@sylphx/sdk 0.23.0 → 0.26.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 -561
- package/dist/index.d.ts +311 -1
- package/dist/index.mjs +721 -16
- package/dist/index.mjs.map +1 -1
- package/dist/nextjs/index.mjs +24 -24
- package/dist/nextjs/index.mjs.map +1 -1
- package/dist/react/index.mjs +1 -1
- package/dist/react/index.mjs.map +1 -1
- package/dist/server/index.mjs +24 -24
- package/dist/server/index.mjs.map +1 -1
- package/package.json +126 -123
package/dist/server/index.mjs
CHANGED
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
PLATFORM_CONSOLE_SLUG
|
|
6
6
|
} from "@sylphx/contract";
|
|
7
7
|
|
|
8
|
-
//
|
|
8
|
+
// ../../../../../.bun/install/cache/links/jose@6.1.3-bb9fbb1164201cee/node_modules/jose/dist/webapi/lib/buffer_utils.js
|
|
9
9
|
var encoder = new TextEncoder();
|
|
10
10
|
var decoder = new TextDecoder();
|
|
11
11
|
var MAX_INT32 = 2 ** 32;
|
|
@@ -31,7 +31,7 @@ function encode(string) {
|
|
|
31
31
|
return bytes;
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
//
|
|
34
|
+
// ../../../../../.bun/install/cache/links/jose@6.1.3-bb9fbb1164201cee/node_modules/jose/dist/webapi/lib/base64.js
|
|
35
35
|
function decodeBase64(encoded) {
|
|
36
36
|
if (Uint8Array.fromBase64) {
|
|
37
37
|
return Uint8Array.fromBase64(encoded);
|
|
@@ -44,7 +44,7 @@ function decodeBase64(encoded) {
|
|
|
44
44
|
return bytes;
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
-
//
|
|
47
|
+
// ../../../../../.bun/install/cache/links/jose@6.1.3-bb9fbb1164201cee/node_modules/jose/dist/webapi/util/base64url.js
|
|
48
48
|
function decode(input) {
|
|
49
49
|
if (Uint8Array.fromBase64) {
|
|
50
50
|
return Uint8Array.fromBase64(typeof input === "string" ? input : decoder.decode(input), {
|
|
@@ -63,7 +63,7 @@ function decode(input) {
|
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
-
//
|
|
66
|
+
// ../../../../../.bun/install/cache/links/jose@6.1.3-bb9fbb1164201cee/node_modules/jose/dist/webapi/util/errors.js
|
|
67
67
|
var JOSEError = class extends Error {
|
|
68
68
|
static code = "ERR_JOSE_GENERIC";
|
|
69
69
|
code = "ERR_JOSE_GENERIC";
|
|
@@ -123,7 +123,7 @@ var JWSSignatureVerificationFailed = class extends JOSEError {
|
|
|
123
123
|
}
|
|
124
124
|
};
|
|
125
125
|
|
|
126
|
-
//
|
|
126
|
+
// ../../../../../.bun/install/cache/links/jose@6.1.3-bb9fbb1164201cee/node_modules/jose/dist/webapi/lib/crypto_key.js
|
|
127
127
|
var unusable = (name, prop = "algorithm.name") => new TypeError(`CryptoKey does not support this operation, its ${prop} must be ${name}`);
|
|
128
128
|
var isAlgorithm = (algorithm, name) => algorithm.name === name;
|
|
129
129
|
function getHashLength(hash) {
|
|
@@ -211,7 +211,7 @@ function checkSigCryptoKey(key, alg, usage) {
|
|
|
211
211
|
checkUsage(key, usage);
|
|
212
212
|
}
|
|
213
213
|
|
|
214
|
-
//
|
|
214
|
+
// ../../../../../.bun/install/cache/links/jose@6.1.3-bb9fbb1164201cee/node_modules/jose/dist/webapi/lib/invalid_key_input.js
|
|
215
215
|
function message(msg, actual, ...types) {
|
|
216
216
|
types = types.filter(Boolean);
|
|
217
217
|
if (types.length > 2) {
|
|
@@ -236,7 +236,7 @@ function message(msg, actual, ...types) {
|
|
|
236
236
|
var invalidKeyInput = (actual, ...types) => message("Key must be ", actual, ...types);
|
|
237
237
|
var withAlg = (alg, actual, ...types) => message(`Key for the ${alg} algorithm must be `, actual, ...types);
|
|
238
238
|
|
|
239
|
-
//
|
|
239
|
+
// ../../../../../.bun/install/cache/links/jose@6.1.3-bb9fbb1164201cee/node_modules/jose/dist/webapi/lib/is_key_like.js
|
|
240
240
|
var isCryptoKey = (key) => {
|
|
241
241
|
if (key?.[Symbol.toStringTag] === "CryptoKey")
|
|
242
242
|
return true;
|
|
@@ -249,7 +249,7 @@ var isCryptoKey = (key) => {
|
|
|
249
249
|
var isKeyObject = (key) => key?.[Symbol.toStringTag] === "KeyObject";
|
|
250
250
|
var isKeyLike = (key) => isCryptoKey(key) || isKeyObject(key);
|
|
251
251
|
|
|
252
|
-
//
|
|
252
|
+
// ../../../../../.bun/install/cache/links/jose@6.1.3-bb9fbb1164201cee/node_modules/jose/dist/webapi/lib/is_disjoint.js
|
|
253
253
|
function isDisjoint(...headers) {
|
|
254
254
|
const sources = headers.filter(Boolean);
|
|
255
255
|
if (sources.length === 0 || sources.length === 1) {
|
|
@@ -272,7 +272,7 @@ function isDisjoint(...headers) {
|
|
|
272
272
|
return true;
|
|
273
273
|
}
|
|
274
274
|
|
|
275
|
-
//
|
|
275
|
+
// ../../../../../.bun/install/cache/links/jose@6.1.3-bb9fbb1164201cee/node_modules/jose/dist/webapi/lib/is_object.js
|
|
276
276
|
var isObjectLike = (value) => typeof value === "object" && value !== null;
|
|
277
277
|
function isObject(input) {
|
|
278
278
|
if (!isObjectLike(input) || Object.prototype.toString.call(input) !== "[object Object]") {
|
|
@@ -288,7 +288,7 @@ function isObject(input) {
|
|
|
288
288
|
return Object.getPrototypeOf(input) === proto;
|
|
289
289
|
}
|
|
290
290
|
|
|
291
|
-
//
|
|
291
|
+
// ../../../../../.bun/install/cache/links/jose@6.1.3-bb9fbb1164201cee/node_modules/jose/dist/webapi/lib/check_key_length.js
|
|
292
292
|
function checkKeyLength(alg, key) {
|
|
293
293
|
if (alg.startsWith("RS") || alg.startsWith("PS")) {
|
|
294
294
|
const { modulusLength } = key.algorithm;
|
|
@@ -298,7 +298,7 @@ function checkKeyLength(alg, key) {
|
|
|
298
298
|
}
|
|
299
299
|
}
|
|
300
300
|
|
|
301
|
-
//
|
|
301
|
+
// ../../../../../.bun/install/cache/links/jose@6.1.3-bb9fbb1164201cee/node_modules/jose/dist/webapi/lib/jwk_to_key.js
|
|
302
302
|
function subtleMapping(jwk) {
|
|
303
303
|
let algorithm;
|
|
304
304
|
let keyUsages;
|
|
@@ -408,7 +408,7 @@ async function jwkToKey(jwk) {
|
|
|
408
408
|
return crypto.subtle.importKey("jwk", keyData, algorithm, jwk.ext ?? (jwk.d || jwk.priv ? false : true), jwk.key_ops ?? keyUsages);
|
|
409
409
|
}
|
|
410
410
|
|
|
411
|
-
//
|
|
411
|
+
// ../../../../../.bun/install/cache/links/jose@6.1.3-bb9fbb1164201cee/node_modules/jose/dist/webapi/key/import.js
|
|
412
412
|
async function importJWK(jwk, alg, options) {
|
|
413
413
|
if (!isObject(jwk)) {
|
|
414
414
|
throw new TypeError("JWK must be an object");
|
|
@@ -444,7 +444,7 @@ async function importJWK(jwk, alg, options) {
|
|
|
444
444
|
}
|
|
445
445
|
}
|
|
446
446
|
|
|
447
|
-
//
|
|
447
|
+
// ../../../../../.bun/install/cache/links/jose@6.1.3-bb9fbb1164201cee/node_modules/jose/dist/webapi/lib/validate_crit.js
|
|
448
448
|
function validateCrit(Err, recognizedDefault, recognizedOption, protectedHeader, joseHeader) {
|
|
449
449
|
if (joseHeader.crit !== void 0 && protectedHeader?.crit === void 0) {
|
|
450
450
|
throw new Err('"crit" (Critical) Header Parameter MUST be integrity protected');
|
|
@@ -475,7 +475,7 @@ function validateCrit(Err, recognizedDefault, recognizedOption, protectedHeader,
|
|
|
475
475
|
return new Set(protectedHeader.crit);
|
|
476
476
|
}
|
|
477
477
|
|
|
478
|
-
//
|
|
478
|
+
// ../../../../../.bun/install/cache/links/jose@6.1.3-bb9fbb1164201cee/node_modules/jose/dist/webapi/lib/validate_algorithms.js
|
|
479
479
|
function validateAlgorithms(option, algorithms) {
|
|
480
480
|
if (algorithms !== void 0 && (!Array.isArray(algorithms) || algorithms.some((s) => typeof s !== "string"))) {
|
|
481
481
|
throw new TypeError(`"${option}" option must be an array of strings`);
|
|
@@ -486,13 +486,13 @@ function validateAlgorithms(option, algorithms) {
|
|
|
486
486
|
return new Set(algorithms);
|
|
487
487
|
}
|
|
488
488
|
|
|
489
|
-
//
|
|
489
|
+
// ../../../../../.bun/install/cache/links/jose@6.1.3-bb9fbb1164201cee/node_modules/jose/dist/webapi/lib/is_jwk.js
|
|
490
490
|
var isJWK = (key) => isObject(key) && typeof key.kty === "string";
|
|
491
491
|
var isPrivateJWK = (key) => key.kty !== "oct" && (key.kty === "AKP" && typeof key.priv === "string" || typeof key.d === "string");
|
|
492
492
|
var isPublicJWK = (key) => key.kty !== "oct" && key.d === void 0 && key.priv === void 0;
|
|
493
493
|
var isSecretJWK = (key) => key.kty === "oct" && typeof key.k === "string";
|
|
494
494
|
|
|
495
|
-
//
|
|
495
|
+
// ../../../../../.bun/install/cache/links/jose@6.1.3-bb9fbb1164201cee/node_modules/jose/dist/webapi/lib/normalize_key.js
|
|
496
496
|
var cache;
|
|
497
497
|
var handleJWK = async (key, jwk, alg, freeze = false) => {
|
|
498
498
|
cache ||= /* @__PURE__ */ new WeakMap();
|
|
@@ -663,7 +663,7 @@ async function normalizeKey(key, alg) {
|
|
|
663
663
|
throw new Error("unreachable");
|
|
664
664
|
}
|
|
665
665
|
|
|
666
|
-
//
|
|
666
|
+
// ../../../../../.bun/install/cache/links/jose@6.1.3-bb9fbb1164201cee/node_modules/jose/dist/webapi/lib/check_key_type.js
|
|
667
667
|
var tag = (key) => key?.[Symbol.toStringTag];
|
|
668
668
|
var jwkMatchesOp = (alg, key, usage) => {
|
|
669
669
|
if (key.use !== void 0) {
|
|
@@ -783,7 +783,7 @@ function checkKeyType(alg, key, usage) {
|
|
|
783
783
|
}
|
|
784
784
|
}
|
|
785
785
|
|
|
786
|
-
//
|
|
786
|
+
// ../../../../../.bun/install/cache/links/jose@6.1.3-bb9fbb1164201cee/node_modules/jose/dist/webapi/lib/subtle_dsa.js
|
|
787
787
|
function subtleAlgorithm(alg, algorithm) {
|
|
788
788
|
const hash = `SHA-${alg.slice(-3)}`;
|
|
789
789
|
switch (alg) {
|
|
@@ -815,7 +815,7 @@ function subtleAlgorithm(alg, algorithm) {
|
|
|
815
815
|
}
|
|
816
816
|
}
|
|
817
817
|
|
|
818
|
-
//
|
|
818
|
+
// ../../../../../.bun/install/cache/links/jose@6.1.3-bb9fbb1164201cee/node_modules/jose/dist/webapi/lib/get_sign_verify_key.js
|
|
819
819
|
async function getSigKey(alg, key, usage) {
|
|
820
820
|
if (key instanceof Uint8Array) {
|
|
821
821
|
if (!alg.startsWith("HS")) {
|
|
@@ -827,7 +827,7 @@ async function getSigKey(alg, key, usage) {
|
|
|
827
827
|
return key;
|
|
828
828
|
}
|
|
829
829
|
|
|
830
|
-
//
|
|
830
|
+
// ../../../../../.bun/install/cache/links/jose@6.1.3-bb9fbb1164201cee/node_modules/jose/dist/webapi/lib/verify.js
|
|
831
831
|
async function verify(alg, key, signature, data) {
|
|
832
832
|
const cryptoKey = await getSigKey(alg, key, "verify");
|
|
833
833
|
checkKeyLength(alg, cryptoKey);
|
|
@@ -839,7 +839,7 @@ async function verify(alg, key, signature, data) {
|
|
|
839
839
|
}
|
|
840
840
|
}
|
|
841
841
|
|
|
842
|
-
//
|
|
842
|
+
// ../../../../../.bun/install/cache/links/jose@6.1.3-bb9fbb1164201cee/node_modules/jose/dist/webapi/jws/flattened/verify.js
|
|
843
843
|
async function flattenedVerify(jws, key, options) {
|
|
844
844
|
if (!isObject(jws)) {
|
|
845
845
|
throw new JWSInvalid("Flattened JWS must be an object");
|
|
@@ -941,7 +941,7 @@ async function flattenedVerify(jws, key, options) {
|
|
|
941
941
|
return result;
|
|
942
942
|
}
|
|
943
943
|
|
|
944
|
-
//
|
|
944
|
+
// ../../../../../.bun/install/cache/links/jose@6.1.3-bb9fbb1164201cee/node_modules/jose/dist/webapi/jws/compact/verify.js
|
|
945
945
|
async function compactVerify(jws, key, options) {
|
|
946
946
|
if (jws instanceof Uint8Array) {
|
|
947
947
|
jws = decoder.decode(jws);
|
|
@@ -961,7 +961,7 @@ async function compactVerify(jws, key, options) {
|
|
|
961
961
|
return result;
|
|
962
962
|
}
|
|
963
963
|
|
|
964
|
-
//
|
|
964
|
+
// ../../../../../.bun/install/cache/links/jose@6.1.3-bb9fbb1164201cee/node_modules/jose/dist/webapi/lib/jwt_claims_set.js
|
|
965
965
|
var epoch = (date) => Math.floor(date.getTime() / 1e3);
|
|
966
966
|
var minute = 60;
|
|
967
967
|
var hour = minute * 60;
|
|
@@ -1118,7 +1118,7 @@ function validateClaimsSet(protectedHeader, encodedPayload, options = {}) {
|
|
|
1118
1118
|
return payload;
|
|
1119
1119
|
}
|
|
1120
1120
|
|
|
1121
|
-
//
|
|
1121
|
+
// ../../../../../.bun/install/cache/links/jose@6.1.3-bb9fbb1164201cee/node_modules/jose/dist/webapi/jwt/verify.js
|
|
1122
1122
|
async function jwtVerify(jwt, key, options) {
|
|
1123
1123
|
const verified = await compactVerify(jwt, key, options);
|
|
1124
1124
|
if (verified.protectedHeader.crit?.includes("b64") && verified.protectedHeader.b64 === false) {
|