@daski/x402-scheme 0.3.0 → 0.4.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/README.md +3 -3
- package/dist/binding.d.ts +1 -11
- package/dist/binding.d.ts.map +1 -1
- package/dist/binding.js +4 -8
- package/dist/binding.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/recipe.d.ts +5 -10
- package/dist/recipe.d.ts.map +1 -1
- package/dist/recipe.js +11 -19
- package/dist/recipe.js.map +1 -1
- package/dist/signer.d.ts +2 -2
- package/dist/signer.d.ts.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -68,9 +68,9 @@ what lets you sign a server-proposed authorization without trusting the
|
|
|
68
68
|
server. When the gateway supplies `daski-sign-request`, its proposal is
|
|
69
69
|
treated as an input: recomputed, compared, and refused on mismatch.
|
|
70
70
|
|
|
71
|
-
|
|
72
|
-
tests against a vector produced independently by the reference client
|
|
73
|
-
43 settled sandbox orders.
|
|
71
|
+
`recipeNonceV2` is the only recipe (the V1 binding is retired) and is pinned
|
|
72
|
+
by tests against a vector produced independently by the reference client
|
|
73
|
+
behind 43 settled sandbox orders.
|
|
74
74
|
|
|
75
75
|
## Examples
|
|
76
76
|
|
package/dist/binding.d.ts
CHANGED
|
@@ -6,16 +6,6 @@
|
|
|
6
6
|
* that carries one is refused rather than trimmed.
|
|
7
7
|
*/
|
|
8
8
|
import type { Hex } from "viem";
|
|
9
|
-
export interface OrderBindingV1 {
|
|
10
|
-
version: 1;
|
|
11
|
-
profile: "recipe-bound-v1";
|
|
12
|
-
listingManifestHash: Hex;
|
|
13
|
-
providerOfferHash: Hex;
|
|
14
|
-
quoteHash: Hex;
|
|
15
|
-
canonicalRequestHash: Hex;
|
|
16
|
-
orderNonce: Hex;
|
|
17
|
-
expiresAt: number;
|
|
18
|
-
}
|
|
19
9
|
/** Catalog-driven checkout: the runtime listing commitment plus the
|
|
20
10
|
* provider's signed registration intent. */
|
|
21
11
|
export interface OrderBindingV2 {
|
|
@@ -28,7 +18,7 @@ export interface OrderBindingV2 {
|
|
|
28
18
|
orderNonce: Hex;
|
|
29
19
|
expiresAt: number;
|
|
30
20
|
}
|
|
31
|
-
export type OrderBinding =
|
|
21
|
+
export type OrderBinding = OrderBindingV2;
|
|
32
22
|
/**
|
|
33
23
|
* Parses the `daski-order-binding` extension, or returns `undefined` when the
|
|
34
24
|
* challenge carries none (the stock-delegation path).
|
package/dist/binding.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"binding.d.ts","sourceRoot":"","sources":["../src/binding.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,MAAM,CAAC;AAKhC
|
|
1
|
+
{"version":3,"file":"binding.d.ts","sourceRoot":"","sources":["../src/binding.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,MAAM,CAAC;AAKhC;6CAC6C;AAC7C,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,CAAC,CAAC;IACX,OAAO,EAAE,iBAAiB,CAAC;IAC3B,qBAAqB,EAAE,GAAG,CAAC;IAC3B,kBAAkB,EAAE,GAAG,CAAC;IACxB,SAAS,EAAE,GAAG,CAAC;IACf,oBAAoB,EAAE,GAAG,CAAC;IAC1B,UAAU,EAAE,GAAG,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,MAAM,YAAY,GAAG,cAAc,CAAC;AAQ1C;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,GAAG,YAAY,GAAG,SAAS,CA2D1E"}
|
package/dist/binding.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { refuse } from "./errors.js";
|
|
2
2
|
const HEX32 = /^0x[0-9a-fA-F]{64}$/;
|
|
3
3
|
const SHARED_SLOTS = ["quoteHash", "canonicalRequestHash", "orderNonce"];
|
|
4
|
-
const
|
|
5
|
-
const DEAL_SLOTS_V2 = ["runtimeCommitmentHash", "providerIntentHash"];
|
|
4
|
+
const DEAL_SLOTS = ["runtimeCommitmentHash", "providerIntentHash"];
|
|
6
5
|
const BINDING_DOC = "https://github.com/daski-io/buyer/blob/main/docs/policy.md#daski-order-binding";
|
|
7
6
|
/**
|
|
8
7
|
* Parses the `daski-order-binding` extension, or returns `undefined` when the
|
|
@@ -21,8 +20,7 @@ export function parseOrderBinding(value) {
|
|
|
21
20
|
});
|
|
22
21
|
}
|
|
23
22
|
const binding = value;
|
|
24
|
-
const
|
|
25
|
-
const dealSlots = isV2 ? DEAL_SLOTS_V2 : DEAL_SLOTS_V1;
|
|
23
|
+
const dealSlots = DEAL_SLOTS;
|
|
26
24
|
const expectedKeys = [
|
|
27
25
|
"version", "profile", ...dealSlots, ...SHARED_SLOTS, "expiresAt",
|
|
28
26
|
].sort();
|
|
@@ -37,14 +35,12 @@ export function parseOrderBinding(value) {
|
|
|
37
35
|
`signed. Upgrade @daski/x402-scheme, or see ${BINDING_DOC}`,
|
|
38
36
|
});
|
|
39
37
|
}
|
|
40
|
-
const versionOk =
|
|
41
|
-
? binding.version === 2
|
|
42
|
-
: binding.version === 1 && binding.profile === "recipe-bound-v1";
|
|
38
|
+
const versionOk = binding.profile === "recipe-bound-v2" && binding.version === 2;
|
|
43
39
|
if (!versionOk) {
|
|
44
40
|
refuse({
|
|
45
41
|
check: "challenge-shape",
|
|
46
42
|
code: "DASKI_BINDING_UNKNOWN_PROFILE",
|
|
47
|
-
expected: "recipe-bound-
|
|
43
|
+
expected: "recipe-bound-v2 (version 2)",
|
|
48
44
|
actual: `profile=${String(binding.profile)} version=${String(binding.version)}`,
|
|
49
45
|
remediation: `Upgrade @daski/x402-scheme; see ${BINDING_DOC}`,
|
|
50
46
|
});
|
package/dist/binding.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"binding.js","sourceRoot":"","sources":["../src/binding.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC,MAAM,KAAK,GAAG,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"binding.js","sourceRoot":"","sources":["../src/binding.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC,MAAM,KAAK,GAAG,qBAAqB,CAAC;AAiBpC,MAAM,YAAY,GAAG,CAAC,WAAW,EAAE,sBAAsB,EAAE,YAAY,CAAU,CAAC;AAClF,MAAM,UAAU,GAAG,CAAC,uBAAuB,EAAE,oBAAoB,CAAU,CAAC;AAE5E,MAAM,WAAW,GACf,gFAAgF,CAAC;AAEnF;;;GAGG;AACH,MAAM,UAAU,iBAAiB,CAAC,KAAc;IAC9C,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO,SAAS,CAAC;IAC1C,IAAI,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QAChE,MAAM,CAAC;YACL,KAAK,EAAE,iBAAiB;YACxB,IAAI,EAAE,6BAA6B;YACnC,QAAQ,EAAE,mDAAmD;YAC7D,MAAM,EAAE,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,OAAO,KAAK;YACxD,WAAW,EAAE,kCAAkC,WAAW,EAAE;SAC7D,CAAC,CAAC;IACL,CAAC;IACD,MAAM,OAAO,GAAG,KAAgC,CAAC;IACjD,MAAM,SAAS,GAAG,UAAU,CAAC;IAC7B,MAAM,YAAY,GAAG;QACnB,SAAS,EAAE,SAAS,EAAE,GAAG,SAAS,EAAE,GAAG,YAAY,EAAE,WAAW;KACjE,CAAC,IAAI,EAAE,CAAC;IACT,MAAM,UAA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,CAAC,CAAC,EAAE;gBAC1C,WAAW,EAAE,kCAAkC,WAAW,EAAE;aAC7D,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IACD,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,OAAO,CAAC,SAAS,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC;QAC/E,MAAM,CAAC;YACL,KAAK,EAAE,iBAAiB;YACxB,IAAI,EAAE,gCAAgC;YACtC,QAAQ,EAAE,sDAAsD;YAChE,MAAM,EAAE,aAAa,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE;YAChD,WAAW,EAAE,kCAAkC,WAAW,EAAE;SAC7D,CAAC,CAAC;IACL,CAAC;IACD,OAAO,OAAkC,CAAC;AAC5C,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -7,14 +7,14 @@
|
|
|
7
7
|
* and the gateway never sees the key. There is no exported "just sign this"
|
|
8
8
|
* function, and there never will be.
|
|
9
9
|
*/
|
|
10
|
-
export { parseOrderBinding, type OrderBinding, type
|
|
10
|
+
export { parseOrderBinding, type OrderBinding, type OrderBindingV2, } from "./binding.js";
|
|
11
11
|
export { canonicalHash, canonicalJson } from "./canonical.js";
|
|
12
12
|
export { AUTHORIZATION_FIELDS, isClosedTransferWithAuthorizationTypes, TRANSFER_WITH_AUTHORIZATION_PRIMARY_TYPE, TRANSFER_WITH_AUTHORIZATION_TYPES, transferWithAuthorizationTypedData, type Eip712Domain, type TransferAuthorization, type TypedDataRequest, } from "./eip712.js";
|
|
13
13
|
export { PolicyRefusal, refuse, type PolicyCheck, type PolicyRefusalDetail, } from "./errors.js";
|
|
14
14
|
export { DASKI_ORDER_BINDING, DASKI_SIGN_REQUEST, issuedPaymentIdentifier, PAYMENT_IDENTIFIER, PAYMENT_IDENTIFIER_PATTERN, paymentEchoExtensions, withPaymentIdentifier, } from "./extensions.js";
|
|
15
15
|
export { LIFECYCLE_CLOCK_SKEW_SECONDS, MAX_LIFECYCLE_LIFETIME_SECONDS, ORDER_ACTION_TYPES, orderActionResourceUri, orderActionTypedData, validateOrderActionChallenge, validateWalletActionChallenge, WALLET_ACTION_TYPES, walletActionTypedData, type OrderAction, type OrderActionAuthorization, type OrderActionChallenge, type OrderActionExpectations, type WalletActionChallenge, type WalletActionExpectations, } from "./lifecycle.js";
|
|
16
16
|
export { bindingFromExtensions, DEFAULT_MAX_AUTHORIZATION_LIFETIME_SECONDS, DEFAULT_MAX_BACKDATE_SECONDS, DEFAULT_MIN_AUTHORIZATION_LIFETIME_SECONDS, formatUsdc, parseUsdcToAtomic, USDC_DECIMALS, validatePurchaseAuthorization, type PolicyConfig, type PurchaseExpectations, type SessionLedger, type SplitterEvidence, type SplitterResolver, type ValidatedPurchase, } from "./policy.js";
|
|
17
|
-
export { deriveBindingNonce,
|
|
17
|
+
export { deriveBindingNonce, RECIPE_NONCE_DOMAIN_V2, recipeNonceV2, type RecipeNonceV2Input, type RecipePaymentFacts, } from "./recipe.js";
|
|
18
18
|
export { registerDaskiExactEvmScheme, type RegisterOptions, type X402ClientLike } from "./register.js";
|
|
19
19
|
export { DaskiExactEvmScheme, type DaskiExactEvmSchemeOptions, type PaymentPayloadContextLike, type PaymentPayloadResultLike, type PaymentRequirementsLike, type PurchaseContextResolver, type SchemeNetworkClientLike, } from "./scheme.js";
|
|
20
20
|
export { parseSignRequest, proposedNonce, type ParsedSignRequest } from "./signRequest.js";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EACL,iBAAiB,EACjB,KAAK,YAAY,EACjB,KAAK,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EACL,iBAAiB,EACjB,KAAK,YAAY,E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EAAE,KAAK,cAAc,EAAE,MAAM,eAAe,CAAC;AAEvG,OAAO,EACL,mBAAmB,EACnB,KAAK,0BAA0B,EAC/B,KAAK,yBAAyB,EAC9B,KAAK,wBAAwB,EAC7B,KAAK,uBAAuB,EAC5B,KAAK,uBAAuB,EAC5B,KAAK,uBAAuB,GAC7B,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAAE,KAAK,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAE3F,OAAO,EACL,iBAAiB,EACjB,KAAK,aAAa,EAClB,KAAK,iBAAiB,GACvB,MAAM,aAAa,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -14,7 +14,7 @@ export { PolicyRefusal, refuse, } from "./errors.js";
|
|
|
14
14
|
export { DASKI_ORDER_BINDING, DASKI_SIGN_REQUEST, issuedPaymentIdentifier, PAYMENT_IDENTIFIER, PAYMENT_IDENTIFIER_PATTERN, paymentEchoExtensions, withPaymentIdentifier, } from "./extensions.js";
|
|
15
15
|
export { LIFECYCLE_CLOCK_SKEW_SECONDS, MAX_LIFECYCLE_LIFETIME_SECONDS, ORDER_ACTION_TYPES, orderActionResourceUri, orderActionTypedData, validateOrderActionChallenge, validateWalletActionChallenge, WALLET_ACTION_TYPES, walletActionTypedData, } from "./lifecycle.js";
|
|
16
16
|
export { bindingFromExtensions, DEFAULT_MAX_AUTHORIZATION_LIFETIME_SECONDS, DEFAULT_MAX_BACKDATE_SECONDS, DEFAULT_MIN_AUTHORIZATION_LIFETIME_SECONDS, formatUsdc, parseUsdcToAtomic, USDC_DECIMALS, validatePurchaseAuthorization, } from "./policy.js";
|
|
17
|
-
export { deriveBindingNonce,
|
|
17
|
+
export { deriveBindingNonce, RECIPE_NONCE_DOMAIN_V2, recipeNonceV2, } from "./recipe.js";
|
|
18
18
|
export { registerDaskiExactEvmScheme } from "./register.js";
|
|
19
19
|
export { DaskiExactEvmScheme, } from "./scheme.js";
|
|
20
20
|
export { parseSignRequest, proposedNonce } from "./signRequest.js";
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EACL,iBAAiB,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EACL,iBAAiB,GAGlB,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAE9D,OAAO,EACL,oBAAoB,EACpB,sCAAsC,EACtC,wCAAwC,EACxC,iCAAiC,EACjC,kCAAkC,GAInC,MAAM,aAAa,CAAC;AAErB,OAAO,EACL,aAAa,EACb,MAAM,GAGP,MAAM,aAAa,CAAC;AAErB,OAAO,EACL,mBAAmB,EACnB,kBAAkB,EAClB,uBAAuB,EACvB,kBAAkB,EAClB,0BAA0B,EAC1B,qBAAqB,EACrB,qBAAqB,GACtB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EACL,4BAA4B,EAC5B,8BAA8B,EAC9B,kBAAkB,EAClB,sBAAsB,EACtB,oBAAoB,EACpB,4BAA4B,EAC5B,6BAA6B,EAC7B,mBAAmB,EACnB,qBAAqB,GAOtB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EACL,qBAAqB,EACrB,0CAA0C,EAC1C,4BAA4B,EAC5B,0CAA0C,EAC1C,UAAU,EACV,iBAAiB,EACjB,aAAa,EACb,6BAA6B,GAO9B,MAAM,aAAa,CAAC;AAErB,OAAO,EACL,kBAAkB,EAClB,sBAAsB,EACtB,aAAa,GAGd,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,2BAA2B,EAA6C,MAAM,eAAe,CAAC;AAEvG,OAAO,EACL,mBAAmB,GAOpB,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAA0B,MAAM,kBAAkB,CAAC;AAE3F,OAAO,EACL,iBAAiB,GAGlB,MAAM,aAAa,CAAC"}
|
package/dist/recipe.d.ts
CHANGED
|
@@ -7,14 +7,12 @@
|
|
|
7
7
|
* if our nonce and theirs disagree, the deal we were shown is not the deal
|
|
8
8
|
* we would be signing, and we refuse.
|
|
9
9
|
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
10
|
+
* This function mirrors the gateway's `recipeNonceV2` byte for byte.
|
|
11
|
+
* Changing it is a protocol break, not a refactor.
|
|
12
12
|
*/
|
|
13
13
|
import { type Address, type Hex } from "viem";
|
|
14
|
-
import type { OrderBinding,
|
|
15
|
-
/** `keccak256("
|
|
16
|
-
export declare const RECIPE_NONCE_DOMAIN_V1: Hex;
|
|
17
|
-
/** `keccak256("DaskiStandardExactOrderV2")` — the v2 recipe domain separator. */
|
|
14
|
+
import type { OrderBinding, OrderBindingV2 } from "./binding.js";
|
|
15
|
+
/** `keccak256("DaskiStandardExactOrderV2")` — the recipe domain separator. */
|
|
18
16
|
export declare const RECIPE_NONCE_DOMAIN_V2: Hex;
|
|
19
17
|
/**
|
|
20
18
|
* The five payment facts the recipe binds that do not come from the binding
|
|
@@ -29,12 +27,9 @@ export interface RecipePaymentFacts {
|
|
|
29
27
|
splitter: Address;
|
|
30
28
|
grossAmount: bigint;
|
|
31
29
|
}
|
|
32
|
-
export type RecipeNonceV1Input = RecipePaymentFacts & Pick<OrderBindingV1, "listingManifestHash" | "providerOfferHash" | "quoteHash" | "canonicalRequestHash" | "orderNonce">;
|
|
33
30
|
export type RecipeNonceV2Input = RecipePaymentFacts & Pick<OrderBindingV2, "runtimeCommitmentHash" | "providerIntentHash" | "quoteHash" | "canonicalRequestHash" | "orderNonce">;
|
|
34
|
-
/** `recipeNonce` — the v1 layout, for `recipe-bound-v1` listings. */
|
|
35
|
-
export declare function recipeNonce(input: RecipeNonceV1Input): Hex;
|
|
36
31
|
/** `recipeNonceV2` — the catalog-driven layout, for `recipe-bound-v2` listings. */
|
|
37
32
|
export declare function recipeNonceV2(input: RecipeNonceV2Input): Hex;
|
|
38
|
-
/** Recomputes the authorization nonce a binding commits to
|
|
33
|
+
/** Recomputes the authorization nonce a binding commits to. */
|
|
39
34
|
export declare function deriveBindingNonce(binding: OrderBinding, facts: RecipePaymentFacts): Hex;
|
|
40
35
|
//# sourceMappingURL=recipe.d.ts.map
|
package/dist/recipe.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"recipe.d.ts","sourceRoot":"","sources":["../src/recipe.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EAA+C,KAAK,OAAO,EAAE,KAAK,GAAG,EAAE,MAAM,MAAM,CAAC;AAC3F,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,
|
|
1
|
+
{"version":3,"file":"recipe.d.ts","sourceRoot":"","sources":["../src/recipe.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EAA+C,KAAK,OAAO,EAAE,KAAK,GAAG,EAAE,MAAM,MAAM,CAAC;AAC3F,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAEjE,8EAA8E;AAC9E,eAAO,MAAM,sBAAsB,EAAE,GAAyD,CAAC;AAE/F;;;;;GAKG;AACH,MAAM,WAAW,kBAAkB;IACjC,OAAO,EAAE,MAAM,CAAC;IAChB,cAAc,EAAE,OAAO,CAAC;IACxB,KAAK,EAAE,OAAO,CAAC;IACf,QAAQ,EAAE,OAAO,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;CACrB;AAyCD,MAAM,MAAM,kBAAkB,GAAG,kBAAkB,GACjD,IAAI,CAAC,cAAc,EAAE,uBAAuB,GAAG,oBAAoB,GAAG,WAAW,GAC7E,sBAAsB,GAAG,YAAY,CAAC,CAAC;AAE7C,mFAAmF;AACnF,wBAAgB,aAAa,CAAC,KAAK,EAAE,kBAAkB,GAAG,GAAG,CAU5D;AAED,+DAA+D;AAC/D,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,YAAY,EAAE,KAAK,EAAE,kBAAkB,GAAG,GAAG,CAExF"}
|
package/dist/recipe.js
CHANGED
|
@@ -7,15 +7,13 @@
|
|
|
7
7
|
* if our nonce and theirs disagree, the deal we were shown is not the deal
|
|
8
8
|
* we would be signing, and we refuse.
|
|
9
9
|
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
10
|
+
* This function mirrors the gateway's `recipeNonceV2` byte for byte.
|
|
11
|
+
* Changing it is a protocol break, not a refactor.
|
|
12
12
|
*/
|
|
13
13
|
import { encodeAbiParameters, keccak256, stringToHex } from "viem";
|
|
14
|
-
/** `keccak256("
|
|
15
|
-
export const RECIPE_NONCE_DOMAIN_V1 = keccak256(stringToHex("DaskiStandardExactOrderV1"));
|
|
16
|
-
/** `keccak256("DaskiStandardExactOrderV2")` — the v2 recipe domain separator. */
|
|
14
|
+
/** `keccak256("DaskiStandardExactOrderV2")` — the recipe domain separator. */
|
|
17
15
|
export const RECIPE_NONCE_DOMAIN_V2 = keccak256(stringToHex("DaskiStandardExactOrderV2"));
|
|
18
|
-
/** The eleven-slot ABI layout
|
|
16
|
+
/** The eleven-slot ABI layout of the V2 recipe. */
|
|
19
17
|
const RECIPE_ABI = [
|
|
20
18
|
{ type: "bytes32" }, // domain separator
|
|
21
19
|
{ type: "uint256" }, // chainId
|
|
@@ -23,13 +21,13 @@ const RECIPE_ABI = [
|
|
|
23
21
|
{ type: "address" }, // payer
|
|
24
22
|
{ type: "address" }, // splitter
|
|
25
23
|
{ type: "uint256" }, // grossAmount
|
|
26
|
-
{ type: "bytes32" }, //
|
|
27
|
-
{ type: "bytes32" }, //
|
|
24
|
+
{ type: "bytes32" }, // runtimeCommitmentHash
|
|
25
|
+
{ type: "bytes32" }, // providerIntentHash
|
|
28
26
|
{ type: "bytes32" }, // quoteHash
|
|
29
27
|
{ type: "bytes32" }, // canonicalRequestHash
|
|
30
28
|
{ type: "bytes32" }, // orderNonce
|
|
31
29
|
];
|
|
32
|
-
function encodeRecipe(domain, facts,
|
|
30
|
+
function encodeRecipe(domain, facts, runtimeCommitmentHash, providerIntentHash, quoteHash, canonicalRequestHash, orderNonce) {
|
|
33
31
|
return keccak256(encodeAbiParameters(RECIPE_ABI, [
|
|
34
32
|
domain,
|
|
35
33
|
BigInt(facts.chainId),
|
|
@@ -37,25 +35,19 @@ function encodeRecipe(domain, facts, dealSlot1, dealSlot2, quoteHash, canonicalR
|
|
|
37
35
|
facts.payer,
|
|
38
36
|
facts.splitter,
|
|
39
37
|
facts.grossAmount,
|
|
40
|
-
|
|
41
|
-
|
|
38
|
+
runtimeCommitmentHash,
|
|
39
|
+
providerIntentHash,
|
|
42
40
|
quoteHash,
|
|
43
41
|
canonicalRequestHash,
|
|
44
42
|
orderNonce,
|
|
45
43
|
]));
|
|
46
44
|
}
|
|
47
|
-
/** `recipeNonce` — the v1 layout, for `recipe-bound-v1` listings. */
|
|
48
|
-
export function recipeNonce(input) {
|
|
49
|
-
return encodeRecipe(RECIPE_NONCE_DOMAIN_V1, input, input.listingManifestHash, input.providerOfferHash, input.quoteHash, input.canonicalRequestHash, input.orderNonce);
|
|
50
|
-
}
|
|
51
45
|
/** `recipeNonceV2` — the catalog-driven layout, for `recipe-bound-v2` listings. */
|
|
52
46
|
export function recipeNonceV2(input) {
|
|
53
47
|
return encodeRecipe(RECIPE_NONCE_DOMAIN_V2, input, input.runtimeCommitmentHash, input.providerIntentHash, input.quoteHash, input.canonicalRequestHash, input.orderNonce);
|
|
54
48
|
}
|
|
55
|
-
/** Recomputes the authorization nonce a binding commits to
|
|
49
|
+
/** Recomputes the authorization nonce a binding commits to. */
|
|
56
50
|
export function deriveBindingNonce(binding, facts) {
|
|
57
|
-
return binding
|
|
58
|
-
? recipeNonceV2({ ...facts, ...binding })
|
|
59
|
-
: recipeNonce({ ...facts, ...binding });
|
|
51
|
+
return recipeNonceV2({ ...facts, ...binding });
|
|
60
52
|
}
|
|
61
53
|
//# sourceMappingURL=recipe.js.map
|
package/dist/recipe.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"recipe.js","sourceRoot":"","sources":["../src/recipe.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EAAE,mBAAmB,EAAE,SAAS,EAAE,WAAW,EAA0B,MAAM,MAAM,CAAC;AAG3F,
|
|
1
|
+
{"version":3,"file":"recipe.js","sourceRoot":"","sources":["../src/recipe.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EAAE,mBAAmB,EAAE,SAAS,EAAE,WAAW,EAA0B,MAAM,MAAM,CAAC;AAG3F,8EAA8E;AAC9E,MAAM,CAAC,MAAM,sBAAsB,GAAQ,SAAS,CAAC,WAAW,CAAC,2BAA2B,CAAC,CAAC,CAAC;AAgB/F,mDAAmD;AACnD,MAAM,UAAU,GAAG;IACjB,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,mBAAmB;IACxC,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,UAAU;IAC/B,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,iBAAiB;IACtC,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,QAAQ;IAC7B,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,WAAW;IAChC,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,cAAc;IACnC,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,wBAAwB;IAC7C,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,qBAAqB;IAC1C,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,YAAY;IACjC,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,uBAAuB;IAC5C,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,aAAa;CAC1B,CAAC;AAEX,SAAS,YAAY,CACnB,MAAW,EACX,KAAyB,EACzB,qBAA0B,EAC1B,kBAAuB,EACvB,SAAc,EACd,oBAAyB,EACzB,UAAe;IAEf,OAAO,SAAS,CAAC,mBAAmB,CAAC,UAAU,EAAE;QAC/C,MAAM;QACN,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC;QACrB,KAAK,CAAC,cAAc;QACpB,KAAK,CAAC,KAAK;QACX,KAAK,CAAC,QAAQ;QACd,KAAK,CAAC,WAAW;QACjB,qBAAqB;QACrB,kBAAkB;QAClB,SAAS;QACT,oBAAoB;QACpB,UAAU;KACX,CAAC,CAAC,CAAC;AACN,CAAC;AAMD,mFAAmF;AACnF,MAAM,UAAU,aAAa,CAAC,KAAyB;IACrD,OAAO,YAAY,CACjB,sBAAsB,EACtB,KAAK,EACL,KAAK,CAAC,qBAAqB,EAC3B,KAAK,CAAC,kBAAkB,EACxB,KAAK,CAAC,SAAS,EACf,KAAK,CAAC,oBAAoB,EAC1B,KAAK,CAAC,UAAU,CACjB,CAAC;AACJ,CAAC;AAED,+DAA+D;AAC/D,MAAM,UAAU,kBAAkB,CAAC,OAAqB,EAAE,KAAyB;IACjF,OAAO,aAAa,CAAC,EAAE,GAAG,KAAK,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;AACjD,CAAC"}
|
package/dist/signer.d.ts
CHANGED
|
@@ -11,8 +11,8 @@ import type { TypedDataRequest } from "./eip712.js";
|
|
|
11
11
|
export interface SignerDescription {
|
|
12
12
|
/** e.g. `local`, `cdp`, `circle`. */
|
|
13
13
|
provider: string;
|
|
14
|
-
/**
|
|
15
|
-
accountType: "eoa" | "
|
|
14
|
+
/** `eoa` for a plain wallet, `contract` for a deployed contract account. */
|
|
15
|
+
accountType: "eoa" | "contract" | "unknown";
|
|
16
16
|
/** Set when an adapter has not yet passed the §6 conformance suite. */
|
|
17
17
|
conformance?: "verified" | "candidate-pending-conformance";
|
|
18
18
|
}
|
package/dist/signer.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signer.d.ts","sourceRoot":"","sources":["../src/signer.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,MAAM,CAAC;AACzC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAEpD,uDAAuD;AACvD,MAAM,WAAW,iBAAiB;IAChC,qCAAqC;IACrC,QAAQ,EAAE,MAAM,CAAC;IACjB,
|
|
1
|
+
{"version":3,"file":"signer.d.ts","sourceRoot":"","sources":["../src/signer.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,MAAM,CAAC;AACzC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAEpD,uDAAuD;AACvD,MAAM,WAAW,iBAAiB;IAChC,qCAAqC;IACrC,QAAQ,EAAE,MAAM,CAAC;IACjB,4EAA4E;IAC5E,WAAW,EAAE,KAAK,GAAG,UAAU,GAAG,SAAS,CAAC;IAC5C,uEAAuE;IACvE,WAAW,CAAC,EAAE,UAAU,GAAG,+BAA+B,CAAC;CAC5D;AAED;;;;GAIG;AACH,MAAM,WAAW,aAAa;IAC5B,UAAU,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;IAC/B,aAAa,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;IACvD,QAAQ,IAAI,iBAAiB,CAAC;CAC/B;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,aAAa,GACrB;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,aAAa,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,GAAG,CAAC,CAAA;CAAE,CAK9E"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@daski/x402-scheme",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "Composite Exact-EVM client plugin for the modular x402 v2 SDK: wraps the stock handler, adds Daski recipe-order binding, and refuses to sign anything its policy validator has not independently checked.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|