Skip to content

Commit 8f22525

Browse files
authored
Merge pull request #1117 from webauthn4j/update-note-regarding-safari
Update note regarding WebAuthn JSON methods regarding Safari
2 parents 59ef34a + 939bc95 commit 8f22525

4 files changed

Lines changed: 4 additions & 4 deletions

File tree

docs/src/reference/asciidoc/en/deep-dive.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ A `ObjectConverter` with a `DeviceCheckCBORModule` can be obtained with `DeviceC
119119

120120
=== Alternative to Unsupported JSON Serialization APIs in Safari
121121

122-
In the Quick Start, `PublicKeyCredential.parseCreationOptionsFromJSON` is introduced as an API for parsing `PublicKeyCredentialCreationOptions`, and `PublicKeyCredential#toJSON` as an API for serializing `PublicKeyCredential`. However, as of today(December 2024), these APIs are not available in Safari.
122+
In the Quick Start, `PublicKeyCredential.parseCreationOptionsFromJSON` is introduced as an API for parsing `PublicKeyCredentialCreationOptions`, and `PublicKeyCredential#toJSON` as an API for serializing `PublicKeyCredential`. However, these APIs are not available on Safari versions earlier than 18.4.
123123

124124
As an alternative, it is recommended to use the pony-fill provided by the npm library https://github.com/github/webauthn-json[github/@webauthn-json], maintained by GitHub.
125125
It provides `parseCreationOptionsFromJSON` method as a substitute for `PublicKeyCredential.parseCreationOptionsFromJSON` and `create` as a substitute for `navigator.credentials.create`.

docs/src/reference/asciidoc/en/quick-start.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ If no wrapper library is available, you will need to implement these functions y
147147
When calling the `navigator.credentials.create` method, various options can be specified. One of these options is `challenge`. As mentioned earlier, the challenge is a parameter used to prevent replay attacks; it should be generated by the server, passed as a parameter, and also saved in a session or similar storage.
148148
According to the registration flow diagram, the backend server first generates the challenge, saves it in a session, and then sends it to the client.
149149
The WebAuthn specification does not define a specific method for passing the challenge from the backend server to the frontend. You could embed it in an HTML page or set up a REST endpoint to return the challenge. Another good idea is to create an endpoint that returns the entire `PublicKeyCredentialCreationOptions`, a parameter for `navigator.credentials.create`. The WebAuthn JavaScript API provides a method called `PublicKeyCredential.parseCreationOptionsFromJSON`, which can parse a serialized JSON `PublicKeyCredentialCreationOptions`.
150-
However, as of December 2024, `PublicKeyCredential.parseCreationOptionsFromJSON` is not available in Safari.
150+
However, `PublicKeyCredential.parseCreationOptionsFromJSON` is not available on Safari versions earlier than 18.4.
151151
For alternative solutions, refer to <<./deep-dive.adoc#_alternative_to_unsupported_json_serialization_apis_in_safari, Alternative to Unsupported JSON Serialization APIs in Safari>>.
152152

153153
WebAuthn4J offers a Java class representing `PublicKeyCredentialCreationOptions`, which can be useful for assembling JSON on the backend server.

docs/src/reference/asciidoc/ja/deep-dive.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ webauthn4j-appattestでは、`CredentialRecord` インタフェースの代わ
110110
=== Safariで未サポートなJSON serialization APIsの代替
111111

112112
クイックスタートでは、 `PublicKeyCredentialCreationOptions` をパースするAPIとして `PublicKeyCredential.parseCreationOptionsFromJSON` が、
113-
`PublicKeyCredential` をシリアライズするAPIとして `PublicKeyCredential#toJSON` が存在すると紹介しましたが、2024/12現在、Safariでは利用できません
113+
`PublicKeyCredential` をシリアライズするAPIとして `PublicKeyCredential#toJSON` が存在すると紹介しましたが、Safariでは18.4以降でしか利用できません
114114
代わりとして、GitHubが提供するnpmライブラリ、 https://github.com/github/webauthn-json[github/@webauthn-json] が提供する、 pony-fillを利用するのがお勧めです。
115115
`PublicKeyCredential.parseCreationOptionsFromJSON` の代わりに、 `parseCreationOptionsFromJSON` が、
116116
`naviagator.credentials.create` の代わりに `create` が提供されています。

docs/src/reference/asciidoc/ja/quick-start.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ WebAuthnの鍵ペアの生成において中心となるAPIは、ブラウザの
161161
HTMLページに埋め込んでも良いですし、チャレンジを返却するRESTエンドポイントを用意することも可能です。
162162
`navigator.credentials.create` メソッドのパラメータである、 `PublicKeyCredentialCreationOptions` 全体を返却するエンドポイントを用意するのも良いアイデアでしょう。
163163
WebAuthnのJava Script APIには、 `PublicKeyCredential.parseCreationOptionsFromJSON` というメソッドが用意されており、JSONとしてシリアライズされた `PublicKeyCredentialCreationOptions` をパースすることが可能です。
164-
但し、2024/12現在、Safariでは `PublicKeyCredential.parseCreationOptionsFromJSON` が利用できません。代替策については、<<./deep-dive.adoc#Safariで未サポートなJSON serialization APIsの代替,Safariで未サポートなJSON serialization APIsの代替>> を参照してください。
164+
但し、SafariではSafari 18.4以降でしか `PublicKeyCredential.parseCreationOptionsFromJSON` が利用できません。代替策については、<<./deep-dive.adoc#Safariで未サポートなJSON serialization APIsの代替,Safariで未サポートなJSON serialization APIsの代替>> を参照してください。
165165

166166
WebAuthn4Jは `PublicKeyCredentialCreationOptions` を表現するJavaのクラスを提供しており、バックエンドサーバー側でJSONを組み立てる際にご活用頂けます。
167167

0 commit comments

Comments
 (0)