package chain
import "go.mau.fi/libsignal/keys/chain"
Package chain provides chain keys used in double ratchet sessions.
Index ¶
- type Key
- func NewKey(kdf kdf.HKDF, key []byte, index uint32) *Key
- func NewKeyFromStruct(structure *KeyStructure, kdf kdf.HKDF) *Key
- func (c *Key) BaseMaterial(seed []byte) []byte
- func (c *Key) Current() *Key
- func (c *Key) Index() uint32
- func (c *Key) Key() []byte
- func (c *Key) MessageKeys() *message.Keys
- func (c *Key) NextKey() *Key
- func (c *Key) SetIndex(index uint32)
- func (c *Key) SetKey(key []byte)
- type KeyStructure
Types ¶
type Key ¶
type Key struct {
// contains filtered or unexported fields
}
Key is used for generating message keys. This key "ratchets" every time a message key is generated. Every time the chain key ratchets forward, its index increases by one.
func NewKey ¶
NewKey returns a new chain key with the given kdf, key, and index
func NewKeyFromStruct ¶
func NewKeyFromStruct(structure *KeyStructure, kdf kdf.HKDF) *Key
NewKeyFromStruct will return a chain key built from the given structure.
func (*Key) BaseMaterial ¶
BaseMaterial uses hmac to derive the base material used in the key derivation function for a new key.
func (*Key) Current ¶
Current returns the current ChainKey struct.
func (*Key) Index ¶
Index returns how many times the ChainKey has been "ratcheted" forward.
func (*Key) Key ¶
Key returns the ChainKey's key material.
func (*Key) MessageKeys ¶
MessageKeys returns message keys, which includes the cipherkey, mac, iv, and index.
func (*Key) NextKey ¶
NextKey uses the key derivation function to generate a new ChainKey.
func (*Key) SetIndex ¶
SetIndex sets how many times the ChainKey has been "ratcheted" forward.
func (*Key) SetKey ¶
SetKey will set the ChainKey's key material.
type KeyStructure ¶
KeyStructure is a serializeable structure for chain keys.
func NewStructFromKey ¶
func NewStructFromKey(key *Key) *KeyStructure
NewStructFromKey will return a chain key structure for serialization.
Source Files ¶
ChainKey.go
- Version
- v0.1.2 (latest)
- Published
- Feb 12, 2025
- Platform
- linux/amd64
- Imports
- 4 packages
- Last checked
- 1 week ago –
Tools for package owners.