FactomProject / factom

Library for writing Factom clients in go
MIT License
44 stars 19 forks source link

Fd 670 Identity walletd API #81

Closed sambarnes closed 5 years ago

sambarnes commented 6 years ago

This branch contains the changes necessary to add Identity support to both the go library and the factom-walletd wsapi. Wasn't entirely sure on the structuring and if Identity and Identity keys belonged in the factom or wallet package (will move them to wallet if people agree that is a better fit).

Documentation for identity chain/entry structures: https://docs.google.com/document/d/1NooBhYdRARwmfqMS0lrbFoXxgbB8cFrsWIl0d0kdhF8/edit?usp=sharing

Request structures:

# Generate a new key pair
'{"jsonrpc": "2.0", "id": 0, "method": "generate-identity-key"}'

# Import an identity private key
'{"jsonrpc": "2.0", "id": 0, "method": "import-identity-keys", "params":{"keys":[{"secret":"idsec..."},{"secret":"idsec..."},{"secret":"idsec..."}]}}'

# Fetch an identity key by its public key ("idpub...")
'{"jsonrpc": "2.0", "id": 0, "method": "identity-key", "params":{"public":"idpub..."}}'

# Get all identity key pairs in the wallet
'{"jsonrpc": "2.0", "id": 0, "method": "all-identity-keys"}'

# Remove a specific identity key pair that corresponds to the given public key
'{"jsonrpc": "2.0", "id": 0, "method": "remove-identity-key", "params":{"public":"idpub..."}}'

# Compose commit/reveal requests for a new identity
'{"jsonrpc": "2.0", "id": 0, "method":"compose-identity-chain", "params":{"name":["John","Jacob","Jingleheimer-Schmidt"]‌, "pubkeys":["idpub...","idpub...","idpub..."], "ecpub":""}}'

# Get valid public keys for an identity
'{"jsonrpc": "2.0", "id": 0, "method":"identity-keys-at-height", "params":{"chainid":"", "height":1600}}'

# Compose commit/reveal requests for identity key replacement
'{"jsonrpc": "2.0", "id": 0, "method": "compose-identity-key-replacement", "params":{"chainid":"", "oldkey":"idpub...", "newkey":"idpub...", "signerkey":"idpub...", "ecpub":""}}'

# Compose commit/reveal requests for an identity attribute
'{"jsonrpc": "2.0", "id": 0, "method": "compose-identity-attribute", "params":{"receiver-chainid":"", "destination-chainid":"", "attributes":[{"key":"email","value":"sam@abc.com"}], "signerkey":"idpub...", "signer-chainid":"", "ecpub":""}}'

# Compose commit/reveal requests for an identity attribute endorsement
'{"jsonrpc": "2.0", "id": 0, "method": "compose-identity-attribute-endorsement", "params":{"destination-chainid":"", "entry-hash":"", "signerkey":"idpub...", "signer-chainid":"", "ecpub":""}}'
michaelbeam commented 5 years ago

changes are already in master branch