anastasis: salt rename

This commit is contained in:
Florian Dold 2022-04-13 08:55:35 +02:00
parent a74bd998f1
commit 2c3aeabed1
No known key found for this signature in database
GPG Key ID: D2E4F00F29D02A4B
3 changed files with 14 additions and 11 deletions

View File

@ -314,7 +314,7 @@ async function getProviderInfo(
type: x.type, type: x.type,
usage_fee: x.cost, usage_fee: x.cost,
})), })),
salt: jsonResp.server_salt, provider_salt: jsonResp.provider_salt,
storage_limit_in_megabytes: jsonResp.storage_limit_in_megabytes, storage_limit_in_megabytes: jsonResp.storage_limit_in_megabytes,
truth_upload_fee: jsonResp.truth_upload_fee, truth_upload_fee: jsonResp.truth_upload_fee,
}; };
@ -424,7 +424,7 @@ async function prepareRecoveryData(
tm = { tm = {
key_share: encodeCrock(getRandomBytes(32)), key_share: encodeCrock(getRandomBytes(32)),
nonce: encodeCrock(getRandomBytes(24)), nonce: encodeCrock(getRandomBytes(24)),
truth_salt: encodeCrock(getRandomBytes(16)), master_salt: encodeCrock(getRandomBytes(16)),
truth_key: encodeCrock(getRandomBytes(64)), truth_key: encodeCrock(getRandomBytes(64)),
uuid: encodeCrock(getRandomBytes(32)), uuid: encodeCrock(getRandomBytes(32)),
pol_method_index: methIndex, pol_method_index: methIndex,
@ -457,8 +457,8 @@ async function prepareRecoveryData(
escrowMethods.push({ escrowMethods.push({
escrow_type: authMethod.type as any, escrow_type: authMethod.type as any,
instructions: authMethod.instructions, instructions: authMethod.instructions,
provider_salt: provider.salt, provider_salt: provider.provider_salt,
truth_salt: tm.truth_salt, truth_salt: tm.master_salt,
truth_key: tm.truth_key, truth_key: tm.truth_key,
url: meth.provider, url: meth.provider,
uuid: tm.uuid, uuid: tm.uuid,
@ -514,7 +514,7 @@ async function uploadSecret(
] as AuthenticationProviderStatusOk; ] as AuthenticationProviderStatusOk;
userId = userIdCache[providerUrl] = await userIdentifierDerive( userId = userIdCache[providerUrl] = await userIdentifierDerive(
state.identity_attributes!, state.identity_attributes!,
provider.salt, provider.provider_salt,
); );
} }
return userId; return userId;
@ -525,7 +525,7 @@ async function uploadSecret(
const meth = pol.methods[tm.pol_method_index]; const meth = pol.methods[tm.pol_method_index];
const authMethod = const authMethod =
state.authentication_methods![meth.authentication_method]; state.authentication_methods![meth.authentication_method];
const truthValue = await getTruthValue(authMethod, tm.uuid, tm.truth_salt); const truthValue = await getTruthValue(authMethod, tm.uuid, tm.master_salt);
const encryptedTruth = await encryptTruth( const encryptedTruth = await encryptTruth(
tm.nonce, tm.nonce,
tm.truth_key, tm.truth_key,
@ -746,7 +746,7 @@ async function downloadPolicy(
if (!pi || pi.status !== "ok") { if (!pi || pi.status !== "ok") {
continue; continue;
} }
const userId = await userIdentifierDerive(userAttributes, pi.salt); const userId = await userIdentifierDerive(userAttributes, pi.provider_salt);
const acctKeypair = accountKeypairDerive(userId); const acctKeypair = accountKeypairDerive(userId);
const reqUrl = new URL(`policy/${acctKeypair.pub}`, prov.url); const reqUrl = new URL(`policy/${acctKeypair.pub}`, prov.url);
reqUrl.searchParams.set("version", `${prov.version}`); reqUrl.searchParams.set("version", `${prov.version}`);
@ -1653,7 +1653,7 @@ export async function discoverPolicies(
} }
const userId = await userIdentifierDerive( const userId = await userIdentifierDerive(
state.identity_attributes!, state.identity_attributes!,
providerInfo.salt, providerInfo.provider_salt,
); );
const acctKeypair = accountKeypairDerive(userId); const acctKeypair = accountKeypairDerive(userId);
const reqUrl = new URL(`policy/${acctKeypair.pub}/meta`, providerUrl); const reqUrl = new URL(`policy/${acctKeypair.pub}/meta`, providerUrl);

View File

@ -54,8 +54,11 @@ export interface EscrowConfigurationResponse {
// **provider salt** is then used in various operations to ensure // **provider salt** is then used in various operations to ensure
// cryptographic operations differ by provider. A provider must // cryptographic operations differ by provider. A provider must
// never change its salt value. // never change its salt value.
server_salt: string; provider_salt: string;
/**
* Human-readable business name of the provider.
*/
business_name: string; business_name: string;
} }

View File

@ -266,7 +266,7 @@ export interface TruthMetaData {
/** /**
* Truth-specific salt. * Truth-specific salt.
*/ */
truth_salt: string; master_salt: string;
} }
export interface ReducerStateError { export interface ReducerStateError {
@ -316,7 +316,7 @@ export interface AuthenticationProviderStatusOk {
currency: string; currency: string;
http_status: 200; http_status: 200;
liability_limit: string; liability_limit: string;
salt: string; provider_salt: string;
storage_limit_in_megabytes: number; storage_limit_in_megabytes: number;
truth_upload_fee: string; truth_upload_fee: string;
methods: MethodSpec[]; methods: MethodSpec[];