summaryrefslogtreecommitdiff
path: root/helpers.rb
diff options
context:
space:
mode:
Diffstat (limited to 'helpers.rb')
-rw-r--r--helpers.rb9
1 files changed, 7 insertions, 2 deletions
diff --git a/helpers.rb b/helpers.rb
index 536a7c6..0a7f829 100644
--- a/helpers.rb
+++ b/helpers.rb
@@ -80,7 +80,6 @@ helpers do
signature = Base64.strict_encode64(keypair.sign(OpenSSL::Digest.new('SHA256'), string))
signed_header = "keyId=\"#{ACTOR}#main-key\",algorithm=\"rsa-sha256\",headers=\"(request-target) host date digest content-type\",signature=\"#{signature}\""
- p inbox
# Net::HTTP fails with OpenSSL error
curl(
"-X POST -H 'Host: #{uri.host}' -H 'Date: #{httpdate}' -H 'Digest: #{digest}' -H 'Signature: #{signed_header}' --data-binary '@#{activity_path}'", inbox
@@ -204,8 +203,14 @@ helpers do
def find_file(id)
Dir[File.join('*', 'object', '*', '*.json')].find do |f|
- # Dir[File.join('*box', '**', '*.json')].find do |f|
JSON.load_file(f)['id'] == id
end
end
+
+ def find_object(id)
+ Dir[File.join('*', '**', '*.json')].each do |file|
+ object = JSON.load_file(file)
+ return [file, object] if object['id'] == id
+ end
+ end
end