2.0.2-beta.0 • Published 5 months ago

@oraichain/security-questions v2.0.2-beta.0

Weekly downloads
-
License
MIT
Repository
github
Last release
5 months ago

tKey Security Questions Module

npm version minzip

The oKey Security Questions Module helps you add or remove the and password as a share for oKey. This module is the part of the oKey SDK.

Installation

npm install --save @oraichain/security-questions

Initialization

Import the SecurityQuestionsModule class from @oraichain/security-questions

import SecurityQuestionsModule from "@oraichain/security-questions";

Assign the SecurityQuestionsModule class to a variable

const securityQuestionsModule = new SecurityQuestionsModule(params);

Parameters

params

  • saveAnswers?: boolean

Returns

The SecurityQuestionsModule class returns an object with the following properties:

class SecurityQuestionsModule implements IModule {
  moduleName: string;
  tbSDK: ITKeyApi;
  saveAnswers: boolean;
  constructor(saveAnswers?: boolean);
  static refreshSecurityQuestionsMiddleware(generalStore: unknown, oldShareStores: ShareStoreMap, newShareStores: ShareStoreMap): unknown;
  setModuleReferences(tbSDK: ITKeyApi): void;
  initialize(): Promise<void>;
  generateNewShareWithSecurityQuestions(answerString: string, questions: string): Promise<GenerateNewShareResult>;
  getSecurityQuestions(): string;
  inputShareFromSecurityQuestions(answerString: string): Promise<void>;
  changeSecurityQuestionAndAnswer(newAnswerString: string, newQuestions: string): Promise<void>;
  saveAnswerOnTkeyStore(answerString: string): Promise<void>;
  getAnswer(): Promise<string>;
}

Usage

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

Generate new share with security questions

generateNewShareWithSecurityQuestions(answerString: string, questions: string)

  • answerString: Answer corresponding to a security question
  • questions: The secutity question

Return

  • Promise<GenerateNewShareResult>: The GenerateNewShareResult object
GenerateNewShareResult
declare type GenerateNewShareResult = {
  newShareStores: ShareStoreMap;
  newShareIndex: BN;
};
export declare type ShareStoreMap = {
  [shareIndex: string]: ShareStore;
};
declare class ShareStore implements ISerializable {
  share: Share;
  polynomialID: PolynomialID;
  constructor(share: Share, polynomialID: PolynomialID);
  static fromJSON(value: StringifiedType): ShareStore;
  toJSON(): StringifiedType;
}

Get Security Question

getSecurityQuestions()

Return

  • string: The security question

Input share from security question

inputShareFromSecurityQuestions(answerString: string)

  • answerString: Answer corresponding to the security question

Change Security Question and Answer

changeSecurityQuestionAndAnswer(newAnswerString: string, newQuestions: string)

  • newAnswerString: Answer corresponding to the new security question
  • newQuestions: The new secutity question

Save answer on tkey store

saveAnswerOnTkeyStore(answerString: string)

  • answerString: Answer corresponding to the security question

Get answer

getAnswer

Return

  • string: The answer corresponding to the security question
2.0.2-beta.0

5 months ago

2.0.1

5 months ago

2.0.1-beta.2

5 months ago

2.0.0

5 months ago

1.3.1-beta.0

5 months ago

1.3.0

6 months ago

1.2.19-beta.0

6 months ago

1.2.18

6 months ago

1.2.18-beta.2

7 months ago

1.2.18-beta.1

7 months ago

1.2.18-beta.0

7 months ago

1.2.17

7 months ago

1.2.17-beta.4

7 months ago

1.2.17-beta.3

7 months ago

1.2.17-beta.0

7 months ago

1.2.16

7 months ago

1.2.15

7 months ago

1.2.14

7 months ago

1.2.13

7 months ago

1.2.12

7 months ago

1.2.11

7 months ago

1.2.10

7 months ago

1.2.9

7 months ago

1.2.8

7 months ago

1.2.7

7 months ago

1.2.6

8 months ago

1.2.5

8 months ago

1.2.4

8 months ago

1.2.3

8 months ago

1.2.2

8 months ago

1.2.1

8 months ago

1.2.0

8 months ago

1.1.5

9 months ago

1.1.4

9 months ago

1.1.3

9 months ago

1.1.2

9 months ago

1.1.1

9 months ago

1.1.0

9 months ago

1.0.3

10 months ago

1.0.2

10 months ago

1.0.1

10 months ago

1.0.0

10 months ago