@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, 06:00 UTC

main
ts 47 lines 1.26 KB
Raw
1 import type * as kms from "@distilled.cloud/gcp/cloudkms_v1";
2 import * as Binding from "alchemy/Binding";
3 import type { RuntimeContext } from "alchemy/RuntimeContext";
4 import type * as Effect from "effect/Effect";
5 import type { CryptoKey } from "./CryptoKey.ts";
6
7 export interface EncryptRequest extends Omit<
8 kms.EncryptProjectsLocationsKeyRingsCryptoKeysRequest,
9 "name"
10 > {}
11
12 /**
13 * Runtime binding for Cloud KMS `cryptoKeys.encrypt`.
14 *
15 * Bind this operation to a {@link CryptoKey} in a Function/Action init
16 * phase. Provide {@link EncryptHttp}. The CryptoKey purpose must be
17 * `ENCRYPT_DECRYPT` and it must have an enabled primary version.
18 *
19 * ### Encrypting Data
20 * **Example:** Encrypt a payload
21 * ```typescript
22 * const encrypt = yield* GCP.KMS.Encrypt(key);
23 * const { ciphertext } = yield* encrypt({
24 * body: { plaintext: btoa("hello") },
25 * });
26 * ```
27 *
28 * @binding
29 * @category KMS
30 */
31 export interface Encrypt extends Binding.Service<
32 Encrypt,
33 "GCP.KMS.Encrypt",
34 (
35 key: CryptoKey,
36 ) => Effect.Effect<
37 (
38 request?: EncryptRequest,
39 ) => Effect.Effect<
40 kms.EncryptResponse,
41 kms.EncryptProjectsLocationsKeyRingsCryptoKeysError,
42 RuntimeContext
43 >
44 >
45 > {}
46
47 export const Encrypt = Binding.Service<Encrypt>("GCP.KMS.Encrypt");