serialize

package
v0.0.0-...-fb2b840 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2024 License: GPL-3.0 Imports: 5 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 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 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 NewSerializer

func NewSerializer() *Serializer

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

Jump to

Keyboard shortcuts

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