Update private key generation
This commit is contained in:
@@ -1,7 +1,13 @@
|
|||||||
import { x25519 } from "@noble/curves/ed25519";
|
import { x25519 } from "@noble/curves/ed25519";
|
||||||
|
|
||||||
export function getX25519PrivateKey(): Uint8Array {
|
export function getX25519PrivateKey(): Uint8Array {
|
||||||
return x25519.utils.randomPrivateKey();
|
const key = x25519.utils.randomPrivateKey();
|
||||||
|
|
||||||
|
key[0] &= 248
|
||||||
|
key[31] &= 127
|
||||||
|
key[31] |= 64
|
||||||
|
|
||||||
|
return key;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getX25519PublicKey(privateKey: Uint8Array): Uint8Array {
|
export function getX25519PublicKey(privateKey: Uint8Array): Uint8Array {
|
||||||
|
|||||||
Reference in New Issue
Block a user