layer

package
v0.1.9 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2023 License: Unlicense Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MagicString = "os"
	Len         = magicbytes.Len + nonce.IVLen + cloak.Len + pub.KeyLen
)

Variables

View Source
var (
	Magic = slice.Bytes(MagicString)
)

Functions

This section is empty.

Types

type OnionSkin

type OnionSkin struct {
	To   *pub.Key
	From *prv.Key
	// The remainder here are for Decode.
	Nonce   nonce.IV
	Cloak   cloak.PubKey
	ToPriv  *prv.Key
	FromPub *pub.Key
	// The following field is only populated in the outermost layer, and
	// passed in the `b slice.Bytes` parameter in both encode and decode,
	// this is created after first getting the Len of everything and
	// pre-allocating.
	slice.Bytes
	types.Onion
}

OnionSkin message is the generic top level wrapper for an OnionSkin. All following messages are wrapped inside this. This type provides the encryption for each layer, and a header which a relay uses to determine what cipher to use. Everything in a message after this message is encrypted as specified.

func (*OnionSkin) Decode

func (x *OnionSkin) Decode(b slice.Bytes, c *slice.Cursor) (e error)

func (*OnionSkin) Decrypt

func (x *OnionSkin) Decrypt(prk *prv.Key, b slice.Bytes, c *slice.Cursor)

Decrypt requires the prv.Key to be located from the Cloak, using the FromPub key to derive the shared secret, and then decrypts the rest of the message.

func (*OnionSkin) Encode

func (x *OnionSkin) Encode(b slice.Bytes, c *slice.Cursor)

func (*OnionSkin) Inner

func (x *OnionSkin) Inner() types.Onion

func (*OnionSkin) Insert

func (x *OnionSkin) Insert(o types.Onion)

func (*OnionSkin) Len

func (x *OnionSkin) Len() int

func (*OnionSkin) String

func (x *OnionSkin) String() string

Jump to

Keyboard shortcuts

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