Module: signed_pre_key_pair

class x3dh.signed_pre_key_pair.SignedPreKeyPair(priv, sig, timestamp)[source]

Bases: NamedTuple

A signed pre key, i.e. a pre key whose public key was encoded using an application-specific encoding format, then signed by the identity key, and stored together with a generation timestamp for periodic rotation.

Parameters:
priv: bytes

Alias for field number 0

sig: bytes

Alias for field number 1

timestamp: int

Alias for field number 2

property pub: bytes

Returns: The public key of this signed pre key.

property model: SignedPreKeyPairModel

Returns: The internal state of this SignedPreKeyPair as a pydantic model.

property json: JSONObject

Returns: The internal state of this SignedPreKeyPair as a JSON-serializable Python object.

static from_model(model)[source]
Parameters:

model (SignedPreKeyPairModel) – The pydantic model holding the internal state of a SignedPreKeyPair, as produced by model.

Return type:

SignedPreKeyPair

Returns:

A configured instance of SignedPreKeyPair, with internal state restored from the model.

Warning

Migrations are not provided via the model/from_model() API. Use json/from_json() instead. Refer to Serialization and Migration in the documentation for details.

static from_json(serialized)[source]
Parameters:

serialized (JSONObject) – A JSON-serializable Python object holding the internal state of a SignedPreKeyPair, as produced by json.

Return type:

SignedPreKeyPair

Returns:

A configured instance of SignedPreKeyPair, with internal state restored from the serialized data.