Skip to content

Commit 5259d80

Browse files
GODRIVER-2473 Remove ClientEncryption.createKey() in favor of createDataKey() (#1008)
Co-authored-by: Kevin Albertson <[email protected]> Co-authored-by: Kevin Albertson <[email protected]>
1 parent d3cf243 commit 5259d80

File tree

9 files changed

+52
-56
lines changed

9 files changed

+52
-56
lines changed

data/client-side-encryption/unified/createKey-kms_providers-invalid.json renamed to data/client-side-encryption/unified/createDataKey-kms_providers-invalid.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"description": "createKey-provider-invalid",
2+
"description": "createDataKey-provider-invalid",
33
"schemaVersion": "1.8",
44
"runOnRequirements": [
55
{
@@ -35,7 +35,7 @@
3535
"description": "create data key without required master key fields",
3636
"operations": [
3737
{
38-
"name": "createKey",
38+
"name": "createDataKey",
3939
"object": "clientEncryption0",
4040
"arguments": {
4141
"kmsProvider": "aws",
@@ -59,7 +59,7 @@
5959
"description": "create data key with invalid master key field",
6060
"operations": [
6161
{
62-
"name": "createKey",
62+
"name": "createDataKey",
6363
"object": "clientEncryption0",
6464
"arguments": {
6565
"kmsProvider": "local",
@@ -85,7 +85,7 @@
8585
"description": "create data key with invalid master key",
8686
"operations": [
8787
{
88-
"name": "createKey",
88+
"name": "createDataKey",
8989
"object": "clientEncryption0",
9090
"arguments": {
9191
"kmsProvider": "aws",
@@ -109,4 +109,4 @@
109109
]
110110
}
111111
]
112-
}
112+
}

data/client-side-encryption/unified/createKey-kms_providers-invalid.yml renamed to data/client-side-encryption/unified/createDataKey-kms_providers-invalid.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
description: createKey-provider-invalid
1+
description: createDataKey-provider-invalid
22

33
schemaVersion: "1.8"
44

@@ -23,7 +23,7 @@ createEntities:
2323
tests:
2424
- description: create data key without required master key fields
2525
operations:
26-
- name: createKey
26+
- name: createDataKey
2727
object: *clientEncryption0
2828
arguments:
2929
kmsProvider: aws
@@ -37,7 +37,7 @@ tests:
3737

3838
- description: create data key with invalid master key field
3939
operations:
40-
- name: createKey
40+
- name: createDataKey
4141
object: *clientEncryption0
4242
arguments:
4343
kmsProvider: local
@@ -52,7 +52,7 @@ tests:
5252

5353
- description: create data key with invalid master key
5454
operations:
55-
- name: createKey
55+
- name: createDataKey
5656
object: *clientEncryption0
5757
arguments:
5858
kmsProvider: aws
@@ -64,4 +64,4 @@ tests:
6464
isClientError: true
6565
expectEvents:
6666
- client: *client0
67-
events: []
67+
events: []

data/client-side-encryption/unified/createKey.json renamed to data/client-side-encryption/unified/createDataKey.json

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"description": "createKey",
2+
"description": "createDataKey",
33
"schemaVersion": "1.8",
44
"runOnRequirements": [
55
{
@@ -90,7 +90,7 @@
9090
"description": "create data key with AWS KMS provider",
9191
"operations": [
9292
{
93-
"name": "createKey",
93+
"name": "createDataKey",
9494
"object": "clientEncryption0",
9595
"arguments": {
9696
"kmsProvider": "aws",
@@ -153,7 +153,7 @@
153153
"description": "create datakey with Azure KMS provider",
154154
"operations": [
155155
{
156-
"name": "createKey",
156+
"name": "createDataKey",
157157
"object": "clientEncryption0",
158158
"arguments": {
159159
"kmsProvider": "azure",
@@ -216,7 +216,7 @@
216216
"description": "create datakey with GCP KMS provider",
217217
"operations": [
218218
{
219-
"name": "createKey",
219+
"name": "createDataKey",
220220
"object": "clientEncryption0",
221221
"arguments": {
222222
"kmsProvider": "gcp",
@@ -283,7 +283,7 @@
283283
"description": "create datakey with KMIP KMS provider",
284284
"operations": [
285285
{
286-
"name": "createKey",
286+
"name": "createDataKey",
287287
"object": "clientEncryption0",
288288
"arguments": {
289289
"kmsProvider": "kmip"
@@ -341,7 +341,7 @@
341341
"description": "create datakey with local KMS provider",
342342
"operations": [
343343
{
344-
"name": "createKey",
344+
"name": "createDataKey",
345345
"object": "clientEncryption0",
346346
"arguments": {
347347
"kmsProvider": "local"
@@ -396,7 +396,7 @@
396396
"description": "create datakey with no keyAltName",
397397
"operations": [
398398
{
399-
"name": "createKey",
399+
"name": "createDataKey",
400400
"object": "clientEncryption0",
401401
"arguments": {
402402
"kmsProvider": "local",
@@ -457,7 +457,7 @@
457457
"description": "create datakey with single keyAltName",
458458
"operations": [
459459
{
460-
"name": "createKey",
460+
"name": "createDataKey",
461461
"object": "clientEncryption0",
462462
"arguments": {
463463
"kmsProvider": "local",
@@ -520,7 +520,7 @@
520520
"description": "create datakey with multiple keyAltNames",
521521
"operations": [
522522
{
523-
"name": "createKey",
523+
"name": "createDataKey",
524524
"object": "clientEncryption0",
525525
"arguments": {
526526
"kmsProvider": "local",
@@ -619,7 +619,7 @@
619619
"description": "create datakey with custom key material",
620620
"operations": [
621621
{
622-
"name": "createKey",
622+
"name": "createDataKey",
623623
"object": "clientEncryption0",
624624
"arguments": {
625625
"kmsProvider": "local",
@@ -682,7 +682,7 @@
682682
"description": "create datakey with invalid custom key material (too short)",
683683
"operations": [
684684
{
685-
"name": "createKey",
685+
"name": "createDataKey",
686686
"object": "clientEncryption0",
687687
"arguments": {
688688
"kmsProvider": "local",
@@ -708,4 +708,4 @@
708708
]
709709
}
710710
]
711-
}
711+
}

data/client-side-encryption/unified/createKey.yml renamed to data/client-side-encryption/unified/createDataKey.yml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
description: createKey
1+
description: createDataKey
22

33
schemaVersion: "1.8"
44

@@ -38,7 +38,7 @@ initialData:
3838
tests:
3939
- description: create data key with AWS KMS provider
4040
operations:
41-
- name: createKey
41+
- name: createDataKey
4242
object: *clientEncryption0
4343
arguments:
4444
kmsProvider: aws
@@ -67,7 +67,7 @@ tests:
6767

6868
- description: create datakey with Azure KMS provider
6969
operations:
70-
- name: createKey
70+
- name: createDataKey
7171
object: *clientEncryption0
7272
arguments:
7373
kmsProvider: azure
@@ -96,7 +96,7 @@ tests:
9696

9797
- description: create datakey with GCP KMS provider
9898
operations:
99-
- name: createKey
99+
- name: createDataKey
100100
object: *clientEncryption0
101101
arguments:
102102
kmsProvider: gcp
@@ -127,7 +127,7 @@ tests:
127127

128128
- description: create datakey with KMIP KMS provider
129129
operations:
130-
- name: createKey
130+
- name: createDataKey
131131
object: *clientEncryption0
132132
arguments:
133133
kmsProvider: kmip
@@ -152,7 +152,7 @@ tests:
152152

153153
- description: create datakey with local KMS provider
154154
operations:
155-
- name: createKey
155+
- name: createDataKey
156156
object: *clientEncryption0
157157
arguments:
158158
kmsProvider: local
@@ -176,7 +176,7 @@ tests:
176176

177177
- description: create datakey with no keyAltName
178178
operations:
179-
- name: createKey
179+
- name: createDataKey
180180
object: *clientEncryption0
181181
arguments:
182182
kmsProvider: local
@@ -203,7 +203,7 @@ tests:
203203

204204
- description: create datakey with single keyAltName
205205
operations:
206-
- name: createKey
206+
- name: createDataKey
207207
object: *clientEncryption0
208208
arguments:
209209
kmsProvider: local
@@ -229,7 +229,7 @@ tests:
229229

230230
- description: create datakey with multiple keyAltNames
231231
operations:
232-
- name: createKey
232+
- name: createDataKey
233233
object: *clientEncryption0
234234
arguments:
235235
kmsProvider: local
@@ -268,7 +268,7 @@ tests:
268268

269269
- description: create datakey with custom key material
270270
operations:
271-
- name: createKey
271+
- name: createDataKey
272272
object: *clientEncryption0
273273
arguments:
274274
kmsProvider: local
@@ -295,7 +295,7 @@ tests:
295295

296296
- description: create datakey with invalid custom key material (too short)
297297
operations:
298-
- name: createKey
298+
- name: createDataKey
299299
object: *clientEncryption0
300300
arguments:
301301
kmsProvider: local
@@ -306,4 +306,4 @@ tests:
306306
isClientError: true
307307
expectEvents:
308308
- client: *client0
309-
events: []
309+
events: []

data/client-side-encryption/unified/getKeys.json

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
2+
13
{
24
"description": "getKeys",
35
"schemaVersion": "1.8",
@@ -87,7 +89,7 @@
8789
"description": "getKeys with single key documents",
8890
"operations": [
8991
{
90-
"name": "createKey",
92+
"name": "createDataKey",
9193
"object": "clientEncryption0",
9294
"arguments": {
9395
"kmsProvider": "local",
@@ -160,7 +162,7 @@
160162
"description": "getKeys with many key documents",
161163
"operations": [
162164
{
163-
"name": "createKey",
165+
"name": "createDataKey",
164166
"object": "clientEncryption0",
165167
"arguments": {
166168
"kmsProvider": "local"
@@ -170,7 +172,7 @@
170172
}
171173
},
172174
{
173-
"name": "createKey",
175+
"name": "createDataKey",
174176
"object": "clientEncryption0",
175177
"arguments": {
176178
"kmsProvider": "local"
@@ -257,4 +259,4 @@
257259
]
258260
}
259261
]
260-
}
262+
}

data/client-side-encryption/unified/getKeys.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ tests:
4949

5050
- description: getKeys with single key documents
5151
operations:
52-
- name: createKey
52+
- name: createDataKey
5353
object: *clientEncryption0
5454
arguments:
5555
kmsProvider: local
@@ -80,12 +80,12 @@ tests:
8080

8181
- description: getKeys with many key documents
8282
operations:
83-
- name: createKey
83+
- name: createDataKey
8484
object: *clientEncryption0
8585
arguments:
8686
kmsProvider: local
8787
expectResult: { $$type: binData }
88-
- name: createKey
88+
- name: createDataKey
8989
object: *clientEncryption0
9090
arguments:
9191
kmsProvider: local
@@ -119,4 +119,4 @@ tests:
119119
command:
120120
find: *collection0Name
121121
filter: {}
122-
readConcern: { level: majority }
122+
readConcern: { level: majority }

mongo/client_encryption.go

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -80,15 +80,9 @@ func (ce *ClientEncryption) AddKeyAltName(ctx context.Context, id primitive.Bina
8080
return ce.keyVaultColl.FindOneAndUpdate(ctx, filter, update)
8181
}
8282

83-
// CreateDataKey is an alias function equivalent to CreateKey.
84-
func (ce *ClientEncryption) CreateDataKey(ctx context.Context, kmsProvider string,
85-
opts ...*options.DataKeyOptions) (primitive.Binary, error) {
86-
return ce.CreateKey(ctx, kmsProvider, opts...)
87-
}
88-
89-
// CreateKey creates a new key document and inserts into the key vault collection. Returns the _id of the created
83+
// CreateDataKey creates a new key document and inserts into the key vault collection. Returns the _id of the created
9084
// document as a UUID (BSON binary subtype 0x04).
91-
func (ce *ClientEncryption) CreateKey(ctx context.Context, kmsProvider string,
85+
func (ce *ClientEncryption) CreateDataKey(ctx context.Context, kmsProvider string,
9286
opts ...*options.DataKeyOptions) (primitive.Binary, error) {
9387

9488
// translate opts to mcopts.DataKeyOptions

0 commit comments

Comments
 (0)