store

package
v0.0.0-...-d09bcab Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2017 License: GPL-3.0 Imports: 5 Imported by: 4

Documentation

Overview

Package store provides the storage interfaces for storing the state of ongoing double ratchet sessions and keys.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IdentityKey

type IdentityKey interface {
	// Get the local client's identity key pair.
	GetIdentityKeyPair() *identity.KeyPair

	// Return the local client's registration ID.
	//
	// Clients should maintain a registration ID, a random number between 1 and 16380
	// that's generated once at install time.
	GetLocalRegistrationId() uint32

	// Save a remote client's identity key in our identity store.
	SaveIdentity(address *protocol.SignalAddress, identityKey *identity.Key)

	// Verify a remote client's identity key.
	//
	// Determine whether a remote client's identity is trusted. Trust is based on
	// 'trust on first use'. This means that an identity key is considered 'trusted'
	// if there is no entry for the recipient in the local store, or if it matches the
	// saved key for a recipient in the local store.
	IsTrustedIdentity(address *protocol.SignalAddress, identityKey *identity.Key) bool
}

IdentityKey provides an interface to identity information.

type MessageKey

type MessageKey interface {
	// Load a local message key by id
	LoadMessageKey(keyID uint32) *message.Keys

	// Store a local message key
	StoreMessageKey(keyID uint32, key *message.Keys)

	// Check to see if the store contains a message key with id.
	ContainsMessageKey(keyID uint32) bool

	// Delete a message key from local storage.
	RemoveMessageKey(keyID uint32)
}

MessageKey store is an interface describing the optional local storage of message keys.

type PreKey

type PreKey interface {
	// Load a local PreKeyRecord
	LoadPreKey(preKeyID uint32) *record.PreKey

	// Store a local PreKeyRecord
	StorePreKey(preKeyID uint32, preKeyRecord *record.PreKey)

	// Check to see if the store contains a PreKeyRecord
	ContainsPreKey(preKeyID uint32) bool

	// Delete a PreKeyRecord from local storage.
	RemovePreKey(preKeyID uint32)
}

PreKey store is an interface describing the local storage of PreKeyRecords

type Session

type Session interface {
	LoadSession(address *protocol.SignalAddress) *record.Session
	GetSubDeviceSessions(name string) []uint32
	StoreSession(remoteAddress *protocol.SignalAddress, record *record.Session)
	ContainsSession(remoteAddress *protocol.SignalAddress) bool
	DeleteSession(remoteAddress *protocol.SignalAddress)
	DeleteAllSessions()
}

Session store is an interface for the persistent storage of session state information for remote clients.

type SignalProtocol

type SignalProtocol interface {
	IdentityKey
	PreKey
	Session
	SignedPreKey
	store.SenderKey
}

SignalProtocol store is an interface that implements the methods for all stores needed in the Signal Protocol.

type SignedPreKey

type SignedPreKey interface {
	// LoadSignedPreKey loads a local SignedPreKeyRecord
	LoadSignedPreKey(signedPreKeyID uint32) *record.SignedPreKey

	// LoadSignedPreKeys loads all local SignedPreKeyRecords
	LoadSignedPreKeys() []*record.SignedPreKey

	// Store a local SignedPreKeyRecord
	StoreSignedPreKey(signedPreKeyID uint32, record *record.SignedPreKey)

	// Check to see if store contains the given record
	ContainsSignedPreKey(signedPreKeyID uint32) bool

	// Delete a SignedPreKeyRecord from local storage
	RemoveSignedPreKey(signedPreKeyID uint32)
}

SignedPreKey store is an interface that describes how to persistently store signed PreKeys.

Jump to

Keyboard shortcuts

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