Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
qingyang-hu committed Sep 26, 2023
1 parent 5202542 commit f35a93a
Show file tree
Hide file tree
Showing 11 changed files with 268 additions and 548 deletions.
26 changes: 25 additions & 1 deletion mongo/client_encryption.go
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,31 @@ func (ce *ClientEncryption) CreateDataKey(ctx context.Context, kmsProvider strin

// transformExplicitEncryptionOptions creates explicit encryption options to be passed to libmongocrypt.
func transformExplicitEncryptionOptions(opts ...*options.EncryptOptions) *mcopts.ExplicitEncryptionOptions {
eo := options.MergeEncryptOptions(opts...)
eo := options.Encrypt()
for _, opt := range opts {
if opt == nil {
continue
}

if opt.KeyID != nil {
eo.KeyID = opt.KeyID
}
if opt.KeyAltName != nil {
eo.KeyAltName = opt.KeyAltName
}
if opt.Algorithm != "" {
eo.Algorithm = opt.Algorithm
}
if opt.QueryType != "" {
eo.QueryType = opt.QueryType
}
if opt.ContentionFactor != nil {
eo.ContentionFactor = opt.ContentionFactor
}
if opt.RangeOptions != nil {
eo.RangeOptions = opt.RangeOptions
}
}
transformed := mcopts.ExplicitEncryption()
if eo.KeyID != nil {
transformed.SetKeyID(*eo.KeyID)
Expand Down
Loading

0 comments on commit f35a93a

Please sign in to comment.