@authup/server-kit 1.0.0-beta.4 → 1.0.0-beta.41
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/LICENSE +1 -1
- package/README.md +1 -1
- package/dist/crypto/hash/hash.d.ts +1 -1
- package/dist/crypto/hash/hash.d.ts.map +1 -1
- package/dist/crypto/index.d.ts +1 -1
- package/dist/crypto/index.d.ts.map +1 -1
- package/dist/crypto/json-web-token/extract.d.ts +16 -0
- package/dist/crypto/json-web-token/extract.d.ts.map +1 -0
- package/dist/crypto/json-web-token/index.d.ts +1 -1
- package/dist/crypto/json-web-token/index.d.ts.map +1 -1
- package/dist/crypto/json-web-token/sign/index.d.ts +3 -0
- package/dist/crypto/json-web-token/sign/index.d.ts.map +1 -0
- package/dist/crypto/json-web-token/sign/module.d.ts +4 -0
- package/dist/crypto/json-web-token/sign/module.d.ts.map +1 -0
- package/dist/crypto/json-web-token/sign/types.d.ts +28 -0
- package/dist/crypto/json-web-token/sign/types.d.ts.map +1 -0
- package/dist/crypto/json-web-token/type.d.ts +4 -33
- package/dist/crypto/json-web-token/type.d.ts.map +1 -1
- package/dist/crypto/json-web-token/utils.d.ts +5 -2
- package/dist/crypto/json-web-token/utils.d.ts.map +1 -1
- package/dist/crypto/json-web-token/verify/index.d.ts +3 -0
- package/dist/crypto/json-web-token/verify/index.d.ts.map +1 -0
- package/dist/crypto/json-web-token/verify/module.d.ts +12 -0
- package/dist/crypto/json-web-token/verify/module.d.ts.map +1 -0
- package/dist/crypto/json-web-token/verify/types.d.ts +25 -0
- package/dist/crypto/json-web-token/verify/types.d.ts.map +1 -0
- package/dist/crypto/key/asymmetric/check.d.ts +3 -0
- package/dist/crypto/key/asymmetric/check.d.ts.map +1 -0
- package/dist/crypto/key/asymmetric/constants.d.ts +8 -0
- package/dist/crypto/key/asymmetric/constants.d.ts.map +1 -0
- package/dist/crypto/key/asymmetric/create.d.ts +3 -0
- package/dist/crypto/key/asymmetric/create.d.ts.map +1 -0
- package/dist/crypto/key/asymmetric/helpers/index.d.ts +2 -0
- package/dist/crypto/key/asymmetric/helpers/index.d.ts.map +1 -0
- package/dist/crypto/key/asymmetric/helpers/wrap.d.ts +5 -0
- package/dist/crypto/key/asymmetric/helpers/wrap.d.ts.map +1 -0
- package/dist/crypto/key/asymmetric/index.d.ts +9 -0
- package/dist/crypto/key/asymmetric/index.d.ts.map +1 -0
- package/dist/crypto/key/asymmetric/key-usages.d.ts +5 -0
- package/dist/crypto/key/asymmetric/key-usages.d.ts.map +1 -0
- package/dist/crypto/key/asymmetric/module.d.ts +20 -0
- package/dist/crypto/key/asymmetric/module.d.ts.map +1 -0
- package/dist/crypto/key/asymmetric/normalize.d.ts +4 -0
- package/dist/crypto/key/asymmetric/normalize.d.ts.map +1 -0
- package/dist/crypto/key/asymmetric/types.d.ts +35 -0
- package/dist/crypto/key/asymmetric/types.d.ts.map +1 -0
- package/dist/crypto/key/base.d.ts +9 -0
- package/dist/crypto/key/base.d.ts.map +1 -0
- package/dist/crypto/key/index.d.ts +4 -0
- package/dist/crypto/key/index.d.ts.map +1 -0
- package/dist/crypto/key/symmetric/check.d.ts +3 -0
- package/dist/crypto/key/symmetric/check.d.ts.map +1 -0
- package/dist/crypto/key/symmetric/constants.d.ts +7 -0
- package/dist/crypto/key/symmetric/constants.d.ts.map +1 -0
- package/dist/crypto/key/symmetric/create.d.ts +3 -0
- package/dist/crypto/key/symmetric/create.d.ts.map +1 -0
- package/dist/crypto/key/symmetric/index.d.ts +7 -0
- package/dist/crypto/key/symmetric/index.d.ts.map +1 -0
- package/dist/crypto/key/symmetric/key-usages.d.ts +2 -0
- package/dist/crypto/key/symmetric/key-usages.d.ts.map +1 -0
- package/dist/crypto/key/symmetric/module.d.ts +13 -0
- package/dist/crypto/key/symmetric/module.d.ts.map +1 -0
- package/dist/crypto/key/symmetric/normalize.d.ts +4 -0
- package/dist/crypto/key/symmetric/normalize.d.ts.map +1 -0
- package/dist/crypto/key/symmetric/types.d.ts +32 -0
- package/dist/crypto/key/symmetric/types.d.ts.map +1 -0
- package/dist/domain-event/index.d.ts +1 -1
- package/dist/domain-event/index.d.ts.map +1 -1
- package/dist/domain-event/module.d.ts +9 -0
- package/dist/domain-event/module.d.ts.map +1 -0
- package/dist/domain-event/redis/index.d.ts +1 -1
- package/dist/domain-event/redis/index.d.ts.map +1 -1
- package/dist/domain-event/redis/module.d.ts +9 -0
- package/dist/domain-event/redis/module.d.ts.map +1 -0
- package/dist/domain-event/socket/index.d.ts +1 -2
- package/dist/domain-event/socket/index.d.ts.map +1 -1
- package/dist/domain-event/socket/module.d.ts +9 -0
- package/dist/domain-event/socket/module.d.ts.map +1 -0
- package/dist/domain-event/type.d.ts +8 -0
- package/dist/domain-event/type.d.ts.map +1 -1
- package/dist/domain-event/utils.d.ts +2 -1
- package/dist/domain-event/utils.d.ts.map +1 -1
- package/dist/index.d.mts +379 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.d.ts +1 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +704 -579
- package/dist/index.mjs.map +1 -1
- package/dist/services/cache/adapters/index.d.ts +3 -0
- package/dist/services/cache/adapters/index.d.ts.map +1 -0
- package/dist/services/cache/adapters/memory.d.ts +15 -0
- package/dist/services/cache/adapters/memory.d.ts.map +1 -0
- package/dist/services/cache/adapters/redis.d.ts +17 -0
- package/dist/services/cache/adapters/redis.d.ts.map +1 -0
- package/dist/services/cache/helper.d.ts +3 -0
- package/dist/services/cache/helper.d.ts.map +1 -0
- package/dist/services/cache/index.d.ts +4 -0
- package/dist/services/cache/index.d.ts.map +1 -0
- package/dist/services/cache/types.d.ts +25 -0
- package/dist/services/cache/types.d.ts.map +1 -0
- package/dist/services/index.d.ts +5 -0
- package/dist/services/index.d.ts.map +1 -0
- package/dist/services/logger/index.d.ts +4 -0
- package/dist/services/logger/index.d.ts.map +1 -0
- package/dist/services/logger/module.d.ts +4 -0
- package/dist/services/logger/module.d.ts.map +1 -0
- package/dist/services/logger/singleton.d.ts +7 -0
- package/dist/services/logger/singleton.d.ts.map +1 -0
- package/dist/services/logger/types.d.ts +7 -0
- package/dist/services/logger/types.d.ts.map +1 -0
- package/dist/services/redis/check.d.ts +3 -0
- package/dist/services/redis/check.d.ts.map +1 -0
- package/dist/services/redis/factory.d.ts +4 -0
- package/dist/services/redis/factory.d.ts.map +1 -0
- package/dist/services/redis/index.d.ts +4 -0
- package/dist/services/redis/index.d.ts.map +1 -0
- package/dist/services/redis/module.d.ts +5 -0
- package/dist/services/redis/module.d.ts.map +1 -0
- package/dist/services/vault/index.d.ts +3 -0
- package/dist/services/vault/index.d.ts.map +1 -0
- package/dist/services/vault/module.d.ts +3 -0
- package/dist/services/vault/module.d.ts.map +1 -0
- package/dist/services/vault/singleton.d.ts +6 -0
- package/dist/services/vault/singleton.d.ts.map +1 -0
- package/package.json +45 -34
- package/dist/crypto/json-web-token/decode.d.ts +0 -15
- package/dist/crypto/json-web-token/decode.d.ts.map +0 -1
- package/dist/crypto/json-web-token/sign.d.ts +0 -4
- package/dist/crypto/json-web-token/sign.d.ts.map +0 -1
- package/dist/crypto/json-web-token/verify.d.ts +0 -15
- package/dist/crypto/json-web-token/verify.d.ts.map +0 -1
- package/dist/crypto/key-pair/constants.d.ts +0 -5
- package/dist/crypto/key-pair/constants.d.ts.map +0 -1
- package/dist/crypto/key-pair/create.d.ts +0 -3
- package/dist/crypto/key-pair/create.d.ts.map +0 -1
- package/dist/crypto/key-pair/delete.d.ts +0 -3
- package/dist/crypto/key-pair/delete.d.ts.map +0 -1
- package/dist/crypto/key-pair/index.d.ts +0 -9
- package/dist/crypto/key-pair/index.d.ts.map +0 -1
- package/dist/crypto/key-pair/load.d.ts +0 -3
- package/dist/crypto/key-pair/load.d.ts.map +0 -1
- package/dist/crypto/key-pair/module.d.ts +0 -3
- package/dist/crypto/key-pair/module.d.ts.map +0 -1
- package/dist/crypto/key-pair/save.d.ts +0 -3
- package/dist/crypto/key-pair/save.d.ts.map +0 -1
- package/dist/crypto/key-pair/type.d.ts +0 -65
- package/dist/crypto/key-pair/type.d.ts.map +0 -1
- package/dist/crypto/key-pair/utils/check.d.ts +0 -4
- package/dist/crypto/key-pair/utils/check.d.ts.map +0 -1
- package/dist/crypto/key-pair/utils/file-name.d.ts +0 -4
- package/dist/crypto/key-pair/utils/file-name.d.ts.map +0 -1
- package/dist/crypto/key-pair/utils/index.d.ts +0 -5
- package/dist/crypto/key-pair/utils/index.d.ts.map +0 -1
- package/dist/crypto/key-pair/utils/options.d.ts +0 -3
- package/dist/crypto/key-pair/utils/options.d.ts.map +0 -1
- package/dist/crypto/key-pair/utils/private-key.d.ts +0 -4
- package/dist/crypto/key-pair/utils/private-key.d.ts.map +0 -1
- package/dist/domain-event/publish.d.ts +0 -4
- package/dist/domain-event/publish.d.ts.map +0 -1
- package/dist/domain-event/redis/publish.d.ts +0 -4
- package/dist/domain-event/redis/publish.d.ts.map +0 -1
- package/dist/domain-event/socket/publish.d.ts +0 -4
- package/dist/domain-event/socket/publish.d.ts.map +0 -1
- package/dist/domain-event/socket/singleton.d.ts +0 -4
- package/dist/domain-event/socket/singleton.d.ts.map +0 -1
- package/dist/domain-event/socket/type.d.ts +0 -5
- package/dist/domain-event/socket/type.d.ts.map +0 -1
- package/dist/index.cjs +0 -642
- package/dist/index.cjs.map +0 -1
- package/dist/logger/index.d.ts +0 -4
- package/dist/logger/index.d.ts.map +0 -1
- package/dist/logger/module.d.ts +0 -4
- package/dist/logger/module.d.ts.map +0 -1
- package/dist/logger/presets/index.d.ts +0 -2
- package/dist/logger/presets/index.d.ts.map +0 -1
- package/dist/logger/presets/void.d.ts +0 -16
- package/dist/logger/presets/void.d.ts.map +0 -1
- package/dist/logger/type.d.ts +0 -14
- package/dist/logger/type.d.ts.map +0 -1
- package/dist/smtp/config/index.d.ts +0 -2
- package/dist/smtp/config/index.d.ts.map +0 -1
- package/dist/smtp/config/singleton.d.ts +0 -5
- package/dist/smtp/config/singleton.d.ts.map +0 -1
- package/dist/smtp/index.d.ts +0 -5
- package/dist/smtp/index.d.ts.map +0 -1
- package/dist/smtp/module.d.ts +0 -4
- package/dist/smtp/module.d.ts.map +0 -1
- package/dist/smtp/singleton.d.ts +0 -3
- package/dist/smtp/singleton.d.ts.map +0 -1
- package/dist/smtp/type.d.ts +0 -14
- package/dist/smtp/type.d.ts.map +0 -1
package/dist/index.mjs
CHANGED
|
@@ -1,613 +1,738 @@
|
|
|
1
|
-
import { compare as compare$1, hash as hash$1 } from
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
|
|
1
|
+
import { compare as compare$1, hash as hash$1 } from "@node-rs/bcrypt";
|
|
2
|
+
import { arrayBufferToBase64, base64ToArrayBuffer, isObject } from "@authup/kit";
|
|
3
|
+
import { JWKType, JWTAlgorithm, JWTError } from "@authup/specs";
|
|
4
|
+
import { subtle } from "uncrypto";
|
|
5
|
+
import { Algorithm, sign, verify } from "@node-rs/jsonwebtoken";
|
|
6
|
+
import { isObject as isObject$1 } from "smob";
|
|
7
|
+
import { TTLCache } from "@isaacs/ttlcache";
|
|
8
|
+
import { Client as RedisClient, JsonAdapter, JsonAdapter as RedisJsonAdapter, Watcher as RedisWatcher, buildKeyPath as buildRedisKeyPath, createClient, escapeKey as escapeRedisKey, parseKeyPath as parseRedisKeyPath } from "redis-extension";
|
|
9
|
+
import path from "node:path";
|
|
10
|
+
import process from "node:process";
|
|
11
|
+
import { Logger, createLogger as createLogger$1, format, transports } from "winston";
|
|
12
|
+
import { singa } from "singa";
|
|
13
|
+
import { VaultClient, createClient as createVaultClient } from "@hapic/vault";
|
|
14
|
+
import { buildEventFullName } from "@authup/core-realtime-kit";
|
|
15
|
+
import { Emitter } from "@socket.io/redis-emitter";
|
|
16
|
+
//#region src/crypto/hash/compare.ts
|
|
12
17
|
async function compare(value, hashedValue) {
|
|
13
|
-
|
|
18
|
+
return compare$1(value, hashedValue);
|
|
14
19
|
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
20
|
+
//#endregion
|
|
21
|
+
//#region src/crypto/hash/hash.ts
|
|
22
|
+
async function hash(str, rounds = 10) {
|
|
23
|
+
return hash$1(str, rounds);
|
|
18
24
|
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
25
|
+
//#endregion
|
|
26
|
+
//#region src/crypto/key/asymmetric/constants.ts
|
|
27
|
+
let CryptoAsymmetricAlgorithm = /* @__PURE__ */ function(CryptoAsymmetricAlgorithm) {
|
|
28
|
+
CryptoAsymmetricAlgorithm["RSA_PSS"] = "RSA-PSS";
|
|
29
|
+
CryptoAsymmetricAlgorithm["RSASSA_PKCS1_V1_5"] = "RSASSA-PKCS1-v1_5";
|
|
30
|
+
CryptoAsymmetricAlgorithm["RSA_OAEP"] = "RSA-OAEP";
|
|
31
|
+
CryptoAsymmetricAlgorithm["ECDSA"] = "ECDSA";
|
|
32
|
+
CryptoAsymmetricAlgorithm["ECDH"] = "ECDH";
|
|
33
|
+
return CryptoAsymmetricAlgorithm;
|
|
34
|
+
}({});
|
|
35
|
+
//#endregion
|
|
36
|
+
//#region src/crypto/key/base.ts
|
|
37
|
+
var BaseKey = class {
|
|
38
|
+
key;
|
|
39
|
+
constructor(cryptoKey) {
|
|
40
|
+
this.key = cryptoKey;
|
|
41
|
+
}
|
|
42
|
+
async toArrayBuffer() {
|
|
43
|
+
if (this.key.type === "private") return subtle.exportKey("pkcs8", this.key);
|
|
44
|
+
if (this.key.type === "public") return subtle.exportKey("spki", this.key);
|
|
45
|
+
return subtle.exportKey("raw", this.key);
|
|
46
|
+
}
|
|
47
|
+
async toUint8Array() {
|
|
48
|
+
const arrayBuffer = await this.toArrayBuffer();
|
|
49
|
+
return new Uint8Array(arrayBuffer);
|
|
50
|
+
}
|
|
51
|
+
async toBase64() {
|
|
52
|
+
return arrayBufferToBase64(await this.toArrayBuffer());
|
|
53
|
+
}
|
|
54
|
+
async toJWK() {
|
|
55
|
+
return subtle.exportKey("jwk", this.key);
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
//#endregion
|
|
59
|
+
//#region src/crypto/key/asymmetric/helpers/wrap.ts
|
|
60
|
+
function enc(type, input) {
|
|
61
|
+
return `-----BEGIN ${type}-----\n${input}\n-----END ${type}-----`;
|
|
33
62
|
}
|
|
34
|
-
function
|
|
35
|
-
|
|
63
|
+
function encodePKCS8ToPEM(base64) {
|
|
64
|
+
return enc("PRIVATE KEY", base64);
|
|
36
65
|
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
var _options;
|
|
40
|
-
options = options ?? {};
|
|
41
|
-
options.directory = options.directory || process.cwd();
|
|
42
|
-
options.directory = path.isAbsolute(options.directory) ? options.directory : path.resolve(process.cwd(), options.directory);
|
|
43
|
-
(_options = options).type ?? (_options.type = 'rsa');
|
|
44
|
-
if (options.type === 'rsa' || options.type === 'rsa-pss' || options.type === 'dsa') {
|
|
45
|
-
options.modulusLength = 2048;
|
|
46
|
-
}
|
|
47
|
-
if (!options.privateKeyEncoding) {
|
|
48
|
-
options.privateKeyEncoding = {
|
|
49
|
-
type: 'pkcs8',
|
|
50
|
-
format: 'pem'
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
if (!options.publicKeyEncoding) {
|
|
54
|
-
options.publicKeyEncoding = {
|
|
55
|
-
type: 'spki',
|
|
56
|
-
format: 'pem'
|
|
57
|
-
};
|
|
58
|
-
}
|
|
59
|
-
if (options.privateKeyEncoding.passphrase && !options.privateKeyEncoding.cipher) {
|
|
60
|
-
options.privateKeyEncoding.cipher = 'aes-256-cbc';
|
|
61
|
-
}
|
|
62
|
-
return options;
|
|
66
|
+
function encodeSPKIToPem(input) {
|
|
67
|
+
return enc("PUBLIC KEY", input);
|
|
63
68
|
}
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
{
|
|
71
|
-
if (options.privateName) {
|
|
72
|
-
parts.push(options.privateName);
|
|
73
|
-
} else {
|
|
74
|
-
parts.push(type);
|
|
75
|
-
}
|
|
76
|
-
if (options.privateExtension) {
|
|
77
|
-
if (options.privateExtension.startsWith('.')) {
|
|
78
|
-
options.privateExtension = options.privateExtension.slice(1);
|
|
79
|
-
}
|
|
80
|
-
parts.push(options.privateExtension);
|
|
81
|
-
} else {
|
|
82
|
-
parts.push('pem');
|
|
83
|
-
}
|
|
84
|
-
break;
|
|
85
|
-
}
|
|
86
|
-
case KeyPairKind.PUBLIC:
|
|
87
|
-
{
|
|
88
|
-
if (options.publicName) {
|
|
89
|
-
parts.push(options.publicName);
|
|
90
|
-
} else {
|
|
91
|
-
parts.push(type);
|
|
92
|
-
}
|
|
93
|
-
if (options.publicExtension) {
|
|
94
|
-
if (options.publicExtension.startsWith('.')) {
|
|
95
|
-
options.publicExtension = options.publicExtension.slice(1);
|
|
96
|
-
}
|
|
97
|
-
parts.push(options.publicExtension);
|
|
98
|
-
} else {
|
|
99
|
-
parts.push('pem');
|
|
100
|
-
}
|
|
101
|
-
break;
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
return parts.join('.');
|
|
69
|
+
function dec(type, input) {
|
|
70
|
+
input = input.replace(`-----BEGIN ${type}-----\n`, "");
|
|
71
|
+
input = input.replace(`\n-----END ${type}-----\n`, "");
|
|
72
|
+
input = input.replace(`-----END ${type}-----\n`, "");
|
|
73
|
+
input = input.replace(`\n-----END ${type}-----`, "");
|
|
74
|
+
return input;
|
|
105
75
|
}
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
const privateKey = createPrivateKey({
|
|
109
|
-
type: context.privateKeyEncoding.type,
|
|
110
|
-
format: context.privateKeyEncoding.format,
|
|
111
|
-
key,
|
|
112
|
-
passphrase: context.privateKeyEncoding.passphrase || context.passphrase
|
|
113
|
-
});
|
|
114
|
-
let content = privateKey.export({
|
|
115
|
-
type: context.privateKeyEncoding.type,
|
|
116
|
-
format: context.privateKeyEncoding.format
|
|
117
|
-
});
|
|
118
|
-
if (typeof content !== 'string') {
|
|
119
|
-
content = Buffer.from(content).toString('utf-8');
|
|
120
|
-
}
|
|
121
|
-
return content;
|
|
76
|
+
function decodePemToPKCS8(input) {
|
|
77
|
+
return dec("PRIVATE KEY", input);
|
|
122
78
|
}
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
context = extendKeyPairOptions(context);
|
|
126
|
-
await fs.promises.mkdir(context.directory, {
|
|
127
|
-
recursive: true
|
|
128
|
-
});
|
|
129
|
-
await Promise.all([
|
|
130
|
-
{
|
|
131
|
-
path: path.resolve(context.directory, buildKeyFileName(KeyPairKind.PRIVATE, context)),
|
|
132
|
-
content: keyPair.privateKey
|
|
133
|
-
},
|
|
134
|
-
{
|
|
135
|
-
path: path.resolve(context.directory, buildKeyFileName(KeyPairKind.PUBLIC, context)),
|
|
136
|
-
content: keyPair.publicKey
|
|
137
|
-
}
|
|
138
|
-
].map((file)=>fs.promises.writeFile(file.path, file.content)));
|
|
139
|
-
return keyPair;
|
|
79
|
+
function decodePemToSpki(input) {
|
|
80
|
+
return dec("PUBLIC KEY", input);
|
|
140
81
|
}
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
case 'rsa-pss':
|
|
163
|
-
generateKeyPair(options.type, options, callback);
|
|
164
|
-
break;
|
|
165
|
-
}
|
|
166
|
-
});
|
|
167
|
-
if (options.save) {
|
|
168
|
-
await saveKeyPair(keyPair, options);
|
|
169
|
-
}
|
|
170
|
-
if (options.passphrase || options.privateKeyEncoding.passphrase) {
|
|
171
|
-
keyPair.privateKey = decryptRSAPrivateKey(options, keyPair.privateKey);
|
|
172
|
-
}
|
|
173
|
-
return keyPair;
|
|
82
|
+
//#endregion
|
|
83
|
+
//#region src/crypto/key/asymmetric/key-usages.ts
|
|
84
|
+
/**
|
|
85
|
+
* @see https://nodejs.org/api/webcrypto.html#cryptokeyusages
|
|
86
|
+
*/
|
|
87
|
+
function getKeyUsagesForAsymmetricAlgorithm(name, format) {
|
|
88
|
+
if (name === "RSA-PSS" || name === "ECDSA" || name === "RSASSA-PKCS1-v1_5") {
|
|
89
|
+
if (format === "spki") return ["verify"];
|
|
90
|
+
if (format === "pkcs8") return ["sign"];
|
|
91
|
+
return ["sign", "verify"];
|
|
92
|
+
}
|
|
93
|
+
if (name === "ECDH") {
|
|
94
|
+
if (format === "spki") return [];
|
|
95
|
+
return ["deriveKey", "deriveBits"];
|
|
96
|
+
}
|
|
97
|
+
if (name === "RSA-OAEP") {
|
|
98
|
+
if (format === "spki") return ["encrypt"];
|
|
99
|
+
if (format === "pkcs8") return ["decrypt"];
|
|
100
|
+
return ["encrypt", "decrypt"];
|
|
101
|
+
}
|
|
102
|
+
throw new SyntaxError(`Key usages can not be determined for asymmetric algorithm: ${name}`);
|
|
174
103
|
}
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
104
|
+
//#endregion
|
|
105
|
+
//#region src/crypto/key/asymmetric/normalize.ts
|
|
106
|
+
function normalizeAsymmetricKeyPairCreateOptions(options) {
|
|
107
|
+
let optionsNormalized;
|
|
108
|
+
switch (options.name) {
|
|
109
|
+
case "RSASSA-PKCS1-v1_5":
|
|
110
|
+
case "RSA-PSS":
|
|
111
|
+
case "RSA-OAEP":
|
|
112
|
+
optionsNormalized = {
|
|
113
|
+
modulusLength: 2048,
|
|
114
|
+
publicExponent: new Uint8Array([
|
|
115
|
+
1,
|
|
116
|
+
0,
|
|
117
|
+
1
|
|
118
|
+
]),
|
|
119
|
+
hash: "SHA-256",
|
|
120
|
+
...options
|
|
121
|
+
};
|
|
122
|
+
break;
|
|
123
|
+
case "ECDSA":
|
|
124
|
+
case "ECDH": optionsNormalized = {
|
|
125
|
+
namedCurve: "P-256",
|
|
126
|
+
...options
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
return optionsNormalized;
|
|
192
130
|
}
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
const publicKeyBuffer = await fs.promises.readFile(publicKeyPath);
|
|
212
|
-
publicKey = publicKeyBuffer.toString();
|
|
213
|
-
} catch (e) {
|
|
214
|
-
const publicKeyObject = createPublicKey({
|
|
215
|
-
key: privateKey,
|
|
216
|
-
format: options.privateKeyEncoding.format,
|
|
217
|
-
type: options.publicKeyEncoding.type
|
|
218
|
-
});
|
|
219
|
-
const stringOrBuffer = publicKeyObject.export({
|
|
220
|
-
format: options.publicKeyEncoding.format,
|
|
221
|
-
type: options.publicKeyEncoding.type
|
|
222
|
-
});
|
|
223
|
-
if (typeof stringOrBuffer !== 'string') {
|
|
224
|
-
publicKey = stringOrBuffer.toString();
|
|
225
|
-
} else {
|
|
226
|
-
publicKey = stringOrBuffer;
|
|
227
|
-
}
|
|
228
|
-
if (options.save) {
|
|
229
|
-
await saveKeyPair({
|
|
230
|
-
privateKey,
|
|
231
|
-
publicKey
|
|
232
|
-
}, options);
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
return {
|
|
236
|
-
privateKey,
|
|
237
|
-
publicKey
|
|
238
|
-
};
|
|
131
|
+
function normalizeAsymmetricKeyImportOptions(options) {
|
|
132
|
+
let optionsNormalized;
|
|
133
|
+
switch (options.name) {
|
|
134
|
+
case "RSASSA-PKCS1-v1_5":
|
|
135
|
+
case "RSA-PSS":
|
|
136
|
+
case "RSA-OAEP":
|
|
137
|
+
optionsNormalized = {
|
|
138
|
+
hash: "SHA-256",
|
|
139
|
+
...options
|
|
140
|
+
};
|
|
141
|
+
break;
|
|
142
|
+
case "ECDSA":
|
|
143
|
+
case "ECDH": optionsNormalized = {
|
|
144
|
+
namedCurve: "P-256",
|
|
145
|
+
...options
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
return optionsNormalized;
|
|
239
149
|
}
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
150
|
+
//#endregion
|
|
151
|
+
//#region src/crypto/key/asymmetric/module.ts
|
|
152
|
+
var AsymmetricKey = class AsymmetricKey extends BaseKey {
|
|
153
|
+
async toPem() {
|
|
154
|
+
const base64 = await this.toBase64();
|
|
155
|
+
if (this.key.type === "public") return encodeSPKIToPem(base64);
|
|
156
|
+
if (this.key.type === "private") return encodePKCS8ToPEM(base64);
|
|
157
|
+
throw new Error(`${this.key.type} can not be converted to pem.`);
|
|
158
|
+
}
|
|
159
|
+
static async fromPem(ctx) {
|
|
160
|
+
if (ctx.format === "pkcs8") return AsymmetricKey.fromBase64({
|
|
161
|
+
...ctx,
|
|
162
|
+
key: decodePemToPKCS8(ctx.key)
|
|
163
|
+
});
|
|
164
|
+
return AsymmetricKey.fromBase64({
|
|
165
|
+
...ctx,
|
|
166
|
+
key: decodePemToSpki(ctx.key)
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
static async fromBase64(ctx) {
|
|
170
|
+
const arrayBuffer = base64ToArrayBuffer(ctx.key);
|
|
171
|
+
return AsymmetricKey.fromArrayBuffer({
|
|
172
|
+
...ctx,
|
|
173
|
+
key: arrayBuffer
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
static async fromArrayBuffer(ctx) {
|
|
177
|
+
const normalizedOptions = normalizeAsymmetricKeyImportOptions(ctx.options);
|
|
178
|
+
return new AsymmetricKey(await subtle.importKey(ctx.format, ctx.key, normalizedOptions, true, getKeyUsagesForAsymmetricAlgorithm(normalizedOptions.name, ctx.format)));
|
|
179
|
+
}
|
|
180
|
+
static buildImportOptionsForJWTAlgorithm(alg) {
|
|
181
|
+
if (alg === JWTAlgorithm.RS256) return {
|
|
182
|
+
name: "RSASSA-PKCS1-v1_5",
|
|
183
|
+
hash: "SHA-256"
|
|
184
|
+
};
|
|
185
|
+
if (alg === JWTAlgorithm.RS384) return {
|
|
186
|
+
name: "RSASSA-PKCS1-v1_5",
|
|
187
|
+
hash: "SHA-384"
|
|
188
|
+
};
|
|
189
|
+
if (alg === JWTAlgorithm.RS512) return {
|
|
190
|
+
name: "RSASSA-PKCS1-v1_5",
|
|
191
|
+
hash: "SHA-512"
|
|
192
|
+
};
|
|
193
|
+
if (alg === JWTAlgorithm.ES256) return {
|
|
194
|
+
name: "ECDSA",
|
|
195
|
+
namedCurve: "P-256"
|
|
196
|
+
};
|
|
197
|
+
if (alg === JWTAlgorithm.ES384) return {
|
|
198
|
+
name: "ECDSA",
|
|
199
|
+
namedCurve: "P-384"
|
|
200
|
+
};
|
|
201
|
+
if (alg === JWTAlgorithm.ES512) return {
|
|
202
|
+
name: "ECDSA",
|
|
203
|
+
namedCurve: "P-521"
|
|
204
|
+
};
|
|
205
|
+
throw new Error(`Signature algorithm ${alg} is not supported.`);
|
|
206
|
+
}
|
|
207
|
+
};
|
|
208
|
+
//#endregion
|
|
209
|
+
//#region src/crypto/key/asymmetric/check.ts
|
|
210
|
+
function isAsymmetricAlgorithm(input) {
|
|
211
|
+
return Object.values(CryptoAsymmetricAlgorithm).includes(input);
|
|
260
212
|
}
|
|
261
|
-
|
|
213
|
+
//#endregion
|
|
214
|
+
//#region src/crypto/key/asymmetric/create.ts
|
|
215
|
+
async function createAsymmetricKeyPair(options) {
|
|
216
|
+
const optionsNormalized = normalizeAsymmetricKeyPairCreateOptions(options);
|
|
217
|
+
return subtle.generateKey(optionsNormalized, true, getKeyUsagesForAsymmetricAlgorithm(optionsNormalized.name));
|
|
218
|
+
}
|
|
219
|
+
//#endregion
|
|
220
|
+
//#region src/crypto/key/symmetric/constants.ts
|
|
221
|
+
let SymmetricAlgorithm = /* @__PURE__ */ function(SymmetricAlgorithm) {
|
|
222
|
+
SymmetricAlgorithm["HMAC"] = "HMAC";
|
|
223
|
+
SymmetricAlgorithm["AES_CTR"] = "AES-CTR";
|
|
224
|
+
SymmetricAlgorithm["AES_CBC"] = "AES-CBC";
|
|
225
|
+
SymmetricAlgorithm["AES_GCM"] = "AES-GCM";
|
|
226
|
+
return SymmetricAlgorithm;
|
|
227
|
+
}({});
|
|
228
|
+
//#endregion
|
|
229
|
+
//#region src/crypto/key/symmetric/check.ts
|
|
230
|
+
function isSymmetricAlgorithm(input) {
|
|
231
|
+
return Object.values(SymmetricAlgorithm).includes(input);
|
|
232
|
+
}
|
|
233
|
+
//#endregion
|
|
234
|
+
//#region src/crypto/key/symmetric/key-usages.ts
|
|
235
|
+
function getKeyUsagesForSymmetricAlgorithm(name) {
|
|
236
|
+
/**
|
|
237
|
+
* @see https://nodejs.org/api/webcrypto.html#cryptokeyusages
|
|
238
|
+
*/
|
|
239
|
+
if (name === "HMAC") return ["sign", "verify"];
|
|
240
|
+
if (name === "AES-CBC" || name === "AES-GCM" || name === "AES-CTR") return ["encrypt", "decrypt"];
|
|
241
|
+
throw new SyntaxError(`Key usages can not be determined for symmetric algorithm: ${name}`);
|
|
242
|
+
}
|
|
243
|
+
//#endregion
|
|
244
|
+
//#region src/crypto/key/symmetric/normalize.ts
|
|
245
|
+
function normalizeSymmetricKeyCreateOptions(input) {
|
|
246
|
+
if (input.name === "HMAC") return {
|
|
247
|
+
hash: "SHA-256",
|
|
248
|
+
...input
|
|
249
|
+
};
|
|
250
|
+
return {
|
|
251
|
+
length: 256,
|
|
252
|
+
name: input.name
|
|
253
|
+
};
|
|
254
|
+
}
|
|
255
|
+
function normalizeSymmetricKeyImportOptions(input) {
|
|
256
|
+
if (input.name === "HMAC") return {
|
|
257
|
+
hash: "SHA-256",
|
|
258
|
+
...input
|
|
259
|
+
};
|
|
260
|
+
return input;
|
|
261
|
+
}
|
|
262
|
+
//#endregion
|
|
263
|
+
//#region src/crypto/key/symmetric/module.ts
|
|
264
|
+
var SymmetricKey = class SymmetricKey extends BaseKey {
|
|
265
|
+
static async fromBase64(ctx) {
|
|
266
|
+
const arrayBuffer = base64ToArrayBuffer(ctx.key);
|
|
267
|
+
return SymmetricKey.fromArrayBuffer({
|
|
268
|
+
...ctx,
|
|
269
|
+
key: arrayBuffer
|
|
270
|
+
});
|
|
271
|
+
}
|
|
272
|
+
static async fromArrayBuffer(ctx) {
|
|
273
|
+
const normalizedOptions = normalizeSymmetricKeyImportOptions(ctx.options);
|
|
274
|
+
return new SymmetricKey(await subtle.importKey(ctx.format, ctx.key, normalizedOptions, true, getKeyUsagesForSymmetricAlgorithm(normalizedOptions.name)));
|
|
275
|
+
}
|
|
276
|
+
static buildImportOptionsForJWTAlgorithm(alg) {
|
|
277
|
+
if (alg === JWTAlgorithm.HS256) return {
|
|
278
|
+
name: "HMAC",
|
|
279
|
+
hash: "SHA-256"
|
|
280
|
+
};
|
|
281
|
+
if (alg === JWTAlgorithm.HS384) return {
|
|
282
|
+
name: "HMAC",
|
|
283
|
+
hash: "SHA-384"
|
|
284
|
+
};
|
|
285
|
+
if (alg === JWTAlgorithm.HS512) return {
|
|
286
|
+
name: "HMAC",
|
|
287
|
+
hash: "SHA-512"
|
|
288
|
+
};
|
|
289
|
+
throw new Error(`Signature algorithm ${alg} is not supported.`);
|
|
290
|
+
}
|
|
291
|
+
};
|
|
292
|
+
//#endregion
|
|
293
|
+
//#region src/crypto/key/symmetric/create.ts
|
|
294
|
+
async function createSymmetricKey(input) {
|
|
295
|
+
const optionsNormalized = normalizeSymmetricKeyCreateOptions(input);
|
|
296
|
+
return subtle.generateKey(optionsNormalized, true, getKeyUsagesForSymmetricAlgorithm(optionsNormalized.name));
|
|
297
|
+
}
|
|
298
|
+
//#endregion
|
|
299
|
+
//#region src/crypto/json-web-token/extract.ts
|
|
300
|
+
/**
|
|
301
|
+
* Decode a JWT token with no verification.
|
|
302
|
+
*
|
|
303
|
+
* @param token
|
|
304
|
+
*
|
|
305
|
+
* @throws JWTError
|
|
306
|
+
*/
|
|
307
|
+
function extractTokenHeader(token) {
|
|
308
|
+
const parts = token.split(".");
|
|
309
|
+
if (parts.length !== 3) throw JWTError.invalid();
|
|
310
|
+
const [headerBase64] = parts;
|
|
311
|
+
try {
|
|
312
|
+
const payload = atob(headerBase64);
|
|
313
|
+
return JSON.parse(payload);
|
|
314
|
+
} catch {
|
|
315
|
+
throw JWTError.headerInvalid("The token header could not be extracted.");
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
/**
|
|
319
|
+
* @param token
|
|
320
|
+
*
|
|
321
|
+
* @throws JWTError
|
|
322
|
+
*/
|
|
323
|
+
function extractTokenPayload(token) {
|
|
324
|
+
const parts = token.split(".");
|
|
325
|
+
if (parts.length !== 3) throw JWTError.invalid();
|
|
326
|
+
const [, payloadBase64] = parts;
|
|
327
|
+
try {
|
|
328
|
+
const payload = atob(payloadBase64);
|
|
329
|
+
return JSON.parse(payload);
|
|
330
|
+
} catch {
|
|
331
|
+
throw JWTError.payloadInvalid("The token payload could not be extracted.");
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
//#endregion
|
|
335
|
+
//#region src/crypto/json-web-token/utils.ts
|
|
262
336
|
function createErrorForJWTError(e) {
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
}
|
|
285
|
-
return new TokenError({
|
|
286
|
-
cause: e,
|
|
287
|
-
logMessage: true,
|
|
288
|
-
message: 'The JWT error could not be determined.'
|
|
289
|
-
});
|
|
337
|
+
if (isObject$1(e)) {
|
|
338
|
+
if (typeof e.name === "string") switch (e.name) {
|
|
339
|
+
case "TokenExpiredError": return JWTError.expired();
|
|
340
|
+
case "NotBeforeError":
|
|
341
|
+
if (typeof e.date === "string" || e.date instanceof Date) return JWTError.notActiveBefore(e.date);
|
|
342
|
+
break;
|
|
343
|
+
case "JsonWebTokenError":
|
|
344
|
+
if (typeof e.message === "string") return JWTError.payloadInvalid(e.message);
|
|
345
|
+
break;
|
|
346
|
+
}
|
|
347
|
+
switch (e.message) {
|
|
348
|
+
case "ExpiredSignature": return JWTError.expired();
|
|
349
|
+
case "ImmatureSignature": return JWTError.notActiveBefore();
|
|
350
|
+
case "InvalidToken":
|
|
351
|
+
case "InvalidSignature": return JWTError.payloadInvalid();
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
return new JWTError({
|
|
355
|
+
cause: e,
|
|
356
|
+
message: "The JWT error could not be determined."
|
|
357
|
+
});
|
|
290
358
|
}
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
359
|
+
function transformJWTAlgorithmToInternal(algorithm) {
|
|
360
|
+
switch (algorithm) {
|
|
361
|
+
case JWTAlgorithm.HS256: return Algorithm.HS256;
|
|
362
|
+
case JWTAlgorithm.HS384: return Algorithm.HS384;
|
|
363
|
+
case JWTAlgorithm.HS512: return Algorithm.HS512;
|
|
364
|
+
case JWTAlgorithm.RS256: return Algorithm.RS256;
|
|
365
|
+
case JWTAlgorithm.RS384: return Algorithm.RS384;
|
|
366
|
+
case JWTAlgorithm.RS512: return Algorithm.RS512;
|
|
367
|
+
case JWTAlgorithm.ES256: return Algorithm.ES256;
|
|
368
|
+
case JWTAlgorithm.ES384: return Algorithm.ES384;
|
|
369
|
+
case JWTAlgorithm.PS256: return Algorithm.PS256;
|
|
370
|
+
case JWTAlgorithm.PS384: return Algorithm.PS384;
|
|
371
|
+
case JWTAlgorithm.PS512: return Algorithm.PS512;
|
|
372
|
+
}
|
|
373
|
+
throw new Error(`The algorithm ${algorithm} is not supported.`);
|
|
306
374
|
}
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
375
|
+
//#endregion
|
|
376
|
+
//#region src/crypto/json-web-token/sign/module.ts
|
|
377
|
+
const getUtcTimestamp = () => Math.floor((/* @__PURE__ */ new Date()).getTime() / 1e3);
|
|
378
|
+
async function signToken(claims, context) {
|
|
379
|
+
if (typeof claims.exp !== "number") claims.exp = getUtcTimestamp() + 3600;
|
|
380
|
+
if (typeof claims.iat !== "number") claims.iat = getUtcTimestamp();
|
|
381
|
+
switch (context.type) {
|
|
382
|
+
case JWKType.RSA:
|
|
383
|
+
case JWKType.EC: {
|
|
384
|
+
let algorithm;
|
|
385
|
+
let key;
|
|
386
|
+
if (typeof context.key === "string") key = encodePKCS8ToPEM(context.key);
|
|
387
|
+
else key = await new AsymmetricKey(context.key).toPem();
|
|
388
|
+
if (context.type === JWKType.RSA) algorithm = context.algorithm ? transformJWTAlgorithmToInternal(context.algorithm) : Algorithm.RS256;
|
|
389
|
+
else algorithm = context.algorithm ? transformJWTAlgorithmToInternal(context.algorithm) : Algorithm.ES256;
|
|
390
|
+
return sign(claims, key, {
|
|
391
|
+
algorithm,
|
|
392
|
+
keyId: context.keyId
|
|
393
|
+
});
|
|
394
|
+
}
|
|
395
|
+
case JWKType.OCT: {
|
|
396
|
+
const algorithm = context.algorithm ? transformJWTAlgorithmToInternal(context.algorithm) : Algorithm.HS256;
|
|
397
|
+
let key;
|
|
398
|
+
if (typeof context.key === "string") key = context.key;
|
|
399
|
+
else key = await new SymmetricKey(context.key).toUint8Array();
|
|
400
|
+
return sign(claims, key, {
|
|
401
|
+
algorithm,
|
|
402
|
+
keyId: context.keyId
|
|
403
|
+
});
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
throw new JWTError();
|
|
331
407
|
}
|
|
332
|
-
|
|
408
|
+
//#endregion
|
|
409
|
+
//#region src/crypto/json-web-token/verify/module.ts
|
|
410
|
+
/**
|
|
411
|
+
* Verify JWT.
|
|
412
|
+
*
|
|
413
|
+
* @param token
|
|
414
|
+
* @param context
|
|
415
|
+
*
|
|
416
|
+
* @throws OAuth2Error
|
|
417
|
+
*/
|
|
333
418
|
async function verifyToken(token, context) {
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
if (err) {
|
|
381
|
-
reject(err);
|
|
382
|
-
return;
|
|
383
|
-
}
|
|
384
|
-
resolve(decoded);
|
|
385
|
-
});
|
|
386
|
-
});
|
|
387
|
-
}
|
|
388
|
-
}
|
|
389
|
-
output = await promise;
|
|
390
|
-
} catch (e) {
|
|
391
|
-
throw createErrorForJWTError(e);
|
|
392
|
-
}
|
|
393
|
-
if (typeof output === 'undefined') {
|
|
394
|
-
throw new TokenError({
|
|
395
|
-
message: 'Invalid type.'
|
|
396
|
-
});
|
|
397
|
-
}
|
|
398
|
-
return output;
|
|
419
|
+
let promise;
|
|
420
|
+
let output;
|
|
421
|
+
try {
|
|
422
|
+
switch (context.type) {
|
|
423
|
+
case JWKType.RSA:
|
|
424
|
+
case JWKType.EC: {
|
|
425
|
+
let algorithms;
|
|
426
|
+
if (context.type === JWKType.RSA) algorithms = context.algorithms ? context.algorithms.map((algorithm) => transformJWTAlgorithmToInternal(algorithm)) : [
|
|
427
|
+
Algorithm.RS256,
|
|
428
|
+
Algorithm.RS384,
|
|
429
|
+
Algorithm.RS512,
|
|
430
|
+
Algorithm.PS256,
|
|
431
|
+
Algorithm.PS384,
|
|
432
|
+
Algorithm.PS512
|
|
433
|
+
];
|
|
434
|
+
else algorithms = context.algorithms ? context.algorithms.map((algorithm) => transformJWTAlgorithmToInternal(algorithm)) : [Algorithm.ES256, Algorithm.ES384];
|
|
435
|
+
let key;
|
|
436
|
+
if (typeof context.key === "string") key = encodeSPKIToPem(context.key);
|
|
437
|
+
else key = await new AsymmetricKey(context.key).toPem();
|
|
438
|
+
promise = verify(token, key, {
|
|
439
|
+
algorithms,
|
|
440
|
+
validateNbf: true
|
|
441
|
+
});
|
|
442
|
+
break;
|
|
443
|
+
}
|
|
444
|
+
case JWKType.OCT: {
|
|
445
|
+
const algorithms = context.algorithms ? context.algorithms.map((algorithm) => transformJWTAlgorithmToInternal(algorithm)) : [
|
|
446
|
+
Algorithm.HS256,
|
|
447
|
+
Algorithm.HS384,
|
|
448
|
+
Algorithm.HS512
|
|
449
|
+
];
|
|
450
|
+
let key;
|
|
451
|
+
if (typeof context.key === "string") key = context.key;
|
|
452
|
+
else key = await new SymmetricKey(context.key).toUint8Array();
|
|
453
|
+
promise = verify(token, key, {
|
|
454
|
+
algorithms,
|
|
455
|
+
validateNbf: true
|
|
456
|
+
});
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
if (promise) output = await promise;
|
|
460
|
+
} catch (e) {
|
|
461
|
+
throw createErrorForJWTError(e);
|
|
462
|
+
}
|
|
463
|
+
if (!output) throw new JWTError();
|
|
464
|
+
return output;
|
|
399
465
|
}
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
466
|
+
//#endregion
|
|
467
|
+
//#region src/domain-event/module.ts
|
|
468
|
+
var DomainEventPublisher = class {
|
|
469
|
+
publishers;
|
|
470
|
+
constructor() {
|
|
471
|
+
this.publishers = /* @__PURE__ */ new Set();
|
|
472
|
+
}
|
|
473
|
+
mount(publisher) {
|
|
474
|
+
this.publishers.add(publisher);
|
|
475
|
+
}
|
|
476
|
+
async publish(ctx) {
|
|
477
|
+
const publishers = this.publishers.values();
|
|
478
|
+
while (true) {
|
|
479
|
+
const it = publishers.next();
|
|
480
|
+
if (it.done) return;
|
|
481
|
+
await it.value.publish(ctx);
|
|
482
|
+
}
|
|
483
|
+
}
|
|
484
|
+
};
|
|
485
|
+
//#endregion
|
|
486
|
+
//#region src/services/cache/adapters/memory.ts
|
|
487
|
+
var MemoryCache = class {
|
|
488
|
+
instance;
|
|
489
|
+
constructor(options = {}) {
|
|
490
|
+
this.instance = new TTLCache({
|
|
491
|
+
checkAgeOnGet: true,
|
|
492
|
+
ttl: Infinity,
|
|
493
|
+
...options || {}
|
|
494
|
+
});
|
|
495
|
+
}
|
|
496
|
+
async pop(key) {
|
|
497
|
+
if (this.instance.has(key)) {
|
|
498
|
+
const output = this.instance.get(key);
|
|
499
|
+
this.instance.delete(key);
|
|
500
|
+
return output;
|
|
501
|
+
}
|
|
502
|
+
return null;
|
|
503
|
+
}
|
|
504
|
+
async has(key) {
|
|
505
|
+
return this.instance.has(key);
|
|
506
|
+
}
|
|
507
|
+
async get(key) {
|
|
508
|
+
const output = await this.instance.get(key);
|
|
509
|
+
if (output) return output;
|
|
510
|
+
return null;
|
|
511
|
+
}
|
|
512
|
+
async set(key, value, options) {
|
|
513
|
+
this.instance.set(key, value, { ttl: options.ttl });
|
|
514
|
+
}
|
|
515
|
+
async drop(key) {
|
|
516
|
+
this.instance.delete(key);
|
|
517
|
+
}
|
|
518
|
+
async dropMany(keys) {
|
|
519
|
+
for (const key of keys) this.instance.delete(key);
|
|
520
|
+
}
|
|
521
|
+
async clear(options = {}) {
|
|
522
|
+
if (options.prefix) {
|
|
523
|
+
const keys = this.instance.keys();
|
|
524
|
+
let iterator = keys.next();
|
|
525
|
+
while (!iterator.done) {
|
|
526
|
+
if (typeof iterator.value !== "string") continue;
|
|
527
|
+
if (iterator.value.startsWith(options.prefix)) this.instance.delete(iterator.value);
|
|
528
|
+
iterator = keys.next();
|
|
529
|
+
}
|
|
530
|
+
return;
|
|
531
|
+
}
|
|
532
|
+
this.instance.clear();
|
|
533
|
+
}
|
|
534
|
+
};
|
|
535
|
+
//#endregion
|
|
536
|
+
//#region src/services/redis/check.ts
|
|
537
|
+
function isRedisClient(data) {
|
|
538
|
+
return isObject$1(data) && typeof data.connect === "function" && typeof data.disconnect === "function";
|
|
412
539
|
}
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
540
|
+
//#endregion
|
|
541
|
+
//#region src/services/redis/factory.ts
|
|
542
|
+
function createRedisClient(input) {
|
|
543
|
+
if (typeof input === "boolean") return createClient({ connectionString: "redis://127.0.0.1" });
|
|
544
|
+
if (typeof input === "string") return createClient({ connectionString: input });
|
|
545
|
+
if (!isRedisClient(input)) return createClient({ options: input });
|
|
546
|
+
return input;
|
|
418
547
|
}
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
548
|
+
//#endregion
|
|
549
|
+
//#region src/services/cache/adapters/redis.ts
|
|
550
|
+
var RedisCache = class {
|
|
551
|
+
client;
|
|
552
|
+
jsonAdapter;
|
|
553
|
+
constructor(input) {
|
|
554
|
+
this.client = createRedisClient(input);
|
|
555
|
+
this.jsonAdapter = new JsonAdapter(this.client);
|
|
556
|
+
}
|
|
557
|
+
async get(key) {
|
|
558
|
+
const output = await this.jsonAdapter.get(key);
|
|
559
|
+
if (output) return output;
|
|
560
|
+
return null;
|
|
561
|
+
}
|
|
562
|
+
async pop(key) {
|
|
563
|
+
const raw = await this.client.getdel(key);
|
|
564
|
+
if (!raw) return null;
|
|
565
|
+
try {
|
|
566
|
+
return JSON.parse(raw);
|
|
567
|
+
} catch {
|
|
568
|
+
return null;
|
|
569
|
+
}
|
|
570
|
+
}
|
|
571
|
+
async has(key) {
|
|
572
|
+
return !!await this.get(key);
|
|
573
|
+
}
|
|
574
|
+
async set(key, value, options) {
|
|
575
|
+
await this.jsonAdapter.set(key, value, { milliseconds: options.ttl });
|
|
576
|
+
}
|
|
577
|
+
async drop(key) {
|
|
578
|
+
await this.jsonAdapter.drop(key);
|
|
579
|
+
}
|
|
580
|
+
async dropMany(keys) {
|
|
581
|
+
const pipeline = this.client.pipeline();
|
|
582
|
+
for (const key of keys) pipeline.del(key);
|
|
583
|
+
await pipeline.exec();
|
|
584
|
+
}
|
|
585
|
+
async clear(options = {}) {
|
|
586
|
+
if (options.prefix) {
|
|
587
|
+
const pipeline = this.client.pipeline();
|
|
588
|
+
const keys = await this.client.keys(`${options.prefix}*`);
|
|
589
|
+
for (const key of keys) pipeline.del(key);
|
|
590
|
+
await pipeline.exec();
|
|
591
|
+
return;
|
|
592
|
+
}
|
|
593
|
+
await this.client.flushdb();
|
|
594
|
+
}
|
|
595
|
+
};
|
|
596
|
+
//#endregion
|
|
597
|
+
//#region src/services/cache/helper.ts
|
|
598
|
+
function buildCacheKey(options) {
|
|
599
|
+
return buildRedisKeyPath(options);
|
|
439
600
|
}
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
function
|
|
443
|
-
|
|
444
|
-
return instance$3;
|
|
445
|
-
}
|
|
446
|
-
instance$3 = new Emitter(useClient());
|
|
447
|
-
return instance$3;
|
|
601
|
+
//#endregion
|
|
602
|
+
//#region src/services/logger/module.ts
|
|
603
|
+
function createNoopLogger() {
|
|
604
|
+
return createLogger$1({ silent: true });
|
|
448
605
|
}
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
emitter.in(roomName)// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
473
|
-
// @ts-ignore
|
|
474
|
-
.emit(fullEventName, {
|
|
475
|
-
...context,
|
|
476
|
-
meta: {
|
|
477
|
-
roomName,
|
|
478
|
-
roomId: context.data.id
|
|
479
|
-
}
|
|
480
|
-
});
|
|
481
|
-
}
|
|
482
|
-
}
|
|
606
|
+
function createLogger(context) {
|
|
607
|
+
let items;
|
|
608
|
+
const cwd = context.directory || process.cwd();
|
|
609
|
+
if (context.env === "production") items = [
|
|
610
|
+
new transports.Console({ level: "info" }),
|
|
611
|
+
new transports.File({
|
|
612
|
+
filename: path.join(cwd, "http.log"),
|
|
613
|
+
level: "http",
|
|
614
|
+
maxsize: 10 * 1024 * 1024,
|
|
615
|
+
maxFiles: 5
|
|
616
|
+
}),
|
|
617
|
+
new transports.File({
|
|
618
|
+
filename: path.join(cwd, "error.log"),
|
|
619
|
+
level: "warn",
|
|
620
|
+
maxsize: 10 * 1024 * 1024,
|
|
621
|
+
maxFiles: 5
|
|
622
|
+
})
|
|
623
|
+
];
|
|
624
|
+
else items = [new transports.Console({ level: "debug" })];
|
|
625
|
+
return createLogger$1({
|
|
626
|
+
format: format.combine(format.errors({ stack: true }), format.timestamp(), format.colorize(), format.simple()),
|
|
627
|
+
transports: items
|
|
628
|
+
});
|
|
483
629
|
}
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
630
|
+
//#endregion
|
|
631
|
+
//#region src/services/logger/singleton.ts
|
|
632
|
+
const instance$1 = singa({ name: "logger" });
|
|
633
|
+
function setLoggerFactory(factory) {
|
|
634
|
+
instance$1.setFactory(factory);
|
|
488
635
|
}
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
* view the LICENSE file that was distributed with this source code.
|
|
495
|
-
*/ class VoidLogger {
|
|
496
|
-
error() {
|
|
497
|
-
return this;
|
|
498
|
-
}
|
|
499
|
-
warn() {
|
|
500
|
-
return this;
|
|
501
|
-
}
|
|
502
|
-
info() {
|
|
503
|
-
return this;
|
|
504
|
-
}
|
|
505
|
-
http() {
|
|
506
|
-
return this;
|
|
507
|
-
}
|
|
508
|
-
verbose() {
|
|
509
|
-
return this;
|
|
510
|
-
}
|
|
511
|
-
debug() {
|
|
512
|
-
return this;
|
|
513
|
-
}
|
|
636
|
+
function isLoggerUsable() {
|
|
637
|
+
return instance$1.has() || instance$1.hasFactory();
|
|
638
|
+
}
|
|
639
|
+
function setLogger(input) {
|
|
640
|
+
instance$1.set(input);
|
|
514
641
|
}
|
|
515
|
-
|
|
516
|
-
let instance$2;
|
|
517
642
|
function useLogger() {
|
|
518
|
-
|
|
519
|
-
return instance$2;
|
|
520
|
-
}
|
|
521
|
-
instance$2 = new VoidLogger();
|
|
522
|
-
return instance$2;
|
|
643
|
+
return instance$1.use();
|
|
523
644
|
}
|
|
524
|
-
|
|
525
|
-
|
|
645
|
+
//#endregion
|
|
646
|
+
//#region src/services/vault/singleton.ts
|
|
647
|
+
const instance = singa({ name: "vault" });
|
|
648
|
+
function setVaultFactory(factory) {
|
|
649
|
+
instance.setFactory(factory);
|
|
526
650
|
}
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
* Copyright (c) 2022.
|
|
530
|
-
* Author Peter Placzek (tada5hi)
|
|
531
|
-
* For the full copyright and license information,
|
|
532
|
-
* view the LICENSE file that was distributed with this source code.
|
|
533
|
-
*/ let instance$1;
|
|
534
|
-
function hasSmtpConfig() {
|
|
535
|
-
return !!instance$1;
|
|
536
|
-
}
|
|
537
|
-
function setSmtpConfig(value) {
|
|
538
|
-
instance$1 = value;
|
|
539
|
-
}
|
|
540
|
-
function useSmtpConfig() {
|
|
541
|
-
if (typeof instance$1 !== 'undefined') {
|
|
542
|
-
return instance$1;
|
|
543
|
-
}
|
|
544
|
-
instance$1 = {};
|
|
545
|
-
return instance$1;
|
|
651
|
+
function isVaultClientUsable() {
|
|
652
|
+
return instance.has() || instance.hasFactory();
|
|
546
653
|
}
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
let transport;
|
|
550
|
-
options = options || {};
|
|
551
|
-
if (typeof options === 'string') {
|
|
552
|
-
transport = createTransport(options);
|
|
553
|
-
} else if (options.connectionString) {
|
|
554
|
-
transport = createTransport(options.connectionString);
|
|
555
|
-
} else {
|
|
556
|
-
let auth;
|
|
557
|
-
if (options.user && options.password) {
|
|
558
|
-
auth = {
|
|
559
|
-
type: 'login',
|
|
560
|
-
user: options.user,
|
|
561
|
-
pass: options.password
|
|
562
|
-
};
|
|
563
|
-
}
|
|
564
|
-
transport = createTransport({
|
|
565
|
-
host: options.host,
|
|
566
|
-
port: options.port,
|
|
567
|
-
auth,
|
|
568
|
-
secure: options.ssl,
|
|
569
|
-
opportunisticTLS: options.starttls,
|
|
570
|
-
tls: {
|
|
571
|
-
rejectUnauthorized: false
|
|
572
|
-
}
|
|
573
|
-
});
|
|
574
|
-
}
|
|
575
|
-
transport.on('error', (e)=>{
|
|
576
|
-
useLogger().error(e.message);
|
|
577
|
-
});
|
|
578
|
-
return transport;
|
|
654
|
+
function useVaultClient() {
|
|
655
|
+
return instance.use();
|
|
579
656
|
}
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
port: 587,
|
|
592
|
-
ssl: false,
|
|
593
|
-
user: testAccount.user,
|
|
594
|
-
password: testAccount.pass
|
|
595
|
-
};
|
|
596
|
-
} else {
|
|
597
|
-
options = useSmtpConfig();
|
|
598
|
-
}
|
|
599
|
-
instance = createSmtpClient(options);
|
|
600
|
-
return instance;
|
|
657
|
+
//#endregion
|
|
658
|
+
//#region src/domain-event/utils.ts
|
|
659
|
+
function transformDomainEventData(input) {
|
|
660
|
+
const keys = Object.keys(input);
|
|
661
|
+
for (const key_ of keys) {
|
|
662
|
+
const key = key_;
|
|
663
|
+
const value = input[key];
|
|
664
|
+
if (!isObject(value)) continue;
|
|
665
|
+
if (value instanceof Date) input[key] = value.toISOString();
|
|
666
|
+
}
|
|
667
|
+
return input;
|
|
601
668
|
}
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
669
|
+
function buildDomainEventChannelName(input, id) {
|
|
670
|
+
if (typeof input === "string") return input;
|
|
671
|
+
return input(id);
|
|
672
|
+
}
|
|
673
|
+
//#endregion
|
|
674
|
+
//#region src/domain-event/redis/module.ts
|
|
675
|
+
var DomainEventRedisPublisher = class {
|
|
676
|
+
driver;
|
|
677
|
+
constructor(input) {
|
|
678
|
+
this.driver = createRedisClient(input);
|
|
679
|
+
}
|
|
680
|
+
async publish(ctx) {
|
|
681
|
+
const data = JSON.stringify(transformDomainEventData(ctx.content));
|
|
682
|
+
const pipeline = this.driver.pipeline();
|
|
683
|
+
for (let i = 0; i < ctx.destinations.length; i++) {
|
|
684
|
+
const { namespace } = ctx.destinations[i];
|
|
685
|
+
const keyPrefix = namespace ? `${namespace}:` : "";
|
|
686
|
+
let key = keyPrefix + buildDomainEventChannelName(ctx.destinations[i].channel);
|
|
687
|
+
pipeline.publish(key, data);
|
|
688
|
+
if (typeof ctx.destinations[i].channel === "function") {
|
|
689
|
+
key = keyPrefix + buildDomainEventChannelName(ctx.destinations[i].channel, ctx.content.data.id);
|
|
690
|
+
pipeline.publish(key, data);
|
|
691
|
+
}
|
|
692
|
+
}
|
|
693
|
+
await pipeline.exec();
|
|
694
|
+
}
|
|
695
|
+
};
|
|
696
|
+
//#endregion
|
|
697
|
+
//#region src/domain-event/socket/module.ts
|
|
698
|
+
var DomainEventSocketPublisher = class {
|
|
699
|
+
driver;
|
|
700
|
+
constructor(input) {
|
|
701
|
+
const client = createRedisClient(input);
|
|
702
|
+
this.driver = new Emitter(client);
|
|
703
|
+
}
|
|
704
|
+
async publish(ctx) {
|
|
705
|
+
ctx.content = transformDomainEventData(ctx.content);
|
|
706
|
+
for (let i = 0; i < ctx.destinations.length; i++) {
|
|
707
|
+
const destination = ctx.destinations[i];
|
|
708
|
+
let emitter;
|
|
709
|
+
if (destination.namespace) emitter = this.driver.of(destination.namespace);
|
|
710
|
+
else emitter = this.driver;
|
|
711
|
+
let roomName = buildDomainEventChannelName(destination.channel);
|
|
712
|
+
const fullEventName = buildEventFullName(ctx.content.type, ctx.content.event);
|
|
713
|
+
emitter.in(roomName).emit(fullEventName, {
|
|
714
|
+
...ctx.content,
|
|
715
|
+
meta: { roomName }
|
|
716
|
+
});
|
|
717
|
+
if (typeof destination.channel === "function") {
|
|
718
|
+
roomName = buildDomainEventChannelName(destination.channel, ctx.content.data.id);
|
|
719
|
+
emitter.in(roomName).emit(fullEventName, {
|
|
720
|
+
...ctx.content,
|
|
721
|
+
meta: {
|
|
722
|
+
roomName,
|
|
723
|
+
roomId: ctx.content.data.id
|
|
724
|
+
}
|
|
725
|
+
});
|
|
726
|
+
}
|
|
727
|
+
}
|
|
728
|
+
}
|
|
729
|
+
};
|
|
730
|
+
//#endregion
|
|
731
|
+
//#region src/utils/has-property.ts
|
|
732
|
+
function hasOwnProperty(obj, prop) {
|
|
733
|
+
return Object.prototype.hasOwnProperty.call(obj, prop);
|
|
610
734
|
}
|
|
735
|
+
//#endregion
|
|
736
|
+
export { AsymmetricKey, BaseKey, CryptoAsymmetricAlgorithm, DomainEventPublisher, DomainEventRedisPublisher, DomainEventSocketPublisher, Logger, MemoryCache, RedisCache, RedisClient, RedisJsonAdapter, RedisWatcher, SymmetricAlgorithm, SymmetricKey, VaultClient, buildCacheKey, buildRedisKeyPath, compare, createAsymmetricKeyPair, createLogger, createNoopLogger, createRedisClient, createSymmetricKey, createVaultClient, decodePemToPKCS8, decodePemToSpki, encodePKCS8ToPEM, encodeSPKIToPem, escapeRedisKey, extractTokenHeader, extractTokenPayload, getKeyUsagesForAsymmetricAlgorithm, getKeyUsagesForSymmetricAlgorithm, hasOwnProperty, hash, isAsymmetricAlgorithm, isLoggerUsable, isRedisClient, isSymmetricAlgorithm, isVaultClientUsable, normalizeAsymmetricKeyImportOptions, normalizeAsymmetricKeyPairCreateOptions, parseRedisKeyPath, setLogger, setLoggerFactory, setVaultFactory, signToken, useLogger, useVaultClient, verifyToken };
|
|
611
737
|
|
|
612
|
-
|
|
613
|
-
//# sourceMappingURL=index.mjs.map
|
|
738
|
+
//# sourceMappingURL=index.mjs.map
|