@fgv/ts-extras 5.0.2 → 5.1.0-1
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/index.browser.js +6 -2
- package/dist/index.js +5 -1
- package/dist/packlets/ai-assist/apiClient.js +484 -0
- package/dist/packlets/ai-assist/converters.js +121 -0
- package/dist/packlets/ai-assist/index.js +10 -0
- package/dist/packlets/ai-assist/model.js +90 -0
- package/dist/packlets/ai-assist/registry.js +145 -0
- package/dist/packlets/ai-assist/toolFormats.js +160 -0
- package/dist/packlets/crypto-utils/constants.js +48 -0
- package/dist/packlets/crypto-utils/converters.js +155 -0
- package/dist/packlets/crypto-utils/directEncryptionProvider.js +86 -0
- package/dist/packlets/crypto-utils/encryptedFile.js +161 -0
- package/dist/packlets/crypto-utils/index.browser.js +41 -0
- package/dist/packlets/crypto-utils/index.js +41 -0
- package/dist/packlets/crypto-utils/keystore/converters.js +84 -0
- package/dist/packlets/crypto-utils/keystore/index.js +31 -0
- package/dist/packlets/crypto-utils/keystore/keyStore.js +758 -0
- package/dist/packlets/crypto-utils/keystore/model.js +64 -0
- package/dist/packlets/crypto-utils/model.js +39 -0
- package/dist/packlets/crypto-utils/nodeCryptoProvider.js +159 -0
- package/dist/packlets/experimental/formatter.js +1 -1
- package/dist/packlets/mustache/index.js +23 -0
- package/dist/packlets/mustache/interfaces.js +25 -0
- package/dist/packlets/mustache/mustacheTemplate.js +242 -0
- package/dist/packlets/record-jar/recordJarHelpers.js +1 -1
- package/dist/packlets/yaml/converters.js +46 -0
- package/dist/packlets/yaml/index.js +23 -0
- package/dist/packlets/zip-file-tree/index.js +1 -0
- package/dist/packlets/zip-file-tree/zipFileTreeAccessors.js +6 -2
- package/dist/packlets/zip-file-tree/zipFileTreeWriter.js +40 -0
- package/dist/ts-extras.d.ts +1964 -112
- package/dist/tsdoc-metadata.json +1 -1
- package/lib/index.browser.d.ts +3 -1
- package/lib/index.browser.js +6 -1
- package/lib/index.d.ts +5 -1
- package/lib/index.js +9 -1
- package/lib/packlets/ai-assist/apiClient.d.ts +60 -0
- package/lib/packlets/ai-assist/apiClient.js +488 -0
- package/lib/packlets/ai-assist/converters.d.ts +55 -0
- package/lib/packlets/ai-assist/converters.js +124 -0
- package/lib/packlets/ai-assist/index.d.ts +10 -0
- package/lib/packlets/ai-assist/index.js +33 -0
- package/lib/packlets/ai-assist/model.d.ts +222 -0
- package/lib/packlets/ai-assist/model.js +95 -0
- package/lib/packlets/ai-assist/registry.d.ts +25 -0
- package/lib/packlets/ai-assist/registry.js +150 -0
- package/lib/packlets/ai-assist/toolFormats.d.ts +44 -0
- package/lib/packlets/ai-assist/toolFormats.js +166 -0
- package/lib/packlets/crypto-utils/constants.d.ts +26 -0
- package/lib/packlets/crypto-utils/constants.js +51 -0
- package/lib/packlets/crypto-utils/converters.d.ts +58 -0
- package/lib/packlets/crypto-utils/converters.js +192 -0
- package/lib/packlets/crypto-utils/directEncryptionProvider.d.ts +69 -0
- package/lib/packlets/crypto-utils/directEncryptionProvider.js +90 -0
- package/lib/packlets/crypto-utils/encryptedFile.d.ts +88 -0
- package/lib/packlets/crypto-utils/encryptedFile.js +201 -0
- package/lib/packlets/crypto-utils/index.browser.d.ts +14 -0
- package/lib/packlets/crypto-utils/index.browser.js +91 -0
- package/lib/packlets/crypto-utils/index.d.ts +15 -0
- package/lib/packlets/crypto-utils/index.js +88 -0
- package/lib/packlets/crypto-utils/keystore/converters.d.ts +29 -0
- package/lib/packlets/crypto-utils/keystore/converters.js +87 -0
- package/lib/packlets/crypto-utils/keystore/index.d.ts +9 -0
- package/lib/packlets/crypto-utils/keystore/index.js +71 -0
- package/lib/packlets/crypto-utils/keystore/keyStore.d.ts +239 -0
- package/lib/packlets/crypto-utils/keystore/keyStore.js +795 -0
- package/lib/packlets/crypto-utils/keystore/model.d.ts +245 -0
- package/lib/packlets/crypto-utils/keystore/model.js +68 -0
- package/lib/packlets/crypto-utils/model.d.ts +236 -0
- package/lib/packlets/crypto-utils/model.js +76 -0
- package/lib/packlets/crypto-utils/nodeCryptoProvider.d.ts +62 -0
- package/lib/packlets/crypto-utils/nodeCryptoProvider.js +196 -0
- package/lib/packlets/experimental/formatter.d.ts +1 -1
- package/lib/packlets/experimental/formatter.js +1 -1
- package/lib/packlets/mustache/index.d.ts +3 -0
- package/lib/packlets/mustache/index.js +27 -0
- package/lib/packlets/mustache/interfaces.d.ts +97 -0
- package/lib/packlets/mustache/interfaces.js +26 -0
- package/lib/packlets/mustache/mustacheTemplate.d.ts +76 -0
- package/lib/packlets/mustache/mustacheTemplate.js +249 -0
- package/lib/packlets/record-jar/recordJarHelpers.js +1 -1
- package/lib/packlets/yaml/converters.d.ts +9 -0
- package/lib/packlets/yaml/converters.js +82 -0
- package/lib/packlets/yaml/index.d.ts +2 -0
- package/lib/packlets/yaml/index.js +39 -0
- package/lib/packlets/zip-file-tree/index.d.ts +1 -0
- package/lib/packlets/zip-file-tree/index.js +15 -0
- package/lib/packlets/zip-file-tree/zipFileTreeAccessors.d.ts +5 -1
- package/lib/packlets/zip-file-tree/zipFileTreeAccessors.js +6 -2
- package/lib/packlets/zip-file-tree/zipFileTreeWriter.d.ts +27 -0
- package/lib/packlets/zip-file-tree/zipFileTreeWriter.js +43 -0
- package/package.json +50 -31
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright (c) 2024 Erik Fortune
|
|
3
|
+
//
|
|
4
|
+
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
5
|
+
// of this software and associated documentation files (the "Software"), to deal
|
|
6
|
+
// in the Software without restriction, including without limitation the rights
|
|
7
|
+
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
8
|
+
// copies of the Software, and to permit persons to whom the Software is
|
|
9
|
+
// furnished to do so, subject to the following conditions:
|
|
10
|
+
//
|
|
11
|
+
// The above copyright notice and this permission notice shall be included in all
|
|
12
|
+
// copies or substantial portions of the Software.
|
|
13
|
+
//
|
|
14
|
+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
15
|
+
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
16
|
+
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
17
|
+
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
18
|
+
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
19
|
+
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
20
|
+
// SOFTWARE.
|
|
21
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
22
|
+
if (k2 === undefined) k2 = k;
|
|
23
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
24
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
25
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
26
|
+
}
|
|
27
|
+
Object.defineProperty(o, k2, desc);
|
|
28
|
+
}) : (function(o, m, k, k2) {
|
|
29
|
+
if (k2 === undefined) k2 = k;
|
|
30
|
+
o[k2] = m[k];
|
|
31
|
+
}));
|
|
32
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
33
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
34
|
+
}) : function(o, v) {
|
|
35
|
+
o["default"] = v;
|
|
36
|
+
});
|
|
37
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
38
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
39
|
+
};
|
|
40
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
41
|
+
var ownKeys = function(o) {
|
|
42
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
43
|
+
var ar = [];
|
|
44
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
45
|
+
return ar;
|
|
46
|
+
};
|
|
47
|
+
return ownKeys(o);
|
|
48
|
+
};
|
|
49
|
+
return function (mod) {
|
|
50
|
+
if (mod && mod.__esModule) return mod;
|
|
51
|
+
var result = {};
|
|
52
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
53
|
+
__setModuleDefault(result, mod);
|
|
54
|
+
return result;
|
|
55
|
+
};
|
|
56
|
+
})();
|
|
57
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
58
|
+
exports.tryDecryptFile = exports.toBase64 = exports.fromBase64 = exports.decryptFile = exports.createEncryptedFile = 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
|
+
/**
|
|
60
|
+
* Crypto utilities for encrypted file handling and key management (browser version).
|
|
61
|
+
* Note: For browser crypto provider, use \@fgv/ts-web-extras.
|
|
62
|
+
* @packageDocumentation
|
|
63
|
+
*/
|
|
64
|
+
// Re-export all types from model
|
|
65
|
+
__exportStar(require("./model"), exports);
|
|
66
|
+
// Constants
|
|
67
|
+
var constants_1 = require("./constants");
|
|
68
|
+
Object.defineProperty(exports, "AES_256_KEY_SIZE", { enumerable: true, get: function () { return constants_1.AES_256_KEY_SIZE; } });
|
|
69
|
+
Object.defineProperty(exports, "DEFAULT_ALGORITHM", { enumerable: true, get: function () { return constants_1.DEFAULT_ALGORITHM; } });
|
|
70
|
+
Object.defineProperty(exports, "ENCRYPTED_FILE_FORMAT", { enumerable: true, get: function () { return constants_1.ENCRYPTED_FILE_FORMAT; } });
|
|
71
|
+
Object.defineProperty(exports, "GCM_AUTH_TAG_SIZE", { enumerable: true, get: function () { return constants_1.GCM_AUTH_TAG_SIZE; } });
|
|
72
|
+
Object.defineProperty(exports, "GCM_IV_SIZE", { enumerable: true, get: function () { return constants_1.GCM_IV_SIZE; } });
|
|
73
|
+
// KeyStore namespace
|
|
74
|
+
const KeyStore = __importStar(require("./keystore"));
|
|
75
|
+
exports.KeyStore = KeyStore;
|
|
76
|
+
// Converters namespace
|
|
77
|
+
const Converters = __importStar(require("./converters"));
|
|
78
|
+
exports.Converters = Converters;
|
|
79
|
+
// Direct encryption provider
|
|
80
|
+
var directEncryptionProvider_1 = require("./directEncryptionProvider");
|
|
81
|
+
Object.defineProperty(exports, "DirectEncryptionProvider", { enumerable: true, get: function () { return directEncryptionProvider_1.DirectEncryptionProvider; } });
|
|
82
|
+
// Note: NodeCryptoProvider is NOT exported in browser version
|
|
83
|
+
// Use BrowserCryptoProvider from @fgv/ts-web-extras instead
|
|
84
|
+
// Encrypted file helpers
|
|
85
|
+
var encryptedFile_1 = require("./encryptedFile");
|
|
86
|
+
Object.defineProperty(exports, "createEncryptedFile", { enumerable: true, get: function () { return encryptedFile_1.createEncryptedFile; } });
|
|
87
|
+
Object.defineProperty(exports, "decryptFile", { enumerable: true, get: function () { return encryptedFile_1.decryptFile; } });
|
|
88
|
+
Object.defineProperty(exports, "fromBase64", { enumerable: true, get: function () { return encryptedFile_1.fromBase64; } });
|
|
89
|
+
Object.defineProperty(exports, "toBase64", { enumerable: true, get: function () { return encryptedFile_1.toBase64; } });
|
|
90
|
+
Object.defineProperty(exports, "tryDecryptFile", { enumerable: true, get: function () { return encryptedFile_1.tryDecryptFile; } });
|
|
91
|
+
//# sourceMappingURL=index.browser.js.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Crypto utilities for encrypted file handling and key management.
|
|
3
|
+
* @packageDocumentation
|
|
4
|
+
*/
|
|
5
|
+
export * from './model';
|
|
6
|
+
import * as Constants from './constants';
|
|
7
|
+
export { Constants };
|
|
8
|
+
import * as KeyStore from './keystore';
|
|
9
|
+
export { KeyStore };
|
|
10
|
+
import * as Converters from './converters';
|
|
11
|
+
export { Converters };
|
|
12
|
+
export { DirectEncryptionProvider, IDirectEncryptionProviderParams } from './directEncryptionProvider';
|
|
13
|
+
export { NodeCryptoProvider, nodeCryptoProvider } from './nodeCryptoProvider';
|
|
14
|
+
export { createEncryptedFile, decryptFile, fromBase64, ICreateEncryptedFileParams, toBase64, tryDecryptFile } from './encryptedFile';
|
|
15
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright (c) 2024 Erik Fortune
|
|
3
|
+
//
|
|
4
|
+
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
5
|
+
// of this software and associated documentation files (the "Software"), to deal
|
|
6
|
+
// in the Software without restriction, including without limitation the rights
|
|
7
|
+
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
8
|
+
// copies of the Software, and to permit persons to whom the Software is
|
|
9
|
+
// furnished to do so, subject to the following conditions:
|
|
10
|
+
//
|
|
11
|
+
// The above copyright notice and this permission notice shall be included in all
|
|
12
|
+
// copies or substantial portions of the Software.
|
|
13
|
+
//
|
|
14
|
+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
15
|
+
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
16
|
+
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
17
|
+
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
18
|
+
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
19
|
+
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
20
|
+
// SOFTWARE.
|
|
21
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
22
|
+
if (k2 === undefined) k2 = k;
|
|
23
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
24
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
25
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
26
|
+
}
|
|
27
|
+
Object.defineProperty(o, k2, desc);
|
|
28
|
+
}) : (function(o, m, k, k2) {
|
|
29
|
+
if (k2 === undefined) k2 = k;
|
|
30
|
+
o[k2] = m[k];
|
|
31
|
+
}));
|
|
32
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
33
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
34
|
+
}) : function(o, v) {
|
|
35
|
+
o["default"] = v;
|
|
36
|
+
});
|
|
37
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
38
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
39
|
+
};
|
|
40
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
41
|
+
var ownKeys = function(o) {
|
|
42
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
43
|
+
var ar = [];
|
|
44
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
45
|
+
return ar;
|
|
46
|
+
};
|
|
47
|
+
return ownKeys(o);
|
|
48
|
+
};
|
|
49
|
+
return function (mod) {
|
|
50
|
+
if (mod && mod.__esModule) return mod;
|
|
51
|
+
var result = {};
|
|
52
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
53
|
+
__setModuleDefault(result, mod);
|
|
54
|
+
return result;
|
|
55
|
+
};
|
|
56
|
+
})();
|
|
57
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
58
|
+
exports.tryDecryptFile = exports.toBase64 = exports.fromBase64 = exports.decryptFile = exports.createEncryptedFile = exports.nodeCryptoProvider = exports.NodeCryptoProvider = exports.DirectEncryptionProvider = exports.Converters = exports.KeyStore = exports.Constants = void 0;
|
|
59
|
+
/**
|
|
60
|
+
* Crypto utilities for encrypted file handling and key management.
|
|
61
|
+
* @packageDocumentation
|
|
62
|
+
*/
|
|
63
|
+
// Re-export all types from model
|
|
64
|
+
__exportStar(require("./model"), exports);
|
|
65
|
+
// Constants
|
|
66
|
+
const Constants = __importStar(require("./constants"));
|
|
67
|
+
exports.Constants = Constants;
|
|
68
|
+
// KeyStore namespace
|
|
69
|
+
const KeyStore = __importStar(require("./keystore"));
|
|
70
|
+
exports.KeyStore = KeyStore;
|
|
71
|
+
// Converters namespace
|
|
72
|
+
const Converters = __importStar(require("./converters"));
|
|
73
|
+
exports.Converters = Converters;
|
|
74
|
+
// Direct encryption provider
|
|
75
|
+
var directEncryptionProvider_1 = require("./directEncryptionProvider");
|
|
76
|
+
Object.defineProperty(exports, "DirectEncryptionProvider", { enumerable: true, get: function () { return directEncryptionProvider_1.DirectEncryptionProvider; } });
|
|
77
|
+
// Node.js crypto provider (Node.js environment only)
|
|
78
|
+
var nodeCryptoProvider_1 = require("./nodeCryptoProvider");
|
|
79
|
+
Object.defineProperty(exports, "NodeCryptoProvider", { enumerable: true, get: function () { return nodeCryptoProvider_1.NodeCryptoProvider; } });
|
|
80
|
+
Object.defineProperty(exports, "nodeCryptoProvider", { enumerable: true, get: function () { return nodeCryptoProvider_1.nodeCryptoProvider; } });
|
|
81
|
+
// Encrypted file helpers
|
|
82
|
+
var encryptedFile_1 = require("./encryptedFile");
|
|
83
|
+
Object.defineProperty(exports, "createEncryptedFile", { enumerable: true, get: function () { return encryptedFile_1.createEncryptedFile; } });
|
|
84
|
+
Object.defineProperty(exports, "decryptFile", { enumerable: true, get: function () { return encryptedFile_1.decryptFile; } });
|
|
85
|
+
Object.defineProperty(exports, "fromBase64", { enumerable: true, get: function () { return encryptedFile_1.fromBase64; } });
|
|
86
|
+
Object.defineProperty(exports, "toBase64", { enumerable: true, get: function () { return encryptedFile_1.toBase64; } });
|
|
87
|
+
Object.defineProperty(exports, "tryDecryptFile", { enumerable: true, get: function () { return encryptedFile_1.tryDecryptFile; } });
|
|
88
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Converter } from '@fgv/ts-utils';
|
|
2
|
+
import { IKeyStoreFile, IKeyStoreSecretEntryJson, IKeyStoreVaultContents, KeyStoreFormat, KeyStoreSecretType } from './model';
|
|
3
|
+
/**
|
|
4
|
+
* Converter for {@link CryptoUtils.KeyStore.KeyStoreFormat | key store format} version.
|
|
5
|
+
* @public
|
|
6
|
+
*/
|
|
7
|
+
export declare const keystoreFormat: Converter<KeyStoreFormat>;
|
|
8
|
+
/**
|
|
9
|
+
* Converter for {@link CryptoUtils.KeyStore.KeyStoreSecretType | key store secret type} discriminator.
|
|
10
|
+
* @public
|
|
11
|
+
*/
|
|
12
|
+
export declare const keystoreSecretType: Converter<KeyStoreSecretType>;
|
|
13
|
+
/**
|
|
14
|
+
* Converter for {@link CryptoUtils.KeyStore.IKeyStoreSecretEntryJson | key store secret entry} in JSON format.
|
|
15
|
+
* The `type` field is optional for backwards compatibility — missing means `'encryption-key'`.
|
|
16
|
+
* @public
|
|
17
|
+
*/
|
|
18
|
+
export declare const keystoreSecretEntryJson: Converter<IKeyStoreSecretEntryJson>;
|
|
19
|
+
/**
|
|
20
|
+
* Converter for {@link CryptoUtils.KeyStore.IKeyStoreVaultContents | key store vault contents} (decrypted state).
|
|
21
|
+
* @public
|
|
22
|
+
*/
|
|
23
|
+
export declare const keystoreVaultContents: Converter<IKeyStoreVaultContents>;
|
|
24
|
+
/**
|
|
25
|
+
* Converter for {@link CryptoUtils.KeyStore.IKeyStoreFile | encrypted key store file}.
|
|
26
|
+
* @public
|
|
27
|
+
*/
|
|
28
|
+
export declare const keystoreFile: Converter<IKeyStoreFile>;
|
|
29
|
+
//# sourceMappingURL=converters.d.ts.map
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright (c) 2026 Erik Fortune
|
|
3
|
+
//
|
|
4
|
+
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
5
|
+
// of this software and associated documentation files (the "Software"), to deal
|
|
6
|
+
// in the Software without restriction, including without limitation the rights
|
|
7
|
+
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
8
|
+
// copies of the Software, and to permit persons to whom the Software is
|
|
9
|
+
// furnished to do so, subject to the following conditions:
|
|
10
|
+
//
|
|
11
|
+
// The above copyright notice and this permission notice shall be included in all
|
|
12
|
+
// copies or substantial portions of the Software.
|
|
13
|
+
//
|
|
14
|
+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
15
|
+
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
16
|
+
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
17
|
+
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
18
|
+
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
19
|
+
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
20
|
+
// SOFTWARE.
|
|
21
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
+
exports.keystoreFile = exports.keystoreVaultContents = exports.keystoreSecretEntryJson = exports.keystoreSecretType = exports.keystoreFormat = void 0;
|
|
23
|
+
const ts_utils_1 = require("@fgv/ts-utils");
|
|
24
|
+
const converters_1 = require("../converters");
|
|
25
|
+
const model_1 = require("./model");
|
|
26
|
+
// ============================================================================
|
|
27
|
+
// Key Store Format Converter
|
|
28
|
+
// ============================================================================
|
|
29
|
+
/**
|
|
30
|
+
* Converter for {@link CryptoUtils.KeyStore.KeyStoreFormat | key store format} version.
|
|
31
|
+
* @public
|
|
32
|
+
*/
|
|
33
|
+
exports.keystoreFormat = ts_utils_1.Converters.enumeratedValue([
|
|
34
|
+
model_1.KEYSTORE_FORMAT
|
|
35
|
+
]);
|
|
36
|
+
// ============================================================================
|
|
37
|
+
// Secret Type Converter
|
|
38
|
+
// ============================================================================
|
|
39
|
+
/**
|
|
40
|
+
* Converter for {@link CryptoUtils.KeyStore.KeyStoreSecretType | key store secret type} discriminator.
|
|
41
|
+
* @public
|
|
42
|
+
*/
|
|
43
|
+
exports.keystoreSecretType = ts_utils_1.Converters.enumeratedValue(model_1.allKeyStoreSecretTypes);
|
|
44
|
+
// ============================================================================
|
|
45
|
+
// Secret Entry Converters
|
|
46
|
+
// ============================================================================
|
|
47
|
+
/**
|
|
48
|
+
* Converter for {@link CryptoUtils.KeyStore.IKeyStoreSecretEntryJson | key store secret entry} in JSON format.
|
|
49
|
+
* The `type` field is optional for backwards compatibility — missing means `'encryption-key'`.
|
|
50
|
+
* @public
|
|
51
|
+
*/
|
|
52
|
+
exports.keystoreSecretEntryJson = ts_utils_1.Converters.object({
|
|
53
|
+
name: ts_utils_1.Converters.string,
|
|
54
|
+
type: exports.keystoreSecretType,
|
|
55
|
+
key: converters_1.base64String,
|
|
56
|
+
description: ts_utils_1.Converters.string,
|
|
57
|
+
createdAt: ts_utils_1.Converters.string
|
|
58
|
+
}, {
|
|
59
|
+
optionalFields: ['type', 'description']
|
|
60
|
+
});
|
|
61
|
+
// ============================================================================
|
|
62
|
+
// Vault Contents Converter
|
|
63
|
+
// ============================================================================
|
|
64
|
+
/**
|
|
65
|
+
* Converter for {@link CryptoUtils.KeyStore.IKeyStoreVaultContents | key store vault contents} (decrypted state).
|
|
66
|
+
* @public
|
|
67
|
+
*/
|
|
68
|
+
exports.keystoreVaultContents = ts_utils_1.Converters.object({
|
|
69
|
+
version: exports.keystoreFormat,
|
|
70
|
+
secrets: ts_utils_1.Converters.recordOf(exports.keystoreSecretEntryJson)
|
|
71
|
+
});
|
|
72
|
+
// ============================================================================
|
|
73
|
+
// Key Store File Converter
|
|
74
|
+
// ============================================================================
|
|
75
|
+
/**
|
|
76
|
+
* Converter for {@link CryptoUtils.KeyStore.IKeyStoreFile | encrypted key store file}.
|
|
77
|
+
* @public
|
|
78
|
+
*/
|
|
79
|
+
exports.keystoreFile = ts_utils_1.Converters.object({
|
|
80
|
+
format: exports.keystoreFormat,
|
|
81
|
+
algorithm: converters_1.encryptionAlgorithm,
|
|
82
|
+
iv: converters_1.base64String,
|
|
83
|
+
authTag: converters_1.base64String,
|
|
84
|
+
encryptedData: converters_1.base64String,
|
|
85
|
+
keyDerivation: converters_1.keyDerivationParams
|
|
86
|
+
});
|
|
87
|
+
//# sourceMappingURL=converters.js.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Key store module for password-protected secret management.
|
|
3
|
+
* @packageDocumentation
|
|
4
|
+
*/
|
|
5
|
+
export * from './model';
|
|
6
|
+
import * as Converters from './converters';
|
|
7
|
+
export { Converters };
|
|
8
|
+
export { KeyStore } from './keyStore';
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright (c) 2026 Erik Fortune
|
|
3
|
+
//
|
|
4
|
+
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
5
|
+
// of this software and associated documentation files (the "Software"), to deal
|
|
6
|
+
// in the Software without restriction, including without limitation the rights
|
|
7
|
+
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
8
|
+
// copies of the Software, and to permit persons to whom the Software is
|
|
9
|
+
// furnished to do so, subject to the following conditions:
|
|
10
|
+
//
|
|
11
|
+
// The above copyright notice and this permission notice shall be included in all
|
|
12
|
+
// copies or substantial portions of the Software.
|
|
13
|
+
//
|
|
14
|
+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
15
|
+
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
16
|
+
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
17
|
+
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
18
|
+
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
19
|
+
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
20
|
+
// SOFTWARE.
|
|
21
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
22
|
+
if (k2 === undefined) k2 = k;
|
|
23
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
24
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
25
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
26
|
+
}
|
|
27
|
+
Object.defineProperty(o, k2, desc);
|
|
28
|
+
}) : (function(o, m, k, k2) {
|
|
29
|
+
if (k2 === undefined) k2 = k;
|
|
30
|
+
o[k2] = m[k];
|
|
31
|
+
}));
|
|
32
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
33
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
34
|
+
}) : function(o, v) {
|
|
35
|
+
o["default"] = v;
|
|
36
|
+
});
|
|
37
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
38
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
39
|
+
};
|
|
40
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
41
|
+
var ownKeys = function(o) {
|
|
42
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
43
|
+
var ar = [];
|
|
44
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
45
|
+
return ar;
|
|
46
|
+
};
|
|
47
|
+
return ownKeys(o);
|
|
48
|
+
};
|
|
49
|
+
return function (mod) {
|
|
50
|
+
if (mod && mod.__esModule) return mod;
|
|
51
|
+
var result = {};
|
|
52
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
53
|
+
__setModuleDefault(result, mod);
|
|
54
|
+
return result;
|
|
55
|
+
};
|
|
56
|
+
})();
|
|
57
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
58
|
+
exports.KeyStore = exports.Converters = void 0;
|
|
59
|
+
/**
|
|
60
|
+
* Key store module for password-protected secret management.
|
|
61
|
+
* @packageDocumentation
|
|
62
|
+
*/
|
|
63
|
+
// Types and interfaces
|
|
64
|
+
__exportStar(require("./model"), exports);
|
|
65
|
+
// Converters namespace
|
|
66
|
+
const Converters = __importStar(require("./converters"));
|
|
67
|
+
exports.Converters = Converters;
|
|
68
|
+
// Key store class
|
|
69
|
+
var keyStore_1 = require("./keyStore");
|
|
70
|
+
Object.defineProperty(exports, "KeyStore", { enumerable: true, get: function () { return keyStore_1.KeyStore; } });
|
|
71
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
import { JsonValue } from '@fgv/ts-json-base';
|
|
2
|
+
import { Result } from '@fgv/ts-utils';
|
|
3
|
+
import { ICryptoProvider, IEncryptedFile, IEncryptionConfig, IEncryptionProvider, SecretProvider } from '../model';
|
|
4
|
+
import { IAddSecretFromPasswordOptions, IAddSecretFromPasswordResult, IAddSecretOptions, IAddSecretResult, IImportSecretOptions, IKeyStoreCreateParams, IKeyStoreFile, IKeyStoreOpenParams, IKeyStoreSecretEntry, KeyStoreLockState, KeyStoreSecretType } from './model';
|
|
5
|
+
/**
|
|
6
|
+
* Password-protected key store for managing encryption secrets.
|
|
7
|
+
*
|
|
8
|
+
* The KeyStore provides a secure vault for storing named encryption keys.
|
|
9
|
+
* The vault is encrypted at rest using a master password via PBKDF2 key derivation.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```typescript
|
|
13
|
+
* // Create new key store
|
|
14
|
+
* const keystore = KeyStore.create({ cryptoProvider: nodeCryptoProvider }).orThrow();
|
|
15
|
+
* await keystore.initialize('master-password');
|
|
16
|
+
*
|
|
17
|
+
* // Add secrets
|
|
18
|
+
* await keystore.addSecret('my-key', { description: 'Production key' });
|
|
19
|
+
*
|
|
20
|
+
* // Save to file
|
|
21
|
+
* const fileContent = await keystore.save();
|
|
22
|
+
*
|
|
23
|
+
* // Later: Open existing key store
|
|
24
|
+
* const keystore2 = KeyStore.open({
|
|
25
|
+
* cryptoProvider: nodeCryptoProvider,
|
|
26
|
+
* keystoreFile: fileContent.value
|
|
27
|
+
* }).orThrow();
|
|
28
|
+
* await keystore2.unlock('master-password');
|
|
29
|
+
*
|
|
30
|
+
* // Use as secret provider for encrypted file loading
|
|
31
|
+
* const encryptionConfig = keystore2.getEncryptionConfig().orThrow();
|
|
32
|
+
* ```
|
|
33
|
+
*
|
|
34
|
+
* @public
|
|
35
|
+
*/
|
|
36
|
+
export declare class KeyStore implements IEncryptionProvider {
|
|
37
|
+
private readonly _cryptoProvider;
|
|
38
|
+
private readonly _iterations;
|
|
39
|
+
private _keystoreFile;
|
|
40
|
+
private _salt;
|
|
41
|
+
private _secrets;
|
|
42
|
+
private _state;
|
|
43
|
+
private _dirty;
|
|
44
|
+
private _isNew;
|
|
45
|
+
private constructor();
|
|
46
|
+
/**
|
|
47
|
+
* Creates a new, empty key store.
|
|
48
|
+
* Call `initialize(password)` to set the master password.
|
|
49
|
+
* @param params - Creation parameters
|
|
50
|
+
* @returns Success with new KeyStore instance, or Failure if parameters invalid
|
|
51
|
+
* @public
|
|
52
|
+
*/
|
|
53
|
+
static create(params: IKeyStoreCreateParams): Result<KeyStore>;
|
|
54
|
+
/**
|
|
55
|
+
* Opens an existing encrypted key store.
|
|
56
|
+
* Call `unlock(password)` to decrypt and access secrets.
|
|
57
|
+
* @param params - Open parameters including the encrypted file
|
|
58
|
+
* @returns Success with KeyStore instance, or Failure if file format invalid
|
|
59
|
+
* @public
|
|
60
|
+
*/
|
|
61
|
+
static open(params: IKeyStoreOpenParams): Result<KeyStore>;
|
|
62
|
+
/**
|
|
63
|
+
* Initializes a new key store with the master password.
|
|
64
|
+
* Generates a random salt for key derivation.
|
|
65
|
+
* Only valid for newly created (not opened) key stores.
|
|
66
|
+
* @param password - The master password
|
|
67
|
+
* @returns Success with this instance when initialized, Failure if already initialized or opened
|
|
68
|
+
* @public
|
|
69
|
+
*/
|
|
70
|
+
initialize(password: string): Promise<Result<KeyStore>>;
|
|
71
|
+
/**
|
|
72
|
+
* Unlocks an existing key store with the master password.
|
|
73
|
+
* Decrypts the vault and loads secrets into memory.
|
|
74
|
+
* @param password - The master password
|
|
75
|
+
* @returns Success with this instance when unlocked, Failure if password incorrect
|
|
76
|
+
* @public
|
|
77
|
+
*/
|
|
78
|
+
unlock(password: string): Promise<Result<KeyStore>>;
|
|
79
|
+
/**
|
|
80
|
+
* Locks the key store, clearing all secrets from memory.
|
|
81
|
+
* @param force - If true, discards unsaved changes
|
|
82
|
+
* @returns Success when locked, Failure if unsaved changes and !force
|
|
83
|
+
* @public
|
|
84
|
+
*/
|
|
85
|
+
lock(force?: boolean): Result<KeyStore>;
|
|
86
|
+
/**
|
|
87
|
+
* Checks if the key store is unlocked.
|
|
88
|
+
* @public
|
|
89
|
+
*/
|
|
90
|
+
get isUnlocked(): boolean;
|
|
91
|
+
/**
|
|
92
|
+
* Checks if there are unsaved changes.
|
|
93
|
+
* @public
|
|
94
|
+
*/
|
|
95
|
+
get isDirty(): boolean;
|
|
96
|
+
/**
|
|
97
|
+
* Whether this is a newly created key store (not opened from a file).
|
|
98
|
+
* A new key store must be initialized with a password before use.
|
|
99
|
+
* An opened key store must be unlocked with the existing password.
|
|
100
|
+
* @public
|
|
101
|
+
*/
|
|
102
|
+
get isNew(): boolean;
|
|
103
|
+
/**
|
|
104
|
+
* Gets the current lock state.
|
|
105
|
+
* @public
|
|
106
|
+
*/
|
|
107
|
+
get state(): KeyStoreLockState;
|
|
108
|
+
/**
|
|
109
|
+
* Gets the crypto provider used by this key store.
|
|
110
|
+
* Available regardless of lock state.
|
|
111
|
+
* @public
|
|
112
|
+
*/
|
|
113
|
+
get cryptoProvider(): ICryptoProvider;
|
|
114
|
+
/**
|
|
115
|
+
* Lists all secret names in the key store.
|
|
116
|
+
* @returns Success with array of secret names, Failure if locked
|
|
117
|
+
* @public
|
|
118
|
+
*/
|
|
119
|
+
listSecrets(): Result<readonly string[]>;
|
|
120
|
+
/**
|
|
121
|
+
* Gets a secret by name.
|
|
122
|
+
* @param name - Name of the secret
|
|
123
|
+
* @returns Success with secret entry, Failure if not found or locked
|
|
124
|
+
* @public
|
|
125
|
+
*/
|
|
126
|
+
getSecret(name: string): Result<IKeyStoreSecretEntry>;
|
|
127
|
+
/**
|
|
128
|
+
* Checks if a secret exists.
|
|
129
|
+
* @param name - Name of the secret
|
|
130
|
+
* @returns Success with boolean, Failure if locked
|
|
131
|
+
* @public
|
|
132
|
+
*/
|
|
133
|
+
hasSecret(name: string): Result<boolean>;
|
|
134
|
+
/**
|
|
135
|
+
* Adds a new secret with a randomly generated key.
|
|
136
|
+
* @param name - Unique name for the secret
|
|
137
|
+
* @param options - Optional description
|
|
138
|
+
* @returns Success with the generated entry, Failure if locked or name invalid
|
|
139
|
+
* @public
|
|
140
|
+
*/
|
|
141
|
+
addSecret(name: string, options?: IAddSecretOptions): Promise<Result<IAddSecretResult>>;
|
|
142
|
+
/**
|
|
143
|
+
* Imports an existing secret key.
|
|
144
|
+
* @param name - Unique name for the secret
|
|
145
|
+
* @param key - The 32-byte AES-256 key
|
|
146
|
+
* @param options - Optional description, whether to replace existing
|
|
147
|
+
* @returns Success with entry, Failure if locked, key invalid, or exists and !replace
|
|
148
|
+
* @public
|
|
149
|
+
*/
|
|
150
|
+
importSecret(name: string, key: Uint8Array, options?: IImportSecretOptions): Result<IAddSecretResult>;
|
|
151
|
+
/**
|
|
152
|
+
* Adds a secret derived from a password using PBKDF2.
|
|
153
|
+
*
|
|
154
|
+
* Generates a random salt, derives a 32-byte AES-256 key from the password,
|
|
155
|
+
* and stores it in the vault. Returns the key derivation parameters so they
|
|
156
|
+
* can be stored alongside encrypted files, enabling decryption with just the
|
|
157
|
+
* password (without unlocking the keystore).
|
|
158
|
+
*
|
|
159
|
+
* @param name - Unique name for the secret
|
|
160
|
+
* @param password - Password to derive the key from
|
|
161
|
+
* @param options - Optional description, iterations, replace flag
|
|
162
|
+
* @returns Success with entry and keyDerivation params, Failure if locked or invalid
|
|
163
|
+
* @public
|
|
164
|
+
*/
|
|
165
|
+
addSecretFromPassword(name: string, password: string, options?: IAddSecretFromPasswordOptions): Promise<Result<IAddSecretFromPasswordResult>>;
|
|
166
|
+
/**
|
|
167
|
+
* Removes a secret by name.
|
|
168
|
+
* @param name - Name of the secret to remove
|
|
169
|
+
* @returns Success with removed entry, Failure if not found or locked
|
|
170
|
+
* @public
|
|
171
|
+
*/
|
|
172
|
+
removeSecret(name: string): Result<IKeyStoreSecretEntry>;
|
|
173
|
+
/**
|
|
174
|
+
* Imports an API key string into the vault.
|
|
175
|
+
* The string is UTF-8 encoded and stored with type `'api-key'`.
|
|
176
|
+
* @param name - Unique name for the secret
|
|
177
|
+
* @param apiKey - The API key string
|
|
178
|
+
* @param options - Optional description, whether to replace existing
|
|
179
|
+
* @returns Success with entry, Failure if locked, empty, or exists and !replace
|
|
180
|
+
* @public
|
|
181
|
+
*/
|
|
182
|
+
importApiKey(name: string, apiKey: string, options?: IImportSecretOptions): Result<IAddSecretResult>;
|
|
183
|
+
/**
|
|
184
|
+
* Retrieves an API key string by name.
|
|
185
|
+
* Only works for secrets with type `'api-key'`.
|
|
186
|
+
* @param name - Name of the secret
|
|
187
|
+
* @returns Success with the API key string, Failure if not found, locked, or wrong type
|
|
188
|
+
* @public
|
|
189
|
+
*/
|
|
190
|
+
getApiKey(name: string): Result<string>;
|
|
191
|
+
/**
|
|
192
|
+
* Lists secret names filtered by type.
|
|
193
|
+
* @param type - The secret type to filter by
|
|
194
|
+
* @returns Success with array of matching secret names, Failure if locked
|
|
195
|
+
* @public
|
|
196
|
+
*/
|
|
197
|
+
listSecretsByType(type: KeyStoreSecretType): Result<readonly string[]>;
|
|
198
|
+
/**
|
|
199
|
+
* Renames a secret.
|
|
200
|
+
* @param oldName - Current name
|
|
201
|
+
* @param newName - New name
|
|
202
|
+
* @returns Success with updated entry, Failure if source not found, target exists, or locked
|
|
203
|
+
* @public
|
|
204
|
+
*/
|
|
205
|
+
renameSecret(oldName: string, newName: string): Result<IKeyStoreSecretEntry>;
|
|
206
|
+
/**
|
|
207
|
+
* Saves the key store, returning the encrypted file content.
|
|
208
|
+
* Requires the master password to encrypt.
|
|
209
|
+
* @param password - The master password
|
|
210
|
+
* @returns Success with IKeyStoreFile, Failure if locked
|
|
211
|
+
* @public
|
|
212
|
+
*/
|
|
213
|
+
save(password: string): Promise<Result<IKeyStoreFile>>;
|
|
214
|
+
/**
|
|
215
|
+
* Changes the master password.
|
|
216
|
+
* Re-encrypts the vault with the new password-derived key.
|
|
217
|
+
* @param currentPassword - Current master password (for verification)
|
|
218
|
+
* @param newPassword - New master password
|
|
219
|
+
* @returns Success when password changed, Failure if locked or current password incorrect
|
|
220
|
+
* @public
|
|
221
|
+
*/
|
|
222
|
+
changePassword(currentPassword: string, newPassword: string): Promise<Result<KeyStore>>;
|
|
223
|
+
/** {@inheritDoc IEncryptionProvider.encryptByName} */
|
|
224
|
+
encryptByName<TMetadata = JsonValue>(secretName: string, content: JsonValue, metadata?: TMetadata): Promise<Result<IEncryptedFile<TMetadata>>>;
|
|
225
|
+
/**
|
|
226
|
+
* Creates a SecretProvider function for use with IEncryptionConfig.
|
|
227
|
+
* The returned function looks up secrets from this key store.
|
|
228
|
+
* @returns Success with SecretProvider, Failure if locked
|
|
229
|
+
* @public
|
|
230
|
+
*/
|
|
231
|
+
getSecretProvider(): Result<SecretProvider>;
|
|
232
|
+
/**
|
|
233
|
+
* Creates a partial IEncryptionConfig using this key store as the secret source.
|
|
234
|
+
* @returns Partial config that can be spread into a full IEncryptionConfig
|
|
235
|
+
* @public
|
|
236
|
+
*/
|
|
237
|
+
getEncryptionConfig(): Result<Pick<IEncryptionConfig, 'secretProvider' | 'cryptoProvider'>>;
|
|
238
|
+
}
|
|
239
|
+
//# sourceMappingURL=keyStore.d.ts.map
|