Skip to content

Commit 387972c

Browse files
committed
avoid building the auth data twice
1 parent 1bf33d3 commit 387972c

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

src/Kp2aPasskey.Core/AuthenticatorResponses.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -253,21 +253,21 @@ private byte[] BuildAuthData()
253253
return result;
254254
}
255255

256-
private byte[] BuildAttestationObject()
256+
private byte[] BuildAttestationObject(byte[] authData)
257257
{
258258
// https://www.w3.org/TR/webauthn-3/#attestation-object
259259
var cbor = CBORObject.NewMap()
260260
.Add("fmt", "none")
261261
.Add("attStmt", CBORObject.NewMap())
262-
.Add("authData", BuildAuthData());
262+
.Add("authData", authData);
263263

264264
return cbor.EncodeToBytes();
265265
}
266266

267267
public JSONObject ToJson()
268268
{
269269
var authData = BuildAuthData();
270-
var attestationObject = BuildAttestationObject();
270+
var attestationObject = BuildAttestationObject(authData);
271271

272272
var json = new JSONObject();
273273
json.Put("clientDataJSON", clientDataResponse.BuildResponse());

0 commit comments

Comments
 (0)