The Share Serialization Module helps you add or remove the and password as a share for tkey. This module is the part of the tKey SDK.
npm install --save @tkey/share-serialization
import ShareSerializationModule from "@tkey/share-serialization";
const shareSerializationModule = new ShareSerializationModule();
The ShareSerializationModule
class returns an object with the following properties:
declare class ShareSerializationModule implements IModule {
moduleName: string;
tbSDK: ITKeyApi;
constructor();
static serializeMnemonic(share: BN): string;
static deserializeMnemonic(share: string): BN;
setModuleReferences(tbSDK: ITKeyApi): void;
initialize(): Promise<void>;
serialize(share: BN, type: string): Promise<unknown>;
deserialize(serializedShare: unknown, type: string): Promise<BN>;
}
With the ShareSerializationModule
, you've access to the following functions:
-
share
: The share to serialize. -
type
: The type of share to serialize.
-
Promise<BN>
: The deserialized share.