Files
Desktop/ts/test-helpers/keyPair.node.ts
T
2026-04-13 12:50:00 -07:00

19 lines
459 B
TypeScript

// Copyright 2026 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
import { PrivateKey } from '@signalapp/libsignal-client';
type KeyPair = Readonly<{
publicKey: Uint8Array<ArrayBuffer>;
privateKey: Uint8Array<ArrayBuffer>;
}>;
export function keyPair(): KeyPair {
const privKey = PrivateKey.generate();
const pubKey = privKey.getPublicKey();
return {
publicKey: pubKey.serialize(),
privateKey: privKey.serialize(),
};
}