@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
package/dist/ts-extras.d.ts
CHANGED
|
@@ -720,6 +720,7 @@ declare namespace CryptoUtils {
|
|
|
720
720
|
IDirectEncryptionProviderParams,
|
|
721
721
|
IKeyPairAlgorithmParams,
|
|
722
722
|
keyPairAlgorithmParams,
|
|
723
|
+
deriveKeyPairFromSeed,
|
|
723
724
|
NodeCryptoProvider,
|
|
724
725
|
nodeCryptoProvider,
|
|
725
726
|
createEncryptedFile,
|
|
@@ -731,6 +732,8 @@ declare namespace CryptoUtils {
|
|
|
731
732
|
base64UrlNoPadDecode,
|
|
732
733
|
base64UrlNoPadEncode,
|
|
733
734
|
exportPublicKeyAsMultibaseSpki,
|
|
735
|
+
hexDecode,
|
|
736
|
+
hexEncode,
|
|
734
737
|
importPublicKeyFromMultibaseSpki,
|
|
735
738
|
isValidMultibaseSpkiPublicKey,
|
|
736
739
|
MultibaseSpkiPublicKeyRegExp,
|
|
@@ -747,6 +750,7 @@ declare namespace CryptoUtils {
|
|
|
747
750
|
IEncryptionResult,
|
|
748
751
|
IEncryptBytesResult,
|
|
749
752
|
KeyPairAlgorithm,
|
|
753
|
+
SeedDerivableAlgorithm,
|
|
750
754
|
IWrapBytesOptions,
|
|
751
755
|
IWrappedBytes,
|
|
752
756
|
allKeyPairAlgorithms,
|
|
@@ -757,6 +761,7 @@ declare namespace CryptoUtils {
|
|
|
757
761
|
IArgon2idParams,
|
|
758
762
|
ARGON2ID_OWASP_MIN,
|
|
759
763
|
ARGON2ID_PASSPHRASE,
|
|
764
|
+
IArgon2idKeyingOptions,
|
|
760
765
|
IArgon2idProvider,
|
|
761
766
|
IEncryptedFile,
|
|
762
767
|
ICryptoProvider,
|
|
@@ -841,6 +846,46 @@ declare const DEFAULT_RANGEOF_FORMATS: RangeOfFormats;
|
|
|
841
846
|
*/
|
|
842
847
|
declare const DEFAULT_SECRET_ITERATIONS: number;
|
|
843
848
|
|
|
849
|
+
/**
|
|
850
|
+
* Derives an asymmetric keypair *deterministically* from a fixed secret seed
|
|
851
|
+
* using `globalThis.crypto.subtle`, shared by the Node and browser
|
|
852
|
+
* {@link CryptoUtils.ICryptoProvider} implementations (both speak the same
|
|
853
|
+
* WebCrypto API). See
|
|
854
|
+
* {@link CryptoUtils.ICryptoProvider.importKeyPairFromSeed | importKeyPairFromSeed}
|
|
855
|
+
* for the public contract.
|
|
856
|
+
*
|
|
857
|
+
* For each supported algorithm: wraps the 32-byte seed in the RFC 8410 PKCS#8
|
|
858
|
+
* envelope, then runs a transient-extractable-then-derive dance so the public
|
|
859
|
+
* key is recoverable even when the caller requests a non-extractable private key:
|
|
860
|
+
*
|
|
861
|
+
* 1. Import the PKCS#8 as a *transient* extractable private key.
|
|
862
|
+
* 2. Export it to JWK to read the deterministic public coordinate `x`.
|
|
863
|
+
* 3. Import `{ kty: 'OKP', crv, x }` as the returned public key.
|
|
864
|
+
* 4. For the returned private key: reuse the transient key when `extractable`
|
|
865
|
+
* is `true`; otherwise re-import the same PKCS#8 as a non-extractable key.
|
|
866
|
+
* The transient extractable key is never returned when `extractable` is
|
|
867
|
+
* `false`, so seed material cannot escape through it.
|
|
868
|
+
*
|
|
869
|
+
* The two algorithms differ only in the OID/name/curve/usages (see
|
|
870
|
+
* {@link ISeedAlgorithmParams}); `'x25519'` yields the DH key-agreement keypair
|
|
871
|
+
* (private `'deriveBits'`, public no-usage) that {@link CryptoUtils.HpkeProvider}
|
|
872
|
+
* consumes as its recipient key.
|
|
873
|
+
*
|
|
874
|
+
* The seed bytes are copied into a freshly allocated PKCS#8 buffer, so the
|
|
875
|
+
* `BufferSource` handed to WebCrypto is always backed by a plain `ArrayBuffer`
|
|
876
|
+
* (side-stepping the Node-20 `SharedArrayBuffer`-view rejection) and the
|
|
877
|
+
* caller's `seed` is never mutated.
|
|
878
|
+
*
|
|
879
|
+
* @param algorithm - The seed-derivable algorithm (`'ed25519'` or `'x25519'`).
|
|
880
|
+
* Any other value fails loudly rather than being mis-handled.
|
|
881
|
+
* @param seed - The 32-byte secret seed. Any other length fails loudly, before
|
|
882
|
+
* any WebCrypto call.
|
|
883
|
+
* @param extractable - Whether the returned private key may be exported.
|
|
884
|
+
* @returns `Success` with the derived `CryptoKeyPair`, or `Failure` with error context.
|
|
885
|
+
* @public
|
|
886
|
+
*/
|
|
887
|
+
declare function deriveKeyPairFromSeed(algorithm: SeedDerivableAlgorithm, seed: Uint8Array, extractable: boolean): Promise<Result<CryptoKeyPair>>;
|
|
888
|
+
|
|
844
889
|
/**
|
|
845
890
|
* An {@link IEncryptionProvider} that uses a pre-supplied key and crypto provider.
|
|
846
891
|
*
|
|
@@ -1368,6 +1413,34 @@ declare namespace Hash {
|
|
|
1368
1413
|
}
|
|
1369
1414
|
export { Hash }
|
|
1370
1415
|
|
|
1416
|
+
/**
|
|
1417
|
+
* Decodes a hexadecimal string (no `0x` prefix) back to a `Uint8Array`.
|
|
1418
|
+
*
|
|
1419
|
+
* Liberal in what it accepts: both lowercase and uppercase hex digits are
|
|
1420
|
+
* allowed (whereas {@link CryptoUtils.hexEncode} always emits lowercase). The
|
|
1421
|
+
* input must have even length and contain only hex digits (`0-9`, `a-f`, `A-F`);
|
|
1422
|
+
* an empty string decodes to an empty `Uint8Array`. Odd length or any non-hex
|
|
1423
|
+
* character fails with error context.
|
|
1424
|
+
*
|
|
1425
|
+
* @param encoded - The hex string to decode.
|
|
1426
|
+
* @returns `Success` with the decoded bytes, or `Failure` with error context.
|
|
1427
|
+
* @public
|
|
1428
|
+
*/
|
|
1429
|
+
declare function hexDecode(encoded: string): Result<Uint8Array>;
|
|
1430
|
+
|
|
1431
|
+
/**
|
|
1432
|
+
* Encodes a `Uint8Array` as a lowercase hexadecimal string with no `0x` prefix.
|
|
1433
|
+
*
|
|
1434
|
+
* Each byte becomes exactly two lowercase hex characters (zero-padded), so an
|
|
1435
|
+
* `n`-byte input yields a `2n`-character string. An empty input yields the empty
|
|
1436
|
+
* string. This is the inverse of {@link CryptoUtils.hexDecode}.
|
|
1437
|
+
*
|
|
1438
|
+
* @param data - The binary data to encode.
|
|
1439
|
+
* @returns The lowercase, unprefixed hex string.
|
|
1440
|
+
* @public
|
|
1441
|
+
*/
|
|
1442
|
+
declare function hexEncode(data: Uint8Array): string;
|
|
1443
|
+
|
|
1371
1444
|
/**
|
|
1372
1445
|
* HPKE base mode (RFC 9180) — `DHKEM(X25519, HKDF-SHA256) + HKDF-SHA256 + AES-256-GCM`.
|
|
1373
1446
|
*
|
|
@@ -2523,6 +2596,33 @@ declare interface IArgon2idKeyDerivationParams {
|
|
|
2523
2596
|
readonly parallelism: number;
|
|
2524
2597
|
}
|
|
2525
2598
|
|
|
2599
|
+
/**
|
|
2600
|
+
* Optional keyed-hashing inputs for {@link CryptoUtils.IArgon2idProvider.argon2id | argon2id}
|
|
2601
|
+
* (RFC 9106 §3.1). These are distinct from the cost parameters in
|
|
2602
|
+
* {@link CryptoUtils.IArgon2idParams} — they change the derived output but are
|
|
2603
|
+
* not tuning knobs. Both fields are optional; omitting a field (or passing an
|
|
2604
|
+
* empty `Uint8Array`) is a no-op that leaves the output byte-identical to a call
|
|
2605
|
+
* with no options at all.
|
|
2606
|
+
* @public
|
|
2607
|
+
*/
|
|
2608
|
+
declare interface IArgon2idKeyingOptions {
|
|
2609
|
+
/**
|
|
2610
|
+
* Optional secret key K (RFC 9106 keyed hashing, sometimes called a "pepper").
|
|
2611
|
+
* When present and non-empty it is mixed into the hash so that the derived
|
|
2612
|
+
* output cannot be reproduced without also knowing K. Empty or omitted means
|
|
2613
|
+
* no secret. Honored by both the Node and browser backends.
|
|
2614
|
+
*/
|
|
2615
|
+
readonly secret?: Uint8Array;
|
|
2616
|
+
/**
|
|
2617
|
+
* Optional associated data X (RFC 9106 §3.1). When present and non-empty it is
|
|
2618
|
+
* mixed into the hash. **Node-only:** the WASM (`hash-wasm`) browser backend
|
|
2619
|
+
* has no associated-data input, so `BrowserArgon2Provider` fails loudly rather
|
|
2620
|
+
* than silently dropping it (which would produce wrong bytes). Empty or omitted
|
|
2621
|
+
* means no associated data and is accepted by both backends.
|
|
2622
|
+
*/
|
|
2623
|
+
readonly associatedData?: Uint8Array;
|
|
2624
|
+
}
|
|
2625
|
+
|
|
2526
2626
|
/**
|
|
2527
2627
|
* Parameters for Argon2id key derivation (RFC 9106).
|
|
2528
2628
|
* All fields are required; fgv does not pick defaults silently.
|
|
@@ -2570,15 +2670,24 @@ declare interface IArgon2idProvider {
|
|
|
2570
2670
|
/**
|
|
2571
2671
|
* Derives key material from a password using Argon2id (RFC 9106 §3.1).
|
|
2572
2672
|
*
|
|
2573
|
-
* Returns the raw derived bytes as a `Uint8Array`.
|
|
2574
|
-
*
|
|
2673
|
+
* Returns the raw derived bytes as a `Uint8Array`. For the same inputs that
|
|
2674
|
+
* both backends support, the Node and browser implementations produce
|
|
2675
|
+
* byte-identical output. The optional `associatedData` in
|
|
2676
|
+
* {@link CryptoUtils.IArgon2idKeyingOptions} is the one exception: it is
|
|
2677
|
+
* Node-only (the browser WASM backend has no associated-data input), so a call
|
|
2678
|
+
* that supplies non-empty `associatedData` is not portable to the browser
|
|
2679
|
+
* backend. Every input the browser backend *does* support (including the
|
|
2680
|
+
* optional `secret`) is byte-identical across the two.
|
|
2575
2681
|
*
|
|
2576
2682
|
* @param password - Password or passphrase. Accepts string (UTF-8) or raw bytes.
|
|
2577
2683
|
* @param salt - Salt bytes. Must be random and unique per credential (\>= 16 bytes recommended).
|
|
2578
2684
|
* @param params - Argon2id parameters. Use `ARGON2ID_OWASP_MIN` as a starting point.
|
|
2685
|
+
* @param options - Optional {@link CryptoUtils.IArgon2idKeyingOptions | keyed-hashing inputs}
|
|
2686
|
+
* (secret K and/or associated data X). Omitting them (the default) leaves the
|
|
2687
|
+
* output byte-identical to prior behavior.
|
|
2579
2688
|
* @returns Success with derived bytes, Failure with error context.
|
|
2580
2689
|
*/
|
|
2581
|
-
argon2id(password: Uint8Array | string, salt: Uint8Array, params: IArgon2idParams): Promise<Result<Uint8Array>>;
|
|
2690
|
+
argon2id(password: Uint8Array | string, salt: Uint8Array, params: IArgon2idParams, options?: IArgon2idKeyingOptions): Promise<Result<Uint8Array>>;
|
|
2582
2691
|
}
|
|
2583
2692
|
|
|
2584
2693
|
/**
|
|
@@ -2837,6 +2946,31 @@ declare interface ICryptoProvider {
|
|
|
2837
2946
|
* @returns Success with the generated `CryptoKeyPair`, or Failure with error context.
|
|
2838
2947
|
*/
|
|
2839
2948
|
generateKeyPair(algorithm: KeyPairAlgorithm, extractable: boolean): Promise<Result<CryptoKeyPair>>;
|
|
2949
|
+
/**
|
|
2950
|
+
* Derives an asymmetric keypair *deterministically* from a fixed secret seed.
|
|
2951
|
+
* The same `seed` always yields the same keypair on every runtime, so this is
|
|
2952
|
+
* the primitive to use when a keypair must be reconstructable from stored seed
|
|
2953
|
+
* material (key escrow, HD-style derivation, deterministic test vectors) rather
|
|
2954
|
+
* than freshly sampled by {@link CryptoUtils.ICryptoProvider.generateKeyPair | generateKeyPair}.
|
|
2955
|
+
*
|
|
2956
|
+
* For both `'ed25519'` and `'x25519'` the private key *is* its 32-byte seed and
|
|
2957
|
+
* the public key is a deterministic function of that seed (RFC 8032 / RFC 7748),
|
|
2958
|
+
* so the returned public key is recovered even when the caller requests a
|
|
2959
|
+
* non-extractable private key. The transient extractable key used internally to
|
|
2960
|
+
* recover the public half is never returned or logged when `extractable` is
|
|
2961
|
+
* `false`. The returned keys carry the algorithm's usages: `'ed25519'` →
|
|
2962
|
+
* private `'sign'` / public `'verify'`; `'x25519'` → private `'deriveBits'` /
|
|
2963
|
+
* public no-usage (ready to hand to {@link CryptoUtils.HpkeProvider}).
|
|
2964
|
+
* @param algorithm - The {@link CryptoUtils.SeedDerivableAlgorithm | seed-derivable algorithm}
|
|
2965
|
+
* (`'ed25519'` or `'x25519'`); any other value fails loudly with context.
|
|
2966
|
+
* @param seed - The secret seed. It must be exactly 32 bytes for both supported
|
|
2967
|
+
* algorithms; any other length fails loudly, before any WebCrypto call. The
|
|
2968
|
+
* bytes are copied, not retained or mutated.
|
|
2969
|
+
* @param extractable - Whether the returned private key may be exported. The
|
|
2970
|
+
* returned public key is identical for a given seed regardless of this flag.
|
|
2971
|
+
* @returns Success with the derived `CryptoKeyPair`, or Failure with error context.
|
|
2972
|
+
*/
|
|
2973
|
+
importKeyPairFromSeed(algorithm: SeedDerivableAlgorithm, seed: Uint8Array, extractable: boolean): Promise<Result<CryptoKeyPair>>;
|
|
2840
2974
|
/**
|
|
2841
2975
|
* Exports the public half of a keypair as a JSON Web Key.
|
|
2842
2976
|
* @param publicKey - The public `CryptoKey` to export. Must be an `extractable`
|
|
@@ -3511,6 +3645,19 @@ declare interface IImportKeyOptions extends IImportSecretOptions {
|
|
|
3511
3645
|
readonly type?: KeyStoreSymmetricSecretType;
|
|
3512
3646
|
}
|
|
3513
3647
|
|
|
3648
|
+
/**
|
|
3649
|
+
* Options for importing raw opaque bytes via {@link KeyStore.importSecretBytes}.
|
|
3650
|
+
* Extends {@link IImportSecretOptions} with optional initial metadata.
|
|
3651
|
+
* @public
|
|
3652
|
+
*/
|
|
3653
|
+
declare interface IImportSecretBytesOptions extends IImportSecretOptions {
|
|
3654
|
+
/**
|
|
3655
|
+
* Optional initial mutable metadata to store with the entry. Can also be set
|
|
3656
|
+
* or replaced later via {@link KeyStore.setSecretMetadata}.
|
|
3657
|
+
*/
|
|
3658
|
+
readonly metadata?: JsonValue;
|
|
3659
|
+
}
|
|
3660
|
+
|
|
3514
3661
|
/**
|
|
3515
3662
|
* Options for importing a secret.
|
|
3516
3663
|
* @public
|
|
@@ -3791,16 +3938,36 @@ declare interface IKeyStoreSymmetricEntry {
|
|
|
3791
3938
|
* The secret data.
|
|
3792
3939
|
* - For `'encryption-key'`: 32-byte AES-256 key.
|
|
3793
3940
|
* - For `'api-key'`: UTF-8 encoded API key string (arbitrary length).
|
|
3941
|
+
* - For `'opaque'`: arbitrary raw bytes, stored and returned verbatim.
|
|
3794
3942
|
*/
|
|
3795
3943
|
readonly key: Uint8Array;
|
|
3796
3944
|
/**
|
|
3797
3945
|
* Optional description for this secret.
|
|
3798
3946
|
*/
|
|
3799
3947
|
readonly description?: string;
|
|
3948
|
+
/**
|
|
3949
|
+
* Optional mutable, non-secret-by-contract metadata for this entry. Set via
|
|
3950
|
+
* {@link CryptoUtils.KeyStore.KeyStore.setSecretMetadata} without touching the
|
|
3951
|
+
* secret `key` bytes.
|
|
3952
|
+
*
|
|
3953
|
+
* "Non-secret by contract" means the field is intended for lifecycle metadata
|
|
3954
|
+
* (rotation timestamps, labels, provenance) rather than secret material.
|
|
3955
|
+
* PHYSICALLY it lives inside the vault's AES-GCM ciphertext alongside the key
|
|
3956
|
+
* bytes — the vault has no plaintext index — so it is protected at rest by the
|
|
3957
|
+
* master password; the "non-secret" designation is a usage contract, not a
|
|
3958
|
+
* weaker custody class.
|
|
3959
|
+
*/
|
|
3960
|
+
readonly metadata?: JsonValue;
|
|
3800
3961
|
/**
|
|
3801
3962
|
* When this secret was added (ISO 8601).
|
|
3802
3963
|
*/
|
|
3803
3964
|
readonly createdAt: string;
|
|
3965
|
+
/**
|
|
3966
|
+
* When this entry was last mutated (ISO 8601). Stamped on any metadata
|
|
3967
|
+
* mutation (see {@link CryptoUtils.KeyStore.KeyStore.setSecretMetadata}).
|
|
3968
|
+
* Absent on entries that have never been mutated since creation.
|
|
3969
|
+
*/
|
|
3970
|
+
readonly updatedAt?: string;
|
|
3804
3971
|
}
|
|
3805
3972
|
|
|
3806
3973
|
/**
|
|
@@ -3840,10 +4007,22 @@ declare interface IKeyStoreSymmetricEntryJson {
|
|
|
3840
4007
|
* Optional description.
|
|
3841
4008
|
*/
|
|
3842
4009
|
readonly description?: string;
|
|
4010
|
+
/**
|
|
4011
|
+
* Optional mutable, non-secret-by-contract metadata for this entry. Present
|
|
4012
|
+
* only on `'keystore-v3'` vaults whose entry carried metadata; a v1/v2 vault
|
|
4013
|
+
* omits the field. Physically carried inside the vault ciphertext (the vault
|
|
4014
|
+
* has no plaintext index).
|
|
4015
|
+
*/
|
|
4016
|
+
readonly metadata?: JsonValue;
|
|
3843
4017
|
/**
|
|
3844
4018
|
* When this secret was added (ISO 8601).
|
|
3845
4019
|
*/
|
|
3846
4020
|
readonly createdAt: string;
|
|
4021
|
+
/**
|
|
4022
|
+
* When this entry was last mutated (ISO 8601). Present only on `'keystore-v3'`
|
|
4023
|
+
* vaults whose entry has been mutated since creation.
|
|
4024
|
+
*/
|
|
4025
|
+
readonly updatedAt?: string;
|
|
3847
4026
|
}
|
|
3848
4027
|
|
|
3849
4028
|
/**
|
|
@@ -4800,6 +4979,7 @@ declare namespace KeyStore {
|
|
|
4800
4979
|
IAddSecretOptions,
|
|
4801
4980
|
IImportSecretOptions,
|
|
4802
4981
|
IImportKeyOptions,
|
|
4982
|
+
IImportSecretBytesOptions,
|
|
4803
4983
|
IAddSecretFromPasswordOptions,
|
|
4804
4984
|
DEFAULT_SECRET_ITERATIONS,
|
|
4805
4985
|
IAddSecretFromPasswordResult,
|
|
@@ -5120,6 +5300,50 @@ declare class KeyStore_2 implements IEncryptionProvider {
|
|
|
5120
5300
|
* @public
|
|
5121
5301
|
*/
|
|
5122
5302
|
getApiKey(name: string): Result<string>;
|
|
5303
|
+
/**
|
|
5304
|
+
* Imports arbitrary raw bytes into the vault with type `'opaque'`.
|
|
5305
|
+
*
|
|
5306
|
+
* Unlike {@link KeyStore.importSecret} (which enforces a 32-byte AES-256 key)
|
|
5307
|
+
* and {@link KeyStore.importApiKey} (which UTF-8 encodes a string), this
|
|
5308
|
+
* accepts a byte buffer of any length and stores it verbatim — including
|
|
5309
|
+
* embedded NUL bytes. Use it for byte blobs that are neither a fixed-size key
|
|
5310
|
+
* nor a UTF-8 string (e.g. a serialized credential bundle), so they are not
|
|
5311
|
+
* mistyped as `'api-key'`.
|
|
5312
|
+
*
|
|
5313
|
+
* @param name - Unique name for the secret
|
|
5314
|
+
* @param bytes - The raw bytes to store
|
|
5315
|
+
* @param options - Optional description, initial metadata, whether to replace existing
|
|
5316
|
+
* @returns Success with entry, Failure if locked, empty, or exists and !replace
|
|
5317
|
+
* @public
|
|
5318
|
+
*/
|
|
5319
|
+
importSecretBytes(name: string, bytes: Uint8Array, options?: IImportSecretBytesOptions): Promise<Result<IAddSecretResult>>;
|
|
5320
|
+
/**
|
|
5321
|
+
* Retrieves the raw stored bytes for a symmetric entry, returned verbatim
|
|
5322
|
+
* (never UTF-8 decoded). Intended for `'opaque'` entries but works for any
|
|
5323
|
+
* symmetric type; asymmetric-keypair entries carry no raw key material and
|
|
5324
|
+
* are rejected.
|
|
5325
|
+
*
|
|
5326
|
+
* @param name - Name of the secret
|
|
5327
|
+
* @returns Success with a copy of the stored bytes, Failure if not found,
|
|
5328
|
+
* locked, or the entry is asymmetric
|
|
5329
|
+
* @public
|
|
5330
|
+
*/
|
|
5331
|
+
getSecretBytes(name: string): Result<Uint8Array>;
|
|
5332
|
+
/**
|
|
5333
|
+
* Replaces the mutable metadata on a symmetric entry and stamps `updatedAt`
|
|
5334
|
+
* with the current timestamp. Does NOT touch the secret `key` bytes — the
|
|
5335
|
+
* material reads back identically afterward.
|
|
5336
|
+
*
|
|
5337
|
+
* Metadata is non-secret by contract but physically lives inside the vault
|
|
5338
|
+
* ciphertext (see {@link CryptoUtils.KeyStore.IKeyStoreSymmetricEntry.metadata}).
|
|
5339
|
+
*
|
|
5340
|
+
* @param name - Name of the secret to update
|
|
5341
|
+
* @param value - New metadata value (replaces any prior metadata)
|
|
5342
|
+
* @returns Success with the updated entry, Failure if not found, locked, or
|
|
5343
|
+
* the entry is asymmetric
|
|
5344
|
+
* @public
|
|
5345
|
+
*/
|
|
5346
|
+
setSecretMetadata(name: string, value: JsonValue): Result<IKeyStoreSymmetricEntry>;
|
|
5123
5347
|
/**
|
|
5124
5348
|
* Adds a new asymmetric keypair to the vault. Storage-first: the private key
|
|
5125
5349
|
* is stored under a freshly-minted `id` before the public-key vault entry is
|
|
@@ -5305,7 +5529,7 @@ declare class KeyStore_2 implements IEncryptionProvider {
|
|
|
5305
5529
|
}
|
|
5306
5530
|
|
|
5307
5531
|
/**
|
|
5308
|
-
* Current format version constant. New vaults are written as `'keystore-
|
|
5532
|
+
* Current format version constant. New vaults are written as `'keystore-v3'`.
|
|
5309
5533
|
* @public
|
|
5310
5534
|
*/
|
|
5311
5535
|
declare const KEYSTORE_FORMAT: KeyStoreFormat;
|
|
@@ -5349,9 +5573,14 @@ declare const keystoreFile: Converter<IKeyStoreFile>;
|
|
|
5349
5573
|
* asymmetric-keypair entries. A strict superset of v1 — the field is
|
|
5350
5574
|
* optional, so a v2 reader opens a v1 vault with no special-casing, and a
|
|
5351
5575
|
* v1 vault opened and re-saved is silently upgraded to v2.
|
|
5576
|
+
* - `'keystore-v3'`: adds the `'opaque'` symmetric secret type and the optional
|
|
5577
|
+
* `metadata` / `updatedAt` fields on symmetric entries. A strict superset of
|
|
5578
|
+
* v1/v2 — the additions are optional (and `'opaque'` is simply a new enum
|
|
5579
|
+
* value), so a v3 reader opens a v1/v2 vault with no special-casing, and a
|
|
5580
|
+
* v1/v2 vault opened and re-saved is silently upgraded to v3.
|
|
5352
5581
|
* @public
|
|
5353
5582
|
*/
|
|
5354
|
-
declare type KeyStoreFormat = 'keystore-v1' | 'keystore-v2';
|
|
5583
|
+
declare type KeyStoreFormat = 'keystore-v1' | 'keystore-v2' | 'keystore-v3';
|
|
5355
5584
|
|
|
5356
5585
|
/**
|
|
5357
5586
|
* Converter for {@link CryptoUtils.KeyStore.KeyStoreFormat | key store format} version.
|
|
@@ -5409,13 +5638,17 @@ declare const keystoreSymmetricEntryJson: Converter<IKeyStoreSymmetricEntryJson>
|
|
|
5409
5638
|
* Discriminator for symmetric secret types stored in the vault.
|
|
5410
5639
|
* - `'encryption-key'`: A 32-byte AES-256 encryption key.
|
|
5411
5640
|
* - `'api-key'`: An arbitrary-length API key string (UTF-8 encoded).
|
|
5641
|
+
* - `'opaque'`: Arbitrary raw bytes with no encoding contract — stored and
|
|
5642
|
+
* returned verbatim (never UTF-8 decoded). Use for byte blobs that are
|
|
5643
|
+
* neither a fixed-size AES key nor a UTF-8 string (e.g. a serialized
|
|
5644
|
+
* credential bundle), so they are not mistyped as `'api-key'`.
|
|
5412
5645
|
* @public
|
|
5413
5646
|
*/
|
|
5414
|
-
declare type KeyStoreSymmetricSecretType = 'encryption-key' | 'api-key';
|
|
5647
|
+
declare type KeyStoreSymmetricSecretType = 'encryption-key' | 'api-key' | 'opaque';
|
|
5415
5648
|
|
|
5416
5649
|
/**
|
|
5417
5650
|
* Converter for {@link CryptoUtils.KeyStore.KeyStoreSymmetricSecretType | symmetric secret type} discriminator.
|
|
5418
|
-
* Accepts
|
|
5651
|
+
* Accepts `'encryption-key'`, `'api-key'`, and `'opaque'`.
|
|
5419
5652
|
* @public
|
|
5420
5653
|
*/
|
|
5421
5654
|
declare const keystoreSymmetricSecretType: Converter<KeyStoreSymmetricSecretType>;
|
|
@@ -5763,6 +5996,14 @@ declare class NodeCryptoProvider implements ICryptoProvider {
|
|
|
5763
5996
|
* @returns `Success` with the generated `CryptoKeyPair`, or `Failure` with an error.
|
|
5764
5997
|
*/
|
|
5765
5998
|
generateKeyPair(algorithm: KeyPairAlgorithm, extractable: boolean): Promise<Result<CryptoKeyPair>>;
|
|
5999
|
+
/**
|
|
6000
|
+
* Derives an asymmetric keypair deterministically from a fixed secret seed.
|
|
6001
|
+
* @param algorithm - The seed-derivable algorithm (only `'ed25519'` today).
|
|
6002
|
+
* @param seed - The 32-byte secret seed.
|
|
6003
|
+
* @param extractable - Whether the returned private key may be exported.
|
|
6004
|
+
* @returns `Success` with the derived `CryptoKeyPair`, or `Failure` with an error.
|
|
6005
|
+
*/
|
|
6006
|
+
importKeyPairFromSeed(algorithm: SeedDerivableAlgorithm, seed: Uint8Array, extractable: boolean): Promise<Result<CryptoKeyPair>>;
|
|
5766
6007
|
/**
|
|
5767
6008
|
* Exports a public `CryptoKey` as a JSON Web Key.
|
|
5768
6009
|
* @remarks
|
|
@@ -6214,6 +6455,28 @@ declare function resolveProviderModel(descriptor: IAiProviderDescriptor, modelOv
|
|
|
6214
6455
|
*/
|
|
6215
6456
|
declare type SecretProvider = (secretName: string) => Promise<Result<Uint8Array>>;
|
|
6216
6457
|
|
|
6458
|
+
/**
|
|
6459
|
+
* The subset of {@link CryptoUtils.KeyPairAlgorithm} whose keypair can be
|
|
6460
|
+
* derived *deterministically* from a fixed secret seed, for use with
|
|
6461
|
+
* {@link CryptoUtils.ICryptoProvider.importKeyPairFromSeed | importKeyPairFromSeed}.
|
|
6462
|
+
*
|
|
6463
|
+
* Two algorithms are supported, both of whose 32-byte private scalar *is* the
|
|
6464
|
+
* seed and whose public key is a deterministic function of it, so the same seed
|
|
6465
|
+
* always yields the same keypair on every runtime:
|
|
6466
|
+
* - `'ed25519'` — signing keypair (RFC 8032). Private usage `'sign'`, public
|
|
6467
|
+
* usage `'verify'`.
|
|
6468
|
+
* - `'x25519'` — Diffie-Hellman key-agreement keypair (RFC 7748), the recipient
|
|
6469
|
+
* keypair consumed by {@link CryptoUtils.HpkeProvider}. Private usage
|
|
6470
|
+
* `'deriveBits'`, public key imported with no usages. Deriving a fixed X25519
|
|
6471
|
+
* recipient keypair from a checked-in seed is what makes a deterministic HPKE
|
|
6472
|
+
* seal/open round-trip vector possible.
|
|
6473
|
+
*
|
|
6474
|
+
* The type is a proper subset of {@link CryptoUtils.KeyPairAlgorithm} because
|
|
6475
|
+
* algorithms like RSA or the NIST curves are not recoverable from a bare seed.
|
|
6476
|
+
* @public
|
|
6477
|
+
*/
|
|
6478
|
+
declare type SeedDerivableAlgorithm = 'ed25519' | 'x25519';
|
|
6479
|
+
|
|
6217
6480
|
/**
|
|
6218
6481
|
* Default system-prompt suffix appended when {@link AiAssist.IGenerateJsonCompletionParams.promptHint}
|
|
6219
6482
|
* is `'smart'` (the default). Designed to discourage code fences and prose in
|
|
@@ -11,7 +11,8 @@ import * as Converters from './converters';
|
|
|
11
11
|
export { Converters };
|
|
12
12
|
export { DirectEncryptionProvider, IDirectEncryptionProviderParams } from './directEncryptionProvider';
|
|
13
13
|
export { IKeyPairAlgorithmParams, keyPairAlgorithmParams } from './keyPairAlgorithmParams';
|
|
14
|
+
export { deriveKeyPairFromSeed } from './seedDerivedKeyPair';
|
|
14
15
|
export { createEncryptedFile, decryptFile, fromBase64, ICreateEncryptedFileParams, toBase64, tryDecryptFile } from './encryptedFile';
|
|
15
|
-
export { base64UrlNoPadDecode, base64UrlNoPadEncode, exportPublicKeyAsMultibaseSpki, importPublicKeyFromMultibaseSpki, isValidMultibaseSpkiPublicKey, MultibaseSpkiPublicKeyRegExp, multibaseBase64UrlDecode, multibaseBase64UrlEncode, spkiToRawX25519 } from './spkiHelpers';
|
|
16
|
+
export { base64UrlNoPadDecode, base64UrlNoPadEncode, exportPublicKeyAsMultibaseSpki, hexDecode, hexEncode, importPublicKeyFromMultibaseSpki, isValidMultibaseSpkiPublicKey, MultibaseSpkiPublicKeyRegExp, multibaseBase64UrlDecode, multibaseBase64UrlEncode, spkiToRawX25519 } from './spkiHelpers';
|
|
16
17
|
export { HpkeProvider, IHpkeSealResult } from './hpkeProvider';
|
|
17
18
|
//# sourceMappingURL=index.browser.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.browser.d.ts","sourceRoot":"","sources":["../../../src/packlets/crypto-utils/index.browser.ts"],"names":[],"mappings":"AAoBA;;;;GAIG;AAGH,cAAc,SAAS,CAAC;AAGxB,OAAO,EACL,gBAAgB,EAChB,iBAAiB,EACjB,qBAAqB,EACrB,iBAAiB,EACjB,WAAW,EACZ,MAAM,aAAa,CAAC;AAIrB,OAAO,KAAK,QAAQ,MAAM,0BAA0B,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,CAAC;AAGpB,OAAO,KAAK,UAAU,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,CAAC;AAGtB,OAAO,EAAE,wBAAwB,EAAE,+BAA+B,EAAE,MAAM,4BAA4B,CAAC;AAGvG,OAAO,EAAE,uBAAuB,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"index.browser.d.ts","sourceRoot":"","sources":["../../../src/packlets/crypto-utils/index.browser.ts"],"names":[],"mappings":"AAoBA;;;;GAIG;AAGH,cAAc,SAAS,CAAC;AAGxB,OAAO,EACL,gBAAgB,EAChB,iBAAiB,EACjB,qBAAqB,EACrB,iBAAiB,EACjB,WAAW,EACZ,MAAM,aAAa,CAAC;AAIrB,OAAO,KAAK,QAAQ,MAAM,0BAA0B,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,CAAC;AAGpB,OAAO,KAAK,UAAU,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,CAAC;AAGtB,OAAO,EAAE,wBAAwB,EAAE,+BAA+B,EAAE,MAAM,4BAA4B,CAAC;AAGvG,OAAO,EAAE,uBAAuB,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAI3F,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAM7D,OAAO,EACL,mBAAmB,EACnB,WAAW,EACX,UAAU,EACV,0BAA0B,EAC1B,QAAQ,EACR,cAAc,EACf,MAAM,iBAAiB,CAAC;AAGzB,OAAO,EACL,oBAAoB,EACpB,oBAAoB,EACpB,8BAA8B,EAC9B,SAAS,EACT,SAAS,EACT,gCAAgC,EAChC,6BAA6B,EAC7B,4BAA4B,EAC5B,wBAAwB,EACxB,wBAAwB,EACxB,eAAe,EAChB,MAAM,eAAe,CAAC;AAIvB,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC"}
|
|
@@ -55,7 +55,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
55
55
|
};
|
|
56
56
|
})();
|
|
57
57
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
58
|
-
exports.HpkeProvider = exports.spkiToRawX25519 = exports.multibaseBase64UrlEncode = exports.multibaseBase64UrlDecode = exports.MultibaseSpkiPublicKeyRegExp = exports.isValidMultibaseSpkiPublicKey = exports.importPublicKeyFromMultibaseSpki = exports.exportPublicKeyAsMultibaseSpki = exports.base64UrlNoPadEncode = exports.base64UrlNoPadDecode = exports.tryDecryptFile = exports.toBase64 = exports.fromBase64 = exports.decryptFile = exports.createEncryptedFile = exports.keyPairAlgorithmParams = exports.DirectEncryptionProvider = exports.Converters = exports.KeyStore = exports.GCM_IV_SIZE = exports.GCM_AUTH_TAG_SIZE = exports.ENCRYPTED_FILE_FORMAT = exports.DEFAULT_ALGORITHM = exports.AES_256_KEY_SIZE = void 0;
|
|
58
|
+
exports.HpkeProvider = exports.spkiToRawX25519 = exports.multibaseBase64UrlEncode = exports.multibaseBase64UrlDecode = exports.MultibaseSpkiPublicKeyRegExp = exports.isValidMultibaseSpkiPublicKey = exports.importPublicKeyFromMultibaseSpki = exports.hexEncode = exports.hexDecode = exports.exportPublicKeyAsMultibaseSpki = exports.base64UrlNoPadEncode = exports.base64UrlNoPadDecode = exports.tryDecryptFile = exports.toBase64 = exports.fromBase64 = exports.decryptFile = exports.createEncryptedFile = exports.deriveKeyPairFromSeed = exports.keyPairAlgorithmParams = exports.DirectEncryptionProvider = exports.Converters = exports.KeyStore = exports.GCM_IV_SIZE = exports.GCM_AUTH_TAG_SIZE = exports.ENCRYPTED_FILE_FORMAT = exports.DEFAULT_ALGORITHM = exports.AES_256_KEY_SIZE = void 0;
|
|
59
59
|
/**
|
|
60
60
|
* Crypto utilities for encrypted file handling and key management (browser version).
|
|
61
61
|
* Note: For browser crypto provider, use \@fgv/ts-web-extras.
|
|
@@ -83,6 +83,10 @@ Object.defineProperty(exports, "DirectEncryptionProvider", { enumerable: true, g
|
|
|
83
83
|
// WebCrypto parameter table for asymmetric keypair algorithms
|
|
84
84
|
var keyPairAlgorithmParams_1 = require("./keyPairAlgorithmParams");
|
|
85
85
|
Object.defineProperty(exports, "keyPairAlgorithmParams", { enumerable: true, get: function () { return keyPairAlgorithmParams_1.keyPairAlgorithmParams; } });
|
|
86
|
+
// Deterministic seed → keypair derivation shared by the Node/browser providers
|
|
87
|
+
// (globalThis.crypto.subtle only — no node:crypto, safe in the browser entry point)
|
|
88
|
+
var seedDerivedKeyPair_1 = require("./seedDerivedKeyPair");
|
|
89
|
+
Object.defineProperty(exports, "deriveKeyPairFromSeed", { enumerable: true, get: function () { return seedDerivedKeyPair_1.deriveKeyPairFromSeed; } });
|
|
86
90
|
// Note: NodeCryptoProvider is NOT exported in browser version
|
|
87
91
|
// Use BrowserCryptoProvider from @fgv/ts-web-extras instead
|
|
88
92
|
// Encrypted file helpers
|
|
@@ -97,6 +101,8 @@ var spkiHelpers_1 = require("./spkiHelpers");
|
|
|
97
101
|
Object.defineProperty(exports, "base64UrlNoPadDecode", { enumerable: true, get: function () { return spkiHelpers_1.base64UrlNoPadDecode; } });
|
|
98
102
|
Object.defineProperty(exports, "base64UrlNoPadEncode", { enumerable: true, get: function () { return spkiHelpers_1.base64UrlNoPadEncode; } });
|
|
99
103
|
Object.defineProperty(exports, "exportPublicKeyAsMultibaseSpki", { enumerable: true, get: function () { return spkiHelpers_1.exportPublicKeyAsMultibaseSpki; } });
|
|
104
|
+
Object.defineProperty(exports, "hexDecode", { enumerable: true, get: function () { return spkiHelpers_1.hexDecode; } });
|
|
105
|
+
Object.defineProperty(exports, "hexEncode", { enumerable: true, get: function () { return spkiHelpers_1.hexEncode; } });
|
|
100
106
|
Object.defineProperty(exports, "importPublicKeyFromMultibaseSpki", { enumerable: true, get: function () { return spkiHelpers_1.importPublicKeyFromMultibaseSpki; } });
|
|
101
107
|
Object.defineProperty(exports, "isValidMultibaseSpkiPublicKey", { enumerable: true, get: function () { return spkiHelpers_1.isValidMultibaseSpkiPublicKey; } });
|
|
102
108
|
Object.defineProperty(exports, "MultibaseSpkiPublicKeyRegExp", { enumerable: true, get: function () { return spkiHelpers_1.MultibaseSpkiPublicKeyRegExp; } });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.browser.js","sourceRoot":"","sources":["../../../src/packlets/crypto-utils/index.browser.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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEZ;;;;GAIG;AAEH,iCAAiC;AACjC,0CAAwB;AAExB,YAAY;AACZ,yCAMqB;AALnB,6GAAA,gBAAgB,OAAA;AAChB,8GAAA,iBAAiB,OAAA;AACjB,kHAAA,qBAAqB,OAAA;AACrB,8GAAA,iBAAiB,OAAA;AACjB,wGAAA,WAAW,OAAA;AAGb,gEAAgE;AAChE,iFAAiF;AACjF,mEAAqD;AAC5C,4BAAQ;AAEjB,uBAAuB;AACvB,yDAA2C;AAClC,gCAAU;AAEnB,6BAA6B;AAC7B,uEAAuG;AAA9F,oIAAA,wBAAwB,OAAA;AAEjC,8DAA8D;AAC9D,mEAA2F;AAAzD,gIAAA,sBAAsB,OAAA;AAExD,8DAA8D;AAC9D,4DAA4D;AAE5D,yBAAyB;AACzB,iDAOyB;AANvB,oHAAA,mBAAmB,OAAA;AACnB,4GAAA,WAAW,OAAA;AACX,2GAAA,UAAU,OAAA;AAEV,yGAAA,QAAQ,OAAA;AACR,+GAAA,cAAc,OAAA;AAGhB,qCAAqC;AACrC,
|
|
1
|
+
{"version":3,"file":"index.browser.js","sourceRoot":"","sources":["../../../src/packlets/crypto-utils/index.browser.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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEZ;;;;GAIG;AAEH,iCAAiC;AACjC,0CAAwB;AAExB,YAAY;AACZ,yCAMqB;AALnB,6GAAA,gBAAgB,OAAA;AAChB,8GAAA,iBAAiB,OAAA;AACjB,kHAAA,qBAAqB,OAAA;AACrB,8GAAA,iBAAiB,OAAA;AACjB,wGAAA,WAAW,OAAA;AAGb,gEAAgE;AAChE,iFAAiF;AACjF,mEAAqD;AAC5C,4BAAQ;AAEjB,uBAAuB;AACvB,yDAA2C;AAClC,gCAAU;AAEnB,6BAA6B;AAC7B,uEAAuG;AAA9F,oIAAA,wBAAwB,OAAA;AAEjC,8DAA8D;AAC9D,mEAA2F;AAAzD,gIAAA,sBAAsB,OAAA;AAExD,+EAA+E;AAC/E,oFAAoF;AACpF,2DAA6D;AAApD,2HAAA,qBAAqB,OAAA;AAE9B,8DAA8D;AAC9D,4DAA4D;AAE5D,yBAAyB;AACzB,iDAOyB;AANvB,oHAAA,mBAAmB,OAAA;AACnB,4GAAA,WAAW,OAAA;AACX,2GAAA,UAAU,OAAA;AAEV,yGAAA,QAAQ,OAAA;AACR,+GAAA,cAAc,OAAA;AAGhB,qCAAqC;AACrC,6CAYuB;AAXrB,mHAAA,oBAAoB,OAAA;AACpB,mHAAA,oBAAoB,OAAA;AACpB,6HAAA,8BAA8B,OAAA;AAC9B,wGAAA,SAAS,OAAA;AACT,wGAAA,SAAS,OAAA;AACT,+HAAA,gCAAgC,OAAA;AAChC,4HAAA,6BAA6B,OAAA;AAC7B,2HAAA,4BAA4B,OAAA;AAC5B,uHAAA,wBAAwB,OAAA;AACxB,uHAAA,wBAAwB,OAAA;AACxB,8GAAA,eAAe,OAAA;AAGjB,qFAAqF;AACrF,uFAAuF;AACvF,+CAA+D;AAAtD,4GAAA,YAAY,OAAA","sourcesContent":["// Copyright (c) 2024 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\n/**\n * Crypto utilities for encrypted file handling and key management (browser version).\n * Note: For browser crypto provider, use \\@fgv/ts-web-extras.\n * @packageDocumentation\n */\n\n// Re-export all types from model\nexport * from './model';\n\n// Constants\nexport {\n AES_256_KEY_SIZE,\n DEFAULT_ALGORITHM,\n ENCRYPTED_FILE_FORMAT,\n GCM_AUTH_TAG_SIZE,\n GCM_IV_SIZE\n} from './constants';\n\n// KeyStore namespace (browser-safe barrel — omits the Node-only\n// EncryptedFilePrivateKeyStorage so the browser entry stays free of node:crypto)\nimport * as KeyStore from './keystore/index.browser';\nexport { KeyStore };\n\n// Converters namespace\nimport * as Converters from './converters';\nexport { Converters };\n\n// Direct encryption provider\nexport { DirectEncryptionProvider, IDirectEncryptionProviderParams } from './directEncryptionProvider';\n\n// WebCrypto parameter table for asymmetric keypair algorithms\nexport { IKeyPairAlgorithmParams, keyPairAlgorithmParams } from './keyPairAlgorithmParams';\n\n// Deterministic seed → keypair derivation shared by the Node/browser providers\n// (globalThis.crypto.subtle only — no node:crypto, safe in the browser entry point)\nexport { deriveKeyPairFromSeed } from './seedDerivedKeyPair';\n\n// Note: NodeCryptoProvider is NOT exported in browser version\n// Use BrowserCryptoProvider from @fgv/ts-web-extras instead\n\n// Encrypted file helpers\nexport {\n createEncryptedFile,\n decryptFile,\n fromBase64,\n ICreateEncryptedFileParams,\n toBase64,\n tryDecryptFile\n} from './encryptedFile';\n\n// Multibase/SPKI + base64url helpers\nexport {\n base64UrlNoPadDecode,\n base64UrlNoPadEncode,\n exportPublicKeyAsMultibaseSpki,\n hexDecode,\n hexEncode,\n importPublicKeyFromMultibaseSpki,\n isValidMultibaseSpkiPublicKey,\n MultibaseSpkiPublicKeyRegExp,\n multibaseBase64UrlDecode,\n multibaseBase64UrlEncode,\n spkiToRawX25519\n} from './spkiHelpers';\n\n// HPKE base mode (RFC 9180) — DHKEM(X25519, HKDF-SHA256) + HKDF-SHA256 + AES-256-GCM\n// hpkeProvider.ts has no Node-specific imports and is safe in the browser entry point.\nexport { HpkeProvider, IHpkeSealResult } from './hpkeProvider';\n"]}
|
|
@@ -11,8 +11,9 @@ import * as Converters from './converters';
|
|
|
11
11
|
export { Converters };
|
|
12
12
|
export { DirectEncryptionProvider, IDirectEncryptionProviderParams } from './directEncryptionProvider';
|
|
13
13
|
export { IKeyPairAlgorithmParams, keyPairAlgorithmParams } from './keyPairAlgorithmParams';
|
|
14
|
+
export { deriveKeyPairFromSeed } from './seedDerivedKeyPair';
|
|
14
15
|
export { NodeCryptoProvider, nodeCryptoProvider } from './nodeCryptoProvider';
|
|
15
16
|
export { createEncryptedFile, decryptFile, fromBase64, ICreateEncryptedFileParams, toBase64, tryDecryptFile } from './encryptedFile';
|
|
16
|
-
export { base64UrlNoPadDecode, base64UrlNoPadEncode, exportPublicKeyAsMultibaseSpki, importPublicKeyFromMultibaseSpki, isValidMultibaseSpkiPublicKey, MultibaseSpkiPublicKeyRegExp, multibaseBase64UrlDecode, multibaseBase64UrlEncode, spkiToRawX25519 } from './spkiHelpers';
|
|
17
|
+
export { base64UrlNoPadDecode, base64UrlNoPadEncode, exportPublicKeyAsMultibaseSpki, hexDecode, hexEncode, importPublicKeyFromMultibaseSpki, isValidMultibaseSpkiPublicKey, MultibaseSpkiPublicKeyRegExp, multibaseBase64UrlDecode, multibaseBase64UrlEncode, spkiToRawX25519 } from './spkiHelpers';
|
|
17
18
|
export { HpkeProvider, IHpkeSealResult } from './hpkeProvider';
|
|
18
19
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/packlets/crypto-utils/index.ts"],"names":[],"mappings":"AAoBA;;;GAGG;AAGH,cAAc,SAAS,CAAC;AAGxB,OAAO,KAAK,SAAS,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,CAAC;AAGrB,OAAO,KAAK,QAAQ,MAAM,YAAY,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,CAAC;AAGpB,OAAO,KAAK,UAAU,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,CAAC;AAGtB,OAAO,EAAE,wBAAwB,EAAE,+BAA+B,EAAE,MAAM,4BAA4B,CAAC;AAGvG,OAAO,EAAE,uBAAuB,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAG3F,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAG9E,OAAO,EACL,mBAAmB,EACnB,WAAW,EACX,UAAU,EACV,0BAA0B,EAC1B,QAAQ,EACR,cAAc,EACf,MAAM,iBAAiB,CAAC;AAGzB,OAAO,EACL,oBAAoB,EACpB,oBAAoB,EACpB,8BAA8B,EAC9B,gCAAgC,EAChC,6BAA6B,EAC7B,4BAA4B,EAC5B,wBAAwB,EACxB,wBAAwB,EACxB,eAAe,EAChB,MAAM,eAAe,CAAC;AAGvB,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/packlets/crypto-utils/index.ts"],"names":[],"mappings":"AAoBA;;;GAGG;AAGH,cAAc,SAAS,CAAC;AAGxB,OAAO,KAAK,SAAS,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,CAAC;AAGrB,OAAO,KAAK,QAAQ,MAAM,YAAY,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,CAAC;AAGpB,OAAO,KAAK,UAAU,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,CAAC;AAGtB,OAAO,EAAE,wBAAwB,EAAE,+BAA+B,EAAE,MAAM,4BAA4B,CAAC;AAGvG,OAAO,EAAE,uBAAuB,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAG3F,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAG7D,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAG9E,OAAO,EACL,mBAAmB,EACnB,WAAW,EACX,UAAU,EACV,0BAA0B,EAC1B,QAAQ,EACR,cAAc,EACf,MAAM,iBAAiB,CAAC;AAGzB,OAAO,EACL,oBAAoB,EACpB,oBAAoB,EACpB,8BAA8B,EAC9B,SAAS,EACT,SAAS,EACT,gCAAgC,EAChC,6BAA6B,EAC7B,4BAA4B,EAC5B,wBAAwB,EACxB,wBAAwB,EACxB,eAAe,EAChB,MAAM,eAAe,CAAC;AAGvB,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC"}
|
|
@@ -55,7 +55,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
55
55
|
};
|
|
56
56
|
})();
|
|
57
57
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
58
|
-
exports.HpkeProvider = exports.spkiToRawX25519 = exports.multibaseBase64UrlEncode = exports.multibaseBase64UrlDecode = exports.MultibaseSpkiPublicKeyRegExp = exports.isValidMultibaseSpkiPublicKey = exports.importPublicKeyFromMultibaseSpki = exports.exportPublicKeyAsMultibaseSpki = exports.base64UrlNoPadEncode = exports.base64UrlNoPadDecode = exports.tryDecryptFile = exports.toBase64 = exports.fromBase64 = exports.decryptFile = exports.createEncryptedFile = exports.nodeCryptoProvider = exports.NodeCryptoProvider = exports.keyPairAlgorithmParams = exports.DirectEncryptionProvider = exports.Converters = exports.KeyStore = exports.Constants = void 0;
|
|
58
|
+
exports.HpkeProvider = exports.spkiToRawX25519 = exports.multibaseBase64UrlEncode = exports.multibaseBase64UrlDecode = exports.MultibaseSpkiPublicKeyRegExp = exports.isValidMultibaseSpkiPublicKey = exports.importPublicKeyFromMultibaseSpki = exports.hexEncode = exports.hexDecode = exports.exportPublicKeyAsMultibaseSpki = exports.base64UrlNoPadEncode = exports.base64UrlNoPadDecode = exports.tryDecryptFile = exports.toBase64 = exports.fromBase64 = exports.decryptFile = exports.createEncryptedFile = exports.nodeCryptoProvider = exports.NodeCryptoProvider = exports.deriveKeyPairFromSeed = exports.keyPairAlgorithmParams = exports.DirectEncryptionProvider = exports.Converters = exports.KeyStore = exports.Constants = void 0;
|
|
59
59
|
/**
|
|
60
60
|
* Crypto utilities for encrypted file handling and key management.
|
|
61
61
|
* @packageDocumentation
|
|
@@ -77,6 +77,9 @@ Object.defineProperty(exports, "DirectEncryptionProvider", { enumerable: true, g
|
|
|
77
77
|
// WebCrypto parameter table for asymmetric keypair algorithms
|
|
78
78
|
var keyPairAlgorithmParams_1 = require("./keyPairAlgorithmParams");
|
|
79
79
|
Object.defineProperty(exports, "keyPairAlgorithmParams", { enumerable: true, get: function () { return keyPairAlgorithmParams_1.keyPairAlgorithmParams; } });
|
|
80
|
+
// Deterministic seed → keypair derivation shared by the Node/browser providers
|
|
81
|
+
var seedDerivedKeyPair_1 = require("./seedDerivedKeyPair");
|
|
82
|
+
Object.defineProperty(exports, "deriveKeyPairFromSeed", { enumerable: true, get: function () { return seedDerivedKeyPair_1.deriveKeyPairFromSeed; } });
|
|
80
83
|
// Node.js crypto provider (Node.js environment only)
|
|
81
84
|
var nodeCryptoProvider_1 = require("./nodeCryptoProvider");
|
|
82
85
|
Object.defineProperty(exports, "NodeCryptoProvider", { enumerable: true, get: function () { return nodeCryptoProvider_1.NodeCryptoProvider; } });
|
|
@@ -93,6 +96,8 @@ var spkiHelpers_1 = require("./spkiHelpers");
|
|
|
93
96
|
Object.defineProperty(exports, "base64UrlNoPadDecode", { enumerable: true, get: function () { return spkiHelpers_1.base64UrlNoPadDecode; } });
|
|
94
97
|
Object.defineProperty(exports, "base64UrlNoPadEncode", { enumerable: true, get: function () { return spkiHelpers_1.base64UrlNoPadEncode; } });
|
|
95
98
|
Object.defineProperty(exports, "exportPublicKeyAsMultibaseSpki", { enumerable: true, get: function () { return spkiHelpers_1.exportPublicKeyAsMultibaseSpki; } });
|
|
99
|
+
Object.defineProperty(exports, "hexDecode", { enumerable: true, get: function () { return spkiHelpers_1.hexDecode; } });
|
|
100
|
+
Object.defineProperty(exports, "hexEncode", { enumerable: true, get: function () { return spkiHelpers_1.hexEncode; } });
|
|
96
101
|
Object.defineProperty(exports, "importPublicKeyFromMultibaseSpki", { enumerable: true, get: function () { return spkiHelpers_1.importPublicKeyFromMultibaseSpki; } });
|
|
97
102
|
Object.defineProperty(exports, "isValidMultibaseSpkiPublicKey", { enumerable: true, get: function () { return spkiHelpers_1.isValidMultibaseSpkiPublicKey; } });
|
|
98
103
|
Object.defineProperty(exports, "MultibaseSpkiPublicKeyRegExp", { enumerable: true, get: function () { return spkiHelpers_1.MultibaseSpkiPublicKeyRegExp; } });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/packlets/crypto-utils/index.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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEZ;;;GAGG;AAEH,iCAAiC;AACjC,0CAAwB;AAExB,YAAY;AACZ,uDAAyC;AAChC,8BAAS;AAElB,qBAAqB;AACrB,qDAAuC;AAC9B,4BAAQ;AAEjB,uBAAuB;AACvB,yDAA2C;AAClC,gCAAU;AAEnB,6BAA6B;AAC7B,uEAAuG;AAA9F,oIAAA,wBAAwB,OAAA;AAEjC,8DAA8D;AAC9D,mEAA2F;AAAzD,gIAAA,sBAAsB,OAAA;AAExD,qDAAqD;AACrD,2DAA8E;AAArE,wHAAA,kBAAkB,OAAA;AAAE,wHAAA,kBAAkB,OAAA;AAE/C,yBAAyB;AACzB,iDAOyB;AANvB,oHAAA,mBAAmB,OAAA;AACnB,4GAAA,WAAW,OAAA;AACX,2GAAA,UAAU,OAAA;AAEV,yGAAA,QAAQ,OAAA;AACR,+GAAA,cAAc,OAAA;AAGhB,qCAAqC;AACrC,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/packlets/crypto-utils/index.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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEZ;;;GAGG;AAEH,iCAAiC;AACjC,0CAAwB;AAExB,YAAY;AACZ,uDAAyC;AAChC,8BAAS;AAElB,qBAAqB;AACrB,qDAAuC;AAC9B,4BAAQ;AAEjB,uBAAuB;AACvB,yDAA2C;AAClC,gCAAU;AAEnB,6BAA6B;AAC7B,uEAAuG;AAA9F,oIAAA,wBAAwB,OAAA;AAEjC,8DAA8D;AAC9D,mEAA2F;AAAzD,gIAAA,sBAAsB,OAAA;AAExD,+EAA+E;AAC/E,2DAA6D;AAApD,2HAAA,qBAAqB,OAAA;AAE9B,qDAAqD;AACrD,2DAA8E;AAArE,wHAAA,kBAAkB,OAAA;AAAE,wHAAA,kBAAkB,OAAA;AAE/C,yBAAyB;AACzB,iDAOyB;AANvB,oHAAA,mBAAmB,OAAA;AACnB,4GAAA,WAAW,OAAA;AACX,2GAAA,UAAU,OAAA;AAEV,yGAAA,QAAQ,OAAA;AACR,+GAAA,cAAc,OAAA;AAGhB,qCAAqC;AACrC,6CAYuB;AAXrB,mHAAA,oBAAoB,OAAA;AACpB,mHAAA,oBAAoB,OAAA;AACpB,6HAAA,8BAA8B,OAAA;AAC9B,wGAAA,SAAS,OAAA;AACT,wGAAA,SAAS,OAAA;AACT,+HAAA,gCAAgC,OAAA;AAChC,4HAAA,6BAA6B,OAAA;AAC7B,2HAAA,4BAA4B,OAAA;AAC5B,uHAAA,wBAAwB,OAAA;AACxB,uHAAA,wBAAwB,OAAA;AACxB,8GAAA,eAAe,OAAA;AAGjB,qFAAqF;AACrF,+CAA+D;AAAtD,4GAAA,YAAY,OAAA","sourcesContent":["// Copyright (c) 2024 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\n/**\n * Crypto utilities for encrypted file handling and key management.\n * @packageDocumentation\n */\n\n// Re-export all types from model\nexport * from './model';\n\n// Constants\nimport * as Constants from './constants';\nexport { Constants };\n\n// KeyStore namespace\nimport * as KeyStore from './keystore';\nexport { KeyStore };\n\n// Converters namespace\nimport * as Converters from './converters';\nexport { Converters };\n\n// Direct encryption provider\nexport { DirectEncryptionProvider, IDirectEncryptionProviderParams } from './directEncryptionProvider';\n\n// WebCrypto parameter table for asymmetric keypair algorithms\nexport { IKeyPairAlgorithmParams, keyPairAlgorithmParams } from './keyPairAlgorithmParams';\n\n// Deterministic seed → keypair derivation shared by the Node/browser providers\nexport { deriveKeyPairFromSeed } from './seedDerivedKeyPair';\n\n// Node.js crypto provider (Node.js environment only)\nexport { NodeCryptoProvider, nodeCryptoProvider } from './nodeCryptoProvider';\n\n// Encrypted file helpers\nexport {\n createEncryptedFile,\n decryptFile,\n fromBase64,\n ICreateEncryptedFileParams,\n toBase64,\n tryDecryptFile\n} from './encryptedFile';\n\n// Multibase/SPKI + base64url helpers\nexport {\n base64UrlNoPadDecode,\n base64UrlNoPadEncode,\n exportPublicKeyAsMultibaseSpki,\n hexDecode,\n hexEncode,\n importPublicKeyFromMultibaseSpki,\n isValidMultibaseSpkiPublicKey,\n MultibaseSpkiPublicKeyRegExp,\n multibaseBase64UrlDecode,\n multibaseBase64UrlEncode,\n spkiToRawX25519\n} from './spkiHelpers';\n\n// HPKE base mode (RFC 9180) — DHKEM(X25519, HKDF-SHA256) + HKDF-SHA256 + AES-256-GCM\nexport { HpkeProvider, IHpkeSealResult } from './hpkeProvider';\n"]}
|
|
@@ -13,7 +13,7 @@ export declare const keystoreFormat: Converter<KeyStoreFormat>;
|
|
|
13
13
|
export declare const keystoreSecretType: Converter<KeyStoreSecretType>;
|
|
14
14
|
/**
|
|
15
15
|
* Converter for {@link CryptoUtils.KeyStore.KeyStoreSymmetricSecretType | symmetric secret type} discriminator.
|
|
16
|
-
* Accepts
|
|
16
|
+
* Accepts `'encryption-key'`, `'api-key'`, and `'opaque'`.
|
|
17
17
|
* @public
|
|
18
18
|
*/
|
|
19
19
|
export declare const keystoreSymmetricSecretType: Converter<KeyStoreSymmetricSecretType>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"converters.d.ts","sourceRoot":"","sources":["../../../../src/packlets/crypto-utils/keystore/converters.ts"],"names":[],"mappings":"AAoBA,OAAO,EAAE,SAAS,EAAmC,SAAS,EAAc,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"converters.d.ts","sourceRoot":"","sources":["../../../../src/packlets/crypto-utils/keystore/converters.ts"],"names":[],"mappings":"AAoBA,OAAO,EAAE,SAAS,EAAmC,SAAS,EAAc,MAAM,eAAe,CAAC;AAGlG,OAAO,EAKL,4BAA4B,EAC5B,kBAAkB,EAClB,aAAa,EACb,2BAA2B,EAC3B,sBAAsB,EACtB,gBAAgB,EAChB,4BAA4B,EAC5B,cAAc,EACd,kBAAkB,EAClB,2BAA2B,EAE5B,MAAM,SAAS,CAAC;AAMjB;;;GAGG;AACH,eAAO,MAAM,cAAc,EAAE,SAAS,CAAC,cAAc,CACW,CAAC;AAMjE;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,EAAE,SAAS,CAAC,kBAAkB,CACW,CAAC;AAEzE;;;;GAIG;AACH,eAAO,MAAM,2BAA2B,EAAE,SAAS,CAAC,2BAA2B,CACW,CAAC;AAE3F;;;;GAIG;AACH,eAAO,MAAM,4BAA4B,EAAE,SAAS,CAAC,4BAA4B,CACW,CAAC;AAM7F;;;GAGG;AACH,eAAO,MAAM,gBAAgB,EAAE,SAAS,CAAC,gBAAgB,CACW,CAAC;AAMrE;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,eAAe,EAAE,SAAS,CAAC,UAAU,CAEE,CAAC;AAMrD;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,0BAA0B,EAAE,SAAS,CAAC,2BAA2B,CAsB3E,CAAC;AAMJ;;;;;;GAMG;AACH,eAAO,MAAM,2BAA2B,EAAE,SAAS,CAAC,4BAA4B,CAU5E,CAAC;AAML;;;;;;;GAOG;AACH,eAAO,MAAM,uBAAuB,EAAE,SAAS,CAAC,kBAAkB,CAGhE,CAAC;AAMH;;;GAGG;AACH,eAAO,MAAM,qBAAqB,EAAE,SAAS,CAAC,sBAAsB,CAIhE,CAAC;AAML;;;GAGG;AACH,eAAO,MAAM,YAAY,EAAE,SAAS,CAAC,aAAa,CAOhD,CAAC"}
|
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
22
|
exports.keystoreFile = exports.keystoreVaultContents = exports.keystoreSecretEntryJson = exports.keystoreAsymmetricEntryJson = exports.keystoreSymmetricEntryJson = exports.jsonWebKeyShape = exports.keyPairAlgorithm = exports.keystoreAsymmetricSecretType = exports.keystoreSymmetricSecretType = exports.keystoreSecretType = exports.keystoreFormat = void 0;
|
|
23
23
|
const ts_utils_1 = require("@fgv/ts-utils");
|
|
24
|
+
const ts_json_base_1 = require("@fgv/ts-json-base");
|
|
24
25
|
const converters_1 = require("../converters");
|
|
25
26
|
const model_1 = require("./model");
|
|
26
27
|
// ============================================================================
|
|
@@ -42,7 +43,7 @@ exports.keystoreFormat = ts_utils_1.Converters.enumeratedValue(model_1.allKeySto
|
|
|
42
43
|
exports.keystoreSecretType = ts_utils_1.Converters.enumeratedValue(model_1.allKeyStoreSecretTypes);
|
|
43
44
|
/**
|
|
44
45
|
* Converter for {@link CryptoUtils.KeyStore.KeyStoreSymmetricSecretType | symmetric secret type} discriminator.
|
|
45
|
-
* Accepts
|
|
46
|
+
* Accepts `'encryption-key'`, `'api-key'`, and `'opaque'`.
|
|
46
47
|
* @public
|
|
47
48
|
*/
|
|
48
49
|
exports.keystoreSymmetricSecretType = ts_utils_1.Converters.enumeratedValue(model_1.allKeyStoreSymmetricSecretTypes);
|
|
@@ -105,11 +106,14 @@ exports.keystoreSymmetricEntryJson = ts_utils_1.Converters.object({
|
|
|
105
106
|
type: exports.keystoreSymmetricSecretType,
|
|
106
107
|
key: converters_1.base64String,
|
|
107
108
|
description: ts_utils_1.Converters.string,
|
|
108
|
-
|
|
109
|
+
metadata: ts_json_base_1.Converters.jsonValue,
|
|
110
|
+
createdAt: ts_utils_1.Converters.string,
|
|
111
|
+
updatedAt: ts_utils_1.Converters.string
|
|
109
112
|
}, {
|
|
110
113
|
// `type` is optional at the input layer for legacy-vault compatibility;
|
|
111
|
-
// the .map() below normalizes by injecting the default.
|
|
112
|
-
|
|
114
|
+
// the .map() below normalizes by injecting the default. `metadata` and
|
|
115
|
+
// `updatedAt` are keystore-v3 additions, optional so v1/v2 entries parse.
|
|
116
|
+
optionalFields: ['type', 'description', 'metadata', 'updatedAt']
|
|
113
117
|
}).map((entry) => {
|
|
114
118
|
var _a;
|
|
115
119
|
return (0, ts_utils_1.succeed)(Object.assign(Object.assign({}, entry), { type: (_a = entry.type) !== null && _a !== void 0 ? _a : 'encryption-key' }));
|