@sylphx/sdk 0.5.0 → 0.7.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 +13 -0
- package/dist/index.d.cts +3304 -20506
- package/dist/index.d.ts +3304 -20506
- package/dist/index.js +8399 -1698
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +8108 -1456
- package/dist/index.mjs.map +1 -1
- package/dist/nextjs/index.d.cts +24 -5697
- package/dist/nextjs/index.d.ts +24 -5697
- package/dist/nextjs/index.js +24 -25
- package/dist/nextjs/index.js.map +1 -1
- package/dist/nextjs/index.mjs +24 -25
- package/dist/nextjs/index.mjs.map +1 -1
- package/dist/react/index.d.cts +404 -6088
- package/dist/react/index.d.ts +404 -6088
- package/dist/react/index.js +1124 -611
- package/dist/react/index.js.map +1 -1
- package/dist/react/index.mjs +1191 -677
- package/dist/react/index.mjs.map +1 -1
- package/dist/server/index.d.cts +116 -19551
- package/dist/server/index.d.ts +116 -19551
- package/dist/server/index.js +128 -61
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +128 -51
- package/dist/server/index.mjs.map +1 -1
- package/dist/web-analytics.js +0 -3
- package/dist/web-analytics.js.map +1 -1
- package/dist/web-analytics.mjs +0 -3
- package/dist/web-analytics.mjs.map +1 -1
- package/package.json +2 -5
package/dist/nextjs/index.js
CHANGED
|
@@ -547,7 +547,6 @@ function createSylphxMiddleware(userConfig = {}) {
|
|
|
547
547
|
];
|
|
548
548
|
const log = (msg, data) => {
|
|
549
549
|
if (config.debug) {
|
|
550
|
-
console.log(`[Sylphx] ${msg}`, data ?? "");
|
|
551
550
|
}
|
|
552
551
|
};
|
|
553
552
|
const ctx = {
|
|
@@ -631,7 +630,7 @@ function getNamespace(secretKey) {
|
|
|
631
630
|
// src/nextjs/server.ts
|
|
632
631
|
var import_react = require("react");
|
|
633
632
|
|
|
634
|
-
// node_modules/jose/dist/webapi/lib/buffer_utils.js
|
|
633
|
+
// ../../node_modules/jose/dist/webapi/lib/buffer_utils.js
|
|
635
634
|
var encoder = new TextEncoder();
|
|
636
635
|
var decoder = new TextDecoder();
|
|
637
636
|
var MAX_INT32 = 2 ** 32;
|
|
@@ -657,7 +656,7 @@ function encode(string) {
|
|
|
657
656
|
return bytes;
|
|
658
657
|
}
|
|
659
658
|
|
|
660
|
-
// node_modules/jose/dist/webapi/lib/base64.js
|
|
659
|
+
// ../../node_modules/jose/dist/webapi/lib/base64.js
|
|
661
660
|
function decodeBase64(encoded) {
|
|
662
661
|
if (Uint8Array.fromBase64) {
|
|
663
662
|
return Uint8Array.fromBase64(encoded);
|
|
@@ -670,7 +669,7 @@ function decodeBase64(encoded) {
|
|
|
670
669
|
return bytes;
|
|
671
670
|
}
|
|
672
671
|
|
|
673
|
-
// node_modules/jose/dist/webapi/util/base64url.js
|
|
672
|
+
// ../../node_modules/jose/dist/webapi/util/base64url.js
|
|
674
673
|
function decode(input) {
|
|
675
674
|
if (Uint8Array.fromBase64) {
|
|
676
675
|
return Uint8Array.fromBase64(typeof input === "string" ? input : decoder.decode(input), {
|
|
@@ -689,7 +688,7 @@ function decode(input) {
|
|
|
689
688
|
}
|
|
690
689
|
}
|
|
691
690
|
|
|
692
|
-
// node_modules/jose/dist/webapi/util/errors.js
|
|
691
|
+
// ../../node_modules/jose/dist/webapi/util/errors.js
|
|
693
692
|
var JOSEError = class extends Error {
|
|
694
693
|
static code = "ERR_JOSE_GENERIC";
|
|
695
694
|
code = "ERR_JOSE_GENERIC";
|
|
@@ -749,7 +748,7 @@ var JWSSignatureVerificationFailed = class extends JOSEError {
|
|
|
749
748
|
}
|
|
750
749
|
};
|
|
751
750
|
|
|
752
|
-
// node_modules/jose/dist/webapi/lib/crypto_key.js
|
|
751
|
+
// ../../node_modules/jose/dist/webapi/lib/crypto_key.js
|
|
753
752
|
var unusable = (name, prop = "algorithm.name") => new TypeError(`CryptoKey does not support this operation, its ${prop} must be ${name}`);
|
|
754
753
|
var isAlgorithm = (algorithm, name) => algorithm.name === name;
|
|
755
754
|
function getHashLength(hash) {
|
|
@@ -837,7 +836,7 @@ function checkSigCryptoKey(key, alg, usage) {
|
|
|
837
836
|
checkUsage(key, usage);
|
|
838
837
|
}
|
|
839
838
|
|
|
840
|
-
// node_modules/jose/dist/webapi/lib/invalid_key_input.js
|
|
839
|
+
// ../../node_modules/jose/dist/webapi/lib/invalid_key_input.js
|
|
841
840
|
function message(msg, actual, ...types) {
|
|
842
841
|
types = types.filter(Boolean);
|
|
843
842
|
if (types.length > 2) {
|
|
@@ -862,7 +861,7 @@ function message(msg, actual, ...types) {
|
|
|
862
861
|
var invalidKeyInput = (actual, ...types) => message("Key must be ", actual, ...types);
|
|
863
862
|
var withAlg = (alg, actual, ...types) => message(`Key for the ${alg} algorithm must be `, actual, ...types);
|
|
864
863
|
|
|
865
|
-
// node_modules/jose/dist/webapi/lib/is_key_like.js
|
|
864
|
+
// ../../node_modules/jose/dist/webapi/lib/is_key_like.js
|
|
866
865
|
var isCryptoKey = (key) => {
|
|
867
866
|
if (key?.[Symbol.toStringTag] === "CryptoKey")
|
|
868
867
|
return true;
|
|
@@ -875,7 +874,7 @@ var isCryptoKey = (key) => {
|
|
|
875
874
|
var isKeyObject = (key) => key?.[Symbol.toStringTag] === "KeyObject";
|
|
876
875
|
var isKeyLike = (key) => isCryptoKey(key) || isKeyObject(key);
|
|
877
876
|
|
|
878
|
-
// node_modules/jose/dist/webapi/lib/is_disjoint.js
|
|
877
|
+
// ../../node_modules/jose/dist/webapi/lib/is_disjoint.js
|
|
879
878
|
function isDisjoint(...headers) {
|
|
880
879
|
const sources = headers.filter(Boolean);
|
|
881
880
|
if (sources.length === 0 || sources.length === 1) {
|
|
@@ -898,7 +897,7 @@ function isDisjoint(...headers) {
|
|
|
898
897
|
return true;
|
|
899
898
|
}
|
|
900
899
|
|
|
901
|
-
// node_modules/jose/dist/webapi/lib/is_object.js
|
|
900
|
+
// ../../node_modules/jose/dist/webapi/lib/is_object.js
|
|
902
901
|
var isObjectLike = (value) => typeof value === "object" && value !== null;
|
|
903
902
|
function isObject(input) {
|
|
904
903
|
if (!isObjectLike(input) || Object.prototype.toString.call(input) !== "[object Object]") {
|
|
@@ -914,7 +913,7 @@ function isObject(input) {
|
|
|
914
913
|
return Object.getPrototypeOf(input) === proto;
|
|
915
914
|
}
|
|
916
915
|
|
|
917
|
-
// node_modules/jose/dist/webapi/lib/check_key_length.js
|
|
916
|
+
// ../../node_modules/jose/dist/webapi/lib/check_key_length.js
|
|
918
917
|
function checkKeyLength(alg, key) {
|
|
919
918
|
if (alg.startsWith("RS") || alg.startsWith("PS")) {
|
|
920
919
|
const { modulusLength } = key.algorithm;
|
|
@@ -924,7 +923,7 @@ function checkKeyLength(alg, key) {
|
|
|
924
923
|
}
|
|
925
924
|
}
|
|
926
925
|
|
|
927
|
-
// node_modules/jose/dist/webapi/lib/jwk_to_key.js
|
|
926
|
+
// ../../node_modules/jose/dist/webapi/lib/jwk_to_key.js
|
|
928
927
|
function subtleMapping(jwk) {
|
|
929
928
|
let algorithm;
|
|
930
929
|
let keyUsages;
|
|
@@ -1034,7 +1033,7 @@ async function jwkToKey(jwk) {
|
|
|
1034
1033
|
return crypto.subtle.importKey("jwk", keyData, algorithm, jwk.ext ?? (jwk.d || jwk.priv ? false : true), jwk.key_ops ?? keyUsages);
|
|
1035
1034
|
}
|
|
1036
1035
|
|
|
1037
|
-
// node_modules/jose/dist/webapi/key/import.js
|
|
1036
|
+
// ../../node_modules/jose/dist/webapi/key/import.js
|
|
1038
1037
|
async function importJWK(jwk, alg, options) {
|
|
1039
1038
|
if (!isObject(jwk)) {
|
|
1040
1039
|
throw new TypeError("JWK must be an object");
|
|
@@ -1070,7 +1069,7 @@ async function importJWK(jwk, alg, options) {
|
|
|
1070
1069
|
}
|
|
1071
1070
|
}
|
|
1072
1071
|
|
|
1073
|
-
// node_modules/jose/dist/webapi/lib/validate_crit.js
|
|
1072
|
+
// ../../node_modules/jose/dist/webapi/lib/validate_crit.js
|
|
1074
1073
|
function validateCrit(Err, recognizedDefault, recognizedOption, protectedHeader, joseHeader) {
|
|
1075
1074
|
if (joseHeader.crit !== void 0 && protectedHeader?.crit === void 0) {
|
|
1076
1075
|
throw new Err('"crit" (Critical) Header Parameter MUST be integrity protected');
|
|
@@ -1101,7 +1100,7 @@ function validateCrit(Err, recognizedDefault, recognizedOption, protectedHeader,
|
|
|
1101
1100
|
return new Set(protectedHeader.crit);
|
|
1102
1101
|
}
|
|
1103
1102
|
|
|
1104
|
-
// node_modules/jose/dist/webapi/lib/validate_algorithms.js
|
|
1103
|
+
// ../../node_modules/jose/dist/webapi/lib/validate_algorithms.js
|
|
1105
1104
|
function validateAlgorithms(option, algorithms) {
|
|
1106
1105
|
if (algorithms !== void 0 && (!Array.isArray(algorithms) || algorithms.some((s) => typeof s !== "string"))) {
|
|
1107
1106
|
throw new TypeError(`"${option}" option must be an array of strings`);
|
|
@@ -1112,13 +1111,13 @@ function validateAlgorithms(option, algorithms) {
|
|
|
1112
1111
|
return new Set(algorithms);
|
|
1113
1112
|
}
|
|
1114
1113
|
|
|
1115
|
-
// node_modules/jose/dist/webapi/lib/is_jwk.js
|
|
1114
|
+
// ../../node_modules/jose/dist/webapi/lib/is_jwk.js
|
|
1116
1115
|
var isJWK = (key) => isObject(key) && typeof key.kty === "string";
|
|
1117
1116
|
var isPrivateJWK = (key) => key.kty !== "oct" && (key.kty === "AKP" && typeof key.priv === "string" || typeof key.d === "string");
|
|
1118
1117
|
var isPublicJWK = (key) => key.kty !== "oct" && key.d === void 0 && key.priv === void 0;
|
|
1119
1118
|
var isSecretJWK = (key) => key.kty === "oct" && typeof key.k === "string";
|
|
1120
1119
|
|
|
1121
|
-
// node_modules/jose/dist/webapi/lib/normalize_key.js
|
|
1120
|
+
// ../../node_modules/jose/dist/webapi/lib/normalize_key.js
|
|
1122
1121
|
var cache;
|
|
1123
1122
|
var handleJWK = async (key, jwk, alg, freeze = false) => {
|
|
1124
1123
|
cache ||= /* @__PURE__ */ new WeakMap();
|
|
@@ -1289,7 +1288,7 @@ async function normalizeKey(key, alg) {
|
|
|
1289
1288
|
throw new Error("unreachable");
|
|
1290
1289
|
}
|
|
1291
1290
|
|
|
1292
|
-
// node_modules/jose/dist/webapi/lib/check_key_type.js
|
|
1291
|
+
// ../../node_modules/jose/dist/webapi/lib/check_key_type.js
|
|
1293
1292
|
var tag = (key) => key?.[Symbol.toStringTag];
|
|
1294
1293
|
var jwkMatchesOp = (alg, key, usage) => {
|
|
1295
1294
|
if (key.use !== void 0) {
|
|
@@ -1409,7 +1408,7 @@ function checkKeyType(alg, key, usage) {
|
|
|
1409
1408
|
}
|
|
1410
1409
|
}
|
|
1411
1410
|
|
|
1412
|
-
// node_modules/jose/dist/webapi/lib/subtle_dsa.js
|
|
1411
|
+
// ../../node_modules/jose/dist/webapi/lib/subtle_dsa.js
|
|
1413
1412
|
function subtleAlgorithm(alg, algorithm) {
|
|
1414
1413
|
const hash = `SHA-${alg.slice(-3)}`;
|
|
1415
1414
|
switch (alg) {
|
|
@@ -1441,7 +1440,7 @@ function subtleAlgorithm(alg, algorithm) {
|
|
|
1441
1440
|
}
|
|
1442
1441
|
}
|
|
1443
1442
|
|
|
1444
|
-
// node_modules/jose/dist/webapi/lib/get_sign_verify_key.js
|
|
1443
|
+
// ../../node_modules/jose/dist/webapi/lib/get_sign_verify_key.js
|
|
1445
1444
|
async function getSigKey(alg, key, usage) {
|
|
1446
1445
|
if (key instanceof Uint8Array) {
|
|
1447
1446
|
if (!alg.startsWith("HS")) {
|
|
@@ -1453,7 +1452,7 @@ async function getSigKey(alg, key, usage) {
|
|
|
1453
1452
|
return key;
|
|
1454
1453
|
}
|
|
1455
1454
|
|
|
1456
|
-
// node_modules/jose/dist/webapi/lib/verify.js
|
|
1455
|
+
// ../../node_modules/jose/dist/webapi/lib/verify.js
|
|
1457
1456
|
async function verify(alg, key, signature, data) {
|
|
1458
1457
|
const cryptoKey = await getSigKey(alg, key, "verify");
|
|
1459
1458
|
checkKeyLength(alg, cryptoKey);
|
|
@@ -1465,7 +1464,7 @@ async function verify(alg, key, signature, data) {
|
|
|
1465
1464
|
}
|
|
1466
1465
|
}
|
|
1467
1466
|
|
|
1468
|
-
// node_modules/jose/dist/webapi/jws/flattened/verify.js
|
|
1467
|
+
// ../../node_modules/jose/dist/webapi/jws/flattened/verify.js
|
|
1469
1468
|
async function flattenedVerify(jws, key, options) {
|
|
1470
1469
|
if (!isObject(jws)) {
|
|
1471
1470
|
throw new JWSInvalid("Flattened JWS must be an object");
|
|
@@ -1567,7 +1566,7 @@ async function flattenedVerify(jws, key, options) {
|
|
|
1567
1566
|
return result;
|
|
1568
1567
|
}
|
|
1569
1568
|
|
|
1570
|
-
// node_modules/jose/dist/webapi/jws/compact/verify.js
|
|
1569
|
+
// ../../node_modules/jose/dist/webapi/jws/compact/verify.js
|
|
1571
1570
|
async function compactVerify(jws, key, options) {
|
|
1572
1571
|
if (jws instanceof Uint8Array) {
|
|
1573
1572
|
jws = decoder.decode(jws);
|
|
@@ -1587,7 +1586,7 @@ async function compactVerify(jws, key, options) {
|
|
|
1587
1586
|
return result;
|
|
1588
1587
|
}
|
|
1589
1588
|
|
|
1590
|
-
// node_modules/jose/dist/webapi/lib/jwt_claims_set.js
|
|
1589
|
+
// ../../node_modules/jose/dist/webapi/lib/jwt_claims_set.js
|
|
1591
1590
|
var epoch = (date) => Math.floor(date.getTime() / 1e3);
|
|
1592
1591
|
var minute = 60;
|
|
1593
1592
|
var hour = minute * 60;
|
|
@@ -1744,7 +1743,7 @@ function validateClaimsSet(protectedHeader, encodedPayload, options = {}) {
|
|
|
1744
1743
|
return payload;
|
|
1745
1744
|
}
|
|
1746
1745
|
|
|
1747
|
-
// node_modules/jose/dist/webapi/jwt/verify.js
|
|
1746
|
+
// ../../node_modules/jose/dist/webapi/jwt/verify.js
|
|
1748
1747
|
async function jwtVerify(jwt, key, options) {
|
|
1749
1748
|
const verified = await compactVerify(jwt, key, options);
|
|
1750
1749
|
if (verified.protectedHeader.crit?.includes("b64") && verified.protectedHeader.b64 === false) {
|