MCPcopy Create free account
hub / github.com/mongodb/mongo-python-driver / get_key

Method get_key

pymongo/synchronous/encryption.py:1088–1101  ·  view source on GitHub ↗

Get a data key by id. :param id` (Binary): The UUID of a key a which must be a :class:`~bson.binary.Binary` with subtype 4 ( :attr:`~bson.binary.UUID_SUBTYPE`). :return: The key document. .. versionadded:: 4.2

(self, id: Binary)

Source from the content-addressed store, hash-verified

1086 return decode(decrypted_doc, codec_options=self._codec_options)["v"]
1087
1088 def get_key(self, id: Binary) -> Optional[RawBSONDocument]:
1089 """Get a data key by id.
1090
1091 :param id` (Binary): The UUID of a key a which must be a
1092 :class:`~bson.binary.Binary` with subtype 4 (
1093 :attr:`~bson.binary.UUID_SUBTYPE`).
1094
1095 :return: The key document.
1096
1097 .. versionadded:: 4.2
1098 """
1099 self._check_closed()
1100 assert self._key_vault_coll is not None
1101 return self._key_vault_coll.find_one({"_id": id})
1102
1103 def get_keys(self) -> Cursor[RawBSONDocument]:
1104 """Get all of the data keys.

Callers

nothing calls this directly

Calls 2

_check_closedMethod · 0.95
find_oneMethod · 0.45

Tested by

no test coverage detected