Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: use constant for non-changing values #1

Merged
merged 1 commit into from
May 21, 2018
Merged
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
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