@wireapp/cryptobox
Version:
High-level API with persistent storage for Proteus.
32 lines (31 loc) • 1.67 kB
TypeScript
import { keys as ProteusKeys, session as ProteusSession } from '@wireapp/proteus';
import { CRUDEngineBaseCollection } from '@wireapp/store-engine';
export declare enum CRUDStoreKeys {
LOCAL_IDENTITY = "local_identity"
}
export declare enum CRUDStoreStores {
LOCAL_IDENTITY = "keys",
PRE_KEYS = "prekeys",
SESSIONS = "sessions"
}
export declare class CryptoboxCRUDStore implements ProteusSession.PreKeyStore {
private readonly engine;
static readonly KEYS: typeof CRUDStoreKeys;
static readonly STORES: typeof CRUDStoreStores;
constructor(engine: CRUDEngineBaseCollection);
private from_store;
private to_store;
delete_all(): Promise<true>;
delete_prekey(prekeyId: number): Promise<number>;
load_identity(): Promise<ProteusKeys.IdentityKeyPair | undefined>;
load_prekey(prekeyId: number): Promise<ProteusKeys.PreKey | undefined>;
load_prekeys(): Promise<ProteusKeys.PreKey[]>;
save_identity(identity: ProteusKeys.IdentityKeyPair): Promise<ProteusKeys.IdentityKeyPair>;
save_prekey(preKey: ProteusKeys.PreKey): Promise<ProteusKeys.PreKey>;
save_prekeys(preKeys: ProteusKeys.PreKey[]): Promise<ProteusKeys.PreKey[]>;
create_session(sessionId: string, session: ProteusSession.Session): Promise<ProteusSession.Session>;
read_session(identity: ProteusKeys.IdentityKeyPair, sessionId: string): Promise<ProteusSession.Session>;
read_sessions(identity: ProteusKeys.IdentityKeyPair): Promise<Record<string, ProteusSession.Session>>;
update_session(sessionId: string, session: ProteusSession.Session): Promise<ProteusSession.Session>;
delete_session(sessionId: string): Promise<string>;
}