@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.
@@ -493,7 +493,6 @@ function createSylphxMiddleware(userConfig = {}) {
493
493
  ];
494
494
  const log = (msg, data) => {
495
495
  if (config.debug) {
496
- console.log(`[Sylphx] ${msg}`, data ?? "");
497
496
  }
498
497
  };
499
498
  const ctx = {
@@ -577,7 +576,7 @@ function getNamespace(secretKey) {
577
576
  // src/nextjs/server.ts
578
577
  import { cache as cache2 } from "react";
579
578
 
580
- // node_modules/jose/dist/webapi/lib/buffer_utils.js
579
+ // ../../node_modules/jose/dist/webapi/lib/buffer_utils.js
581
580
  var encoder = new TextEncoder();
582
581
  var decoder = new TextDecoder();
583
582
  var MAX_INT32 = 2 ** 32;
@@ -603,7 +602,7 @@ function encode(string) {
603
602
  return bytes;
604
603
  }
605
604
 
606
- // node_modules/jose/dist/webapi/lib/base64.js
605
+ // ../../node_modules/jose/dist/webapi/lib/base64.js
607
606
  function decodeBase64(encoded) {
608
607
  if (Uint8Array.fromBase64) {
609
608
  return Uint8Array.fromBase64(encoded);
@@ -616,7 +615,7 @@ function decodeBase64(encoded) {
616
615
  return bytes;
617
616
  }
618
617
 
619
- // node_modules/jose/dist/webapi/util/base64url.js
618
+ // ../../node_modules/jose/dist/webapi/util/base64url.js
620
619
  function decode(input) {
621
620
  if (Uint8Array.fromBase64) {
622
621
  return Uint8Array.fromBase64(typeof input === "string" ? input : decoder.decode(input), {
@@ -635,7 +634,7 @@ function decode(input) {
635
634
  }
636
635
  }
637
636
 
638
- // node_modules/jose/dist/webapi/util/errors.js
637
+ // ../../node_modules/jose/dist/webapi/util/errors.js
639
638
  var JOSEError = class extends Error {
640
639
  static code = "ERR_JOSE_GENERIC";
641
640
  code = "ERR_JOSE_GENERIC";
@@ -695,7 +694,7 @@ var JWSSignatureVerificationFailed = class extends JOSEError {
695
694
  }
696
695
  };
697
696
 
698
- // node_modules/jose/dist/webapi/lib/crypto_key.js
697
+ // ../../node_modules/jose/dist/webapi/lib/crypto_key.js
699
698
  var unusable = (name, prop = "algorithm.name") => new TypeError(`CryptoKey does not support this operation, its ${prop} must be ${name}`);
700
699
  var isAlgorithm = (algorithm, name) => algorithm.name === name;
701
700
  function getHashLength(hash) {
@@ -783,7 +782,7 @@ function checkSigCryptoKey(key, alg, usage) {
783
782
  checkUsage(key, usage);
784
783
  }
785
784
 
786
- // node_modules/jose/dist/webapi/lib/invalid_key_input.js
785
+ // ../../node_modules/jose/dist/webapi/lib/invalid_key_input.js
787
786
  function message(msg, actual, ...types) {
788
787
  types = types.filter(Boolean);
789
788
  if (types.length > 2) {
@@ -808,7 +807,7 @@ function message(msg, actual, ...types) {
808
807
  var invalidKeyInput = (actual, ...types) => message("Key must be ", actual, ...types);
809
808
  var withAlg = (alg, actual, ...types) => message(`Key for the ${alg} algorithm must be `, actual, ...types);
810
809
 
811
- // node_modules/jose/dist/webapi/lib/is_key_like.js
810
+ // ../../node_modules/jose/dist/webapi/lib/is_key_like.js
812
811
  var isCryptoKey = (key) => {
813
812
  if (key?.[Symbol.toStringTag] === "CryptoKey")
814
813
  return true;
@@ -821,7 +820,7 @@ var isCryptoKey = (key) => {
821
820
  var isKeyObject = (key) => key?.[Symbol.toStringTag] === "KeyObject";
822
821
  var isKeyLike = (key) => isCryptoKey(key) || isKeyObject(key);
823
822
 
824
- // node_modules/jose/dist/webapi/lib/is_disjoint.js
823
+ // ../../node_modules/jose/dist/webapi/lib/is_disjoint.js
825
824
  function isDisjoint(...headers) {
826
825
  const sources = headers.filter(Boolean);
827
826
  if (sources.length === 0 || sources.length === 1) {
@@ -844,7 +843,7 @@ function isDisjoint(...headers) {
844
843
  return true;
845
844
  }
846
845
 
847
- // node_modules/jose/dist/webapi/lib/is_object.js
846
+ // ../../node_modules/jose/dist/webapi/lib/is_object.js
848
847
  var isObjectLike = (value) => typeof value === "object" && value !== null;
849
848
  function isObject(input) {
850
849
  if (!isObjectLike(input) || Object.prototype.toString.call(input) !== "[object Object]") {
@@ -860,7 +859,7 @@ function isObject(input) {
860
859
  return Object.getPrototypeOf(input) === proto;
861
860
  }
862
861
 
863
- // node_modules/jose/dist/webapi/lib/check_key_length.js
862
+ // ../../node_modules/jose/dist/webapi/lib/check_key_length.js
864
863
  function checkKeyLength(alg, key) {
865
864
  if (alg.startsWith("RS") || alg.startsWith("PS")) {
866
865
  const { modulusLength } = key.algorithm;
@@ -870,7 +869,7 @@ function checkKeyLength(alg, key) {
870
869
  }
871
870
  }
872
871
 
873
- // node_modules/jose/dist/webapi/lib/jwk_to_key.js
872
+ // ../../node_modules/jose/dist/webapi/lib/jwk_to_key.js
874
873
  function subtleMapping(jwk) {
875
874
  let algorithm;
876
875
  let keyUsages;
@@ -980,7 +979,7 @@ async function jwkToKey(jwk) {
980
979
  return crypto.subtle.importKey("jwk", keyData, algorithm, jwk.ext ?? (jwk.d || jwk.priv ? false : true), jwk.key_ops ?? keyUsages);
981
980
  }
982
981
 
983
- // node_modules/jose/dist/webapi/key/import.js
982
+ // ../../node_modules/jose/dist/webapi/key/import.js
984
983
  async function importJWK(jwk, alg, options) {
985
984
  if (!isObject(jwk)) {
986
985
  throw new TypeError("JWK must be an object");
@@ -1016,7 +1015,7 @@ async function importJWK(jwk, alg, options) {
1016
1015
  }
1017
1016
  }
1018
1017
 
1019
- // node_modules/jose/dist/webapi/lib/validate_crit.js
1018
+ // ../../node_modules/jose/dist/webapi/lib/validate_crit.js
1020
1019
  function validateCrit(Err, recognizedDefault, recognizedOption, protectedHeader, joseHeader) {
1021
1020
  if (joseHeader.crit !== void 0 && protectedHeader?.crit === void 0) {
1022
1021
  throw new Err('"crit" (Critical) Header Parameter MUST be integrity protected');
@@ -1047,7 +1046,7 @@ function validateCrit(Err, recognizedDefault, recognizedOption, protectedHeader,
1047
1046
  return new Set(protectedHeader.crit);
1048
1047
  }
1049
1048
 
1050
- // node_modules/jose/dist/webapi/lib/validate_algorithms.js
1049
+ // ../../node_modules/jose/dist/webapi/lib/validate_algorithms.js
1051
1050
  function validateAlgorithms(option, algorithms) {
1052
1051
  if (algorithms !== void 0 && (!Array.isArray(algorithms) || algorithms.some((s) => typeof s !== "string"))) {
1053
1052
  throw new TypeError(`"${option}" option must be an array of strings`);
@@ -1058,13 +1057,13 @@ function validateAlgorithms(option, algorithms) {
1058
1057
  return new Set(algorithms);
1059
1058
  }
1060
1059
 
1061
- // node_modules/jose/dist/webapi/lib/is_jwk.js
1060
+ // ../../node_modules/jose/dist/webapi/lib/is_jwk.js
1062
1061
  var isJWK = (key) => isObject(key) && typeof key.kty === "string";
1063
1062
  var isPrivateJWK = (key) => key.kty !== "oct" && (key.kty === "AKP" && typeof key.priv === "string" || typeof key.d === "string");
1064
1063
  var isPublicJWK = (key) => key.kty !== "oct" && key.d === void 0 && key.priv === void 0;
1065
1064
  var isSecretJWK = (key) => key.kty === "oct" && typeof key.k === "string";
1066
1065
 
1067
- // node_modules/jose/dist/webapi/lib/normalize_key.js
1066
+ // ../../node_modules/jose/dist/webapi/lib/normalize_key.js
1068
1067
  var cache;
1069
1068
  var handleJWK = async (key, jwk, alg, freeze = false) => {
1070
1069
  cache ||= /* @__PURE__ */ new WeakMap();
@@ -1235,7 +1234,7 @@ async function normalizeKey(key, alg) {
1235
1234
  throw new Error("unreachable");
1236
1235
  }
1237
1236
 
1238
- // node_modules/jose/dist/webapi/lib/check_key_type.js
1237
+ // ../../node_modules/jose/dist/webapi/lib/check_key_type.js
1239
1238
  var tag = (key) => key?.[Symbol.toStringTag];
1240
1239
  var jwkMatchesOp = (alg, key, usage) => {
1241
1240
  if (key.use !== void 0) {
@@ -1355,7 +1354,7 @@ function checkKeyType(alg, key, usage) {
1355
1354
  }
1356
1355
  }
1357
1356
 
1358
- // node_modules/jose/dist/webapi/lib/subtle_dsa.js
1357
+ // ../../node_modules/jose/dist/webapi/lib/subtle_dsa.js
1359
1358
  function subtleAlgorithm(alg, algorithm) {
1360
1359
  const hash = `SHA-${alg.slice(-3)}`;
1361
1360
  switch (alg) {
@@ -1387,7 +1386,7 @@ function subtleAlgorithm(alg, algorithm) {
1387
1386
  }
1388
1387
  }
1389
1388
 
1390
- // node_modules/jose/dist/webapi/lib/get_sign_verify_key.js
1389
+ // ../../node_modules/jose/dist/webapi/lib/get_sign_verify_key.js
1391
1390
  async function getSigKey(alg, key, usage) {
1392
1391
  if (key instanceof Uint8Array) {
1393
1392
  if (!alg.startsWith("HS")) {
@@ -1399,7 +1398,7 @@ async function getSigKey(alg, key, usage) {
1399
1398
  return key;
1400
1399
  }
1401
1400
 
1402
- // node_modules/jose/dist/webapi/lib/verify.js
1401
+ // ../../node_modules/jose/dist/webapi/lib/verify.js
1403
1402
  async function verify(alg, key, signature, data) {
1404
1403
  const cryptoKey = await getSigKey(alg, key, "verify");
1405
1404
  checkKeyLength(alg, cryptoKey);
@@ -1411,7 +1410,7 @@ async function verify(alg, key, signature, data) {
1411
1410
  }
1412
1411
  }
1413
1412
 
1414
- // node_modules/jose/dist/webapi/jws/flattened/verify.js
1413
+ // ../../node_modules/jose/dist/webapi/jws/flattened/verify.js
1415
1414
  async function flattenedVerify(jws, key, options) {
1416
1415
  if (!isObject(jws)) {
1417
1416
  throw new JWSInvalid("Flattened JWS must be an object");
@@ -1513,7 +1512,7 @@ async function flattenedVerify(jws, key, options) {
1513
1512
  return result;
1514
1513
  }
1515
1514
 
1516
- // node_modules/jose/dist/webapi/jws/compact/verify.js
1515
+ // ../../node_modules/jose/dist/webapi/jws/compact/verify.js
1517
1516
  async function compactVerify(jws, key, options) {
1518
1517
  if (jws instanceof Uint8Array) {
1519
1518
  jws = decoder.decode(jws);
@@ -1533,7 +1532,7 @@ async function compactVerify(jws, key, options) {
1533
1532
  return result;
1534
1533
  }
1535
1534
 
1536
- // node_modules/jose/dist/webapi/lib/jwt_claims_set.js
1535
+ // ../../node_modules/jose/dist/webapi/lib/jwt_claims_set.js
1537
1536
  var epoch = (date) => Math.floor(date.getTime() / 1e3);
1538
1537
  var minute = 60;
1539
1538
  var hour = minute * 60;
@@ -1690,7 +1689,7 @@ function validateClaimsSet(protectedHeader, encodedPayload, options = {}) {
1690
1689
  return payload;
1691
1690
  }
1692
1691
 
1693
- // node_modules/jose/dist/webapi/jwt/verify.js
1692
+ // ../../node_modules/jose/dist/webapi/jwt/verify.js
1694
1693
  async function jwtVerify(jwt, key, options) {
1695
1694
  const verified = await compactVerify(jwt, key, options);
1696
1695
  if (verified.protectedHeader.crit?.includes("b64") && verified.protectedHeader.b64 === false) {