UNPKG

@azure/cosmos

Version:
67 lines (66 loc) 2.92 kB
var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __hasOwnProp = Object.prototype.hasOwnProperty; var __export = (target, all) => { for (var name in all) __defProp(target, name, { get: all[name], enumerable: true }); }; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); } return to; }; var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); var EncryptionSettingForProperty_exports = {}; __export(EncryptionSettingForProperty_exports, { EncryptionSettingForProperty: () => EncryptionSettingForProperty }); module.exports = __toCommonJS(EncryptionSettingForProperty_exports); var import_AeadAes256CbcHmacSha256Algorithm = require("./AeadAes256CbcHmacSha256Algorithm/index.js"); class EncryptionSettingForProperty { // client encryption key id. encryptionKeyId; // encryption type - Deterministic/Randomized. encryptionType; // encryption algorithm - AEAD_AES_256_CBC_HMAC_SHA256 encryptionAlgorithm; constructor(clientEncryptionIncludedPath) { this.encryptionKeyId = clientEncryptionIncludedPath.clientEncryptionKeyId; this.encryptionType = clientEncryptionIncludedPath.encryptionType; this.encryptionAlgorithm = clientEncryptionIncludedPath.encryptionAlgorithm; } async buildEncryptionAlgorithm(clientEncryptionKeyProperties, encryptionManager, forceRefresh) { const protectedDataEncryptionKey = await this.buildProtectedDataEncryptionKey( clientEncryptionKeyProperties, encryptionManager, forceRefresh ); const encryptionAlgorithm = new import_AeadAes256CbcHmacSha256Algorithm.AeadAes256CbcHmacSha256Algorithm( protectedDataEncryptionKey, this.encryptionType ); return encryptionAlgorithm; } async buildProtectedDataEncryptionKey(clientEncryptionKeyProperties, encryptionManager, forceRefresh) { const keyEncryptionKey = encryptionManager.keyEncryptionKeyCache.getOrCreate( clientEncryptionKeyProperties.encryptionKeyWrapMetadata.name, clientEncryptionKeyProperties.encryptionKeyWrapMetadata.value, encryptionManager.encryptionKeyStoreProvider ); const protectedDataEncryptionKey = await encryptionManager.protectedDataEncryptionKeyCache.getOrCreate( this.encryptionKeyId, keyEncryptionKey, clientEncryptionKeyProperties.wrappedDataEncryptionKey, forceRefresh ); return protectedDataEncryptionKey; } } // Annotate the CommonJS export names for ESM import in node: 0 && (module.exports = { EncryptionSettingForProperty });