Get actor from key with non-standard uri
This commit is contained in:
parent
d6169f4bc3
commit
502bf8b5a6
2 changed files with 10 additions and 1 deletions
|
@ -225,7 +225,7 @@ 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 = \strip_fragment_from_url( $keyId ); // phpcs:ignore
|
||||
$actor = \Activitypub\get_actor_from_key( $keyId ); // phpcs:ignore
|
||||
$publicKeyPem = \Activitypub\get_publickey_by_actor( $actor, $keyId ); // phpcs:ignore
|
||||
return \rtrim( $publicKeyPem ); // phpcs:ignore
|
||||
}
|
||||
|
|
|
@ -219,6 +219,15 @@ function get_publickey_by_actor( $actor, $key_id ) {
|
|||
return new \WP_Error( 'activitypub_no_public_key', \__( 'No "Public-Key" found', 'activitypub' ), $metadata );
|
||||
}
|
||||
|
||||
function get_actor_from_key( $key_id ) {
|
||||
$actor = \strip_fragment_from_url( $key_id );
|
||||
if ( $actor === $key_id ) {
|
||||
// strip /main-key/ for GoToSocial.
|
||||
$actor = \dirname( $key_id, 1 );
|
||||
}
|
||||
return $actor;
|
||||
}
|
||||
|
||||
function get_follower_inboxes( $user_id ) {
|
||||
$followers = \Activitypub\Peer\Followers::get_followers( $user_id );
|
||||
$inboxes = array();
|
||||
|
|
Loading…
Reference in a new issue