Getting started
KeyHold is a small protocol with a deliberate boundary: a password encrypts one secp256k1 private key, and the result is a portable JSON document. Start with the SDK that matches your application.
Install
- TypeScript
- Go
npm install keyhold
go get github.com/bsv8/KeyHold/go/v2
First operation
The TypeScript SDK returns a promise for cryptographic work. The Go SDK returns an explicit error; both produce the same document format.
- TypeScript
- Go
import {exportPrivateKey, recommendedParameters} from 'keyhold';
const document = await exportPrivateKey({
privateKey,
password: 'correct horse battery staple',
label: 'primary signing key',
parameters: recommendedParameters(),
});
parameters := keyhold.RecommendedParameters()
document, err := keyhold.ExportPrivateKey(keyhold.PrivateKeyExportInput{
PrivateKey: privateKey,
Password: "correct horse battery staple",
Label: "primary signing key",
Parameters: parameters,
})
if err != nil { return err }
Next, use the operation map to choose a capability, or follow the export and unlock workflow.