@workos-inc/node 7.50.0 → 7.51.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/lib/actions/actions.js +2 -2
- package/lib/actions/actions.spec.js +3 -3
- package/lib/common/crypto/crypto-provider.d.ts +33 -0
- package/lib/common/crypto/{CryptoProvider.spec.js → crypto-provider.spec.js} +8 -8
- package/lib/common/crypto/node-crypto-provider.d.ts +7 -0
- package/lib/common/crypto/node-crypto-provider.js +38 -2
- package/lib/common/crypto/{SignatureProvider.d.ts → signature-provider.d.ts} +1 -1
- package/lib/common/crypto/{SignatureProvider.spec.js → signature-provider.spec.js} +4 -4
- package/lib/common/crypto/subtle-crypto-provider.d.ts +7 -0
- package/lib/common/crypto/subtle-crypto-provider.js +48 -0
- package/lib/common/utils/base64.d.ts +12 -0
- package/lib/common/utils/base64.js +52 -0
- package/lib/common/utils/pagination.d.ts +1 -1
- package/lib/fga/fga.d.ts +2 -1
- package/lib/fga/fga.js +3 -1
- package/lib/fga/fga.spec.js +144 -0
- package/lib/fga/interfaces/check.interface.d.ts +4 -0
- package/lib/fga/interfaces/check.interface.js +1 -0
- package/lib/fga/interfaces/list.interface.d.ts +8 -0
- package/lib/fga/interfaces/list.interface.js +2 -0
- package/lib/fga/interfaces/warning.interface.d.ts +9 -0
- package/lib/fga/interfaces/warning.interface.js +2 -0
- package/lib/fga/serializers/index.d.ts +1 -0
- package/lib/fga/serializers/index.js +1 -0
- package/lib/fga/serializers/list.serializer.d.ts +5 -0
- package/lib/fga/serializers/list.serializer.js +10 -0
- package/lib/fga/serializers/query-result.serializer.d.ts +5 -0
- package/lib/fga/utils/fetch-and-deserialize-list.d.ts +5 -0
- package/lib/fga/utils/fetch-and-deserialize-list.js +18 -0
- package/lib/fga/utils/fga-paginatable.d.ts +9 -0
- package/lib/fga/utils/fga-paginatable.js +13 -0
- package/lib/index.d.ts +2 -0
- package/lib/index.js +5 -9
- package/lib/index.worker.d.ts +2 -0
- package/lib/index.worker.js +3 -0
- package/lib/user-management/interfaces/update-user-options.interface.d.ts +4 -2
- package/lib/user-management/serializers/update-user-options.serializer.js +2 -1
- package/lib/user-management/user-management.spec.js +10 -0
- package/lib/vault/vault.d.ts +5 -3
- package/lib/vault/vault.js +60 -6
- package/lib/vault/vault.spec.js +39 -0
- package/lib/webhooks/webhooks.js +2 -2
- package/lib/workos.d.ts +2 -0
- package/lib/workos.js +6 -3
- package/package.json +1 -1
- package/lib/common/crypto/CryptoProvider.d.ts +0 -32
- package/lib/common/crypto/CryptoProvider.js +0 -13
- package/lib/common/crypto/NodeCryptoProvider.d.ts +0 -12
- package/lib/common/crypto/NodeCryptoProvider.js +0 -73
- package/lib/common/crypto/SubtleCryptoProvider.d.ts +0 -15
- package/lib/common/crypto/SubtleCryptoProvider.js +0 -75
- package/lib/vault/cryptography/decrypt.d.ts +0 -9
- package/lib/vault/cryptography/decrypt.js +0 -39
- package/lib/vault/cryptography/encrypt.d.ts +0 -1
- package/lib/vault/cryptography/encrypt.js +0 -33
- /package/lib/common/crypto/{CryptoProvider.spec.d.ts → crypto-provider.spec.d.ts} +0 -0
- /package/lib/common/crypto/{SignatureProvider.js → signature-provider.js} +0 -0
- /package/lib/common/crypto/{SignatureProvider.spec.d.ts → signature-provider.spec.d.ts} +0 -0
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
export interface Decoded {
|
|
3
|
-
iv: Buffer;
|
|
4
|
-
tag: Buffer;
|
|
5
|
-
keys: string;
|
|
6
|
-
ciphertext: Buffer;
|
|
7
|
-
}
|
|
8
|
-
export declare const decrypt: (payload: string | Decoded, dataKey: string, aad: string) => string;
|
|
9
|
-
export declare const decode: (payload: string) => Decoded;
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.decode = exports.decrypt = void 0;
|
|
7
|
-
const crypto_1 = __importDefault(require("crypto"));
|
|
8
|
-
const leb_1 = require("leb");
|
|
9
|
-
const decrypt = (payload, dataKey, aad) => {
|
|
10
|
-
if (typeof payload === 'string') {
|
|
11
|
-
payload = (0, exports.decode)(payload);
|
|
12
|
-
}
|
|
13
|
-
const { iv, tag, ciphertext } = payload;
|
|
14
|
-
const key = Buffer.from(dataKey, 'base64');
|
|
15
|
-
const decipher = crypto_1.default
|
|
16
|
-
.createDecipheriv('aes-256-gcm', key, iv)
|
|
17
|
-
.setAAD(Buffer.from(aad))
|
|
18
|
-
.setAuthTag(tag);
|
|
19
|
-
const decrypted = decipher.update(ciphertext, undefined, 'utf-8') + decipher.final('utf-8');
|
|
20
|
-
return decrypted;
|
|
21
|
-
};
|
|
22
|
-
exports.decrypt = decrypt;
|
|
23
|
-
const decode = (payload) => {
|
|
24
|
-
const inputData = Buffer.from(payload, 'base64');
|
|
25
|
-
const iv = inputData.slice(0, 32);
|
|
26
|
-
const tag = inputData.slice(32, 48);
|
|
27
|
-
const { value: keyLen, nextIndex } = (0, leb_1.decodeUInt32)(inputData, 48);
|
|
28
|
-
const keys = inputData
|
|
29
|
-
.slice(nextIndex, nextIndex + keyLen)
|
|
30
|
-
.toString('base64');
|
|
31
|
-
const ciphertext = inputData.slice(nextIndex + keyLen);
|
|
32
|
-
return {
|
|
33
|
-
iv,
|
|
34
|
-
tag,
|
|
35
|
-
keys,
|
|
36
|
-
ciphertext,
|
|
37
|
-
};
|
|
38
|
-
};
|
|
39
|
-
exports.decode = decode;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const encrypt: (data: string, dataKey: string, encryptedKeys: string, aad: string) => string;
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.encrypt = void 0;
|
|
7
|
-
const crypto_1 = __importDefault(require("crypto"));
|
|
8
|
-
const leb_1 = require("leb");
|
|
9
|
-
const encrypt = (data, dataKey, encryptedKeys, aad) => {
|
|
10
|
-
// encrypt using the returned data key
|
|
11
|
-
const key = Buffer.from(dataKey, 'base64');
|
|
12
|
-
const keyBlob = Buffer.from(encryptedKeys, 'base64');
|
|
13
|
-
const prefixLen = (0, leb_1.encodeUInt32)(keyBlob.length);
|
|
14
|
-
const iv = crypto_1.default.randomBytes(32);
|
|
15
|
-
const cipher = crypto_1.default
|
|
16
|
-
.createCipheriv('aes-256-gcm', key, iv)
|
|
17
|
-
.setAAD(Buffer.from(aad));
|
|
18
|
-
const ciphertext = Buffer.concat([
|
|
19
|
-
cipher.update(data, 'utf8'),
|
|
20
|
-
cipher.final(),
|
|
21
|
-
]);
|
|
22
|
-
const tag = cipher.getAuthTag();
|
|
23
|
-
// store the encrypted keys with the ciphertext
|
|
24
|
-
const payload = Buffer.concat([
|
|
25
|
-
iv,
|
|
26
|
-
tag,
|
|
27
|
-
prefixLen,
|
|
28
|
-
keyBlob,
|
|
29
|
-
ciphertext,
|
|
30
|
-
]).toString('base64');
|
|
31
|
-
return payload;
|
|
32
|
-
};
|
|
33
|
-
exports.encrypt = encrypt;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|