@verbeth/sdk 0.1.5 → 0.1.7
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/README.md +10 -7
- package/dist/esm/src/addresses.d.ts +20 -0
- package/dist/esm/src/addresses.d.ts.map +1 -0
- package/dist/esm/src/addresses.js +32 -0
- package/dist/esm/src/executor.d.ts +17 -17
- package/dist/esm/src/executor.d.ts.map +1 -1
- package/dist/esm/src/executor.js +47 -47
- package/dist/esm/src/identity.d.ts +3 -3
- package/dist/esm/src/identity.d.ts.map +1 -1
- package/dist/esm/src/identity.js +9 -9
- package/dist/esm/src/index.d.ts +1 -0
- package/dist/esm/src/index.d.ts.map +1 -1
- package/dist/esm/src/index.js +1 -0
- package/dist/esm/src/utils/safeSessionSigner.d.ts +1 -1
- package/dist/esm/src/utils/safeSessionSigner.d.ts.map +1 -1
- package/dist/esm/src/utils/safeSessionSigner.js +5 -5
- package/dist/esm/src/utils.d.ts +1 -1
- package/dist/esm/src/utils.d.ts.map +1 -1
- package/dist/esm/src/utils.js +2 -2
- package/dist/esm/src/verify.js +2 -2
- package/dist/src/addresses.d.ts +20 -0
- package/dist/src/addresses.d.ts.map +1 -0
- package/dist/src/addresses.js +32 -0
- package/dist/src/executor.d.ts +17 -17
- package/dist/src/executor.d.ts.map +1 -1
- package/dist/src/executor.js +47 -47
- package/dist/src/identity.d.ts +3 -3
- package/dist/src/identity.d.ts.map +1 -1
- package/dist/src/identity.js +9 -9
- package/dist/src/index.d.ts +1 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +1 -0
- package/dist/src/utils/safeSessionSigner.d.ts +1 -1
- package/dist/src/utils/safeSessionSigner.d.ts.map +1 -1
- package/dist/src/utils/safeSessionSigner.js +5 -5
- package/dist/src/utils.d.ts +1 -1
- package/dist/src/utils.d.ts.map +1 -1
- package/dist/src/utils.js +2 -2
- package/dist/src/verify.js +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -9,18 +9,21 @@ npm install @verbeth/sdk
|
|
|
9
9
|
|
|
10
10
|
### Quickstart
|
|
11
11
|
```ts
|
|
12
|
-
import {
|
|
12
|
+
import {
|
|
13
|
+
createVerbethClient,
|
|
14
|
+
deriveIdentityKeyPairWithProof,
|
|
15
|
+
ExecutorFactory,
|
|
16
|
+
getVerbethAddress
|
|
17
|
+
} from '@verbeth/sdk';
|
|
13
18
|
import { ethers } from 'ethers';
|
|
14
19
|
|
|
15
|
-
const LOGCHAIN = '0x62720f39d5Ec6501508bDe4D152c1E13Fd2F6707';
|
|
16
|
-
|
|
17
20
|
const provider = new ethers.BrowserProvider(window.ethereum);
|
|
18
21
|
const signer = await provider.getSigner();
|
|
19
22
|
const address = await signer.getAddress();
|
|
20
23
|
|
|
21
24
|
const { identityKeyPair, identityProof } = await deriveIdentityKeyPairWithProof(signer, address);
|
|
22
25
|
|
|
23
|
-
const contract = new ethers.Contract(
|
|
26
|
+
const contract = new ethers.Contract(getVerbethAddress(), VerbethABI, signer);
|
|
24
27
|
const client = createVerbethClient({
|
|
25
28
|
address,
|
|
26
29
|
signer,
|
|
@@ -42,10 +45,10 @@ MPL-2.0
|
|
|
42
45
|
|
|
43
46
|
## Links
|
|
44
47
|
|
|
45
|
-
- [GitHub Repository](https://github.com/okrame/verbeth
|
|
48
|
+
- [GitHub Repository](https://github.com/okrame/verbeth)
|
|
46
49
|
- [Demo App](https://verbeth-demo.vercel.app/)
|
|
47
|
-
- [Contract Source](https://github.com/okrame/verbeth
|
|
50
|
+
- [Contract Source](https://github.com/okrame/verbeth/tree/main/packages/contracts)
|
|
48
51
|
|
|
49
52
|
---
|
|
50
53
|
|
|
51
|
-
**Questions or feedback?** Open an issue on [GitHub](https://github.com/okrame/verbeth
|
|
54
|
+
**Questions or feedback?** Open an issue on [GitHub](https://github.com/okrame/verbeth/issues).
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export interface ChainConfig {
|
|
2
|
+
verbethProxy: `0x${string}`;
|
|
3
|
+
verbethImpl: `0x${string}`;
|
|
4
|
+
creationBlock: number;
|
|
5
|
+
moduleSetupHelper?: `0x${string}`;
|
|
6
|
+
}
|
|
7
|
+
export declare const VERBETH_CONFIG: ChainConfig;
|
|
8
|
+
export declare const MODULE_SETUP_HELPERS: Record<number, `0x${string}`>;
|
|
9
|
+
export declare function getVerbethAddress(): `0x${string}`;
|
|
10
|
+
export declare function getCreationBlock(): number;
|
|
11
|
+
export declare function getModuleSetupHelper(chainId: number): `0x${string}` | undefined;
|
|
12
|
+
export declare function isModuleSetupSupported(chainId: number): boolean;
|
|
13
|
+
export declare const SCAN_DEFAULTS: {
|
|
14
|
+
readonly INITIAL_SCAN_BLOCKS: 1000;
|
|
15
|
+
readonly MAX_RETRIES: 3;
|
|
16
|
+
readonly MAX_RANGE_PROVIDER: 2000;
|
|
17
|
+
readonly CHUNK_SIZE: 2000;
|
|
18
|
+
readonly REAL_TIME_BUFFER: 3;
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=addresses.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"addresses.d.ts","sourceRoot":"","sources":["../../../src/addresses.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,WAAW;IAC1B,YAAY,EAAE,KAAK,MAAM,EAAE,CAAC;IAC5B,WAAW,EAAE,KAAK,MAAM,EAAE,CAAC;IAC3B,aAAa,EAAE,MAAM,CAAC;IACtB,iBAAiB,CAAC,EAAE,KAAK,MAAM,EAAE,CAAC;CACnC;AAGD,eAAO,MAAM,cAAc,EAAE,WAInB,CAAC;AAGX,eAAO,MAAM,oBAAoB,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,MAAM,EAAE,CAGrD,CAAC;AAGX,wBAAgB,iBAAiB,IAAI,KAAK,MAAM,EAAE,CAEjD;AAED,wBAAgB,gBAAgB,IAAI,MAAM,CAEzC;AAED,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM,GAAG,KAAK,MAAM,EAAE,GAAG,SAAS,CAE/E;AAED,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAE/D;AAGD,eAAO,MAAM,aAAa;;;;;;CAMhB,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// packages/sdk/src/addresses.ts
|
|
2
|
+
// Deterministic deployment
|
|
3
|
+
export const VERBETH_CONFIG = {
|
|
4
|
+
verbethProxy: '0x82C9c5475D63e4C9e959280e9066aBb24973a663',
|
|
5
|
+
verbethImpl: '0x51670aB6eDE1d1B11C654CCA53b7D42080802326',
|
|
6
|
+
creationBlock: 37097547, // *** only base sepolia for now
|
|
7
|
+
};
|
|
8
|
+
// helpers for Safe session module
|
|
9
|
+
export const MODULE_SETUP_HELPERS = {
|
|
10
|
+
8453: '0xc022F74924BDB4b62D830234d89b066359bF67c0',
|
|
11
|
+
84532: '0xbd59Fea46D308eDF3b75C22a6f64AC68feFc731A',
|
|
12
|
+
};
|
|
13
|
+
export function getVerbethAddress() {
|
|
14
|
+
return VERBETH_CONFIG.verbethProxy;
|
|
15
|
+
}
|
|
16
|
+
export function getCreationBlock() {
|
|
17
|
+
return VERBETH_CONFIG.creationBlock;
|
|
18
|
+
}
|
|
19
|
+
export function getModuleSetupHelper(chainId) {
|
|
20
|
+
return MODULE_SETUP_HELPERS[chainId];
|
|
21
|
+
}
|
|
22
|
+
export function isModuleSetupSupported(chainId) {
|
|
23
|
+
return chainId in MODULE_SETUP_HELPERS;
|
|
24
|
+
}
|
|
25
|
+
// Scanning defaults (chain-agnostic)
|
|
26
|
+
export const SCAN_DEFAULTS = {
|
|
27
|
+
INITIAL_SCAN_BLOCKS: 1000,
|
|
28
|
+
MAX_RETRIES: 3,
|
|
29
|
+
MAX_RANGE_PROVIDER: 2000,
|
|
30
|
+
CHUNK_SIZE: 2000,
|
|
31
|
+
REAL_TIME_BUFFER: 3,
|
|
32
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Signer, Contract, BaseContract } from "ethers";
|
|
2
|
-
import type {
|
|
2
|
+
import type { VerbethV1 } from "@verbeth/contracts/typechain-types";
|
|
3
3
|
export declare function split128x128(word: bigint): readonly [bigint, bigint];
|
|
4
4
|
export interface IExecutor {
|
|
5
5
|
sendMessage(ciphertext: Uint8Array, topic: string, timestamp: number, nonce: bigint): Promise<any>;
|
|
@@ -8,19 +8,19 @@ export interface IExecutor {
|
|
|
8
8
|
}
|
|
9
9
|
export declare class EOAExecutor implements IExecutor {
|
|
10
10
|
private contract;
|
|
11
|
-
constructor(contract:
|
|
11
|
+
constructor(contract: VerbethV1);
|
|
12
12
|
sendMessage(ciphertext: Uint8Array, topic: string, timestamp: number, nonce: bigint): Promise<any>;
|
|
13
13
|
initiateHandshake(recipientHash: string, pubKeys: string, ephemeralPubKey: string, plaintextPayload: Uint8Array): Promise<any>;
|
|
14
14
|
respondToHandshake(inResponseTo: string, responderEphemeralR: string, ciphertext: Uint8Array): Promise<any>;
|
|
15
15
|
}
|
|
16
16
|
export declare class BaseSmartAccountExecutor implements IExecutor {
|
|
17
17
|
private baseAccountProvider;
|
|
18
|
-
private
|
|
18
|
+
private verbEthAddress;
|
|
19
19
|
private paymasterServiceUrl?;
|
|
20
20
|
private subAccountAddress?;
|
|
21
|
-
private
|
|
21
|
+
private verbEthInterface;
|
|
22
22
|
private chainId;
|
|
23
|
-
constructor(baseAccountProvider: any,
|
|
23
|
+
constructor(baseAccountProvider: any, verbEthAddress: string, chainId?: number, paymasterServiceUrl?: string | undefined, subAccountAddress?: string | undefined);
|
|
24
24
|
sendMessage(ciphertext: Uint8Array, topic: string, timestamp: number, nonce: bigint): Promise<any>;
|
|
25
25
|
initiateHandshake(recipientHash: string, pubKeys: string, ephemeralPubKey: string, plaintextPayload: Uint8Array): Promise<any>;
|
|
26
26
|
respondToHandshake(inResponseTo: string, responderEphemeralR: string, ciphertext: Uint8Array): Promise<any>;
|
|
@@ -28,12 +28,12 @@ export declare class BaseSmartAccountExecutor implements IExecutor {
|
|
|
28
28
|
}
|
|
29
29
|
export declare class UserOpExecutor implements IExecutor {
|
|
30
30
|
private smartAccountAddress;
|
|
31
|
-
private
|
|
31
|
+
private verbEthAddress;
|
|
32
32
|
private bundlerClient;
|
|
33
33
|
private smartAccountClient;
|
|
34
|
-
private
|
|
34
|
+
private verbEthInterface;
|
|
35
35
|
private smartAccountInterface;
|
|
36
|
-
constructor(smartAccountAddress: string,
|
|
36
|
+
constructor(smartAccountAddress: string, verbEthAddress: string, bundlerClient: any, smartAccountClient: any);
|
|
37
37
|
sendMessage(ciphertext: Uint8Array, topic: string, timestamp: number, nonce: bigint): Promise<any>;
|
|
38
38
|
initiateHandshake(recipientHash: string, pubKeys: string, ephemeralPubKey: string, plaintextPayload: Uint8Array): Promise<any>;
|
|
39
39
|
respondToHandshake(inResponseTo: string, responderEphemeralR: string, ciphertext: Uint8Array): Promise<any>;
|
|
@@ -41,28 +41,28 @@ export declare class UserOpExecutor implements IExecutor {
|
|
|
41
41
|
}
|
|
42
42
|
export declare class DirectEntryPointExecutor implements IExecutor {
|
|
43
43
|
private smartAccountAddress;
|
|
44
|
-
private
|
|
44
|
+
private verbEthAddress;
|
|
45
45
|
private smartAccountClient;
|
|
46
46
|
private signer;
|
|
47
|
-
private
|
|
47
|
+
private verbEthInterface;
|
|
48
48
|
private smartAccountInterface;
|
|
49
49
|
private entryPointContract;
|
|
50
50
|
private spec;
|
|
51
|
-
constructor(smartAccountAddress: string, entryPointContract: Contract | BaseContract,
|
|
51
|
+
constructor(smartAccountAddress: string, entryPointContract: Contract | BaseContract, verbEthAddress: string, smartAccountClient: any, signer: Signer);
|
|
52
52
|
sendMessage(ciphertext: Uint8Array, topic: string, timestamp: number, nonce: bigint): Promise<any>;
|
|
53
53
|
initiateHandshake(recipientHash: string, pubKeys: string, ephemeralPubKey: string, plaintextPayload: Uint8Array): Promise<any>;
|
|
54
54
|
respondToHandshake(inResponseTo: string, responderEphemeralR: string, ciphertext: Uint8Array): Promise<any>;
|
|
55
55
|
private executeDirectUserOp;
|
|
56
56
|
}
|
|
57
57
|
export declare class ExecutorFactory {
|
|
58
|
-
static createEOA(contract:
|
|
59
|
-
static createBaseSmartAccount(baseAccountProvider: any,
|
|
60
|
-
static createUserOp(smartAccountAddress: string, _entryPointAddress: string,
|
|
61
|
-
static createDirectEntryPoint(smartAccountAddress: string, entryPointContract: Contract | BaseContract,
|
|
62
|
-
static createAuto(signerOrAccount: any, contract:
|
|
58
|
+
static createEOA(contract: VerbethV1): IExecutor;
|
|
59
|
+
static createBaseSmartAccount(baseAccountProvider: any, verbEthAddress: string, chainId?: number, paymasterServiceUrl?: string, subAccountAddress?: string): IExecutor;
|
|
60
|
+
static createUserOp(smartAccountAddress: string, _entryPointAddress: string, verbEthAddress: string, bundlerClient: any, smartAccountClient: any): IExecutor;
|
|
61
|
+
static createDirectEntryPoint(smartAccountAddress: string, entryPointContract: Contract | BaseContract, verbEthAddress: string, smartAccountClient: any, signer: Signer): IExecutor;
|
|
62
|
+
static createAuto(signerOrAccount: any, contract: VerbethV1, options?: {
|
|
63
63
|
entryPointAddress?: string;
|
|
64
64
|
entryPointContract?: Contract | BaseContract;
|
|
65
|
-
|
|
65
|
+
verbEthAddress?: string;
|
|
66
66
|
bundlerClient?: any;
|
|
67
67
|
baseAccountProvider?: any;
|
|
68
68
|
chainId?: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"executor.d.ts","sourceRoot":"","sources":["../../../src/executor.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,MAAM,EACN,QAAQ,EAER,YAAY,EAGb,MAAM,QAAQ,CAAC;AAOhB,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"executor.d.ts","sourceRoot":"","sources":["../../../src/executor.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,MAAM,EACN,QAAQ,EAER,YAAY,EAGb,MAAM,QAAQ,CAAC;AAOhB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oCAAoC,CAA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E,MAAM,EAC3B,kBAAkB,EAAE,MAAM,EAC1B,cAAc,EAAE,MAAM,EACtB,aAAa,EAAE,GAAG,EAClB,kBAAkB,EAAE,GAAG,GACtB,SAAS;IASZ,MAAM,CAAC,sBAAsB,CAC3B,mBAAmB,EAAE,MAAM,EAC3B,kBAAkB,EAAE,QAAQ,GAAG,YAAY,EAC3C,cAAc,EAAE,MAAM,EACtB,kBAAkB,EAAE,GAAG,EACvB,MAAM,EAAE,MAAM,GACb,SAAS;WAWC,UAAU,CACrB,eAAe,EAAE,GAAG,EACpB,QAAQ,EAAE,SAAS,EACnB,OAAO,CAAC,EAAE;QACR,iBAAiB,CAAC,EAAE,MAAM,CAAC;QAC3B,kBAAkB,CAAC,EAAE,QAAQ,GAAG,YAAY,CAAC;QAC7C,cAAc,CAAC,EAAE,MAAM,CAAC;QACxB,aAAa,CAAC,EAAE,GAAG,CAAC;QACpB,mBAAmB,CAAC,EAAE,GAAG,CAAC;QAC1B,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,iBAAiB,CAAC,EAAE,OAAO,CAAC;KAC7B,GACA,OAAO,CAAC,SAAS,CAAC;CAgEtB"}
|
package/dist/esm/src/executor.js
CHANGED
|
@@ -46,12 +46,12 @@ export class EOAExecutor {
|
|
|
46
46
|
}
|
|
47
47
|
// Base Smart Account Executor - Uses wallet_sendCalls for sponsored transactions
|
|
48
48
|
export class BaseSmartAccountExecutor {
|
|
49
|
-
constructor(baseAccountProvider,
|
|
49
|
+
constructor(baseAccountProvider, verbEthAddress, chainId = 8453, paymasterServiceUrl, subAccountAddress) {
|
|
50
50
|
this.baseAccountProvider = baseAccountProvider;
|
|
51
|
-
this.
|
|
51
|
+
this.verbEthAddress = verbEthAddress;
|
|
52
52
|
this.paymasterServiceUrl = paymasterServiceUrl;
|
|
53
53
|
this.subAccountAddress = subAccountAddress;
|
|
54
|
-
this.
|
|
54
|
+
this.verbEthInterface = new Interface([
|
|
55
55
|
"function sendMessage(bytes calldata ciphertext, bytes32 topic, uint256 timestamp, uint256 nonce)",
|
|
56
56
|
"function initiateHandshake(bytes32 recipientHash, bytes pubKeys, bytes ephemeralPubKey, bytes plaintextPayload)",
|
|
57
57
|
"function respondToHandshake(bytes32 inResponseTo, bytes32 responderEphemeralR, bytes ciphertext)",
|
|
@@ -64,7 +64,7 @@ export class BaseSmartAccountExecutor {
|
|
|
64
64
|
: `0x${chainId.toString(16)}`;
|
|
65
65
|
}
|
|
66
66
|
async sendMessage(ciphertext, topic, timestamp, nonce) {
|
|
67
|
-
const callData = this.
|
|
67
|
+
const callData = this.verbEthInterface.encodeFunctionData("sendMessage", [
|
|
68
68
|
ciphertext,
|
|
69
69
|
topic,
|
|
70
70
|
timestamp,
|
|
@@ -72,27 +72,27 @@ export class BaseSmartAccountExecutor {
|
|
|
72
72
|
]);
|
|
73
73
|
return this.executeCalls([
|
|
74
74
|
{
|
|
75
|
-
to: this.
|
|
75
|
+
to: this.verbEthAddress,
|
|
76
76
|
value: "0x0",
|
|
77
77
|
data: callData,
|
|
78
78
|
},
|
|
79
79
|
]);
|
|
80
80
|
}
|
|
81
81
|
async initiateHandshake(recipientHash, pubKeys, ephemeralPubKey, plaintextPayload) {
|
|
82
|
-
const callData = this.
|
|
82
|
+
const callData = this.verbEthInterface.encodeFunctionData("initiateHandshake", [recipientHash, pubKeys, ephemeralPubKey, plaintextPayload]);
|
|
83
83
|
return this.executeCalls([
|
|
84
84
|
{
|
|
85
|
-
to: this.
|
|
85
|
+
to: this.verbEthAddress,
|
|
86
86
|
value: "0x0",
|
|
87
87
|
data: callData,
|
|
88
88
|
},
|
|
89
89
|
]);
|
|
90
90
|
}
|
|
91
91
|
async respondToHandshake(inResponseTo, responderEphemeralR, ciphertext) {
|
|
92
|
-
const callData = this.
|
|
92
|
+
const callData = this.verbEthInterface.encodeFunctionData("respondToHandshake", [inResponseTo, responderEphemeralR, ciphertext]);
|
|
93
93
|
return this.executeCalls([
|
|
94
94
|
{
|
|
95
|
-
to: this.
|
|
95
|
+
to: this.verbEthAddress,
|
|
96
96
|
value: "0x0",
|
|
97
97
|
data: callData,
|
|
98
98
|
},
|
|
@@ -136,12 +136,12 @@ export class BaseSmartAccountExecutor {
|
|
|
136
136
|
}
|
|
137
137
|
// UserOp Executor - Account Abstraction via bundler
|
|
138
138
|
export class UserOpExecutor {
|
|
139
|
-
constructor(smartAccountAddress,
|
|
139
|
+
constructor(smartAccountAddress, verbEthAddress, bundlerClient, smartAccountClient) {
|
|
140
140
|
this.smartAccountAddress = smartAccountAddress;
|
|
141
|
-
this.
|
|
141
|
+
this.verbEthAddress = verbEthAddress;
|
|
142
142
|
this.bundlerClient = bundlerClient;
|
|
143
143
|
this.smartAccountClient = smartAccountClient;
|
|
144
|
-
this.
|
|
144
|
+
this.verbEthInterface = new Interface([
|
|
145
145
|
"function sendMessage(bytes calldata ciphertext, bytes32 topic, uint256 timestamp, uint256 nonce)",
|
|
146
146
|
"function initiateHandshake(bytes32 recipientHash, bytes pubKeys, bytes ephemeralPubKey, bytes plaintextPayload)",
|
|
147
147
|
"function respondToHandshake(bytes32 inResponseTo, bytes32 responderEphemeralR, bytes ciphertext)",
|
|
@@ -151,29 +151,29 @@ export class UserOpExecutor {
|
|
|
151
151
|
]);
|
|
152
152
|
}
|
|
153
153
|
async sendMessage(ciphertext, topic, timestamp, nonce) {
|
|
154
|
-
const
|
|
154
|
+
const verbEthCallData = this.verbEthInterface.encodeFunctionData("sendMessage", [ciphertext, topic, timestamp, nonce]);
|
|
155
155
|
const smartAccountCallData = this.smartAccountInterface.encodeFunctionData("execute", [
|
|
156
|
-
this.
|
|
156
|
+
this.verbEthAddress,
|
|
157
157
|
0,
|
|
158
|
-
|
|
158
|
+
verbEthCallData,
|
|
159
159
|
]);
|
|
160
160
|
return this.executeUserOp(smartAccountCallData);
|
|
161
161
|
}
|
|
162
162
|
async initiateHandshake(recipientHash, pubKeys, ephemeralPubKey, plaintextPayload) {
|
|
163
|
-
const
|
|
163
|
+
const verbEthCallData = this.verbEthInterface.encodeFunctionData("initiateHandshake", [recipientHash, pubKeys, ephemeralPubKey, plaintextPayload]);
|
|
164
164
|
const smartAccountCallData = this.smartAccountInterface.encodeFunctionData("execute", [
|
|
165
|
-
this.
|
|
165
|
+
this.verbEthAddress,
|
|
166
166
|
0,
|
|
167
|
-
|
|
167
|
+
verbEthCallData,
|
|
168
168
|
]);
|
|
169
169
|
return this.executeUserOp(smartAccountCallData);
|
|
170
170
|
}
|
|
171
171
|
async respondToHandshake(inResponseTo, responderEphemeralR, ciphertext) {
|
|
172
|
-
const
|
|
172
|
+
const verbEthCallData = this.verbEthInterface.encodeFunctionData("respondToHandshake", [inResponseTo, responderEphemeralR, ciphertext]);
|
|
173
173
|
const smartAccountCallData = this.smartAccountInterface.encodeFunctionData("execute", [
|
|
174
|
-
this.
|
|
174
|
+
this.verbEthAddress,
|
|
175
175
|
0,
|
|
176
|
-
|
|
176
|
+
verbEthCallData,
|
|
177
177
|
]);
|
|
178
178
|
return this.executeUserOp(smartAccountCallData);
|
|
179
179
|
}
|
|
@@ -201,12 +201,12 @@ export class UserOpExecutor {
|
|
|
201
201
|
}
|
|
202
202
|
// Direct EntryPoint Executor (bypasses bundler for local testing)
|
|
203
203
|
export class DirectEntryPointExecutor {
|
|
204
|
-
constructor(smartAccountAddress, entryPointContract,
|
|
204
|
+
constructor(smartAccountAddress, entryPointContract, verbEthAddress, smartAccountClient, signer) {
|
|
205
205
|
this.smartAccountAddress = smartAccountAddress;
|
|
206
|
-
this.
|
|
206
|
+
this.verbEthAddress = verbEthAddress;
|
|
207
207
|
this.smartAccountClient = smartAccountClient;
|
|
208
208
|
this.signer = signer;
|
|
209
|
-
this.
|
|
209
|
+
this.verbEthInterface = new Interface([
|
|
210
210
|
"function sendMessage(bytes calldata ciphertext, bytes32 topic, uint256 timestamp, uint256 nonce)",
|
|
211
211
|
"function initiateHandshake(bytes32 recipientHash, bytes pubKeys, bytes ephemeralPubKey, bytes plaintextPayload)",
|
|
212
212
|
"function respondToHandshake(bytes32 inResponseTo, bytes32 responderEphemeralR, bytes ciphertext)",
|
|
@@ -218,29 +218,29 @@ export class DirectEntryPointExecutor {
|
|
|
218
218
|
this.spec = detectSpecVersion(this.entryPointContract.interface);
|
|
219
219
|
}
|
|
220
220
|
async sendMessage(ciphertext, topic, timestamp, nonce) {
|
|
221
|
-
const
|
|
221
|
+
const verbEthCallData = this.verbEthInterface.encodeFunctionData("sendMessage", [ciphertext, topic, timestamp, nonce]);
|
|
222
222
|
const smartAccountCallData = this.smartAccountInterface.encodeFunctionData("execute", [
|
|
223
|
-
this.
|
|
223
|
+
this.verbEthAddress,
|
|
224
224
|
0, // value
|
|
225
|
-
|
|
225
|
+
verbEthCallData,
|
|
226
226
|
]);
|
|
227
227
|
return this.executeDirectUserOp(smartAccountCallData);
|
|
228
228
|
}
|
|
229
229
|
async initiateHandshake(recipientHash, pubKeys, ephemeralPubKey, plaintextPayload) {
|
|
230
|
-
const
|
|
230
|
+
const verbEthCallData = this.verbEthInterface.encodeFunctionData("initiateHandshake", [recipientHash, pubKeys, ephemeralPubKey, plaintextPayload]);
|
|
231
231
|
const smartAccountCallData = this.smartAccountInterface.encodeFunctionData("execute", [
|
|
232
|
-
this.
|
|
232
|
+
this.verbEthAddress,
|
|
233
233
|
0,
|
|
234
|
-
|
|
234
|
+
verbEthCallData,
|
|
235
235
|
]);
|
|
236
236
|
return this.executeDirectUserOp(smartAccountCallData);
|
|
237
237
|
}
|
|
238
238
|
async respondToHandshake(inResponseTo, responderEphemeralR, ciphertext) {
|
|
239
|
-
const
|
|
239
|
+
const verbEthCallData = this.verbEthInterface.encodeFunctionData("respondToHandshake", [inResponseTo, responderEphemeralR, ciphertext]);
|
|
240
240
|
const smartAccountCallData = this.smartAccountInterface.encodeFunctionData("execute", [
|
|
241
|
-
this.
|
|
241
|
+
this.verbEthAddress,
|
|
242
242
|
0,
|
|
243
|
-
|
|
243
|
+
verbEthCallData,
|
|
244
244
|
]);
|
|
245
245
|
return this.executeDirectUserOp(smartAccountCallData);
|
|
246
246
|
}
|
|
@@ -289,19 +289,19 @@ export class ExecutorFactory {
|
|
|
289
289
|
static createEOA(contract) {
|
|
290
290
|
return new EOAExecutor(contract);
|
|
291
291
|
}
|
|
292
|
-
static createBaseSmartAccount(baseAccountProvider,
|
|
293
|
-
return new BaseSmartAccountExecutor(baseAccountProvider,
|
|
292
|
+
static createBaseSmartAccount(baseAccountProvider, verbEthAddress, chainId = 8453, paymasterServiceUrl, subAccountAddress) {
|
|
293
|
+
return new BaseSmartAccountExecutor(baseAccountProvider, verbEthAddress, chainId, paymasterServiceUrl, subAccountAddress);
|
|
294
294
|
}
|
|
295
|
-
static createUserOp(smartAccountAddress, _entryPointAddress,
|
|
296
|
-
return new UserOpExecutor(smartAccountAddress,
|
|
295
|
+
static createUserOp(smartAccountAddress, _entryPointAddress, verbEthAddress, bundlerClient, smartAccountClient) {
|
|
296
|
+
return new UserOpExecutor(smartAccountAddress, verbEthAddress, bundlerClient, smartAccountClient);
|
|
297
297
|
}
|
|
298
|
-
static createDirectEntryPoint(smartAccountAddress, entryPointContract,
|
|
299
|
-
return new DirectEntryPointExecutor(smartAccountAddress, entryPointContract,
|
|
298
|
+
static createDirectEntryPoint(smartAccountAddress, entryPointContract, verbEthAddress, smartAccountClient, signer) {
|
|
299
|
+
return new DirectEntryPointExecutor(smartAccountAddress, entryPointContract, verbEthAddress, smartAccountClient, signer);
|
|
300
300
|
}
|
|
301
301
|
// Auto-detect executor based on environment and signer type
|
|
302
302
|
static async createAuto(signerOrAccount, contract, options) {
|
|
303
|
-
if (options?.baseAccountProvider && options?.
|
|
304
|
-
return new BaseSmartAccountExecutor(options.baseAccountProvider, options.
|
|
303
|
+
if (options?.baseAccountProvider && options?.verbEthAddress) {
|
|
304
|
+
return new BaseSmartAccountExecutor(options.baseAccountProvider, options.verbEthAddress, options.chainId || 8453);
|
|
305
305
|
}
|
|
306
306
|
try {
|
|
307
307
|
const provider = signerOrAccount?.provider || signerOrAccount;
|
|
@@ -312,9 +312,9 @@ export class ExecutorFactory {
|
|
|
312
312
|
params: [],
|
|
313
313
|
})
|
|
314
314
|
.catch(() => null);
|
|
315
|
-
if (capabilities && options?.
|
|
315
|
+
if (capabilities && options?.verbEthAddress) {
|
|
316
316
|
// if wallet supports capabilities, it's likely a Base Smart Account
|
|
317
|
-
return new BaseSmartAccountExecutor(provider, options.
|
|
317
|
+
return new BaseSmartAccountExecutor(provider, options.verbEthAddress, options.chainId || 8453);
|
|
318
318
|
}
|
|
319
319
|
}
|
|
320
320
|
}
|
|
@@ -323,13 +323,13 @@ export class ExecutorFactory {
|
|
|
323
323
|
(options?.bundlerClient || options?.entryPointContract)) {
|
|
324
324
|
if (options.isTestEnvironment &&
|
|
325
325
|
options.entryPointContract &&
|
|
326
|
-
options.
|
|
327
|
-
return new DirectEntryPointExecutor(signerOrAccount.address, options.entryPointContract, options.
|
|
326
|
+
options.verbEthAddress) {
|
|
327
|
+
return new DirectEntryPointExecutor(signerOrAccount.address, options.entryPointContract, options.verbEthAddress, signerOrAccount, signerOrAccount.signer || signerOrAccount);
|
|
328
328
|
}
|
|
329
329
|
if (options.bundlerClient &&
|
|
330
330
|
options.entryPointAddress &&
|
|
331
|
-
options.
|
|
332
|
-
return new UserOpExecutor(signerOrAccount.address, options.
|
|
331
|
+
options.verbEthAddress) {
|
|
332
|
+
return new UserOpExecutor(signerOrAccount.address, options.verbEthAddress, options.bundlerClient, signerOrAccount);
|
|
333
333
|
}
|
|
334
334
|
}
|
|
335
335
|
return new EOAExecutor(contract);
|
|
@@ -21,9 +21,9 @@ export declare function deriveIdentityKeys(signer: any, address: string): Promis
|
|
|
21
21
|
/**
|
|
22
22
|
* Create the binding proof that ties the derived keys to the Safe address.
|
|
23
23
|
*/
|
|
24
|
-
export declare function createBindingProof(signer: any, address: string, derivedKeys: DerivedIdentityKeys,
|
|
25
|
-
export declare function deriveIdentityKeyPairWithProof(signer: any, address: string,
|
|
26
|
-
export declare function deriveIdentityWithUnifiedKeys(signer: Signer, address: string,
|
|
24
|
+
export declare function createBindingProof(signer: any, address: string, derivedKeys: DerivedIdentityKeys, executorAddress: string, ctx?: IdentityContext): Promise<IdentityProof>;
|
|
25
|
+
export declare function deriveIdentityKeyPairWithProof(signer: any, address: string, executorAddress?: string, ctx?: IdentityContext): Promise<DerivedIdentityWithProof>;
|
|
26
|
+
export declare function deriveIdentityWithUnifiedKeys(signer: Signer, address: string, executorAddress?: string, ctx?: IdentityContext): Promise<{
|
|
27
27
|
identityProof: IdentityProof;
|
|
28
28
|
identityPubKey: Uint8Array;
|
|
29
29
|
signingPubKey: Uint8Array;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"identity.d.ts","sourceRoot":"","sources":["../../../src/identity.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,MAAM,EAAqC,MAAM,QAAQ,CAAC;AAGnE,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAwE7E,MAAM,WAAW,mBAAmB;IAClC,mDAAmD;IACnD,OAAO,EAAE,eAAe,CAAC;IACzB,2DAA2D;IAC3D,iBAAiB,EAAE,MAAM,CAAC;IAC1B,6CAA6C;IAC7C,cAAc,EAAE,MAAM,CAAC;IACvB,iDAAiD;IACjD,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,wBAAyB,SAAQ,mBAAmB;IACnE,aAAa,EAAE,aAAa,CAAC;CAC9B;AAMD;;GAEG;AACH,wBAAsB,kBAAkB,CACtC,MAAM,EAAE,GAAG,EACX,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,mBAAmB,CAAC,CA8D9B;AAMD;;GAEG;AACH,wBAAsB,kBAAkB,CACtC,MAAM,EAAE,GAAG,EACX,OAAO,EAAE,MAAM,EACf,WAAW,EAAE,mBAAmB,EAChC,
|
|
1
|
+
{"version":3,"file":"identity.d.ts","sourceRoot":"","sources":["../../../src/identity.ts"],"names":[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EAAE,MAAM,CAAC;IAC1B,cAAc,EAAE,MAAM,CAAC;CACxB,CAAC,CAqBD"}
|
package/dist/esm/src/identity.js
CHANGED
|
@@ -50,13 +50,13 @@ function buildSeedMessage(addrLower) {
|
|
|
50
50
|
];
|
|
51
51
|
return lines.join("\n");
|
|
52
52
|
}
|
|
53
|
-
function buildBindingMessage(addrLower, pkEd25519Hex, pkX25519Hex,
|
|
53
|
+
function buildBindingMessage(addrLower, pkEd25519Hex, pkX25519Hex, executorAddress, ctx) {
|
|
54
54
|
const lines = [
|
|
55
55
|
"VerbEth Key Binding v1",
|
|
56
56
|
`Address: ${addrLower}`,
|
|
57
57
|
`PkEd25519: ${pkEd25519Hex}`,
|
|
58
58
|
`PkX25519: ${pkX25519Hex}`,
|
|
59
|
-
`
|
|
59
|
+
`ExecutorAddress: ${executorAddress ?? ""}`,
|
|
60
60
|
];
|
|
61
61
|
if (typeof ctx?.chainId === "number")
|
|
62
62
|
lines.push(`ChainId: ${ctx.chainId}`);
|
|
@@ -129,10 +129,10 @@ export async function deriveIdentityKeys(signer, address) {
|
|
|
129
129
|
/**
|
|
130
130
|
* Create the binding proof that ties the derived keys to the Safe address.
|
|
131
131
|
*/
|
|
132
|
-
export async function createBindingProof(signer, address, derivedKeys,
|
|
132
|
+
export async function createBindingProof(signer, address, derivedKeys, executorAddress, ctx) {
|
|
133
133
|
const addrLower = address.toLowerCase();
|
|
134
|
-
const
|
|
135
|
-
const message = buildBindingMessage(addrLower, derivedKeys.pkEd25519Hex, derivedKeys.pkX25519Hex,
|
|
134
|
+
const executorAddressLower = executorAddress.toLowerCase();
|
|
135
|
+
const message = buildBindingMessage(addrLower, derivedKeys.pkEd25519Hex, derivedKeys.pkX25519Hex, executorAddressLower, ctx);
|
|
136
136
|
const signature = await signer.signMessage(message);
|
|
137
137
|
const messageRawHex = ("0x" +
|
|
138
138
|
Buffer.from(message, "utf-8").toString("hex"));
|
|
@@ -143,16 +143,16 @@ export async function createBindingProof(signer, address, derivedKeys, executorS
|
|
|
143
143
|
};
|
|
144
144
|
}
|
|
145
145
|
// this is when the Safe address is known upfront
|
|
146
|
-
export async function deriveIdentityKeyPairWithProof(signer, address,
|
|
146
|
+
export async function deriveIdentityKeyPairWithProof(signer, address, executorAddress, ctx) {
|
|
147
147
|
const derivedKeys = await deriveIdentityKeys(signer, address);
|
|
148
|
-
const identityProof = await createBindingProof(signer, address, derivedKeys,
|
|
148
|
+
const identityProof = await createBindingProof(signer, address, derivedKeys, executorAddress ?? "", ctx);
|
|
149
149
|
return {
|
|
150
150
|
...derivedKeys,
|
|
151
151
|
identityProof,
|
|
152
152
|
};
|
|
153
153
|
}
|
|
154
|
-
export async function deriveIdentityWithUnifiedKeys(signer, address,
|
|
155
|
-
const result = await deriveIdentityKeyPairWithProof(signer, address,
|
|
154
|
+
export async function deriveIdentityWithUnifiedKeys(signer, address, executorAddress, ctx) {
|
|
155
|
+
const result = await deriveIdentityKeyPairWithProof(signer, address, executorAddress, ctx);
|
|
156
156
|
const unifiedPubKeys = encodeUnifiedPubKeys(result.keyPair.publicKey, result.keyPair.signingPublicKey);
|
|
157
157
|
return {
|
|
158
158
|
identityProof: result.identityProof,
|
package/dist/esm/src/index.d.ts
CHANGED
|
@@ -18,4 +18,5 @@ export type { VerbethClientConfig, VerbethClientCallbacks, TopicRatchetEvent, Me
|
|
|
18
18
|
export * from './ratchet/index.js';
|
|
19
19
|
export { dh, deriveTopic, hybridInitialSecret } from './ratchet/kdf.js';
|
|
20
20
|
export { kem } from './pq/kem.js';
|
|
21
|
+
export * from './addresses.js';
|
|
21
22
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAEA,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC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CAAC;AAElC,cAAc,gBAAgB,CAAC"}
|
package/dist/esm/src/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"safeSessionSigner.d.ts","sourceRoot":"","sources":["../../../../src/utils/safeSessionSigner.ts"],"names":[],"mappings":"AACA,OAAO,EACL,cAAc,EAEd,KAAK,QAAQ,EACb,KAAK,MAAM,EACX,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,EACxB,KAAK,eAAe,EACpB,KAAK,cAAc,EACpB,MAAM,QAAQ,CAAC;AAEhB,MAAM,WAAW,wBAAwB;IACvC,QAAQ,EAAE,QAAQ,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC;IACtB,
|
|
1
|
+
{"version":3,"file":"safeSessionSigner.d.ts","sourceRoot":"","sources":["../../../../src/utils/safeSessionSigner.ts"],"names":[],"mappings":"AACA,OAAO,EACL,cAAc,EAEd,KAAK,QAAQ,EACb,KAAK,MAAM,EACX,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,EACxB,KAAK,eAAe,EACpB,KAAK,cAAc,EACpB,MAAM,QAAQ,CAAC;AAEhB,MAAM,WAAW,wBAAwB;IACvC,QAAQ,EAAE,QAAQ,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC;IACtB,cAAc,EAAE,MAAM,CAAC;IACvB,aAAa,EAAE,MAAM,CAAC;CACvB;AASD,qBAAa,iBAAkB,SAAQ,cAAc;IACnD,OAAO,CAAC,MAAM,CAAW;IACzB,OAAO,CAAC,IAAI,CAA2B;gBAE3B,IAAI,EAAE,wBAAwB;IAiB3B,UAAU,IAAI,OAAO,CAAC,MAAM,CAAC;IAItC,uBAAuB,IAAI,OAAO,CAAC,MAAM,CAAC;IAI1C,cAAc,IAAI,OAAO,CAAC,OAAO,CAAC;IAKlC,eAAe,IAAI,OAAO,CAAC,OAAO,CAAC;IAI1B,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC;IAI1D,eAAe,CAAC,GAAG,EAAE,kBAAkB,GAAG,OAAO,CAAC,MAAM,CAAC;IAIzD,aAAa,CAC1B,MAAM,EAAE,eAAe,EACvB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,cAAc,CAAC,CAAC,EAC5C,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GACzB,OAAO,CAAC,MAAM,CAAC;IAQH,eAAe,CAAC,EAAE,EAAE,kBAAkB,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAsB3E,OAAO,CAAC,QAAQ,EAAE,QAAQ,GAAG,iBAAiB;CAGxD"}
|
|
@@ -26,7 +26,7 @@ export class SafeSessionSigner extends AbstractSigner {
|
|
|
26
26
|
return this.module.isValidSession(this.opts.safeAddress, signerAddr);
|
|
27
27
|
}
|
|
28
28
|
async isTargetAllowed() {
|
|
29
|
-
return this.module.isAllowedTarget(this.opts.safeAddress, this.opts.
|
|
29
|
+
return this.module.isAllowedTarget(this.opts.safeAddress, this.opts.verbEthAddress);
|
|
30
30
|
}
|
|
31
31
|
async signMessage(message) {
|
|
32
32
|
return this.opts.sessionSigner.signMessage(message);
|
|
@@ -45,13 +45,13 @@ export class SafeSessionSigner extends AbstractSigner {
|
|
|
45
45
|
if (!tx.to)
|
|
46
46
|
throw new Error("SafeSessionSigner: tx.to required");
|
|
47
47
|
const to = String(tx.to).toLowerCase();
|
|
48
|
-
const
|
|
49
|
-
if (to !==
|
|
50
|
-
throw new Error(`SafeSessionSigner: only
|
|
48
|
+
const verbEth = this.opts.verbEthAddress.toLowerCase();
|
|
49
|
+
if (to !== verbEth) {
|
|
50
|
+
throw new Error(`SafeSessionSigner: only verbEth txs allowed. Got ${tx.to}`);
|
|
51
51
|
}
|
|
52
52
|
const data = tx.data ?? "0x";
|
|
53
53
|
// execute(safe, to, value, data, operation)
|
|
54
|
-
return this.module.execute(this.opts.safeAddress, this.opts.
|
|
54
|
+
return this.module.execute(this.opts.safeAddress, this.opts.verbEthAddress, 0n, data, 0);
|
|
55
55
|
}
|
|
56
56
|
connect(provider) {
|
|
57
57
|
return new SafeSessionSigner({ ...this.opts, provider });
|
package/dist/esm/src/utils.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/utils.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,eAAe,EAGhB,MAAM,QAAQ,CAAC;AAGhB,OAAO,EAIL,KAAK,YAAY,EAClB,MAAM,MAAM,CAAC;AAGd,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,GAAG;IACpD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,KAAK,MAAM,EAAE,CAAC;IAC1B,QAAQ,CAAC,EAAE,KAAK,MAAM,EAAE,CAAC;IACzB,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/utils.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,eAAe,EAGhB,MAAM,QAAQ,CAAC;AAGhB,OAAO,EAIL,KAAK,YAAY,EAClB,MAAM,MAAM,CAAC;AAGd,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,GAAG;IACpD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,KAAK,MAAM,EAAE,CAAC;IAC1B,QAAQ,CAAC,EAAE,KAAK,MAAM,EAAE,CAAC;IACzB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CA4BA;AAED,MAAM,MAAM,MAAM,GACd,OAAO,QAAQ,EAAE,eAAe,GAChC,OAAO,QAAQ,EAAE,eAAe,GAChC;IAAE,OAAO,EAAE,CAAC,IAAI,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,GAAG,EAAE,CAAA;KAAE,KAAK,OAAO,CAAC,GAAG,CAAC,CAAA;CAAE,CAAC;AAe5E,wBAAsB,oBAAoB,CACxC,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,YAAY,CAAC,CAmBvB;AAED,eAAO,MAAM,cAAc,uEAC2C,CAAC;AAEvE,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAIxD;AAED;;;GAGG;AACH,wBAAsB,mBAAmB,CACvC,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,eAAe,GACxB,OAAO,CAAC,OAAO,CAAC,CA+DlB"}
|
package/dist/esm/src/utils.js
CHANGED
|
@@ -23,9 +23,9 @@ export function parseBindingMessage(message) {
|
|
|
23
23
|
if (key === "pkx25519") {
|
|
24
24
|
out.pkX25519 = hexlify(val);
|
|
25
25
|
}
|
|
26
|
-
if (key === "
|
|
26
|
+
if (key === "executoraddress" || key === "executorsafe") {
|
|
27
27
|
if (val)
|
|
28
|
-
out.
|
|
28
|
+
out.executorAddress = getAddress(val);
|
|
29
29
|
}
|
|
30
30
|
if (key === "context")
|
|
31
31
|
out.context = val;
|
package/dist/esm/src/verify.js
CHANGED
|
@@ -94,8 +94,8 @@ export async function verifyIdentityProof(identityProof, address, expectedUnifie
|
|
|
94
94
|
console.error("Unexpected binding header:", parsed.header);
|
|
95
95
|
return false;
|
|
96
96
|
}
|
|
97
|
-
if (!parsed.
|
|
98
|
-
getAddress(parsed.
|
|
97
|
+
if (!parsed.executorAddress ||
|
|
98
|
+
getAddress(parsed.executorAddress) !== getAddress(inputAddress)) {
|
|
99
99
|
console.error("Binding message Safe address mismatch");
|
|
100
100
|
return false;
|
|
101
101
|
}
|