@api-encrypt/sdk
Advanced tools
Comparing version 0.0.9 to 0.0.10
{ | ||
"name": "@api-encrypt/sdk", | ||
"version": "0.0.9", | ||
"version": "0.0.10", | ||
"type": "commonjs", | ||
@@ -5,0 +5,0 @@ "dependencies": { |
@@ -103,6 +103,7 @@ "use strict"; | ||
}); | ||
// get header `x-api-encrypt-key` | ||
encryptedSecretKey = response.headers.get('x-api-encrypt-key') || ''; | ||
const { data: responseData, message: responseMessage } = yield response.json(); | ||
data = responseData; | ||
const { data: responseDataString, message: responseMessage } = yield response.json(); | ||
const responseDecoded = atob(responseDataString); | ||
const responseJson = JSON.parse(responseDecoded); | ||
data = responseJson.encryptedData; | ||
encryptedSecretKey = responseJson.encryptedSecretKey; | ||
message = responseMessage; | ||
@@ -113,2 +114,5 @@ } | ||
} | ||
if (!encryptedSecretKey) { | ||
throw Error('request api encrypt error: encryptedSecretKey is undefined'); | ||
} | ||
// decode secret key | ||
@@ -115,0 +119,0 @@ try { |
Sorry, the diff of this file is not supported yet
13701
174
1