Skip to content

Commit

Permalink
Add stubs in ClientEncryption class
Browse files Browse the repository at this point in the history
  • Loading branch information
alcaeus authored and isfedorov committed Jul 14, 2023
1 parent 9bdfbf5 commit 614f009
Showing 1 changed file with 74 additions and 2 deletions.
76 changes: 74 additions & 2 deletions mongodb/ClientEncryption.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,16 @@ final private function __construct() {}

final public function __wakeup() {}

/**
* Adds an alternate name to a key document
* @link https://www.php.net/manual/en/mongodb-driver-clientencryption.addkeyaltname.php
* @param \MongoDB\BSON\Binary $keyId A MongoDB\BSON\Binary instance with subtype 4 (UUID) identifying the key document.
* @param string $keyAltName Alternate name to add to the key document.
* @return object|null Returns the previous version of the key document, or null if no document matched.
* @throws InvalidArgumentException On argument parsing errors.
*/
final public function addKeyAltName(\MongoDB\BSON\Binary $keyId, string $keyAltName): ?object {}

/**
* Creates a new key document and inserts into the key vault collection.
* @link https://www.php.net/manual/en/mongodb-driver-clientencryption.createdatakey.php
Expand All @@ -38,7 +48,16 @@ final public function createDataKey($kmsProvider, ?array $options = []) {}
* @throws InvalidArgumentException On argument parsing errors.
* @throws EncryptionException If an error occurs while decrypting the value.
*/
final public function decrypt(\MongoDB\BSON\BinaryInterface $keyVaultClient) {}
final public function decrypt(\MongoDB\BSON\Binary $keyVaultClient) {}

/**
* Deletes a key document
* @link https://www.php.net/manual/en/mongodb-driver-clientencryption.deletekey.php
* @param \MongoDB\BSON\Binary $keyId A MongoDB\BSON\Binary instance with subtype 4 (UUID) identifying the key document.
* @return object Returns the result of the internal deleteOne operation on the key vault collection.
* @throws InvalidArgumentException On argument parsing errors.
*/
final public function deleteKey(\MongoDB\BSON\Binary $keyId): object {}

/**
* Encrypts a value with a given key and algorithm.
Expand All @@ -49,5 +68,58 @@ final public function decrypt(\MongoDB\BSON\BinaryInterface $keyVaultClient) {}
* @throws InvalidArgumentException On argument parsing errors.
* @throws EncryptionException If an error occurs while encrypting the value.
*/
final public function encrypt($value, ?array $options = []) {}
final public function encrypt($value, ?array $options = []): \MongoDB\BSON\Binary {}

/**
* Encrypts a Match Expression or Aggregate Expression to query a range index
* @param array|object $expr A BSON document containing the expression
* @param array|null $options
* @return object Returns the encrypted expression as a BSON document
* @throws InvalidArgumentException On argument parsing errors.
*/
final public function encryptExpression(array|object $expr, ?array $options = null): object {}

/**
* Gets a key document
* @link https://www.php.net/manual/en/mongodb-driver-clientencryption.getkey.php
* @param \MongoDB\BSON\Binary $keyId A MongoDB\BSON\Binary instance with subtype 4 (UUID) identifying the key document.
* @return object|null Returns the key document, or null if no document matched.
* @throws InvalidArgumentException On argument parsing errors.
*/
final public function getKey(\MongoDB\BSON\Binary $keyId): ?object {}

/**
* Gets a key document by an alternate name
* @link https://www.php.net/manual/en/mongodb-driver-clientencryption.getkeybyaltname.php
* @param string $keyAltName Alternate name for the key document.
* @return object|null Returns the key document, or null if no document matched.
* @throws InvalidArgumentException On argument parsing errors.
*/
final public function getKeyByAltName(string $keyAltName): ?object {}

/**
* Finds all key documents in the key vault collection.
* @link https://www.php.net/manual/en/mongodb-driver-clientencryption.getkeys.php
* @return Cursor
* @throws InvalidArgumentException On argument parsing errors.
*/
final public function getKeys(): Cursor {}

/**
* Removes an alternate name from a key document
* @link https://www.php.net/manual/en/mongodb-driver-clientencryption.removekeyaltname.php
* @param \MongoDB\BSON\Binary $keyId A MongoDB\BSON\Binary instance with subtype 4 (UUID) identifying the key document.
* @param string $keyAltName Alternate name to remove from the key document.
* @return object|null Returns the previous version of the key document, or null if no document matched.
*/
final public function removeKeyAltName(\MongoDB\BSON\Binary $keyId, string $keyAltName): ?object {}

/**
* Rewraps data keys
* @link https://www.php.net/manual/en/mongodb-driver-clientencryption.rewrapmanydatakey.php
* @param array|object $filter
* @param array|null $options
* @return object Returns an object, which will have an optional bulkWriteResult property containing the result of the internal bulkWrite operation as an object. If no data keys matched the filter or the write was unacknowledged, the bulkWriteResult property will be null.
*/
final public function rewrapManyDataKey(array|object $filter, ?array $options = null): object {}
}

0 comments on commit 614f009

Please sign in to comment.