@enbox/crypto 0.0.2 → 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 +26 -39
- 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 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"secp256r1.js","sourceRoot":"","sources":["../../../src/primitives/secp256r1.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,wCAAwC;AACxC,+CAA8C;AAC9C,2CAA+C;AAC/C,sDAA+D;AAK/D,yCAAqF;AAErF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0DG;AACH;IAAA;IAwwBA,CAAC;IAvwBD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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iB,gBAAM,GAA1B;4DAA2B,EACb;;gBADe,GAAG,SAAA,EAAE,SAAS,eAAA,EAAE,IAAI,UAAA;;;4BAIxB,qBAAM,SAAS,CAAC,gBAAgB,CAAC,EAAE,SAAS,EAAE,GAAG,EAAE,CAAC,EAAA;;wBAArE,cAAc,GAAG,SAAoD;wBAGrE,MAAM,GAAG,IAAA,eAAM,EAAC,IAAI,CAAC,CAAC;wBAOtB,OAAO,GAAG,gBAAS,CAAC,MAAM,CAAC,SAAS,EAAE,MAAM,EAAE,cAAc,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;wBAErF,sBAAO,OAAO,EAAC;;;;KAChB;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAgCG;IACkB,uBAAa,GAAlC;4DAAmC,EAElC;;gBAFoC,QAAQ,cAAA;;gBAG3C,yDAAyD;gBACzD,IAAI,QAAQ,CAAC,UAAU,KAAK,EAAE,EAAE,CAAC;oBAC/B,QAAQ,GAAG,gBAAS,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC;gBAC9C,CAAC;gBAGK,KAAK,GAAG,gBAAS,CAAC,eAAe,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;gBAGpD,CAAC,GAAG,IAAA,uBAAe,EAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;gBACjC,CAAC,GAAG,IAAA,uBAAe,EAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;gBAEvC,sBAAO,EAAE,CAAC,GAAA,EAAE,CAAC,GAAA,EAAE,EAAC;;;KACjB;IACH,gBAAC;AAAD,CAAC,AAxwBD,IAwwBC;AAxwBY,8BAAS;AA0wBA,yBAAI"}
|
|
@@ -1,93 +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.Sha256 = void 0;
|
|
40
|
-
var sha256_1 = require("@noble/hashes/sha256");
|
|
41
|
-
/**
|
|
42
|
-
* The `Sha256` class provides an interface for generating SHA-256 hash digests.
|
|
43
|
-
*
|
|
44
|
-
* This class utilizes the '@noble/hashes/sha256' function to generate hash digests
|
|
45
|
-
* of the provided data. The SHA-256 algorithm is widely used in cryptographic
|
|
46
|
-
* applications to produce a fixed-size 256-bit (32-byte) hash.
|
|
47
|
-
*
|
|
48
|
-
* The methods of this class are asynchronous and return Promises. They use the Uint8Array
|
|
49
|
-
* type for input data and the resulting digest, ensuring a consistent interface
|
|
50
|
-
* for binary data processing.
|
|
51
|
-
*
|
|
52
|
-
* @example
|
|
53
|
-
* ```ts
|
|
54
|
-
* const data = new Uint8Array([...]);
|
|
55
|
-
* const hash = await Sha256.digest({ data });
|
|
56
|
-
* ```
|
|
57
|
-
*/
|
|
58
|
-
var Sha256 = /** @class */ (function () {
|
|
59
|
-
function Sha256() {
|
|
60
|
-
}
|
|
61
|
-
/**
|
|
62
|
-
* Generates a SHA-256 hash digest for the given data.
|
|
63
|
-
*
|
|
64
|
-
* @remarks
|
|
65
|
-
* This method produces a hash digest using the SHA-256 algorithm. The resultant digest
|
|
66
|
-
* is deterministic, meaning the same data will always produce the same hash, but
|
|
67
|
-
* is computationally infeasible to regenerate the original data from the hash.
|
|
68
|
-
*
|
|
69
|
-
* @example
|
|
70
|
-
* ```ts
|
|
71
|
-
* const data = new Uint8Array([...]);
|
|
72
|
-
* const hash = await Sha256.digest({ data });
|
|
73
|
-
* ```
|
|
74
|
-
*
|
|
75
|
-
* @param params - The parameters for the hashing operation.
|
|
76
|
-
* @param params.data - The data to hash, represented as a Uint8Array.
|
|
77
|
-
*
|
|
78
|
-
* @returns A Promise that resolves to the SHA-256 hash digest of the provided data as a Uint8Array.
|
|
79
|
-
*/
|
|
80
|
-
Sha256.digest = function (_a) {
|
|
81
|
-
return __awaiter(this, arguments, void 0, function (_b) {
|
|
82
|
-
var hash;
|
|
83
|
-
var data = _b.data;
|
|
84
|
-
return __generator(this, function (_c) {
|
|
85
|
-
hash = (0, sha256_1.sha256)(data);
|
|
86
|
-
return [2 /*return*/, hash];
|
|
87
|
-
});
|
|
88
|
-
});
|
|
89
|
-
};
|
|
90
|
-
return Sha256;
|
|
91
|
-
}());
|
|
92
|
-
exports.Sha256 = Sha256;
|
|
93
|
-
//# sourceMappingURL=sha256.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sha256.js","sourceRoot":"","sources":["../../../src/primitives/sha256.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAA8C;AAE9C;;;;;;;;;;;;;;;;GAgBG;AACH;IAAA;IA2BA,CAAC;IA1BC;;;;;;;;;;;;;;;;;;OAkBG;IACiB,aAAM,GAA1B;4DAA2B,EAE1B;;gBAF4B,IAAI,UAAA;;gBAGzB,IAAI,GAAG,IAAA,eAAM,EAAC,IAAI,CAAC,CAAC;gBAE1B,sBAAO,IAAI,EAAC;;;KACb;IACH,aAAC;AAAD,CAAC,AA3BD,IA2BC;AA3BY,wBAAM"}
|
|
@@ -1,498 +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
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
39
|
-
var t = {};
|
|
40
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
41
|
-
t[p] = s[p];
|
|
42
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
43
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
44
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
45
|
-
t[p[i]] = s[p[i]];
|
|
46
|
-
}
|
|
47
|
-
return t;
|
|
48
|
-
};
|
|
49
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
50
|
-
exports.X25519 = void 0;
|
|
51
|
-
var common_1 = require("@enbox/common");
|
|
52
|
-
var ed25519_1 = require("@noble/curves/ed25519");
|
|
53
|
-
var jwk_js_1 = require("../jose/jwk.js");
|
|
54
|
-
/**
|
|
55
|
-
* The `X25519` class provides a comprehensive suite of utilities for working with the X25519
|
|
56
|
-
* elliptic curve, widely used for key agreement protocols and cryptographic applications. It
|
|
57
|
-
* provides methods for key generation, conversion, and Elliptic Curve Diffie-Hellman (ECDH)
|
|
58
|
-
* key agreement, all aligned with standard cryptographic practices.
|
|
59
|
-
*
|
|
60
|
-
* The class supports conversions between raw byte formats and JSON Web Key (JWK) formats,
|
|
61
|
-
* making it versatile for various cryptographic tasks. It adheres to RFC6090 for ECDH, ensuring
|
|
62
|
-
* secure and effective handling of keys and cryptographic operations.
|
|
63
|
-
*
|
|
64
|
-
* Key Features:
|
|
65
|
-
* - Key Generation: Generate X25519 private keys in JWK format.
|
|
66
|
-
* - Key Conversion: Transform keys between raw byte arrays and JWK formats.
|
|
67
|
-
* - Public Key Derivation: Derive public keys from private keys.
|
|
68
|
-
* - ECDH Shared Secret Computation: Securely derive shared secrets using private and public keys.
|
|
69
|
-
*
|
|
70
|
-
* The methods in this class are asynchronous, returning Promises to accommodate various
|
|
71
|
-
* JavaScript environments.
|
|
72
|
-
*
|
|
73
|
-
* @example
|
|
74
|
-
* ```ts
|
|
75
|
-
* // Key Generation
|
|
76
|
-
* const privateKey = await X25519.generateKey();
|
|
77
|
-
*
|
|
78
|
-
* // Public Key Derivation
|
|
79
|
-
* const publicKey = await X25519.computePublicKey({ key: privateKey });
|
|
80
|
-
* console.log(publicKey === await X25519.getPublicKey({ key: privateKey })); // Output: true
|
|
81
|
-
*
|
|
82
|
-
* // ECDH Shared Secret Computation
|
|
83
|
-
* const sharedSecret = await X25519.sharedSecret({
|
|
84
|
-
* privateKeyA: privateKey,
|
|
85
|
-
* publicKeyB: anotherPublicKey
|
|
86
|
-
* });
|
|
87
|
-
*
|
|
88
|
-
* // Key Conversion
|
|
89
|
-
* const publicKeyBytes = await X25519.publicKeyToBytes({ publicKey });
|
|
90
|
-
* const privateKeyBytes = await X25519.privateKeyToBytes({ privateKey });
|
|
91
|
-
* ```
|
|
92
|
-
*/
|
|
93
|
-
var X25519 = /** @class */ (function () {
|
|
94
|
-
function X25519() {
|
|
95
|
-
}
|
|
96
|
-
/**
|
|
97
|
-
* Converts a raw private key in bytes to its corresponding JSON Web Key (JWK) format.
|
|
98
|
-
*
|
|
99
|
-
* @remarks
|
|
100
|
-
* This method accepts a private key as a byte array (Uint8Array) for the X25519 elliptic curve
|
|
101
|
-
* and transforms it into a JWK object. The process involves first deriving the public key from
|
|
102
|
-
* the private key, then encoding both the private and public keys into base64url format.
|
|
103
|
-
*
|
|
104
|
-
* The resulting JWK object includes the following properties:
|
|
105
|
-
* - `kty`: Key Type, set to 'OKP' for Octet Key Pair.
|
|
106
|
-
* - `crv`: Curve Name, set to 'X25519'.
|
|
107
|
-
* - `d`: The private key component, base64url-encoded.
|
|
108
|
-
* - `x`: The derived public key, base64url-encoded.
|
|
109
|
-
*
|
|
110
|
-
* This method is useful for converting raw public keys into a standardized
|
|
111
|
-
* JSON format, facilitating their use in cryptographic operations and making
|
|
112
|
-
* them easy to share and store.
|
|
113
|
-
*
|
|
114
|
-
* @example
|
|
115
|
-
* ```ts
|
|
116
|
-
* const privateKeyBytes = new Uint8Array([...]); // Replace with actual private key bytes
|
|
117
|
-
* const privateKey = await X25519.bytesToPrivateKey({ privateKeyBytes });
|
|
118
|
-
* ```
|
|
119
|
-
*
|
|
120
|
-
* @param params - The parameters for the private key conversion.
|
|
121
|
-
* @param params.privateKeyBytes - The raw private key as a Uint8Array.
|
|
122
|
-
*
|
|
123
|
-
* @returns A Promise that resolves to the private key in JWK format.
|
|
124
|
-
*/
|
|
125
|
-
X25519.bytesToPrivateKey = function (_a) {
|
|
126
|
-
return __awaiter(this, arguments, void 0, function (_b) {
|
|
127
|
-
var publicKeyBytes, privateKey, _c;
|
|
128
|
-
var privateKeyBytes = _b.privateKeyBytes;
|
|
129
|
-
return __generator(this, function (_d) {
|
|
130
|
-
switch (_d.label) {
|
|
131
|
-
case 0:
|
|
132
|
-
publicKeyBytes = ed25519_1.x25519.getPublicKey(privateKeyBytes);
|
|
133
|
-
privateKey = {
|
|
134
|
-
kty: 'OKP',
|
|
135
|
-
crv: 'X25519',
|
|
136
|
-
d: common_1.Convert.uint8Array(privateKeyBytes).toBase64Url(),
|
|
137
|
-
x: common_1.Convert.uint8Array(publicKeyBytes).toBase64Url(),
|
|
138
|
-
};
|
|
139
|
-
// Compute the JWK thumbprint and set as the key ID.
|
|
140
|
-
_c = privateKey;
|
|
141
|
-
return [4 /*yield*/, (0, jwk_js_1.computeJwkThumbprint)({ jwk: privateKey })];
|
|
142
|
-
case 1:
|
|
143
|
-
// Compute the JWK thumbprint and set as the key ID.
|
|
144
|
-
_c.kid = _d.sent();
|
|
145
|
-
return [2 /*return*/, privateKey];
|
|
146
|
-
}
|
|
147
|
-
});
|
|
148
|
-
});
|
|
149
|
-
};
|
|
150
|
-
/**
|
|
151
|
-
* Converts a raw public key in bytes to its corresponding JSON Web Key (JWK) format.
|
|
152
|
-
*
|
|
153
|
-
* @remarks
|
|
154
|
-
* This method accepts a public key as a byte array (Uint8Array) for the X25519 elliptic curve
|
|
155
|
-
* and transforms it into a JWK object. The conversion process involves encoding the public
|
|
156
|
-
* key bytes into base64url format.
|
|
157
|
-
*
|
|
158
|
-
* The resulting JWK object includes the following properties:
|
|
159
|
-
* - `kty`: Key Type, set to 'OKP' for Octet Key Pair.
|
|
160
|
-
* - `crv`: Curve Name, set to 'X25519'.
|
|
161
|
-
* - `x`: The public key, base64url-encoded.
|
|
162
|
-
*
|
|
163
|
-
* This method is useful for converting raw public keys into a standardized
|
|
164
|
-
* JSON format, facilitating their use in cryptographic operations and making
|
|
165
|
-
* them easy to share and store.
|
|
166
|
-
*
|
|
167
|
-
* @example
|
|
168
|
-
* ```ts
|
|
169
|
-
* const publicKeyBytes = new Uint8Array([...]); // Replace with actual public key bytes
|
|
170
|
-
* const publicKey = await X25519.bytesToPublicKey({ publicKeyBytes });
|
|
171
|
-
* ```
|
|
172
|
-
*
|
|
173
|
-
* @param params - The parameters for the public key conversion.
|
|
174
|
-
* @param params.publicKeyBytes - The raw public key as a Uint8Array.
|
|
175
|
-
*
|
|
176
|
-
* @returns A Promise that resolves to the public key in JWK format.
|
|
177
|
-
*/
|
|
178
|
-
X25519.bytesToPublicKey = function (_a) {
|
|
179
|
-
return __awaiter(this, arguments, void 0, function (_b) {
|
|
180
|
-
var publicKey, _c;
|
|
181
|
-
var publicKeyBytes = _b.publicKeyBytes;
|
|
182
|
-
return __generator(this, function (_d) {
|
|
183
|
-
switch (_d.label) {
|
|
184
|
-
case 0:
|
|
185
|
-
publicKey = {
|
|
186
|
-
kty: 'OKP',
|
|
187
|
-
crv: 'X25519',
|
|
188
|
-
x: common_1.Convert.uint8Array(publicKeyBytes).toBase64Url(),
|
|
189
|
-
};
|
|
190
|
-
// Compute the JWK thumbprint and set as the key ID.
|
|
191
|
-
_c = publicKey;
|
|
192
|
-
return [4 /*yield*/, (0, jwk_js_1.computeJwkThumbprint)({ jwk: publicKey })];
|
|
193
|
-
case 1:
|
|
194
|
-
// Compute the JWK thumbprint and set as the key ID.
|
|
195
|
-
_c.kid = _d.sent();
|
|
196
|
-
return [2 /*return*/, publicKey];
|
|
197
|
-
}
|
|
198
|
-
});
|
|
199
|
-
});
|
|
200
|
-
};
|
|
201
|
-
/**
|
|
202
|
-
* Derives the public key in JWK format from a given X25519 private key.
|
|
203
|
-
*
|
|
204
|
-
* @remarks
|
|
205
|
-
* This method takes a private key in JWK format and derives its corresponding public key,
|
|
206
|
-
* also in JWK format. The derivation process involves converting the private key to a
|
|
207
|
-
* raw byte array and then computing the corresponding public key on the Curve25519 curve.
|
|
208
|
-
* The public key is then encoded into base64url format to construct a JWK representation.
|
|
209
|
-
*
|
|
210
|
-
* The process ensures that the derived public key correctly corresponds to the given private key,
|
|
211
|
-
* adhering to the Curve25519 elliptic curve in Twisted Edwards form standards. This method is
|
|
212
|
-
* useful in cryptographic operations where a public key is needed for operations like signature
|
|
213
|
-
* verification, but only the private key is available.
|
|
214
|
-
*
|
|
215
|
-
* @example
|
|
216
|
-
* ```ts
|
|
217
|
-
* const privateKey = { ... }; // A Jwk object representing an X25519 private key
|
|
218
|
-
* const publicKey = await X25519.computePublicKey({ key: privateKey });
|
|
219
|
-
* ```
|
|
220
|
-
*
|
|
221
|
-
* @param params - The parameters for the public key derivation.
|
|
222
|
-
* @param params.key - The private key in JWK format from which to derive the public key.
|
|
223
|
-
*
|
|
224
|
-
* @returns A Promise that resolves to the derived public key in JWK format.
|
|
225
|
-
*/
|
|
226
|
-
X25519.computePublicKey = function (_a) {
|
|
227
|
-
return __awaiter(this, arguments, void 0, function (_b) {
|
|
228
|
-
var privateKeyBytes, publicKeyBytes, publicKey, _c;
|
|
229
|
-
var key = _b.key;
|
|
230
|
-
return __generator(this, function (_d) {
|
|
231
|
-
switch (_d.label) {
|
|
232
|
-
case 0: return [4 /*yield*/, X25519.privateKeyToBytes({ privateKey: key })];
|
|
233
|
-
case 1:
|
|
234
|
-
privateKeyBytes = _d.sent();
|
|
235
|
-
publicKeyBytes = ed25519_1.x25519.getPublicKey(privateKeyBytes);
|
|
236
|
-
publicKey = {
|
|
237
|
-
kty: 'OKP',
|
|
238
|
-
crv: 'X25519',
|
|
239
|
-
x: common_1.Convert.uint8Array(publicKeyBytes).toBase64Url()
|
|
240
|
-
};
|
|
241
|
-
// Compute the JWK thumbprint and set as the key ID.
|
|
242
|
-
_c = publicKey;
|
|
243
|
-
return [4 /*yield*/, (0, jwk_js_1.computeJwkThumbprint)({ jwk: publicKey })];
|
|
244
|
-
case 2:
|
|
245
|
-
// Compute the JWK thumbprint and set as the key ID.
|
|
246
|
-
_c.kid = _d.sent();
|
|
247
|
-
return [2 /*return*/, publicKey];
|
|
248
|
-
}
|
|
249
|
-
});
|
|
250
|
-
});
|
|
251
|
-
};
|
|
252
|
-
/**
|
|
253
|
-
* Generates an X25519 private key in JSON Web Key (JWK) format.
|
|
254
|
-
*
|
|
255
|
-
* @remarks
|
|
256
|
-
* This method creates a new private key suitable for use with the X25519 elliptic curve.
|
|
257
|
-
* The key generation process involves using cryptographically secure random number generation
|
|
258
|
-
* to ensure the uniqueness and security of the key. The resulting private key adheres to the
|
|
259
|
-
* JWK format making it compatible with common cryptographic standards and easy to use in various
|
|
260
|
-
* cryptographic processes.
|
|
261
|
-
*
|
|
262
|
-
* The generated private key in JWK format includes the following components:
|
|
263
|
-
* - `kty`: Key Type, set to 'OKP' for Octet Key Pair.
|
|
264
|
-
* - `crv`: Curve Name, set to 'X25519'.
|
|
265
|
-
* - `d`: The private key component, base64url-encoded.
|
|
266
|
-
* - `x`: The derived public key, base64url-encoded.
|
|
267
|
-
*
|
|
268
|
-
* The key is returned in a format suitable for direct use in key agreement operations.
|
|
269
|
-
*
|
|
270
|
-
* @example
|
|
271
|
-
* ```ts
|
|
272
|
-
* const privateKey = await X25519.generateKey();
|
|
273
|
-
* ```
|
|
274
|
-
*
|
|
275
|
-
* @returns A Promise that resolves to the generated private key in JWK format.
|
|
276
|
-
*/
|
|
277
|
-
X25519.generateKey = function () {
|
|
278
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
279
|
-
var privateKeyBytes, privateKey, _a;
|
|
280
|
-
return __generator(this, function (_b) {
|
|
281
|
-
switch (_b.label) {
|
|
282
|
-
case 0:
|
|
283
|
-
privateKeyBytes = ed25519_1.x25519.utils.randomPrivateKey();
|
|
284
|
-
return [4 /*yield*/, X25519.bytesToPrivateKey({ privateKeyBytes: privateKeyBytes })];
|
|
285
|
-
case 1:
|
|
286
|
-
privateKey = _b.sent();
|
|
287
|
-
// Compute the JWK thumbprint and set as the key ID.
|
|
288
|
-
_a = privateKey;
|
|
289
|
-
return [4 /*yield*/, (0, jwk_js_1.computeJwkThumbprint)({ jwk: privateKey })];
|
|
290
|
-
case 2:
|
|
291
|
-
// Compute the JWK thumbprint and set as the key ID.
|
|
292
|
-
_a.kid = _b.sent();
|
|
293
|
-
return [2 /*return*/, privateKey];
|
|
294
|
-
}
|
|
295
|
-
});
|
|
296
|
-
});
|
|
297
|
-
};
|
|
298
|
-
/**
|
|
299
|
-
* Retrieves the public key properties from a given private key in JWK format.
|
|
300
|
-
*
|
|
301
|
-
* @remarks
|
|
302
|
-
* This method extracts the public key portion from an X25519 private key in JWK format. It does
|
|
303
|
-
* so by removing the private key property 'd' and making a shallow copy, effectively yielding the
|
|
304
|
-
* public key. The method sets the 'kid' (key ID) property using the JWK thumbprint if it is not
|
|
305
|
-
* already defined. This approach is used under the assumption that a private key in JWK format
|
|
306
|
-
* always contains the corresponding public key properties.
|
|
307
|
-
*
|
|
308
|
-
* Note: This method offers a significant performance advantage, being about 500 times faster
|
|
309
|
-
* than `computePublicKey()`. However, it does not mathematically validate the private key, nor
|
|
310
|
-
* does it derive the public key from the private key. It simply extracts existing public key
|
|
311
|
-
* properties from the private key object. This makes it suitable for scenarios where speed is
|
|
312
|
-
* critical and the private key's integrity is already assured.
|
|
313
|
-
*
|
|
314
|
-
* @example
|
|
315
|
-
* ```ts
|
|
316
|
-
* const privateKey = { ... }; // A Jwk object representing an X25519 private key
|
|
317
|
-
* const publicKey = await X25519.getPublicKey({ key: privateKey });
|
|
318
|
-
* ```
|
|
319
|
-
*
|
|
320
|
-
* @param params - The parameters for retrieving the public key properties.
|
|
321
|
-
* @param params.key - The private key in JWK format.
|
|
322
|
-
*
|
|
323
|
-
* @returns A Promise that resolves to the public key in JWK format.
|
|
324
|
-
*/
|
|
325
|
-
X25519.getPublicKey = function (_a) {
|
|
326
|
-
return __awaiter(this, arguments, void 0, function (_b) {
|
|
327
|
-
var d, publicKey, _c, _d;
|
|
328
|
-
var _e;
|
|
329
|
-
var key = _b.key;
|
|
330
|
-
return __generator(this, function (_f) {
|
|
331
|
-
switch (_f.label) {
|
|
332
|
-
case 0:
|
|
333
|
-
// Verify the provided JWK represents an octet key pair (OKP) X25519 private key.
|
|
334
|
-
if (!((0, jwk_js_1.isOkpPrivateJwk)(key) && key.crv === 'X25519')) {
|
|
335
|
-
throw new Error("X25519: The provided key is not an X25519 private JWK.");
|
|
336
|
-
}
|
|
337
|
-
d = key.d, publicKey = __rest(key, ["d"]);
|
|
338
|
-
if (!((_e =
|
|
339
|
-
// If the key ID is undefined, set it to the JWK thumbprint.
|
|
340
|
-
publicKey.kid) !== null && _e !== void 0)) return [3 /*break*/, 1];
|
|
341
|
-
_c = _e;
|
|
342
|
-
return [3 /*break*/, 3];
|
|
343
|
-
case 1:
|
|
344
|
-
// If the key ID is undefined, set it to the JWK thumbprint.
|
|
345
|
-
_d = publicKey;
|
|
346
|
-
return [4 /*yield*/, (0, jwk_js_1.computeJwkThumbprint)({ jwk: publicKey })];
|
|
347
|
-
case 2:
|
|
348
|
-
_c = (_d.kid = _f.sent());
|
|
349
|
-
_f.label = 3;
|
|
350
|
-
case 3:
|
|
351
|
-
// If the key ID is undefined, set it to the JWK thumbprint.
|
|
352
|
-
_c;
|
|
353
|
-
return [2 /*return*/, publicKey];
|
|
354
|
-
}
|
|
355
|
-
});
|
|
356
|
-
});
|
|
357
|
-
};
|
|
358
|
-
/**
|
|
359
|
-
* Converts a private key from JSON Web Key (JWK) format to a raw byte array (Uint8Array).
|
|
360
|
-
*
|
|
361
|
-
* @remarks
|
|
362
|
-
* This method accepts a private key in JWK format and extracts its raw byte representation.
|
|
363
|
-
*
|
|
364
|
-
* This method accepts a public key in JWK format and converts it into its raw binary
|
|
365
|
-
* form. The conversion process involves decoding the 'd' parameter of the JWK
|
|
366
|
-
* from base64url format into a byte array.
|
|
367
|
-
*
|
|
368
|
-
* This conversion is essential for operations that require the private key in its raw
|
|
369
|
-
* binary form, such as certain low-level cryptographic operations or when interfacing
|
|
370
|
-
* with systems and libraries that expect keys in a byte array format.
|
|
371
|
-
*
|
|
372
|
-
* @example
|
|
373
|
-
* ```ts
|
|
374
|
-
* const privateKey = { ... }; // An X25519 private key in JWK format
|
|
375
|
-
* const privateKeyBytes = await X25519.privateKeyToBytes({ privateKey });
|
|
376
|
-
* ```
|
|
377
|
-
*
|
|
378
|
-
* @param params - The parameters for the private key conversion.
|
|
379
|
-
* @param params.privateKey - The private key in JWK format.
|
|
380
|
-
*
|
|
381
|
-
* @returns A Promise that resolves to the private key as a Uint8Array.
|
|
382
|
-
*/
|
|
383
|
-
X25519.privateKeyToBytes = function (_a) {
|
|
384
|
-
return __awaiter(this, arguments, void 0, function (_b) {
|
|
385
|
-
var privateKeyBytes;
|
|
386
|
-
var privateKey = _b.privateKey;
|
|
387
|
-
return __generator(this, function (_c) {
|
|
388
|
-
// Verify the provided JWK represents a valid OKP private key.
|
|
389
|
-
if (!(0, jwk_js_1.isOkpPrivateJwk)(privateKey)) {
|
|
390
|
-
throw new Error("X25519: The provided key is not a valid OKP private key.");
|
|
391
|
-
}
|
|
392
|
-
privateKeyBytes = common_1.Convert.base64Url(privateKey.d).toUint8Array();
|
|
393
|
-
return [2 /*return*/, privateKeyBytes];
|
|
394
|
-
});
|
|
395
|
-
});
|
|
396
|
-
};
|
|
397
|
-
/**
|
|
398
|
-
* Converts a public key from JSON Web Key (JWK) format to a raw byte array (Uint8Array).
|
|
399
|
-
*
|
|
400
|
-
* @remarks
|
|
401
|
-
* This method accepts a public key in JWK format and converts it into its raw binary form.
|
|
402
|
-
* The conversion process involves decoding the 'x' parameter of the JWK (which represent the
|
|
403
|
-
* x coordinate of the elliptic curve point) from base64url format into a byte array.
|
|
404
|
-
*
|
|
405
|
-
* This conversion is essential for operations that require the public key in its raw
|
|
406
|
-
* binary form, such as certain low-level cryptographic operations or when interfacing
|
|
407
|
-
* with systems and libraries that expect keys in a byte array format.
|
|
408
|
-
*
|
|
409
|
-
* @example
|
|
410
|
-
* ```ts
|
|
411
|
-
* const publicKey = { ... }; // An X25519 public key in JWK format
|
|
412
|
-
* const publicKeyBytes = await X25519.publicKeyToBytes({ publicKey });
|
|
413
|
-
* ```
|
|
414
|
-
*
|
|
415
|
-
* @param params - The parameters for the public key conversion.
|
|
416
|
-
* @param params.publicKey - The public key in JWK format.
|
|
417
|
-
*
|
|
418
|
-
* @returns A Promise that resolves to the public key as a Uint8Array.
|
|
419
|
-
*/
|
|
420
|
-
X25519.publicKeyToBytes = function (_a) {
|
|
421
|
-
return __awaiter(this, arguments, void 0, function (_b) {
|
|
422
|
-
var publicKeyBytes;
|
|
423
|
-
var publicKey = _b.publicKey;
|
|
424
|
-
return __generator(this, function (_c) {
|
|
425
|
-
// Verify the provided JWK represents a valid OKP public key.
|
|
426
|
-
if (!(0, jwk_js_1.isOkpPublicJwk)(publicKey)) {
|
|
427
|
-
throw new Error("X25519: The provided key is not a valid OKP public key.");
|
|
428
|
-
}
|
|
429
|
-
publicKeyBytes = common_1.Convert.base64Url(publicKey.x).toUint8Array();
|
|
430
|
-
return [2 /*return*/, publicKeyBytes];
|
|
431
|
-
});
|
|
432
|
-
});
|
|
433
|
-
};
|
|
434
|
-
/**
|
|
435
|
-
* Computes an RFC6090-compliant Elliptic Curve Diffie-Hellman (ECDH) shared secret
|
|
436
|
-
* using secp256k1 private and public keys in JSON Web Key (JWK) format.
|
|
437
|
-
*
|
|
438
|
-
* @remarks
|
|
439
|
-
* This method facilitates the ECDH key agreement protocol, which is a method of securely
|
|
440
|
-
* deriving a shared secret between two parties based on their private and public keys.
|
|
441
|
-
* It takes the private key of one party (privateKeyA) and the public key of another
|
|
442
|
-
* party (publicKeyB) to compute a shared secret. The shared secret is derived from the
|
|
443
|
-
* x-coordinate of the elliptic curve point resulting from the multiplication of the
|
|
444
|
-
* public key with the private key.
|
|
445
|
-
*
|
|
446
|
-
* Note: When performing Elliptic Curve Diffie-Hellman (ECDH) key agreement,
|
|
447
|
-
* the resulting shared secret is a point on the elliptic curve, which
|
|
448
|
-
* consists of an x-coordinate and a y-coordinate. With a 256-bit curve like
|
|
449
|
-
* secp256k1, each of these coordinates is 32 bytes (256 bits) long. However,
|
|
450
|
-
* in the ECDH process, it's standard practice to use only the x-coordinate
|
|
451
|
-
* of the shared secret point as the resulting shared key. This is because
|
|
452
|
-
* the y-coordinate does not add to the entropy of the key, and both parties
|
|
453
|
-
* can independently compute the x-coordinate. Consquently, this implementation
|
|
454
|
-
* omits the y-coordinate for simplicity and standard compliance.
|
|
455
|
-
*
|
|
456
|
-
* @example
|
|
457
|
-
* ```ts
|
|
458
|
-
* const privateKeyA = { ... }; // A Jwk object for party A
|
|
459
|
-
* const publicKeyB = { ... }; // A PublicKeyJwk object for party B
|
|
460
|
-
* const sharedSecret = await Secp256k1.sharedSecret({
|
|
461
|
-
* privateKeyA,
|
|
462
|
-
* publicKeyB
|
|
463
|
-
* });
|
|
464
|
-
* ```
|
|
465
|
-
*
|
|
466
|
-
* @param params - The parameters for the shared secret computation.
|
|
467
|
-
* @param params.privateKeyA - The private key in JWK format of one party.
|
|
468
|
-
* @param params.publicKeyB - The public key in JWK format of the other party.
|
|
469
|
-
*
|
|
470
|
-
* @returns A Promise that resolves to the computed shared secret as a Uint8Array.
|
|
471
|
-
*/
|
|
472
|
-
X25519.sharedSecret = function (_a) {
|
|
473
|
-
return __awaiter(this, arguments, void 0, function (_b) {
|
|
474
|
-
var privateKeyABytes, publicKeyBBytes, sharedSecret;
|
|
475
|
-
var privateKeyA = _b.privateKeyA, publicKeyB = _b.publicKeyB;
|
|
476
|
-
return __generator(this, function (_c) {
|
|
477
|
-
switch (_c.label) {
|
|
478
|
-
case 0:
|
|
479
|
-
// Ensure that keys from the same key pair are not specified.
|
|
480
|
-
if ('x' in privateKeyA && 'x' in publicKeyB && privateKeyA.x === publicKeyB.x) {
|
|
481
|
-
throw new Error("X25519: ECDH shared secret cannot be computed from a single key pair's public and private keys.");
|
|
482
|
-
}
|
|
483
|
-
return [4 /*yield*/, X25519.privateKeyToBytes({ privateKey: privateKeyA })];
|
|
484
|
-
case 1:
|
|
485
|
-
privateKeyABytes = _c.sent();
|
|
486
|
-
return [4 /*yield*/, X25519.publicKeyToBytes({ publicKey: publicKeyB })];
|
|
487
|
-
case 2:
|
|
488
|
-
publicKeyBBytes = _c.sent();
|
|
489
|
-
sharedSecret = ed25519_1.x25519.getSharedSecret(privateKeyABytes, publicKeyBBytes);
|
|
490
|
-
return [2 /*return*/, sharedSecret];
|
|
491
|
-
}
|
|
492
|
-
});
|
|
493
|
-
});
|
|
494
|
-
};
|
|
495
|
-
return X25519;
|
|
496
|
-
}());
|
|
497
|
-
exports.X25519 = X25519;
|
|
498
|
-
//# sourceMappingURL=x25519.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"x25519.js","sourceRoot":"","sources":["../../../src/primitives/x25519.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;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