x3dh

package
v0.0.0-...-f3cc64c Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2024 License: BSD-2-Clause Imports: 10 Imported by: 0

README

X3DH

Issue Tracker Docs Chat License

This library implements the x3dh key negotiation protocol in Go. It was written to be used as part of the OMEMO e2e encryption protocol.

To use it in your project, import it (or any of its other packages) like so:

import mellium.im/crypto/x3dh

If you'd like to contribute to the project, see CONTRIBUTING.md.

License

The package may be used under the terms of the BSD 2-Clause License a copy of which may be found in the file "LICENSE".

Unless you explicitly state otherwise, any contribution submitted for inclusion in the work by you shall be licensed as above, without any additional terms or conditions.

Documentation

Overview

Package x3dh implements the X3DH key agreement protocol.

X3DH was originally written for the Signal instant messaging client. For more information see the specification:

https://signal.org/docs/specifications/x3dh/

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ED25519PrivToCurve25519

func ED25519PrivToCurve25519(sk ed25519.PrivateKey) (*ecdh.PrivateKey, error)

ED25519PrivToCurve25519 converts an ED25519 secret key to an ECDH key on the X25519 curve.

func ED25519PubToCurve25519

func ED25519PubToCurve25519(key ed25519.PublicKey) (*ecdh.PublicKey, error)

ED25519PubToCurve25519 converts an ED25519 public key to an ECDH key on the X25519 curve.

func NewInitMessage

func NewInitMessage(idKey ed25519.PrivateKey, peerIDKey, opkPub ed25519.PublicKey, spkPub *ecdh.PublicKey, spkSig []byte) ([]byte, []byte, *ecdh.PublicKey, error)

NewInitMessage creates a new initiation message that can be used to start an X3DH session. Returned values are the session key, any associated data, and the ephemeral public key.

func NewSignedPreKey

func NewSignedPreKey(idKey ed25519.PrivateKey) (*ecdh.PrivateKey, []byte, error)

NewSignedPreKey creates a new X25519 signed prekey (SPK) and signs the public part of the key with the identity key, returning the private key and the signature.

func RecvInitMessage

func RecvInitMessage(idKey, opkPriv ed25519.PrivateKey, spkPriv *ecdh.PrivateKey, peerIDKey ed25519.PublicKey, ekPub *ecdh.PublicKey) ([]byte, []byte, error)

RecvInitMessage handles an incoming X3DH request. Returned values are the session key and any associated data.

Types

This section is empty.

Jump to

Keyboard shortcuts

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