cybercongress / cyb-ts

Immortal robot for the Great Web
https://cyb.ai
163 stars 40 forks source link

042🟢🟢🟢 key management #125

Open mastercyb opened 4 years ago

mastercyb commented 4 years ago

Ability to add, delete and rename pubkeys is very important. So its time to implement robots

mastercyb commented 4 years ago

Concept

The concept of the robot stems from the fact that using just one secret the one can implement very complex accounting strategies with the help of derivation techniques. In general an agent can derive several pubkeys from the same private key. For usability an agent can assign human readable name for every privkey. So there is a simple rule: one privkey - one robot and no exceptions. I believe this constraint will simplify interfaces and all derived software. The purpose of the storage is to allow an agent associate contracts with his pubkeys, hence the robot can perfrom more complex operations. Contracts can be either derived from the bip path (you can refer to this as address) or not, e.g, can be deployed in some network.

Localstorage format

account: "xhipster"
  privkey: ""
    pubkey: "0389238304638548cee3e0bdf30c9c2e44fd9dbf8e24385aeb1b4595f54495c9f0"
    source: "ledger" or "metamask" or "cyb" or "custom"
    curve: "secp256k1"
    contracts:
      index: 0      
        type: "hex"
          bip-44-path: [44, 60, 0, 0, 0]
        networks": [foundation, kovan, rinkeby, kovan]
        prefix: "0x"
        contract:  "0x002F9CaF40a444f20813DA783D152bdfAF42852F"
      index: 1
        type: "bech32" 
          bip-44-path: [44, 118, 0, 0, 0]
        networks": "[cosmoshub-3]
        prefix: "cosmos"
        contract:  "cosmos158mysantvvk7x65tfhhuu8q2va4ls34rhxr9qq"
      index: 2
        type: "bech32"
          bip-44-path: [44, 118, 0, 0, 0]
        networks" [cyber, euler]
        prefix: "cyber"
        contract:  "cyber158mysantvvk7x65tfhhuu8q2va4ls34rsdydf6"

This format could partially defines the interface:

account.current.pubkey
must return
0389238304638548cee3e0bdf30c9c2e44fd9dbf8e24385aeb1b4595f54495c9f0
account.current.cyber.contract
must return
cyber158mysantvvk7x65tfhhuu8q2va4ls34rsdydf6
account.current.euler.path
must return
[44, 118, 0, 0, 0]
mastercyb commented 4 years ago

Ux checklist:

mastercyb commented 2 years ago

Need updates