@fgv/ts-extras 5.1.0-41 → 5.1.0-43
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/dist/packlets/crypto-utils/index.browser.js +4 -1
- package/dist/packlets/crypto-utils/index.browser.js.map +1 -1
- package/dist/packlets/crypto-utils/index.js +3 -1
- package/dist/packlets/crypto-utils/index.js.map +1 -1
- package/dist/packlets/crypto-utils/keystore/converters.js +8 -4
- package/dist/packlets/crypto-utils/keystore/converters.js.map +1 -1
- package/dist/packlets/crypto-utils/keystore/keyStore.js +101 -2
- package/dist/packlets/crypto-utils/keystore/keyStore.js.map +1 -1
- package/dist/packlets/crypto-utils/keystore/model.js +9 -4
- package/dist/packlets/crypto-utils/keystore/model.js.map +1 -1
- package/dist/packlets/crypto-utils/model.js.map +1 -1
- package/dist/packlets/crypto-utils/nodeCryptoProvider.js +11 -0
- package/dist/packlets/crypto-utils/nodeCryptoProvider.js.map +1 -1
- package/dist/packlets/crypto-utils/seedDerivedKeyPair.js +120 -0
- package/dist/packlets/crypto-utils/seedDerivedKeyPair.js.map +1 -0
- package/dist/packlets/crypto-utils/spkiHelpers.js +44 -0
- package/dist/packlets/crypto-utils/spkiHelpers.js.map +1 -1
- package/dist/ts-extras.d.ts +270 -7
- package/lib/packlets/crypto-utils/index.browser.d.ts +2 -1
- package/lib/packlets/crypto-utils/index.browser.d.ts.map +1 -1
- package/lib/packlets/crypto-utils/index.browser.js +7 -1
- package/lib/packlets/crypto-utils/index.browser.js.map +1 -1
- package/lib/packlets/crypto-utils/index.d.ts +2 -1
- package/lib/packlets/crypto-utils/index.d.ts.map +1 -1
- package/lib/packlets/crypto-utils/index.js +6 -1
- package/lib/packlets/crypto-utils/index.js.map +1 -1
- package/lib/packlets/crypto-utils/keystore/converters.d.ts +1 -1
- package/lib/packlets/crypto-utils/keystore/converters.d.ts.map +1 -1
- package/lib/packlets/crypto-utils/keystore/converters.js +8 -4
- package/lib/packlets/crypto-utils/keystore/converters.js.map +1 -1
- package/lib/packlets/crypto-utils/keystore/keyStore.d.ts +45 -1
- package/lib/packlets/crypto-utils/keystore/keyStore.d.ts.map +1 -1
- package/lib/packlets/crypto-utils/keystore/keyStore.js +101 -2
- package/lib/packlets/crypto-utils/keystore/keyStore.js.map +1 -1
- package/lib/packlets/crypto-utils/keystore/model.d.ts +57 -3
- package/lib/packlets/crypto-utils/keystore/model.d.ts.map +1 -1
- package/lib/packlets/crypto-utils/keystore/model.js +9 -4
- package/lib/packlets/crypto-utils/keystore/model.js.map +1 -1
- package/lib/packlets/crypto-utils/model.d.ts +84 -3
- package/lib/packlets/crypto-utils/model.d.ts.map +1 -1
- package/lib/packlets/crypto-utils/model.js.map +1 -1
- package/lib/packlets/crypto-utils/nodeCryptoProvider.d.ts +9 -1
- package/lib/packlets/crypto-utils/nodeCryptoProvider.d.ts.map +1 -1
- package/lib/packlets/crypto-utils/nodeCryptoProvider.js +11 -0
- package/lib/packlets/crypto-utils/nodeCryptoProvider.js.map +1 -1
- package/lib/packlets/crypto-utils/seedDerivedKeyPair.d.ts +42 -0
- package/lib/packlets/crypto-utils/seedDerivedKeyPair.d.ts.map +1 -0
- package/lib/packlets/crypto-utils/seedDerivedKeyPair.js +123 -0
- package/lib/packlets/crypto-utils/seedDerivedKeyPair.js.map +1 -0
- package/lib/packlets/crypto-utils/spkiHelpers.d.ts +26 -0
- package/lib/packlets/crypto-utils/spkiHelpers.d.ts.map +1 -1
- package/lib/packlets/crypto-utils/spkiHelpers.js +46 -0
- package/lib/packlets/crypto-utils/spkiHelpers.js.map +1 -1
- package/package.json +7 -7
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { JsonValue } from '@fgv/ts-json-base';
|
|
1
2
|
import { EncryptionAlgorithm, ICryptoProvider, IArgon2idParams, IKeyDerivationParams, IPbkdf2KeyDerivationParams, KeyPairAlgorithm } from '../model';
|
|
2
3
|
import { IPrivateKeyStorage } from './privateKeyStorage';
|
|
3
4
|
export { allKeyPairAlgorithms, KeyPairAlgorithm } from '../model';
|
|
@@ -9,16 +10,21 @@ export { allKeyPairAlgorithms, KeyPairAlgorithm } from '../model';
|
|
|
9
10
|
* asymmetric-keypair entries. A strict superset of v1 — the field is
|
|
10
11
|
* optional, so a v2 reader opens a v1 vault with no special-casing, and a
|
|
11
12
|
* v1 vault opened and re-saved is silently upgraded to v2.
|
|
13
|
+
* - `'keystore-v3'`: adds the `'opaque'` symmetric secret type and the optional
|
|
14
|
+
* `metadata` / `updatedAt` fields on symmetric entries. A strict superset of
|
|
15
|
+
* v1/v2 — the additions are optional (and `'opaque'` is simply a new enum
|
|
16
|
+
* value), so a v3 reader opens a v1/v2 vault with no special-casing, and a
|
|
17
|
+
* v1/v2 vault opened and re-saved is silently upgraded to v3.
|
|
12
18
|
* @public
|
|
13
19
|
*/
|
|
14
|
-
export type KeyStoreFormat = 'keystore-v1' | 'keystore-v2';
|
|
20
|
+
export type KeyStoreFormat = 'keystore-v1' | 'keystore-v2' | 'keystore-v3';
|
|
15
21
|
/**
|
|
16
22
|
* All recognized key store format versions (readable by the current library).
|
|
17
23
|
* @public
|
|
18
24
|
*/
|
|
19
25
|
export declare const allKeyStoreFormats: ReadonlyArray<KeyStoreFormat>;
|
|
20
26
|
/**
|
|
21
|
-
* Current format version constant. New vaults are written as `'keystore-
|
|
27
|
+
* Current format version constant. New vaults are written as `'keystore-v3'`.
|
|
22
28
|
* @public
|
|
23
29
|
*/
|
|
24
30
|
export declare const KEYSTORE_FORMAT: KeyStoreFormat;
|
|
@@ -37,9 +43,13 @@ export declare const MIN_SALT_LENGTH: number;
|
|
|
37
43
|
* Discriminator for symmetric secret types stored in the vault.
|
|
38
44
|
* - `'encryption-key'`: A 32-byte AES-256 encryption key.
|
|
39
45
|
* - `'api-key'`: An arbitrary-length API key string (UTF-8 encoded).
|
|
46
|
+
* - `'opaque'`: Arbitrary raw bytes with no encoding contract — stored and
|
|
47
|
+
* returned verbatim (never UTF-8 decoded). Use for byte blobs that are
|
|
48
|
+
* neither a fixed-size AES key nor a UTF-8 string (e.g. a serialized
|
|
49
|
+
* credential bundle), so they are not mistyped as `'api-key'`.
|
|
40
50
|
* @public
|
|
41
51
|
*/
|
|
42
|
-
export type KeyStoreSymmetricSecretType = 'encryption-key' | 'api-key';
|
|
52
|
+
export type KeyStoreSymmetricSecretType = 'encryption-key' | 'api-key' | 'opaque';
|
|
43
53
|
/**
|
|
44
54
|
* All valid symmetric secret types.
|
|
45
55
|
* @public
|
|
@@ -87,16 +97,36 @@ export interface IKeyStoreSymmetricEntry {
|
|
|
87
97
|
* The secret data.
|
|
88
98
|
* - For `'encryption-key'`: 32-byte AES-256 key.
|
|
89
99
|
* - For `'api-key'`: UTF-8 encoded API key string (arbitrary length).
|
|
100
|
+
* - For `'opaque'`: arbitrary raw bytes, stored and returned verbatim.
|
|
90
101
|
*/
|
|
91
102
|
readonly key: Uint8Array;
|
|
92
103
|
/**
|
|
93
104
|
* Optional description for this secret.
|
|
94
105
|
*/
|
|
95
106
|
readonly description?: string;
|
|
107
|
+
/**
|
|
108
|
+
* Optional mutable, non-secret-by-contract metadata for this entry. Set via
|
|
109
|
+
* {@link CryptoUtils.KeyStore.KeyStore.setSecretMetadata} without touching the
|
|
110
|
+
* secret `key` bytes.
|
|
111
|
+
*
|
|
112
|
+
* "Non-secret by contract" means the field is intended for lifecycle metadata
|
|
113
|
+
* (rotation timestamps, labels, provenance) rather than secret material.
|
|
114
|
+
* PHYSICALLY it lives inside the vault's AES-GCM ciphertext alongside the key
|
|
115
|
+
* bytes — the vault has no plaintext index — so it is protected at rest by the
|
|
116
|
+
* master password; the "non-secret" designation is a usage contract, not a
|
|
117
|
+
* weaker custody class.
|
|
118
|
+
*/
|
|
119
|
+
readonly metadata?: JsonValue;
|
|
96
120
|
/**
|
|
97
121
|
* When this secret was added (ISO 8601).
|
|
98
122
|
*/
|
|
99
123
|
readonly createdAt: string;
|
|
124
|
+
/**
|
|
125
|
+
* When this entry was last mutated (ISO 8601). Stamped on any metadata
|
|
126
|
+
* mutation (see {@link CryptoUtils.KeyStore.KeyStore.setSecretMetadata}).
|
|
127
|
+
* Absent on entries that have never been mutated since creation.
|
|
128
|
+
*/
|
|
129
|
+
readonly updatedAt?: string;
|
|
100
130
|
}
|
|
101
131
|
/**
|
|
102
132
|
* An asymmetric keypair entry stored in the vault (in-memory representation).
|
|
@@ -199,10 +229,22 @@ export interface IKeyStoreSymmetricEntryJson {
|
|
|
199
229
|
* Optional description.
|
|
200
230
|
*/
|
|
201
231
|
readonly description?: string;
|
|
232
|
+
/**
|
|
233
|
+
* Optional mutable, non-secret-by-contract metadata for this entry. Present
|
|
234
|
+
* only on `'keystore-v3'` vaults whose entry carried metadata; a v1/v2 vault
|
|
235
|
+
* omits the field. Physically carried inside the vault ciphertext (the vault
|
|
236
|
+
* has no plaintext index).
|
|
237
|
+
*/
|
|
238
|
+
readonly metadata?: JsonValue;
|
|
202
239
|
/**
|
|
203
240
|
* When this secret was added (ISO 8601).
|
|
204
241
|
*/
|
|
205
242
|
readonly createdAt: string;
|
|
243
|
+
/**
|
|
244
|
+
* When this entry was last mutated (ISO 8601). Present only on `'keystore-v3'`
|
|
245
|
+
* vaults whose entry has been mutated since creation.
|
|
246
|
+
*/
|
|
247
|
+
readonly updatedAt?: string;
|
|
206
248
|
}
|
|
207
249
|
/**
|
|
208
250
|
* JSON-serializable representation of an asymmetric keypair entry.
|
|
@@ -403,6 +445,18 @@ export interface IImportKeyOptions extends IImportSecretOptions {
|
|
|
403
445
|
*/
|
|
404
446
|
readonly type?: KeyStoreSymmetricSecretType;
|
|
405
447
|
}
|
|
448
|
+
/**
|
|
449
|
+
* Options for importing raw opaque bytes via {@link KeyStore.importSecretBytes}.
|
|
450
|
+
* Extends {@link IImportSecretOptions} with optional initial metadata.
|
|
451
|
+
* @public
|
|
452
|
+
*/
|
|
453
|
+
export interface IImportSecretBytesOptions extends IImportSecretOptions {
|
|
454
|
+
/**
|
|
455
|
+
* Optional initial mutable metadata to store with the entry. Can also be set
|
|
456
|
+
* or replaced later via {@link KeyStore.setSecretMetadata}.
|
|
457
|
+
*/
|
|
458
|
+
readonly metadata?: JsonValue;
|
|
459
|
+
}
|
|
406
460
|
/**
|
|
407
461
|
* Options for adding a secret derived from a password.
|
|
408
462
|
* @public
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../../../src/packlets/crypto-utils/keystore/model.ts"],"names":[],"mappings":"AAoBA,OAAO,EACL,mBAAmB,EACnB,eAAe,EACf,eAAe,EACf,oBAAoB,EACpB,0BAA0B,EAC1B,gBAAgB,EACjB,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAIzD,OAAO,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAMlE
|
|
1
|
+
{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../../../src/packlets/crypto-utils/keystore/model.ts"],"names":[],"mappings":"AAoBA,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EACL,mBAAmB,EACnB,eAAe,EACf,eAAe,EACf,oBAAoB,EACpB,0BAA0B,EAC1B,gBAAgB,EACjB,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAIzD,OAAO,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAMlE;;;;;;;;;;;;;;GAcG;AACH,MAAM,MAAM,cAAc,GAAG,aAAa,GAAG,aAAa,GAAG,aAAa,CAAC;AAE3E;;;GAGG;AACH,eAAO,MAAM,kBAAkB,EAAE,aAAa,CAAC,cAAc,CAI5D,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,eAAe,EAAE,cAA8B,CAAC;AAE7D;;;;GAIG;AACH,eAAO,MAAM,2BAA2B,EAAE,MAAe,CAAC;AAE1D;;;GAGG;AACH,eAA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AAI,EAAE,OAAO,GAAG,OAAO,CAMrD"}
|
|
@@ -29,12 +29,16 @@ Object.defineProperty(exports, "allKeyPairAlgorithms", { enumerable: true, get:
|
|
|
29
29
|
* All recognized key store format versions (readable by the current library).
|
|
30
30
|
* @public
|
|
31
31
|
*/
|
|
32
|
-
exports.allKeyStoreFormats = [
|
|
32
|
+
exports.allKeyStoreFormats = [
|
|
33
|
+
'keystore-v1',
|
|
34
|
+
'keystore-v2',
|
|
35
|
+
'keystore-v3'
|
|
36
|
+
];
|
|
33
37
|
/**
|
|
34
|
-
* Current format version constant. New vaults are written as `'keystore-
|
|
38
|
+
* Current format version constant. New vaults are written as `'keystore-v3'`.
|
|
35
39
|
* @public
|
|
36
40
|
*/
|
|
37
|
-
exports.KEYSTORE_FORMAT = 'keystore-
|
|
41
|
+
exports.KEYSTORE_FORMAT = 'keystore-v3';
|
|
38
42
|
/**
|
|
39
43
|
* Default PBKDF2 iterations for key store encryption.
|
|
40
44
|
* Higher than regular files since this protects the master key vault.
|
|
@@ -52,7 +56,8 @@ exports.MIN_SALT_LENGTH = 16;
|
|
|
52
56
|
*/
|
|
53
57
|
exports.allKeyStoreSymmetricSecretTypes = [
|
|
54
58
|
'encryption-key',
|
|
55
|
-
'api-key'
|
|
59
|
+
'api-key',
|
|
60
|
+
'opaque'
|
|
56
61
|
];
|
|
57
62
|
/**
|
|
58
63
|
* All valid asymmetric secret types.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model.js","sourceRoot":"","sources":["../../../../src/packlets/crypto-utils/keystore/model.ts"],"names":[],"mappings":";AAAA,kCAAkC;AAClC,EAAE;AACF,+EAA+E;AAC/E,gFAAgF;AAChF,+EAA+E;AAC/E,4EAA4E;AAC5E,wEAAwE;AACxE,2DAA2D;AAC3D,EAAE;AACF,iFAAiF;AACjF,kDAAkD;AAClD,EAAE;AACF,6EAA6E;AAC7E,2EAA2E;AAC3E,8EAA8E;AAC9E,yEAAyE;AACzE,gFAAgF;AAChF,gFAAgF;AAChF,YAAY;;;AAmrBZ,wCAMC;AA7qBD,2EAA2E;AAC3E,2EAA2E;AAC3E,kCAAkE;AAAzD,6GAAA,oBAAoB,OAAA;AAkB7B;;;GAGG;AACU,QAAA,kBAAkB,GAAkC,CAAC,aAAa,EAAE,aAAa,CAAC,CAAC;AAEhG;;;GAGG;AACU,QAAA,eAAe,GAAmB,aAAa,CAAC;AAE7D;;;;GAIG;AACU,QAAA,2BAA2B,GAAW,MAAM,CAAC;AAE1D;;;GAGG;AACU,QAAA,eAAe,GAAW,EAAE,CAAC;AAc1C;;;GAGG;AACU,QAAA,+BAA+B,GAA+C;IACzF,gBAAgB;IAChB,SAAS;CACV,CAAC;AAWF;;;GAGG;AACU,QAAA,gCAAgC,GAAgD;IAC3F,oBAAoB;CACrB,CAAC;AAQF;;;GAGG;AACU,QAAA,sBAAsB,GAAsC;IACvE,GAAG,wCAAgC;IACnC,GAAG,uCAA+B;CACnC,CAAC;AA6ZF;;;;GAIG;AACU,QAAA,yBAAyB,GAAW,MAAM,CAAC;AA0JxD,+EAA+E;AAC/E,mBAAmB;AACnB,+EAA+E;AAE/E;;;;;;GAMG;AACH,SAAgB,cAAc,CAAC,IAAa;IAC1C,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,KAAK,IAAI,EAAE,CAAC;QAC9C,OAAO,KAAK,CAAC;IACf,CAAC;IACD,MAAM,GAAG,GAAG,IAA+B,CAAC;IAC5C,OAAO,OAAO,GAAG,CAAC,MAAM,KAAK,QAAQ,IAAK,0BAA4C,CAAC,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;AAC9G,CAAC","sourcesContent":["// Copyright (c) 2026 Erik Fortune\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in all\n// copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n// SOFTWARE.\n\nimport {\n EncryptionAlgorithm,\n ICryptoProvider,\n IArgon2idParams,\n IKeyDerivationParams,\n IPbkdf2KeyDerivationParams,\n KeyPairAlgorithm\n} from '../model';\nimport { IPrivateKeyStorage } from './privateKeyStorage';\n\n// Re-export so consumers can continue to access the algorithm enum via the\n// CryptoUtils.KeyStore namespace alongside the rest of the keystore types.\nexport { allKeyPairAlgorithms, KeyPairAlgorithm } from '../model';\n\n// ============================================================================\n// Key Store Format Types\n// ============================================================================\n\n/**\n * Format version for key store files.\n *\n * - `'keystore-v1'`: the original format (no private-key escrow).\n * - `'keystore-v2'`: adds the optional `escrowedPrivateKeyJwk` field on\n * asymmetric-keypair entries. A strict superset of v1 — the field is\n * optional, so a v2 reader opens a v1 vault with no special-casing, and a\n * v1 vault opened and re-saved is silently upgraded to v2.\n * @public\n */\nexport type KeyStoreFormat = 'keystore-v1' | 'keystore-v2';\n\n/**\n * All recognized key store format versions (readable by the current library).\n * @public\n */\nexport const allKeyStoreFormats: ReadonlyArray<KeyStoreFormat> = ['keystore-v1', 'keystore-v2'];\n\n/**\n * Current format version constant. New vaults are written as `'keystore-v2'`.\n * @public\n */\nexport const KEYSTORE_FORMAT: KeyStoreFormat = 'keystore-v2';\n\n/**\n * Default PBKDF2 iterations for key store encryption.\n * Higher than regular files since this protects the master key vault.\n * @public\n */\nexport const DEFAULT_KEYSTORE_ITERATIONS: number = 600000;\n\n/**\n * Minimum salt length for key derivation.\n * @public\n */\nexport const MIN_SALT_LENGTH: number = 16;\n\n// ============================================================================\n// Key Store Vault Contents (Decrypted State)\n// ============================================================================\n\n/**\n * Discriminator for symmetric secret types stored in the vault.\n * - `'encryption-key'`: A 32-byte AES-256 encryption key.\n * - `'api-key'`: An arbitrary-length API key string (UTF-8 encoded).\n * @public\n */\nexport type KeyStoreSymmetricSecretType = 'encryption-key' | 'api-key';\n\n/**\n * All valid symmetric secret types.\n * @public\n */\nexport const allKeyStoreSymmetricSecretTypes: ReadonlyArray<KeyStoreSymmetricSecretType> = [\n 'encryption-key',\n 'api-key'\n];\n\n/**\n * Discriminator for asymmetric secret types stored in the vault.\n * - `'asymmetric-keypair'`: A public/private key pair. The public key is held in\n * the vault as a JWK; the private key lives in the supplied\n * {@link CryptoUtils.KeyStore.IPrivateKeyStorage} provider.\n * @public\n */\nexport type KeyStoreAsymmetricSecretType = 'asymmetric-keypair';\n\n/**\n * All valid asymmetric secret types.\n * @public\n */\nexport const allKeyStoreAsymmetricSecretTypes: ReadonlyArray<KeyStoreAsymmetricSecretType> = [\n 'asymmetric-keypair'\n];\n\n/**\n * Discriminator for any secret type stored in the vault.\n * @public\n */\nexport type KeyStoreSecretType = KeyStoreSymmetricSecretType | KeyStoreAsymmetricSecretType;\n\n/**\n * All valid key store secret types.\n * @public\n */\nexport const allKeyStoreSecretTypes: ReadonlyArray<KeyStoreSecretType> = [\n ...allKeyStoreAsymmetricSecretTypes,\n ...allKeyStoreSymmetricSecretTypes\n];\n\n/**\n * A symmetric secret entry stored in the vault (in-memory representation).\n * Holds the raw key material directly — for `'encryption-key'` it is a 32-byte\n * AES-256 key; for `'api-key'` it is the UTF-8 encoded API key string.\n * @public\n */\nexport interface IKeyStoreSymmetricEntry {\n /**\n * Unique name for this secret (used as lookup key).\n */\n readonly name: string;\n\n /**\n * Symmetric secret type discriminator.\n */\n readonly type: KeyStoreSymmetricSecretType;\n\n /**\n * The secret data.\n * - For `'encryption-key'`: 32-byte AES-256 key.\n * - For `'api-key'`: UTF-8 encoded API key string (arbitrary length).\n */\n readonly key: Uint8Array;\n\n /**\n * Optional description for this secret.\n */\n readonly description?: string;\n\n /**\n * When this secret was added (ISO 8601).\n */\n readonly createdAt: string;\n}\n\n/**\n * An asymmetric keypair entry stored in the vault (in-memory representation).\n * Holds only the public key (as a JWK) and a stable handle (`id`) the\n * {@link CryptoUtils.KeyStore.IPrivateKeyStorage} provider uses to fetch the private key.\n * @public\n */\nexport interface IKeyStoreAsymmetricEntry {\n /**\n * Unique name for this entry (used as vault lookup key, renameable).\n */\n readonly name: string;\n\n /**\n * Asymmetric secret type discriminator.\n */\n readonly type: KeyStoreAsymmetricSecretType;\n\n /**\n * Immutable handle used by {@link CryptoUtils.KeyStore.IPrivateKeyStorage} to address the\n * private key. Independent of `name`; survives renames.\n */\n readonly id: string;\n\n /**\n * Algorithm used to generate this keypair.\n */\n readonly algorithm: KeyPairAlgorithm;\n\n /**\n * The public key as a JSON Web Key.\n */\n readonly publicKeyJwk: JsonWebKey;\n\n /**\n * Optional escrowed copy of the private key, as a JSON Web Key. Present only\n * when the entry was created with `addKeyPair(name, { escrow: true })`.\n *\n * This is an opt-in cross-device recovery affordance: the private key is\n * carried inside the vault's AES-GCM ciphertext (same custody class as\n * `publicKeyJwk`), so a recovered vault plus the master password can\n * reconstitute the signing/decryption identity on a fresh device via\n * `getKeyPair(name, { rehydrate: true })`.\n *\n * SECURITY: when present, the master password becomes the sole gate\n * protecting this private key. Use a strong KDF for escrow-bearing stores.\n * See the {@link CryptoUtils.KeyStore.KeyStore} class docs.\n */\n readonly escrowedPrivateKeyJwk?: JsonWebKey;\n\n /**\n * Optional description for this entry.\n */\n readonly description?: string;\n\n /**\n * When this entry was added (ISO 8601).\n */\n readonly createdAt: string;\n}\n\n/**\n * Any vault entry, discriminated by `type`.\n * @public\n */\nexport type IKeyStoreEntry = IKeyStoreSymmetricEntry | IKeyStoreAsymmetricEntry;\n\n/**\n * Backwards-compatible alias for {@link CryptoUtils.KeyStore.IKeyStoreSymmetricEntry}.\n * @deprecated Use {@link CryptoUtils.KeyStore.IKeyStoreSymmetricEntry} for symmetric\n * entries or {@link CryptoUtils.KeyStore.IKeyStoreEntry} for the discriminated union.\n * @public\n */\nexport type IKeyStoreSecretEntry = IKeyStoreSymmetricEntry;\n\n/**\n * JSON-serializable representation of a symmetric secret entry.\n *\n * @remarks\n * Describes the *normalized* shape after parsing. `type` is required here\n * because the converter (see\n * {@link CryptoUtils.KeyStore.Converters.keystoreSymmetricEntryJson | keystoreSymmetricEntryJson})\n * injects the default `'encryption-key'` when reading vaults written before\n * asymmetric-keypair support added the discriminator. Raw on-wire bytes from\n * a legacy vault may therefore omit `type`; downstream code only ever sees\n * the post-conversion shape declared here.\n *\n * @public\n */\nexport interface IKeyStoreSymmetricEntryJson {\n /**\n * Unique name for this secret.\n */\n readonly name: string;\n\n /**\n * Symmetric secret type discriminator.\n *\n * Required on this normalized model type. Vaults written prior to the\n * asymmetric-keypair support may omit this field on the wire; the\n * converter injects `'encryption-key'` when missing for backwards\n * compatibility, so by the time a value of this type is observed the\n * discriminator is always present.\n */\n readonly type: KeyStoreSymmetricSecretType;\n\n /**\n * Base64-encoded secret data.\n */\n readonly key: string;\n\n /**\n * Optional description.\n */\n readonly description?: string;\n\n /**\n * When this secret was added (ISO 8601).\n */\n readonly createdAt: string;\n}\n\n/**\n * JSON-serializable representation of an asymmetric keypair entry.\n * The private key is not present here — it lives in the\n * {@link CryptoUtils.KeyStore.IPrivateKeyStorage} provider, addressed by `id`.\n * @public\n */\nexport interface IKeyStoreAsymmetricEntryJson {\n /**\n * Unique name for this entry.\n */\n readonly name: string;\n\n /**\n * Asymmetric secret type discriminator.\n */\n readonly type: KeyStoreAsymmetricSecretType;\n\n /**\n * Immutable handle used by {@link CryptoUtils.KeyStore.IPrivateKeyStorage} to address the\n * private key.\n */\n readonly id: string;\n\n /**\n * Algorithm used to generate this keypair.\n */\n readonly algorithm: KeyPairAlgorithm;\n\n /**\n * The public key as a JSON Web Key.\n */\n readonly publicKeyJwk: JsonWebKey;\n\n /**\n * Optional escrowed copy of the private key, as a JSON Web Key. Present only\n * on `'keystore-v2'` vaults whose entry was created with escrow enabled. A\n * v1 vault omits the field; a v2 reader treats its absence as \"no escrow\".\n */\n readonly escrowedPrivateKeyJwk?: JsonWebKey;\n\n /**\n * Optional description.\n */\n readonly description?: string;\n\n /**\n * When this entry was added (ISO 8601).\n */\n readonly createdAt: string;\n}\n\n/**\n * Any JSON vault entry, discriminated by `type`.\n * @public\n */\nexport type IKeyStoreEntryJson = IKeyStoreSymmetricEntryJson | IKeyStoreAsymmetricEntryJson;\n\n/**\n * Backwards-compatible alias for {@link CryptoUtils.KeyStore.IKeyStoreSymmetricEntryJson}.\n * @deprecated Use {@link CryptoUtils.KeyStore.IKeyStoreSymmetricEntryJson} for\n * symmetric entries or {@link CryptoUtils.KeyStore.IKeyStoreEntryJson} for the\n * discriminated union.\n * @public\n */\nexport type IKeyStoreSecretEntryJson = IKeyStoreSymmetricEntryJson;\n\n/**\n * The decrypted vault contents - a versioned map of entries.\n * @public\n */\nexport interface IKeyStoreVaultContents {\n /**\n * Format version for vault contents.\n */\n readonly version: KeyStoreFormat;\n\n /**\n * Map of entry name to entry (symmetric or asymmetric).\n */\n readonly secrets: Record<string, IKeyStoreEntryJson>;\n}\n\n// ============================================================================\n// Key Store File Format (Encrypted State)\n// ============================================================================\n\n/**\n * The encrypted key store file format.\n * @public\n */\nexport interface IKeyStoreFile {\n /**\n * Format identifier.\n */\n readonly format: KeyStoreFormat;\n\n /**\n * Algorithm used for encryption.\n */\n readonly algorithm: EncryptionAlgorithm;\n\n /**\n * Base64-encoded initialization vector.\n */\n readonly iv: string;\n\n /**\n * Base64-encoded authentication tag.\n */\n readonly authTag: string;\n\n /**\n * Base64-encoded encrypted vault contents.\n */\n readonly encryptedData: string;\n\n /**\n * Key derivation parameters for the vault master key (always PBKDF2).\n */\n readonly keyDerivation: IPbkdf2KeyDerivationParams;\n}\n\n// ============================================================================\n// Key Store State and Configuration\n// ============================================================================\n\n/**\n * Key store lock state.\n * @public\n */\nexport type KeyStoreLockState = 'locked' | 'unlocked';\n\n/**\n * Parameters for creating a new key store.\n * @public\n */\nexport interface IKeyStoreCreateParams {\n /**\n * Crypto provider to use.\n */\n readonly cryptoProvider: ICryptoProvider;\n\n /**\n * PBKDF2 iterations (defaults to DEFAULT_KEYSTORE_ITERATIONS).\n */\n readonly iterations?: number;\n\n /**\n * Optional private-key storage backend. Required to use `addKeyPair` /\n * `getKeyPair`; absent backends still permit opening, listing, and reading\n * public-key metadata for asymmetric entries.\n */\n readonly privateKeyStorage?: IPrivateKeyStorage;\n}\n\n/**\n * Parameters for opening an existing key store.\n * @public\n */\nexport interface IKeyStoreOpenParams {\n /**\n * Crypto provider to use.\n */\n readonly cryptoProvider: ICryptoProvider;\n\n /**\n * The encrypted key store file content.\n */\n readonly keystoreFile: IKeyStoreFile;\n\n /**\n * Optional private-key storage backend. Required to use `addKeyPair` /\n * `getKeyPair`; absent backends still permit opening, listing, and reading\n * public-key metadata for asymmetric entries.\n */\n readonly privateKeyStorage?: IPrivateKeyStorage;\n}\n\n/**\n * Result of adding a secret to the key store.\n * @public\n */\nexport interface IAddSecretResult {\n /**\n * The secret entry that was added.\n */\n readonly entry: IKeyStoreSymmetricEntry;\n\n /**\n * Whether this replaced an existing secret.\n */\n readonly replaced: boolean;\n\n /**\n * Best-effort warning from displaced-resource cleanup. Set when this call\n * replaced an asymmetric-keypair entry but the corresponding\n * {@link CryptoUtils.KeyStore.IPrivateKeyStorage}.delete failed; the new\n * entry is still committed and the orphaned blob is left for consumer-side\n * GC to reconcile.\n */\n readonly warning?: string;\n}\n\n/**\n * Options for adding a secret.\n * @public\n */\nexport interface IAddSecretOptions {\n /**\n * Optional description for the secret.\n */\n readonly description?: string;\n}\n\n/**\n * Options for importing a secret.\n * @public\n */\nexport interface IImportSecretOptions extends IAddSecretOptions {\n /**\n * Whether to replace an existing secret with the same name.\n */\n readonly replace?: boolean;\n}\n\n/**\n * Options for importing raw key material via {@link KeyStore.importSecret}.\n * Extends {@link IImportSecretOptions} with a type classification.\n * @public\n */\nexport interface IImportKeyOptions extends IImportSecretOptions {\n /**\n * Symmetric secret type classification for the imported key material.\n * @defaultValue 'encryption-key'\n */\n readonly type?: KeyStoreSymmetricSecretType;\n}\n\n/**\n * Options for adding a secret derived from a password.\n * @public\n */\nexport interface IAddSecretFromPasswordOptions extends IAddSecretOptions {\n /**\n * Whether to replace an existing secret with the same name.\n */\n readonly replace?: boolean;\n\n /**\n * PBKDF2 iterations for key derivation.\n * @defaultValue DEFAULT_SECRET_ITERATIONS (350000)\n */\n readonly iterations?: number;\n}\n\n/**\n * Default PBKDF2 iterations for secret-level key derivation.\n * Lower than keystore encryption since these are used more frequently.\n * @public\n */\nexport const DEFAULT_SECRET_ITERATIONS: number = 350000;\n\n/**\n * Result of adding a password-derived secret.\n * Extends {@link IAddSecretResult} with key derivation parameters\n * needed to store alongside encrypted files.\n * @public\n */\nexport interface IAddSecretFromPasswordResult extends IAddSecretResult {\n /**\n * Key derivation parameters used to derive the secret key.\n * Store these in encrypted file metadata so the password alone\n * can re-derive the same key for decryption.\n */\n readonly keyDerivation: IKeyDerivationParams;\n}\n\n/**\n * Options for adding an Argon2id password-derived secret.\n * @public\n */\nexport interface IAddSecretFromPasswordArgon2idOptions {\n /**\n * Argon2id parameters. Defaults to {@link CryptoUtils.ARGON2ID_OWASP_MIN}.\n */\n readonly params?: IArgon2idParams;\n /**\n * Optional description for the secret.\n */\n readonly description?: string;\n /**\n * Whether to replace an existing secret with the same name.\n */\n readonly replace?: boolean;\n}\n\n/**\n * Options for adding an asymmetric keypair to the key store.\n * @public\n */\nexport interface IAddKeyPairOptions {\n /**\n * Algorithm to use for the new keypair.\n */\n readonly algorithm: KeyPairAlgorithm;\n\n /**\n * Optional description for the entry.\n */\n readonly description?: string;\n\n /**\n * Whether to replace an existing entry with the same name.\n * Replacement mints a fresh storage `id` and best-effort deletes the\n * displaced storage blob; see the keystore design doc for details.\n */\n readonly replace?: boolean;\n\n /**\n * Overrides the storage-backend-derived extractability for this key only.\n * Omit to keep the default (`!privateKeyStorage.supportsNonExtractable`).\n * A value the backend cannot honor fails loudly rather than silently\n * downgrading.\n */\n readonly extractable?: boolean;\n\n /**\n * Opt in to private-key escrow. When `true`, an encrypted copy of the\n * private key (as a JWK) is carried inside the vault entry\n * (`escrowedPrivateKeyJwk`), enabling cross-device recovery from the vault\n * file plus the master password alone via\n * `getKeyPair(name, { rehydrate: true })`.\n *\n * Orthogonal to `extractable`: the escrow copy is always captured (the\n * transient keypair is generated extractable so it can be exported to JWK),\n * while the LIVE stored key's extractability still follows the normal rule\n * (`extractable` override, else the backend default). So escrow does not\n * change how extractable the day-to-day key is — only whether a recovery\n * copy is retained in the vault.\n *\n * @defaultValue false — no escrow copy is written (today's behavior).\n *\n * SECURITY: escrow makes the master password the sole gate protecting a\n * private key that would otherwise be unrecoverable from the vault. Use a\n * strong KDF (Argon2id-derived or high-iteration PBKDF2) for escrow-bearing\n * stores. See the {@link CryptoUtils.KeyStore.KeyStore} class docs.\n */\n readonly escrow?: boolean;\n}\n\n/**\n * Options for retrieving an asymmetric keypair via {@link CryptoUtils.KeyStore.KeyStore.getKeyPair}.\n * @public\n */\nexport interface IGetKeyPairOptions {\n /**\n * Opt in to escrow rehydration. When `true` AND no private-key blob exists\n * under the entry's storage `id` AND the entry carries an\n * `escrowedPrivateKeyJwk`, the escrowed JWK is imported (non-extractable\n * where the backend supports it) and stored under the entry's `id` before\n * being returned — filling a gap on a fresh device from the recovered vault.\n *\n * Fill-a-gap only: an existing storage blob is never overwritten. When a\n * blob is present it is loaded as usual and the escrow copy is ignored.\n *\n * @defaultValue false — today's behavior: load from storage or fail.\n */\n readonly rehydrate?: boolean;\n}\n\n/**\n * Result of adding an asymmetric keypair to the key store.\n * @public\n */\nexport interface IAddKeyPairResult {\n /**\n * The asymmetric entry that was added.\n */\n readonly entry: IKeyStoreAsymmetricEntry;\n\n /**\n * Whether this replaced an existing entry.\n */\n readonly replaced: boolean;\n\n /**\n * Best-effort warning from displaced-resource cleanup. Set when this call\n * replaced a prior entry but the corresponding\n * {@link CryptoUtils.KeyStore.IPrivateKeyStorage}.delete failed; the new\n * keypair is still committed and the orphaned blob is left for consumer-side\n * GC to reconcile.\n */\n readonly warning?: string;\n}\n\n/**\n * Result of removing a secret from the key store.\n * @public\n */\nexport interface IRemoveSecretResult {\n /**\n * The secret entry that was removed from the vault.\n */\n readonly entry: IKeyStoreEntry;\n\n /**\n * Best-effort warning from {@link CryptoUtils.KeyStore.IPrivateKeyStorage}.delete\n * for asymmetric entries when the storage call failed. The vault entry is\n * still considered removed and the orphaned blob is left for consumer-side\n * GC to reconcile.\n */\n readonly warning?: string;\n}\n\n// ============================================================================\n// Detection Helper\n// ============================================================================\n\n/**\n * Checks if a JSON object appears to be a key store file.\n * Uses the format field as a discriminator.\n * @param json - JSON object to check\n * @returns true if the object has the key store format field\n * @public\n */\nexport function isKeyStoreFile(json: unknown): boolean {\n if (typeof json !== 'object' || json === null) {\n return false;\n }\n const obj = json as Record<string, unknown>;\n return typeof obj.format === 'string' && (allKeyStoreFormats as ReadonlyArray<string>).includes(obj.format);\n}\n"]}
|
|
1
|
+
{"version":3,"file":"model.js","sourceRoot":"","sources":["../../../../src/packlets/crypto-utils/keystore/model.ts"],"names":[],"mappings":";AAAA,kCAAkC;AAClC,EAAE;AACF,+EAA+E;AAC/E,gFAAgF;AAChF,+EAA+E;AAC/E,4EAA4E;AAC5E,wEAAwE;AACxE,2DAA2D;AAC3D,EAAE;AACF,iFAAiF;AACjF,kDAAkD;AAClD,EAAE;AACF,6EAA6E;AAC7E,2EAA2E;AAC3E,8EAA8E;AAC9E,yEAAyE;AACzE,gFAAgF;AAChF,gFAAgF;AAChF,YAAY;;;AAmvBZ,wCAMC;AA5uBD,2EAA2E;AAC3E,2EAA2E;AAC3E,kCAAkE;AAAzD,6GAAA,oBAAoB,OAAA;AAuB7B;;;GAGG;AACU,QAAA,kBAAkB,GAAkC;IAC/D,aAAa;IACb,aAAa;IACb,aAAa;CACd,CAAC;AAEF;;;GAGG;AACU,QAAA,eAAe,GAAmB,aAAa,CAAC;AAE7D;;;;GAIG;AACU,QAAA,2BAA2B,GAAW,MAAM,CAAC;AAE1D;;;GAGG;AACU,QAAA,eAAe,GAAW,EAAE,CAAC;AAkB1C;;;GAGG;AACU,QAAA,+BAA+B,GAA+C;IACzF,gBAAgB;IAChB,SAAS;IACT,QAAQ;CACT,CAAC;AAWF;;;GAGG;AACU,QAAA,gCAAgC,GAAgD;IAC3F,oBAAoB;CACrB,CAAC;AAQF;;;GAGG;AACU,QAAA,sBAAsB,GAAsC;IACvE,GAAG,wCAAgC;IACnC,GAAG,uCAA+B;CACnC,CAAC;AA8cF;;;;GAIG;AACU,QAAA,yBAAyB,GAAW,MAAM,CAAC;AA0JxD,+EAA+E;AAC/E,mBAAmB;AACnB,+EAA+E;AAE/E;;;;;;GAMG;AACH,SAAgB,cAAc,CAAC,IAAa;IAC1C,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,KAAK,IAAI,EAAE,CAAC;QAC9C,OAAO,KAAK,CAAC;IACf,CAAC;IACD,MAAM,GAAG,GAAG,IAA+B,CAAC;IAC5C,OAAO,OAAO,GAAG,CAAC,MAAM,KAAK,QAAQ,IAAK,0BAA4C,CAAC,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;AAC9G,CAAC","sourcesContent":["// Copyright (c) 2026 Erik Fortune\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in all\n// copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n// SOFTWARE.\n\nimport { JsonValue } from '@fgv/ts-json-base';\nimport {\n EncryptionAlgorithm,\n ICryptoProvider,\n IArgon2idParams,\n IKeyDerivationParams,\n IPbkdf2KeyDerivationParams,\n KeyPairAlgorithm\n} from '../model';\nimport { IPrivateKeyStorage } from './privateKeyStorage';\n\n// Re-export so consumers can continue to access the algorithm enum via the\n// CryptoUtils.KeyStore namespace alongside the rest of the keystore types.\nexport { allKeyPairAlgorithms, KeyPairAlgorithm } from '../model';\n\n// ============================================================================\n// Key Store Format Types\n// ============================================================================\n\n/**\n * Format version for key store files.\n *\n * - `'keystore-v1'`: the original format (no private-key escrow).\n * - `'keystore-v2'`: adds the optional `escrowedPrivateKeyJwk` field on\n * asymmetric-keypair entries. A strict superset of v1 — the field is\n * optional, so a v2 reader opens a v1 vault with no special-casing, and a\n * v1 vault opened and re-saved is silently upgraded to v2.\n * - `'keystore-v3'`: adds the `'opaque'` symmetric secret type and the optional\n * `metadata` / `updatedAt` fields on symmetric entries. A strict superset of\n * v1/v2 — the additions are optional (and `'opaque'` is simply a new enum\n * value), so a v3 reader opens a v1/v2 vault with no special-casing, and a\n * v1/v2 vault opened and re-saved is silently upgraded to v3.\n * @public\n */\nexport type KeyStoreFormat = 'keystore-v1' | 'keystore-v2' | 'keystore-v3';\n\n/**\n * All recognized key store format versions (readable by the current library).\n * @public\n */\nexport const allKeyStoreFormats: ReadonlyArray<KeyStoreFormat> = [\n 'keystore-v1',\n 'keystore-v2',\n 'keystore-v3'\n];\n\n/**\n * Current format version constant. New vaults are written as `'keystore-v3'`.\n * @public\n */\nexport const KEYSTORE_FORMAT: KeyStoreFormat = 'keystore-v3';\n\n/**\n * Default PBKDF2 iterations for key store encryption.\n * Higher than regular files since this protects the master key vault.\n * @public\n */\nexport const DEFAULT_KEYSTORE_ITERATIONS: number = 600000;\n\n/**\n * Minimum salt length for key derivation.\n * @public\n */\nexport const MIN_SALT_LENGTH: number = 16;\n\n// ============================================================================\n// Key Store Vault Contents (Decrypted State)\n// ============================================================================\n\n/**\n * Discriminator for symmetric secret types stored in the vault.\n * - `'encryption-key'`: A 32-byte AES-256 encryption key.\n * - `'api-key'`: An arbitrary-length API key string (UTF-8 encoded).\n * - `'opaque'`: Arbitrary raw bytes with no encoding contract — stored and\n * returned verbatim (never UTF-8 decoded). Use for byte blobs that are\n * neither a fixed-size AES key nor a UTF-8 string (e.g. a serialized\n * credential bundle), so they are not mistyped as `'api-key'`.\n * @public\n */\nexport type KeyStoreSymmetricSecretType = 'encryption-key' | 'api-key' | 'opaque';\n\n/**\n * All valid symmetric secret types.\n * @public\n */\nexport const allKeyStoreSymmetricSecretTypes: ReadonlyArray<KeyStoreSymmetricSecretType> = [\n 'encryption-key',\n 'api-key',\n 'opaque'\n];\n\n/**\n * Discriminator for asymmetric secret types stored in the vault.\n * - `'asymmetric-keypair'`: A public/private key pair. The public key is held in\n * the vault as a JWK; the private key lives in the supplied\n * {@link CryptoUtils.KeyStore.IPrivateKeyStorage} provider.\n * @public\n */\nexport type KeyStoreAsymmetricSecretType = 'asymmetric-keypair';\n\n/**\n * All valid asymmetric secret types.\n * @public\n */\nexport const allKeyStoreAsymmetricSecretTypes: ReadonlyArray<KeyStoreAsymmetricSecretType> = [\n 'asymmetric-keypair'\n];\n\n/**\n * Discriminator for any secret type stored in the vault.\n * @public\n */\nexport type KeyStoreSecretType = KeyStoreSymmetricSecretType | KeyStoreAsymmetricSecretType;\n\n/**\n * All valid key store secret types.\n * @public\n */\nexport const allKeyStoreSecretTypes: ReadonlyArray<KeyStoreSecretType> = [\n ...allKeyStoreAsymmetricSecretTypes,\n ...allKeyStoreSymmetricSecretTypes\n];\n\n/**\n * A symmetric secret entry stored in the vault (in-memory representation).\n * Holds the raw key material directly — for `'encryption-key'` it is a 32-byte\n * AES-256 key; for `'api-key'` it is the UTF-8 encoded API key string.\n * @public\n */\nexport interface IKeyStoreSymmetricEntry {\n /**\n * Unique name for this secret (used as lookup key).\n */\n readonly name: string;\n\n /**\n * Symmetric secret type discriminator.\n */\n readonly type: KeyStoreSymmetricSecretType;\n\n /**\n * The secret data.\n * - For `'encryption-key'`: 32-byte AES-256 key.\n * - For `'api-key'`: UTF-8 encoded API key string (arbitrary length).\n * - For `'opaque'`: arbitrary raw bytes, stored and returned verbatim.\n */\n readonly key: Uint8Array;\n\n /**\n * Optional description for this secret.\n */\n readonly description?: string;\n\n /**\n * Optional mutable, non-secret-by-contract metadata for this entry. Set via\n * {@link CryptoUtils.KeyStore.KeyStore.setSecretMetadata} without touching the\n * secret `key` bytes.\n *\n * \"Non-secret by contract\" means the field is intended for lifecycle metadata\n * (rotation timestamps, labels, provenance) rather than secret material.\n * PHYSICALLY it lives inside the vault's AES-GCM ciphertext alongside the key\n * bytes — the vault has no plaintext index — so it is protected at rest by the\n * master password; the \"non-secret\" designation is a usage contract, not a\n * weaker custody class.\n */\n readonly metadata?: JsonValue;\n\n /**\n * When this secret was added (ISO 8601).\n */\n readonly createdAt: string;\n\n /**\n * When this entry was last mutated (ISO 8601). Stamped on any metadata\n * mutation (see {@link CryptoUtils.KeyStore.KeyStore.setSecretMetadata}).\n * Absent on entries that have never been mutated since creation.\n */\n readonly updatedAt?: string;\n}\n\n/**\n * An asymmetric keypair entry stored in the vault (in-memory representation).\n * Holds only the public key (as a JWK) and a stable handle (`id`) the\n * {@link CryptoUtils.KeyStore.IPrivateKeyStorage} provider uses to fetch the private key.\n * @public\n */\nexport interface IKeyStoreAsymmetricEntry {\n /**\n * Unique name for this entry (used as vault lookup key, renameable).\n */\n readonly name: string;\n\n /**\n * Asymmetric secret type discriminator.\n */\n readonly type: KeyStoreAsymmetricSecretType;\n\n /**\n * Immutable handle used by {@link CryptoUtils.KeyStore.IPrivateKeyStorage} to address the\n * private key. Independent of `name`; survives renames.\n */\n readonly id: string;\n\n /**\n * Algorithm used to generate this keypair.\n */\n readonly algorithm: KeyPairAlgorithm;\n\n /**\n * The public key as a JSON Web Key.\n */\n readonly publicKeyJwk: JsonWebKey;\n\n /**\n * Optional escrowed copy of the private key, as a JSON Web Key. Present only\n * when the entry was created with `addKeyPair(name, { escrow: true })`.\n *\n * This is an opt-in cross-device recovery affordance: the private key is\n * carried inside the vault's AES-GCM ciphertext (same custody class as\n * `publicKeyJwk`), so a recovered vault plus the master password can\n * reconstitute the signing/decryption identity on a fresh device via\n * `getKeyPair(name, { rehydrate: true })`.\n *\n * SECURITY: when present, the master password becomes the sole gate\n * protecting this private key. Use a strong KDF for escrow-bearing stores.\n * See the {@link CryptoUtils.KeyStore.KeyStore} class docs.\n */\n readonly escrowedPrivateKeyJwk?: JsonWebKey;\n\n /**\n * Optional description for this entry.\n */\n readonly description?: string;\n\n /**\n * When this entry was added (ISO 8601).\n */\n readonly createdAt: string;\n}\n\n/**\n * Any vault entry, discriminated by `type`.\n * @public\n */\nexport type IKeyStoreEntry = IKeyStoreSymmetricEntry | IKeyStoreAsymmetricEntry;\n\n/**\n * Backwards-compatible alias for {@link CryptoUtils.KeyStore.IKeyStoreSymmetricEntry}.\n * @deprecated Use {@link CryptoUtils.KeyStore.IKeyStoreSymmetricEntry} for symmetric\n * entries or {@link CryptoUtils.KeyStore.IKeyStoreEntry} for the discriminated union.\n * @public\n */\nexport type IKeyStoreSecretEntry = IKeyStoreSymmetricEntry;\n\n/**\n * JSON-serializable representation of a symmetric secret entry.\n *\n * @remarks\n * Describes the *normalized* shape after parsing. `type` is required here\n * because the converter (see\n * {@link CryptoUtils.KeyStore.Converters.keystoreSymmetricEntryJson | keystoreSymmetricEntryJson})\n * injects the default `'encryption-key'` when reading vaults written before\n * asymmetric-keypair support added the discriminator. Raw on-wire bytes from\n * a legacy vault may therefore omit `type`; downstream code only ever sees\n * the post-conversion shape declared here.\n *\n * @public\n */\nexport interface IKeyStoreSymmetricEntryJson {\n /**\n * Unique name for this secret.\n */\n readonly name: string;\n\n /**\n * Symmetric secret type discriminator.\n *\n * Required on this normalized model type. Vaults written prior to the\n * asymmetric-keypair support may omit this field on the wire; the\n * converter injects `'encryption-key'` when missing for backwards\n * compatibility, so by the time a value of this type is observed the\n * discriminator is always present.\n */\n readonly type: KeyStoreSymmetricSecretType;\n\n /**\n * Base64-encoded secret data.\n */\n readonly key: string;\n\n /**\n * Optional description.\n */\n readonly description?: string;\n\n /**\n * Optional mutable, non-secret-by-contract metadata for this entry. Present\n * only on `'keystore-v3'` vaults whose entry carried metadata; a v1/v2 vault\n * omits the field. Physically carried inside the vault ciphertext (the vault\n * has no plaintext index).\n */\n readonly metadata?: JsonValue;\n\n /**\n * When this secret was added (ISO 8601).\n */\n readonly createdAt: string;\n\n /**\n * When this entry was last mutated (ISO 8601). Present only on `'keystore-v3'`\n * vaults whose entry has been mutated since creation.\n */\n readonly updatedAt?: string;\n}\n\n/**\n * JSON-serializable representation of an asymmetric keypair entry.\n * The private key is not present here — it lives in the\n * {@link CryptoUtils.KeyStore.IPrivateKeyStorage} provider, addressed by `id`.\n * @public\n */\nexport interface IKeyStoreAsymmetricEntryJson {\n /**\n * Unique name for this entry.\n */\n readonly name: string;\n\n /**\n * Asymmetric secret type discriminator.\n */\n readonly type: KeyStoreAsymmetricSecretType;\n\n /**\n * Immutable handle used by {@link CryptoUtils.KeyStore.IPrivateKeyStorage} to address the\n * private key.\n */\n readonly id: string;\n\n /**\n * Algorithm used to generate this keypair.\n */\n readonly algorithm: KeyPairAlgorithm;\n\n /**\n * The public key as a JSON Web Key.\n */\n readonly publicKeyJwk: JsonWebKey;\n\n /**\n * Optional escrowed copy of the private key, as a JSON Web Key. Present only\n * on `'keystore-v2'` vaults whose entry was created with escrow enabled. A\n * v1 vault omits the field; a v2 reader treats its absence as \"no escrow\".\n */\n readonly escrowedPrivateKeyJwk?: JsonWebKey;\n\n /**\n * Optional description.\n */\n readonly description?: string;\n\n /**\n * When this entry was added (ISO 8601).\n */\n readonly createdAt: string;\n}\n\n/**\n * Any JSON vault entry, discriminated by `type`.\n * @public\n */\nexport type IKeyStoreEntryJson = IKeyStoreSymmetricEntryJson | IKeyStoreAsymmetricEntryJson;\n\n/**\n * Backwards-compatible alias for {@link CryptoUtils.KeyStore.IKeyStoreSymmetricEntryJson}.\n * @deprecated Use {@link CryptoUtils.KeyStore.IKeyStoreSymmetricEntryJson} for\n * symmetric entries or {@link CryptoUtils.KeyStore.IKeyStoreEntryJson} for the\n * discriminated union.\n * @public\n */\nexport type IKeyStoreSecretEntryJson = IKeyStoreSymmetricEntryJson;\n\n/**\n * The decrypted vault contents - a versioned map of entries.\n * @public\n */\nexport interface IKeyStoreVaultContents {\n /**\n * Format version for vault contents.\n */\n readonly version: KeyStoreFormat;\n\n /**\n * Map of entry name to entry (symmetric or asymmetric).\n */\n readonly secrets: Record<string, IKeyStoreEntryJson>;\n}\n\n// ============================================================================\n// Key Store File Format (Encrypted State)\n// ============================================================================\n\n/**\n * The encrypted key store file format.\n * @public\n */\nexport interface IKeyStoreFile {\n /**\n * Format identifier.\n */\n readonly format: KeyStoreFormat;\n\n /**\n * Algorithm used for encryption.\n */\n readonly algorithm: EncryptionAlgorithm;\n\n /**\n * Base64-encoded initialization vector.\n */\n readonly iv: string;\n\n /**\n * Base64-encoded authentication tag.\n */\n readonly authTag: string;\n\n /**\n * Base64-encoded encrypted vault contents.\n */\n readonly encryptedData: string;\n\n /**\n * Key derivation parameters for the vault master key (always PBKDF2).\n */\n readonly keyDerivation: IPbkdf2KeyDerivationParams;\n}\n\n// ============================================================================\n// Key Store State and Configuration\n// ============================================================================\n\n/**\n * Key store lock state.\n * @public\n */\nexport type KeyStoreLockState = 'locked' | 'unlocked';\n\n/**\n * Parameters for creating a new key store.\n * @public\n */\nexport interface IKeyStoreCreateParams {\n /**\n * Crypto provider to use.\n */\n readonly cryptoProvider: ICryptoProvider;\n\n /**\n * PBKDF2 iterations (defaults to DEFAULT_KEYSTORE_ITERATIONS).\n */\n readonly iterations?: number;\n\n /**\n * Optional private-key storage backend. Required to use `addKeyPair` /\n * `getKeyPair`; absent backends still permit opening, listing, and reading\n * public-key metadata for asymmetric entries.\n */\n readonly privateKeyStorage?: IPrivateKeyStorage;\n}\n\n/**\n * Parameters for opening an existing key store.\n * @public\n */\nexport interface IKeyStoreOpenParams {\n /**\n * Crypto provider to use.\n */\n readonly cryptoProvider: ICryptoProvider;\n\n /**\n * The encrypted key store file content.\n */\n readonly keystoreFile: IKeyStoreFile;\n\n /**\n * Optional private-key storage backend. Required to use `addKeyPair` /\n * `getKeyPair`; absent backends still permit opening, listing, and reading\n * public-key metadata for asymmetric entries.\n */\n readonly privateKeyStorage?: IPrivateKeyStorage;\n}\n\n/**\n * Result of adding a secret to the key store.\n * @public\n */\nexport interface IAddSecretResult {\n /**\n * The secret entry that was added.\n */\n readonly entry: IKeyStoreSymmetricEntry;\n\n /**\n * Whether this replaced an existing secret.\n */\n readonly replaced: boolean;\n\n /**\n * Best-effort warning from displaced-resource cleanup. Set when this call\n * replaced an asymmetric-keypair entry but the corresponding\n * {@link CryptoUtils.KeyStore.IPrivateKeyStorage}.delete failed; the new\n * entry is still committed and the orphaned blob is left for consumer-side\n * GC to reconcile.\n */\n readonly warning?: string;\n}\n\n/**\n * Options for adding a secret.\n * @public\n */\nexport interface IAddSecretOptions {\n /**\n * Optional description for the secret.\n */\n readonly description?: string;\n}\n\n/**\n * Options for importing a secret.\n * @public\n */\nexport interface IImportSecretOptions extends IAddSecretOptions {\n /**\n * Whether to replace an existing secret with the same name.\n */\n readonly replace?: boolean;\n}\n\n/**\n * Options for importing raw key material via {@link KeyStore.importSecret}.\n * Extends {@link IImportSecretOptions} with a type classification.\n * @public\n */\nexport interface IImportKeyOptions extends IImportSecretOptions {\n /**\n * Symmetric secret type classification for the imported key material.\n * @defaultValue 'encryption-key'\n */\n readonly type?: KeyStoreSymmetricSecretType;\n}\n\n/**\n * Options for importing raw opaque bytes via {@link KeyStore.importSecretBytes}.\n * Extends {@link IImportSecretOptions} with optional initial metadata.\n * @public\n */\nexport interface IImportSecretBytesOptions extends IImportSecretOptions {\n /**\n * Optional initial mutable metadata to store with the entry. Can also be set\n * or replaced later via {@link KeyStore.setSecretMetadata}.\n */\n readonly metadata?: JsonValue;\n}\n\n/**\n * Options for adding a secret derived from a password.\n * @public\n */\nexport interface IAddSecretFromPasswordOptions extends IAddSecretOptions {\n /**\n * Whether to replace an existing secret with the same name.\n */\n readonly replace?: boolean;\n\n /**\n * PBKDF2 iterations for key derivation.\n * @defaultValue DEFAULT_SECRET_ITERATIONS (350000)\n */\n readonly iterations?: number;\n}\n\n/**\n * Default PBKDF2 iterations for secret-level key derivation.\n * Lower than keystore encryption since these are used more frequently.\n * @public\n */\nexport const DEFAULT_SECRET_ITERATIONS: number = 350000;\n\n/**\n * Result of adding a password-derived secret.\n * Extends {@link IAddSecretResult} with key derivation parameters\n * needed to store alongside encrypted files.\n * @public\n */\nexport interface IAddSecretFromPasswordResult extends IAddSecretResult {\n /**\n * Key derivation parameters used to derive the secret key.\n * Store these in encrypted file metadata so the password alone\n * can re-derive the same key for decryption.\n */\n readonly keyDerivation: IKeyDerivationParams;\n}\n\n/**\n * Options for adding an Argon2id password-derived secret.\n * @public\n */\nexport interface IAddSecretFromPasswordArgon2idOptions {\n /**\n * Argon2id parameters. Defaults to {@link CryptoUtils.ARGON2ID_OWASP_MIN}.\n */\n readonly params?: IArgon2idParams;\n /**\n * Optional description for the secret.\n */\n readonly description?: string;\n /**\n * Whether to replace an existing secret with the same name.\n */\n readonly replace?: boolean;\n}\n\n/**\n * Options for adding an asymmetric keypair to the key store.\n * @public\n */\nexport interface IAddKeyPairOptions {\n /**\n * Algorithm to use for the new keypair.\n */\n readonly algorithm: KeyPairAlgorithm;\n\n /**\n * Optional description for the entry.\n */\n readonly description?: string;\n\n /**\n * Whether to replace an existing entry with the same name.\n * Replacement mints a fresh storage `id` and best-effort deletes the\n * displaced storage blob; see the keystore design doc for details.\n */\n readonly replace?: boolean;\n\n /**\n * Overrides the storage-backend-derived extractability for this key only.\n * Omit to keep the default (`!privateKeyStorage.supportsNonExtractable`).\n * A value the backend cannot honor fails loudly rather than silently\n * downgrading.\n */\n readonly extractable?: boolean;\n\n /**\n * Opt in to private-key escrow. When `true`, an encrypted copy of the\n * private key (as a JWK) is carried inside the vault entry\n * (`escrowedPrivateKeyJwk`), enabling cross-device recovery from the vault\n * file plus the master password alone via\n * `getKeyPair(name, { rehydrate: true })`.\n *\n * Orthogonal to `extractable`: the escrow copy is always captured (the\n * transient keypair is generated extractable so it can be exported to JWK),\n * while the LIVE stored key's extractability still follows the normal rule\n * (`extractable` override, else the backend default). So escrow does not\n * change how extractable the day-to-day key is — only whether a recovery\n * copy is retained in the vault.\n *\n * @defaultValue false — no escrow copy is written (today's behavior).\n *\n * SECURITY: escrow makes the master password the sole gate protecting a\n * private key that would otherwise be unrecoverable from the vault. Use a\n * strong KDF (Argon2id-derived or high-iteration PBKDF2) for escrow-bearing\n * stores. See the {@link CryptoUtils.KeyStore.KeyStore} class docs.\n */\n readonly escrow?: boolean;\n}\n\n/**\n * Options for retrieving an asymmetric keypair via {@link CryptoUtils.KeyStore.KeyStore.getKeyPair}.\n * @public\n */\nexport interface IGetKeyPairOptions {\n /**\n * Opt in to escrow rehydration. When `true` AND no private-key blob exists\n * under the entry's storage `id` AND the entry carries an\n * `escrowedPrivateKeyJwk`, the escrowed JWK is imported (non-extractable\n * where the backend supports it) and stored under the entry's `id` before\n * being returned — filling a gap on a fresh device from the recovered vault.\n *\n * Fill-a-gap only: an existing storage blob is never overwritten. When a\n * blob is present it is loaded as usual and the escrow copy is ignored.\n *\n * @defaultValue false — today's behavior: load from storage or fail.\n */\n readonly rehydrate?: boolean;\n}\n\n/**\n * Result of adding an asymmetric keypair to the key store.\n * @public\n */\nexport interface IAddKeyPairResult {\n /**\n * The asymmetric entry that was added.\n */\n readonly entry: IKeyStoreAsymmetricEntry;\n\n /**\n * Whether this replaced an existing entry.\n */\n readonly replaced: boolean;\n\n /**\n * Best-effort warning from displaced-resource cleanup. Set when this call\n * replaced a prior entry but the corresponding\n * {@link CryptoUtils.KeyStore.IPrivateKeyStorage}.delete failed; the new\n * keypair is still committed and the orphaned blob is left for consumer-side\n * GC to reconcile.\n */\n readonly warning?: string;\n}\n\n/**\n * Result of removing a secret from the key store.\n * @public\n */\nexport interface IRemoveSecretResult {\n /**\n * The secret entry that was removed from the vault.\n */\n readonly entry: IKeyStoreEntry;\n\n /**\n * Best-effort warning from {@link CryptoUtils.KeyStore.IPrivateKeyStorage}.delete\n * for asymmetric entries when the storage call failed. The vault entry is\n * still considered removed and the orphaned blob is left for consumer-side\n * GC to reconcile.\n */\n readonly warning?: string;\n}\n\n// ============================================================================\n// Detection Helper\n// ============================================================================\n\n/**\n * Checks if a JSON object appears to be a key store file.\n * Uses the format field as a discriminator.\n * @param json - JSON object to check\n * @returns true if the object has the key store format field\n * @public\n */\nexport function isKeyStoreFile(json: unknown): boolean {\n if (typeof json !== 'object' || json === null) {\n return false;\n }\n const obj = json as Record<string, unknown>;\n return typeof obj.format === 'string' && (allKeyStoreFormats as ReadonlyArray<string>).includes(obj.format);\n}\n"]}
|
|
@@ -101,6 +101,27 @@ export interface IEncryptBytesResult {
|
|
|
101
101
|
* @public
|
|
102
102
|
*/
|
|
103
103
|
export type KeyPairAlgorithm = 'ecdsa-p256' | 'rsa-oaep-2048' | 'ecdh-p256' | 'ed25519' | 'x25519';
|
|
104
|
+
/**
|
|
105
|
+
* The subset of {@link CryptoUtils.KeyPairAlgorithm} whose keypair can be
|
|
106
|
+
* derived *deterministically* from a fixed secret seed, for use with
|
|
107
|
+
* {@link CryptoUtils.ICryptoProvider.importKeyPairFromSeed | importKeyPairFromSeed}.
|
|
108
|
+
*
|
|
109
|
+
* Two algorithms are supported, both of whose 32-byte private scalar *is* the
|
|
110
|
+
* seed and whose public key is a deterministic function of it, so the same seed
|
|
111
|
+
* always yields the same keypair on every runtime:
|
|
112
|
+
* - `'ed25519'` — signing keypair (RFC 8032). Private usage `'sign'`, public
|
|
113
|
+
* usage `'verify'`.
|
|
114
|
+
* - `'x25519'` — Diffie-Hellman key-agreement keypair (RFC 7748), the recipient
|
|
115
|
+
* keypair consumed by {@link CryptoUtils.HpkeProvider}. Private usage
|
|
116
|
+
* `'deriveBits'`, public key imported with no usages. Deriving a fixed X25519
|
|
117
|
+
* recipient keypair from a checked-in seed is what makes a deterministic HPKE
|
|
118
|
+
* seal/open round-trip vector possible.
|
|
119
|
+
*
|
|
120
|
+
* The type is a proper subset of {@link CryptoUtils.KeyPairAlgorithm} because
|
|
121
|
+
* algorithms like RSA or the NIST curves are not recoverable from a bare seed.
|
|
122
|
+
* @public
|
|
123
|
+
*/
|
|
124
|
+
export type SeedDerivableAlgorithm = 'ed25519' | 'x25519';
|
|
104
125
|
/**
|
|
105
126
|
* Caller-supplied HKDF parameters that domain-separate one
|
|
106
127
|
* {@link CryptoUtils.ICryptoProvider.wrapBytes | wrapBytes} call from another.
|
|
@@ -239,6 +260,32 @@ export declare const ARGON2ID_OWASP_MIN: IArgon2idParams;
|
|
|
239
260
|
* @public
|
|
240
261
|
*/
|
|
241
262
|
export declare const ARGON2ID_PASSPHRASE: IArgon2idParams;
|
|
263
|
+
/**
|
|
264
|
+
* Optional keyed-hashing inputs for {@link CryptoUtils.IArgon2idProvider.argon2id | argon2id}
|
|
265
|
+
* (RFC 9106 §3.1). These are distinct from the cost parameters in
|
|
266
|
+
* {@link CryptoUtils.IArgon2idParams} — they change the derived output but are
|
|
267
|
+
* not tuning knobs. Both fields are optional; omitting a field (or passing an
|
|
268
|
+
* empty `Uint8Array`) is a no-op that leaves the output byte-identical to a call
|
|
269
|
+
* with no options at all.
|
|
270
|
+
* @public
|
|
271
|
+
*/
|
|
272
|
+
export interface IArgon2idKeyingOptions {
|
|
273
|
+
/**
|
|
274
|
+
* Optional secret key K (RFC 9106 keyed hashing, sometimes called a "pepper").
|
|
275
|
+
* When present and non-empty it is mixed into the hash so that the derived
|
|
276
|
+
* output cannot be reproduced without also knowing K. Empty or omitted means
|
|
277
|
+
* no secret. Honored by both the Node and browser backends.
|
|
278
|
+
*/
|
|
279
|
+
readonly secret?: Uint8Array;
|
|
280
|
+
/**
|
|
281
|
+
* Optional associated data X (RFC 9106 §3.1). When present and non-empty it is
|
|
282
|
+
* mixed into the hash. **Node-only:** the WASM (`hash-wasm`) browser backend
|
|
283
|
+
* has no associated-data input, so `BrowserArgon2Provider` fails loudly rather
|
|
284
|
+
* than silently dropping it (which would produce wrong bytes). Empty or omitted
|
|
285
|
+
* means no associated data and is accepted by both backends.
|
|
286
|
+
*/
|
|
287
|
+
readonly associatedData?: Uint8Array;
|
|
288
|
+
}
|
|
242
289
|
/**
|
|
243
290
|
* Argon2id key derivation provider (RFC 9106).
|
|
244
291
|
*
|
|
@@ -253,15 +300,24 @@ export interface IArgon2idProvider {
|
|
|
253
300
|
/**
|
|
254
301
|
* Derives key material from a password using Argon2id (RFC 9106 §3.1).
|
|
255
302
|
*
|
|
256
|
-
* Returns the raw derived bytes as a `Uint8Array`.
|
|
257
|
-
*
|
|
303
|
+
* Returns the raw derived bytes as a `Uint8Array`. For the same inputs that
|
|
304
|
+
* both backends support, the Node and browser implementations produce
|
|
305
|
+
* byte-identical output. The optional `associatedData` in
|
|
306
|
+
* {@link CryptoUtils.IArgon2idKeyingOptions} is the one exception: it is
|
|
307
|
+
* Node-only (the browser WASM backend has no associated-data input), so a call
|
|
308
|
+
* that supplies non-empty `associatedData` is not portable to the browser
|
|
309
|
+
* backend. Every input the browser backend *does* support (including the
|
|
310
|
+
* optional `secret`) is byte-identical across the two.
|
|
258
311
|
*
|
|
259
312
|
* @param password - Password or passphrase. Accepts string (UTF-8) or raw bytes.
|
|
260
313
|
* @param salt - Salt bytes. Must be random and unique per credential (\>= 16 bytes recommended).
|
|
261
314
|
* @param params - Argon2id parameters. Use `ARGON2ID_OWASP_MIN` as a starting point.
|
|
315
|
+
* @param options - Optional {@link CryptoUtils.IArgon2idKeyingOptions | keyed-hashing inputs}
|
|
316
|
+
* (secret K and/or associated data X). Omitting them (the default) leaves the
|
|
317
|
+
* output byte-identical to prior behavior.
|
|
262
318
|
* @returns Success with derived bytes, Failure with error context.
|
|
263
319
|
*/
|
|
264
|
-
argon2id(password: Uint8Array | string, salt: Uint8Array, params: IArgon2idParams): Promise<Result<Uint8Array>>;
|
|
320
|
+
argon2id(password: Uint8Array | string, salt: Uint8Array, params: IArgon2idParams, options?: IArgon2idKeyingOptions): Promise<Result<Uint8Array>>;
|
|
265
321
|
}
|
|
266
322
|
/**
|
|
267
323
|
* Generic encrypted file format.
|
|
@@ -445,6 +501,31 @@ export interface ICryptoProvider {
|
|
|
445
501
|
* @returns Success with the generated `CryptoKeyPair`, or Failure with error context.
|
|
446
502
|
*/
|
|
447
503
|
generateKeyPair(algorithm: KeyPairAlgorithm, extractable: boolean): Promise<Result<CryptoKeyPair>>;
|
|
504
|
+
/**
|
|
505
|
+
* Derives an asymmetric keypair *deterministically* from a fixed secret seed.
|
|
506
|
+
* The same `seed` always yields the same keypair on every runtime, so this is
|
|
507
|
+
* the primitive to use when a keypair must be reconstructable from stored seed
|
|
508
|
+
* material (key escrow, HD-style derivation, deterministic test vectors) rather
|
|
509
|
+
* than freshly sampled by {@link CryptoUtils.ICryptoProvider.generateKeyPair | generateKeyPair}.
|
|
510
|
+
*
|
|
511
|
+
* For both `'ed25519'` and `'x25519'` the private key *is* its 32-byte seed and
|
|
512
|
+
* the public key is a deterministic function of that seed (RFC 8032 / RFC 7748),
|
|
513
|
+
* so the returned public key is recovered even when the caller requests a
|
|
514
|
+
* non-extractable private key. The transient extractable key used internally to
|
|
515
|
+
* recover the public half is never returned or logged when `extractable` is
|
|
516
|
+
* `false`. The returned keys carry the algorithm's usages: `'ed25519'` →
|
|
517
|
+
* private `'sign'` / public `'verify'`; `'x25519'` → private `'deriveBits'` /
|
|
518
|
+
* public no-usage (ready to hand to {@link CryptoUtils.HpkeProvider}).
|
|
519
|
+
* @param algorithm - The {@link CryptoUtils.SeedDerivableAlgorithm | seed-derivable algorithm}
|
|
520
|
+
* (`'ed25519'` or `'x25519'`); any other value fails loudly with context.
|
|
521
|
+
* @param seed - The secret seed. It must be exactly 32 bytes for both supported
|
|
522
|
+
* algorithms; any other length fails loudly, before any WebCrypto call. The
|
|
523
|
+
* bytes are copied, not retained or mutated.
|
|
524
|
+
* @param extractable - Whether the returned private key may be exported. The
|
|
525
|
+
* returned public key is identical for a given seed regardless of this flag.
|
|
526
|
+
* @returns Success with the derived `CryptoKeyPair`, or Failure with error context.
|
|
527
|
+
*/
|
|
528
|
+
importKeyPairFromSeed(algorithm: SeedDerivableAlgorithm, seed: Uint8Array, extractable: boolean): Promise<Result<CryptoKeyPair>>;
|
|
448
529
|
/**
|
|
449
530
|
* Exports the public half of a keypair as a JSON Web Key.
|
|
450
531
|
* @param publicKey - The public `CryptoKey` to export. Must be an `extractable`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../../src/packlets/crypto-utils/model.ts"],"names":[],"mappings":"AAoBA,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAEpD,OAAO,KAAK,SAAS,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,CAAC;AAMrB;;;;;;;;GAQG;AACH,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