@dvmkit/dvm-cli 0.1.4 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{_esm-M2HUAA3B.js → _esm-MN4BUYV6.js} +56 -54
- package/dist/{accounts-S747UW3A.js → accounts-2WZE4N5F.js} +5 -5
- package/dist/actions-LR65XILR.js +244 -0
- package/dist/{ccip-XZ5F5J6R.js → ccip-JXYJSXTW.js} +3 -3
- package/dist/{chains-PINFXYUE.js → chains-LJ7XK6H3.js} +8 -8
- package/dist/{chunk-YZUBKHHA.js → chunk-2VVVWBQA.js} +471 -471
- package/dist/chunk-3SWX5BQP.js +66 -0
- package/dist/chunk-3W2M46WM.js +61142 -0
- package/dist/chunk-4JXFXP4Y.js +757 -0
- package/dist/{chunk-GIDSTROG.js → chunk-4NWEJTAW.js} +160 -158
- package/dist/{chunk-UXQCP26E.js → chunk-65EY7CT4.js} +2 -2
- package/dist/{chunk-6UGZAFIR.js → chunk-6CC6JGEU.js} +348 -18
- package/dist/{chunk-PHZHPRQE.js → chunk-6O27TEXD.js} +173 -173
- package/dist/{chunk-HPRIQEJS.js → chunk-7OK7MBT6.js} +19 -19
- package/dist/{chunk-7UPZZGC5.js → chunk-BECPI5H5.js} +193 -193
- package/dist/chunk-CJTE5TS3.js +1298 -0
- package/dist/{chunk-RWBYCM47.js → chunk-ECEM3ZAS.js} +10 -10
- package/dist/{chunk-ACNNU5RY.js → chunk-ECK465AY.js} +694 -565
- package/dist/{chunk-XGABM4H5.js → chunk-EGY4KDBW.js} +3822 -2012
- package/dist/{chunk-SLDVIXCS.js → chunk-EVQERRCP.js} +12 -12
- package/dist/{chunk-4AQ4G7L5.js → chunk-EZHT2RLJ.js} +383 -383
- package/dist/{chunk-IC6OXFYW.js → chunk-F55NNH2F.js} +63 -63
- package/dist/chunk-G5C6E6PJ.js +9063 -0
- package/dist/{chunk-6AJ7H2VX.js → chunk-GZWKCIYN.js} +213 -1281
- package/dist/{chunk-ZGXCK43G.js → chunk-LH3QPVN6.js} +8499 -8498
- package/dist/{chunk-MMJR6N3J.js → chunk-MLDUKBU3.js} +1368 -1368
- package/dist/chunk-N3UJT2NJ.js +3 -0
- package/dist/{chunk-BZNZWRBB.js → chunk-OWJZYYMG.js} +11 -15
- package/dist/chunk-ZJYO7OLO.js +514 -0
- package/dist/{client-D3XFLWOK.js → client-OWIOFBKS.js} +18 -16
- package/dist/{dist-7MMV3EZA.js → dist-2G3QBGID.js} +11 -10
- package/dist/dvm.js +26781 -4423
- package/dist/esm-RQLHAH2K.js +5183 -0
- package/dist/internal-QFQ7MJ5V.js +1228 -0
- package/dist/payout-reporter-3UB5WRCV-XTVZFIAO.js +17 -0
- package/dist/{pocket-refill-GDYSTECR.js → pocket-refill-PQ5ZVSBY.js} +26 -30
- package/dist/revenue-reporter-JIKUPXOK-TYUBTF4P.js +11 -0
- package/dist/{secp256k1-4YWQEMGF.js → secp256k1-JLZEQ2H7.js} +2 -2
- package/dist/tempo-lifecycle-SQL3KLEZ-AATA2SKI.js +28 -0
- package/dist/{tempo-wallet-5FEOI4CF.js → tempo-wallet-QOLEIPCV-SWCXRBDS.js} +2 -4
- package/dist/{x402-VNFA3DBY.js → x402-FTG2GRAQ-UGAUMUL6.js} +13 -24
- package/package.json +2 -10
- package/dist/channel-store-GOV7TEDN.js +0 -62
- package/dist/chunk-3PPOU55E.js +0 -312
- package/dist/chunk-3TBULV3F.js +0 -551
- package/dist/chunk-5BUV73FO.js +0 -2351
- package/dist/chunk-EY5K4BM3.js +0 -1780
- package/dist/chunk-G3RLVJF5.js +0 -19
- package/dist/chunk-KC4UPK44.js +0 -113
- package/dist/chunk-MTBCEXJ6.js +0 -4602
- package/dist/chunk-ONQMRWY3.js +0 -83
- package/dist/chunk-TO47XRK7.js +0 -24890
- package/dist/chunk-U5TNSUYW.js +0 -1757
- package/dist/chunk-UU6QMSTQ.js +0 -171
- package/dist/chunk-ZELLQI7F.js +0 -248
- package/dist/lifecycle-5RLM5JMN.js +0 -29
- package/dist/tempo-lifecycle-DHZPQTSB.js +0 -31
- package/dist/wallet-G3VOUCL4.js +0 -30
|
@@ -3,19 +3,19 @@ import { createRequire as __dvmCreateRequire } from "node:module";
|
|
|
3
3
|
const require = __dvmCreateRequire(import.meta.url);
|
|
4
4
|
import {
|
|
5
5
|
Base64_exports
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-EZHT2RLJ.js";
|
|
7
7
|
import {
|
|
8
8
|
Hash_exports,
|
|
9
9
|
parseUnits
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-LH3QPVN6.js";
|
|
11
11
|
import {
|
|
12
12
|
Bytes_exports,
|
|
13
13
|
Hex_exports,
|
|
14
14
|
Json_exports
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-F55NNH2F.js";
|
|
16
16
|
import {
|
|
17
17
|
getAddress
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-MLDUKBU3.js";
|
|
19
19
|
import {
|
|
20
20
|
__export
|
|
21
21
|
} from "./chunk-IYHTITNZ.js";
|
|
@@ -68,281 +68,6 @@ function getMethodDetail(methodDetails, key) {
|
|
|
68
68
|
return methodDetails[key];
|
|
69
69
|
}
|
|
70
70
|
|
|
71
|
-
// node_modules/mppx/dist/Errors.js
|
|
72
|
-
var Errors_exports = {};
|
|
73
|
-
__export(Errors_exports, {
|
|
74
|
-
AmountExceedsDepositError: () => AmountExceedsDepositError,
|
|
75
|
-
BadRequestError: () => BadRequestError,
|
|
76
|
-
ChannelClosedError: () => ChannelClosedError,
|
|
77
|
-
ChannelNotFoundError: () => ChannelNotFoundError,
|
|
78
|
-
DeltaTooSmallError: () => DeltaTooSmallError,
|
|
79
|
-
Hints: () => Hints,
|
|
80
|
-
InsufficientBalanceError: () => InsufficientBalanceError,
|
|
81
|
-
InvalidChallengeError: () => InvalidChallengeError,
|
|
82
|
-
InvalidPayloadError: () => InvalidPayloadError,
|
|
83
|
-
InvalidSignatureError: () => InvalidSignatureError,
|
|
84
|
-
MalformedCredentialError: () => MalformedCredentialError,
|
|
85
|
-
PaymentActionRequiredError: () => PaymentActionRequiredError,
|
|
86
|
-
PaymentError: () => PaymentError,
|
|
87
|
-
PaymentExpiredError: () => PaymentExpiredError,
|
|
88
|
-
PaymentInsufficientError: () => PaymentInsufficientError,
|
|
89
|
-
PaymentMethodUnsupportedError: () => PaymentMethodUnsupportedError,
|
|
90
|
-
PaymentRequiredError: () => PaymentRequiredError,
|
|
91
|
-
SignerMismatchError: () => SignerMismatchError,
|
|
92
|
-
VerificationFailedError: () => VerificationFailedError
|
|
93
|
-
});
|
|
94
|
-
var Hints = {
|
|
95
|
-
paymentRequired: "Use a supported wallet to pay for this resource using one of the supported payment methods returned in the WWW-Authenticate header. See https://mpp.dev/tools/wallet.md",
|
|
96
|
-
malformedCredential: "Use a supported wallet to construct valid credentials for one of the supported payment methods returned in the WWW-Authenticate header. See https://mpp.dev/tools/wallet.md",
|
|
97
|
-
methodUnsupported: "Use a supported wallet to pay for this resource using one of the supported payment methods returned in the WWW-Authenticate header. See https://mpp.dev/tools/wallet.md"
|
|
98
|
-
};
|
|
99
|
-
var PaymentError = class extends Error {
|
|
100
|
-
/** Safe method-specific context for diagnostics and relay responses. */
|
|
101
|
-
details;
|
|
102
|
-
/** HTTP status code. */
|
|
103
|
-
status = 402;
|
|
104
|
-
/** Actionable hint for resolving the error (RFC 9457 extension member). */
|
|
105
|
-
hint;
|
|
106
|
-
constructor(message, options = {}) {
|
|
107
|
-
super(message);
|
|
108
|
-
this.details = options.details;
|
|
109
|
-
}
|
|
110
|
-
/** Converts the error to RFC 9457 Problem Details format. */
|
|
111
|
-
toProblemDetails(challengeId) {
|
|
112
|
-
return {
|
|
113
|
-
type: this.type,
|
|
114
|
-
title: this.title,
|
|
115
|
-
status: this.status,
|
|
116
|
-
detail: this.message,
|
|
117
|
-
...this.details && Object.keys(this.details).length > 0 && { details: this.details },
|
|
118
|
-
...this.hint && { hint: this.hint },
|
|
119
|
-
...challengeId && { challengeId }
|
|
120
|
-
};
|
|
121
|
-
}
|
|
122
|
-
};
|
|
123
|
-
var MalformedCredentialError = class extends PaymentError {
|
|
124
|
-
name = "MalformedCredentialError";
|
|
125
|
-
title = "Malformed Credential";
|
|
126
|
-
status = 402;
|
|
127
|
-
type = "https://paymentauth.org/problems/malformed-credential";
|
|
128
|
-
hint = Hints.malformedCredential;
|
|
129
|
-
constructor(options = {}) {
|
|
130
|
-
const { reason } = options;
|
|
131
|
-
super(reason ? `Credential is malformed: ${reason}.` : "Credential is malformed.");
|
|
132
|
-
}
|
|
133
|
-
};
|
|
134
|
-
var InvalidChallengeError = class extends PaymentError {
|
|
135
|
-
name = "InvalidChallengeError";
|
|
136
|
-
title = "Invalid Challenge";
|
|
137
|
-
status = 402;
|
|
138
|
-
type = "https://paymentauth.org/problems/invalid-challenge";
|
|
139
|
-
constructor(options = {}) {
|
|
140
|
-
const { id, reason } = options;
|
|
141
|
-
const idPart = id ? ` "${id}"` : "";
|
|
142
|
-
const reasonPart = reason ? `: ${reason}` : "";
|
|
143
|
-
super(`Challenge${idPart} is invalid${reasonPart}.`);
|
|
144
|
-
}
|
|
145
|
-
};
|
|
146
|
-
var VerificationFailedError = class extends PaymentError {
|
|
147
|
-
name = "VerificationFailedError";
|
|
148
|
-
title = "Verification Failed";
|
|
149
|
-
type = "https://paymentauth.org/problems/verification-failed";
|
|
150
|
-
constructor(options = {}) {
|
|
151
|
-
const { details, reason } = options;
|
|
152
|
-
super(reason ? `Payment verification failed: ${reason}.` : "Payment verification failed.", {
|
|
153
|
-
details
|
|
154
|
-
});
|
|
155
|
-
}
|
|
156
|
-
};
|
|
157
|
-
var PaymentActionRequiredError = class extends PaymentError {
|
|
158
|
-
name = "PaymentActionRequiredError";
|
|
159
|
-
title = "Payment Action Required";
|
|
160
|
-
type = "https://paymentauth.org/problems/payment-action-required";
|
|
161
|
-
constructor(options = {}) {
|
|
162
|
-
const { reason } = options;
|
|
163
|
-
super(reason ? `Payment requires action: ${reason}.` : "Payment requires action.");
|
|
164
|
-
}
|
|
165
|
-
};
|
|
166
|
-
var PaymentExpiredError = class extends PaymentError {
|
|
167
|
-
name = "PaymentExpiredError";
|
|
168
|
-
title = "Payment Expired";
|
|
169
|
-
type = "https://paymentauth.org/problems/payment-expired";
|
|
170
|
-
constructor(options = {}) {
|
|
171
|
-
const { expires } = options;
|
|
172
|
-
super(expires ? `Payment expired at ${expires}.` : "Payment has expired.");
|
|
173
|
-
}
|
|
174
|
-
};
|
|
175
|
-
var PaymentRequiredError = class extends PaymentError {
|
|
176
|
-
name = "PaymentRequiredError";
|
|
177
|
-
title = "Payment Required";
|
|
178
|
-
type = "https://paymentauth.org/problems/payment-required";
|
|
179
|
-
hint = Hints.paymentRequired;
|
|
180
|
-
constructor(options = {}) {
|
|
181
|
-
const { description } = options;
|
|
182
|
-
const parts = ["Payment is required"];
|
|
183
|
-
if (description)
|
|
184
|
-
parts.push(`(${description})`);
|
|
185
|
-
super(`${parts.join(" ")}.`);
|
|
186
|
-
}
|
|
187
|
-
};
|
|
188
|
-
var InvalidPayloadError = class extends PaymentError {
|
|
189
|
-
name = "InvalidPayloadError";
|
|
190
|
-
title = "Invalid Payload";
|
|
191
|
-
type = "https://paymentauth.org/problems/invalid-payload";
|
|
192
|
-
constructor(options = {}) {
|
|
193
|
-
const { reason } = options;
|
|
194
|
-
super(reason ? `Credential payload is invalid: ${reason}.` : "Credential payload is invalid.");
|
|
195
|
-
}
|
|
196
|
-
};
|
|
197
|
-
var BadRequestError = class extends PaymentError {
|
|
198
|
-
name = "BadRequestError";
|
|
199
|
-
title = "Bad Request";
|
|
200
|
-
status = 400;
|
|
201
|
-
type = "https://paymentauth.org/problems/bad-request";
|
|
202
|
-
constructor(options = {}) {
|
|
203
|
-
const { reason } = options;
|
|
204
|
-
super(reason ? `Bad request: ${reason}.` : "Bad request.");
|
|
205
|
-
}
|
|
206
|
-
};
|
|
207
|
-
var PaymentInsufficientError = class extends PaymentError {
|
|
208
|
-
name = "PaymentInsufficientError";
|
|
209
|
-
title = "Payment Insufficient";
|
|
210
|
-
type = "https://paymentauth.org/problems/payment-insufficient";
|
|
211
|
-
constructor(options = {}) {
|
|
212
|
-
const { reason } = options;
|
|
213
|
-
super(reason ? `Payment insufficient: ${reason}.` : "Payment amount is insufficient.");
|
|
214
|
-
}
|
|
215
|
-
};
|
|
216
|
-
var PaymentMethodUnsupportedError = class extends PaymentError {
|
|
217
|
-
name = "PaymentMethodUnsupportedError";
|
|
218
|
-
title = "Method Unsupported";
|
|
219
|
-
status = 400;
|
|
220
|
-
type = "https://paymentauth.org/problems/method-unsupported";
|
|
221
|
-
hint = Hints.methodUnsupported;
|
|
222
|
-
constructor(options = {}) {
|
|
223
|
-
const { method } = options;
|
|
224
|
-
super(method ? `Payment method "${method}" is not supported.` : "Payment method is not supported.");
|
|
225
|
-
}
|
|
226
|
-
};
|
|
227
|
-
var InsufficientBalanceError = class extends PaymentError {
|
|
228
|
-
name = "InsufficientBalanceError";
|
|
229
|
-
title = "Insufficient Balance";
|
|
230
|
-
status = 402;
|
|
231
|
-
type = "https://paymentauth.org/problems/session/insufficient-balance";
|
|
232
|
-
constructor(options = {}) {
|
|
233
|
-
const { reason } = options;
|
|
234
|
-
super(reason ? `Insufficient balance: ${reason}.` : "Insufficient balance.");
|
|
235
|
-
}
|
|
236
|
-
};
|
|
237
|
-
var InvalidSignatureError = class extends PaymentError {
|
|
238
|
-
name = "InvalidSignatureError";
|
|
239
|
-
title = "Invalid Signature";
|
|
240
|
-
status = 402;
|
|
241
|
-
type = "https://paymentauth.org/problems/session/invalid-signature";
|
|
242
|
-
constructor(options = {}) {
|
|
243
|
-
const { reason } = options;
|
|
244
|
-
super(reason ? `Invalid signature: ${reason}.` : "Invalid signature.");
|
|
245
|
-
}
|
|
246
|
-
};
|
|
247
|
-
var SignerMismatchError = class extends PaymentError {
|
|
248
|
-
name = "SignerMismatchError";
|
|
249
|
-
title = "Signer Mismatch";
|
|
250
|
-
status = 402;
|
|
251
|
-
type = "https://paymentauth.org/problems/session/signer-mismatch";
|
|
252
|
-
constructor(options = {}) {
|
|
253
|
-
const { reason } = options;
|
|
254
|
-
super(reason ? `Signer mismatch: ${reason}.` : "Signer is not authorized for this channel.");
|
|
255
|
-
}
|
|
256
|
-
};
|
|
257
|
-
var AmountExceedsDepositError = class extends PaymentError {
|
|
258
|
-
name = "AmountExceedsDepositError";
|
|
259
|
-
title = "Amount Exceeds Deposit";
|
|
260
|
-
status = 402;
|
|
261
|
-
type = "https://paymentauth.org/problems/session/amount-exceeds-deposit";
|
|
262
|
-
constructor(options = {}) {
|
|
263
|
-
const { reason } = options;
|
|
264
|
-
super(reason ? `Amount exceeds deposit: ${reason}.` : "Voucher amount exceeds channel deposit.");
|
|
265
|
-
}
|
|
266
|
-
};
|
|
267
|
-
var DeltaTooSmallError = class extends PaymentError {
|
|
268
|
-
name = "DeltaTooSmallError";
|
|
269
|
-
title = "Delta Too Small";
|
|
270
|
-
status = 402;
|
|
271
|
-
type = "https://paymentauth.org/problems/session/delta-too-small";
|
|
272
|
-
constructor(options = {}) {
|
|
273
|
-
const { reason } = options;
|
|
274
|
-
super(reason ? `Delta too small: ${reason}.` : "Amount increase below minimum voucher delta.");
|
|
275
|
-
}
|
|
276
|
-
};
|
|
277
|
-
var ChannelNotFoundError = class extends PaymentError {
|
|
278
|
-
name = "ChannelNotFoundError";
|
|
279
|
-
title = "Channel Not Found";
|
|
280
|
-
status = 410;
|
|
281
|
-
type = "https://paymentauth.org/problems/session/channel-not-found";
|
|
282
|
-
constructor(options = {}) {
|
|
283
|
-
const { reason } = options;
|
|
284
|
-
super(reason ? `Channel not found: ${reason}.` : "No channel with this ID exists.");
|
|
285
|
-
}
|
|
286
|
-
};
|
|
287
|
-
var ChannelClosedError = class extends PaymentError {
|
|
288
|
-
name = "ChannelClosedError";
|
|
289
|
-
title = "Channel Closed";
|
|
290
|
-
status = 410;
|
|
291
|
-
type = "https://paymentauth.org/problems/session/channel-finalized";
|
|
292
|
-
constructor(options = {}) {
|
|
293
|
-
const { reason } = options;
|
|
294
|
-
super(reason ? `Channel closed: ${reason}.` : "Channel is closed.");
|
|
295
|
-
}
|
|
296
|
-
};
|
|
297
|
-
|
|
298
|
-
// node_modules/mppx/dist/Expires.js
|
|
299
|
-
var Expires_exports = {};
|
|
300
|
-
__export(Expires_exports, {
|
|
301
|
-
assert: () => assert,
|
|
302
|
-
days: () => days,
|
|
303
|
-
hours: () => hours,
|
|
304
|
-
minutes: () => minutes,
|
|
305
|
-
months: () => months,
|
|
306
|
-
seconds: () => seconds,
|
|
307
|
-
weeks: () => weeks,
|
|
308
|
-
years: () => years
|
|
309
|
-
});
|
|
310
|
-
function assert(expires, challengeId) {
|
|
311
|
-
if (!expires)
|
|
312
|
-
throw new InvalidChallengeError({
|
|
313
|
-
...challengeId && { id: challengeId },
|
|
314
|
-
reason: "missing required expires field"
|
|
315
|
-
});
|
|
316
|
-
if (Number.isNaN(new Date(expires).getTime()))
|
|
317
|
-
throw new InvalidChallengeError({
|
|
318
|
-
...challengeId && { id: challengeId },
|
|
319
|
-
reason: "malformed expires timestamp"
|
|
320
|
-
});
|
|
321
|
-
if (new Date(expires) < /* @__PURE__ */ new Date())
|
|
322
|
-
throw new PaymentExpiredError({ expires });
|
|
323
|
-
}
|
|
324
|
-
function days(n) {
|
|
325
|
-
return new Date(Date.now() + n * 24 * 60 * 60 * 1e3).toISOString();
|
|
326
|
-
}
|
|
327
|
-
function hours(n) {
|
|
328
|
-
return new Date(Date.now() + n * 60 * 60 * 1e3).toISOString();
|
|
329
|
-
}
|
|
330
|
-
function minutes(n) {
|
|
331
|
-
return new Date(Date.now() + n * 60 * 1e3).toISOString();
|
|
332
|
-
}
|
|
333
|
-
function months(n) {
|
|
334
|
-
return new Date(Date.now() + n * 30 * 24 * 60 * 60 * 1e3).toISOString();
|
|
335
|
-
}
|
|
336
|
-
function seconds(n) {
|
|
337
|
-
return new Date(Date.now() + n * 1e3).toISOString();
|
|
338
|
-
}
|
|
339
|
-
function weeks(n) {
|
|
340
|
-
return new Date(Date.now() + n * 7 * 24 * 60 * 60 * 1e3).toISOString();
|
|
341
|
-
}
|
|
342
|
-
function years(n) {
|
|
343
|
-
return new Date(Date.now() + n * 365 * 24 * 60 * 60 * 1e3).toISOString();
|
|
344
|
-
}
|
|
345
|
-
|
|
346
71
|
// node_modules/mppx/dist/PaymentRequest.js
|
|
347
72
|
var PaymentRequest_exports = {};
|
|
348
73
|
__export(PaymentRequest_exports, {
|
|
@@ -1224,7 +949,7 @@ __export(util_exports, {
|
|
|
1224
949
|
NUMBER_FORMAT_RANGES: () => NUMBER_FORMAT_RANGES,
|
|
1225
950
|
aborted: () => aborted,
|
|
1226
951
|
allowsEval: () => allowsEval,
|
|
1227
|
-
assert: () =>
|
|
952
|
+
assert: () => assert,
|
|
1228
953
|
assertEqual: () => assertEqual,
|
|
1229
954
|
assertIs: () => assertIs,
|
|
1230
955
|
assertNever: () => assertNever,
|
|
@@ -1294,7 +1019,7 @@ function assertIs(_arg) {
|
|
|
1294
1019
|
function assertNever(_x) {
|
|
1295
1020
|
throw new Error("Unexpected value in exhaustive check");
|
|
1296
1021
|
}
|
|
1297
|
-
function
|
|
1022
|
+
function assert(_) {
|
|
1298
1023
|
}
|
|
1299
1024
|
function getEnumValues(entries) {
|
|
1300
1025
|
const numericValues = Object.values(entries).filter((v) => typeof v === "number");
|
|
@@ -14242,197 +13967,457 @@ function readQuotedAuthParamValue(input, start) {
|
|
|
14242
13967
|
}
|
|
14243
13968
|
throw new Error("Unterminated quoted-string.");
|
|
14244
13969
|
}
|
|
14245
|
-
function startsWithSchemeToken(value, index, token) {
|
|
14246
|
-
if (!value.slice(index).toLowerCase().startsWith(token.toLowerCase()))
|
|
13970
|
+
function startsWithSchemeToken(value, index, token) {
|
|
13971
|
+
if (!value.slice(index).toLowerCase().startsWith(token.toLowerCase()))
|
|
13972
|
+
return false;
|
|
13973
|
+
const next = value[index + token.length];
|
|
13974
|
+
return Boolean(next && /\s/.test(next));
|
|
13975
|
+
}
|
|
13976
|
+
function fromHeaders(headers, options) {
|
|
13977
|
+
const header = headers.get(Headers.wwwAuthenticate);
|
|
13978
|
+
if (!header)
|
|
13979
|
+
throw new Error(`Missing ${Headers.wwwAuthenticate} header.`);
|
|
13980
|
+
return deserialize2(header, options);
|
|
13981
|
+
}
|
|
13982
|
+
function fromResponse(response, options) {
|
|
13983
|
+
if (response.status !== 402)
|
|
13984
|
+
throw new Error("Response status is not 402.");
|
|
13985
|
+
return fromHeaders(response.headers, options);
|
|
13986
|
+
}
|
|
13987
|
+
function fromResponseList(response, options) {
|
|
13988
|
+
if (response.status !== 402)
|
|
13989
|
+
throw new Error("Response status is not 402.");
|
|
13990
|
+
return fromHeadersList(response.headers, options);
|
|
13991
|
+
}
|
|
13992
|
+
function fromHeadersList(headers, options) {
|
|
13993
|
+
const header = headers.get(Headers.wwwAuthenticate);
|
|
13994
|
+
if (!header)
|
|
13995
|
+
throw new Error(`Missing ${Headers.wwwAuthenticate} header.`);
|
|
13996
|
+
return deserializeList(header, options);
|
|
13997
|
+
}
|
|
13998
|
+
function deserializeList(value, options) {
|
|
13999
|
+
const starts = [];
|
|
14000
|
+
const schemePattern = new RegExp(`${Schemes.payment}\\s+`, "gi");
|
|
14001
|
+
for (const match of value.matchAll(schemePattern)) {
|
|
14002
|
+
starts.push(match.index);
|
|
14003
|
+
}
|
|
14004
|
+
if (starts.length === 0)
|
|
14005
|
+
throw new Error("No Payment schemes found.");
|
|
14006
|
+
return starts.map((start, i) => {
|
|
14007
|
+
const end = i + 1 < starts.length ? starts[i + 1] : value.length;
|
|
14008
|
+
const chunk = value.slice(start, end).replace(/,\s*$/, "");
|
|
14009
|
+
return deserialize2(chunk, options);
|
|
14010
|
+
});
|
|
14011
|
+
}
|
|
14012
|
+
function verify(challenge, options) {
|
|
14013
|
+
const expectedId = computeId(challenge, options);
|
|
14014
|
+
return constantTimeEqual(challenge.id, expectedId);
|
|
14015
|
+
}
|
|
14016
|
+
function meta3(challenge) {
|
|
14017
|
+
return challenge.meta;
|
|
14018
|
+
}
|
|
14019
|
+
function idBindingInput(challenge) {
|
|
14020
|
+
return [
|
|
14021
|
+
challenge.realm,
|
|
14022
|
+
challenge.method,
|
|
14023
|
+
challenge.intent,
|
|
14024
|
+
serialize(challenge.request),
|
|
14025
|
+
challenge.expires ?? "",
|
|
14026
|
+
challenge.digest ?? "",
|
|
14027
|
+
challenge.opaque ?? (challenge.meta ? serialize(challenge.meta) : "")
|
|
14028
|
+
].join("|");
|
|
14029
|
+
}
|
|
14030
|
+
function computeId(challenge, options) {
|
|
14031
|
+
const input = idBindingInput(challenge);
|
|
14032
|
+
const key = Bytes_exports.fromString(options.secretKey);
|
|
14033
|
+
const data = Bytes_exports.fromString(input);
|
|
14034
|
+
const mac3 = Hash_exports.hmac256(key, data, { as: "Bytes" });
|
|
14035
|
+
return Base64_exports.fromBytes(mac3, { url: true, pad: false });
|
|
14036
|
+
}
|
|
14037
|
+
|
|
14038
|
+
// node_modules/mppx/dist/Credential.js
|
|
14039
|
+
var Credential_exports = {};
|
|
14040
|
+
__export(Credential_exports, {
|
|
14041
|
+
InvalidCredentialEncodingError: () => InvalidCredentialEncodingError,
|
|
14042
|
+
MissingAuthorizationHeaderError: () => MissingAuthorizationHeaderError,
|
|
14043
|
+
MissingPaymentSchemeError: () => MissingPaymentSchemeError,
|
|
14044
|
+
deserialize: () => deserialize3,
|
|
14045
|
+
extractPaymentScheme: () => extractPaymentScheme,
|
|
14046
|
+
from: () => from3,
|
|
14047
|
+
fromRequest: () => fromRequest,
|
|
14048
|
+
serialize: () => serialize3
|
|
14049
|
+
});
|
|
14050
|
+
var MissingAuthorizationHeaderError = class extends Error {
|
|
14051
|
+
name = "MissingAuthorizationHeaderError";
|
|
14052
|
+
constructor() {
|
|
14053
|
+
super("Missing Authorization header.");
|
|
14054
|
+
}
|
|
14055
|
+
};
|
|
14056
|
+
var MissingPaymentSchemeError = class extends Error {
|
|
14057
|
+
name = "MissingPaymentSchemeError";
|
|
14058
|
+
constructor() {
|
|
14059
|
+
super("Missing Payment scheme.");
|
|
14060
|
+
}
|
|
14061
|
+
};
|
|
14062
|
+
var InvalidCredentialEncodingError = class extends Error {
|
|
14063
|
+
name = "InvalidCredentialEncodingError";
|
|
14064
|
+
constructor() {
|
|
14065
|
+
super("Invalid base64url or JSON.");
|
|
14066
|
+
}
|
|
14067
|
+
};
|
|
14068
|
+
function deserialize3(value) {
|
|
14069
|
+
const prefixMatch = value.match(new RegExp(`^${Schemes.payment}\\s+(.+)$`, "i"));
|
|
14070
|
+
if (!prefixMatch?.[1])
|
|
14071
|
+
throw new MissingPaymentSchemeError();
|
|
14072
|
+
try {
|
|
14073
|
+
const json2 = Base64_exports.toString(prefixMatch[1]);
|
|
14074
|
+
const parsed = JSON.parse(json2);
|
|
14075
|
+
const { opaque: challengeOpaque, request, meta: _meta, ...challengeFields } = parsed.challenge;
|
|
14076
|
+
const { meta: meta4, opaque } = normalizeCredentialOpaque(challengeOpaque);
|
|
14077
|
+
const challenge = Schema.parse({
|
|
14078
|
+
...challengeFields,
|
|
14079
|
+
...meta4 !== void 0 && { meta: meta4 },
|
|
14080
|
+
...opaque !== void 0 && { opaque },
|
|
14081
|
+
request: deserialize(request)
|
|
14082
|
+
});
|
|
14083
|
+
return {
|
|
14084
|
+
challenge,
|
|
14085
|
+
payload: parsed.payload,
|
|
14086
|
+
...parsed.source && { source: parsed.source }
|
|
14087
|
+
};
|
|
14088
|
+
} catch {
|
|
14089
|
+
throw new InvalidCredentialEncodingError();
|
|
14090
|
+
}
|
|
14091
|
+
}
|
|
14092
|
+
function normalizeCredentialOpaque(value) {
|
|
14093
|
+
if (value === void 0)
|
|
14094
|
+
return {};
|
|
14095
|
+
if (typeof value === "string")
|
|
14096
|
+
return { opaque: value };
|
|
14097
|
+
if (!isStringRecord(value))
|
|
14098
|
+
throw new Error("Invalid opaque.");
|
|
14099
|
+
return {
|
|
14100
|
+
meta: value,
|
|
14101
|
+
opaque: serialize(value)
|
|
14102
|
+
};
|
|
14103
|
+
}
|
|
14104
|
+
function isStringRecord(value) {
|
|
14105
|
+
if (typeof value !== "object" || value === null || Array.isArray(value))
|
|
14247
14106
|
return false;
|
|
14248
|
-
|
|
14249
|
-
return Boolean(next && /\s/.test(next));
|
|
14107
|
+
return Object.values(value).every((entry) => typeof entry === "string");
|
|
14250
14108
|
}
|
|
14251
|
-
function
|
|
14252
|
-
const
|
|
14253
|
-
|
|
14254
|
-
|
|
14255
|
-
|
|
14109
|
+
function from3(parameters) {
|
|
14110
|
+
const { challenge, payload, source } = parameters;
|
|
14111
|
+
return {
|
|
14112
|
+
challenge,
|
|
14113
|
+
payload,
|
|
14114
|
+
...source && { source }
|
|
14115
|
+
};
|
|
14256
14116
|
}
|
|
14257
|
-
function
|
|
14258
|
-
|
|
14259
|
-
|
|
14260
|
-
|
|
14117
|
+
function fromRequest(request) {
|
|
14118
|
+
const header = request.headers.get(Headers.authorization);
|
|
14119
|
+
if (!header)
|
|
14120
|
+
throw new MissingAuthorizationHeaderError();
|
|
14121
|
+
const payment = extractPaymentScheme(header);
|
|
14122
|
+
if (!payment)
|
|
14123
|
+
throw new MissingPaymentSchemeError();
|
|
14124
|
+
return deserialize3(payment);
|
|
14261
14125
|
}
|
|
14262
|
-
function
|
|
14263
|
-
|
|
14264
|
-
|
|
14265
|
-
|
|
14126
|
+
function serialize3(credential) {
|
|
14127
|
+
const { meta: meta4, opaque, request, ...challenge } = credential.challenge;
|
|
14128
|
+
const wireOpaque = opaque ?? (meta4 !== void 0 ? serialize(meta4) : void 0);
|
|
14129
|
+
const wire = {
|
|
14130
|
+
challenge: {
|
|
14131
|
+
...challenge,
|
|
14132
|
+
...wireOpaque !== void 0 && { opaque: wireOpaque },
|
|
14133
|
+
request: serialize(request)
|
|
14134
|
+
},
|
|
14135
|
+
payload: credential.payload,
|
|
14136
|
+
...credential.source && { source: credential.source }
|
|
14137
|
+
};
|
|
14138
|
+
const json2 = JSON.stringify(wire);
|
|
14139
|
+
const encoded = Base64_exports.fromString(json2, { pad: false, url: true });
|
|
14140
|
+
return `${Schemes.payment} ${encoded}`;
|
|
14266
14141
|
}
|
|
14267
|
-
function
|
|
14268
|
-
const
|
|
14269
|
-
|
|
14270
|
-
throw new Error(`Missing ${Headers.wwwAuthenticate} header.`);
|
|
14271
|
-
return deserializeList(header, options);
|
|
14142
|
+
function extractPaymentScheme(header) {
|
|
14143
|
+
const schemes2 = header.split(",").map((s) => s.trim());
|
|
14144
|
+
return schemes2.find((s) => new RegExp(`^${Schemes.payment}\\s+`, "i").test(s)) ?? null;
|
|
14272
14145
|
}
|
|
14273
|
-
|
|
14274
|
-
|
|
14275
|
-
|
|
14276
|
-
|
|
14277
|
-
|
|
14146
|
+
|
|
14147
|
+
// node_modules/mppx/dist/Errors.js
|
|
14148
|
+
var Errors_exports2 = {};
|
|
14149
|
+
__export(Errors_exports2, {
|
|
14150
|
+
AmountExceedsDepositError: () => AmountExceedsDepositError,
|
|
14151
|
+
BadRequestError: () => BadRequestError,
|
|
14152
|
+
ChannelClosedError: () => ChannelClosedError,
|
|
14153
|
+
ChannelNotFoundError: () => ChannelNotFoundError,
|
|
14154
|
+
DeltaTooSmallError: () => DeltaTooSmallError,
|
|
14155
|
+
Hints: () => Hints,
|
|
14156
|
+
InsufficientBalanceError: () => InsufficientBalanceError,
|
|
14157
|
+
InvalidChallengeError: () => InvalidChallengeError,
|
|
14158
|
+
InvalidPayloadError: () => InvalidPayloadError,
|
|
14159
|
+
InvalidSignatureError: () => InvalidSignatureError,
|
|
14160
|
+
MalformedCredentialError: () => MalformedCredentialError,
|
|
14161
|
+
PaymentActionRequiredError: () => PaymentActionRequiredError,
|
|
14162
|
+
PaymentError: () => PaymentError,
|
|
14163
|
+
PaymentExpiredError: () => PaymentExpiredError,
|
|
14164
|
+
PaymentInsufficientError: () => PaymentInsufficientError,
|
|
14165
|
+
PaymentMethodUnsupportedError: () => PaymentMethodUnsupportedError,
|
|
14166
|
+
PaymentRequiredError: () => PaymentRequiredError,
|
|
14167
|
+
SignerMismatchError: () => SignerMismatchError,
|
|
14168
|
+
VerificationFailedError: () => VerificationFailedError
|
|
14169
|
+
});
|
|
14170
|
+
var Hints = {
|
|
14171
|
+
paymentRequired: "Use a supported wallet to pay for this resource using one of the supported payment methods returned in the WWW-Authenticate header. See https://mpp.dev/tools/wallet.md",
|
|
14172
|
+
malformedCredential: "Use a supported wallet to construct valid credentials for one of the supported payment methods returned in the WWW-Authenticate header. See https://mpp.dev/tools/wallet.md",
|
|
14173
|
+
methodUnsupported: "Use a supported wallet to pay for this resource using one of the supported payment methods returned in the WWW-Authenticate header. See https://mpp.dev/tools/wallet.md"
|
|
14174
|
+
};
|
|
14175
|
+
var PaymentError = class extends Error {
|
|
14176
|
+
/** Safe method-specific context for diagnostics and relay responses. */
|
|
14177
|
+
details;
|
|
14178
|
+
/** HTTP status code. */
|
|
14179
|
+
status = 402;
|
|
14180
|
+
/** Actionable hint for resolving the error (RFC 9457 extension member). */
|
|
14181
|
+
hint;
|
|
14182
|
+
constructor(message, options = {}) {
|
|
14183
|
+
super(message);
|
|
14184
|
+
this.details = options.details;
|
|
14185
|
+
}
|
|
14186
|
+
/** Converts the error to RFC 9457 Problem Details format. */
|
|
14187
|
+
toProblemDetails(challengeId) {
|
|
14188
|
+
return {
|
|
14189
|
+
type: this.type,
|
|
14190
|
+
title: this.title,
|
|
14191
|
+
status: this.status,
|
|
14192
|
+
detail: this.message,
|
|
14193
|
+
...this.details && Object.keys(this.details).length > 0 && { details: this.details },
|
|
14194
|
+
...this.hint && { hint: this.hint },
|
|
14195
|
+
...challengeId && { challengeId }
|
|
14196
|
+
};
|
|
14197
|
+
}
|
|
14198
|
+
};
|
|
14199
|
+
var MalformedCredentialError = class extends PaymentError {
|
|
14200
|
+
name = "MalformedCredentialError";
|
|
14201
|
+
title = "Malformed Credential";
|
|
14202
|
+
status = 402;
|
|
14203
|
+
type = "https://paymentauth.org/problems/malformed-credential";
|
|
14204
|
+
hint = Hints.malformedCredential;
|
|
14205
|
+
constructor(options = {}) {
|
|
14206
|
+
const { reason } = options;
|
|
14207
|
+
super(reason ? `Credential is malformed: ${reason}.` : "Credential is malformed.");
|
|
14208
|
+
}
|
|
14209
|
+
};
|
|
14210
|
+
var InvalidChallengeError = class extends PaymentError {
|
|
14211
|
+
name = "InvalidChallengeError";
|
|
14212
|
+
title = "Invalid Challenge";
|
|
14213
|
+
status = 402;
|
|
14214
|
+
type = "https://paymentauth.org/problems/invalid-challenge";
|
|
14215
|
+
constructor(options = {}) {
|
|
14216
|
+
const { id, reason } = options;
|
|
14217
|
+
const idPart = id ? ` "${id}"` : "";
|
|
14218
|
+
const reasonPart = reason ? `: ${reason}` : "";
|
|
14219
|
+
super(`Challenge${idPart} is invalid${reasonPart}.`);
|
|
14220
|
+
}
|
|
14221
|
+
};
|
|
14222
|
+
var VerificationFailedError = class extends PaymentError {
|
|
14223
|
+
name = "VerificationFailedError";
|
|
14224
|
+
title = "Verification Failed";
|
|
14225
|
+
type = "https://paymentauth.org/problems/verification-failed";
|
|
14226
|
+
constructor(options = {}) {
|
|
14227
|
+
const { details, reason } = options;
|
|
14228
|
+
super(reason ? `Payment verification failed: ${reason}.` : "Payment verification failed.", {
|
|
14229
|
+
details
|
|
14230
|
+
});
|
|
14231
|
+
}
|
|
14232
|
+
};
|
|
14233
|
+
var PaymentActionRequiredError = class extends PaymentError {
|
|
14234
|
+
name = "PaymentActionRequiredError";
|
|
14235
|
+
title = "Payment Action Required";
|
|
14236
|
+
type = "https://paymentauth.org/problems/payment-action-required";
|
|
14237
|
+
constructor(options = {}) {
|
|
14238
|
+
const { reason } = options;
|
|
14239
|
+
super(reason ? `Payment requires action: ${reason}.` : "Payment requires action.");
|
|
14240
|
+
}
|
|
14241
|
+
};
|
|
14242
|
+
var PaymentExpiredError = class extends PaymentError {
|
|
14243
|
+
name = "PaymentExpiredError";
|
|
14244
|
+
title = "Payment Expired";
|
|
14245
|
+
type = "https://paymentauth.org/problems/payment-expired";
|
|
14246
|
+
constructor(options = {}) {
|
|
14247
|
+
const { expires } = options;
|
|
14248
|
+
super(expires ? `Payment expired at ${expires}.` : "Payment has expired.");
|
|
14249
|
+
}
|
|
14250
|
+
};
|
|
14251
|
+
var PaymentRequiredError = class extends PaymentError {
|
|
14252
|
+
name = "PaymentRequiredError";
|
|
14253
|
+
title = "Payment Required";
|
|
14254
|
+
type = "https://paymentauth.org/problems/payment-required";
|
|
14255
|
+
hint = Hints.paymentRequired;
|
|
14256
|
+
constructor(options = {}) {
|
|
14257
|
+
const { description } = options;
|
|
14258
|
+
const parts = ["Payment is required"];
|
|
14259
|
+
if (description)
|
|
14260
|
+
parts.push(`(${description})`);
|
|
14261
|
+
super(`${parts.join(" ")}.`);
|
|
14262
|
+
}
|
|
14263
|
+
};
|
|
14264
|
+
var InvalidPayloadError = class extends PaymentError {
|
|
14265
|
+
name = "InvalidPayloadError";
|
|
14266
|
+
title = "Invalid Payload";
|
|
14267
|
+
type = "https://paymentauth.org/problems/invalid-payload";
|
|
14268
|
+
constructor(options = {}) {
|
|
14269
|
+
const { reason } = options;
|
|
14270
|
+
super(reason ? `Credential payload is invalid: ${reason}.` : "Credential payload is invalid.");
|
|
14271
|
+
}
|
|
14272
|
+
};
|
|
14273
|
+
var BadRequestError = class extends PaymentError {
|
|
14274
|
+
name = "BadRequestError";
|
|
14275
|
+
title = "Bad Request";
|
|
14276
|
+
status = 400;
|
|
14277
|
+
type = "https://paymentauth.org/problems/bad-request";
|
|
14278
|
+
constructor(options = {}) {
|
|
14279
|
+
const { reason } = options;
|
|
14280
|
+
super(reason ? `Bad request: ${reason}.` : "Bad request.");
|
|
14281
|
+
}
|
|
14282
|
+
};
|
|
14283
|
+
var PaymentInsufficientError = class extends PaymentError {
|
|
14284
|
+
name = "PaymentInsufficientError";
|
|
14285
|
+
title = "Payment Insufficient";
|
|
14286
|
+
type = "https://paymentauth.org/problems/payment-insufficient";
|
|
14287
|
+
constructor(options = {}) {
|
|
14288
|
+
const { reason } = options;
|
|
14289
|
+
super(reason ? `Payment insufficient: ${reason}.` : "Payment amount is insufficient.");
|
|
14290
|
+
}
|
|
14291
|
+
};
|
|
14292
|
+
var PaymentMethodUnsupportedError = class extends PaymentError {
|
|
14293
|
+
name = "PaymentMethodUnsupportedError";
|
|
14294
|
+
title = "Method Unsupported";
|
|
14295
|
+
status = 400;
|
|
14296
|
+
type = "https://paymentauth.org/problems/method-unsupported";
|
|
14297
|
+
hint = Hints.methodUnsupported;
|
|
14298
|
+
constructor(options = {}) {
|
|
14299
|
+
const { method } = options;
|
|
14300
|
+
super(method ? `Payment method "${method}" is not supported.` : "Payment method is not supported.");
|
|
14301
|
+
}
|
|
14302
|
+
};
|
|
14303
|
+
var InsufficientBalanceError = class extends PaymentError {
|
|
14304
|
+
name = "InsufficientBalanceError";
|
|
14305
|
+
title = "Insufficient Balance";
|
|
14306
|
+
status = 402;
|
|
14307
|
+
type = "https://paymentauth.org/problems/session/insufficient-balance";
|
|
14308
|
+
constructor(options = {}) {
|
|
14309
|
+
const { reason } = options;
|
|
14310
|
+
super(reason ? `Insufficient balance: ${reason}.` : "Insufficient balance.");
|
|
14311
|
+
}
|
|
14312
|
+
};
|
|
14313
|
+
var InvalidSignatureError = class extends PaymentError {
|
|
14314
|
+
name = "InvalidSignatureError";
|
|
14315
|
+
title = "Invalid Signature";
|
|
14316
|
+
status = 402;
|
|
14317
|
+
type = "https://paymentauth.org/problems/session/invalid-signature";
|
|
14318
|
+
constructor(options = {}) {
|
|
14319
|
+
const { reason } = options;
|
|
14320
|
+
super(reason ? `Invalid signature: ${reason}.` : "Invalid signature.");
|
|
14321
|
+
}
|
|
14322
|
+
};
|
|
14323
|
+
var SignerMismatchError = class extends PaymentError {
|
|
14324
|
+
name = "SignerMismatchError";
|
|
14325
|
+
title = "Signer Mismatch";
|
|
14326
|
+
status = 402;
|
|
14327
|
+
type = "https://paymentauth.org/problems/session/signer-mismatch";
|
|
14328
|
+
constructor(options = {}) {
|
|
14329
|
+
const { reason } = options;
|
|
14330
|
+
super(reason ? `Signer mismatch: ${reason}.` : "Signer is not authorized for this channel.");
|
|
14331
|
+
}
|
|
14332
|
+
};
|
|
14333
|
+
var AmountExceedsDepositError = class extends PaymentError {
|
|
14334
|
+
name = "AmountExceedsDepositError";
|
|
14335
|
+
title = "Amount Exceeds Deposit";
|
|
14336
|
+
status = 402;
|
|
14337
|
+
type = "https://paymentauth.org/problems/session/amount-exceeds-deposit";
|
|
14338
|
+
constructor(options = {}) {
|
|
14339
|
+
const { reason } = options;
|
|
14340
|
+
super(reason ? `Amount exceeds deposit: ${reason}.` : "Voucher amount exceeds channel deposit.");
|
|
14278
14341
|
}
|
|
14279
|
-
|
|
14280
|
-
|
|
14281
|
-
|
|
14282
|
-
|
|
14283
|
-
|
|
14284
|
-
|
|
14285
|
-
})
|
|
14286
|
-
}
|
|
14287
|
-
|
|
14288
|
-
const expectedId = computeId(challenge, options);
|
|
14289
|
-
return constantTimeEqual(challenge.id, expectedId);
|
|
14290
|
-
}
|
|
14291
|
-
function meta3(challenge) {
|
|
14292
|
-
return challenge.meta;
|
|
14293
|
-
}
|
|
14294
|
-
function idBindingInput(challenge) {
|
|
14295
|
-
return [
|
|
14296
|
-
challenge.realm,
|
|
14297
|
-
challenge.method,
|
|
14298
|
-
challenge.intent,
|
|
14299
|
-
serialize(challenge.request),
|
|
14300
|
-
challenge.expires ?? "",
|
|
14301
|
-
challenge.digest ?? "",
|
|
14302
|
-
challenge.opaque ?? (challenge.meta ? serialize(challenge.meta) : "")
|
|
14303
|
-
].join("|");
|
|
14304
|
-
}
|
|
14305
|
-
function computeId(challenge, options) {
|
|
14306
|
-
const input = idBindingInput(challenge);
|
|
14307
|
-
const key = Bytes_exports.fromString(options.secretKey);
|
|
14308
|
-
const data = Bytes_exports.fromString(input);
|
|
14309
|
-
const mac3 = Hash_exports.hmac256(key, data, { as: "Bytes" });
|
|
14310
|
-
return Base64_exports.fromBytes(mac3, { url: true, pad: false });
|
|
14311
|
-
}
|
|
14312
|
-
|
|
14313
|
-
// node_modules/mppx/dist/Credential.js
|
|
14314
|
-
var Credential_exports = {};
|
|
14315
|
-
__export(Credential_exports, {
|
|
14316
|
-
InvalidCredentialEncodingError: () => InvalidCredentialEncodingError,
|
|
14317
|
-
MissingAuthorizationHeaderError: () => MissingAuthorizationHeaderError,
|
|
14318
|
-
MissingPaymentSchemeError: () => MissingPaymentSchemeError,
|
|
14319
|
-
deserialize: () => deserialize3,
|
|
14320
|
-
extractPaymentScheme: () => extractPaymentScheme,
|
|
14321
|
-
from: () => from3,
|
|
14322
|
-
fromRequest: () => fromRequest,
|
|
14323
|
-
serialize: () => serialize3
|
|
14324
|
-
});
|
|
14325
|
-
var MissingAuthorizationHeaderError = class extends Error {
|
|
14326
|
-
name = "MissingAuthorizationHeaderError";
|
|
14327
|
-
constructor() {
|
|
14328
|
-
super("Missing Authorization header.");
|
|
14342
|
+
};
|
|
14343
|
+
var DeltaTooSmallError = class extends PaymentError {
|
|
14344
|
+
name = "DeltaTooSmallError";
|
|
14345
|
+
title = "Delta Too Small";
|
|
14346
|
+
status = 402;
|
|
14347
|
+
type = "https://paymentauth.org/problems/session/delta-too-small";
|
|
14348
|
+
constructor(options = {}) {
|
|
14349
|
+
const { reason } = options;
|
|
14350
|
+
super(reason ? `Delta too small: ${reason}.` : "Amount increase below minimum voucher delta.");
|
|
14329
14351
|
}
|
|
14330
14352
|
};
|
|
14331
|
-
var
|
|
14332
|
-
name = "
|
|
14333
|
-
|
|
14334
|
-
|
|
14353
|
+
var ChannelNotFoundError = class extends PaymentError {
|
|
14354
|
+
name = "ChannelNotFoundError";
|
|
14355
|
+
title = "Channel Not Found";
|
|
14356
|
+
status = 410;
|
|
14357
|
+
type = "https://paymentauth.org/problems/session/channel-not-found";
|
|
14358
|
+
constructor(options = {}) {
|
|
14359
|
+
const { reason } = options;
|
|
14360
|
+
super(reason ? `Channel not found: ${reason}.` : "No channel with this ID exists.");
|
|
14335
14361
|
}
|
|
14336
14362
|
};
|
|
14337
|
-
var
|
|
14338
|
-
name = "
|
|
14339
|
-
|
|
14340
|
-
|
|
14363
|
+
var ChannelClosedError = class extends PaymentError {
|
|
14364
|
+
name = "ChannelClosedError";
|
|
14365
|
+
title = "Channel Closed";
|
|
14366
|
+
status = 410;
|
|
14367
|
+
type = "https://paymentauth.org/problems/session/channel-finalized";
|
|
14368
|
+
constructor(options = {}) {
|
|
14369
|
+
const { reason } = options;
|
|
14370
|
+
super(reason ? `Channel closed: ${reason}.` : "Channel is closed.");
|
|
14341
14371
|
}
|
|
14342
14372
|
};
|
|
14343
|
-
|
|
14344
|
-
|
|
14345
|
-
|
|
14346
|
-
|
|
14347
|
-
|
|
14348
|
-
|
|
14349
|
-
|
|
14350
|
-
|
|
14351
|
-
|
|
14352
|
-
|
|
14353
|
-
|
|
14354
|
-
|
|
14355
|
-
|
|
14356
|
-
|
|
14373
|
+
|
|
14374
|
+
// node_modules/mppx/dist/Expires.js
|
|
14375
|
+
var Expires_exports = {};
|
|
14376
|
+
__export(Expires_exports, {
|
|
14377
|
+
assert: () => assert2,
|
|
14378
|
+
days: () => days,
|
|
14379
|
+
hours: () => hours,
|
|
14380
|
+
minutes: () => minutes,
|
|
14381
|
+
months: () => months,
|
|
14382
|
+
seconds: () => seconds,
|
|
14383
|
+
weeks: () => weeks,
|
|
14384
|
+
years: () => years
|
|
14385
|
+
});
|
|
14386
|
+
function assert2(expires, challengeId) {
|
|
14387
|
+
if (!expires)
|
|
14388
|
+
throw new InvalidChallengeError({
|
|
14389
|
+
...challengeId && { id: challengeId },
|
|
14390
|
+
reason: "missing required expires field"
|
|
14357
14391
|
});
|
|
14358
|
-
|
|
14359
|
-
|
|
14360
|
-
|
|
14361
|
-
|
|
14362
|
-
};
|
|
14363
|
-
|
|
14364
|
-
throw new
|
|
14365
|
-
}
|
|
14392
|
+
if (Number.isNaN(new Date(expires).getTime()))
|
|
14393
|
+
throw new InvalidChallengeError({
|
|
14394
|
+
...challengeId && { id: challengeId },
|
|
14395
|
+
reason: "malformed expires timestamp"
|
|
14396
|
+
});
|
|
14397
|
+
if (new Date(expires) < /* @__PURE__ */ new Date())
|
|
14398
|
+
throw new PaymentExpiredError({ expires });
|
|
14366
14399
|
}
|
|
14367
|
-
function
|
|
14368
|
-
|
|
14369
|
-
return {};
|
|
14370
|
-
if (typeof value === "string")
|
|
14371
|
-
return { opaque: value };
|
|
14372
|
-
if (!isStringRecord(value))
|
|
14373
|
-
throw new Error("Invalid opaque.");
|
|
14374
|
-
return {
|
|
14375
|
-
meta: value,
|
|
14376
|
-
opaque: serialize(value)
|
|
14377
|
-
};
|
|
14400
|
+
function days(n) {
|
|
14401
|
+
return new Date(Date.now() + n * 24 * 60 * 60 * 1e3).toISOString();
|
|
14378
14402
|
}
|
|
14379
|
-
function
|
|
14380
|
-
|
|
14381
|
-
return false;
|
|
14382
|
-
return Object.values(value).every((entry) => typeof entry === "string");
|
|
14403
|
+
function hours(n) {
|
|
14404
|
+
return new Date(Date.now() + n * 60 * 60 * 1e3).toISOString();
|
|
14383
14405
|
}
|
|
14384
|
-
function
|
|
14385
|
-
|
|
14386
|
-
return {
|
|
14387
|
-
challenge,
|
|
14388
|
-
payload,
|
|
14389
|
-
...source && { source }
|
|
14390
|
-
};
|
|
14406
|
+
function minutes(n) {
|
|
14407
|
+
return new Date(Date.now() + n * 60 * 1e3).toISOString();
|
|
14391
14408
|
}
|
|
14392
|
-
function
|
|
14393
|
-
|
|
14394
|
-
if (!header)
|
|
14395
|
-
throw new MissingAuthorizationHeaderError();
|
|
14396
|
-
const payment = extractPaymentScheme(header);
|
|
14397
|
-
if (!payment)
|
|
14398
|
-
throw new MissingPaymentSchemeError();
|
|
14399
|
-
return deserialize3(payment);
|
|
14409
|
+
function months(n) {
|
|
14410
|
+
return new Date(Date.now() + n * 30 * 24 * 60 * 60 * 1e3).toISOString();
|
|
14400
14411
|
}
|
|
14401
|
-
function
|
|
14402
|
-
|
|
14403
|
-
const wireOpaque = opaque ?? (meta4 !== void 0 ? serialize(meta4) : void 0);
|
|
14404
|
-
const wire = {
|
|
14405
|
-
challenge: {
|
|
14406
|
-
...challenge,
|
|
14407
|
-
...wireOpaque !== void 0 && { opaque: wireOpaque },
|
|
14408
|
-
request: serialize(request)
|
|
14409
|
-
},
|
|
14410
|
-
payload: credential.payload,
|
|
14411
|
-
...credential.source && { source: credential.source }
|
|
14412
|
-
};
|
|
14413
|
-
const json2 = JSON.stringify(wire);
|
|
14414
|
-
const encoded = Base64_exports.fromString(json2, { pad: false, url: true });
|
|
14415
|
-
return `${Schemes.payment} ${encoded}`;
|
|
14412
|
+
function seconds(n) {
|
|
14413
|
+
return new Date(Date.now() + n * 1e3).toISOString();
|
|
14416
14414
|
}
|
|
14417
|
-
function
|
|
14418
|
-
|
|
14419
|
-
|
|
14415
|
+
function weeks(n) {
|
|
14416
|
+
return new Date(Date.now() + n * 7 * 24 * 60 * 60 * 1e3).toISOString();
|
|
14417
|
+
}
|
|
14418
|
+
function years(n) {
|
|
14419
|
+
return new Date(Date.now() + n * 365 * 24 * 60 * 60 * 1e3).toISOString();
|
|
14420
14420
|
}
|
|
14421
|
-
|
|
14422
|
-
// node_modules/mppx/dist/Mcp.js
|
|
14423
|
-
var Mcp_exports = {};
|
|
14424
|
-
__export(Mcp_exports, {
|
|
14425
|
-
credentialMetaKey: () => credentialMetaKey,
|
|
14426
|
-
paymentRequiredCode: () => paymentRequiredCode,
|
|
14427
|
-
paymentRequiredMetaKey: () => paymentRequiredMetaKey,
|
|
14428
|
-
paymentVerificationFailedCode: () => paymentVerificationFailedCode,
|
|
14429
|
-
receiptMetaKey: () => receiptMetaKey
|
|
14430
|
-
});
|
|
14431
|
-
var paymentRequiredCode = -32042;
|
|
14432
|
-
var paymentVerificationFailedCode = -32043;
|
|
14433
|
-
var credentialMetaKey = "org.paymentauth/credential";
|
|
14434
|
-
var paymentRequiredMetaKey = "org.paymentauth/payment-required";
|
|
14435
|
-
var receiptMetaKey = "org.paymentauth/receipt";
|
|
14436
14421
|
|
|
14437
14422
|
// node_modules/mppx/dist/Method.js
|
|
14438
14423
|
var Method_exports = {};
|
|
@@ -14476,7 +14461,7 @@ function prepareCredential(methods, input) {
|
|
|
14476
14461
|
id: credential.challenge.id,
|
|
14477
14462
|
reason: `no registered method for ${credential.challenge.method}/${credential.challenge.intent}`
|
|
14478
14463
|
});
|
|
14479
|
-
|
|
14464
|
+
assert2(credential.challenge.expires, credential.challenge.id);
|
|
14480
14465
|
let payload;
|
|
14481
14466
|
try {
|
|
14482
14467
|
payload = method.schema.credential.payload.parse(credential.payload);
|
|
@@ -14539,6 +14524,21 @@ function toServer(method, options) {
|
|
|
14539
14524
|
};
|
|
14540
14525
|
}
|
|
14541
14526
|
|
|
14527
|
+
// node_modules/mppx/dist/Mcp.js
|
|
14528
|
+
var Mcp_exports = {};
|
|
14529
|
+
__export(Mcp_exports, {
|
|
14530
|
+
credentialMetaKey: () => credentialMetaKey,
|
|
14531
|
+
paymentRequiredCode: () => paymentRequiredCode,
|
|
14532
|
+
paymentRequiredMetaKey: () => paymentRequiredMetaKey,
|
|
14533
|
+
paymentVerificationFailedCode: () => paymentVerificationFailedCode,
|
|
14534
|
+
receiptMetaKey: () => receiptMetaKey
|
|
14535
|
+
});
|
|
14536
|
+
var paymentRequiredCode = -32042;
|
|
14537
|
+
var paymentVerificationFailedCode = -32043;
|
|
14538
|
+
var credentialMetaKey = "org.paymentauth/credential";
|
|
14539
|
+
var paymentRequiredMetaKey = "org.paymentauth/payment-required";
|
|
14540
|
+
var receiptMetaKey = "org.paymentauth/receipt";
|
|
14541
|
+
|
|
14542
14542
|
// node_modules/mppx/dist/x402/Types.js
|
|
14543
14543
|
var Types_exports = {};
|
|
14544
14544
|
__export(Types_exports, {
|
|
@@ -15079,20 +15079,6 @@ export {
|
|
|
15079
15079
|
SessionProtocols,
|
|
15080
15080
|
getMethodDetail,
|
|
15081
15081
|
Constants_exports,
|
|
15082
|
-
PaymentError,
|
|
15083
|
-
InvalidChallengeError,
|
|
15084
|
-
VerificationFailedError,
|
|
15085
|
-
PaymentExpiredError,
|
|
15086
|
-
BadRequestError,
|
|
15087
|
-
InsufficientBalanceError,
|
|
15088
|
-
InvalidSignatureError,
|
|
15089
|
-
AmountExceedsDepositError,
|
|
15090
|
-
DeltaTooSmallError,
|
|
15091
|
-
ChannelNotFoundError,
|
|
15092
|
-
ChannelClosedError,
|
|
15093
|
-
Errors_exports,
|
|
15094
|
-
assert,
|
|
15095
|
-
Expires_exports,
|
|
15096
15082
|
constantTimeEqual,
|
|
15097
15083
|
serialize,
|
|
15098
15084
|
PaymentRequest_exports,
|
|
@@ -15372,6 +15358,25 @@ export {
|
|
|
15372
15358
|
serialize3,
|
|
15373
15359
|
extractPaymentScheme,
|
|
15374
15360
|
Credential_exports,
|
|
15361
|
+
PaymentError,
|
|
15362
|
+
InvalidChallengeError,
|
|
15363
|
+
VerificationFailedError,
|
|
15364
|
+
PaymentExpiredError,
|
|
15365
|
+
BadRequestError,
|
|
15366
|
+
InsufficientBalanceError,
|
|
15367
|
+
InvalidSignatureError,
|
|
15368
|
+
AmountExceedsDepositError,
|
|
15369
|
+
DeltaTooSmallError,
|
|
15370
|
+
ChannelNotFoundError,
|
|
15371
|
+
ChannelClosedError,
|
|
15372
|
+
Errors_exports2 as Errors_exports,
|
|
15373
|
+
assert2 as assert,
|
|
15374
|
+
Expires_exports,
|
|
15375
|
+
from4 as from3,
|
|
15376
|
+
toClient,
|
|
15377
|
+
toServer,
|
|
15378
|
+
Method_exports,
|
|
15379
|
+
createJson,
|
|
15375
15380
|
paymentRequiredCode,
|
|
15376
15381
|
credentialMetaKey,
|
|
15377
15382
|
paymentRequiredMetaKey,
|
|
@@ -15400,7 +15405,6 @@ export {
|
|
|
15400
15405
|
SettleResponseSchema,
|
|
15401
15406
|
toPaymentRequirements,
|
|
15402
15407
|
Types_exports,
|
|
15403
|
-
createJson,
|
|
15404
15408
|
decodePaymentRequiredEnvelope,
|
|
15405
15409
|
encodePaymentSignature,
|
|
15406
15410
|
Header_exports,
|
|
@@ -15410,10 +15414,6 @@ export {
|
|
|
15410
15414
|
Assets_exports,
|
|
15411
15415
|
Assets_exports2,
|
|
15412
15416
|
Chains_exports,
|
|
15413
|
-
from4 as from3,
|
|
15414
|
-
toClient,
|
|
15415
|
-
toServer,
|
|
15416
|
-
Method_exports,
|
|
15417
15417
|
paymentMethod2,
|
|
15418
15418
|
chargeIntent,
|
|
15419
15419
|
evmNetworkPrefix2,
|