16.0.0 • Published 11 months ago

@tkey/security-questions v16.0.0

Weekly downloads
88
License
MIT
Repository
github
Last release
11 months ago

tKey Security Questions Module

npm version minzip

The tKey Security Questions 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/security-questions

Initialization

Import the SecurityQuestionsModule class from @tkey/security-questions

import SecurityQuestionsModule from "@tkey/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
16.0.0

11 months ago

15.2.1-alpha.0

1 year ago

15.1.0

1 year ago

15.1.0-alpha.0

1 year ago

15.0.2

1 year ago

15.0.0

1 year ago

14.0.0

2 years ago

13.0.0-alpha.6

2 years ago

13.0.0-alpha.4

2 years ago

12.1.2

2 years ago

12.1.1

2 years ago

13.0.1-alpha.0

2 years ago

13.0.0-alpha.1

2 years ago

13.0.0-alpha.0

2 years ago

12.1.0

2 years ago

10.0.0

3 years ago

12.0.0

2 years ago

11.0.2

2 years ago

11.0.3

2 years ago

11.0.0

2 years ago

11.0.1

2 years ago

10.1.0

3 years ago

8.1.0-alpha.0

3 years ago

9.0.0

3 years ago

7.4.0

3 years ago

7.3.0

3 years ago

8.0.5-alpha.0

3 years ago

8.0.7-alpha.0

3 years ago

8.0.6-alpha.0

3 years ago

8.0.0-alpha.0

3 years ago

7.2.0

3 years ago

7.1.0

3 years ago

6.1.0

4 years ago

6.2.0

4 years ago

7.0.0

4 years ago

6.0.0

4 years ago

5.1.4

4 years ago

5.1.3

4 years ago

5.1.1

4 years ago

5.1.0

4 years ago

5.0.0

4 years ago

4.4.0-alpha.0

4 years ago

4.4.0-y.0

4 years ago

4.4.0-alpha.4

4 years ago

4.4.0-alpha.3

4 years ago

4.4.0-alpha.2

4 years ago

4.4.0-alpha.1

4 years ago

4.4.0

4 years ago

4.3.0

5 years ago

4.2.1

5 years ago

4.2.0

5 years ago

4.1.1

5 years ago

4.1.0

5 years ago

4.0.1

5 years ago

4.0.2

5 years ago

3.14.1

5 years ago

3.14.2

5 years ago

4.0.0

5 years ago

3.14.0

5 years ago

3.13.0

5 years ago

3.12.1

5 years ago

3.12.0

5 years ago

3.11.1

5 years ago

3.11.0

5 years ago

3.10.0

5 years ago

3.9.1

5 years ago

3.9.0

5 years ago

3.8.0

5 years ago

3.7.0

5 years ago

3.6.5

5 years ago

3.6.4

5 years ago

3.6.2

5 years ago

3.6.3

5 years ago

3.6.1

5 years ago

3.6.0

5 years ago

3.5.0

5 years ago

3.4.0

5 years ago

3.2.2

5 years ago

3.2.1

5 years ago

3.2.0

5 years ago

3.1.1

5 years ago

3.1.0

5 years ago

3.0.1

5 years ago

3.0.0

5 years ago

2.0.1

5 years ago

2.0.0

5 years ago