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.
npm install --save @tkey/security-questions
import SecurityQuestionsModule from "@tkey/security-questions";
const securityQuestionsModule = new SecurityQuestionsModule(params);
params
-
saveAnswers?
:boolean
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>;
}
With the SecurityQuestionsModule
, you've access to the following functions:
-
answerString
: Answer corresponding to a security question -
questions
: The secutity question
-
Promise<GenerateNewShareResult>
: TheGenerateNewShareResult
object
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;
}
-
string
: The security question
-
answerString
: Answer corresponding to the security question
-
newAnswerString
: Answer corresponding to the new security question -
newQuestions
: The new secutity question
-
answerString
: Answer corresponding to the security question
-
string
: The answer corresponding to the security question