@orangecheck/me-client 0.44.0 → 0.45.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
@@ -836,6 +836,25 @@ async function post2(url, tokens, timeoutMs) {
836
836
  }
837
837
  }
838
838
 
839
+ // src/merged.ts
840
+ var MERGED_HANDLES_MAX = 16;
841
+ function mergedHandles(session) {
842
+ const v = session.merged_rh;
843
+ if (!Array.isArray(v) || v.length > MERGED_HANDLES_MAX) return [];
844
+ if (!v.every((h) => typeof h === "string" && h.length > 0)) return [];
845
+ return [...new Set(v)];
846
+ }
847
+ async function matchMergedUser(session, lookup) {
848
+ const users = /* @__PURE__ */ new Set();
849
+ for (const rh of mergedHandles(session)) {
850
+ const user = await lookup(rh);
851
+ if (typeof user === "string" && user.length > 0) users.add(user);
852
+ }
853
+ if (users.size === 0) return { kind: "none" };
854
+ if (users.size === 1) return { kind: "one", user: [...users][0] };
855
+ return { kind: "conflict", users: [...users].sort() };
856
+ }
857
+
839
858
  // src/server.ts
840
859
  var VERIFIED = /* @__PURE__ */ new WeakSet();
841
860
  function vouch(session) {
@@ -1220,6 +1239,6 @@ function ocAuthHono(options = {}) {
1220
1239
  };
1221
1240
  }
1222
1241
 
1223
- export { BACK_ACCOUNT_URL, CONNECT_CONSENT_BLURB, CONNECT_CONSENT_LABEL, MemoryJtiStore, _resetSessionChecksForTests, checkOcSession, checkOcToken, checkSignInRule, connectClaimLink, connectDelete, connectProvision, getOcSession, identity, ocAuthExpress, ocAuthHono, refreshEnvelopeJwks, revokeToken, spendOnce, verifyActivityAttestation, verifyOcToken, withOcAuth };
1242
+ export { BACK_ACCOUNT_URL, CONNECT_CONSENT_BLURB, CONNECT_CONSENT_LABEL, MemoryJtiStore, _resetSessionChecksForTests, checkOcSession, checkOcToken, checkSignInRule, connectClaimLink, connectDelete, connectProvision, getOcSession, identity, matchMergedUser, mergedHandles, ocAuthExpress, ocAuthHono, refreshEnvelopeJwks, revokeToken, spendOnce, verifyActivityAttestation, verifyOcToken, withOcAuth };
1224
1243
  //# sourceMappingURL=server.mjs.map
1225
1244
  //# sourceMappingURL=server.mjs.map