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