export type LibSignalType = { externalCurve?: CurveType; crypto: { encrypt: ( key: ArrayBuffer, data: ArrayBuffer, iv: ArrayBuffer ) => Promise; decrypt: ( key: ArrayBuffer, data: ArrayBuffer, iv: ArrayBuffer ) => Promise; calculateMAC: (key: ArrayBuffer, data: ArrayBuffer) => Promise; verifyMAC: ( data: ArrayBuffer, key: ArrayBuffer, mac: ArrayBuffer, length: number ) => Promise; getRandomBytes: (size: number) => ArrayBuffer; }; externalCurveAsync: { calculateAgreement: ( pubKey: ArrayBuffer, privKey: ArrayBuffer ) => Promise; generateKeyPair: () => Promise<{ privKey: ArrayBuffer; pubKey: ArrayBuffer; }>; }; KeyHelper: { generateIdentityKeyPair: () => Promise<{ privKey: ArrayBuffer; pubKey: ArrayBuffer; }>; generateRegistrationId: () => number; generateSignedPreKey: ( identityKeyPair: KeyPairType, signedKeyId: number ) => Promise; generatePreKey: (keyId: number) => Promise; }; Curve: { generateKeyPair: () => KeyPairType; createKeyPair: (privKey: ArrayBuffer) => KeyPairType; calculateAgreement: ( pubKey: ArrayBuffer, privKey: ArrayBuffer ) => ArrayBuffer; verifySignature: ( pubKey: ArrayBuffer, msg: ArrayBuffer, sig: ArrayBuffer ) => void; calculateSignature: ( privKey: ArrayBuffer, message: ArrayBuffer ) => ArrayBuffer | Promise; validatePubKeyFormat: (buffer: ArrayBuffer) => ArrayBuffer; async: CurveType; }; HKDF: { deriveSecrets: ( packKey: ArrayBuffer, salt: ArrayBuffer, // The string is a bit crazy, but ProvisioningCipher currently passes in a string info?: ArrayBuffer | string ) => Promise>; }; worker: { startWorker: () => void; stopWorker: () => void; }; FingerprintGenerator: typeof FingerprintGeneratorClass; SessionBuilder: typeof SessionBuilderClass; SessionCipher: typeof SessionCipherClass; SignalProtocolAddress: typeof SignalProtocolAddressClass; }; export type KeyPairType = { pubKey: ArrayBuffer; privKey: ArrayBuffer; }; export type SignedPreKeyType = { keyId: number; keyPair: KeyPairType; signature: ArrayBuffer; }; export type PreKeyType = { keyId: number; keyPair: KeyPairType; }; type RecordType = { archiveCurrentState: () => void; deleteAllSessions: () => void; getOpenSession: () => void; getSessionByBaseKey: () => void; getSessions: () => void; haveOpenSession: () => void; promoteState: () => void; serialize: () => void; updateSessionState: () => void; }; type CurveType = { generateKeyPair: () => Promise; createKeyPair: (privKey: ArrayBuffer) => Promise; calculateAgreement: ( pubKey: ArrayBuffer, privKey: ArrayBuffer ) => Promise; verifySignature: ( pubKey: ArrayBuffer, msg: ArrayBuffer, sig: ArrayBuffer ) => Promise; calculateSignature: ( privKey: ArrayBuffer, message: ArrayBuffer ) => ArrayBuffer | Promise; validatePubKeyFormat: (buffer: ArrayBuffer) => ArrayBuffer; }; type SessionRecordType = any; export type StorageType = { Direction: { SENDING: number; RECEIVING: number; }; getIdentityKeyPair: () => Promise; getLocalRegistrationId: () => Promise; isTrustedIdentity: () => Promise; loadPreKey: ( encodedAddress: string, publicKey: ArrayBuffer | undefined, direction: number ) => Promise; loadSession: (encodedAddress: string) => Promise; loadSignedPreKey: (keyId: number) => Promise; removePreKey: (keyId: number) => Promise; saveIdentity: ( encodedAddress: string, publicKey: ArrayBuffer, nonblockingApproval?: boolean ) => Promise; storeSession: ( encodedAddress: string, record: SessionRecordType ) => Promise; }; declare class FingerprintGeneratorClass { constructor(iterations: number); createFor: ( localIdentifier: string, localIdentityKey: ArrayBuffer, remoteIdentifier: string, remoteIdentityKey: ArrayBuffer ) => string; } export declare class SignalProtocolAddressClass { static fromString(encodedAddress: string): SignalProtocolAddressClass; constructor(name: string, deviceId: number); getName: () => string; getDeviceId: () => number; toString: () => string; equals: (other: SignalProtocolAddressClass) => boolean; } type DeviceType = { deviceId: number; identityKey: ArrayBuffer; registrationId: number; signedPreKey: { keyId: number; publicKey: ArrayBuffer; signature: ArrayBuffer; }; preKey?: { keyId: number; publicKey: ArrayBuffer; }; }; declare class SessionBuilderClass { constructor(storage: StorageType, remoteAddress: SignalProtocolAddressClass); processPreKey: (device: DeviceType) => Promise; processV3: (record: RecordType, message: any) => Promise; } export declare class SessionCipherClass { constructor( storage: StorageType, remoteAddress: SignalProtocolAddressClass, options?: any ); closeOpenSessionForDevice: () => Promise; decryptPreKeyWhisperMessage: ( buffer: ArrayBuffer, encoding?: string ) => Promise; decryptWhisperMessage: ( buffer: ArrayBuffer, encoding?: string ) => Promise; deleteAllSessionsForDevice: () => Promise; encrypt: ( buffer: ArrayBuffer | Uint8Array, encoding?: string ) => Promise<{ type: number; registrationId: number; body: string; }>; getRecord: () => Promise; getRemoteRegistrationId: () => Promise; hasOpenSession: () => Promise; }