export type FeedId = string;
export type MsgId = string;
export type BlobId = string;
export interface Msg {
key: MsgId;
value: {
previous: MsgId;
author: FeedId;
sequence: number;
timestamp: number;
hash: 'sha256';
content: C;
signature: string;
};
timestamp: number;
}
export type MsgInThread = Msg;
export interface UnboxedMsg extends Msg {
value: Msg['value'] & {
cyphertext: string;
private: true;
unbox: string;
};
meta?: {
private: true;
originalContent: string;
};
}
export type Privatable = T & {recps?: Array};
export type Content =
| Privatable
| Privatable
| Privatable
| Privatable
| Privatable
| Privatable
| Privatable
| Privatable
| Privatable
| null;
export interface PostContent {
type: 'post';
text: string;
channel?: string;
mentions?: Array;
root?: MsgId;
branch?: MsgId | Array;
fork?: MsgId;
}
export interface AboutContent {
type: 'about';
about: FeedId;
name?: string;
description?: string;
image?: string;
}
export interface ContactContent {
type: 'contact';
contact?: FeedId;
following?: boolean;
blocking?: boolean;
}
export interface VoteContent {
type: 'vote';
vote: {
link: MsgId;
value: number;
expression: string;
};
}
export interface BlogContent {
type: 'blog';
title: string;
summary: string;
channel?: string;
thumbnail?: string;
blog: string;
mentions?: Array;
root?: MsgId;
branch?: MsgId | Array;
fork?: MsgId;
}
export interface AliasContent {
type: 'room/alias';
action?: 'registered' | 'revoked';
alias?: string;
aliasURL?: string;
room?: FeedId;
}
export interface GatheringContent {
type: 'gathering';
progenitor?: MsgId;
mentions?: Array;
}
export interface GatheringUpdateContent {
type: 'about';
about: MsgId;
title?: string;
description?: string;
location?: string;
startDateTime?: {
epoch?: number;
tz?: string;
bias?: number;
silent?: boolean;
};
image?: {
link: BlobId;
name?: string;
size?: number;
type?: string;
};
}
export interface AttendeeContent {
type: 'about';
about: MsgId;
attendee: {
link: FeedId;
remove?: true;
};
}
export interface About {
name?: string;
description?: string;
color?: string;
imageUrl?: string;
id?: FeedId;
following?: true | null | false;
}
export interface PeerMetadata {
host: string;
port: number;
key: string;
name?: string;
source: 'local' | 'pub' | 'manual';
announcers?: number;
duration?: any;
client: boolean;
state: 'connecting' | 'connected' | 'disconnecting' | undefined;
stateChange: number;
ping?: {
rtt: {
mean: number;
stdev: number;
count: number;
sum: number;
sqsum: number;
};
skew: {
mean: number;
stdev: number;
count: number;
sum: number;
sqsum: number;
};
};
}