mirror of
https://github.com/optim-enterprises-bv/vault.git
synced 2026-01-09 13:41:56 +00:00
20 lines
623 B
JavaScript
20 lines
623 B
JavaScript
/**
|
|
* Copyright (c) HashiCorp, Inc.
|
|
* SPDX-License-Identifier: BUSL-1.1
|
|
*/
|
|
|
|
/**
|
|
* keyParamsByType
|
|
* @param {string} type - refers to `type` attribute on the pki/action model. Should be one of 'exported', 'internal', 'existing', 'kms'
|
|
* @returns array of valid key-related attribute names (camelCase). NOTE: Key params are not used on all action endpoints
|
|
*/
|
|
export function keyParamsByType(type) {
|
|
let fields = ['keyName', 'keyType', 'keyBits'];
|
|
if (type === 'existing') {
|
|
fields = ['keyRef'];
|
|
} else if (type === 'kms') {
|
|
fields = ['keyName', 'managedKeyName', 'managedKeyId'];
|
|
}
|
|
return fields;
|
|
}
|