Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update key generation #277

Merged
merged 21 commits into from
Sep 8, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update private key generation
KomelT committed Sep 2, 2024
commit d0bd02980de89146341133e34cc152eb0ca2b107
8 changes: 7 additions & 1 deletion src/core/utils/x25519.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
import { x25519 } from "@noble/curves/ed25519";

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 {