mirror of
https://github.com/FranP-code/Baileys.git
synced 2025-10-13 00:32:22 +00:00
finalize multi-device
This commit is contained in:
@@ -1,22 +1,51 @@
|
||||
import type { Contact } from "./Contact"
|
||||
import type { proto } from "../../WAProto"
|
||||
|
||||
export interface AuthenticationCredentials {
|
||||
clientID: string
|
||||
serverToken: string
|
||||
clientToken: string
|
||||
encKey: Buffer
|
||||
macKey: Buffer
|
||||
export type KeyPair = { public: Uint8Array, private: Uint8Array }
|
||||
export type SignedKeyPair = { keyPair: KeyPair, signature: Uint8Array, keyId: number }
|
||||
|
||||
export type ProtocolAddress = {
|
||||
name: string // jid
|
||||
deviceId: number
|
||||
}
|
||||
export interface AuthenticationCredentialsBase64 {
|
||||
clientID: string
|
||||
serverToken: string
|
||||
clientToken: string
|
||||
encKey: string
|
||||
macKey: string
|
||||
export type SignalIdentity = {
|
||||
identifier: ProtocolAddress
|
||||
identifierKey: Uint8Array
|
||||
}
|
||||
export interface AuthenticationCredentialsBrowser {
|
||||
WABrowserId: string
|
||||
WASecretBundle: {encKey: string, macKey: string} | string
|
||||
WAToken1: string
|
||||
WAToken2: string
|
||||
|
||||
export type CollectionType = 'regular_high' | 'regular_low' | 'critical_unblock_low' | 'critical_block'
|
||||
|
||||
export type AuthenticationCreds = {
|
||||
noiseKey: KeyPair
|
||||
signedIdentityKey: KeyPair
|
||||
signedPreKey: SignedKeyPair
|
||||
registrationId: number
|
||||
advSecretKey: string
|
||||
me?: Contact
|
||||
account?: proto.ADVSignedDeviceIdentity
|
||||
signalIdentities?: SignalIdentity[]
|
||||
appStateSyncKeys?: proto.IAppStateSyncKey[]
|
||||
appStateVersion?: {
|
||||
[T in CollectionType]: number
|
||||
}
|
||||
|
||||
firstUnuploadedPreKeyId: number
|
||||
serverHasPreKeys: boolean
|
||||
nextPreKeyId: number
|
||||
}
|
||||
export type AnyAuthenticationCredentials = AuthenticationCredentialsBrowser | AuthenticationCredentialsBase64 | AuthenticationCredentials
|
||||
type Awaitable<T> = T | Promise<T>
|
||||
export type SignalKeyStore = {
|
||||
getPreKey: (keyId: number) => Awaitable<KeyPair>
|
||||
setPreKey: (keyId: number, pair: KeyPair | null) => Awaitable<void>
|
||||
|
||||
getSession: (sessionId: string) => Awaitable<any>
|
||||
setSession: (sessionId: string, item: any | null) => Awaitable<void>
|
||||
|
||||
getSenderKey: (id: string) => Awaitable<any>
|
||||
setSenderKey: (id: string, item: any | null) => Awaitable<void>
|
||||
}
|
||||
|
||||
export type AuthenticationState = {
|
||||
creds: AuthenticationCreds
|
||||
keys: SignalKeyStore
|
||||
}
|
||||
Reference in New Issue
Block a user