- /**
- * repairs a signature that was double encoded
- *
- * The function is unused at the moment. It was copied from the old implementation.
- *
- * @param string $signature The signature
- * @param string $handle The handle of the signature owner
- * @param integer $level This value is only set inside this function to avoid endless loops
- *
- * @return string the repaired signature
- * @throws \Exception
- */
- private static function repairSignature($signature, $handle = "", $level = 1)
- {
- if ($signature == "") {
- return ($signature);
- }
-
- if (base64_encode(base64_decode(base64_decode($signature))) == base64_decode($signature)) {
- $signature = base64_decode($signature);
- Logger::log("Repaired double encoded signature from Diaspora/Hubzilla handle ".$handle." - level ".$level, Logger::DEBUG);
-
- // Do a recursive call to be able to fix even multiple levels
- if ($level < 10) {
- $signature = self::repairSignature($signature, $handle, ++$level);
- }
- }
-
- return($signature);
- }
-