You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Based on #5, the Authenticator trait was released on fc-traits-authn. In order to provide integrations with usable authentication mechanisms for pallet-pass, it's suggested to implement an authenticator that validates
Design
Define a structure that implements the required methods by the Authenticator trait.
For get_device_id, we'll need to get an [u8; 32] that represents the PublicKeyCredentials object, encoded in the device parameter. The method returns Some if the device is able to be authenticated by this authenticator (i.e. this device is an actual encoded representation of some PublicKeyCredentials).
Implementing authenticate
For authenticate, the method returns a Result with a unit (()) success whenever the payload sent by the device resolves the challenge given by pallet-pass, using a device provided by the user trying to authenticate, or an error when the challenge can't correctly be resolved by the given device.
For example, Alice sends an authentication request with a given device: the public key ABC, and a payload that is the signature of the challenge, using the private key that derives this public key. The result for this method should be a success.
On the other hand, Bob sends an authentication request, with a given device: the public key DEF, but the payload is a signature of the challenge using a different private key from the one that produced DEF. In this case, the signature is not correctly assesed, and the challenge fails, therefore the method returns an error.
Finally, Charlie sends an authentication request, with a given device: the sub id 123456. This is not a PublicKeyCredentials representation, but something else. The method should return an error.
The text was updated successfully, but these errors were encountered:
Motivation
Based on #5, the
Authenticator
trait was released onfc-traits-authn
. In order to provide integrations with usable authentication mechanisms forpallet-pass
, it's suggested to implement an authenticator that validatesDesign
Define a structure that implements the required methods by the
Authenticator
trait.Implementing
get_device_id
For
get_device_id
, we'll need to get an[u8; 32]
that represents thePublicKeyCredentials
object, encoded in thedevice
parameter. The method returnsSome
if the device is able to be authenticated by this authenticator (i.e. thisdevice
is an actual encoded representation of somePublicKeyCredentials
).Implementing
authenticate
For
authenticate
, the method returns aResult
with a unit (()
) success whenever the payload sent by the device resolves the challenge given bypallet-pass
, using adevice
provided by the user trying to authenticate, or an error when the challenge can't correctly be resolved by the givendevice
.For example, Alice sends an authentication request with a given
device
: the public keyABC
, and apayload
that is the signature of thechallenge
, using the private key that derives this public key. The result for this method should be a success.On the other hand, Bob sends an authentication request, with a given
device
: the public keyDEF
, but thepayload
is a signature of thechallenge
using a different private key from the one that producedDEF
. In this case, the signature is not correctly assesed, and the challenge fails, therefore the method returns an error.Finally, Charlie sends an authentication request, with a given
device
: the sub id123456
. This is not aPublicKeyCredentials
representation, but something else. The method should return an error.The text was updated successfully, but these errors were encountered: