EIP 2255

Summary

A proposed standard interface for restricting and permitting access to security-sensitive methods within a restricted web3 context like a website or “dapp”.

Many web3 applications today begin their sessions with a series of repetitive requests:

  • Reveal your wallet address to this site
  • Switch to a preferred network
  • Sign a cryptographic challenge
  • Grant a token allowance to our contract
  • Send a transaction to our contract

Many of these can be generalized into a set of human-readable permissions prompts on the original sign-in screen, and additional permissions could be requested only as needed.

API

This proposal adds two new methods

  • wallet_getPermissions: get an array of current permissions(empty by default).

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    const response = await provider.request({
    method: 'wallet_getPermissions'
    })
    /**
    * [
    * {
    * invoker: 'url', // unique domain string used to identify the source of the current dapp
    * parentCapability: 'eth_accounts', // the basis of these permissions
    * caveats: [ // the specific restrictions applied to the permitted method
    * {
    * type: 'fileterResponse',
    * value: ['...']
    * }
    * ]
    * }
    * ]
    */
  • wallet_requestPermissions: request some permissions.

    1
    2
    3
    4
    5
    6
    const response = await provider.request({
    method: 'wallet_requestPermissions',
    params: [{
    'eth_accounts': {}
    }]
    })

Discussion

Discussion: EIP-2255

  • Wallet should make dangerous permission look dangerous. This isn’t an excuse to get users to click blindly. This is a time to rebuild the user’s sense of responsibility.
  • Wallet should expose permissions that are meaningful to user. A token allowance is meaningful, but a hex blob is not. If we can identify the terms that convey the true risk a user is taking, I believe we can allow the risks a user takes to be much more comprehensible to them, which allows them to participate in informed consent. We cannot stop users from being reckless, but we can empower them to be careful with fewer steps.
  • Wallets should allow users to attenuate permissions(add caveats), or reduce their impact when possible. An app may request a login, but the user may say “Just for the next 30 minutes”.