mirror of
https://github.com/hashicorp/vault.git
synced 2025-08-18 12:37:02 +02:00
22 lines
704 B
JavaScript
22 lines
704 B
JavaScript
/**
|
|
* Copyright (c) HashiCorp, Inc.
|
|
* SPDX-License-Identifier: MPL-2.0
|
|
*/
|
|
|
|
/**
|
|
* 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'];
|
|
} else if (type === 'exported') {
|
|
fields = [...fields, 'privateKeyFormat'];
|
|
}
|
|
return fields;
|
|
}
|