@orangecheck/me-client 0.51.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/dist/server.mjs CHANGED
@@ -1,5 +1,6 @@
1
- import { verifyOcToken as verifyOcToken$1, checkOcToken as checkOcToken$1, readOcSessionToken, SAFE_METHODS, familyRevocationCheck, integratorRevocationCheck, bondMeets, readBondClaim } from '@orangecheck/auth-core';
2
- export { bondMeets, readBondClaim } from '@orangecheck/auth-core';
1
+ import { verifyOcToken as verifyOcToken$1, checkOcToken as checkOcToken$1, readOcSessionToken, SAFE_METHODS, readBondNeed, familyRevocationCheck, integratorRevocationCheck, bondMeets, readBondClaim } from '@orangecheck/auth-core';
2
+ export { bondMeets, readBondClaim, readBondNeed } from '@orangecheck/auth-core';
3
+ import { isDidOc } from '@orangecheck/auth-core/identifiers';
3
4
 
4
5
  var __defProp = Object.defineProperty;
5
6
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
@@ -567,12 +568,9 @@ var identity = {
567
568
  verifyActivityAttestation,
568
569
  refreshEnvelopeJwks
569
570
  };
570
-
571
- // src/connect.ts
572
571
  var ORIGIN = "https://ochk.io";
573
572
  var DEFAULT_TIMEOUT_MS = 5e3;
574
573
  var MAX_TIMEOUT_MS = 3e4;
575
- var DID_OC = /^did:oc:[0-9a-f]{32}$/;
576
574
  var BASE_KEYS = ["apiKey", "userId", "timeoutMs"];
577
575
  var PROVISION_KEYS = /* @__PURE__ */ new Set([...BASE_KEYS, "consent", "email", "emailVerified"]);
578
576
  var USER_KEYS = new Set(BASE_KEYS);
@@ -689,7 +687,7 @@ function connectProvision(options) {
689
687
  (answer) => {
690
688
  const b = answer.body;
691
689
  if (answer.status !== 200) return refused(answer, PROVISION_REASONS);
692
- const good = b?.ok === true && typeof b.did_oc === "string" && DID_OC.test(b.did_oc) && typeof b.is_new === "boolean";
690
+ const good = b?.ok === true && isDidOc(b.did_oc) && typeof b.is_new === "boolean";
693
691
  return good ? { ok: true, did_oc: b.did_oc, is_new: b.is_new } : { ok: false, reason: "unavailable", status: 200 };
694
692
  }
695
693
  );
@@ -1169,6 +1167,11 @@ function checkOptions(options) {
1169
1167
  `@orangecheck/me-client: requireBond: unknown option ${extra.join(", ")}. It reads only ${[...BOND_OPTIONS].join(", ")}.`
1170
1168
  );
1171
1169
  }
1170
+ if (!readBondNeed(bond)) {
1171
+ throw new TypeError(
1172
+ "@orangecheck/me-client: requireBond: minSats, minDays and maxAgeSecs must each be left out or a whole number of 0 or more"
1173
+ );
1174
+ }
1172
1175
  }
1173
1176
  var BACK_ACCOUNT_URL = "https://ochk.app/me/account#backing";
1174
1177
  var stamp = () => ({ mono: performance.now(), wall: Date.now() });