Share Serialization Module - tKey iOS SDK
The ShareSerializationModule is a Swift module that provides functionality for serializing and deserializing threshold key shares.
To use the ShareSerializationModule in your Swift project, you will need to import the module as follows:
import tkey_pkg
ShareSerializationModule
is a class that provides the following methods:
Function | Description | Arguments | Async | return |
---|---|---|---|---|
serialize_share | Serialize share | threshold_key: ThresholdKey, share: String, format: String? | No | String |
deserialize_share | Deserialize share | threshold_key: ThresholdKey, share: String, format: String? | No | String |
serialize_share()
serialize_share(threshold_key: ThresholdKey, share: String, format: String?) throws -> String
This method serializes a threshold key share and returns it as a string.
Parameters
Parameters | Type | Description |
---|---|---|
threshold_key | ThresholdKey | A ThresholdKey object that represents the threshold key to which the share belongs. |
share | String | A string that represents the share to be serialized. |
format | String? | An optional string that represents the serialization format. If it is not specified, the default format will be used. |
Returns
- A string that represents the serialized share.
Throws
- RuntimeError: If the serialization operation fails, a RuntimeError will be thrown.
deserialize_share()
deserialize_share(threshold_key: ThresholdKey, share: String, format: String?) throws -> String
This method deserializes a threshold key share and returns it as a string.
Parameters
Parameters | Type | Description |
---|---|---|
threshold_key | ThresholdKey | A ThresholdKey object that represents the threshold key to which the share belongs. |
share | String | A string that represents the share to be deserialized. |
format | String? | An optional string that represents the serialization format. If it is not specified, the default format will be used. |
Returns
- A string that represents the deserialized share.
Throws
- RuntimeError: If the deserialization operation fails, a RuntimeError will be thrown.