Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function rawAesEncryptedDataKey (
keyNamespace: string,
keyName: string,
iv: Uint8Array,
ciphertext: Uint8Array,
authTag: Uint8Array
): EncryptedDataKey {
const ivLength = iv.byteLength
const authTagBitLength = authTag.byteLength * 8
const encryptedDataKey = concatBuffers(ciphertext, authTag)
const providerId = keyNamespace
const rawInfo = concatBuffers(fromUtf8(keyName), uInt32BE(authTagBitLength), uInt32BE(ivLength), iv)
const providerInfo = toUtf8(rawInfo)
return new EncryptedDataKey({ encryptedDataKey, providerId, providerInfo, rawInfo })
}
}