ls-deno/types.ts
2022-10-08 02:01:48 -05:00

40 lines
767 B
TypeScript

export interface Identifiable {
id: string;
}
export interface Created {
createdAt: Date;
}
export interface Updated {
updatedAt: Date;
}
export type Timestamped = Created & Updated;
export interface Note extends Identifiable, Timestamped {
content: string;
}
export interface Team extends Identifiable, Timestamped {
displayName: string;
}
export interface User extends Identifiable, Timestamped {
username: string;
passwordDigest: string;
displayName?: string;
}
type IdentifierFor<T extends Identifiable> = T["id"];
export interface Token extends Created {
bytes?: Uint8Array;
digest: Uint8Array;
userId: IdentifierFor<User>;
data: Record<string, unknown> | null;
}
/** 32 bytes base64-encoded */
export type TokenDigest = string;