Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions app.rb
Original file line number Diff line number Diff line change
Expand Up @@ -108,4 +108,20 @@ class ShareKeysAPI < Sinatra::Base
status 201
headers('Location' => new_location)
end

post '/api/v1/accounts/:account_username/keys/:key_id/share' do
begin
new_data = JSON.parse(request.body.read)
saved_secret = Sharing.create(new_data)
rescue => e
logger.info "FAILED to share key: #{e.inspect}"
halt 400
end

new_location = URI.join("/api/v1/accounts/:account_username/keys/")
.to_s

status 201
headers('Location' => new_location)
end
end