insumer-verify 1.3.3 → 1.3.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/README.md +36 -2
- package/build/index.d.ts +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -22,7 +22,7 @@ curl -s -X POST https://us-central1-insumer-merchant.cloudfunctions.net/createDe
|
|
|
22
22
|
-d '{"email": "you@example.com", "appName": "insumer-verify", "tier": "free"}' | jq .
|
|
23
23
|
```
|
|
24
24
|
|
|
25
|
-
Returns an `insr_live_...` key with
|
|
25
|
+
Returns an `insr_live_...` key with 10 credits and 100 calls/day. One free key per email.
|
|
26
26
|
|
|
27
27
|
Or get one at [insumermodel.com/developers](https://insumermodel.com/developers/).
|
|
28
28
|
|
|
@@ -119,6 +119,40 @@ The attestation response you're verifying looks like this:
|
|
|
119
119
|
|
|
120
120
|
No balances. No amounts. Just a signed true/false per condition.
|
|
121
121
|
|
|
122
|
+
#### XRPL-specific fields
|
|
123
|
+
|
|
124
|
+
XRPL attestation results use `ledgerIndex` (integer) and `ledgerHash` (string) instead of `blockNumber` and `blockTimestamp`:
|
|
125
|
+
|
|
126
|
+
```json
|
|
127
|
+
{
|
|
128
|
+
"condition": 0,
|
|
129
|
+
"met": true,
|
|
130
|
+
"label": "RLUSD >= 100 on XRPL",
|
|
131
|
+
"type": "token_balance",
|
|
132
|
+
"chainId": "xrpl",
|
|
133
|
+
"evaluatedCondition": {
|
|
134
|
+
"type": "token_balance",
|
|
135
|
+
"chainId": "xrpl",
|
|
136
|
+
"currency": "524C555344...",
|
|
137
|
+
"issuer": "rMxCKbEDwqr76QuheSUMdEGf4B9xJ8m5De",
|
|
138
|
+
"operator": "gte",
|
|
139
|
+
"threshold": 100,
|
|
140
|
+
"decimals": 6
|
|
141
|
+
},
|
|
142
|
+
"conditionHash": "0x9f2c...",
|
|
143
|
+
"ledgerIndex": 96482715,
|
|
144
|
+
"ledgerHash": "A1B2C3D4..."
|
|
145
|
+
}
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
Trust line token conditions may also include `trustLineState` with a `frozen` boolean indicating whether the trust line is frozen:
|
|
149
|
+
|
|
150
|
+
```json
|
|
151
|
+
"trustLineState": { "frozen": false }
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
Because XRPL results have no `blockTimestamp`, the freshness check (`maxAge`) skips them rather than failing. Condition hash and signature checks work identically across all chains.
|
|
155
|
+
|
|
122
156
|
### Handling `rpc_failure` errors
|
|
123
157
|
|
|
124
158
|
If the API cannot reach one or more data sources (RPC nodes, Helius, XRPL, Covalent) after retries, it returns `ok: false` with error code `rpc_failure` instead of issuing an attestation. **No signature, no JWT, no credits charged.** This is a retryable error — retry the same request after a short delay (2-5 seconds).
|
|
@@ -177,7 +211,7 @@ const result = await verifyAttestation(apiResponse, { maxAge: 120 });
|
|
|
177
211
|
// Fails if any blockTimestamp is older than 120 seconds
|
|
178
212
|
```
|
|
179
213
|
|
|
180
|
-
Results without `blockTimestamp` (Covalent, Solana, and XRPL chains) are skipped, not treated as failures.
|
|
214
|
+
Results without `blockTimestamp` (Covalent, Solana, and XRPL chains) are skipped, not treated as failures. XRPL results use `ledgerIndex` and `ledgerHash` instead.
|
|
181
215
|
|
|
182
216
|
### JWKS key discovery
|
|
183
217
|
|
package/build/index.d.ts
CHANGED
|
@@ -25,7 +25,7 @@ export interface CheckResult {
|
|
|
25
25
|
reason?: string;
|
|
26
26
|
}
|
|
27
27
|
export interface VerifyOptions {
|
|
28
|
-
/** Maximum acceptable age of blockTimestamp in seconds. Results without blockTimestamp are skipped. */
|
|
28
|
+
/** Maximum acceptable age of blockTimestamp in seconds. Results without blockTimestamp (e.g. XRPL, which uses ledgerIndex/ledgerHash instead) are skipped. */
|
|
29
29
|
maxAge?: number;
|
|
30
30
|
/** JWKS URL for dynamic key discovery. When set, fetches the signing key from this URL instead of using the hardcoded key. Example: "https://insumermodel.com/.well-known/jwks.json" */
|
|
31
31
|
jwksUrl?: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "insumer-verify",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.5",
|
|
4
4
|
"description": "Client-side verifier for InsumerAPI attestations. ECDSA P-256 signatures, condition hashes, block freshness, expiry. Zero dependencies. Used by DJD Agent Score (Coinbase x402).",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "build/index.js",
|