1import type * as kms from "@distilled.cloud/aws/kms";
2import type * as Effect from "effect/Effect";
3import * as Binding from "../../Binding.ts";
4import type { AliasName } from "./Alias.ts";
5import type { Key } from "./Key.ts";
6
7export interface GetPublicKeyRequest extends Omit<
8 kms.GetPublicKeyRequest,
9 "KeyId"
10> {}
11
12/**
13 * Runtime binding for `kms:GetPublicKey`.
14 *
15 * Bind this operation to an asymmetric KMS {@link Key} (or the `alias/...`
16 * name of a pre-existing key) to get a callable that automatically injects
17 * the `KeyId`. Returns the DER-encoded public key so callers can verify
18 * signatures or encrypt locally without a KMS round-trip per operation.
19 *
20 * ### Signing
21 * **Example:** Download the Public Key
22 * ```typescript
23 * const getPublicKey = yield* AWS.KMS.GetPublicKey(signingKey);
24 *
25 * const { PublicKey, SigningAlgorithms } = yield* getPublicKey({});
26 * // PublicKey is the DER-encoded SubjectPublicKeyInfo
27 * ```
28 *
29 * @binding
30 */
31export interface GetPublicKey extends Binding.Service<
32 GetPublicKey,
33 "AWS.KMS.GetPublicKey",
34 (
35 key: Key | AliasName,
36 ) => Effect.Effect<
37 (
38 request?: GetPublicKeyRequest,
39 ) => Effect.Effect<kms.GetPublicKeyResponse, kms.GetPublicKeyError>
40 >
41> {}
42
43export const GetPublicKey = Binding.Service<GetPublicKey>(
44 "AWS.KMS.GetPublicKey",
45);