mirror of
https://github.com/perfect-panel/ppanel-web.git
synced 2026-02-06 03:30:25 -05:00
12 lines
373 B
TypeScript
12 lines
373 B
TypeScript
import * as x25519 from '@noble/ed25519';
|
|
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) };
|
|
}
|