uvd-x402-sdk 2.70.0 → 2.71.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 +12 -2
- package/dist/backend/index.d.mts +35 -3
- package/dist/backend/index.d.ts +35 -3
- package/dist/backend/index.js +8 -1
- package/dist/backend/index.js.map +1 -1
- package/dist/backend/index.mjs +8 -1
- package/dist/backend/index.mjs.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/backend/index.ts +35 -3
package/README.md
CHANGED
|
@@ -959,8 +959,18 @@ const prep = await erc8004.prepareRelayedFeedback({
|
|
|
959
959
|
},
|
|
960
960
|
});
|
|
961
961
|
|
|
962
|
-
// 1. Sign
|
|
963
|
-
|
|
962
|
+
// 1. Sign with the RATER's key. WHICH value you sign depends on HOW you sign
|
|
963
|
+
// it — get this wrong and you produce a well-formed signature that
|
|
964
|
+
// authorises nobody, and the only symptom is `relay_bad_signature`.
|
|
965
|
+
//
|
|
966
|
+
// `prep.digest` already carries the EIP-191 envelope. A raw key signs it as
|
|
967
|
+
// a prehash; a wallet's personal_sign would add the envelope a SECOND time,
|
|
968
|
+
// so wallets sign `prep.signingPayload` instead.
|
|
969
|
+
const signature = await account.sign({ hash: prep.digest! }); // raw key
|
|
970
|
+
// ...or, from a browser wallet:
|
|
971
|
+
// const signature = await walletClient.signMessage({
|
|
972
|
+
// account, message: { raw: prep.signingPayload! },
|
|
973
|
+
// });
|
|
964
974
|
|
|
965
975
|
// 2. Only the first time this rater rates: point their EOA at the delegate.
|
|
966
976
|
const authorization = prep.delegated
|
package/dist/backend/index.d.mts
CHANGED
|
@@ -1463,8 +1463,29 @@ interface PrepareRelayFeedbackResponse {
|
|
|
1463
1463
|
delegate?: string;
|
|
1464
1464
|
/** Registry calldata the rater is authorising, hex-encoded */
|
|
1465
1465
|
data?: string;
|
|
1466
|
-
/**
|
|
1466
|
+
/**
|
|
1467
|
+
* The value the rater's signature must recover against.
|
|
1468
|
+
*
|
|
1469
|
+
* **The EIP-191 envelope is already applied here.** A holder of a raw key
|
|
1470
|
+
* signs this directly as a prehash (viem's `sign({ hash })`, ethers'
|
|
1471
|
+
* `signingKey.sign`). A WALLET must not be handed this value: `personal_sign`
|
|
1472
|
+
* applies the envelope itself, so it gets wrapped twice and recovers an
|
|
1473
|
+
* address that is not the rater. Wallets sign {@link signingPayload}.
|
|
1474
|
+
*/
|
|
1467
1475
|
digest?: string;
|
|
1476
|
+
/**
|
|
1477
|
+
* The same hash with the envelope still OFF — what a wallet signs.
|
|
1478
|
+
*
|
|
1479
|
+
* `keccak256('\x19Ethereum Signed Message:\n32' || signingPayload)` is
|
|
1480
|
+
* exactly {@link digest}, so a client can check the two against each other
|
|
1481
|
+
* rather than rebuilding the preimage from `data`.
|
|
1482
|
+
*
|
|
1483
|
+
* Requires facilitator v1.95.0+. Older facilitators omit it; a client that
|
|
1484
|
+
* needs it should fail loudly rather than fall back to signing `digest`
|
|
1485
|
+
* through a wallet, which produces a well-formed signature that authorises
|
|
1486
|
+
* nobody.
|
|
1487
|
+
*/
|
|
1488
|
+
signingPayload?: string;
|
|
1468
1489
|
/**
|
|
1469
1490
|
* Unix seconds after which the authorisation is void. Short on purpose:
|
|
1470
1491
|
* relaying is permissionless, so a signed authorisation is live in the wild
|
|
@@ -1501,7 +1522,11 @@ interface SubmitRelayFeedbackRequest {
|
|
|
1501
1522
|
deadline: number;
|
|
1502
1523
|
/** The single-use nonce `prepare` returned */
|
|
1503
1524
|
nonce: string;
|
|
1504
|
-
/**
|
|
1525
|
+
/**
|
|
1526
|
+
* The rater's signature. It must recover to `rater` over `digest` — so
|
|
1527
|
+
* either a raw-key prehash signature over `digest`, or a wallet
|
|
1528
|
+
* `personal_sign` over `signingPayload`. Not `personal_sign` over `digest`.
|
|
1529
|
+
*/
|
|
1505
1530
|
signature: string;
|
|
1506
1531
|
/** Required only when `prepare` answered `delegated: false` */
|
|
1507
1532
|
authorization?: RelayAuthorizationParams;
|
|
@@ -2044,7 +2069,14 @@ declare class Erc8004Client {
|
|
|
2044
2069
|
* facilitator pays.
|
|
2045
2070
|
*
|
|
2046
2071
|
* What to do with the answer:
|
|
2047
|
-
* 1.
|
|
2072
|
+
* 1. Produce the rater's signature. **Which value you sign depends on how you
|
|
2073
|
+
* sign it**, and getting it wrong yields a well-formed signature that
|
|
2074
|
+
* authorises nobody:
|
|
2075
|
+
* - raw key: sign `digest` as a **prehash**. It already carries the
|
|
2076
|
+
* EIP-191 envelope.
|
|
2077
|
+
* - wallet: `personal_sign` over `signingPayload`. `personal_sign` adds the
|
|
2078
|
+
* envelope itself, so signing `digest` with it wraps the value TWICE and
|
|
2079
|
+
* recovers a stranger — the only symptom is `relay_bad_signature`.
|
|
2048
2080
|
* 2. If `delegated` is `false`, also produce an EIP-7702 authorization over
|
|
2049
2081
|
* `(chainId, delegate, accountNonce)`.
|
|
2050
2082
|
* 3. Hand both to {@link submitRelayedFeedback} with the SAME feedback
|
package/dist/backend/index.d.ts
CHANGED
|
@@ -1463,8 +1463,29 @@ interface PrepareRelayFeedbackResponse {
|
|
|
1463
1463
|
delegate?: string;
|
|
1464
1464
|
/** Registry calldata the rater is authorising, hex-encoded */
|
|
1465
1465
|
data?: string;
|
|
1466
|
-
/**
|
|
1466
|
+
/**
|
|
1467
|
+
* The value the rater's signature must recover against.
|
|
1468
|
+
*
|
|
1469
|
+
* **The EIP-191 envelope is already applied here.** A holder of a raw key
|
|
1470
|
+
* signs this directly as a prehash (viem's `sign({ hash })`, ethers'
|
|
1471
|
+
* `signingKey.sign`). A WALLET must not be handed this value: `personal_sign`
|
|
1472
|
+
* applies the envelope itself, so it gets wrapped twice and recovers an
|
|
1473
|
+
* address that is not the rater. Wallets sign {@link signingPayload}.
|
|
1474
|
+
*/
|
|
1467
1475
|
digest?: string;
|
|
1476
|
+
/**
|
|
1477
|
+
* The same hash with the envelope still OFF — what a wallet signs.
|
|
1478
|
+
*
|
|
1479
|
+
* `keccak256('\x19Ethereum Signed Message:\n32' || signingPayload)` is
|
|
1480
|
+
* exactly {@link digest}, so a client can check the two against each other
|
|
1481
|
+
* rather than rebuilding the preimage from `data`.
|
|
1482
|
+
*
|
|
1483
|
+
* Requires facilitator v1.95.0+. Older facilitators omit it; a client that
|
|
1484
|
+
* needs it should fail loudly rather than fall back to signing `digest`
|
|
1485
|
+
* through a wallet, which produces a well-formed signature that authorises
|
|
1486
|
+
* nobody.
|
|
1487
|
+
*/
|
|
1488
|
+
signingPayload?: string;
|
|
1468
1489
|
/**
|
|
1469
1490
|
* Unix seconds after which the authorisation is void. Short on purpose:
|
|
1470
1491
|
* relaying is permissionless, so a signed authorisation is live in the wild
|
|
@@ -1501,7 +1522,11 @@ interface SubmitRelayFeedbackRequest {
|
|
|
1501
1522
|
deadline: number;
|
|
1502
1523
|
/** The single-use nonce `prepare` returned */
|
|
1503
1524
|
nonce: string;
|
|
1504
|
-
/**
|
|
1525
|
+
/**
|
|
1526
|
+
* The rater's signature. It must recover to `rater` over `digest` — so
|
|
1527
|
+
* either a raw-key prehash signature over `digest`, or a wallet
|
|
1528
|
+
* `personal_sign` over `signingPayload`. Not `personal_sign` over `digest`.
|
|
1529
|
+
*/
|
|
1505
1530
|
signature: string;
|
|
1506
1531
|
/** Required only when `prepare` answered `delegated: false` */
|
|
1507
1532
|
authorization?: RelayAuthorizationParams;
|
|
@@ -2044,7 +2069,14 @@ declare class Erc8004Client {
|
|
|
2044
2069
|
* facilitator pays.
|
|
2045
2070
|
*
|
|
2046
2071
|
* What to do with the answer:
|
|
2047
|
-
* 1.
|
|
2072
|
+
* 1. Produce the rater's signature. **Which value you sign depends on how you
|
|
2073
|
+
* sign it**, and getting it wrong yields a well-formed signature that
|
|
2074
|
+
* authorises nobody:
|
|
2075
|
+
* - raw key: sign `digest` as a **prehash**. It already carries the
|
|
2076
|
+
* EIP-191 envelope.
|
|
2077
|
+
* - wallet: `personal_sign` over `signingPayload`. `personal_sign` adds the
|
|
2078
|
+
* envelope itself, so signing `digest` with it wraps the value TWICE and
|
|
2079
|
+
* recovers a stranger — the only symptom is `relay_bad_signature`.
|
|
2048
2080
|
* 2. If `delegated` is `false`, also produce an EIP-7702 authorization over
|
|
2049
2081
|
* `(chainId, delegate, accountNonce)`.
|
|
2050
2082
|
* 3. Hand both to {@link submitRelayedFeedback} with the SAME feedback
|
package/dist/backend/index.js
CHANGED
|
@@ -2903,7 +2903,14 @@ var Erc8004Client = class {
|
|
|
2903
2903
|
* facilitator pays.
|
|
2904
2904
|
*
|
|
2905
2905
|
* What to do with the answer:
|
|
2906
|
-
* 1.
|
|
2906
|
+
* 1. Produce the rater's signature. **Which value you sign depends on how you
|
|
2907
|
+
* sign it**, and getting it wrong yields a well-formed signature that
|
|
2908
|
+
* authorises nobody:
|
|
2909
|
+
* - raw key: sign `digest` as a **prehash**. It already carries the
|
|
2910
|
+
* EIP-191 envelope.
|
|
2911
|
+
* - wallet: `personal_sign` over `signingPayload`. `personal_sign` adds the
|
|
2912
|
+
* envelope itself, so signing `digest` with it wraps the value TWICE and
|
|
2913
|
+
* recovers a stranger — the only symptom is `relay_bad_signature`.
|
|
2907
2914
|
* 2. If `delegated` is `false`, also produce an EIP-7702 authorization over
|
|
2908
2915
|
* `(chainId, delegate, accountNonce)`.
|
|
2909
2916
|
* 3. Hand both to {@link submitRelayedFeedback} with the SAME feedback
|