Documentation ¶
Overview ¶
Package message defines protocol messages.
Index ¶
- Constants
- type Ciphertext
- type CiphertextType
- type Plaintext
- type PreKey
- func (p *PreKey) BaseKey() curve.PublicKey
- func (p *PreKey) Bytes() []byte
- func (p *PreKey) IdentityKey() identity.Key
- func (p *PreKey) Message() *Signal
- func (p *PreKey) PreKeyID() *prekey.ID
- func (p *PreKey) RegistrationID() uint32
- func (p *PreKey) SignedPreKeyID() prekey.ID
- func (*PreKey) Type() CiphertextType
- func (p *PreKey) Version() uint8
- type PreKeyConfig
- type SenderKey
- func (s *SenderKey) Bytes() []byte
- func (s *SenderKey) ChainID() uint32
- func (s *SenderKey) DistributionID() distribution.ID
- func (s *SenderKey) Iteration() uint32
- func (s *SenderKey) Message() []byte
- func (*SenderKey) Type() CiphertextType
- func (s *SenderKey) VerifySignature(signatureKey curve.PublicKey) (bool, error)
- func (s *SenderKey) Version() uint8
- type SenderKeyConfig
- type SenderKeyDistConfig
- type SenderKeyDistribution
- func (s *SenderKeyDistribution) Bytes() []byte
- func (s *SenderKeyDistribution) ChainID() uint32
- func (s *SenderKeyDistribution) ChainKey() []byte
- func (s *SenderKeyDistribution) DistributionID() distribution.ID
- func (s *SenderKeyDistribution) Iteration() uint32
- func (s *SenderKeyDistribution) SigningKey() curve.PublicKey
- func (s *SenderKeyDistribution) Version() uint8
- type Signal
- func (s *Signal) Bytes() []byte
- func (s *Signal) Counter() uint32
- func (s *Signal) Message() []byte
- func (s *Signal) SenderRatchetKey() curve.PublicKey
- func (*Signal) Type() CiphertextType
- func (s *Signal) VerifyMAC(macKey []byte, senderIdentityKey, receiverIdentityKey identity.Key) (bool, error)
- func (s *Signal) Version() uint8
- type SignalConfig
Constants ¶
const ( // CiphertextVersion is the current version of ciphertext messages. CiphertextVersion = 3 // SenderKeyVersion is the current version of sender-key messages. SenderKeyVersion = 3 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Ciphertext ¶
type Ciphertext interface { // Type is the CiphertextType of the message. Type() CiphertextType // Bytes returns an encoding of the Ciphertext message. Bytes() []byte }
Ciphertext defines a ciphertext message.
func NewPreKey ¶
func NewPreKey(cfg PreKeyConfig) (Ciphertext, error)
func NewPreKeyFromBytes ¶
func NewPreKeyFromBytes(bytes []byte) (Ciphertext, error)
func NewSignal ¶
func NewSignal(cfg SignalConfig) (Ciphertext, error)
func NewSignalFromBytes ¶
func NewSignalFromBytes(bytes []byte) (Ciphertext, error)
type CiphertextType ¶
type CiphertextType int
CiphertextType represents a protocol message type.
const ( WhisperType CiphertextType = 2 PreKeyType CiphertextType = 3 SenderKeyType CiphertextType = 7 PlaintextType CiphertextType = 8 )
func (CiphertextType) String ¶
func (i CiphertextType) String() string
type Plaintext ¶
type Plaintext struct {
// contains filtered or unexported fields
}
Plaintext represents a plaintext message.
func NewPlaintextFromBytes ¶
func (*Plaintext) Type ¶
func (*Plaintext) Type() CiphertextType
type PreKey ¶
type PreKey struct {
// contains filtered or unexported fields
}
PreKey represents a pre-key message.
func (*PreKey) IdentityKey ¶
func (*PreKey) RegistrationID ¶
func (*PreKey) SignedPreKeyID ¶
func (*PreKey) Type ¶
func (*PreKey) Type() CiphertextType
type PreKeyConfig ¶
type PreKeyConfig struct { Version uint8 RegistrationID uint32 PreKeyID *prekey.ID SignedPreKeyID prekey.ID BaseKey curve.PublicKey IdentityKey identity.Key Message *Signal }
PreKeyConfig represents the configuration for a PreKey message.
type SenderKey ¶
type SenderKey struct {
// contains filtered or unexported fields
}
SenderKey represents a sender key message for group messaging.
func NewSenderKey ¶
func NewSenderKey(random io.Reader, cfg SenderKeyConfig) (*SenderKey, error)
func NewSenderKeyFromBytes ¶
func (*SenderKey) DistributionID ¶
func (s *SenderKey) DistributionID() distribution.ID
func (*SenderKey) Type ¶
func (*SenderKey) Type() CiphertextType
func (*SenderKey) VerifySignature ¶
VerifySignature verifies the signature is a valid signature of the messages by the public key.
type SenderKeyConfig ¶
type SenderKeyConfig struct { Version uint8 DistID distribution.ID ChainID uint32 Iteration uint32 Ciphertext []byte SignatureKey curve.PrivateKey }
SenderKeyConfig represents the configuration for a SenderKey message.
type SenderKeyDistConfig ¶
type SenderKeyDistConfig struct { Version uint8 DistID distribution.ID ChainID uint32 Iteration uint32 ChainKey []byte SigningKey curve.PublicKey }
SenderKeyDistConfig represents the configuration for a SenderKeyDistribution message.
type SenderKeyDistribution ¶
type SenderKeyDistribution struct {
// contains filtered or unexported fields
}
SenderKeyDistribution represents a sender key distribution message for group messaging.
func NewSenderKeyDistribution ¶
func NewSenderKeyDistribution(cfg SenderKeyDistConfig) (*SenderKeyDistribution, error)
func NewSenderKeyDistributionFromBytes ¶
func NewSenderKeyDistributionFromBytes(bytes []byte) (*SenderKeyDistribution, error)
func (*SenderKeyDistribution) Bytes ¶
func (s *SenderKeyDistribution) Bytes() []byte
func (*SenderKeyDistribution) ChainID ¶
func (s *SenderKeyDistribution) ChainID() uint32
func (*SenderKeyDistribution) ChainKey ¶
func (s *SenderKeyDistribution) ChainKey() []byte
func (*SenderKeyDistribution) DistributionID ¶
func (s *SenderKeyDistribution) DistributionID() distribution.ID
func (*SenderKeyDistribution) Iteration ¶
func (s *SenderKeyDistribution) Iteration() uint32
func (*SenderKeyDistribution) SigningKey ¶
func (s *SenderKeyDistribution) SigningKey() curve.PublicKey
func (*SenderKeyDistribution) Version ¶
func (s *SenderKeyDistribution) Version() uint8
type Signal ¶
type Signal struct {
// contains filtered or unexported fields
}
Signal represents a typical ciphertext message.
func (*Signal) SenderRatchetKey ¶
func (*Signal) Type ¶
func (*Signal) Type() CiphertextType