@droplinked_inc/web3 1.0.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/LICENSE +21 -0
- package/MIGRATION.md +152 -0
- package/README.md +112 -0
- package/THREAT_MODEL.md +115 -0
- package/dist/abis/airdrop.d.ts +81 -0
- package/dist/abis/airdrop.d.ts.map +1 -0
- package/dist/abis/airdrop.js +58 -0
- package/dist/abis/airdrop.js.map +1 -0
- package/dist/abis/deployer.d.ts +54 -0
- package/dist/abis/deployer.d.ts.map +1 -0
- package/dist/abis/deployer.js +41 -0
- package/dist/abis/deployer.js.map +1 -0
- package/dist/abis/erc20.d.ts +102 -0
- package/dist/abis/erc20.d.ts.map +1 -0
- package/dist/abis/erc20.js +87 -0
- package/dist/abis/erc20.js.map +1 -0
- package/dist/abis/index.d.ts +5 -0
- package/dist/abis/index.d.ts.map +1 -0
- package/dist/abis/index.js +5 -0
- package/dist/abis/index.js.map +1 -0
- package/dist/abis/shop.d.ts +213 -0
- package/dist/abis/shop.d.ts.map +1 -0
- package/dist/abis/shop.js +162 -0
- package/dist/abis/shop.js.map +1 -0
- package/dist/contracts/erc20.d.ts +23 -0
- package/dist/contracts/erc20.d.ts.map +1 -0
- package/dist/contracts/erc20.js +59 -0
- package/dist/contracts/erc20.js.map +1 -0
- package/dist/contracts/index.d.ts +3 -0
- package/dist/contracts/index.d.ts.map +1 -0
- package/dist/contracts/index.js +3 -0
- package/dist/contracts/index.js.map +1 -0
- package/dist/contracts/shop.d.ts +56 -0
- package/dist/contracts/shop.d.ts.map +1 -0
- package/dist/contracts/shop.js +113 -0
- package/dist/contracts/shop.js.map +1 -0
- package/dist/drop-web3.d.ts +44 -0
- package/dist/drop-web3.d.ts.map +1 -0
- package/dist/drop-web3.js +65 -0
- package/dist/drop-web3.js.map +1 -0
- package/dist/encoders.d.ts +115 -0
- package/dist/encoders.d.ts.map +1 -0
- package/dist/encoders.js +198 -0
- package/dist/encoders.js.map +1 -0
- package/dist/errors.d.ts +111 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +206 -0
- package/dist/errors.js.map +1 -0
- package/dist/index.d.ts +24 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +29 -0
- package/dist/index.js.map +1 -0
- package/dist/providers/evm-shim.d.ts +77 -0
- package/dist/providers/evm-shim.d.ts.map +1 -0
- package/dist/providers/evm-shim.js +86 -0
- package/dist/providers/evm-shim.js.map +1 -0
- package/dist/signing.d.ts +157 -0
- package/dist/signing.d.ts.map +1 -0
- package/dist/signing.js +187 -0
- package/dist/signing.js.map +1 -0
- package/dist/types.d.ts +705 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +271 -0
- package/dist/types.js.map +1 -0
- package/package.json +57 -0
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* EVM provider shim — a thin source-compat layer for
|
|
3
|
+
* droplinked-web3@5.0.2's `EVMProvider` API.
|
|
4
|
+
*
|
|
5
|
+
* Intentionally a SHIM, not a re-implementation: it owns the typed
|
|
6
|
+
* contract clients (`ShopContract`, `Erc20Contract`) and delegates all
|
|
7
|
+
* wallet-level operations (login, raw tx submission, selector
|
|
8
|
+
* enforcement) to @droplinked_inc/wallet-connection. There is no
|
|
9
|
+
* wallet code in this file — that surface lives where it can be
|
|
10
|
+
* audited once.
|
|
11
|
+
*
|
|
12
|
+
* Deliberately NOT exposed:
|
|
13
|
+
* - `setNFTContractAddress` post-construction (was mutable in v5.0.2;
|
|
14
|
+
* consumers could swap mid-session and re-target signatures)
|
|
15
|
+
* - `setShopContractAddress` post-construction (same reason)
|
|
16
|
+
* - any "fetch address from remote API" entry point
|
|
17
|
+
*/
|
|
18
|
+
import type { Address, PublicClient } from 'viem';
|
|
19
|
+
import { Chain, type ChainWallet, type Network, type IChainPayment } from '../types.js';
|
|
20
|
+
import { ShopContract } from '../contracts/shop.js';
|
|
21
|
+
import { Erc20Contract } from '../contracts/erc20.js';
|
|
22
|
+
import type { EncodedCall } from '../encoders.js';
|
|
23
|
+
export interface EvmProviderShimArgs {
|
|
24
|
+
readonly chain: Chain;
|
|
25
|
+
readonly network: Network;
|
|
26
|
+
readonly wallet?: ChainWallet;
|
|
27
|
+
readonly shopContractAddress?: Address;
|
|
28
|
+
readonly nftContractAddress?: Address;
|
|
29
|
+
readonly origin?: string;
|
|
30
|
+
readonly publicClient?: PublicClient;
|
|
31
|
+
}
|
|
32
|
+
export declare class EvmProviderShim {
|
|
33
|
+
readonly chain: Chain;
|
|
34
|
+
readonly network: Network;
|
|
35
|
+
readonly wallet: ChainWallet | undefined;
|
|
36
|
+
readonly shopContractAddress: Address | undefined;
|
|
37
|
+
readonly nftContractAddress: Address | undefined;
|
|
38
|
+
readonly origin: string | undefined;
|
|
39
|
+
private readonly publicClient;
|
|
40
|
+
private readonly shop;
|
|
41
|
+
constructor(args: EvmProviderShimArgs);
|
|
42
|
+
/**
|
|
43
|
+
* Returns the typed Shop contract client. Throws if no shop address
|
|
44
|
+
* was supplied — we never auto-fetch.
|
|
45
|
+
*/
|
|
46
|
+
getShop(): ShopContract;
|
|
47
|
+
/**
|
|
48
|
+
* Returns a typed ERC-20 client for a token address the caller
|
|
49
|
+
* already knows. We require a publicClient — read-only operations
|
|
50
|
+
* can't proceed without an RPC.
|
|
51
|
+
*/
|
|
52
|
+
getErc20(tokenAddress: Address): Erc20Contract;
|
|
53
|
+
/**
|
|
54
|
+
* Build the calldata for the configured shop's `droplinkedPurchase`.
|
|
55
|
+
* The returned `EncodedCall` exposes the function name + selector +
|
|
56
|
+
* decoded args; the caller MUST surface those to the user before
|
|
57
|
+
* passing the calldata to a wallet.
|
|
58
|
+
*/
|
|
59
|
+
buildPurchaseCall(payment: IChainPayment): EncodedCall<IChainPayment>;
|
|
60
|
+
/**
|
|
61
|
+
* Build a `setSigner` calldata. Privileged.
|
|
62
|
+
*/
|
|
63
|
+
buildSetSignerCall(newSigner: Address, ack: {
|
|
64
|
+
acknowledgePrivilegedAction: true;
|
|
65
|
+
}): EncodedCall<{
|
|
66
|
+
newSigner: Address;
|
|
67
|
+
}>;
|
|
68
|
+
/**
|
|
69
|
+
* Build a `setManager` calldata. Privileged.
|
|
70
|
+
*/
|
|
71
|
+
buildSetManagerCall(newManager: Address, ack: {
|
|
72
|
+
acknowledgePrivilegedAction: true;
|
|
73
|
+
}): EncodedCall<{
|
|
74
|
+
newManager: Address;
|
|
75
|
+
}>;
|
|
76
|
+
}
|
|
77
|
+
//# sourceMappingURL=evm-shim.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"evm-shim.d.ts","sourceRoot":"","sources":["../../src/providers/evm-shim.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,MAAM,CAAC;AAClD,OAAO,EAAE,KAAK,EAAE,KAAK,WAAW,EAAE,KAAK,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,aAAa,CAAC;AAGxF,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAElD,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,CAAC;IAC9B,QAAQ,CAAC,mBAAmB,CAAC,EAAE,OAAO,CAAC;IACvC,QAAQ,CAAC,kBAAkB,CAAC,EAAE,OAAO,CAAC;IACtC,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,YAAY,CAAC,EAAE,YAAY,CAAC;CACtC;AAED,qBAAa,eAAe;IAC1B,SAAgB,KAAK,EAAE,KAAK,CAAC;IAC7B,SAAgB,OAAO,EAAE,OAAO,CAAC;IACjC,SAAgB,MAAM,EAAE,WAAW,GAAG,SAAS,CAAC;IAChD,SAAgB,mBAAmB,EAAE,OAAO,GAAG,SAAS,CAAC;IACzD,SAAgB,kBAAkB,EAAE,OAAO,GAAG,SAAS,CAAC;IACxD,SAAgB,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3C,OAAO,CAAC,QAAQ,CAAC,YAAY,CAA2B;IACxD,OAAO,CAAC,QAAQ,CAAC,IAAI,CAA2B;gBAEpC,IAAI,EAAE,mBAAmB;IAwBrC;;;OAGG;IACH,OAAO,IAAI,YAAY;IASvB;;;;OAIG;IACH,QAAQ,CAAC,YAAY,EAAE,OAAO,GAAG,aAAa;IAS9C;;;;;OAKG;IACH,iBAAiB,CAAC,OAAO,EAAE,aAAa,GAAG,WAAW,CAAC,aAAa,CAAC;IAIrE;;OAEG;IACH,kBAAkB,CAChB,SAAS,EAAE,OAAO,EAClB,GAAG,EAAE;QAAE,2BAA2B,EAAE,IAAI,CAAA;KAAE,GACzC,WAAW,CAAC;QAAE,SAAS,EAAE,OAAO,CAAA;KAAE,CAAC;IAOtC;;OAEG;IACH,mBAAmB,CACjB,UAAU,EAAE,OAAO,EACnB,GAAG,EAAE;QAAE,2BAA2B,EAAE,IAAI,CAAA;KAAE,GACzC,WAAW,CAAC;QAAE,UAAU,EAAE,OAAO,CAAA;KAAE,CAAC;CAMxC"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { EvmAddressSchema } from '../types.js';
|
|
2
|
+
import { InvalidParametersException, PrivilegedActionNotAcknowledgedError } from '../errors.js';
|
|
3
|
+
import { ShopContract } from '../contracts/shop.js';
|
|
4
|
+
import { Erc20Contract } from '../contracts/erc20.js';
|
|
5
|
+
export class EvmProviderShim {
|
|
6
|
+
chain;
|
|
7
|
+
network;
|
|
8
|
+
wallet;
|
|
9
|
+
shopContractAddress;
|
|
10
|
+
nftContractAddress;
|
|
11
|
+
origin;
|
|
12
|
+
publicClient;
|
|
13
|
+
shop;
|
|
14
|
+
constructor(args) {
|
|
15
|
+
this.chain = args.chain;
|
|
16
|
+
this.network = args.network;
|
|
17
|
+
this.wallet = args.wallet;
|
|
18
|
+
this.origin = args.origin;
|
|
19
|
+
this.publicClient = args.publicClient;
|
|
20
|
+
this.shopContractAddress =
|
|
21
|
+
args.shopContractAddress !== undefined
|
|
22
|
+
? EvmAddressSchema.parse(args.shopContractAddress)
|
|
23
|
+
: undefined;
|
|
24
|
+
this.nftContractAddress =
|
|
25
|
+
args.nftContractAddress !== undefined
|
|
26
|
+
? EvmAddressSchema.parse(args.nftContractAddress)
|
|
27
|
+
: undefined;
|
|
28
|
+
if (this.shopContractAddress !== undefined) {
|
|
29
|
+
this.shop = new ShopContract({
|
|
30
|
+
address: this.shopContractAddress,
|
|
31
|
+
...(this.publicClient !== undefined
|
|
32
|
+
? { publicClient: this.publicClient }
|
|
33
|
+
: {}),
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Returns the typed Shop contract client. Throws if no shop address
|
|
39
|
+
* was supplied — we never auto-fetch.
|
|
40
|
+
*/
|
|
41
|
+
getShop() {
|
|
42
|
+
if (this.shop === undefined) {
|
|
43
|
+
throw new InvalidParametersException('shopContractAddress must be passed to web3Instance(...) before shop operations');
|
|
44
|
+
}
|
|
45
|
+
return this.shop;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Returns a typed ERC-20 client for a token address the caller
|
|
49
|
+
* already knows. We require a publicClient — read-only operations
|
|
50
|
+
* can't proceed without an RPC.
|
|
51
|
+
*/
|
|
52
|
+
getErc20(tokenAddress) {
|
|
53
|
+
if (this.publicClient === undefined) {
|
|
54
|
+
throw new InvalidParametersException('publicClient must be supplied to construct ERC-20 clients');
|
|
55
|
+
}
|
|
56
|
+
return new Erc20Contract({ address: tokenAddress, publicClient: this.publicClient });
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Build the calldata for the configured shop's `droplinkedPurchase`.
|
|
60
|
+
* The returned `EncodedCall` exposes the function name + selector +
|
|
61
|
+
* decoded args; the caller MUST surface those to the user before
|
|
62
|
+
* passing the calldata to a wallet.
|
|
63
|
+
*/
|
|
64
|
+
buildPurchaseCall(payment) {
|
|
65
|
+
return this.getShop().buildDroplinkedPurchase(payment);
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Build a `setSigner` calldata. Privileged.
|
|
69
|
+
*/
|
|
70
|
+
buildSetSignerCall(newSigner, ack) {
|
|
71
|
+
if (ack?.acknowledgePrivilegedAction !== true) {
|
|
72
|
+
throw new PrivilegedActionNotAcknowledgedError('setSigner');
|
|
73
|
+
}
|
|
74
|
+
return this.getShop().buildSetSigner(newSigner, ack);
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Build a `setManager` calldata. Privileged.
|
|
78
|
+
*/
|
|
79
|
+
buildSetManagerCall(newManager, ack) {
|
|
80
|
+
if (ack?.acknowledgePrivilegedAction !== true) {
|
|
81
|
+
throw new PrivilegedActionNotAcknowledgedError('setManager');
|
|
82
|
+
}
|
|
83
|
+
return this.getShop().buildSetManager(newManager, ack);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
//# sourceMappingURL=evm-shim.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"evm-shim.js","sourceRoot":"","sources":["../../src/providers/evm-shim.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,0BAA0B,EAAE,oCAAoC,EAAE,MAAM,cAAc,CAAC;AAChG,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAatD,MAAM,OAAO,eAAe;IACV,KAAK,CAAQ;IACb,OAAO,CAAU;IACjB,MAAM,CAA0B;IAChC,mBAAmB,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AAC;IAED;;;;OAIG;IACH,QAAQ,CAAC,YAAqB;QAC5B,IAAI,IAAI,CAAC,YAAY,KAAK,SAAS,EAAE,CAAC;YACpC,MAAM,IAAI,0BAA0B,CAClC,2DAA2D,CAC5D,CAAC;QACJ,CAAC;QACD,OAAO,IAAI,aAAa,CAAC,EAAE,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,IAAI,CAAC,YAAY,EAAE,CAAC,CAAC;IACvF,CAAC;IAED;;;;;OAKG;IACH,iBAAiB,CAAC,OAAsB;QACtC,OAAO,IAAI,CAAC,OAAO,EAAE,CAAC,uBAAuB,CAAC,OAAO,CAAC,CAAC;IACzD,CAAC;IAED;;OAEG;IACH,kBAAkB,CAChB,SAAkB,EAClB,GAA0C;QAE1C,IAAI,GAAG,EAAE,2BAA2B,KAAK,IAAI,EAAE,CAAC;YAC9C,MAAM,IAAI,oCAAoC,CAAC,WAAW,CAAC,CAAC;QAC9D,CAAC;QACD,OAAO,IAAI,CAAC,OAAO,EAAE,CAAC,cAAc,CAAC,SAAS,EAAE,GAAG,CAAC,CAAC;IACvD,CAAC;IAED;;OAEG;IACH,mBAAmB,CACjB,UAAmB,EACnB,GAA0C;QAE1C,IAAI,GAAG,EAAE,2BAA2B,KAAK,IAAI,EAAE,CAAC;YAC9C,MAAM,IAAI,oCAAoC,CAAC,YAAY,CAAC,CAAC;QAC/D,CAAC;QACD,OAAO,IAAI,CAAC,OAAO,EAAE,CAAC,eAAe,CAAC,UAAU,EAAE,GAAG,CAAC,CAAC;IACzD,CAAC;CACF"}
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* EIP-712 typed-data signing and verification for the droplinked
|
|
3
|
+
* purchase-confirmation flow (claimNFTs).
|
|
4
|
+
*
|
|
5
|
+
* Hardening deltas vs droplinked-web3@5.0.2:
|
|
6
|
+
* 1. v5.0.2 transported a bare `signature` + `purchaseData[]` with
|
|
7
|
+
* NO domain binding. A signature created for shop A on chain X
|
|
8
|
+
* could be replayed against shop B on chain Y. This package
|
|
9
|
+
* embeds `chainId`, `verifyingContract`, single-use `nonce`, and
|
|
10
|
+
* `deadline` in the EIP-712 domain — every signature is bound to
|
|
11
|
+
* one shop on one chain at one time.
|
|
12
|
+
* 2. Nonces MUST be read from the shop contract via
|
|
13
|
+
* `purchaseNonces(buyer)` immediately before signing; the SDK
|
|
14
|
+
* refuses to sign with a cached nonce.
|
|
15
|
+
* 3. Deadlines must be in the future at submission time.
|
|
16
|
+
* 4. Verification uses viem's `verifyTypedData`. Recovered addresses
|
|
17
|
+
* are compared as lowercased hex (no checksum sensitivity).
|
|
18
|
+
* 5. The signature byte length is asserted to be exactly 65 bytes
|
|
19
|
+
* (130 hex chars + 0x). Compact 64-byte EIP-2098 sigs are
|
|
20
|
+
* explicitly rejected — they remove the v parity bit and have
|
|
21
|
+
* been observed in malformed wallet flows.
|
|
22
|
+
*/
|
|
23
|
+
import { type Address, type Hex } from 'viem';
|
|
24
|
+
/**
|
|
25
|
+
* Maximum allowed window between `now` and `deadline` when building or
|
|
26
|
+
* verifying a purchase typed-data payload. Defaults to 1 hour (3600s).
|
|
27
|
+
*
|
|
28
|
+
* Rationale: the re-audit flagged that `deadline = MAX_UINT256` would
|
|
29
|
+
* effectively be an "approve forever" signature — if leaked, it could
|
|
30
|
+
* be replayed at any time in the future. 1 hour is loose enough to
|
|
31
|
+
* support normal wallet-confirmation latency and tight enough to
|
|
32
|
+
* prevent an indefinite signature from being captured.
|
|
33
|
+
*
|
|
34
|
+
* Consumers can override per-call via
|
|
35
|
+
* `buildPurchaseTypedData({ maxDeadlineHorizonSeconds })` for cases
|
|
36
|
+
* where the operator deliberately wants a longer window (e.g. a 24h
|
|
37
|
+
* pre-signed batch claim). Anything outside the override throws
|
|
38
|
+
* `DeadlineTooFarError`.
|
|
39
|
+
*/
|
|
40
|
+
export declare const DEFAULT_MAX_DEADLINE_HORIZON_SECONDS = 3600n;
|
|
41
|
+
import { type PurchaseConfirmationItem, type PurchaseSignature } from './types.js';
|
|
42
|
+
export declare const DROPLINKED_TYPED_DATA_VERSION: "1";
|
|
43
|
+
export declare const DROPLINKED_TYPED_DATA_NAME: "DroplinkedShop";
|
|
44
|
+
export declare const PURCHASE_CONFIRMATION_TYPES: {
|
|
45
|
+
readonly PurchaseConfirmation: readonly [{
|
|
46
|
+
readonly name: "buyer";
|
|
47
|
+
readonly type: "address";
|
|
48
|
+
}, {
|
|
49
|
+
readonly name: "shopAddress";
|
|
50
|
+
readonly type: "address";
|
|
51
|
+
}, {
|
|
52
|
+
readonly name: "items";
|
|
53
|
+
readonly type: "PurchaseItem[]";
|
|
54
|
+
}, {
|
|
55
|
+
readonly name: "nonce";
|
|
56
|
+
readonly type: "uint256";
|
|
57
|
+
}, {
|
|
58
|
+
readonly name: "deadline";
|
|
59
|
+
readonly type: "uint256";
|
|
60
|
+
}];
|
|
61
|
+
readonly PurchaseItem: readonly [{
|
|
62
|
+
readonly name: "amount";
|
|
63
|
+
readonly type: "uint256";
|
|
64
|
+
}, {
|
|
65
|
+
readonly name: "productId";
|
|
66
|
+
readonly type: "uint256";
|
|
67
|
+
}, {
|
|
68
|
+
readonly name: "nullifier";
|
|
69
|
+
readonly type: "bytes32";
|
|
70
|
+
}];
|
|
71
|
+
};
|
|
72
|
+
export interface PurchaseConfirmationDomain {
|
|
73
|
+
readonly chainId: number;
|
|
74
|
+
readonly verifyingContract: Address;
|
|
75
|
+
}
|
|
76
|
+
export interface PurchaseConfirmationMessage {
|
|
77
|
+
readonly buyer: Address;
|
|
78
|
+
readonly shopAddress: Address;
|
|
79
|
+
readonly items: ReadonlyArray<{
|
|
80
|
+
readonly amount: bigint;
|
|
81
|
+
readonly productId: bigint;
|
|
82
|
+
readonly nullifier: Hex;
|
|
83
|
+
}>;
|
|
84
|
+
readonly nonce: bigint;
|
|
85
|
+
readonly deadline: bigint;
|
|
86
|
+
}
|
|
87
|
+
export interface BuildPurchaseTypedDataArgs {
|
|
88
|
+
readonly chainId: number;
|
|
89
|
+
readonly verifyingContract: Address;
|
|
90
|
+
readonly buyer: Address;
|
|
91
|
+
readonly shopAddress: Address;
|
|
92
|
+
readonly items: readonly PurchaseConfirmationItem[];
|
|
93
|
+
readonly nonce: bigint;
|
|
94
|
+
readonly deadline: bigint;
|
|
95
|
+
/**
|
|
96
|
+
* Maximum allowed delta between `now` and `deadline`. Defaults to
|
|
97
|
+
* `DEFAULT_MAX_DEADLINE_HORIZON_SECONDS` (1 hour). Throws
|
|
98
|
+
* `DeadlineTooFarError` if exceeded — guards against
|
|
99
|
+
* "approve forever" signatures.
|
|
100
|
+
*/
|
|
101
|
+
readonly maxDeadlineHorizonSeconds?: bigint;
|
|
102
|
+
/** Current unix-seconds, for testability. Defaults to Date.now()/1000. */
|
|
103
|
+
readonly nowSeconds?: bigint;
|
|
104
|
+
}
|
|
105
|
+
export interface PurchaseTypedData {
|
|
106
|
+
readonly domain: {
|
|
107
|
+
readonly name: typeof DROPLINKED_TYPED_DATA_NAME;
|
|
108
|
+
readonly version: typeof DROPLINKED_TYPED_DATA_VERSION;
|
|
109
|
+
readonly chainId: number;
|
|
110
|
+
readonly verifyingContract: Address;
|
|
111
|
+
};
|
|
112
|
+
readonly types: typeof PURCHASE_CONFIRMATION_TYPES;
|
|
113
|
+
readonly primaryType: 'PurchaseConfirmation';
|
|
114
|
+
readonly message: PurchaseConfirmationMessage;
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Build the canonical EIP-712 typed-data payload for a purchase
|
|
118
|
+
* confirmation. Pure: no I/O. The caller has already read the
|
|
119
|
+
* on-chain `nonce` from `purchaseNonces(buyer)`.
|
|
120
|
+
*
|
|
121
|
+
* EXPLICIT field copy — we do NOT spread the input object. This
|
|
122
|
+
* prevents prototype pollution and accidental injection of extra
|
|
123
|
+
* fields into the signed payload.
|
|
124
|
+
*/
|
|
125
|
+
export declare function buildPurchaseTypedData(args: BuildPurchaseTypedDataArgs): PurchaseTypedData;
|
|
126
|
+
export interface VerifyPurchaseSignatureArgs {
|
|
127
|
+
readonly signature: PurchaseSignature;
|
|
128
|
+
readonly expectedSigner: Address;
|
|
129
|
+
/** Current unix-seconds. Defaults to Date.now()/1000. */
|
|
130
|
+
readonly nowSeconds?: bigint;
|
|
131
|
+
/**
|
|
132
|
+
* Per-shop on-chain nonce. The signature's `nonce` MUST equal this —
|
|
133
|
+
* otherwise it's either replayed or stale. The caller is responsible
|
|
134
|
+
* for reading this from `purchaseNonces(buyer)` immediately before
|
|
135
|
+
* verification.
|
|
136
|
+
*/
|
|
137
|
+
readonly onChainNonce: bigint;
|
|
138
|
+
/**
|
|
139
|
+
* Maximum allowed delta between `now` and the signature's `deadline`.
|
|
140
|
+
* Defaults to `DEFAULT_MAX_DEADLINE_HORIZON_SECONDS` (1 hour). Throws
|
|
141
|
+
* `DeadlineTooFarError` if the wire `deadline` exceeds this — defends
|
|
142
|
+
* against an attacker handing you a sig with `deadline = MAX_UINT256`.
|
|
143
|
+
*/
|
|
144
|
+
readonly maxDeadlineHorizonSeconds?: bigint;
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Verify a purchase signature end-to-end:
|
|
148
|
+
* - signature is 65-byte hex (no compact 2098)
|
|
149
|
+
* - deadline > now
|
|
150
|
+
* - nonce equals the on-chain nonce (no replay)
|
|
151
|
+
* - recovered signer == expectedSigner (case-insensitive)
|
|
152
|
+
*
|
|
153
|
+
* Throws a specific error class for each failure mode so callers can
|
|
154
|
+
* route to the right user-facing message.
|
|
155
|
+
*/
|
|
156
|
+
export declare function verifyPurchaseSignature(args: VerifyPurchaseSignatureArgs): Promise<true>;
|
|
157
|
+
//# sourceMappingURL=signing.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signing.d.ts","sourceRoot":"","sources":["../src/signing.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,OAAO,EAAmB,KAAK,OAAO,EAAE,KAAK,GAAG,EAAE,MAAM,MAAM,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yB,CAAC,EAAE,MAAM,CAAC;IAC5C,0EAA0E;IAC1E,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;CAC9B;AAED,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,MAAM,EAAE;QACf,QAAQ,CAAC,IAAI,EAAE,OAAO,0BAA0B,CAAC;QACjD,QAAQ,CAAC,OAAO,EAAE,OAAO,6BAA6B,CAAC;QACvD,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;QACzB,QAAQ,CAAC,iBAAiB,EAAE,OAAO,CAAC;KACrC,CAAC;IACF,QAAQ,CAAC,KAAK,EAAE,OAAO,2BAA2B,CAAC;IACnD,QAAQ,CAAC,WAAW,EAAE,sBAAsB,CAAC;IAC7C,QAAQ,CAAC,OAAO,EAAE,2BAA2B,CAAC;CAC/C;AAED;;;;;;;;GAQG;AACH,wBAAgB,sBAAsB,CACpC,IAAI,EAAE,0BAA0B,GAC/B,iBAAiB,CAyDnB;AAMD,MAAM,WAAW,2BAA2B;IAC1C,QAAQ,CAAC,SAAS,EAAE,iBAAiB,CAAC;IACtC,QAAQ,CAAC,cAAc,EAAE,OAAO,CAAC;IACjC,yDAAyD;IACzD,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B;;;;;OAKG;IACH,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B;;;;;OAKG;IACH,QAAQ,CAAC,yBAAyB,CAAC,EAAE,MAAM,CAAC;CAC7C;AAED;;;;;;;;;GASG;AACH,wBAAsB,uBAAuB,CAC3C,IAAI,EAAE,2BAA2B,GAChC,OAAO,CAAC,IAAI,CAAC,CAiEf"}
|
package/dist/signing.js
ADDED
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* EIP-712 typed-data signing and verification for the droplinked
|
|
3
|
+
* purchase-confirmation flow (claimNFTs).
|
|
4
|
+
*
|
|
5
|
+
* Hardening deltas vs droplinked-web3@5.0.2:
|
|
6
|
+
* 1. v5.0.2 transported a bare `signature` + `purchaseData[]` with
|
|
7
|
+
* NO domain binding. A signature created for shop A on chain X
|
|
8
|
+
* could be replayed against shop B on chain Y. This package
|
|
9
|
+
* embeds `chainId`, `verifyingContract`, single-use `nonce`, and
|
|
10
|
+
* `deadline` in the EIP-712 domain — every signature is bound to
|
|
11
|
+
* one shop on one chain at one time.
|
|
12
|
+
* 2. Nonces MUST be read from the shop contract via
|
|
13
|
+
* `purchaseNonces(buyer)` immediately before signing; the SDK
|
|
14
|
+
* refuses to sign with a cached nonce.
|
|
15
|
+
* 3. Deadlines must be in the future at submission time.
|
|
16
|
+
* 4. Verification uses viem's `verifyTypedData`. Recovered addresses
|
|
17
|
+
* are compared as lowercased hex (no checksum sensitivity).
|
|
18
|
+
* 5. The signature byte length is asserted to be exactly 65 bytes
|
|
19
|
+
* (130 hex chars + 0x). Compact 64-byte EIP-2098 sigs are
|
|
20
|
+
* explicitly rejected — they remove the v parity bit and have
|
|
21
|
+
* been observed in malformed wallet flows.
|
|
22
|
+
*/
|
|
23
|
+
import { verifyTypedData } from 'viem';
|
|
24
|
+
import { DeadlineExpiredError, DeadlineTooFarError, InvalidParametersException, ReplayDetectedError, SignatureVerificationError, } from './errors.js';
|
|
25
|
+
/**
|
|
26
|
+
* Maximum allowed window between `now` and `deadline` when building or
|
|
27
|
+
* verifying a purchase typed-data payload. Defaults to 1 hour (3600s).
|
|
28
|
+
*
|
|
29
|
+
* Rationale: the re-audit flagged that `deadline = MAX_UINT256` would
|
|
30
|
+
* effectively be an "approve forever" signature — if leaked, it could
|
|
31
|
+
* be replayed at any time in the future. 1 hour is loose enough to
|
|
32
|
+
* support normal wallet-confirmation latency and tight enough to
|
|
33
|
+
* prevent an indefinite signature from being captured.
|
|
34
|
+
*
|
|
35
|
+
* Consumers can override per-call via
|
|
36
|
+
* `buildPurchaseTypedData({ maxDeadlineHorizonSeconds })` for cases
|
|
37
|
+
* where the operator deliberately wants a longer window (e.g. a 24h
|
|
38
|
+
* pre-signed batch claim). Anything outside the override throws
|
|
39
|
+
* `DeadlineTooFarError`.
|
|
40
|
+
*/
|
|
41
|
+
export const DEFAULT_MAX_DEADLINE_HORIZON_SECONDS = 3600n;
|
|
42
|
+
import { EvmAddressSchema, PurchaseSignatureSchema, Uint256Schema, } from './types.js';
|
|
43
|
+
/* -------------------------------------------------------------------------- */
|
|
44
|
+
/* EIP-712 schema */
|
|
45
|
+
/* -------------------------------------------------------------------------- */
|
|
46
|
+
export const DROPLINKED_TYPED_DATA_VERSION = '1';
|
|
47
|
+
export const DROPLINKED_TYPED_DATA_NAME = 'DroplinkedShop';
|
|
48
|
+
export const PURCHASE_CONFIRMATION_TYPES = {
|
|
49
|
+
PurchaseConfirmation: [
|
|
50
|
+
{ name: 'buyer', type: 'address' },
|
|
51
|
+
{ name: 'shopAddress', type: 'address' },
|
|
52
|
+
{ name: 'items', type: 'PurchaseItem[]' },
|
|
53
|
+
{ name: 'nonce', type: 'uint256' },
|
|
54
|
+
{ name: 'deadline', type: 'uint256' },
|
|
55
|
+
],
|
|
56
|
+
PurchaseItem: [
|
|
57
|
+
{ name: 'amount', type: 'uint256' },
|
|
58
|
+
{ name: 'productId', type: 'uint256' },
|
|
59
|
+
{ name: 'nullifier', type: 'bytes32' },
|
|
60
|
+
],
|
|
61
|
+
};
|
|
62
|
+
/**
|
|
63
|
+
* Build the canonical EIP-712 typed-data payload for a purchase
|
|
64
|
+
* confirmation. Pure: no I/O. The caller has already read the
|
|
65
|
+
* on-chain `nonce` from `purchaseNonces(buyer)`.
|
|
66
|
+
*
|
|
67
|
+
* EXPLICIT field copy — we do NOT spread the input object. This
|
|
68
|
+
* prevents prototype pollution and accidental injection of extra
|
|
69
|
+
* fields into the signed payload.
|
|
70
|
+
*/
|
|
71
|
+
export function buildPurchaseTypedData(args) {
|
|
72
|
+
const chainId = args.chainId;
|
|
73
|
+
if (!Number.isInteger(chainId) || chainId <= 0) {
|
|
74
|
+
throw new InvalidParametersException(`chainId must be a positive integer, got ${chainId}`);
|
|
75
|
+
}
|
|
76
|
+
const verifyingContract = EvmAddressSchema.parse(args.verifyingContract);
|
|
77
|
+
const buyer = EvmAddressSchema.parse(args.buyer);
|
|
78
|
+
const shopAddress = EvmAddressSchema.parse(args.shopAddress);
|
|
79
|
+
const nonce = Uint256Schema.parse(args.nonce);
|
|
80
|
+
const deadline = Uint256Schema.parse(args.deadline);
|
|
81
|
+
// Deadline upper-bound cap. Prevents indefinite signatures ("approve
|
|
82
|
+
// forever" semantics) — see DEFAULT_MAX_DEADLINE_HORIZON_SECONDS.
|
|
83
|
+
const maxHorizon = args.maxDeadlineHorizonSeconds ?? DEFAULT_MAX_DEADLINE_HORIZON_SECONDS;
|
|
84
|
+
if (maxHorizon <= 0n) {
|
|
85
|
+
throw new InvalidParametersException(`maxDeadlineHorizonSeconds must be > 0, got ${maxHorizon.toString()}`);
|
|
86
|
+
}
|
|
87
|
+
const now = args.nowSeconds ?? BigInt(Math.floor(Date.now() / 1000));
|
|
88
|
+
const maxAllowed = now + maxHorizon;
|
|
89
|
+
if (deadline > maxAllowed) {
|
|
90
|
+
throw new DeadlineTooFarError(deadline, maxAllowed, now);
|
|
91
|
+
}
|
|
92
|
+
if (args.items.length === 0) {
|
|
93
|
+
throw new InvalidParametersException('items must not be empty');
|
|
94
|
+
}
|
|
95
|
+
const items = args.items.map((it) => {
|
|
96
|
+
const amount = Uint256Schema.parse(it.amount);
|
|
97
|
+
if (amount === 0n) {
|
|
98
|
+
throw new InvalidParametersException('item amount must be > 0');
|
|
99
|
+
}
|
|
100
|
+
if (!/^0x[a-fA-F0-9]+$/u.test(it.nullifier)) {
|
|
101
|
+
throw new InvalidParametersException('item nullifier must be 0x-prefixed hex');
|
|
102
|
+
}
|
|
103
|
+
return {
|
|
104
|
+
amount,
|
|
105
|
+
productId: Uint256Schema.parse(it.productId),
|
|
106
|
+
nullifier: it.nullifier.toLowerCase(),
|
|
107
|
+
};
|
|
108
|
+
});
|
|
109
|
+
return {
|
|
110
|
+
domain: {
|
|
111
|
+
name: DROPLINKED_TYPED_DATA_NAME,
|
|
112
|
+
version: DROPLINKED_TYPED_DATA_VERSION,
|
|
113
|
+
chainId,
|
|
114
|
+
verifyingContract,
|
|
115
|
+
},
|
|
116
|
+
types: PURCHASE_CONFIRMATION_TYPES,
|
|
117
|
+
primaryType: 'PurchaseConfirmation',
|
|
118
|
+
message: { buyer, shopAddress, items, nonce, deadline },
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Verify a purchase signature end-to-end:
|
|
123
|
+
* - signature is 65-byte hex (no compact 2098)
|
|
124
|
+
* - deadline > now
|
|
125
|
+
* - nonce equals the on-chain nonce (no replay)
|
|
126
|
+
* - recovered signer == expectedSigner (case-insensitive)
|
|
127
|
+
*
|
|
128
|
+
* Throws a specific error class for each failure mode so callers can
|
|
129
|
+
* route to the right user-facing message.
|
|
130
|
+
*/
|
|
131
|
+
export async function verifyPurchaseSignature(args) {
|
|
132
|
+
const sig = PurchaseSignatureSchema.parse(args.signature);
|
|
133
|
+
const expectedSigner = EvmAddressSchema.parse(args.expectedSigner);
|
|
134
|
+
const now = args.nowSeconds ?? BigInt(Math.floor(Date.now() / 1000));
|
|
135
|
+
if (sig.deadline < now) {
|
|
136
|
+
throw new DeadlineExpiredError(sig.deadline, now);
|
|
137
|
+
}
|
|
138
|
+
// Upper-bound cap — symmetrical with build-time check. An attacker
|
|
139
|
+
// who hands you a sig with deadline = MAX_UINT256 (or 24h out when
|
|
140
|
+
// your policy is 1h) is trying to extend the replay window.
|
|
141
|
+
const maxHorizon = args.maxDeadlineHorizonSeconds ?? DEFAULT_MAX_DEADLINE_HORIZON_SECONDS;
|
|
142
|
+
if (maxHorizon <= 0n) {
|
|
143
|
+
throw new InvalidParametersException(`maxDeadlineHorizonSeconds must be > 0, got ${maxHorizon.toString()}`);
|
|
144
|
+
}
|
|
145
|
+
const maxAllowed = now + maxHorizon;
|
|
146
|
+
if (sig.deadline > maxAllowed) {
|
|
147
|
+
throw new DeadlineTooFarError(sig.deadline, maxAllowed, now);
|
|
148
|
+
}
|
|
149
|
+
if (sig.nonce !== args.onChainNonce) {
|
|
150
|
+
throw new ReplayDetectedError(sig.nonce);
|
|
151
|
+
}
|
|
152
|
+
if (sig.signature.length !== 132) {
|
|
153
|
+
// 0x + 130 = 132 chars = 65 bytes; compact 64-byte sigs (130 chars
|
|
154
|
+
// with 0x) are length 130 — rejected.
|
|
155
|
+
throw new SignatureVerificationError(`signature must be 65 bytes (132-char hex incl. 0x); got ${sig.signature.length}`);
|
|
156
|
+
}
|
|
157
|
+
// Reconstruct the typed-data payload from the wire fields. Buyer is
|
|
158
|
+
// assumed to be the expectedSigner (the buyer signs their own
|
|
159
|
+
// purchase) — if a future flow ever splits buyer from signer the
|
|
160
|
+
// schema gains a `buyer` field.
|
|
161
|
+
const typedData = buildPurchaseTypedData({
|
|
162
|
+
chainId: sig.chainId,
|
|
163
|
+
verifyingContract: sig.verifyingContract,
|
|
164
|
+
buyer: expectedSigner,
|
|
165
|
+
shopAddress: sig.shopAddress,
|
|
166
|
+
items: sig.purchaseData,
|
|
167
|
+
nonce: sig.nonce,
|
|
168
|
+
deadline: sig.deadline,
|
|
169
|
+
// Pass through the same horizon + now so the inner cap is
|
|
170
|
+
// consistent with verify-time policy (already enforced above).
|
|
171
|
+
maxDeadlineHorizonSeconds: maxHorizon,
|
|
172
|
+
nowSeconds: now,
|
|
173
|
+
});
|
|
174
|
+
const ok = await verifyTypedData({
|
|
175
|
+
address: expectedSigner,
|
|
176
|
+
domain: typedData.domain,
|
|
177
|
+
types: typedData.types,
|
|
178
|
+
primaryType: typedData.primaryType,
|
|
179
|
+
message: typedData.message,
|
|
180
|
+
signature: sig.signature,
|
|
181
|
+
});
|
|
182
|
+
if (!ok) {
|
|
183
|
+
throw new SignatureVerificationError('EIP-712 typed-data signature did not recover to expectedSigner');
|
|
184
|
+
}
|
|
185
|
+
return true;
|
|
186
|
+
}
|
|
187
|
+
//# s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