Documentation ¶
Overview ¶
Package record provides the state and record of a group session.
Index ¶
- type SenderKey
- func NewSenderKey(serializer SenderKeySerializer, stateSerializer SenderKeyStateSerializer) *SenderKey
- func NewSenderKeyFromBytes(serialized []byte, serializer SenderKeySerializer, ...) (*SenderKey, error)
- func NewSenderKeyFromStruct(structure *SenderKeyStructure, serializer SenderKeySerializer, ...) (*SenderKey, error)
- func (k *SenderKey) AddSenderKeyState(id uint32, iteration uint32, chainKey []byte, signatureKey ecc.ECPublicKeyable)
- func (k *SenderKey) GetSenderKeyStateByID(keyID uint32) (*SenderKeyState, error)
- func (k *SenderKey) IsEmpty() bool
- func (k *SenderKey) SenderKeyState() (*SenderKeyState, error)
- func (k *SenderKey) Serialize() []byte
- func (k *SenderKey) SetSenderKeyState(id uint32, iteration uint32, chainKey []byte, signatureKey *ecc.ECKeyPair)
- type SenderKeySerializer
- type SenderKeyState
- func NewSenderKeyState(keyID uint32, iteration uint32, chainKey []byte, signatureKey *ecc.ECKeyPair, ...) *SenderKeyState
- func NewSenderKeyStateFromBytes(serialized []byte, serializer SenderKeyStateSerializer) (*SenderKeyState, error)
- func NewSenderKeyStateFromPublicKey(keyID uint32, iteration uint32, chainKey []byte, ...) *SenderKeyState
- func NewSenderKeyStateFromStructure(structure *SenderKeyStateStructure, serializer SenderKeyStateSerializer) (*SenderKeyState, error)
- func (k *SenderKeyState) AddSenderMessageKey(senderMsgKey *ratchet.SenderMessageKey)
- func (k *SenderKeyState) HasSenderMessageKey(iteration uint32) bool
- func (k *SenderKeyState) KeyID() uint32
- func (k *SenderKeyState) RemoveSenderMessageKey(iteration uint32) *ratchet.SenderMessageKey
- func (k *SenderKeyState) SenderChainKey() *ratchet.SenderChainKey
- func (k *SenderKeyState) Serialize() []byte
- func (k *SenderKeyState) SetSenderChainKey(senderChainKey *ratchet.SenderChainKey)
- func (k *SenderKeyState) SigningKey() *ecc.ECKeyPair
- type SenderKeyStateSerializer
- type SenderKeyStateStructure
- type SenderKeyStructure
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type SenderKey ¶
type SenderKey struct {
// contains filtered or unexported fields
}
SenderKey record is a structure for storing pre keys inside a SenderKeyStore.
func NewSenderKey ¶
func NewSenderKey(serializer SenderKeySerializer, stateSerializer SenderKeyStateSerializer) *SenderKey
NewSenderKey record returns a new sender key record that can be stored in a SenderKeyStore.
func NewSenderKeyFromBytes ¶
func NewSenderKeyFromBytes(serialized []byte, serializer SenderKeySerializer, stateSerializer SenderKeyStateSerializer) (*SenderKey, error)
NewSenderKeyFromBytes will return a prekey record from the given bytes using the given serializer.
func NewSenderKeyFromStruct ¶
func NewSenderKeyFromStruct(structure *SenderKeyStructure, serializer SenderKeySerializer, stateSerializer SenderKeyStateSerializer) (*SenderKey, error)
NewSenderKeyFromStruct returns a SenderKey record using the given serializable structure.
func (*SenderKey) AddSenderKeyState ¶
func (k *SenderKey) AddSenderKeyState(id uint32, iteration uint32, chainKey []byte, signatureKey ecc.ECPublicKeyable)
AddSenderKeyState will add a new state to this senderkey record with the given id, iteration, chainkey, and signature key.
func (*SenderKey) GetSenderKeyStateByID ¶
func (k *SenderKey) GetSenderKeyStateByID(keyID uint32) (*SenderKeyState, error)
GetSenderKeyStateByID will return the sender key state with the given key id.
func (*SenderKey) IsEmpty ¶
IsEmpty will return false if there is more than one state in this senderkey record.
func (*SenderKey) SenderKeyState ¶
func (k *SenderKey) SenderKeyState() (*SenderKeyState, error)
SenderKeyState will return the first sender key state in the record's list of sender key states.
type SenderKeySerializer ¶
type SenderKeySerializer interface { Serialize(preKey *SenderKeyStructure) []byte Deserialize(serialized []byte) (*SenderKeyStructure, error) }
SenderKeySerializer is an interface for serializing and deserializing SenderKey objects into bytes. An implementation of this interface should be used to encode/decode the object into JSON, Protobuffers, etc.
type SenderKeyState ¶
type SenderKeyState struct {
// contains filtered or unexported fields
}
SenderKeyState is a structure for maintaining a senderkey session state.
func NewSenderKeyState ¶
func NewSenderKeyState(keyID uint32, iteration uint32, chainKey []byte, signatureKey *ecc.ECKeyPair, serializer SenderKeyStateSerializer) *SenderKeyState
NewSenderKeyState returns a new SenderKeyState.
func NewSenderKeyStateFromBytes ¶
func NewSenderKeyStateFromBytes(serialized []byte, serializer SenderKeyStateSerializer) (*SenderKeyState, error)
NewSenderKeyStateFromBytes will return a Signal State from the given bytes using the given serializer.
func NewSenderKeyStateFromPublicKey ¶
func NewSenderKeyStateFromPublicKey(keyID uint32, iteration uint32, chainKey []byte, signatureKey ecc.ECPublicKeyable, serializer SenderKeyStateSerializer) *SenderKeyState
NewSenderKeyStateFromPublicKey returns a new SenderKeyState with the given publicKey.
func NewSenderKeyStateFromStructure ¶
func NewSenderKeyStateFromStructure(structure *SenderKeyStateStructure, serializer SenderKeyStateSerializer) (*SenderKeyState, error)
NewSenderKeyStateFromStructure will return a new session state with the given state structure. This structure is given back from an implementation of the sender key state serializer.
func (*SenderKeyState) AddSenderMessageKey ¶
func (k *SenderKeyState) AddSenderMessageKey(senderMsgKey *ratchet.SenderMessageKey)
AddSenderMessageKey will add the given sender message key to the state.
func (*SenderKeyState) HasSenderMessageKey ¶
func (k *SenderKeyState) HasSenderMessageKey(iteration uint32) bool
HasSenderMessageKey will return true if the state has a key with the given iteration.
func (*SenderKeyState) KeyID ¶
func (k *SenderKeyState) KeyID() uint32
KeyID returns the state's key id.
func (*SenderKeyState) RemoveSenderMessageKey ¶
func (k *SenderKeyState) RemoveSenderMessageKey(iteration uint32) *ratchet.SenderMessageKey
RemoveSenderMessageKey will remove the key in this state with the given iteration number.
func (*SenderKeyState) SenderChainKey ¶
func (k *SenderKeyState) SenderChainKey() *ratchet.SenderChainKey
SenderChainKey returns the sender chain key of the state.
func (*SenderKeyState) Serialize ¶
func (k *SenderKeyState) Serialize() []byte
Serialize will return the state as bytes using the given serializer.
func (*SenderKeyState) SetSenderChainKey ¶
func (k *SenderKeyState) SetSenderChainKey(senderChainKey *ratchet.SenderChainKey)
SetSenderChainKey will set the state's sender chain key with the given key.
func (*SenderKeyState) SigningKey ¶
func (k *SenderKeyState) SigningKey() *ecc.ECKeyPair
SigningKey returns the signing key pair of the sender key state.
type SenderKeyStateSerializer ¶
type SenderKeyStateSerializer interface { Serialize(state *SenderKeyStateStructure) []byte Deserialize(serialized []byte) (*SenderKeyStateStructure, error) }
SenderKeyStateSerializer is an interface for serializing and deserializing a Signal State into bytes. An implementation of this interface should be used to encode/decode the object into JSON, Protobuffers, etc.
type SenderKeyStateStructure ¶
type SenderKeyStateStructure struct { Keys []*ratchet.SenderMessageKeyStructure KeyID uint32 SenderChainKey *ratchet.SenderChainKeyStructure SigningKeyPrivate []byte SigningKeyPublic []byte }
SenderKeyStateStructure is a serializeable structure of SenderKeyState.
type SenderKeyStructure ¶
type SenderKeyStructure struct {
SenderKeyStates []*SenderKeyStateStructure
}
SenderKeyStructure is a structure for serializing SenderKey records.