@devries-cameron20 / t3code Mirror · read-only
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 21, 04:45 UTC

main
ts 49 lines 1.81 KB
Raw
1 import type * as kms from "@distilled.cloud/aws/kms";
2 import * as Binding from "alchemy/Binding";
3 import type * as Effect from "effect/Effect";
4 import type { AliasName } from "./Alias.ts";
5 import type { Key } from "./Key.ts";
6
7 export interface GenerateDataKeyPairRequest extends Omit<kms.GenerateDataKeyPairRequest, "KeyId"> {}
8
9 /**
10 * Runtime binding for `kms:GenerateDataKeyPair`.
11 *
12 * Bind this operation to a symmetric-encryption KMS {@link Key} (or the
13 * `alias/...` name of a pre-existing key) to get a callable that
14 * automatically injects the `KeyId`. Returns a fresh asymmetric key pair:
15 * the public key and plaintext private key for immediate local use, plus
16 * the private key encrypted under the bound symmetric key for storage.
17 *
18 * The `PrivateKeyPlaintext` in the response is wrapped in `Redacted` so it
19 * never leaks into logs — unwrap with `Redacted.value(...)` at the point of
20 * use and discard it as soon as the local operation is done.
21 *
22 * ### Data Key Pairs
23 * **Example:** Generate an RSA Key Pair
24 * ```typescript
25 * const generateDataKeyPair = yield* AWS.KMS.GenerateDataKeyPair(key);
26 *
27 * const pair = yield* generateDataKeyPair({ KeyPairSpec: "RSA_2048" });
28 * // pair.PublicKey — DER-encoded public key
29 * // pair.PrivateKeyPlaintext — Redacted; use locally then discard
30 * // pair.PrivateKeyCiphertextBlob — persist; recover via the Decrypt binding
31 * ```
32 *
33 * @binding
34 */
35 export interface GenerateDataKeyPair extends Binding.Service<
36 GenerateDataKeyPair,
37 "AWS.KMS.GenerateDataKeyPair",
38 (
39 key: Key | AliasName,
40 ) => Effect.Effect<
41 (
42 request: GenerateDataKeyPairRequest,
43 ) => Effect.Effect<kms.GenerateDataKeyPairResponse, kms.GenerateDataKeyPairError>
44 >
45 > {}
46
47 export const GenerateDataKeyPair = Binding.Service<GenerateDataKeyPair>(
48 "AWS.KMS.GenerateDataKeyPair",
49 );