EIPs Explained

ERC-7522 · Draft · ERC · 2023-09-20

ERC-7522: OIDC ZK Verifier for AA Account

A draft interface for an on-chain verifier that lets an ERC-4337 smart account accept a zero-knowledge proof of a social-login (OIDC) identity, for example as a recovery guardian.

What problem does it solve?

Most people already have a login with Google, Apple or similar identity providers, which use OpenID Connect (OIDC). The provider issues an ID token, a JWT signed with the provider's well-known RSA key, that says "this is user X". It would be convenient to let that identity control or recover a smart account.

Checking a JWT directly on-chain would expose the user's Web2 identity next to their address. The common workaround, MPC services, adds a third party that can fail or lock users in. ERC-7522 instead uses a zero-knowledge proof: the user proves, on their own device, that they hold a valid ID token for the identity linked to the account, without revealing the token contents on-chain.

How it works

Roles: the identity provider (IDP) signs ID tokens; the user's client builds the ZK proof; an optional aggregator combines many proofs; the OpenIdZkVerifier contract checks them for ERC-4337 user operations.

The verifier needs three things:

  1. the user's ID hash linked to the account: getIdHash(account);
  2. the IDP's public key: getVerificationKeyOfIdp();
  3. the proof plus public inputs, checked by verify(op, input, proof) or, for batches, verifyAggregated(ops, inputs, aggregatedProof).

The public input struct contains the hash of the JWT header and payload, the hash of the user ID, the JWT expiration timestamp and the JWT signature. The proof must also bind to the user operation so it cannot be reused for a different action.

Because ZK verification is expensive, the spec suggests the main use is as a guardian: if the owner key is lost, a proof from one or more linked OIDC identities authorises recovery.

Sample code

Interface sketch based on the spec (UserOp stands for the ERC-4337 user operation struct of your EntryPoint version):

// SPDX-License-Identifier: CC0-1.0
pragma solidity ^0.8.20;

struct OpenIdZkProofPublicInput {
    bytes32 jwtHeaderAndPayloadHash;
    bytes32 userIdHash;
    uint256 expirationTimestamp;
    bytes jwtSignature;
}

interface IOpenIdZkVerifier {
    function getVerificationKeyOfIdp() external view returns (bytes memory);
    function getIdHash(address account) external view returns (bytes32);
    function verify(UserOp memory op, OpenIdZkProofPublicInput memory input, bytes memory proof) external;
    function verifyAggregated(
        UserOp[] memory ops,
        OpenIdZkProofPublicInput[] memory inputs,
        bytes memory aggregatedProof
    ) external;
}

Things to know

  • Status: Draft. The spec does not fix a proof system, circuit or return convention for verify (it returns nothing; presumably it reverts on failure). Implementations will differ.
  • Security requirements from the spec: the proof must check the expiration timestamp (to prevent replay), the user operation (to prevent front-running) and the user ID hash; the verifier must check that each operation's sender is linked to that ID hash.
  • The identity provider remains a trust point: it can sign tokens for any user ID. Using several providers as independent guardians reduces that risk.
  • Providers rotate signing keys, so how getVerificationKeyOfIdp is kept current matters in practice.

#account-abstraction #zk #oidc #social-login #recovery

Details

Authors
Shu Dong (@dongshu2013) <[email protected]>, Yudao Yan <[email protected]>, Song Z <[email protected]>, Kai Chen <[email protected]>
Status
Draft
Type
Standards Track / ERC
Created
2023-09-20
Requires

Machine-readable: Markdown · JSON