@sylphx/sdk 0.27.0 → 0.28.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/README.md +47 -2
- package/dist/connect.d.ts +2838 -0
- package/dist/connect.mjs +220 -0
- package/dist/connect.mjs.map +1 -0
- package/dist/index.d.ts +24380 -2217
- package/dist/index.mjs +30821 -2778
- package/dist/index.mjs.map +1 -1
- package/dist/nextjs/index.mjs +29 -26
- package/dist/nextjs/index.mjs.map +1 -1
- package/dist/react/index.d.ts +38 -1140
- package/dist/react/index.mjs +959 -2632
- package/dist/react/index.mjs.map +1 -1
- package/dist/server/index.d.ts +21 -38
- package/dist/server/index.mjs +27 -27
- package/dist/server/index.mjs.map +1 -1
- package/dist/web-analytics.mjs +1 -1
- package/dist/web-analytics.mjs.map +1 -1
- package/package.json +11 -5
- package/dist/tasks.d.ts +0 -1463
- package/dist/tasks.mjs +0 -1907
- package/dist/tasks.mjs.map +0 -1
package/dist/nextjs/index.mjs
CHANGED
|
@@ -202,7 +202,7 @@ function detectSdkPlatform() {
|
|
|
202
202
|
}
|
|
203
203
|
var SDK_PLATFORM = detectSdkPlatform();
|
|
204
204
|
var TOKEN_EXPIRY_BUFFER_MS = 3e4;
|
|
205
|
-
var SESSION_TOKEN_LIFETIME_SECONDS =
|
|
205
|
+
var SESSION_TOKEN_LIFETIME_SECONDS = 60 * 60;
|
|
206
206
|
var SESSION_TOKEN_LIFETIME_MS = SESSION_TOKEN_LIFETIME_SECONDS * 1e3;
|
|
207
207
|
var REFRESH_TOKEN_LIFETIME_SECONDS = 30 * 24 * 60 * 60;
|
|
208
208
|
var FLAGS_CACHE_TTL_MS = 5 * 60 * 1e3;
|
|
@@ -552,7 +552,7 @@ import {
|
|
|
552
552
|
PLATFORM_CONSOLE_SLUG
|
|
553
553
|
} from "@sylphx/contract";
|
|
554
554
|
|
|
555
|
-
//
|
|
555
|
+
// ../../node_modules/.bun/jose@6.1.3/node_modules/jose/dist/webapi/lib/buffer_utils.js
|
|
556
556
|
var encoder = new TextEncoder();
|
|
557
557
|
var decoder = new TextDecoder();
|
|
558
558
|
var MAX_INT32 = 2 ** 32;
|
|
@@ -578,7 +578,7 @@ function encode(string) {
|
|
|
578
578
|
return bytes;
|
|
579
579
|
}
|
|
580
580
|
|
|
581
|
-
//
|
|
581
|
+
// ../../node_modules/.bun/jose@6.1.3/node_modules/jose/dist/webapi/lib/base64.js
|
|
582
582
|
function decodeBase64(encoded) {
|
|
583
583
|
if (Uint8Array.fromBase64) {
|
|
584
584
|
return Uint8Array.fromBase64(encoded);
|
|
@@ -591,7 +591,7 @@ function decodeBase64(encoded) {
|
|
|
591
591
|
return bytes;
|
|
592
592
|
}
|
|
593
593
|
|
|
594
|
-
//
|
|
594
|
+
// ../../node_modules/.bun/jose@6.1.3/node_modules/jose/dist/webapi/util/base64url.js
|
|
595
595
|
function decode(input) {
|
|
596
596
|
if (Uint8Array.fromBase64) {
|
|
597
597
|
return Uint8Array.fromBase64(typeof input === "string" ? input : decoder.decode(input), {
|
|
@@ -610,7 +610,7 @@ function decode(input) {
|
|
|
610
610
|
}
|
|
611
611
|
}
|
|
612
612
|
|
|
613
|
-
//
|
|
613
|
+
// ../../node_modules/.bun/jose@6.1.3/node_modules/jose/dist/webapi/util/errors.js
|
|
614
614
|
var JOSEError = class extends Error {
|
|
615
615
|
static code = "ERR_JOSE_GENERIC";
|
|
616
616
|
code = "ERR_JOSE_GENERIC";
|
|
@@ -670,7 +670,7 @@ var JWSSignatureVerificationFailed = class extends JOSEError {
|
|
|
670
670
|
}
|
|
671
671
|
};
|
|
672
672
|
|
|
673
|
-
//
|
|
673
|
+
// ../../node_modules/.bun/jose@6.1.3/node_modules/jose/dist/webapi/lib/crypto_key.js
|
|
674
674
|
var unusable = (name, prop = "algorithm.name") => new TypeError(`CryptoKey does not support this operation, its ${prop} must be ${name}`);
|
|
675
675
|
var isAlgorithm = (algorithm, name) => algorithm.name === name;
|
|
676
676
|
function getHashLength(hash) {
|
|
@@ -758,7 +758,7 @@ function checkSigCryptoKey(key, alg, usage) {
|
|
|
758
758
|
checkUsage(key, usage);
|
|
759
759
|
}
|
|
760
760
|
|
|
761
|
-
//
|
|
761
|
+
// ../../node_modules/.bun/jose@6.1.3/node_modules/jose/dist/webapi/lib/invalid_key_input.js
|
|
762
762
|
function message(msg, actual, ...types) {
|
|
763
763
|
types = types.filter(Boolean);
|
|
764
764
|
if (types.length > 2) {
|
|
@@ -783,7 +783,7 @@ function message(msg, actual, ...types) {
|
|
|
783
783
|
var invalidKeyInput = (actual, ...types) => message("Key must be ", actual, ...types);
|
|
784
784
|
var withAlg = (alg, actual, ...types) => message(`Key for the ${alg} algorithm must be `, actual, ...types);
|
|
785
785
|
|
|
786
|
-
//
|
|
786
|
+
// ../../node_modules/.bun/jose@6.1.3/node_modules/jose/dist/webapi/lib/is_key_like.js
|
|
787
787
|
var isCryptoKey = (key) => {
|
|
788
788
|
if (key?.[Symbol.toStringTag] === "CryptoKey")
|
|
789
789
|
return true;
|
|
@@ -796,7 +796,7 @@ var isCryptoKey = (key) => {
|
|
|
796
796
|
var isKeyObject = (key) => key?.[Symbol.toStringTag] === "KeyObject";
|
|
797
797
|
var isKeyLike = (key) => isCryptoKey(key) || isKeyObject(key);
|
|
798
798
|
|
|
799
|
-
//
|
|
799
|
+
// ../../node_modules/.bun/jose@6.1.3/node_modules/jose/dist/webapi/lib/is_disjoint.js
|
|
800
800
|
function isDisjoint(...headers) {
|
|
801
801
|
const sources = headers.filter(Boolean);
|
|
802
802
|
if (sources.length === 0 || sources.length === 1) {
|
|
@@ -819,7 +819,7 @@ function isDisjoint(...headers) {
|
|
|
819
819
|
return true;
|
|
820
820
|
}
|
|
821
821
|
|
|
822
|
-
//
|
|
822
|
+
// ../../node_modules/.bun/jose@6.1.3/node_modules/jose/dist/webapi/lib/is_object.js
|
|
823
823
|
var isObjectLike = (value) => typeof value === "object" && value !== null;
|
|
824
824
|
function isObject(input) {
|
|
825
825
|
if (!isObjectLike(input) || Object.prototype.toString.call(input) !== "[object Object]") {
|
|
@@ -835,7 +835,7 @@ function isObject(input) {
|
|
|
835
835
|
return Object.getPrototypeOf(input) === proto;
|
|
836
836
|
}
|
|
837
837
|
|
|
838
|
-
//
|
|
838
|
+
// ../../node_modules/.bun/jose@6.1.3/node_modules/jose/dist/webapi/lib/check_key_length.js
|
|
839
839
|
function checkKeyLength(alg, key) {
|
|
840
840
|
if (alg.startsWith("RS") || alg.startsWith("PS")) {
|
|
841
841
|
const { modulusLength } = key.algorithm;
|
|
@@ -845,7 +845,7 @@ function checkKeyLength(alg, key) {
|
|
|
845
845
|
}
|
|
846
846
|
}
|
|
847
847
|
|
|
848
|
-
//
|
|
848
|
+
// ../../node_modules/.bun/jose@6.1.3/node_modules/jose/dist/webapi/lib/jwk_to_key.js
|
|
849
849
|
function subtleMapping(jwk) {
|
|
850
850
|
let algorithm;
|
|
851
851
|
let keyUsages;
|
|
@@ -955,7 +955,7 @@ async function jwkToKey(jwk) {
|
|
|
955
955
|
return crypto.subtle.importKey("jwk", keyData, algorithm, jwk.ext ?? (jwk.d || jwk.priv ? false : true), jwk.key_ops ?? keyUsages);
|
|
956
956
|
}
|
|
957
957
|
|
|
958
|
-
//
|
|
958
|
+
// ../../node_modules/.bun/jose@6.1.3/node_modules/jose/dist/webapi/key/import.js
|
|
959
959
|
async function importJWK(jwk, alg, options) {
|
|
960
960
|
if (!isObject(jwk)) {
|
|
961
961
|
throw new TypeError("JWK must be an object");
|
|
@@ -991,7 +991,7 @@ async function importJWK(jwk, alg, options) {
|
|
|
991
991
|
}
|
|
992
992
|
}
|
|
993
993
|
|
|
994
|
-
//
|
|
994
|
+
// ../../node_modules/.bun/jose@6.1.3/node_modules/jose/dist/webapi/lib/validate_crit.js
|
|
995
995
|
function validateCrit(Err, recognizedDefault, recognizedOption, protectedHeader, joseHeader) {
|
|
996
996
|
if (joseHeader.crit !== void 0 && protectedHeader?.crit === void 0) {
|
|
997
997
|
throw new Err('"crit" (Critical) Header Parameter MUST be integrity protected');
|
|
@@ -1022,7 +1022,7 @@ function validateCrit(Err, recognizedDefault, recognizedOption, protectedHeader,
|
|
|
1022
1022
|
return new Set(protectedHeader.crit);
|
|
1023
1023
|
}
|
|
1024
1024
|
|
|
1025
|
-
//
|
|
1025
|
+
// ../../node_modules/.bun/jose@6.1.3/node_modules/jose/dist/webapi/lib/validate_algorithms.js
|
|
1026
1026
|
function validateAlgorithms(option, algorithms) {
|
|
1027
1027
|
if (algorithms !== void 0 && (!Array.isArray(algorithms) || algorithms.some((s) => typeof s !== "string"))) {
|
|
1028
1028
|
throw new TypeError(`"${option}" option must be an array of strings`);
|
|
@@ -1033,13 +1033,13 @@ function validateAlgorithms(option, algorithms) {
|
|
|
1033
1033
|
return new Set(algorithms);
|
|
1034
1034
|
}
|
|
1035
1035
|
|
|
1036
|
-
//
|
|
1036
|
+
// ../../node_modules/.bun/jose@6.1.3/node_modules/jose/dist/webapi/lib/is_jwk.js
|
|
1037
1037
|
var isJWK = (key) => isObject(key) && typeof key.kty === "string";
|
|
1038
1038
|
var isPrivateJWK = (key) => key.kty !== "oct" && (key.kty === "AKP" && typeof key.priv === "string" || typeof key.d === "string");
|
|
1039
1039
|
var isPublicJWK = (key) => key.kty !== "oct" && key.d === void 0 && key.priv === void 0;
|
|
1040
1040
|
var isSecretJWK = (key) => key.kty === "oct" && typeof key.k === "string";
|
|
1041
1041
|
|
|
1042
|
-
//
|
|
1042
|
+
// ../../node_modules/.bun/jose@6.1.3/node_modules/jose/dist/webapi/lib/normalize_key.js
|
|
1043
1043
|
var cache;
|
|
1044
1044
|
var handleJWK = async (key, jwk, alg, freeze = false) => {
|
|
1045
1045
|
cache ||= /* @__PURE__ */ new WeakMap();
|
|
@@ -1210,7 +1210,7 @@ async function normalizeKey(key, alg) {
|
|
|
1210
1210
|
throw new Error("unreachable");
|
|
1211
1211
|
}
|
|
1212
1212
|
|
|
1213
|
-
//
|
|
1213
|
+
// ../../node_modules/.bun/jose@6.1.3/node_modules/jose/dist/webapi/lib/check_key_type.js
|
|
1214
1214
|
var tag = (key) => key?.[Symbol.toStringTag];
|
|
1215
1215
|
var jwkMatchesOp = (alg, key, usage) => {
|
|
1216
1216
|
if (key.use !== void 0) {
|
|
@@ -1330,7 +1330,7 @@ function checkKeyType(alg, key, usage) {
|
|
|
1330
1330
|
}
|
|
1331
1331
|
}
|
|
1332
1332
|
|
|
1333
|
-
//
|
|
1333
|
+
// ../../node_modules/.bun/jose@6.1.3/node_modules/jose/dist/webapi/lib/subtle_dsa.js
|
|
1334
1334
|
function subtleAlgorithm(alg, algorithm) {
|
|
1335
1335
|
const hash = `SHA-${alg.slice(-3)}`;
|
|
1336
1336
|
switch (alg) {
|
|
@@ -1362,7 +1362,7 @@ function subtleAlgorithm(alg, algorithm) {
|
|
|
1362
1362
|
}
|
|
1363
1363
|
}
|
|
1364
1364
|
|
|
1365
|
-
//
|
|
1365
|
+
// ../../node_modules/.bun/jose@6.1.3/node_modules/jose/dist/webapi/lib/get_sign_verify_key.js
|
|
1366
1366
|
async function getSigKey(alg, key, usage) {
|
|
1367
1367
|
if (key instanceof Uint8Array) {
|
|
1368
1368
|
if (!alg.startsWith("HS")) {
|
|
@@ -1374,7 +1374,7 @@ async function getSigKey(alg, key, usage) {
|
|
|
1374
1374
|
return key;
|
|
1375
1375
|
}
|
|
1376
1376
|
|
|
1377
|
-
//
|
|
1377
|
+
// ../../node_modules/.bun/jose@6.1.3/node_modules/jose/dist/webapi/lib/verify.js
|
|
1378
1378
|
async function verify(alg, key, signature, data) {
|
|
1379
1379
|
const cryptoKey = await getSigKey(alg, key, "verify");
|
|
1380
1380
|
checkKeyLength(alg, cryptoKey);
|
|
@@ -1386,7 +1386,7 @@ async function verify(alg, key, signature, data) {
|
|
|
1386
1386
|
}
|
|
1387
1387
|
}
|
|
1388
1388
|
|
|
1389
|
-
//
|
|
1389
|
+
// ../../node_modules/.bun/jose@6.1.3/node_modules/jose/dist/webapi/jws/flattened/verify.js
|
|
1390
1390
|
async function flattenedVerify(jws, key, options) {
|
|
1391
1391
|
if (!isObject(jws)) {
|
|
1392
1392
|
throw new JWSInvalid("Flattened JWS must be an object");
|
|
@@ -1488,7 +1488,7 @@ async function flattenedVerify(jws, key, options) {
|
|
|
1488
1488
|
return result;
|
|
1489
1489
|
}
|
|
1490
1490
|
|
|
1491
|
-
//
|
|
1491
|
+
// ../../node_modules/.bun/jose@6.1.3/node_modules/jose/dist/webapi/jws/compact/verify.js
|
|
1492
1492
|
async function compactVerify(jws, key, options) {
|
|
1493
1493
|
if (jws instanceof Uint8Array) {
|
|
1494
1494
|
jws = decoder.decode(jws);
|
|
@@ -1508,7 +1508,7 @@ async function compactVerify(jws, key, options) {
|
|
|
1508
1508
|
return result;
|
|
1509
1509
|
}
|
|
1510
1510
|
|
|
1511
|
-
//
|
|
1511
|
+
// ../../node_modules/.bun/jose@6.1.3/node_modules/jose/dist/webapi/lib/jwt_claims_set.js
|
|
1512
1512
|
var epoch = (date) => Math.floor(date.getTime() / 1e3);
|
|
1513
1513
|
var minute = 60;
|
|
1514
1514
|
var hour = minute * 60;
|
|
@@ -1665,7 +1665,7 @@ function validateClaimsSet(protectedHeader, encodedPayload, options = {}) {
|
|
|
1665
1665
|
return payload;
|
|
1666
1666
|
}
|
|
1667
1667
|
|
|
1668
|
-
//
|
|
1668
|
+
// ../../node_modules/.bun/jose@6.1.3/node_modules/jose/dist/webapi/jwt/verify.js
|
|
1669
1669
|
async function jwtVerify(jwt, key, options) {
|
|
1670
1670
|
const verified = await compactVerify(jwt, key, options);
|
|
1671
1671
|
if (verified.protectedHeader.crit?.includes("b64") && verified.protectedHeader.b64 === false) {
|
|
@@ -2468,6 +2468,8 @@ async function handleCallback(request, ctx) {
|
|
|
2468
2468
|
}
|
|
2469
2469
|
try {
|
|
2470
2470
|
const codeVerifier = readOAuthPkceVerifier(request, ctx);
|
|
2471
|
+
const redirectUri = resolveOAuthCallbackUrl(request, ctx);
|
|
2472
|
+
redirectUri.searchParams.set("redirect_to", redirectTo);
|
|
2471
2473
|
const res = await fetch(`${ctx.platformUrl}/v1/auth/token`, {
|
|
2472
2474
|
method: "POST",
|
|
2473
2475
|
headers: { "Content-Type": "application/json" },
|
|
@@ -2475,7 +2477,8 @@ async function handleCallback(request, ctx) {
|
|
|
2475
2477
|
grant_type: "authorization_code",
|
|
2476
2478
|
code,
|
|
2477
2479
|
client_secret: ctx.secretKey,
|
|
2478
|
-
...codeVerifier ? { code_verifier: codeVerifier } : {}
|
|
2480
|
+
...codeVerifier ? { code_verifier: codeVerifier } : {},
|
|
2481
|
+
redirect_uri: redirectUri.toString()
|
|
2479
2482
|
})
|
|
2480
2483
|
});
|
|
2481
2484
|
if (!res.ok) {
|