goolm

package module
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2023 License: MIT Imports: 2 Imported by: 0

README

goolm

Please don't upload to GitHub GoDoc

A Go implementation of Olm and Megolm

goolm is a pure Go implementation of libolm. Libolm is a cryptographic library used for end-to-end encryption in Matrix and wirtten in C++. With goolm there is no need to use cgo when building Matrix clients in go.

See the GoDoc for usage.

This package is written to be a easily used in github.com/mautrix/go/crypto/olm.

PR's are always welcome.

Features

  • Test files for most methods and functions adapted from libolm

Supported

  • Olm
  • Pickle structs with encryption using JSON marshalling
  • Pickle structs with encryption using the libolm format
  • Megolm
  • Inbound and outbound group sessions
  • SAS support

License

MIT licensed. See the LICENSE file for details.

Documentation

Overview

goolm is a pure Go implementation of libolm. Libolm is a cryptographic library used for end-to-end encryption in Matrix and wirtten in C++. With goolm there is no need to use cgo when building Matrix clients in go.

This package contains the possible errors which can occur as well as some simple functions. All the 'action' happens in the subdirectories.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoSigningKey         = errors.New("no signing key")
	ErrBadSignature         = errors.New("bad signature")
	ErrBadMAC               = errors.New("bad mac")
	ErrBadMessageFormat     = errors.New("bad message format")
	ErrBadVerification      = errors.New("bad verification")
	ErrWrongProtocolVersion = errors.New("wrong protocol version")
	ErrNoSessionKey         = errors.New("no session key")
	ErrEmptyInput           = errors.New("empty input")
	ErrNoKeyProvided        = errors.New("no key")
	ErrBadMessageKeyID      = errors.New("bad message key id")
	ErrRatchetNotAvailable  = errors.New("ratchet not available: attempt to decode a message whose index is earlier than our earliest known session key")
	ErrMsgIndexTooHigh      = errors.New("message index too high")
	ErrProtocolViolation    = errors.New("not protocol message order")
	ErrMessageKeyNotFound   = errors.New("message key not found")
	ErrChainTooHigh         = errors.New("chain index too high")
	ErrBadInput             = errors.New("bad input")
	ErrBadVersion           = errors.New("wrong version")
	ErrNotBlocksize         = errors.New("length != blocksize")
	ErrNotMultipleBlocksize = errors.New("length not a multiple of the blocksize")
	ErrBase64InvalidLength  = errors.New("base64 decode invalid length")
	ErrWrongPickleVersion   = errors.New("Wrong pickle version")
	ErrSignatureNotFound    = errors.New("signature not found")
	ErrNotEnoughGoRandom    = errors.New("Not enough random data available")
	ErrValueTooShort        = errors.New("value too short")
	ErrInputToSmall         = errors.New("input too small (truncated?)")
	ErrOverflow             = errors.New("overflow")
	ErrBadBase64            = errors.New("Bad base64")
)

Those are the most common used errors

Functions

func Base64Decode

func Base64Decode(input []byte) ([]byte, error)

Base64Decode decodes the input. Padding characters ('=') will be added if needed.

func Base64Encode

func Base64Encode(input []byte) []byte

Base64Encode encodes the input and strips all padding characters ('=') from the end.

func GetLibaryVersion added in v0.2.0

func GetLibaryVersion() (major, minor, patch uint8)

Types

This section is empty.

Directories

Path Synopsis
account packages an account which stores the identity, one time keys and fallback keys.
account packages an account which stores the identity, one time keys and fallback keys.
cipher provides the methods and structs to do encryptions for olm/megolm.
cipher provides the methods and structs to do encryptions for olm/megolm.
crpyto provides the nessesary encryption methods for olm/megolm
crpyto provides the nessesary encryption methods for olm/megolm
megolm provides the ratchet used by the megolm protocol
megolm provides the ratchet used by the megolm protocol
olm provides the ratchet used by the olm protocol
olm provides the ratchet used by the olm protocol
sas provides the means to do SAS between keys
sas provides the means to do SAS between keys
session provides the different types of sessions for en/decrypting of messages
session provides the different types of sessions for en/decrypting of messages

Jump to

Keyboard shortcuts

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