From 79e3bf726b7166c5ec641ea02b75f82a74f31698 Mon Sep 17 00:00:00 2001 From: pdp8 Date: Sun, 23 Apr 2023 19:26:00 +0200 Subject: inbox/outbox GET --- post.rb | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'post.rb') diff --git a/post.rb b/post.rb index ed7a964..c5e7cd7 100755 --- a/post.rb +++ b/post.rb @@ -6,7 +6,21 @@ require 'base64' require 'net/http' require 'uri' -document = { "a" => 2 } # .to_json +# document = { "a" => 2 } # .to_json +document = { + "@context": "https://www.w3.org/ns/activitystreams", + "type": "Like", + "actor": "https://example.net/~mallory", + "to": ["https://hatchat.example/sarah/", + "https://example.com/peeps/john/"], + "object": { + "@context": { "@language": "en" }, + "id": "https://example.org/~alice/note/23", + "type": "Note", + "attributedTo": "https://example.org/~alice", + "content": "I'm a goat" + } +} date = Time.now.utc.httpdate keypair = OpenSSL::PKey::RSA.new(File.read('private.pem')) signed_string = "(request-target): post /inbox\nhost: social.pdp8.info\ndate: #{date}" @@ -19,6 +33,7 @@ http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = true http.verify_mode = OpenSSL::SSL::VERIFY_NONE header = { + 'Accept' => 'application/ld+json; profile="https://www.w3.org/ns/activitystreams"', 'Host' => 'social.pdp8.info', 'Date' => date, 'Signature' => signed_header, -- cgit v1.2.3