Simplify signature_algorithm
This commit is contained in:
parent
3a0f62b092
commit
e1722cd4d3
1 changed files with 2 additions and 8 deletions
|
@ -11,8 +11,6 @@ use DateTimeZone;
|
||||||
*/
|
*/
|
||||||
class Signature {
|
class Signature {
|
||||||
|
|
||||||
const DEFAULT_SIGNING_ALGORITHM = 'sha256';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param int $user_id
|
* @param int $user_id
|
||||||
*
|
*
|
||||||
|
@ -181,12 +179,10 @@ class Signature {
|
||||||
|
|
||||||
public static function get_signature_algorithm( $signature_block ) {
|
public static function get_signature_algorithm( $signature_block ) {
|
||||||
switch ( $signature_block['algorithm'] ) {
|
switch ( $signature_block['algorithm'] ) {
|
||||||
case 'rsa-sha256':
|
|
||||||
return 'sha256';
|
|
||||||
case 'rsa-sha-512':
|
case 'rsa-sha-512':
|
||||||
return 'sha512';
|
return 'sha512';
|
||||||
case 'hs2019':
|
default:
|
||||||
return self::DEFAULT_SIGNING_ALGORITHM;
|
return 'sha256';
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -223,8 +219,6 @@ class Signature {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function get_key( $keyId ) { // phpcs:ignore
|
public static function get_key( $keyId ) { // phpcs:ignore
|
||||||
// If there was no key passed to verify, it will find the keyId and call this
|
|
||||||
// function to fetch the public key from stored data or a network fetch.
|
|
||||||
$actor = \Activitypub\get_actor_from_key( $keyId ); // phpcs:ignore
|
$actor = \Activitypub\get_actor_from_key( $keyId ); // phpcs:ignore
|
||||||
$publicKeyPem = \Activitypub\get_publickey_by_actor( $actor, $keyId ); // phpcs:ignore
|
$publicKeyPem = \Activitypub\get_publickey_by_actor( $actor, $keyId ); // phpcs:ignore
|
||||||
return \rtrim( $publicKeyPem ); // phpcs:ignore
|
return \rtrim( $publicKeyPem ); // phpcs:ignore
|
||||||
|
|
Loading…
Reference in a new issue