Documentation ¶
Overview ¶
Package ratchet implements the axolotl ratchet, by Trevor Perrin. See https://github.com/trevp/axolotl/wiki.
Index ¶
- type Ratchet
- func (r *Ratchet) CompleteKeyExchange(kx *pond.KeyExchange, isV2 bool) error
- func (r *Ratchet) Decrypt(ciphertext []byte) ([]byte, error)
- func (r *Ratchet) Encrypt(out, msg []byte) []byte
- func (r *Ratchet) FillKeyExchange(kx *pond.KeyExchange) error
- func (r *Ratchet) GetKXPrivateForTransition() [32]byte
- func (r *Ratchet) Marshal(now time.Time, lifetime time.Duration) *disk.RatchetState
- func (r *Ratchet) Unmarshal(s *disk.RatchetState) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Ratchet ¶
type Ratchet struct {
// MyIdentityPrivate and TheirIdentityPublic contain the primary,
// curve25519 identity keys. These are pointers because the canonical
// copies live in the client and Contact structs.
MyIdentityPrivate, TheirIdentityPublic *[32]byte
// MySigningPublic and TheirSigningPublic are Ed25519 keys. Again,
// these are pointers because the canonical versions are kept
// elsewhere.
MySigningPublic, TheirSigningPublic *[32]byte
// Now is an optional function that will be used to get the current
// time. If nil, time.Now is used.
Now func() time.Time
// contains filtered or unexported fields
}
Ratchet contains the per-contact, crypto state.
func (*Ratchet) CompleteKeyExchange ¶
func (r *Ratchet) CompleteKeyExchange(kx *pond.KeyExchange, isV2 bool) error
CompleteKeyExchange takes a KeyExchange message from the other party and establishes the ratchet.
func (*Ratchet) Encrypt ¶
Encrypt acts like append() but appends an encrypted version of msg to out.
func (*Ratchet) FillKeyExchange ¶
func (r *Ratchet) FillKeyExchange(kx *pond.KeyExchange) error
FillKeyExchange sets elements of kx with key exchange information from the ratchet.
func (*Ratchet) GetKXPrivateForTransition ¶
GetKXPrivateForTransition returns the DH private key used in the key exchange. This exists in order to support the transition to the new ratchet format.
Click to show internal directories.
Click to hide internal directories.