|
@@ -44,8 +44,6 @@ declare namespace threema {
|
|
|
data?: any;
|
|
|
}
|
|
|
|
|
|
- type WireMessageCallback = (message: WireMessage, result: any) => boolean;
|
|
|
-
|
|
|
type MessageType = 'text' | 'image' | 'video' | 'audio' | 'location' | 'status' | 'ballot' | 'file';
|
|
|
type MessageState = 'delivered' | 'read' | 'send-failed' | 'sent' | 'user-ack' | 'user-dec' | 'pending' | 'sending';
|
|
|
type InitializationStep = 'client info' | 'conversations' | 'receivers';
|
|
@@ -265,11 +263,6 @@ declare namespace threema {
|
|
|
*/
|
|
|
type MessageContentType = 'text' | 'file';
|
|
|
|
|
|
- /**
|
|
|
- * Possible message types sent to the receiver.
|
|
|
- */
|
|
|
- type MessageDataType = 'text' | 'file';
|
|
|
-
|
|
|
interface MessageData {
|
|
|
// optional quote object
|
|
|
quote?: Quote;
|
|
@@ -313,65 +306,6 @@ declare namespace threema {
|
|
|
initParams: null | {identity: null};
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * State service.
|
|
|
- */
|
|
|
- interface StateService {
|
|
|
- // WebRTC states
|
|
|
- signalingConnectionState: saltyrtc.SignalingState;
|
|
|
- rtcConnectionState: RTCConnectionState;
|
|
|
-
|
|
|
- // Global connection state
|
|
|
- state: 'ok' | 'warning' | 'error';
|
|
|
- stage: 'signaling' | 'rtc';
|
|
|
- wasConnected: boolean;
|
|
|
-
|
|
|
- // Connection buildup
|
|
|
- connectionBuildupState: ConnectionBuildupState;
|
|
|
- progress: number;
|
|
|
- slowConnect: boolean;
|
|
|
-
|
|
|
- // Update states
|
|
|
- updateSignalingConnectionState(state: saltyrtc.SignalingState): void;
|
|
|
- updateRtcConnectionState(state: RTCConnectionState): void;
|
|
|
- updateConnectionBuildupState(state: ConnectionBuildupState): void;
|
|
|
-
|
|
|
- reset(): void;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * Notification service.
|
|
|
- */
|
|
|
- interface NotificationService {
|
|
|
- getNotificationPermission(): boolean;
|
|
|
- getWantsNotifications(): boolean;
|
|
|
- setWantsNotifications(wantsNotifications: boolean): void;
|
|
|
- setWantsPreview(wantsPreview: boolean): void;
|
|
|
- getWantsPreview(): boolean;
|
|
|
- init(): void;
|
|
|
- isNotificationApiAvailable(): boolean;
|
|
|
- showNotification(id: string, title: string, body: string,
|
|
|
- avatar: string | null, clickCallback: any | null): boolean;
|
|
|
- clearCache(tag: string): void;
|
|
|
- hideNotification(tag: string): boolean;
|
|
|
- }
|
|
|
-
|
|
|
- interface MessageService {
|
|
|
- getAccess(message: Message, receiver: Receiver): MessageAccess;
|
|
|
- createTemporary(receiver: Receiver, type: string, messageData: MessageData): Message;
|
|
|
- showStatusIcon(message: Message, receiver: Receiver): boolean;
|
|
|
- getFileName(message: Message): string;
|
|
|
- }
|
|
|
-
|
|
|
- interface MessageAccess {
|
|
|
- quote: boolean;
|
|
|
- ack: boolean;
|
|
|
- dec: boolean;
|
|
|
- delete: boolean;
|
|
|
- download: boolean;
|
|
|
- copy: boolean;
|
|
|
- }
|
|
|
-
|
|
|
interface Quote {
|
|
|
identity: string;
|
|
|
text: string;
|
|
@@ -391,22 +325,6 @@ declare namespace threema {
|
|
|
pushToken: string | null;
|
|
|
}
|
|
|
|
|
|
- interface TrustedKeyStoreService {
|
|
|
- blocked: boolean;
|
|
|
- storeTrustedKey(ownPublicKey: Uint8Array, ownSecretKey: Uint8Array, peerPublicKey: Uint8Array,
|
|
|
- pushToken: string | null, password: string): void;
|
|
|
- hasTrustedKey(): boolean;
|
|
|
- retrieveTrustedKey(password: string): TrustedKeyStoreData;
|
|
|
- clearTrustedKey(): void;
|
|
|
- }
|
|
|
-
|
|
|
- interface PushService {
|
|
|
- init(pushToken: string): void;
|
|
|
- reset(): void;
|
|
|
- isAvailable(): boolean;
|
|
|
- sendPush(session: Uint8Array): Promise<boolean>;
|
|
|
- }
|
|
|
-
|
|
|
interface BrowserInfo {
|
|
|
chrome: boolean;
|
|
|
firefox: boolean;
|
|
@@ -417,35 +335,6 @@ declare namespace threema {
|
|
|
textInfo: string;
|
|
|
}
|
|
|
|
|
|
- interface BrowserService {
|
|
|
- getBrowser(): BrowserInfo;
|
|
|
- isVisible(): boolean;
|
|
|
- }
|
|
|
-
|
|
|
- interface TitleService {
|
|
|
- updateUnreadCount(count: number): void;
|
|
|
- }
|
|
|
-
|
|
|
- interface FingerPrintService {
|
|
|
- generate(publicKey: ArrayBuffer): string;
|
|
|
- }
|
|
|
-
|
|
|
- interface ContactService {
|
|
|
- requiredDetails(contactReceiver: ContactReceiver): Promise<ContactReceiver>;
|
|
|
- }
|
|
|
-
|
|
|
- interface ControllerModelService {
|
|
|
- contact(receiver: ContactReceiver, mode: any): ControllerModel;
|
|
|
- group(receiver: GroupReceiver, mode: any): ControllerModel;
|
|
|
- distributionList(receiver: DistributionListReceiver, mode: any): ControllerModel;
|
|
|
- }
|
|
|
-
|
|
|
- interface QrCodeService {
|
|
|
- buildQrCodePayload(initiatorKey: Uint8Array, authToken: Uint8Array, serverKey: Uint8Array | null,
|
|
|
- host: string, port: number,
|
|
|
- persistent: boolean): string;
|
|
|
- }
|
|
|
-
|
|
|
interface PromiseCallbacks {
|
|
|
resolve: (arg: any) => void;
|
|
|
reject: (arg: any) => void;
|
|
@@ -467,11 +356,6 @@ declare namespace threema {
|
|
|
setOnRemoved(callback: any): void;
|
|
|
}
|
|
|
|
|
|
- interface AvatarControllerModel {
|
|
|
- onChangeAvatar: (image: ArrayBuffer) => void;
|
|
|
- getAvatar(): ArrayBuffer | null;
|
|
|
- }
|
|
|
-
|
|
|
interface Alert {
|
|
|
source: string;
|
|
|
type: string;
|
|
@@ -499,106 +383,6 @@ declare namespace threema {
|
|
|
OPERA: number;
|
|
|
}
|
|
|
|
|
|
- interface MimeService {
|
|
|
- isImage(mimeType: string): boolean;
|
|
|
- isAudio(mimeType: string): boolean;
|
|
|
- isVideo(mimeType: string): boolean;
|
|
|
- getLabel(mimeType: string): string;
|
|
|
- getIconUrl(mimeType: string): string;
|
|
|
- }
|
|
|
-
|
|
|
- interface ReceiverService {
|
|
|
- setActive(activeReceiver: Receiver): void;
|
|
|
- getActive(): Receiver;
|
|
|
- isConversationActive(conversation: Conversation): boolean;
|
|
|
- compare(a: Conversation | Receiver, b: Conversation| Receiver): boolean;
|
|
|
- isContact(receiver: Receiver): boolean;
|
|
|
- isGroup(receiver: Receiver): boolean;
|
|
|
- isDistributionList(receiver: Receiver): boolean;
|
|
|
- isBusinessContact(receiver: Receiver): boolean;
|
|
|
- }
|
|
|
-
|
|
|
- interface SettingsService {
|
|
|
- storeUntrustedKeyValuePair(key: string, value: string): void;
|
|
|
- retrieveUntrustedKeyValuePair(key: string): string;
|
|
|
- }
|
|
|
-
|
|
|
- interface WebClientDefault {
|
|
|
- getAvatar(type: string, highResolution: boolean): string;
|
|
|
- }
|
|
|
-
|
|
|
- interface WebClientService {
|
|
|
- salty: saltyrtc.SaltyRTC;
|
|
|
- messages: Container.Messages;
|
|
|
- conversations: Container.Conversations;
|
|
|
- receivers: Container.Receivers;
|
|
|
- alerts: Alert[];
|
|
|
- defaults: WebClientDefault;
|
|
|
- receiverListener: ReceiverListener[];
|
|
|
-
|
|
|
- me: MeReceiver;
|
|
|
- contacts: Map<string, ContactReceiver>;
|
|
|
- groups: Map<string, GroupReceiver>;
|
|
|
- distributionLists: Map<string, DistributionListReceiver>;
|
|
|
- typing: Container.Typing;
|
|
|
-
|
|
|
- buildQrCodePayload(persistent: boolean): string;
|
|
|
- init(keyStore?: saltyrtc.KeyStore, peerTrustedKey?: Uint8Array, resetField?: boolean): void;
|
|
|
- start(): ng.IPromise<any>;
|
|
|
- stop(requestedByUs: boolean, deleteStoredData?: boolean, resetPush?: boolean, redirect?: boolean): void;
|
|
|
- registerInitializationStep(name: string): void;
|
|
|
- setReceiverListener(listener: ReceiverListener): void;
|
|
|
- requestClientInfo(): void;
|
|
|
- requestReceivers(): void;
|
|
|
- requestConversations(): void;
|
|
|
- requestMessages(receiver: Receiver, reloadExisting?: boolean): number;
|
|
|
- requestAvatar(receiver: Receiver, highResolution: boolean): Promise<any>;
|
|
|
- requestThumbnail(receiver: Receiver, message: Message): Promise<any>;
|
|
|
- requestBlob(msgId: number, receiver: Receiver): Promise<ArrayBuffer>;
|
|
|
- requestRead(receiver, newestMessageId: number): void;
|
|
|
- requestContactDetail(contactReceiver: ContactReceiver): Promise<any>;
|
|
|
- sendMessage(receiver, type: MessageContentType, message: MessageData): Promise<Promise<any>>;
|
|
|
- ackMessage(receiver, message: Message, acknowledged?: boolean): void;
|
|
|
- deleteMessage(receiver, message: Message): void;
|
|
|
- sendMeIsTyping(receiver, isTyping: boolean): void;
|
|
|
- sendKeyPersisted(): void;
|
|
|
- addContact(threemaId: String): Promise<ContactReceiver>;
|
|
|
- modifyContact(threemaId: String, firstName: String, lastName: String, avatar?: ArrayBuffer):
|
|
|
- Promise<ContactReceiver>;
|
|
|
- createGroup(members: String[], name: String, avatar?: ArrayBuffer): Promise<GroupReceiver>;
|
|
|
- modifyGroup(id: string, members: String[], name: String, avatar?: ArrayBuffer): Promise<GroupReceiver>;
|
|
|
- leaveGroup(group: GroupReceiver): Promise<any>;
|
|
|
- deleteGroup(group: GroupReceiver): Promise<any>;
|
|
|
- syncGroup(group: GroupReceiver): Promise<any>;
|
|
|
- createDistributionList(members: String[], name: String): Promise<DistributionListReceiver>;
|
|
|
- modifyDistributionList(id: string, members: String[], name: String): Promise<DistributionListReceiver>;
|
|
|
- deleteDistributionList(distributionList: DistributionListReceiver): Promise<any>;
|
|
|
- isTyping(receiver: ContactReceiver): boolean;
|
|
|
- getMyIdentity(): Identity;
|
|
|
- getQuote(receiver: Receiver): Quote;
|
|
|
- setQuote(receiver: Receiver, message?: Message): void;
|
|
|
- setDraft(receiver: Receiver, message: string): void;
|
|
|
- getDraft(receiver: Receiver): string;
|
|
|
- setPassword(password: string): void;
|
|
|
- clearCache(): void;
|
|
|
- getMaxTextLength(): number;
|
|
|
- }
|
|
|
-
|
|
|
- interface ControllerService {
|
|
|
- setControllerName(name: string): void;
|
|
|
- getControllerName(): string;
|
|
|
- }
|
|
|
-
|
|
|
- interface StringService {
|
|
|
- /**
|
|
|
- * create chunks of a string by counting the used bytes
|
|
|
- * @param str
|
|
|
- * @param byteLength
|
|
|
- * @param offset
|
|
|
- */
|
|
|
- byteChunk(str: string, byteLength: number, offset: number): string[];
|
|
|
- }
|
|
|
-
|
|
|
namespace Container {
|
|
|
interface ReceiverData {
|
|
|
me: MeReceiver;
|