@arbidocs/client 0.4.158 → 0.4.160
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/index.cjs +24 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +221 -18
- package/dist/index.d.ts +221 -18
- package/dist/index.js +24 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1462,6 +1462,29 @@ async function changePassword(params, deps) {
|
|
|
1462
1462
|
return { wrappedIdentityKey: request.wrapped_identity_key };
|
|
1463
1463
|
}
|
|
1464
1464
|
|
|
1465
|
+
// src/auth/session-claims.ts
|
|
1466
|
+
function readSessionClaims(token) {
|
|
1467
|
+
const payload = token?.split(".")[1];
|
|
1468
|
+
if (!payload) return null;
|
|
1469
|
+
let claims;
|
|
1470
|
+
try {
|
|
1471
|
+
const binary = atob(payload.replace(/-/g, "+").replace(/_/g, "/"));
|
|
1472
|
+
claims = JSON.parse(
|
|
1473
|
+
new TextDecoder().decode(Uint8Array.from(binary, (c) => c.charCodeAt(0)))
|
|
1474
|
+
);
|
|
1475
|
+
} catch {
|
|
1476
|
+
return null;
|
|
1477
|
+
}
|
|
1478
|
+
if (typeof claims !== "object" || claims === null) return null;
|
|
1479
|
+
const { sk, exp } = claims;
|
|
1480
|
+
const sessionKey = typeof sk === "string" && sk ? sk : null;
|
|
1481
|
+
return {
|
|
1482
|
+
sessionKey,
|
|
1483
|
+
sessionId: sessionKey ? sessionKey.slice(0, 12) : null,
|
|
1484
|
+
expiresAt: typeof exp === "number" && Number.isFinite(exp) ? exp * 1e3 : null
|
|
1485
|
+
};
|
|
1486
|
+
}
|
|
1487
|
+
|
|
1465
1488
|
// src/client.ts
|
|
1466
1489
|
var API_PREFIX = "/v1";
|
|
1467
1490
|
var RETRYABLE_CODES = /* @__PURE__ */ new Set([
|
|
@@ -1782,6 +1805,7 @@ exports.parseRecoveryUrl = parseRecoveryUrl;
|
|
|
1782
1805
|
exports.parseServerMessage = parseServerMessage;
|
|
1783
1806
|
exports.passwordChangeErrorMessage = passwordChangeErrorMessage;
|
|
1784
1807
|
exports.prewarmKeyPairs = prewarmKeyPairs;
|
|
1808
|
+
exports.readSessionClaims = readSessionClaims;
|
|
1785
1809
|
exports.saveSession = saveSession;
|
|
1786
1810
|
exports.sealCallKey = sealCallKey;
|
|
1787
1811
|
exports.sealChatKey = sealChatKey;
|