mppx 0.21.1 → 0.21.2
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/CHANGELOG.md +13 -0
- package/dist/Errors.d.ts +55 -0
- package/dist/Errors.js +48 -0
- package/dist/Html.d.ts +1 -1
- package/dist/Html.js +2 -2
- package/dist/Method.d.ts +1 -1
- package/dist/cli/cli.js +138 -138
- package/dist/cli/internal.js +1 -1
- package/dist/cli/plugins/evm.js +1 -1
- package/dist/cli/plugins/index.js +13 -13
- package/dist/cli/plugins/x402.js +1 -1
- package/dist/cli/utils.d.ts +2 -45
- package/dist/cli/utils.js +2 -79
- package/dist/cli/validate/index.js +5 -2
- package/dist/cli/validate/payment.d.ts +1 -1
- package/dist/cli/validate/payment.js +3 -3
- package/dist/cli/validate/print.d.ts +12 -0
- package/dist/cli/validate/print.js +35 -0
- package/dist/client/core.d.ts +6 -0
- package/dist/client/core.js +6 -0
- package/dist/client/index.d.ts +2 -8
- package/dist/client/index.js +2 -6
- package/dist/client/internal/protocols/Shared.js +1 -1
- package/dist/client/internal/protocols/X402.js +3 -3
- package/dist/evm/client/Charge.js +1 -1
- package/dist/evm/index.d.ts +1 -1
- package/dist/evm/server/Charge.js +1 -1
- package/dist/integrations/x402/Evm.js +1 -1
- package/dist/integrations/x402/Negotiator.js +1 -1
- package/dist/internal/AcceptPayment.js +1 -1
- package/dist/internal/CredentialExpiry.js +1 -1
- package/dist/{mcp/internal/Credential.d.ts → internal/McpCredential.d.ts} +2 -2
- package/dist/{mcp/internal/Credential.js → internal/McpCredential.js} +2 -2
- package/dist/{server/internal → internal}/challengeMeta.js +1 -1
- package/dist/{server/internal → internal}/html/config.d.ts +2 -2
- package/dist/internal/pc.d.ts +46 -0
- package/dist/internal/pc.js +80 -0
- package/dist/internal/version.d.ts +2 -2
- package/dist/internal/version.js +1 -1
- package/dist/{x402 → internal/x402}/Header.js +1 -1
- package/dist/{x402 → internal/x402}/Siwx.d.ts +2 -2
- package/dist/{x402 → internal/x402}/Siwx.js +2 -2
- package/dist/{x402 → internal/x402}/Types.d.ts +1 -1
- package/dist/{x402 → internal/x402}/Types.js +1 -1
- package/dist/mcp/server/index.d.ts +1 -1
- package/dist/mcp/server/index.js +1 -1
- package/dist/server/Mppx.d.ts +1 -1
- package/dist/server/Mppx.js +6 -6
- package/dist/server/Transport.d.ts +2 -2
- package/dist/server/Transport.js +4 -4
- package/dist/server/index.d.ts +1 -8
- package/dist/server/index.js +1 -8
- package/dist/{mcp/server/Transport.d.ts → server/internal/mcpSdk.d.ts} +2 -2
- package/dist/{mcp/server/Transport.js → server/internal/mcpSdk.js} +3 -3
- package/dist/stripe/server/Charge.d.ts +1 -1
- package/dist/stripe/server/internal/html.gen.js +1 -1
- package/dist/tempo/Methods.d.ts +3 -0
- package/dist/tempo/Methods.js +3 -1
- package/dist/tempo/client/Charge.js +1 -1
- package/dist/tempo/client/Methods.d.ts +3 -0
- package/dist/tempo/client/index.d.ts +3 -0
- package/dist/tempo/client/index.js +1 -0
- package/dist/tempo/internal/configurable-account.d.ts +26 -0
- package/dist/tempo/internal/configurable-account.js +77 -0
- package/dist/tempo/internal/signature.d.ts +15 -0
- package/dist/tempo/internal/signature.js +43 -0
- package/dist/tempo/server/Charge.d.ts +1 -1
- package/dist/tempo/server/Charge.js +1 -1
- package/dist/tempo/server/Methods.d.ts +139 -4
- package/dist/tempo/server/internal/html.gen.js +1 -1
- package/dist/tempo/session/client/ChannelOps.d.ts +29 -0
- package/dist/tempo/session/client/ChannelOps.js +108 -3
- package/dist/tempo/session/client/CredentialState.d.ts +6 -0
- package/dist/tempo/session/client/CredentialState.js +29 -4
- package/dist/tempo/session/client/Session.d.ts +3 -0
- package/dist/tempo/session/client/SessionManager.js +4 -0
- package/dist/tempo/session/precompile/Chain.d.ts +35 -1
- package/dist/tempo/session/precompile/Chain.js +52 -0
- package/dist/tempo/session/precompile/Voucher.d.ts +46 -5
- package/dist/tempo/session/precompile/Voucher.js +78 -29
- package/dist/tempo/session/precompile/escrow.abi.d.ts +79 -0
- package/dist/tempo/session/precompile/escrow.abi.js +38 -0
- package/dist/tempo/session/server/ChannelStore.d.ts +27 -0
- package/dist/tempo/session/server/ChannelStore.js +24 -3
- package/dist/tempo/session/server/CredentialVerification.d.ts +7 -1
- package/dist/tempo/session/server/CredentialVerification.js +91 -12
- package/dist/tempo/session/server/RequestState.d.ts +2 -0
- package/dist/tempo/session/server/RequestState.js +1 -0
- package/dist/tempo/session/server/Session.d.ts +11 -0
- package/dist/tempo/session/server/Session.js +10 -2
- package/dist/tempo/session/server/SponsorshipLimit.d.ts +11 -3
- package/dist/tempo/session/server/SponsorshipLimit.js +36 -4
- package/dist/tempo/subscription/KeyAuthorization.js +6 -2
- package/dist/{cli/validate → validation}/challenge.d.ts +1 -1
- package/dist/{cli/validate → validation}/challenge.js +4 -4
- package/dist/validation/core.d.ts +29 -2
- package/dist/validation/core.js +41 -10
- package/dist/{cli/validate → validation}/helpers.d.ts +0 -10
- package/dist/{cli/validate → validation}/helpers.js +1 -35
- package/dist/validation/index.d.ts +2 -2
- package/dist/validation/index.js +1 -1
- package/dist/x402/Assets.d.ts +1 -1
- package/dist/x402/client/Exact.d.ts +1 -1
- package/dist/x402/client/Exact.js +2 -2
- package/dist/x402/index.d.ts +4 -4
- package/dist/x402/index.js +4 -4
- package/dist/x402/internal/RouteBinding.d.ts +1 -1
- package/dist/x402/mcp.js +2 -2
- package/dist/x402/server/EvmCharge.d.ts +2 -2
- package/dist/x402/server/EvmCharge.js +4 -4
- package/dist/x402/server/Facilitator.d.ts +1 -1
- package/dist/x402/server/Facilitator.js +1 -1
- package/package.json +13 -1
- /package/dist/{server/internal → internal}/challengeMeta.d.ts +0 -0
- /package/dist/{server/internal → internal}/html/compose.main.gen.d.ts +0 -0
- /package/dist/{server/internal → internal}/html/compose.main.gen.js +0 -0
- /package/dist/{server/internal → internal}/html/config.js +0 -0
- /package/dist/{server/internal → internal}/html/constants.d.ts +0 -0
- /package/dist/{server/internal → internal}/html/constants.js +0 -0
- /package/dist/{server/internal → internal}/html/serviceWorker.client.d.ts +0 -0
- /package/dist/{server/internal → internal}/html/serviceWorker.client.js +0 -0
- /package/dist/{server/internal → internal}/html/serviceWorker.gen.d.ts +0 -0
- /package/dist/{server/internal → internal}/html/serviceWorker.gen.js +0 -0
- /package/dist/{x402/internal → internal/x402}/ChallengeBrand.d.ts +0 -0
- /package/dist/{x402/internal → internal/x402}/ChallengeBrand.js +0 -0
- /package/dist/{x402 → internal/x402}/Header.d.ts +0 -0
- /package/dist/{cli/validate → validation}/discovery.d.ts +0 -0
- /package/dist/{cli/validate → validation}/discovery.js +0 -0
- /package/dist/{cli/validate → validation}/messages.d.ts +0 -0
- /package/dist/{cli/validate → validation}/messages.js +0 -0
|
@@ -40,6 +40,21 @@ export type ChannelEntry = {
|
|
|
40
40
|
};
|
|
41
41
|
/** Resolves the voucher authority address for a client account. */
|
|
42
42
|
export declare function resolveAuthorizedSigner(account: Account): Address;
|
|
43
|
+
/**
|
|
44
|
+
* Returns whether a client account's vouchers are TIP-1166 configurable account (`0x05`)
|
|
45
|
+
* signatures, which only servers that advertise `configurableVouchers` accept.
|
|
46
|
+
*/
|
|
47
|
+
export declare function isConfigurableSigner(account: Account): boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Resolves the default TIP-1034 open salt for a client account.
|
|
50
|
+
*
|
|
51
|
+
* From T15 (TIP-1166), the escrow requires the salt of a channel whose signer has a config
|
|
52
|
+
* commitment to equal that commitment, and records it so vouchers are checked against it. A
|
|
53
|
+
* configurable account signer therefore opens with its commitment: the one on chain, or, when it
|
|
54
|
+
* is not registered yet, the one its version-zero config registers in the open transaction itself.
|
|
55
|
+
* Every other account gets a random salt, with no RPC call.
|
|
56
|
+
*/
|
|
57
|
+
export declare function resolveOpenSalt(client: Client, account: Account): Promise<Hex.Hex>;
|
|
43
58
|
/** Resolves the server-advertised escrow against the client's trust policy. */
|
|
44
59
|
export declare function resolveEscrow(challenge: {
|
|
45
60
|
request: {
|
|
@@ -50,6 +65,15 @@ export declare function resolveEscrow(challenge: {
|
|
|
50
65
|
export declare function serializeCredential(challenge: Challenge, payload: SessionCredentialPayload, chainId: number, account: Account): string;
|
|
51
66
|
/** Case-insensitive EVM address equality. */
|
|
52
67
|
export declare function isSameAddress(a: Address, b: Address): boolean;
|
|
68
|
+
/**
|
|
69
|
+
* Asserts that a configurable account signer can sign a voucher an existing channel settles
|
|
70
|
+
* (TIP-1166). A channel whose signer had a config commitment at open carries it as its salt and
|
|
71
|
+
* settles only `0x05` vouchers whose config hashes to it. A channel opened with no commitment (a
|
|
72
|
+
* zero opening commitment) settles a `0x05` voucher only from the version-zero config that derives the
|
|
73
|
+
* signer's address; otherwise it settles only primitive vouchers, which a configurable account
|
|
74
|
+
* cannot sign. Primitive account signers keep signing primitive vouchers.
|
|
75
|
+
*/
|
|
76
|
+
export declare function assertCanSignVoucher(account: Account, descriptor: Channel.ChannelDescriptor): void;
|
|
53
77
|
/**
|
|
54
78
|
* Signs and creates a TIP-1034 voucher credential payload for an existing channel.
|
|
55
79
|
*
|
|
@@ -81,6 +105,11 @@ export declare function createOpenPayload(client: Client, account: Account, para
|
|
|
81
105
|
payee: Address;
|
|
82
106
|
/** Calls executed atomically before the channel is opened. */
|
|
83
107
|
prefixCalls?: readonly TempoChannelCall[] | undefined;
|
|
108
|
+
/**
|
|
109
|
+
* Channel salt. Defaults to the signer's TIP-1166 config commitment for a configurable
|
|
110
|
+
* account, else a random value. See {@link resolveOpenSalt}.
|
|
111
|
+
*/
|
|
112
|
+
salt?: Hex.Hex | undefined;
|
|
84
113
|
token: Address;
|
|
85
114
|
}): Promise<OpenCredentialPayload>;
|
|
86
115
|
/**
|
|
@@ -9,10 +9,12 @@
|
|
|
9
9
|
* @see https://tips.sh/1034-1
|
|
10
10
|
*/
|
|
11
11
|
import { Hex } from 'ox';
|
|
12
|
-
import {
|
|
12
|
+
import { AccountConfig } from 'ox/tempo';
|
|
13
|
+
import { decodeErrorResult, encodeFunctionData, isAddress, } from 'viem';
|
|
13
14
|
import { prepareTransactionRequest, signTransaction } from 'viem/actions';
|
|
14
|
-
import { Transaction } from 'viem/tempo';
|
|
15
|
+
import { Actions, Transaction } from 'viem/tempo';
|
|
15
16
|
import * as Credential from '../../../Credential.js';
|
|
17
|
+
import * as Errors from '../../../Errors.js';
|
|
16
18
|
import * as Simulation from '../../internal/simulation.js';
|
|
17
19
|
import * as Channel from '../precompile/Channel.js';
|
|
18
20
|
import { escrowAbi } from '../precompile/escrow.abi.js';
|
|
@@ -40,6 +42,80 @@ function randomValidAfter() {
|
|
|
40
42
|
export function resolveAuthorizedSigner(account) {
|
|
41
43
|
return readAccessKeyAddress(account) ?? account.address;
|
|
42
44
|
}
|
|
45
|
+
/**
|
|
46
|
+
* Returns whether a client account's vouchers are TIP-1166 configurable account (`0x05`)
|
|
47
|
+
* signatures, which only servers that advertise `configurableVouchers` accept.
|
|
48
|
+
*/
|
|
49
|
+
export function isConfigurableSigner(account) {
|
|
50
|
+
return resolveConfigurableSigner(account) !== undefined;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Returns the configurable account that signs a client account's vouchers: the account itself,
|
|
54
|
+
* or the configurable account behind a configurable access key (TIP-1111), which signs vouchers
|
|
55
|
+
* raw as the channel's authorized signer.
|
|
56
|
+
*/
|
|
57
|
+
function resolveConfigurableSigner(account) {
|
|
58
|
+
const accessKeyAddress = readAccessKeyAddress(account);
|
|
59
|
+
if (accessKeyAddress === undefined)
|
|
60
|
+
return Voucher.isConfigurableAccount(account) ? account : undefined;
|
|
61
|
+
const delegate = account.delegate;
|
|
62
|
+
if (delegate &&
|
|
63
|
+
Voucher.isConfigurableAccount(delegate) &&
|
|
64
|
+
delegate.address.toLowerCase() === accessKeyAddress.toLowerCase())
|
|
65
|
+
return delegate;
|
|
66
|
+
return undefined;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Resolves the default TIP-1034 open salt for a client account.
|
|
70
|
+
*
|
|
71
|
+
* From T15 (TIP-1166), the escrow requires the salt of a channel whose signer has a config
|
|
72
|
+
* commitment to equal that commitment, and records it so vouchers are checked against it. A
|
|
73
|
+
* configurable account signer therefore opens with its commitment: the one on chain, or, when it
|
|
74
|
+
* is not registered yet, the one its version-zero config registers in the open transaction itself.
|
|
75
|
+
* Every other account gets a random salt, with no RPC call.
|
|
76
|
+
*/
|
|
77
|
+
export async function resolveOpenSalt(client, account) {
|
|
78
|
+
const signer = resolveConfigurableSigner(account);
|
|
79
|
+
if (!signer)
|
|
80
|
+
return Hex.random(32);
|
|
81
|
+
const { config } = signer;
|
|
82
|
+
const onChain = await Actions.accounts.getConfigCommitment(client, { account: signer.address });
|
|
83
|
+
const local = config ? AccountConfig.getCommitment(config) : undefined;
|
|
84
|
+
if (BigInt(onChain) !== 0n) {
|
|
85
|
+
if (local && local.toLowerCase() !== onChain.toLowerCase())
|
|
86
|
+
throw new Error(`Configurable account ${signer.address} holds a config whose commitment ${local} does not match its on-chain commitment ${onChain}. Use the account's current config.`);
|
|
87
|
+
return onChain;
|
|
88
|
+
}
|
|
89
|
+
if (!local || BigInt(config.version ?? 0n) !== 0n)
|
|
90
|
+
throw new Error(`Configurable account ${signer.address} is not registered, so it needs its version-zero config to open a channel.`);
|
|
91
|
+
return local;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Maps a top-up simulation that reverted with TIP-1166 `SignerConfigChanged` or
|
|
95
|
+
* `RootKeyRetired` for the channel signer to {@link Errors.SignerConfigChangedError}.
|
|
96
|
+
*/
|
|
97
|
+
function toSignerConfigChangedError(error, parameters) {
|
|
98
|
+
const data = Simulation.getRevertData(error);
|
|
99
|
+
if (!data)
|
|
100
|
+
return undefined;
|
|
101
|
+
try {
|
|
102
|
+
const decoded = decodeErrorResult({ abi: escrowAbi, data });
|
|
103
|
+
if (decoded.errorName !== 'SignerConfigChanged' && decoded.errorName !== 'RootKeyRetired')
|
|
104
|
+
return undefined;
|
|
105
|
+
const [signer] = decoded.args;
|
|
106
|
+
if (signer.toLowerCase() !== parameters.signer.toLowerCase())
|
|
107
|
+
return undefined;
|
|
108
|
+
return new Errors.SignerConfigChangedError({
|
|
109
|
+
cause: error,
|
|
110
|
+
channelId: parameters.channelId,
|
|
111
|
+
reason: decoded.errorName,
|
|
112
|
+
signer,
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
catch {
|
|
116
|
+
return undefined;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
43
119
|
async function prepareTempoChannelTransaction(client, parameters) {
|
|
44
120
|
const { account, calls, feePayer, feeToken, validAfter } = parameters;
|
|
45
121
|
// Session management transactions are independent and short-lived, so they
|
|
@@ -89,6 +165,26 @@ export function serializeCredential(challenge, payload, chainId, account) {
|
|
|
89
165
|
export function isSameAddress(a, b) {
|
|
90
166
|
return a.toLowerCase() === b.toLowerCase();
|
|
91
167
|
}
|
|
168
|
+
/**
|
|
169
|
+
* Asserts that a configurable account signer can sign a voucher an existing channel settles
|
|
170
|
+
* (TIP-1166). A channel whose signer had a config commitment at open carries it as its salt and
|
|
171
|
+
* settles only `0x05` vouchers whose config hashes to it. A channel opened with no commitment (a
|
|
172
|
+
* zero opening commitment) settles a `0x05` voucher only from the version-zero config that derives the
|
|
173
|
+
* signer's address; otherwise it settles only primitive vouchers, which a configurable account
|
|
174
|
+
* cannot sign. Primitive account signers keep signing primitive vouchers.
|
|
175
|
+
*/
|
|
176
|
+
export function assertCanSignVoucher(account, descriptor) {
|
|
177
|
+
const signer = resolveConfigurableSigner(account);
|
|
178
|
+
if (!signer?.config)
|
|
179
|
+
return;
|
|
180
|
+
const { config } = signer;
|
|
181
|
+
if (AccountConfig.getCommitment(config).toLowerCase() === descriptor.salt.toLowerCase())
|
|
182
|
+
return;
|
|
183
|
+
if (BigInt(config.version ?? 0n) === 0n &&
|
|
184
|
+
AccountConfig.getAddress(config).toLowerCase() === signer.address.toLowerCase())
|
|
185
|
+
return;
|
|
186
|
+
throw new Error(`Configurable account ${signer.address} holds a config that does not match the channel's opening commitment (salt ${descriptor.salt}), so it cannot sign a voucher the channel settles. Sign with the config the channel opened with, or close the channel and open a new one.`);
|
|
187
|
+
}
|
|
92
188
|
/**
|
|
93
189
|
* Signs and creates a TIP-1034 voucher credential payload for an existing channel.
|
|
94
190
|
*
|
|
@@ -101,6 +197,7 @@ export async function createVoucherPayload(client, account, descriptor, cumulati
|
|
|
101
197
|
escrow,
|
|
102
198
|
});
|
|
103
199
|
const amount = uint96(cumulativeAmount);
|
|
200
|
+
assertCanSignVoucher(account, descriptor);
|
|
104
201
|
const signature = await Voucher.signVoucher(client, account, { channelId, cumulativeAmount: amount }, escrow, chainId);
|
|
105
202
|
return {
|
|
106
203
|
action: 'voucher',
|
|
@@ -142,7 +239,7 @@ export async function createOpenPayload(client, account, parameters) {
|
|
|
142
239
|
const authorizedSigner = resolveAuthorizedSigner(account);
|
|
143
240
|
const escrow = parameters.escrow ?? tip20ChannelEscrow;
|
|
144
241
|
const operator = parameters.operator ?? '0x0000000000000000000000000000000000000000';
|
|
145
|
-
const salt =
|
|
242
|
+
const salt = parameters.salt ?? (await resolveOpenSalt(client, account));
|
|
146
243
|
const deposit = uint96(parameters.deposit);
|
|
147
244
|
const initialAmount = uint96(parameters.initialAmount);
|
|
148
245
|
const openData = encodeFunctionData({
|
|
@@ -155,6 +252,9 @@ export async function createOpenPayload(client, account, parameters) {
|
|
|
155
252
|
calls: [...(parameters.prefixCalls ?? []), { to: escrow, data: openData }],
|
|
156
253
|
feePayer: parameters.feePayer,
|
|
157
254
|
feeToken: parameters.feeToken ?? parameters.token,
|
|
255
|
+
// A configurable signer's salt is its stable config commitment, so the open needs its own
|
|
256
|
+
// entropy to get a distinct expiring nonce hash and channel ID.
|
|
257
|
+
validAfter: randomValidAfter(),
|
|
158
258
|
});
|
|
159
259
|
const transaction = await signPreparedTempoTransaction(client, prepared);
|
|
160
260
|
const signed = Transaction.deserialize(transaction);
|
|
@@ -216,6 +316,11 @@ export async function createTopUpPayload(client, account, descriptor, additional
|
|
|
216
316
|
feePayer,
|
|
217
317
|
feeToken,
|
|
218
318
|
validAfter: randomValidAfter(),
|
|
319
|
+
}).catch((error) => {
|
|
320
|
+
throw (toSignerConfigChangedError(error, {
|
|
321
|
+
channelId,
|
|
322
|
+
signer: Channel.resolveAuthorizedSigner(descriptor),
|
|
323
|
+
}) ?? error);
|
|
219
324
|
});
|
|
220
325
|
const transaction = await signPreparedTempoTransaction(client, prepared);
|
|
221
326
|
return {
|
|
@@ -102,6 +102,8 @@ export type ClientSessionMethodDetails = {
|
|
|
102
102
|
feeToken?: Address | undefined;
|
|
103
103
|
/** Channel operator address advertised by the server. */
|
|
104
104
|
operator?: Address | undefined;
|
|
105
|
+
/** Whether the server accepts TIP-1166 configurable account (`0x05`) vouchers. */
|
|
106
|
+
configurableVouchers?: boolean | undefined;
|
|
105
107
|
/** Server bootstrap snapshot for a reusable session channel. */
|
|
106
108
|
sessionSnapshot?: SessionSnapshot | undefined;
|
|
107
109
|
};
|
|
@@ -163,6 +165,8 @@ export type ChallengeContext = {
|
|
|
163
165
|
challenge: Challenge.Challenge;
|
|
164
166
|
chainId: number;
|
|
165
167
|
client: Client;
|
|
168
|
+
/** Whether the server accepts TIP-1166 configurable account (`0x05`) vouchers. */
|
|
169
|
+
configurableVouchers?: boolean | undefined;
|
|
166
170
|
escrow: Address;
|
|
167
171
|
feePayer?: boolean | undefined;
|
|
168
172
|
feeToken?: Address | undefined;
|
|
@@ -214,6 +218,8 @@ export type HydrateSessionSnapshotParameters = {
|
|
|
214
218
|
snapshot: SessionSnapshot;
|
|
215
219
|
/** Optional state reader for deterministic tests. */
|
|
216
220
|
readChannelState?: ReadReusableChannelState | undefined;
|
|
221
|
+
/** Optional escrow voucher check (`verifyVoucher` view) for deterministic tests. */
|
|
222
|
+
verifyVoucherOnChain?: typeof Chain.verifyVoucher | undefined;
|
|
217
223
|
};
|
|
218
224
|
/** Validated client channel state reconstructed without local persistence. */
|
|
219
225
|
export type HydratedSessionSnapshot = {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { isAddress, parseUnits, } from 'viem';
|
|
2
2
|
import * as Constants from '../../../Constants.js';
|
|
3
|
+
import * as Errors from '../../../Errors.js';
|
|
3
4
|
import { assertAllowedChainId, assertChainId } from '../../../viem/Client.js';
|
|
4
5
|
import * as z from '../../../zod.js';
|
|
5
6
|
import * as AutoSwap from '../../internal/auto-swap.js';
|
|
@@ -7,7 +8,7 @@ import * as MachineTokenCharge from '../../internal/machine-token-charge.js';
|
|
|
7
8
|
import * as Chain from '../precompile/Chain.js';
|
|
8
9
|
import * as Channel from '../precompile/Channel.js';
|
|
9
10
|
import * as Voucher from '../precompile/Voucher.js';
|
|
10
|
-
import { createClosePayload, createOpenPayload, createTopUpPayload, createVoucherPayload, isSameAddress, resolveAuthorizedSigner, resolveEscrow, } from './ChannelOps.js';
|
|
11
|
+
import { createClosePayload, createOpenPayload, createTopUpPayload, createVoucherPayload, isConfigurableSigner, isSameAddress, resolveAuthorizedSigner, resolveEscrow, } from './ChannelOps.js';
|
|
11
12
|
import { channelKey, entryKey, persistChannel, deleteChannel, } from './ChannelStore.js';
|
|
12
13
|
import { assertWithinMaxDeposit, resolveOpeningDeposit } from './Runtime.js';
|
|
13
14
|
/** Returns whether a credential payload carries cumulative voucher authorization. */
|
|
@@ -112,6 +113,9 @@ function readMethodDetails(challenge) {
|
|
|
112
113
|
feePayer: typeof methodDetails.feePayer === 'boolean' ? methodDetails.feePayer : undefined,
|
|
113
114
|
feeToken: readOptionalAddress(methodDetails.feeToken),
|
|
114
115
|
operator: readOptionalAddress(methodDetails.operator),
|
|
116
|
+
configurableVouchers: typeof methodDetails.configurableVouchers === 'boolean'
|
|
117
|
+
? methodDetails.configurableVouchers
|
|
118
|
+
: undefined,
|
|
115
119
|
sessionSnapshot: Constants.getMethodDetail(methodDetails, Constants.MethodDetailKeys.sessionSnapshot),
|
|
116
120
|
};
|
|
117
121
|
}
|
|
@@ -149,6 +153,9 @@ export async function resolveChallengeContext(parameters) {
|
|
|
149
153
|
challenge,
|
|
150
154
|
chainId,
|
|
151
155
|
client,
|
|
156
|
+
...(methodDetails.configurableVouchers !== undefined
|
|
157
|
+
? { configurableVouchers: methodDetails.configurableVouchers }
|
|
158
|
+
: {}),
|
|
152
159
|
escrow,
|
|
153
160
|
feePayer: methodDetails.feePayer,
|
|
154
161
|
feeToken: methodDetails.feeToken,
|
|
@@ -227,7 +234,7 @@ export function resolveRecoveredCumulative(parameters) {
|
|
|
227
234
|
}
|
|
228
235
|
/** Checks a server snapshot against its signed voucher and current TIP-1034 state. */
|
|
229
236
|
export async function hydrateSessionSnapshot(parameters) {
|
|
230
|
-
const { account, client, readChannelState, snapshot } = parameters;
|
|
237
|
+
const { account, client, readChannelState, snapshot, verifyVoucherOnChain = Chain.verifyVoucher, } = parameters;
|
|
231
238
|
const signed = snapshot.highestVoucher;
|
|
232
239
|
if (!signed)
|
|
233
240
|
throw new Error('session snapshot is missing its highest signed voucher');
|
|
@@ -245,11 +252,25 @@ export async function hydrateSessionSnapshot(parameters) {
|
|
|
245
252
|
throw new Error('session snapshot spent exceeds acceptedCumulative');
|
|
246
253
|
if (snapshotSettled > snapshotDeposit)
|
|
247
254
|
throw new Error('session snapshot settled amount exceeds deposit');
|
|
248
|
-
|
|
255
|
+
const highestVoucher = {
|
|
249
256
|
channelId: signed.channelId,
|
|
250
257
|
cumulativeAmount: voucherCumulative,
|
|
251
258
|
signature: signed.signature,
|
|
252
|
-
}
|
|
259
|
+
};
|
|
260
|
+
const voucherSigner = Channel.resolveAuthorizedSigner(snapshot.descriptor);
|
|
261
|
+
// A configurable account signer's vouchers carry its config: the one recorded at open (the
|
|
262
|
+
// channel salt) when it had a commitment then, else its version-zero config. The salt alone
|
|
263
|
+
// cannot show that the channel opened with no commitment, so only the escrow's `verifyVoucher`
|
|
264
|
+
// view, which knows the opening commitment, may accept a voucher that does not match the salt.
|
|
265
|
+
const configurable = isConfigurableSigner(account);
|
|
266
|
+
const valid = Voucher.verifyVoucher(snapshot.escrow, snapshot.chainId, highestVoucher, voucherSigner, configurable ? { configurable: true, openingCommitment: snapshot.descriptor.salt } : {}) ||
|
|
267
|
+
(configurable &&
|
|
268
|
+
(await verifyVoucherOnChain(client, {
|
|
269
|
+
descriptor: snapshot.descriptor,
|
|
270
|
+
cumulativeAmount: voucherCumulative,
|
|
271
|
+
signature: highestVoucher.signature,
|
|
272
|
+
}, snapshot.escrow).catch(() => false)));
|
|
273
|
+
if (!valid)
|
|
253
274
|
throw new Error('session snapshot highest voucher signature is invalid');
|
|
254
275
|
const reusable = await resolveReusableChannel({
|
|
255
276
|
channelId: snapshot.channelId,
|
|
@@ -362,6 +383,10 @@ async function assertMachineTokenDeposit(autoSwap, parameters) {
|
|
|
362
383
|
}
|
|
363
384
|
async function open(plan, sink, autoSwap) {
|
|
364
385
|
const { account, resolved } = plan;
|
|
386
|
+
// Servers without TIP-1166 support reject configurable account vouchers, so fail before the
|
|
387
|
+
// open transaction locks a deposit.
|
|
388
|
+
if (isConfigurableSigner(account) && resolved.configurableVouchers !== true)
|
|
389
|
+
throw new Errors.ConfigurableVouchersUnsupportedError({ signer: account.address });
|
|
365
390
|
const deposit = resolveOpeningDeposit({
|
|
366
391
|
contextDepositRaw: plan.context?.depositRaw,
|
|
367
392
|
maxDeposit: plan.maxDeposit,
|
|
@@ -56,6 +56,7 @@ export declare function session(parameters?: session.Parameters): Method.Client<
|
|
|
56
56
|
amount: import("zod/mini").ZodMiniString<string>;
|
|
57
57
|
chainId: import("zod/mini").ZodMiniOptional<import("zod/mini").ZodMiniNumber<number>>;
|
|
58
58
|
channelId: import("zod/mini").ZodMiniOptional<import("zod/mini").ZodMiniString<string>>;
|
|
59
|
+
configurableVouchers: import("zod/mini").ZodMiniOptional<import("zod/mini").ZodMiniBoolean<boolean>>;
|
|
59
60
|
currency: import("zod/mini").ZodMiniString<string>;
|
|
60
61
|
decimals: import("zod/mini").ZodMiniNumber<number>;
|
|
61
62
|
escrowContract: import("zod/mini").ZodMiniOptional<import("zod/mini").ZodMiniString<string>>;
|
|
@@ -85,6 +86,7 @@ export declare function session(parameters?: session.Parameters): Method.Client<
|
|
|
85
86
|
feePayer?: boolean | undefined;
|
|
86
87
|
feeToken?: string | undefined;
|
|
87
88
|
operator?: string | undefined;
|
|
89
|
+
configurableVouchers?: boolean | undefined;
|
|
88
90
|
sessionProtocol?: "v1" | "v2" | undefined;
|
|
89
91
|
sessionSnapshot?: import("./Runtime.js").SessionSnapshot | undefined;
|
|
90
92
|
};
|
|
@@ -92,6 +94,7 @@ export declare function session(parameters?: session.Parameters): Method.Client<
|
|
|
92
94
|
amount: string;
|
|
93
95
|
chainId?: number | undefined;
|
|
94
96
|
channelId?: string | undefined;
|
|
97
|
+
configurableVouchers?: boolean | undefined;
|
|
95
98
|
currency: string;
|
|
96
99
|
decimals: number;
|
|
97
100
|
escrowContract?: string | undefined;
|
|
@@ -12,6 +12,7 @@ import * as Account from '../../../viem/Account.js';
|
|
|
12
12
|
import * as Client from '../../../viem/Client.js';
|
|
13
13
|
import { charge as chargePlugin } from '../../client/Charge.js';
|
|
14
14
|
import * as defaults from '../../internal/defaults.js';
|
|
15
|
+
import { resolveEscrow } from '../client/ChannelOps.js';
|
|
15
16
|
import { createChannelStore, deleteChannel, entryKey, persistChannel as persistStoredChannel, registerFundingStore, withFundingLock, } from '../client/ChannelStore.js';
|
|
16
17
|
import { hydrateSessionSnapshot, sessionContextSchema, } from '../client/CredentialState.js';
|
|
17
18
|
import { session as sessionPlugin } from '../client/Session.js';
|
|
@@ -354,6 +355,9 @@ export function sessionManager(parameters) {
|
|
|
354
355
|
return undefined;
|
|
355
356
|
const snapshot = deserializeSessionSnapshot(header);
|
|
356
357
|
Client.assertAllowedChainId(parameters.allowedChainIds, snapshot.chainId);
|
|
358
|
+
// The snapshot's escrow verifies its voucher and reports its deposit, so it must pass the
|
|
359
|
+
// same escrow policy as a challenge before any contract read.
|
|
360
|
+
resolveEscrow({ request: { methodDetails: { escrow: snapshot.escrow } } }, parameters.escrow, allowCustomEscrow);
|
|
357
361
|
const client = await getClient({ chainId: snapshot.chainId });
|
|
358
362
|
Client.assertChainId(client, snapshot.chainId);
|
|
359
363
|
const defaultAccount = getAccount(client);
|
|
@@ -61,6 +61,11 @@ export type ChannelOpenedReceiptFields = {
|
|
|
61
61
|
deposit: bigint;
|
|
62
62
|
/** Expiring nonce hash emitted by the precompile. */
|
|
63
63
|
expiringNonceHash: Hex;
|
|
64
|
+
/**
|
|
65
|
+
* TIP-1166 signer config commitment recorded at open (`OpeningCommitmentRecorded`), present only when
|
|
66
|
+
* the channel signer had a nonzero config commitment.
|
|
67
|
+
*/
|
|
68
|
+
openingCommitment?: Hex | undefined;
|
|
64
69
|
};
|
|
65
70
|
/** Typed fields decoded from a TopUp receipt event. */
|
|
66
71
|
export type TopUpReceiptFields = {
|
|
@@ -88,6 +93,21 @@ type ReceiptEventWithArgs = {
|
|
|
88
93
|
};
|
|
89
94
|
/** Reads and validates typed fields from a ChannelOpened receipt event. */
|
|
90
95
|
export declare function readChannelOpenedReceiptFields(event: ReceiptEventWithArgs): ChannelOpenedReceiptFields;
|
|
96
|
+
/**
|
|
97
|
+
* Reads the TIP-1166 `OpeningCommitmentRecorded` event the escrow emits for a channel at open.
|
|
98
|
+
*
|
|
99
|
+
* Returns `undefined` when the receipt has none, which means the signer had no config commitment
|
|
100
|
+
* when the channel opened. The escrow requires the channel salt to equal the recorded commitment, so
|
|
101
|
+
* an opening commitment that names another signer or differs from `descriptor.salt` is rejected.
|
|
102
|
+
*/
|
|
103
|
+
export declare function readOpeningCommitment(receipt: ChannelEventReceipt, parameters: {
|
|
104
|
+
/** Channel ID the opening commitment must belong to. */
|
|
105
|
+
channelId: Hex;
|
|
106
|
+
/** Descriptor of the opened channel. */
|
|
107
|
+
descriptor: ChannelDescriptor;
|
|
108
|
+
/** Escrow that must have emitted the event. */
|
|
109
|
+
escrow: Address;
|
|
110
|
+
}): Hex | undefined;
|
|
91
111
|
/** Reads and validates typed fields from a TopUp receipt event. */
|
|
92
112
|
export declare function readTopUpReceiptFields(event: ReceiptEventWithArgs): TopUpReceiptFields;
|
|
93
113
|
/** Reads and validates typed fields from a Settled receipt event. */
|
|
@@ -141,6 +161,15 @@ export type Channel = {
|
|
|
141
161
|
* Read channel descriptor and state from the TIP20EscrowChannel precompile.
|
|
142
162
|
*/
|
|
143
163
|
export declare function getChannel(client: Client, descriptor: ChannelDescriptor, escrow?: Address, blockNumber?: bigint): Promise<Channel>;
|
|
164
|
+
/**
|
|
165
|
+
* Asks the escrow whether `settle` and `close` would accept `signature` for the channel at
|
|
166
|
+
* `cumulativeAmount`, under the voucher rules for the channel's opening commitment (TIP-1166).
|
|
167
|
+
*/
|
|
168
|
+
export declare function verifyVoucher(client: Client, parameters: {
|
|
169
|
+
descriptor: ChannelDescriptor;
|
|
170
|
+
cumulativeAmount: bigint;
|
|
171
|
+
signature: Hex;
|
|
172
|
+
}, escrow?: Address): Promise<boolean>;
|
|
144
173
|
/**
|
|
145
174
|
* Read channel state from the TIP20EscrowChannel precompile.
|
|
146
175
|
*/
|
|
@@ -282,13 +311,18 @@ export type BroadcastOpenTransactionResult = {
|
|
|
282
311
|
expiringNonceHash: Hex;
|
|
283
312
|
/** Deposit amount encoded in the open calldata. */
|
|
284
313
|
openDeposit: bigint;
|
|
314
|
+
/**
|
|
315
|
+
* TIP-1166 signer config commitment the escrow recorded at open, present only when the receipt
|
|
316
|
+
* has an `OpeningCommitmentRecorded` event for the channel.
|
|
317
|
+
*/
|
|
318
|
+
openingCommitment?: Hex | undefined;
|
|
285
319
|
};
|
|
286
320
|
/** Inputs for broadcasting and verifying a client-signed TIP-1034 open transaction. */
|
|
287
321
|
export type BroadcastOpenTransactionParameters = {
|
|
288
322
|
/** Fee tokens allowed when the server completes a sponsored transaction. Defaults to the channel currency. */
|
|
289
323
|
allowedFeeTokens?: readonly Address[] | undefined;
|
|
290
324
|
/** Hook invoked after calldata validation but before broadcasting. */
|
|
291
|
-
beforeBroadcast?: ((result: Omit<BroadcastOpenTransactionResult, 'txHash' | 'state'>) => Promise<void> | void) | undefined;
|
|
325
|
+
beforeBroadcast?: ((result: Omit<BroadcastOpenTransactionResult, 'txHash' | 'state' | 'openingCommitment'>) => Promise<void> | void) | undefined;
|
|
292
326
|
/** Challenge expiration propagated into fee-payer policy checks. */
|
|
293
327
|
challengeExpires?: string | undefined;
|
|
294
328
|
/** Chain ID used for channel ID and voucher domain separation. */
|
|
@@ -29,6 +29,39 @@ export function readChannelOpenedReceiptFields(event) {
|
|
|
29
29
|
expiringNonceHash: readBytes32(event.args.expiringNonceHash, 'ChannelOpened expiringNonceHash'),
|
|
30
30
|
};
|
|
31
31
|
}
|
|
32
|
+
/**
|
|
33
|
+
* Reads the TIP-1166 `OpeningCommitmentRecorded` event the escrow emits for a channel at open.
|
|
34
|
+
*
|
|
35
|
+
* Returns `undefined` when the receipt has none, which means the signer had no config commitment
|
|
36
|
+
* when the channel opened. The escrow requires the channel salt to equal the recorded commitment, so
|
|
37
|
+
* an opening commitment that names another signer or differs from `descriptor.salt` is rejected.
|
|
38
|
+
*/
|
|
39
|
+
export function readOpeningCommitment(receipt, parameters) {
|
|
40
|
+
const { channelId, descriptor, escrow } = parameters;
|
|
41
|
+
const logs = parseEventLogs({
|
|
42
|
+
abi: escrowAbi,
|
|
43
|
+
eventName: 'OpeningCommitmentRecorded',
|
|
44
|
+
logs: receipt.logs,
|
|
45
|
+
}).filter((log) => isAddressEqual(log.address, escrow) &&
|
|
46
|
+
log.args.channelId.toLowerCase() === channelId.toLowerCase());
|
|
47
|
+
if (logs.length === 0)
|
|
48
|
+
return undefined;
|
|
49
|
+
if (logs.length > 1)
|
|
50
|
+
throw new VerificationFailedError({
|
|
51
|
+
reason: 'expected at most one OpeningCommitmentRecorded event for credential channelId in receipt',
|
|
52
|
+
});
|
|
53
|
+
const { commitment, signer } = logs[0].args;
|
|
54
|
+
const recorded = readBytes32(commitment, 'OpeningCommitmentRecorded commitment');
|
|
55
|
+
if (!isAddressEqual(signer, ChannelUtils.resolveAuthorizedSigner(descriptor)))
|
|
56
|
+
throw new VerificationFailedError({
|
|
57
|
+
reason: 'OpeningCommitmentRecorded signer does not match descriptor',
|
|
58
|
+
});
|
|
59
|
+
if (recorded.toLowerCase() !== descriptor.salt.toLowerCase())
|
|
60
|
+
throw new VerificationFailedError({
|
|
61
|
+
reason: 'OpeningCommitmentRecorded commitment does not match descriptor salt',
|
|
62
|
+
});
|
|
63
|
+
return recorded;
|
|
64
|
+
}
|
|
32
65
|
/** Reads and validates typed fields from a TopUp receipt event. */
|
|
33
66
|
export function readTopUpReceiptFields(event) {
|
|
34
67
|
return {
|
|
@@ -127,6 +160,19 @@ export async function getChannel(client, descriptor, escrow = tip20ChannelEscrow
|
|
|
127
160
|
state: stateFromTuple(channel.state),
|
|
128
161
|
};
|
|
129
162
|
}
|
|
163
|
+
/**
|
|
164
|
+
* Asks the escrow whether `settle` and `close` would accept `signature` for the channel at
|
|
165
|
+
* `cumulativeAmount`, under the voucher rules for the channel's opening commitment (TIP-1166).
|
|
166
|
+
*/
|
|
167
|
+
export async function verifyVoucher(client, parameters, escrow = tip20ChannelEscrow) {
|
|
168
|
+
const { cumulativeAmount, descriptor, signature } = parameters;
|
|
169
|
+
return readContract(client, {
|
|
170
|
+
address: escrow,
|
|
171
|
+
abi: escrowAbi,
|
|
172
|
+
functionName: 'verifyVoucher',
|
|
173
|
+
args: [descriptorTuple(descriptor), cumulativeAmount, signature],
|
|
174
|
+
});
|
|
175
|
+
}
|
|
130
176
|
/**
|
|
131
177
|
* Read channel state from the TIP20EscrowChannel precompile.
|
|
132
178
|
*/
|
|
@@ -571,6 +617,11 @@ export async function broadcastOpenTransaction(parameters) {
|
|
|
571
617
|
expectedChannelId: parameters.expectedChannelId,
|
|
572
618
|
openDeposit,
|
|
573
619
|
});
|
|
620
|
+
const openingCommitment = readOpeningCommitment(receipt, {
|
|
621
|
+
channelId: parameters.expectedChannelId,
|
|
622
|
+
descriptor,
|
|
623
|
+
escrow: parameters.escrowContract,
|
|
624
|
+
});
|
|
574
625
|
const chainChannel = await readbackWithRetry(() => getChannel(parameters.client, descriptor, parameters.escrowContract, receipt.blockNumber));
|
|
575
626
|
const state = chainChannel.state;
|
|
576
627
|
validateOpenReadbackState({ emittedDeposit: opened.deposit, state });
|
|
@@ -580,6 +631,7 @@ export async function broadcastOpenTransaction(parameters) {
|
|
|
580
631
|
state,
|
|
581
632
|
expiringNonceHash: opened.expiringNonceHash,
|
|
582
633
|
openDeposit,
|
|
634
|
+
...(openingCommitment ? { openingCommitment } : {}),
|
|
583
635
|
};
|
|
584
636
|
}
|
|
585
637
|
/** Validates the immutable fields of a client-signed TIP-1034 top-up transaction. */
|
|
@@ -32,6 +32,27 @@ export declare const closeAuthorizationTypes: {
|
|
|
32
32
|
readonly type: 'uint96';
|
|
33
33
|
}];
|
|
34
34
|
};
|
|
35
|
+
/**
|
|
36
|
+
* Options for verifying TIP-1166 configurable account voucher signers.
|
|
37
|
+
*
|
|
38
|
+
* With the defaults, verification accepts only TIP-1020 primitive signatures, as before TIP-1166.
|
|
39
|
+
*/
|
|
40
|
+
export type VerifyVoucherOptions = {
|
|
41
|
+
/**
|
|
42
|
+
* Accepts TIP-1166 configurable account (`0x05`) signatures from a configurable account
|
|
43
|
+
* signer. Enable only once the chain runs T15.
|
|
44
|
+
* @default false
|
|
45
|
+
*/
|
|
46
|
+
configurable?: boolean | undefined;
|
|
47
|
+
/**
|
|
48
|
+
* Config commitment the escrow recorded for the channel signer at open
|
|
49
|
+
* (`OpeningCommitmentRecorded`). A missing or zero opening commitment means the signer had no config
|
|
50
|
+
* commitment when the channel opened.
|
|
51
|
+
*/
|
|
52
|
+
openingCommitment?: Hex | undefined;
|
|
53
|
+
};
|
|
54
|
+
/** Returns whether an account signs with a TIP-1166 configurable account (`0x05`) signature. */
|
|
55
|
+
export declare function isConfigurableAccount(account: Account): boolean;
|
|
35
56
|
/**
|
|
36
57
|
* Sign a voucher with an account.
|
|
37
58
|
*/
|
|
@@ -40,15 +61,35 @@ export declare function signVoucher(client: Client, account: Account, voucher: V
|
|
|
40
61
|
* Signs a distinct EIP-712 authorization for cooperatively closing a channel.
|
|
41
62
|
*/
|
|
42
63
|
export declare function signCloseAuthorization(client: Client, account: Account, authorization: Voucher, verifyingContract: Address, chainId: number): Promise<Hex>;
|
|
43
|
-
/**
|
|
44
|
-
export
|
|
64
|
+
/** Options for {@link verifyCloseAuthorization}. */
|
|
65
|
+
export type VerifyCloseAuthorizationOptions = VerifyVoucherOptions & {
|
|
66
|
+
/**
|
|
67
|
+
* The channel's voucher signer. The configurable account rules apply only to the candidate equal
|
|
68
|
+
* to it; other candidates, such as a distinct payer, must sign a primitive signature, since no
|
|
69
|
+
* opening commitment binds their config. Without it, the options apply to every candidate.
|
|
70
|
+
*/
|
|
71
|
+
voucherSigner?: Address | undefined;
|
|
72
|
+
};
|
|
73
|
+
/**
|
|
74
|
+
* Verifies that a cooperative-close signature belongs to a channel authority.
|
|
75
|
+
*
|
|
76
|
+
* `options` applies the TIP-1166 configurable account rules of {@link verifyVoucher}; the
|
|
77
|
+
* defaults accept only TIP-1020 primitive signatures.
|
|
78
|
+
*/
|
|
79
|
+
export declare function verifyCloseAuthorization(escrowContract: Address, chainId: number, authorization: SignedVoucher, expectedSigners: readonly Address[], options?: VerifyCloseAuthorizationOptions): boolean;
|
|
45
80
|
/**
|
|
46
81
|
* Verify a voucher signature matches the expected signer.
|
|
47
82
|
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
83
|
+
* By default, accepts canonical TIP-1020 primitive signatures only. Keychain wrappers,
|
|
84
|
+
* configurable account signatures, and magic-suffixed encodings are rejected.
|
|
85
|
+
*
|
|
86
|
+
* With `options.configurable`, also applies TIP-1166: a configurable account (`0x05`)
|
|
87
|
+
* signature is accepted when it names `expectedSigner`, its owner approvals reach the
|
|
88
|
+
* threshold, and its config commitment equals `options.openingCommitment` or, when the channel
|
|
89
|
+
* has no opening commitment, its config is the version-zero config that derives `expectedSigner`. A
|
|
90
|
+
* nonzero `openingCommitment` rejects primitive signatures.
|
|
50
91
|
*/
|
|
51
|
-
export declare function verifyVoucher(escrowContract: Address, chainId: number, voucher: SignedVoucher, expectedSigner: Address): boolean;
|
|
92
|
+
export declare function verifyVoucher(escrowContract: Address, chainId: number, voucher: SignedVoucher, expectedSigner: Address, options?: VerifyVoucherOptions): boolean;
|
|
52
93
|
/**
|
|
53
94
|
* Parse a voucher from credential payload.
|
|
54
95
|
*/
|