scheme

package
v0.0.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 11, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package scheme orchestrates the cryptocore primitives, blob framing, archiving, and word codec into the two high-level operations: sealing a directory into a vault+warden pair, and the unlock handshake. UI (prompts, printing) lives in the commands; this package is pure logic so it can be tested headlessly.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewChallenge

func NewChallenge() (ePriv *ecdh.PrivateKey, challenge []byte, err error)

NewChallenge generates an ephemeral keypair; the public bytes are the challenge.

func Seal

func Seal(assetsDir string, wordlist, password, wardenPass []byte, noWarden bool) (vaultPayload, wardenPayload []byte, err error)

Seal encrypts assetsDir and returns the payloads to append to the vault and warden stubs. wordlist is the raw newline-separated BIP39 list. wardenPass may be empty (obfuscation only). If noWarden is true, the vault is single-factor (password only): no keypair/handshake, no warden — wardenPayload is nil and wardenPass is ignored.

func WardenHasPass

func WardenHasPass(wardenPayload []byte) (bool, error)

WardenHasPass reports whether the warden payload needs a passphrase, without decrypting it (so the command can decide whether to prompt).

Types

type VaultMeta

type VaultMeta struct {
	TwoFactor bool   // false for a single-factor (--no-warden) vault
	PK        []byte // warden public key; empty unless TwoFactor
	Wordlist  []byte // raw BIP39 list; empty unless TwoFactor
	// contains filtered or unexported fields
}

VaultMeta is the result of opening the vault's password-protected metadata.

func OpenVaultMeta

func OpenVaultMeta(vaultPayload, password []byte) (*VaultMeta, error)

OpenVaultMeta decrypts the metadata with the password. A wrong password fails here, before the handshake (if any).

func (*VaultMeta) OpenAssets

func (m *VaultMeta) OpenAssets(ePriv *ecdh.PrivateKey, response []byte) (map[string][]byte, error)

OpenAssets completes the unlock: recover the share from the warden response, derive K_a, decrypt and extract the files.

func (*VaultMeta) OpenAssetsSolo added in v0.0.7

func (m *VaultMeta) OpenAssetsSolo() (map[string][]byte, error)

OpenAssetsSolo completes the unlock for a single-factor (--no-warden) vault: no handshake, K_a is derived from the password alone.

type WardenKey

type WardenKey struct {
	Wordlist []byte
	// contains filtered or unexported fields
}

WardenKey holds the responder's secret and wordlist after deobfuscation.

func OpenWarden

func OpenWarden(wardenPayload, pass []byte) (*WardenKey, error)

OpenWarden deobfuscates (or decrypts, if a passphrase is set) the warden payload. pass may be empty when HasPass is false.

func (*WardenKey) Respond

func (k *WardenKey) Respond(challenge []byte) ([]byte, error)

Respond computes the 16-byte response for a challenge (warden side).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL