Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

ServerSecretStore.ts

21 lines785 Bytes

1import { Data, Context } from "effect";
2import type { Effect } from "effect";
3​
4export class SecretStoreError extends Data.TaggedError("SecretStoreError")<{
5 readonly message: string;
6 readonly cause?: unknown;
7}> {}
8​
9export interface ServerSecretStoreShape {
10 readonly get: (name: string) => Effect.Effect<Uint8Array | null, SecretStoreError>;
11 readonly set: (name: string, value: Uint8Array) => Effect.Effect<void, SecretStoreError>;
12 readonly getOrCreateRandom: (
13 name: string,
14 bytes: number,
15 ) => Effect.Effect<Uint8Array, SecretStoreError>;
16 readonly remove: (name: string) => Effect.Effect<void, SecretStoreError>;
18​
19export class ServerSecretStore extends Context.Service<ServerSecretStore, ServerSecretStoreShape>()(
20 "t3/auth/Services/ServerSecretStore",
21) {}