Skip to main content

API reference

These pages are generated from the SDK source metadata and are the precise contract for each public declaration.

  • Format — Format is the KeyHold document format discriminator.
  • Version — Version is the supported KeyHold document version.
  • KDFAlgorithm — KDFAlgorithm identifies the password-based key derivation algorithm.
  • PasswordEncoding — PasswordEncoding is an exported Go constant.
  • CipherAlgorithm — CipherAlgorithm identifies the authenticated encryption algorithm.
  • KeyLengthBits — KeyLengthBits is an exported Go constant.
  • OutputLengthBits — OutputLengthBits is an exported Go constant.
  • TagLengthBits — TagLengthBits is an exported Go constant.
  • MinIterations — MinIterations is an exported Go constant.
  • MaxIterations — MaxIterations is an exported Go constant.
  • RecommendedIterations — RecommendedIterations is an exported Go constant.
  • SaltLengthBytes — SaltLengthBytes is an exported Go constant.
  • IVLengthBytes — IVLengthBytes is an exported Go constant.
  • PrivateKeyLengthBytes — PrivateKeyLengthBytes is an exported Go constant.
  • PublicKeyLengthBytes — PublicKeyLengthBytes is an exported Go constant.
  • CiphertextAndTagLengthBytes — CiphertextAndTagLengthBytes is an exported Go constant.
  • TagLengthBytes — TagLengthBytes is an exported Go constant.
  • Serialize — Serialize validates and encodes a document as canonical JSON.
  • Summary — Summary returns the non-secret metadata of a validated document.
  • Unlock — Unlock decrypts a document and verifies that the recovered private key matches its public key.
  • RecommendedParameters — RecommendedParameters returns the recommended explicit export parameters.
  • ExportEncryptedState — ExportEncryptedState serializes state that is already encrypted using KeyHold semantics.
  • ExportPrivateKey — ExportPrivateKey encrypts a private key with a password and returns a complete JSON document.
  • KeyDerivation — KeyDerivation describes the password-based key derivation section.
  • Cipher — Cipher describes the AES-GCM section.
  • Document — Document is a complete, validated KeyHold v1 document.
  • KeyDerivationParameters — KeyDerivationParameters contains explicit KDF parameters for export.
  • CipherParameters — CipherParameters contains explicit cipher parameters for export.
  • Parameters — Parameters contains the complete explicit export parameter set.
  • EncryptedKDFInput — EncryptedKDFInput contains an already-derived document KDF section and raw salt.
  • EncryptedCipherInput — EncryptedCipherInput contains an already-encrypted document cipher section.
  • EncryptedStateInput — EncryptedStateInput describes encrypted state that can be serialized without decryption.
  • PrivateKeyExportInput — PrivateKeyExportInput describes plaintext private-key export input.
  • UnlockResult — UnlockResult contains the private key and its matching compressed public key.
  • DocumentSummary — DocumentSummary contains the non-secret metadata of a document.
  • EncodeBase64URL — EncodeBase64URL encodes bytes as unpadded canonical base64url.
  • DecodeBase64URL — DecodeBase64URL decodes an unpadded canonical base64url value.
  • EncodeHex — EncodeHex encodes bytes as lowercase hexadecimal.
  • DecodeHex — DecodeHex decodes a lowercase hexadecimal value.
  • ErrorCode — ErrorCode is a stable category of KeyHold failure.
  • ErrInvalidJSON — ErrInvalidJSON is an exported Go constant.
  • ErrUnsupportedFormat — ErrUnsupportedFormat is an exported Go constant.
  • ErrUnsupportedVersion — ErrUnsupportedVersion is an exported Go constant.
  • ErrInvalidDocument — ErrInvalidDocument is an exported Go constant.
  • ErrInvalidParameter — ErrInvalidParameter is an exported Go constant.
  • ErrUnsupportedAlgorithm — ErrUnsupportedAlgorithm is an exported Go constant.
  • ErrInvalidPrivateKey — ErrInvalidPrivateKey is an exported Go constant.
  • ErrUnlockFailed — ErrUnlockFailed is an exported Go constant.
  • KeyHoldError — KeyHoldError is an SDK error with a stable code and optional cause.
  • E — E constructs a KeyHoldError with an optional underlying cause.
  • ErrorCodeOf — ErrorCodeOf returns the first KeyHold error code in an unwrap chain.
  • PublicKeyFromPrivate — PublicKeyFromPrivate derives a compressed secp256k1 public key.
  • ValidatePublicKeyHex — ValidatePublicKeyHex validates and decodes a compressed secp256k1 public key.
  • Validate — Validate checks the structure and cryptographic public fields of a document.
  • Parse — Parse decodes JSON bytes and validates the resulting document.