@@ -77,6 +77,46 @@ function getKMSProviderCredentials(kmsProviderName) {
77
77
}
78
78
}
79
79
80
+ function getCustomerMasterKeyCredentials ( kmsProviderString ) {
81
+ let customerMasterKeyCredentials ;
82
+ switch ( kmsProviderString ) {
83
+ case "aws" :
84
+ // start-aws-cmk-credentials
85
+ customerMasterKeyCredentials = {
86
+ key : process . env [ "AWS_KEY_ARN" ] , // Your AWS Key ARN
87
+ region : process . env [ "AWS_KEY_REGION" ] , // Your AWS Key Region
88
+ } ;
89
+ // end-aws-cmk-credentials
90
+ return customerMasterKeyCredentials ;
91
+ case "azure" :
92
+ // start-azure-cmk-credentials
93
+ customerMasterKeyCredentials = {
94
+ keyVaultEndpoint : process . env [ "AZURE_KEY_VAULT_ENDPOINT" ] , // Your Azure Key Vault Endpoint
95
+ keyName : process . env [ "AZURE_KEY_NAME" ] , // Your Azure Key Name
96
+ } ;
97
+ // end-azure-cmk-credentials
98
+ return customerMasterKeyCredentials ;
99
+ case "gcp" :
100
+ // start-gcp-cmk-credentials
101
+ customerMasterKeyCredentials = {
102
+ projectId : process . env [ "GCP_PROJECT_ID" ] , // Your GCP Project ID
103
+ location : process . env [ "GCP_LOCATION" ] , // Your GCP Key Location
104
+ keyRing : process . env [ "GCP_KEY_RING" ] , // Your GCP Key Ring
105
+ keyName : process . env [ "GCP_KEY_NAME" ] , // Your GCP Key Name
106
+ } ;
107
+ // end-gcp-cmk-credentials
108
+ return customerMasterKeyCredentials ;
109
+ case "kmip" :
110
+ case "local" :
111
+ // start-kmip-local-cmk-credentials
112
+ customerMasterKeyCredentials = { } ;
113
+ // end-kmip-local-cmk-credentials
114
+ return customerMasterKeyCredentials ;
115
+ default :
116
+ throw new Error ( "Invalid KMS provider name" ) ;
117
+ }
118
+ }
119
+
80
120
async function getAutoEncryptionOptions (
81
121
kmsProviderName ,
82
122
keyVaultNamespace ,
0 commit comments