Provable Authn
In order to improve UX/DX and encourage seamless integration with App backends and services, fcl.authenticate
has been upgraded.
Additional data is sent in the body of FCL:VIEW:READY:RESPONSE
. This data includes what the wallet needs to build a message for signing with the user’s private key/s.
The signature can be returned as part of an optional account-proof
service with the FCL:VIEW:RESPONSE
.
When provided by the wallet, this signature and additional account-proof data is available to the App via fcl.currentUser
services. The service data can be used to recreate the message, and verify the signature on the Flow Blockchain.
For example, it can be sent to the App’s backend and after validating the signature and the other account-proof data, it can safely associate the included account address to a user and log them in.
TL;DR Wallet Provider
- Wallet receives Authn
FCL:VIEW:READY:RESPONSE
request and parses out theappIdentifier
, andnonce
. - The wallet authenticates the user however they choose to do, and determines the user's account
address
- Wallet prepares and signs the message:
- Encodes the
appIdentifier
,nonce
, andaddress
along with the"FCL-ACCOUNT-PROOF-V0.0"
domain separation tag, using the encoding scheme described below. - Signs the message with the
signatureAlgorithm
andhashAlgorithm
specified on user's key. It is highly recommended that the wallet display the message data and receive user approval before signing.
- Encodes the
- Wallet sends back this new service and data along with the other service configuration when completing Authn.
Account Proof Message Encoding
The account proof message is encoded as follows:
with the following values:
ACCOUNT_PROOF_DOMAIN_TAG
is the constant"FCL-ACCOUNT-PROOF-V0.0"
, encoded as UTF-8 byte array and right-padded with zero bytes to a length of 32 bytes.APP_IDENTIFIER
is an arbitrary length string.ADDRESS
is a byte array containing the address bytes, left-padded with zero bytes to a length of 8 bytes.NONCE
is an byte array with a minimum length of 32 bytes.
RLP_ENCODE
is a function that performs RLP encoding and returns the encoded value as bytes.
JavaScript Signing Example