@workos-inc/node 10.6.0 → 10.8.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 +23 -0
- package/lib/{factory-nPldaSjn.d.mts → factory-B8vTFojy.d.cts} +1278 -136
- package/lib/{factory-nPldaSjn.d.cts → factory-B8vTFojy.d.mts} +1278 -136
- package/lib/{factory-B6WUDYmR.cjs → factory-CoKXdPX2.cjs} +847 -105
- package/lib/factory-CoKXdPX2.cjs.map +1 -0
- package/lib/{factory-C3tbwZax.mjs → factory-MKPb5Egh.mjs} +847 -105
- package/lib/factory-MKPb5Egh.mjs.map +1 -0
- package/lib/index.cjs +102 -1
- package/lib/index.cjs.map +1 -1
- package/lib/index.d.cts +158 -3
- package/lib/index.d.mts +158 -3
- package/lib/index.mjs +89 -2
- package/lib/index.mjs.map +1 -1
- package/lib/index.worker.cjs +2 -1
- package/lib/index.worker.cjs.map +1 -1
- package/lib/index.worker.d.cts +2 -3
- package/lib/index.worker.d.mts +2 -3
- package/lib/index.worker.mjs +2 -1
- package/lib/index.worker.mjs.map +1 -1
- package/lib/{webapi-S8D5YgJz.mjs → webapi-BgpV54gi.mjs} +22 -19
- package/lib/{webapi-S8D5YgJz.mjs.map → webapi-BgpV54gi.mjs.map} +1 -1
- package/lib/{webapi-CVu-Hjaz.cjs → webapi-BzGFatFp.cjs} +22 -19
- package/lib/{webapi-CVu-Hjaz.cjs.map → webapi-BzGFatFp.cjs.map} +1 -1
- package/package.json +1 -1
- package/lib/factory-B6WUDYmR.cjs.map +0 -1
- package/lib/factory-C3tbwZax.mjs.map +0 -1
|
@@ -36,13 +36,13 @@ function writeUInt32BE(buf, value, offset) {
|
|
|
36
36
|
function uint64be(value) {
|
|
37
37
|
const high = Math.floor(value / MAX_INT32);
|
|
38
38
|
const low = value % MAX_INT32;
|
|
39
|
-
const buf = new Uint8Array(8);
|
|
39
|
+
const buf = /* @__PURE__ */ new Uint8Array(8);
|
|
40
40
|
writeUInt32BE(buf, high, 0);
|
|
41
41
|
writeUInt32BE(buf, low, 4);
|
|
42
42
|
return buf;
|
|
43
43
|
}
|
|
44
44
|
function uint32be(value) {
|
|
45
|
-
const buf = new Uint8Array(4);
|
|
45
|
+
const buf = /* @__PURE__ */ new Uint8Array(4);
|
|
46
46
|
writeUInt32BE(buf, value);
|
|
47
47
|
return buf;
|
|
48
48
|
}
|
|
@@ -627,10 +627,10 @@ async function concatKdf(Z, L, OtherInfo) {
|
|
|
627
627
|
}
|
|
628
628
|
return dk.slice(0, dkLen);
|
|
629
629
|
}
|
|
630
|
-
async function deriveKey$1(publicKey, privateKey, algorithm, keyLength, apu = new Uint8Array(), apv = new Uint8Array()) {
|
|
630
|
+
async function deriveKey$1(publicKey, privateKey, algorithm, keyLength, apu = /* @__PURE__ */ new Uint8Array(), apv = /* @__PURE__ */ new Uint8Array()) {
|
|
631
631
|
checkEncCryptoKey(publicKey, "ECDH");
|
|
632
632
|
checkEncCryptoKey(privateKey, "ECDH", "deriveBits");
|
|
633
|
-
const otherInfo = concat(lengthAndInput(encode$1(algorithm)), lengthAndInput(apu), lengthAndInput(apv), uint32be(keyLength), new Uint8Array());
|
|
633
|
+
const otherInfo = concat(lengthAndInput(encode$1(algorithm)), lengthAndInput(apu), lengthAndInput(apv), uint32be(keyLength), /* @__PURE__ */ new Uint8Array());
|
|
634
634
|
return concatKdf(new Uint8Array(await crypto.subtle.deriveBits({
|
|
635
635
|
name: publicKey.algorithm.name,
|
|
636
636
|
public: publicKey
|
|
@@ -670,7 +670,7 @@ async function deriveKey(p2s, alg, p2c, key) {
|
|
|
670
670
|
const cryptoKey = await getCryptoKey(key, alg);
|
|
671
671
|
return new Uint8Array(await crypto.subtle.deriveBits(subtleAlg, cryptoKey, keylen));
|
|
672
672
|
}
|
|
673
|
-
async function wrap$1(alg, key, cek, p2c = 2048, p2s = crypto.getRandomValues(new Uint8Array(16))) {
|
|
673
|
+
async function wrap$1(alg, key, cek, p2c = 2048, p2s = crypto.getRandomValues(/* @__PURE__ */ new Uint8Array(16))) {
|
|
674
674
|
const derived = await deriveKey(p2s, alg, p2c, key);
|
|
675
675
|
return {
|
|
676
676
|
encryptedKey: await wrap$2(alg.slice(-6), derived, cek),
|
|
@@ -964,11 +964,11 @@ const handleKeyObject = (keyObject, alg) => {
|
|
|
964
964
|
}, extractable, [isPublic ? "verify" : "sign"]);
|
|
965
965
|
}
|
|
966
966
|
if (keyObject.asymmetricKeyType === "ec") {
|
|
967
|
-
const namedCurve = new Map([
|
|
967
|
+
const namedCurve = (/* @__PURE__ */ new Map([
|
|
968
968
|
["prime256v1", "P-256"],
|
|
969
969
|
["secp384r1", "P-384"],
|
|
970
970
|
["secp521r1", "P-521"]
|
|
971
|
-
]).get(keyObject.asymmetricKeyDetails?.namedCurve);
|
|
971
|
+
])).get(keyObject.asymmetricKeyDetails?.namedCurve);
|
|
972
972
|
if (!namedCurve) throw new TypeError(unusableForAlg);
|
|
973
973
|
const expectedCurve = {
|
|
974
974
|
ES256: "P-256",
|
|
@@ -999,7 +999,8 @@ async function normalizeKey(key, alg) {
|
|
|
999
999
|
} catch (err) {
|
|
1000
1000
|
if (err instanceof TypeError) throw err;
|
|
1001
1001
|
}
|
|
1002
|
-
|
|
1002
|
+
let jwk = key.export({ format: "jwk" });
|
|
1003
|
+
return handleJWK(key, jwk, alg);
|
|
1003
1004
|
}
|
|
1004
1005
|
if (isJWK(key)) {
|
|
1005
1006
|
if (key.k) return decode(key.k);
|
|
@@ -1063,7 +1064,8 @@ const getSubarray = (state, length) => {
|
|
|
1063
1064
|
};
|
|
1064
1065
|
const parseAlgorithmOID = (state) => {
|
|
1065
1066
|
expectTag(state, 6, "Expected algorithm OID");
|
|
1066
|
-
|
|
1067
|
+
const oidLen = parseLength(state);
|
|
1068
|
+
return getSubarray(state, oidLen);
|
|
1067
1069
|
};
|
|
1068
1070
|
function parsePKCS8Header(state) {
|
|
1069
1071
|
expectTag(state, 48, "Invalid PKCS#8 structure");
|
|
@@ -1105,7 +1107,8 @@ const parseECAlgorithmIdentifier = (state) => {
|
|
|
1105
1107
|
1
|
|
1106
1108
|
])) throw new Error("Unsupported key algorithm");
|
|
1107
1109
|
expectTag(state, 6, "Expected curve OID");
|
|
1108
|
-
const
|
|
1110
|
+
const curveOidLen = parseLength(state);
|
|
1111
|
+
const curveOid = getSubarray(state, curveOidLen);
|
|
1109
1112
|
for (const { name, oid } of [
|
|
1110
1113
|
{
|
|
1111
1114
|
name: "P-256",
|
|
@@ -1350,7 +1353,7 @@ async function exportJWK(key) {
|
|
|
1350
1353
|
//#endregion
|
|
1351
1354
|
//#region node_modules/jose/dist/webapi/lib/aesgcmkw.js
|
|
1352
1355
|
async function wrap(alg, key, cek, iv) {
|
|
1353
|
-
const wrapped = await encrypt$1(alg.slice(0, 7), cek, key, iv, new Uint8Array());
|
|
1356
|
+
const wrapped = await encrypt$1(alg.slice(0, 7), cek, key, iv, /* @__PURE__ */ new Uint8Array());
|
|
1354
1357
|
return {
|
|
1355
1358
|
encryptedKey: wrapped.ciphertext,
|
|
1356
1359
|
iv: encode(wrapped.iv),
|
|
@@ -1358,7 +1361,7 @@ async function wrap(alg, key, cek, iv) {
|
|
|
1358
1361
|
};
|
|
1359
1362
|
}
|
|
1360
1363
|
async function unwrap(alg, key, encryptedKey, iv, tag) {
|
|
1361
|
-
return decrypt$1(alg.slice(0, 7), key, encryptedKey, iv, tag, new Uint8Array());
|
|
1364
|
+
return decrypt$1(alg.slice(0, 7), key, encryptedKey, iv, tag, /* @__PURE__ */ new Uint8Array());
|
|
1362
1365
|
}
|
|
1363
1366
|
//#endregion
|
|
1364
1367
|
//#region node_modules/jose/dist/webapi/lib/key_management.js
|
|
@@ -1713,7 +1716,7 @@ async function flattenedDecrypt(jwe, key, options) {
|
|
|
1713
1716
|
let tag;
|
|
1714
1717
|
if (jwe.iv !== void 0) iv = decodeBase64url(jwe.iv, "iv", JWEInvalid);
|
|
1715
1718
|
if (jwe.tag !== void 0) tag = decodeBase64url(jwe.tag, "tag", JWEInvalid);
|
|
1716
|
-
const protectedHeader = jwe.protected !== void 0 ? encode$1(jwe.protected) : new Uint8Array();
|
|
1719
|
+
const protectedHeader = jwe.protected !== void 0 ? encode$1(jwe.protected) : /* @__PURE__ */ new Uint8Array();
|
|
1717
1720
|
let additionalData;
|
|
1718
1721
|
if (jwe.aad !== void 0) additionalData = concat(protectedHeader, encode$1("."), encode$1(jwe.aad));
|
|
1719
1722
|
else additionalData = protectedHeader;
|
|
@@ -1874,7 +1877,7 @@ var FlattenedEncrypt = class {
|
|
|
1874
1877
|
protectedHeaderB = encode$1(protectedHeaderS);
|
|
1875
1878
|
} else {
|
|
1876
1879
|
protectedHeaderS = "";
|
|
1877
|
-
protectedHeaderB = new Uint8Array();
|
|
1880
|
+
protectedHeaderB = /* @__PURE__ */ new Uint8Array();
|
|
1878
1881
|
}
|
|
1879
1882
|
if (this.#aad) {
|
|
1880
1883
|
aadMember = encode(this.#aad);
|
|
@@ -2053,7 +2056,7 @@ async function flattenedVerify(jws, key, options) {
|
|
|
2053
2056
|
...parsedProt,
|
|
2054
2057
|
...jws.header
|
|
2055
2058
|
};
|
|
2056
|
-
const extensions = validateCrit(JWSInvalid, new Map([["b64", true]]), options?.crit, parsedProt, joseHeader);
|
|
2059
|
+
const extensions = validateCrit(JWSInvalid, /* @__PURE__ */ new Map([["b64", true]]), options?.crit, parsedProt, joseHeader);
|
|
2057
2060
|
let b64 = true;
|
|
2058
2061
|
if (extensions.has("b64")) {
|
|
2059
2062
|
b64 = parsedProt.b64;
|
|
@@ -2072,7 +2075,7 @@ async function flattenedVerify(jws, key, options) {
|
|
|
2072
2075
|
resolvedKey = true;
|
|
2073
2076
|
}
|
|
2074
2077
|
checkKeyType(alg, key, "verify");
|
|
2075
|
-
const data = concat(jws.protected !== void 0 ? encode$1(jws.protected) : new Uint8Array(), encode$1("."), typeof jws.payload === "string" ? b64 ? encode$1(jws.payload) : encoder.encode(jws.payload) : jws.payload);
|
|
2078
|
+
const data = concat(jws.protected !== void 0 ? encode$1(jws.protected) : /* @__PURE__ */ new Uint8Array(), encode$1("."), typeof jws.payload === "string" ? b64 ? encode$1(jws.payload) : encoder.encode(jws.payload) : jws.payload);
|
|
2076
2079
|
const signature = decodeBase64url(jws.signature, "signature", JWSInvalid);
|
|
2077
2080
|
const k = await normalizeKey(key, alg);
|
|
2078
2081
|
if (!await verify(alg, k, signature, data)) throw new JWSSignatureVerificationFailed();
|
|
@@ -2385,7 +2388,7 @@ var FlattenedSign = class {
|
|
|
2385
2388
|
...this.#protectedHeader,
|
|
2386
2389
|
...this.#unprotectedHeader
|
|
2387
2390
|
};
|
|
2388
|
-
const extensions = validateCrit(JWSInvalid, new Map([["b64", true]]), options?.crit, this.#protectedHeader, joseHeader);
|
|
2391
|
+
const extensions = validateCrit(JWSInvalid, /* @__PURE__ */ new Map([["b64", true]]), options?.crit, this.#protectedHeader, joseHeader);
|
|
2389
2392
|
let b64 = true;
|
|
2390
2393
|
if (extensions.has("b64")) {
|
|
2391
2394
|
b64 = this.#protectedHeader.b64;
|
|
@@ -2410,7 +2413,7 @@ var FlattenedSign = class {
|
|
|
2410
2413
|
protectedHeaderBytes = encode$1(protectedHeaderString);
|
|
2411
2414
|
} else {
|
|
2412
2415
|
protectedHeaderString = "";
|
|
2413
|
-
protectedHeaderBytes = new Uint8Array();
|
|
2416
|
+
protectedHeaderBytes = /* @__PURE__ */ new Uint8Array();
|
|
2414
2417
|
}
|
|
2415
2418
|
const data = concat(protectedHeaderBytes, encode$1("."), payloadB);
|
|
2416
2419
|
const jws = {
|
|
@@ -3265,4 +3268,4 @@ exports.jwksCache = jwksCache;
|
|
|
3265
3268
|
exports.jwtDecrypt = jwtDecrypt;
|
|
3266
3269
|
exports.jwtVerify = jwtVerify;
|
|
3267
3270
|
|
|
3268
|
-
//# sourceMappingURL=webapi-
|
|
3271
|
+
//# sourceMappingURL=webapi-BzGFatFp.cjs.map
|