Files
WebDrop/web/src/core-bridge/generated/api.ts
T
justme d946fc5e8a feat(api)!: fold devices into users and report member presence
Contract 7.0.0 (breaking). Devices become an attribute of the account;
members are managed per user, and only unauthenticated guests keep a
per-terminal registration.

- rename seats -> max_members, seats_used -> members_used,
  seats_full -> members_full, SeatJoined -> JoinResult, the `seats`
  stream control message -> `members`, and POST /channels/{id}/seats ->
  POST /channels/{id}/join (stored channel settings are migrated on start)
- drop per-terminal encrypted device labels and the seat list/release
  endpoints; add GET/DELETE /channels/{id}/guests for guest terminals
- authenticate account members by account session only: the terminal key
  is optional for logged-in accounts, no seat row is written for them,
  and gated-download grants are counted per user (per terminal for guests)
- GET /channels/{id}/members now returns online, devices and
  online_devices per account; presence is tracked in memory from active
  WebSocket/SSE subscriptions and is not pushed over the stream
- owner invitation list no longer returns accounts that already joined
2026-10-14 22:18:59 +08:00

426 lines
9.5 KiB
TypeScript

// Generated from backend DTOs; do not edit.
// backend-contract-sha256: 54ea3f00fa672e0241efbb9fc8e7ad9e8fc68415ec124e08f70657c2d57d9ff9
export interface AccountChannelBody {
channel_id: string;
created_at: number;
payload: string;
role: string;
}
export interface AccountDeviceBody {
created_at: number;
current: boolean;
id: string;
last_seen: number;
name: string;
}
export interface AccountDeviceNameRequest {
name: string;
}
export interface AccountDeviceSigningRequest {
device_id: string;
public_key: string;
signature: string;
}
export interface AccountProfile {
avatar?: string | null;
displayName: string;
modifiedAt: number;
username: string;
}
export interface AccountProfileRequest {
avatar?: string | null;
displayName: string;
}
export interface AccountRegisterRequest {
public_key: string;
salt: string;
signing_public_key: string;
username: string;
vault: string;
verifier: string;
}
export interface AccountSaltBody {
salt: string;
}
export interface AccountSaltRequest {
username: string;
}
export interface AccountSessionBody {
token: string;
username: string;
}
export interface AccountSessionRequest {
device_id?: string | null;
device_name?: string | null;
username: string;
verifier: string;
}
export interface AccountVaultBody {
revision: number;
vault: string;
}
export interface AccountVaultRequest {
revision: number;
vault: string;
}
export interface AppendResult {
seq: number;
}
export interface ChannelHistoryRequest {
chatHistory: boolean;
filesHistory: boolean;
}
export interface ChannelInfo {
can_manage_structure: boolean;
can_upload: boolean;
created_at: number;
creator_account?: string | null;
expires_at: number;
id: string;
last_seq: number;
members_used: number;
mode: ChannelMode;
oldest_seq: number;
password_required: boolean;
settings: ChannelSettings;
}
export type ChannelMode = 'enc' | 'raw';
export interface ChannelSettings {
allow_guests: boolean;
delete_policy: DeletePolicy;
file_max_downloads: number;
join_policy: JoinPolicy;
max_items: number;
max_members: number;
members_can_upload: boolean;
name?: string | null;
ttl_seconds: number;
ui_restrict_copy_download: boolean;
}
export interface ChannelSettingsPatch {
allow_guests?: boolean | null;
delete_policy?: DeletePolicy | null;
file_max_downloads?: number | null;
join_password?: string | null;
join_policy?: JoinPolicy | null;
max_items?: number | null;
max_members?: number | null;
members_can_upload?: boolean | null;
name?: string | null;
ttl_seconds?: number | null;
ui_restrict_copy_download?: boolean | null;
}
export interface CreateChannelRequest {
id?: string | null;
join_password?: string | null;
key_package?: string | null;
mode?: ChannelMode | null;
owner_hash?: string | null;
read_hash?: string | null;
settings?: ChannelSettings | null;
write_hash?: string | null;
}
export interface CreateShareRequest {
id?: string | null;
owner_hash?: string | null;
read_hash?: string | null;
settings?: ShareSettings | null;
}
export interface CryptoState {
access: ChannelAccess[];
envelopes: DomainEnvelope[];
objects: ObjectEnvelope[];
revision: number;
}
export interface ChannelAccess {
channelId: string;
chatFromRevision: number;
chatRead: boolean;
chatWrite: boolean;
filesFromRevision: number;
filesRead: boolean;
filesUpload: boolean;
username: string;
}
export type DeletePolicy = 'owner_only' | 'own' | 'anyone';
export interface DomainEnvelope {
channelId: string;
domain: CryptoDomain;
epoch: number;
payload: string;
username: string;
}
export type CryptoDomain = 'chat' | 'files';
export interface DomainPublishRequest {
channelId: string;
domain: CryptoDomain;
envelopes: DomainEnvelope[];
epoch: number;
}
export interface ErrorBody {
error: string;
}
export interface FinishShareRequest {
manifest_item_id?: string | null;
}
export interface GoneLogBody {
error: string;
oldest_seq: number;
}
export interface GuestInfo {
endpoint_hash: string;
joined_at: number;
}
export interface InvitationBody {
channel_id: string;
created_at: number;
payload: string;
username: string;
}
export interface InvitationCryptoPlan {
batches: CryptoGrantBatch[];
channelId: string;
username: string;
}
export interface CryptoGrantBatch {
domain: CryptoDomain;
epoch: number;
recipients: string[];
rotate: boolean;
}
export interface InvitationRequest {
domain_envelopes?: DomainEnvelope[] | null;
payload: string;
username: string;
}
export type JoinPolicy = 'open' | 'invite';
export interface JoinRequest {
password?: string | null;
}
export interface JoinResult {
joined_at: number;
members_max: number;
members_used: number;
}
export interface KeyPackageRequest {
payload: string;
}
export interface MemberBody {
devices: number;
joined_at: number;
online: boolean;
online_devices: number;
role: string;
username: string;
}
export interface ObjectEnvelope {
authorAccount?: string | null;
channelId: string;
createdRevision: number;
deleteEvent?: SignedContentEventRecord | null;
domain: CryptoDomain;
epoch: number;
event?: SignedContentEventRecord | null;
itemId: string;
keyEnvelope: string;
}
export interface PasskeyBeginRequest {
username: string;
verifier?: string | null;
}
export interface PasskeyEnvelopeRequest {
credential: string;
id: string;
key_envelope: string;
username: string;
}
export interface PasskeyFinishRequest {
credential: string;
device_id?: string | null;
device_name?: string | null;
id: string;
key_envelope?: string | null;
name?: string | null;
username: string;
}
export interface PasskeyInfoBody {
can_recover: boolean;
created_at: number;
id: string;
name: string;
prf_salt: string;
}
export interface PasskeyOptionsBody {
credentials: PasskeyInfoBody[];
id: string;
options: string;
prf_salt?: string | null;
}
export interface PasskeySessionBody {
credential_id: string;
key_envelope?: string | null;
prf_salt: string;
token: string;
username: string;
}
export interface PublicKeyBody {
public_key: string;
signing_public_key?: string | null;
}
export interface ServerInfoBody {
captcha: CaptchaBody;
choices: SettingChoicesBody;
contract_version: string;
defaults: DefaultsBody;
limits: LimitsBody;
protocol: number;
transports: TransportsBody;
}
export interface CaptchaBody {
api_endpoint?: string | null;
enabled: boolean;
provider: string;
}
export interface DefaultsBody {
channel: ChannelSettings;
channel_mode: ChannelMode;
share: ShareSettings;
}
export interface LimitsBody {
max_channel_bytes: number;
max_frames_per_item: number;
max_items: number;
max_members: number;
max_payload_bytes: number;
max_ttl_seconds: number;
max_visitors: number;
max_workspace_bytes: number;
max_workspace_channel_bytes: number;
min_ttl_seconds: number;
}
export interface SettingChoicesBody {
file_max_downloads: number[];
max_members: number[];
max_visitors: number[];
ttl_seconds: number[];
}
export interface ShareInfo {
created_at: number;
expires_at: number;
id: string;
items: ShareItemInfo[];
manifest_item_id?: string | null;
sealed_at?: number | null;
settings: ShareSettings;
state: string;
}
export interface ShareItemInfo {
bytes: number;
complete: boolean;
downloads_left: number | null;
frames: number;
item_id: string;
max_downloads: number;
}
export interface ShareSettings {
file_max_downloads: number;
max_visitors: number;
ttl_seconds: number;
}
export interface ShareSettingsPatch {
file_max_downloads?: number | null;
max_visitors?: number | null;
ttl_seconds?: number | null;
}
export interface SignedContentEventRecord {
deviceCertificateSignature: string;
eventId: string;
frameCount: number;
kind: string;
manifestHash: string;
signature: string;
signerDeviceId: string;
signerDevicePublicKey: string;
signerRootPublicKey: string;
targetItemId?: string | null;
}
export interface TransportsBody {
http3: boolean;
sse: boolean;
websocket: boolean;
}
export interface WorkspaceBody {
people: AccountProfile[];
structure: WorkspaceState;
}
export interface WorkspaceChannelCreatedBody {
channel: WorkspaceChannel;
workspace: WorkspaceBody;
}
export interface WorkspaceChannel {
chatEpoch: number;
chatHistory: boolean;
createdAt: number;
createdBy: string;
fileBytes: number;
filesEpoch: number;
filesHistory: boolean;
groupId?: string | null;
id: string;
name: string;
}
export interface WorkspaceChannelRequest {
groupId?: string | null;
name: string;
}
export interface WorkspaceFolderRequest {
name: string;
parentId?: string | null;
threadId: string;
}
export interface WorkspaceGroupCreatedBody {
group: WorkspaceGroup;
workspace: WorkspaceBody;
}
export interface WorkspaceGroup {
createdAt: number;
id: string;
name: string;
}
export interface WorkspaceGroupRequest {
groupId?: string | null;
}
export interface WorkspaceMoveRequest {
folderId?: string | null;
itemIds: string[];
threadId: string;
}
export interface WorkspaceNameRequest {
name: string;
}
export interface WorkspaceState {
channels: WorkspaceChannel[];
defaultChannelId?: string | null;
folders: WorkspaceFolder[];
groups: WorkspaceGroup[];
locations: WorkspaceLocation[];
revision: number;
}
export interface WorkspaceFolder {
id: string;
name: string;
parentId?: string | null;
threadId: string;
}
export interface WorkspaceLocation {
authorAccount?: string | null;
folderId?: string | null;
itemId: string;
threadId: string;
}