mirror of
https://github.com/perfect-panel/ppanel-web.git
synced 2026-02-06 03:30:25 -05:00
12 lines
382 B
TypeScript
12 lines
382 B
TypeScript
import { x25519 } from '@noble/curves/ed25519.js';
|
|
import { toB64Url } from './util';
|
|
|
|
/**
|
|
* Generate a Reality key pair
|
|
* @returns An object containing the private and public keys in base64url format
|
|
*/
|
|
export function generateRealityKeyPair() {
|
|
const { secretKey, publicKey } = x25519.keygen();
|
|
return { privateKey: toB64Url(secretKey), publicKey: toB64Url(publicKey) };
|
|
}
|