Esempio n. 1
0
 /**
  * Sign a message with our private key
  * 
  * @param string $message Message to sign
  * @param SignatureSecretKey $privateKey
  * @param boolean $raw Don't hex encode the output?
  * @return string Signature (detached)
  */
 public static function sign(string $message, SignatureSecretKey $privateKey, bool $raw = false) : string
 {
     $signed = \Sodium\crypto_sign_detached($message, $privateKey->getRawKeyMaterial());
     if ($raw) {
         return $signed;
     }
     return \Sodium\bin2hex($signed);
 }