Fix types

pull/1141/head
Mikunj 5 years ago
parent 729fa594b8
commit 85d3c35c0c

109
js/modules/data.d.ts vendored

@ -7,25 +7,46 @@ type IdentityKey = {
firstUse: boolean; firstUse: boolean;
verified: number; verified: number;
nonblockingApproval: boolean; nonblockingApproval: boolean;
} | null; };
type PreKey = { type PreKey = {
id: string; id: number;
publicKey: string; publicKey: ArrayBuffer;
privateKey: string; privateKey: ArrayBuffer;
recipient: string; recipient: string;
} | null; };
type SignedPreKey = {
id: number;
publicKey: ArrayBuffer;
privateKey: ArrayBuffer;
created_at: number;
confirmed: boolean;
signature: ArrayBuffer;
};
type ContactPreKey = {
id: number;
identityKeyString: string;
publicKey: ArrayBuffer;
keyId: number;
};
type ContactSignedPreKey = {
id: number;
identityKeyString: string;
publicKey: ArrayBuffer;
keyId: number;
signature: ArrayBuffer;
created_at: number;
confirmed: boolean;
};
type PairingAuthorisation = { type PairingAuthorisation = {
primaryDevicePubKey: string; primaryDevicePubKey: string;
secondaryDevicePubKey: string; secondaryDevicePubKey: string;
requestSignature: string; requestSignature: ArrayBuffer;
grantSignature: string | null; grantSignature: ArrayBuffer | null;
} | null;
type PairingAuthorisationInit = {
requestSignature: string;
grantSignature: string;
}; };
type GuardNode = { type GuardNode = {
@ -67,53 +88,61 @@ export function removeIndexedDBFiles(): Promise<void>;
export function getPasswordHash(): Promise<string | null>; export function getPasswordHash(): Promise<string | null>;
// Identity Keys // Identity Keys
export function createOrUpdateIdentityKey(data: any): Promise<void>; export function createOrUpdateIdentityKey(data: IdentityKey): Promise<void>;
export function getIdentityKeyById(id: string): Promise<IdentityKey>; export function getIdentityKeyById(id: string): Promise<IdentityKey | null>;
export function bulkAddIdentityKeys(array: Array<IdentityKey>): Promise<void>; export function bulkAddIdentityKeys(array: Array<IdentityKey>): Promise<void>;
export function removeIdentityKeyById(id: string): Promise<void>; export function removeIdentityKeyById(id: string): Promise<void>;
export function removeAllIdentityKeys(): Promise<void>; export function removeAllIdentityKeys(): Promise<void>;
// Pre Keys // Pre Keys
export function createOrUpdatePreKey(data: PreKey): Promise<void>; export function createOrUpdatePreKey(data: PreKey): Promise<void>;
export function getPreKeyById(id: string): Promise<PreKey>; export function getPreKeyById(id: number): Promise<PreKey | null>;
export function getPreKeyByRecipient(recipient: string): Promise<PreKey>; export function getPreKeyByRecipient(recipient: string): Promise<PreKey | null>;
export function bulkAddPreKeys(data: Array<PreKey>): Promise<void>; export function bulkAddPreKeys(data: Array<PreKey>): Promise<void>;
export function removePreKeyById(id: string): Promise<void>; export function removePreKeyById(id: number): Promise<void>;
export function getAllPreKeys(): Promise<Array<PreKey>>; export function getAllPreKeys(): Promise<Array<PreKey>>;
// Signed Pre Keys // Signed Pre Keys
export function createOrUpdateSignedPreKey(data: PreKey): Promise<void>; export function createOrUpdateSignedPreKey(data: SignedPreKey): Promise<void>;
export function getSignedPreKeyById(id: string): Promise<PreKey>; export function getSignedPreKeyById(id: number): Promise<SignedPreKey | null>;
export function getAllSignedPreKeys(recipient: string): Promise<PreKey>; export function getAllSignedPreKeys(): Promise<SignedPreKey | null>;
export function bulkAddSignedPreKeys(array: Array<PreKey>): Promise<void>; export function bulkAddSignedPreKeys(array: Array<SignedPreKey>): Promise<void>;
export function removeSignedPreKeyById(id: string): Promise<void>; export function removeSignedPreKeyById(id: number): Promise<void>;
export function removeAllSignedPreKeys(): Promise<void>; export function removeAllSignedPreKeys(): Promise<void>;
// Contact Pre Key // Contact Pre Key
export function createOrUpdateContactPreKey(data: PreKey): Promise<void>; export function createOrUpdateContactPreKey(data: ContactPreKey): Promise<void>;
export function getContactPreKeyById(id: string): Promise<PreKey>; export function getContactPreKeyById(id: number): Promise<ContactPreKey | null>;
export function getContactPreKeyByIdentityKey(key: string): Promise<PreKey>; export function getContactPreKeyByIdentityKey(
key: string
): Promise<ContactPreKey | null>;
export function getContactPreKeys( export function getContactPreKeys(
keyId: string, keyId: number,
identityKeyString: string identityKeyString: string
): Promise<Array<PreKey>>; ): Promise<Array<ContactPreKey>>;
export function getAllContactPreKeys(): Promise<Array<PreKey>>; export function getAllContactPreKeys(): Promise<Array<ContactPreKey>>;
export function bulkAddContactPreKeys(array: Array<PreKey>): Promise<void>; export function bulkAddContactPreKeys(
export function removeContactPreKeyByIdentityKey(id: string): Promise<void>; array: Array<ContactPreKey>
): Promise<void>;
export function removeContactPreKeyByIdentityKey(id: number): Promise<void>;
export function removeAllContactPreKeys(): Promise<void>; export function removeAllContactPreKeys(): Promise<void>;
// Contact Signed Pre Key // Contact Signed Pre Key
export function createOrUpdateContactSignedPreKey(data: PreKey): Promise<void>; export function createOrUpdateContactSignedPreKey(
export function getContactSignedPreKeyByIdid(string): Promise<PreKey>; data: ContactSignedPreKey
): Promise<void>;
export function getContactSignedPreKeyById(
id: number
): Promise<ContactSignedPreKey | null>;
export function getContactSignedPreKeyByIdentityKey( export function getContactSignedPreKeyByIdentityKey(
key: string key: string
): Promise<PreKey>; ): Promise<ContactSignedPreKey | null>;
export function getContactSignedPreKeys( export function getContactSignedPreKeys(
keyId: string, keyId: number,
identityKeyString: string identityKeyString: string
): Promise<Array<PreKey>>; ): Promise<Array<ContactSignedPreKey>>;
export function bulkAddContactSignedPreKeys( export function bulkAddContactSignedPreKeys(
array: Array<PreKey> array: Array<ContactSignedPreKey>
): Promise<void>; ): Promise<void>;
export function removeContactSignedPreKeyByIdentityKey( export function removeContactSignedPreKeyByIdentityKey(
id: string id: string
@ -122,8 +151,8 @@ export function removeAllContactSignedPreKeys(): Promise<void>;
// Authorisations & Linking // Authorisations & Linking
export function createOrUpdatePairingAuthorisation( export function createOrUpdatePairingAuthorisation(
data: PairingAuthorisationInit data: PairingAuthorisation
): Promise<PairingAuthorisation>; ): Promise<void>;
export function removePairingAuthorisationForSecondaryPubKey( export function removePairingAuthorisationForSecondaryPubKey(
pubKey: string pubKey: string
): Promise<void>; ): Promise<void>;
@ -132,10 +161,10 @@ export function getGrantAuthorisationsForPrimaryPubKey(
): Promise<Array<PairingAuthorisation>>; ): Promise<Array<PairingAuthorisation>>;
export function getGrantAuthorisationForSecondaryPubKey( export function getGrantAuthorisationForSecondaryPubKey(
pubKey: string pubKey: string
): Promise<PairingAuthorisation>; ): Promise<PairingAuthorisation | null>;
export function getAuthorisationForSecondaryPubKey( export function getAuthorisationForSecondaryPubKey(
pubKey: string pubKey: string
): Promise<PairingAuthorisation>; ): Promise<PairingAuthorisation | null>;
export function getSecondaryDevicesFor( export function getSecondaryDevicesFor(
primaryDevicePubKey: string primaryDevicePubKey: string
): Promise<Array<string>>; ): Promise<Array<string>>;

Loading…
Cancel
Save