halite

package module
v0.0.0-...-1a9e666 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2022 License: GPL-3.0 Imports: 11 Imported by: 0

README

Halite

Halite is an annotated container format for sets of Ed25519 and X25519 keys. It has two main types of keys:

  • Private keys, which come with both private and public annotations
  • Public keys, which come with only public annotations

Public keys are often expressed in a Saltpack-like armored format. In this library you can get to those via HalitePublicKey.Armored("").

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EnsureHaliteDirsExist

func EnsureHaliteDirsExist()

Types

type HaliteKey

type HaliteKey interface {
	Save(string) error
	String() string
	Bytes() []byte
	SaveToIndex(string) error
	Public() HalitePublicKey
}

type HalitePrivateKey

type HalitePrivateKey struct {

	// The traditionally-capitalized algorithm name, such as Ed25519 or RSA.
	// EdX25519 is the name of an Ed25519 key stored with a companion X25519 key.
	Algorithm string
	// The white-label brand stored with the key.
	Brand string
	// The annotations attached to the key.
	// These are stored as an embedded document in the msgpack.
	Annotations map[string]any
	// The private annotations attached to the key.
	// These are simply not shared, and I'll probably encrypt them
	// using the encryption key in the future.
	PrivateAnnotations map[string]any
	// The actual data of the private Ed25519 key.
	// It's the private key (32 bytes), followed by the public key (32 bytes).
	PrivateSigningKey []byte
	// The actual data of the private X25519 key.
	// It's the private key (32 bytes), followed by the public key (32 bytes).
	PrivateEncryptionKey []byte
	// contains filtered or unexported fields
}

A base Halite key, as it would be stored.

func LoadAllHalitePrivateKeys

func LoadAllHalitePrivateKeys(query string) ([]HalitePrivateKey, error)

Load a Halite private key by its name. Pass an empty string to get all keys.

func LoadHalitePrivateKey

func LoadHalitePrivateKey(query string) (HalitePrivateKey, error)

Load a Halite private key by its name.

func UnmarshalHalitePrivateKey

func UnmarshalHalitePrivateKey(bytes []byte) (HalitePrivateKey, error)

func (HalitePrivateKey) Bytes

func (key HalitePrivateKey) Bytes() []byte

func (HalitePrivateKey) Public

func (key HalitePrivateKey) Public() HalitePublicKey

func (HalitePrivateKey) Save

func (key HalitePrivateKey) Save(ext string) error

func (HalitePrivateKey) SaveToIndex

func (key HalitePrivateKey) SaveToIndex(hash string) error

func (HalitePrivateKey) String

func (key HalitePrivateKey) String() string

HaliteKey as a string, for development.

type HalitePublicKey

type HalitePublicKey struct {

	// The traditionally-capitalized algorithm name, such as Ed25519 or RSA.
	// EdX25519 is the name of an Ed25519 key stored with a companion X25519 key.
	Algorithm string
	// The white-label brand stored with the key.
	Brand string
	// The annotations attached to the key.
	// These are stored as an embedded document in the msgpack.
	Annotations map[string]any
	// The actual data of the Ed25519 private key.
	// Use this to verify that the holder of the corresponding public key
	// really was the one to sign the data you're looking at.
	// 32 bytes.
	PublicSigningKey []byte
	// The actual data of the X25519 public key.
	// Use this to encrypt data so that only the holder of the corresponding
	// private key can read it.
	// 32 bytes.
	PublicEncryptionKey []byte
	// contains filtered or unexported fields
}

func LoadAllHalitePublicKeys

func LoadAllHalitePublicKeys(query string) ([]HalitePublicKey, error)

Load a Halite public key by its filename. Pass an empty string to get all keys.

func LoadHalitePublicKey

func LoadHalitePublicKey(query string) (HalitePublicKey, error)

Load a Halite public key by its filename.

func UnmarshalHalitePublicKey

func UnmarshalHalitePublicKey(bytes []byte) (HalitePublicKey, error)

func (HalitePublicKey) Armored

func (key HalitePublicKey) Armored(brand string) string

func (HalitePublicKey) Bytes

func (key HalitePublicKey) Bytes() []byte

func (HalitePublicKey) Public

func (key HalitePublicKey) Public() HalitePublicKey

func (HalitePublicKey) Save

func (key HalitePublicKey) Save(ext string) error

func (HalitePublicKey) SaveToIndex

func (key HalitePublicKey) SaveToIndex(hash string) error

func (HalitePublicKey) String

func (key HalitePublicKey) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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