mirror of
https://github.com/signalapp/Signal-Desktop.git
synced 2026-05-08 08:58:38 +01:00
Add extra notary signature checks to zkgroup
This commit is contained in:
@@ -16,6 +16,7 @@ import {
|
||||
ProfileKeyCredentialResponse,
|
||||
ServerPublicParams,
|
||||
UuidCiphertext,
|
||||
NotarySignature,
|
||||
} from '@signalapp/signal-client/zkgroup';
|
||||
import { UUID } from '../types/UUID';
|
||||
import type { UUIDStringType } from '../types/UUID';
|
||||
@@ -256,3 +257,17 @@ export function deriveProfileKeyCommitment(
|
||||
|
||||
return profileKey.getCommitment(uuid).contents.toString('base64');
|
||||
}
|
||||
|
||||
export function verifyNotarySignature(
|
||||
serverPublicParamsBase64: string,
|
||||
message: Uint8Array,
|
||||
signature: Uint8Array
|
||||
): void {
|
||||
const serverPublicParams = new ServerPublicParams(
|
||||
Buffer.from(serverPublicParamsBase64, 'base64')
|
||||
);
|
||||
|
||||
const notarySignature = new NotarySignature(Buffer.from(signature));
|
||||
|
||||
serverPublicParams.verifySignature(Buffer.from(message), notarySignature);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user