Module: types

class x3dh.types.Bundle(identity_key, signed_pre_key, signed_pre_key_sig, pre_keys)[source]

Bases: NamedTuple

The bundle is a collection of public keys and signatures used by the X3DH protocol to achieve asynchronous key agreements while providing forward secrecy and cryptographic deniability. Parties that want to be available for X3DH key agreements have to publish their bundle somehow. Other parties can then use that bundle to perform a key agreement.

Parameters:
identity_key: bytes

Alias for field number 0

signed_pre_key: bytes

Alias for field number 1

signed_pre_key_sig: bytes

Alias for field number 2

pre_keys: FrozenSet[bytes]

Alias for field number 3

class x3dh.types.IdentityKeyFormat(*values)[source]

Bases: Enum

The two supported public key formats for the identity key:

CURVE_25519 = 'CURVE_25519'
ED_25519 = 'ED_25519'
class x3dh.types.Header(identity_key, ephemeral_key, signed_pre_key, pre_key)[source]

Bases: NamedTuple

The header generated by the active party as part of the key agreement, and consumed by the passive party to derive the same shared secret.

Parameters:
identity_key: bytes

Alias for field number 0

ephemeral_key: bytes

Alias for field number 1

signed_pre_key: bytes

Alias for field number 2

pre_key: bytes | None

Alias for field number 3

class x3dh.types.SecretType(*values)[source]

Bases: Enum

The two types of secrets that an IdentityKeyPair can use internally: a seed or a private key.

SEED = 'SEED'
PRIV = 'PRIV'

Type Aliases

x3dh.types.JSONType

alias of Mapping[str, JSONType] | List[JSONType] | str | int | float | bool | None

x3dh.types.JSONObject

alias of Mapping[str, JSONType]