12.1.0 • Published 1 month ago

@tkey/security-questions v12.1.0

Weekly downloads
88
License
MIT
Repository
github
Last release
1 month 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
12.1.0

1 month ago

10.0.0

10 months ago

12.0.0

7 months ago

11.0.2

9 months ago

11.0.3

8 months ago

11.0.0

9 months ago

11.0.1

9 months ago

10.1.0

10 months ago

8.1.0-alpha.0

1 year ago

9.0.0

1 year ago

7.4.0

1 year ago

7.3.0

1 year ago

8.0.5-alpha.0

1 year ago

8.0.7-alpha.0

1 year ago

8.0.6-alpha.0

1 year ago

8.0.0-alpha.0

1 year ago

7.2.0

1 year ago

7.1.0

1 year ago

6.1.0

2 years ago

6.2.0

2 years ago

7.0.0

2 years ago

6.0.0

2 years ago

5.1.4

2 years ago

5.1.3

2 years ago

5.1.1

2 years ago

5.1.0

2 years ago

5.0.0

2 years ago

4.4.0-alpha.0

3 years ago

4.4.0-y.0

3 years ago

4.4.0-alpha.4

3 years ago

4.4.0-alpha.3

3 years ago

4.4.0-alpha.2

3 years ago

4.4.0-alpha.1

3 years ago

4.4.0

3 years ago

4.3.0

3 years ago

4.2.1

3 years ago

4.2.0

3 years ago

4.1.1

3 years ago

4.1.0

3 years ago

4.0.1

3 years ago

4.0.2

3 years ago

3.14.1

3 years ago

3.14.2

3 years ago

4.0.0

3 years ago

3.14.0

3 years ago

3.13.0

3 years ago

3.12.1

3 years ago

3.12.0

3 years ago

3.11.1

3 years ago

3.11.0

3 years ago

3.10.0

3 years ago

3.9.1

3 years ago

3.9.0

3 years ago

3.8.0

3 years ago

3.7.0

3 years ago

3.6.5

3 years ago

3.6.4

3 years ago

3.6.2

3 years ago

3.6.3

3 years ago

3.6.1

3 years ago

3.6.0

3 years ago

3.5.0

3 years ago

3.4.0

3 years ago

3.2.2

3 years ago

3.2.1

3 years ago

3.2.0

3 years ago

3.1.1

3 years ago

3.1.0

3 years ago

3.0.1

4 years ago

3.0.0

4 years ago

2.0.1

4 years ago

2.0.0

4 years ago