Class: Unmagic::Passkeys::WebAuthn::RelyingParty
- Inherits:
-
Object
- Object
- Unmagic::Passkeys::WebAuthn::RelyingParty
- Defined in:
- lib/unmagic/passkeys/web_authn/relying_party.rb
Overview
Action Pack WebAuthn Relying Party
Represents the relying party (your application) in WebAuthn ceremonies. The relying party identity is sent to authenticators during registration and authentication to scope credentials to your application.
Usage
# Using defaults (host from Current, name from Rails application)
= Unmagic::Passkeys::WebAuthn::RelyingParty.new
# With explicit values
= Unmagic::Passkeys::WebAuthn::RelyingParty.new(
id: "example.com",
name: "Example Application"
)
Attributes
id-
The relying party identifier, typically the application’s domain name (e.g., “example.com”). This must match the origin’s effective domain or be a registrable domain suffix of it. Credentials are scoped to this identifier. Defaults to
Unmagic::Passkeys::WebAuthn::Current.host. name-
A human-readable name for your application, displayed by authenticators during ceremonies. Defaults to
Rails.application.name.
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
-
#as_json ⇒ Object
Returns a Hash suitable for JSON serialization.
-
#initialize(id: Unmagic::Passkeys::WebAuthn::Current.host, name: Rails.application.name) ⇒ RelyingParty
constructor
Creates a new relying party configuration.
Constructor Details
#initialize(id: Unmagic::Passkeys::WebAuthn::Current.host, name: Rails.application.name) ⇒ RelyingParty
Creates a new relying party configuration.
Options
:id-
Optional. The relying party identifier (domain).
:name-
Optional. The application display name.
41 42 43 44 |
# File 'lib/unmagic/passkeys/web_authn/relying_party.rb', line 41 def initialize(id: Unmagic::Passkeys::WebAuthn::Current.host, name: Rails.application.name) @id = id @name = name end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
30 31 32 |
# File 'lib/unmagic/passkeys/web_authn/relying_party.rb', line 30 def id @id end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
30 31 32 |
# File 'lib/unmagic/passkeys/web_authn/relying_party.rb', line 30 def name @name end |
Instance Method Details
#as_json ⇒ Object
Returns a Hash suitable for JSON serialization.
47 48 49 |
# File 'lib/unmagic/passkeys/web_authn/relying_party.rb', line 47 def as_json(*) { id: id, name: name } end |