Add latest code

This commit is contained in:
Anthony Wang 2022-08-16 23:37:49 -05:00
parent 320e0457d8
commit e917628021
Signed by: a
GPG Key ID: BC96B00AEC5F2D76

View File

@ -8,9 +8,9 @@ require 'openssl'
document = File.read(ARGV[0])
date = Time.now.utc.httpdate
keypair = OpenSSL::PKey::RSA.new(File.read('private.pem'))
signed_string = "(request-target): post /inbox\nhost: git.exozy.me\ndate: #{date}"
signed_string = "(request-target): post /inbox\ndate: #{date}"
signature = Base64.strict_encode64(keypair.sign(OpenSSL::Digest::SHA256.new, signed_string))
header = 'keyId="https://test.exozy.me/api/v1/activitypub/user/test#main-key",headers="(request-target) host date",signature="' + signature + '"'
header = 'keyId="https://test.exozy.me/api/v1/activitypub/user/test#main-key",headers="(request-target) date",signature="' + signature + '"'
HTTP.headers({ 'Host': 'git.exozy.me', 'Date': date, 'Signature': header })
HTTP.headers({ 'Date': date, 'Signature': header })
.post('https://git.exozy.me/api/v1/activitypub/repo/Ta180m/Hello-world/inbox', body: document)