aboutsummaryrefslogtreecommitdiff
path: root/packages/anastasis-core
diff options
context:
space:
mode:
authorFlorian Dold <florian@dold.me>2022-04-13 13:16:35 +0200
committerFlorian Dold <florian@dold.me>2022-04-13 13:16:35 +0200
commit31b6496db502b302e5a33597723ed847a83fe63e (patch)
treeab1865f78dbfcce89829906b86917f87449837b2 /packages/anastasis-core
parent2c3aeabed100fb16c33171c005aa41b026eccca1 (diff)
downloadwallet-core-31b6496db502b302e5a33597723ed847a83fe63e.tar.xz
anastasis-core: salt rename, fix tagging
Diffstat (limited to 'packages/anastasis-core')
-rw-r--r--packages/anastasis-core/src/index.ts31
-rw-r--r--packages/anastasis-core/src/recovery-document-types.ts2
2 files changed, 18 insertions, 15 deletions
diff --git a/packages/anastasis-core/src/index.ts b/packages/anastasis-core/src/index.ts
index 52cb33f5a..68ecc5173 100644
--- a/packages/anastasis-core/src/index.ts
+++ b/packages/anastasis-core/src/index.ts
@@ -458,7 +458,7 @@ async function prepareRecoveryData(
escrow_type: authMethod.type as any,
instructions: authMethod.instructions,
provider_salt: provider.provider_salt,
- truth_salt: tm.master_salt,
+ question_salt: tm.master_salt,
truth_key: tm.truth_key,
url: meth.provider,
uuid: tm.uuid,
@@ -902,7 +902,7 @@ async function getResponseHash(
respHash = await secureAnswerHash(
solveRequest.answer,
truth.uuid,
- truth.truth_salt,
+ truth.question_salt,
);
} else {
throw Error("unsupported answer request");
@@ -1074,18 +1074,21 @@ async function selectChallenge(
const url = new URL(`/truth/${truth.uuid}/challenge`, truth.url);
- if (truth.escrow_type === ChallengeType.Question) {
- return {
- ...state,
- recovery_state: RecoveryStates.ChallengeSolving,
- selected_challenge_uuid: truth.uuid,
- challenge_feedback: {
- ...state.challenge_feedback,
- [truth.uuid]: {
- state: ChallengeFeedbackStatus.Pending,
+ switch (truth.escrow_type) {
+ case ChallengeType.Question:
+ case ChallengeType.Totp: {
+ return {
+ ...state,
+ recovery_state: RecoveryStates.ChallengeSolving,
+ selected_challenge_uuid: truth.uuid,
+ challenge_feedback: {
+ ...state.challenge_feedback,
+ [truth.uuid]: {
+ state: ChallengeFeedbackStatus.Pending,
+ },
},
- },
- };
+ };
+ }
}
const resp = await fetch(url.href, {
@@ -1732,7 +1735,7 @@ export async function reduceAction(
return {
reducer_type: "error",
...e.errorJson,
- }
+ };
}
throw e;
}
diff --git a/packages/anastasis-core/src/recovery-document-types.ts b/packages/anastasis-core/src/recovery-document-types.ts
index 3dc4481ff..f94aa1916 100644
--- a/packages/anastasis-core/src/recovery-document-types.ts
+++ b/packages/anastasis-core/src/recovery-document-types.ts
@@ -82,7 +82,7 @@ export interface EscrowMethod {
/**
* Salt to hash the security question answer if applicable.
*/
- truth_salt: TruthSalt;
+ question_salt: TruthSalt;
// Salt from the provider to derive the user ID
// at this provider.