From ff2858b6ea8f586daa95e51ae21315f86cc5ded5 Mon Sep 17 00:00:00 2001 From: Arno Richter Date: Fri, 13 Jan 2023 17:47:09 +0100 Subject: first draft of activitypub support --- lib/activitypub-actor.php | 56 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 lib/activitypub-actor.php (limited to 'lib/activitypub-actor.php') diff --git a/lib/activitypub-actor.php b/lib/activitypub-actor.php new file mode 100644 index 0000000..705955b --- /dev/null +++ b/lib/activitypub-actor.php @@ -0,0 +1,56 @@ + 'sha512', + 'private_key_bits' => 4096, + 'private_key_type' => OPENSSL_KEYTYPE_RSA, + ]); + openssl_pkey_export($rsa, $private_key); + $public_key = openssl_pkey_get_details($rsa)['key']; + + file_put_contents(ROOT.DS.'keys'.DS.'id_rsa', $private_key); + file_put_contents(ROOT.DS.'keys'.DS.'id_rsa.pub', $public_key); + } else { + $public_key = file_get_contents(ROOT.DS.'keys'.DS.'id_rsa.pub'); + } + + + + /* + + $data = [ + 'subject' => 'acct:'.$actor.'@'.$domain, + 'links' => [ + 'rel' => 'self', + 'type' => 'application/activity+json', + 'href' => $config['url'].'/actor' + ] + ]; + */ + + header('Content-Type: application/ld+json'); + // echo(json_encode($data, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)); +?>{ + "@context": [ + "https://www.w3.org/ns/activitystreams", + "https://w3id.org/security/v1" + ], + + "id": "/actor", + "type": "Person", + "preferredUsername": "", + "inbox": "/inbox", + + "publicKey": { + "id": "/actor#main-key", + "owner": "/actor", + "publicKeyPem": "" + } +} -- cgit v1.2.3