secure

package
v0.1.0-preview.2 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2026 License: Apache-2.0 Imports: 19 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const Suite = "DARE20-AGE-X25519-v1"

Variables

This section is empty.

Functions

func AdoptLegacySpool

func AdoptLegacySpool(key, ciphertextPath, envelopePath string, identity *Identity, root string, size int64) error

Adopt a legacy cache only after authenticating its envelope for this device and verifying its plaintext identity. Leave all legacy files untouched.

func ConfigDirectory

func ConfigDirectory() (string, error)

func DecryptFile

func DecryptFile(input, output string, key []byte) error

func DecryptManifestFile

func DecryptManifestFile(input, output string, manifest Manifest) error

SIO encodes an empty source as zero bytes and its generic decryptor rejects that stream. Accept that one case only when the authenticated manifest explicitly commits to an empty plaintext. Key-only decryption stays strict.

func DecryptManifestStream

func DecryptManifestStream(source io.Reader, destination io.Writer, manifest Manifest) error

The manifest must already have been opened with this recipient's age key. Callers additionally verify the plaintext size and root before committing.

func EncryptFile

func EncryptFile(input, output, plaintextRoot string, plaintextSize int64, fileName string, identity *Identity) ([]byte, error)

func EncryptManifestStream

func EncryptManifestStream(source io.Reader, destination io.Writer, root string, size int64, name string, identity *Identity) ([]byte, error)

func SealHistory

func SealHistory(plaintext []byte, publicKeys []string) ([]byte, error)

func SealManifest

func SealManifest(manifest Manifest, publicKeys []string) ([]byte, error)

func SpoolPaths

func SpoolPaths(dedupKey string, namespace ...string) (string, string, error)

Types

type Identity

type Identity struct {
	// contains filtered or unexported fields
}

func LoadIdentity

func LoadIdentity(ownerID, deviceID string) (*Identity, error)

func (*Identity) LocalCertificate

func (i *Identity) LocalCertificate() (tls.Certificate, error)

The device key is the peer's trust anchor. Local connections pin this public key directly, so they do not need a CA, DNS or a synchronized peer clock.

func (*Identity) LocalID

func (i *Identity) LocalID() string

func (*Identity) OpenHistory

func (i *Identity) OpenHistory(ciphertext []byte) ([]byte, error)

func (*Identity) PublicKey

func (i *Identity) PublicKey() string

func (*Identity) Sign

func (i *Identity) Sign(message []byte) string

func (*Identity) SigningPublicKey

func (i *Identity) SigningPublicKey() string

type Manifest

type Manifest struct {
	Suite         string `json:"suite"`
	DataKey       []byte `json:"data_key"`
	PlaintextRoot string `json:"plaintext_root"`
	PlaintextSize int64  `json:"plaintext_size"`
	FileName      string `json:"file_name"`
}

func OpenManifest

func OpenManifest(ciphertext []byte, identity *Identity) (Manifest, error)

Jump to

Keyboard shortcuts

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