mirror of
https://github.com/anikeen-com/yaac.git
synced 2026-03-16 07:06:09 +00:00
Merge branch 'lordelph-master'
# Conflicts: # src/Data/Authorization.php
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
namespace Afosto\Acme\Data;
|
||||
|
||||
use Afosto\Acme\Client;
|
||||
use Afosto\Acme\Helper;
|
||||
|
||||
class Authorization
|
||||
{
|
||||
@@ -93,6 +94,20 @@ class Authorization
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Challenge|bool
|
||||
*/
|
||||
public function getDnsChallenge()
|
||||
{
|
||||
foreach ($this->getChallenges() as $challenge) {
|
||||
if ($challenge->getType() == Client::VALIDATION_DNS) {
|
||||
return $challenge;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return File object for the given challenge
|
||||
* @return File|bool
|
||||
@@ -105,4 +120,15 @@ class Authorization
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Challenge $challenge
|
||||
* @return string containing TXT record for DNS challenge
|
||||
*/
|
||||
public function getTxtRecord(Challenge $challenge)
|
||||
{
|
||||
$raw=$challenge->getToken() . '.' . $this->digest;
|
||||
$hash=hash('sha256', $raw, true);
|
||||
return Helper::toSafeString($hash);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user