@rhinestone/sdk 1.0.40 → 1.0.41-alpha.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/package.json +1 -1
- package/dist/src/accounts/error.d.ts +0 -114
- package/dist/src/accounts/error.d.ts.map +0 -1
- package/dist/src/accounts/error.js +0 -174
- package/dist/src/accounts/index.d.ts +0 -50
- package/dist/src/accounts/index.d.ts.map +0 -1
- package/dist/src/accounts/index.js +0 -669
- package/dist/src/accounts/index.test.d.ts +0 -2
- package/dist/src/accounts/index.test.d.ts.map +0 -1
- package/dist/src/accounts/index.test.js +0 -33
- package/dist/src/accounts/json-rpc/index.d.ts +0 -5
- package/dist/src/accounts/json-rpc/index.d.ts.map +0 -1
- package/dist/src/accounts/json-rpc/index.js +0 -20
- package/dist/src/accounts/json-rpc/index.test.d.ts +0 -2
- package/dist/src/accounts/json-rpc/index.test.d.ts.map +0 -1
- package/dist/src/accounts/json-rpc/index.test.js +0 -33
- package/dist/src/accounts/json-rpc/providers.d.ts +0 -5
- package/dist/src/accounts/json-rpc/providers.d.ts.map +0 -1
- package/dist/src/accounts/json-rpc/providers.js +0 -22
- package/dist/src/accounts/json-rpc/providers.test.d.ts +0 -2
- package/dist/src/accounts/json-rpc/providers.test.d.ts.map +0 -1
- package/dist/src/accounts/json-rpc/providers.test.js +0 -43
- package/dist/src/accounts/kernel.d.ts +0 -29
- package/dist/src/accounts/kernel.d.ts.map +0 -1
- package/dist/src/accounts/kernel.js +0 -297
- package/dist/src/accounts/kernel.test.d.ts +0 -2
- package/dist/src/accounts/kernel.test.d.ts.map +0 -1
- package/dist/src/accounts/kernel.test.js +0 -132
- package/dist/src/accounts/nexus.d.ts +0 -35
- package/dist/src/accounts/nexus.d.ts.map +0 -1
- package/dist/src/accounts/nexus.js +0 -471
- package/dist/src/accounts/nexus.test.d.ts +0 -2
- package/dist/src/accounts/nexus.test.d.ts.map +0 -1
- package/dist/src/accounts/nexus.test.js +0 -118
- package/dist/src/accounts/passport.d.ts +0 -12
- package/dist/src/accounts/passport.d.ts.map +0 -1
- package/dist/src/accounts/passport.js +0 -173
- package/dist/src/accounts/safe.d.ts +0 -35
- package/dist/src/accounts/safe.d.ts.map +0 -1
- package/dist/src/accounts/safe.js +0 -365
- package/dist/src/accounts/safe.test.d.ts +0 -2
- package/dist/src/accounts/safe.test.d.ts.map +0 -1
- package/dist/src/accounts/safe.test.js +0 -118
- package/dist/src/accounts/signing/common.d.ts +0 -27
- package/dist/src/accounts/signing/common.d.ts.map +0 -1
- package/dist/src/accounts/signing/common.js +0 -183
- package/dist/src/accounts/signing/message.d.ts +0 -5
- package/dist/src/accounts/signing/message.d.ts.map +0 -1
- package/dist/src/accounts/signing/message.js +0 -47
- package/dist/src/accounts/signing/passkeys.d.ts +0 -36
- package/dist/src/accounts/signing/passkeys.d.ts.map +0 -1
- package/dist/src/accounts/signing/passkeys.js +0 -125
- package/dist/src/accounts/signing/passkeys.test.d.ts +0 -2
- package/dist/src/accounts/signing/passkeys.test.d.ts.map +0 -1
- package/dist/src/accounts/signing/passkeys.test.js +0 -88
- package/dist/src/accounts/signing/typedData.d.ts +0 -5
- package/dist/src/accounts/signing/typedData.d.ts.map +0 -1
- package/dist/src/accounts/signing/typedData.js +0 -35
- package/dist/src/accounts/startale.d.ts +0 -27
- package/dist/src/accounts/startale.d.ts.map +0 -1
- package/dist/src/accounts/startale.js +0 -116
- package/dist/src/accounts/startale.test.d.ts +0 -2
- package/dist/src/accounts/startale.test.d.ts.map +0 -1
- package/dist/src/accounts/startale.test.js +0 -92
- package/dist/src/accounts/utils.d.ts +0 -33
- package/dist/src/accounts/utils.d.ts.map +0 -1
- package/dist/src/accounts/utils.js +0 -201
- package/dist/src/accounts/utils.test.d.ts +0 -2
- package/dist/src/accounts/utils.test.d.ts.map +0 -1
- package/dist/src/accounts/utils.test.js +0 -49
- package/dist/src/accounts/walletClient.d.ts +0 -34
- package/dist/src/accounts/walletClient.d.ts.map +0 -1
- package/dist/src/accounts/walletClient.js +0 -121
- package/dist/src/actions/compact.d.ts +0 -13
- package/dist/src/actions/compact.d.ts.map +0 -1
- package/dist/src/actions/compact.js +0 -210
- package/dist/src/actions/deployment.d.ts +0 -19
- package/dist/src/actions/deployment.d.ts.map +0 -1
- package/dist/src/actions/deployment.js +0 -78
- package/dist/src/actions/ecdsa.d.ts +0 -35
- package/dist/src/actions/ecdsa.d.ts.map +0 -1
- package/dist/src/actions/ecdsa.js +0 -114
- package/dist/src/actions/ecdsa.test.d.ts +0 -2
- package/dist/src/actions/ecdsa.test.d.ts.map +0 -1
- package/dist/src/actions/ecdsa.test.js +0 -99
- package/dist/src/actions/index.d.ts +0 -17
- package/dist/src/actions/index.d.ts.map +0 -1
- package/dist/src/actions/index.js +0 -53
- package/dist/src/actions/mfa.d.ts +0 -37
- package/dist/src/actions/mfa.d.ts.map +0 -1
- package/dist/src/actions/mfa.js +0 -133
- package/dist/src/actions/passkeys.d.ts +0 -37
- package/dist/src/actions/passkeys.d.ts.map +0 -1
- package/dist/src/actions/passkeys.js +0 -129
- package/dist/src/actions/passkeys.test.d.ts +0 -2
- package/dist/src/actions/passkeys.test.d.ts.map +0 -1
- package/dist/src/actions/passkeys.test.js +0 -54
- package/dist/src/actions/recovery.d.ts +0 -33
- package/dist/src/actions/recovery.d.ts.map +0 -1
- package/dist/src/actions/recovery.js +0 -193
- package/dist/src/actions/recovery.test.d.ts +0 -2
- package/dist/src/actions/recovery.test.d.ts.map +0 -1
- package/dist/src/actions/recovery.test.js +0 -168
- package/dist/src/actions/smart-sessions.d.ts +0 -14
- package/dist/src/actions/smart-sessions.d.ts.map +0 -1
- package/dist/src/actions/smart-sessions.js +0 -16
- package/dist/src/errors/index.d.ts +0 -5
- package/dist/src/errors/index.d.ts.map +0 -1
- package/dist/src/errors/index.js +0 -53
- package/dist/src/execution/compact.d.ts +0 -151
- package/dist/src/execution/compact.d.ts.map +0 -1
- package/dist/src/execution/compact.js +0 -122
- package/dist/src/execution/error.d.ts +0 -61
- package/dist/src/execution/error.d.ts.map +0 -1
- package/dist/src/execution/error.js +0 -87
- package/dist/src/execution/index.d.ts +0 -41
- package/dist/src/execution/index.d.ts.map +0 -1
- package/dist/src/execution/index.js +0 -233
- package/dist/src/execution/permit2.d.ts +0 -148
- package/dist/src/execution/permit2.d.ts.map +0 -1
- package/dist/src/execution/permit2.js +0 -291
- package/dist/src/execution/singleChainOps.d.ts +0 -28
- package/dist/src/execution/singleChainOps.d.ts.map +0 -1
- package/dist/src/execution/singleChainOps.js +0 -32
- package/dist/src/execution/smart-session.d.ts +0 -13
- package/dist/src/execution/smart-session.d.ts.map +0 -1
- package/dist/src/execution/smart-session.js +0 -178
- package/dist/src/execution/types.d.ts +0 -36
- package/dist/src/execution/types.d.ts.map +0 -1
- package/dist/src/execution/types.js +0 -2
- package/dist/src/execution/utils.d.ts +0 -83
- package/dist/src/execution/utils.d.ts.map +0 -1
- package/dist/src/execution/utils.js +0 -705
- package/dist/src/index.d.ts +0 -74
- package/dist/src/index.d.ts.map +0 -1
- package/dist/src/index.js +0 -317
- package/dist/src/modules/abi/smart-sessions.d.ts +0 -104
- package/dist/src/modules/abi/smart-sessions.d.ts.map +0 -1
- package/dist/src/modules/abi/smart-sessions.js +0 -131
- package/dist/src/modules/chain-abstraction.d.ts +0 -5
- package/dist/src/modules/chain-abstraction.d.ts.map +0 -1
- package/dist/src/modules/chain-abstraction.js +0 -7
- package/dist/src/modules/common.d.ts +0 -30
- package/dist/src/modules/common.d.ts.map +0 -1
- package/dist/src/modules/common.js +0 -42
- package/dist/src/modules/index.d.ts +0 -10
- package/dist/src/modules/index.d.ts.map +0 -1
- package/dist/src/modules/index.js +0 -94
- package/dist/src/modules/index.test.d.ts +0 -2
- package/dist/src/modules/index.test.d.ts.map +0 -1
- package/dist/src/modules/index.test.js +0 -81
- package/dist/src/modules/legacy.d.ts +0 -10
- package/dist/src/modules/legacy.d.ts.map +0 -1
- package/dist/src/modules/legacy.js +0 -65
- package/dist/src/modules/read.d.ts +0 -9
- package/dist/src/modules/read.d.ts.map +0 -1
- package/dist/src/modules/read.js +0 -125
- package/dist/src/modules/validators/core.d.ts +0 -29
- package/dist/src/modules/validators/core.d.ts.map +0 -1
- package/dist/src/modules/validators/core.js +0 -278
- package/dist/src/modules/validators/core.test.d.ts +0 -2
- package/dist/src/modules/validators/core.test.d.ts.map +0 -1
- package/dist/src/modules/validators/core.test.js +0 -101
- package/dist/src/modules/validators/index.d.ts +0 -4
- package/dist/src/modules/validators/index.d.ts.map +0 -1
- package/dist/src/modules/validators/index.js +0 -15
- package/dist/src/modules/validators/smart-sessions.d.ts +0 -96
- package/dist/src/modules/validators/smart-sessions.d.ts.map +0 -1
- package/dist/src/modules/validators/smart-sessions.js +0 -497
- package/dist/src/modules/validators/smart-sessions.test.d.ts +0 -2
- package/dist/src/modules/validators/smart-sessions.test.d.ts.map +0 -1
- package/dist/src/modules/validators/smart-sessions.test.js +0 -219
- package/dist/src/orchestrator/client.d.ts +0 -27
- package/dist/src/orchestrator/client.d.ts.map +0 -1
- package/dist/src/orchestrator/client.js +0 -354
- package/dist/src/orchestrator/consts.d.ts +0 -5
- package/dist/src/orchestrator/consts.d.ts.map +0 -1
- package/dist/src/orchestrator/consts.js +0 -9
- package/dist/src/orchestrator/error.d.ts +0 -232
- package/dist/src/orchestrator/error.d.ts.map +0 -1
- package/dist/src/orchestrator/error.js +0 -268
- package/dist/src/orchestrator/index.d.ts +0 -10
- package/dist/src/orchestrator/index.d.ts.map +0 -1
- package/dist/src/orchestrator/index.js +0 -57
- package/dist/src/orchestrator/registry.d.ts +0 -22
- package/dist/src/orchestrator/registry.d.ts.map +0 -1
- package/dist/src/orchestrator/registry.js +0 -121
- package/dist/src/orchestrator/registry.test.d.ts +0 -2
- package/dist/src/orchestrator/registry.test.d.ts.map +0 -1
- package/dist/src/orchestrator/registry.test.js +0 -150
- package/dist/src/orchestrator/types.d.ts +0 -295
- package/dist/src/orchestrator/types.d.ts.map +0 -1
- package/dist/src/orchestrator/types.js +0 -17
- package/dist/src/orchestrator/utils.d.ts +0 -3
- package/dist/src/orchestrator/utils.d.ts.map +0 -1
- package/dist/src/orchestrator/utils.js +0 -24
- package/dist/src/types.d.ts +0 -278
- package/dist/src/types.d.ts.map +0 -1
- package/dist/src/types.js +0 -2
- package/dist/src/utils/index.d.ts +0 -26
- package/dist/src/utils/index.d.ts.map +0 -1
- package/dist/src/utils/index.js +0 -63
- package/dist/test/consts.d.ts +0 -10
- package/dist/test/consts.d.ts.map +0 -1
- package/dist/test/consts.js +0 -22
- package/dist/test/utils/utils.d.ts +0 -5
- package/dist/test/utils/utils.d.ts.map +0 -1
- package/dist/test/utils/utils.js +0 -20
|
@@ -1,183 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.convertOwnerSetToSignerSet = convertOwnerSetToSignerSet;
|
|
4
|
-
exports.signWithMultiFactorAuth = signWithMultiFactorAuth;
|
|
5
|
-
exports.signWithSession = signWithSession;
|
|
6
|
-
exports.signWithGuardians = signWithGuardians;
|
|
7
|
-
exports.signWithOwners = signWithOwners;
|
|
8
|
-
const viem_1 = require("viem");
|
|
9
|
-
const modules_1 = require("../../modules");
|
|
10
|
-
const core_1 = require("../../modules/validators/core");
|
|
11
|
-
const passkeys_1 = require("./passkeys");
|
|
12
|
-
function convertOwnerSetToSignerSet(owners) {
|
|
13
|
-
switch (owners.type) {
|
|
14
|
-
case 'ecdsa': {
|
|
15
|
-
return {
|
|
16
|
-
type: 'owner',
|
|
17
|
-
kind: 'ecdsa',
|
|
18
|
-
accounts: owners.accounts,
|
|
19
|
-
module: owners.module ?? core_1.OWNABLE_VALIDATOR_ADDRESS,
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
case 'ens': {
|
|
23
|
-
return {
|
|
24
|
-
type: 'owner',
|
|
25
|
-
kind: 'ecdsa',
|
|
26
|
-
accounts: owners.accounts,
|
|
27
|
-
module: owners.module ?? core_1.ENS_VALIDATOR_ADDRESS,
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
case 'passkey': {
|
|
31
|
-
return {
|
|
32
|
-
type: 'owner',
|
|
33
|
-
kind: 'passkey',
|
|
34
|
-
accounts: owners.accounts,
|
|
35
|
-
module: owners.module,
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
case 'multi-factor': {
|
|
39
|
-
return {
|
|
40
|
-
type: 'owner',
|
|
41
|
-
kind: 'multi-factor',
|
|
42
|
-
validators: owners.validators.map((validator, index) => {
|
|
43
|
-
switch (validator.type) {
|
|
44
|
-
case 'ecdsa': {
|
|
45
|
-
return {
|
|
46
|
-
type: validator.type,
|
|
47
|
-
id: index,
|
|
48
|
-
accounts: validator.accounts,
|
|
49
|
-
module: validator.module ?? core_1.OWNABLE_VALIDATOR_ADDRESS,
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
case 'ens': {
|
|
53
|
-
return {
|
|
54
|
-
type: 'ecdsa',
|
|
55
|
-
id: index,
|
|
56
|
-
accounts: validator.accounts,
|
|
57
|
-
module: validator.module ?? core_1.ENS_VALIDATOR_ADDRESS,
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
case 'passkey': {
|
|
61
|
-
return {
|
|
62
|
-
type: 'passkey',
|
|
63
|
-
id: index,
|
|
64
|
-
accounts: validator.accounts,
|
|
65
|
-
module: validator.module,
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
default: {
|
|
69
|
-
throw new Error(`Unsupported validator type: ${validator.type}`);
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
}),
|
|
73
|
-
};
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
async function signWithMultiFactorAuth(signers, chain, address, params, isUserOpHash, signMain) {
|
|
78
|
-
const signatures = await Promise.all(signers.validators.map(async (validator) => {
|
|
79
|
-
if (validator === null) {
|
|
80
|
-
return '0x';
|
|
81
|
-
}
|
|
82
|
-
const validatorSigners = convertOwnerSetToSignerSet(validator);
|
|
83
|
-
return signMain(validatorSigners, chain, address, params, isUserOpHash);
|
|
84
|
-
}));
|
|
85
|
-
const data = (0, viem_1.encodeAbiParameters)([
|
|
86
|
-
{
|
|
87
|
-
components: [
|
|
88
|
-
{
|
|
89
|
-
internalType: 'bytes32',
|
|
90
|
-
name: 'packedValidatorAndId',
|
|
91
|
-
type: 'bytes32',
|
|
92
|
-
},
|
|
93
|
-
{ internalType: 'bytes', name: 'data', type: 'bytes' },
|
|
94
|
-
],
|
|
95
|
-
name: 'validators',
|
|
96
|
-
type: 'tuple[]',
|
|
97
|
-
},
|
|
98
|
-
], [
|
|
99
|
-
signers.validators.map((validator, index) => {
|
|
100
|
-
const validatorModule = (0, core_1.getValidator)(validator);
|
|
101
|
-
return {
|
|
102
|
-
packedValidatorAndId: (0, viem_1.concat)([
|
|
103
|
-
(0, viem_1.pad)((0, viem_1.toHex)(validator.id), {
|
|
104
|
-
size: 12,
|
|
105
|
-
}),
|
|
106
|
-
validatorModule.address,
|
|
107
|
-
]),
|
|
108
|
-
data: signatures[index],
|
|
109
|
-
};
|
|
110
|
-
}),
|
|
111
|
-
]);
|
|
112
|
-
return data;
|
|
113
|
-
}
|
|
114
|
-
async function signWithSession(signers, chain, address, params, isUserOpHash, signMain) {
|
|
115
|
-
const sessionSigners = convertOwnerSetToSignerSet(signers.session.owners);
|
|
116
|
-
return signMain(sessionSigners, chain, address, params, isUserOpHash);
|
|
117
|
-
}
|
|
118
|
-
async function signWithGuardians(signers, params, signingFunctions) {
|
|
119
|
-
const signatures = await Promise.all(signers.guardians.map((account) => signingFunctions.signEcdsa(account, params, false)));
|
|
120
|
-
return (0, viem_1.concat)(signatures);
|
|
121
|
-
}
|
|
122
|
-
async function signWithOwners(signers, chain, address, params, signingFunctions, isUserOpHash, signMain) {
|
|
123
|
-
async function signEcdsWithChain(account, params, updateV, chain) {
|
|
124
|
-
const client = account.client;
|
|
125
|
-
const transport = client?.transport;
|
|
126
|
-
if (transport) {
|
|
127
|
-
// Switch chain
|
|
128
|
-
const walletClient = (0, viem_1.createWalletClient)({
|
|
129
|
-
chain,
|
|
130
|
-
transport: (0, viem_1.custom)(transport),
|
|
131
|
-
account,
|
|
132
|
-
});
|
|
133
|
-
await walletClient.switchChain({
|
|
134
|
-
id: chain.id,
|
|
135
|
-
});
|
|
136
|
-
}
|
|
137
|
-
// Sign
|
|
138
|
-
return signingFunctions.signEcdsa(account, params, updateV);
|
|
139
|
-
}
|
|
140
|
-
switch (signers.kind) {
|
|
141
|
-
case 'ecdsa': {
|
|
142
|
-
// Ownable validator uses `v` value to determine which validation mode to use
|
|
143
|
-
// ENS validator (based on Ownable) also uses the same signature format
|
|
144
|
-
// This is not needed for UserOps
|
|
145
|
-
const isOwnableOrENS = !signers.module ||
|
|
146
|
-
signers.module?.toLowerCase() === core_1.OWNABLE_VALIDATOR_ADDRESS ||
|
|
147
|
-
signers.module?.toLowerCase() === core_1.ENS_VALIDATOR_ADDRESS;
|
|
148
|
-
const updateV = isOwnableOrENS && !isUserOpHash;
|
|
149
|
-
const signatures = await Promise.all(signers.accounts.map((account) => signEcdsWithChain(account, params, updateV, chain)));
|
|
150
|
-
return (0, viem_1.concat)(signatures);
|
|
151
|
-
}
|
|
152
|
-
case 'passkey': {
|
|
153
|
-
const signatures = await Promise.all(signers.accounts.map((account) => signingFunctions.signPasskey(account, params)));
|
|
154
|
-
const usePrecompile = (0, modules_1.isRip7212SupportedNetwork)(chain);
|
|
155
|
-
const credIds = signers.accounts.map((account) => {
|
|
156
|
-
const publicKey = account.publicKey;
|
|
157
|
-
const { x, y } = (0, passkeys_1.parsePublicKey)(publicKey);
|
|
158
|
-
return (0, passkeys_1.generateCredentialId)(x, y, address);
|
|
159
|
-
});
|
|
160
|
-
const webAuthns = signatures.map((signature) => {
|
|
161
|
-
const { r, s } = (0, passkeys_1.parseSignature)(signature.signature);
|
|
162
|
-
return {
|
|
163
|
-
authenticatorData: signature.webauthn.authenticatorData,
|
|
164
|
-
clientDataJSON: signature.webauthn.clientDataJSON,
|
|
165
|
-
challengeIndex: BigInt(signature.webauthn.challengeIndex),
|
|
166
|
-
typeIndex: BigInt(signature.webauthn.typeIndex),
|
|
167
|
-
r,
|
|
168
|
-
s,
|
|
169
|
-
};
|
|
170
|
-
});
|
|
171
|
-
if (signers.module?.toLowerCase() === core_1.WEBAUTHN_V0_VALIDATOR_ADDRESS) {
|
|
172
|
-
return (0, passkeys_1.packSignatureV0)(webAuthns[0], usePrecompile);
|
|
173
|
-
}
|
|
174
|
-
return (0, passkeys_1.packSignature)(credIds, usePrecompile, webAuthns);
|
|
175
|
-
}
|
|
176
|
-
case 'multi-factor': {
|
|
177
|
-
return signWithMultiFactorAuth(signers, chain, address, params, isUserOpHash, signMain);
|
|
178
|
-
}
|
|
179
|
-
default: {
|
|
180
|
-
throw new Error('Unsupported owner kind');
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { type Address, type Chain, type Hex } from 'viem';
|
|
2
|
-
import type { SignerSet } from '../../types';
|
|
3
|
-
declare function sign(signers: SignerSet, chain: Chain, address: Address, hash: Hex, isUserOpHash: boolean): Promise<Hex>;
|
|
4
|
-
export { sign };
|
|
5
|
-
//# sourceMappingURL=message.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"message.d.ts","sourceRoot":"","sources":["../../../../accounts/signing/message.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,OAAO,EACZ,KAAK,KAAK,EAEV,KAAK,GAAG,EAGT,MAAM,MAAM,CAAA;AAEb,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAS5C,iBAAe,IAAI,CACjB,OAAO,EAAE,SAAS,EAClB,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,GAAG,EACT,YAAY,EAAE,OAAO,GACpB,OAAO,CAAC,GAAG,CAAC,CAyBd;AA4BD,OAAO,EAAE,IAAI,EAAE,CAAA"}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.sign = sign;
|
|
4
|
-
const viem_1 = require("viem");
|
|
5
|
-
const error_1 = require("../error");
|
|
6
|
-
const common_1 = require("./common");
|
|
7
|
-
async function sign(signers, chain, address, hash, isUserOpHash) {
|
|
8
|
-
const signingFunctions = {
|
|
9
|
-
signEcdsa: (account, hash, updateV) => signEcdsa(account, hash, updateV),
|
|
10
|
-
signPasskey: (account, hash) => signPasskey(account, hash),
|
|
11
|
-
};
|
|
12
|
-
switch (signers.type) {
|
|
13
|
-
case 'owner': {
|
|
14
|
-
return (0, common_1.signWithOwners)(signers, chain, address, hash, signingFunctions, isUserOpHash, sign);
|
|
15
|
-
}
|
|
16
|
-
case 'session': {
|
|
17
|
-
return (0, common_1.signWithSession)(signers, chain, address, hash, false, sign);
|
|
18
|
-
}
|
|
19
|
-
case 'guardians': {
|
|
20
|
-
return (0, common_1.signWithGuardians)(signers, hash, signingFunctions);
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
async function signEcdsa(account, hash, updateV) {
|
|
25
|
-
if (!account.signMessage) {
|
|
26
|
-
throw new error_1.SigningNotSupportedForAccountError();
|
|
27
|
-
}
|
|
28
|
-
const originalSignature = await account.signMessage({
|
|
29
|
-
message: { raw: hash },
|
|
30
|
-
});
|
|
31
|
-
// Manually tweak the `v` value to trigger the message prefixing onchain
|
|
32
|
-
// https://github.com/rhinestonewtf/checknsignatures/blob/main/src/CheckNSignatures.sol#L53-L61
|
|
33
|
-
const { r, s, v } = (0, viem_1.parseSignature)(originalSignature);
|
|
34
|
-
if (!v) {
|
|
35
|
-
throw new Error('Invalid signature');
|
|
36
|
-
}
|
|
37
|
-
const newV = updateV ? v + 4n : v;
|
|
38
|
-
const newSignature = (0, viem_1.concat)([r, s, (0, viem_1.toHex)(newV)]);
|
|
39
|
-
return newSignature;
|
|
40
|
-
}
|
|
41
|
-
async function signPasskey(account, hash) {
|
|
42
|
-
const { webauthn, signature } = await account.sign({ hash });
|
|
43
|
-
return {
|
|
44
|
-
webauthn,
|
|
45
|
-
signature,
|
|
46
|
-
};
|
|
47
|
-
}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { type Address, type Hex } from 'viem';
|
|
2
|
-
interface WebAuthnSignature {
|
|
3
|
-
authenticatorData: Hex;
|
|
4
|
-
clientDataJSON: string;
|
|
5
|
-
challengeIndex: bigint;
|
|
6
|
-
typeIndex: bigint;
|
|
7
|
-
r: bigint;
|
|
8
|
-
s: bigint;
|
|
9
|
-
}
|
|
10
|
-
declare function parsePublicKey(publicKey: Hex | Uint8Array): {
|
|
11
|
-
x: bigint;
|
|
12
|
-
y: bigint;
|
|
13
|
-
};
|
|
14
|
-
declare function parseSignature(signature: Hex | Uint8Array): {
|
|
15
|
-
r: bigint;
|
|
16
|
-
s: bigint;
|
|
17
|
-
};
|
|
18
|
-
declare function generateCredentialId(pubKeyX: bigint, pubKeyY: bigint, account: Address): `0x${string}`;
|
|
19
|
-
declare function packSignature(credIds: Hex[], usePrecompile: boolean, webAuthns: {
|
|
20
|
-
authenticatorData: Hex;
|
|
21
|
-
clientDataJSON: string;
|
|
22
|
-
challengeIndex: bigint;
|
|
23
|
-
typeIndex: bigint;
|
|
24
|
-
r: bigint;
|
|
25
|
-
s: bigint;
|
|
26
|
-
}[]): Hex;
|
|
27
|
-
declare function packSignatureV0(webauthn: {
|
|
28
|
-
authenticatorData: Hex;
|
|
29
|
-
clientDataJSON: string;
|
|
30
|
-
typeIndex: number | bigint;
|
|
31
|
-
r: bigint;
|
|
32
|
-
s: bigint;
|
|
33
|
-
}, usePrecompiled: boolean): `0x${string}`;
|
|
34
|
-
export { parsePublicKey, parseSignature, generateCredentialId, packSignature, packSignatureV0, };
|
|
35
|
-
export type { WebAuthnSignature };
|
|
36
|
-
//# sourceMappingURL=passkeys.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"passkeys.d.ts","sourceRoot":"","sources":["../../../../accounts/signing/passkeys.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,OAAO,EAGZ,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,CAC3B,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,OAAO,iBAkBjB;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"}
|
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.parsePublicKey = parsePublicKey;
|
|
4
|
-
exports.parseSignature = parseSignature;
|
|
5
|
-
exports.generateCredentialId = generateCredentialId;
|
|
6
|
-
exports.packSignature = packSignature;
|
|
7
|
-
exports.packSignatureV0 = packSignatureV0;
|
|
8
|
-
const viem_1 = require("viem");
|
|
9
|
-
function parsePublicKey(publicKey) {
|
|
10
|
-
const bytes = typeof publicKey === 'string' ? (0, viem_1.hexToBytes)(publicKey) : publicKey;
|
|
11
|
-
const offset = bytes.length === 65 ? 1 : 0;
|
|
12
|
-
const x = bytes.slice(offset, 32 + offset);
|
|
13
|
-
const y = bytes.slice(32 + offset, 64 + offset);
|
|
14
|
-
return {
|
|
15
|
-
x: BigInt((0, viem_1.bytesToHex)(x)),
|
|
16
|
-
y: BigInt((0, viem_1.bytesToHex)(y)),
|
|
17
|
-
};
|
|
18
|
-
}
|
|
19
|
-
function parseSignature(signature) {
|
|
20
|
-
const bytes = typeof signature === 'string' ? (0, viem_1.hexToBytes)(signature) : signature;
|
|
21
|
-
const r = bytes.slice(0, 32);
|
|
22
|
-
const s = bytes.slice(32, 64);
|
|
23
|
-
return {
|
|
24
|
-
r: BigInt((0, viem_1.bytesToHex)(r)),
|
|
25
|
-
s: BigInt((0, viem_1.bytesToHex)(s)),
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
function generateCredentialId(pubKeyX, pubKeyY, account) {
|
|
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]));
|
|
40
|
-
}
|
|
41
|
-
function packSignature(credIds, usePrecompile, webAuthns) {
|
|
42
|
-
// Sort both `credIds` and `webAuthns` by credIds
|
|
43
|
-
const credIdsAndWebAuthns = credIds.map((credId, index) => ({
|
|
44
|
-
credId,
|
|
45
|
-
webAuthn: webAuthns[index],
|
|
46
|
-
}));
|
|
47
|
-
credIdsAndWebAuthns.sort((a, b) => a.credId.localeCompare(b.credId));
|
|
48
|
-
credIds = credIdsAndWebAuthns.map(({ credId }) => credId);
|
|
49
|
-
webAuthns = credIdsAndWebAuthns.map(({ webAuthn }) => webAuthn);
|
|
50
|
-
// Encode
|
|
51
|
-
return (0, viem_1.encodeAbiParameters)([
|
|
52
|
-
{
|
|
53
|
-
type: 'bytes32[]',
|
|
54
|
-
name: 'credIds',
|
|
55
|
-
},
|
|
56
|
-
{
|
|
57
|
-
type: 'bool',
|
|
58
|
-
name: 'usePrecompile',
|
|
59
|
-
},
|
|
60
|
-
{
|
|
61
|
-
type: 'tuple[]',
|
|
62
|
-
name: 'webAuthns',
|
|
63
|
-
components: [
|
|
64
|
-
{
|
|
65
|
-
type: 'bytes',
|
|
66
|
-
name: 'authenticatorData',
|
|
67
|
-
},
|
|
68
|
-
{
|
|
69
|
-
type: 'string',
|
|
70
|
-
name: 'clientDataJSON',
|
|
71
|
-
},
|
|
72
|
-
{
|
|
73
|
-
type: 'uint256',
|
|
74
|
-
name: 'challengeIndex',
|
|
75
|
-
},
|
|
76
|
-
{
|
|
77
|
-
type: 'uint256',
|
|
78
|
-
name: 'typeIndex',
|
|
79
|
-
},
|
|
80
|
-
{
|
|
81
|
-
type: 'uint256',
|
|
82
|
-
name: 'r',
|
|
83
|
-
},
|
|
84
|
-
{
|
|
85
|
-
type: 'uint256',
|
|
86
|
-
name: 's',
|
|
87
|
-
},
|
|
88
|
-
],
|
|
89
|
-
},
|
|
90
|
-
], [credIds, usePrecompile, webAuthns]);
|
|
91
|
-
}
|
|
92
|
-
function packSignatureV0(webauthn, usePrecompiled) {
|
|
93
|
-
return (0, viem_1.encodeAbiParameters)([
|
|
94
|
-
{ type: 'bytes', name: 'authenticatorData' },
|
|
95
|
-
{
|
|
96
|
-
type: 'string',
|
|
97
|
-
name: 'clientDataJSON',
|
|
98
|
-
},
|
|
99
|
-
{
|
|
100
|
-
type: 'uint256',
|
|
101
|
-
name: 'responseTypeLocation',
|
|
102
|
-
},
|
|
103
|
-
{
|
|
104
|
-
type: 'uint256',
|
|
105
|
-
name: 'r',
|
|
106
|
-
},
|
|
107
|
-
{
|
|
108
|
-
type: 'uint256',
|
|
109
|
-
name: 's',
|
|
110
|
-
},
|
|
111
|
-
{
|
|
112
|
-
type: 'bool',
|
|
113
|
-
name: 'usePrecompiled',
|
|
114
|
-
},
|
|
115
|
-
], [
|
|
116
|
-
webauthn.authenticatorData,
|
|
117
|
-
webauthn.clientDataJSON,
|
|
118
|
-
typeof webauthn.typeIndex === 'bigint'
|
|
119
|
-
? webauthn.typeIndex
|
|
120
|
-
: BigInt(webauthn.typeIndex),
|
|
121
|
-
webauthn.r,
|
|
122
|
-
webauthn.s,
|
|
123
|
-
usePrecompiled,
|
|
124
|
-
]);
|
|
125
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"passkeys.test.d.ts","sourceRoot":"","sources":["../../../../accounts/signing/passkeys.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const vitest_1 = require("vitest");
|
|
4
|
-
const passkeys_1 = require("./passkeys");
|
|
5
|
-
(0, vitest_1.describe)('Passkeys', () => {
|
|
6
|
-
(0, vitest_1.describe)('Parse Public Key', () => {
|
|
7
|
-
(0, vitest_1.test)('default', () => {
|
|
8
|
-
const parsed = (0, passkeys_1.parsePublicKey)('0x7a2b9234dbc079da984e021acb76cf230dff5c03f2c5668024ddaeeb388520294bd61dcef34cade4d3bca405e63179ef022948ac45d0b0530cb125977c118ad7');
|
|
9
|
-
(0, vitest_1.expect)(parsed.x).toEqual(55259151030970399927675340420359705684663366332711724388150056154288143802409n);
|
|
10
|
-
(0, vitest_1.expect)(parsed.y).toEqual(34301774645623054632612895881498878184566570389017277955884655401641769536215n);
|
|
11
|
-
});
|
|
12
|
-
});
|
|
13
|
-
(0, vitest_1.describe)('Parse Signature', () => {
|
|
14
|
-
(0, vitest_1.test)('default', () => {
|
|
15
|
-
const parsed = (0, passkeys_1.parseSignature)('0xf60f80fe3fd029d1b380d631f0b659bfbc8f8f60921a88e1e123c159aa540f920ed337464d1bb813dc5f9c3e81998185370da49cc525e9f42cdf805f1030aff8');
|
|
16
|
-
(0, vitest_1.expect)(parsed.r).toEqual(111296353735534357766084082487308191701889898756402773464442570100570127077266n);
|
|
17
|
-
(0, vitest_1.expect)(parsed.s).toEqual(6705566102199758127831148650668918567109283965479844611524279039128750829560n);
|
|
18
|
-
});
|
|
19
|
-
});
|
|
20
|
-
(0, vitest_1.describe)('Generate Credential ID', () => {
|
|
21
|
-
(0, vitest_1.test)('default', () => {
|
|
22
|
-
const id = (0, passkeys_1.generateCredentialId)(55259151030970399927675340420359705684663366332711724388150056154288143802409n, 34301774645623054632612895881498878184566570389017277955884655401641769536215n, '0xb975975c9f381b5df3b4af93bdd1ba739698bc37');
|
|
23
|
-
(0, vitest_1.expect)(id).toEqual('0x9437809df26444a849d303b1174543f0851df5fae657da19f3bb0d92356426ea');
|
|
24
|
-
});
|
|
25
|
-
});
|
|
26
|
-
(0, vitest_1.describe)('Pack Signature', () => {
|
|
27
|
-
(0, vitest_1.test)('single', () => {
|
|
28
|
-
const credIds = [
|
|
29
|
-
'0x9437809df26444a849d303b1174543f0851df5fae657da19f3bb0d92356426ea',
|
|
30
|
-
];
|
|
31
|
-
const usePrecompile = false;
|
|
32
|
-
const webAuthns = [
|
|
33
|
-
{
|
|
34
|
-
authenticatorData: '0x49960de5880e8c687434170f6476605b8fe4aeb9a28632c7995cf3ba831d97631d00000000',
|
|
35
|
-
clientDataJSON: '{"type":"webauthn.get","challenge":"4p2TiZpTooLCFFYTC2HmMPVMiVjZGghCJ0dz7zUDEeA","origin":"http://localhost:5173","crossOrigin":false}',
|
|
36
|
-
challengeIndex: 23n,
|
|
37
|
-
typeIndex: 1n,
|
|
38
|
-
r: 111296353735534357766084082487308191701889898756402773464442570100570127077266n,
|
|
39
|
-
s: 6705566102199758127831148650668918567109283965479844611524279039128750829560n,
|
|
40
|
-
},
|
|
41
|
-
];
|
|
42
|
-
const packed = (0, passkeys_1.packSignature)(credIds, usePrecompile, webAuthns);
|
|
43
|
-
(0, vitest_1.expect)(packed).toEqual('0x0000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000019437809df26444a849d303b1174543f0851df5fae657da19f3bb0d92356426ea0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000012000000000000000000000000000000000000000000000000000000000000000170000000000000000000000000000000000000000000000000000000000000001f60f80fe3fd029d1b380d631f0b659bfbc8f8f60921a88e1e123c159aa540f920ed337464d1bb813dc5f9c3e81998185370da49cc525e9f42cdf805f1030aff8000000000000000000000000000000000000000000000000000000000000002549960de5880e8c687434170f6476605b8fe4aeb9a28632c7995cf3ba831d97631d0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000867b2274797065223a22776562617574686e2e676574222c226368616c6c656e6765223a2234703254695a70546f6f4c43464659544332486d4d50564d69566a5a476768434a30647a377a5544456541222c226f726967696e223a22687474703a2f2f6c6f63616c686f73743a35313733222c2263726f73734f726967696e223a66616c73657d0000000000000000000000000000000000000000000000000000');
|
|
44
|
-
});
|
|
45
|
-
(0, vitest_1.test)('multisig', () => {
|
|
46
|
-
const credIds = [
|
|
47
|
-
'0x9437809df26444a849d303b1174543f0851df5fae657da19f3bb0d92356426ea',
|
|
48
|
-
'0x6be9646e4d64132d1a1789a467d0501e948d23afce6792d963f401434d7bef33',
|
|
49
|
-
];
|
|
50
|
-
const usePrecompile = true;
|
|
51
|
-
const webAuthns = [
|
|
52
|
-
{
|
|
53
|
-
authenticatorData: '0x49960de5880e8c687434170f6476605b8fe4aeb9a28632c7995cf3ba831d97631d00000000',
|
|
54
|
-
clientDataJSON: '{"type":"webauthn.get","challenge":"4p2TiZpTooLCFFYTC2HmMPVMiVjZGghCJ0dz7zUDEeA","origin":"http://localhost:5173","crossOrigin":false}',
|
|
55
|
-
challengeIndex: 23n,
|
|
56
|
-
typeIndex: 1n,
|
|
57
|
-
r: 111296353735534357766084082487308191701889898756402773464442570100570127077266n,
|
|
58
|
-
s: 6705566102199758127831148650668918567109283965479844611524279039128750829560n,
|
|
59
|
-
},
|
|
60
|
-
{
|
|
61
|
-
authenticatorData: '0x49960de5880e8c687434170f6476605b8fe4aeb9a28632c7995cf3ba831d97631d00000000',
|
|
62
|
-
clientDataJSON: '{"type":"webauthn.get","challenge":"19qAcQAVCeucFt8tQSizBBdbxW6Jkex_3nAejdRuVek","origin":"http://localhost:5173","crossOrigin":false}',
|
|
63
|
-
challengeIndex: 23n,
|
|
64
|
-
typeIndex: 1n,
|
|
65
|
-
r: 52674584175531096231012948456392242307658490190760877544141461393264453154030n,
|
|
66
|
-
s: 1045924358482323524717958171193057427003444327614976707002321626568131749413n,
|
|
67
|
-
},
|
|
68
|
-
];
|
|
69
|
-
const packed = (0, passkeys_1.packSignature)(credIds, usePrecompile, webAuthns);
|
|
70
|
-
(0, vitest_1.expect)(packed).toEqual('0x0000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000000026be9646e4d64132d1a1789a467d0501e948d23afce6792d963f401434d7bef339437809df26444a849d303b1174543f0851df5fae657da19f3bb0d92356426ea00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000022000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000120000000000000000000000000000000000000000000000000000000000000001700000000000000000000000000000000000000000000000000000000000000017474c214167b8a4704cf06f75287a738e7ddbcca9cc0383db6dac6a7d090f4ee024ff8e2a2e8c54aa8cf5f36e3b6125016c3d58d896e3a85c5cd2cd0027a2625000000000000000000000000000000000000000000000000000000000000002549960de5880e8c687434170f6476605b8fe4aeb9a28632c7995cf3ba831d97631d0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000867b2274797065223a22776562617574686e2e676574222c226368616c6c656e6765223a22313971416351415643657563467438745153697a424264627857364a6b65785f336e41656a64527556656b222c226f726967696e223a22687474703a2f2f6c6f63616c686f73743a35313733222c2263726f73734f726967696e223a66616c73657d000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000012000000000000000000000000000000000000000000000000000000000000000170000000000000000000000000000000000000000000000000000000000000001f60f80fe3fd029d1b380d631f0b659bfbc8f8f60921a88e1e123c159aa540f920ed337464d1bb813dc5f9c3e81998185370da49cc525e9f42cdf805f1030aff8000000000000000000000000000000000000000000000000000000000000002549960de5880e8c687434170f6476605b8fe4aeb9a28632c7995cf3ba831d97631d0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000867b2274797065223a22776562617574686e2e676574222c226368616c6c656e6765223a2234703254695a70546f6f4c43464659544332486d4d50564d69566a5a476768434a30647a377a5544456541222c226f726967696e223a22687474703a2f2f6c6f63616c686f73743a35313733222c2263726f73734f726967696e223a66616c73657d0000000000000000000000000000000000000000000000000000');
|
|
71
|
-
});
|
|
72
|
-
});
|
|
73
|
-
(0, vitest_1.describe)('Pack Signature V0', () => {
|
|
74
|
-
(0, vitest_1.test)('single', () => {
|
|
75
|
-
const usePrecompile = false;
|
|
76
|
-
const webAuthns = {
|
|
77
|
-
authenticatorData: '0x49960de5880e8c687434170f6476605b8fe4aeb9a28632c7995cf3ba831d97631d00000000',
|
|
78
|
-
clientDataJSON: '{"type":"webauthn.get","challenge":"4p2TiZpTooLCFFYTC2HmMPVMiVjZGghCJ0dz7zUDEeA","origin":"http://localhost:5173","crossOrigin":false}',
|
|
79
|
-
challengeIndex: 23n,
|
|
80
|
-
typeIndex: 1n,
|
|
81
|
-
r: 111296353735534357766084082487308191701889898756402773464442570100570127077266n,
|
|
82
|
-
s: 6705566102199758127831148650668918567109283965479844611524279039128750829560n,
|
|
83
|
-
};
|
|
84
|
-
const packed = (0, passkeys_1.packSignatureV0)(webAuthns, usePrecompile);
|
|
85
|
-
(0, vitest_1.expect)(packed).toEqual('0x00000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000001200000000000000000000000000000000000000000000000000000000000000001f60f80fe3fd029d1b380d631f0b659bfbc8f8f60921a88e1e123c159aa540f920ed337464d1bb813dc5f9c3e81998185370da49cc525e9f42cdf805f1030aff80000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002549960de5880e8c687434170f6476605b8fe4aeb9a28632c7995cf3ba831d97631d0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000867b2274797065223a22776562617574686e2e676574222c226368616c6c656e6765223a2234703254695a70546f6f4c43464659544332486d4d50564d69566a5a476768434a30647a377a5544456541222c226f726967696e223a22687474703a2f2f6c6f63616c686f73743a35313733222c2263726f73734f726967696e223a66616c73657d0000000000000000000000000000000000000000000000000000');
|
|
86
|
-
});
|
|
87
|
-
});
|
|
88
|
-
});
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { Address, Chain, HashTypedDataParameters, Hex, TypedData } from 'viem';
|
|
2
|
-
import type { SignerSet } from '../../types';
|
|
3
|
-
declare function sign<typedData extends TypedData | Record<string, unknown> = TypedData, primaryType extends keyof typedData | 'EIP712Domain' = keyof typedData>(signers: SignerSet, chain: Chain, address: Address, parameters: HashTypedDataParameters<typedData, primaryType>): Promise<Hex>;
|
|
4
|
-
export { sign };
|
|
5
|
-
//# sourceMappingURL=typedData.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"typedData.d.ts","sourceRoot":"","sources":["../../../../accounts/signing/typedData.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,OAAO,EACP,KAAK,EACL,uBAAuB,EACvB,GAAG,EACH,SAAS,EACV,MAAM,MAAM,CAAA;AAEb,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAS5C,iBAAe,IAAI,CACjB,SAAS,SAAS,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,EACjE,WAAW,SAAS,MAAM,SAAS,GAAG,cAAc,GAAG,MAAM,SAAS,EAEtE,OAAO,EAAE,SAAS,EAClB,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,OAAO,EAChB,UAAU,EAAE,uBAAuB,CAAC,SAAS,EAAE,WAAW,CAAC,GAC1D,OAAO,CAAC,GAAG,CAAC,CA2Bd;AA6BD,OAAO,EAAE,IAAI,EAAE,CAAA"}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.sign = sign;
|
|
4
|
-
const error_1 = require("../error");
|
|
5
|
-
const common_1 = require("./common");
|
|
6
|
-
async function sign(signers, chain, address, parameters) {
|
|
7
|
-
const signingFunctions = {
|
|
8
|
-
signEcdsa: (account, params) => signEcdsa(account, params),
|
|
9
|
-
signPasskey: (account, params) => signPasskey(account, params),
|
|
10
|
-
};
|
|
11
|
-
switch (signers.type) {
|
|
12
|
-
case 'owner': {
|
|
13
|
-
return (0, common_1.signWithOwners)(signers, chain, address, parameters, signingFunctions, false, sign);
|
|
14
|
-
}
|
|
15
|
-
case 'session': {
|
|
16
|
-
return (0, common_1.signWithSession)(signers, chain, address, parameters, false, sign);
|
|
17
|
-
}
|
|
18
|
-
case 'guardians': {
|
|
19
|
-
return (0, common_1.signWithGuardians)(signers, parameters, signingFunctions);
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
async function signEcdsa(account, parameters) {
|
|
24
|
-
if (!account.signTypedData) {
|
|
25
|
-
throw new error_1.SigningNotSupportedForAccountError();
|
|
26
|
-
}
|
|
27
|
-
return await account.signTypedData(parameters);
|
|
28
|
-
}
|
|
29
|
-
async function signPasskey(account, parameters) {
|
|
30
|
-
const { webauthn, signature } = await account.signTypedData(parameters);
|
|
31
|
-
return {
|
|
32
|
-
webauthn,
|
|
33
|
-
signature,
|
|
34
|
-
};
|
|
35
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import type { Address, Chain, Hex, PublicClient } from 'viem';
|
|
2
|
-
import type { Module } from '../modules/common';
|
|
3
|
-
import type { EnableSessionData } from '../modules/validators/smart-sessions';
|
|
4
|
-
import type { OwnerSet, RhinestoneAccountConfig, Session } from '../types';
|
|
5
|
-
import type { ValidatorConfig } from './utils';
|
|
6
|
-
declare function getDeployArgs(config: RhinestoneAccountConfig): {
|
|
7
|
-
factory: `0x${string}`;
|
|
8
|
-
factoryData: `0x${string}`;
|
|
9
|
-
salt: `0x${string}`;
|
|
10
|
-
implementation: `0x${string}`;
|
|
11
|
-
initializationCallData: `0x${string}`;
|
|
12
|
-
};
|
|
13
|
-
declare function getAddress(config: RhinestoneAccountConfig): `0x${string}`;
|
|
14
|
-
declare function getEip712Domain(config: RhinestoneAccountConfig, chain: Chain): {
|
|
15
|
-
name: string;
|
|
16
|
-
version: string;
|
|
17
|
-
chainId: number;
|
|
18
|
-
verifyingContract: `0x${string}`;
|
|
19
|
-
salt: "0x0000000000000000000000000000000000000000000000000000000000000000";
|
|
20
|
-
};
|
|
21
|
-
declare function getInstallData(module: Module): `0x${string}`;
|
|
22
|
-
declare function packSignature(signature: Hex, validator: ValidatorConfig, transformSignature?: (signature: Hex) => Hex): Promise<`0x${string}`>;
|
|
23
|
-
declare function getSmartAccount(client: PublicClient, address: Address, owners: OwnerSet, validatorAddress: Address, sign: (hash: Hex) => Promise<Hex>): Promise<import("viem/_types/account-abstraction").SmartAccount<import("viem/_types/account-abstraction").SmartAccountImplementation<import("viem").Abi, "0.7">>>;
|
|
24
|
-
declare function getSessionSmartAccount(client: PublicClient, address: Address, session: Session, validatorAddress: Address, enableData: EnableSessionData | null, sign: (hash: Hex) => Promise<Hex>): Promise<import("viem/_types/account-abstraction").SmartAccount<import("viem/_types/account-abstraction").SmartAccountImplementation<import("viem").Abi, "0.7">>>;
|
|
25
|
-
declare function getGuardianSmartAccount(client: PublicClient, address: Address, guardians: OwnerSet, validatorAddress: Address, sign: (hash: Hex) => Promise<Hex>): Promise<import("viem/_types/account-abstraction").SmartAccount<import("viem/_types/account-abstraction").SmartAccountImplementation<import("viem").Abi, "0.7">>>;
|
|
26
|
-
export { getEip712Domain, getInstallData, getAddress, packSignature, getDeployArgs, getSmartAccount, getSessionSmartAccount, getGuardianSmartAccount, };
|
|
27
|
-
//# sourceMappingURL=startale.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"startale.d.ts","sourceRoot":"","sources":["../../../accounts/startale.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,YAAY,EAAE,MAAM,MAAM,CAAA;AAa7D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAC/C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sCAAsC,CAAA;AAC7E,OAAO,KAAK,EACV,QAAQ,EACR,uBAAuB,EACvB,OAAO,EAER,MAAM,UAAU,CAAA;AASjB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAc9C,iBAAS,aAAa,CAAC,MAAM,EAAE,uBAAuB;;;;;;EAwDrD;AAED,iBAAS,UAAU,CAAC,MAAM,EAAE,uBAAuB,iBA4BlD;AAED,iBAAS,eAAe,CAAC,MAAM,EAAE,uBAAuB,EAAE,KAAK,EAAE,KAAK;;;;;;EAarE;AAED,iBAAS,cAAc,CAAC,MAAM,EAAE,MAAM,iBAErC;AAED,iBAAe,aAAa,CAC1B,SAAS,EAAE,GAAG,EACd,SAAS,EAAE,eAAe,EAC1B,kBAAkB,GAAE,CAAC,SAAS,EAAE,GAAG,KAAK,GAA8B,0BAQvE;AAED,iBAAe,eAAe,CAC5B,MAAM,EAAE,YAAY,EACpB,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,QAAQ,EAChB,gBAAgB,EAAE,OAAO,EACzB,IAAI,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,OAAO,CAAC,GAAG,CAAC,oKAUlC;AAED,iBAAe,sBAAsB,CACnC,MAAM,EAAE,YAAY,EACpB,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,OAAO,EAChB,gBAAgB,EAAE,OAAO,EACzB,UAAU,EAAE,iBAAiB,GAAG,IAAI,EACpC,IAAI,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,OAAO,CAAC,GAAG,CAAC,oKAWlC;AAED,iBAAe,uBAAuB,CACpC,MAAM,EAAE,YAAY,EACpB,OAAO,EAAE,OAAO,EAChB,SAAS,EAAE,QAAQ,EACnB,gBAAgB,EAAE,OAAO,EACzB,IAAI,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,OAAO,CAAC,GAAG,CAAC,oKAUlC;AAED,OAAO,EACL,eAAe,EACf,cAAc,EACd,UAAU,EACV,aAAa,EACb,aAAa,EACb,eAAe,EACf,sBAAsB,EACtB,uBAAuB,GACxB,CAAA"}
|