@charterlabs/rhinestone-sdk 0.4.4 → 0.4.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/accounts/signing/common.d.ts +1 -1
- package/dist/src/accounts/signing/common.d.ts.map +1 -1
- package/dist/src/accounts/signing/common.js +9 -12
- package/dist/src/accounts/signing/mfa-webauthn.d.ts +30 -12
- package/dist/src/accounts/signing/mfa-webauthn.d.ts.map +1 -1
- package/dist/src/accounts/signing/mfa-webauthn.js +45 -56
- package/dist/src/accounts/signing/passkeys.d.ts +2 -2
- package/dist/src/accounts/signing/passkeys.d.ts.map +1 -1
- package/dist/src/accounts/signing/passkeys.js +2 -12
- package/dist/src/modules/validators/core.d.ts.map +1 -1
- package/dist/src/modules/validators/core.js +16 -7
- package/dist/src/modules/validators/webauthn-contract.d.ts +1 -4
- package/dist/src/modules/validators/webauthn-contract.d.ts.map +1 -1
- package/dist/src/modules/validators/webauthn-contract.js +2 -3
- package/package.json +1 -1
|
@@ -20,7 +20,7 @@ type SigningFunctions<T> = {
|
|
|
20
20
|
declare function signWithMultiFactorAuth<T>(signers: SignerSet & {
|
|
21
21
|
type: 'owner';
|
|
22
22
|
kind: 'multi-factor';
|
|
23
|
-
}, chain: Chain, address: Address, params: T, isUserOpHash: boolean, signMain: (signers: SignerSet, chain: Chain, address: Address, params: T, isUserOpHash: boolean) => Promise<Hex>): Promise<Hex>;
|
|
23
|
+
}, chain: Chain, address: Address, params: T, isUserOpHash: boolean, signMain: (signers: SignerSet, chain: Chain, address: Address, params: T, isUserOpHash: boolean) => Promise<Hex>, signingFunctions: SigningFunctions<T>): Promise<Hex>;
|
|
24
24
|
declare function signWithSession(signers: ResolvedSessionSignerSet, chain: Chain, address: Address, hash: Hex, signMain: (signers: SignerSet, chain: Chain, address: Address, hash: Hex, isUserOpHash: boolean) => Promise<Hex>): Promise<Hex>;
|
|
25
25
|
declare function signWithGuardians<T>(signers: SignerSet & {
|
|
26
26
|
type: 'guardians';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../../accounts/signing/common.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,OAAO,EACZ,KAAK,OAAO,EACZ,KAAK,KAAK,EAMV,KAAK,GAAG,EAIT,MAAM,MAAM,CAAA;AACb,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAA;AAQ/D,OAAO,EAEL,KAAK,wBAAwB,EAC9B,MAAM,yCAAyC,CAAA;AAChD,OAAO,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAUtD,iBAAS,0BAA0B,CAAC,MAAM,EAAE,QAAQ,GAAG,SAAS,CAkE/D;AAED,KAAK,oBAAoB,GAAG;IAC1B,iBAAiB,EAAE,GAAG,CAAA;IACtB,cAAc,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IACnC,cAAc,EAAE,MAAM,CAAA;IACtB,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAC9B,wBAAwB,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;CAC/C,CAAA;AAED,KAAK,gBAAgB,CAAC,CAAC,IAAI;IACzB,SAAS,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,EAAE,OAAO,EAAE,OAAO,KAAK,OAAO,CAAC,GAAG,CAAC,CAAA;IAC1E,WAAW,EAAE,CACX,OAAO,EAAE,eAAe,EACxB,MAAM,EAAE,CAAC,KACN,OAAO,CAAC;QACX,QAAQ,EAAE,oBAAoB,CAAA;QAC9B,SAAS,EAAE,GAAG,CAAA;KACf,CAAC,CAAA;CACH,CAAA;
|
|
1
|
+
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../../accounts/signing/common.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,OAAO,EACZ,KAAK,OAAO,EACZ,KAAK,KAAK,EAMV,KAAK,GA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SetToSignerSet(owners) {
|
|
|
79
79
|
function encodeValidatorId(id) {
|
|
80
80
|
return (0, viem_1.padHex)(typeof id === 'number' ? (0, viem_1.toHex)(id) : id, { size: 12 });
|
|
81
81
|
}
|
|
82
|
-
async function signMfaSubValidator(validator, chain, address, params, isUserOpHash, signMain) {
|
|
82
|
+
async function signMfaSubValidator(validator, chain, address, params, isUserOpHash, signMain, signingFunctions) {
|
|
83
83
|
if (validator === null) {
|
|
84
84
|
return '0x';
|
|
85
85
|
}
|
|
86
86
|
if (validator.type === 'passkey') {
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
accounts: validator.accounts,
|
|
91
|
-
}, chain, address, params, isUserOpHash);
|
|
87
|
+
// Sign each account directly and encode as a bare WebAuthnAuth[] sorted by
|
|
88
|
+
// the 2-arg MFA credential ID — matching WebAuthVerificationContext ordering.
|
|
89
|
+
const signResults = await Promise.all(validator.accounts.map((account) => signingFunctions.signPasskey(account, params)));
|
|
92
90
|
return (0, mfa_webauthn_1.encodeMfaWebAuthnSignatureForAccounts)({
|
|
93
|
-
passkeySignature: signature,
|
|
94
91
|
accounts: validator.accounts,
|
|
95
|
-
|
|
92
|
+
signResults,
|
|
96
93
|
});
|
|
97
94
|
}
|
|
98
95
|
const validatorSigners = convertOwnerSetToSignerSet(validator);
|
|
99
96
|
return signMain(validatorSigners, chain, address, params, isUserOpHash);
|
|
100
97
|
}
|
|
101
|
-
async function signWithMultiFactorAuth(signers, chain, address, params, isUserOpHash, signMain) {
|
|
98
|
+
async function signWithMultiFactorAuth(signers, chain, address, params, isUserOpHash, signMain, signingFunctions) {
|
|
102
99
|
const validators = signers.validators.filter((validator) => validator !== null);
|
|
103
|
-
const signatures = await Promise.all(validators.map((validator) => signMfaSubValidator(validator, chain, address, params, isUserOpHash, signMain)));
|
|
100
|
+
const signatures = await Promise.all(validators.map((validator) => signMfaSubValidator(validator, chain, address, params, isUserOpHash, signMain, signingFunctions)));
|
|
104
101
|
const data = (0, viem_1.encodeAbiParameters)([
|
|
105
102
|
{
|
|
106
103
|
components: [
|
|
@@ -178,7 +175,7 @@ async function signWithOwners(signers, chain, address, params, signingFunctions,
|
|
|
178
175
|
const credIds = signers.accounts.map((account) => {
|
|
179
176
|
const publicKey = account.publicKey;
|
|
180
177
|
const { x, y } = (0, passkeys_1.parsePublicKey)(publicKey);
|
|
181
|
-
return (0, passkeys_1.generateCredentialId)(x, y
|
|
178
|
+
return (0, passkeys_1.generateCredentialId)(x, y);
|
|
182
179
|
});
|
|
183
180
|
const webAuthns = signatures.map((signature) => {
|
|
184
181
|
const { r, s } = (0, passkeys_1.parseSignature)(signature.signature);
|
|
@@ -197,7 +194,7 @@ async function signWithOwners(signers, chain, address, params, signingFunctions,
|
|
|
197
194
|
return (0, passkeys_1.packSignature)(credIds, usePrecompile, webAuthns);
|
|
198
195
|
}
|
|
199
196
|
case 'multi-factor': {
|
|
200
|
-
return signWithMultiFactorAuth(signers, chain, address, params, isUserOpHash, signMain);
|
|
197
|
+
return signWithMultiFactorAuth(signers, chain, address, params, isUserOpHash, signMain, signingFunctions);
|
|
201
198
|
}
|
|
202
199
|
default: {
|
|
203
200
|
throw new Error('Unsupported owner kind');
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type Hex } from 'viem';
|
|
2
2
|
import type { WebAuthnAccount } from 'viem/account-abstraction';
|
|
3
3
|
import { type WebAuthnSignature } from './passkeys';
|
|
4
4
|
type WebAuthnCredentialData = {
|
|
@@ -6,24 +6,42 @@ type WebAuthnCredentialData = {
|
|
|
6
6
|
pubKeyY: bigint;
|
|
7
7
|
requireUV?: boolean;
|
|
8
8
|
};
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
/**
|
|
10
|
+
* Encodes the WebAuthVerificationContext blob stored by MultiFactor for the
|
|
11
|
+
* WebAuthn sub-validator. Passed as `validatorStorageData` when MultiFactor
|
|
12
|
+
* calls WebAuthnValidator.validateSignatureWithData.
|
|
13
|
+
*
|
|
14
|
+
* Credential IDs are keccak256(abi.encode(pubKeyX, pubKeyY)) — matching
|
|
15
|
+
* WebAuthnValidator.generateCredentialId exactly.
|
|
16
|
+
*/
|
|
14
17
|
declare function encodeMfaWebAuthnValidatorData(input: {
|
|
15
18
|
usePrecompile: boolean;
|
|
16
19
|
threshold: number;
|
|
17
20
|
credentials: WebAuthnCredentialData[];
|
|
18
21
|
}): Hex;
|
|
19
|
-
|
|
22
|
+
/**
|
|
23
|
+
* Encodes a sorted WebAuthnAuth[] array as the `signature` argument for
|
|
24
|
+
* WebAuthnValidator.validateSignatureWithData.
|
|
25
|
+
*/
|
|
20
26
|
declare function encodeMfaWebAuthnSignature(webAuthns: WebAuthnSignature[]): Hex;
|
|
21
|
-
|
|
27
|
+
type PasskeySignResult = {
|
|
28
|
+
webauthn: {
|
|
29
|
+
authenticatorData: Hex;
|
|
30
|
+
clientDataJSON: string;
|
|
31
|
+
challengeIndex?: number | undefined;
|
|
32
|
+
typeIndex?: number | undefined;
|
|
33
|
+
};
|
|
34
|
+
signature: Hex;
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* Produces the MFA sub-validator signature (bare WebAuthnAuth[]) directly from
|
|
38
|
+
* raw sign results. Entries are sorted by credential ID — keccak256(abi.encode(x, y))
|
|
39
|
+
* — matching the ordering stored in WebAuthVerificationContext.credentialIds.
|
|
40
|
+
*/
|
|
22
41
|
declare function encodeMfaWebAuthnSignatureForAccounts(input: {
|
|
23
|
-
passkeySignature: Hex;
|
|
24
42
|
accounts: WebAuthnAccount[];
|
|
25
|
-
|
|
43
|
+
signResults: PasskeySignResult[];
|
|
26
44
|
}): Hex;
|
|
27
|
-
export {
|
|
28
|
-
export type { WebAuthnCredentialData };
|
|
45
|
+
export { encodeMfaWebAuthnValidatorData, encodeMfaWebAuthnSignature, encodeMfaWebAuthnSignatureForAccounts, };
|
|
46
|
+
export type { WebAuthnCredentialData, PasskeySignResult };
|
|
29
47
|
//# sourceMappingURL=mfa-webauthn.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mfa-webauthn.d.ts","sourceRoot":"","sources":["../../../../accounts/signing/mfa-webauthn.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"mfa-webauthn.d.ts","sourceRoot":"","sources":["../../../../accounts/signing/mfa-webauthn.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,KAAK,GAAG,EAAE,MAAM,MAAM,CAAA;AACpD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAA;AAC/D,OAAO,EAIL,KAAK,iBAAiB,EACvB,MAAM,YAAY,CAAA;AAEnB,KAAK,sBAAsB,GAAG;IAC5B,OAAO,EAAE,MAAM,CAAA;IACf,OAAO,EAAE,MAAM,CAAA;IACf,SAAS,CAAC,EAAE,OAAO,CAAA;CACpB,CAAA;AA2CD;;;;;;;GAOG;AACH,iBAAS,8BAA8B,CAAC,KAAK,EAAE;IAC7C,aAAa,EAAE,OAAO,CAAA;IACtB,SAAS,EAAE,MAAM,CAAA;IACjB,WAAW,EAAE,sBAAsB,EAAE,CAAA;CACtC,GAAG,GAAG,CAuBN;AAED;;;GAGG;AACH,iBAAS,0BAA0B,CAAC,SAAS,EAAE,iBAAiB,EAAE,GAAG,GAAG,CAEvE;AAED,KAAK,iBAAiB,GAAG;IACvB,QAAQ,EAAE;QACR,iBAAiB,EAAE,GAAG,CAAA;QACtB,cAAc,EAAE,MAAM,CAAA;QACtB,cAAc,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;QACnC,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;KAC/B,CAAA;IACD,SAAS,EAAE,GAAG,CAAA;CACf,CAAA;AAED;;;;GAIG;AACH,iBAAS,qCAAqC,CAAC,KAAK,EAAE;IACpD,QAAQ,EAAE,eAAe,EAAE,CAAA;IAC3B,WAAW,EAAE,iBAAiB,EAAE,CAAA;CACjC,GAAG,GAAG,CAgCN;AAED,OAAO,EACL,8BAA8B,EAC9B,0BAA0B,EAC1B,qCAAqC,GACtC,CAAA;AACD,YAAY,EAAE,sBAAsB,EAAE,iBAAiB,EAAE,CAAA"}
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.encodeMfaWebAuthnValidatorData = encodeMfaWebAuthnValidatorData;
|
|
4
4
|
exports.encodeMfaWebAuthnSignature = encodeMfaWebAuthnSignature;
|
|
5
5
|
exports.encodeMfaWebAuthnSignatureForAccounts = encodeMfaWebAuthnSignatureForAccounts;
|
|
6
|
-
exports.encodeMfaWebAuthnValidatorData = encodeMfaWebAuthnValidatorData;
|
|
7
|
-
exports.extractMfaWebAuthnSignatureFromPasskeySignature = extractMfaWebAuthnSignatureFromPasskeySignature;
|
|
8
|
-
exports.generateMfaWebAuthnCredentialId = generateMfaWebAuthnCredentialId;
|
|
9
6
|
const viem_1 = require("viem");
|
|
10
7
|
const passkeys_1 = require("./passkeys");
|
|
8
|
+
// ABI fragment for a WebAuthnAuth tuple array — the exact format expected by
|
|
9
|
+
// WebAuthnValidator.validateSignatureWithData as its `signature` argument.
|
|
11
10
|
const webAuthnAuthAbiParameter = {
|
|
12
11
|
type: 'tuple[]',
|
|
13
12
|
name: 'webAuthns',
|
|
@@ -20,11 +19,8 @@ const webAuthnAuthAbiParameter = {
|
|
|
20
19
|
{ type: 'uint256', name: 's' },
|
|
21
20
|
],
|
|
22
21
|
};
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
{ type: 'bool', name: 'usePrecompile' },
|
|
26
|
-
webAuthnAuthAbiParameter,
|
|
27
|
-
];
|
|
22
|
+
// ABI fragment for WebAuthVerificationContext — stored by MultiFactor as
|
|
23
|
+
// `validatorStorageData` and passed to validateSignatureWithData as `data`.
|
|
28
24
|
const webAuthnMfaContextAbiParameter = {
|
|
29
25
|
type: 'tuple',
|
|
30
26
|
name: 'context',
|
|
@@ -44,25 +40,22 @@ const webAuthnMfaContextAbiParameter = {
|
|
|
44
40
|
],
|
|
45
41
|
};
|
|
46
42
|
function compareHex(left, right) {
|
|
47
|
-
if (left === right)
|
|
43
|
+
if (left === right)
|
|
48
44
|
return 0;
|
|
49
|
-
}
|
|
50
45
|
return left < right ? -1 : 1;
|
|
51
46
|
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
], [pubKeyX, pubKeyY]));
|
|
61
|
-
}
|
|
47
|
+
/**
|
|
48
|
+
* Encodes the WebAuthVerificationContext blob stored by MultiFactor for the
|
|
49
|
+
* WebAuthn sub-validator. Passed as `validatorStorageData` when MultiFactor
|
|
50
|
+
* calls WebAuthnValidator.validateSignatureWithData.
|
|
51
|
+
*
|
|
52
|
+
* Credential IDs are keccak256(abi.encode(pubKeyX, pubKeyY)) — matching
|
|
53
|
+
* WebAuthnValidator.generateCredentialId exactly.
|
|
54
|
+
*/
|
|
62
55
|
function encodeMfaWebAuthnValidatorData(input) {
|
|
63
56
|
const credentials = input.credentials
|
|
64
57
|
.map((credential) => ({
|
|
65
|
-
credentialId:
|
|
58
|
+
credentialId: (0, passkeys_1.generateCredentialId)(credential.pubKeyX, credential.pubKeyY),
|
|
66
59
|
credentialData: {
|
|
67
60
|
pubKeyX: credential.pubKeyX,
|
|
68
61
|
pubKeyY: credential.pubKeyY,
|
|
@@ -74,51 +67,47 @@ function encodeMfaWebAuthnValidatorData(input) {
|
|
|
74
67
|
{
|
|
75
68
|
usePrecompile: input.usePrecompile,
|
|
76
69
|
threshold: BigInt(input.threshold),
|
|
77
|
-
credentialIds: credentials.map((
|
|
78
|
-
credentialData: credentials.map((
|
|
70
|
+
credentialIds: credentials.map((c) => c.credentialId),
|
|
71
|
+
credentialData: credentials.map((c) => c.credentialData),
|
|
79
72
|
},
|
|
80
73
|
]);
|
|
81
74
|
}
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
webAuthns: webAuthns.map((webAuthn) => ({
|
|
87
|
-
authenticatorData: webAuthn.authenticatorData,
|
|
88
|
-
clientDataJSON: webAuthn.clientDataJSON,
|
|
89
|
-
challengeIndex: BigInt(webAuthn.challengeIndex),
|
|
90
|
-
typeIndex: BigInt(webAuthn.typeIndex),
|
|
91
|
-
r: BigInt(webAuthn.r),
|
|
92
|
-
s: BigInt(webAuthn.s),
|
|
93
|
-
})),
|
|
94
|
-
};
|
|
95
|
-
}
|
|
75
|
+
/**
|
|
76
|
+
* Encodes a sorted WebAuthnAuth[] array as the `signature` argument for
|
|
77
|
+
* WebAuthnValidator.validateSignatureWithData.
|
|
78
|
+
*/
|
|
96
79
|
function encodeMfaWebAuthnSignature(webAuthns) {
|
|
97
80
|
return (0, viem_1.encodeAbiParameters)([webAuthnAuthAbiParameter], [webAuthns]);
|
|
98
81
|
}
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
82
|
+
/**
|
|
83
|
+
* Produces the MFA sub-validator signature (bare WebAuthnAuth[]) directly from
|
|
84
|
+
* raw sign results. Entries are sorted by credential ID — keccak256(abi.encode(x, y))
|
|
85
|
+
* — matching the ordering stored in WebAuthVerificationContext.credentialIds.
|
|
86
|
+
*/
|
|
102
87
|
function encodeMfaWebAuthnSignatureForAccounts(input) {
|
|
103
|
-
const
|
|
104
|
-
const
|
|
105
|
-
credId.toLowerCase(),
|
|
106
|
-
decoded.webAuthns[index],
|
|
107
|
-
]));
|
|
108
|
-
const webAuthns = input.accounts
|
|
109
|
-
.map((account) => {
|
|
88
|
+
const { accounts, signResults } = input;
|
|
89
|
+
const entries = accounts.map((account, index) => {
|
|
110
90
|
const { x, y } = (0, passkeys_1.parsePublicKey)(account.publicKey);
|
|
111
|
-
const
|
|
112
|
-
const
|
|
113
|
-
if (!
|
|
114
|
-
throw new Error('Missing WebAuthn
|
|
91
|
+
const credentialId = (0, passkeys_1.generateCredentialId)(x, y);
|
|
92
|
+
const sigResult = signResults[index];
|
|
93
|
+
if (!sigResult) {
|
|
94
|
+
throw new Error('Missing WebAuthn sign result for MFA credential');
|
|
115
95
|
}
|
|
96
|
+
const { r, s } = (0, passkeys_1.parseSignature)(sigResult.signature);
|
|
116
97
|
return {
|
|
117
|
-
credentialId
|
|
118
|
-
webAuthn
|
|
98
|
+
credentialId,
|
|
99
|
+
webAuthn: {
|
|
100
|
+
authenticatorData: sigResult.webauthn.authenticatorData,
|
|
101
|
+
clientDataJSON: sigResult.webauthn.clientDataJSON,
|
|
102
|
+
challengeIndex: BigInt(sigResult.webauthn.challengeIndex ?? 0),
|
|
103
|
+
typeIndex: BigInt(sigResult.webauthn.typeIndex ?? 0),
|
|
104
|
+
r,
|
|
105
|
+
s,
|
|
106
|
+
},
|
|
119
107
|
};
|
|
120
|
-
})
|
|
108
|
+
});
|
|
109
|
+
const sorted = entries
|
|
121
110
|
.sort((left, right) => compareHex(left.credentialId, right.credentialId))
|
|
122
111
|
.map(({ webAuthn }) => webAuthn);
|
|
123
|
-
return encodeMfaWebAuthnSignature(
|
|
112
|
+
return encodeMfaWebAuthnSignature(sorted);
|
|
124
113
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type Hex } from 'viem';
|
|
2
2
|
interface WebAuthnSignature {
|
|
3
3
|
authenticatorData: Hex;
|
|
4
4
|
clientDataJSON: string;
|
|
@@ -15,7 +15,7 @@ declare function parseSignature(signature: Hex | Uint8Array): {
|
|
|
15
15
|
r: bigint;
|
|
16
16
|
s: bigint;
|
|
17
17
|
};
|
|
18
|
-
declare function generateCredentialId(pubKeyX: bigint, pubKeyY: bigint
|
|
18
|
+
declare function generateCredentialId(pubKeyX: bigint, pubKeyY: bigint): Hex;
|
|
19
19
|
declare function packSignature(credIds: Hex[], usePrecompile: boolean, webAuthns: {
|
|
20
20
|
authenticatorData: Hex;
|
|
21
21
|
clientDataJSON: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"passkeys.d.ts","sourceRoot":"","sources":["../../../../accounts/signing/passkeys.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"passkeys.d.ts","sourceRoot":"","sources":["../../../../accounts/signing/passkeys.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,GAAG,EAGT,MAAM,MAAM,CAAA;AAEb,UAAU,iBAAiB;IACzB,iBAAiB,EAAE,GAAG,CAAA;IACtB,cAAc,EAAE,MAAM,CAAA;IACtB,cAAc,EAAE,MAAM,CAAA;IACtB,SAAS,EAAE,MAAM,CAAA;IACjB,CAAC,EAAE,MAAM,CAAA;IACT,CAAC,EAAE,MAAM,CAAA;CACV;AAED,iBAAS,cAAc,CAAC,SAAS,EAAE,GAAG,GAAG,UAAU,GAAG;IACpD,CAAC,EAAE,MAAM,CAAA;IACT,CAAC,EAAE,MAAM,CAAA;CACV,CAUA;AAED,iBAAS,cAAc,CAAC,SAAS,EAAE,GAAG,GAAG,UAAU,GAAG;IACpD,CAAC,EAAE,MAAM,CAAA;IACT,CAAC,EAAE,MAAM,CAAA;CACV,CASA;AAED,iBAAS,oBAAoB,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,GAAG,CAOnE;AAED,iBAAS,aAAa,CACpB,OAAO,EAAE,GAAG,EAAE,EACd,aAAa,EAAE,OAAO,EACtB,SAAS,EAAE;IACT,iBAAiB,EAAE,GAAG,CAAA;IACtB,cAAc,EAAE,MAAM,CAAA;IACtB,cAAc,EAAE,MAAM,CAAA;IACtB,SAAS,EAAE,MAAM,CAAA;IACjB,CAAC,EAAE,MAAM,CAAA;IACT,CAAC,EAAE,MAAM,CAAA;CACV,EAAE,GACF,GAAG,CAqDL;AAED,iBAAS,eAAe,CACtB,QAAQ,EAAE;IACR,iBAAiB,EAAE,GAAG,CAAA;IACtB,cAAc,EAAE,MAAM,CAAA;IACtB,SAAS,EAAE,MAAM,GAAG,MAAM,CAAA;IAC1B,CAAC,EAAE,MAAM,CAAA;IACT,CAAC,EAAE,MAAM,CAAA;CACV,EACD,cAAc,EAAE,OAAO,iBAqCxB;AAED,OAAO,EACL,cAAc,EACd,cAAc,EACd,oBAAoB,EACpB,aAAa,EACb,eAAe,GAChB,CAAA;AACD,YAAY,EAAE,iBAAiB,EAAE,CAAA"}
|
|
@@ -25,18 +25,8 @@ function parseSignature(signature) {
|
|
|
25
25
|
s: BigInt((0, viem_1.bytesToHex)(s)),
|
|
26
26
|
};
|
|
27
27
|
}
|
|
28
|
-
function generateCredentialId(pubKeyX, pubKeyY
|
|
29
|
-
return (0, viem_1.keccak256)((0, viem_1.encodeAbiParameters)([
|
|
30
|
-
{
|
|
31
|
-
type: 'uint256',
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
type: 'uint256',
|
|
35
|
-
},
|
|
36
|
-
{
|
|
37
|
-
type: 'address',
|
|
38
|
-
},
|
|
39
|
-
], [pubKeyX, pubKeyY, account]));
|
|
28
|
+
function generateCredentialId(pubKeyX, pubKeyY) {
|
|
29
|
+
return (0, viem_1.keccak256)((0, viem_1.encodeAbiParameters)([{ type: 'uint256' }, { type: 'uint256' }], [pubKeyX, pubKeyY]));
|
|
40
30
|
}
|
|
41
31
|
function packSignature(credIds, usePrecompile, webAuthns) {
|
|
42
32
|
// Sort both `credIds` and `webAuthns` by credIds
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../../../modules/validators/core.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,OAAO,EACZ,KAAK,OAAO,EAKZ,KAAK,GAAG,EAKT,MAAM,MAAM,CAAA;AAOb,OAAO,KAAK,EACV,kBAAkB,EAClB,sBAAsB,EACtB,QAAQ,EACR,uBAAuB,EACvB,uBAAuB,EACxB,MAAM,aAAa,CAAA;AAEpB,OAAO,EAA4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B,IAAI,CACP,EAAE,EACH,OAAO,GAAE,+BAAoC,GAC5C,MAAM,CAgDR;AAED,iBAAS,0BAA0B,CACjC,SAAS,EAAE,OAAO,EAAE,EACpB,SAAS,SAAI,GACZ,MAAM,CAsBR;AAeD,iBAAS,cAAc,CAAC,SAAS,EAAE,MAAM,WAUxC;AAED,OAAO,EACL,yBAAyB,EACzB,qBAAqB,EACrB,0BAA0B,EAC1B,8BAA8B,EAC9B,6BAA6B,EAC7B,8BAA8B,EAC9B,kCAAkC,EAClC,iBAAiB,EACjB,mBAAmB,EACnB,eAAe,EACf,oBAAoB,EACpB,uBAAuB,EACvB,0BAA0B,EAC1B,YAAY,EACZ,gBAAgB,EAChB,8BAA8B,EAC9B,cAAc,GACf,CAAA;AACD,YAAY,EAAE,kBAAkB,EAAE,CAAA"}
|
|
@@ -35,6 +35,18 @@ const WEBAUTHN_V0_VALIDATOR_ADDRESS = '0x0000000000578c4cb0e472a5462da43c495c3f3
|
|
|
35
35
|
exports.WEBAUTHN_V0_VALIDATOR_ADDRESS = WEBAUTHN_V0_VALIDATOR_ADDRESS;
|
|
36
36
|
const ECDSA_MOCK_SIGNATURE = '0x81d4b4981670cb18f99f0b4a66446df1bf5b204d24cfcb659bf38ba27a4359b5711649ec2423c5e1247245eba2964679b6a1dbb85c992ae40b9b00c6935b02ff1b';
|
|
37
37
|
const WEBAUTHN_MOCK_SIGNATURE = '0x0000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000001b9b86eb98fda3ed4d797d9e690588dfadf17b329a76a47cec935bebf92d7ddc80000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000120000000000000000000000000000000000000000000000000000000000000001700000000000000000000000000000000000000000000000000000000000000019b2e9410bb6850f9f660a03d609d5a844fb96bcdc87a15139b03ee22c70f469100d2b865a215c3bf786387064effa8fcedcb1d625b5148f8a1236d5e3ff11acf000000000000000000000000000000000000000000000000000000000000002549960de5880e8c687434170f6476605b8fe4aeb9a28632c7995cf3ba831d9763050000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000867b2274797065223a22776562617574686e2e676574222c226368616c6c656e6765223a22396a4546696a75684557724d34534f572d7443684a625545484550343456636a634a2d42716f3166544d38222c226f726967696e223a22687474703a2f2f6c6f63616c686f73743a38303830222c2263726f73734f726967696e223a66616c73657d0000000000000000000000000000000000000000000000000000';
|
|
38
|
+
// Bare WebAuthnAuth[] mock for the MFA sub-validator path.
|
|
39
|
+
// Encodes a single dummy WebAuthnAuth entry matching WEBAUTHN_MOCK_SIGNATURE's inner auth data.
|
|
40
|
+
const WEBAUTHN_MFA_MOCK_SIGNATURE = (0, mfa_webauthn_1.encodeMfaWebAuthnSignature)([
|
|
41
|
+
{
|
|
42
|
+
authenticatorData: '0x49960de5880e8c687434170f6476605b8fe4aeb9a28632c7995cf3ba831d9763050000000100000000000000000000000000000000000000000000000000000000',
|
|
43
|
+
clientDataJSON: '{"type":"webauthn.get","challenge":"9jEFijuhEWrM4SOW-tChJbUEHEP44VcjcJ-Bqo1fTM8","origin":"http://localhost:8080","crossOrigin":false}',
|
|
44
|
+
challengeIndex: 23n,
|
|
45
|
+
typeIndex: 1n,
|
|
46
|
+
r: 70235888126729571064571568093815785379960052049327803024461697693617897013393n,
|
|
47
|
+
s: 612003553534680706344989555478059265065082866949551793736049920959897505487n,
|
|
48
|
+
},
|
|
49
|
+
]);
|
|
38
50
|
function getOwnerValidator(config) {
|
|
39
51
|
if (!config.owners) {
|
|
40
52
|
throw new error_1.OwnersFieldRequiredError();
|
|
@@ -55,16 +67,13 @@ function getMockSignature(ownerSet) {
|
|
|
55
67
|
case 'multi-factor': {
|
|
56
68
|
const mockValidators = ownerSet.validators.map((validator, index) => {
|
|
57
69
|
const validatorModule = getValidator(validator);
|
|
70
|
+
// For passkey sub-validators: produce bare WebAuthnAuth[] (the format
|
|
71
|
+
// validateSignatureWithData expects). For all others: use the normal mock.
|
|
58
72
|
const signature = validator.type === 'passkey'
|
|
59
|
-
?
|
|
73
|
+
? WEBAUTHN_MFA_MOCK_SIGNATURE
|
|
60
74
|
: getMockSignature(validator);
|
|
61
75
|
return {
|
|
62
|
-
packedValidatorAndId: (0, viem_1.encodePacked)(['bytes12', 'address'], [
|
|
63
|
-
(0, viem_1.pad)((0, viem_1.toHex)(index), {
|
|
64
|
-
size: 12,
|
|
65
|
-
}),
|
|
66
|
-
validatorModule.address,
|
|
67
|
-
]),
|
|
76
|
+
packedValidatorAndId: (0, viem_1.encodePacked)(['bytes12', 'address'], [(0, viem_1.pad)((0, viem_1.toHex)(index), { size: 12 }), validatorModule.address]),
|
|
68
77
|
data: signature,
|
|
69
78
|
};
|
|
70
79
|
});
|
|
@@ -12,9 +12,6 @@ declare const WEBAUTHN_VALIDATOR_ABI: readonly [{
|
|
|
12
12
|
}, {
|
|
13
13
|
readonly name: "pubKeyY";
|
|
14
14
|
readonly type: "uint256";
|
|
15
|
-
}, {
|
|
16
|
-
readonly name: "account";
|
|
17
|
-
readonly type: "address";
|
|
18
15
|
}];
|
|
19
16
|
readonly outputs: readonly [{
|
|
20
17
|
readonly name: "";
|
|
@@ -145,7 +142,7 @@ declare const WEBAUTHN_VALIDATOR_ABI: readonly [{
|
|
|
145
142
|
* @param provider Optional provider configuration
|
|
146
143
|
* @returns Promise resolving to the credential ID
|
|
147
144
|
*/
|
|
148
|
-
declare function generateCredentialId(pubKeyX: bigint, pubKeyY: bigint,
|
|
145
|
+
declare function generateCredentialId(pubKeyX: bigint, pubKeyY: bigint, chain: Chain, provider?: ProviderConfig): Promise<Hex>;
|
|
149
146
|
/**
|
|
150
147
|
* Gets all credential IDs for an account
|
|
151
148
|
* @param accountAddress Address of the account
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webauthn-contract.d.ts","sourceRoot":"","sources":["../../../../modules/validators/webauthn-contract.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,OAAO,EACZ,KAAK,KAAK,EAGV,KAAK,GAAG,EACT,MAAM,MAAM,CAAA;AAGb,OAAO,KAAK,EAAE,IAAI,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAGvD;;GAEG;AACH,QAAA,MAAM,sBAAsB
|
|
1
|
+
{"version":3,"file":"webauthn-contract.d.ts","sourceRoot":"","sources":["../../../../modules/validators/webauthn-contract.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,OAAO,EACZ,KAAK,KAAK,EAGV,KAAK,GAAG,EACT,MAAM,MAAM,CAAA;AAGb,OAAO,KAAK,EAAE,IAAI,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAGvD;;GAEG;AACH,QAAA,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAwFlB,CAAA;AAEV;;;;;;;;GAQG;AACH,iBAAe,oBAAoB,CACjC,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,KAAK,EACZ,QAAQ,CAAC,EAAE,cAAc,GACxB,OAAO,CAAC,GAAG,CAAC,CAcd;AAED;;;;;;GAMG;AACH,iBAAe,gBAAgB,CAC7B,cAAc,EAAE,OAAO,EACvB,KAAK,EAAE,KAAK,EACZ,QAAQ,CAAC,EAAE,cAAc,GACxB,OAAO,CAAC,GAAG,EAAE,CAAC,CAchB;AAED;;;;;;;GAOG;AACH,iBAAe,iBAAiB,CAC9B,YAAY,EAAE,GAAG,EACjB,cAAc,EAAE,OAAO,EACvB,KAAK,EAAE,KAAK,EACZ,QAAQ,CAAC,EAAE,cAAc,GACxB,OAAO,CAAC,OAAO,CAAC,CAclB;AAED;;;;;;;;GAQG;AACH,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jB,aAAa,EACb,aAAa,EACb,gBAAgB,EAChB,YAAY,EACZ,iBAAiB,EACjB,YAAY,EACZ,cAAc,EACd,sBAAsB,GACvB,CAAA"}
|
|
@@ -24,7 +24,6 @@ const WEBAUTHN_VALIDATOR_ABI = [
|
|
|
24
24
|
inputs: [
|
|
25
25
|
{ name: 'pubKeyX', type: 'uint256' },
|
|
26
26
|
{ name: 'pubKeyY', type: 'uint256' },
|
|
27
|
-
{ name: 'account', type: 'address' },
|
|
28
27
|
],
|
|
29
28
|
outputs: [{ name: '', type: 'bytes32' }],
|
|
30
29
|
stateMutability: 'pure',
|
|
@@ -117,7 +116,7 @@ exports.WEBAUTHN_VALIDATOR_ABI = WEBAUTHN_VALIDATOR_ABI;
|
|
|
117
116
|
* @param provider Optional provider configuration
|
|
118
117
|
* @returns Promise resolving to the credential ID
|
|
119
118
|
*/
|
|
120
|
-
async function generateCredentialId(pubKeyX, pubKeyY,
|
|
119
|
+
async function generateCredentialId(pubKeyX, pubKeyY, chain, provider) {
|
|
121
120
|
const publicClient = (0, viem_1.createPublicClient)({
|
|
122
121
|
chain,
|
|
123
122
|
transport: (0, utils_1.createTransport)(chain, provider),
|
|
@@ -126,7 +125,7 @@ async function generateCredentialId(pubKeyX, pubKeyY, accountAddress, chain, pro
|
|
|
126
125
|
abi: WEBAUTHN_VALIDATOR_ABI,
|
|
127
126
|
address: core_1.WEBAUTHN_VALIDATOR_ADDRESS,
|
|
128
127
|
functionName: 'generateCredentialId',
|
|
129
|
-
args: [pubKeyX, pubKeyY
|
|
128
|
+
args: [pubKeyX, pubKeyY],
|
|
130
129
|
});
|
|
131
130
|
return result;
|
|
132
131
|
}
|