some more prep work for Zot VI - some of this will need to be undone or at least re-arranged later but we need to bootstrap a test environment.
This commit is contained in:
		| @@ -126,9 +126,16 @@ class HTTPSig { | |||||||
|  |  | ||||||
| 	function get_activitypub_key($id) { | 	function get_activitypub_key($id) { | ||||||
|  |  | ||||||
|  | 		if(strpos($id,'acct:') === 0) { | ||||||
|  | 			$x = q("select xchan_pubkey from xchan left join hubloc on xchan_hash = hubloc_hash where hubloc_addr = '%s' limit 1", | ||||||
|  | 				dbesc(str_replace('acct:','',$id)) | ||||||
|  | 			); | ||||||
|  | 		} | ||||||
|  | 		else { | ||||||
| 			$x = q("select xchan_pubkey from xchan where xchan_hash = '%s' and xchan_network = 'activitypub' ", | 			$x = q("select xchan_pubkey from xchan where xchan_hash = '%s' and xchan_network = 'activitypub' ", | ||||||
| 				dbesc($id) | 				dbesc($id) | ||||||
| 			); | 			); | ||||||
|  | 		} | ||||||
|  |  | ||||||
| 		if($x && $x[0]['xchan_pubkey']) { | 		if($x && $x[0]['xchan_pubkey']) { | ||||||
| 			return ($x[0]['xchan_pubkey']); | 			return ($x[0]['xchan_pubkey']); | ||||||
|   | |||||||
| @@ -120,9 +120,10 @@ class Finger { | |||||||
| 			return $ret; | 			return $ret; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		$verify = \Zotlabs\Web\HTTPSig::verify($result); |  | ||||||
| 		 |  | ||||||
| 		$x = json_decode($result['body'], true); | 		$x = json_decode($result['body'], true); | ||||||
|  |  | ||||||
|  | 		$verify = \Zotlabs\Web\HTTPSig::verify($result,(($x) ? $x['key'] : ''); | ||||||
|  | 		 | ||||||
| 		if($x && (! $verify['header_valid'])) { | 		if($x && (! $verify['header_valid'])) { | ||||||
| 			$signed_token = ((is_array($x) && array_key_exists('signed_token', $x)) ? $x['signed_token'] : null); | 			$signed_token = ((is_array($x) && array_key_exists('signed_token', $x)) ? $x['signed_token'] : null); | ||||||
| 			if($signed_token) { | 			if($signed_token) { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user