Module: migrations

x3dh.migrations.parse_identity_key_pair_model(serialized)[source]

Parse a serialized IdentityKeyPair instance, as returned by json, into the most recent pydantic model available for the class. Perform migrations in case the pydantic models were updated.

Parameters:

serialized (JSONObject) – The serialized instance.

Return type:

IdentityKeyPairModel

Returns:

The model, which can be used to restore the instance using from_model().

Note

Pre-stable data can only be migrated as a whole using parse_base_state_model().

x3dh.migrations.parse_signed_pre_key_pair_model(serialized)[source]

Parse a serialized SignedPreKeyPair instance, as returned by json, into the most recent pydantic model available for the class. Perform migrations in case the pydantic models were updated.

Parameters:

serialized (JSONObject) – The serialized instance.

Return type:

SignedPreKeyPairModel

Returns:

The model, which can be used to restore the instance using from_model().

Note

Pre-stable data can only be migrated as a whole using parse_base_state_model().

x3dh.migrations.parse_base_state_model(serialized)[source]

Parse a serialized BaseState instance, as returned by json, into the most recent pydantic model available for the class. Perform migrations in case the pydantic models were updated. Supports migration of pre-stable data.

Parameters:

serialized (JSONObject) – The serialized instance.

Return type:

Tuple[BaseStateModel, bool]

Returns:

The model, which can be used to restore the instance using from_model(), and a flag that indicates whether the bundle needs to be published, which was part of the pre-stable serialization format.