@opengeni/vaults-keeper 0.0.0-stage → 3.3.0

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/LICENSE ADDED
@@ -0,0 +1,190 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ Copyright 2026 Cloudgeni-ai
179
+
180
+ Licensed under the Apache License, Version 2.0 (the "License");
181
+ you may not use this file except in compliance with the License.
182
+ You may obtain a copy of the License at
183
+
184
+ http://www.apache.org/licenses/LICENSE-2.0
185
+
186
+ Unless required by applicable law or agreed to in writing, software
187
+ distributed under the License is distributed on an "AS IS" BASIS,
188
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
189
+ See the License for the specific language governing permissions and
190
+ limitations under the License.
package/README.md CHANGED
@@ -1,3 +1,148 @@
1
- # Temporary Holding Version
1
+ # `@opengeni/vaults-keeper`
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ The Keeper Secrets Manager (KSM) provider for Opengeni vaults. It implements
4
+ `VaultProvider` from `@opengeni/vaults` on a KSM application, using the
5
+ official `@keeper-security/secrets-manager-core` pinned to exactly 17.6.0.
6
+
7
+ Load it only with a dynamic `import()` from the API or the worker. Nothing
8
+ else may import it, and nothing may import the SDK as a module
9
+ (`test/import-guard.test.ts`).
10
+
11
+ ## Connecting: one-time token to configuration
12
+
13
+ A customer creates a KSM application, shares folders with it and generates a
14
+ one-time access token (`US:…`, `EU:…` and so on). The first request redeems
15
+ the token and binds a key pair; the result is the connection's credential.
16
+
17
+ ```ts
18
+ const keeper = await import("@opengeni/vaults-keeper");
19
+ const { configuration, accountName } = await keeper.bootstrapKeeperConfiguration({
20
+ oneTimeToken, // hostname is needed only for a token without a region prefix
21
+ persistConfiguration: async (configuration, { previous, reason }) => {
22
+ // reason "bind", previous null: store it encrypted before anything else runs
23
+ },
24
+ });
25
+ const provider = keeper.createKeeperVaultProvider({
26
+ configuration, // or the stored string record
27
+ persistConfiguration: async (next, { previous }) => {
28
+ // compare-and-swap the stored, encrypted configuration from `previous` to `next`
29
+ },
30
+ });
31
+ ```
32
+
33
+ `bootstrapKeeperVaultProvider(options)` does both and returns
34
+ `{ provider, configuration, accountName }`. It requires
35
+ `persistConfiguration` and awaits it with the bound configuration before
36
+ returning, so a later validate or list failure cannot lose a spent token's
37
+ credential.
38
+
39
+ - **Redeem once, save at once.** As soon as Keeper has bound the key pair,
40
+ the configuration is passed to `persistConfiguration` (`previous: null`,
41
+ `reason: "bind"`), even if something after the bind failed. If that save
42
+ fails, bootstrap reports `provider_unavailable` (without the configuration)
43
+ and the customer generates a new token. A lost bind response is
44
+ `provider_outcome_unknown` and is never retried, and so is a 5xx or any
45
+ other unexpected status (Keeper may have applied the bind behind a failing
46
+ gateway). A definite refusal is
47
+ `provider_auth_invalid`. If the application is IP-locked, the first request
48
+ locks it to the Opengeni egress address.
49
+ - **Configuration.** JSON, base64 JSON (as Keeper tools export it) or a
50
+ string record. The adapter emits canonical JSON of a string record, with
51
+ binary entries in base64; `keeperConfigurationRecord()` returns the record
52
+ for structured storage. Only the known keys are kept; `hostname`,
53
+ `clientId`, `privateKey` and `appKey` are required. The host must be on
54
+ `allowedHosts` (default `KEEPER_REGION_HOSTS`: US, EU, AU, GOV, JP, CA and
55
+ IL5), checked before every request.
56
+ - **Rotation.** When the server rotates its key, the SDK changes the
57
+ configuration and the adapter awaits `persistConfiguration` (`reason:
58
+ "rotation"`, `previous` the last saved value). If that fails,
59
+ the change stays pending and is persisted first on the next call, and the
60
+ read fails with `provider_unavailable` (a write that already happened still
61
+ succeeds). `currentConfiguration()` returns the latest value.
62
+
63
+ Other options: `allowedHosts`, `requestTimeoutMs` (default 15 s),
64
+ `valueCacheMs`, `operations` (the operations verified at setup; the provider
65
+ narrows to them and refuses the rest before any request) and `fetch`. Servers
66
+ pass a DNS-pinned `fetch` (the API and worker use `pinnedFetch` from
67
+ `@opengeni/network`); both the KSM transport and file downloads use it and
68
+ still apply the caller's abort signal, deadline, size bound and no-redirect
69
+ rule. `queryFunction`, `fetchFile`, `sdk` and `now` exist for tests.
70
+
71
+ Servers usually call `openKeeperConnection({ credentials, persistConfiguration,
72
+ operations, fetch })` instead. `credentials` is either `{ oneTimeToken,
73
+ hostname? }` or `{ configuration }` (a string record or JSON), and
74
+ `persistConfiguration(record, { reason })` is required: without it the call
75
+ refuses before any request. It returns `{ provider, configuration }`, the
76
+ bound configuration as a string record, never the token.
77
+
78
+ ## How it uses the SDK
79
+
80
+ The SDK keeps its keys in module-global state and, by default, can write its
81
+ configuration and a response cache to disk. So the adapter never imports it
82
+ as a module. `createKeeperSdkLoader` reads the SDK's `dist/index.cjs.js`,
83
+ checks it against `KEEPER_SDK_SHA256`, and evaluates a fresh copy for every
84
+ operation:
85
+
86
+ - each operation has its own key cache, so connections in one process never
87
+ share key material;
88
+ - `fs` is a stub with constants only, and `https` and `os` are empty, so the
89
+ SDK cannot touch disk or open its own connections;
90
+ - configuration lives only in an in-memory store per operation;
91
+ - requests go through the adapter's transport: POST only, no redirects, a
92
+ deadline and abort, and responses of at most 32 MB;
93
+ - SDK console output is captured, bounded and never forwarded. Records the
94
+ SDK skips because they cannot be decrypted make a listing
95
+ `provider_inventory_incomplete`.
96
+
97
+ Bundlers must keep `@keeper-security/secrets-manager-core` as an installed,
98
+ external package: the loader resolves and reads its file at run time.
99
+
100
+ Each operation is charged to the attempt's call budget, and operations for
101
+ one connection are serialized. Throttling is reported at once as
102
+ `provider_rate_limited` with Keeper's retry hint.
103
+
104
+ ## What it can do
105
+
106
+ Vaults are the application's **shared folders**. Records shared directly to
107
+ the application, outside a shared folder, are not listed. Subfolders are
108
+ part of their shared folder.
109
+
110
+ | Operation | Supported | Notes |
111
+ | --- | --- | --- |
112
+ | List vaults | yes | Shared folders; `writeAccess` is `"unknown"` because KSM does not report it. |
113
+ | List items, read values | yes | Values read live, cached per attempt; `forceRefresh` bypasses the cache. |
114
+ | Read files | yes | Size-checked, downloaded over HTTPS and decrypted in memory, at most 256 KiB. |
115
+ | Create | login, note | In an existing shared folder. API key, file and passkey items are refused before any request. |
116
+ | Update | yes | Field patch with the record revision as the version; a stale version is `provider_conflict`. Standard fields are emptied, custom fields removed. Structured fields (cards, bank accounts, key pairs, security questions) cannot be patched. |
117
+ | TOTP | create and update | `oneTimeCode` fields. |
118
+ | Archive, delete | **no** | KSM can only delete permanently, which the adapter does not expose. |
119
+ | Create vault, write files | no | |
120
+
121
+ Read-only shared folders and other permission checks are enforced by
122
+ Keeper; a refused write is `provider_permission_denied`. A write whose
123
+ response is lost, or answered with anything but 400, 401, 403, 404, 409 or
124
+ 429 (`KEEPER_DEFINITE_REJECTION_STATUSES`), is `provider_outcome_unknown`
125
+ and is never retried.
126
+
127
+ The per-attempt record cache belongs to one provider instance (one bound
128
+ application), so providers that share an attempt budget never reuse each
129
+ other's records. Records with more than 50 fields or 20 websites (or a
130
+ website over 2,048 characters) make the listing
131
+ `provider_inventory_incomplete` instead of being mirrored cut down.
132
+
133
+ Field ids: `f:<type>` (standard fields), `c:<label or type>` (custom
134
+ fields), `@notes` and `@file:<fileUid>`, with `#n` on repeated names.
135
+ Records report their revision as the version and no update time.
136
+
137
+ ## Testing
138
+
139
+ `bun test` runs against `test/fake-ksm.ts`, a fake KSM server that speaks
140
+ the wire protocol with real cryptography (key binding, AES-GCM and CBC,
141
+ ECDSA request signatures and key rotation). It covers the shared provider
142
+ contract (read side), bootstrap, configuration rotation and persistence
143
+ failure, reads, writes, permissions, conflicts, lost responses, throttling,
144
+ budgets, aborts and SDK isolation.
145
+
146
+ No live Keeper account was used. Request shapes come from the SDK source;
147
+ the error bodies for throttling, permissions and revision conflicts follow
148
+ the SDK's handling and Keeper documentation and are not verified live.
@@ -0,0 +1,40 @@
1
+ import { type KeeperRuntimeOptions, type KeeperVaultProvider, type PersistKeeperConfiguration } from "./provider.js";
2
+ export interface KeeperBootstrapOptions extends KeeperRuntimeOptions {
3
+ /** One-time access token, `REGION:key` (for example `US:…`), or a bare key with `hostname`. */
4
+ oneTimeToken: string;
5
+ /** Region host for a token without a region prefix. */
6
+ hostname?: string;
7
+ signal?: AbortSignal;
8
+ /**
9
+ * Awaited with the bound configuration (`previous: null`, `reason: "bind"`)
10
+ * as soon as Keeper has accepted the token, before bootstrap returns or
11
+ * reports a later failure. The token is spent at that point, so this is the
12
+ * only copy of the credential.
13
+ */
14
+ persistConfiguration?: PersistKeeperConfiguration;
15
+ }
16
+ export interface KeeperBootstrapResult {
17
+ /** Bound KSM configuration (JSON). Store it encrypted; it is the connection's credential. */
18
+ configuration: string;
19
+ /** The Secrets Manager application's title. */
20
+ accountName: string | null;
21
+ }
22
+ /** The region host a token names, checked against the allowlist before any network call. */
23
+ export declare function keeperTokenHost(oneTimeToken: string, hostname?: string): string;
24
+ /**
25
+ * Redeems a one-time access token once: generates the client key pair in
26
+ * memory, binds it with the first `get_secret` call, and returns the bound
27
+ * configuration. The token is never retried; an ambiguous failure means the
28
+ * customer must generate a new token.
29
+ */
30
+ export declare function bootstrapKeeperConfiguration(options: KeeperBootstrapOptions): Promise<KeeperBootstrapResult>;
31
+ /**
32
+ * Bootstrap, then a provider over the bound configuration. The configuration
33
+ * is persisted through `persistConfiguration` (reason `"bind"`) before this
34
+ * returns and before the provider makes any request.
35
+ */
36
+ export declare function bootstrapKeeperVaultProvider(options: KeeperBootstrapOptions & {
37
+ persistConfiguration: PersistKeeperConfiguration;
38
+ }): Promise<KeeperBootstrapResult & {
39
+ provider: KeeperVaultProvider;
40
+ }>;
@@ -0,0 +1,41 @@
1
+ import type { KeyValueStorage } from "./sdk.js";
2
+ /** Region prefixes of a one-time token (`US:…`), as mapped by SDK 17.6.0 `initializeStorage`. */
3
+ export declare const KEEPER_REGION_HOSTS: {
4
+ readonly US: "keepersecurity.com";
5
+ readonly EU: "keepersecurity.eu";
6
+ readonly AU: "keepersecurity.com.au";
7
+ readonly GOV: "govcloud.keepersecurity.us";
8
+ readonly JP: "keepersecurity.jp";
9
+ readonly CA: "keepersecurity.ca";
10
+ readonly IL5: "il5.keepersecurity.us";
11
+ };
12
+ /**
13
+ * Hosts a configuration may talk to. The SDK treats an unknown token prefix
14
+ * as a host name, so without this list a crafted token or configuration could
15
+ * point Opengeni's server at an arbitrary host.
16
+ */
17
+ export declare const KEEPER_DEFAULT_ALLOWED_HOSTS: readonly string[];
18
+ /** Keys of the standard KSM JSON configuration. Bytes are standard base64. */
19
+ export declare const KEEPER_CONFIG_KEYS: readonly ["hostname", "clientId", "clientKey", "privateKey", "appKey", "appOwnerPublicKey", "serverPublicKeyId", "serverPublicKey"];
20
+ export type KeeperConfigKey = (typeof KEEPER_CONFIG_KEYS)[number];
21
+ export type KeeperConfigValues = Map<KeeperConfigKey, string>;
22
+ /**
23
+ * Parses a bound KSM configuration (JSON, or base64 of JSON as Keeper tools
24
+ * export it, or the already parsed string record). Unknown keys are dropped;
25
+ * the client must already be bound (appKey present).
26
+ */
27
+ export declare function parseKeeperConfiguration(input: string | Readonly<Record<string, string>>): KeeperConfigValues;
28
+ /** The canonical JSON form (sorted known keys) handed to the persistence callback. */
29
+ export declare function serializeKeeperConfiguration(values: KeeperConfigValues): string;
30
+ /** The canonical string record of a bound configuration, for structured storage. */
31
+ export declare function keeperConfigurationRecord(configuration: string | Readonly<Record<string, string>>): Record<string, string>;
32
+ export declare function assertAllowedHost(hostname: string | undefined, allowed: readonly string[]): string;
33
+ /**
34
+ * In-memory KSM storage over a copy of the configuration. Nothing reaches
35
+ * disk; `changed` reports whether the SDK rewrote any persisted key (binding,
36
+ * server key rotation) so the caller can persist the new configuration.
37
+ */
38
+ export declare function memoryKeeperStorage(initial?: KeeperConfigValues): KeyValueStorage & {
39
+ readonly values: KeeperConfigValues;
40
+ changed(): boolean;
41
+ };
@@ -0,0 +1,37 @@
1
+ import { type VaultProviderOperations } from "./contract.js";
2
+ import { type KeeperRuntimeOptions, type KeeperVaultProvider } from "./provider.js";
3
+ /** What a server stores for a Keeper connection: setup input, or the bound configuration. */
4
+ export type KeeperConnectionCredentials = {
5
+ oneTimeToken: string;
6
+ hostname?: string;
7
+ } | {
8
+ configuration: string | Readonly<Record<string, string>>;
9
+ };
10
+ /**
11
+ * Durable, encrypted storage for the bound configuration. Called with
12
+ * `reason: "bind"` when a one-time token is redeemed (before anything else
13
+ * runs) and `reason: "rotation"` when Keeper rotates its key.
14
+ */
15
+ export type PersistKeeperConfigurationRecord = (configuration: Record<string, string>, context: {
16
+ reason: "bind" | "rotation";
17
+ }) => Promise<void>;
18
+ export interface OpenKeeperConnectionOptions extends KeeperRuntimeOptions {
19
+ credentials: KeeperConnectionCredentials;
20
+ /** Required: without durable storage a redeemed token or a rotated key would be lost. */
21
+ persistConfiguration?: PersistKeeperConfigurationRecord;
22
+ /** Operations verified at setup; the provider narrows to them. */
23
+ operations?: VaultProviderOperations;
24
+ valueCacheMs?: number;
25
+ signal?: AbortSignal;
26
+ }
27
+ /**
28
+ * One Keeper connection for a server: redeems a one-time token or opens a
29
+ * stored configuration, and returns the provider with the bound configuration
30
+ * as a string record. The one-time token is never part of the result. Each
31
+ * call has its own provider; SDK state is per operation, so connections never
32
+ * share keys.
33
+ */
34
+ export declare function openKeeperConnection(options: OpenKeeperConnectionOptions): Promise<{
35
+ provider: KeeperVaultProvider;
36
+ configuration: Record<string, string>;
37
+ }>;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * The shared vault contracts this adapter implements, re-exported for the
3
+ * package's modules so every file names one source.
4
+ */
5
+ export { VaultProviderError, type ProviderCallBudget, type ProviderCallOperation, type ProviderFieldMeta, type ProviderFieldValue, type ProviderItemMeta, type ProviderVault, type ProviderWriteField, type ProviderWriteItem, type VaultProvider, type VaultProviderAuthority, type VaultProviderCapabilities, type VaultProviderContext, type VaultProviderErrorCode, } from "@opengeni/vaults";
6
+ export { VAULT_LIMITS, parseTotpInput, type SecretMaterial, type TotpParams, type VaultFieldKind, type VaultItemType, type VaultProviderOperations, } from "@opengeni/contracts";
@@ -0,0 +1,36 @@
1
+ import { VaultProviderError } from "./contract.js";
2
+ export interface KeeperErrorBody {
3
+ code: string | null;
4
+ message: string;
5
+ retryAfterSeconds: number | null;
6
+ }
7
+ /** Parses the JSON error body the SDK embeds in its Error message. */
8
+ export declare function keeperErrorBody(error: unknown): KeeperErrorBody | null;
9
+ export declare function isAbortLike(error: unknown): boolean;
10
+ /**
11
+ * Maps any failure of a read-side operation. stderr-like SDK text never
12
+ * leaves this function; only a closed result code may appear in messages.
13
+ */
14
+ export declare function mapKeeperError(error: unknown, subject: string): VaultProviderError;
15
+ /** Tracks one mutation's requests so a failure can be classified as definite or unknown. */
16
+ export interface MutationTracker {
17
+ /** Requests started for the mutation itself. */
18
+ sent: number;
19
+ /** Status of the last mutation response, if one arrived. */
20
+ lastStatus: number | null;
21
+ }
22
+ /**
23
+ * Statuses with which Keeper refuses a request before applying it: a bad or
24
+ * unauthorised request (400, 401, 403), a missing target (404), a revision
25
+ * conflict (409) or throttling (429). Any other status after the request was
26
+ * sent (5xx from Keeper or a proxy, an unexpected 2xx or 3xx) may follow an
27
+ * applied change.
28
+ */
29
+ export declare const KEEPER_DEFINITE_REJECTION_STATUSES: ReadonlySet<number>;
30
+ /**
31
+ * A mutation failure is definite only when nothing was sent, or Keeper
32
+ * answered the last request with a known rejection status. A transport
33
+ * failure, deadline or abort after sending, any other status (502 included),
34
+ * or any failure after a 200, leaves the outcome unknown.
35
+ */
36
+ export declare function mapKeeperMutationError(error: unknown, subject: string, tracker: MutationTracker): VaultProviderError;
@@ -0,0 +1,8 @@
1
+ export { KEEPER_OPERATIONS, KEEPER_VALUE_CACHE_MS, createKeeperVaultProvider, type KeeperRuntimeOptions, type KeeperVaultProvider, type KeeperVaultProviderOptions, type PersistKeeperConfiguration, } from "./provider.js";
2
+ export { bootstrapKeeperConfiguration, bootstrapKeeperVaultProvider, keeperTokenHost, type KeeperBootstrapOptions, type KeeperBootstrapResult, } from "./bootstrap.js";
3
+ export { KEEPER_CONFIG_KEYS, KEEPER_DEFAULT_ALLOWED_HOSTS, KEEPER_REGION_HOSTS, keeperConfigurationRecord, parseKeeperConfiguration, serializeKeeperConfiguration, } from "./config.js";
4
+ export { KEEPER_MAX_RESPONSE_BYTES, KEEPER_REQUEST_TIMEOUT_MS, KEEPER_SDK_PACKAGE, KEEPER_SDK_SHA256, KEEPER_SDK_VERSION, createKeeperSdkLoader, type KeeperFetch, type KeeperFileFetcher, type KeeperQueryFunction, type KeeperSdkLoader, } from "./sdk.js";
5
+ export { FILE_FIELD_PREFIX, NOTES_FIELD_ID } from "./mapping.js";
6
+ export { openKeeperConnection, type KeeperConnectionCredentials, type OpenKeeperConnectionOptions, type PersistKeeperConfigurationRecord, } from "./connection.js";
7
+ export { restrictToOperations } from "./operations.js";
8
+ export { KEEPER_DEFINITE_REJECTION_STATUSES } from "./errors.js";