Backwards compatibility updates for libsignal-client
This commit is contained in:
parent
34285054f6
commit
bc0f4387fe
4 changed files with 28 additions and 6 deletions
12
preload.js
12
preload.js
|
@ -534,6 +534,18 @@ try {
|
|||
},
|
||||
createKeyPair: incomingKey => {
|
||||
const incomingKeyBuffer = Buffer.from(incomingKey);
|
||||
|
||||
if (incomingKeyBuffer.length !== 32) {
|
||||
throw new Error('key must be 32 bytes long');
|
||||
}
|
||||
|
||||
// eslint-disable-next-line no-bitwise
|
||||
incomingKeyBuffer[0] &= 248;
|
||||
// eslint-disable-next-line no-bitwise
|
||||
incomingKeyBuffer[31] &= 127;
|
||||
// eslint-disable-next-line no-bitwise
|
||||
incomingKeyBuffer[31] |= 64;
|
||||
|
||||
const privKey = client.PrivateKey.deserialize(incomingKeyBuffer);
|
||||
const pubKey = privKey.getPublicKey();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue