Sure no problem.
First off, this is not finished, but the specific issue is showing up here:
InboxController starting around line 40.
Specifically I’m trying 2 approaches in this block
$signature = new HttpSignature($server);
$isValidLandrok = $signature->verify($request);
$isValidHome = SignatureHelper::validate($actor->get(), $request);
The isValidLandrok is using landrok/activity-pub’s built in validator. The isValidHome is the one I re-built from Building an Activity-Pub Server
Neither works.
Recently I’ve added Henge’s pasture/httpsig server to my docker-compose.yml. I send the request I receive to a method that constructs a call w/ all the appropriate headers and the body of the request to his validator. Things still fail however:
A call constructed running via PostMan…
{
"headers": {
"Accept-Encoding": "gzip",
"X-Forwarded-Proto": "https",
"X-Forwarded-Host": "corgi-evident-bear.ngrok-free.app",
"X-Forwarded-For": "32.219.195.90",
"Signature": "keyId=\"https:\/\/redwombat.social\/users\/daemionfox#main-key\",algorithm=\"rsa-sha256\",headers=\"(request-target) host date digest content-type\",signature=\"OBo+sFl\/dSYRdwNDJwd1Y3XJJrx+Y4BUfjUuiE5ThhGHeoWMJlpVG5SdzJhgnlBFuv0dYvQE1hjTfyKGa1PjKXpWfQayfN8mvt87it8+vp40IvoBzhvFYYWE5v65ckjEV8hqBdf+N43hHY8pNmBoEZ+twOlhBdcik9GDtnm\/fApROq2AH1TMSDU4CEWXt3IUoBLD6VP9ttjcrvH8RPvDfdEYYIvquxw7B+0mfJ7vpouTFWP3ELWCmtKdHu3MtieGJPmSf4ajXCZhasN0q\/JjQQ\/OVNtD5Pkl+YOH5rK54ZX\/uQSJWBgv9F39dr0gPQtc+Tg1xrCiHjULxJDKUuk0iQ==\"",
"Digest": "SHA-256=xdk1OkkEwowdIF3qtehsLYyQOGYK\/XUebaYmjFROieM=",
"Date": "Tue, 05 Dec 2023 13:34:36 GMT",
"Content-Type": "application\/activity+json",
"Content-Length": "258",
"User-Agent": "http.rb\/5.1.1 (Mastodon\/4.2.0; +https:\/\/redwombat.social\/)",
"Host": "corgi-evident-bear.ngrok-free.app:443"
},
"body": {
"@context": "https:\/\/www.w3.org\/ns\/activitystreams",
"id": "https:\/\/redwombat.social\/361d56d1-a883-4d7e-adba-cd1f4e8753d2",
"type": "Follow",
"actor": "https:\/\/redwombat.social\/users\/daemionfox",
"object": "https:\/\/corgi-evident-bear.ngrok-free.app\/@cutloose"
}
}
yields
{
"steps": [
"Got post request",
"With headers: Remote-Addr: 172.19.0.3\r\nHost: corgi-evident-bear.ngrok-free.app:443\r\nAccept-Encoding: gzip\r\nX-Forwarded-Proto: https\r\nX-Forwarded-Host: corgi-evident-bear.ngrok-free.app\r\nX-Forwarded-For: 32.219.195.90\r\nSignature: keyId=\"https:\/\/redwombat.social\/users\/daemionfox#main-key\",algorithm=\"rsa-sha256\",headers=\"(request-target) host date digest content-type\",signature=\"OBo+sFl\/dSYRdwNDJwd1Y3XJJrx+Y4BUfjUuiE5ThhGHeoWMJlpVG5SdzJhgnlBFuv0dYvQE1hjTfyKGa1PjKXpWfQayfN8mvt87it8+vp40IvoBzhvFYYWE5v65ckjEV8hqBdf+N43hHY8pNmBoEZ+twOlhBdcik9GDtnm\/fApROq2AH1TMSDU4CEWXt3IUoBLD6VP9ttjcrvH8RPvDfdEYYIvquxw7B+0mfJ7vpouTFWP3ELWCmtKdHu3MtieGJPmSf4ajXCZhasN0q\/JjQQ\/OVNtD5Pkl+YOH5rK54ZX\/uQSJWBgv9F39dr0gPQtc+Tg1xrCiHjULxJDKUuk0iQ==\"\r\nDigest: SHA-256=xdk1OkkEwowdIF3qtehsLYyQOGYK\/XUebaYmjFROieM=\r\nDate: Tue, 05 Dec 2023 13:34:36 GMT\r\nContent-Type: application\/activity+json\r\nUser-Agent: http.rb\/5.1.1 (Mastodon\/4.2.0; +https:\/\/redwombat.social\/)\r\nX-Php-Ob-Level: 0\r\nContent-Length: 258\r\n\r\n",
"Signature header 'keyId=\"https:\/\/redwombat.social\/users\/daemionfox#main-key\",algorithm=\"rsa-sha256\",headers=\"(request-target) host date digest content-type\",signature=\"OBo+sFl\/dSYRdwNDJwd1Y3XJJrx+Y4BUfjUuiE5ThhGHeoWMJlpVG5SdzJhgnlBFuv0dYvQE1hjTfyKGa1PjKXpWfQayfN8mvt87it8+vp40IvoBzhvFYYWE5v65ckjEV8hqBdf+N43hHY8pNmBoEZ+twOlhBdcik9GDtnm\/fApROq2AH1TMSDU4CEWXt3IUoBLD6VP9ttjcrvH8RPvDfdEYYIvquxw7B+0mfJ7vpouTFWP3ELWCmtKdHu3MtieGJPmSf4ajXCZhasN0q\/JjQQ\/OVNtD5Pkl+YOH5rK54ZX\/uQSJWBgv9F39dr0gPQtc+Tg1xrCiHjULxJDKUuk0iQ==\"'",
"Got fields (request-target), host, date, digest, content-type",
"Got body: '{\"@context\": \"https:\/\/www.w3.org\/ns\/activitystreams\",\"id\": \"https:\/\/redwombat.social\/361d56d1-a883-4d7e-adba-cd1f4e8753d2\",\"type\": \"Follow\",\n\"actor\": \"https:\/\/redwombat.social\/users\/daemionfox\",\"object\": \"https:\/\/corgi-evident-bear.ngrok-free.app\/@cutloose\"}'",
"Computed digest sha-256=UnNLmYxOzk9zk9pr76sGyFHerymLUgY8RY0wH9HWRA8="
],
"x error": "Digests do not match"
}
Whereas the same request coming from Mastodon (different timestamps/sigs/etc) returns as a 500 error with a
fediverse_pasture.types:['Something went wrong when verifying signature', "ValueError('Could not deserialize key data. The data may be in an incorrect format, it may be encrypted with an unsupported algorithm, or it may be an unsupported key type (e.g. EC curves with explicit parameters).', [<OpenSSLError(code=75497580, lib=9, reason=108, reason_text=no start line)>])"
So as I said, I’m stumped. (I started working on this piece of the code in December, and have gotten no closer to complete)