Skip to content

Commit

Permalink
Docblock cleanup.
Browse files Browse the repository at this point in the history
  • Loading branch information
paragonie-security committed Jan 15, 2018
1 parent ff17ec8 commit 9647486
Show file tree
Hide file tree
Showing 21 changed files with 75 additions and 90 deletions.
15 changes: 7 additions & 8 deletions src/Asymmetric/Crypto.php
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,7 @@ public static function decryptWithAd(
* @param bool $get_as_object Get as a Key object?
* @return HiddenString|Key
*
* @throws CannotPerformOperation
* @throws InvalidType
* @throws \TypeError
*/
public static function getSharedSecret(
EncryptionSecretKey $privateKey,
Expand Down Expand Up @@ -238,8 +237,8 @@ public static function getSharedSecret(
* @param mixed $encoding Which encoding scheme to use?
* @return string Ciphertext
*
* @throws CannotPerformOperation
* @throws InvalidType
* @throws \TypeError
*/
public static function seal(
HiddenString $plaintext,
Expand All @@ -265,8 +264,8 @@ public static function seal(
* @param mixed $encoding Which encoding scheme to use?
* @return string Signature (detached)
*
* @throws CannotPerformOperation
* @throws InvalidType
* @throws \TypeError
*/
public static function sign(
string $message,
Expand All @@ -292,9 +291,10 @@ public static function sign(
* @param PublicKey $recipientPublicKey Public encryption key
* @param mixed $encoding Which encoding scheme to use?
* @return string
* @throws CannotPerformOperation
*
* @throws InvalidKey
* @throws InvalidType
* @throws \TypeError
*/
public static function signAndEncrypt(
HiddenString $message,
Expand Down Expand Up @@ -324,10 +324,10 @@ public static function signAndEncrypt(
* @param mixed $encoding Which encoding scheme to use?
* @return HiddenString
*
* @throws CannotPerformOperation
* @throws InvalidKey
* @throws InvalidMessage
* @throws InvalidType
* @throws \TypeError
*/
public static function unseal(
string $ciphertext,
Expand Down Expand Up @@ -386,9 +386,9 @@ public static function unseal(
* @param mixed $encoding Which encoding scheme to use?
* @return bool
*
* @throws CannotPerformOperation
* @throws InvalidSignature
* @throws InvalidType
* @throws \TypeError
*/
public static function verify(
string $message,
Expand Down Expand Up @@ -424,7 +424,6 @@ public static function verify(
* @param mixed $encoding Which encoding scheme to use?
* @return HiddenString
*
* @throws CannotPerformOperation
* @throws InvalidKey
* @throws InvalidMessage
* @throws InvalidSignature
Expand Down
3 changes: 1 addition & 2 deletions src/Asymmetric/EncryptionPublicKey.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,8 @@ final class EncryptionPublicKey extends PublicKey
*
* @param HiddenString $keyMaterial - The actual key data
*
* @throws CannotPerformOperation
* @throws InvalidKey
* @throws InvalidType
* @throws \TypeError
*/
public function __construct(HiddenString $keyMaterial)
{
Expand Down
6 changes: 2 additions & 4 deletions src/Asymmetric/EncryptionSecretKey.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,8 @@ final class EncryptionSecretKey extends SecretKey
/**
* EncryptionSecretKey constructor.
* @param HiddenString $keyMaterial - The actual key data
* @throws CannotPerformOperation
* @throws InvalidKey
* @throws InvalidType
* @throws \TypeError
*/
public function __construct(HiddenString $keyMaterial)
{
Expand All @@ -42,8 +41,7 @@ public function __construct(HiddenString $keyMaterial)
*
* @return EncryptionPublicKey
*
* @throws CannotPerformOperation
* @throws InvalidType
* @throws \TypeError
*/
public function derivePublicKey()
{
Expand Down
3 changes: 1 addition & 2 deletions src/Asymmetric/PublicKey.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ class PublicKey extends Key
* PublicKey constructor.
* @param HiddenString $keyMaterial - The actual key data
*
* @throws CannotPerformOperation
* @throws InvalidType
* @throws \TypeError
*/
public function __construct(HiddenString $keyMaterial)
{
Expand Down
3 changes: 1 addition & 2 deletions src/Asymmetric/SecretKey.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ class SecretKey extends Key
* SecretKey constructor.
* @param HiddenString $keyMaterial - The actual key data
*
* @throws CannotPerformOperation
* @throws InvalidType
* @throws \TypeError
*/
public function __construct(HiddenString $keyMaterial)
{
Expand Down
6 changes: 2 additions & 4 deletions src/Asymmetric/SignaturePublicKey.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ final class SignaturePublicKey extends PublicKey
* @param HiddenString $keyMaterial - The actual key data
*
* @throws InvalidKey
* @throws CannotPerformOperation
* @throws InvalidType
* @throws \TypeError
*/
public function __construct(HiddenString $keyMaterial)
{
Expand All @@ -44,8 +43,7 @@ public function __construct(HiddenString $keyMaterial)
* Get an encryption public key from a signing public key.
*
* @return EncryptionPublicKey
* @throws CannotPerformOperation
* @throws InvalidType
* @throws \TypeError
*/
public function getEncryptionPublicKey(): EncryptionPublicKey
{
Expand Down
9 changes: 3 additions & 6 deletions src/Asymmetric/SignatureSecretKey.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ final class SignatureSecretKey extends SecretKey
* @param HiddenString $keyMaterial - The actual key data
*
* @throws InvalidKey
* @throws CannotPerformOperation
* @throws InvalidType
* @throws \TypeError
*/
public function __construct(HiddenString $keyMaterial)
{
Expand All @@ -44,8 +43,7 @@ public function __construct(HiddenString $keyMaterial)
* See the appropriate derived class.
*
* @return SignaturePublicKey
* @throws CannotPerformOperation
* @throws InvalidType
* @throws \TypeError
*/
public function derivePublicKey()
{
Expand All @@ -59,8 +57,7 @@ public function derivePublicKey()
* Get an encryption secret key from a signing secret key.
*
* @return EncryptionSecretKey
* @throws CannotPerformOperation
* @throws InvalidType
* @throws \TypeError
*/
public function getEncryptionSecretKey(): EncryptionSecretKey
{
Expand Down
1 change: 1 addition & 0 deletions src/Cookie.php
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ protected static function getConfig(string $stored): SymmetricConfig
* @throws CannotPerformOperation
* @throws InvalidMessage
* @throws InvalidType
* @throws \TypeError
*/
public function store(
string $name,
Expand Down
1 change: 1 addition & 0 deletions src/EncryptionKeyPair.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ final class EncryptionKeyPair extends KeyPair
* @throws InvalidType
* @throws InvalidKey
* @throws \InvalidArgumentException
* @throws \TypeError
*/
public function __construct(Key ...$keys)
{
Expand Down
37 changes: 29 additions & 8 deletions src/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use ParagonIE\Halite\Alerts\{
CannotPerformOperation,
FileAccessDenied,
FileError,
FileModified,
InvalidDigestLength,
InvalidKey,
Expand Down Expand Up @@ -66,9 +67,11 @@ final private function __construct()
*
* @throws CannotPerformOperation
* @throws FileAccessDenied
* @throws FileError
* @throws InvalidKey
* @throws InvalidMessage
* @throws InvalidType
* @throws \TypeError
*/
public static function checksum(
$filePath,
Expand Down Expand Up @@ -100,11 +103,12 @@ public static function checksum(
*
* @throws CannotPerformOperation
* @throws FileAccessDenied
* @throws FileError
* @throws FileModified
* @throws InvalidDigestLength
* @throws InvalidKey
* @throws InvalidMessage
* @throws InvalidType
* @throws \TypeError
*/
public static function encrypt(
$input,
Expand Down Expand Up @@ -142,11 +146,12 @@ public static function encrypt(
*
* @throws CannotPerformOperation
* @throws FileAccessDenied
* @throws FileError
* @throws FileModified
* @throws InvalidDigestLength
* @throws InvalidKey
* @throws InvalidMessage
* @throws InvalidType
* @throws \TypeError
*/
public static function decrypt(
$input,
Expand Down Expand Up @@ -232,6 +237,7 @@ public static function seal(
*
* @throws CannotPerformOperation
* @throws FileAccessDenied
* @throws FileError
* @throws FileModified
* @throws InvalidDigestLength
* @throws InvalidMessage
Expand Down Expand Up @@ -282,9 +288,11 @@ public static function unseal(
*
* @throws CannotPerformOperation
* @throws FileAccessDenied
* @throws FileError
* @throws InvalidKey
* @throws InvalidMessage
* @throws InvalidType
* @throws \TypeError
*/
public static function sign(
$filename,
Expand Down Expand Up @@ -317,10 +325,12 @@ public static function sign(
* @return bool
* @throws CannotPerformOperation
* @throws FileAccessDenied
* @throws FileError
* @throws InvalidKey
* @throws InvalidMessage
* @throws InvalidSignature
* @throws InvalidType
* @throws \TypeError
*/
public static function verify(
$filename,
Expand Down Expand Up @@ -354,9 +364,11 @@ public static function verify(
*
* @throws CannotPerformOperation
* @throws FileAccessDenied
* @throws FileError
* @throws InvalidKey
* @throws InvalidMessage
* @throws InvalidType
* @throws \TypeError
*/
protected static function checksumData(
StreamInterface $fileStream,
Expand Down Expand Up @@ -433,11 +445,12 @@ protected static function checksumData(
*
* @throws CannotPerformOperation
* @throws FileAccessDenied
* @throws FileError
* @throws FileModified
* @throws InvalidDigestLength
* @throws InvalidKey
* @throws InvalidMessage
* @throws InvalidType
* @throws \TypeError
*/
protected static function encryptData(
ReadOnlyFile $input,
Expand Down Expand Up @@ -502,11 +515,12 @@ protected static function encryptData(
*
* @throws CannotPerformOperation
* @throws FileAccessDenied
* @throws FileError
* @throws FileModified
* @throws InvalidDigestLength
* @throws InvalidKey
* @throws InvalidMessage
* @throws InvalidType
* @throws \TypeError
*/
protected static function decryptData(
ReadOnlyFile $input,
Expand Down Expand Up @@ -689,6 +703,7 @@ protected static function sealData(
*
* @throws CannotPerformOperation
* @throws FileAccessDenied
* @throws FileError
* @throws FileModified
* @throws InvalidDigestLength
* @throws InvalidMessage
Expand Down Expand Up @@ -798,9 +813,11 @@ protected static function unsealData(
*
* @throws CannotPerformOperation
* @throws FileAccessDenied
* @throws FileError
* @throws InvalidKey
* @throws InvalidMessage
* @throws InvalidType
* @throws \TypeError
*/
protected static function signData(
ReadOnlyFile $input,
Expand Down Expand Up @@ -832,9 +849,11 @@ protected static function signData(
* @throws InvalidSignature
* @throws CannotPerformOperation
* @throws FileAccessDenied
* @throws FileError
* @throws InvalidKey
* @throws InvalidMessage
* @throws InvalidType
* @throws \TypeError
*/
protected static function verifyData(
ReadOnlyFile $input,
Expand Down Expand Up @@ -1007,7 +1026,7 @@ protected static function getConfigChecksum(int $major, int $minor): array
*
* @throws InvalidDigestLength
* @throws CannotPerformOperation
* @throws InvalidType
* @throws \TypeError
*/
protected static function splitKeys(
Key $master,
Expand Down Expand Up @@ -1043,10 +1062,11 @@ protected static function splitKeys(
*
* @return int (number of bytes)
*
* @throws FileError
* @throws CannotPerformOperation
* @throws FileAccessDenied
* @throws FileModified
* @throws InvalidType
* @throws \TypeError
*/
final private static function streamEncrypt(
ReadOnlyFile $input,
Expand Down Expand Up @@ -1104,11 +1124,12 @@ final private static function streamEncrypt(
*
* @return bool
*
* @throws FileError
* @throws CannotPerformOperation
* @throws FileAccessDenied
* @throws FileModified
* @throws InvalidMessage
* @throws InvalidType
* @throws \TypeError
*/
final private static function streamDecrypt(
ReadOnlyFile $input,
Expand Down Expand Up @@ -1185,7 +1206,7 @@ final private static function streamDecrypt(
* @throws FileAccessDenied
* @throws FileModified
* @throws InvalidMessage
* @throws InvalidType
* @throws \TypeError
*/
final private static function streamVerify(
ReadOnlyFile $input,
Expand Down
2 changes: 1 addition & 1 deletion src/Halite.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
*/
final class Halite
{
const VERSION = '4.1.0';
const VERSION = '4.2.0';

const HALITE_VERSION_KEYS = "\x31\x40\x04\x00";
const HALITE_VERSION_FILE = "\x31\x41\x04\x00";
Expand Down
Loading

0 comments on commit 9647486

Please sign in to comment.