session

package
v0.0.0-...-d09bcab Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2017 License: GPL-3.0 Imports: 3 Imported by: 12

Documentation

Overview

Package session provides a simple structure for session keys, which is a pair of root and chain keys for a session.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChainKeyable

type ChainKeyable interface {
	Key() []byte
	Index() uint32
	NextKey() *chain.Key
	MessageKeys() *message.Keys
	Current() *chain.Key
}

ChainKeyable is an interface for all chain key implementations that are part of a session keypair.

type DerivedSecrets

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

DerivedSecrets is a structure for holding the derived secrets for the Root and Chain keys for a session.

func NewDerivedSecrets

func NewDerivedSecrets(keyMaterial []byte) *DerivedSecrets

NewDerivedSecrets returns a new RootKey/ChainKey pair from 64 bytes of key material generated by the key derivation function.

func (*DerivedSecrets) ChainKey

func (d *DerivedSecrets) ChainKey() []byte

ChainKey returns the ChainKey bytes.

func (*DerivedSecrets) RootKey

func (d *DerivedSecrets) RootKey() []byte

RootKey returns the RootKey bytes.

type KeyPair

type KeyPair struct {
	RootKey  RootKeyable
	ChainKey ChainKeyable
}

KeyPair is a session key pair that holds a single root and chain key pair. These keys are ratcheted after every message sent and every message round trip.

func NewKeyPair

func NewKeyPair(rootKey RootKeyable, chainKey ChainKeyable) *KeyPair

NewKeyPair returns a new session key pair that holds a root and chain key.

type RootKeyable

type RootKeyable interface {
	Bytes() []byte
	CreateChain(theirRatchetKey ecc.ECPublicKeyable, ourRatchetKey *ecc.ECKeyPair) (*KeyPair, error)
}

RootKeyable is an interface for all root key implementations that are part of a session keypair.

Jump to

Keyboard shortcuts

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