mirror of
https://github.com/FranP-code/Baileys.git
synced 2025-10-13 00:32:22 +00:00
fix: handle string format for signing keys in SenderKeyState (#1552)
This commit is contained in:
committed by
GitHub
parent
89b51e4040
commit
38b4ada997
@@ -94,9 +94,11 @@ export class SenderKeyState {
|
|||||||
const publicKey = this.senderKeyStateStructure.senderSigningKey.public
|
const publicKey = this.senderKeyStateStructure.senderSigningKey.public
|
||||||
if (publicKey instanceof Buffer) {
|
if (publicKey instanceof Buffer) {
|
||||||
return publicKey
|
return publicKey
|
||||||
|
} else if (typeof publicKey === 'string') {
|
||||||
|
return Buffer.from(publicKey, 'base64')
|
||||||
}
|
}
|
||||||
|
|
||||||
return Buffer.from(publicKey || [])
|
return Buffer.from(publicKey)
|
||||||
}
|
}
|
||||||
|
|
||||||
public getSigningKeyPrivate(): Buffer | undefined {
|
public getSigningKeyPrivate(): Buffer | undefined {
|
||||||
@@ -107,6 +109,8 @@ export class SenderKeyState {
|
|||||||
|
|
||||||
if (privateKey instanceof Buffer) {
|
if (privateKey instanceof Buffer) {
|
||||||
return privateKey
|
return privateKey
|
||||||
|
} else if (typeof privateKey === 'string') {
|
||||||
|
return Buffer.from(privateKey, 'base64')
|
||||||
}
|
}
|
||||||
|
|
||||||
return Buffer.from(privateKey)
|
return Buffer.from(privateKey)
|
||||||
|
|||||||
Reference in New Issue
Block a user