Created
July 29, 2018 09:55
-
-
Save waweic/2b2f1ad8221a738aa7df05a519d80ca3 to your computer and use it in GitHub Desktop.
I think these are all files needed to understand my problem
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| * Serving Flask app "simple_python_activitypub" | |
| * Environment: production | |
| WARNING: Do not use the development server in a production environment. | |
| Use a production WSGI server instead. | |
| * Debug mode: off | |
| * Running on http://127.0.0.1:5000/ (Press CTRL+C to quit) | |
| 127.0.0.1 - - [29/Jul/2018 10:58:44] "GET /users/waweic HTTP/1.0" 200 - | |
| 127.0.0.1 - - [29/Jul/2018 10:58:44] "GET /users/waweic HTTP/1.0" 200 - | |
| 127.0.0.1 - - [29/Jul/2018 10:58:44] "GET /.well-known/webfinger?resource=acct:waweic@testing1.ism.rocks HTTP/1.0" 200 - |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -----BEGIN PUBLIC KEY----- | |
| MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAutW8neaZrIGKGI5IWYGa | |
| 3aZt7Of09Op+PArt0Sl95MpUjhA44MiKbda6G6qgE2ehjK1GQ+zxLS03D5uKCCpM | |
| 3G2BHQVx9WocwJJkwDoB9EWnyJAE/bBtTbkFbMYXgRGVuEadBivbqERDkUOIEiCO | |
| alvZCIcbDJbwLh3TtGVHndIjqYD1Flf1JyIwxhFsXgVdZNroP90fRn7lHsIxH+zK | |
| +DciIqXlryOjpfVG8d6JUzxBMJ8JbTbdmjgqxOoM5Du7QFFPJQdTelLiAsxlIufU | |
| CTko0eqgOIVv4RiKmDRdv4HcgywoPZ04NP2Y4445/NKlB2sW3iPIwUUmxqaYEnAv | |
| 3wIDAQAB | |
| -----END PUBLIC KEY----- |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 401 | |
| Public key not found for key https://testing1.ism.rocks/users/waweic#main-key |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'http' | |
| require 'openssl' | |
| document = File.read('create-hello-world.json') | |
| date = Time.now.utc.httpdate | |
| keypair = OpenSSL::PKey::RSA.new(File.read('private.pem')) | |
| signed_string = "(request-target): post /inbox\nhost: mastodon.social\ndate: #{date}" | |
| signature = Base64.strict_encode64(keypair.sign(OpenSSL::Digest::SHA256.new, signed_string)) | |
| header = 'keyId="https://testing1.ism.rocks/users/waweic#main-key",headers="(request-target) host date",signature="' + signature + '"' | |
| http = HTTP.headers({ 'Host': 'mastodon.social', 'Date': date, 'Signature': header }) | |
| response = http.post('https://mastodon.social/inbox', body: document) | |
| print(response.code) | |
| print("\n") | |
| print(response.body) | |
| # print(response.body) | |
| # print(signed_string) | |
| # print("\n\n") | |
| # print(signature) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| POST /inbox HTTP/1.1 | |
| Host: mastodon.social | |
| Date: Sun, 29 Jul 2018 08:53:30 GMT | |
| Signature: keyId="https://testing1.ism.rocks/users/waweic#main-key",headers="(request-target) host date",signature="tgrZ/YvRzx5BuODSFz/IzvUbDvu6o3/grEAwaBnxUsYNmpYH0FNi2gxglFFlWwerSM3cM3Zv+8/wBnWe2i3/g+mtPti9nwVvRo3nTIbalCEXDIxgDpz9STZ4RGNd+jzgW+8/zR+qMgAcVcBU+nvSIXLQNTQdA/fYXrJs9ZI3LkupByzpkfiE7CjSmgfKLmsi4z8EBNJda6EnvnqDLmOroMmgTAI/5LmXfqj1S92E2i3N+bTsXx0YpMyodNMmZXzhQUfJ9zq7G0irZoYPbqBNWqUfZiUau5pSFpS/UBh1J0iurEK7/gYilkOraEewFA6BMFYGuAeA+8bWgfTgSSPMnA==" | |
| Connection: close | |
| User-Agent: http.rb/3.3.0 | |
| Content-Length: 582 | |
| { | |
| "@context": "https://www.w3.org/ns/activitystreams", | |
| "id": "https://testing1.ism.rocks/object/dsngoisgoihs/activity", | |
| "type": "Create", | |
| "actor": "https://testing1.ism.rocks/users/waweic", | |
| "object": { | |
| "id": "https://testing1.ism.rocks/object/dsngoisgoihs", | |
| "type": "Note", | |
| "published": "2018-07-27T20:38:11Z", | |
| "attributedTo": "https://testing1.ism.rocks/users/waweic", | |
| "inReplyTo": "https://mastodon.social/users/Gargron/statuses/100254678717223630", | |
| "content": "<p>Hello world</p>", | |
| "to": "https://www.w3.org/ns/activitystreams#Public" | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| {"@context": ["https://www.w3.org/ns/activitystreams", "https://w3id.org/security/v1"], "id": "https://testing1.ism.rocks/users/waweic", "type": "Person", "inbox": "https://testing1.ism.rocks/users/waweic/inbox", "preferredUsername": "waweic", "publicKey": {"owner": "https://testing1.ism.rocks/users/waweic", "id": "https://testing1.ism.rocks/users/waweic#main-key", "publicKeyPem": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAutW8neaZrIGKGI5IWYGa\n3aZt7Of09Op+PArt0Sl95MpUjhA44MiKbda6G6qgE2ehjK1GQ+zxLS03D5uKCCpM\n3G2BHQVx9WocwJJkwDoB9EWnyJAE/bBtTbkFbMYXgRGVuEadBivbqERDkUOIEiCO\nalvZCIcbDJbwLh3TtGVHndIjqYD1Flf1JyIwxhFsXgVdZNroP90fRn7lHsIxH+zK\n+DciIqXlryOjpfVG8d6JUzxBMJ8JbTbdmjgqxOoM5Du7QFFPJQdTelLiAsxlIufU\nCTko0eqgOIVv4RiKmDRdv4HcgywoPZ04NP2Y4445/NKlB2sW3iPIwUUmxqaYEnAv\n3wIDAQAB\n-----END PUBLIC KEY-----"}} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "subject": "acct:waweic@testing1.ism.rocks", | |
| "links": [ | |
| { | |
| "rel": "self", | |
| "type": "application/activity+json", | |
| "href": "https://testing1.ism.rocks/users/waweic" | |
| } | |
| ] | |
| } |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
this_is_what_i_send.httpare sent to mastodon.socialmy_flask_log.log). Note that I have an nginx proxy between the internet and my server to provide an SSL connection.waweic.jsonand laterwebfinger.jsonare replied to mastodon.social. (Note that I got them over curl, so this definitely works)ruby_script.logon my screen and have no clue why I get an error code back, because verifying the signature usingpublic.pemworks.Note, that I nearly completely copy-pasted the contents of send.rb from Gargrons blogpost.