Skip to content

Commit

Permalink
Merge pull request #1 from cedarcode/constantize
Browse files Browse the repository at this point in the history
refactor: use constant for non-changing values
  • Loading branch information
grzuy authored May 21, 2018
2 parents 5581661 + dbb83fd commit 0917e04
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions lib/webauthn.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,18 @@
require "base64"

module WebAuthn
ES256_ALGORITHM = { type: "public-key", alg: -7 }.freeze
RP_NAME = "web-server".freeze
USER_ID = "1".freeze
USER_NAME = "web-user".freeze

def self.registration_payload
{
publicKey: {
challenge: SecureRandom.random_bytes(16),
pubKeyCredParams: [{ type: "public-key", alg: -7 }],
rp: { name: "web-server" },
user: { name: "web-user", displayName: "web-user", id: Base64.encode64("1") }
pubKeyCredParams: [ES256_ALGORITHM],
rp: { name: RP_NAME },
user: { name: USER_NAME, displayName: "web-user", id: Base64.encode64(USER_ID) }
}
}
end
Expand Down

0 comments on commit 0917e04

Please sign in to comment.