domains: remove SECRET_PLACEHOLDER from responses
This commit is contained in:
@@ -1,15 +1,5 @@
|
||||
'use strict';
|
||||
|
||||
exports = module.exports = {
|
||||
removePrivateFields,
|
||||
injectPrivateFields,
|
||||
upsert,
|
||||
get,
|
||||
del,
|
||||
wait,
|
||||
verifyDomainConfig
|
||||
};
|
||||
|
||||
const assert = require('node:assert'),
|
||||
BoxError = require('../boxerror.js'),
|
||||
constants = require('../constants.js'),
|
||||
@@ -25,12 +15,12 @@ function formatError(error) {
|
||||
}
|
||||
|
||||
function removePrivateFields(domainObject) {
|
||||
domainObject.config.appSecret = constants.SECRET_PLACEHOLDER;
|
||||
delete domainObject.config.appSecret;
|
||||
return domainObject;
|
||||
}
|
||||
|
||||
function injectPrivateFields(newConfig, currentConfig) {
|
||||
if (newConfig.appSecret === constants.SECRET_PLACEHOLDER) newConfig.appSecret = currentConfig.appSecret;
|
||||
if (!Object.hasOwn(newConfig, 'appSecret')) newConfig.appSecret = currentConfig.appSecret;
|
||||
}
|
||||
|
||||
function createClient(domainConfig) {
|
||||
@@ -234,3 +224,13 @@ async function verifyDomainConfig(domainObject) {
|
||||
|
||||
return credentials;
|
||||
}
|
||||
|
||||
exports = module.exports = {
|
||||
removePrivateFields,
|
||||
injectPrivateFields,
|
||||
upsert,
|
||||
get,
|
||||
del,
|
||||
wait,
|
||||
verifyDomainConfig
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user