Domain.Vault reference
Source:
packages/domain/src/Vault.ts
A field whose value is encrypted under a key kept per subject. Deleting the subject’s key makes every copy unreadable, wherever it was stored.
Vault: Declaring a sealed field
Section titled “Vault: Declaring a sealed field”import * as Domain from "@alchemy.run/domain";import * as Schema from "effect/Schema";import { VaultError } from "./VaultError.ts";
export { VaultError } from "./VaultError.ts";
export const Name = Domain.Sealed(Schema.String);
export class CustomerRegistered extends Domain.Event("CustomerRegistered", { name: Name }) {}Vault: Sending a value to be sealed
Section titled “Vault: Sending a value to be sealed”A client sends the value with the subject it belongs to. The model seals it when the command arrives, before anything is stored.
yield* bank.RegisterCustomer({ customerId, name: Name.plain(customerId, "Sam") });