diff --git a/client/v1/issuer/README.md b/client/v1/issuer/README.md new file mode 100644 index 0000000..de21052 --- /dev/null +++ b/client/v1/issuer/README.md @@ -0,0 +1,9 @@ +# Flow + +In order to create a unisgned request to send to a sandbox.genericissuer admin do: +1. `echo '{"controller": ""}' > controller.json` +2. `zenroom -a controller.json -z create-keyring.zen > keys.json` +3. `zenroom -a keys.json -z create-identity-pubkeys.zen > pks.json` +4. `zenroom -a pks.json -k request_input.json -z pubkeys-request-unsigned.zen > req.json` + + diff --git a/client/v1/issuer/create-identity-pubkeys.zen b/client/v1/issuer/create-identity-pubkeys.zen new file mode 100644 index 0000000..a83cc2e --- /dev/null +++ b/client/v1/issuer/create-identity-pubkeys.zen @@ -0,0 +1,30 @@ +rule output encoding base58 +Scenario 'ecdh': Create the pk +Scenario 'ethereum': Create the pk +Scenario 'reflow': Create the pk +Scenario 'eddsa' : Create the pk +Scenario 'credential': Create the pk +Scenario 'bbs': Create the pk +Scenario 'es256': Create the pk + +Given my name is in a 'string' named 'controller' +and I have my 'keyring' + +When I create the ecdh public key +and I create the eddsa public key +and I create the ethereum address +and I create the bitcoin public key +and I create the reflow public key +and I create the issuer public key +and I create the bbs public key +and I create the es256 public key + +Then I print the 'eddsa public key' +and I print the 'ethereum address' +and I print the 'ecdh public key' +and I print the 'bitcoin public key' +and I print the 'reflow public key' +and I print the 'issuer public key' as 'compressed issuer public key' +and I print the 'bbs public key' +and I print the 'es256 public key' +and I print my name in 'identity' diff --git a/client/v1/issuer/create-keyring.zen b/client/v1/issuer/create-keyring.zen new file mode 100644 index 0000000..6e55d0f --- /dev/null +++ b/client/v1/issuer/create-keyring.zen @@ -0,0 +1,22 @@ +Scenario ecdh +Scenario eddsa +Scenario ethereum +Scenario reflow +Scenario es256 +Scenario credential +Scenario bbs + +Given I my name is in a 'string' named 'controller' + +When I create the ecdh key +and I create the eddsa key +and I create the ethereum key +and I create the bitcoin key +and I create the reflow key +and I create the es256 key +and I create the issuer key +and I create the bbs key + +# keyring and explicit owner identity +Then print my 'keyring' +and print my name in 'controller' diff --git a/client/v1/issuer/pubkeys-request-unsigned.zen b/client/v1/issuer/pubkeys-request-unsigned.zen new file mode 100644 index 0000000..b59c877 --- /dev/null +++ b/client/v1/issuer/pubkeys-request-unsigned.zen @@ -0,0 +1,179 @@ +Rule input encoding base58 +Rule output encoding base58 + +Scenario 'ecdh': Move pk in did doc +Scenario 'ethereum': Move pk in did doc +Scenario 'reflow': Move pk in did doc +Scenario 'eddsa' : Move pk in did doc +Scenario 'credential': Move pk in did doc +Scenario 'bbs': Move pk in did doc +Scenario 'es256': Move pk in did doc + +# data +Given I have a 'string array' named '@context' +Given I have a 'string' named 'identity' +and I rename 'identity' to 'description' +Given I have a 'eddsa_public_key' +and I rename 'eddsa_public_key' to 'identity pk' +Given I have a 'ethereum_address' +Given I have a 'ecdh_public_key' +Given I have a 'reflow_public_key' +Given I have a 'bbs_public_key' +Given I have a 'es256_public_key' +Given I have a 'base58' named 'issuer_public_key' +Given I have a 'base58' named 'bitcoin public key' + +# keys +Given I have a 'string' named 'did_spec' + +### Formulate the DID creation request +When I create the 'string dictionary' named 'did document' +and I move '@context' in 'did document' +and I move 'description' in 'did document' + +## did spec and id +When I set 'did:dyne:' to 'did:dyne:' as 'string' +and I append 'did_spec' to 'did:dyne:' +and I append the string ':' to 'did:dyne:' +and I append the 'base58' of 'identity pk' to 'did:dyne:' +and I copy the 'did:dyne:' to 'id' in 'did document' + +## veririfcationMethod +When I create the 'string array' named 'verificationMethod' + +# 1-ecdsa public key +When I create the 'string dictionary' named 'verification-key' +# pk +When I create the 'base58' string of 'ecdh public key' +When I move the 'base58' to 'publicKeyBase58' in 'verification-key' +# type +When I set 'type' to 'EcdsaSecp256k1VerificationKey2019' as 'string' +When I move 'type' in 'verification-key' +# id +When I copy 'did:dyne:' to 'id' +When I append the string '#ecdh_public_key' to 'id' +When I move 'id' in 'verification-key' +# controller +When I copy the 'did:dyne:' to 'controller' in 'verification-key' +When I move 'verification-key' in 'verificationMethod' + +# 2-reflow public key +When I create the 'string dictionary' named 'verification-key' +# pk +When I create the 'base58' string of 'reflow public key' +When I move the 'base58' to 'publicKeyBase58' in 'verification-key' +# type +When I set 'type' to 'ReflowBLS12381VerificationKey' as 'string' +When I move 'type' in 'verification-key' +# id +When I copy 'did:dyne:' to 'id' +When I append the string '#reflow_public_key' to 'id' +When I move 'id' in 'verification-key' +# controller +When I copy the 'did:dyne:' to 'controller' in 'verification-key' +When I move 'verification-key' in 'verificationMethod' + +# 3-bitcoin public key +When I create the 'string dictionary' named 'verification-key' +# pk +When I create the 'base58' string of 'bitcoin public key' +and I move the 'base58' to 'publicKeyBase58' in 'verification-key' +# type +When I set 'type' to 'EcdsaSecp256k1VerificationKey2019' as 'string' +When I move 'type' in 'verification-key' +# id +When I copy 'did:dyne:' to 'id' +When I append the string '#bitcoin_public_key' to 'id' +When I move 'id' in 'verification-key' +# controller +When I copy the 'did:dyne:' to 'controller' in 'verification-key' +When I move 'verification-key' in 'verificationMethod' + +# 4-eddsa public key +When I create the 'string dictionary' named 'verification-key' +# pk +When I create the 'base58' string of 'identity pk' +and I move the 'base58' to 'publicKeyBase58' in 'verification-key' +# type +When I set 'type' to 'Ed25519VerificationKey2018' as 'string' +When I move 'type' in 'verification-key' +# id +When I copy 'did:dyne:' to 'id' +When I append the string '#eddsa_public_key' to 'id' +When I move 'id' in 'verification-key' +# controller +When I copy the 'did:dyne:' to 'controller' in 'verification-key' +When I move 'verification-key' in 'verificationMethod' + +# 5-issuer public key +When I create the 'string dictionary' named 'verification-key' +# pk +When I create the 'base58' string of 'issuer public key' +and I move the 'base58' to 'publicKeyBase58' in 'verification-key' +# type +When I set 'type' to 'IssuerBLS12381VerificationKey' as 'string' +When I move 'type' in 'verification-key' +# id +When I copy 'did:dyne:' to 'id' +When I append the string '#issuer_public_key' to 'id' +When I move 'id' in 'verification-key' +# controller +When I copy the 'did:dyne:' to 'controller' in 'verification-key' +When I move 'verification-key' in 'verificationMethod' + +# 6-bbs public key +When I create the 'string dictionary' named 'verification-key' +# pk +When I create the 'base58' string of 'bbs public key' +and I move the 'base58' to 'publicKeyBase58' in 'verification-key' +# type +When I set 'type' to 'BbsVerificationKey' as 'string' +When I move 'type' in 'verification-key' +# id +When I copy 'did:dyne:' to 'id' +When I append the string '#bbs_public_key' to 'id' +When I move 'id' in 'verification-key' +# controller +When I copy the 'did:dyne:' to 'controller' in 'verification-key' +When I move 'verification-key' in 'verificationMethod' + +# 7-es256 public key +When I create the 'string dictionary' named 'verification-key' +# pk +When I create the 'base58' string of 'es256 public key' +and I move the 'base58' to 'publicKeyBase58' in 'verification-key' +# type +When I set 'type' to 'EcdsaSecp256r1VerificationKey' as 'string' +When I move 'type' in 'verification-key' +# id +When I copy 'did:dyne:' to 'id' +When I append the string '#es256_public_key' to 'id' +When I move 'id' in 'verification-key' +# controller +When I copy the 'did:dyne:' to 'controller' in 'verification-key' +When I move 'verification-key' in 'verificationMethod' + +# 8-ethereum address +When I create the 'string dictionary' named 'verification-key' +# address +# this follows the CAIP-10(https://github.com/ChainAgnostic/CAIPs/blob/master/CAIPs/caip-10.md) spec +# thus it is: namespace + ":" + chain_id + ":" + address +When I set 'blockchainAccountId' to 'eip155:1:0x' as 'string' +When I append the 'hex' of 'ethereum address' to 'blockchainAccountId' +When I move 'blockchainAccountId' in 'verification-key' +# type +When I set 'type' to 'EcdsaSecp256k1RecoveryMethod2020' as 'string' +When I move 'type' in 'verification-key' +# id +When I copy 'did:dyne:' to 'id' +When I append the string '#ethereum_address' to 'id' +When I move 'id' in 'verification-key' +# controller +When I copy the 'did:dyne:' to 'controller' in 'verification-key' +When I move 'verification-key' in 'verificationMethod' + +When I move 'verificationMethod' in 'did document' +### DID-Document ended + +# print did document +Then print the 'did document' as 'string' in 'request' diff --git a/client/v1/issuer/request_input.json b/client/v1/issuer/request_input.json new file mode 100644 index 0000000..f1678a8 --- /dev/null +++ b/client/v1/issuer/request_input.json @@ -0,0 +1,16 @@ +{ + "did_spec": "sandbox.genericissuer", + "@context": [ + "https://www.w3.org/ns/did/v1", + "https://w3id.org/security/suites/ed25519-2018/v1", + "https://w3id.org/security/suites/secp256k1-2019/v1", + "https://w3id.org/security/suites/secp256k1-2020/v1", + "https://dyne.github.io/W3C-DID/specs/ReflowBLS12381.json", + "https://dyne.github.io/W3C-DID/specs/IssuerBLS12381.json", + "https://dyne.github.io/W3C-DID/specs/Bbs.json", + "https://dyne.github.io/W3C-DID/specs/EcdsaSecp256r1.json", + { + "description": "https://schema.org/description" + } + ] +}