WebAuthn Level2 と Level3 の違いを見る

5.1. PublicKeyCredential Interface
登録(navigator.credentials.create)と認証(navigator.credentials.gei)のAPIのレスポンスオブジェクト
[SecureContext, Exposed=Window]
interface PublicKeyCredential : Credential {
[SameObject] readonly attribute ArrayBuffer rawId;
[SameObject] readonly attribute AuthenticatorResponse response;
[SameObject] readonly attribute DOMString? authenticatorAttachment; ← ★追加
AuthenticationExtensionsClientOutputs getClientExtensionResults();
static Promise<boolean> isConditionalMediationAvailable(); ← ★追加
PublicKeyCredentialJSON toJSON(); ←★追加
};
authenticatorAttachment
- 以下のいずれかの値が設定される
enum AuthenticatorAttachment {
"platform",
"cross-platform"
};
- 登録や認証時にどのタイプのAuthenticatorを使ったのかが設定される。登録時にcross-platformだったことを記憶しておけば認証時にcross-platformだけを受け付けるような操作画面にすることに利用できる
isConditionalMediationAvailable()
- ConditionalMediationオプションが利用可能かどうかをture/falseで返す
- 以下のように利用する
if(!PublicKeyCredential.isConditionalMediationAvailable ||
!PublicKeyCredential.isConditionalMediationAvailable()) {
// Browser doesn't support ConditionalMediation.
} else {
options.userVerification = "preferred";
options["mediation"] = "conditional";
}
navigator.credentials.get({publicKey: options, signal: abortSignal})
By setting options.mediation to conditional, Relying Parties can indicate that a prominent modal UI should not be shown unless credentials are discovered.
options["mediation"] = "conditional" とすることで、(クレデンシャルが検出されない限り)モーダルUIを表示しないようにすることができる。
→ Conditional UI = Auto Fillとの統合???
toJSON()
RegistrationResponseJSONに変換する。RPに送りつける際に、ArrayBufferの値をbase64urlエンコーディングでDOMStringにエンコードしなくていいだけ便利。

【追加】5.1.8. Deserialize Registration ceremony options - PublicKeyCredential’s parseCreationOptionsFromJSON() Method
RP(js)ではこのメソッドを使用して、オプションのJSONオブジェクトを navigator.credentials.create() にわたす PublicKeyCredentialCreationOptions
に変換することができる。
RPでサーバーからJSONで引き渡されたoptionを手動でbase64urlでコードしなくていいだけ便利

【追加】5.1.9. Deserialize Authentication ceremony options - PublicKeyCredential’s parseRequestOptionsFromJSON() Methods
RP(js)ではこのメソッドを使用して、オプションのJSONオブジェクトを navigator.credentials.get() に渡す PublicKeyCredentialRequestOptions
に変換することができる。
RPでサーバーからJSONで引き渡されたoptionを手動でbase64urlでコードしなくていいだけ便利

5.2. Authenticator Responses (interface AuthenticatorResponse)
navigator.credentials.create()のレスポンス attestation.response.clientDataJSON
→ 追加ナシ

5.3. Parameters for Credential Generation (dictionary PublicKeyCredentialParameters)
navigator.credentials.create()の引数 options.pubKeyCredParams
→ 追加ナシ

Conditional UIとは?
- input要素にフォーカスをあてた時に、ユーザー名の入力補助リストの一部としてWebAuthnのDiscoverable Credentialが表示されるようになる。これはプラットフォーム認証器にResident Keyで保管されているクレデンシャルのユーザー名を取り出して表示する
- ページロード時に navigator.credentials.get() する必要がある

Conditional UIとは?(画面的にどんなもの)
通常の Webauthn UI
モーダルダイアログが出てくるやつ
Conditional UI
モーダルダイアログではなく、テキストボックスにポップアップするやつ
- テキストにカーソルを当てると出てくる
- ここで指紋認証するとそのままログインする