fix: handle string format for signing keys in SenderKeyState (#1552)

This commit is contained in:
João Lucas de Oliveira Lopes
2025-06-24 18:50:57 -03:00
committed by GitHub
parent 89b51e4040
commit 38b4ada997

View File

@@ -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)