@insumermodel/mppx-condition-gate 3.1.1 → 3.1.3

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.
Files changed (3) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +12 -3
  3. package/package.json +4 -4
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 douglasborthwick-crypto
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -21,7 +21,7 @@ The signed attestation is verifiable offline via [JWKS](https://insumermodel.com
21
21
 
22
22
  ### Why you must supply the payer
23
23
 
24
- mppx credentials carry an optional `source` DID, but mppx documents it as *"an asserted identity, not independent proof of control"* — it is a claim by the caller, not a proof. Versions before 3.0.0 granted free access on it, which let anyone name a qualifying wallet and skip payment ([GHSA-jg6q-3qfh-r9f8](https://github.com/douglasborthwick-crypto/mppx-condition-gate/security/advisories/GHSA-jg6q-3qfh-r9f8)). The gate now refuses to guess.
24
+ mppx credentials carry an optional `source` DID, but mppx documents it as *"an asserted identity, not independent proof of control"* — it is a claim by the caller, not a proof. Versions before 3.0.0 granted free access on it, which let anyone name a qualifying wallet and skip payment ([GHSA-jg6q-3qfh-r9f8](https://github.com/insumerapi/mppx-condition-gate/security/advisories/GHSA-jg6q-3qfh-r9f8)). The gate now refuses to guess.
25
25
 
26
26
  `provenPayer` receives **only** the validation `details` — never the credential and never `source` — so the unproven identity is not reachable from it. Return a payer only if the payment method has actually established control of it. **Every path that cannot justify free access falls through to payment:** no resolver, no `validate` hook on the method, a resolver returning `null` or throwing, a credential that fails validation, conditions not met, or an attestation error.
27
27
 
@@ -230,7 +230,7 @@ curl -X POST https://api.insumermodel.com/v1/keys/create \
230
230
 
231
231
  Either way, set `INSUMER_API_KEY` as an environment variable in your runtime.
232
232
 
233
- **Top up** an existing key on-chain via `POST /v1/credits/buy`. Accepted: USDC or USDT on any major EVM chain, USDC on Solana, or BTC on Bitcoin. See the [credits endpoint](https://insumermodel.com/developers/api-reference/) for transaction format.
233
+ **Top up** an existing key on-chain via `POST /v1/credits/buy`. Accepted: USDC or USDT on Ethereum (1), Base (8453), Polygon (137), Arbitrum (42161), Optimism (10), BNB Chain (56), or Avalanche (43114); USDC or USDT on Solana; BTC on Bitcoin; or USDT (TRC-20) on Tron. See the [credits endpoint](https://insumermodel.com/developers/api-reference/) for transaction format.
234
234
 
235
235
  **Pricing model**: the wallet holder pays nothing at the gated route. The operator running the gate pays per attestation call out of the key's credit balance. Cost per attestation depends on tier and condition mix.
236
236
 
@@ -268,6 +268,15 @@ if (receipt.reference.startsWith('condition-gate:free:')) {
268
268
  }
269
269
  ```
270
270
 
271
+ The same check applies on the server. mppx reports a free grant through its `payment.success` event (`onPaymentSuccess`), because the gate returns a successful receipt. If you count revenue or log payments from that event, read `receipt.reference` first: a reference starting with `condition-gate:free:` means access was granted and no money moved.
272
+
273
+ ```ts
274
+ mppx.onPaymentSuccess(({ receipt }) => {
275
+ if (receipt.reference.startsWith('condition-gate:free:')) return // free access, nothing settled
276
+ recordPayment(receipt)
277
+ })
278
+ ```
279
+
271
280
  ## When the API is unreachable
272
281
 
273
282
  If the attestation API is unreachable, the adapter falls through to the original payment method. Wallets that would have qualified for free access pay normally; everyone else is unaffected.
@@ -300,7 +309,7 @@ The `parsXrplDid` typo from v1 is fixed: use `parseXrplDid`. The cache helper re
300
309
 
301
310
  ## Migrating from 2.x (security release)
302
311
 
303
- 3.0.0 fixes an authentication bypass ([GHSA-jg6q-3qfh-r9f8](https://github.com/douglasborthwick-crypto/mppx-condition-gate/security/advisories/GHSA-jg6q-3qfh-r9f8)). All 2.x versions, and all versions of the predecessor `@insumermodel/mppx-token-gate`, are affected.
312
+ 3.0.0 fixes an authentication bypass ([GHSA-jg6q-3qfh-r9f8](https://github.com/insumerapi/mppx-condition-gate/security/advisories/GHSA-jg6q-3qfh-r9f8)). All 2.x versions, and all versions of the predecessor `@insumermodel/mppx-token-gate`, are affected.
304
313
 
305
314
  Add a `provenPayer` resolver:
306
315
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@insumermodel/mppx-condition-gate",
3
- "version": "3.1.1",
3
+ "version": "3.1.3",
4
4
  "description": "Condition-based access for mppx routes. Wallet auth via signed attestations. Six condition types: token balance, NFT ownership, EAS attestation, Farcaster ID, ratio_to_amount, ratio_to_supply.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -42,15 +42,15 @@
42
42
  "license": "MIT",
43
43
  "repository": {
44
44
  "type": "git",
45
- "url": "git+https://github.com/douglasborthwick-crypto/mppx-condition-gate.git"
45
+ "url": "git+https://github.com/insumerapi/mppx-condition-gate.git"
46
46
  },
47
47
  "peerDependencies": {
48
48
  "mppx": ">=0.8.14"
49
49
  },
50
50
  "devDependencies": {
51
51
  "@types/node": "^25.5.0",
52
- "mppx": "0.9.3",
52
+ "mppx": "0.13.1",
53
53
  "typescript": "^5.7.0",
54
- "viem": "2.56.5"
54
+ "viem": "2.57.2"
55
55
  }
56
56
  }