@smartledger/notaryhash
v1.0.0
Published
Client SDK for NotaryHash — sign hashes locally, anchor them to BSV, and verify certificates offline against Bitcoin block headers. Privacy-preserving and post-quantum (ML-DSA / SLH-DSA).
Maintainers
Readme
@smartledger/notaryhash
Client SDK for NotaryHash — anchor a signed hash to the BSV blockchain and verify the resulting certificate, in any Node.js app.
- Privacy-preserving — you hash and sign locally; only the hash, signature, and public key are ever sent. Your document and private key never leave your process.
- Post-quantum — ECDSA plus ML-DSA (FIPS 204) and SLH-DSA (FIPS 205).
- Trustless verification — verify a certificate against Bitcoin block headers alone, with no dependency on the issuing service.
- Tiny — depends only on
@noblecrypto. No server code.
npm install @smartledger/notaryhashNotarize (sign locally, anchor via a service)
import { generateKey, notarizeBytes } from '@smartledger/notaryhash';
import { readFileSync } from 'node:fs';
const key = generateKey('ECDSA-secp256k1'); // keep key.privateKey secret — it never leaves you
const { certificate } = await notarizeBytes(readFileSync('contract.pdf'), key.privateKey, {
url: 'https://notaryhash.com',
apiKey: process.env.NOTARYHASH_API_KEY, // write endpoint requires a key
});
console.log('anchored:', certificate.anchor.txid);Swap generateKey('ML-DSA-65') (or any of the 16 algorithms) for post-quantum signatures —
pass the same algorithm to notarizeBytes via the options.
Verify (offline, against block headers — no trust in the service)
import { verifyCertificateStandalone, MultiSourceHeaderProvider, WocHeaderProvider } from '@smartledger/notaryhash';
const headers = new MultiSourceHeaderProvider([
new WocHeaderProvider('https://api.whatsonchain.com/v1/bsv/main'),
// add more independent sources for a real cross-check
]);
const verdict = await verifyCertificateStandalone(certificate, headers);
// { ok, signatureValid, proofHashValid, anchorValid, verificationMethod: 'spv', blockHeight, reasons }verifyCertificateOffline(certificate) checks the signature and proof hash with no network at
all (the anchor check needs a block header).
CLI
This package also installs a notaryhash CLI:
notaryhash keygen --algorithm ECDSA-secp256k1 --out key.json
notaryhash notarize contract.pdf --algorithm ECDSA-secp256k1 \
--key "$(node -e "console.log(require('./key.json').privateKey)")" \
--url https://notaryhash.com --api-key "$NOTARYHASH_API_KEY"
notaryhash verify cert.json --offlineWhat this SDK does and does not do
It produces and verifies proofs. It does not run the notarization service (anchoring, fee-paying wallet, key issuance) — that is operated by a NotaryHash provider such as notaryhash.com. Verification is free and open; anchoring goes through a provider's authenticated API.
See the protocol specification (BRC-141).
License
MIT © SmartLedger.Technology
