parent
36762dbbf2
commit
b644e2a05f
@ -0,0 +1,23 @@
|
||||
import { SignalService } from '../../../ts/protobuf';
|
||||
import {
|
||||
BinaryString,
|
||||
CipherTextObject,
|
||||
} from '../../../libtextsecure/libsignal-protocol';
|
||||
|
||||
export declare class SecretSessionCipher {
|
||||
constructor(storage: any);
|
||||
encrypt(
|
||||
destinationPubkey: string,
|
||||
senderCertificate: SignalService.SenderCertificate,
|
||||
innerEncryptedMessage: CipherTextObject
|
||||
): Promise<ArrayBuffer>;
|
||||
decrypt(
|
||||
cipherText: ArrayBuffer,
|
||||
me: { number: string; deviceId: number }
|
||||
): Promise<{
|
||||
isMe?: boolean;
|
||||
sender: string;
|
||||
content: ArrayBuffer;
|
||||
type: SignalService.Envelope.Type;
|
||||
}>;
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
import { SecretSessionCipher } from './metadata/SecretSessionCipher';
|
||||
|
||||
interface Metadata {
|
||||
SecretSessionCipher: typeof SecretSessionCipher;
|
||||
}
|
||||
|
||||
export interface SignalInterface {
|
||||
Metadata: Metadata;
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
import { getItemById } from '../../js/modules/data';
|
||||
import { KeyPair } from '../../libtextsecure/libsignal-protocol';
|
||||
|
||||
export async function getCurrentDevicePubKey(): Promise<string | undefined> {
|
||||
const item = await getItemById('number_id');
|
||||
if (!item || !item.value) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
return item.value.split('.')[0];
|
||||
}
|
||||
|
||||
export async function getIdentityKeyPair(): Promise<KeyPair | undefined> {
|
||||
const item = await getItemById('identityKey');
|
||||
|
||||
return item?.value;
|
||||
}
|
Loading…
Reference in New Issue