Skip to content
This repository was archived by the owner on Oct 4, 2024. It is now read-only.

delete-key prompts #890

Merged
merged 3 commits into from
Nov 30, 2021
Merged

delete-key prompts #890

merged 3 commits into from
Nov 30, 2021

Conversation

volovyks
Copy link
Collaborator

Closing #834
Current output:

~/P/N/near-cli on last-key-deletion ⨯ ./bin/near keys keystest.serhii.testnet

Keys for account keystest.serhii.testnet
[
  {
    public_key: 'ed25519:2iQAzcDvdSVMReXi2NVvhANrYdHBcMXnSWZz7mdBii5P',
    access_key: { nonce: 73345990000006, permission: 'FullAccess' }
  },
  {
    public_key: 'ed25519:6HtbSyKVtSasm5vvtvN5LevdyzCt3L6dNgkMnXK7Sw4P',
    access_key: { nonce: 73346143000000, permission: 'FullAccess' }
  },
  {
    public_key: 'ed25519:GkMNfc92fwM1AmwH1MTjF4b7UZuceamsq96XPkHsQ9vi',
    access_key: {
      nonce: 73347044000000,
      permission: {
        FunctionCall: {
          allowance: '30000000000000000000000000000000000',
          receiver_id: 'example-contract.testnet',
          method_names: [ 'example_method' ]
        }
      }
    }
  }
]

⋊> ~/P/N/near-cli on last-key-deletion ⨯ ./bin/near delete-key keystest.serhii.testnet ed25519:GkMNfc92fwM1AmwH1MTjF4b7UZuceamsq96XPkHsQ9vi

Deleting key ed25519:GkMNfc92fwM1AmwH1MTjF4b7UZuceamsq96XPkHsQ9vi on keystest.serhii.testnet.
Transaction Id DXQtAbWAVKL2HrfTzdzCf7cQCnn7bUMZNuaZ2dKJ2amN
To see the transaction in the transaction explorer, please open this url in your browser
https://explorer.testnet.near.org/transactions/DXQtAbWAVKL2HrfTzdzCf7cQCnn7bUMZNuaZ2dKJ2amN

⋊> ~/P/N/near-cli on last-key-deletion ⨯ ./bin/near delete-key keystest.serhii.testnet ed25519:6HtbSyKVtSasm5vvtvN5LevdyzCt3L6dNgkMnXK7Sw4P

Key ed25519:6HtbSyKVtSasm5vvtvN5LevdyzCt3L6dNgkMnXK7Sw4P ] is a Full Access key. Make sure it's not your recovery method. Do you want to proceed? (y/n) n
Deletion of  ed25519:6HtbSyKVtSasm5vvtvN5LevdyzCt3L6dNgkMnXK7Sw4P  key on keystest.serhii.testnet. was canceled

⋊> ~/P/N/near-cli on last-key-deletion ⨯ ./bin/near delete-key keystest.serhii.testnet ed25519:6HtbSyKVtSasm5vvtvN5LevdyzCt3L6dNgkMnXK7Sw4P

Key ed25519:6HtbSyKVtSasm5vvtvN5LevdyzCt3L6dNgkMnXK7Sw4P ] is a Full Access key. Make sure it's not your recovery method. Do you want to proceed? (y/n) y
Deleting key ed25519:6HtbSyKVtSasm5vvtvN5LevdyzCt3L6dNgkMnXK7Sw4P on keystest.serhii.testnet.
Transaction Id EKheTmgnK2212CtHTXAStKRLhEURpESBN7n22AxAXN1E
To see the transaction in the transaction explorer, please open this url in your browser
https://explorer.testnet.near.org/transactions/EKheTmgnK2212CtHTXAStKRLhEURpESBN7n22AxAXN1E

⋊> ~/P/N/near-cli on last-key-deletion ⨯ ./bin/near add-key keystest.serhii.testnet ed25519:6HtbSyKVtSasm5vvtvN5LevdyzCt3L6dNgkMnXK7Sw4P

Adding full access key = ed25519:6HtbSyKVtSasm5vvtvN5LevdyzCt3L6dNgkMnXK7Sw4P to keystest.serhii.testnet.
Transaction Id 4igCtMDda2MKGDvdxC8wBuZrE26SKnRFcUG8UYpnzYF9
To see the transaction in the transaction explorer, please open this url in your browser
https://explorer.testnet.near.org/transactions/4igCtMDda2MKGDvdxC8wBuZrE26SKnRFcUG8UYpnzYF9

⋊> ~/P/N/near-cli on last-key-deletion ⨯ ./bin/near delete-key keystest.serhii.testnet ed25519:6HtbSyKVtSasm5vvtvN5LevdyzCt3L6dNgkMnXK7Sw4P --force

Deleting key ed25519:6HtbSyKVtSasm5vvtvN5LevdyzCt3L6dNgkMnXK7Sw4P on keystest.serhii.testnet.
Transaction Id 9Ltbk5oMBay2n2WfJJXBygEYgjBnUysvz36vXVKDjjVb
To see the transaction in the transaction explorer, please open this url in your browser
https://explorer.testnet.near.org/transactions/9Ltbk5oMBay2n2WfJJXBygEYgjBnUysvz36vXVKDjjVb

⋊> ~/P/N/near-cli on last-key-deletion ⨯ ./bin/near delete-key keystest.serhii.testnet ed25519:2iQAzcDvdSVMReXi2NVvhANrYdHBcMXnSWZz7mdBii5P

Key ed25519:2iQAzcDvdSVMReXi2NVvhANrYdHBcMXnSWZz7mdBii5P ] is a Full Access key. Make sure it's not your recovery method. Do you want to proceed? (y/n) y
Key [ ed25519:2iQAzcDvdSVMReXi2NVvhANrYdHBcMXnSWZz7mdBii5P ] is the last Full Access key. In case of deletion, you will not be able to restore access to the account [ keystest.serhii.testnet ]. Do you want to proceed? (y/n) y
Deleting key ed25519:2iQAzcDvdSVMReXi2NVvhANrYdHBcMXnSWZz7mdBii5P on keystest.serhii.testnet.
Transaction Id Na8qbutSkkuVyFnynCQKq3vPHVE5QTx6EEs2DmbK1xG
To see the transaction in the transaction explorer, please open this url in your browser
https://explorer.testnet.near.org/transactions/Na8qbutSkkuVyFnynCQKq3vPHVE5QTx6EEs2DmbK1xG

⋊> ~/P/N/near-cli on last-key-deletion ⨯ ./bin/near keys keystest.serhii.testnet                                                                       
Keys for account keystest.serhii.testnet
[]

@volovyks volovyks added enhancement New feature or request P2 Medium priority security Pull requests that address a security vulnerability labels Nov 30, 2021
@volovyks volovyks self-assigned this Nov 30, 2021
@volovyks volovyks linked an issue Nov 30, 2021 that may be closed by this pull request
let accessKeys = await account.getAccessKeys();
let fullAccessKeys = accessKeys.filter(accessKey => accessKey.access_key.permission === 'FullAccess');

// aks for approvals if user is deleting Full Access Key
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// aks for approvals if user is deleting Full Access Key
// asks for approval if user is deleting Full Access Key

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Merged together with other changes, thanks!

@volovyks volovyks merged commit 1959b71 into master Nov 30, 2021
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
enhancement New feature or request P2 Medium priority security Pull requests that address a security vulnerability
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Warning if last full access key is being deleted
3 participants