Skip to main content

latest
Works with
JSR Score
23%
Published
3 months ago (1.0.0)

Generate an ed25519 keypair

As used in https://bogbook.com/

Depends on TweetNaCl to generate 25519 keypairs, encode them in base64, and save them in localStorage.

import { ed25519 } from './mod.js'

const keypair = await ed25519.keypair()
// QBkxvfsfy7/iM5/+3U2xzpIJk2iiMWXLSaWcvno9jRU=gw5GGOvMAbC48hUatHT55OSkzi1MBddYn5endgrSfBJAGTG9+x/Lv+Izn/7dTbHOkgmTaKIxZctJpZy+ej2NFQ==
const pubkey = await ed25519.pubkey()
// QBkxvfsfy7/iM5/+3U2xzpIJk2iiMWXLSaWcvno9jRU=
const privkey = await ed25519.privkey()
gw5GGOvMAbC48hUatHT55OSkzi1MBddYn5endgrSfBJAGTG9+x/Lv+Izn/7dTbHOkgmTaKIxZctJpZy+ej2NFQ==

await ed25519.deletekey()
// (localStorage.getItem('kepair') === undefined)

MIT

Add Package

deno add @bog/ed25519keys

Import symbol

import * as mod from "@bog/ed25519keys";

Add Package

npx jsr add @bog/ed25519keys

Import symbol

import * as mod from "@bog/ed25519keys";

Add Package

yarn dlx jsr add @bog/ed25519keys

Import symbol

import * as mod from "@bog/ed25519keys";

Add Package

pnpm dlx jsr add @bog/ed25519keys

Import symbol

import * as mod from "@bog/ed25519keys";

Add Package

bunx jsr add @bog/ed25519keys

Import symbol

import * as mod from "@bog/ed25519keys";