ERC-6662 AA account authentication metadata (AA Account Metadata For Authentication)

Draft · Accounts & wallets · created 2023-03-09

An extension standard that lets an ERC-4337 smart contract account publish authentication-related information onchain once, so that apps can read it directly to authenticate the user.

Why it is needed

In today's authentication model, a user has to connect their wallet to log in every time they use an app, and account-related information has to be pushed from the user to the app through that wallet connection. Apps have no way to know where a user's signing tool (authenticator) lives or what format a request to it should take, so they must always rely on the single path of wallet connection. This standard defines an interface for storing authentication information as metadata on an Account Abstraction account. Users only need to publish a relay service address that connects to their authenticator and a description of the request format once, and apps can then actively fetch that information from the chain to build more flexible and convenient authentication flows.

What to implement

In depth

The IAccountMetadata interface

This standard defines the IAccountMetadata interface, which extends the IAccount interface from ERC-4337. The AuthenticatorInfo struct has two fields. relayURI is a list of relay service URIs that forward the app's message to the authenticator, and schema is either a JSON string describing the structure of AuthenticationRequest or a URI pointing to a JSON file. If the schema file is stored onchain, its URI must follow ERC-4804. The getAuthenticationInfo() function returns an array of these AuthenticatorInfo entries. The new interface is fully backward compatible with ERC-4337.

Roles of the authenticator and relay service

In the new flow, the user's wallet address is an AA-compatible smart contract account. The Authenticator can be any party holding the private key that signs user operations, for example an offline authentication mobile app or an online cloud service. The Relay is an online service that forwards the app's request to the authenticator. If the authenticator is online, it can act as its own relay and listen for the app's requests directly.

AuthenticationRequest format

The relay endpoint must accept an AuthenticationRequest object as input, with its format defined by the schema field of AuthenticationInfo. The example schema in the source includes entrypoint (the entry point contract address), chainId (the chain ID expressed as a hex string, e.g. 0x5 for the Goerli testnet), userOp (the ERC-4337 UserOp struct minus the signature), and encryptedData (a field holding all encrypted fields). Beyond these base fields, more fields can be defined by the schema, and a special marker such as "$e2ee" can indicate that a given field is encrypted.

Design rationale and relay service selection

For this flow to work, the app needs to know two things. The relayURI field resolves where the authenticator is, and the schema field resolves what format the request should take. The schema can define additional fields for the relay service, which can also be used for flexible access control. Each authenticator can list multiple relay services, and the app should try them in order until it finds the first one that works. All relay services belonging to a given authenticator must follow the same schema.

Multisig and signature aggregation

Storing multiple AuthenticatorInfo entries on a single smart contract account enables multisig authentication. Each authenticator can independently sign the user operation and submit it to the bundler, and these signatures are aggregated by an Aggregator as defined in ERC-4337.

Room for future extension

The IAccountMetadata interface can be extended as needed. For example, new fields such as alias or avatar could be defined for profile display.

Proposal status

This proposal has been in Draft status since March 2023. Since its contents may still change, it is best to check the latest source before implementing it.

Things to watch out for

Original ERC · ← ERCs