Small TypeScript helpers for working with curve25519 / X25519 / base58 in the
browser and Node. Thin wrappers around @noble/curves.
npm install @zksend/curve25519-helpersbs58encode(bytes)/bs58decode(str)— base58 withoutBufferedwardsToMontgomeryPub(pub)— point form conversionclampScalar(bytes)— RFC 8032 §5.1.5 clampingecdhSharedSecret(scalar, peerPub)— DH on ed25519
The Solana ecosystem standard for crypto is @noble/curves. This package
adds a few project-specific helpers used across ZKSend repos.
MIT
| Function | Returns | Notes |
|---|---|---|
bs58encode(bytes) |
string | matches bs58 package |
bs58decode(str) |
Uint8Array | throws on invalid char |
concatBytes(...) |
Uint8Array | one-shot concat |
clampScalar(seed) |
Uint8Array | RFC 8032 |
ecdhSharedSecret(scalar, peer) |
Uint8Array | Edwards-direct |
| Function | Returns | Notes |
|---|---|---|
bs58encode(bytes) |
string | matches bs58 package |
bs58decode(str) |
Uint8Array | throws on invalid char |
concatBytes(...) |
Uint8Array | one-shot concat |
clampScalar(seed) |
Uint8Array | RFC 8032 |
ecdhSharedSecret(scalar, peer) |
Uint8Array | Edwards-direct |
import { bs58encode, bs58decode } from "@zksend/curve25519-helpers";
const addr = "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
const bytes = bs58decode(addr); // Uint8Array(32)
const back = bs58encode(bytes); // === addrNo Buffer. Works in any browser, Bun, Deno, Node 18+.
import { bs58encode, bs58decode } from "@zksend/curve25519-helpers";
const addr = "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
const bytes = bs58decode(addr); // Uint8Array(32)
const back = bs58encode(bytes); // === addrNo Buffer. Works in any browser, Bun, Deno, Node 18+.
- RFC 8032 — Edwards-Curve Digital Signature Algorithm (EdDSA)
- @noble/curves — https://github.com/paulmillr/noble-curves
- RFC 8032 — Edwards-Curve Digital Signature Algorithm (EdDSA)
- @noble/curves — https://github.com/paulmillr/noble-curves