You cannot select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
	
	
		
			25 lines
		
	
	
		
			785 B
		
	
	
	
		
			TypeScript
		
	
			
		
		
	
	
			25 lines
		
	
	
		
			785 B
		
	
	
	
		
			TypeScript
		
	
import { getItemById } from '../../js/modules/data';
 | 
						|
import { KeyPair } from '../../libtextsecure/libsignal-protocol';
 | 
						|
import { PrimaryPubKey } from '../session/types';
 | 
						|
import { MultiDeviceProtocol } from '../session/protocols';
 | 
						|
 | 
						|
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 getPrimary(): Promise<PrimaryPubKey> {
 | 
						|
  const ourNumber = (await getCurrentDevicePubKey()) as string;
 | 
						|
  return MultiDeviceProtocol.getPrimaryDevice(ourNumber);
 | 
						|
}
 | 
						|
 | 
						|
export async function getIdentityKeyPair(): Promise<KeyPair | undefined> {
 | 
						|
  const item = await getItemById('identityKey');
 | 
						|
 | 
						|
  return item?.value;
 | 
						|
}
 |