clone

a browser-first diagram editor with live svg previews, local drafts and encrypted, accountless sharing

main
diagramzip / services / api / src / model.ts
model.ts 1.9K
1export type JsonValue = null | boolean | number | string | JsonValue[] | { [key: string]: JsonValue }23export interface Diagram {4 type: string5 source: string6 options: { [key: string]: JsonValue }7 presentation: {8 background: string9 padding: number10 frame: boolean11 appearance: 'raw' | 'auto-transparent' | 'light-transparent' | 'dark-transparent' | 'auto-framed' | 'light-framed' | 'dark-framed'12 }13}1415export interface AliasMetadata {16 title: string17 description: string18}1920export interface OpenAliasInput {21 mode: 'open'22 diagram: Diagram23 metadata: AliasMetadata24}2526export interface EncryptedBlob {27 v: 128 alg: 'A256GCM'29 iv: string30 ciphertext: string31}3233export interface KeyEnvelope {34 v: 135 kdf: {36 name: 'PBKDF2'37 hash: 'SHA-256'38 iterations: number39 salt: string40 }41 wrap: EncryptedBlob42}4344export interface LockedAliasInput {45 mode: 'locked'46 encryptedContent: EncryptedBlob47 encryptedMetadata: EncryptedBlob48 keyEnvelope: KeyEnvelope49}5051export type AliasInput = OpenAliasInput | LockedAliasInput5253export interface AliasRecord {54 alias_id: string55 content_id: string56 render_id: string57 object_key: string58 revision: number59 mode: 'open' | 'locked'60 title: string | null61 description: string | null62 encrypted_metadata: string | null63 key_envelope: string | null64 write_key_hash: ArrayBuffer65 created_at: number66 updated_at: number67}6869export interface OpenAliasResponse {70 aliasId: string71 contentId: string72 renderId: string73 revision: number74 mode: 'open'75 metadata: AliasMetadata76 diagram: Diagram77 createdAt: number78 updatedAt: number79}8081export interface LockedAliasResponse {82 aliasId: string83 contentId: string84 renderId: string85 revision: number86 mode: 'locked'87 encryptedContent: EncryptedBlob88 encryptedMetadata: EncryptedBlob89 keyEnvelope: KeyEnvelope90 createdAt: number91 updatedAt: number92}9394export type AliasResponse = OpenAliasResponse | LockedAliasResponse