Public keys other than main public key generated by user

Viewed 73

When you run NODE_ENV=mainnet near keys account.near you get your public key, but there is also several other keys which are some generic wallet things. One of the keys was in this format:

{
        public_key: 'ed25519:XXXXXXX',
        access_key: {
          nonce: 0,
          permission: {
            FunctionCall: {
              allowance: '0',
              receiver_id: 'XXXX',
              method_names: [ '__wallet__metadata', [length]: 1 ]
            }
          }
        }
      },

Can you please explain what are these keys used for and how it works?

1 Answers

This is a limited access key which doesn't allow to charge your account (allowance is 0) and limited to call __wallet__metadata contract method on your own account (receiver_id should be your account.near). This method usually doesn't exist, it is just a dummy value to identify such keys.

Such keys are used to authorize access to private off chain data (like your e-mail, phone, etc) when NEAR Wallet doesn't have full access keys (e.g. when using 2FA or Ledger).

This might change in future, check out https://github.com/near/near-wallet/issues/772 for status and discussion.

Related