@enbox/crypto 0.0.2 → 0.0.4
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.mjs +6 -10
- package/dist/browser.mjs.map +4 -4
- package/dist/esm/algorithms/aes-ctr.js +1 -1
- package/dist/esm/algorithms/aes-gcm.js +35 -2
- package/dist/esm/algorithms/aes-gcm.js.map +1 -1
- package/dist/esm/algorithms/aes-kw.js +154 -0
- package/dist/esm/algorithms/aes-kw.js.map +1 -0
- package/dist/esm/algorithms/ecdsa.js +119 -6
- package/dist/esm/algorithms/ecdsa.js.map +1 -1
- package/dist/esm/algorithms/eddsa.js +99 -6
- package/dist/esm/algorithms/eddsa.js.map +1 -1
- package/dist/esm/algorithms/hkdf.js +53 -0
- package/dist/esm/algorithms/hkdf.js.map +1 -0
- package/dist/esm/algorithms/pbkdf2.js +55 -0
- package/dist/esm/algorithms/pbkdf2.js.map +1 -0
- package/dist/esm/algorithms/sha-2.js +2 -2
- package/dist/esm/algorithms/sha-2.js.map +1 -1
- package/dist/esm/algorithms/x25519.js +125 -0
- package/dist/esm/algorithms/x25519.js.map +1 -0
- package/dist/esm/crypto-error.js +41 -0
- package/dist/esm/crypto-error.js.map +1 -0
- package/dist/esm/index.js +8 -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 +9 -3
- 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/ecies-secp256k1.js +79 -0
- package/dist/esm/primitives/ecies-secp256k1.js.map +1 -0
- 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 +10 -17
- 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 +30 -0
- package/dist/esm/utils.js.map +1 -1
- package/dist/types/algorithms/aes-ctr.d.ts +2 -2
- package/dist/types/algorithms/aes-ctr.d.ts.map +1 -1
- package/dist/types/algorithms/aes-gcm.d.ts +25 -5
- package/dist/types/algorithms/aes-gcm.d.ts.map +1 -1
- package/dist/types/algorithms/aes-kw.d.ts +129 -0
- package/dist/types/algorithms/aes-kw.d.ts.map +1 -0
- package/dist/types/algorithms/ecdsa.d.ts +49 -4
- package/dist/types/algorithms/ecdsa.d.ts.map +1 -1
- package/dist/types/algorithms/eddsa.d.ts +49 -4
- package/dist/types/algorithms/eddsa.d.ts.map +1 -1
- package/dist/types/algorithms/hkdf.d.ts +35 -0
- package/dist/types/algorithms/hkdf.d.ts.map +1 -0
- package/dist/types/algorithms/pbkdf2.d.ts +35 -0
- package/dist/types/algorithms/pbkdf2.d.ts.map +1 -0
- package/dist/types/algorithms/sha-2.d.ts +2 -2
- package/dist/types/algorithms/sha-2.d.ts.map +1 -1
- package/dist/types/algorithms/x25519.d.ts +76 -0
- package/dist/types/algorithms/x25519.d.ts.map +1 -0
- 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 +8 -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 +6 -6
- 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/ecies-secp256k1.d.ts +53 -0
- package/dist/types/primitives/ecies-secp256k1.d.ts.map +1 -0
- 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/x25519.d.ts +9 -16
- package/dist/types/primitives/x25519.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 +54 -6
- package/dist/types/types/crypto-api.d.ts.map +1 -1
- package/dist/types/types/key-converter.d.ts +37 -15
- package/dist/types/types/key-converter.d.ts.map +1 -1
- package/dist/types/types/key-deriver.d.ts +41 -0
- package/dist/types/types/key-deriver.d.ts.map +1 -1
- package/dist/types/types/key-io.d.ts +37 -0
- package/dist/types/types/key-io.d.ts.map +1 -1
- package/dist/types/types/params-direct.d.ts +96 -1
- package/dist/types/types/params-direct.d.ts.map +1 -1
- package/dist/types/types/params-kms.d.ts +55 -0
- package/dist/types/types/params-kms.d.ts.map +1 -1
- package/dist/types/utils.d.ts +19 -0
- package/dist/types/utils.d.ts.map +1 -1
- package/dist/utils.js +1 -1
- package/dist/utils.js.map +4 -4
- package/package.json +29 -45
- package/src/algorithms/aes-ctr.ts +2 -2
- package/src/algorithms/aes-gcm.ts +41 -4
- package/src/algorithms/aes-kw.ts +182 -0
- package/src/algorithms/ecdsa.ts +145 -8
- package/src/algorithms/eddsa.ts +117 -10
- package/src/algorithms/hkdf.ts +54 -0
- package/src/algorithms/pbkdf2.ts +57 -0
- package/src/algorithms/sha-2.ts +3 -3
- package/src/algorithms/x25519.ts +153 -0
- package/src/crypto-error.ts +45 -0
- package/src/index.ts +8 -0
- package/src/jose/jwk.ts +32 -32
- package/src/local-key-manager.ts +22 -16
- 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/ecies-secp256k1.ts +113 -0
- 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 +12 -19
- 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 +129 -11
- package/src/types/key-converter.ts +33 -7
- package/src/types/key-deriver.ts +49 -0
- package/src/types/key-io.ts +40 -0
- package/src/types/params-direct.ts +118 -1
- package/src/types/params-kms.ts +67 -0
- package/src/utils.ts +55 -2
- package/dist/browser.js +0 -64
- package/dist/browser.js.map +0 -7
- 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
|
@@ -16,7 +16,7 @@ import { CryptoAlgorithm } from './crypto-algorithm.js';
|
|
|
16
16
|
* decryption features.
|
|
17
17
|
*
|
|
18
18
|
* This class is typically accessed through implementations that extend the
|
|
19
|
-
* {@link
|
|
19
|
+
* {@link DsaApi | `DsaApi`} interface.
|
|
20
20
|
*/
|
|
21
21
|
export class AesCtrAlgorithm extends CryptoAlgorithm {
|
|
22
22
|
/**
|
|
@@ -7,8 +7,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
-
import { CryptoAlgorithm } from './crypto-algorithm.js';
|
|
11
10
|
import { AesGcm } from '../primitives/aes-gcm.js';
|
|
11
|
+
import { CryptoAlgorithm } from './crypto-algorithm.js';
|
|
12
12
|
/**
|
|
13
13
|
* The `AesGcmAlgorithm` class provides a concrete implementation for cryptographic operations using
|
|
14
14
|
* the AES algorithm in Galois/Counter Mode (GCM). This class implements both
|
|
@@ -16,9 +16,27 @@ import { AesGcm } from '../primitives/aes-gcm.js';
|
|
|
16
16
|
* key generation, encryption, and decryption features.
|
|
17
17
|
*
|
|
18
18
|
* This class is typically accessed through implementations that extend the
|
|
19
|
-
* {@link
|
|
19
|
+
* {@link DsaApi | `DsaApi`} interface.
|
|
20
20
|
*/
|
|
21
21
|
export class AesGcmAlgorithm extends CryptoAlgorithm {
|
|
22
|
+
/**
|
|
23
|
+
* Converts a private key from a byte array to JWK format, setting the `alg` property based on
|
|
24
|
+
* the key length.
|
|
25
|
+
*
|
|
26
|
+
* @param params - The parameters for the private key conversion.
|
|
27
|
+
* @param params.privateKeyBytes - The raw private key as a Uint8Array.
|
|
28
|
+
*
|
|
29
|
+
* @returns A Promise that resolves to the private key in JWK format.
|
|
30
|
+
*/
|
|
31
|
+
bytesToPrivateKey(_a) {
|
|
32
|
+
return __awaiter(this, arguments, void 0, function* ({ privateKeyBytes }) {
|
|
33
|
+
// Convert the byte array to a JWK.
|
|
34
|
+
const privateKey = yield AesGcm.bytesToPrivateKey({ privateKeyBytes });
|
|
35
|
+
// Set the `alg` property based on the key length.
|
|
36
|
+
privateKey.alg = { 16: 'A128GCM', 24: 'A192GCM', 32: 'A256GCM' }[privateKeyBytes.length];
|
|
37
|
+
return privateKey;
|
|
38
|
+
});
|
|
39
|
+
}
|
|
22
40
|
/**
|
|
23
41
|
* Decrypts the provided data using AES-GCM.
|
|
24
42
|
*
|
|
@@ -128,5 +146,20 @@ export class AesGcmAlgorithm extends CryptoAlgorithm {
|
|
|
128
146
|
return privateKey;
|
|
129
147
|
});
|
|
130
148
|
}
|
|
149
|
+
/**
|
|
150
|
+
* Converts a private key from JWK format to a byte array.
|
|
151
|
+
*
|
|
152
|
+
* @param params - The parameters for the private key conversion.
|
|
153
|
+
* @param params.privateKey - The private key in JWK format.
|
|
154
|
+
*
|
|
155
|
+
* @returns A Promise that resolves to the private key as a Uint8Array.
|
|
156
|
+
*/
|
|
157
|
+
privateKeyToBytes(_a) {
|
|
158
|
+
return __awaiter(this, arguments, void 0, function* ({ privateKey }) {
|
|
159
|
+
// Convert the JWK to a byte array.
|
|
160
|
+
const privateKeyBytes = yield AesGcm.privateKeyToBytes({ privateKey });
|
|
161
|
+
return privateKeyBytes;
|
|
162
|
+
});
|
|
163
|
+
}
|
|
131
164
|
}
|
|
132
165
|
//# sourceMappingURL=aes-gcm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"aes-gcm.js","sourceRoot":"","sources":["../../../src/algorithms/aes-gcm.ts"],"names":[],"mappings":";;;;;;;;;
|
|
1
|
+
{"version":3,"file":"aes-gcm.js","sourceRoot":"","sources":["../../../src/algorithms/aes-gcm.ts"],"names":[],"mappings":";;;;;;;;;AAOA,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAmDxD;;;;;;;;GAQG;AACH,MAAM,OAAO,eAAgB,SAAQ,eAAe;IAKlD;;;;;;;;OAQG;IACU,iBAAiB;6DAAC,EAAE,eAAe,EAA2B;YACzE,mCAAmC;YACnC,MAAM,UAAU,GAAG,MAAM,MAAM,CAAC,iBAAiB,CAAC,EAAE,eAAe,EAAE,CAAC,CAAC;YAEvE,kDAAkD;YAClD,UAAU,CAAC,GAAG,GAAG,EAAE,EAAE,EAAE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) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { AesKw } from '../primitives/aes-kw.js';
|
|
11
|
+
import { CryptoAlgorithm } from './crypto-algorithm.js';
|
|
12
|
+
/**
|
|
13
|
+
* The `AesKwAlgorithm` class provides a concrete implementation for cryptographic operations using
|
|
14
|
+
* the AES algorithm for key wrapping. This class implements both
|
|
15
|
+
* {@link KeyGenerator | `KeyGenerator`} and {@link KeyWrapper | `KeyWrapper`} interfaces, providing
|
|
16
|
+
* key generation, key wrapping, and key unwrapping features.
|
|
17
|
+
*
|
|
18
|
+
* This class is typically accessed through implementations that extend the
|
|
19
|
+
* {@link DsaApi | `DsaApi`} interface.
|
|
20
|
+
*/
|
|
21
|
+
export class AesKwAlgorithm extends CryptoAlgorithm {
|
|
22
|
+
/**
|
|
23
|
+
* Converts a private key from a byte array to JWK format, setting the `alg` property based on
|
|
24
|
+
* the key length.
|
|
25
|
+
*
|
|
26
|
+
* @param params - The parameters for the private key conversion.
|
|
27
|
+
* @param params.privateKeyBytes - The raw private key as a Uint8Array.
|
|
28
|
+
*
|
|
29
|
+
* @returns A Promise that resolves to the private key in JWK format.
|
|
30
|
+
*/
|
|
31
|
+
bytesToPrivateKey(_a) {
|
|
32
|
+
return __awaiter(this, arguments, void 0, function* ({ privateKeyBytes }) {
|
|
33
|
+
// Convert the byte array to a JWK.
|
|
34
|
+
const privateKey = yield AesKw.bytesToPrivateKey({ privateKeyBytes });
|
|
35
|
+
// Set the `alg` property based on the key length.
|
|
36
|
+
privateKey.alg = { 16: 'A128KW', 24: 'A192KW', 32: 'A256KW' }[privateKeyBytes.length];
|
|
37
|
+
return privateKey;
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Generates a symmetric key for AES for key wrapping in JSON Web Key (JWK) format.
|
|
42
|
+
*
|
|
43
|
+
* @remarks
|
|
44
|
+
* This method generates a symmetric AES key for use in key wrapping mode, based on the specified
|
|
45
|
+
* `algorithm` parameter which determines the key length. It uses cryptographically secure random
|
|
46
|
+
* number generation to ensure the uniqueness and security of the key. The key is returned in JWK
|
|
47
|
+
* format.
|
|
48
|
+
*
|
|
49
|
+
* The generated key includes the following components:
|
|
50
|
+
* - `kty`: Key Type, set to 'oct' for Octet Sequence.
|
|
51
|
+
* - `k`: The symmetric key component, base64url-encoded.
|
|
52
|
+
* - `kid`: Key ID, generated based on the JWK thumbprint.
|
|
53
|
+
* - `alg`: Algorithm, set to 'A128KW', 'A192KW', or 'A256KW' for AES Key Wrap with the
|
|
54
|
+
* specified key length.
|
|
55
|
+
*
|
|
56
|
+
* @example
|
|
57
|
+
* ```ts
|
|
58
|
+
* const aesKw = new AesKwAlgorithm();
|
|
59
|
+
* const privateKey = await aesKw.generateKey({ algorithm: 'A256KW' });
|
|
60
|
+
* ```
|
|
61
|
+
*
|
|
62
|
+
* @param params - The parameters for the key generation.
|
|
63
|
+
*
|
|
64
|
+
* @returns A Promise that resolves to the generated symmetric key in JWK format.
|
|
65
|
+
*/
|
|
66
|
+
generateKey(_a) {
|
|
67
|
+
return __awaiter(this, arguments, void 0, function* ({ algorithm }) {
|
|
68
|
+
// Map algorithm name to key length.
|
|
69
|
+
const length = { A128KW: 128, A192KW: 192, A256KW: 256 }[algorithm];
|
|
70
|
+
// Generate a random private key.
|
|
71
|
+
const privateKey = yield AesKw.generateKey({ length });
|
|
72
|
+
// Set the `alg` property based on the specified algorithm.
|
|
73
|
+
privateKey.alg = algorithm;
|
|
74
|
+
return privateKey;
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Converts a private key from JWK format to a byte array.
|
|
79
|
+
*
|
|
80
|
+
* @param params - The parameters for the private key conversion.
|
|
81
|
+
* @param params.privateKey - The private key in JWK format.
|
|
82
|
+
*
|
|
83
|
+
* @returns A Promise that resolves to the private key as a Uint8Array.
|
|
84
|
+
*/
|
|
85
|
+
privateKeyToBytes(_a) {
|
|
86
|
+
return __awaiter(this, arguments, void 0, function* ({ privateKey }) {
|
|
87
|
+
// Convert the JWK to a byte array.
|
|
88
|
+
const privateKeyBytes = yield AesKw.privateKeyToBytes({ privateKey });
|
|
89
|
+
return privateKeyBytes;
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Decrypts a wrapped key using the AES Key Wrap algorithm.
|
|
94
|
+
*
|
|
95
|
+
* @remarks
|
|
96
|
+
* This method unwraps a previously wrapped cryptographic key using the AES Key Wrap algorithm.
|
|
97
|
+
* The wrapped key, provided as a byte array, is unwrapped using the decryption key specified in
|
|
98
|
+
* the parameters.
|
|
99
|
+
*
|
|
100
|
+
* This operation is useful for securely receiving keys transmitted over untrusted mediums. The
|
|
101
|
+
* method returns the unwrapped key as a JSON Web Key (JWK).
|
|
102
|
+
*
|
|
103
|
+
* @example
|
|
104
|
+
* ```ts
|
|
105
|
+
* const aesKw = new AesKwAlgorithm();
|
|
106
|
+
* const wrappedKeyBytes = new Uint8Array([...]); // Byte array of a wrapped AES-256 GCM key
|
|
107
|
+
* const decryptionKey = { ... }; // A Jwk object representing the AES unwrapping key
|
|
108
|
+
* const unwrappedKey = await aesKw.unwrapKey({
|
|
109
|
+
* wrappedKeyBytes,
|
|
110
|
+
* wrappedKeyAlgorithm: 'A256GCM',
|
|
111
|
+
* decryptionKey
|
|
112
|
+
* });
|
|
113
|
+
* ```
|
|
114
|
+
*
|
|
115
|
+
* @param params - The parameters for the key unwrapping operation.
|
|
116
|
+
*
|
|
117
|
+
* @returns A Promise that resolves to the unwrapped key in JWK format.
|
|
118
|
+
*/
|
|
119
|
+
unwrapKey(params) {
|
|
120
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
121
|
+
const unwrappedKey = yield AesKw.unwrapKey(params);
|
|
122
|
+
return unwrappedKey;
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Encrypts a given key using the AES Key Wrap algorithm.
|
|
127
|
+
*
|
|
128
|
+
* @remarks
|
|
129
|
+
* This method wraps a given cryptographic key using the AES Key Wrap algorithm. The private key
|
|
130
|
+
* to be wrapped is provided in the form of a JSON Web Key (JWK).
|
|
131
|
+
*
|
|
132
|
+
* This operation is useful for securely transmitting keys over untrusted mediums. The method
|
|
133
|
+
* returns the wrapped key as a byte array.
|
|
134
|
+
*
|
|
135
|
+
* @example
|
|
136
|
+
* ```ts
|
|
137
|
+
* const aesKw = new AesKwAlgorithm();
|
|
138
|
+
* const unwrappedKey = { ... }; // A Jwk object representing the key to be wrapped
|
|
139
|
+
* const encryptionKey = { ... }; // A Jwk object representing the AES wrapping key
|
|
140
|
+
* const wrappedKeyBytes = await aesKw.wrapKey({ unwrappedKey, encryptionKey });
|
|
141
|
+
* ```
|
|
142
|
+
*
|
|
143
|
+
* @param params - The parameters for the key wrapping operation.
|
|
144
|
+
*
|
|
145
|
+
* @returns A Promise that resolves to the wrapped key as a Uint8Array.
|
|
146
|
+
*/
|
|
147
|
+
wrapKey(params) {
|
|
148
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
149
|
+
const wrappedKeyBytes = AesKw.wrapKey(params);
|
|
150
|
+
return wrappedKeyBytes;
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
//# sourceMappingURL=aes-kw.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"aes-kw.js","sourceRoot":"","sources":["../../../src/algorithms/aes-kw.ts"],"names":[],"mappings":";;;;;;;;;AAOA,OAAO,EAAE,KAAK,EAA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SAAS,CAAC,MAAM,CAAC,CAAC;YAEnD,OAAO,YAAY,CAAC;QACtB,CAAC;KAAA;IAED;;;;;;;;;;;;;;;;;;;;;OAqBG;IACU,OAAO,CAAC,MACN;;YAEb,MAAM,eAAe,GAAG,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;YAE9C,OAAO,eAAe,CAAC;QACzB,CAAC;KAAA;CACF"}
|
|
@@ -7,9 +7,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
+
import { CryptoAlgorithm } from './crypto-algorithm.js';
|
|
10
11
|
import { Secp256k1 } from '../primitives/secp256k1.js';
|
|
11
12
|
import { Secp256r1 } from '../primitives/secp256r1.js';
|
|
12
|
-
import {
|
|
13
|
+
import { CryptoError, CryptoErrorCode } from '../crypto-error.js';
|
|
13
14
|
import { isEcPrivateJwk, isEcPublicJwk } from '../jose/jwk.js';
|
|
14
15
|
/**
|
|
15
16
|
* The `EcdsaAlgorithm` class provides a concrete implementation for cryptographic operations using
|
|
@@ -19,9 +20,71 @@ import { isEcPrivateJwk, isEcPublicJwk } from '../jose/jwk.js';
|
|
|
19
20
|
* of signatures.
|
|
20
21
|
*
|
|
21
22
|
* This class is typically accessed through implementations that extend the
|
|
22
|
-
* {@link
|
|
23
|
+
* {@link DsaApi | `DsaApi`} interface.
|
|
23
24
|
*/
|
|
24
25
|
export class EcdsaAlgorithm extends CryptoAlgorithm {
|
|
26
|
+
/**
|
|
27
|
+
* Converts a private key from a byte array to JWK format, setting the `alg` property based on
|
|
28
|
+
* the algorithm.
|
|
29
|
+
*
|
|
30
|
+
* @param params - The parameters for the private key conversion.
|
|
31
|
+
* @param params.algorithm - The ECDSA algorithm identifier.
|
|
32
|
+
* @param params.privateKeyBytes - The raw private key as a Uint8Array.
|
|
33
|
+
*
|
|
34
|
+
* @returns A Promise that resolves to the private key in JWK format.
|
|
35
|
+
*/
|
|
36
|
+
bytesToPrivateKey(_a) {
|
|
37
|
+
return __awaiter(this, arguments, void 0, function* ({ algorithm, privateKeyBytes }) {
|
|
38
|
+
switch (algorithm) {
|
|
39
|
+
case 'ES256K':
|
|
40
|
+
case 'secp256k1': {
|
|
41
|
+
const privateKey = yield Secp256k1.bytesToPrivateKey({ privateKeyBytes });
|
|
42
|
+
privateKey.alg = 'ES256K';
|
|
43
|
+
return privateKey;
|
|
44
|
+
}
|
|
45
|
+
case 'ES256':
|
|
46
|
+
case 'secp256r1': {
|
|
47
|
+
const privateKey = yield Secp256r1.bytesToPrivateKey({ privateKeyBytes });
|
|
48
|
+
privateKey.alg = 'ES256';
|
|
49
|
+
return privateKey;
|
|
50
|
+
}
|
|
51
|
+
default: {
|
|
52
|
+
throw new CryptoError(CryptoErrorCode.AlgorithmNotSupported, `Algorithm not supported: ${algorithm}`);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Converts a public key from a byte array to JWK format, setting the `alg` property based on
|
|
59
|
+
* the algorithm.
|
|
60
|
+
*
|
|
61
|
+
* @param params - The parameters for the public key conversion.
|
|
62
|
+
* @param params.algorithm - The ECDSA algorithm identifier.
|
|
63
|
+
* @param params.publicKeyBytes - The raw public key as a Uint8Array.
|
|
64
|
+
*
|
|
65
|
+
* @returns A Promise that resolves to the public key in JWK format.
|
|
66
|
+
*/
|
|
67
|
+
bytesToPublicKey(_a) {
|
|
68
|
+
return __awaiter(this, arguments, void 0, function* ({ algorithm, publicKeyBytes }) {
|
|
69
|
+
switch (algorithm) {
|
|
70
|
+
case 'ES256K':
|
|
71
|
+
case 'secp256k1': {
|
|
72
|
+
const publicKey = yield Secp256k1.bytesToPublicKey({ publicKeyBytes });
|
|
73
|
+
publicKey.alg = 'ES256K';
|
|
74
|
+
return publicKey;
|
|
75
|
+
}
|
|
76
|
+
case 'ES256':
|
|
77
|
+
case 'secp256r1': {
|
|
78
|
+
const publicKey = yield Secp256r1.bytesToPublicKey({ publicKeyBytes });
|
|
79
|
+
publicKey.alg = 'ES256';
|
|
80
|
+
return publicKey;
|
|
81
|
+
}
|
|
82
|
+
default: {
|
|
83
|
+
throw new CryptoError(CryptoErrorCode.AlgorithmNotSupported, `Algorithm not supported: ${algorithm}`);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
}
|
|
25
88
|
/**
|
|
26
89
|
* Derives the public key in JWK format from a given private key.
|
|
27
90
|
*
|
|
@@ -44,8 +107,9 @@ export class EcdsaAlgorithm extends CryptoAlgorithm {
|
|
|
44
107
|
*/
|
|
45
108
|
computePublicKey(_a) {
|
|
46
109
|
return __awaiter(this, arguments, void 0, function* ({ key }) {
|
|
47
|
-
if (!isEcPrivateJwk(key))
|
|
110
|
+
if (!isEcPrivateJwk(key)) {
|
|
48
111
|
throw new TypeError('Invalid key provided. Must be an elliptic curve (EC) private key.');
|
|
112
|
+
}
|
|
49
113
|
switch (key.crv) {
|
|
50
114
|
case 'secp256k1': {
|
|
51
115
|
const publicKey = yield Secp256k1.computePublicKey({ key });
|
|
@@ -123,8 +187,9 @@ export class EcdsaAlgorithm extends CryptoAlgorithm {
|
|
|
123
187
|
*/
|
|
124
188
|
getPublicKey(_a) {
|
|
125
189
|
return __awaiter(this, arguments, void 0, function* ({ key }) {
|
|
126
|
-
if (!isEcPrivateJwk(key))
|
|
190
|
+
if (!isEcPrivateJwk(key)) {
|
|
127
191
|
throw new TypeError('Invalid key provided. Must be an elliptic curve (EC) private key.');
|
|
192
|
+
}
|
|
128
193
|
switch (key.crv) {
|
|
129
194
|
case 'secp256k1': {
|
|
130
195
|
const publicKey = yield Secp256k1.getPublicKey({ key });
|
|
@@ -172,8 +237,9 @@ export class EcdsaAlgorithm extends CryptoAlgorithm {
|
|
|
172
237
|
*/
|
|
173
238
|
sign(_a) {
|
|
174
239
|
return __awaiter(this, arguments, void 0, function* ({ key, data }) {
|
|
175
|
-
if (!isEcPrivateJwk(key))
|
|
240
|
+
if (!isEcPrivateJwk(key)) {
|
|
176
241
|
throw new TypeError('Invalid key provided. Must be an elliptic curve (EC) private key.');
|
|
242
|
+
}
|
|
177
243
|
switch (key.crv) {
|
|
178
244
|
case 'secp256k1': {
|
|
179
245
|
return yield Secp256k1.sign({ key, data });
|
|
@@ -218,8 +284,9 @@ export class EcdsaAlgorithm extends CryptoAlgorithm {
|
|
|
218
284
|
*/
|
|
219
285
|
verify(_a) {
|
|
220
286
|
return __awaiter(this, arguments, void 0, function* ({ key, signature, data }) {
|
|
221
|
-
if (!isEcPublicJwk(key))
|
|
287
|
+
if (!isEcPublicJwk(key)) {
|
|
222
288
|
throw new TypeError('Invalid key provided. Must be an elliptic curve (EC) public key.');
|
|
289
|
+
}
|
|
223
290
|
switch (key.crv) {
|
|
224
291
|
case 'secp256k1': {
|
|
225
292
|
return yield Secp256k1.verify({ key, signature, data });
|
|
@@ -233,5 +300,51 @@ export class EcdsaAlgorithm extends CryptoAlgorithm {
|
|
|
233
300
|
}
|
|
234
301
|
});
|
|
235
302
|
}
|
|
303
|
+
/**
|
|
304
|
+
* Converts a private key from JWK format to a byte array.
|
|
305
|
+
*
|
|
306
|
+
* @param params - The parameters for the private key conversion.
|
|
307
|
+
* @param params.privateKey - The private key in JWK format.
|
|
308
|
+
*
|
|
309
|
+
* @returns A Promise that resolves to the private key as a Uint8Array.
|
|
310
|
+
*/
|
|
311
|
+
privateKeyToBytes(_a) {
|
|
312
|
+
return __awaiter(this, arguments, void 0, function* ({ privateKey }) {
|
|
313
|
+
switch (privateKey.crv) {
|
|
314
|
+
case 'secp256k1': {
|
|
315
|
+
return yield Secp256k1.privateKeyToBytes({ privateKey });
|
|
316
|
+
}
|
|
317
|
+
case 'P-256': {
|
|
318
|
+
return yield Secp256r1.privateKeyToBytes({ privateKey });
|
|
319
|
+
}
|
|
320
|
+
default: {
|
|
321
|
+
throw new CryptoError(CryptoErrorCode.AlgorithmNotSupported, `Curve not supported: ${privateKey.crv}`);
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
});
|
|
325
|
+
}
|
|
326
|
+
/**
|
|
327
|
+
* Converts a public key from JWK format to a byte array.
|
|
328
|
+
*
|
|
329
|
+
* @param params - The parameters for the public key conversion.
|
|
330
|
+
* @param params.publicKey - The public key in JWK format.
|
|
331
|
+
*
|
|
332
|
+
* @returns A Promise that resolves to the public key as a Uint8Array.
|
|
333
|
+
*/
|
|
334
|
+
publicKeyToBytes(_a) {
|
|
335
|
+
return __awaiter(this, arguments, void 0, function* ({ publicKey }) {
|
|
336
|
+
switch (publicKey.crv) {
|
|
337
|
+
case 'secp256k1': {
|
|
338
|
+
return yield Secp256k1.publicKeyToBytes({ publicKey });
|
|
339
|
+
}
|
|
340
|
+
case 'P-256': {
|
|
341
|
+
return yield Secp256r1.publicKeyToBytes({ publicKey });
|
|
342
|
+
}
|
|
343
|
+
default: {
|
|
344
|
+
throw new CryptoError(CryptoErrorCode.AlgorithmNotSupported, `Curve not supported: ${publicKey.crv}`);
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
});
|
|
348
|
+
}
|
|
236
349
|
}
|
|
237
350
|
//# sourceMappingURL=ecdsa.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ecdsa.js","sourceRoot":"","sources":["../../../src/algorithms/ecdsa.ts"],"names":[],"mappings":";;;;;;;;;
|
|
1
|
+
{"version":3,"file":"ecdsa.js","sourceRoot":"","sources":["../../../src/algorithms/ecdsa.ts"],"names":[],"mappings":";;;;;;;;;AAgBA,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAClE,OAAO,EAAE,cAAc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awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
-
import { Ed25519 } from '../primitives/ed25519.js';
|
|
11
10
|
import { CryptoAlgorithm } from './crypto-algorithm.js';
|
|
11
|
+
import { Ed25519 } from '../primitives/ed25519.js';
|
|
12
|
+
import { CryptoError, CryptoErrorCode } from '../crypto-error.js';
|
|
12
13
|
import { isOkpPrivateJwk, isOkpPublicJwk } from '../jose/jwk.js';
|
|
13
14
|
/**
|
|
14
15
|
* The `EdDsaAlgorithm` class provides a concrete implementation for cryptographic operations using
|
|
@@ -18,9 +19,57 @@ import { isOkpPrivateJwk, isOkpPublicJwk } from '../jose/jwk.js';
|
|
|
18
19
|
* of signatures.
|
|
19
20
|
*
|
|
20
21
|
* This class is typically accessed through implementations that extend the
|
|
21
|
-
* {@link
|
|
22
|
+
* {@link DsaApi | `DsaApi`} interface.
|
|
22
23
|
*/
|
|
23
24
|
export class EdDsaAlgorithm extends CryptoAlgorithm {
|
|
25
|
+
/**
|
|
26
|
+
* Converts a private key from a byte array to JWK format, setting the `alg` property to
|
|
27
|
+
* `'EdDSA'`.
|
|
28
|
+
*
|
|
29
|
+
* @param params - The parameters for the private key conversion.
|
|
30
|
+
* @param params.algorithm - The EdDSA algorithm identifier (`'Ed25519'`).
|
|
31
|
+
* @param params.privateKeyBytes - The raw private key as a Uint8Array.
|
|
32
|
+
*
|
|
33
|
+
* @returns A Promise that resolves to the private key in JWK format.
|
|
34
|
+
*/
|
|
35
|
+
bytesToPrivateKey(_a) {
|
|
36
|
+
return __awaiter(this, arguments, void 0, function* ({ algorithm, privateKeyBytes }) {
|
|
37
|
+
switch (algorithm) {
|
|
38
|
+
case 'Ed25519': {
|
|
39
|
+
const privateKey = yield Ed25519.bytesToPrivateKey({ privateKeyBytes });
|
|
40
|
+
privateKey.alg = 'EdDSA';
|
|
41
|
+
return privateKey;
|
|
42
|
+
}
|
|
43
|
+
default: {
|
|
44
|
+
throw new CryptoError(CryptoErrorCode.AlgorithmNotSupported, `Algorithm not supported: ${algorithm}`);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Converts a public key from a byte array to JWK format, setting the `alg` property to
|
|
51
|
+
* `'EdDSA'`.
|
|
52
|
+
*
|
|
53
|
+
* @param params - The parameters for the public key conversion.
|
|
54
|
+
* @param params.algorithm - The EdDSA algorithm identifier (`'Ed25519'`).
|
|
55
|
+
* @param params.publicKeyBytes - The raw public key as a Uint8Array.
|
|
56
|
+
*
|
|
57
|
+
* @returns A Promise that resolves to the public key in JWK format.
|
|
58
|
+
*/
|
|
59
|
+
bytesToPublicKey(_a) {
|
|
60
|
+
return __awaiter(this, arguments, void 0, function* ({ algorithm, publicKeyBytes }) {
|
|
61
|
+
switch (algorithm) {
|
|
62
|
+
case 'Ed25519': {
|
|
63
|
+
const publicKey = yield Ed25519.bytesToPublicKey({ publicKeyBytes });
|
|
64
|
+
publicKey.alg = 'EdDSA';
|
|
65
|
+
return publicKey;
|
|
66
|
+
}
|
|
67
|
+
default: {
|
|
68
|
+
throw new CryptoError(CryptoErrorCode.AlgorithmNotSupported, `Algorithm not supported: ${algorithm}`);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
}
|
|
24
73
|
/**
|
|
25
74
|
* Derives the public key in JWK format from a given private key.
|
|
26
75
|
*
|
|
@@ -43,8 +92,9 @@ export class EdDsaAlgorithm extends CryptoAlgorithm {
|
|
|
43
92
|
*/
|
|
44
93
|
computePublicKey(_a) {
|
|
45
94
|
return __awaiter(this, arguments, void 0, function* ({ key }) {
|
|
46
|
-
if (!isOkpPrivateJwk(key))
|
|
95
|
+
if (!isOkpPrivateJwk(key)) {
|
|
47
96
|
throw new TypeError('Invalid key provided. Must be an octet key pair (OKP) private key.');
|
|
97
|
+
}
|
|
48
98
|
switch (key.crv) {
|
|
49
99
|
case 'Ed25519': {
|
|
50
100
|
const publicKey = yield Ed25519.computePublicKey({ key });
|
|
@@ -110,8 +160,9 @@ export class EdDsaAlgorithm extends CryptoAlgorithm {
|
|
|
110
160
|
*/
|
|
111
161
|
getPublicKey(_a) {
|
|
112
162
|
return __awaiter(this, arguments, void 0, function* ({ key }) {
|
|
113
|
-
if (!isOkpPrivateJwk(key))
|
|
163
|
+
if (!isOkpPrivateJwk(key)) {
|
|
114
164
|
throw new TypeError('Invalid key provided. Must be an octet key pair (OKP) private key.');
|
|
165
|
+
}
|
|
115
166
|
switch (key.crv) {
|
|
116
167
|
case 'Ed25519': {
|
|
117
168
|
const publicKey = yield Ed25519.getPublicKey({ key });
|
|
@@ -154,8 +205,9 @@ export class EdDsaAlgorithm extends CryptoAlgorithm {
|
|
|
154
205
|
*/
|
|
155
206
|
sign(_a) {
|
|
156
207
|
return __awaiter(this, arguments, void 0, function* ({ key, data }) {
|
|
157
|
-
if (!isOkpPrivateJwk(key))
|
|
208
|
+
if (!isOkpPrivateJwk(key)) {
|
|
158
209
|
throw new TypeError('Invalid key provided. Must be an octet key pair (OKP) private key.');
|
|
210
|
+
}
|
|
159
211
|
switch (key.crv) {
|
|
160
212
|
case 'Ed25519': {
|
|
161
213
|
return yield Ed25519.sign({ key, data });
|
|
@@ -197,8 +249,9 @@ export class EdDsaAlgorithm extends CryptoAlgorithm {
|
|
|
197
249
|
*/
|
|
198
250
|
verify(_a) {
|
|
199
251
|
return __awaiter(this, arguments, void 0, function* ({ key, signature, data }) {
|
|
200
|
-
if (!isOkpPublicJwk(key))
|
|
252
|
+
if (!isOkpPublicJwk(key)) {
|
|
201
253
|
throw new TypeError('Invalid key provided. Must be an octet key pair (OKP) public key.');
|
|
254
|
+
}
|
|
202
255
|
switch (key.crv) {
|
|
203
256
|
case 'Ed25519': {
|
|
204
257
|
return yield Ed25519.verify({ key, signature, data });
|
|
@@ -209,5 +262,45 @@ export class EdDsaAlgorithm extends CryptoAlgorithm {
|
|
|
209
262
|
}
|
|
210
263
|
});
|
|
211
264
|
}
|
|
265
|
+
/**
|
|
266
|
+
* Converts a private key from JWK format to a byte array.
|
|
267
|
+
*
|
|
268
|
+
* @param params - The parameters for the private key conversion.
|
|
269
|
+
* @param params.privateKey - The private key in JWK format.
|
|
270
|
+
*
|
|
271
|
+
* @returns A Promise that resolves to the private key as a Uint8Array.
|
|
272
|
+
*/
|
|
273
|
+
privateKeyToBytes(_a) {
|
|
274
|
+
return __awaiter(this, arguments, void 0, function* ({ privateKey }) {
|
|
275
|
+
switch (privateKey.crv) {
|
|
276
|
+
case 'Ed25519': {
|
|
277
|
+
return yield Ed25519.privateKeyToBytes({ privateKey });
|
|
278
|
+
}
|
|
279
|
+
default: {
|
|
280
|
+
throw new CryptoError(CryptoErrorCode.AlgorithmNotSupported, `Curve not supported: ${privateKey.crv}`);
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
});
|
|
284
|
+
}
|
|
285
|
+
/**
|
|
286
|
+
* Converts a public key from JWK format to a byte array.
|
|
287
|
+
*
|
|
288
|
+
* @param params - The parameters for the public key conversion.
|
|
289
|
+
* @param params.publicKey - The public key in JWK format.
|
|
290
|
+
*
|
|
291
|
+
* @returns A Promise that resolves to the public key as a Uint8Array.
|
|
292
|
+
*/
|
|
293
|
+
publicKeyToBytes(_a) {
|
|
294
|
+
return __awaiter(this, arguments, void 0, function* ({ publicKey }) {
|
|
295
|
+
switch (publicKey.crv) {
|
|
296
|
+
case 'Ed25519': {
|
|
297
|
+
return yield Ed25519.publicKeyToBytes({ publicKey });
|
|
298
|
+
}
|
|
299
|
+
default: {
|
|
300
|
+
throw new CryptoError(CryptoErrorCode.AlgorithmNotSupported, `Curve not supported: ${publicKey.crv}`);
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
});
|
|
304
|
+
}
|
|
212
305
|
}
|
|
213
306
|
//# sourceMappingURL=eddsa.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"eddsa.js","sourceRoot":"","sources":["../../../src/algorithms/eddsa.ts"],"names":[],"mappings":";;;;;;;;;
|
|
1
|
+
{"version":3,"file":"eddsa.js","sourceRoot":"","sources":["../../../src/algorithms/eddsa.ts"],"names":[],"mappings":";;;;;;;;;AAgBA,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAClE,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAcjE;;;;;;;;;GASG;AACH,MAAM,OAAO,cAAe,SAAQ,eAAe;IAKjD;;;;;;;;;OASG;IACU,iBAAiB;6DAAC,EAAE,SAAS,EAAE,eAAe,EACP;YAElD,QAAQ,SAAS,EAAE,CAAC;gBAElB,KAAK,SAAS,CAAC,CAAC,CAAC;oBACf,MAAM,UAAU,GAAG,MAAM,OAAO,CAAC,iBAAiB,CAAC,EAAE,eAAe,EAAE,CAAC,CAAC;oBACxE,UAAU,CAAC,GAAG,GAAG,OAAO,CAAC;oBACzB,OAAO,UAAU,CAAC;gBACpB,CAAC;gBAED,OAAO,CAAC,CAAC,CAAC;oBACR,MAAM,IAAI,WAAW,CAAC,eAAe,CAAC,qBAAqB,EAAE,4BAA4B,SAAS,EAAE,CAAC,CAAC;gBACxG,CAAC;YACH,CAAC;QACH,CAAC;KAAA;IAED;;;;;;;;;OASG;IACU,gBAAgB;6DAAC,EAAE,SAAS,EAAE,cAAc,EACN;YAEjD,QAAQ,SAAS,EAAE,CAAC;gBAElB,KAAK,SAAS,CAAC,CAAC,CAAC;oBACf,MAAM,SAAS,GAAG,MAAM,OAAO,CAAC,gBAAgB,CAAC,EAAE,cAAc,EAAE,CAAC,CAAC;oBACrE,SAAS,CAAC,GAAG,GAAG,OAAO,CAAC;oBACxB,OAAO,SAAS,CAAC;gBACnB,CAAC;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