@orangecheck/me-client 0.52.0 → 0.53.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/CHANGELOG.md CHANGED
@@ -8,6 +8,18 @@ and [Semantic Versioning](https://semver.org/). Wire-format / canonical-message
8
8
  changes are coordinated via the relevant `oc-*-protocol` spec repo's CHANGELOG;
9
9
  this file tracks the package's TS / Node / runtime API surface.
10
10
 
11
+ ## [0.53.0] — 2026-10-25
12
+
13
+ ### Changed
14
+
15
+ - `requireBond` throws a TypeError when `withOcAuth`, `ocAuthExpress`,
16
+ `ocAuthHono`, `checkOcSession` or `checkSignInRule` is given one whose
17
+ `minSats`, `minDays` or `maxAgeSecs` is not left out or a whole number of 0
18
+ or more: NaN (an unset env var read with `Number()`), a string, a fraction or
19
+ null. `bondMeets`, from auth-core ^2.24.0, is false for such a floor.
20
+ `readBondNeed` is exported beside it. Held to auth-core's
21
+ `test-vectors/bond-need.json`.
22
+
11
23
  ## [0.52.0] — 2026-10-25
12
24
 
13
25
  ### Changed
package/README.md CHANGED
@@ -101,7 +101,7 @@ export default withOcAuth(handler, {
101
101
  });
102
102
  ```
103
103
 
104
- Or set it in code with `requireBond: { minSats: 100_000, minDays: 30, maxAgeSecs: 3600 }`. ochk.io re-checks the coin when its last check is over ten minutes old; `maxAgeSecs` refuses a claim checked longer ago than you accept. From 0.28.0, an account below the floor gets `403 { ok: false, reason: 'bond_required', need: { min_sats, min_days }, have: { sats_floor, days_floor } | null, back_url }`: link the person to `back_url` to back their account. If the project's setting can't be read, the last one read stands for ten minutes; with none read in that time, a signed-in request gets `503 { reason: 'bond_policy_unavailable' }` rather than being let through unchecked. A request with no session is not held to the project's setting and never waits on it (0.37.0); pass `required: true` to answer it 401. `readBondClaim(session)` and `bondMeets(session, { minSats, minDays, maxAgeSecs })` are exported for your own checks.
104
+ Or set it in code with `requireBond: { minSats: 100_000, minDays: 30, maxAgeSecs: 3600 }`. ochk.io re-checks the coin when its last check is over ten minutes old; `maxAgeSecs` refuses a claim checked longer ago than you accept. Each value is left out or a whole number of 0 or more; anything else (NaN from an unset env var, a string, a fraction) throws when the adapter is made. From 0.28.0, an account below the floor gets `403 { ok: false, reason: 'bond_required', need: { min_sats, min_days }, have: { sats_floor, days_floor } | null, back_url }`: link the person to `back_url` to back their account. If the project's setting can't be read, the last one read stands for ten minutes; with none read in that time, a signed-in request gets `503 { reason: 'bond_policy_unavailable' }` rather than being let through unchecked. A request with no session is not held to the project's setting and never waits on it (0.37.0); pass `required: true` to answer it 401. `readBondClaim(session)` and `bondMeets(session, { minSats, minDays, maxAgeSecs })` are exported for your own checks.
105
105
 
106
106
  `verifyOcToken` and `checkOcToken` check the token alone, not the rule. Where you verify it yourself, apply the rule with one call in the route that starts your own session (0.43.0). It reads and holds the rule as `withOcAuth` does and answers with the same status and body:
107
107
 
package/dist/server.d.mts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { RevocationCheck, SessionPayload, VerifyOcOptions, SessionRequestHeaders } from '@orangecheck/auth-core';
2
- export { BondClaim, SessionPayload, VerifyOcOptions, bondMeets, readBondClaim } from '@orangecheck/auth-core';
2
+ export { BondClaim, SessionPayload, VerifyOcOptions, bondMeets, readBondClaim, readBondNeed } from '@orangecheck/auth-core';
3
3
  export { A as ActivityAttestation, a as ActivityAttestationBundle, b as ActivityVerifyCheck, c as ActivityVerifyResult, V as VerifyActivityOptions, i as identity, r as refreshEnvelopeJwks, v as verifyActivityAttestation } from './identity-DfxCvxuH.mjs';
4
4
  export { CONNECT_CONSENT_BLURB, CONNECT_CONSENT_LABEL } from './connect-consent.mjs';
5
5
 
package/dist/server.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { RevocationCheck, SessionPayload, VerifyOcOptions, SessionRequestHeaders } from '@orangecheck/auth-core';
2
- export { BondClaim, SessionPayload, VerifyOcOptions, bondMeets, readBondClaim } from '@orangecheck/auth-core';
2
+ export { BondClaim, SessionPayload, VerifyOcOptions, bondMeets, readBondClaim, readBondNeed } from '@orangecheck/auth-core';
3
3
  export { A as ActivityAttestation, a as ActivityAttestationBundle, b as ActivityVerifyCheck, c as ActivityVerifyResult, V as VerifyActivityOptions, i as identity, r as refreshEnvelopeJwks, v as verifyActivityAttestation } from './identity-DfxCvxuH.js';
4
4
  export { CONNECT_CONSENT_BLURB, CONNECT_CONSENT_LABEL } from './connect-consent.js';
5
5
 
package/dist/server.js CHANGED
@@ -1168,6 +1168,11 @@ function checkOptions(options) {
1168
1168
  `@orangecheck/me-client: requireBond: unknown option ${extra.join(", ")}. It reads only ${[...BOND_OPTIONS].join(", ")}.`
1169
1169
  );
1170
1170
  }
1171
+ if (!authCore.readBondNeed(bond)) {
1172
+ throw new TypeError(
1173
+ "@orangecheck/me-client: requireBond: minSats, minDays and maxAgeSecs must each be left out or a whole number of 0 or more"
1174
+ );
1175
+ }
1171
1176
  }
1172
1177
  var BACK_ACCOUNT_URL = "https://ochk.app/me/account#backing";
1173
1178
  var stamp = () => ({ mono: performance.now(), wall: Date.now() });
@@ -1368,6 +1373,10 @@ Object.defineProperty(exports, "readBondClaim", {
1368
1373
  enumerable: true,
1369
1374
  get: function () { return authCore.readBondClaim; }
1370
1375
  });
1376
+ Object.defineProperty(exports, "readBondNeed", {
1377
+ enumerable: true,
1378
+ get: function () { return authCore.readBondNeed; }
1379
+ });
1371
1380
  exports.BACK_ACCOUNT_URL = BACK_ACCOUNT_URL;
1372
1381
  exports.CONNECT_CONSENT_BLURB = CONNECT_CONSENT_BLURB;
1373
1382
  exports.CONNECT_CONSENT_LABEL = CONNECT_CONSENT_LABEL;