mirror of
https://github.com/FranP-code/Baileys.git
synced 2025-10-13 00:32:22 +00:00
feat: implement getAuthenticationCredsType
This commit is contained in:
@@ -3,7 +3,7 @@ import { randomBytes } from 'crypto'
|
||||
import { decodeBinaryNodeLegacy, jidNormalizedUser } from "../WABinary"
|
||||
import { aesDecrypt, hmacSign, hkdf, Curve } from "./crypto"
|
||||
import { BufferJSON } from './generics'
|
||||
import { DisconnectReason, WATag, LegacyAuthenticationCreds, CurveKeyPair, Contact } from "../Types"
|
||||
import { DisconnectReason, WATag, LegacyAuthenticationCreds, AuthenticationCreds, CurveKeyPair, Contact } from "../Types"
|
||||
|
||||
export const newLegacyAuthCreds = () => ({
|
||||
clientID: randomBytes(16).toString('base64')
|
||||
@@ -173,4 +173,13 @@ export const useSingleFileLegacyAuthState = (file: string) => {
|
||||
writeFileSync(file, str)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export const getAuthenticationCredsType = (creds: LegacyAuthenticationCreds | AuthenticationCreds) => {
|
||||
if('clientID' in creds && !!creds.clientID) {
|
||||
return 'legacy'
|
||||
}
|
||||
if('noiseKey' in creds && !!creds.noiseKey) {
|
||||
return 'md'
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user