WebAuthn 登録 | レスポンス

サーバーはクライアントの登録オプションリクエスト (例: POST /sgcWebAuthn/Registration/Options) に対して、バイナリフィールドを base64url エンコードした後、以下のような JSON ペイロードで応答します:

 

{
"publicKey": {
"rp": {
"name": "esegece software",
"id": "esegece.com"
},
"user": {
"id": "c3ViamVjdC1pZA", // base64url でエンコードされた ArrayBuffer(ユーザーハンドル)
"name": "webauthn@esegece.com",
"displayName": "Delphi Developer"
},
"challenge": "Xz8x2K6nY3gZ...", // base64url でエンコードされたチャレンジ
"pubKeyCredParams": [
{ "type": "public-key", "alg": -7 }, // ES256
{ "type": "public-key", "alg": -257 } // RS256
],
"timeout": 60000,
"attestation": "none",
"authenticatorSelection": {
"authenticatorAttachment": "platform",
"userVerification": "preferred",
"residentKey": "discouraged"
}
}
}

 

 

フィールドの説明を以下に示します:

 

 

クライアントにレスポンスを送信する前に、OnWebAuthnRegistrationOptionsResponse イベントが呼び出され、レスポンスをカスタマイズできます。

 


procedure OnWebAuthnRegistrationOptionsResponse(Sender: TObject; const aRequest: TsgcWebAuthn_RegistrationOptions_Request; const aResponse: TsgcWebAuthn_RegistrationOptions_Response);
begin
  if aRequest.Username = 'esegece.com' then
  begin
    aResponse.ExcludeCredentials.AddCredentialRecordFromJSON('json1.txt');
    aResponse.ExcludeCredentials.AddCredentialRecordFromJSON('json2.txt');
  end;
end;