@k9o/kibo 0.0.0-stage → 1.1.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 +201 -0
- package/NOTICE +4 -0
- package/README.md +273 -2
- package/dist/index.d.ts +266 -0
- package/dist/index.js +259 -0
- package/dist/index.js.map +1 -0
- package/dist/types.d.ts +161 -0
- package/dist/types.js +1 -0
- package/dist/types.js.map +1 -0
- package/package.json +44 -4
- package/src/client-factory.ts +24 -0
- package/src/crypto-types.ts +117 -0
- package/src/crypto.ts +133 -0
- package/src/index.ts +33 -0
- package/src/types.ts +171 -0
- package/src/vault.ts +212 -0
- package/wasm/kibo_kms_rest_ffi.d.ts +54 -0
- package/wasm/kibo_kms_rest_ffi.js +887 -0
- package/wasm/kibo_kms_rest_ffi_bg.wasm +0 -0
- package/wasm/kibo_kms_rest_ffi_bg.wasm.d.ts +26 -0
package/src/types.ts
ADDED
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@k9o/kibo` — Zero-Knowledge BYOK/HYOK vault SDK types.
|
|
3
|
+
*
|
|
4
|
+
* Surface: the ZK-DEK store/fetch. The wrapped
|
|
5
|
+
* envelope is produced client-side by the audited ZK core (the
|
|
6
|
+
* `kibo-kms-rest` binding); this SDK ships it **verbatim and opaque** and never
|
|
7
|
+
* reads its interior — the strict-ZK invariant + envelope framing live in the
|
|
8
|
+
* core, never here.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
/** Customer KMS/HSM provider — non-secret routing metadata (mirrors the ZK FFI provider selector). */
|
|
12
|
+
export type KmsProvider = "aws-kms" | "gcp-kms" | "azure-kv" | "hashicorp-vault";
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Input to store an opaque customer-wrapped DEK.
|
|
16
|
+
* `provider` + `keyVersionRef` are explicit non-secret fields the SDK supplies
|
|
17
|
+
* (vault-ops never parses the envelope to derive them).
|
|
18
|
+
*/
|
|
19
|
+
export type StoreZkDekInput = {
|
|
20
|
+
/** base64 opaque `WrappedDek` envelope (AEAD-sealed under the customer KEK). */
|
|
21
|
+
envelope: string;
|
|
22
|
+
/** Which customer KMS/HSM holds the wrapping KEK. */
|
|
23
|
+
provider: KmsProvider;
|
|
24
|
+
/** Customer key reference (KMS ARN / GCP resource / AKV id / Vault path). */
|
|
25
|
+
keyVersionRef: string;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
/** Store response — the opaque `zkdek_<base62>` handle + creation timestamp. */
|
|
29
|
+
export type ZkDekHandle = {
|
|
30
|
+
/** `zkdek_<base62>` handle. */
|
|
31
|
+
id: string;
|
|
32
|
+
createdAt: string;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
/** Fetch response — the stored record: opaque envelope + non-secret metadata. */
|
|
36
|
+
export type ZkDekRecord = {
|
|
37
|
+
id: string;
|
|
38
|
+
/** base64 opaque `WrappedDek` envelope, returned verbatim for the customer to unwrap. */
|
|
39
|
+
envelope: string;
|
|
40
|
+
provider: KmsProvider;
|
|
41
|
+
keyVersionRef: string;
|
|
42
|
+
createdAt: string;
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
/** secret visibility — write ops (create/update) stay owner-only regardless of this tag. */
|
|
46
|
+
export type SecretVisibility =
|
|
47
|
+
| { kind: "private" }
|
|
48
|
+
| { kind: "shared"; principals?: string[]; roles?: string[] };
|
|
49
|
+
|
|
50
|
+
/** Input to create a vault secret — `POST /@<projectSlug>/vault/secrets/<name>?region=<region>`. */
|
|
51
|
+
export type CreateSecretInput = {
|
|
52
|
+
/** Hierarchical path the secret is addressed under, e.g. `byos/s3-prod` (also the `:name` URL segment). */
|
|
53
|
+
name: string;
|
|
54
|
+
/** The plaintext to seal, as a regular (non-base64) string — `vault.secrets.create` base64-encodes
|
|
55
|
+
* it for the wire itself (live-verified against staging: the route's OpenAPI description says
|
|
56
|
+
* "the plaintext to seal" but a raw non-base64 `value` is rejected as unparseable). */
|
|
57
|
+
value: string;
|
|
58
|
+
/** The authoritative region for this vault write (sent as `?region=`), REQUIRED — the vault-forward
|
|
59
|
+
* proxy fail-closes without it (live-verified against staging, not documented in the route's
|
|
60
|
+
* OpenAPI schema as of this writing). Distinct from any region carried inside `value`'s own
|
|
61
|
+
* envelope. */
|
|
62
|
+
region: string;
|
|
63
|
+
visibility?: SecretVisibility;
|
|
64
|
+
metadata?: Record<string, string>;
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
/** A secret WITHOUT its sealed ciphertext — the create/list/read metadata shape. */
|
|
68
|
+
export type SecretSummary = {
|
|
69
|
+
/** `sec_<base62>`. */
|
|
70
|
+
id: string;
|
|
71
|
+
name: string;
|
|
72
|
+
ownerId: string;
|
|
73
|
+
visibility: SecretVisibility;
|
|
74
|
+
version: number;
|
|
75
|
+
/** The wrapping-key id at this version. */
|
|
76
|
+
kid: string;
|
|
77
|
+
createdAt: string;
|
|
78
|
+
createdBy: string;
|
|
79
|
+
updatedAt: string;
|
|
80
|
+
updatedBy: string;
|
|
81
|
+
rotatedAt: string | null;
|
|
82
|
+
retiredAt: string | null;
|
|
83
|
+
metadata: Record<string, string>;
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
/** `client.kibo.vault.secrets.list()` input — none of these need `region` (live-verified: unlike every
|
|
87
|
+
* other secrets operation, list is NOT region-gated). */
|
|
88
|
+
export type ListSecretsInput = {
|
|
89
|
+
/** Filter to a path prefix. */
|
|
90
|
+
prefix?: string;
|
|
91
|
+
cursor?: string;
|
|
92
|
+
limit?: number;
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
export type ListSecretsResult = {
|
|
96
|
+
secrets: readonly SecretSummary[];
|
|
97
|
+
nextCursor: string | null;
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
/** releasing-node observed attestation tier (K4) — present on every reveal. */
|
|
101
|
+
export type AttestationTier = {
|
|
102
|
+
/** `attestation:destination:region` trust-tier URN. */
|
|
103
|
+
urn: string;
|
|
104
|
+
/** Node provenance: `platform` (Kibo-operated) or `client` (Private Perimeter). */
|
|
105
|
+
operator: string;
|
|
106
|
+
/** Whether node attestation was verified against the vendor PKI on the URN's attestation segment. */
|
|
107
|
+
verified: boolean;
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
/** `revealChallenge()` result — a single-use challenge to present on the immediately-following `reveal()`. */
|
|
111
|
+
export type RevealChallenge = {
|
|
112
|
+
challenge: string;
|
|
113
|
+
expiresAt: string;
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
/** `reveal()` result. `value` is the decoded plaintext (the SDK base64-decodes the wire value, the
|
|
117
|
+
* inverse of `create`'s encode) — never the raw base64. */
|
|
118
|
+
export type RevealSecretResult = {
|
|
119
|
+
id: string;
|
|
120
|
+
name: string;
|
|
121
|
+
version: number;
|
|
122
|
+
value: string;
|
|
123
|
+
revealedAt: string;
|
|
124
|
+
attestationTier: AttestationTier;
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
/** `update()` input. */
|
|
128
|
+
export type UpdateSecretInput = {
|
|
129
|
+
/** The authoritative region for this write (sent as `?region=`), REQUIRED — same live-verified gate
|
|
130
|
+
* as `create`. */
|
|
131
|
+
region: string;
|
|
132
|
+
/** New plaintext — bumps `version`. The SDK base64-encodes it for the wire. */
|
|
133
|
+
value: string;
|
|
134
|
+
metadata?: Record<string, string>;
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* `update()` result — 🔴 live-verified NARROWER than the documented `SecretSummary`: the gateway
|
|
139
|
+
* returns only `{id, name, version}` on a real PUT, not the full summary the OpenAPI schema claims.
|
|
140
|
+
* Typed to what's actually observed rather than the aspirational doc shape; call `get()` afterward if
|
|
141
|
+
* the full summary is needed.
|
|
142
|
+
*/
|
|
143
|
+
export type UpdateSecretResult = {
|
|
144
|
+
id: string;
|
|
145
|
+
name: string;
|
|
146
|
+
version: number;
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* `rotate()` result — 🔴 live-verified shape, not documented anywhere in the OpenAPI schema (the route
|
|
151
|
+
* only declares `t.Union([SecretSummary, RevealChallengeResponse])`, which this matches neither).
|
|
152
|
+
* `ledgerSequenceNumber` is undocumented; kept as-observed.
|
|
153
|
+
*/
|
|
154
|
+
export type RotateSecretResult = {
|
|
155
|
+
id: string;
|
|
156
|
+
name: string;
|
|
157
|
+
version: number;
|
|
158
|
+
rotatedAt: string;
|
|
159
|
+
ledgerSequenceNumber: number;
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* `move()` result — 🔴 live-verified shape, also not the documented `SecretSummary`: no `version`, and
|
|
164
|
+
* an undocumented `event` field (`"SECRET_PATH_CHANGED"` observed; typed as `string` since only one
|
|
165
|
+
* sample was seen and a closed enum can't be asserted from one observation).
|
|
166
|
+
*/
|
|
167
|
+
export type MoveSecretResult = {
|
|
168
|
+
id: string;
|
|
169
|
+
name: string;
|
|
170
|
+
event: string;
|
|
171
|
+
};
|
package/src/vault.ts
ADDED
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `client.kibo.vault.*` — the Kibo vault surface.
|
|
3
|
+
*
|
|
4
|
+
* `vault.zkDeks.{store,fetch}` — member-plane,
|
|
5
|
+
* project-scoped storage of the opaque customer-wrapped DEK envelope. Zero
|
|
6
|
+
* crypto SDK-side: this is a plain authenticated REST round-trip carrying an
|
|
7
|
+
* opaque blob (the wrapping happens in the ZK core, piece C). The encryption
|
|
8
|
+
* surface (`kibo.encrypt`/`decrypt`) is provided by the ZK core binding when it is
|
|
9
|
+
* bundled.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
import { request, type HttpClientConfig } from "@k9o/core/http";
|
|
13
|
+
import { projectPath } from "@k9o/core/url-grammar";
|
|
14
|
+
import { KError } from "@k9o/core/errors";
|
|
15
|
+
import type { Envelope } from "@k9o/core/envelope";
|
|
16
|
+
import type {
|
|
17
|
+
StoreZkDekInput, ZkDekHandle, ZkDekRecord,
|
|
18
|
+
CreateSecretInput, SecretSummary, ListSecretsInput, ListSecretsResult,
|
|
19
|
+
RevealChallenge, RevealSecretResult, UpdateSecretInput, UpdateSecretResult,
|
|
20
|
+
RotateSecretResult, MoveSecretResult,
|
|
21
|
+
} from "./types.ts";
|
|
22
|
+
|
|
23
|
+
/** UTF-8-safe base64 encode, usable across browser/Node/Bun (unlike `Buffer`) — the vault-secrets wire
|
|
24
|
+
* `value` field is base64 (live-verified; the OpenAPI "plaintext to seal" description does not mean
|
|
25
|
+
* raw-on-the-wire). */
|
|
26
|
+
function encodeBase64Utf8(plaintext: string): string {
|
|
27
|
+
return btoa(unescape(encodeURIComponent(plaintext)));
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/** Inverse of {@link encodeBase64Utf8} — decodes a revealed wire `value` back to plaintext. */
|
|
31
|
+
function decodeBase64Utf8(b64: string): string {
|
|
32
|
+
return decodeURIComponent(escape(atob(b64)));
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/** Both `vault.zkDeks` and `vault.secrets` require a project context (member-plane, /). */
|
|
36
|
+
function requireProjectSlug(config: HttpClientConfig): string {
|
|
37
|
+
if (config.projectSlug === undefined || config.projectSlug.length === 0) {
|
|
38
|
+
throw new KError({
|
|
39
|
+
code: "K9O_MISSING_PROJECT_CONTEXT",
|
|
40
|
+
message: "client.kibo.vault requires a bound projectSlug (member-plane resource)",
|
|
41
|
+
context: {},
|
|
42
|
+
recommendation: "Pass projectSlug when constructing the client.",
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
return config.projectSlug;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export function makeVaultNamespace(config: HttpClientConfig) {
|
|
49
|
+
return {
|
|
50
|
+
/** ZK-DEK opaque store/fetch (F.5). */
|
|
51
|
+
zkDeks: {
|
|
52
|
+
/**
|
|
53
|
+
* Store an opaque customer-wrapped DEK envelope.
|
|
54
|
+
* `POST /@<projectSlug>/vault/zk-deks` → the `zkdek_<base62>` handle.
|
|
55
|
+
* The SDK ships the envelope verbatim; it is never parsed here.
|
|
56
|
+
*/
|
|
57
|
+
async store(input: StoreZkDekInput): Promise<Envelope<ZkDekHandle>> {
|
|
58
|
+
return request<ZkDekHandle>(config, {
|
|
59
|
+
method: "POST",
|
|
60
|
+
path: projectPath(requireProjectSlug(config), "vault/zk-deks"),
|
|
61
|
+
body: input,
|
|
62
|
+
});
|
|
63
|
+
},
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Fetch a stored `WrappedDek` by its handle.
|
|
67
|
+
* `GET /@<projectSlug>/vault/zk-deks/<id>` → the opaque envelope + the
|
|
68
|
+
* non-secret `provider`/`keyVersionRef` the caller needs to unwrap it.
|
|
69
|
+
*/
|
|
70
|
+
async fetch(id: string): Promise<Envelope<ZkDekRecord>> {
|
|
71
|
+
return request<ZkDekRecord>(config, {
|
|
72
|
+
method: "GET",
|
|
73
|
+
path: projectPath(requireProjectSlug(config), `vault/zk-deks/${encodeURIComponent(id)}`),
|
|
74
|
+
});
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* typed secrets surface (`services/gateway/src/routes/vault-secrets.ts`) — the full family:
|
|
80
|
+
* list/get/create/revealChallenge/reveal/update/rotate/move/delete. Every operation on a NAMED
|
|
81
|
+
* secret (everything except `list`) requires `region` — live-verified against staging, not
|
|
82
|
+
* documented in the route's OpenAPI schema. `list` is the one exception (verified it does NOT
|
|
83
|
+
* need `region`).
|
|
84
|
+
*
|
|
85
|
+
* Response shapes for `update`/`rotate`/`move` are typed to what the gateway ACTUALLY returns
|
|
86
|
+
* (live-verified), not the OpenAPI's documented (and inaccurate for these three) `SecretSummary` —
|
|
87
|
+
* see the 🔴 notes on `UpdateSecretResult`/`RotateSecretResult`/`MoveSecretResult` in `types.ts`.
|
|
88
|
+
*/
|
|
89
|
+
secrets: {
|
|
90
|
+
/** List secrets (metadata only — never lists ciphertext). `GET /@<projectSlug>/vault/secrets`.
|
|
91
|
+
* The one secrets operation that does NOT need `region` (live-verified). */
|
|
92
|
+
async list(input?: ListSecretsInput): Promise<Envelope<ListSecretsResult>> {
|
|
93
|
+
return request<ListSecretsResult>(config, {
|
|
94
|
+
method: "GET",
|
|
95
|
+
path: projectPath(requireProjectSlug(config), "vault/secrets"),
|
|
96
|
+
query: { prefix: input?.prefix, cursor: input?.cursor, limit: input?.limit },
|
|
97
|
+
});
|
|
98
|
+
},
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Read a secret's metadata (never its value — use `revealChallenge`+`reveal` for that).
|
|
102
|
+
* `GET /@<projectSlug>/vault/secrets/<name>?region=<region>`.
|
|
103
|
+
*
|
|
104
|
+
* 🔴 KNOWN LIVE BUG (staging, 2026-09-05): this call currently fails with
|
|
105
|
+
* `K9O_REVEAL_CHALLENGE_REQUIRED` on every attempt — the gateway/kibo does not honor the
|
|
106
|
+
* documented "no `X-K9O-Reveal-Challenge` header ⇒ return metadata" behavior; it demands a
|
|
107
|
+
* challenge unconditionally. Implemented per the documented contract (this is a backend defect,
|
|
108
|
+
* not a client workaround); `list({prefix: exactName})` is the current working alternative for a
|
|
109
|
+
* single secret's metadata until the gateway/kibo side is fixed.
|
|
110
|
+
*/
|
|
111
|
+
async get(name: string, opts: { region: string }): Promise<Envelope<SecretSummary>> {
|
|
112
|
+
return request<SecretSummary>(config, {
|
|
113
|
+
method: "GET",
|
|
114
|
+
path: projectPath(requireProjectSlug(config), `vault/secrets/${encodeURIComponent(name)}`),
|
|
115
|
+
query: { region: opts.region },
|
|
116
|
+
});
|
|
117
|
+
},
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Create a secret under the caller's own auth.
|
|
121
|
+
* `POST /@<projectSlug>/vault/secrets/<name>?region=<region>` → the `sec_<base62>` summary.
|
|
122
|
+
*
|
|
123
|
+
* 🔴 `region` is REQUIRED on the query string, live-verified against staging — the vault-forward
|
|
124
|
+
* proxy fail-closes with `K9O_INVALID_FIELD_VALUE` ("this request requires an authoritative
|
|
125
|
+
* region") without it. Distinct from any `region` carried inside `input.value`'s envelope (e.g.
|
|
126
|
+
* the BYOS aws_sigv4 STS-signing region): this one scopes the vault WRITE itself, mirroring the
|
|
127
|
+
* gateway's `gatewayRegion()` residency guard (region-guard.ts) that closed a 2026-08 wrong-region
|
|
128
|
+
* incident for the audit path — the request-shape unit tests never caught this because they don't
|
|
129
|
+
* exercise a real gateway.
|
|
130
|
+
*/
|
|
131
|
+
async create(input: CreateSecretInput): Promise<Envelope<SecretSummary>> {
|
|
132
|
+
const { name, region, value, ...rest } = input;
|
|
133
|
+
return request<SecretSummary>(config, {
|
|
134
|
+
method: "POST",
|
|
135
|
+
path: projectPath(requireProjectSlug(config), `vault/secrets/${encodeURIComponent(name)}`),
|
|
136
|
+
query: { region },
|
|
137
|
+
// Live-verified against staging: the wire `value` MUST be base64 — a raw plaintext string
|
|
138
|
+
// (matching the route's own "the plaintext to seal" OpenAPI description literally) is
|
|
139
|
+
// rejected with K9O_INVALID_FIELD_VALUE "Request body could not be parsed." `input.value`
|
|
140
|
+
// stays the caller-facing plaintext; base64 is purely a wire-transport detail handled here.
|
|
141
|
+
body: { ...rest, value: encodeBase64Utf8(value) },
|
|
142
|
+
});
|
|
143
|
+
},
|
|
144
|
+
|
|
145
|
+
/** Mint a single-use reveal challenge — present it as `X-K9O-Reveal-Challenge` on the
|
|
146
|
+
* immediately-following `reveal()` call. `POST .../<name>?op=reveal-challenge®ion=<region>`. */
|
|
147
|
+
async revealChallenge(name: string, opts: { region: string }): Promise<Envelope<RevealChallenge>> {
|
|
148
|
+
return request<RevealChallenge>(config, {
|
|
149
|
+
method: "POST",
|
|
150
|
+
path: projectPath(requireProjectSlug(config), `vault/secrets/${encodeURIComponent(name)}`),
|
|
151
|
+
query: { op: "reveal-challenge", region: opts.region },
|
|
152
|
+
});
|
|
153
|
+
},
|
|
154
|
+
|
|
155
|
+
/** Reveal a secret's plaintext value using a single-use challenge from `revealChallenge()`.
|
|
156
|
+
* `GET .../<name>?region=<region>` with `X-K9O-Reveal-Challenge`. Decodes the wire's base64
|
|
157
|
+
* `value` back to plaintext (live-verified: the reveal response's `value` is base64, symmetric
|
|
158
|
+
* with `create`'s encode). */
|
|
159
|
+
async reveal(name: string, opts: { region: string; challenge: string }): Promise<Envelope<RevealSecretResult>> {
|
|
160
|
+
const envelope = await request<RevealSecretResult>(config, {
|
|
161
|
+
method: "GET",
|
|
162
|
+
path: projectPath(requireProjectSlug(config), `vault/secrets/${encodeURIComponent(name)}`),
|
|
163
|
+
query: { region: opts.region },
|
|
164
|
+
headers: { "X-K9O-Reveal-Challenge": opts.challenge },
|
|
165
|
+
});
|
|
166
|
+
return { ...envelope, data: { ...envelope.data, value: decodeBase64Utf8(envelope.data.value) } };
|
|
167
|
+
},
|
|
168
|
+
|
|
169
|
+
/** Update a secret's value (bumps version) — owner-only. `PUT .../<name>?region=<region>`.
|
|
170
|
+
* 🔴 Returns only `{id, name, version}` live (see `UpdateSecretResult`), not the full summary
|
|
171
|
+
* the OpenAPI schema documents — call `get()` after if you need the rest. */
|
|
172
|
+
async update(name: string, input: UpdateSecretInput): Promise<Envelope<UpdateSecretResult>> {
|
|
173
|
+
return request<UpdateSecretResult>(config, {
|
|
174
|
+
method: "PUT",
|
|
175
|
+
path: projectPath(requireProjectSlug(config), `vault/secrets/${encodeURIComponent(name)}`),
|
|
176
|
+
query: { region: input.region },
|
|
177
|
+
body: { value: encodeBase64Utf8(input.value), ...(input.metadata !== undefined ? { metadata: input.metadata } : {}) },
|
|
178
|
+
});
|
|
179
|
+
},
|
|
180
|
+
|
|
181
|
+
/** Rotate a secret's wrapping key (re-wraps under a fresh `kid`; content unchanged) — owner-only.
|
|
182
|
+
* `POST .../<name>?op=rotate®ion=<region>`. */
|
|
183
|
+
async rotate(name: string, opts: { region: string }): Promise<Envelope<RotateSecretResult>> {
|
|
184
|
+
return request<RotateSecretResult>(config, {
|
|
185
|
+
method: "POST",
|
|
186
|
+
path: projectPath(requireProjectSlug(config), `vault/secrets/${encodeURIComponent(name)}`),
|
|
187
|
+
query: { op: "rotate", region: opts.region },
|
|
188
|
+
});
|
|
189
|
+
},
|
|
190
|
+
|
|
191
|
+
/** Move (rename) a secret's hierarchical path — owner-only.
|
|
192
|
+
* `POST .../<name>?op=move®ion=<region>`. */
|
|
193
|
+
async move(name: string, opts: { region: string; newPath: string }): Promise<Envelope<MoveSecretResult>> {
|
|
194
|
+
return request<MoveSecretResult>(config, {
|
|
195
|
+
method: "POST",
|
|
196
|
+
path: projectPath(requireProjectSlug(config), `vault/secrets/${encodeURIComponent(name)}`),
|
|
197
|
+
query: { op: "move", region: opts.region },
|
|
198
|
+
body: { newPath: opts.newPath },
|
|
199
|
+
});
|
|
200
|
+
},
|
|
201
|
+
|
|
202
|
+
/** Retire a secret — owner-only. `DELETE .../<name>?region=<region>` → `204 No Content`. */
|
|
203
|
+
async delete(name: string, opts: { region: string }): Promise<Envelope<void>> {
|
|
204
|
+
return request<void>(config, {
|
|
205
|
+
method: "DELETE",
|
|
206
|
+
path: projectPath(requireProjectSlug(config), `vault/secrets/${encodeURIComponent(name)}`),
|
|
207
|
+
query: { region: opts.region },
|
|
208
|
+
});
|
|
209
|
+
},
|
|
210
|
+
},
|
|
211
|
+
};
|
|
212
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
/**
|
|
4
|
+
* The `ReadableStreamType` enum.
|
|
5
|
+
*
|
|
6
|
+
* *This API requires the following crate features to be activated: `ReadableStreamType`*
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
type ReadableStreamType = "bytes";
|
|
10
|
+
|
|
11
|
+
export class IntoUnderlyingByteSource {
|
|
12
|
+
private constructor();
|
|
13
|
+
free(): void;
|
|
14
|
+
[Symbol.dispose](): void;
|
|
15
|
+
cancel(): void;
|
|
16
|
+
pull(controller: ReadableByteStreamController): Promise<any>;
|
|
17
|
+
start(controller: ReadableByteStreamController): void;
|
|
18
|
+
readonly autoAllocateChunkSize: number;
|
|
19
|
+
readonly type: ReadableStreamType;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export class IntoUnderlyingSink {
|
|
23
|
+
private constructor();
|
|
24
|
+
free(): void;
|
|
25
|
+
[Symbol.dispose](): void;
|
|
26
|
+
abort(reason: any): Promise<any>;
|
|
27
|
+
close(): Promise<any>;
|
|
28
|
+
write(chunk: any): Promise<any>;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export class IntoUnderlyingSource {
|
|
32
|
+
private constructor();
|
|
33
|
+
free(): void;
|
|
34
|
+
[Symbol.dispose](): void;
|
|
35
|
+
cancel(): void;
|
|
36
|
+
pull(controller: ReadableStreamDefaultController): Promise<any>;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Decrypt a ZKFE envelope (browser / React Native).
|
|
41
|
+
*
|
|
42
|
+
* `input_json` — JSON-serialized `DecryptInput`.
|
|
43
|
+
* Returns a `Promise<string>` resolving to JSON-serialized `DecryptOutput`.
|
|
44
|
+
*/
|
|
45
|
+
export function zk_decrypt(input_json: any): Promise<any>;
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Encrypt via the customer KMS (browser / React Native).
|
|
49
|
+
*
|
|
50
|
+
* `input_json` — JSON-serialized `EncryptInput`.
|
|
51
|
+
* Returns a `Promise<string>` resolving to JSON-serialized `EncryptOutput`,
|
|
52
|
+
* or rejecting with a `JsValue` error string.
|
|
53
|
+
*/
|
|
54
|
+
export function zk_encrypt(input_json: any): Promise<any>;
|