@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 41 lines 1.31 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 GenerateMacRequest extends Omit<kms.GenerateMacRequest, "KeyId"> {}
8
9 /**
10 * Runtime binding for `kms:GenerateMac`.
11 *
12 * Bind this operation to an HMAC KMS {@link Key} (or the `alias/...` name of
13 * a pre-existing key) to get a callable that automatically injects the
14 * `KeyId`. Computes an HMAC inside KMS — the MAC key never leaves the HSM,
15 * so any party with `kms:VerifyMac` can validate tokens without ever
16 * holding the shared secret.
17 *
18 * ### Message Authentication
19 * **Example:** Compute an HMAC
20 * ```typescript
21 * const generateMac = yield* AWS.KMS.GenerateMac(hmacKey);
22 *
23 * const { Mac } = yield* generateMac({
24 * Message: new TextEncoder().encode("session-token-payload"),
25 * MacAlgorithm: "HMAC_SHA_256",
26 * });
27 * ```
28 *
29 * @binding
30 */
31 export interface GenerateMac extends Binding.Service<
32 GenerateMac,
33 "AWS.KMS.GenerateMac",
34 (
35 key: Key | AliasName,
36 ) => Effect.Effect<
37 (request: GenerateMacRequest) => Effect.Effect<kms.GenerateMacResponse, kms.GenerateMacError>
38 >
39 > {}
40
41 export const GenerateMac = Binding.Service<GenerateMac>("AWS.KMS.GenerateMac");