@enbox/crypto 0.0.1 → 0.0.3
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 +34 -102
- package/dist/browser.js +6 -10
- package/dist/browser.js.map +4 -4
- package/dist/browser.mjs +6 -10
- package/dist/browser.mjs.map +4 -4
- package/dist/esm/algorithms/aes-gcm.js +1 -1
- package/dist/esm/algorithms/aes-gcm.js.map +1 -1
- package/dist/esm/algorithms/ecdsa.js +9 -5
- package/dist/esm/algorithms/ecdsa.js.map +1 -1
- package/dist/esm/algorithms/eddsa.js +9 -5
- package/dist/esm/algorithms/eddsa.js.map +1 -1
- package/dist/esm/algorithms/sha-2.js +1 -1
- package/dist/esm/algorithms/sha-2.js.map +1 -1
- package/dist/esm/crypto-error.js +41 -0
- package/dist/esm/crypto-error.js.map +1 -0
- package/dist/esm/index.js +3 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/jose/jwk.js +52 -26
- package/dist/esm/jose/jwk.js.map +1 -1
- package/dist/esm/local-key-manager.js +3 -2
- package/dist/esm/local-key-manager.js.map +1 -1
- package/dist/esm/primitives/aes-ctr.js.map +1 -1
- package/dist/esm/primitives/aes-gcm.js.map +1 -1
- package/dist/esm/primitives/aes-kw.js +246 -0
- package/dist/esm/primitives/aes-kw.js.map +1 -0
- package/dist/esm/primitives/concat-kdf.js +1 -1
- package/dist/esm/primitives/concat-kdf.js.map +1 -1
- package/dist/esm/primitives/ed25519.js +3 -3
- package/dist/esm/primitives/ed25519.js.map +1 -1
- package/dist/esm/primitives/hkdf.js +79 -0
- package/dist/esm/primitives/hkdf.js.map +1 -0
- package/dist/esm/primitives/pbkdf2.js +49 -0
- package/dist/esm/primitives/pbkdf2.js.map +1 -1
- package/dist/esm/primitives/secp256k1.js +4 -4
- package/dist/esm/primitives/secp256k1.js.map +1 -1
- package/dist/esm/primitives/secp256r1.js +4 -4
- package/dist/esm/primitives/secp256r1.js.map +1 -1
- package/dist/esm/primitives/x25519.js +1 -1
- package/dist/esm/primitives/x25519.js.map +1 -1
- package/dist/esm/primitives/xchacha20-poly1305.js +48 -3
- package/dist/esm/primitives/xchacha20-poly1305.js.map +1 -1
- package/dist/esm/primitives/xchacha20.js +1 -1
- package/dist/esm/primitives/xchacha20.js.map +1 -1
- package/dist/esm/utils.js.map +1 -1
- package/dist/types/algorithms/aes-ctr.d.ts +1 -1
- package/dist/types/algorithms/aes-ctr.d.ts.map +1 -1
- package/dist/types/algorithms/aes-gcm.d.ts +2 -2
- package/dist/types/algorithms/aes-gcm.d.ts.map +1 -1
- package/dist/types/algorithms/ecdsa.d.ts +1 -1
- package/dist/types/algorithms/ecdsa.d.ts.map +1 -1
- package/dist/types/algorithms/eddsa.d.ts +2 -2
- package/dist/types/algorithms/eddsa.d.ts.map +1 -1
- package/dist/types/algorithms/sha-2.d.ts +1 -1
- package/dist/types/algorithms/sha-2.d.ts.map +1 -1
- package/dist/types/crypto-error.d.ts +29 -0
- package/dist/types/crypto-error.d.ts.map +1 -0
- package/dist/types/index.d.ts +3 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/jose/jwk.d.ts.map +1 -1
- package/dist/types/local-key-manager.d.ts +3 -3
- package/dist/types/local-key-manager.d.ts.map +1 -1
- package/dist/types/primitives/aes-kw.d.ts +103 -0
- package/dist/types/primitives/aes-kw.d.ts.map +1 -0
- package/dist/types/primitives/concat-kdf.d.ts +1 -1
- package/dist/types/primitives/concat-kdf.d.ts.map +1 -1
- package/dist/types/primitives/hkdf.d.ts +90 -0
- package/dist/types/primitives/hkdf.d.ts.map +1 -0
- package/dist/types/primitives/pbkdf2.d.ts +58 -0
- package/dist/types/primitives/pbkdf2.d.ts.map +1 -1
- package/dist/types/primitives/xchacha20-poly1305.d.ts +47 -0
- package/dist/types/primitives/xchacha20-poly1305.d.ts.map +1 -1
- package/dist/types/types/cipher.d.ts +1 -1
- package/dist/types/types/crypto-api.d.ts +3 -3
- package/dist/types/types/crypto-api.d.ts.map +1 -1
- package/dist/types/types/params-direct.d.ts +79 -1
- package/dist/types/types/params-direct.d.ts.map +1 -1
- package/dist/utils.js.map +2 -2
- package/package.json +21 -34
- package/src/algorithms/aes-ctr.ts +1 -1
- package/src/algorithms/aes-gcm.ts +3 -2
- package/src/algorithms/ecdsa.ts +13 -7
- package/src/algorithms/eddsa.ts +9 -9
- package/src/algorithms/sha-2.ts +2 -2
- package/src/crypto-error.ts +45 -0
- package/src/index.ts +3 -0
- package/src/jose/jwk.ts +32 -32
- package/src/local-key-manager.ts +14 -13
- package/src/primitives/aes-ctr.ts +1 -1
- package/src/primitives/aes-gcm.ts +5 -5
- package/src/primitives/aes-kw.ts +269 -0
- package/src/primitives/concat-kdf.ts +4 -2
- package/src/primitives/ed25519.ts +6 -6
- package/src/primitives/hkdf.ts +121 -0
- package/src/primitives/pbkdf2.ts +91 -0
- package/src/primitives/secp256k1.ts +6 -6
- package/src/primitives/secp256r1.ts +6 -6
- package/src/primitives/x25519.ts +3 -3
- package/src/primitives/xchacha20-poly1305.ts +57 -4
- package/src/primitives/xchacha20.ts +1 -1
- package/src/types/cipher.ts +1 -1
- package/src/types/crypto-api.ts +5 -5
- package/src/types/params-direct.ts +97 -1
- package/src/utils.ts +2 -2
- package/dist/cjs/algorithms/aes-ctr.js +0 -188
- package/dist/cjs/algorithms/aes-ctr.js.map +0 -1
- package/dist/cjs/algorithms/aes-gcm.js +0 -196
- package/dist/cjs/algorithms/aes-gcm.js.map +0 -1
- package/dist/cjs/algorithms/crypto-algorithm.js +0 -13
- package/dist/cjs/algorithms/crypto-algorithm.js.map +0 -1
- package/dist/cjs/algorithms/ecdsa.js +0 -352
- package/dist/cjs/algorithms/ecdsa.js.map +0 -1
- package/dist/cjs/algorithms/eddsa.js +0 -325
- package/dist/cjs/algorithms/eddsa.js.map +0 -1
- package/dist/cjs/algorithms/sha-2.js +0 -119
- package/dist/cjs/algorithms/sha-2.js.map +0 -1
- package/dist/cjs/index.js +0 -41
- package/dist/cjs/index.js.map +0 -1
- package/dist/cjs/jose/jwe.js +0 -3
- package/dist/cjs/jose/jwe.js.map +0 -1
- package/dist/cjs/jose/jwk.js +0 -278
- package/dist/cjs/jose/jwk.js.map +0 -1
- package/dist/cjs/jose/jws.js +0 -3
- package/dist/cjs/jose/jws.js.map +0 -1
- package/dist/cjs/jose/jwt.js +0 -3
- package/dist/cjs/jose/jwt.js.map +0 -1
- package/dist/cjs/jose/utils.js +0 -60
- package/dist/cjs/jose/utils.js.map +0 -1
- package/dist/cjs/local-key-manager.js +0 -521
- package/dist/cjs/local-key-manager.js.map +0 -1
- package/dist/cjs/package.json +0 -1
- package/dist/cjs/primitives/aes-ctr.js +0 -398
- package/dist/cjs/primitives/aes-ctr.js.map +0 -1
- package/dist/cjs/primitives/aes-gcm.js +0 -425
- package/dist/cjs/primitives/aes-gcm.js.map +0 -1
- package/dist/cjs/primitives/concat-kdf.js +0 -215
- package/dist/cjs/primitives/concat-kdf.js.map +0 -1
- package/dist/cjs/primitives/ed25519.js +0 -651
- package/dist/cjs/primitives/ed25519.js.map +0 -1
- package/dist/cjs/primitives/pbkdf2.js +0 -120
- package/dist/cjs/primitives/pbkdf2.js.map +0 -1
- package/dist/cjs/primitives/secp256k1.js +0 -958
- package/dist/cjs/primitives/secp256k1.js.map +0 -1
- package/dist/cjs/primitives/secp256r1.js +0 -959
- package/dist/cjs/primitives/secp256r1.js.map +0 -1
- package/dist/cjs/primitives/sha256.js +0 -93
- package/dist/cjs/primitives/sha256.js.map +0 -1
- package/dist/cjs/primitives/x25519.js +0 -498
- package/dist/cjs/primitives/x25519.js.map +0 -1
- package/dist/cjs/primitives/xchacha20-poly1305.js +0 -340
- package/dist/cjs/primitives/xchacha20-poly1305.js.map +0 -1
- package/dist/cjs/primitives/xchacha20.js +0 -316
- package/dist/cjs/primitives/xchacha20.js.map +0 -1
- package/dist/cjs/types/cipher.js +0 -3
- package/dist/cjs/types/cipher.js.map +0 -1
- package/dist/cjs/types/crypto-api.js +0 -3
- package/dist/cjs/types/crypto-api.js.map +0 -1
- package/dist/cjs/types/hasher.js +0 -3
- package/dist/cjs/types/hasher.js.map +0 -1
- package/dist/cjs/types/identifier.js +0 -3
- package/dist/cjs/types/identifier.js.map +0 -1
- package/dist/cjs/types/key-compressor.js +0 -3
- package/dist/cjs/types/key-compressor.js.map +0 -1
- package/dist/cjs/types/key-converter.js +0 -3
- package/dist/cjs/types/key-converter.js.map +0 -1
- package/dist/cjs/types/key-deriver.js +0 -3
- package/dist/cjs/types/key-deriver.js.map +0 -1
- package/dist/cjs/types/key-generator.js +0 -3
- package/dist/cjs/types/key-generator.js.map +0 -1
- package/dist/cjs/types/key-io.js +0 -3
- package/dist/cjs/types/key-io.js.map +0 -1
- package/dist/cjs/types/key-wrapper.js +0 -3
- package/dist/cjs/types/key-wrapper.js.map +0 -1
- package/dist/cjs/types/params-direct.js +0 -3
- package/dist/cjs/types/params-direct.js.map +0 -1
- package/dist/cjs/types/params-enclosed.js +0 -3
- package/dist/cjs/types/params-enclosed.js.map +0 -1
- package/dist/cjs/types/params-kms.js +0 -3
- package/dist/cjs/types/params-kms.js.map +0 -1
- package/dist/cjs/types/signer.js +0 -3
- package/dist/cjs/types/signer.js.map +0 -1
- package/dist/cjs/utils.js +0 -173
- package/dist/cjs/utils.js.map +0 -1
|
@@ -1,521 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
-
function step(op) {
|
|
16
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
-
switch (op[0]) {
|
|
21
|
-
case 0: case 1: t = op; break;
|
|
22
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
-
default:
|
|
26
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
-
if (t[2]) _.ops.pop();
|
|
31
|
-
_.trys.pop(); continue;
|
|
32
|
-
}
|
|
33
|
-
op = body.call(thisArg, _);
|
|
34
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.LocalKeyManager = void 0;
|
|
40
|
-
var common_1 = require("@enbox/common");
|
|
41
|
-
var sha_2_js_1 = require("./algorithms/sha-2.js");
|
|
42
|
-
var ecdsa_js_1 = require("./algorithms/ecdsa.js");
|
|
43
|
-
var eddsa_js_1 = require("./algorithms/eddsa.js");
|
|
44
|
-
var jwk_js_1 = require("./jose/jwk.js");
|
|
45
|
-
/**
|
|
46
|
-
* `supportedAlgorithms` is an object mapping algorithm names to their respective implementations
|
|
47
|
-
* Each entry in this map specifies the algorithm name and its associated properties, including the
|
|
48
|
-
* implementation class and any relevant names or identifiers for the algorithm. This structure
|
|
49
|
-
* allows for easy retrieval and instantiation of algorithm implementations based on the algorithm
|
|
50
|
-
* name or key specification. It facilitates the support of multiple algorithms within the
|
|
51
|
-
* `LocalKeyManager` class.
|
|
52
|
-
*/
|
|
53
|
-
var supportedAlgorithms = {
|
|
54
|
-
'Ed25519': {
|
|
55
|
-
implementation: eddsa_js_1.EdDsaAlgorithm,
|
|
56
|
-
names: ['Ed25519'],
|
|
57
|
-
},
|
|
58
|
-
'secp256k1': {
|
|
59
|
-
implementation: ecdsa_js_1.EcdsaAlgorithm,
|
|
60
|
-
names: ['ES256K', 'secp256k1'],
|
|
61
|
-
},
|
|
62
|
-
'secp256r1': {
|
|
63
|
-
implementation: ecdsa_js_1.EcdsaAlgorithm,
|
|
64
|
-
names: ['ES256', 'secp256r1'],
|
|
65
|
-
},
|
|
66
|
-
'SHA-256': {
|
|
67
|
-
implementation: sha_2_js_1.Sha2Algorithm,
|
|
68
|
-
names: ['SHA-256']
|
|
69
|
-
}
|
|
70
|
-
};
|
|
71
|
-
var LocalKeyManager = /** @class */ (function () {
|
|
72
|
-
function LocalKeyManager(params) {
|
|
73
|
-
var _a;
|
|
74
|
-
/**
|
|
75
|
-
* A private map that stores instances of cryptographic algorithm implementations. Each key in
|
|
76
|
-
* this map is an `AlgorithmConstructor`, and its corresponding value is an instance of a class
|
|
77
|
-
* that implements a specific cryptographic algorithm. This map is used to cache and reuse
|
|
78
|
-
* instances for performance optimization, ensuring that each algorithm is instantiated only once.
|
|
79
|
-
*/
|
|
80
|
-
this._algorithmInstances = new Map();
|
|
81
|
-
this._keyStore = (_a = params === null || params === void 0 ? void 0 : params.keyStore) !== null && _a !== void 0 ? _a : new common_1.MemoryStore();
|
|
82
|
-
}
|
|
83
|
-
/**
|
|
84
|
-
* Generates a hash digest of the provided data.
|
|
85
|
-
*
|
|
86
|
-
* @remarks
|
|
87
|
-
* A digest is the output of the hash function. It's a fixed-size string of bytes
|
|
88
|
-
* that uniquely represents the data input into the hash function. The digest is often used for
|
|
89
|
-
* data integrity checks, as any alteration in the input data results in a significantly
|
|
90
|
-
* different digest.
|
|
91
|
-
*
|
|
92
|
-
* It takes the algorithm identifier of the hash function and data to digest as input and returns
|
|
93
|
-
* the digest of the data.
|
|
94
|
-
*
|
|
95
|
-
* @example
|
|
96
|
-
* ```ts
|
|
97
|
-
* const keyManager = new LocalKeyManager();
|
|
98
|
-
* const data = new Uint8Array([...]);
|
|
99
|
-
* const digest = await keyManager.digest({ algorithm: 'SHA-256', data });
|
|
100
|
-
* ```
|
|
101
|
-
*
|
|
102
|
-
* @param params - The parameters for the digest operation.
|
|
103
|
-
* @param params.algorithm - The name of hash function to use.
|
|
104
|
-
* @param params.data - The data to digest.
|
|
105
|
-
*
|
|
106
|
-
* @returns A Promise which will be fulfilled with the hash digest.
|
|
107
|
-
*/
|
|
108
|
-
LocalKeyManager.prototype.digest = function (_a) {
|
|
109
|
-
return __awaiter(this, arguments, void 0, function (_b) {
|
|
110
|
-
var hasher, hash;
|
|
111
|
-
var algorithm = _b.algorithm, data = _b.data;
|
|
112
|
-
return __generator(this, function (_c) {
|
|
113
|
-
switch (_c.label) {
|
|
114
|
-
case 0:
|
|
115
|
-
hasher = this.getAlgorithm({ algorithm: algorithm });
|
|
116
|
-
return [4 /*yield*/, hasher.digest({ algorithm: algorithm, data: data })];
|
|
117
|
-
case 1:
|
|
118
|
-
hash = _c.sent();
|
|
119
|
-
return [2 /*return*/, hash];
|
|
120
|
-
}
|
|
121
|
-
});
|
|
122
|
-
});
|
|
123
|
-
};
|
|
124
|
-
/**
|
|
125
|
-
* Exports a private key identified by the provided key URI from the local KMS.
|
|
126
|
-
*
|
|
127
|
-
* @remarks
|
|
128
|
-
* This method retrieves the key from the key store and returns it. It is primarily used
|
|
129
|
-
* for extracting keys for backup or transfer purposes.
|
|
130
|
-
*
|
|
131
|
-
* @example
|
|
132
|
-
* ```ts
|
|
133
|
-
* const keyManager = new LocalKeyManager();
|
|
134
|
-
* const keyUri = await keyManager.generateKey({ algorithm: 'Ed25519' });
|
|
135
|
-
* const privateKey = await keyManager.exportKey({ keyUri });
|
|
136
|
-
* ```
|
|
137
|
-
*
|
|
138
|
-
* @param params - Parameters for exporting the key.
|
|
139
|
-
* @param params.keyUri - The key URI identifying the key to export.
|
|
140
|
-
*
|
|
141
|
-
* @returns A Promise resolving to the JWK representation of the exported key.
|
|
142
|
-
*/
|
|
143
|
-
LocalKeyManager.prototype.exportKey = function (_a) {
|
|
144
|
-
return __awaiter(this, arguments, void 0, function (_b) {
|
|
145
|
-
var privateKey;
|
|
146
|
-
var keyUri = _b.keyUri;
|
|
147
|
-
return __generator(this, function (_c) {
|
|
148
|
-
switch (_c.label) {
|
|
149
|
-
case 0: return [4 /*yield*/, this.getPrivateKey({ keyUri: keyUri })];
|
|
150
|
-
case 1:
|
|
151
|
-
privateKey = _c.sent();
|
|
152
|
-
return [2 /*return*/, privateKey];
|
|
153
|
-
}
|
|
154
|
-
});
|
|
155
|
-
});
|
|
156
|
-
};
|
|
157
|
-
/**
|
|
158
|
-
* Generates a new cryptographic key in the local KMS with the specified algorithm and returns a
|
|
159
|
-
* unique key URI which can be used to reference the key in subsequent operations.
|
|
160
|
-
*
|
|
161
|
-
* @example
|
|
162
|
-
* ```ts
|
|
163
|
-
* const keyManager = new LocalKeyManager();
|
|
164
|
-
* const keyUri = await keyManager.generateKey({ algorithm: 'Ed25519' });
|
|
165
|
-
* console.log(keyUri); // Outputs the key URI
|
|
166
|
-
* ```
|
|
167
|
-
*
|
|
168
|
-
* @param params - The parameters for key generation.
|
|
169
|
-
* @param params.algorithm - The algorithm to use for key generation, defined in `SupportedAlgorithm`.
|
|
170
|
-
*
|
|
171
|
-
* @returns A Promise that resolves to the key URI, a unique identifier for the generated key.
|
|
172
|
-
*/
|
|
173
|
-
LocalKeyManager.prototype.generateKey = function (_a) {
|
|
174
|
-
return __awaiter(this, arguments, void 0, function (_b) {
|
|
175
|
-
var keyGenerator, key, keyUri;
|
|
176
|
-
var algorithm = _b.algorithm;
|
|
177
|
-
return __generator(this, function (_c) {
|
|
178
|
-
switch (_c.label) {
|
|
179
|
-
case 0:
|
|
180
|
-
keyGenerator = this.getAlgorithm({ algorithm: algorithm });
|
|
181
|
-
return [4 /*yield*/, keyGenerator.generateKey({ algorithm: algorithm })];
|
|
182
|
-
case 1:
|
|
183
|
-
key = _c.sent();
|
|
184
|
-
if ((key === null || key === void 0 ? void 0 : key.kid) === undefined) {
|
|
185
|
-
throw new Error('Generated key is missing a required property: kid');
|
|
186
|
-
}
|
|
187
|
-
keyUri = "".concat(jwk_js_1.KEY_URI_PREFIX_JWK).concat(key.kid);
|
|
188
|
-
// Store the key in the key store.
|
|
189
|
-
return [4 /*yield*/, this._keyStore.set(keyUri, key)];
|
|
190
|
-
case 2:
|
|
191
|
-
// Store the key in the key store.
|
|
192
|
-
_c.sent();
|
|
193
|
-
return [2 /*return*/, keyUri];
|
|
194
|
-
}
|
|
195
|
-
});
|
|
196
|
-
});
|
|
197
|
-
};
|
|
198
|
-
/**
|
|
199
|
-
* Computes the Key URI for a given public JWK (JSON Web Key).
|
|
200
|
-
*
|
|
201
|
-
* @remarks
|
|
202
|
-
* This method generates a {@link https://datatracker.ietf.org/doc/html/rfc3986 | URI}
|
|
203
|
-
* (Uniform Resource Identifier) for the given JWK, which uniquely identifies the key across all
|
|
204
|
-
* `CryptoApi` implementations. The key URI is constructed by appending the
|
|
205
|
-
* {@link https://datatracker.ietf.org/doc/html/rfc7638 | JWK thumbprint} to the prefix
|
|
206
|
-
* `urn:jwk:`. The JWK thumbprint is deterministically computed from the JWK and is consistent
|
|
207
|
-
* regardless of property order or optional property inclusion in the JWK. This ensures that the
|
|
208
|
-
* same key material represented as a JWK will always yield the same thumbprint, and therefore,
|
|
209
|
-
* the same key URI.
|
|
210
|
-
*
|
|
211
|
-
* @example
|
|
212
|
-
* ```ts
|
|
213
|
-
* const keyManager = new LocalKeyManager();
|
|
214
|
-
* const keyUri = await keyManager.generateKey({ algorithm: 'Ed25519' });
|
|
215
|
-
* const publicKey = await keyManager.getPublicKey({ keyUri });
|
|
216
|
-
* const keyUriFromPublicKey = await keyManager.getKeyUri({ key: publicKey });
|
|
217
|
-
* console.log(keyUri === keyUriFromPublicKey); // Outputs `true`
|
|
218
|
-
* ```
|
|
219
|
-
*
|
|
220
|
-
* @param params - The parameters for getting the key URI.
|
|
221
|
-
* @param params.key - The JWK for which to compute the key URI.
|
|
222
|
-
*
|
|
223
|
-
* @returns A Promise that resolves to the key URI as a string.
|
|
224
|
-
*/
|
|
225
|
-
LocalKeyManager.prototype.getKeyUri = function (_a) {
|
|
226
|
-
return __awaiter(this, arguments, void 0, function (_b) {
|
|
227
|
-
var jwkThumbprint, keyUri;
|
|
228
|
-
var key = _b.key;
|
|
229
|
-
return __generator(this, function (_c) {
|
|
230
|
-
switch (_c.label) {
|
|
231
|
-
case 0: return [4 /*yield*/, (0, jwk_js_1.computeJwkThumbprint)({ jwk: key })];
|
|
232
|
-
case 1:
|
|
233
|
-
jwkThumbprint = _c.sent();
|
|
234
|
-
keyUri = "".concat(jwk_js_1.KEY_URI_PREFIX_JWK).concat(jwkThumbprint);
|
|
235
|
-
return [2 /*return*/, keyUri];
|
|
236
|
-
}
|
|
237
|
-
});
|
|
238
|
-
});
|
|
239
|
-
};
|
|
240
|
-
/**
|
|
241
|
-
* Retrieves the public key associated with a previously generated private key, identified by
|
|
242
|
-
* the provided key URI.
|
|
243
|
-
*
|
|
244
|
-
* @example
|
|
245
|
-
* ```ts
|
|
246
|
-
* const keyManager = new LocalKeyManager();
|
|
247
|
-
* const keyUri = await keyManager.generateKey({ algorithm: 'Ed25519' });
|
|
248
|
-
* const publicKey = await keyManager.getPublicKey({ keyUri });
|
|
249
|
-
* ```
|
|
250
|
-
*
|
|
251
|
-
* @param params - The parameters for retrieving the public key.
|
|
252
|
-
* @param params.keyUri - The key URI of the private key to retrieve the public key for.
|
|
253
|
-
*
|
|
254
|
-
* @returns A Promise that resolves to the public key in JWK format.
|
|
255
|
-
*/
|
|
256
|
-
LocalKeyManager.prototype.getPublicKey = function (_a) {
|
|
257
|
-
return __awaiter(this, arguments, void 0, function (_b) {
|
|
258
|
-
var privateKey, algorithm, keyGenerator, publicKey;
|
|
259
|
-
var keyUri = _b.keyUri;
|
|
260
|
-
return __generator(this, function (_c) {
|
|
261
|
-
switch (_c.label) {
|
|
262
|
-
case 0: return [4 /*yield*/, this.getPrivateKey({ keyUri: keyUri })];
|
|
263
|
-
case 1:
|
|
264
|
-
privateKey = _c.sent();
|
|
265
|
-
algorithm = this.getAlgorithmName({ key: privateKey });
|
|
266
|
-
keyGenerator = this.getAlgorithm({ algorithm: algorithm });
|
|
267
|
-
return [4 /*yield*/, keyGenerator.getPublicKey({ key: privateKey })];
|
|
268
|
-
case 2:
|
|
269
|
-
publicKey = _c.sent();
|
|
270
|
-
return [2 /*return*/, publicKey];
|
|
271
|
-
}
|
|
272
|
-
});
|
|
273
|
-
});
|
|
274
|
-
};
|
|
275
|
-
/**
|
|
276
|
-
* Imports a private key into the local KMS.
|
|
277
|
-
*
|
|
278
|
-
* @remarks
|
|
279
|
-
* This method stores the provided JWK in the key store, making it available for subsequent
|
|
280
|
-
* cryptographic operations. It is particularly useful for initializing the KMS with pre-existing
|
|
281
|
-
* keys or for restoring keys from backups.
|
|
282
|
-
*
|
|
283
|
-
* Note that, if defined, the `kid` (key ID) property of the JWK is used as the key URI for the
|
|
284
|
-
* imported key. If the `kid` property is not provided, the key URI is computed from the JWK
|
|
285
|
-
* thumbprint of the key.
|
|
286
|
-
*
|
|
287
|
-
* @example
|
|
288
|
-
* ```ts
|
|
289
|
-
* const keyManager = new LocalKeyManager();
|
|
290
|
-
* const privateKey = { ... } // A private key in JWK format
|
|
291
|
-
* const keyUri = await keyManager.importKey({ key: privateKey });
|
|
292
|
-
* ```
|
|
293
|
-
*
|
|
294
|
-
* @param params - Parameters for importing the key.
|
|
295
|
-
* @param params.key - The private key to import to in JWK format.
|
|
296
|
-
*
|
|
297
|
-
* @returns A Promise resolving to the key URI, uniquely identifying the imported key.
|
|
298
|
-
*/
|
|
299
|
-
LocalKeyManager.prototype.importKey = function (_a) {
|
|
300
|
-
return __awaiter(this, arguments, void 0, function (_b) {
|
|
301
|
-
var privateKey, _c, _d, keyUri;
|
|
302
|
-
var _e;
|
|
303
|
-
var key = _b.key;
|
|
304
|
-
return __generator(this, function (_f) {
|
|
305
|
-
switch (_f.label) {
|
|
306
|
-
case 0:
|
|
307
|
-
if (!(0, jwk_js_1.isPrivateJwk)(key))
|
|
308
|
-
throw new TypeError('Invalid key provided. Must be a private key in JWK format.');
|
|
309
|
-
privateKey = structuredClone(key);
|
|
310
|
-
if (!((_e =
|
|
311
|
-
// If the key ID is undefined, set it to the JWK thumbprint.
|
|
312
|
-
privateKey.kid) !== null && _e !== void 0)) return [3 /*break*/, 1];
|
|
313
|
-
_c = _e;
|
|
314
|
-
return [3 /*break*/, 3];
|
|
315
|
-
case 1:
|
|
316
|
-
// If the key ID is undefined, set it to the JWK thumbprint.
|
|
317
|
-
_d = privateKey;
|
|
318
|
-
return [4 /*yield*/, (0, jwk_js_1.computeJwkThumbprint)({ jwk: privateKey })];
|
|
319
|
-
case 2:
|
|
320
|
-
_c = (_d.kid = _f.sent());
|
|
321
|
-
_f.label = 3;
|
|
322
|
-
case 3:
|
|
323
|
-
// If the key ID is undefined, set it to the JWK thumbprint.
|
|
324
|
-
_c;
|
|
325
|
-
return [4 /*yield*/, this.getKeyUri({ key: privateKey })];
|
|
326
|
-
case 4:
|
|
327
|
-
keyUri = _f.sent();
|
|
328
|
-
// Store the key in the key store.
|
|
329
|
-
return [4 /*yield*/, this._keyStore.set(keyUri, privateKey)];
|
|
330
|
-
case 5:
|
|
331
|
-
// Store the key in the key store.
|
|
332
|
-
_f.sent();
|
|
333
|
-
return [2 /*return*/, keyUri];
|
|
334
|
-
}
|
|
335
|
-
});
|
|
336
|
-
});
|
|
337
|
-
};
|
|
338
|
-
/**
|
|
339
|
-
* Signs the provided data using the private key identified by the provided key URI.
|
|
340
|
-
*
|
|
341
|
-
* @remarks
|
|
342
|
-
* This method uses the signature algorithm determined by the `alg` and/or `crv` properties of the
|
|
343
|
-
* private key identified by the provided key URI to sign the provided data. The signature can
|
|
344
|
-
* later be verified by parties with access to the corresponding public key, ensuring that the
|
|
345
|
-
* data has not been tampered with and was indeed signed by the holder of the private key.
|
|
346
|
-
*
|
|
347
|
-
* @example
|
|
348
|
-
* ```ts
|
|
349
|
-
* const keyManager = new LocalKeyManager();
|
|
350
|
-
* const keyUri = await keyManager.generateKey({ algorithm: 'Ed25519' });
|
|
351
|
-
* const data = new TextEncoder().encode('Message to sign');
|
|
352
|
-
* const signature = await keyManager.sign({ keyUri, data });
|
|
353
|
-
* ```
|
|
354
|
-
*
|
|
355
|
-
* @param params - The parameters for the signing operation.
|
|
356
|
-
* @param params.keyUri - The key URI of the private key to use for signing.
|
|
357
|
-
* @param params.data - The data to sign.
|
|
358
|
-
*
|
|
359
|
-
* @returns A Promise resolving to the digital signature as a `Uint8Array`.
|
|
360
|
-
*/
|
|
361
|
-
LocalKeyManager.prototype.sign = function (_a) {
|
|
362
|
-
return __awaiter(this, arguments, void 0, function (_b) {
|
|
363
|
-
var privateKey, algorithm, signer, signature;
|
|
364
|
-
var keyUri = _b.keyUri, data = _b.data;
|
|
365
|
-
return __generator(this, function (_c) {
|
|
366
|
-
switch (_c.label) {
|
|
367
|
-
case 0: return [4 /*yield*/, this.getPrivateKey({ keyUri: keyUri })];
|
|
368
|
-
case 1:
|
|
369
|
-
privateKey = _c.sent();
|
|
370
|
-
algorithm = this.getAlgorithmName({ key: privateKey });
|
|
371
|
-
signer = this.getAlgorithm({ algorithm: algorithm });
|
|
372
|
-
signature = signer.sign({ data: data, key: privateKey });
|
|
373
|
-
return [2 /*return*/, signature];
|
|
374
|
-
}
|
|
375
|
-
});
|
|
376
|
-
});
|
|
377
|
-
};
|
|
378
|
-
/**
|
|
379
|
-
* Verifies a digital signature associated the provided data using the provided key.
|
|
380
|
-
*
|
|
381
|
-
* @remarks
|
|
382
|
-
* This method uses the signature algorithm determined by the `alg` and/or `crv` properties of the
|
|
383
|
-
* provided key to check the validity of a digital signature against the original data. It
|
|
384
|
-
* confirms whether the signature was created by the holder of the corresponding private key and
|
|
385
|
-
* that the data has not been tampered with.
|
|
386
|
-
*
|
|
387
|
-
* @example
|
|
388
|
-
* ```ts
|
|
389
|
-
* const keyManager = new LocalKeyManager();
|
|
390
|
-
* const keyUri = await keyManager.generateKey({ algorithm: 'Ed25519' });
|
|
391
|
-
* const data = new TextEncoder().encode('Message to sign');
|
|
392
|
-
* const signature = await keyManager.sign({ keyUri, data });
|
|
393
|
-
* const isSignatureValid = await keyManager.verify({ keyUri, data, signature });
|
|
394
|
-
* ```
|
|
395
|
-
*
|
|
396
|
-
* @param params - The parameters for the verification operation.
|
|
397
|
-
* @param params.key - The key to use for verification.
|
|
398
|
-
* @param params.signature - The signature to verify.
|
|
399
|
-
* @param params.data - The data to verify.
|
|
400
|
-
*
|
|
401
|
-
* @returns A Promise resolving to a boolean indicating whether the signature is valid.
|
|
402
|
-
*/
|
|
403
|
-
LocalKeyManager.prototype.verify = function (_a) {
|
|
404
|
-
return __awaiter(this, arguments, void 0, function (_b) {
|
|
405
|
-
var algorithm, signer, isSignatureValid;
|
|
406
|
-
var key = _b.key, signature = _b.signature, data = _b.data;
|
|
407
|
-
return __generator(this, function (_c) {
|
|
408
|
-
algorithm = this.getAlgorithmName({ key: key });
|
|
409
|
-
signer = this.getAlgorithm({ algorithm: algorithm });
|
|
410
|
-
isSignatureValid = signer.verify({ key: key, signature: signature, data: data });
|
|
411
|
-
return [2 /*return*/, isSignatureValid];
|
|
412
|
-
});
|
|
413
|
-
});
|
|
414
|
-
};
|
|
415
|
-
/**
|
|
416
|
-
* Retrieves an algorithm implementation instance based on the provided algorithm name.
|
|
417
|
-
*
|
|
418
|
-
* @remarks
|
|
419
|
-
* This method checks if the requested algorithm is supported and returns a cached instance
|
|
420
|
-
* if available. If an instance does not exist, it creates and caches a new one. This approach
|
|
421
|
-
* optimizes performance by reusing algorithm instances across cryptographic operations.
|
|
422
|
-
*
|
|
423
|
-
* @example
|
|
424
|
-
* ```ts
|
|
425
|
-
* const signer = this.getAlgorithm({ algorithm: 'Ed25519' });
|
|
426
|
-
* ```
|
|
427
|
-
*
|
|
428
|
-
* @param params - The parameters for retrieving the algorithm implementation.
|
|
429
|
-
* @param params.algorithm - The name of the algorithm to retrieve.
|
|
430
|
-
*
|
|
431
|
-
* @returns An instance of the requested algorithm implementation.
|
|
432
|
-
*
|
|
433
|
-
* @throws Error if the requested algorithm is not supported.
|
|
434
|
-
*/
|
|
435
|
-
LocalKeyManager.prototype.getAlgorithm = function (_a) {
|
|
436
|
-
var _b;
|
|
437
|
-
var algorithm = _a.algorithm;
|
|
438
|
-
// Check if algorithm is supported.
|
|
439
|
-
var AlgorithmImplementation = (_b = supportedAlgorithms[algorithm]) === null || _b === void 0 ? void 0 : _b['implementation'];
|
|
440
|
-
if (!AlgorithmImplementation) {
|
|
441
|
-
throw new Error("Algorithm not supported: ".concat(algorithm));
|
|
442
|
-
}
|
|
443
|
-
// Check if instance already exists for the `AlgorithmImplementation`.
|
|
444
|
-
if (!this._algorithmInstances.has(AlgorithmImplementation)) {
|
|
445
|
-
// If not, create a new instance and store it in the cache
|
|
446
|
-
this._algorithmInstances.set(AlgorithmImplementation, new AlgorithmImplementation());
|
|
447
|
-
}
|
|
448
|
-
// Return the cached instance
|
|
449
|
-
return this._algorithmInstances.get(AlgorithmImplementation);
|
|
450
|
-
};
|
|
451
|
-
/**
|
|
452
|
-
* Determines the name of the algorithm based on the key's properties.
|
|
453
|
-
*
|
|
454
|
-
* @remarks
|
|
455
|
-
* This method facilitates the identification of the correct algorithm for cryptographic
|
|
456
|
-
* operations based on the `alg` or `crv` properties of a {@link Jwk | JWK}.
|
|
457
|
-
*
|
|
458
|
-
* @example
|
|
459
|
-
* ```ts
|
|
460
|
-
* const publicKey = { ... }; // Public key in JWK format
|
|
461
|
-
* const algorithm = this.getAlgorithmName({ key: publicKey });
|
|
462
|
-
* ```
|
|
463
|
-
*
|
|
464
|
-
* @param params - The parameters for determining the algorithm name.
|
|
465
|
-
* @param params.key - A JWK containing the `alg` or `crv` properties.
|
|
466
|
-
*
|
|
467
|
-
* @returns The name of the algorithm associated with the key.
|
|
468
|
-
*
|
|
469
|
-
* @throws Error if the algorithm cannot be determined from the provided input.
|
|
470
|
-
*/
|
|
471
|
-
LocalKeyManager.prototype.getAlgorithmName = function (_a) {
|
|
472
|
-
var key = _a.key;
|
|
473
|
-
var algProperty = key.alg;
|
|
474
|
-
var crvProperty = key.crv;
|
|
475
|
-
for (var algName in supportedAlgorithms) {
|
|
476
|
-
var algorithmInfo = supportedAlgorithms[algName];
|
|
477
|
-
if (algProperty && algorithmInfo.names.includes(algProperty)) {
|
|
478
|
-
return algName;
|
|
479
|
-
}
|
|
480
|
-
else if (crvProperty && algorithmInfo.names.includes(crvProperty)) {
|
|
481
|
-
return algName;
|
|
482
|
-
}
|
|
483
|
-
}
|
|
484
|
-
throw new Error("Unable to determine algorithm based on provided input: alg=".concat(algProperty, ", crv=").concat(crvProperty));
|
|
485
|
-
};
|
|
486
|
-
/**
|
|
487
|
-
* Retrieves a private key from the key store based on the provided key URI.
|
|
488
|
-
*
|
|
489
|
-
* @example
|
|
490
|
-
* ```ts
|
|
491
|
-
* const privateKey = this.getPrivateKey({ keyUri: 'urn:jwk:...' });
|
|
492
|
-
* ```
|
|
493
|
-
*
|
|
494
|
-
* @param params - Parameters for retrieving the private key.
|
|
495
|
-
* @param params.keyUri - The key URI identifying the private key to retrieve.
|
|
496
|
-
*
|
|
497
|
-
* @returns A Promise resolving to the JWK representation of the private key.
|
|
498
|
-
*
|
|
499
|
-
* @throws Error if the key is not found in the key store.
|
|
500
|
-
*/
|
|
501
|
-
LocalKeyManager.prototype.getPrivateKey = function (_a) {
|
|
502
|
-
return __awaiter(this, arguments, void 0, function (_b) {
|
|
503
|
-
var privateKey;
|
|
504
|
-
var keyUri = _b.keyUri;
|
|
505
|
-
return __generator(this, function (_c) {
|
|
506
|
-
switch (_c.label) {
|
|
507
|
-
case 0: return [4 /*yield*/, this._keyStore.get(keyUri)];
|
|
508
|
-
case 1:
|
|
509
|
-
privateKey = _c.sent();
|
|
510
|
-
if (!privateKey) {
|
|
511
|
-
throw new Error("Key not found: ".concat(keyUri));
|
|
512
|
-
}
|
|
513
|
-
return [2 /*return*/, privateKey];
|
|
514
|
-
}
|
|
515
|
-
});
|
|
516
|
-
});
|
|
517
|
-
};
|
|
518
|
-
return LocalKeyManager;
|
|
519
|
-
}());
|
|
520
|
-
exports.LocalKeyManager = LocalKeyManager;
|
|
521
|
-
//# sourceMappingURL=local-key-manager.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"local-key-manager.js","sourceRoot":"","sources":["../../src/local-key-manager.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,wCAA2D;AAqB3D,kDAAsD;AACtD,kDAAuD;AACvD,kDAAuD;AAEvD,wCAAuF;AAEvF;;;;;;;GAOG;AACH,IAAM,mBAAmB,GAAG;IAC1B,SAAS,EAAE;QACT,cAAc,EAAG,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