serialize

package
v0.0.0-...-e34fb4d Latest Latest
Warning

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

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

Documentation

Overview

Package serialize provides a serialization structure to serialize and deserialize Signal objects into storeable and transportable bytes.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DeviceConsistencyCodeMessage

type DeviceConsistencyCodeMessage struct {
	Generation           *uint32  `protobuf:"varint,1,opt,name=generation" json:"generation,omitempty"`
	Signature            []byte   `protobuf:"bytes,2,opt,name=signature" json:"signature,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*DeviceConsistencyCodeMessage) Descriptor

func (*DeviceConsistencyCodeMessage) Descriptor() ([]byte, []int)

func (*DeviceConsistencyCodeMessage) GetGeneration

func (m *DeviceConsistencyCodeMessage) GetGeneration() uint32

func (*DeviceConsistencyCodeMessage) GetSignature

func (m *DeviceConsistencyCodeMessage) GetSignature() []byte

func (*DeviceConsistencyCodeMessage) ProtoMessage

func (*DeviceConsistencyCodeMessage) ProtoMessage()

func (*DeviceConsistencyCodeMessage) Reset

func (m *DeviceConsistencyCodeMessage) Reset()

func (*DeviceConsistencyCodeMessage) String

func (*DeviceConsistencyCodeMessage) XXX_DiscardUnknown

func (m *DeviceConsistencyCodeMessage) XXX_DiscardUnknown()

func (*DeviceConsistencyCodeMessage) XXX_Marshal

func (m *DeviceConsistencyCodeMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*DeviceConsistencyCodeMessage) XXX_Merge

func (m *DeviceConsistencyCodeMessage) XXX_Merge(src proto.Message)

func (*DeviceConsistencyCodeMessage) XXX_Size

func (m *DeviceConsistencyCodeMessage) XXX_Size() int

func (*DeviceConsistencyCodeMessage) XXX_Unmarshal

func (m *DeviceConsistencyCodeMessage) XXX_Unmarshal(b []byte) error

type JSONPreKeyRecordSerializer

type JSONPreKeyRecordSerializer struct{}

JSONPreKeyRecordSerializer is a structure for serializing prekey records into and from JSON.

func (*JSONPreKeyRecordSerializer) Deserialize

func (j *JSONPreKeyRecordSerializer) Deserialize(serialized []byte) (*record.PreKeyStructure, error)

Deserialize will take in JSON bytes and return a prekey record structure.

func (*JSONPreKeyRecordSerializer) Serialize

func (j *JSONPreKeyRecordSerializer) Serialize(preKey *record.PreKeyStructure) []byte

Serialize will take a prekey record structure and convert it to JSON bytes.

type JSONPreKeySignalMessageSerializer

type JSONPreKeySignalMessageSerializer struct{}

JSONPreKeySignalMessageSerializer is a structure for serializing prekey signal messages into and from JSON.

func (*JSONPreKeySignalMessageSerializer) Deserialize

Deserialize will take in JSON bytes and return a prekey signal message structure.

func (*JSONPreKeySignalMessageSerializer) Serialize

Serialize will take a prekey signal message structure and convert it to JSON bytes.

type JSONSenderKeyDistributionMessageSerializer

type JSONSenderKeyDistributionMessageSerializer struct{}

JSONSenderKeyDistributionMessageSerializer is a structure for serializing senderkey distribution records to and from JSON.

func (*JSONSenderKeyDistributionMessageSerializer) Deserialize

Deserialize will take in JSON bytes and return a message structure, which can be used to create a new SenderKey Distribution object.

func (*JSONSenderKeyDistributionMessageSerializer) Serialize

Serialize will take a senderkey distribution message and convert it to JSON bytes.

type JSONSenderKeyMessageSerializer

type JSONSenderKeyMessageSerializer struct{}

JSONSenderKeyMessageSerializer is a structure for serializing senderkey messages to and from JSON.

func (*JSONSenderKeyMessageSerializer) Deserialize

Deserialize will take in JSON bytes and return a message structure, which can be used to create a new SenderKey message object.

func (*JSONSenderKeyMessageSerializer) Serialize

Serialize will take a senderkey message and convert it to JSON bytes.

type JSONSenderKeySessionSerializer

type JSONSenderKeySessionSerializer struct{}

JSONSenderKeySessionSerializer is a structure for serializing session records into and from JSON.

func (*JSONSenderKeySessionSerializer) Deserialize

func (j *JSONSenderKeySessionSerializer) Deserialize(serialized []byte) (*groupRecord.SenderKeyStructure, error)

Deserialize will take in JSON bytes and return a session structure, which can be used to create a new Session Record object.

func (*JSONSenderKeySessionSerializer) Serialize

Serialize will take a session structure and convert it to JSON bytes.

type JSONSenderKeyStateSerializer

type JSONSenderKeyStateSerializer struct{}

JSONSenderKeyStateSerializer is a structure for serializing group session states into and from JSON.

func (*JSONSenderKeyStateSerializer) Deserialize

Deserialize will take in JSON bytes and return a session state structure.

func (*JSONSenderKeyStateSerializer) Serialize

Serialize will take a session state structure and convert it to JSON bytes.

type JSONSessionSerializer

type JSONSessionSerializer struct{}

JSONSessionSerializer is a structure for serializing session records into and from JSON.

func (*JSONSessionSerializer) Deserialize

func (j *JSONSessionSerializer) Deserialize(serialized []byte) (*record.SessionStructure, error)

Deserialize will take in JSON bytes and return a session structure, which can be used to create a new Session Record object.

func (*JSONSessionSerializer) Serialize

func (j *JSONSessionSerializer) Serialize(session *record.SessionStructure) []byte

Serialize will take a session structure and convert it to JSON bytes.

type JSONSignalMessageSerializer

type JSONSignalMessageSerializer struct{}

JSONSignalMessageSerializer is a structure for serializing signal messages into and from JSON.

func (*JSONSignalMessageSerializer) Deserialize

func (j *JSONSignalMessageSerializer) Deserialize(serialized []byte) (*protocol.SignalMessageStructure, error)

Deserialize will take in JSON bytes and return a signal message structure.

func (*JSONSignalMessageSerializer) Serialize

func (j *JSONSignalMessageSerializer) Serialize(signalMessage *protocol.SignalMessageStructure) []byte

Serialize will take a signal message structure and convert it to JSON bytes.

type JSONSignedPreKeyRecordSerializer

type JSONSignedPreKeyRecordSerializer struct{}

JSONSignedPreKeyRecordSerializer is a structure for serializing signed prekey records into and from JSON.

func (*JSONSignedPreKeyRecordSerializer) Deserialize

func (j *JSONSignedPreKeyRecordSerializer) Deserialize(serialized []byte) (*record.SignedPreKeyStructure, error)

Deserialize will take in JSON bytes and return a signed prekey record structure.

func (*JSONSignedPreKeyRecordSerializer) Serialize

func (j *JSONSignedPreKeyRecordSerializer) Serialize(signedPreKey *record.SignedPreKeyStructure) []byte

Serialize will take a signed prekey record structure and convert it to JSON bytes.

type JSONStateSerializer

type JSONStateSerializer struct{}

JSONStateSerializer is a structure for serializing session states into and from JSON.

func (*JSONStateSerializer) Deserialize

func (j *JSONStateSerializer) Deserialize(serialized []byte) (*record.StateStructure, error)

Deserialize will take in JSON bytes and return a session state structure.

func (*JSONStateSerializer) Serialize

func (j *JSONStateSerializer) Serialize(state *record.StateStructure) []byte

Serialize will take a session state structure and convert it to JSON bytes.

type KeyExchangeMessage

type KeyExchangeMessage struct {
	Id                   *uint32  `protobuf:"varint,1,opt,name=id" json:"id,omitempty"`
	BaseKey              []byte   `protobuf:"bytes,2,opt,name=baseKey" json:"baseKey,omitempty"`
	RatchetKey           []byte   `protobuf:"bytes,3,opt,name=ratchetKey" json:"ratchetKey,omitempty"`
	IdentityKey          []byte   `protobuf:"bytes,4,opt,name=identityKey" json:"identityKey,omitempty"`
	BaseKeySignature     []byte   `protobuf:"bytes,5,opt,name=baseKeySignature" json:"baseKeySignature,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*KeyExchangeMessage) Descriptor

func (*KeyExchangeMessage) Descriptor() ([]byte, []int)

func (*KeyExchangeMessage) GetBaseKey

func (m *KeyExchangeMessage) GetBaseKey() []byte

func (*KeyExchangeMessage) GetBaseKeySignature

func (m *KeyExchangeMessage) GetBaseKeySignature() []byte

func (*KeyExchangeMessage) GetId

func (m *KeyExchangeMessage) GetId() uint32

func (*KeyExchangeMessage) GetIdentityKey

func (m *KeyExchangeMessage) GetIdentityKey() []byte

func (*KeyExchangeMessage) GetRatchetKey

func (m *KeyExchangeMessage) GetRatchetKey() []byte

func (*KeyExchangeMessage) ProtoMessage

func (*KeyExchangeMessage) ProtoMessage()

func (*KeyExchangeMessage) Reset

func (m *KeyExchangeMessage) Reset()

func (*KeyExchangeMessage) String

func (m *KeyExchangeMessage) String() string

func (*KeyExchangeMessage) XXX_DiscardUnknown

func (m *KeyExchangeMessage) XXX_DiscardUnknown()

func (*KeyExchangeMessage) XXX_Marshal

func (m *KeyExchangeMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*KeyExchangeMessage) XXX_Merge

func (m *KeyExchangeMessage) XXX_Merge(src proto.Message)

func (*KeyExchangeMessage) XXX_Size

func (m *KeyExchangeMessage) XXX_Size() int

func (*KeyExchangeMessage) XXX_Unmarshal

func (m *KeyExchangeMessage) XXX_Unmarshal(b []byte) error

type PreKeySignalMessage

type PreKeySignalMessage struct {
	RegistrationId       *uint32  `protobuf:"varint,5,opt,name=registrationId" json:"registrationId,omitempty"`
	PreKeyId             *uint32  `protobuf:"varint,1,opt,name=preKeyId" json:"preKeyId,omitempty"`
	SignedPreKeyId       *uint32  `protobuf:"varint,6,opt,name=signedPreKeyId" json:"signedPreKeyId,omitempty"`
	BaseKey              []byte   `protobuf:"bytes,2,opt,name=baseKey" json:"baseKey,omitempty"`
	IdentityKey          []byte   `protobuf:"bytes,3,opt,name=identityKey" json:"identityKey,omitempty"`
	Message              []byte   `protobuf:"bytes,4,opt,name=message" json:"message,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*PreKeySignalMessage) Descriptor

func (*PreKeySignalMessage) Descriptor() ([]byte, []int)

func (*PreKeySignalMessage) GetBaseKey

func (m *PreKeySignalMessage) GetBaseKey() []byte

func (*PreKeySignalMessage) GetIdentityKey

func (m *PreKeySignalMessage) GetIdentityKey() []byte

func (*PreKeySignalMessage) GetMessage

func (m *PreKeySignalMessage) GetMessage() []byte

func (*PreKeySignalMessage) GetPreKeyId

func (m *PreKeySignalMessage) GetPreKeyId() uint32

func (*PreKeySignalMessage) GetRegistrationId

func (m *PreKeySignalMessage) GetRegistrationId() uint32

func (*PreKeySignalMessage) GetSignedPreKeyId

func (m *PreKeySignalMessage) GetSignedPreKeyId() uint32

func (*PreKeySignalMessage) ProtoMessage

func (*PreKeySignalMessage) ProtoMessage()

func (*PreKeySignalMessage) Reset

func (m *PreKeySignalMessage) Reset()

func (*PreKeySignalMessage) String

func (m *PreKeySignalMessage) String() string

func (*PreKeySignalMessage) XXX_DiscardUnknown

func (m *PreKeySignalMessage) XXX_DiscardUnknown()

func (*PreKeySignalMessage) XXX_Marshal

func (m *PreKeySignalMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*PreKeySignalMessage) XXX_Merge

func (m *PreKeySignalMessage) XXX_Merge(src proto.Message)

func (*PreKeySignalMessage) XXX_Size

func (m *PreKeySignalMessage) XXX_Size() int

func (*PreKeySignalMessage) XXX_Unmarshal

func (m *PreKeySignalMessage) XXX_Unmarshal(b []byte) error

type ProtoBufPreKeySignalMessageSerializer

type ProtoBufPreKeySignalMessageSerializer struct{}

ProtoBufPreKeySignalMessageSerializer is a structure for serializing prekey signal messages into and from ProtoBuf.

func (*ProtoBufPreKeySignalMessageSerializer) Deserialize

Deserialize will take in ProtoBuf bytes and return a prekey signal message structure.

func (*ProtoBufPreKeySignalMessageSerializer) Serialize

Serialize will take a prekey signal message structure and convert it to ProtoBuf bytes.

type ProtoBufSenderKeyDistributionMessageSerializer

type ProtoBufSenderKeyDistributionMessageSerializer struct{}

ProtoBufSenderKeyDistributionMessageSerializer is a structure for serializing senderkey distribution records to and from ProtoBuf.

func (*ProtoBufSenderKeyDistributionMessageSerializer) Deserialize

Deserialize will take in ProtoBuf bytes and return a message structure, which can be used to create a new SenderKey Distribution object.

func (*ProtoBufSenderKeyDistributionMessageSerializer) Serialize

Serialize will take a senderkey distribution message and convert it to ProtoBuf bytes.

type ProtoBufSenderKeyMessageSerializer

type ProtoBufSenderKeyMessageSerializer struct{}

ProtoBufSenderKeyMessageSerializer is a structure for serializing senderkey messages to and from ProtoBuf.

func (*ProtoBufSenderKeyMessageSerializer) Deserialize

Deserialize will take in ProtoBuf bytes and return a message structure, which can be used to create a new SenderKey message object.

func (*ProtoBufSenderKeyMessageSerializer) Serialize

Serialize will take a senderkey message and convert it to ProtoBuf bytes.

type ProtoBufSignalMessageSerializer

type ProtoBufSignalMessageSerializer struct{}

ProtoBufSignalMessageSerializer is a structure for serializing signal messages into and from ProtoBuf.

func (*ProtoBufSignalMessageSerializer) Deserialize

Deserialize will take in ProtoBuf bytes and return a signal message structure.

func (*ProtoBufSignalMessageSerializer) Serialize

Serialize will take a signal message structure and convert it to ProtoBuf bytes.

type SenderKeyDistributionMessage

type SenderKeyDistributionMessage struct {
	Id                   *uint32  `protobuf:"varint,1,opt,name=id" json:"id,omitempty"`
	Iteration            *uint32  `protobuf:"varint,2,opt,name=iteration" json:"iteration,omitempty"`
	ChainKey             []byte   `protobuf:"bytes,3,opt,name=chainKey" json:"chainKey,omitempty"`
	SigningKey           []byte   `protobuf:"bytes,4,opt,name=signingKey" json:"signingKey,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*SenderKeyDistributionMessage) Descriptor

func (*SenderKeyDistributionMessage) Descriptor() ([]byte, []int)

func (*SenderKeyDistributionMessage) GetChainKey

func (m *SenderKeyDistributionMessage) GetChainKey() []byte

func (*SenderKeyDistributionMessage) GetId

func (*SenderKeyDistributionMessage) GetIteration

func (m *SenderKeyDistributionMessage) GetIteration() uint32

func (*SenderKeyDistributionMessage) GetSigningKey

func (m *SenderKeyDistributionMessage) GetSigningKey() []byte

func (*SenderKeyDistributionMessage) ProtoMessage

func (*SenderKeyDistributionMessage) ProtoMessage()

func (*SenderKeyDistributionMessage) Reset

func (m *SenderKeyDistributionMessage) Reset()

func (*SenderKeyDistributionMessage) String

func (*SenderKeyDistributionMessage) XXX_DiscardUnknown

func (m *SenderKeyDistributionMessage) XXX_DiscardUnknown()

func (*SenderKeyDistributionMessage) XXX_Marshal

func (m *SenderKeyDistributionMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*SenderKeyDistributionMessage) XXX_Merge

func (m *SenderKeyDistributionMessage) XXX_Merge(src proto.Message)

func (*SenderKeyDistributionMessage) XXX_Size

func (m *SenderKeyDistributionMessage) XXX_Size() int

func (*SenderKeyDistributionMessage) XXX_Unmarshal

func (m *SenderKeyDistributionMessage) XXX_Unmarshal(b []byte) error

type SenderKeyMessage

type SenderKeyMessage struct {
	Id                   *uint32  `protobuf:"varint,1,opt,name=id" json:"id,omitempty"`
	Iteration            *uint32  `protobuf:"varint,2,opt,name=iteration" json:"iteration,omitempty"`
	Ciphertext           []byte   `protobuf:"bytes,3,opt,name=ciphertext" json:"ciphertext,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*SenderKeyMessage) Descriptor

func (*SenderKeyMessage) Descriptor() ([]byte, []int)

func (*SenderKeyMessage) GetCiphertext

func (m *SenderKeyMessage) GetCiphertext() []byte

func (*SenderKeyMessage) GetId

func (m *SenderKeyMessage) GetId() uint32

func (*SenderKeyMessage) GetIteration

func (m *SenderKeyMessage) GetIteration() uint32

func (*SenderKeyMessage) ProtoMessage

func (*SenderKeyMessage) ProtoMessage()

func (*SenderKeyMessage) Reset

func (m *SenderKeyMessage) Reset()

func (*SenderKeyMessage) String

func (m *SenderKeyMessage) String() string

func (*SenderKeyMessage) XXX_DiscardUnknown

func (m *SenderKeyMessage) XXX_DiscardUnknown()

func (*SenderKeyMessage) XXX_Marshal

func (m *SenderKeyMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*SenderKeyMessage) XXX_Merge

func (m *SenderKeyMessage) XXX_Merge(src proto.Message)

func (*SenderKeyMessage) XXX_Size

func (m *SenderKeyMessage) XXX_Size() int

func (*SenderKeyMessage) XXX_Unmarshal

func (m *SenderKeyMessage) XXX_Unmarshal(b []byte) error

type Serializer

type Serializer struct {
	SenderKeyRecord              groupRecord.SenderKeySerializer
	SenderKeyState               groupRecord.SenderKeyStateSerializer
	SignalMessage                protocol.SignalMessageSerializer
	PreKeySignalMessage          protocol.PreKeySignalMessageSerializer
	SenderKeyMessage             protocol.SenderKeyMessageSerializer
	SenderKeyDistributionMessage protocol.SenderKeyDistributionMessageSerializer
	SignedPreKeyRecord           record.SignedPreKeySerializer
	PreKeyRecord                 record.PreKeySerializer
	State                        record.StateSerializer
	Session                      record.SessionSerializer
}

Serializer is a structure to serialize Signal objects into bytes. This allows you to use any serialization format to store or send Signal objects.

func NewJSONSerializer

func NewJSONSerializer() *Serializer

NewJSONSerializer will return a serializer for all Signal objects that will be responsible for converting objects to and from JSON bytes.

func NewProtoBufSerializer

func NewProtoBufSerializer() *Serializer

NewProtoBufSerializer will return a serializer for all Signal objects that will be responsible for converting objects to and from ProtoBuf bytes.

func NewSerializer

func NewSerializer() *Serializer

NewSerializer will return a new serializer object that will be used to encode/decode Signal objects into bytes.

type SignalMessage

type SignalMessage struct {
	RatchetKey           []byte   `protobuf:"bytes,1,opt,name=ratchetKey" json:"ratchetKey,omitempty"`
	Counter              *uint32  `protobuf:"varint,2,opt,name=counter" json:"counter,omitempty"`
	PreviousCounter      *uint32  `protobuf:"varint,3,opt,name=previousCounter" json:"previousCounter,omitempty"`
	Ciphertext           []byte   `protobuf:"bytes,4,opt,name=ciphertext" json:"ciphertext,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*SignalMessage) Descriptor

func (*SignalMessage) Descriptor() ([]byte, []int)

func (*SignalMessage) GetCiphertext

func (m *SignalMessage) GetCiphertext() []byte

func (*SignalMessage) GetCounter

func (m *SignalMessage) GetCounter() uint32

func (*SignalMessage) GetPreviousCounter

func (m *SignalMessage) GetPreviousCounter() uint32

func (*SignalMessage) GetRatchetKey

func (m *SignalMessage) GetRatchetKey() []byte

func (*SignalMessage) ProtoMessage

func (*SignalMessage) ProtoMessage()

func (*SignalMessage) Reset

func (m *SignalMessage) Reset()

func (*SignalMessage) String

func (m *SignalMessage) String() string

func (*SignalMessage) XXX_DiscardUnknown

func (m *SignalMessage) XXX_DiscardUnknown()

func (*SignalMessage) XXX_Marshal

func (m *SignalMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*SignalMessage) XXX_Merge

func (m *SignalMessage) XXX_Merge(src proto.Message)

func (*SignalMessage) XXX_Size

func (m *SignalMessage) XXX_Size() int

func (*SignalMessage) XXX_Unmarshal

func (m *SignalMessage) XXX_Unmarshal(b []byte) error

Jump to

Keyboard shortcuts

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