kms-utils.js
function encryptKey(kms, keyId, plaintext, logger) {
  const params = {KeyId: keyId, Plaintext: plaintext};
  return encrypt(kms, params, logger).then(result => result.CiphertextBlob && result.CiphertextBlob.toString('base64'));
}
function encryptKey(kms, keyId, plaintext, logger) {
  const params = {KeyId: keyId, Plaintext: plaintext};
  return encrypt(kms, params, logger).then(result => result.CiphertextBlob && result.CiphertextBlob.toString('base64'));
}
function encryptKey ( kms , keyId , plaintext , logger ) { const params = { KeyId : keyId , Plaintext : plaintext } ; return encrypt ( kms , params , logger ) . then ( result => result . CiphertextBlob && result . CiphertextBlob . toString ( 'base64' ) ) ; }
Encrypts the given plaintext using the given AWS.KMS instance & returns the encrypted ciphertext.
@param {AWS.KMS} kms - an AWS.KMS instance to use
@param {string} keyId - the identifier of the CMK to use for encryption. You can use the key ID or Amazon Resource Name (ARN) of the CMK, or the name or ARN of an alias that refers to the CMK.
@param {string} plaintext - the plaintext to encrypt
@param {Logger|console|undefined} [logger] - an optional logger to use (defaults to console if omitted)
@returns {Promise.<string>} a promise of the encrypted ciphertext
Encrypts the given plaintext using the given AWS . KMS instance & returns the encrypted ciphertext .