Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@tkey/share-transfer

Package Overview
Dependencies
Maintainers
4
Versions
85
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tkey/share-transfer

TKey Share Transfer Module

  • 10.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
579
increased by5.66%
Maintainers
4
Weekly downloads
 
Created
Source

tKey Share Transfer Module

npm version minzip

The Share Transfer 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-transfer

Initialization

Import the ShareTransferModule class from @tkey/share-transfer
import ShareTransferModule from "@tkey/share-transfer";
Assign the ShareTransferModule class to a variable
const shareTransferModule = new ShareTransferModule();

Returns

The ShareTransferModule class returns an object with the following properties:

declare class ShareTransferModule implements IModule {
  moduleName: string;
  tbSDK: ITKeyApi;
  currentEncKey: BN;
  requestStatusCheckId: number;
  requestStatusCheckInterval: number;
  constructor();
  static refreshShareTransferMiddleware(
    generalStore: unknown,
    oldShareStores: ShareStoreMap,
    newShareStores: ShareStoreMap
  ): ShareTransferStorePointer;
  setModuleReferences(tbSDK: ITKeyApi): void;
  setRequestStatusCheckInterval(interval: number): void;
  initialize(): Promise<void>;
  requestNewShare(
    userAgent: string,
    availableShareIndexes: Array<string>,
    callback?: (err?: ITkeyError, shareStore?: ShareStore) => void
  ): Promise<string>;
  addCustomInfoToShareRequest(encPubKeyX: string, customInfo: string): Promise<void>;
  lookForRequests(): Promise<Array<string>>;
  approveRequest(encPubKeyX: string, shareStore?: ShareStore): Promise<void>;
  approveRequestWithShareIndex(encPubKeyX: string, shareIndex: string): Promise<void>;
  getShareTransferStore(): Promise<ShareTransferStore>;
  setShareTransferStore(shareTransferStore: ShareTransferStore): Promise<void>;
  startRequestStatusCheck(encPubKeyX: string, deleteRequestAfterCompletion: boolean): Promise<ShareStore>;
  cancelRequestStatusCheck(): Promise<void>;
  deleteShareTransferStore(encPubKey: string): Promise<void>;
  resetShareTransferStore(): Promise<void>;
  private _cleanUpCurrentRequest;
}

Usage

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

Request a new share

requestNewShare(userAgent: string, availableShareIndexes: Array<string>, callback?: (err?: ITkeyError, shareStore?: ShareStore) => void)
  • userAgent: The user agent of the client that is requesting a new share.
  • availableShareIndexes: An array of share indexes that are available for the client.
  • callback: A callback function that is called when the request is complete.
Return
  • Promise<string>: Share index of the new share.

Add custom info to share request

addCustomInfoToShareRequest(encPubKeyX: string, customInfo: string)
  • encPubKeyX: The public key of the share that is being requested.
  • customInfo: The custom info that is being added to the share request.

Look for requests

lookForRequests()
Return
  • Promise<Array<string>>: An array of indexes of pending requests

Approve request

approveRequest(encPubKeyX: string, shareStore?: ShareStore)
  • encPubKeyX: The public key of the share that is being approved.
  • shareStore: The share store that is being approved.

Approve request with share index

approveRequestWithShareIndex(encPubKeyX: string, shareIndex: string)
  • encPubKeyX: The public key of the share that is being approved.
  • shareIndex: The share index that is being approved.

Get share transfer store

getShareTransferStore()
Return
  • Promise<ShareTransferStore>: The share transfer store.

Set share transfer store

setShareTransferStore(shareTransferStore: ShareTransferStore)
  • shareTransferStore: The share transfer store.

Start request status check

startRequestStatusCheck(encPubKeyX: string, deleteRequestAfterCompletion: boolean)
  • encPubKeyX: The public key of the share that is being checked.
  • deleteRequestAfterCompletion: Whether or not to delete the request after it is completed.
Return
  • Promise<ShareStore>: The share store.

Cancel request status check

cancelRequestStatusCheck()

Delete share transfer store

deleteShareTransferStore(encPubKey: string)
  • encPubKey: The public key of the share that is being deleted.

Reset share transfer store

resetShareTransferStore()

FAQs

Package last updated on 05 Jul 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc