mirror of
https://github.com/optim-enterprises-bv/vault.git
synced 2026-01-07 20:51:28 +00:00
21 lines
537 B
JavaScript
21 lines
537 B
JavaScript
/**
|
|
* Copyright (c) HashiCorp, Inc.
|
|
* SPDX-License-Identifier: BUSL-1.1
|
|
*/
|
|
|
|
/**
|
|
* Method to check whether the secret value is a nested object (returns true)
|
|
* All other values return false
|
|
* @param value string or stringified JSON
|
|
* @returns boolean
|
|
*/
|
|
export function isAdvancedSecret(value) {
|
|
try {
|
|
const obj = typeof value === 'string' ? JSON.parse(value) : value;
|
|
if (Array.isArray(obj)) return false;
|
|
return Object.values(obj).any((value) => typeof value !== 'string');
|
|
} catch (e) {
|
|
return false;
|
|
}
|
|
}
|