Skip to content

Commit

Permalink
refactor: use constant for non-changing values
Browse files Browse the repository at this point in the history
  • Loading branch information
grzuy committed May 21, 2018
1 parent 5581661 commit 361aaaf
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 361aaaf

Please sign in to comment.