From e1722cd4d393b2e60bf7abf8868345bc7a9d0f74 Mon Sep 17 00:00:00 2001 From: Django Doucet Date: Wed, 5 Apr 2023 13:25:39 -0600 Subject: [PATCH] Simplify signature_algorithm --- includes/class-signature.php | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/includes/class-signature.php b/includes/class-signature.php index 17a9a6f..3c28941 100644 --- a/includes/class-signature.php +++ b/includes/class-signature.php @@ -11,8 +11,6 @@ use DateTimeZone; */ class Signature { - const DEFAULT_SIGNING_ALGORITHM = 'sha256'; - /** * @param int $user_id * @@ -181,12 +179,10 @@ class Signature { public static function get_signature_algorithm( $signature_block ) { switch ( $signature_block['algorithm'] ) { - case 'rsa-sha256': - return 'sha256'; case 'rsa-sha-512': return 'sha512'; - case 'hs2019': - return self::DEFAULT_SIGNING_ALGORITHM; + default: + return 'sha256'; } return false; } @@ -223,8 +219,6 @@ class Signature { } 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 $publicKeyPem = \Activitypub\get_publickey_by_actor( $actor, $keyId ); // phpcs:ignore return \rtrim( $publicKeyPem ); // phpcs:ignore