[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-wallet-core] 02/02: do not add provider without salt
From: |
gnunet |
Subject: |
[taler-wallet-core] 02/02: do not add provider without salt |
Date: |
Fri, 03 Jun 2022 17:18:56 +0200 |
This is an automated email from the git hooks/post-receive script.
sebasjm pushed a commit to branch master
in repository wallet-core.
commit 8e9bca396ec0d78c67d682f4ae01b67ccf761380
Author: Sebastian <sebasjm@gmail.com>
AuthorDate: Fri Jun 3 12:18:45 2022 -0300
do not add provider without salt
---
packages/anastasis-core/src/index.ts | 23 +++++++++++++++--------
1 file changed, 15 insertions(+), 8 deletions(-)
diff --git a/packages/anastasis-core/src/index.ts
b/packages/anastasis-core/src/index.ts
index 14ddf815..b5e0517e 100644
--- a/packages/anastasis-core/src/index.ts
+++ b/packages/anastasis-core/src/index.ts
@@ -169,8 +169,8 @@ export class ReducerError extends Error {
constructor(public errorJson: ErrorDetails) {
super(
errorJson.message ??
- errorJson.hint ??
- `${TalerErrorCode[errorJson.code]}`,
+ errorJson.hint ??
+ `${TalerErrorCode[errorJson.code]}`,
);
// Set the prototype explicitly.
@@ -301,6 +301,13 @@ async function getProviderInfo(
}
try {
const jsonResp: EscrowConfigurationResponse = await resp.json();
+ if (!jsonResp.provider_salt) {
+ return {
+ status: "error",
+ code: TalerErrorCode.ANASTASIS_REDUCER_PROVIDER_CONFIG_FAILED,
+ hint: "provider did not have provider salt",
+ }
+ }
return {
status: "ok",
http_status: 200,
@@ -552,8 +559,8 @@ async function uploadSecret(
"content-type": "application/json",
...(paySecret
? {
- "Anastasis-Payment-Identifier": paySecret,
- }
+ "Anastasis-Payment-Identifier": paySecret,
+ }
: {}),
},
body: JSON.stringify(tur),
@@ -644,8 +651,8 @@ async function uploadSecret(
[ANASTASIS_HTTP_HEADER_POLICY_META_DATA]: metadataEnc,
...(paySecret
? {
- "Anastasis-Payment-Identifier": paySecret,
- }
+ "Anastasis-Payment-Identifier": paySecret,
+ }
: {}),
},
body: decodeCrock(encRecoveryDoc),
@@ -656,12 +663,12 @@ async function uploadSecret(
let policyExpiration: TalerProtocolTimestamp = { t_s: 0 };
try {
policyVersion = Number(resp.headers.get("Anastasis-Version") ?? "0");
- } catch (e) {}
+ } catch (e) { }
try {
policyExpiration = {
t_s: Number(resp.headers.get("Anastasis-Policy-Expiration") ?? "0"),
};
- } catch (e) {}
+ } catch (e) { }
successDetails[prov.provider_url] = {
policy_version: policyVersion,
policy_expiration: policyExpiration,
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.