Skip to content

Commit

Permalink
⬆️ upgrade @webauthn to v1.0.0
Browse files Browse the repository at this point in the history
This version introduces a breaking change
  • Loading branch information
qd-qd committed Mar 6, 2024
1 parent 920ee4c commit 28944ee
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 47 deletions.
2 changes: 1 addition & 1 deletion lib/webauthn.git
11 changes: 1 addition & 10 deletions script/WebAuthn256r1/02_WebAuthn256r1Verify.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,13 @@ contract WebAuthn256r1Verify is BaseScript {
bytes memory authenticatorData = vm.envBytes("AUTH_DATA");
bytes memory clientData = vm.envBytes("CLIENT_DATA");
bytes memory clientChallenge = vm.envBytes("CLIENT_CHALLENGE");
uint256 clientChallengeOffset = vm.envUint("CLIENT_CHALLENGE_OFFSET");
uint256 r = vm.envUint("R");
uint256 s = vm.envUint("S");
uint256 qx = vm.envUint("QX");
uint256 qy = vm.envUint("QY");

return WebAuthn256r1Wrapper(verifierAddress).verify(
authenticatorDataFlagMask,
authenticatorData,
clientData,
clientChallenge,
clientChallengeOffset,
r,
s,
qx,
qy
authenticatorDataFlagMask, authenticatorData, clientData, clientChallenge, r, s, qx, qy
);
}
}
Expand Down
15 changes: 2 additions & 13 deletions script/WebAuthn256r1/WebAuthn256r1Wrapper.sol
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ contract WebAuthn256r1Wrapper is IWebAuthn256r1 {
bytes1 authenticatorDataFlagMask,
bytes calldata authenticatorData,
bytes calldata clientData,
bytes calldata clientChallenge,
uint256 clientChallengeOffset,
bytes calldata challenge,
uint256 r,
uint256 s,
uint256 qx,
Expand All @@ -21,16 +20,6 @@ contract WebAuthn256r1Wrapper is IWebAuthn256r1 {
external
returns (bool)
{
return WebAuthn256r1.verify(
authenticatorDataFlagMask,
authenticatorData,
clientData,
clientChallenge,
clientChallengeOffset,
r,
s,
qx,
qy
);
return WebAuthn256r1.verify(authenticatorDataFlagMask, authenticatorData, clientData, challenge, r, s, qx, qy);
}
}
14 changes: 1 addition & 13 deletions src/SignerVaultWebAuthnP256R1.sol
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,6 @@ library SignerVaultWebAuthnP256R1 {
/// we use this field to pass the arbitrary execution order.
/// This value is expected to not be encoded in Base64, the encoding is done
/// during the verification.
/// @param clientChallengeOffset The offset of the client challenge in the client data
/// @param r uint256 The r value of the ECDSA signature.
/// @param s uint256 The s value of the ECDSA signature.
/// @param qx The x value of the public key used for the signature
Expand All @@ -203,7 +202,6 @@ library SignerVaultWebAuthnP256R1 {
bytes calldata authenticatorData,
bytes calldata clientData,
bytes calldata clientChallenge,
uint256 clientChallengeOffset,
uint256 r,
uint256 s,
uint256 qx,
Expand All @@ -212,16 +210,6 @@ library SignerVaultWebAuthnP256R1 {
internal
returns (bool)
{
return verifier.verify(
authenticatorDataFlagMask,
authenticatorData,
clientData,
clientChallenge,
clientChallengeOffset,
r,
s,
qx,
qy
);
return verifier.verify(authenticatorDataFlagMask, authenticatorData, clientData, clientChallenge, r, s, qx, qy);
}
}
10 changes: 0 additions & 10 deletions test/unit/SignerVault/signerVaultWebAuthnP256R1.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,6 @@ contract SignerVault__WebAuthnP256R1 is BaseTest {
hex"7a6c7169316f776d4f643955474a30222c226f726967696e223a226874747073"
hex"3a2f2f66726573682e6c65646765722e636f6d222c2263726f73734f726967696e223a66616c73657d";
bytes memory clientChallenge = hex"353a3ed5a0441919f1c639a46931de872ac3357de2ce5aa2d68c2639df54189d";
uint256 clientChallengeOffset = 0x24;
uint256 r =
45_847_212_378_479_006_099_766_816_358_861_726_414_873_720_355_505_495_069_909_394_794_949_093_093_607;
uint256 s =
Expand All @@ -321,7 +320,6 @@ contract SignerVault__WebAuthnP256R1 is BaseTest {
authenticatorData,
clientData,
clientChallenge,
clientChallengeOffset,
r,
s,
qx,
Expand All @@ -341,8 +339,6 @@ contract SignerVault__WebAuthnP256R1 is BaseTest {
clientData,
// clientChallenge
clientChallenge,
// clientChallengeOffset
clientChallengeOffset,
// r
r,
// s
Expand All @@ -365,7 +361,6 @@ contract SignerVault__WebAuthnP256R1 is BaseTest {
hex"7a6c7169316f776d4f643955474a30222c226f726967696e223a226874747073"
hex"3a2f2f66726573682e6c65646765722e636f6d222c2263726f73734f726967696e223a66616c73657d";
bytes memory clientChallenge = hex"353a3ed5a0441919f1c639a46931de872ac3357de2ce5aa2d68c2639df54189d";
uint256 clientChallengeOffset = 0x24;
// incorrect R
uint256 r =
46_847_212_378_479_006_099_766_816_358_861_726_414_873_720_355_505_495_069_909_394_794_949_093_093_607;
Expand All @@ -385,7 +380,6 @@ contract SignerVault__WebAuthnP256R1 is BaseTest {
authenticatorData,
clientData,
clientChallenge,
clientChallengeOffset,
r,
s,
qx,
Expand All @@ -405,8 +399,6 @@ contract SignerVault__WebAuthnP256R1 is BaseTest {
clientData,
// clientChallenge
clientChallenge,
// clientChallengeOffset
clientChallengeOffset,
// r
r,
// s
Expand Down Expand Up @@ -505,7 +497,6 @@ contract SignerVaultWebAuthnP256R1TestWrapper {
bytes calldata authenticatorData,
bytes calldata clientData,
bytes calldata clientChallenge,
uint256 clientChallengeOffset,
uint256 r,
uint256 s,
uint256 qx,
Expand All @@ -520,7 +511,6 @@ contract SignerVaultWebAuthnP256R1TestWrapper {
authenticatorData,
clientData,
clientChallenge,
clientChallengeOffset,
r,
s,
qx,
Expand Down

0 comments on commit 28944ee

Please sign in to comment.