2个不稳定版本

0.2.0 2020年7月15日
0.1.0 2020年6月29日

#8 in #本地密钥

ISC许可证

15KB
310 代码行

阳光身份模块

在substrate上实现Keybase Local Key Security,使用ipfs-rust/ipfs-embed

构建

构建Wasm和本地代码

cargo build --release

启动节点

清除任何现有的开发者链状态

./target/release/node-identity purge-chain --dev

使用以下内容启动开发链

./target/release/node-identity --dev

设置您的账户

将您的设备密钥设置为 //Alice

cli-identity key set --suri //Alice
Please enter a new password (8+ characters):

Your device id is 5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY
Your user id is 0

为您的账户添加纸质备份

cli-identity device paperkey
Generating a new paper key.
Here is your secret paper key phrase:

mandate robust earth scan shrimp second pipe pitch eternal snap glare tooth
bean crucial river bar crash nice sorry laundry oppose filter aunt swear

Write it down and keep somewhere safe.

并列出您的设备密钥

cli-identity device list
5Fe8Da8o2TQY6heaopRA9Zs2dpiJ2GFtvWThnd89uxYEXK1q
5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY

证明您的在线身份

添加新的在线身份

cli-identity id prove dvc94ch@github
Claiming dvc94ch@github...
Please *publicly* post the following Gist, and name it 'substrate-identity-proof.md'.

### substrate identity proof

I hereby claim:

  * I am dvc94ch on github.
  * I am 0 on the substrate chain with genesis hash mzyTJZVm7IXDUBeZwyWk6rG1YGIt8BQnNzrshKJCalYI.
  * I have a public key 5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY valid at block with hash mfBFseDYNX31Poqei8A/9teYmxJIj4PFROoKLKEPaStE.

To claim this, I am signing this object:

{"block":[124,17,108,120,54,13,95,125,79,162,167,162,240,15,253,181,230,38,196,146,35,224,241,81,58,130,139,40,67,218,74,209],"body":{"Ownership":[{"Github":["dvc94ch"]}]},"ctime":1591448931056,"expire_in":18446744073709551615,"genesis":[207,36,201,101,89,187,33,112,212,5,230,112,201,105,58,172,109,88,24,139,124,5,9,205,206,187,33,40,144,154,149,130],"prev":null,"public":"5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY","seqno":1,"uid":0}

with the key 5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY, yielding the signature:

mAU6Gon1dqctnS/zPKHd9gWFvEJBqADvgYQy0OFuamA5CwVQk7papR0xBq8DijRqSXVGpJtNFmy7aYJk5cGLxv4c

And finally, I am proving ownership of the github account by posting this as a gist.

并列出您的身份

cli-identity id list
Your user id is 0
dvc94ch@github https://gist.github.com/da8bbf9c69976a3d750e2c433126852b

接收您的公开身份的付款

//Bob 转账到 dvc94ch@github

cli-identity --path /tmp/bob key set --suri //Bob
Please enter a new password (8+ characters):

Your device id is 5FHneW46xGXgs5mUiveU4sbTyGBzmstUspZC92UhjJM694ty
Your user id is 1

确保ipfs正在运行,以便 //Bob 可以获取 //Alice 的身份

cli-identity run

最后进行转账

cli-identity --path /tmp/bob wallet transfer dvc94ch@github 10000
transfered 10000 to 5Fe8Da8o2TQY6heaopRA9Zs2dpiJ2GFtvWThnd89uxYEXK1q

lib.rs:

身份模块。

依赖项

~6–15MB
~198K SLoC