decrypt/encrypt with libsignal-client, remove libsignal-protocol-javascript
This commit is contained in:
parent
37ff4a1df4
commit
86d2a4b5dd
60 changed files with 2508 additions and 28714 deletions
|
@ -39,11 +39,13 @@ import {
|
|||
concatenateBytes,
|
||||
constantTimeEqual,
|
||||
decryptAesGcm,
|
||||
deriveSecrets,
|
||||
encryptCdsDiscoveryRequest,
|
||||
getBytes,
|
||||
getRandomValue,
|
||||
splitUuids,
|
||||
} from '../Crypto';
|
||||
import { calculateAgreement, generateKeyPair } from '../Curve';
|
||||
import * as linkPreviewFetch from '../linkPreviews/linkPreviewFetch';
|
||||
|
||||
import {
|
||||
|
@ -2406,7 +2408,7 @@ export function initialize({
|
|||
username: string;
|
||||
password: string;
|
||||
}) {
|
||||
const keyPair = await window.libsignal.externalCurveAsync.generateKeyPair();
|
||||
const keyPair = generateKeyPair();
|
||||
const { privKey, pubKey } = keyPair;
|
||||
// Remove first "key type" byte from public key
|
||||
const slicedPubKey = pubKey.slice(1);
|
||||
|
@ -2476,11 +2478,11 @@ export function initialize({
|
|||
);
|
||||
|
||||
// Derive key
|
||||
const ephemeralToEphemeral = await window.libsignal.externalCurveAsync.calculateAgreement(
|
||||
const ephemeralToEphemeral = calculateAgreement(
|
||||
decoded.serverEphemeralPublic,
|
||||
privKey
|
||||
);
|
||||
const ephemeralToStatic = await window.libsignal.externalCurveAsync.calculateAgreement(
|
||||
const ephemeralToStatic = calculateAgreement(
|
||||
decoded.serverStaticPublic,
|
||||
privKey
|
||||
);
|
||||
|
@ -2493,10 +2495,7 @@ export function initialize({
|
|||
decoded.serverEphemeralPublic,
|
||||
decoded.serverStaticPublic
|
||||
);
|
||||
const [
|
||||
clientKey,
|
||||
serverKey,
|
||||
] = await window.libsignal.HKDF.deriveSecrets(
|
||||
const [clientKey, serverKey] = await deriveSecrets(
|
||||
masterSecret,
|
||||
publicKeys,
|
||||
new ArrayBuffer(0)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue