Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
readOnlyProperty(this, 'keyNamespace', keyNamespace)
readOnlyProperty(this, '_wrapKey', _wrapKey)
readOnlyProperty(this, '_unwrapKey', _unwrapKey)
}
_filter ({ providerId, providerInfo }: EncryptedDataKey) {
const { keyNamespace, keyName } = this
return providerId === keyNamespace && providerInfo.startsWith(keyName)
}
_onEncrypt = _onEncrypt(randomBytesAsync)
_onDecrypt = _onDecrypt()
}
immutableClass(RawAesKeyringNode)
const encryptFlags = KeyringTraceFlag.WRAPPING_KEY_ENCRYPTED_DATA_KEY | KeyringTraceFlag.WRAPPING_KEY_SIGNED_ENC_CTX
const decryptFlags = KeyringTraceFlag.WRAPPING_KEY_DECRYPTED_DATA_KEY | KeyringTraceFlag.WRAPPING_KEY_VERIFIED_ENC_CTX
/**
* Uses aes-gcm to encrypt the data key and return the passed NodeEncryptionMaterial with
* an EncryptedDataKey added.
* @param keyNamespace [String] The keyring namespace (for KeyringTrace)
* @param keyName [String] The keyring name (for KeyringTrace and to extract the extra info stored in providerInfo)
* @param material [NodeEncryptionMaterial] The target material to which the EncryptedDataKey will be added
* @param aad [Buffer] The serialized aad (EncryptionContext)
* @param wrappingMaterial [NodeRawAesMaterial] The material used to decrypt the EncryptedDataKey
* @returns [NodeEncryptionMaterial] Mutates and returns the same NodeEncryptionMaterial that was passed but with an EncryptedDataKey added
*/
function aesGcmWrapKey (
keyNamespace: string,
keyName: string,
material: NodeEncryptionMaterial,