Getting started
Derive a key pair from a seed and sign a digest in a few lines.
Import what you need
import { publicKeyFromSeed, deriveIdentityFromSeed, sign } from "@qubic.org/crypto"
import { toSeed } from "@qubic.org/types"Brand your seed string
const seed = toSeed("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
// seed is now typed as Seed — safe to pass to crypto functionsDerive the public key and identity
const publicKey = publicKeyFromSeed(seed) // Uint8Array (32 bytes)
const identity = deriveIdentityFromSeed(seed) // Identity ("BPFJANADBB...")
console.log("Identity:", identity)
console.log("Public key:", Buffer.from(publicKey).toString("hex"))Sign a digest
const digest = new Uint8Array(32) // replace with your actual transaction digest
const signature = await sign(digest, seed) // Uint8Array (64 bytes)
console.log("Signature:", Buffer.from(signature).toString("hex"))Only sign is async — always await it. publicKeyFromSeed, deriveIdentityFromSeed, verify, and k12 are all synchronous.