The Relying Party
aka the application you are interacting with
The Relying Party (or rp) corresponds to the application that will ask for the user to interact with the authenticator.
The library provides a simple class to handle the rp information: Webauthn\PublicKeyCredentialRpEntity.
<?php
use Webauthn\PublicKeyCredentialRpEntity;
$rpEntity = PublicKeyCredentialRpEntity::create(
'' // The application name. See below: this parameter is deprecated
);This $rpEntity object will be useful for the next steps.
Relying Party Name
The W3C IDL still requires a name member in the serialized options. Since v5.3.7, the serializer fills that member with the Relying Party ID when the entity carries an empty name, so an entity created with PublicKeyCredentialRpEntity::create('', 'acme.com') reaches the browser as:
{"id": "acme.com", "name": "acme.com"}An entity with neither a name nor an ID still serializes to nothing.
Relying Party ID
In the example above, we created a simple relying party object. The relying party may also have an ID that corresponds to the domain applicable for that rp. By default, the relying party ID is null i.e. the current domain will be used.
It may be useful to specify the rp ID, especially if your application has several sub-domains. The rp ID can be set during the creation of the object as 2nd constructor parameter.
The rp ID shall be the domain of the application without the scheme, userinfo, port, path, user…. IP addresses are not allowed either.
How to determine the Relying Party ID?
The Relying Party ID should be determined depending on the common URLs for your web application.
If you have a web application that can be reached at https://m.my-app.com (for mobiles) and https://my-app.com or https://www.my-app.com (for other devices), your Relying Party ID should be my-app.com.
If the domain is shared between sub-projects, the rp ID should be limited to that sub-project.
For example, a web site is located at https://(www.)site1.host.com and another at https://(www.)site2.host.com, then the Relying Party IDs should be site1.host.com and site2.host.com respectively. If you set host.com, there is a risk that users from site1.host.com can log in at site2.host.com.
Relying Party Icon
Your application may also have a logo. You can indicate this logo as third argument. Please note that for safety reasons this icon should be an authenticated URL, i.e. an image that uses the data scheme.
Last updated
Was this helpful?