package mongocrypt
import "go.mongodb.org/mongo-driver/x/mongo/driver/mongocrypt"
Index ¶
- type Context
- func (c *Context) AddOperationResult(result bsoncore.Document) error
- func (c *Context) Close()
- func (c *Context) CompleteOperation() error
- func (c *Context) Finish() (bsoncore.Document, error)
- func (c *Context) FinishKmsContexts() error
- func (c *Context) NextKmsContext() *KmsContext
- func (c *Context) NextOperation() (bsoncore.Document, error)
- func (c *Context) State() State
- type Error
- type KmsContext
- func (kc *KmsContext) BytesNeeded() int32
- func (kc *KmsContext) FeedResponse(response []byte) error
- func (kc *KmsContext) HostName() (string, error)
- func (kc *KmsContext) Message() ([]byte, error)
- type MongoCrypt
- func NewMongoCrypt(opts *options.MongoCryptOptions) (*MongoCrypt, error)
- func (m *MongoCrypt) Close()
- func (m *MongoCrypt) CreateDataKeyContext(kmsProvider string, opts *options.DataKeyOptions) (*Context, error)
- func (m *MongoCrypt) CreateDecryptionContext(cmd bsoncore.Document) (*Context, error)
- func (m *MongoCrypt) CreateEncryptionContext(db string, cmd bsoncore.Document) (*Context, error)
- func (m *MongoCrypt) CreateExplicitDecryptionContext(doc bsoncore.Document) (*Context, error)
- func (m *MongoCrypt) CreateExplicitEncryptionContext(doc bsoncore.Document, opts *options.ExplicitEncryptionOptions) (*Context, error)
- type State
Types ¶
type Context ¶
type Context struct{}
Context represents a mongocrypt_ctx_t handle
func (*Context) AddOperationResult ¶
AddOperationResult feeds the result of a database operation to mongocrypt.
func (*Context) Close ¶
func (c *Context) Close()
Close cleans up any resources associated with the given Context instance.
func (*Context) CompleteOperation ¶
CompleteOperation signals a database operation has been completed.
func (*Context) Finish ¶
Finish performs the final operations for the context and returns the resulting document.
func (*Context) FinishKmsContexts ¶
FinishKmsContexts signals that all KMS contexts have been completed.
func (*Context) NextKmsContext ¶
func (c *Context) NextKmsContext() *KmsContext
NextKmsContext returns the next KmsContext, or nil if there are no more.
func (*Context) NextOperation ¶
NextOperation gets the document for the next database operation to run.
func (*Context) State ¶
State returns the current State of the Context.
type Error ¶
Error represents an error from an operation on a MongoCrypt instance.
func (Error) Error ¶
Error implements the error interface
type KmsContext ¶
type KmsContext struct{}
KmsContext represents a mongocrypt_kms_ctx_t handle.
func (*KmsContext) BytesNeeded ¶
func (kc *KmsContext) BytesNeeded() int32
BytesNeeded returns the number of bytes that should be received from the KMS. After sending the message to the KMS, this message should be called in a loop until the number returned is 0.
func (*KmsContext) FeedResponse ¶
func (kc *KmsContext) FeedResponse(response []byte) error
FeedResponse feeds the bytes received from the KMS to mongocrypt.
func (*KmsContext) HostName ¶
func (kc *KmsContext) HostName() (string, error)
HostName gets the host name of the KMS.
func (*KmsContext) Message ¶
func (kc *KmsContext) Message() ([]byte, error)
Message returns the message to send to the KMS.
type MongoCrypt ¶
type MongoCrypt struct{}
MongoCrypt represents a mongocrypt_t handle.
func NewMongoCrypt ¶
func NewMongoCrypt(opts *options.MongoCryptOptions) (*MongoCrypt, error)
NewMongoCrypt constructs a new MongoCrypt instance configured using the provided MongoCryptOptions.
func (*MongoCrypt) Close ¶
func (m *MongoCrypt) Close()
Close cleans up any resources associated with the given MongoCrypt instance.
func (*MongoCrypt) CreateDataKeyContext ¶
func (m *MongoCrypt) CreateDataKeyContext(kmsProvider string, opts *options.DataKeyOptions) (*Context, error)
CreateDataKeyContext creates a Context to use for creating a data key.
func (*MongoCrypt) CreateDecryptionContext ¶
func (m *MongoCrypt) CreateDecryptionContext(cmd bsoncore.Document) (*Context, error)
CreateDecryptionContext creates a Context to use for decryption.
func (*MongoCrypt) CreateEncryptionContext ¶
CreateEncryptionContext creates a Context to use for encryption.
func (*MongoCrypt) CreateExplicitDecryptionContext ¶
func (m *MongoCrypt) CreateExplicitDecryptionContext(doc bsoncore.Document) (*Context, error)
CreateExplicitDecryptionContext creates a Context to use for explicit decryption.
func (*MongoCrypt) CreateExplicitEncryptionContext ¶
func (m *MongoCrypt) CreateExplicitEncryptionContext(doc bsoncore.Document, opts *options.ExplicitEncryptionOptions) (*Context, error)
CreateExplicitEncryptionContext creates a Context to use for explicit encryption.
type State ¶
type State int
State represents a state that a MongocryptContext can be in.
const ( StateError State = iota NeedMongoCollInfo NeedMongoMarkings NeedMongoKeys NeedKms Ready Done )
These constants are valid values for the State type.
func (State) String ¶
String implements the Stringer interface.
Source Files ¶
errors_not_enabled.go mongocrypt_context_not_enabled.go mongocrypt_kms_context_not_enabled.go mongocrypt_not_enabled.go state.go
Directories ¶
Path | Synopsis |
---|---|
x/mongo/driver/mongocrypt/options |
- Version
- v1.7.2
- Published
- Sep 2, 2021
- Platform
- js/wasm
- Imports
- 2 packages
- Last checked
- 1 minute ago –
Tools for package owners.