libsignal

package module
v0.0.0-...-9e252af Latest Latest
Warning

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

Go to latest
Published: May 8, 2016 License: MIT Imports: 26 Imported by: 2

README

libsignal [WIP]

This go library is an implementation of the signal asynchronous messaging protocol modified for use in OpenBazaar.

Modifications include:

  • Removed all communication with the signal servers. This library only handles session state management, encryption, and decryption. It's up to you to implement a transport for the ciphertext.
  • Removed prekey transport. Again, you need to implement a method of getting Alice's prekey bundle to Bob so that Bob can send the first message.
  • Removed message metadata. Messages are not tagged with the recipient ID. This allows them to be stored on untrusted servers without leaking metadata. The cost, however, is that to decrypt a message one must iterative over all open sessions to decrypt the message. Assuming the number of sessions a user keeps open at any given time is relatively small, this shouldn't have scaling issues. It may be possible to improve the efficiency here by tagging each message with a shared secret that ratchets forward, but at the cost of more complexity.
  • [TODO] Identity keys switched to RSA (which is what OpenBazaar/IPFS uses).

Documentation

Index

Constants

This section is empty.

Variables

View Source
var EndSessionFlag uint32 = 1
View Source
var ErrBadPublicKey = errors.New("public key not formatted correctly")
View Source
var ErrCouldNotDecrypt = errors.New("could not decrypt message using any open sessions")

ErrInvalidMACForMessage signals an incoming message with invalid MAC.

View Source
var ErrInvalidMACForMessage = errors.New("invalid MAC for incoming message")

ErrInvalidMACForMessage signals an incoming message with invalid MAC.

View Source
var ErrStoreBadMAC = errors.New("wrong MAC calculated, possibly due to wrong passphrase")

ErrStoreBadMAC occurs when MAC verification fails on the records stored using password based encryption. The probable cause is using a wrong password.

View Source
var MessageTypeNotImplementedError = errors.New("envelope type not implemented")

MessageTypeNotImplementedError is raised in the unlikely event that an unhandled protocol message type is received.

Functions

func ContactIdentityKey

func ContactIdentityKey(id string) ([]byte, error)

ContactIdentityKey returns the serialized public key of the given contact

func MakePreKeyBundle

func MakePreKeyBundle(preKey ratchet.PreKeyRecord, signedPreKey ratchet.SignedPreKeyRecord, identityKey ratchet.IdentityKeyPair) (*ratchet.PreKeyBundle, error)

func MyIdentityKey

func MyIdentityKey() []byte

MyIdentityKey returns our serialized public identity key

func NewStore

func NewStore(password, path string) (*store, error)

Types

type Client

type Client struct {
	Store       *store
	IdentityKey *ratchet.IdentityKeyPair
	PreKeys     *preKeyState
	DeviceID    uint32
	PeerID      string
}

func NewClient

func NewClient(datastorePath string, password string) (*Client, error)

func (*Client) BuildMessage

func (c *Client) BuildMessage(plaintext string, recipient string, pkb *ratchet.PreKeyBundle) ([]byte, error)

func (*Client) HandleReceivedMessage

func (c *Client) HandleReceivedMessage(msg []byte) (string, error)

Authenticate and decrypt a received message

type OutgoingMessage

type OutgoingMessage struct {
	Recipient string
	Msg       string
	Flags     uint32
}

type UnknownContactError

type UnknownContactError struct {
	// contains filtered or unexported fields
}

UnknownContactError is returned when an unknown group id is encountered

func (UnknownContactError) Error

func (err UnknownContactError) Error() string

Directories

Path Synopsis
Package libsignal is a generated protocol buffer package.
Package libsignal is a generated protocol buffer package.
Package axolotl implements the Axolotl ratchet as used by TextSecure protocol version 3.
Package axolotl implements the Axolotl ratchet as used by TextSecure protocol version 3.

Jump to

Keyboard shortcuts

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