Skip to main content

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:

FunctionDescriptionArgumentsAsyncreturn
serialize_shareSerialize sharethreshold_key: ThresholdKey, share: String, format: String?NoString
deserialize_shareDeserialize sharethreshold_key: ThresholdKey, share: String, format: String?NoString

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

ParametersTypeDescription
threshold_keyThresholdKeyA ThresholdKey object that represents the threshold key to which the share belongs.
shareStringA string that represents the share to be serialized.
formatString?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

ParametersTypeDescription
threshold_keyThresholdKeyA ThresholdKey object that represents the threshold key to which the share belongs.
shareStringA string that represents the share to be deserialized.
formatString?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.