@tkey-singularity/share-serialization
TypeScript icon, indicating that this package has built-in type declarations

14.0.0 • Public • Published

tKey Share Serialization Module

npm version minzip

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.

Installation

npm install --save @tkey/share-serialization

Initialization

Import the ShareSerializationModule class from @tkey/share-serialization

import ShareSerializationModule from "@tkey/share-serialization";

Assign the ShareSerializationModule class to a variable

const shareSerializationModule = new ShareSerializationModule();

Returns

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>;
}

Usage

With the ShareSerializationModule, you've access to the following functions:

Serialize a share

serialize(share: BN, type: string)

  • share: The share to serialize.
  • type: The type of share to serialize.

Deserialize a share

deserialize(serializedShare: unknown, type: string)

Return

  • Promise<BN>: The deserialized share.

/@tkey-singularity/share-serialization/

    Package Sidebar

    Install

    npm i @tkey-singularity/share-serialization

    Weekly Downloads

    1

    Version

    14.0.0

    License

    MIT

    Unpacked Size

    3.42 MB

    Total Files

    21

    Last publish

    Collaborators

    • parasmadaan97