@rhinestone/sdk 2.4.0 → 2.6.0
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/actions/mfa.d.ts +5 -4
- package/dist/src/actions/mfa.d.ts.map +1 -1
- package/dist/src/actions/mfa.js +11 -4
- package/dist/src/api/account.d.ts.map +1 -1
- package/dist/src/api/account.js +118 -0
- package/dist/src/api/compose-types.d.ts +7 -0
- package/dist/src/api/compose-types.d.ts.map +1 -1
- package/dist/src/clients/orchestrator/client.js +1 -1
- package/dist/src/clients/orchestrator/mappers.js +40 -2
- package/dist/src/clients/orchestrator/public.d.ts +16 -1
- package/dist/src/clients/orchestrator/public.d.ts.map +1 -1
- package/dist/src/clients/orchestrator/types.d.ts +6 -0
- package/dist/src/clients/orchestrator/types.d.ts.map +1 -1
- package/dist/src/clients/orchestrator/wire.d.ts +15 -2
- package/dist/src/clients/orchestrator/wire.d.ts.map +1 -1
- package/dist/src/config/account.d.ts +140 -6
- package/dist/src/config/account.d.ts.map +1 -1
- package/dist/src/index.d.ts +2 -2
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/modules/validators/ens.d.ts +9 -0
- package/dist/src/modules/validators/ens.d.ts.map +1 -1
- package/dist/src/modules/validators/ens.js +21 -3
- package/dist/src/modules/validators/multi-factor.d.ts +4 -1
- package/dist/src/modules/validators/multi-factor.d.ts.map +1 -1
- package/dist/src/modules/validators/multi-factor.js +2 -2
- package/dist/src/modules/validators/ownable.d.ts +10 -0
- package/dist/src/modules/validators/ownable.d.ts.map +1 -1
- package/dist/src/modules/validators/ownable.js +26 -12
- package/dist/src/modules/validators/permissions.d.ts +13 -0
- package/dist/src/modules/validators/permissions.d.ts.map +1 -1
- package/dist/src/modules/validators/permissions.js +140 -2
- package/dist/src/modules/validators/policies/claim/arbiters.d.ts.map +1 -1
- package/dist/src/modules/validators/policies/claim/arbiters.js +8 -0
- package/dist/src/modules/validators/resolve.d.ts +6 -0
- package/dist/src/modules/validators/resolve.d.ts.map +1 -1
- package/dist/src/modules/validators/resolve.js +28 -6
- package/dist/src/modules/validators/smart-sessions/resolve.d.ts.map +1 -1
- package/dist/src/modules/validators/smart-sessions/resolve.js +112 -13
- package/dist/src/modules/validators/smart-sessions/swap/fynd.d.ts +92 -0
- package/dist/src/modules/validators/smart-sessions/swap/fynd.d.ts.map +1 -0
- package/dist/src/modules/validators/smart-sessions/swap/fynd.js +101 -0
- package/dist/src/modules/validators/smart-sessions/swap/rhinestone.d.ts +147 -0
- package/dist/src/modules/validators/smart-sessions/swap/rhinestone.d.ts.map +1 -0
- package/dist/src/modules/validators/smart-sessions/swap/rhinestone.js +305 -0
- package/dist/src/modules/validators/smart-sessions/swap/rules.d.ts +73 -0
- package/dist/src/modules/validators/smart-sessions/swap/rules.d.ts.map +1 -0
- package/dist/src/modules/validators/smart-sessions/swap/rules.js +105 -0
- package/dist/src/modules/validators/smart-sessions/swap/scope.d.ts +31 -0
- package/dist/src/modules/validators/smart-sessions/swap/scope.d.ts.map +1 -0
- package/dist/src/modules/validators/smart-sessions/swap/scope.js +168 -0
- package/dist/src/modules/validators/smart-sessions/swap/zero-ex.d.ts +143 -0
- package/dist/src/modules/validators/smart-sessions/swap/zero-ex.d.ts.map +1 -0
- package/dist/src/modules/validators/smart-sessions/swap/zero-ex.js +164 -0
- package/dist/src/modules/validators/smart-sessions/types.d.ts +78 -0
- package/dist/src/modules/validators/smart-sessions/types.d.ts.map +1 -1
- package/dist/src/modules/validators/types.d.ts +5 -1
- package/dist/src/modules/validators/types.d.ts.map +1 -1
- package/dist/src/modules/validators/webauthn.d.ts +33 -1
- package/dist/src/modules/validators/webauthn.d.ts.map +1 -1
- package/dist/src/modules/validators/webauthn.js +128 -13
- package/dist/src/signing/context.d.ts.map +1 -1
- package/dist/src/signing/context.js +2 -5
- package/dist/src/smart-sessions/index.d.ts +10 -5
- package/dist/src/smart-sessions/index.d.ts.map +1 -1
- package/dist/src/smart-sessions/index.js +6 -1
- package/dist/src/transactions/intents/session-signing.d.ts.map +1 -1
- package/dist/src/transactions/intents/session-signing.js +7 -1
- package/dist/src/transactions/user-operations/validator-account.d.ts.map +1 -1
- package/dist/src/transactions/user-operations/validator-account.js +2 -2
- package/package.json +1 -1
|
@@ -3,6 +3,7 @@ import type { ResolvedModule } from '../types.js';
|
|
|
3
3
|
import type { AtomicValidatorDefinition } from './types.js';
|
|
4
4
|
export declare const WEBAUTHN_VALIDATOR_ADDRESS: Address;
|
|
5
5
|
export declare const WEBAUTHN_V0_VALIDATOR_ADDRESS: `0x${string}`;
|
|
6
|
+
export declare const WEBAUTHN_STATELESS_ACCOUNT: Address;
|
|
6
7
|
export declare const WEBAUTHN_MOCK_SIGNATURE: "0x0000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000001b9b86eb98fda3ed4d797d9e690588dfadf17b329a76a47cec935bebf92d7ddc80000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000120000000000000000000000000000000000000000000000000000000000000001700000000000000000000000000000000000000000000000000000000000000019b2e9410bb6850f9f660a03d609d5a844fb96bcdc87a15139b03ee22c70f469100d2b865a215c3bf786387064effa8fcedcb1d625b5148f8a1236d5e3ff11acf000000000000000000000000000000000000000000000000000000000000002549960de5880e8c687434170f6476605b8fe4aeb9a28632c7995cf3ba831d9763050000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000867b2274797065223a22776562617574686e2e676574222c226368616c6c656e6765223a22396a4546696a75684557724d34534f572d7443684a625545484550343456636a634a2d42716f3166544d38222c226f726967696e223a22687474703a2f2f6c6f63616c686f73743a38303830222c2263726f73734f726967696e223a66616c73657d0000000000000000000000000000000000000000000000000000";
|
|
7
8
|
export interface PublicKey {
|
|
8
9
|
prefix?: number | undefined;
|
|
@@ -27,14 +28,20 @@ export declare function parseWebauthnSignature(signature: Hex | Uint8Array): {
|
|
|
27
28
|
readonly s: bigint;
|
|
28
29
|
};
|
|
29
30
|
export declare function generateWebauthnCredentialId(pubKeyX: bigint, pubKeyY: bigint, account: Address): Hex;
|
|
31
|
+
export declare function webauthnStatelessMockSignature(): Hex;
|
|
30
32
|
export declare function encodeWebauthnSignatures(credentialIds: readonly Hex[], usePrecompile: boolean, signatures: readonly WebAuthnSignature[]): Hex;
|
|
33
|
+
export declare function encodeWebauthnStatelessSignatures(signatures: readonly WebAuthnSignature[]): Hex;
|
|
31
34
|
export declare function encodeWebauthnSignatureV0(signature: Omit<WebAuthnSignature, 'challengeIndex'>, usePrecompile: boolean): Hex;
|
|
32
35
|
export declare function encodeWebauthnValidatorContribution(input: {
|
|
33
36
|
readonly ownerOrder: readonly string[];
|
|
34
37
|
readonly threshold: number;
|
|
35
38
|
readonly account: Address;
|
|
36
39
|
readonly usePrecompile: boolean;
|
|
37
|
-
readonly format: 'current' | 'v0';
|
|
40
|
+
readonly format: 'current' | 'v0' | 'stateless';
|
|
41
|
+
readonly credentials?: readonly {
|
|
42
|
+
readonly ownerId: string;
|
|
43
|
+
readonly publicKey: Hex;
|
|
44
|
+
}[];
|
|
38
45
|
readonly contributions: readonly {
|
|
39
46
|
readonly ownerId: string;
|
|
40
47
|
readonly publicKey: Hex;
|
|
@@ -69,5 +76,30 @@ export declare function resolveWebauthnCredentials(input: {
|
|
|
69
76
|
readonly ordering?: WebauthnCredentialOrdering;
|
|
70
77
|
}): ResolvedModule;
|
|
71
78
|
export declare function webauthnDefinitionCredentials(definition: AtomicValidatorDefinition): readonly WebauthnCredential[];
|
|
79
|
+
/**
|
|
80
|
+
* The configuration `WebAuthnValidator.validateSignatureWithData` expects, which
|
|
81
|
+
* is *not* the validator's install data: a verification context plus the account
|
|
82
|
+
* the credential IDs were derived from. Multi-factor stores this blob verbatim
|
|
83
|
+
* and hands it back on every factor validation.
|
|
84
|
+
*
|
|
85
|
+
* Written for the deployed validator ({@link WEBAUTHN_VALIDATOR_ADDRESS}); a
|
|
86
|
+
* future deployment that drops the account from credential-ID derivation would
|
|
87
|
+
* need its own encoder.
|
|
88
|
+
*/
|
|
89
|
+
export declare function encodeWebauthnStatelessData(input: {
|
|
90
|
+
readonly credentials: readonly WebauthnCredential[];
|
|
91
|
+
readonly threshold: number;
|
|
92
|
+
readonly usePrecompile?: boolean;
|
|
93
|
+
}): Hex;
|
|
94
|
+
export declare function webauthnStatelessCodecContext(definition: AtomicValidatorDefinition): {
|
|
95
|
+
account: `0x${string}`;
|
|
96
|
+
usePrecompile: boolean;
|
|
97
|
+
format: "stateless";
|
|
98
|
+
credentials: {
|
|
99
|
+
ownerId: string;
|
|
100
|
+
publicKey: `0x${string}`;
|
|
101
|
+
}[];
|
|
102
|
+
};
|
|
103
|
+
export declare function resolveWebauthnStatelessData(definition: AtomicValidatorDefinition): Hex;
|
|
72
104
|
export declare function resolveWebauthnValidator(definition: AtomicValidatorDefinition, ordering?: WebauthnCredentialOrdering): ResolvedModule;
|
|
73
105
|
//# sourceMappingURL=webauthn.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webauthn.d.ts","sourceRoot":"","sources":["../../../../modules/validators/webauthn.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,OAAO,
|
|
1
|
+
{"version":3,"file":"webauthn.d.ts","sourceRoot":"","sources":["../../../../modules/validators/webauthn.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,OAAO,EAIZ,KAAK,GAAG,EAIT,MAAM,MAAM,CAAA;AACb,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAE9C,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,SAAS,CAAA;AAExD,eAAO,MAAM,0BAA0B,EAAE,OACK,CAAA;AAC9C,eAAO,MAAM,6BAA6B,eAA6B,CAAA;AAOvE,eAAO,MAAM,0BAA0B,EAAE,OACK,CAAA;A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,CAAC,EAAE,0BAA0B,GACpC,cAAc,CAUhB"}
|
|
@@ -1,7 +1,13 @@
|
|
|
1
|
-
import { bytesToHex, encodeAbiParameters, hexToBytes, keccak256, stringToBytes, } from 'viem';
|
|
1
|
+
import { bytesToHex, decodeAbiParameters, encodeAbiParameters, hexToBytes, keccak256, stringToBytes, } from 'viem';
|
|
2
2
|
import { compareHexValues } from './ordering.js';
|
|
3
3
|
export const WEBAUTHN_VALIDATOR_ADDRESS = '0x0000000000578c4cb0e472a5462da43c495c3f33';
|
|
4
4
|
export const WEBAUTHN_V0_VALIDATOR_ADDRESS = WEBAUTHN_VALIDATOR_ADDRESS;
|
|
5
|
+
// The account address carried by a stateless WebAuthn configuration. The
|
|
6
|
+
// validator only uses it to re-derive the credential IDs in the same blob and
|
|
7
|
+
// check they match, never to read storage, so any constant works as long as the
|
|
8
|
+
// IDs are derived from it. The real account address cannot be used: it is
|
|
9
|
+
// derived from the init data that would contain it.
|
|
10
|
+
export const WEBAUTHN_STATELESS_ACCOUNT = '0x0000000000000000000000000000000000000000';
|
|
5
11
|
export const WEBAUTHN_MOCK_SIGNATURE = '0x0000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000001b9b86eb98fda3ed4d797d9e690588dfadf17b329a76a47cec935bebf92d7ddc80000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000120000000000000000000000000000000000000000000000000000000000000001700000000000000000000000000000000000000000000000000000000000000019b2e9410bb6850f9f660a03d609d5a844fb96bcdc87a15139b03ee22c70f469100d2b865a215c3bf786387064effa8fcedcb1d625b5148f8a1236d5e3ff11acf000000000000000000000000000000000000000000000000000000000000002549960de5880e8c687434170f6476605b8fe4aeb9a28632c7995cf3ba831d9763050000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000867b2274797065223a22776562617574686e2e676574222c226368616c6c656e6765223a22396a4546696a75684557724d34534f572d7443684a625545484550343456636a634a2d42716f3166544d38222c226f726967696e223a22687474703a2f2f6c6f63616c686f73743a38303830222c2263726f73734f726967696e223a66616c73657d0000000000000000000000000000000000000000000000000000';
|
|
6
12
|
const P256_CURVE_ORDER = 0xffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551n;
|
|
7
13
|
const P256_HALF_CURVE_ORDER = P256_CURVE_ORDER / 2n;
|
|
@@ -56,6 +62,29 @@ export function parseWebauthnSignature(signature) {
|
|
|
56
62
|
export function generateWebauthnCredentialId(pubKeyX, pubKeyY, account) {
|
|
57
63
|
return keccak256(encodeAbiParameters([{ type: 'uint256' }, { type: 'uint256' }, { type: 'address' }], [pubKeyX, pubKeyY, account]));
|
|
58
64
|
}
|
|
65
|
+
const WEBAUTHN_AUTH_ABI = {
|
|
66
|
+
type: 'tuple[]',
|
|
67
|
+
name: 'webAuthns',
|
|
68
|
+
components: [
|
|
69
|
+
{ type: 'bytes', name: 'authenticatorData' },
|
|
70
|
+
{ type: 'string', name: 'clientDataJSON' },
|
|
71
|
+
{ type: 'uint256', name: 'challengeIndex' },
|
|
72
|
+
{ type: 'uint256', name: 'typeIndex' },
|
|
73
|
+
{ type: 'uint256', name: 'r' },
|
|
74
|
+
{ type: 'uint256', name: 's' },
|
|
75
|
+
],
|
|
76
|
+
};
|
|
77
|
+
// The same mock assertion `WEBAUTHN_MOCK_SIGNATURE` carries, in the shape the
|
|
78
|
+
// stateless path expects, so a passkey factor can be gas-estimated.
|
|
79
|
+
export function webauthnStatelessMockSignature() {
|
|
80
|
+
return encodeAbiParameters([WEBAUTHN_AUTH_ABI], [
|
|
81
|
+
decodeAbiParameters([
|
|
82
|
+
{ type: 'bytes32[]', name: 'credIds' },
|
|
83
|
+
{ type: 'bool', name: 'usePrecompile' },
|
|
84
|
+
WEBAUTHN_AUTH_ABI,
|
|
85
|
+
], WEBAUTHN_MOCK_SIGNATURE)[2],
|
|
86
|
+
]);
|
|
87
|
+
}
|
|
59
88
|
export function encodeWebauthnSignatures(credentialIds, usePrecompile, signatures) {
|
|
60
89
|
const ordered = credentialIds
|
|
61
90
|
.map((credentialId, index) => ({
|
|
@@ -66,24 +95,18 @@ export function encodeWebauthnSignatures(credentialIds, usePrecompile, signature
|
|
|
66
95
|
return encodeAbiParameters([
|
|
67
96
|
{ type: 'bytes32[]', name: 'credIds' },
|
|
68
97
|
{ type: 'bool', name: 'usePrecompile' },
|
|
69
|
-
|
|
70
|
-
type: 'tuple[]',
|
|
71
|
-
name: 'webAuthns',
|
|
72
|
-
components: [
|
|
73
|
-
{ type: 'bytes', name: 'authenticatorData' },
|
|
74
|
-
{ type: 'string', name: 'clientDataJSON' },
|
|
75
|
-
{ type: 'uint256', name: 'challengeIndex' },
|
|
76
|
-
{ type: 'uint256', name: 'typeIndex' },
|
|
77
|
-
{ type: 'uint256', name: 'r' },
|
|
78
|
-
{ type: 'uint256', name: 's' },
|
|
79
|
-
],
|
|
80
|
-
},
|
|
98
|
+
WEBAUTHN_AUTH_ABI,
|
|
81
99
|
], [
|
|
82
100
|
ordered.map(({ credentialId }) => credentialId),
|
|
83
101
|
usePrecompile,
|
|
84
102
|
ordered.map(({ signature }) => signature),
|
|
85
103
|
]);
|
|
86
104
|
}
|
|
105
|
+
// The signature format the validator's stateless path expects: the assertions
|
|
106
|
+
// alone, paired with the configuration's credentials by position.
|
|
107
|
+
export function encodeWebauthnStatelessSignatures(signatures) {
|
|
108
|
+
return encodeAbiParameters([WEBAUTHN_AUTH_ABI], [signatures.map(normalizeWebauthnSignature)]);
|
|
109
|
+
}
|
|
87
110
|
export function encodeWebauthnSignatureV0(signature, usePrecompile) {
|
|
88
111
|
const normalized = normalizeWebauthnSignatureV0(signature);
|
|
89
112
|
return encodeAbiParameters([
|
|
@@ -102,6 +125,19 @@ export function encodeWebauthnSignatureV0(signature, usePrecompile) {
|
|
|
102
125
|
usePrecompile,
|
|
103
126
|
]);
|
|
104
127
|
}
|
|
128
|
+
// Orders owners the way the stateless configuration lays their credentials out.
|
|
129
|
+
function statelessCredentialOrder(credentials) {
|
|
130
|
+
return [...credentials]
|
|
131
|
+
.map((credential) => {
|
|
132
|
+
const publicKey = parseWebauthnPublicKey(credential.publicKey);
|
|
133
|
+
return {
|
|
134
|
+
ownerId: credential.ownerId,
|
|
135
|
+
credentialId: generateWebauthnCredentialId(publicKey.x, publicKey.y, WEBAUTHN_STATELESS_ACCOUNT),
|
|
136
|
+
};
|
|
137
|
+
})
|
|
138
|
+
.sort((left, right) => compareHexValues(left.credentialId, right.credentialId))
|
|
139
|
+
.map(({ ownerId }) => ownerId);
|
|
140
|
+
}
|
|
105
141
|
export function encodeWebauthnValidatorContribution(input) {
|
|
106
142
|
if (input.threshold < 1 || input.threshold > input.ownerOrder.length) {
|
|
107
143
|
throw new Error('Validator threshold is outside the configured owner set');
|
|
@@ -137,6 +173,25 @@ export function encodeWebauthnValidatorContribution(input) {
|
|
|
137
173
|
}
|
|
138
174
|
return encodeWebauthnSignatureV0(signatures[0], input.usePrecompile);
|
|
139
175
|
}
|
|
176
|
+
if (input.format === 'stateless') {
|
|
177
|
+
if (!input.credentials) {
|
|
178
|
+
throw new Error('Stateless WebAuthn contributions require the configured credentials');
|
|
179
|
+
}
|
|
180
|
+
const configuredOrder = statelessCredentialOrder(input.credentials);
|
|
181
|
+
const signingOrder = statelessCredentialOrder(ordered.map((contribution) => ({
|
|
182
|
+
ownerId: contribution.ownerId,
|
|
183
|
+
publicKey: contribution.publicKey,
|
|
184
|
+
})));
|
|
185
|
+
const expected = configuredOrder.slice(0, signingOrder.length);
|
|
186
|
+
if (signingOrder.some((ownerId, index) => expected[index] !== ownerId)) {
|
|
187
|
+
throw new Error('A WebAuthn factor pairs each signature with the credential at the same position, so a partial signer set must be the lowest-ordered credentials of that factor');
|
|
188
|
+
}
|
|
189
|
+
const byOwnerId = new Map(ordered.map((contribution, index) => [
|
|
190
|
+
contribution.ownerId,
|
|
191
|
+
signatures[index],
|
|
192
|
+
]));
|
|
193
|
+
return encodeWebauthnStatelessSignatures(signingOrder.map((ownerId) => byOwnerId.get(ownerId)));
|
|
194
|
+
}
|
|
140
195
|
const credentialIds = ordered.map((contribution) => {
|
|
141
196
|
const publicKey = parseWebauthnPublicKey(contribution.publicKey);
|
|
142
197
|
return generateWebauthnCredentialId(publicKey.x, publicKey.y, input.account);
|
|
@@ -232,6 +287,66 @@ export function webauthnDefinitionCredentials(definition) {
|
|
|
232
287
|
};
|
|
233
288
|
});
|
|
234
289
|
}
|
|
290
|
+
/**
|
|
291
|
+
* The configuration `WebAuthnValidator.validateSignatureWithData` expects, which
|
|
292
|
+
* is *not* the validator's install data: a verification context plus the account
|
|
293
|
+
* the credential IDs were derived from. Multi-factor stores this blob verbatim
|
|
294
|
+
* and hands it back on every factor validation.
|
|
295
|
+
*
|
|
296
|
+
* Written for the deployed validator ({@link WEBAUTHN_VALIDATOR_ADDRESS}); a
|
|
297
|
+
* future deployment that drops the account from credential-ID derivation would
|
|
298
|
+
* need its own encoder.
|
|
299
|
+
*/
|
|
300
|
+
export function encodeWebauthnStatelessData(input) {
|
|
301
|
+
const credentials = orderWebauthnCredentials(toWebauthnInstallCredentials(input.credentials), { kind: 'credential-id', account: WEBAUTHN_STATELESS_ACCOUNT });
|
|
302
|
+
return encodeAbiParameters([
|
|
303
|
+
{
|
|
304
|
+
name: 'context',
|
|
305
|
+
type: 'tuple',
|
|
306
|
+
components: [
|
|
307
|
+
{ name: 'usePrecompile', type: 'bool' },
|
|
308
|
+
{ name: 'threshold', type: 'uint256' },
|
|
309
|
+
{ name: 'credentialIds', type: 'bytes32[]' },
|
|
310
|
+
{
|
|
311
|
+
name: 'credentialData',
|
|
312
|
+
type: 'tuple[]',
|
|
313
|
+
components: [
|
|
314
|
+
{ name: 'pubKeyX', type: 'uint256' },
|
|
315
|
+
{ name: 'pubKeyY', type: 'uint256' },
|
|
316
|
+
{ name: 'requireUV', type: 'bool' },
|
|
317
|
+
],
|
|
318
|
+
},
|
|
319
|
+
],
|
|
320
|
+
},
|
|
321
|
+
{ name: 'account', type: 'address' },
|
|
322
|
+
], [
|
|
323
|
+
{
|
|
324
|
+
usePrecompile: input.usePrecompile ?? false,
|
|
325
|
+
threshold: BigInt(input.threshold),
|
|
326
|
+
credentialIds: credentials.map((credential) => generateWebauthnCredentialId(credential.pubKeyX, credential.pubKeyY, WEBAUTHN_STATELESS_ACCOUNT)),
|
|
327
|
+
credentialData: [...credentials],
|
|
328
|
+
},
|
|
329
|
+
WEBAUTHN_STATELESS_ACCOUNT,
|
|
330
|
+
]);
|
|
331
|
+
}
|
|
332
|
+
// A passkey factor signs through the sub-validator's stateless path: the
|
|
333
|
+
// assertions alone, paired with credentials derived from the pinned account.
|
|
334
|
+
export function webauthnStatelessCodecContext(definition) {
|
|
335
|
+
return {
|
|
336
|
+
account: WEBAUTHN_STATELESS_ACCOUNT,
|
|
337
|
+
usePrecompile: false,
|
|
338
|
+
format: 'stateless',
|
|
339
|
+
credentials: definition.owners.flatMap((owner) => owner.kind === 'webauthn'
|
|
340
|
+
? [{ ownerId: owner.id, publicKey: owner.account.publicKey }]
|
|
341
|
+
: []),
|
|
342
|
+
};
|
|
343
|
+
}
|
|
344
|
+
export function resolveWebauthnStatelessData(definition) {
|
|
345
|
+
return encodeWebauthnStatelessData({
|
|
346
|
+
credentials: webauthnDefinitionCredentials(definition),
|
|
347
|
+
threshold: definition.threshold,
|
|
348
|
+
});
|
|
349
|
+
}
|
|
235
350
|
export function resolveWebauthnValidator(definition, ordering) {
|
|
236
351
|
return resolveWebauthnCredentials({
|
|
237
352
|
credentials: webauthnDefinitionCredentials(definition),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../signing/context.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AACzE,OAAO,KAAK,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AAC,SAAS,CAAC,EAAE,oBAAoB,CAAA;CAC1C,GAAG,cAAc,CA4DjB;AAED,wBAAgB,wBAAwB,CACtC,OAAO,EAAE,cAAc,EACvB,WAAW,CAAC,EAAE,SAAS,GAAG,YAAY,GACrC,0BAA0B,CAoB5B;AAED,wBAAgB,0BAA0B,CACxC,OAAO,EAAE,cAAc,EACvB,WAAW,CAAC,EAAE,SAAS,GAAG,YAAY,GACrC,WAAW,CAAC,oBAAoB,CAAC,kBAAkB,CAAC,CAAC,CA+BvD;AAED,wBAAgB,wBAAwB,CACtC,OAAO,EAAE,cAAc,EACvB,OAAO,EAAE,cAAc,EACvB,OAAO,GAAE,oBAAoB,CAAC,SAAS,CAAoB,EAC3D,WAAW,GAAE,SAAS,GAAG,YAAwB,GAChD,IAAI,CAAC,oBAAoB,EAAE,IAAI,GAAG,SAAS,GAAG,OAAO,GAAG,OAAO,CAAC,CAsBlE;AAED,wBAAgB,2BAA2B,CACzC,OAAO,EAAE,cAAc,GACtB,OAAO,mBAAmB,EAAE,wBAAwB,CAWtD"}
|
|
@@ -2,6 +2,7 @@ import { isAddressEqual } from 'viem';
|
|
|
2
2
|
import { getValidatorCapabilities } from '../modules/validators/capabilities.js';
|
|
3
3
|
import { resolveValidator } from '../modules/validators/resolve.js';
|
|
4
4
|
import { ecdsaSignerId } from '../modules/validators/signer-id.js';
|
|
5
|
+
import { webauthnStatelessCodecContext } from '../modules/validators/webauthn.js';
|
|
5
6
|
import { signingTopology } from './plan.js';
|
|
6
7
|
const zeroAddress = '0x0000000000000000000000000000000000000000';
|
|
7
8
|
export function createAccountSigningContext(input) {
|
|
@@ -90,11 +91,7 @@ export function getSigningValidatorFactors(context, payloadKind) {
|
|
|
90
91
|
codec: factor.kind === 'passkey'
|
|
91
92
|
? {
|
|
92
93
|
...normalizedCodec,
|
|
93
|
-
webauthn:
|
|
94
|
-
account: context.account.address,
|
|
95
|
-
usePrecompile: false,
|
|
96
|
-
format: 'current',
|
|
97
|
-
},
|
|
94
|
+
webauthn: webauthnStatelessCodecContext(factor),
|
|
98
95
|
}
|
|
99
96
|
: normalizedCodec,
|
|
100
97
|
};
|
|
@@ -1,16 +1,21 @@
|
|
|
1
|
-
import type { Abi, Address } from 'viem';
|
|
1
|
+
import type { Abi, Address, Chain } from 'viem';
|
|
2
2
|
import type { ProviderConfig, Session, SessionDefinition } from '../config/account.js';
|
|
3
3
|
import { toCrossChainPermissionInput } from '../modules/validators/smart-sessions/cross-chain-permits.js';
|
|
4
4
|
import { getPermissionId, getSessionData } from '../modules/validators/smart-sessions/digest.js';
|
|
5
5
|
import { SMART_SESSION_EMISSARY_ADDRESS, SMART_SESSION_EMISSARY_ADDRESS_DEV } from '../modules/validators/smart-sessions/module.js';
|
|
6
6
|
import { ARG_POLICY_ADDRESS, INTENT_EXECUTION_POLICY_ADDRESS, SPENDING_LIMITS_POLICY_ADDRESS, SUDO_POLICY_ADDRESS, TIME_FRAME_POLICY_ADDRESS, UNIVERSAL_ACTION_POLICY_ADDRESS, USAGE_LIMIT_POLICY_ADDRESS, VALUE_LIMIT_POLICY_ADDRESS } from '../modules/validators/smart-sessions/policies/addresses.js';
|
|
7
7
|
import { SMART_SESSIONS_FALLBACK_TARGET_FLAG, SMART_SESSIONS_FALLBACK_TARGET_SELECTOR_FLAG } from '../modules/validators/smart-sessions/resolve.js';
|
|
8
|
-
import
|
|
9
|
-
|
|
8
|
+
import { fynd } from '../modules/validators/smart-sessions/swap/fynd.js';
|
|
9
|
+
import { rhinestoneSwap } from '../modules/validators/smart-sessions/swap/rhinestone.js';
|
|
10
|
+
import type { SwapVenueFor } from '../modules/validators/smart-sessions/swap/scope.js';
|
|
11
|
+
import type { ZeroExAnySettlerOptions, ZeroExPinnedOptions } from '../modules/validators/smart-sessions/swap/zero-ex.js';
|
|
12
|
+
import { resolveZeroExSettler, zeroEx } from '../modules/validators/smart-sessions/swap/zero-ex.js';
|
|
13
|
+
import type { ChainDigest, FyndVenue, RhinestoneSwapVenue, SessionDetails, SwapVenue, ZeroExVenue } from '../modules/validators/smart-sessions/types.js';
|
|
14
|
+
declare function toSession<const TAbis extends readonly Abi[], const TChain extends Chain>(definition: SessionDefinition<TAbis, TChain>, options?: {
|
|
10
15
|
useDevContracts?: boolean;
|
|
11
16
|
}): Session;
|
|
12
17
|
declare function getSessionDetails(account: Address, sessions: Session[], provider: ProviderConfig | undefined, useDevContracts?: boolean): Promise<SessionDetails>;
|
|
13
18
|
declare function isSessionEnabled(account: Address, provider: ProviderConfig | undefined, session: Session, useDevContracts?: boolean): Promise<boolean>;
|
|
14
|
-
export {
|
|
15
|
-
export
|
|
19
|
+
export type { ChainDigest, FyndVenue, RhinestoneSwapVenue, SessionDetails, SwapVenue, SwapVenueFor, ZeroExAnySettlerOptions, ZeroExPinnedOptions, ZeroExVenue, };
|
|
20
|
+
export { ARG_POLICY_ADDRESS, fynd, getPermissionId, getSessionData, getSessionDetails, INTENT_EXECUTION_POLICY_ADDRESS, isSessionEnabled, resolveZeroExSettler, rhinestoneSwap, SMART_SESSION_EMISSARY_ADDRESS, SMART_SESSION_EMISSARY_ADDRESS_DEV, SMART_SESSIONS_FALLBACK_TARGET_FLAG, SMART_SESSIONS_FALLBACK_TARGET_SELECTOR_FLAG, SPENDING_LIMITS_POLICY_ADDRESS, SUDO_POLICY_ADDRESS, TIME_FRAME_POLICY_ADDRESS, toCrossChainPermissionInput, toSession, UNIVERSAL_ACTION_POLICY_ADDRESS, USAGE_LIMIT_POLICY_ADDRESS, VALUE_LIMIT_POLICY_ADDRESS, zeroEx, };
|
|
16
21
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../smart-sessions/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../smart-sessions/index.ts"],"names":[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,iBAAe,iBAAiB,CAC9B,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,OAAO,EAAE,EACnB,QAAQ,EAAE,cAAc,GAAG,SAAS,EACpC,eAAe,CAAC,EAAE,OAAO,GACxB,OAAO,CAAC,cAAc,CAAC,CAiBzB;AAED,iBAAe,gBAAgB,CAC7B,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,cAAc,GAAG,SAAS,EACpC,OAAO,EAAE,OAAO,EAChB,eAAe,CAAC,EAAE,OAAO,GACxB,OAAO,CAAC,OAAO,CAAC,CASlB;AAED,YAAY,EACV,WAAW,EACX,SAAS,EACT,mBAAmB,EACnB,cAAc,EACd,SAAS,EACT,YAAY,EACZ,uBAAuB,EACvB,mBAAmB,EACnB,WAAW,GACZ,CAAA;AACD,OAAO,EACL,kBAAkB,EAClB,IAAI,EACJ,eAAe,EACf,cAAc,EACd,iBAAiB,EACjB,+BAA+B,EAC/B,gBAAgB,EAChB,oBAAoB,EACpB,cAAc,EACd,8BAA8B,EAC9B,kCAAkC,EAClC,mCAAmC,EACnC,4CAA4C,EAC5C,8BAA8B,EAC9B,mBAAmB,EACnB,yBAAyB,EACzB,2BAA2B,EAC3B,SAAS,EACT,+BAA+B,EAC/B,0BAA0B,EAC1B,0BAA0B,EAE1B,MAAM,GACP,CAAA"}
|
|
@@ -6,6 +6,9 @@ import { SMART_SESSION_EMISSARY_ADDRESS, SMART_SESSION_EMISSARY_ADDRESS_DEV, } f
|
|
|
6
6
|
import { ARG_POLICY_ADDRESS, INTENT_EXECUTION_POLICY_ADDRESS, SPENDING_LIMITS_POLICY_ADDRESS, SUDO_POLICY_ADDRESS, TIME_FRAME_POLICY_ADDRESS, UNIVERSAL_ACTION_POLICY_ADDRESS, USAGE_LIMIT_POLICY_ADDRESS, VALUE_LIMIT_POLICY_ADDRESS, } from '../modules/validators/smart-sessions/policies/addresses.js';
|
|
7
7
|
import { toSession as resolveSession, SMART_SESSIONS_FALLBACK_TARGET_FLAG, SMART_SESSIONS_FALLBACK_TARGET_SELECTOR_FLAG, } from '../modules/validators/smart-sessions/resolve.js';
|
|
8
8
|
import { readSessionEnabled, readSessionNonce, } from '../modules/validators/smart-sessions/state.js';
|
|
9
|
+
import { fynd } from '../modules/validators/smart-sessions/swap/fynd.js';
|
|
10
|
+
import { rhinestoneSwap } from '../modules/validators/smart-sessions/swap/rhinestone.js';
|
|
11
|
+
import { resolveZeroExSettler, zeroEx, } from '../modules/validators/smart-sessions/swap/zero-ex.js';
|
|
9
12
|
function environment(useDevContracts) {
|
|
10
13
|
return useDevContracts === true ? 'development' : 'production';
|
|
11
14
|
}
|
|
@@ -42,4 +45,6 @@ async function isSessionEnabled(account, provider, session, useDevContracts) {
|
|
|
42
45
|
environment: environment(useDevContracts),
|
|
43
46
|
});
|
|
44
47
|
}
|
|
45
|
-
export {
|
|
48
|
+
export { ARG_POLICY_ADDRESS, fynd, getPermissionId, getSessionData, getSessionDetails, INTENT_EXECUTION_POLICY_ADDRESS, isSessionEnabled, resolveZeroExSettler, rhinestoneSwap, SMART_SESSION_EMISSARY_ADDRESS, SMART_SESSION_EMISSARY_ADDRESS_DEV, SMART_SESSIONS_FALLBACK_TARGET_FLAG, SMART_SESSIONS_FALLBACK_TARGET_SELECTOR_FLAG, SPENDING_LIMITS_POLICY_ADDRESS, SUDO_POLICY_ADDRESS, TIME_FRAME_POLICY_ADDRESS, toCrossChainPermissionInput, toSession, UNIVERSAL_ACTION_POLICY_ADDRESS, USAGE_LIMIT_POLICY_ADDRESS, VALUE_LIMIT_POLICY_ADDRESS,
|
|
49
|
+
// Venue-scoped swap sessions (RHI-6286)
|
|
50
|
+
zeroEx, };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session-signing.d.ts","sourceRoot":"","sources":["../../../../transactions/intents/session-signing.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"session-signing.d.ts","sourceRoot":"","sources":["../../../../transactions/intents/session-signing.ts"],"names":[],"mappings":"AA+BA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AAE3D,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,kCAAkC,CAAA;AAOtF,OAAO,KAAK,EAEV,oBAAoB,EAGrB,MAAM,qBAAqB,CAAA;AAC5B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAE7C,wBAAgB,gCAAgC,CAAC,mBAAmB,EAClE,QAAQ,EAAE,cAAc,CAAC,mBAAmB,CAAC,EAC7C,QAAQ,EAAE,oBAAoB,GAC7B,oBAAoB,CA+BtB;AAED,wBAAgB,2BAA2B,CAAC,mBAAmB,EAC7D,QAAQ,EAAE,cAAc,CAAC,mBAAmB,CAAC,EAC7C,OAAO,EAAE,cAAc,GACtB,8BAA8B,CA2FhC"}
|
|
@@ -7,6 +7,7 @@ import { resolveAtomicValidator, resolveValidator, } from '../../modules/validat
|
|
|
7
7
|
import { getSessionData } from '../../modules/validators/smart-sessions/digest.js';
|
|
8
8
|
import { getSmartSessionEmissaryAddress } from '../../modules/validators/smart-sessions/module.js';
|
|
9
9
|
import { resolvePermit2ClaimPolicy, selectPermit2ClaimPolicyForMessage, } from '../../modules/validators/smart-sessions/policies/claim.js';
|
|
10
|
+
import { webauthnStatelessCodecContext } from '../../modules/validators/webauthn.js';
|
|
10
11
|
import { getAccountSignatureEnvelope } from '../../signing/context.js';
|
|
11
12
|
import { createValidatorSigningTasks, signingTopology, } from '../../signing/plan.js';
|
|
12
13
|
import { createSignerInvocationPort } from '../../signing/signers/registry.js';
|
|
@@ -257,7 +258,7 @@ function sessionOwnerSigning(session, account) {
|
|
|
257
258
|
id: factor.id,
|
|
258
259
|
publicId: factor.publicId,
|
|
259
260
|
validator: resolveAtomicValidator(factor).address,
|
|
260
|
-
codec:
|
|
261
|
+
codec: withFactorWebauthnContext(requireAtomicSignerCodec(getValidatorCapabilities(factor, resolveAtomicValidator(factor), 'smart-session-owner', 'intent', false).contributionCodec), factor),
|
|
261
262
|
})),
|
|
262
263
|
}
|
|
263
264
|
: {}),
|
|
@@ -325,6 +326,11 @@ function withWebauthnContext(codec, webauthn, account) {
|
|
|
325
326
|
},
|
|
326
327
|
};
|
|
327
328
|
}
|
|
329
|
+
function withFactorWebauthnContext(codec, factor) {
|
|
330
|
+
return factor.kind === 'passkey'
|
|
331
|
+
? { ...codec, webauthn: webauthnStatelessCodecContext(factor) }
|
|
332
|
+
: codec;
|
|
333
|
+
}
|
|
328
334
|
function sessionAccountEnvelope(envelope, validator) {
|
|
329
335
|
if (envelope.kind === 'none')
|
|
330
336
|
return envelope;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validator-account.d.ts","sourceRoot":"","sources":["../../../../transactions/user-operations/validator-account.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,MAAM,CAAA;AAC/B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAA;
|
|
1
|
+
{"version":3,"file":"validator-account.d.ts","sourceRoot":"","sources":["../../../../transactions/user-operations/validator-account.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,MAAM,CAAA;AAC/B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAA;AAQ5D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AAE3D,wBAAgB,6BAA6B,CAC3C,OAAO,EAAE,cAAc,EACvB,OAAO,EAAE,cAAc,GACtB,GAAG,CAuBL"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { encodeMultiFactorContribution } from '../../modules/validators/multi-factor.js';
|
|
2
2
|
import { encodeOwnableMockSignature } from '../../modules/validators/ownable.js';
|
|
3
3
|
import { resolveValidator } from '../../modules/validators/resolve.js';
|
|
4
|
-
import { WEBAUTHN_MOCK_SIGNATURE } from '../../modules/validators/webauthn.js';
|
|
4
|
+
import { WEBAUTHN_MOCK_SIGNATURE, webauthnStatelessMockSignature, } from '../../modules/validators/webauthn.js';
|
|
5
5
|
export function getUserOperationStubSignature(runtime, context) {
|
|
6
6
|
if (!runtime.adapter.capabilities.supportsUserOperations) {
|
|
7
7
|
throw new Error(`Account ${runtime.construction.account.kind} does not support UserOperations`);
|
|
@@ -17,7 +17,7 @@ export function getUserOperationStubSignature(runtime, context) {
|
|
|
17
17
|
publicId: validator.publicId,
|
|
18
18
|
validator: resolveValidator(validator).address,
|
|
19
19
|
contribution: validator.kind === 'passkey'
|
|
20
|
-
?
|
|
20
|
+
? webauthnStatelessMockSignature()
|
|
21
21
|
: encodeOwnableMockSignature(validator.owners.length),
|
|
22
22
|
})),
|
|
23
23
|
});
|