From 35496f5026d06ebbc34cd7ad971eb6b62101920d Mon Sep 17 00:00:00 2001 From: Django Doucet Date: Fri, 5 May 2023 12:52:24 -0600 Subject: [PATCH] get_public_key support application actor --- includes/class-signature.php | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/includes/class-signature.php b/includes/class-signature.php index dcf3d96..f735fc3 100644 --- a/includes/class-signature.php +++ b/includes/class-signature.php @@ -17,14 +17,15 @@ class Signature { * @return mixed */ public static function get_public_key( $user_id, $force = false ) { - $key = \get_user_meta( $user_id, 'magic_sig_public_key' ); - - if ( $key && ! $force ) { - return $key[0]; + if ( $force ) { + self::generate_key_pair( $user_id ); } - self::generate_key_pair( $user_id ); - $key = \get_user_meta( $user_id, 'magic_sig_public_key' ); + if ( -1 === $user_id ) { + $key = array( \get_option('activitypub_magic_sig_public_key' ) ); + } else { + $key = \get_user_meta( $user_id, 'magic_sig_public_key' ); + } return $key[0]; }