fix signature issue

This commit is contained in:
Matthias Pfefferle 2023-06-01 12:47:08 +02:00
parent d251060624
commit 723a3e3363
2 changed files with 12 additions and 12 deletions

View file

@ -49,7 +49,7 @@ class Application_User extends Blog_User {
}
public function get_public_key() {
$key = \get_option( 'activitypub_application_user_public_key', true );
$key = \get_option( 'activitypub_application_user_public_key' );
if ( $key ) {
return $key;
@ -57,7 +57,7 @@ class Application_User extends Blog_User {
$this->generate_key_pair();
$key = \get_option( 'activitypub_application_user_public_key', true );
$key = \get_option( 'activitypub_application_user_public_key' );
return $key;
}
@ -68,7 +68,7 @@ class Application_User extends Blog_User {
* @return mixed
*/
public function get_private_key() {
$key = \get_option( 'activitypub_application_user_private_key', true );
$key = \get_option( 'activitypub_application_user_private_key' );
if ( $key ) {
return $key;
@ -76,15 +76,15 @@ class Application_User extends Blog_User {
$this->generate_key_pair();
return \get_option( 'activitypub_application_user_private_key', true );
return \get_option( 'activitypub_application_user_private_key' );
}
private function generate_key_pair() {
$key_pair = Signature::generate_key_pair();
if ( ! is_wp_error( $key_pair ) ) {
\update_option( 'activitypub_application_user_public_key', $key_pair['public_key'], true );
\update_option( 'activitypub_application_user_private_key', $key_pair['private_key'], true );
\update_option( 'activitypub_application_user_public_key', $key_pair['public_key'] );
\update_option( 'activitypub_application_user_private_key', $key_pair['private_key'] );
}
}
}

View file

@ -142,7 +142,7 @@ class Blog_User extends User {
}
public function get_public_key() {
$key = \get_option( 'activitypub_blog_user_public_key', true );
$key = \get_option( 'activitypub_blog_user_public_key' );
if ( $key ) {
return $key;
@ -150,7 +150,7 @@ class Blog_User extends User {
$this->generate_key_pair();
$key = \get_option( 'activitypub_blog_user_public_key', true );
$key = \get_option( 'activitypub_blog_user_public_key' );
return $key;
}
@ -161,7 +161,7 @@ class Blog_User extends User {
* @return mixed
*/
public function get_private_key() {
$key = \get_option( 'activitypub_blog_user_private_key', true );
$key = \get_option( 'activitypub_blog_user_private_key' );
if ( $key ) {
return $key;
@ -169,15 +169,15 @@ class Blog_User extends User {
$this->generate_key_pair();
return \get_option( 'activitypub_blog_user_private_key', true );
return \get_option( 'activitypub_blog_user_private_key' );
}
private function generate_key_pair() {
$key_pair = Signature::generate_key_pair();
if ( ! is_wp_error( $key_pair ) ) {
\update_option( 'activitypub_blog_user_public_key', $key_pair['public_key'], true );
\update_option( 'activitypub_blog_user_private_key', $key_pair['private_key'], true );
\update_option( 'activitypub_blog_user_public_key', $key_pair['public_key'] );
\update_option( 'activitypub_blog_user_private_key', $key_pair['private_key'] );
}
}
}