-
Notifications
You must be signed in to change notification settings - Fork 0
/
WebAuthn256r1.sol
34 lines (31 loc) · 1.08 KB
/
WebAuthn256r1.sol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.19 <0.9.0;
import { ECDSA256r1 } from "../lib/secp256r1-verify/src/ECDSA256r1.sol";
import { WebAuthnBase } from "./WebAuthnBase.sol";
/// @title WebAuthn256r1
/// @notice A library to verify ECDSA signature though WebAuthn on the secp256r1 curve
/// @custom:experimental This is an experimental library.
contract WebAuthn256r1 is WebAuthnBase {
/// @notice Verify ECDSA signature though WebAuthn on the secp256r1 curve
function verify(
bytes1 authenticatorDataFlagMask,
bytes calldata authenticatorData,
bytes calldata clientData,
bytes calldata clientChallenge,
uint256 clientChallengeOffset,
uint256 r,
uint256 s,
uint256 qx,
uint256 qy
)
external
returns (bool)
{
unchecked {
bytes32 message = generateMessage(
authenticatorDataFlagMask, authenticatorData, clientData, clientChallenge, clientChallengeOffset
);
return ECDSA256r1.verify(message, r, s, qx, qy);
}
}
}