Skip to content

Commit

Permalink
fix private key download data url
Browse files Browse the repository at this point in the history
  • Loading branch information
joeyw committed Aug 18, 2012
1 parent b9cf9d2 commit d4b6dfd
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/assets/javascripts/views/keypair/download.coffee
Expand Up @@ -11,4 +11,4 @@ class Keypair.Views.Download extends Backbone.View
{href: @dataUri()}

dataUri: ->
"data:application/x-pem-file,#{encodeURIComponent(@app.keypair.privateKey)}"
"data:application/x-pem-file,#{encodeURIComponent(@app.keypair.privateKeyPem)}"
1 change: 1 addition & 0 deletions features/key_generation.feature
Expand Up @@ -10,6 +10,7 @@ Feature: Key Generation
And I press "Generate Key"
And I wait an eternity
Then I should see "Download Private Key"
And "Download Private Key" should contain the private key

When I follow "Done"
Then I should see "+"
Expand Down
6 changes: 5 additions & 1 deletion features/step_definitions/key_steps.rb
Expand Up @@ -29,10 +29,14 @@
-----END ENCRYPTED PRIVATE KEY-----
EOF

And /^"Download Private Key" should contain the private key$/ do
find('a[download="swordfish.pem"]')['href'].should =~ /BEGIN%20ENCRYPTED%20PRIVATE%20KEY/
end

Given '"$email" has generated a key' do |email|
user = User.first(:email => email)
user.public_key = $public_key
user.save!

page.execute_script "localStorage['privateKey'] = #{$private_key.to_json}"
end
end

0 comments on commit d4b6dfd

Please sign in to comment.