From 2fde2fea2047a7ae6078351be5cf08ed2b6f6ee3 Mon Sep 17 00:00:00 2001 From: Arnab Ghose Date: Tue, 19 Sep 2023 10:43:45 +0530 Subject: [PATCH 1/8] refactor: ed25519 signature verification has been aligned in accordance with EdDsaCryptoSuite2020 W3C specification; this includes canonizing the document using RDF dataset normalization and expecting publicKeyMutibase of verification method type Ed25519VerificationKey2020 to carry a 2-byte prefix as described in the said specification --- cmd/hid-noded/cmd/debug_extensions.go | 27 +++-- go.mod | 2 + go.sum | 4 + proto/ssi/v1/did.proto | 3 +- tests/e2e/ssi_tests/e2e_tests.py | 89 +++++++-------- tests/e2e/ssi_tests/generate_doc.py | 41 ++++--- tests/e2e/ssi_tests/utils.py | 9 +- x/ssi/client/cli/tx_ssi.go | 8 +- x/ssi/client/cli/tx_utils.go | 31 ++++-- x/ssi/ld-context/context.go | 155 ++++++++++++++++++++++++++ x/ssi/ld-context/suite.go | 19 ++++ x/ssi/ld-context/types.go | 74 ++++++++++++ x/ssi/types/common.go | 17 ++- x/ssi/types/did.pb.go | 86 +++++++------- x/ssi/verification/client_spec.go | 13 +++ x/ssi/verification/crypto.go | 32 +++++- 16 files changed, 470 insertions(+), 140 deletions(-) create mode 100644 x/ssi/ld-context/context.go create mode 100644 x/ssi/ld-context/suite.go create mode 100644 x/ssi/ld-context/types.go diff --git a/cmd/hid-noded/cmd/debug_extensions.go b/cmd/hid-noded/cmd/debug_extensions.go index b8fbf59..fd1d536 100644 --- a/cmd/hid-noded/cmd/debug_extensions.go +++ b/cmd/hid-noded/cmd/debug_extensions.go @@ -15,10 +15,10 @@ import ( bbs "github.com/hyperledger/aries-framework-go/component/kmscrypto/crypto/primitive/bbs12381g2pub" hidnodecli "github.com/hypersign-protocol/hid-node/x/ssi/client/cli" "github.com/hypersign-protocol/hid-node/x/ssi/types" + "github.com/iden3/go-iden3-crypto/babyjub" "github.com/multiformats/go-multibase" "github.com/spf13/cobra" secp256k1 "github.com/tendermint/tendermint/crypto/secp256k1" - "github.com/iden3/go-iden3-crypto/babyjub" ) func extendDebug(debugCmd *cobra.Command) *cobra.Command { @@ -327,8 +327,8 @@ func signSchemaDocCmd() *cobra.Command { // Sign Schema Document var signature string switch argSigningAlgo { - case "ed25519": - signature, err = hidnodecli.GetEd25519Signature(argPrivateKey, schemaDocBytes) + case types.Ed25519Signature2020: + signature, err = hidnodecli.GetEd25519Signature2020(argPrivateKey, schemaDocBytes) if err != nil { return err } @@ -389,8 +389,8 @@ func signCredStatusDocCmd() *cobra.Command { // Sign Credential Status Document var signature string switch argSigningAlgo { - case "ed25519": - signature, err = hidnodecli.GetEd25519Signature(argPrivateKey, credStatusDocBytes) + case types.Ed25519Signature2020: + signature, err = hidnodecli.GetEd25519Signature2020(argPrivateKey, credStatusDocBytes) if err != nil { return err } @@ -436,14 +436,21 @@ func ed25519RandomCmd() *cobra.Command { return err } + // A 2-byte header must be prefixed before Ed25519 public key based on + // W3C's Ed25519VerificationKey2020 Specification for the attribute `publicKeyMultibase` + // Read more: https://www.w3.org/community/reports/credentials/CG-FINAL-di-eddsa-2020-20220724/#ed25519verificationkey2020 + var publicKeyWithHeader []byte + publicKeyWithHeader = append(publicKeyWithHeader, append([]byte{0xed, 0x01}, pubKey...)...) + keyInfo := struct { - PubKeyBase64 string `json:"pub_key_base_64"` PubKeyMultibase string `json:"pub_key_multibase"` - PrivKeyBase64 string `json:"priv_key_base_64"` + PrivKeyMultibase string `json:"priv_key_base_64"` }{ - PubKeyBase64: base64.StdEncoding.EncodeToString(pubKey), - PubKeyMultibase: "z" + base58.Encode(pubKey), - PrivKeyBase64: base64.StdEncoding.EncodeToString(privKey), + PubKeyMultibase: "z" + base58.Encode(publicKeyWithHeader), + // W3C's Ed25519VerificationKey2020 Specification has not explicitly mentioned about the encoding of the private key + // or whether it should be prefixed similar to the public key. For now, the encoding of private key remains Base64 + // with no prefix + PrivKeyMultibase: base64.StdEncoding.EncodeToString(privKey), } keyInfoJson, err := json.Marshal(keyInfo) diff --git a/go.mod b/go.mod index 9b95906..7e67b75 100644 --- a/go.mod +++ b/go.mod @@ -11,6 +11,7 @@ require ( github.com/grpc-ecosystem/grpc-gateway v1.16.0 github.com/hyperledger/aries-framework-go/component/kmscrypto v0.0.0-20230727134633-020b60b288ed github.com/iden3/go-iden3-crypto v0.0.15 + github.com/piprate/json-gold v0.5.0 github.com/spf13/cast v1.5.0 github.com/spf13/cobra v1.6.0 github.com/stretchr/testify v1.8.2 @@ -106,6 +107,7 @@ require ( github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect + github.com/pquerna/cachecontrol v0.0.0-20180517163645-1555304b9b35 // indirect github.com/prometheus/client_golang v1.12.2 // indirect github.com/prometheus/client_model v0.2.0 // indirect github.com/prometheus/common v0.34.0 // indirect diff --git a/go.sum b/go.sum index 3017a18..9e18fcf 100644 --- a/go.sum +++ b/go.sum @@ -1007,6 +1007,8 @@ github.com/philhofer/fwd v1.0.0/go.mod h1:gk3iGcWd9+svBvR0sR+KPcfE+RNWozjowpeBVG github.com/philhofer/fwd v1.1.1/go.mod h1:gk3iGcWd9+svBvR0sR+KPcfE+RNWozjowpeBVG3ZVNU= github.com/pierrec/lz4 v1.0.2-0.20190131084431-473cd7ce01a1/go.mod h1:3/3N9NVKO0jef7pBehbT1qWhCMrIgbYNnFAZCqQ5LRc= github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= +github.com/piprate/json-gold v0.5.0 h1:RmGh1PYboCFcchVFuh2pbSWAZy4XJaqTMU4KQYsApbM= +github.com/piprate/json-gold v0.5.0/go.mod h1:WZ501QQMbZZ+3pXFPhQKzNwS1+jls0oqov3uQ2WasLs= github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= @@ -1021,6 +1023,8 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/polyfloyd/go-errorlint v0.0.0-20210722154253-910bb7978349/go.mod h1:wi9BfjxjF/bwiZ701TzmfKu6UKC357IOAtNr0Td0Lvw= github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= +github.com/pquerna/cachecontrol v0.0.0-20180517163645-1555304b9b35 h1:J9b7z+QKAmPf4YLrFg6oQUotqHQeUNWwkvo7jZp1GLU= +github.com/pquerna/cachecontrol v0.0.0-20180517163645-1555304b9b35/go.mod h1:prYjPmNq4d1NPVmpShWobRqXY3q7Vp+80DqgxxUrUIA= github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v0.9.3-0.20190127221311-3c4408c8b829/go.mod h1:p2iRAGwDERtqlqzRXnrOVns+ignqQo//hLXqYxZYVNs= github.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDft0ttaMvbicHlPoso= diff --git a/proto/ssi/v1/did.proto b/proto/ssi/v1/did.proto index 48fa89a..bd632c6 100644 --- a/proto/ssi/v1/did.proto +++ b/proto/ssi/v1/did.proto @@ -4,9 +4,10 @@ package hypersignprotocol.hidnode.ssi; option go_package = "github.com/hypersign-protocol/hid-node/x/ssi/types"; import "ssi/v1/clientSpec.proto"; +import "gogoproto/gogo.proto"; message Did { - repeated string context = 1; + repeated string context = 1 [(gogoproto.jsontag) = "@context"]; string id = 2; repeated string controller = 3; repeated string alsoKnownAs = 4; diff --git a/tests/e2e/ssi_tests/e2e_tests.py b/tests/e2e/ssi_tests/e2e_tests.py index 203f8a2..24a60be 100644 --- a/tests/e2e/ssi_tests/e2e_tests.py +++ b/tests/e2e/ssi_tests/e2e_tests.py @@ -59,7 +59,7 @@ def bbs_signature_test(): print("\n--4. PASS: Update a DID using BLS12381G2 Key Pair--\n") - did_doc_string["context"] = ["http://example.com"] + did_doc_string["alsoKnownAs"] = ["blskeypairDid"] signers = [] signers.append(signPair_alice) update_tx_cmd = form_did_update_tx_multisig(did_doc_string, signers, DEFAULT_BLOCKCHAIN_ACCOUNT_NAME) @@ -74,16 +74,16 @@ def bbs_signature_test(): def key_agrement_test(): print("\n--1. FAIL: Ed25519VerificationKey2020 based Verification Method ID being added to keyAgreement attribute--\n") - kp_alice = generate_key_pair("ed25519") + kp_alice = generate_key_pair("Ed25519Signature2020") signers = [] - did_doc_string = generate_did_document(kp_alice, "ed25519") + did_doc_string = generate_did_document(kp_alice, "Ed25519Signature2020") did_doc_alice = did_doc_string["id"] ed25519Vm = did_doc_string["verificationMethod"][0] did_doc_string["keyAgreement"] = [ed25519Vm["id"]] signPair_alice = { "kp": kp_alice, "verificationMethodId": did_doc_string["verificationMethod"][0]["id"], - "signing_algo": "ed25519" + "signing_algo": "Ed25519Signature2020" } signers.append(signPair_alice) create_tx_cmd = form_did_create_tx_multisig(did_doc_string, signers, DEFAULT_BLOCKCHAIN_ACCOUNT_NAME) @@ -91,9 +91,9 @@ def key_agrement_test(): print("\n--2. FAIL: X25519KeyAgreementKey2020 based Verification Method ID being added to authentication attribute--\n") - kp_bob = generate_key_pair("ed25519") + kp_bob = generate_key_pair("Ed25519Signature2020") signers = [] - did_doc_string = generate_did_document(kp_bob, "ed25519") + did_doc_string = generate_did_document(kp_bob, "Ed25519Signature2020") did_doc_alice = did_doc_string["id"] x25519Vm = add_keyAgreeemnt_pubKeyMultibase(did_doc_string["verificationMethod"][0], "X25519KeyAgreementKey2020") did_doc_string["verificationMethod"] = [x25519Vm] @@ -101,14 +101,14 @@ def key_agrement_test(): signPair_bob = { "kp": kp_bob, "verificationMethodId": did_doc_string["verificationMethod"][0]["id"], - "signing_algo": "ed25519" + "signing_algo": "Ed25519Signature2020" } signers.append(signPair_bob) create_tx_cmd = form_did_create_tx_multisig(did_doc_string, signers, DEFAULT_BLOCKCHAIN_ACCOUNT_NAME) run_blockchain_command(create_tx_cmd, f"Registering Alice's DID with Id: {did_doc_alice}", True, True) print("\n--3. PASS: A DID Document is created with Ed25519VerificationKey2020 and X25519KeyAgreementKey2020 based VMs--\n") - did_doc_string = generate_did_document(kp_alice, "ed25519") + did_doc_string = generate_did_document(kp_alice, "Ed25519Signature2020") signers = [] x25519Vm["controller"] = ed25519Vm["controller"] did_doc_string["verificationMethod"] = [ed25519Vm, x25519Vm] @@ -120,12 +120,12 @@ def key_agrement_test(): print("\n--4. FAIL: An attempt is made to update the DID Document by passing the signature of X25519KeyAgreementKey2020 based verification method") signers = [] - did_doc_string["context"] = ["some_context"] + did_doc_string["alsoKnownAs"] = ["KeyAgreementDid"] did_doc_string["authentication"] = [] signPair_x25519 = { "kp": kp_bob, "verificationMethodId": x25519Vm["id"], - "signing_algo": "ed25519" + "signing_algo": "Ed25519Signature2020" } signers.append(signPair_x25519) update_tx_cmd = form_did_update_tx_multisig(did_doc_string, signers, DEFAULT_BLOCKCHAIN_ACCOUNT_NAME) @@ -133,7 +133,7 @@ def key_agrement_test(): print("\n--5. PASS: An attempt is made to update the DID Document by passing the signature of Ed25519VerificationKey2020 based verification method") signers = [] - did_doc_string["context"] = ["some_context"] + did_doc_string["alsoKnownAs"] = ["KeyAgreementDid"] signers.append(signPair_alice) signers.append(signPair_x25519) update_tx_cmd = form_did_update_tx_multisig(did_doc_string, signers, DEFAULT_BLOCKCHAIN_ACCOUNT_NAME) @@ -261,7 +261,7 @@ def create_did_test(): signPair_alice = { "kp": kp_alice, "verificationMethodId": did_doc_string["verificationMethod"][0]["id"], - "signing_algo": "ed25519" + "signing_algo": "Ed25519Signature2020" } signers.append(signPair_alice) create_tx_cmd = form_did_create_tx_multisig(did_doc_string, signers, DEFAULT_BLOCKCHAIN_ACCOUNT_NAME) @@ -275,7 +275,7 @@ def create_did_test(): signPair_bob = { "kp": kp_bob, "verificationMethodId": did_doc_string["verificationMethod"][0]["id"], - "signing_algo": "ed25519" + "signing_algo": "Ed25519Signature2020" } signers.append(signPair_bob) create_tx_cmd = form_did_create_tx_multisig(did_doc_string, signers, DEFAULT_BLOCKCHAIN_ACCOUNT_NAME) @@ -349,15 +349,15 @@ def create_did_test(): # Alice creates a DID where they keep the VM of their friend Eve in the verificationMethod list of the document print("6. FAIL: Alice creates an Org DID where Alice is the controller, and she adds a verification method of her friend Eve. Only Alice sends the singature.\n") - kp_eve = generate_key_pair("ed25519") - did_doc_string = generate_did_document(kp_eve, algo="ed25519") + kp_eve = generate_key_pair("Ed25519Signature2020") + did_doc_string = generate_did_document(kp_eve, algo="Ed25519Signature2020") did_doc_eve = did_doc_string["id"] did_doc_eve_vms = did_doc_string["verificationMethod"] signers = [] signPair_eve = { "kp": kp_eve, "verificationMethodId": did_doc_string["verificationMethod"][0]["id"], - "signing_algo": "ed25519" + "signing_algo": "Ed25519Signature2020" } signers.append(signPair_eve) create_tx_cmd = form_did_create_tx_multisig(did_doc_string, signers, DEFAULT_BLOCKCHAIN_ACCOUNT_NAME) @@ -400,7 +400,7 @@ def create_did_test(): signPair_alice = { "kp": kp_alice, "verificationMethodId": did_doc_string["verificationMethod"][0]["id"], - "signing_algo": "ed25519" + "signing_algo": "Ed25519Signature2020" } signers.append(signPair_alice) create_tx_cmd = form_did_create_tx_multisig(did_doc_string, signers, DEFAULT_BLOCKCHAIN_ACCOUNT_NAME) @@ -423,7 +423,7 @@ def update_did_test(): signPair_alice = { "kp": kp_alice, "verificationMethodId": did_doc_alice_vm["id"], - "signing_algo": "ed25519" + "signing_algo": "Ed25519Signature2020" } signers.append(signPair_alice) create_tx_cmd = form_did_create_tx_multisig(did_doc_string, signers, DEFAULT_BLOCKCHAIN_ACCOUNT_NAME) @@ -438,7 +438,7 @@ def update_did_test(): signPair_bob = { "kp": kp_bob, "verificationMethodId": did_doc_bob_vm["id"], - "signing_algo": "ed25519" + "signing_algo": "Ed25519Signature2020" } signers.append(signPair_bob) create_tx_cmd = form_did_create_tx_multisig(did_doc_string, signers, DEFAULT_BLOCKCHAIN_ACCOUNT_NAME) @@ -458,7 +458,7 @@ def update_did_test(): # Bob (who is not the controller) attempts to make changes in Org DID signers = [] - did_doc_string["context"] = ["gmm", "gmm2"] + did_doc_string["capabilityDelegation"] = [did_doc_bob_vm["id"]] signers.append(signPair_bob) update_tx_cmd = form_did_update_tx_multisig(did_doc_string, signers, DEFAULT_BLOCKCHAIN_ACCOUNT_NAME) run_blockchain_command(update_tx_cmd, f"Bob (non-controller) attempts to update Org DID with Id: {did_doc_org}", True) @@ -466,7 +466,8 @@ def update_did_test(): # Alice (who is the controller) attempts to make changes in Org DID print("2. PASS: Alice creates an Org DID where alice is the controller, and Bob's VM is added to its VM List only. Alice attempts to update Org DID by sending her signature.\n") signers = [] - did_doc_string["context"] = ["gmm", "gmm2"] + did_doc_string["alsoKnownAs"] = ["gm1", "gm2"] + did_doc_string["capabilityDelegation"] = [did_doc_bob_vm["id"]] signers.append(signPair_alice) update_tx_cmd = form_did_update_tx_multisig(did_doc_string, signers, DEFAULT_BLOCKCHAIN_ACCOUNT_NAME) run_blockchain_command(update_tx_cmd, f"Alice (controller) attempts to update Org DID with Id: {did_doc_org}") @@ -482,7 +483,7 @@ def update_did_test(): signPair_george = { "kp": kp_george, "verificationMethodId": did_doc_george_vm["id"], - "signing_algo": "ed25519" + "signing_algo": "Ed25519Signature2020" } signers.append(signPair_george) update_tx_cmd = form_did_create_tx_multisig(did_doc_string, signers, DEFAULT_BLOCKCHAIN_ACCOUNT_NAME) @@ -537,7 +538,7 @@ def update_did_test(): run_blockchain_command(update_tx_cmd, f"Alice attempts update without any change Tx", True) # Register Alice's DID - print("9. PASS: Jenny creates herself a DID with empty Controller list. She then attempts to update the DIDDoc by changing the context field and passes her signature only.\n") + print("9. PASS: Jenny creates herself a DID with empty Controller list. She then attempts to update the DIDDoc by changing the alsoKnownAs field and passes her signature only.\n") kp_jenny = generate_key_pair() signers = [] did_doc_string = generate_did_document(kp_jenny) @@ -547,14 +548,14 @@ def update_did_test(): signPair_jenny = { "kp": kp_jenny, "verificationMethodId": did_doc_jenny_vm["id"], - "signing_algo": "ed25519" + "signing_algo": "Ed25519Signature2020" } signers.append(signPair_jenny) create_tx_cmd = form_did_create_tx_multisig(did_doc_string, signers, DEFAULT_BLOCKCHAIN_ACCOUNT_NAME) run_blockchain_command(create_tx_cmd, f"Registering of Jenny's DID with Id: {did_doc_jenny}") signers = [] - did_doc_string["context"] = ["yo"] + did_doc_string["capabilityDelegation"] = [did_doc_jenny_vm["id"]] signers.append(signPair_jenny) update_tx_cmd = form_did_update_tx_multisig(did_doc_string, signers, DEFAULT_BLOCKCHAIN_ACCOUNT_NAME) run_blockchain_command(update_tx_cmd, f"Jenny (controller) attempts to update Tx") @@ -570,7 +571,7 @@ def update_did_test(): signPair_jenny = { "kp": kp_jenny, "verificationMethodId": did_doc_jenny_vm["id"], - "signing_algo": "ed25519" + "signing_algo": "Ed25519Signature2020" } signers.append(signPair_jenny) create_tx_cmd = form_did_create_tx_multisig(did_doc_string, signers, DEFAULT_BLOCKCHAIN_ACCOUNT_NAME) @@ -590,12 +591,12 @@ def update_did_test(): signPair_jenny_1 = { "kp": kp_jenny, "verificationMethodId": did_doc_jenny_vm["id"], - "signing_algo": "ed25519" + "signing_algo": "Ed25519Signature2020" } signPair_jenny_2 = { "kp": kp_jenny_2, "verificationMethodId": new_vm_id, - "signing_algo": "ed25519" + "signing_algo": "Ed25519Signature2020" } signers.append(signPair_jenny_1) update_tx_cmd = form_did_update_tx_multisig(did_doc_string, signers, DEFAULT_BLOCKCHAIN_ACCOUNT_NAME) @@ -635,7 +636,7 @@ def deactivate_did(): signPair_alice = { "kp": kp_alice, "verificationMethodId": did_doc_alice_vm["id"], - "signing_algo": "ed25519" + "signing_algo": "Ed25519Signature2020" } signers.append(signPair_alice) create_tx_cmd = form_did_create_tx_multisig(did_doc_string, signers, DEFAULT_BLOCKCHAIN_ACCOUNT_NAME) @@ -650,7 +651,7 @@ def deactivate_did(): signPair_bob = { "kp": kp_bob, "verificationMethodId": did_doc_bob_vm["id"], - "signing_algo": "ed25519" + "signing_algo": "Ed25519Signature2020" } signers.append(signPair_bob) create_tx_cmd = form_did_create_tx_multisig(did_doc_string, signers, DEFAULT_BLOCKCHAIN_ACCOUNT_NAME) @@ -686,7 +687,7 @@ def deactivate_did(): signPair_mike = { "kp": kp_mike, "verificationMethodId": did_doc_mike_vm["id"], - "signing_algo": "ed25519" + "signing_algo": "Ed25519Signature2020" } signers.append(signPair_mike) create_tx_cmd = form_did_create_tx_multisig(did_doc_string, signers, DEFAULT_BLOCKCHAIN_ACCOUNT_NAME) @@ -710,7 +711,7 @@ def deactivate_did(): signPair_mike = { "kp": kp_mike, "verificationMethodId": did_doc_mike_vm["id"], - "signing_algo": "ed25519" + "signing_algo": "Ed25519Signature2020" } signers.append(signPair_mike) create_tx_cmd = form_did_create_tx_multisig(did_doc_string, signers, DEFAULT_BLOCKCHAIN_ACCOUNT_NAME) @@ -725,7 +726,7 @@ def deactivate_did(): # Attempt to update deactivated DID signers = [] signers.append(signPair_mike) - did_doc_string["context"] = ["hii"] + did_doc_string["alsoKnownAs"] = ["selfCustody"] update_tx_cmd = form_did_update_tx_multisig(did_doc_string, signers, DEFAULT_BLOCKCHAIN_ACCOUNT_NAME) run_blockchain_command(update_tx_cmd, f"Bob (non-controller) attempts to update Org DID with Id: {did_doc_org}", True) @@ -745,7 +746,7 @@ def schema_test(): signPair_alice = { "kp": kp_alice, "verificationMethodId": did_doc_alice_vm["id"], - "signing_algo": "ed25519" + "signing_algo": "Ed25519Signature2020" } signers.append(signPair_alice) create_tx_cmd = form_did_create_tx_multisig(did_doc_string, signers, DEFAULT_BLOCKCHAIN_ACCOUNT_NAME) @@ -782,7 +783,7 @@ def schema_test(): signPair_bob = { "kp": kp_bob, "verificationMethodId": did_doc_bob_vm["id"], - "signing_algo": "ed25519" + "signing_algo": "Ed25519Signature2020" } signers.append(signPair_bob) create_tx_cmd = form_did_create_tx_multisig(did_doc_string, signers, DEFAULT_BLOCKCHAIN_ACCOUNT_NAME) @@ -819,7 +820,7 @@ def credential_status_test(): signPair_alice = { "kp": kp_alice, "verificationMethodId": did_doc_alice_vm["id"], - "signing_algo": "ed25519" + "signing_algo": "Ed25519Signature2020" } signers.append(signPair_alice) create_tx_cmd = form_did_create_tx_multisig(did_doc_string, signers, DEFAULT_BLOCKCHAIN_ACCOUNT_NAME) @@ -856,7 +857,7 @@ def credential_status_test(): signPair_bob = { "kp": kp_bob, "verificationMethodId": did_doc_bob_vm["id"], - "signing_algo": "ed25519" + "signing_algo": "Ed25519Signature2020" } signers.append(signPair_bob) create_tx_cmd = form_did_create_tx_multisig(did_doc_string, signers, DEFAULT_BLOCKCHAIN_ACCOUNT_NAME) @@ -1170,7 +1171,7 @@ def vm_type_test(): signPair_alice = { "kp": kp_alice, "verificationMethodId": did_doc_string["verificationMethod"][0]["id"], - "signing_algo": "ed25519" + "signing_algo": "Ed25519Signature2020" } signers.append(signPair_alice) create_tx_cmd = form_did_create_tx_multisig(did_doc_string, signers, DEFAULT_BLOCKCHAIN_ACCOUNT_NAME) @@ -1186,7 +1187,7 @@ def vm_type_test(): signPair_alice = { "kp": kp_alice, "verificationMethodId": did_doc_string["verificationMethod"][0]["id"], - "signing_algo": "ed25519" + "signing_algo": "Ed25519Signature2020" } signers.append(signPair_alice) create_tx_cmd = form_did_create_tx_multisig(did_doc_string, signers, DEFAULT_BLOCKCHAIN_ACCOUNT_NAME) @@ -1200,7 +1201,7 @@ def vm_type_test(): signPair_alice = { "kp": kp_alice, "verificationMethodId": did_doc_string["verificationMethod"][0]["id"], - "signing_algo": "ed25519" + "signing_algo": "Ed25519Signature2020" } signers.append(signPair_alice) create_tx_cmd = form_did_create_tx_multisig(did_doc_string, signers, DEFAULT_BLOCKCHAIN_ACCOUNT_NAME) @@ -1341,7 +1342,7 @@ def method_specific_id_test(): print("3. PASS: Registering a DID Document where the user provides a multibase encoded public key in MSI that they own") - kp_algo = "ed25519" + kp_algo = "Ed25519Signature2020" kp_alice = generate_key_pair(algo=kp_algo) signers = [] did_doc_string = generate_did_document(kp_alice, algo=kp_algo) @@ -1358,7 +1359,7 @@ def method_specific_id_test(): print("4. PASS: Registering a DID Document where the user provides a multibase encoded public key in MSI that they don't own") - kp_algo = "ed25519" + kp_algo = "Ed25519Signature2020" kp_bob = generate_key_pair(algo=kp_algo) signers = [] did_doc_string = generate_did_document(kp_bob, algo=kp_algo) @@ -1412,7 +1413,7 @@ def method_specific_id_test(): print("7. PASS: Alice tries to update their DID Document by removing the Verification Method associated with the method specific id (Multibase Encoded PublicKey)") - kp_algo = "ed25519" + kp_algo = "Ed25519Signature2020" kp_alice = generate_key_pair(algo=kp_algo) signers = [] did_doc_string = generate_did_document(kp_alice, algo=kp_algo) @@ -1483,7 +1484,7 @@ def bjj_signature_test(): print("\n--4. PASS: Update a DID using BabyJubJub Key Pair--\n") - did_doc_string["context"] = ["http://example.com"] + did_doc_string["alsoKnownAs"] = ["http://example.com"] signers = [] signers.append(signPair_alice) update_tx_cmd = form_did_update_tx_multisig(did_doc_string, signers, DEFAULT_BLOCKCHAIN_ACCOUNT_NAME) diff --git a/tests/e2e/ssi_tests/generate_doc.py b/tests/e2e/ssi_tests/generate_doc.py index 186e737..b707fe3 100644 --- a/tests/e2e/ssi_tests/generate_doc.py +++ b/tests/e2e/ssi_tests/generate_doc.py @@ -6,22 +6,27 @@ from utils import run_command, generate_document_id, get_document_signature, \ secp256k1_pubkey_to_address -def generate_did_document(key_pair, algo="ed25519", bech32prefix="hid", is_uuid=False): +ED25519_CONTEXT = "https://w3id.org/security/suites/ed25519-2020/v1" +DID_CONTEXT = "https://www.w3.org/ns/did/v1" + +def generate_did_document(key_pair, algo="Ed25519Signature2020", bech32prefix="hid", is_uuid=False): base_document = { "context" : [ - "https://www.w3.org/ns/did/v1" + DID_CONTEXT, ], "id": "", "controller": [], "verificationMethod": [], "authentication": [], } + if algo == "Ed25519Signature2020": + base_document["context"].append(ED25519_CONTEXT) did_id = generate_document_id("did", key_pair, algo, is_uuid) # Form the DID Document vm_type = "" - if algo == "ed25519": + if algo == "Ed25519Signature2020": vm_type = "Ed25519VerificationKey2020" elif algo == "secp256k1": vm_type = "EcdsaSecp256k1VerificationKey2019" @@ -34,13 +39,21 @@ def generate_did_document(key_pair, algo="ed25519", bech32prefix="hid", is_uuid= else: raise Exception("unknown signing algorithm: " + key_pair) - verification_method = { - "id": "", - "type": "", - "controller": "", - "blockchainAccountId": "", - "publicKeyMultibase": "" - } + verification_method = {} + if algo == "recover-eth": + verification_method = { + "id": "", + "type": "", + "controller": "", + "blockchainAccountId": "" + } + else: + verification_method = { + "id": "", + "type": "", + "controller": "", + "publicKeyMultibase": "" + } if algo == "recover-eth": verification_method["blockchainAccountId"] = "eip155:1:" + key_pair["ethereum_address"] @@ -72,7 +85,7 @@ def generate_did_document(key_pair, algo="ed25519", bech32prefix="hid", is_uuid= base_document["assertionMethod"] = [] return base_document -def generate_schema_document(key_pair, schema_author, vm, signature=None, algo="ed25519"): +def generate_schema_document(key_pair, schema_author, vm, signature=None, algo="Ed25519Signature2020"): base_schema_doc = { "type": "https://schema.org/Person", "modelVersion": "v1.0", @@ -90,7 +103,7 @@ def generate_schema_document(key_pair, schema_author, vm, signature=None, algo=" } proof_type = "" - if algo == "ed25519": + if algo == "Ed25519Signature2020": proof_type = "Ed25519Signature2020" elif algo == "secp256k1": proof_type = "EcdsaSecp256k1Signature2019" @@ -124,7 +137,7 @@ def generate_schema_document(key_pair, schema_author, vm, signature=None, algo=" return base_schema_doc, base_schema_proof -def generate_cred_status_document(key_pair, cred_author, vm, signature=None, algo="ed25519"): +def generate_cred_status_document(key_pair, cred_author, vm, signature=None, algo="Ed25519Signature2020"): base_cred_status_doc = { "claim": { "id": "", @@ -138,7 +151,7 @@ def generate_cred_status_document(key_pair, cred_author, vm, signature=None, alg } proof_type = "" - if algo == "ed25519": + if algo == "Ed25519Signature2020": proof_type = "Ed25519Signature2020" elif algo == "secp256k1": proof_type = "EcdsaSecp256k1Signature2019" diff --git a/tests/e2e/ssi_tests/utils.py b/tests/e2e/ssi_tests/utils.py index cb08182..6782f19 100644 --- a/tests/e2e/ssi_tests/utils.py +++ b/tests/e2e/ssi_tests/utils.py @@ -45,9 +45,9 @@ def run_blockchain_command(cmd_string: str, transaction_name: str = None, expect print(f"{transaction_name} : Error while executing transaction command\n") raise(e) -def generate_key_pair(algo="ed25519"): +def generate_key_pair(algo="Ed25519Signature2020"): cmd = "" - if algo == "ed25519": + if algo == "Ed25519Signature2020": cmd = "hid-noded debug ed25519 random" elif algo == "secp256k1": cmd = "hid-noded debug secp256k1 random" @@ -76,7 +76,7 @@ def add_keyAgreeemnt_pubKeyMultibase(verification_method, type): return verification_method -def generate_document_id(doc_type: str, kp: dict = None, algo: str = "ed25519", is_uuid: bool =False): +def generate_document_id(doc_type: str, kp: dict = None, algo: str = "Ed25519Signature2020", is_uuid: bool =False): id = "" if not kp: kp = generate_key_pair(algo) @@ -123,6 +123,9 @@ def get_document_signature(doc: dict, doc_type: str, key_pair: dict, algo: str = cmd_string = f"hid-noded debug sign-ssi-doc {doc_cmd} '{json.dumps(doc)}' {private_key} {algo}" signature, _ = run_command(cmd_string) + + if signature == "": + raise Exception(f"Signature came empty while running command: {cmd_string}") return signature def secp256k1_pubkey_to_address(pub_key, prefix): diff --git a/x/ssi/client/cli/tx_ssi.go b/x/ssi/client/cli/tx_ssi.go index 6458a8e..048fe39 100644 --- a/x/ssi/client/cli/tx_ssi.go +++ b/x/ssi/client/cli/tx_ssi.go @@ -52,7 +52,7 @@ func CmdCreateDID() *cobra.Command { } // Prepare Signatures - signInfos, err = getSignatures(cmd, didDoc.GetSignBytes(), args[1:]) + signInfos, err = getSignatures(cmd, &didDoc, args[1:]) if err != nil { return err } @@ -99,7 +99,7 @@ func CmdCreateDID() *cobra.Command { return err } - signatureBytes, _, err := kr.SignByAddress(txAuthorAddr, didDoc.GetSignBytes()) + signatureBytes, _, err := kr.SignByAddress(txAuthorAddr, didDocBytes) if err != nil { return err } @@ -153,7 +153,7 @@ func CmdUpdateDID() *cobra.Command { return err } - signInfos, err := getSignatures(cmd, didDoc.GetSignBytes(), args[2:]) + signInfos, err := getSignatures(cmd, &didDoc, args[2:]) if err != nil { return err } @@ -246,7 +246,7 @@ func CmdDeactivateDID() *cobra.Command { } didDoc := resolvedDidDocument.GetDidDocument() - signInfos, err := getSignatures(cmd, didDoc.GetSignBytes(), args[2:]) + signInfos, err := getSignatures(cmd, didDoc, args[2:]) if err != nil { return err } diff --git a/x/ssi/client/cli/tx_utils.go b/x/ssi/client/cli/tx_utils.go index 7f24a17..1423859 100644 --- a/x/ssi/client/cli/tx_utils.go +++ b/x/ssi/client/cli/tx_utils.go @@ -8,12 +8,13 @@ import ( "fmt" "math/big" - "golang.org/x/crypto/sha3" "github.com/cosmos/cosmos-sdk/types/bech32" + ldcontext "github.com/hypersign-protocol/hid-node/x/ssi/ld-context" "github.com/hypersign-protocol/hid-node/x/ssi/types" "github.com/multiformats/go-multibase" secp256k1 "github.com/tendermint/tendermint/crypto/secp256k1" "golang.org/x/crypto/ripemd160" // nolint: staticcheck + "golang.org/x/crypto/sha3" etheraccounts "github.com/ethereum/go-ethereum/accounts" etherhexutil "github.com/ethereum/go-ethereum/common/hexutil" @@ -21,8 +22,8 @@ import ( bbs "github.com/hyperledger/aries-framework-go/component/kmscrypto/crypto/primitive/bbs12381g2pub" - "github.com/spf13/cobra" "github.com/iden3/go-iden3-crypto/babyjub" + "github.com/spf13/cobra" ) // Extract Verification Method Ids and their respective signatures from Arguments @@ -133,7 +134,7 @@ func GetSecp256k1Signature(privateKey string, message []byte) (string, error) { return base64.StdEncoding.EncodeToString(signature), nil } -func GetEd25519Signature(privateKey string, message []byte) (string, error) { +func GetEd25519Signature2020(privateKey string, message []byte) (string, error) { // Decode key into bytes privKeyBytes, err := base64.StdEncoding.DecodeString(privateKey) if err != nil { @@ -143,10 +144,10 @@ func GetEd25519Signature(privateKey string, message []byte) (string, error) { // Sign Message signatureBytes := ed25519.Sign(privKeyBytes, message) - return base64.StdEncoding.EncodeToString(signatureBytes), nil + return multibase.Encode(multibase.Base58BTC, signatureBytes) } -func getSignatures(cmd *cobra.Command, message []byte, cmdArgs []string) ([]*types.SignInfo, error) { +func getSignatures(cmd *cobra.Command, didDoc *types.Did, cmdArgs []string) ([]*types.SignInfo, error) { var signInfoList []*types.SignInfo didSigningElementsList, err := extractDIDSigningElements(cmdArgs) @@ -162,34 +163,40 @@ func getSignatures(cmd *cobra.Command, message []byte, cmdArgs []string) ([]*typ // Sign based on the Signing Algorithm switch didSigningElementsList[i].SignAlgo { - case "ed25519": - signInfoList[i].Signature, err = GetEd25519Signature(didSigningElementsList[i].SignKey, message) + case types.Ed25519Signature2020: + // Perform EdDSACryptoSuite2020 Normalization + didDocBytes, err := ldcontext.EdDSACryptoSuite2020Canonize(didDoc) + if err != nil { + return nil, err + } + + signInfoList[i].Signature, err = GetEd25519Signature2020(didSigningElementsList[i].SignKey, didDocBytes[:]) if err != nil { return nil, err } case "secp256k1": - signInfoList[i].Signature, err = GetSecp256k1Signature(didSigningElementsList[i].SignKey, message) + signInfoList[i].Signature, err = GetSecp256k1Signature(didSigningElementsList[i].SignKey, didDoc.GetSignBytes()) if err != nil { return nil, err } case "recover-eth": - signInfoList[i].Signature, err = GetEthRecoverySignature(didSigningElementsList[i].SignKey, message) + signInfoList[i].Signature, err = GetEthRecoverySignature(didSigningElementsList[i].SignKey, didDoc.GetSignBytes()) if err != nil { return nil, err } case "bbs": - signInfoList[i].Signature, err = GetBBSSignature(didSigningElementsList[i].SignKey, message) + signInfoList[i].Signature, err = GetBBSSignature(didSigningElementsList[i].SignKey, didDoc.GetSignBytes()) if err != nil { return nil, err } case "bjj": - signInfoList[i].Signature, err = GetBJJSignature(didSigningElementsList[i].SignKey, message) + signInfoList[i].Signature, err = GetBJJSignature(didSigningElementsList[i].SignKey, didDoc.GetSignBytes()) if err != nil { return nil, err } default: return nil, fmt.Errorf( - "unsupported signing algorithm %s, supported signing algorithms: ['ed25519', 'secp256k1', 'recover-eth', 'bbs', 'bjj']", + "unsupported signing algorithm %s, supported signing algorithms: ['Ed25519Signature2020', 'secp256k1', 'recover-eth', 'bbs', 'bjj']", didSigningElementsList[i].SignAlgo, ) } diff --git a/x/ssi/ld-context/context.go b/x/ssi/ld-context/context.go new file mode 100644 index 0000000..5ee6819 --- /dev/null +++ b/x/ssi/ld-context/context.go @@ -0,0 +1,155 @@ +package ldcontext + +const didContext string = "https://www.w3.org/ns/did/v1" +const ed25519Context2020 string = "https://w3id.org/security/suites/ed25519-2020/v1" + +// As hid-node is not supposed to perform any GET request, the complete Context body of their +// respective Context urls has been maintained below. +var ContextUrlMap map[string]contextObject = map[string]contextObject{ + didContext: { + "@protected": true, + "id": "@id", + "type": "@type", + "alsoKnownAs": map[string]interface{}{ + "@id": "https://www.w3.org/ns/activitystreams#alsoKnownAs", + "@type": "@id", + }, + "assertionMethod": map[string]interface{}{ + "@id": "https://w3id.org/security#assertionMethod", + "@type": "@id", + "@container": "@set", + }, + "authentication": map[string]interface{}{ + "@id": "https://w3id.org/security#authenticationMethod", + "@type": "@id", + "@container": "@set", + }, + "capabilityDelegation": map[string]interface{}{ + "@id": "https://w3id.org/security#capabilityDelegationMethod", + "@type": "@id", + "@container": "@set", + }, + "capabilityInvocation": map[string]interface{}{ + "@id": "https://w3id.org/security#capabilityInvocationMethod", + "@type": "@id", + "@container": "@set", + }, + "controller": map[string]interface{}{ + "@id": "https://w3id.org/security#controller", + "@type": "@id", + }, + "keyAgreement": map[string]interface{}{ + "@id": "https://w3id.org/security#keyAgreementMethod", + "@type": "@id", + "@container": "@set", + }, + "service": map[string]interface{}{ + "@id": "https://www.w3.org/ns/did#service", + "@type": "@id", + "@context": map[string]interface{}{ + "@protected": true, + "id": "@id", + "type": "@type", + "serviceEndpoint": map[string]interface{}{ + "@id": "https://www.w3.org/ns/did#serviceEndpoint", + "@type": "@id", + }, + }, + }, + "verificationMethod": map[string]interface{}{ + "@id": "https://w3id.org/security#verificationMethod", + "@type": "@id", + }, + }, + ed25519Context2020: { + "id": "@id", + "type": "@type", + "@protected": true, + "proof": map[string]interface{}{ + "@id": "https://w3id.org/security#proof", + "@type": "@id", + "@container": "@graph", + }, + "Ed25519VerificationKey2020": map[string]interface{}{ + "@id": "https://w3id.org/security#Ed25519VerificationKey2020", + "@context": map[string]interface{}{ + "@protected": true, + "id": "@id", + "type": "@type", + "controller": map[string]interface{}{ + "@id": "https://w3id.org/security#controller", + "@type": "@id", + }, + "revoked": map[string]interface{}{ + "@id": "https://w3id.org/security#revoked", + "@type": "http://www.w3.org/2001/XMLSchema#dateTime", + }, + "publicKeyMultibase": map[string]interface{}{ + "@id": "https://w3id.org/security#publicKeyMultibase", + "@type": "https://w3id.org/security#multibase", + }, + }, + }, + "Ed25519Signature2020": map[string]interface{}{ + "@id": "https://w3id.org/security#Ed25519Signature2020", + "@context": map[string]interface{}{ + "@protected": true, + "id": "@id", + "type": "@type", + "challenge": "https://w3id.org/security#challenge", + "created": map[string]interface{}{ + "@id": "http://purl.org/dc/terms/created", + "@type": "http://www.w3.org/2001/XMLSchema#dateTime", + }, + "domain": "https://w3id.org/security#domain", + "expires": map[string]interface{}{ + "@id": "https://w3id.org/security#expiration", + "@type": "http://www.w3.org/2001/XMLSchema#dateTime", + }, + "nonce": "https://w3id.org/security#nonce", + "proofPurpose": map[string]interface{}{ + "@id": "https://w3id.org/security#proofPurpose", + "@type": "@vocab", + "@context": map[string]interface{}{ + "@protected": true, + "id": "@id", + "type": "@type", + "assertionMethod": map[string]interface{}{ + "@id": "https://w3id.org/security#assertionMethod", + "@type": "@id", + "@container": "@set", + }, + "authentication": map[string]interface{}{ + "@id": "https://w3id.org/security#authenticationMethod", + "@type": "@id", + "@container": "@set", + }, + "capabilityInvocation": map[string]interface{}{ + "@id": "https://w3id.org/security#capabilityInvocationMethod", + "@type": "@id", + "@container": "@set", + }, + "capabilityDelegation": map[string]interface{}{ + "@id": "https://w3id.org/security#capabilityDelegationMethod", + "@type": "@id", + "@container": "@set", + }, + "keyAgreement": map[string]interface{}{ + "@id": "https://w3id.org/security#keyAgreementMethod", + "@type": "@id", + "@container": "@set", + }, + }, + }, + "proofValue": map[string]interface{}{ + "@id": "https://w3id.org/security#proofValue", + "@type": "https://w3id.org/security#multibase", + }, + "verificationMethod": map[string]interface{}{ + "@id": "https://w3id.org/security#verificationMethod", + "@type": "@id", + }, + }, + }, + }, +} diff --git a/x/ssi/ld-context/suite.go b/x/ssi/ld-context/suite.go new file mode 100644 index 0000000..bbe6290 --- /dev/null +++ b/x/ssi/ld-context/suite.go @@ -0,0 +1,19 @@ +package ldcontext + +import ( + "crypto/sha256" + + "github.com/hypersign-protocol/hid-node/x/ssi/types" +) + +// EdDSACryptoSuite2020Canonize canonizes DID Document in accordance with +// EdDSA Cryptosuite v2020 (https://www.w3.org/community/reports/credentials/CG-FINAL-di-eddsa-2020-20220724/) +func EdDSACryptoSuite2020Canonize(didDoc *types.Did) ([]byte, error) { + jsonLdDid := NewJsonLdDid(didDoc) + canonizedDidDocument, err := jsonLdDid.NormalizeWithURDNA2015() + if err != nil { + return nil, err + } + canonizedDidDocumentHash := sha256.Sum256([]byte(canonizedDidDocument)) + return canonizedDidDocumentHash[:], nil +} diff --git a/x/ssi/ld-context/types.go b/x/ssi/ld-context/types.go new file mode 100644 index 0000000..db5c922 --- /dev/null +++ b/x/ssi/ld-context/types.go @@ -0,0 +1,74 @@ +package ldcontext + +import ( + "fmt" + + "github.com/hypersign-protocol/hid-node/x/ssi/types" + "github.com/piprate/json-gold/ld" +) + +type contextObject map[string]interface{} + +// It is a similar to `Did` struct, with the exception that the `context` attribute is of type +// `contextObject` instead of `[]string`, which is meant for accomodating Context JSON body +// having arbritrary attributes. It should be used for performing Canonization. +type JsonLdDid struct { + Context []contextObject `json:"@context,omitempty"` + Id string `json:"id,omitempty"` + Controller []string `json:"controller,omitempty"` + AlsoKnownAs []string `json:"alsoKnownAs,omitempty"` + VerificationMethod []*types.VerificationMethod `json:"verificationMethod,omitempty"` + Authentication []string `json:"authentication,omitempty"` + AssertionMethod []string `json:"assertionMethod,omitempty"` + KeyAgreement []string `json:"keyAgreement,omitempty"` + CapabilityInvocation []string `json:"capabilityInvocation,omitempty"` + CapabilityDelegation []string `json:"capabilityDelegation,omitempty"` + Service []*types.Service `json:"service,omitempty"` +} + +// NewJsonLdDid returns a new JsonLdDid struct from input Did +func NewJsonLdDid(didDoc *types.Did) *JsonLdDid { + if len(didDoc.Context) == 0 { + panic("atleast one context url must be provided for DID Document for Canonization") + } + + var jsonLdDoc *JsonLdDid = &JsonLdDid{} + + for _, url := range didDoc.Context { + contextObj, ok := ContextUrlMap[url] + if !ok { + panic(fmt.Sprintf("invalid or unsupported context url: %v", url)) + } + jsonLdDoc.Context = append(jsonLdDoc.Context, contextObj) + } + + jsonLdDoc.Id = didDoc.Id + jsonLdDoc.AlsoKnownAs = didDoc.AlsoKnownAs + jsonLdDoc.AssertionMethod = didDoc.AssertionMethod + jsonLdDoc.Authentication = didDoc.Authentication + jsonLdDoc.CapabilityDelegation = didDoc.CapabilityDelegation + jsonLdDoc.CapabilityInvocation = didDoc.CapabilityInvocation + jsonLdDoc.Service = didDoc.Service + jsonLdDoc.VerificationMethod = didDoc.VerificationMethod + jsonLdDoc.Controller = didDoc.Controller + jsonLdDoc.KeyAgreement = didDoc.KeyAgreement + + return jsonLdDoc +} + +// NormalizeWithURDNA2015 performs RDF Canonization upon JsonLdDid using URDNA2015 +// algorithm and returns the canonized document in string +func (doc *JsonLdDid) NormalizeWithURDNA2015() (string, error) { + proc := ld.NewJsonLdProcessor() + options := ld.NewJsonLdOptions("") + options.Algorithm = ld.AlgorithmURDNA2015 + options.Format = "application/n-quads" + + normalisedJsonLdDid, err := proc.Normalize(doc, options) + if err != nil { + return "", fmt.Errorf("unable to Normalize DID Document: %v", err.Error()) + } + + canonizedDocString := normalisedJsonLdDid.(string) + return canonizedDocString, nil +} diff --git a/x/ssi/types/common.go b/x/ssi/types/common.go index db124e1..99ad149 100644 --- a/x/ssi/types/common.go +++ b/x/ssi/types/common.go @@ -13,15 +13,22 @@ const X25519KeyAgreementKeyEIP5630 = "X25519KeyAgreementKeyEIP5630" // TODO: Tem const Bls12381G2Key2020 = "Bls12381G2Key2020" const BabyJubJubVerificationKey2023 = "BabyJubJubVerificationKey2023" +// Supported Proof Types +const Ed25519Signature2020 = "Ed25519Signature2020" +const EcdsaSecp256k1Signature2019 = "EcdsaSecp256k1Signature2019" +const EcdsaSecp256k1RecoverySignature2020 = "EcdsaSecp256k1RecoverySignature2020" +const BabyJubJubSignature2023 = "BabyJubJubSignature2023" +const BbsBlsSignature2020 = "BbsBlsSignature2020" + // Mapping between Verification Key and its corresponding Signature var VerificationKeySignatureMap = map[string]string{ - Ed25519VerificationKey2020: "Ed25519Signature2020", - EcdsaSecp256k1VerificationKey2019: "EcdsaSecp256k1Signature2019", - EcdsaSecp256k1RecoveryMethod2020: "EcdsaSecp256k1RecoverySignature2020", + Ed25519VerificationKey2020: Ed25519Signature2020, + EcdsaSecp256k1VerificationKey2019: EcdsaSecp256k1Signature2019, + EcdsaSecp256k1RecoveryMethod2020: EcdsaSecp256k1RecoverySignature2020, X25519KeyAgreementKey2020: "", // Authentication and Assertion are not allowed X25519KeyAgreementKeyEIP5630: "", // Authentication and Assertion are not allowed - BabyJubJubVerificationKey2023: "BabyJubJubSignature2023", - Bls12381G2Key2020: "BbsBlsSignature2020", + BabyJubJubVerificationKey2023: BabyJubJubSignature2023, + Bls12381G2Key2020: BbsBlsSignature2020, } var supportedVerificationMethodTypes []string = func() []string { diff --git a/x/ssi/types/did.pb.go b/x/ssi/types/did.pb.go index 192eba7..b264abd 100644 --- a/x/ssi/types/did.pb.go +++ b/x/ssi/types/did.pb.go @@ -5,6 +5,7 @@ package types import ( fmt "fmt" + _ "github.com/gogo/protobuf/gogoproto" proto "github.com/gogo/protobuf/proto" io "io" math "math" @@ -23,7 +24,7 @@ var _ = math.Inf const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package type Did struct { - Context []string `protobuf:"bytes,1,rep,name=context,proto3" json:"context,omitempty"` + Context []string `protobuf:"bytes,1,rep,name=context,proto3" json:"@context"` Id string `protobuf:"bytes,2,opt,name=id,proto3" json:"id,omitempty"` Controller []string `protobuf:"bytes,3,rep,name=controller,proto3" json:"controller,omitempty"` AlsoKnownAs []string `protobuf:"bytes,4,rep,name=alsoKnownAs,proto3" json:"alsoKnownAs,omitempty"` @@ -474,48 +475,49 @@ func init() { func init() { proto.RegisterFile("ssi/v1/did.proto", fileDescriptor_cddfa22cf6c6aba3) } var fileDescriptor_cddfa22cf6c6aba3 = []byte{ - // 646 bytes of a gzipped FileDescriptorProto + // 671 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x54, 0xc1, 0x6e, 0xd3, 0x4a, - 0x14, 0xad, 0x9b, 0xbe, 0x26, 0xb9, 0x7e, 0x6a, 0xab, 0x69, 0xf5, 0x9e, 0x85, 0xc0, 0x8a, 0xbc, - 0x28, 0x61, 0x51, 0x87, 0x06, 0x3e, 0x80, 0x42, 0x58, 0x44, 0xa5, 0x1b, 0x47, 0x02, 0xc1, 0xa6, - 0x9a, 0xcc, 0xdc, 0xc6, 0xa3, 0xba, 0x33, 0x96, 0x3d, 0x0e, 0xcd, 0x86, 0x6f, 0xe0, 0x37, 0x58, - 0xb3, 0xe3, 0x0b, 0x58, 0x76, 0xc9, 0x12, 0xb5, 0xbf, 0xc0, 0x07, 0x20, 0x4f, 0xec, 0xc4, 0x4d, - 0x22, 0xc2, 0x2e, 0xf7, 0x9c, 0x7b, 0xe6, 0x9e, 0xdc, 0x7b, 0x64, 0xd8, 0x4b, 0x53, 0xd1, 0x19, - 0x1f, 0x77, 0xb8, 0xe0, 0x7e, 0x9c, 0x28, 0xad, 0xc8, 0xa3, 0x70, 0x12, 0x63, 0x92, 0x8a, 0x91, - 0x34, 0x35, 0x53, 0x91, 0x1f, 0x0a, 0x2e, 0x15, 0x47, 0x3f, 0x4d, 0xc5, 0x83, 0xff, 0x0b, 0x01, - 0x8b, 0x04, 0x4a, 0x3d, 0x88, 0x91, 0x4d, 0x75, 0xde, 0xaf, 0x1a, 0xd4, 0x7a, 0x82, 0x13, 0x07, - 0xea, 0x4c, 0x49, 0x8d, 0xd7, 0xda, 0xb1, 0x5a, 0xb5, 0x76, 0x33, 0x28, 0x4b, 0xb2, 0x03, 0x9b, - 0x82, 0x3b, 0x9b, 0x2d, 0xab, 0xdd, 0x0c, 0x36, 0x05, 0x27, 0x2e, 0x40, 0x4e, 0x25, 0x2a, 0x8a, - 0x30, 0x71, 0x6a, 0xa6, 0xb9, 0x82, 0x90, 0x16, 0xd8, 0x34, 0x4a, 0xd5, 0xa9, 0x54, 0x1f, 0xe5, - 0x49, 0xea, 0x6c, 0x99, 0x86, 0x2a, 0x44, 0x28, 0x90, 0x31, 0x26, 0xe2, 0x42, 0x30, 0xaa, 0x85, - 0x92, 0x67, 0xa8, 0x43, 0xc5, 0x9d, 0x7f, 0x5a, 0xb5, 0xb6, 0xdd, 0x3d, 0xf6, 0xff, 0xf8, 0x47, - 0xfc, 0xb7, 0x4b, 0xc2, 0x60, 0xc5, 0x63, 0xe4, 0x10, 0x76, 0x68, 0xa6, 0x43, 0x94, 0xba, 0xc0, - 0x9d, 0x6d, 0xe3, 0x63, 0x01, 0x25, 0x6d, 0xd8, 0xa5, 0x69, 0x8a, 0x49, 0xc5, 0x47, 0xdd, 0x34, - 0x2e, 0xc2, 0xc4, 0x83, 0x7f, 0x2f, 0x71, 0x72, 0x32, 0x4a, 0x10, 0xaf, 0x50, 0x6a, 0xa7, 0x61, - 0xda, 0xee, 0x61, 0xa4, 0x0b, 0x07, 0x8c, 0xc6, 0x74, 0x28, 0x22, 0xa1, 0x27, 0x7d, 0x39, 0x56, - 0xc5, 0xec, 0xa6, 0xe9, 0x5d, 0xc9, 0xdd, 0xd7, 0xf4, 0x30, 0xc2, 0xd1, 0x54, 0x03, 0x8b, 0x9a, - 0x39, 0x47, 0x5e, 0x40, 0x3d, 0xc5, 0x64, 0x2c, 0x18, 0x3a, 0xb6, 0xd9, 0xda, 0xe1, 0x9a, 0xad, - 0x0d, 0xa6, 0xdd, 0x41, 0x29, 0xf3, 0x3e, 0x41, 0xe3, 0x0c, 0x35, 0xe5, 0x54, 0x53, 0x73, 0xfa, - 0x04, 0xa9, 0x46, 0xee, 0x58, 0xe6, 0xca, 0x65, 0x99, 0x33, 0x59, 0xcc, 0x0d, 0x33, 0xbd, 0x7f, - 0x59, 0xe6, 0x47, 0xe6, 0x48, 0x99, 0x16, 0x63, 0xc3, 0xd6, 0x5a, 0x56, 0xbb, 0x11, 0x54, 0x21, - 0xf2, 0x10, 0x9a, 0xe3, 0xdc, 0x91, 0x92, 0x7d, 0xee, 0x6c, 0x19, 0xf5, 0x1c, 0xf0, 0xbe, 0x59, - 0x40, 0x96, 0x4f, 0x59, 0x64, 0xcd, 0x9a, 0x65, 0x8d, 0xc0, 0x96, 0x9e, 0xc4, 0x58, 0x4c, 0x37, - 0xbf, 0x97, 0xf2, 0x67, 0x2d, 0xe4, 0xcf, 0x07, 0x12, 0x67, 0xc3, 0x48, 0xb0, 0x53, 0x9c, 0x9c, - 0x65, 0x91, 0x16, 0x43, 0x9a, 0x62, 0xe1, 0x60, 0x05, 0x43, 0x9e, 0xc2, 0xfe, 0x30, 0x52, 0xec, - 0x92, 0x85, 0x54, 0xc8, 0x13, 0xc6, 0x54, 0x26, 0x75, 0x3f, 0x8f, 0x63, 0x2e, 0x58, 0x45, 0x79, - 0xef, 0xa0, 0x5e, 0x2c, 0xf4, 0xaf, 0x0c, 0xb7, 0x61, 0xb7, 0x58, 0xfb, 0x6b, 0xc9, 0x63, 0x25, - 0xa4, 0x2e, 0x5c, 0x2f, 0xc2, 0xde, 0x17, 0x0b, 0x1a, 0x03, 0x31, 0x92, 0x7d, 0x79, 0xa1, 0xc8, - 0x73, 0xf8, 0xaf, 0x1a, 0xec, 0xf3, 0x2b, 0xb3, 0xa2, 0xf3, 0xd9, 0xb8, 0x83, 0xe5, 0xd8, 0xf7, - 0xcd, 0xda, 0xf3, 0x14, 0x50, 0x9d, 0x25, 0xa5, 0x8b, 0x39, 0x40, 0xfa, 0x00, 0xf3, 0x2f, 0x80, - 0x71, 0x61, 0x77, 0x9f, 0xac, 0xc9, 0xce, 0xab, 0x99, 0x20, 0xa8, 0x88, 0xbd, 0xaf, 0x16, 0xec, - 0xf5, 0x04, 0xef, 0x29, 0x96, 0xe5, 0xd9, 0x1f, 0x68, 0xaa, 0x91, 0xf4, 0xc0, 0xe6, 0x73, 0xcc, - 0x18, 0xb5, 0xbb, 0xde, 0x9a, 0x01, 0x3d, 0xc1, 0x83, 0xaa, 0x8c, 0xbc, 0x87, 0xfd, 0x4a, 0x59, - 0xe6, 0xd4, 0xfc, 0x1b, 0xbb, 0xfb, 0x78, 0xcd, 0x6b, 0x65, 0x7b, 0xb0, 0xea, 0x8d, 0x97, 0x6f, - 0xbe, 0xdf, 0xba, 0xd6, 0xcd, 0xad, 0x6b, 0xfd, 0xbc, 0x75, 0xad, 0xcf, 0x77, 0xee, 0xc6, 0xcd, - 0x9d, 0xbb, 0xf1, 0xe3, 0xce, 0xdd, 0xf8, 0xd0, 0x1d, 0x09, 0x1d, 0x66, 0x43, 0x9f, 0xa9, 0xab, - 0xce, 0x6c, 0xc2, 0x51, 0x39, 0xa2, 0x13, 0x0a, 0x7e, 0x94, 0xcf, 0xe8, 0x5c, 0x77, 0xf2, 0x4f, - 0x69, 0x7e, 0xd8, 0x74, 0xb8, 0x6d, 0xe8, 0x67, 0xbf, 0x03, 0x00, 0x00, 0xff, 0xff, 0xeb, 0x96, - 0x85, 0xa2, 0x8f, 0x05, 0x00, 0x00, + 0x14, 0xad, 0x9b, 0xbc, 0x26, 0xb9, 0xae, 0xda, 0x6a, 0x5a, 0xbd, 0x67, 0x55, 0xef, 0xf9, 0x45, + 0x5e, 0x94, 0xb0, 0xa8, 0x4d, 0x03, 0x1f, 0xd0, 0x96, 0xb0, 0x88, 0x4a, 0x37, 0x8e, 0x04, 0x82, + 0x4d, 0x35, 0x99, 0x99, 0xda, 0xa3, 0xba, 0x33, 0x96, 0x3d, 0x0e, 0xcd, 0x86, 0x05, 0x5f, 0xc0, + 0x6f, 0xb0, 0x66, 0xc7, 0x17, 0xb0, 0xec, 0x92, 0x15, 0x42, 0xed, 0x8e, 0xaf, 0x40, 0x9e, 0xd8, + 0x89, 0x9b, 0x44, 0x84, 0xdd, 0xcc, 0x39, 0xf7, 0xcc, 0x3d, 0xbe, 0xf7, 0xc8, 0xb0, 0x93, 0xa6, + 0xdc, 0x1b, 0x1d, 0x79, 0x94, 0x53, 0x37, 0x4e, 0xa4, 0x92, 0xe8, 0xbf, 0x70, 0x1c, 0xb3, 0x24, + 0xe5, 0x81, 0xd0, 0x77, 0x22, 0x23, 0x37, 0xe4, 0x54, 0x48, 0xca, 0xdc, 0x34, 0xe5, 0xfb, 0xff, + 0x14, 0x02, 0x12, 0x71, 0x26, 0xd4, 0x20, 0x66, 0x64, 0xa2, 0xdb, 0xdf, 0x0b, 0x64, 0x20, 0xf5, + 0xd1, 0xcb, 0x4f, 0x13, 0xd4, 0xf9, 0x50, 0x87, 0x5a, 0x8f, 0x53, 0x74, 0x00, 0x0d, 0x22, 0x85, + 0x62, 0x37, 0xca, 0x32, 0xda, 0xb5, 0x4e, 0xeb, 0x74, 0xf3, 0xe7, 0xf7, 0xff, 0x9b, 0xc7, 0x05, + 0xe6, 0x97, 0x24, 0xda, 0x82, 0x75, 0x4e, 0xad, 0xf5, 0xb6, 0xd1, 0x69, 0xf9, 0xeb, 0x9c, 0x22, + 0x1b, 0x20, 0xa7, 0x12, 0x19, 0x45, 0x2c, 0xb1, 0x6a, 0xb9, 0xd4, 0xaf, 0x20, 0xa8, 0x0d, 0x26, + 0x8e, 0x52, 0x79, 0x26, 0xe4, 0x3b, 0x71, 0x92, 0x5a, 0x75, 0x5d, 0x50, 0x85, 0x10, 0x06, 0x34, + 0x62, 0x09, 0xbf, 0xe4, 0x04, 0x2b, 0x2e, 0xc5, 0x39, 0x53, 0xa1, 0xa4, 0xd6, 0x5f, 0xed, 0x5a, + 0xc7, 0xec, 0x1e, 0xb9, 0xbf, 0xfd, 0x58, 0xf7, 0xd5, 0x82, 0xd0, 0x5f, 0xf2, 0x18, 0x3a, 0x80, + 0x2d, 0x9c, 0xa9, 0x90, 0x09, 0x55, 0xe0, 0xd6, 0x86, 0xf6, 0x31, 0x87, 0xa2, 0x0e, 0x6c, 0xe3, + 0x34, 0x65, 0x49, 0xc5, 0x47, 0x43, 0x17, 0xce, 0xc3, 0xc8, 0x81, 0xcd, 0x2b, 0x36, 0x3e, 0x09, + 0x12, 0xc6, 0xae, 0x99, 0x50, 0x56, 0x53, 0x97, 0x3d, 0xc0, 0x50, 0x17, 0xf6, 0x08, 0x8e, 0xf1, + 0x90, 0x47, 0x5c, 0x8d, 0xfb, 0x62, 0x24, 0x8b, 0xde, 0x2d, 0x5d, 0xbb, 0x94, 0x7b, 0xa8, 0xe9, + 0xb1, 0x88, 0x05, 0x13, 0x0d, 0xcc, 0x6b, 0x66, 0x1c, 0x3a, 0x86, 0x46, 0xca, 0x92, 0x11, 0x27, + 0xcc, 0x32, 0xf5, 0xd4, 0x0e, 0x56, 0x4c, 0x6d, 0x30, 0xa9, 0xf6, 0x4b, 0x99, 0xf3, 0x1e, 0x9a, + 0xe7, 0x4c, 0x61, 0x8a, 0x15, 0x46, 0x16, 0x34, 0x48, 0xc2, 0xb0, 0x62, 0xd4, 0x32, 0xf4, 0x96, + 0xcb, 0x6b, 0xce, 0x64, 0x31, 0xd5, 0xcc, 0x64, 0xff, 0xe5, 0x35, 0x5f, 0x32, 0x65, 0x98, 0x28, + 0x3e, 0xd2, 0x6c, 0xad, 0x6d, 0x74, 0x9a, 0x7e, 0x15, 0x42, 0xff, 0x42, 0x6b, 0x94, 0x3b, 0x92, + 0xa2, 0x4f, 0xad, 0xba, 0x56, 0xcf, 0x00, 0xe7, 0x8b, 0x01, 0x68, 0x71, 0x95, 0x45, 0xd6, 0x8c, + 0x69, 0xd6, 0x10, 0xd4, 0xd5, 0x38, 0x66, 0x45, 0x77, 0x7d, 0x5e, 0xc8, 0x9f, 0x31, 0x97, 0x3f, + 0x17, 0x50, 0x9c, 0x0d, 0x23, 0x4e, 0xce, 0xd8, 0xf8, 0x3c, 0x8b, 0x14, 0x1f, 0xe2, 0x94, 0x15, + 0x0e, 0x96, 0x30, 0xe8, 0x09, 0xec, 0x0e, 0x23, 0x49, 0xae, 0x48, 0x88, 0xb9, 0x38, 0x21, 0x44, + 0x66, 0x42, 0xf5, 0xf3, 0x38, 0xe6, 0x82, 0x65, 0x94, 0xf3, 0x1a, 0x1a, 0xc5, 0x40, 0xff, 0xc8, + 0x70, 0x07, 0xb6, 0x8b, 0xb1, 0xbf, 0x10, 0x34, 0x96, 0x5c, 0xa8, 0xc2, 0xf5, 0x3c, 0xec, 0x7c, + 0x32, 0xa0, 0x39, 0xe0, 0x81, 0xe8, 0x8b, 0x4b, 0x89, 0x9e, 0xc1, 0xdf, 0xd5, 0x60, 0x5f, 0x5c, + 0xeb, 0x11, 0x5d, 0x4c, 0xdb, 0xed, 0x2d, 0xc6, 0xbe, 0xaf, 0xc7, 0x9e, 0xa7, 0x00, 0xab, 0x2c, + 0x29, 0x5d, 0xcc, 0x00, 0xd4, 0x07, 0x98, 0xfd, 0x25, 0xb4, 0x0b, 0xb3, 0xfb, 0x78, 0x45, 0x76, + 0x9e, 0x4f, 0x05, 0x7e, 0x45, 0xec, 0x7c, 0x36, 0x60, 0xa7, 0xc7, 0x69, 0x4f, 0x92, 0x2c, 0xcf, + 0xfe, 0x40, 0x61, 0xc5, 0x50, 0x0f, 0x4c, 0x3a, 0xc3, 0xb4, 0x51, 0xb3, 0xeb, 0xac, 0x68, 0xd0, + 0xe3, 0xd4, 0xaf, 0xca, 0xd0, 0x1b, 0xd8, 0xad, 0x5c, 0xcb, 0x9c, 0xea, 0xaf, 0x31, 0xbb, 0x8f, + 0x56, 0xbc, 0x56, 0x96, 0xfb, 0xcb, 0xde, 0x38, 0x7d, 0xf9, 0xf5, 0xce, 0x36, 0x6e, 0xef, 0x6c, + 0xe3, 0xc7, 0x9d, 0x6d, 0x7c, 0xbc, 0xb7, 0xd7, 0x6e, 0xef, 0xed, 0xb5, 0x6f, 0xf7, 0xf6, 0xda, + 0xdb, 0x6e, 0xc0, 0x55, 0x98, 0x0d, 0x5d, 0x22, 0xaf, 0xbd, 0x69, 0x87, 0xc3, 0xb2, 0x85, 0x17, + 0x72, 0x7a, 0x98, 0xf7, 0xf0, 0x6e, 0xbc, 0xfc, 0x77, 0x9b, 0x2f, 0x36, 0x1d, 0x6e, 0x68, 0xfa, + 0xe9, 0xaf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x5d, 0x6f, 0x49, 0xfe, 0xb3, 0x05, 0x00, 0x00, } func (m *Did) Marshal() (dAtA []byte, err error) { diff --git a/x/ssi/verification/client_spec.go b/x/ssi/verification/client_spec.go index 49b126b..36b9706 100644 --- a/x/ssi/verification/client_spec.go +++ b/x/ssi/verification/client_spec.go @@ -5,6 +5,7 @@ import ( "encoding/json" "fmt" + ldcontext "github.com/hypersign-protocol/hid-node/x/ssi/ld-context" "github.com/hypersign-protocol/hid-node/x/ssi/types" ) @@ -65,6 +66,18 @@ func getDocBytesByClientSpec(ssiMsg types.SsiMsg, extendedVm *types.ExtendedVeri ) } } else { + // If DID Document, perform RDF normalisation and return its SHA-256 Hash + didDoc, ok := ssiMsg.(*types.Did) + if ok { + switch extendedVm.Type { + case types.Ed25519VerificationKey2020: + didDocBytes, err := ldcontext.EdDSACryptoSuite2020Canonize(didDoc) + if err != nil { + return nil, err + } + return didDocBytes, nil + } + } return ssiMsg.GetSignBytes(), nil } } diff --git a/x/ssi/verification/crypto.go b/x/ssi/verification/crypto.go index 63a5058..939227a 100644 --- a/x/ssi/verification/crypto.go +++ b/x/ssi/verification/crypto.go @@ -57,7 +57,7 @@ func verify(extendedVm *types.ExtendedVerificationMethod, ssiMsg types.SsiMsg) e switch extendedVm.Type { case types.Ed25519VerificationKey2020: - return verifyEd25519VerificationKey2020Key(extendedVm, docBytes) + return verifyEd25519Signature2020(extendedVm, docBytes) case types.EcdsaSecp256k1VerificationKey2019: return verifyEcdsaSecp256k1VerificationKey2019Key(extendedVm, docBytes) case types.EcdsaSecp256k1RecoveryMethod2020: @@ -175,22 +175,44 @@ func verifyEcdsaSecp256k1RecoveryMethod2020Key(extendedVm *types.ExtendedVerific } } -// verifyEd25519VerificationKey2020Key verifies the verification key for verification method type Ed25519VerificationKey2020 -func verifyEd25519VerificationKey2020Key(extendedVm *types.ExtendedVerificationMethod, documentBytes []byte) error { +// verifyEd25519Signature2020 verifies Ed25519Signature2020 signature using Ed25519VerificationKey2020 publicKeyMultibase +func verifyEd25519Signature2020(extendedVm *types.ExtendedVerificationMethod, documentBytes []byte) error { // Decode Public Key - _, publicKeyBytes, err := multibase.Decode(extendedVm.PublicKeyMultibase) + encoding, publicKeyBytes, err := multibase.Decode(extendedVm.PublicKeyMultibase) if err != nil { return fmt.Errorf( "cannot decode Ed25519 public key %s", extendedVm.PublicKeyMultibase, ) } + if encoding != multibase.Base58BTC { + return fmt.Errorf( + "publicKeyMultibase of verification method %v must be multibase base58btc encoded", + extendedVm.Id, + ) + } + + // Incoming publicKeyMultibase is expected to be of 34 byte length (2-byte header + 32-byte public key) + if len(publicKeyBytes) != 34 { + return fmt.Errorf( + "provided publicKeyMultibase %v of verification method %v is expected to be of byte-length 34", + extendedVm.PublicKeyMultibase, + extendedVm.Id, + ) + } + publicKeyBytes = publicKeyBytes[2:] // Decode Signatures - signatureBytes, err := base64.StdEncoding.DecodeString(extendedVm.Signature) + encoding, signatureBytes, err := multibase.Decode(extendedVm.Signature) if err != nil { return err } + if encoding != multibase.Base58BTC { + return fmt.Errorf( + "signature provided for verification method %v must be multibase base58btc encoded", + extendedVm.Id, + ) + } if !ed25519.Verify(publicKeyBytes, documentBytes, signatureBytes) { return fmt.Errorf("signature could not be verified for verificationMethodId: %v", extendedVm.Id) From 07d115b661172ee291c9062b8c6debac96721060 Mon Sep 17 00:00:00 2001 From: Arnab Ghose Date: Wed, 20 Sep 2023 15:25:40 +0530 Subject: [PATCH 2/8] feat: added x25519-2020 ld context --- x/ssi/ld-context/context.go | 26 ++++++++++++++++++++++++++ x/ssi/ld-context/normalize.go | 18 ++++++++++++++++++ x/ssi/verification/client_spec.go | 9 +-------- 3 files changed, 45 insertions(+), 8 deletions(-) create mode 100644 x/ssi/ld-context/normalize.go diff --git a/x/ssi/ld-context/context.go b/x/ssi/ld-context/context.go index 5ee6819..3d23e8e 100644 --- a/x/ssi/ld-context/context.go +++ b/x/ssi/ld-context/context.go @@ -2,6 +2,7 @@ package ldcontext const didContext string = "https://www.w3.org/ns/did/v1" const ed25519Context2020 string = "https://w3id.org/security/suites/ed25519-2020/v1" +const x25519KeyAgreement2020Context string = "https://ns.did.ai/suites/x25519-2020/v1" // As hid-node is not supposed to perform any GET request, the complete Context body of their // respective Context urls has been maintained below. @@ -152,4 +153,29 @@ var ContextUrlMap map[string]contextObject = map[string]contextObject{ }, }, }, + x25519KeyAgreement2020Context: { + "id": "@id", + "type": "@type", + "@protected": true, + "X25519KeyAgreementKey2020": map[string]interface{}{ + "@id": "https://w3id.org/security#X25519KeyAgreementKey2020", + "@context": map[string]interface{}{ + "@protected": true, + "id": "@id", + "type": "@type", + "controller": map[string]interface{}{ + "@id": "https://w3id.org/security#controller", + "@type": "@id", + }, + "revoked": map[string]interface{}{ + "@id": "https://w3id.org/security#revoked", + "@type": "http://www.w3.org/2001/XMLSchema#dateTime", + }, + "publicKeyMultibase": map[string]interface{}{ + "@id": "https://w3id.org/security#publicKeyMultibase", + "@type": "https://w3id.org/security#multibase", + }, + }, + }, + }, } diff --git a/x/ssi/ld-context/normalize.go b/x/ssi/ld-context/normalize.go new file mode 100644 index 0000000..5b7385c --- /dev/null +++ b/x/ssi/ld-context/normalize.go @@ -0,0 +1,18 @@ +package ldcontext + +import ( + "github.com/hypersign-protocol/hid-node/x/ssi/types" +) + +func NormalizeByVerificationMethodType(didDoc *types.Did, vmType string) ([]byte, error) { + switch vmType { + case types.Ed25519VerificationKey2020: + didDocBytes, err := EdDSACryptoSuite2020Canonize(didDoc) + if err != nil { + return nil, err + } + return didDocBytes, nil + default: + return didDoc.GetSignBytes(), nil + } +} diff --git a/x/ssi/verification/client_spec.go b/x/ssi/verification/client_spec.go index 36b9706..3f90fd3 100644 --- a/x/ssi/verification/client_spec.go +++ b/x/ssi/verification/client_spec.go @@ -69,14 +69,7 @@ func getDocBytesByClientSpec(ssiMsg types.SsiMsg, extendedVm *types.ExtendedVeri // If DID Document, perform RDF normalisation and return its SHA-256 Hash didDoc, ok := ssiMsg.(*types.Did) if ok { - switch extendedVm.Type { - case types.Ed25519VerificationKey2020: - didDocBytes, err := ldcontext.EdDSACryptoSuite2020Canonize(didDoc) - if err != nil { - return nil, err - } - return didDocBytes, nil - } + return ldcontext.NormalizeByVerificationMethodType(didDoc, extendedVm.Type) } return ssiMsg.GetSignBytes(), nil } From f0d4995b0979010635c6becc7a6d4d52712cb6ff Mon Sep 17 00:00:00 2001 From: Arnab Ghose Date: Fri, 22 Sep 2023 15:22:21 +0530 Subject: [PATCH 3/8] fix: normalized rdf string came empty even after passing correct JsonLD struct. This issue was solved by converting the jsonLd struct to an interface{} object and fed to the normalize function --- x/ssi/ld-context/types.go | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/x/ssi/ld-context/types.go b/x/ssi/ld-context/types.go index db5c922..2985532 100644 --- a/x/ssi/ld-context/types.go +++ b/x/ssi/ld-context/types.go @@ -1,6 +1,7 @@ package ldcontext import ( + "encoding/json" "fmt" "github.com/hypersign-protocol/hid-node/x/ssi/types" @@ -56,19 +57,39 @@ func NewJsonLdDid(didDoc *types.Did) *JsonLdDid { return jsonLdDoc } +// Convert JsonLdDid to interface +func jsonLdDidToInterface(jsonLd *JsonLdDid) interface{} { + var intf interface{} + + jsonLdBytes, err := json.Marshal(jsonLd) + if err != nil { + panic(err) + } + + err = json.Unmarshal(jsonLdBytes, &intf) + if err != nil { + panic(err) + } + + return intf +} + // NormalizeWithURDNA2015 performs RDF Canonization upon JsonLdDid using URDNA2015 // algorithm and returns the canonized document in string -func (doc *JsonLdDid) NormalizeWithURDNA2015() (string, error) { +func (jsonLd *JsonLdDid) NormalizeWithURDNA2015() (string, error) { proc := ld.NewJsonLdProcessor() options := ld.NewJsonLdOptions("") options.Algorithm = ld.AlgorithmURDNA2015 options.Format = "application/n-quads" - normalisedJsonLdDid, err := proc.Normalize(doc, options) + normalisedJsonLdDid, err := proc.Normalize(jsonLdDidToInterface(jsonLd), options) if err != nil { return "", fmt.Errorf("unable to Normalize DID Document: %v", err.Error()) } canonizedDocString := normalisedJsonLdDid.(string) + if canonizedDocString == "" { + return "", fmt.Errorf("normalization yield empty RDF string for did document: %v", jsonLd.Id) + } return canonizedDocString, nil } From c4f2a40e3e0a6ed4fe45d788842fd8714d3ca651 Mon Sep 17 00:00:00 2001 From: Arnab Ghose Date: Mon, 25 Sep 2023 06:42:41 +0530 Subject: [PATCH 4/8] feat: added secp256k1-2020 context --- cmd/hid-noded/cmd/debug_extensions.go | 16 +-- tests/e2e/ssi_tests/e2e_tests.py | 38 +++--- tests/e2e/ssi_tests/generate_doc.py | 13 +- tests/e2e/ssi_tests/transactions.py | 12 +- tests/e2e/ssi_tests/utils.py | 6 +- x/ssi/client/cli/tx_utils.go | 11 +- x/ssi/ld-context/context.go | 182 ++++++++++++++++++++++++++ x/ssi/ld-context/normalize.go | 6 + x/ssi/ld-context/suite.go | 15 +++ x/ssi/verification/client_spec.go | 17 +++ x/ssi/verification/crypto.go | 6 +- 11 files changed, 275 insertions(+), 47 deletions(-) diff --git a/cmd/hid-noded/cmd/debug_extensions.go b/cmd/hid-noded/cmd/debug_extensions.go index fd1d536..ed6e39a 100644 --- a/cmd/hid-noded/cmd/debug_extensions.go +++ b/cmd/hid-noded/cmd/debug_extensions.go @@ -337,8 +337,8 @@ func signSchemaDocCmd() *cobra.Command { if err != nil { return err } - case "recover-eth": - signature, err = hidnodecli.GetEthRecoverySignature(argPrivateKey, schemaDocBytes) + case types.EcdsaSecp256k1RecoverySignature2020: + signature, err = hidnodecli.GetEcdsaSecp256k1RecoverySignature2020(argPrivateKey, schemaDocBytes) if err != nil { return err } @@ -399,8 +399,8 @@ func signCredStatusDocCmd() *cobra.Command { if err != nil { return err } - case "recover-eth": - signature, err = hidnodecli.GetEthRecoverySignature(argPrivateKey, credStatusDocBytes) + case types.EcdsaSecp256k1RecoverySignature2020: + signature, err = hidnodecli.GetEcdsaSecp256k1RecoverySignature2020(argPrivateKey, credStatusDocBytes) if err != nil { return err } @@ -443,14 +443,14 @@ func ed25519RandomCmd() *cobra.Command { publicKeyWithHeader = append(publicKeyWithHeader, append([]byte{0xed, 0x01}, pubKey...)...) keyInfo := struct { - PubKeyMultibase string `json:"pub_key_multibase"` - PrivKeyMultibase string `json:"priv_key_base_64"` + PubKeyMultibase string `json:"pub_key_multibase"` + PrivKeyMultibase string `json:"priv_key_base_64"` }{ PubKeyMultibase: "z" + base58.Encode(publicKeyWithHeader), // W3C's Ed25519VerificationKey2020 Specification has not explicitly mentioned about the encoding of the private key // or whether it should be prefixed similar to the public key. For now, the encoding of private key remains Base64 - // with no prefix - PrivKeyMultibase: base64.StdEncoding.EncodeToString(privKey), + // with no prefix + PrivKeyMultibase: base64.StdEncoding.EncodeToString(privKey), } keyInfoJson, err := json.Marshal(keyInfo) diff --git a/tests/e2e/ssi_tests/e2e_tests.py b/tests/e2e/ssi_tests/e2e_tests.py index 24a60be..099fa48 100644 --- a/tests/e2e/ssi_tests/e2e_tests.py +++ b/tests/e2e/ssi_tests/e2e_tests.py @@ -154,24 +154,24 @@ def key_agrement_test(): def unique_wallet_address_test(): print("\n---1. FAIL: Alice Creates a DID Doc. Bob attempts to create a DID Document by adding one of Alice's VM.---\n") - kp_alice = generate_key_pair("recover-eth") + kp_alice = generate_key_pair("EcdsaSecp256k1RecoverySignature2020") signers = [] - did_doc_string = generate_did_document(kp_alice, "recover-eth") + did_doc_string = generate_did_document(kp_alice, "EcdsaSecp256k1RecoverySignature2020") did_doc_alice = did_doc_string["id"] did_doc_alice_vm = did_doc_string["verificationMethod"][0] signPair_alice = { "kp": kp_alice, "verificationMethodId": did_doc_string["verificationMethod"][0]["id"], - "signing_algo": "recover-eth" + "signing_algo": "EcdsaSecp256k1RecoverySignature2020" } signers.append(signPair_alice) create_tx_cmd = form_did_create_tx_multisig(did_doc_string, signers, DEFAULT_BLOCKCHAIN_ACCOUNT_NAME) run_blockchain_command(create_tx_cmd, f"Registering Alice's DID with Id: {did_doc_alice}") # Create Bob's DID with Alice's VM - kp_bob = generate_key_pair("recover-eth") + kp_bob = generate_key_pair("EcdsaSecp256k1RecoverySignature2020") signers = [] - did_doc_string = generate_did_document(kp_bob, "recover-eth") + did_doc_string = generate_did_document(kp_bob, "EcdsaSecp256k1RecoverySignature2020") did_doc_bob = did_doc_string["id"] did_doc_string["controller"] = [did_doc_alice] did_doc_string["verificationMethod"] = [did_doc_alice_vm] @@ -181,15 +181,15 @@ def unique_wallet_address_test(): print("\n---2. FAIL: Charlie creates a DID Document. After that, Charlie attempts to update its DID Document by adding one of Alice's VM for which valid signature is passed.---\n") - kp_charlie = generate_key_pair("recover-eth") + kp_charlie = generate_key_pair("EcdsaSecp256k1RecoverySignature2020") signers = [] - did_doc_string_charlie = generate_did_document(kp_charlie, "recover-eth") + did_doc_string_charlie = generate_did_document(kp_charlie, "EcdsaSecp256k1RecoverySignature2020") did_doc_charlie_id = did_doc_string_charlie["id"] did_doc_charlie_vm = did_doc_string_charlie["verificationMethod"][0] signPair_charlie = { "kp": kp_charlie, "verificationMethodId": did_doc_string_charlie["verificationMethod"][0]["id"], - "signing_algo": "recover-eth" + "signing_algo": "EcdsaSecp256k1RecoverySignature2020" } signers.append(signPair_charlie) create_tx_cmd = form_did_create_tx_multisig(did_doc_string_charlie, signers, DEFAULT_BLOCKCHAIN_ACCOUNT_NAME) @@ -219,15 +219,15 @@ def unique_wallet_address_test(): print("\n---4. PASS: Charlie removes one of its Verification Methods. George creates a didDoc for himself. He then proceed to update his DID Document by adding the Verification method removed by Charlie---\n") # Create George's DIDDoc - kp_george = generate_key_pair("recover-eth") + kp_george = generate_key_pair("EcdsaSecp256k1RecoverySignature2020") signers = [] - did_doc_string_george = generate_did_document(kp_george, "recover-eth") + did_doc_string_george = generate_did_document(kp_george, "EcdsaSecp256k1RecoverySignature2020") did_doc_george_id = did_doc_string_george["id"] did_doc_george_vm = did_doc_string_george["verificationMethod"][0] signPair_george = { "kp": kp_george, "verificationMethodId": did_doc_string_george["verificationMethod"][0]["id"], - "signing_algo": "recover-eth" + "signing_algo": "EcdsaSecp256k1RecoverySignature2020" } signers.append(signPair_george) create_tx_cmd = form_did_create_tx_multisig(did_doc_string_george, signers, DEFAULT_BLOCKCHAIN_ACCOUNT_NAME) @@ -301,8 +301,8 @@ def create_did_test(): run_blockchain_command(create_tx_cmd, f"Registering DID with Id: {did_doc_org}") #Alice creates a DID where the controller only has Alice's DID and the verfication method has two ETH wallets added. Signature of all hot wallets are passed - kp_hot_wallet_1 = generate_key_pair("recover-eth") - kp_hot_wallet_2 = generate_key_pair("recover-eth") + kp_hot_wallet_1 = generate_key_pair("EcdsaSecp256k1RecoverySignature2020") + kp_hot_wallet_2 = generate_key_pair("EcdsaSecp256k1RecoverySignature2020") kp_org = generate_key_pair() did_doc_string = generate_did_document(kp_org) @@ -326,12 +326,12 @@ def create_did_test(): signPair_hotWallet1 = { "kp": kp_hot_wallet_1, "verificationMethodId": did_doc_string["verificationMethod"][0]["id"], - "signing_algo": "recover-eth" + "signing_algo": "EcdsaSecp256k1RecoverySignature2020" } signPair_hotWallet2 = { "kp": kp_hot_wallet_2, "verificationMethodId": did_doc_string["verificationMethod"][1]["id"], - "signing_algo": "recover-eth" + "signing_algo": "EcdsaSecp256k1RecoverySignature2020" } print("4. FAIL: Alice has a registered DID Document where Alice is the controller. Alice tries to register an Org DID Document where Alice is the sole controller, and there are two verification Methods, of type EcdsaSecp256k1RecoveryMethod2020, and Alice is the controller for each one of them. Signature is provided by only one of the VMs.\n") @@ -882,7 +882,7 @@ def credential_status_test(): def caip10_ethereum_support_test(): print("\n--- CAIP-10 Test: Ethereum Chains ---\n") - kp_algo = "recover-eth" + kp_algo = "EcdsaSecp256k1RecoverySignature2020" # Invalid blockchain Account Ids invalid_blockchain_account_ids = [ @@ -1257,7 +1257,7 @@ def vm_type_test(): # EcdsaSecp256k1RecoveryMethod2020 print("7. FAIL: Registering DID Document with a verification method of type EcdsaSecp256k1RecoveryMethod2020. Only publicKeyMultibase is passed.") - kp_algo = "recover-eth" + kp_algo = "EcdsaSecp256k1RecoverySignature2020" kp = generate_key_pair(algo=kp_algo) did_doc_string = generate_did_document(kp, kp_algo) did_doc_id = did_doc_string["id"] @@ -1274,7 +1274,7 @@ def vm_type_test(): run_blockchain_command(create_tx_cmd, f"Registering DID with Id: {did_doc_id}", True, True) print("8. FAIL: Registering DID Document with a verification method of type EcdsaSecp256k1RecoveryMethod2020. Both publicKeyMultibase and blockchainAccountId is passed.") - kp_algo = "recover-eth" + kp_algo = "EcdsaSecp256k1RecoverySignature2020" kp = generate_key_pair(algo=kp_algo) did_doc_string = generate_did_document(kp, kp_algo) did_doc_id = did_doc_string["id"] @@ -1290,7 +1290,7 @@ def vm_type_test(): run_blockchain_command(create_tx_cmd, f"Registering DID with Id: {did_doc_id}", True, True) print("9. PASS: Registering DID Document with a verification method of type EcdsaSecp256k1RecoveryMethod2020. Only blockchainAccountId is passed.") - kp_algo = "recover-eth" + kp_algo = "EcdsaSecp256k1RecoverySignature2020" kp = generate_key_pair(algo=kp_algo) did_doc_string = generate_did_document(kp, kp_algo) did_doc_id = did_doc_string["id"] diff --git a/tests/e2e/ssi_tests/generate_doc.py b/tests/e2e/ssi_tests/generate_doc.py index b707fe3..af0ef00 100644 --- a/tests/e2e/ssi_tests/generate_doc.py +++ b/tests/e2e/ssi_tests/generate_doc.py @@ -8,6 +8,7 @@ ED25519_CONTEXT = "https://w3id.org/security/suites/ed25519-2020/v1" DID_CONTEXT = "https://www.w3.org/ns/did/v1" +SECP256K1_RECOVERY_CONTEXT = "https://ns.did.ai/suites/secp256k1-2020/v1" def generate_did_document(key_pair, algo="Ed25519Signature2020", bech32prefix="hid", is_uuid=False): base_document = { @@ -21,6 +22,8 @@ def generate_did_document(key_pair, algo="Ed25519Signature2020", bech32prefix="h } if algo == "Ed25519Signature2020": base_document["context"].append(ED25519_CONTEXT) + if algo == "EcdsaSecp256k1RecoverySignature2020": + base_document["context"].append(SECP256K1_RECOVERY_CONTEXT) did_id = generate_document_id("did", key_pair, algo, is_uuid) @@ -30,7 +33,7 @@ def generate_did_document(key_pair, algo="Ed25519Signature2020", bech32prefix="h vm_type = "Ed25519VerificationKey2020" elif algo == "secp256k1": vm_type = "EcdsaSecp256k1VerificationKey2019" - elif algo == "recover-eth": + elif algo == "EcdsaSecp256k1RecoverySignature2020": vm_type = "EcdsaSecp256k1RecoveryMethod2020" elif algo == "bbs": vm_type = "Bls12381G2Key2020" @@ -40,7 +43,7 @@ def generate_did_document(key_pair, algo="Ed25519Signature2020", bech32prefix="h raise Exception("unknown signing algorithm: " + key_pair) verification_method = {} - if algo == "recover-eth": + if algo == "EcdsaSecp256k1RecoverySignature2020": verification_method = { "id": "", "type": "", @@ -55,7 +58,7 @@ def generate_did_document(key_pair, algo="Ed25519Signature2020", bech32prefix="h "publicKeyMultibase": "" } - if algo == "recover-eth": + if algo == "EcdsaSecp256k1RecoverySignature2020": verification_method["blockchainAccountId"] = "eip155:1:" + key_pair["ethereum_address"] elif algo == "secp256k1": @@ -107,7 +110,7 @@ def generate_schema_document(key_pair, schema_author, vm, signature=None, algo=" proof_type = "Ed25519Signature2020" elif algo == "secp256k1": proof_type = "EcdsaSecp256k1Signature2019" - elif algo == "recover-eth": + elif algo == "EcdsaSecp256k1RecoverySignature2020": proof_type = "EcdsaSecp256k1RecoverySignature2020" elif algo == "bbs": proof_type = "BbsBlsSignature2020" @@ -155,7 +158,7 @@ def generate_cred_status_document(key_pair, cred_author, vm, signature=None, alg proof_type = "Ed25519Signature2020" elif algo == "secp256k1": proof_type = "EcdsaSecp256k1Signature2019" - elif algo == "recover-eth": + elif algo == "EcdsaSecp256k1RecoverySignature2020": proof_type = "EcdsaSecp256k1RecoverySignature2020" elif algo == "bbs": proof_type = "BbsBlsSignature2020" diff --git a/tests/e2e/ssi_tests/transactions.py b/tests/e2e/ssi_tests/transactions.py index e01ce0d..eba8382 100644 --- a/tests/e2e/ssi_tests/transactions.py +++ b/tests/e2e/ssi_tests/transactions.py @@ -17,7 +17,7 @@ def form_did_create_tx_multisig(diddoc, signPairs, blockchain_account): vmId = signPair["verificationMethodId"] signAlgo = signPair["signing_algo"] - if signAlgo in ["recover-eth", "bjj"]: + if signAlgo in ["EcdsaSecp256k1RecoverySignature2020", "bjj"]: private_key = signPair["kp"]["priv_key_hex"] else: private_key = signPair["kp"]["priv_key_base_64"] @@ -35,7 +35,7 @@ def form_did_update_tx_multisig(diddoc, signPairs, blockchain_account): vmId = signPair["verificationMethodId"] signAlgo = signPair["signing_algo"] - if signAlgo in ["recover-eth", "bjj"]: + if signAlgo in ["EcdsaSecp256k1RecoverySignature2020", "bjj"]: private_key = signPair["kp"]["priv_key_hex"] else: private_key = signPair["kp"]["priv_key_base_64"] @@ -54,7 +54,7 @@ def form_did_deactivate_tx_multisig(didId, signPairs, blockchain_account): vmId = signPair["verificationMethodId"] signAlgo = signPair["signing_algo"] - if signAlgo in ["recover-eth", "bjj"]: + if signAlgo in ["EcdsaSecp256k1RecoverySignature2020", "bjj"]: private_key = signPair["kp"]["priv_key_hex"] else: private_key = signPair["kp"]["priv_key_base_64"] @@ -66,7 +66,7 @@ def form_did_deactivate_tx_multisig(didId, signPairs, blockchain_account): return cmd_string def form_did_create_tx(did_doc, kp, blockchain_account, verificationMethodId=None, signing_algo="ed25519"): - if signing_algo in ["recover-eth", "bjj"]: + if signing_algo in ["EcdsaSecp256k1RecoverySignature2020", "bjj"]: private_key = kp["priv_key_hex"] else: private_key = kp["priv_key_base_64"] @@ -86,7 +86,7 @@ def form_create_cred_status_tx(cred_msg, cred_proof, blockchain_account): return cmd_string def form_did_update_tx(did_doc, kp, blockchain_account, verificationMethodId=None, signing_algo="ed25519"): - if signing_algo in ["recover-eth", "bjj"]: + if signing_algo in ["EcdsaSecp256k1RecoverySignature2020", "bjj"]: private_key = kp["priv_key_hex"] else: private_key = kp["priv_key_base_64"] @@ -98,7 +98,7 @@ def form_did_update_tx(did_doc, kp, blockchain_account, verificationMethodId=Non return cmd_string def form_did_deactivate_tx(did_doc_id, kp, blockchain_account, verificationMethodId=None, signing_algo="ed25519"): - if signing_algo in ["recover-eth", "hex"]: + if signing_algo in ["EcdsaSecp256k1RecoverySignature2020", "hex"]: private_key = kp["priv_key_hex"] else: private_key = kp["priv_key_base_64"] diff --git a/tests/e2e/ssi_tests/utils.py b/tests/e2e/ssi_tests/utils.py index 6782f19..3c58587 100644 --- a/tests/e2e/ssi_tests/utils.py +++ b/tests/e2e/ssi_tests/utils.py @@ -51,7 +51,7 @@ def generate_key_pair(algo="Ed25519Signature2020"): cmd = "hid-noded debug ed25519 random" elif algo == "secp256k1": cmd = "hid-noded debug secp256k1 random" - elif algo == "recover-eth": + elif algo == "EcdsaSecp256k1RecoverySignature2020": cmd = "hid-noded debug secp256k1 eth-hex-random" elif algo == "bbs": cmd = "hid-noded debug bbs random" @@ -84,7 +84,7 @@ def generate_document_id(doc_type: str, kp: dict = None, algo: str = "Ed25519Sig if is_uuid: method_specific_id = str(uuid.uuid4()) else: - if algo in ["recover-eth"]: + if algo in ["EcdsaSecp256k1RecoverySignature2020"]: method_specific_id = kp["ethereum_address"] else: method_specific_id = kp["pub_key_multibase"] @@ -109,7 +109,7 @@ def is_blockchain_active(rpc_port): assert s.connect_ex(('localhost', rpc_port)) == 0, f"hid-noded is not running" def get_document_signature(doc: dict, doc_type: str, key_pair: dict, algo: str = "ed25519"): - if algo in ["recover-eth", "bjj"]: + if algo in ["EcdsaSecp256k1RecoverySignature2020", "bjj"]: private_key = key_pair["priv_key_hex"] else: private_key = key_pair["priv_key_base_64"] diff --git a/x/ssi/client/cli/tx_utils.go b/x/ssi/client/cli/tx_utils.go index 1423859..8b8d2a4 100644 --- a/x/ssi/client/cli/tx_utils.go +++ b/x/ssi/client/cli/tx_utils.go @@ -93,7 +93,7 @@ func GetBJJSignature(privateKey string, message []byte) (string, error) { return signatureHex, nil } -func GetEthRecoverySignature(privateKey string, message []byte) (string, error) { +func GetEcdsaSecp256k1RecoverySignature2020(privateKey string, message []byte) (string, error) { // Decode key into bytes privKeyBytes, err := hex.DecodeString(privateKey) if err != nil { @@ -179,8 +179,13 @@ func getSignatures(cmd *cobra.Command, didDoc *types.Did, cmdArgs []string) ([]* if err != nil { return nil, err } - case "recover-eth": - signInfoList[i].Signature, err = GetEthRecoverySignature(didSigningElementsList[i].SignKey, didDoc.GetSignBytes()) + case types.EcdsaSecp256k1RecoverySignature2020: + didDocBytes, err := ldcontext.EcdsaSecp256k1RecoverySignature2020Canonize(didDoc) + if err != nil { + return nil, err + } + + signInfoList[i].Signature, err = GetEcdsaSecp256k1RecoverySignature2020(didSigningElementsList[i].SignKey, didDocBytes) if err != nil { return nil, err } diff --git a/x/ssi/ld-context/context.go b/x/ssi/ld-context/context.go index 3d23e8e..d6dcc83 100644 --- a/x/ssi/ld-context/context.go +++ b/x/ssi/ld-context/context.go @@ -3,6 +3,7 @@ package ldcontext const didContext string = "https://www.w3.org/ns/did/v1" const ed25519Context2020 string = "https://w3id.org/security/suites/ed25519-2020/v1" const x25519KeyAgreement2020Context string = "https://ns.did.ai/suites/x25519-2020/v1" +const secp256k1Recovery2020Context string = "https://ns.did.ai/suites/secp256k1-2020/v1" // As hid-node is not supposed to perform any GET request, the complete Context body of their // respective Context urls has been maintained below. @@ -178,4 +179,185 @@ var ContextUrlMap map[string]contextObject = map[string]contextObject{ }, }, }, + secp256k1Recovery2020Context: { + "id": "@id", + "type": "@type", + "@protected": true, + "EcdsaSecp256k1VerificationKey2020": map[string]interface{}{ + "@id": "https://w3id.org/security#EcdsaSecp256k1VerificationKey2020", + "@context": map[string]interface{}{ + "@protected": true, + "id": "@id", + "type": "@type", + "controller": map[string]interface{}{ + "@id": "https://w3id.org/security#controller", + "@type": "@id", + }, + "revoked": map[string]interface{}{ + "@id": "https://w3id.org/security#revoked", + "@type": "http://www.w3.org/2001/XMLSchema#dateTime", + }, + "publicKeyMultibase": map[string]interface{}{ + "@id": "https://w3id.org/security#publicKeyMultibase", + "@type": "https://w3id.org/security#multibase", + }, + }, + }, + "EcdsaSecp256k1Signature2020": map[string]interface{}{ + "@id": "https://w3id.org/security#EcdsaSecp256k1Signature2020", + "@context": map[string]interface{}{ + "@protected": true, + "id": "@id", + "type": "@type", + "challenge": "https://w3id.org/security#challenge", + "created": map[string]interface{}{ + "@id": "http://purl.org/dc/terms/created", + "@type": "http://www.w3.org/2001/XMLSchema#dateTime", + }, + "domain": "https://w3id.org/security#domain", + "expires": map[string]interface{}{ + "@id": "https://w3id.org/security#expiration", + "@type": "http://www.w3.org/2001/XMLSchema#dateTime", + }, + "nonce": "https://w3id.org/security#nonce", + "proofPurpose": map[string]interface{}{ + "@id": "https://w3id.org/security#proofPurpose", + "@type": "@vocab", + "@context": map[string]interface{}{ + "@protected": true, + "id": "@id", + "type": "@type", + "assertionMethod": map[string]interface{}{ + "@id": "https://w3id.org/security#assertionMethod", + "@type": "@id", + "@container": "@set", + }, + "authentication": map[string]interface{}{ + "@id": "https://w3id.org/security#authenticationMethod", + "@type": "@id", + "@container": "@set", + }, + "capabilityInvocation": map[string]interface{}{ + "@id": "https://w3id.org/security#capabilityInvocationMethod", + "@type": "@id", + "@container": "@set", + }, + "capabilityDelegation": map[string]interface{}{ + "@id": "https://w3id.org/security#capabilityDelegationMethod", + "@type": "@id", + "@container": "@set", + }, + "keyAgreement": map[string]interface{}{ + "@id": "https://w3id.org/security#keyAgreementMethod", + "@type": "@id", + "@container": "@set", + }, + }, + }, + "jws": map[string]interface{}{ + "@id": "https://w3id.org/security#jws", + }, + "verificationMethod": map[string]interface{}{ + "@id": "https://w3id.org/security#verificationMethod", + "@type": "@id", + }, + }, + }, + "EcdsaSecp256k1RecoveryMethod2020": map[string]interface{}{ + "@id": "https://w3id.org/security#EcdsaSecp256k1RecoveryMethod2020", + "@context": map[string]interface{}{ + "@protected": true, + "id": "@id", + "type": "@type", + "controller": map[string]interface{}{ + "@id": "https://w3id.org/security#controller", + "@type": "@id", + }, + "revoked": map[string]interface{}{ + "@id": "https://w3id.org/security#revoked", + "@type": "http://www.w3.org/2001/XMLSchema#dateTime", + }, + "blockchainAccountId": map[string]interface{}{ + "@id": "https://w3id.org/security#blockchainAccountId", + }, + "ethereumAddress": map[string]interface{}{ + "@id": "https://w3id.org/security#ethereumAddress", + }, + "publicKeyJwk": map[string]interface{}{ + "@id": "https://w3id.org/security#publicKeyJwk", + "@type": "@json", + }, + "publicKeyBase58": map[string]interface{}{ + "@id": "https://w3id.org/security#publicKeyBase58", + }, + "publicKeyHex": map[string]interface{}{ + "@id": "https://w3id.org/security#publicKeyHex", + }, + "publicKeyMultibase": map[string]interface{}{ + "@id": "https://w3id.org/security#publicKeyMultibase", + "@type": "https://w3id.org/security#multibase", + }, + }, + }, + "EcdsaSecp256k1RecoverySignature2020": map[string]interface{}{ + "@id": "https://w3id.org/security#EcdsaSecp256k1RecoverySignature2020", + "@context": map[string]interface{}{ + "@protected": true, + "id": "@id", + "type": "@type", + "challenge": "https://w3id.org/security#challenge", + "created": map[string]interface{}{ + "@id": "http://purl.org/dc/terms/created", + "@type": "http://www.w3.org/2001/XMLSchema#dateTime", + }, + "domain": "https://w3id.org/security#domain", + "expires": map[string]interface{}{ + "@id": "https://w3id.org/security#expiration", + "@type": "http://www.w3.org/2001/XMLSchema#dateTime", + }, + "nonce": "https://w3id.org/security#nonce", + "proofPurpose": map[string]interface{}{ + "@id": "https://w3id.org/security#proofPurpose", + "@type": "@vocab", + "@context": map[string]interface{}{ + "@protected": true, + "id": "@id", + "type": "@type", + "assertionMethod": map[string]interface{}{ + "@id": "https://w3id.org/security#assertionMethod", + "@type": "@id", + "@container": "@set", + }, + "authentication": map[string]interface{}{ + "@id": "https://w3id.org/security#authenticationMethod", + "@type": "@id", + "@container": "@set", + }, + "capabilityInvocation": map[string]interface{}{ + "@id": "https://w3id.org/security#capabilityInvocationMethod", + "@type": "@id", + "@container": "@set", + }, + "capabilityDelegation": map[string]interface{}{ + "@id": "https://w3id.org/security#capabilityDelegationMethod", + "@type": "@id", + "@container": "@set", + }, + "keyAgreement": map[string]interface{}{ + "@id": "https://w3id.org/security#keyAgreementMethod", + "@type": "@id", + "@container": "@set", + }, + }, + }, + "jws": map[string]interface{}{ + "@id": "https://w3id.org/security#jws", + }, + "verificationMethod": map[string]interface{}{ + "@id": "https://w3id.org/security#verificationMethod", + "@type": "@id", + }, + }, + }, + }, } diff --git a/x/ssi/ld-context/normalize.go b/x/ssi/ld-context/normalize.go index 5b7385c..7ec2928 100644 --- a/x/ssi/ld-context/normalize.go +++ b/x/ssi/ld-context/normalize.go @@ -12,6 +12,12 @@ func NormalizeByVerificationMethodType(didDoc *types.Did, vmType string) ([]byte return nil, err } return didDocBytes, nil + case types.EcdsaSecp256k1RecoveryMethod2020: + didDocBytes, err := EcdsaSecp256k1RecoverySignature2020Canonize(didDoc) + if err != nil { + return nil, err + } + return didDocBytes, nil default: return didDoc.GetSignBytes(), nil } diff --git a/x/ssi/ld-context/suite.go b/x/ssi/ld-context/suite.go index bbe6290..6201a55 100644 --- a/x/ssi/ld-context/suite.go +++ b/x/ssi/ld-context/suite.go @@ -17,3 +17,18 @@ func EdDSACryptoSuite2020Canonize(didDoc *types.Did) ([]byte, error) { canonizedDidDocumentHash := sha256.Sum256([]byte(canonizedDidDocument)) return canonizedDidDocumentHash[:], nil } + +// EcdsaSecp256k1RecoverySignature2020Canonize canonizes DID Document in accordance with +// the Identity Foundation draft on EcdsaSecp256k1RecoverySignature2020 +// Read more: https://identity.foundation/EcdsaSecp256k1RecoverySignature2020/ +// LD Context: https://ns.did.ai/suites/secp256k1-2020/v1 +func EcdsaSecp256k1RecoverySignature2020Canonize(didDoc *types.Did) ([]byte, error) { + jsonLdDid := NewJsonLdDid(didDoc) + canonizedDidDocument, err := jsonLdDid.NormalizeWithURDNA2015() + if err != nil { + return nil, err + } + + canonizedDidDocumentHash := sha256.Sum256([]byte(canonizedDidDocument)) + return canonizedDidDocumentHash[:], nil +} diff --git a/x/ssi/verification/client_spec.go b/x/ssi/verification/client_spec.go index 3f90fd3..6c6d585 100644 --- a/x/ssi/verification/client_spec.go +++ b/x/ssi/verification/client_spec.go @@ -2,6 +2,7 @@ package verification import ( "encoding/base64" + "encoding/hex" "encoding/json" "fmt" @@ -58,6 +59,22 @@ func getDocBytesByClientSpec(ssiMsg types.SsiMsg, extendedVm *types.ExtendedVeri case types.ADR036ClientSpec: return getCosmosADR036SignDocBytes(ssiMsg, extendedVm.ClientSpec) case types.PersonalSignClientSpec: + if didDoc, ok := ssiMsg.(*types.Did); ok { + canonizedDidDocHash, err := ldcontext.EcdsaSecp256k1RecoverySignature2020Canonize(didDoc) + if err != nil { + return nil, err + } + + // TODO: This is temporary fix eth.personal.sign() client function, since it only signs JSON + // stringified document and hence the following struct was used to sign from the Client end. + return json.Marshal(struct{ + DidId string `json:"didId"` + DidDocDigest string `json:"didDocDigest"` + } { + DidId: didDoc.Id, + DidDocDigest: hex.EncodeToString(canonizedDidDocHash), + }) + } return getPersonalSignSpecDocBytes(ssiMsg) default: return nil, fmt.Errorf( diff --git a/x/ssi/verification/crypto.go b/x/ssi/verification/crypto.go index 939227a..96a04f8 100644 --- a/x/ssi/verification/crypto.go +++ b/x/ssi/verification/crypto.go @@ -61,7 +61,7 @@ func verify(extendedVm *types.ExtendedVerificationMethod, ssiMsg types.SsiMsg) e case types.EcdsaSecp256k1VerificationKey2019: return verifyEcdsaSecp256k1VerificationKey2019Key(extendedVm, docBytes) case types.EcdsaSecp256k1RecoveryMethod2020: - return verifyEcdsaSecp256k1RecoveryMethod2020Key(extendedVm, docBytes) + return verifyEcdsaSecp256k1RecoverySignature2020(extendedVm, docBytes) case types.X25519KeyAgreementKey2020: return verifyX25519KeyAgreementKey2020Key(extendedVm) case types.X25519KeyAgreementKeyEIP5630: @@ -152,8 +152,8 @@ func verifyBls12381G2Key2020Key(extendedVm *types.ExtendedVerificationMethod, do return nil } -// verifyEcdsaSecp256k1RecoveryMethod2020Key verifies the verification key for verification method type EcdsaSecp256k1RecoveryMethod2020 -func verifyEcdsaSecp256k1RecoveryMethod2020Key(extendedVm *types.ExtendedVerificationMethod, documentBytes []byte) error { +// verifyEcdsaSecp256k1RecoverySignature2020 verifies the verification key for verification method type EcdsaSecp256k1RecoveryMethod2020 +func verifyEcdsaSecp256k1RecoverySignature2020(extendedVm *types.ExtendedVerificationMethod, documentBytes []byte) error { extractedCAIP10Prefix, err := getCAIP10Prefix(extendedVm.BlockchainAccountId) if err != nil { return err From 00f27e4956bb8cd7f62e3886ca5ea5f3141f127d Mon Sep 17 00:00:00 2001 From: Arnab Ghose Date: Mon, 25 Sep 2023 07:41:12 +0530 Subject: [PATCH 5/8] feat: added bbs-signature-2020 ld-context --- cmd/hid-noded/cmd/debug_extensions.go | 4 +- tests/e2e/ssi_tests/e2e_tests.py | 10 +- tests/e2e/ssi_tests/generate_doc.py | 6 +- tests/e2e/ssi_tests/run.py | 24 ++--- tests/e2e/ssi_tests/utils.py | 2 +- x/ssi/client/cli/tx_utils.go | 9 +- x/ssi/ld-context/context.go | 148 ++++++++++++++++++++++++++ x/ssi/ld-context/normalize.go | 8 ++ x/ssi/ld-context/suite.go | 13 +++ 9 files changed, 199 insertions(+), 25 deletions(-) diff --git a/cmd/hid-noded/cmd/debug_extensions.go b/cmd/hid-noded/cmd/debug_extensions.go index ed6e39a..2d6abed 100644 --- a/cmd/hid-noded/cmd/debug_extensions.go +++ b/cmd/hid-noded/cmd/debug_extensions.go @@ -342,7 +342,7 @@ func signSchemaDocCmd() *cobra.Command { if err != nil { return err } - case "bbs": + case types.BbsBlsSignature2020: signature, err = hidnodecli.GetBBSSignature(argPrivateKey, schemaDocBytes) if err != nil { return err @@ -404,7 +404,7 @@ func signCredStatusDocCmd() *cobra.Command { if err != nil { return err } - case "bbs": + case types.BbsBlsSignature2020: signature, err = hidnodecli.GetBBSSignature(argPrivateKey, credStatusDocBytes) if err != nil { return err diff --git a/tests/e2e/ssi_tests/e2e_tests.py b/tests/e2e/ssi_tests/e2e_tests.py index 099fa48..d2d7600 100644 --- a/tests/e2e/ssi_tests/e2e_tests.py +++ b/tests/e2e/ssi_tests/e2e_tests.py @@ -12,14 +12,14 @@ def bbs_signature_test(): print("\n--1. PASS: Create a DID using BLS12381G2 Key Pair--\n") - kp_alice = generate_key_pair("bbs") + kp_alice = generate_key_pair("BbsBlsSignature2020") signers = [] - did_doc_string = generate_did_document(kp_alice, "bbs") + did_doc_string = generate_did_document(kp_alice, "BbsBlsSignature2020") did_doc_alice = did_doc_string["id"] signPair_alice = { "kp": kp_alice, "verificationMethodId": did_doc_string["verificationMethod"][0]["id"], - "signing_algo": "bbs" + "signing_algo": "BbsBlsSignature2020" } signers.append(signPair_alice) create_tx_cmd = form_did_create_tx_multisig(did_doc_string, signers, DEFAULT_BLOCKCHAIN_ACCOUNT_NAME) @@ -31,7 +31,7 @@ def bbs_signature_test(): kp_alice, did_doc_alice, did_doc_string["verificationMethod"][0]["id"], - algo="bbs" + algo="BbsBlsSignature2020" ) create_schema_cmd = form_create_schema_tx( schema_doc, @@ -47,7 +47,7 @@ def bbs_signature_test(): kp_alice, did_doc_alice, did_doc_string["verificationMethod"][0]["id"], - algo="bbs" + algo="BbsBlsSignature2020" ) register_cred_status_cmd = form_create_cred_status_tx( cred_doc, diff --git a/tests/e2e/ssi_tests/generate_doc.py b/tests/e2e/ssi_tests/generate_doc.py index af0ef00..cb72138 100644 --- a/tests/e2e/ssi_tests/generate_doc.py +++ b/tests/e2e/ssi_tests/generate_doc.py @@ -35,7 +35,7 @@ def generate_did_document(key_pair, algo="Ed25519Signature2020", bech32prefix="h vm_type = "EcdsaSecp256k1VerificationKey2019" elif algo == "EcdsaSecp256k1RecoverySignature2020": vm_type = "EcdsaSecp256k1RecoveryMethod2020" - elif algo == "bbs": + elif algo == "BbsBlsSignature2020": vm_type = "Bls12381G2Key2020" elif algo == "bjj": vm_type = "BabyJubJubVerificationKey2023" @@ -112,7 +112,7 @@ def generate_schema_document(key_pair, schema_author, vm, signature=None, algo=" proof_type = "EcdsaSecp256k1Signature2019" elif algo == "EcdsaSecp256k1RecoverySignature2020": proof_type = "EcdsaSecp256k1RecoverySignature2020" - elif algo == "bbs": + elif algo == "BbsBlsSignature2020": proof_type = "BbsBlsSignature2020" elif algo == "bjj": proof_type = "BabyJubJubSignature2023" @@ -160,7 +160,7 @@ def generate_cred_status_document(key_pair, cred_author, vm, signature=None, alg proof_type = "EcdsaSecp256k1Signature2019" elif algo == "EcdsaSecp256k1RecoverySignature2020": proof_type = "EcdsaSecp256k1RecoverySignature2020" - elif algo == "bbs": + elif algo == "BbsBlsSignature2020": proof_type = "BbsBlsSignature2020" elif algo == "bjj": proof_type = "BabyJubJubSignature2023" diff --git a/tests/e2e/ssi_tests/run.py b/tests/e2e/ssi_tests/run.py index 733a362..a7a6fee 100644 --- a/tests/e2e/ssi_tests/run.py +++ b/tests/e2e/ssi_tests/run.py @@ -24,19 +24,19 @@ def generate_report(func): def run_all_tests(): print("============= 🔧️ Running all x/ssi e2e tests ============== \n") - create_did_test() - update_did_test() - schema_test() - deactivate_did() - credential_status_test() - caip10_ethereum_support_test() - caip10_cosmos_support_test() - vm_type_test() - method_specific_id_test() - unique_wallet_address_test() - key_agrement_test() + # create_did_test() + # update_did_test() + # schema_test() + # deactivate_did() + # credential_status_test() + # caip10_ethereum_support_test() + # caip10_cosmos_support_test() + # vm_type_test() + # method_specific_id_test() + # unique_wallet_address_test() + # key_agrement_test() bbs_signature_test() - bjj_signature_test() + # bjj_signature_test() print("============= 😃️ All test cases completed successfully ============== \n") diff --git a/tests/e2e/ssi_tests/utils.py b/tests/e2e/ssi_tests/utils.py index 3c58587..9499eed 100644 --- a/tests/e2e/ssi_tests/utils.py +++ b/tests/e2e/ssi_tests/utils.py @@ -53,7 +53,7 @@ def generate_key_pair(algo="Ed25519Signature2020"): cmd = "hid-noded debug secp256k1 random" elif algo == "EcdsaSecp256k1RecoverySignature2020": cmd = "hid-noded debug secp256k1 eth-hex-random" - elif algo == "bbs": + elif algo == "BbsBlsSignature2020": cmd = "hid-noded debug bbs random" elif algo == "bjj": cmd = "hid-noded debug bjj random" diff --git a/x/ssi/client/cli/tx_utils.go b/x/ssi/client/cli/tx_utils.go index 8b8d2a4..525f15a 100644 --- a/x/ssi/client/cli/tx_utils.go +++ b/x/ssi/client/cli/tx_utils.go @@ -189,8 +189,13 @@ func getSignatures(cmd *cobra.Command, didDoc *types.Did, cmdArgs []string) ([]* if err != nil { return nil, err } - case "bbs": - signInfoList[i].Signature, err = GetBBSSignature(didSigningElementsList[i].SignKey, didDoc.GetSignBytes()) + case types.BbsBlsSignature2020: + didDocBytes, err := ldcontext.BbsBlsSignature2020Canonize(didDoc) + if err != nil { + return nil, err + } + + signInfoList[i].Signature, err = GetBBSSignature(didSigningElementsList[i].SignKey, didDocBytes) if err != nil { return nil, err } diff --git a/x/ssi/ld-context/context.go b/x/ssi/ld-context/context.go index d6dcc83..43526e1 100644 --- a/x/ssi/ld-context/context.go +++ b/x/ssi/ld-context/context.go @@ -4,6 +4,7 @@ const didContext string = "https://www.w3.org/ns/did/v1" const ed25519Context2020 string = "https://w3id.org/security/suites/ed25519-2020/v1" const x25519KeyAgreement2020Context string = "https://ns.did.ai/suites/x25519-2020/v1" const secp256k1Recovery2020Context string = "https://ns.did.ai/suites/secp256k1-2020/v1" +const bbsSignature2020Context string = "https://ns.did.ai/suites/bls12381-2020/v1" // As hid-node is not supposed to perform any GET request, the complete Context body of their // respective Context urls has been maintained below. @@ -360,4 +361,151 @@ var ContextUrlMap map[string]contextObject = map[string]contextObject{ }, }, }, + bbsSignature2020Context: { + "@version": 1.1, + "id": "@id", + "type": "@type", + "proof": map[string]interface{}{ + "@id": "https://w3id.org/security#proof", + "@type": "@id", + "@container": "@graph", + }, + "BbsBlsSignature2020": map[string]interface{}{ + "@id": "https://w3id.org/security#BbsBlsSignature2020", + "@context": map[string]interface{}{ + "@version": 1.1, + "@protected": true, + "id": "@id", + "type": "@type", + "challenge": "https://w3id.org/security#challenge", + "created": map[string]interface{}{ + "@id": "http://purl.org/dc/terms/created", + "@type": "http://www.w3.org/2001/XMLSchema#dateTime", + }, + "domain": "https://w3id.org/security#domain", + "proofValue": "https://w3id.org/security#proofValue", + "nonce": "https://w3id.org/security#nonce", + "proofPurpose": map[string]interface{}{ + "@id": "https://w3id.org/security#proofPurpose", + "@type": "@vocab", + "@context": map[string]interface{}{ + "@version": 1.1, + "@protected": true, + "id": "@id", + "type": "@type", + "assertionMethod": map[string]interface{}{ + "@id": "https://w3id.org/security#assertionMethod", + "@type": "@id", + "@container": "@set", + }, + "authentication": map[string]interface{}{ + "@id": "https://w3id.org/security#authenticationMethod", + "@type": "@id", + "@container": "@set", + }, + }, + }, + "verificationMethod": map[string]interface{}{ + "@id": "https://w3id.org/security#verificationMethod", + "@type": "@id", + }, + }, + }, + "BbsBlsSignatureProof2020": map[string]interface{}{ + "@id": "https://w3id.org/security#BbsBlsSignatureProof2020", + "@context": map[string]interface{}{ + "@version": 1.1, + "@protected": true, + "id": "@id", + "type": "@type", + "challenge": "https://w3id.org/security#challenge", + "created": map[string]interface{}{ + "@id": "http://purl.org/dc/terms/created", + "@type": "http://www.w3.org/2001/XMLSchema#dateTime", + }, + "domain": "https://w3id.org/security#domain", + "nonce": "https://w3id.org/security#nonce", + "proofPurpose": map[string]interface{}{ + "@id": "https://w3id.org/security#proofPurpose", + "@type": "@vocab", + "@context": map[string]interface{}{ + "@version": 1.1, + "@protected": true, + "id": "@id", + "type": "@type", + "sec": "https://w3id.org/security#", + "assertionMethod": map[string]interface{}{ + "@id": "https://w3id.org/security#assertionMethod", + "@type": "@id", + "@container": "@set", + }, + "authentication": map[string]interface{}{ + "@id": "https://w3id.org/security#authenticationMethod", + "@type": "@id", + "@container": "@set", + }, + }, + }, + "proofValue": "https://w3id.org/security#proofValue", + "verificationMethod": map[string]interface{}{ + "@id": "https://w3id.org/security#verificationMethod", + "@type": "@id", + }, + }, + }, + "Bls12381G1Key2020": map[string]interface{}{ + "@id": "https://w3id.org/security#Bls12381G1Key2020", + "@context": map[string]interface{}{ + "@protected": true, + "id": "@id", + "type": "@type", + "controller": map[string]interface{}{ + "@id": "https://w3id.org/security#controller", + "@type": "@id", + }, + "revoked": map[string]interface{}{ + "@id": "https://w3id.org/security#revoked", + "@type": "http://www.w3.org/2001/XMLSchema#dateTime", + }, + "publicKeyJwk": map[string]interface{}{ + "@id": "https://w3id.org/security#publicKeyJwk", + "@type": "@json", + }, + "publicKeyBase58": map[string]interface{}{ + "@id": "https://w3id.org/security#publicKeyBase58", + }, + "publicKeyMultibase": map[string]interface{}{ + "@id": "https://w3id.org/security#publicKeyMultibase", + "@type": "https://w3id.org/security#multibase", + }, + }, + }, + "Bls12381G2Key2020": map[string]interface{}{ + "@id": "https://w3id.org/security#Bls12381G2Key2020", + "@context": map[string]interface{}{ + "@protected": true, + "id": "@id", + "type": "@type", + "controller": map[string]interface{}{ + "@id": "https://w3id.org/security#controller", + "@type": "@id", + }, + "revoked": map[string]interface{}{ + "@id": "https://w3id.org/security#revoked", + "@type": "http://www.w3.org/2001/XMLSchema#dateTime", + }, + "publicKeyJwk": map[string]interface{}{ + "@id": "https://w3id.org/security#publicKeyJwk", + "@type": "@json", + }, + "publicKeyBase58": map[string]interface{}{ + "@id": "https://w3id.org/security#publicKeyBase58", + }, + "publicKeyMultibase": map[string]interface{}{ + "@id": "https://w3id.org/security#publicKeyMultibase", + "@type": "https://w3id.org/security#multibase", + }, + }, + }, + }, } diff --git a/x/ssi/ld-context/normalize.go b/x/ssi/ld-context/normalize.go index 7ec2928..500263c 100644 --- a/x/ssi/ld-context/normalize.go +++ b/x/ssi/ld-context/normalize.go @@ -4,6 +4,8 @@ import ( "github.com/hypersign-protocol/hid-node/x/ssi/types" ) +// NormalizeByVerificationMethodType canonizes DID Document based on the input Verification +// Method type func NormalizeByVerificationMethodType(didDoc *types.Did, vmType string) ([]byte, error) { switch vmType { case types.Ed25519VerificationKey2020: @@ -18,6 +20,12 @@ func NormalizeByVerificationMethodType(didDoc *types.Did, vmType string) ([]byte return nil, err } return didDocBytes, nil + case types.Bls12381G2Key2020: + didDocBytes, err := BbsBlsSignature2020Canonize(didDoc) + if err != nil { + return nil, err + } + return didDocBytes, nil default: return didDoc.GetSignBytes(), nil } diff --git a/x/ssi/ld-context/suite.go b/x/ssi/ld-context/suite.go index 6201a55..53da232 100644 --- a/x/ssi/ld-context/suite.go +++ b/x/ssi/ld-context/suite.go @@ -32,3 +32,16 @@ func EcdsaSecp256k1RecoverySignature2020Canonize(didDoc *types.Did) ([]byte, err canonizedDidDocumentHash := sha256.Sum256([]byte(canonizedDidDocument)) return canonizedDidDocumentHash[:], nil } + +// BbsBlsSignature2020Canonize canonizes the DID Document for the +// BbsBlsSignature2020 signature type +func BbsBlsSignature2020Canonize(didDoc *types.Did) ([]byte, error) { + jsonLdDid := NewJsonLdDid(didDoc) + canonizedDidDocument, err := jsonLdDid.NormalizeWithURDNA2015() + if err != nil { + return nil, err + } + + canonizedDidDocumentHash := sha256.Sum256([]byte(canonizedDidDocument)) + return canonizedDidDocumentHash[:], nil +} From e7f86b574c0fbeb7d95505b2fe73dfe835c1643d Mon Sep 17 00:00:00 2001 From: Arnab Ghose Date: Mon, 25 Sep 2023 09:10:13 +0530 Subject: [PATCH 6/8] feat: added secp256k1-2019 ld context --- cmd/hid-noded/cmd/debug_extensions.go | 8 +- tests/e2e/ssi_tests/e2e_tests.py | 14 ++-- tests/e2e/ssi_tests/generate_doc.py | 15 ++-- tests/e2e/ssi_tests/run.py | 24 +++--- tests/e2e/ssi_tests/utils.py | 2 +- x/ssi/client/cli/tx_utils.go | 11 ++- x/ssi/ld-context/context.go | 101 ++++++++++++++++++++++++++ x/ssi/ld-context/normalize.go | 6 ++ x/ssi/ld-context/suite.go | 14 ++++ x/ssi/verification/client_spec.go | 14 +++- x/ssi/verification/crypto.go | 6 +- 11 files changed, 176 insertions(+), 39 deletions(-) diff --git a/cmd/hid-noded/cmd/debug_extensions.go b/cmd/hid-noded/cmd/debug_extensions.go index 2d6abed..651b661 100644 --- a/cmd/hid-noded/cmd/debug_extensions.go +++ b/cmd/hid-noded/cmd/debug_extensions.go @@ -332,8 +332,8 @@ func signSchemaDocCmd() *cobra.Command { if err != nil { return err } - case "secp256k1": - signature, err = hidnodecli.GetSecp256k1Signature(argPrivateKey, schemaDocBytes) + case types.EcdsaSecp256k1Signature2019: + signature, err = hidnodecli.GetEcdsaSecp256k1Signature2019(argPrivateKey, schemaDocBytes) if err != nil { return err } @@ -394,8 +394,8 @@ func signCredStatusDocCmd() *cobra.Command { if err != nil { return err } - case "secp256k1": - signature, err = hidnodecli.GetSecp256k1Signature(argPrivateKey, credStatusDocBytes) + case types.EcdsaSecp256k1Signature2019: + signature, err = hidnodecli.GetEcdsaSecp256k1Signature2019(argPrivateKey, credStatusDocBytes) if err != nil { return err } diff --git a/tests/e2e/ssi_tests/e2e_tests.py b/tests/e2e/ssi_tests/e2e_tests.py index d2d7600..e20bd77 100644 --- a/tests/e2e/ssi_tests/e2e_tests.py +++ b/tests/e2e/ssi_tests/e2e_tests.py @@ -952,7 +952,7 @@ def caip10_ethereum_support_test(): def caip10_cosmos_support_test(): print("\n--- CAIP-10 Test: Cosmos Chains ---\n") - kp_algo = "secp256k1" + kp_algo = "EcdsaSecp256k1Signature2019" # Invalid blockchain Account Ids invalid_blockchain_account_ids = [ @@ -1209,7 +1209,7 @@ def vm_type_test(): # EcdsaSecp256k1VerificationKey2019 print("4. PASS: Registering DID Document with a verification method of type EcdsaSecp256k1VerificationKey2019. Only publicKeyMultibase is passed.") - kp_algo = "secp256k1" + kp_algo = "EcdsaSecp256k1Signature2019" kp = generate_key_pair(algo=kp_algo) did_doc_string = generate_did_document(kp, kp_algo, is_uuid=True, bech32prefix="") did_doc_id = did_doc_string["id"] @@ -1225,7 +1225,7 @@ def vm_type_test(): run_blockchain_command(create_tx_cmd, f"Registering DID with Id: {did_doc_id}") print("5. PASS: Registering DID Document with a verification method of type EcdsaSecp256k1VerificationKey2019. Both publicKeyMultibase and blockchainAccountId are passed.") - kp_algo = "secp256k1" + kp_algo = "EcdsaSecp256k1Signature2019" kp = generate_key_pair(algo=kp_algo) did_doc_string = generate_did_document(kp, kp_algo) did_doc_id = did_doc_string["id"] @@ -1240,7 +1240,7 @@ def vm_type_test(): run_blockchain_command(create_tx_cmd, f"Registering DID with Id: {did_doc_id}") print("6. FAIL: Registering DID Document with a verification method of type EcdsaSecp256k1VerificationKey2019. Only blockchainAccountId is passed.") - kp_algo = "secp256k1" + kp_algo = "EcdsaSecp256k1Signature2019" kp = generate_key_pair(algo=kp_algo) did_doc_string = generate_did_document(kp, kp_algo) did_doc_id = did_doc_string["id"] @@ -1311,7 +1311,7 @@ def method_specific_id_test(): print("1. PASS: Registering a DID Document where the user provides a blockchain address in MSI that they own") - kp_algo = "secp256k1" + kp_algo = "EcdsaSecp256k1Signature2019" kp_alice = generate_key_pair(algo=kp_algo) signers = [] did_doc_string = generate_did_document(kp_alice, algo=kp_algo) @@ -1328,7 +1328,7 @@ def method_specific_id_test(): print("2. FAIL: Registering a DID Document where the user provides a blockchain address in MSI that they don't own") - kp_algo = "secp256k1" + kp_algo = "EcdsaSecp256k1Signature2019" kp_bob = generate_key_pair(algo=kp_algo) signers = [] did_doc_string = generate_did_document(kp_bob, algo=kp_algo) @@ -1392,7 +1392,7 @@ def method_specific_id_test(): print("6. PASS: Alice tries to update their DID Document by removing the Verification Method associated with the method specific id (CAIP-10 Blockchain Address)") - kp_algo = "secp256k1" + kp_algo = "EcdsaSecp256k1Signature2019" kp_alice = generate_key_pair(algo=kp_algo) signers = [] did_doc_string = generate_did_document(kp_alice, algo=kp_algo) diff --git a/tests/e2e/ssi_tests/generate_doc.py b/tests/e2e/ssi_tests/generate_doc.py index cb72138..cb7b143 100644 --- a/tests/e2e/ssi_tests/generate_doc.py +++ b/tests/e2e/ssi_tests/generate_doc.py @@ -9,6 +9,7 @@ ED25519_CONTEXT = "https://w3id.org/security/suites/ed25519-2020/v1" DID_CONTEXT = "https://www.w3.org/ns/did/v1" SECP256K1_RECOVERY_CONTEXT = "https://ns.did.ai/suites/secp256k1-2020/v1" +SECP256K1_VER_KEY_2019_CONTEXT = "https://ns.did.ai/suites/secp256k1-2019/v1" def generate_did_document(key_pair, algo="Ed25519Signature2020", bech32prefix="hid", is_uuid=False): base_document = { @@ -24,14 +25,16 @@ def generate_did_document(key_pair, algo="Ed25519Signature2020", bech32prefix="h base_document["context"].append(ED25519_CONTEXT) if algo == "EcdsaSecp256k1RecoverySignature2020": base_document["context"].append(SECP256K1_RECOVERY_CONTEXT) + if algo == "EcdsaSecp256k1Signature2019": + base_document["context"].append(SECP256K1_VER_KEY_2019_CONTEXT) did_id = generate_document_id("did", key_pair, algo, is_uuid) - + # Form the DID Document vm_type = "" if algo == "Ed25519Signature2020": vm_type = "Ed25519VerificationKey2020" - elif algo == "secp256k1": + elif algo == "EcdsaSecp256k1Signature2019": vm_type = "EcdsaSecp256k1VerificationKey2019" elif algo == "EcdsaSecp256k1RecoverySignature2020": vm_type = "EcdsaSecp256k1RecoveryMethod2020" @@ -40,7 +43,7 @@ def generate_did_document(key_pair, algo="Ed25519Signature2020", bech32prefix="h elif algo == "bjj": vm_type = "BabyJubJubVerificationKey2023" else: - raise Exception("unknown signing algorithm: " + key_pair) + raise Exception("unknown signing algorithm: " + algo) verification_method = {} if algo == "EcdsaSecp256k1RecoverySignature2020": @@ -60,7 +63,7 @@ def generate_did_document(key_pair, algo="Ed25519Signature2020", bech32prefix="h if algo == "EcdsaSecp256k1RecoverySignature2020": verification_method["blockchainAccountId"] = "eip155:1:" + key_pair["ethereum_address"] - elif algo == "secp256k1": + elif algo == "EcdsaSecp256k1Signature2019": if bech32prefix == "hid": verification_method["blockchainAccountId"] = "cosmos:jagrat:" + \ @@ -108,7 +111,7 @@ def generate_schema_document(key_pair, schema_author, vm, signature=None, algo=" proof_type = "" if algo == "Ed25519Signature2020": proof_type = "Ed25519Signature2020" - elif algo == "secp256k1": + elif algo == "EcdsaSecp256k1Signature2019": proof_type = "EcdsaSecp256k1Signature2019" elif algo == "EcdsaSecp256k1RecoverySignature2020": proof_type = "EcdsaSecp256k1RecoverySignature2020" @@ -156,7 +159,7 @@ def generate_cred_status_document(key_pair, cred_author, vm, signature=None, alg proof_type = "" if algo == "Ed25519Signature2020": proof_type = "Ed25519Signature2020" - elif algo == "secp256k1": + elif algo == "EcdsaSecp256k1Signature2019": proof_type = "EcdsaSecp256k1Signature2019" elif algo == "EcdsaSecp256k1RecoverySignature2020": proof_type = "EcdsaSecp256k1RecoverySignature2020" diff --git a/tests/e2e/ssi_tests/run.py b/tests/e2e/ssi_tests/run.py index a7a6fee..733a362 100644 --- a/tests/e2e/ssi_tests/run.py +++ b/tests/e2e/ssi_tests/run.py @@ -24,19 +24,19 @@ def generate_report(func): def run_all_tests(): print("============= 🔧️ Running all x/ssi e2e tests ============== \n") - # create_did_test() - # update_did_test() - # schema_test() - # deactivate_did() - # credential_status_test() - # caip10_ethereum_support_test() - # caip10_cosmos_support_test() - # vm_type_test() - # method_specific_id_test() - # unique_wallet_address_test() - # key_agrement_test() + create_did_test() + update_did_test() + schema_test() + deactivate_did() + credential_status_test() + caip10_ethereum_support_test() + caip10_cosmos_support_test() + vm_type_test() + method_specific_id_test() + unique_wallet_address_test() + key_agrement_test() bbs_signature_test() - # bjj_signature_test() + bjj_signature_test() print("============= 😃️ All test cases completed successfully ============== \n") diff --git a/tests/e2e/ssi_tests/utils.py b/tests/e2e/ssi_tests/utils.py index 9499eed..7ac83b7 100644 --- a/tests/e2e/ssi_tests/utils.py +++ b/tests/e2e/ssi_tests/utils.py @@ -49,7 +49,7 @@ def generate_key_pair(algo="Ed25519Signature2020"): cmd = "" if algo == "Ed25519Signature2020": cmd = "hid-noded debug ed25519 random" - elif algo == "secp256k1": + elif algo == "EcdsaSecp256k1Signature2019": cmd = "hid-noded debug secp256k1 random" elif algo == "EcdsaSecp256k1RecoverySignature2020": cmd = "hid-noded debug secp256k1 eth-hex-random" diff --git a/x/ssi/client/cli/tx_utils.go b/x/ssi/client/cli/tx_utils.go index 525f15a..1dc3bff 100644 --- a/x/ssi/client/cli/tx_utils.go +++ b/x/ssi/client/cli/tx_utils.go @@ -116,7 +116,7 @@ func GetEcdsaSecp256k1RecoverySignature2020(privateKey string, message []byte) ( return etherhexutil.Encode(sigBytes), nil } -func GetSecp256k1Signature(privateKey string, message []byte) (string, error) { +func GetEcdsaSecp256k1Signature2019(privateKey string, message []byte) (string, error) { // Decode key into bytes privKeyBytes, err := base64.StdEncoding.DecodeString(privateKey) if err != nil { @@ -174,8 +174,13 @@ func getSignatures(cmd *cobra.Command, didDoc *types.Did, cmdArgs []string) ([]* if err != nil { return nil, err } - case "secp256k1": - signInfoList[i].Signature, err = GetSecp256k1Signature(didSigningElementsList[i].SignKey, didDoc.GetSignBytes()) + case types.EcdsaSecp256k1Signature2019: + didDocBytes, err := ldcontext.EcdsaSecp256k1Signature2019Canonize(didDoc) + if err != nil { + return nil, err + } + + signInfoList[i].Signature, err = GetEcdsaSecp256k1Signature2019(didSigningElementsList[i].SignKey, didDocBytes) if err != nil { return nil, err } diff --git a/x/ssi/ld-context/context.go b/x/ssi/ld-context/context.go index 43526e1..6b4f83e 100644 --- a/x/ssi/ld-context/context.go +++ b/x/ssi/ld-context/context.go @@ -5,6 +5,7 @@ const ed25519Context2020 string = "https://w3id.org/security/suites/ed25519-2020 const x25519KeyAgreement2020Context string = "https://ns.did.ai/suites/x25519-2020/v1" const secp256k1Recovery2020Context string = "https://ns.did.ai/suites/secp256k1-2020/v1" const bbsSignature2020Context string = "https://ns.did.ai/suites/bls12381-2020/v1" +const secp256k12019Context string = "https://ns.did.ai/suites/secp256k1-2019/v1" // As hid-node is not supposed to perform any GET request, the complete Context body of their // respective Context urls has been maintained below. @@ -508,4 +509,104 @@ var ContextUrlMap map[string]contextObject = map[string]contextObject{ }, }, }, + secp256k12019Context: { + "id": "@id", + "type": "@type", + "@protected": true, + "proof": map[string]interface{}{ + "@id": "https://w3id.org/security#proof", + "@type": "@id", + "@container": "@graph", + }, + "EcdsaSecp256k1VerificationKey2019": map[string]interface{}{ + "@id": "https://w3id.org/security#EcdsaSecp256k1VerificationKey2019", + "@context": map[string]interface{}{ + "@protected": true, + "id": "@id", + "type": "@type", + "controller": map[string]interface{}{ + "@id": "https://w3id.org/security#controller", + "@type": "@id", + }, + "revoked": map[string]interface{}{ + "@id": "https://w3id.org/security#revoked", + "@type": "http://www.w3.org/2001/XMLSchema#dateTime", + }, + "blockchainAccountId": map[string]interface{}{ + "@id": "https://w3id.org/security#blockchainAccountId", + }, + "publicKeyJwk": map[string]interface{}{ + "@id": "https://w3id.org/security#publicKeyJwk", + "@type": "@json", + }, + "publicKeyBase58": map[string]interface{}{ + "@id": "https://w3id.org/security#publicKeyBase58", + }, + "publicKeyMultibase": map[string]interface{}{ + "@id": "https://w3id.org/security#publicKeyMultibase", + "@type": "https://w3id.org/security#multibase", + }, + }, + }, + "EcdsaSecp256k1Signature2019": map[string]interface{}{ + "@id": "https://w3id.org/security#EcdsaSecp256k1Signature2019", + "@context": map[string]interface{}{ + "@protected": true, + "id": "@id", + "type": "@type", + "challenge": "https://w3id.org/security#challenge", + "created": map[string]interface{}{ + "@id": "http://purl.org/dc/terms/created", + "@type": "http://www.w3.org/2001/XMLSchema#dateTime", + }, + "domain": "https://w3id.org/security#domain", + "expires": map[string]interface{}{ + "@id": "https://w3id.org/security#expiration", + "@type": "http://www.w3.org/2001/XMLSchema#dateTime", + }, + "nonce": "https://w3id.org/security#nonce", + "proofPurpose": map[string]interface{}{ + "@id": "https://w3id.org/security#proofPurpose", + "@type": "@vocab", + "@context": map[string]interface{}{ + "@protected": true, + "id": "@id", + "type": "@type", + "assertionMethod": map[string]interface{}{ + "@id": "https://w3id.org/security#assertionMethod", + "@type": "@id", + "@container": "@set", + }, + "authentication": map[string]interface{}{ + "@id": "https://w3id.org/security#authenticationMethod", + "@type": "@id", + "@container": "@set", + }, + "capabilityInvocation": map[string]interface{}{ + "@id": "https://w3id.org/security#capabilityInvocationMethod", + "@type": "@id", + "@container": "@set", + }, + "capabilityDelegation": map[string]interface{}{ + "@id": "https://w3id.org/security#capabilityDelegationMethod", + "@type": "@id", + "@container": "@set", + }, + "keyAgreement": map[string]interface{}{ + "@id": "https://w3id.org/security#keyAgreementMethod", + "@type": "@id", + "@container": "@set", + }, + }, + }, + "jws": map[string]interface{}{ + "@id": "https://w3id.org/security#jws", + }, + "verificationMethod": map[string]interface{}{ + "@id": "https://w3id.org/security#verificationMethod", + "@type": "@id", + }, + }, + }, + }, } diff --git a/x/ssi/ld-context/normalize.go b/x/ssi/ld-context/normalize.go index 500263c..074f1f8 100644 --- a/x/ssi/ld-context/normalize.go +++ b/x/ssi/ld-context/normalize.go @@ -26,6 +26,12 @@ func NormalizeByVerificationMethodType(didDoc *types.Did, vmType string) ([]byte return nil, err } return didDocBytes, nil + case types.EcdsaSecp256k1VerificationKey2019: + didDocBytes, err := EcdsaSecp256k1Signature2019Canonize(didDoc) + if err != nil { + return nil, err + } + return didDocBytes, nil default: return didDoc.GetSignBytes(), nil } diff --git a/x/ssi/ld-context/suite.go b/x/ssi/ld-context/suite.go index 53da232..1c1b18a 100644 --- a/x/ssi/ld-context/suite.go +++ b/x/ssi/ld-context/suite.go @@ -45,3 +45,17 @@ func BbsBlsSignature2020Canonize(didDoc *types.Did) ([]byte, error) { canonizedDidDocumentHash := sha256.Sum256([]byte(canonizedDidDocument)) return canonizedDidDocumentHash[:], nil } + + +// EcdsaSecp256k1Signature2019Canonize canonizes the DID Document for the +// EcdsaSecp256k1Signature2019 signature type +func EcdsaSecp256k1Signature2019Canonize(didDoc *types.Did) ([]byte, error) { + jsonLdDid := NewJsonLdDid(didDoc) + canonizedDidDocument, err := jsonLdDid.NormalizeWithURDNA2015() + if err != nil { + return nil, err + } + + canonizedDidDocumentHash := sha256.Sum256([]byte(canonizedDidDocument)) + return canonizedDidDocumentHash[:], nil +} diff --git a/x/ssi/verification/client_spec.go b/x/ssi/verification/client_spec.go index 6c6d585..2ed7c09 100644 --- a/x/ssi/verification/client_spec.go +++ b/x/ssi/verification/client_spec.go @@ -12,7 +12,7 @@ import ( // Read more about Cosmos's ADR Spec from the following: // https://docs.cosmos.network/v0.45/architecture/adr-036-arbitrary-signature.html -func getCosmosADR036SignDocBytes(ssiMsg types.SsiMsg, clientSpec *types.ClientSpec) ([]byte, error) { +func getCosmosADR036SignDocBytes(ssiDocBytes []byte, clientSpec *types.ClientSpec) ([]byte, error) { var msgSignData types.Msg = types.Msg{ Type: "sign/MsgSignData", Value: types.Val{ @@ -34,7 +34,7 @@ func getCosmosADR036SignDocBytes(ssiMsg types.SsiMsg, clientSpec *types.ClientSp }, Sequence: "0", } - ssiDocBytes := ssiMsg.GetSignBytes() + baseCosmosADR036SignDoc.Msgs[0].Value.Data = base64.StdEncoding.EncodeToString( ssiDocBytes) baseCosmosADR036SignDoc.Msgs[0].Value.Signer = clientSpec.Adr036SignerAddress @@ -57,7 +57,15 @@ func getDocBytesByClientSpec(ssiMsg types.SsiMsg, extendedVm *types.ExtendedVeri if extendedVm.ClientSpec != nil { switch extendedVm.ClientSpec.Type { case types.ADR036ClientSpec: - return getCosmosADR036SignDocBytes(ssiMsg, extendedVm.ClientSpec) + if didDoc, ok := ssiMsg.(*types.Did); ok { + canonizedDidDocHash, err := ldcontext.EcdsaSecp256k1Signature2019Canonize(didDoc) + if err != nil { + return nil, err + } + + return getCosmosADR036SignDocBytes(canonizedDidDocHash, extendedVm.ClientSpec) + } + return getCosmosADR036SignDocBytes(ssiMsg.GetSignBytes(), extendedVm.ClientSpec) case types.PersonalSignClientSpec: if didDoc, ok := ssiMsg.(*types.Did); ok { canonizedDidDocHash, err := ldcontext.EcdsaSecp256k1RecoverySignature2020Canonize(didDoc) diff --git a/x/ssi/verification/crypto.go b/x/ssi/verification/crypto.go index 96a04f8..af8ef46 100644 --- a/x/ssi/verification/crypto.go +++ b/x/ssi/verification/crypto.go @@ -59,7 +59,7 @@ func verify(extendedVm *types.ExtendedVerificationMethod, ssiMsg types.SsiMsg) e case types.Ed25519VerificationKey2020: return verifyEd25519Signature2020(extendedVm, docBytes) case types.EcdsaSecp256k1VerificationKey2019: - return verifyEcdsaSecp256k1VerificationKey2019Key(extendedVm, docBytes) + return verifyEcdsaSecp256k1Signature2019Key(extendedVm, docBytes) case types.EcdsaSecp256k1RecoveryMethod2020: return verifyEcdsaSecp256k1RecoverySignature2020(extendedVm, docBytes) case types.X25519KeyAgreementKey2020: @@ -221,8 +221,8 @@ func verifyEd25519Signature2020(extendedVm *types.ExtendedVerificationMethod, do } } -// verifyEcdsaSecp256k1VerificationKey2019Key verifies the verification key for verification method type EcdsaSecp256k1VerificationKey2019 -func verifyEcdsaSecp256k1VerificationKey2019Key(extendedVm *types.ExtendedVerificationMethod, documentBytes []byte) error { +// verifyEcdsaSecp256k1Signature2019Key verifies the verification key for verification method type EcdsaSecp256k1VerificationKey2019 +func verifyEcdsaSecp256k1Signature2019Key(extendedVm *types.ExtendedVerificationMethod, documentBytes []byte) error { // Decode and Parse Signature signatureBytes, err := base64.StdEncoding.DecodeString(extendedVm.Signature) if err != nil { From 5c8f53b4042954316483982fd2e454a1f03da954 Mon Sep 17 00:00:00 2001 From: Arnab Ghose Date: Mon, 25 Sep 2023 09:27:10 +0530 Subject: [PATCH 7/8] refactor: corrected signature verification function name of BbsBlsSignature2020 --- cmd/hid-noded/cmd/debug_extensions.go | 8 ++++---- x/ssi/client/cli/tx_utils.go | 6 +++--- x/ssi/verification/crypto.go | 6 +++--- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/cmd/hid-noded/cmd/debug_extensions.go b/cmd/hid-noded/cmd/debug_extensions.go index 651b661..0725598 100644 --- a/cmd/hid-noded/cmd/debug_extensions.go +++ b/cmd/hid-noded/cmd/debug_extensions.go @@ -343,7 +343,7 @@ func signSchemaDocCmd() *cobra.Command { return err } case types.BbsBlsSignature2020: - signature, err = hidnodecli.GetBBSSignature(argPrivateKey, schemaDocBytes) + signature, err = hidnodecli.GetBbsBlsSignature2020(argPrivateKey, schemaDocBytes) if err != nil { return err } @@ -353,7 +353,7 @@ func signSchemaDocCmd() *cobra.Command { return err } default: - panic("recieved unsupported signing-algo. Supported algorithms are: ['ed25519', 'secp256k1', 'recover-eth', 'bbs', 'bjj']") + panic("recieved unsupported signing-algo. Supported algorithms are: [Ed25519Signature2020, EcdsaSecp256k1Signature2019, EcdsaSecp256k1RecoverySignature2020, BbsBlsSignature2020, 'bjj']") } _, err = fmt.Fprintln(cmd.OutOrStdout(), signature) @@ -405,7 +405,7 @@ func signCredStatusDocCmd() *cobra.Command { return err } case types.BbsBlsSignature2020: - signature, err = hidnodecli.GetBBSSignature(argPrivateKey, credStatusDocBytes) + signature, err = hidnodecli.GetBbsBlsSignature2020(argPrivateKey, credStatusDocBytes) if err != nil { return err } @@ -415,7 +415,7 @@ func signCredStatusDocCmd() *cobra.Command { return err } default: - panic("recieved unsupported signing-algo. Supported algorithms are: ['ed25519', 'secp256k1', 'recover-eth', 'bbs', 'bjj']") + panic("recieved unsupported signing-algo. Supported algorithms are: [Ed25519Signature2020, EcdsaSecp256k1Signature2019, EcdsaSecp256k1RecoverySignature2020, BbsBlsSignature2020, 'bjj']") } _, err = fmt.Fprintln(cmd.OutOrStdout(), signature) diff --git a/x/ssi/client/cli/tx_utils.go b/x/ssi/client/cli/tx_utils.go index 1dc3bff..5acfab6 100644 --- a/x/ssi/client/cli/tx_utils.go +++ b/x/ssi/client/cli/tx_utils.go @@ -53,8 +53,8 @@ func extractDIDSigningElements(cmdArgs []string) ([]DIDSigningElements, error) { return didSigningElementsList, nil } -// GetBBSSignature signs a message and returns a BBS signature -func GetBBSSignature(privateKey string, message []byte) (string, error) { +// GetBbsBlsSignature2020 signs a message and returns a BBS signature +func GetBbsBlsSignature2020(privateKey string, message []byte) (string, error) { privKeyBytes, err := base64.StdEncoding.DecodeString(privateKey) if err != nil { panic(err) @@ -200,7 +200,7 @@ func getSignatures(cmd *cobra.Command, didDoc *types.Did, cmdArgs []string) ([]* return nil, err } - signInfoList[i].Signature, err = GetBBSSignature(didSigningElementsList[i].SignKey, didDocBytes) + signInfoList[i].Signature, err = GetBbsBlsSignature2020(didSigningElementsList[i].SignKey, didDocBytes) if err != nil { return nil, err } diff --git a/x/ssi/verification/crypto.go b/x/ssi/verification/crypto.go index af8ef46..1c8bb8e 100644 --- a/x/ssi/verification/crypto.go +++ b/x/ssi/verification/crypto.go @@ -67,7 +67,7 @@ func verify(extendedVm *types.ExtendedVerificationMethod, ssiMsg types.SsiMsg) e case types.X25519KeyAgreementKeyEIP5630: return verifyX25519KeyAgreementKeyEIP5630Key(extendedVm) case types.Bls12381G2Key2020: - return verifyBls12381G2Key2020Key(extendedVm, docBytes) + return verifyBbsBlsSignature2020(extendedVm, docBytes) case types.BabyJubJubVerificationKey2023: return verifyBabyJubJubVerificationKey2023Key(extendedVm, docBytes) default: @@ -121,8 +121,8 @@ func verifyBabyJubJubVerificationKey2023Key(extendedVm *types.ExtendedVerificati return nil } -// verifyBls12381G2Key2020Key verifies the verification key for verification method type Bls12381G2Key2020 -func verifyBls12381G2Key2020Key(extendedVm *types.ExtendedVerificationMethod, documentBytes []byte) error { +// verifyBbsBlsSignature2020 verifies the verification key for verification method type BbsBlsSignature2020 +func verifyBbsBlsSignature2020(extendedVm *types.ExtendedVerificationMethod, documentBytes []byte) error { bbsObj := bbs.New() // Unlike in tranditional cryptographic algorithms where a message is signed as-is, the message in BBS+ Signature From 4ce52b2b142d8debb6e8ea97d84494c5264e3030 Mon Sep 17 00:00:00 2001 From: Arnab Ghose Date: Thu, 19 Oct 2023 10:54:45 +0530 Subject: [PATCH 8/8] - Pre TestnetV2 Refactor - SSI proto package name has been renamed from hypersignprotocol.hidnode.ssi to hypersign.ssi.v1 - Client Spec has been reduced to an enum type. ADR036Signer address is infered from the blockchainAccountId - A common Proof message is introduced for DID, Credential Schema and Credential Status documents. It also replaces the existing Schema Proof, Credential Status Proof and DID SignInfo messages. Proof message is only stored on-chain for Credential Schema and Credential Status - Credential Status message has been revamped by eliminating statuses such as Live and Expired. Only Revocation and Suspension is tracked. Claim message has been discarded, making fields such as id, remarks part of the main Credential Status message. The attribute credentialHash has been renamed to merkleRootHash to indicate that the Hash represents the Merkle Root Hash of the VC - CreateDID RPC has been renamed to RegisterDID. Updates of any CredentialStatus document will done through a seperate RPC: UpdateCredentialStatus. Updates of any CredentialStatus document will done through a seperate RPC: UpdateCredentialSchema. - json_name proto tag has been added to context attribute of DidDocument to support @context field in generated TS client - protocgen-ts.sh script has been added to generate TS client files. This approach provides more flexibility in terms of generation options compared to using ignite CLI tool --- .gitignore | 3 + Makefile | 13 +- client/docs/config.json | 37 +- client/docs/swagger-ui/swagger.yaml | 930 ++++--- cmd/hid-noded/cmd/debug_extensions.go | 99 +- cmd/hid-noded/cmd/generate_ssi.go | 2 +- cmd/hid-noded/cmd/generate_ssi_utils.go | 9 +- proto/ssi/v1/clientSpec.proto | 9 - proto/ssi/v1/client_spec.proto | 14 + proto/ssi/v1/credential.proto | 35 - proto/ssi/v1/credential_schema.proto | 30 + proto/ssi/v1/credential_status.proto | 21 + proto/ssi/v1/did.proto | 21 +- proto/ssi/v1/genesis.proto | 6 +- proto/ssi/v1/proof.proto | 15 + proto/ssi/v1/query.proto | 62 +- proto/ssi/v1/schema.proto | 41 - proto/ssi/v1/tx.proto | 89 +- scripts/protocgen-ts.sh | 39 + tests/e2e/ssi_tests/e2e_tests.py | 110 +- tests/e2e/ssi_tests/generate_doc.py | 60 +- tests/e2e/ssi_tests/run.py | 4 +- tests/e2e/ssi_tests/transactions.py | 114 +- tests/e2e/ssi_tests/utils.py | 6 +- x/ssi/abci.go | 15 - x/ssi/client/cli/query_ssi.go | 14 +- x/ssi/client/cli/tx.go | 4 +- x/ssi/client/cli/tx_ssi.go | 207 +- x/ssi/client/cli/tx_utils.go | 108 +- x/ssi/handler.go | 16 +- x/ssi/keeper/grpc_query_credential.go | 22 +- x/ssi/keeper/grpc_query_did.go | 27 +- x/ssi/keeper/grpc_query_schema.go | 28 +- x/ssi/keeper/msg_server.go | 48 +- x/ssi/keeper/msg_server_create_credential.go | 91 + x/ssi/keeper/msg_server_create_did.go | 30 +- x/ssi/keeper/msg_server_credential.go | 291 --- x/ssi/keeper/msg_server_deactivate_did.go | 17 +- x/ssi/keeper/msg_server_schema.go | 101 +- x/ssi/keeper/msg_server_update_credential.go | 100 + x/ssi/keeper/msg_server_update_did.go | 17 +- .../{schema.go => store_credential_schema.go} | 22 +- ...edential.go => store_credential_status.go} | 43 +- .../keeper/{did.go => store_did_document.go} | 7 +- x/ssi/ld-context/context.go | 24 +- x/ssi/ld-context/normalize.go | 2 +- x/ssi/ld-context/suite.go | 9 +- x/ssi/ld-context/types.go | 2 +- x/ssi/module.go | 1 - x/ssi/tests/README.md | 19 - x/ssi/tests/common.go | 301 --- x/ssi/tests/constants.go | 5 - x/ssi/tests/query_credential_test.go | 158 -- x/ssi/tests/query_did_test.go | 107 - x/ssi/tests/query_schema_test.go | 152 -- x/ssi/tests/setup.go | 55 - x/ssi/tests/tx_create_did_test.go | 184 -- x/ssi/tests/tx_create_schema_test.go | 59 - x/ssi/tests/tx_deactivate_did_test.go | 64 - .../tx_register_credential_status_test.go | 169 -- x/ssi/tests/tx_update_did_test.go | 74 - x/ssi/tests/types.go | 50 - x/ssi/tests/utils.go | 38 - .../verification_method_rotation_test.go | 54 - x/ssi/types/chain_namespace_validation.go | 2 +- x/ssi/types/clientSpec.pb.go | 368 --- x/ssi/types/client_spec.pb.go | 76 + x/ssi/types/codec.go | 25 +- x/ssi/types/common.go | 3 + x/ssi/types/credential.pb.go | 1684 ------------- x/ssi/types/credential_schema.pb.go | 1304 ++++++++++ x/ssi/types/credential_status.pb.go | 851 +++++++ x/ssi/types/did.pb.go | 507 +--- x/ssi/types/diddoc_validation.go | 4 +- x/ssi/types/errors.go | 33 +- x/ssi/types/genesis.pb.go | 27 +- x/ssi/types/message_credential.go | 56 +- x/ssi/types/message_did.go | 75 +- x/ssi/types/message_schema.go | 72 +- x/ssi/types/metadata.go | 19 - x/ssi/types/proof.pb.go | 562 +++++ x/ssi/types/proof_validation.go | 54 + x/ssi/types/query.pb.go | 857 ++++--- x/ssi/types/query.pb.gw.go | 178 +- x/ssi/types/schema.pb.go | 1986 --------------- x/ssi/types/ssi_types.go | 26 +- x/ssi/types/tx.pb.go | 2151 +++++++++++------ x/ssi/types/utils.go | 10 - x/ssi/utils/utils.go | 11 + x/ssi/verification/client_spec.go | 78 +- x/ssi/verification/credential_verification.go | 84 - x/ssi/verification/crypto.go | 38 +- x/ssi/verification/signature_verification.go | 4 +- x/ssi/verification/vars.go | 16 - 94 files changed, 6773 insertions(+), 8892 deletions(-) delete mode 100644 proto/ssi/v1/clientSpec.proto create mode 100644 proto/ssi/v1/client_spec.proto delete mode 100644 proto/ssi/v1/credential.proto create mode 100644 proto/ssi/v1/credential_schema.proto create mode 100644 proto/ssi/v1/credential_status.proto create mode 100644 proto/ssi/v1/proof.proto delete mode 100644 proto/ssi/v1/schema.proto create mode 100755 scripts/protocgen-ts.sh delete mode 100644 x/ssi/abci.go create mode 100644 x/ssi/keeper/msg_server_create_credential.go delete mode 100644 x/ssi/keeper/msg_server_credential.go create mode 100644 x/ssi/keeper/msg_server_update_credential.go rename x/ssi/keeper/{schema.go => store_credential_schema.go} (71%) rename x/ssi/keeper/{credential.go => store_credential_status.go} (56%) rename x/ssi/keeper/{did.go => store_did_document.go} (98%) delete mode 100644 x/ssi/tests/README.md delete mode 100644 x/ssi/tests/common.go delete mode 100644 x/ssi/tests/constants.go delete mode 100644 x/ssi/tests/query_credential_test.go delete mode 100644 x/ssi/tests/query_did_test.go delete mode 100644 x/ssi/tests/query_schema_test.go delete mode 100644 x/ssi/tests/setup.go delete mode 100644 x/ssi/tests/tx_create_did_test.go delete mode 100644 x/ssi/tests/tx_create_schema_test.go delete mode 100644 x/ssi/tests/tx_deactivate_did_test.go delete mode 100644 x/ssi/tests/tx_register_credential_status_test.go delete mode 100644 x/ssi/tests/tx_update_did_test.go delete mode 100644 x/ssi/tests/types.go delete mode 100644 x/ssi/tests/utils.go delete mode 100644 x/ssi/tests/verification_method_rotation_test.go delete mode 100644 x/ssi/types/clientSpec.pb.go create mode 100644 x/ssi/types/client_spec.pb.go delete mode 100644 x/ssi/types/credential.pb.go create mode 100644 x/ssi/types/credential_schema.pb.go create mode 100644 x/ssi/types/credential_status.pb.go delete mode 100644 x/ssi/types/metadata.go create mode 100644 x/ssi/types/proof.pb.go create mode 100644 x/ssi/types/proof_validation.go delete mode 100644 x/ssi/types/schema.pb.go create mode 100644 x/ssi/utils/utils.go delete mode 100644 x/ssi/verification/credential_verification.go diff --git a/.gitignore b/.gitignore index 251b993..ee66472 100644 --- a/.gitignore +++ b/.gitignore @@ -31,3 +31,6 @@ dist/ .cache/ __pycache__ artifacts +node_modules +package-lock.json +generated-ts diff --git a/Makefile b/Makefile index 92790d2..f32e4ca 100644 --- a/Makefile +++ b/Makefile @@ -29,7 +29,7 @@ export GO111MODULE=on ############################################################################### .PHONY: build install -all: proto-gen swagger-docs-gen build +all: proto-gen-go proto-gen-swagger build go-version-check: ifneq ($(GO_MINOR_VERSION),19) @@ -51,18 +51,17 @@ build: go-version-check ### Proto ### ############################################################################### -proto-gen: +proto-gen-go: @echo "Generating golang code from protobuf" ./scripts/protocgen.sh -############################################################################### -### Docs ### -############################################################################### - -swagger-docs-gen: +proto-gen-swagger: @echo "Generating swagger docs" ./scripts/protoc-swagger-gen.sh +proto-gen-ts: + @echo "Generating typescript code from protobuf" + ./scripts/protocgen-ts.sh ############################################################################### ### Docker ### diff --git a/client/docs/config.json b/client/docs/config.json index 6f9b03d..67566e7 100644 --- a/client/docs/config.json +++ b/client/docs/config.json @@ -1,20 +1,23 @@ { - "swagger": "2.0", - "info": { - "title": "Hypersign Identity Network - gRPC Gateway docs", - "description": "A REST interface for gRPC queries", - "version": "1.0.0" + "swagger": "2.0", + "info": { + "title": "Hypersign Identity Network - REST API docs", + "description": "A REST interface for gRPC queries", + "version": "1.0.0" + }, + "externalDocs": { + "description": "Hypersign Identity Network Documentation", + "url": "https://docs.hypersign.id" + }, + "apis": [ + { + "url": "./.cache/tmp/swagger-gen/ssi/v1/query.swagger.json" }, - "apis": [ - { - "url": "./.cache/tmp/swagger-gen/ssi/v1/query.swagger.json" - }, - { - "url": "https://github.com/cosmos/cosmos-sdk/raw/v0.45.7/client/docs/swagger-ui/swagger.yaml", - "dereference": { - "circular": "ignore" - } + { + "url": "https://raw.githubusercontent.com/cosmos/cosmos-sdk/v0.45.11/client/docs/swagger-ui/swagger.yaml", + "dereference": { + "circular": "ignore" } - ] - } - \ No newline at end of file + } + ] +} diff --git a/client/docs/swagger-ui/swagger.yaml b/client/docs/swagger-ui/swagger.yaml index 1fe7318..4a60502 100644 --- a/client/docs/swagger-ui/swagger.yaml +++ b/client/docs/swagger-ui/swagger.yaml @@ -1,59 +1,67 @@ swagger: '2.0' info: - title: Hypersign Identity Network - gRPC Gateway docs + title: Hypersign Identity Network - REST API docs description: A REST interface for gRPC queries version: 1.0.0 +externalDocs: + description: Hypersign Identity Network Documentation + url: https://docs.hypersign.id paths: /hypersign-protocol/hidnode/ssi/credential: get: summary: Get all the registed Credential Statuses - operationId: QueryCredentials + operationId: CredentialStatuses responses: '200': description: A successful response. schema: type: object properties: - totalCount: + count: type: string format: uint64 - credentials: + credentialStatuses: type: array items: type: object properties: - claim: + credentialStatusDocument: type: object properties: id: type: string - currentStatus: + revoked: + type: boolean + suspended: + type: boolean + remarks: type: string - statusReason: + issuer: type: string - issuer: - type: string - issuanceDate: - type: string - expirationDate: - type: string - credentialHash: - type: string - proof: + issuanceDate: + type: string + merkleRootHash: + type: string + credentialStatusProof: type: object properties: type: type: string created: type: string - updated: - type: string verificationMethod: type: string proofPurpose: type: string proofValue: type: string + clientSpecType: + type: string + enum: + - CLIENT_SPEC_TYPE_NONE + - CLIENT_SPEC_TYPE_COSMOS_ADR036 + - CLIENT_SPEC_TYPE_ETH_PERSONAL_SIGN + default: CLIENT_SPEC_TYPE_NONE default: description: An unexpected error response. schema: @@ -138,48 +146,53 @@ paths: /hypersign-protocol/hidnode/ssi/credential/{credId}: get: summary: Get the Credential Status for a given credential id - operationId: QueryCredential + operationId: CredentialStatusByID responses: '200': description: A successful response. schema: type: object properties: - credStatus: + credentialStatus: type: object properties: - claim: + credentialStatusDocument: type: object properties: id: type: string - currentStatus: + revoked: + type: boolean + suspended: + type: boolean + remarks: type: string - statusReason: + issuer: type: string - issuer: - type: string - issuanceDate: - type: string - expirationDate: - type: string - credentialHash: - type: string - proof: + issuanceDate: + type: string + merkleRootHash: + type: string + credentialStatusProof: type: object properties: type: type: string created: type: string - updated: - type: string verificationMethod: type: string proofPurpose: type: string proofValue: type: string + clientSpecType: + type: string + enum: + - CLIENT_SPEC_TYPE_NONE + - CLIENT_SPEC_TYPE_COSMOS_ADR036 + - CLIENT_SPEC_TYPE_ETH_PERSONAL_SIGN + default: CLIENT_SPEC_TYPE_NONE default: description: An unexpected error response. schema: @@ -212,17 +225,17 @@ paths: /hypersign-protocol/hidnode/ssi/did: get: summary: Get the count and list of registered Did Documents - operationId: QueryDidDocuments + operationId: DidDocuments responses: '200': description: A successful response. schema: type: object properties: - totalDidCount: + count: type: string format: uint64 - didDocList: + didDocuments: type: array items: type: object @@ -257,6 +270,8 @@ paths: type: string publicKeyMultibase: type: string + blockchainAccountId: + type: string authentication: type: array items: @@ -322,10 +337,6 @@ paths: type: string format: byte parameters: - - name: count - in: query - required: false - type: boolean - name: pagination.key description: |- key is a value returned in PageResponse.next_key to begin @@ -387,7 +398,7 @@ paths: /hypersign-protocol/hidnode/ssi/did/{didId}: get: summary: Get the Did Document for a specified DID id - operationId: QueryDidDocument + operationId: DidDocumentByID responses: '200': description: A successful response. @@ -424,6 +435,8 @@ paths: type: string publicKeyMultibase: type: string + blockchainAccountId: + type: string authentication: type: array items: @@ -498,51 +511,54 @@ paths: /hypersign-protocol/hidnode/ssi/schema: get: summary: Get the count and list of registered Schemas - operationId: QuerySchemas + operationId: CredentialSchemas responses: '200': description: A successful response. schema: type: object properties: - totalCount: + count: type: string format: uint64 - schemaList: + credentialSchemas: type: array items: type: object properties: - type: - type: string - modelVersion: - type: string - id: - type: string - name: - type: string - author: - type: string - authored: - type: string - schema: + credentialSchemaDocument: type: object properties: - schema: + type: type: string - description: + modelVersion: type: string - type: + id: type: string - properties: + name: type: string - required: - type: array - items: - type: string - additionalProperties: - type: boolean - proof: + author: + type: string + authored: + type: string + schema: + type: object + properties: + schema: + type: string + description: + type: string + type: + type: string + properties: + type: string + required: + type: array + items: + type: string + additionalProperties: + type: boolean + credentialSchemaProof: type: object properties: type: @@ -555,6 +571,13 @@ paths: type: string proofValue: type: string + clientSpecType: + type: string + enum: + - CLIENT_SPEC_TYPE_NONE + - CLIENT_SPEC_TYPE_COSMOS_ADR036 + - CLIENT_SPEC_TYPE_ETH_PERSONAL_SIGN + default: CLIENT_SPEC_TYPE_NONE default: description: An unexpected error response. schema: @@ -639,48 +662,51 @@ paths: /hypersign-protocol/hidnode/ssi/schema/{schemaId}: get: summary: Get the Schema Document for a specified schema id - operationId: QuerySchema + operationId: CredentialSchemaByID responses: '200': description: A successful response. schema: type: object properties: - schema: + credentialSchemas: type: array items: type: object properties: - type: - type: string - modelVersion: - type: string - id: - type: string - name: - type: string - author: - type: string - authored: - type: string - schema: + credentialSchemaDocument: type: object properties: - schema: + type: type: string - description: + modelVersion: type: string - type: + id: type: string - properties: + name: type: string - required: - type: array - items: - type: string - additionalProperties: - type: boolean - proof: + author: + type: string + authored: + type: string + schema: + type: object + properties: + schema: + type: string + description: + type: string + type: + type: string + properties: + type: string + required: + type: array + items: + type: string + additionalProperties: + type: boolean + credentialSchemaProof: type: object properties: type: @@ -693,6 +719,13 @@ paths: type: string proofValue: type: string + clientSpecType: + type: string + enum: + - CLIENT_SPEC_TYPE_NONE + - CLIENT_SPEC_TYPE_COSMOS_ADR036 + - CLIENT_SPEC_TYPE_ETH_PERSONAL_SIGN + default: CLIENT_SPEC_TYPE_NONE default: description: An unexpected error response. schema: @@ -727,7 +760,7 @@ paths: description: Information about the connected node summary: The properties of the connected node tags: - - Service + - Gaia REST produces: - application/json responses: @@ -24519,43 +24552,103 @@ definitions: "@type": "type.googleapis.com/google.protobuf.Duration", "value": "1.212s" } - hypersignprotocol.hidnode.ssi.Claim: + hypersign.ssi.v1.ClientSpecType: + type: string + enum: + - CLIENT_SPEC_TYPE_NONE + - CLIENT_SPEC_TYPE_COSMOS_ADR036 + - CLIENT_SPEC_TYPE_ETH_PERSONAL_SIGN + default: CLIENT_SPEC_TYPE_NONE + hypersign.ssi.v1.CredentialSchemaDocument: type: object properties: + type: + type: string + modelVersion: + type: string id: type: string - currentStatus: + name: type: string - statusReason: + author: type: string - hypersignprotocol.hidnode.ssi.Credential: - type: object - properties: - claim: + authored: + type: string + schema: type: object properties: - id: + schema: type: string - currentStatus: + description: type: string - statusReason: + type: type: string - issuer: + properties: + type: string + required: + type: array + items: + type: string + additionalProperties: + type: boolean + hypersign.ssi.v1.CredentialSchemaProperty: + type: object + properties: + schema: type: string - issuanceDate: + description: type: string - expirationDate: + type: type: string - credentialHash: + properties: type: string - proof: + required: + type: array + items: + type: string + additionalProperties: + type: boolean + hypersign.ssi.v1.CredentialSchemaState: + type: object + properties: + credentialSchemaDocument: type: object properties: type: type: string - created: + modelVersion: type: string - updated: + id: + type: string + name: + type: string + author: + type: string + authored: + type: string + schema: + type: object + properties: + schema: + type: string + description: + type: string + type: + type: string + properties: + type: string + required: + type: array + items: + type: string + additionalProperties: + type: boolean + credentialSchemaProof: + type: object + properties: + type: + type: string + created: type: string verificationMethod: type: string @@ -24563,22 +24656,71 @@ definitions: type: string proofValue: type: string - hypersignprotocol.hidnode.ssi.CredentialProof: + clientSpecType: + type: string + enum: + - CLIENT_SPEC_TYPE_NONE + - CLIENT_SPEC_TYPE_COSMOS_ADR036 + - CLIENT_SPEC_TYPE_ETH_PERSONAL_SIGN + default: CLIENT_SPEC_TYPE_NONE + hypersign.ssi.v1.CredentialStatusDocument: type: object properties: - type: - type: string - created: + id: type: string - updated: + revoked: + type: boolean + suspended: + type: boolean + remarks: type: string - verificationMethod: + issuer: type: string - proofPurpose: + issuanceDate: type: string - proofValue: + merkleRootHash: type: string - hypersignprotocol.hidnode.ssi.Did: + hypersign.ssi.v1.CredentialStatusState: + type: object + properties: + credentialStatusDocument: + type: object + properties: + id: + type: string + revoked: + type: boolean + suspended: + type: boolean + remarks: + type: string + issuer: + type: string + issuanceDate: + type: string + merkleRootHash: + type: string + credentialStatusProof: + type: object + properties: + type: + type: string + created: + type: string + verificationMethod: + type: string + proofPurpose: + type: string + proofValue: + type: string + clientSpecType: + type: string + enum: + - CLIENT_SPEC_TYPE_NONE + - CLIENT_SPEC_TYPE_COSMOS_ADR036 + - CLIENT_SPEC_TYPE_ETH_PERSONAL_SIGN + default: CLIENT_SPEC_TYPE_NONE + hypersign.ssi.v1.DidDocument: type: object properties: context: @@ -24608,6 +24750,8 @@ definitions: type: string publicKeyMultibase: type: string + blockchainAccountId: + type: string authentication: type: array items: @@ -24639,7 +24783,7 @@ definitions: type: string serviceEndpoint: type: string - hypersignprotocol.hidnode.ssi.Metadata: + hypersign.ssi.v1.DidDocumentMetadata: type: object properties: created: @@ -24650,80 +24794,303 @@ definitions: type: boolean versionId: type: string - hypersignprotocol.hidnode.ssi.QueryCredentialResponse: + hypersign.ssi.v1.DidDocumentState: type: object properties: - credStatus: + didDocument: type: object properties: - claim: - type: object - properties: - id: - type: string - currentStatus: - type: string - statusReason: - type: string - issuer: - type: string - issuanceDate: - type: string - expirationDate: - type: string - credentialHash: + context: + type: array + items: + type: string + id: type: string - proof: - type: object - properties: - type: - type: string - created: - type: string - updated: - type: string - verificationMethod: - type: string - proofPurpose: - type: string - proofValue: - type: string - hypersignprotocol.hidnode.ssi.QueryCredentialsResponse: - type: object - properties: - totalCount: - type: string - format: uint64 - credentials: - type: array - items: - type: object - properties: - claim: - type: object - properties: - id: - type: string - currentStatus: + controller: + type: array + items: + type: string + alsoKnownAs: + type: array + items: + type: string + verificationMethod: + type: array + items: + type: object + properties: + id: + type: string + type: + type: string + controller: type: string - statusReason: + publicKeyMultibase: + type: string + blockchainAccountId: type: string - issuer: + authentication: + type: array + items: type: string - issuanceDate: + assertionMethod: + type: array + items: + type: string + keyAgreement: + type: array + items: type: string - expirationDate: + capabilityInvocation: + type: array + items: type: string - credentialHash: + capabilityDelegation: + type: array + items: type: string - proof: + service: + type: array + items: + type: object + properties: + id: + type: string + type: + type: string + serviceEndpoint: + type: string + didDocumentMetadata: + type: object + properties: + created: + type: string + updated: + type: string + deactivated: + type: boolean + versionId: + type: string + hypersign.ssi.v1.DocumentProof: + type: object + properties: + type: + type: string + created: + type: string + verificationMethod: + type: string + proofPurpose: + type: string + proofValue: + type: string + clientSpecType: + type: string + enum: + - CLIENT_SPEC_TYPE_NONE + - CLIENT_SPEC_TYPE_COSMOS_ADR036 + - CLIENT_SPEC_TYPE_ETH_PERSONAL_SIGN + default: CLIENT_SPEC_TYPE_NONE + hypersign.ssi.v1.QueryCredentialSchemaResponse: + type: object + properties: + credentialSchemas: + type: array + items: + type: object + properties: + credentialSchemaDocument: + type: object + properties: + type: + type: string + modelVersion: + type: string + id: + type: string + name: + type: string + author: + type: string + authored: + type: string + schema: + type: object + properties: + schema: + type: string + description: + type: string + type: + type: string + properties: + type: string + required: + type: array + items: + type: string + additionalProperties: + type: boolean + credentialSchemaProof: type: object properties: type: type: string created: type: string - updated: + verificationMethod: + type: string + proofPurpose: + type: string + proofValue: + type: string + clientSpecType: + type: string + enum: + - CLIENT_SPEC_TYPE_NONE + - CLIENT_SPEC_TYPE_COSMOS_ADR036 + - CLIENT_SPEC_TYPE_ETH_PERSONAL_SIGN + default: CLIENT_SPEC_TYPE_NONE + hypersign.ssi.v1.QueryCredentialSchemasResponse: + type: object + properties: + count: + type: string + format: uint64 + credentialSchemas: + type: array + items: + type: object + properties: + credentialSchemaDocument: + type: object + properties: + type: + type: string + modelVersion: + type: string + id: + type: string + name: + type: string + author: + type: string + authored: + type: string + schema: + type: object + properties: + schema: + type: string + description: + type: string + type: + type: string + properties: + type: string + required: + type: array + items: + type: string + additionalProperties: + type: boolean + credentialSchemaProof: + type: object + properties: + type: + type: string + created: + type: string + verificationMethod: + type: string + proofPurpose: + type: string + proofValue: + type: string + clientSpecType: + type: string + enum: + - CLIENT_SPEC_TYPE_NONE + - CLIENT_SPEC_TYPE_COSMOS_ADR036 + - CLIENT_SPEC_TYPE_ETH_PERSONAL_SIGN + default: CLIENT_SPEC_TYPE_NONE + hypersign.ssi.v1.QueryCredentialStatusResponse: + type: object + properties: + credentialStatus: + type: object + properties: + credentialStatusDocument: + type: object + properties: + id: + type: string + revoked: + type: boolean + suspended: + type: boolean + remarks: + type: string + issuer: + type: string + issuanceDate: + type: string + merkleRootHash: + type: string + credentialStatusProof: + type: object + properties: + type: + type: string + created: + type: string + verificationMethod: + type: string + proofPurpose: + type: string + proofValue: + type: string + clientSpecType: + type: string + enum: + - CLIENT_SPEC_TYPE_NONE + - CLIENT_SPEC_TYPE_COSMOS_ADR036 + - CLIENT_SPEC_TYPE_ETH_PERSONAL_SIGN + default: CLIENT_SPEC_TYPE_NONE + hypersign.ssi.v1.QueryCredentialStatusesResponse: + type: object + properties: + count: + type: string + format: uint64 + credentialStatuses: + type: array + items: + type: object + properties: + credentialStatusDocument: + type: object + properties: + id: + type: string + revoked: + type: boolean + suspended: + type: boolean + remarks: + type: string + issuer: + type: string + issuanceDate: + type: string + merkleRootHash: + type: string + credentialStatusProof: + type: object + properties: + type: + type: string + created: type: string verificationMethod: type: string @@ -24731,7 +25098,14 @@ definitions: type: string proofValue: type: string - hypersignprotocol.hidnode.ssi.QueryDidDocumentResponse: + clientSpecType: + type: string + enum: + - CLIENT_SPEC_TYPE_NONE + - CLIENT_SPEC_TYPE_COSMOS_ADR036 + - CLIENT_SPEC_TYPE_ETH_PERSONAL_SIGN + default: CLIENT_SPEC_TYPE_NONE + hypersign.ssi.v1.QueryDidDocumentResponse: type: object properties: didDocument: @@ -24764,6 +25138,8 @@ definitions: type: string publicKeyMultibase: type: string + blockchainAccountId: + type: string authentication: type: array items: @@ -24806,13 +25182,13 @@ definitions: type: boolean versionId: type: string - hypersignprotocol.hidnode.ssi.QueryDidDocumentsResponse: + hypersign.ssi.v1.QueryDidDocumentsResponse: type: object properties: - totalDidCount: + count: type: string format: uint64 - didDocList: + didDocuments: type: array items: type: object @@ -24847,6 +25223,8 @@ definitions: type: string publicKeyMultibase: type: string + blockchainAccountId: + type: string authentication: type: array items: @@ -24889,185 +25267,7 @@ definitions: type: boolean versionId: type: string - hypersignprotocol.hidnode.ssi.QuerySchemaResponse: - type: object - properties: - schema: - type: array - items: - type: object - properties: - type: - type: string - modelVersion: - type: string - id: - type: string - name: - type: string - author: - type: string - authored: - type: string - schema: - type: object - properties: - schema: - type: string - description: - type: string - type: - type: string - properties: - type: string - required: - type: array - items: - type: string - additionalProperties: - type: boolean - proof: - type: object - properties: - type: - type: string - created: - type: string - verificationMethod: - type: string - proofPurpose: - type: string - proofValue: - type: string - hypersignprotocol.hidnode.ssi.QuerySchemasResponse: - type: object - properties: - totalCount: - type: string - format: uint64 - schemaList: - type: array - items: - type: object - properties: - type: - type: string - modelVersion: - type: string - id: - type: string - name: - type: string - author: - type: string - authored: - type: string - schema: - type: object - properties: - schema: - type: string - description: - type: string - type: - type: string - properties: - type: string - required: - type: array - items: - type: string - additionalProperties: - type: boolean - proof: - type: object - properties: - type: - type: string - created: - type: string - verificationMethod: - type: string - proofPurpose: - type: string - proofValue: - type: string - hypersignprotocol.hidnode.ssi.Schema: - type: object - properties: - type: - type: string - modelVersion: - type: string - id: - type: string - name: - type: string - author: - type: string - authored: - type: string - schema: - type: object - properties: - schema: - type: string - description: - type: string - type: - type: string - properties: - type: string - required: - type: array - items: - type: string - additionalProperties: - type: boolean - proof: - type: object - properties: - type: - type: string - created: - type: string - verificationMethod: - type: string - proofPurpose: - type: string - proofValue: - type: string - hypersignprotocol.hidnode.ssi.SchemaProof: - type: object - properties: - type: - type: string - created: - type: string - verificationMethod: - type: string - proofPurpose: - type: string - proofValue: - type: string - hypersignprotocol.hidnode.ssi.SchemaProperty: - type: object - properties: - schema: - type: string - description: - type: string - type: - type: string - properties: - type: string - required: - type: array - items: - type: string - additionalProperties: - type: boolean - hypersignprotocol.hidnode.ssi.Service: + hypersign.ssi.v1.Service: type: object properties: id: @@ -25076,7 +25276,7 @@ definitions: type: string serviceEndpoint: type: string - hypersignprotocol.hidnode.ssi.VerificationMethod: + hypersign.ssi.v1.VerificationMethod: type: object properties: id: @@ -25087,6 +25287,8 @@ definitions: type: string publicKeyMultibase: type: string + blockchainAccountId: + type: string CheckTxResult: type: object properties: diff --git a/cmd/hid-noded/cmd/debug_extensions.go b/cmd/hid-noded/cmd/debug_extensions.go index 0725598..82c51a9 100644 --- a/cmd/hid-noded/cmd/debug_extensions.go +++ b/cmd/hid-noded/cmd/debug_extensions.go @@ -14,6 +14,7 @@ import ( ethercrypto "github.com/ethereum/go-ethereum/crypto" bbs "github.com/hyperledger/aries-framework-go/component/kmscrypto/crypto/primitive/bbs12381g2pub" hidnodecli "github.com/hypersign-protocol/hid-node/x/ssi/client/cli" + ldcontext "github.com/hypersign-protocol/hid-node/x/ssi/ld-context" "github.com/hypersign-protocol/hid-node/x/ssi/types" "github.com/iden3/go-iden3-crypto/babyjub" "github.com/multiformats/go-multibase" @@ -295,12 +296,94 @@ func signSSIDocCmd() *cobra.Command { } cmd.AddCommand( + signDidDocCmd(), signSchemaDocCmd(), signCredStatusDocCmd(), ) return cmd } +func signDidDocCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: "did-doc [doc] [private-key] [signing-algo]", + Short: "Did Document signature", + Args: cobra.ExactArgs(3), + RunE: func(cmd *cobra.Command, args []string) error { + argDidDoc := args[0] + argPrivateKey := args[1] + argSigningAlgo := args[2] + + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + + // Unmarshal Schema Document + var didDoc types.DidDocument + err = clientCtx.Codec.UnmarshalJSON([]byte(argDidDoc), &didDoc) + if err != nil { + return err + } + + // Sign Schema Document + var signature string + switch argSigningAlgo { + case types.Ed25519Signature2020: + didDocBytes, err := ldcontext.EdDSACryptoSuite2020Canonize(&didDoc) + if err != nil { + return err + } + + signature, err = hidnodecli.GetEd25519Signature2020(argPrivateKey, didDocBytes[:]) + if err != nil { + return err + } + case types.EcdsaSecp256k1Signature2019: + didDocBytes, err := ldcontext.EcdsaSecp256k1Signature2019Canonize(&didDoc) + if err != nil { + return err + } + + signature, err = hidnodecli.GetEcdsaSecp256k1Signature2019(argPrivateKey, didDocBytes[:]) + if err != nil { + return err + } + case types.EcdsaSecp256k1RecoverySignature2020: + didDocBytes, err := ldcontext.EcdsaSecp256k1RecoverySignature2020Canonize(&didDoc) + if err != nil { + return err + } + + signature, err = hidnodecli.GetEcdsaSecp256k1RecoverySignature2020(argPrivateKey, didDocBytes[:]) + if err != nil { + return err + } + case types.BbsBlsSignature2020: + didDocBytes, err := ldcontext.BbsBlsSignature2020Canonize(&didDoc) + if err != nil { + return err + } + + signature, err = hidnodecli.GetBbsBlsSignature2020(argPrivateKey, didDocBytes[:]) + if err != nil { + return err + } + case types.BabyJubJubSignature2023: + signature, err = hidnodecli.GetBabyJubJubSignature2023(argPrivateKey, didDoc.GetSignBytes()) + if err != nil { + return err + } + default: + panic("recieved unsupported signing-algo. Supported algorithms are: [Ed25519Signature2020, EcdsaSecp256k1Signature2019, EcdsaSecp256k1RecoverySignature2020, BbsBlsSignature2020, BabyJubJubSignature2023]") + } + + _, err = fmt.Fprintln(cmd.OutOrStdout(), signature) + return err + }, + } + return cmd +} + func signSchemaDocCmd() *cobra.Command { cmd := &cobra.Command{ Use: "schema-doc [doc] [private-key] [signing-algo]", @@ -317,7 +400,7 @@ func signSchemaDocCmd() *cobra.Command { } // Unmarshal Schema Document - var schemaDoc types.SchemaDocument + var schemaDoc types.CredentialSchemaDocument err = clientCtx.Codec.UnmarshalJSON([]byte(argSchemaDoc), &schemaDoc) if err != nil { return err @@ -347,13 +430,13 @@ func signSchemaDocCmd() *cobra.Command { if err != nil { return err } - case "bjj": - signature, err = hidnodecli.GetBJJSignature(argPrivateKey, schemaDocBytes) + case types.BabyJubJubSignature2023: + signature, err = hidnodecli.GetBabyJubJubSignature2023(argPrivateKey, schemaDocBytes) if err != nil { return err } default: - panic("recieved unsupported signing-algo. Supported algorithms are: [Ed25519Signature2020, EcdsaSecp256k1Signature2019, EcdsaSecp256k1RecoverySignature2020, BbsBlsSignature2020, 'bjj']") + panic("recieved unsupported signing-algo. Supported algorithms are: [Ed25519Signature2020, EcdsaSecp256k1Signature2019, EcdsaSecp256k1RecoverySignature2020, BbsBlsSignature2020, BabyJubJubSignature2023]") } _, err = fmt.Fprintln(cmd.OutOrStdout(), signature) @@ -379,7 +462,7 @@ func signCredStatusDocCmd() *cobra.Command { } // Unmarshal Credential Status Document - var credStatusDoc types.CredentialStatus + var credStatusDoc types.CredentialStatusDocument err = clientCtx.Codec.UnmarshalJSON([]byte(argCredStatusDoc), &credStatusDoc) if err != nil { return err @@ -409,13 +492,13 @@ func signCredStatusDocCmd() *cobra.Command { if err != nil { return err } - case "bjj": - signature, err = hidnodecli.GetBJJSignature(argPrivateKey, credStatusDocBytes) + case types.BabyJubJubSignature2023: + signature, err = hidnodecli.GetBabyJubJubSignature2023(argPrivateKey, credStatusDocBytes) if err != nil { return err } default: - panic("recieved unsupported signing-algo. Supported algorithms are: [Ed25519Signature2020, EcdsaSecp256k1Signature2019, EcdsaSecp256k1RecoverySignature2020, BbsBlsSignature2020, 'bjj']") + panic("recieved unsupported signing-algo. Supported algorithms are: [Ed25519Signature2020, EcdsaSecp256k1Signature2019, EcdsaSecp256k1RecoverySignature2020, BbsBlsSignature2020, BabyJubJubSignature2023]") } _, err = fmt.Fprintln(cmd.OutOrStdout(), signature) diff --git a/cmd/hid-noded/cmd/generate_ssi.go b/cmd/hid-noded/cmd/generate_ssi.go index 102808b..39c8c3f 100644 --- a/cmd/hid-noded/cmd/generate_ssi.go +++ b/cmd/hid-noded/cmd/generate_ssi.go @@ -73,7 +73,7 @@ func listAllDidAliasesCmd() *cobra.Command { return err } - var didDoc types.Did + var didDoc types.DidDocument err = clientCtx.Codec.UnmarshalJSON(didDocBytes, &didDoc) if err != nil { // Ignore any files which are not able to parse into type.Did diff --git a/cmd/hid-noded/cmd/generate_ssi_utils.go b/cmd/hid-noded/cmd/generate_ssi_utils.go index e07d44b..d074ea9 100644 --- a/cmd/hid-noded/cmd/generate_ssi_utils.go +++ b/cmd/hid-noded/cmd/generate_ssi_utils.go @@ -1,6 +1,7 @@ package cmd import ( + ldcontext "github.com/hypersign-protocol/hid-node/x/ssi/ld-context" "github.com/hypersign-protocol/hid-node/x/ssi/types" ) @@ -12,10 +13,14 @@ func formDidId(didNamespace string, publicKeyMultibase string) string { } } -func generateDidDoc(didNamespace string, publicKeyMultibase string, userAddress string) *types.Did { +func generateDidDoc(didNamespace string, publicKeyMultibase string, userAddress string) *types.DidDocument { didId := formDidId(didNamespace, publicKeyMultibase) - return &types.Did{ + return &types.DidDocument{ + Context: []string{ + ldcontext.DidContext, + ldcontext.Secp256k12019Context, + }, Id: didId, Controller: []string{didId}, VerificationMethod: []*types.VerificationMethod{ diff --git a/proto/ssi/v1/clientSpec.proto b/proto/ssi/v1/clientSpec.proto deleted file mode 100644 index b1e4a27..0000000 --- a/proto/ssi/v1/clientSpec.proto +++ /dev/null @@ -1,9 +0,0 @@ -syntax = "proto3"; -package hypersignprotocol.hidnode.ssi; - -option go_package = "github.com/hypersign-protocol/hid-node/x/ssi/types"; - -message ClientSpec { - string type = 1; - string adr036SignerAddress = 2; -} \ No newline at end of file diff --git a/proto/ssi/v1/client_spec.proto b/proto/ssi/v1/client_spec.proto new file mode 100644 index 0000000..14db8ad --- /dev/null +++ b/proto/ssi/v1/client_spec.proto @@ -0,0 +1,14 @@ +syntax = "proto3"; +package hypersign.ssi.v1; + +import "gogoproto/gogo.proto"; + +option go_package = "github.com/hypersign-protocol/hid-node/x/ssi/types"; + +enum ClientSpecType { + option (gogoproto.goproto_enum_prefix) = false; + + CLIENT_SPEC_TYPE_NONE = 0; + CLIENT_SPEC_TYPE_COSMOS_ADR036 = 1; + CLIENT_SPEC_TYPE_ETH_PERSONAL_SIGN = 2; +} diff --git a/proto/ssi/v1/credential.proto b/proto/ssi/v1/credential.proto deleted file mode 100644 index 22da27d..0000000 --- a/proto/ssi/v1/credential.proto +++ /dev/null @@ -1,35 +0,0 @@ -syntax = "proto3"; -package hypersignprotocol.hidnode.ssi; -option go_package = "github.com/hypersign-protocol/hid-node/x/ssi/types"; - -message Claim { - string id = 1; - string currentStatus = 2; - string statusReason = 3; -} - -message CredentialStatus { - Claim claim = 1; - string issuer = 2; - string issuanceDate = 3; - string expirationDate = 4; - string credentialHash = 5; -} - -message CredentialProof { - string type = 1; - string created = 2; - string updated = 3; - string verificationMethod = 4; - string proofPurpose = 5; - string proofValue = 6; -} - -message Credential { - Claim claim = 1; - string issuer = 2; - string issuanceDate = 3; - string expirationDate = 4; - string credentialHash = 5; - CredentialProof proof = 6; -} \ No newline at end of file diff --git a/proto/ssi/v1/credential_schema.proto b/proto/ssi/v1/credential_schema.proto new file mode 100644 index 0000000..a8fa062 --- /dev/null +++ b/proto/ssi/v1/credential_schema.proto @@ -0,0 +1,30 @@ +syntax = "proto3"; +package hypersign.ssi.v1; + +import "ssi/v1/proof.proto"; + +option go_package = "github.com/hypersign-protocol/hid-node/x/ssi/types"; + +message CredentialSchemaDocument { + string type = 1; + string modelVersion = 2; + string id = 3; + string name = 4; + string author = 5; + string authored = 6; + CredentialSchemaProperty schema = 7; +} + +message CredentialSchemaProperty { + string schema = 1; + string description = 2; + string type = 3; + string properties = 4; + repeated string required = 5; + bool additionalProperties = 6; +} + +message CredentialSchemaState { + CredentialSchemaDocument credentialSchemaDocument = 1; + DocumentProof credentialSchemaProof = 2; +} diff --git a/proto/ssi/v1/credential_status.proto b/proto/ssi/v1/credential_status.proto new file mode 100644 index 0000000..40b4ee8 --- /dev/null +++ b/proto/ssi/v1/credential_status.proto @@ -0,0 +1,21 @@ +syntax = "proto3"; +package hypersign.ssi.v1; + +import "ssi/v1/proof.proto"; + +option go_package = "github.com/hypersign-protocol/hid-node/x/ssi/types"; + +message CredentialStatusDocument { + string id = 1; + bool revoked = 2; + bool suspended = 3; + string remarks = 4; + string issuer = 5; + string issuanceDate = 6; + string merkleRootHash = 7; +} + +message CredentialStatusState { + CredentialStatusDocument credentialStatusDocument = 1; + DocumentProof credentialStatusProof = 2; +} diff --git a/proto/ssi/v1/did.proto b/proto/ssi/v1/did.proto index bd632c6..c46c3e2 100644 --- a/proto/ssi/v1/did.proto +++ b/proto/ssi/v1/did.proto @@ -1,13 +1,12 @@ syntax = "proto3"; -package hypersignprotocol.hidnode.ssi; +package hypersign.ssi.v1; option go_package = "github.com/hypersign-protocol/hid-node/x/ssi/types"; -import "ssi/v1/clientSpec.proto"; import "gogoproto/gogo.proto"; -message Did { - repeated string context = 1 [(gogoproto.jsontag) = "@context"]; +message DidDocument { + repeated string context = 1 [json_name = "@context", (gogoproto.jsontag) = "@context"]; string id = 2; repeated string controller = 3; repeated string alsoKnownAs = 4; @@ -20,7 +19,7 @@ message Did { repeated Service service = 11; } -message Metadata { +message DidDocumentMetadata { string created = 1; string updated = 2; bool deactivated = 3; @@ -41,13 +40,7 @@ message Service { string serviceEndpoint = 3; } -message SignInfo { - string verification_method_id = 1; - string signature = 2; - ClientSpec clientSpec = 3; -} - message DidDocumentState { - Did didDocument = 1; - Metadata didDocumentMetadata = 2; -} \ No newline at end of file + DidDocument didDocument = 1; + DidDocumentMetadata didDocumentMetadata = 2; +} diff --git a/proto/ssi/v1/genesis.proto b/proto/ssi/v1/genesis.proto index 06a73ae..6c598f7 100644 --- a/proto/ssi/v1/genesis.proto +++ b/proto/ssi/v1/genesis.proto @@ -1,11 +1,9 @@ syntax = "proto3"; -package hypersignprotocol.hidnode.ssi; - -import "gogoproto/gogo.proto"; +package hypersign.ssi.v1; option go_package = "github.com/hypersign-protocol/hid-node/x/ssi/types"; // GenesisState defines the ssi module's genesis state. message GenesisState { - string chain_namespace = 1; + string chainNamespace = 1; } diff --git a/proto/ssi/v1/proof.proto b/proto/ssi/v1/proof.proto new file mode 100644 index 0000000..a74b177 --- /dev/null +++ b/proto/ssi/v1/proof.proto @@ -0,0 +1,15 @@ +syntax = "proto3"; +package hypersign.ssi.v1; + +option go_package = "github.com/hypersign-protocol/hid-node/x/ssi/types"; + +import "ssi/v1/client_spec.proto"; + +message DocumentProof { + string type = 1; + string created = 2; + string verificationMethod = 3; + string proofPurpose = 4; + string proofValue = 5; + ClientSpecType clientSpecType = 6; +} diff --git a/proto/ssi/v1/query.proto b/proto/ssi/v1/query.proto index d66ed6a..2698b06 100644 --- a/proto/ssi/v1/query.proto +++ b/proto/ssi/v1/query.proto @@ -1,84 +1,83 @@ syntax = "proto3"; -package hypersignprotocol.hidnode.ssi; +package hypersign.ssi.v1; -import "gogoproto/gogo.proto"; import "google/api/annotations.proto"; import "cosmos/base/query/v1beta1/pagination.proto"; -import "ssi/v1/schema.proto"; +import "ssi/v1/credential_schema.proto"; import "ssi/v1/did.proto"; -import "ssi/v1/credential.proto"; +import "ssi/v1/credential_status.proto"; option go_package = "github.com/hypersign-protocol/hid-node/x/ssi/types"; // Query defines the gRPC querier service. service Query { // Get the Schema Document for a specified schema id - rpc QuerySchema(QuerySchemaRequest) returns (QuerySchemaResponse) { + rpc CredentialSchemaByID(QueryCredentialSchemaRequest) returns (QueryCredentialSchemaResponse) { option (google.api.http).get = "/hypersign-protocol/hidnode/ssi/schema/{schemaId}"; } // Get the count and list of registered Schemas - rpc QuerySchemas(QuerySchemasRequest) returns (QuerySchemasResponse) { + rpc CredentialSchemas(QueryCredentialSchemasRequest) returns (QueryCredentialSchemasResponse) { option (google.api.http).get = "/hypersign-protocol/hidnode/ssi/schema"; } // Get the Did Document for a specified DID id - rpc QueryDidDocument(QueryDidDocumentRequest) returns (QueryDidDocumentResponse) { + rpc DidDocumentByID(QueryDidDocumentRequest) returns (QueryDidDocumentResponse) { option (google.api.http).get = "/hypersign-protocol/hidnode/ssi/did/{didId}"; } // Get the count and list of registered Did Documents - rpc QueryDidDocuments(QueryDidDocumentsRequest) returns (QueryDidDocumentsResponse) { + rpc DidDocuments(QueryDidDocumentsRequest) returns (QueryDidDocumentsResponse) { option (google.api.http).get = "/hypersign-protocol/hidnode/ssi/did"; } // Get the Credential Status for a given credential id - rpc QueryCredential(QueryCredentialRequest) returns (QueryCredentialResponse) { + rpc CredentialStatusByID(QueryCredentialStatusRequest) returns (QueryCredentialStatusResponse) { option (google.api.http).get = "/hypersign-protocol/hidnode/ssi/credential/{credId}"; } // Get all the registed Credential Statuses - rpc QueryCredentials(QueryCredentialsRequest) returns (QueryCredentialsResponse) { + rpc CredentialStatuses(QueryCredentialStatusesRequest) returns (QueryCredentialStatusesResponse) { option (google.api.http).get = "/hypersign-protocol/hidnode/ssi/credential"; } } -// Schema Messages +// Credential Schema Messages -message QuerySchemaRequest { +message QueryCredentialSchemaRequest { string schemaId = 1; } -message QuerySchemaResponse { - repeated Schema schema = 1; +message QueryCredentialSchemaResponse { + repeated CredentialSchemaState credentialSchemas = 1; } -message QuerySchemasRequest { +message QueryCredentialSchemasRequest { cosmos.base.query.v1beta1.PageRequest pagination = 1; } -message QuerySchemasResponse { - uint64 totalCount = 1; - repeated Schema schemaList = 2; +message QueryCredentialSchemasResponse { + uint64 count = 1; + repeated CredentialSchemaState credentialSchemas = 2; } -// Credential Messages +// Credential Status Messages -message QueryCredentialRequest { +message QueryCredentialStatusRequest { string credId = 1; } -message QueryCredentialResponse { - Credential credStatus = 1; +message QueryCredentialStatusResponse { + CredentialStatusState credentialStatus = 1; } -message QueryCredentialsRequest { +message QueryCredentialStatusesRequest { cosmos.base.query.v1beta1.PageRequest pagination = 1; } -message QueryCredentialsResponse { - uint64 totalCount = 1; - repeated Credential credentials = 2; +message QueryCredentialStatusesResponse { + uint64 count = 1; + repeated CredentialStatusState credentialStatuses = 2; } // Did Document Messages @@ -88,16 +87,15 @@ message QueryDidDocumentRequest { } message QueryDidDocumentResponse { - Did didDocument = 1; - Metadata didDocumentMetadata = 2; + DidDocument didDocument = 1; + DidDocumentMetadata didDocumentMetadata = 2; } message QueryDidDocumentsRequest { - bool count = 1; - cosmos.base.query.v1beta1.PageRequest pagination = 2; + cosmos.base.query.v1beta1.PageRequest pagination = 1; } message QueryDidDocumentsResponse { - uint64 totalDidCount = 1; - repeated QueryDidDocumentResponse didDocList = 2; + uint64 count = 1; + repeated DidDocumentState didDocuments = 2; } diff --git a/proto/ssi/v1/schema.proto b/proto/ssi/v1/schema.proto deleted file mode 100644 index 0763a1f..0000000 --- a/proto/ssi/v1/schema.proto +++ /dev/null @@ -1,41 +0,0 @@ -syntax = "proto3"; -package hypersignprotocol.hidnode.ssi; -option go_package = "github.com/hypersign-protocol/hid-node/x/ssi/types"; - -message SchemaDocument { - string type = 1; - string modelVersion = 2; - string id = 3; - string name = 4; - string author = 5; - string authored = 6; - SchemaProperty schema = 7; -} - -message SchemaProperty { - string schema = 1; - string description = 2; - string type = 3; - string properties = 4; - repeated string required = 5; - bool additionalProperties = 6; -} - -message SchemaProof { - string type = 1; - string created = 2; - string verificationMethod = 4; - string proofPurpose = 5; - string proofValue = 6; -} - -message Schema { - string type = 1; - string modelVersion = 2; - string id = 3; - string name = 4; - string author = 5; - string authored = 6; - SchemaProperty schema = 7; - SchemaProof proof = 8; -} diff --git a/proto/ssi/v1/tx.proto b/proto/ssi/v1/tx.proto index 7fcdb3a..04572b1 100644 --- a/proto/ssi/v1/tx.proto +++ b/proto/ssi/v1/tx.proto @@ -1,72 +1,77 @@ syntax = "proto3"; -package hypersignprotocol.hidnode.ssi; +package hypersign.ssi.v1; option go_package = "github.com/hypersign-protocol/hid-node/x/ssi/types"; -import "ssi/v1/schema.proto"; +import "ssi/v1/credential_schema.proto"; import "ssi/v1/did.proto"; -import "ssi/v1/credential.proto"; -import "ssi/v1/clientSpec.proto"; +import "ssi/v1/credential_status.proto"; +import "ssi/v1/proof.proto"; -// Msg defines the Msg service. service Msg { - rpc CreateDID(MsgCreateDID) returns (MsgCreateDIDResponse); + rpc RegisterDID(MsgRegisterDID) returns (MsgRegisterDIDResponse); rpc UpdateDID(MsgUpdateDID) returns (MsgUpdateDIDResponse); - rpc CreateSchema(MsgCreateSchema) returns (MsgCreateSchemaResponse); rpc DeactivateDID(MsgDeactivateDID) returns (MsgDeactivateDIDResponse); + rpc RegisterCredentialSchema(MsgRegisterCredentialSchema) returns (MsgRegisterCredentialSchemaResponse); + rpc UpdateCredentialSchema(MsgUpdateCredentialSchema) returns (MsgUpdateCredentialSchemaResponse); rpc RegisterCredentialStatus(MsgRegisterCredentialStatus) returns (MsgRegisterCredentialStatusResponse); + rpc UpdateCredentialStatus(MsgUpdateCredentialStatus) returns (MsgUpdateCredentialStatusResponse); } -message MsgCreateDID { - Did didDocString = 1; - repeated SignInfo signatures = 2; - string creator = 3; +message MsgRegisterDID { + DidDocument didDocument = 1; + repeated DocumentProof didDocumentProofs = 2; + string txAuthor = 3; } -message MsgCreateDIDResponse { - uint64 id = 1; -} +message MsgRegisterDIDResponse {} message MsgUpdateDID { - Did didDocString = 1; - string version_id = 2; - repeated SignInfo signatures = 3; - string creator = 4; + DidDocument didDocument = 1; + repeated DocumentProof didDocumentProofs = 2; + string versionId = 3; + string txAuthor = 4; } -message MsgUpdateDIDResponse { - string updateId = 1; -} +message MsgUpdateDIDResponse {} -message MsgCreateSchema { - string creator = 1; - SchemaDocument schemaDoc = 2; - SchemaProof schemaProof = 3; - ClientSpec clientSpec = 4; +message MsgDeactivateDID { + string didDocumentId = 1; + repeated DocumentProof didDocumentProofs = 2; + string versionId = 3; + string txAuthor = 4; } -message MsgCreateSchemaResponse { - uint64 id = 1; -} +message MsgDeactivateDIDResponse {} -message MsgDeactivateDID { - string creator = 1; - string didId = 2; - string version_id = 3; - repeated SignInfo signatures = 4; +message MsgRegisterCredentialSchema { + CredentialSchemaDocument credentialSchemaDocument = 1; + DocumentProof credentialSchemaProof = 2; + string txAuthor = 3; } -message MsgDeactivateDIDResponse { - uint64 id = 1; +message MsgRegisterCredentialSchemaResponse {} + +message MsgUpdateCredentialSchema { + CredentialSchemaDocument credentialSchemaDocument = 1; + DocumentProof credentialSchemaProof = 2; + string txAuthor = 3; } +message MsgUpdateCredentialSchemaResponse {} + message MsgRegisterCredentialStatus { - string creator = 1; - CredentialStatus credentialStatus = 2; - CredentialProof proof = 3; - ClientSpec clientSpec = 4; + CredentialStatusDocument credentialStatusDocument = 1; + DocumentProof credentialStatusProof = 2; + string txAuthor = 3; } -message MsgRegisterCredentialStatusResponse { - uint64 id = 1; +message MsgRegisterCredentialStatusResponse {} + +message MsgUpdateCredentialStatus { + CredentialStatusDocument credentialStatusDocument = 1; + DocumentProof credentialStatusProof = 2; + string txAuthor = 3; } + +message MsgUpdateCredentialStatusResponse {} diff --git a/scripts/protocgen-ts.sh b/scripts/protocgen-ts.sh new file mode 100755 index 0000000..d7d1528 --- /dev/null +++ b/scripts/protocgen-ts.sh @@ -0,0 +1,39 @@ +#!/usr/bin/env bash +set -eux pipefail + +# Install ts-proto plugin +npm i ts-proto + +# generated-ts +generated_ts_dir=./generated-ts + +# Remove generated files director to update changes +rm -rf $generated_ts_dir + +# Make a generated files directory +mkdir $generated_ts_dir + +# Get the path of the cosmos-sdk repo from go/pkg/mod +cosmos_sdk_dir=$(go list -f '{{ .Dir }}' -m github.com/cosmos/cosmos-sdk) +proto_dirs=$(find ./proto -path -prune -o -name '*.proto' -print0 | xargs -0 -n1 dirname | sort | uniq) +for dir in $proto_dirs; do + # generate protobuf bind + protoc \ + --plugin ./node_modules/.bin/protoc-gen-ts_proto \ + --ts_proto_out=$generated_ts_dir \ + --ts_proto_opt=useOptionals=all \ + --ts_proto_opt=initializeFieldsAsUndefined=false \ + --ts_proto_opt=unrecognizedEnum=false \ + --ts_proto_opt=useJsonName=true \ + --ts_proto_opt=esModuleInterop=true \ + -I "proto" \ + -I "third_party/proto" \ + -I "$cosmos_sdk_dir/third_party/proto" \ + -I "$cosmos_sdk_dir/proto" \ + $(find "${dir}" -name '*.proto') + +done + +rm -rf ./node_modules package-lock.json + +echo "TS files are generated at $generated_ts_dir" \ No newline at end of file diff --git a/tests/e2e/ssi_tests/e2e_tests.py b/tests/e2e/ssi_tests/e2e_tests.py index e20bd77..cde8662 100644 --- a/tests/e2e/ssi_tests/e2e_tests.py +++ b/tests/e2e/ssi_tests/e2e_tests.py @@ -6,7 +6,8 @@ from utils import run_blockchain_command, generate_key_pair, secp256k1_pubkey_to_address, add_keyAgreeemnt_pubKeyMultibase from generate_doc import generate_did_document, generate_schema_document, generate_cred_status_document from transactions import form_did_create_tx_multisig, form_did_update_tx_multisig, \ - query_did, form_create_schema_tx, form_did_deactivate_tx_multisig, form_create_cred_status_tx + query_did, form_create_schema_tx, form_did_deactivate_tx_multisig, form_create_cred_status_tx, \ + form_update_schema_tx, form_update_cred_status_tx from constants import DEFAULT_BLOCKCHAIN_ACCOUNT_NAME def bbs_signature_test(): @@ -54,7 +55,7 @@ def bbs_signature_test(): cred_proof, DEFAULT_BLOCKCHAIN_ACCOUNT_NAME ) - cred_id = cred_doc["claim"]["id"] + cred_id = cred_doc["id"] run_blockchain_command(register_cred_status_cmd, f"Registering Credential status with Id: {cred_id}") @@ -804,6 +805,27 @@ def schema_test(): schema_doc_id = schema_doc["id"] run_blockchain_command(create_schema_cmd, f"Registering Schema with Id: {schema_doc_id}") + print("3. PASS: Bob updates a schema using one of her VMs\n") + updated_schema_doc = schema_doc + #Increment version in Schema id + schema_id_list = list(updated_schema_doc["id"]) + schema_id_list[-3] = '4' + updated_schema_doc["id"] = "".join(schema_id_list) + updated_schema_doc_id = updated_schema_doc["id"] + + _, schema_proof = generate_schema_document( + kp_bob, + did_doc_bob, + did_doc_bob_vm["id"], + updated_schema=updated_schema_doc + ) + update_schema_cmd = form_update_schema_tx( + updated_schema_doc, + schema_proof, + DEFAULT_BLOCKCHAIN_ACCOUNT_NAME + ) + run_blockchain_command(update_schema_cmd, f"Updating Schema with Id: {updated_schema_doc_id}") + print("--- Test Completed ---\n") def credential_status_test(): @@ -843,7 +865,7 @@ def credential_status_test(): cred_proof, DEFAULT_BLOCKCHAIN_ACCOUNT_NAME ) - cred_id = cred_doc["claim"]["id"] + cred_id = cred_doc["id"] run_blockchain_command(register_cred_status_cmd, f"Registering Credential status with Id: {cred_id}", True) print("2. PASS: Bob creates a DID with herself being the controller. He attempts to registers a credential status using one of his VMs\n") @@ -875,9 +897,77 @@ def credential_status_test(): cred_proof, DEFAULT_BLOCKCHAIN_ACCOUNT_NAME ) - cred_id = cred_doc["claim"]["id"] + cred_id = cred_doc["id"] run_blockchain_command(register_cred_status_cmd, f"Registering Credential status with Id: {cred_id}") + print("3. PASS: Bob suspends the credential status using one of his VMs\n") + cred_doc["suspended"] = True + + _, cred_proof = generate_cred_status_document( + kp_bob, + did_doc_bob, + did_doc_bob_vm["id"], + updated_credstatus_doc=cred_doc + ) + register_cred_status_cmd = form_update_cred_status_tx( + cred_doc, + cred_proof, + DEFAULT_BLOCKCHAIN_ACCOUNT_NAME + ) + cred_id = cred_doc["id"] + run_blockchain_command(register_cred_status_cmd, f"Updating Credential status with Id: {cred_id}") + + print("4. PASS: Bob un-suspends the credential status using one of his VMs\n") + cred_doc["suspended"] = False + + _, cred_proof = generate_cred_status_document( + kp_bob, + did_doc_bob, + did_doc_bob_vm["id"], + updated_credstatus_doc=cred_doc + ) + register_cred_status_cmd = form_update_cred_status_tx( + cred_doc, + cred_proof, + DEFAULT_BLOCKCHAIN_ACCOUNT_NAME + ) + cred_id = cred_doc["id"] + run_blockchain_command(register_cred_status_cmd, f"Updating Credential status with Id: {cred_id}") + + print("5. PASS: Bob revokes the credential status using one of his VMs\n") + cred_doc["revoked"] = True + + _, cred_proof = generate_cred_status_document( + kp_bob, + did_doc_bob, + did_doc_bob_vm["id"], + updated_credstatus_doc=cred_doc + ) + register_cred_status_cmd = form_update_cred_status_tx( + cred_doc, + cred_proof, + DEFAULT_BLOCKCHAIN_ACCOUNT_NAME + ) + cred_id = cred_doc["id"] + run_blockchain_command(register_cred_status_cmd, f"Updating Credential status with Id: {cred_id}") + + print("6. FAIL: Bob attempts to un-revoke the credential status using one of his VMs\n") + cred_doc["revoked"] = False + + _, cred_proof = generate_cred_status_document( + kp_bob, + did_doc_bob, + did_doc_bob_vm["id"], + updated_credstatus_doc=cred_doc + ) + register_cred_status_cmd = form_update_cred_status_tx( + cred_doc, + cred_proof, + DEFAULT_BLOCKCHAIN_ACCOUNT_NAME + ) + cred_id = cred_doc["id"] + run_blockchain_command(register_cred_status_cmd, f"Updating Credential status with Id: {cred_id}", True) + print("--- Test Completed ---\n") def caip10_ethereum_support_test(): @@ -1437,14 +1527,14 @@ def method_specific_id_test(): def bjj_signature_test(): print("\n--1. PASS: Create a DID using BabyJubJub Key Pair--\n") - kp_alice = generate_key_pair("bjj") + kp_alice = generate_key_pair("BabyJubJubSignature2023") signers = [] - did_doc_string = generate_did_document(kp_alice, "bjj") + did_doc_string = generate_did_document(kp_alice, "BabyJubJubSignature2023") did_doc_alice = did_doc_string["id"] signPair_alice = { "kp": kp_alice, "verificationMethodId": did_doc_string["verificationMethod"][0]["id"], - "signing_algo": "bjj" + "signing_algo": "BabyJubJubSignature2023" } signers.append(signPair_alice) create_tx_cmd = form_did_create_tx_multisig(did_doc_string, signers, DEFAULT_BLOCKCHAIN_ACCOUNT_NAME) @@ -1456,7 +1546,7 @@ def bjj_signature_test(): kp_alice, did_doc_alice, did_doc_string["verificationMethod"][0]["id"], - algo="bjj" + algo="BabyJubJubSignature2023" ) create_schema_cmd = form_create_schema_tx( schema_doc, @@ -1472,14 +1562,14 @@ def bjj_signature_test(): kp_alice, did_doc_alice, did_doc_string["verificationMethod"][0]["id"], - algo="bjj" + algo="BabyJubJubSignature2023" ) register_cred_status_cmd = form_create_cred_status_tx( cred_doc, cred_proof, DEFAULT_BLOCKCHAIN_ACCOUNT_NAME ) - cred_id = cred_doc["claim"]["id"] + cred_id = cred_doc["id"] run_blockchain_command(register_cred_status_cmd, f"Registering Credential status with Id: {cred_id}") diff --git a/tests/e2e/ssi_tests/generate_doc.py b/tests/e2e/ssi_tests/generate_doc.py index cb7b143..4a4d2c5 100644 --- a/tests/e2e/ssi_tests/generate_doc.py +++ b/tests/e2e/ssi_tests/generate_doc.py @@ -40,7 +40,7 @@ def generate_did_document(key_pair, algo="Ed25519Signature2020", bech32prefix="h vm_type = "EcdsaSecp256k1RecoveryMethod2020" elif algo == "BbsBlsSignature2020": vm_type = "Bls12381G2Key2020" - elif algo == "bjj": + elif algo == "BabyJubJubSignature2023": vm_type = "BabyJubJubVerificationKey2023" else: raise Exception("unknown signing algorithm: " + algo) @@ -91,7 +91,7 @@ def generate_did_document(key_pair, algo="Ed25519Signature2020", bech32prefix="h base_document["assertionMethod"] = [] return base_document -def generate_schema_document(key_pair, schema_author, vm, signature=None, algo="Ed25519Signature2020"): +def generate_schema_document(key_pair, schema_author, vm, signature=None, algo="Ed25519Signature2020", updated_schema=None): base_schema_doc = { "type": "https://schema.org/Person", "modelVersion": "v1.0", @@ -117,7 +117,7 @@ def generate_schema_document(key_pair, schema_author, vm, signature=None, algo=" proof_type = "EcdsaSecp256k1RecoverySignature2020" elif algo == "BbsBlsSignature2020": proof_type = "BbsBlsSignature2020" - elif algo == "bjj": + elif algo == "BabyJubJubSignature2023": proof_type = "BabyJubJubSignature2023" else: raise Exception("Invalid signing algo: " + algo) @@ -127,33 +127,32 @@ def generate_schema_document(key_pair, schema_author, vm, signature=None, algo=" "created": "2022-08-16T10:22:12Z", "verificationMethod": "", "proofValue": "", - "proofPurpose": "assertion" + "proofPurpose": "assertionMethod" } - + schema_id = generate_document_id("schema", algo=algo) base_schema_doc["id"] = schema_id base_schema_doc["author"] = schema_author base_schema_proof["verificationMethod"] = vm # Form Signature - if not signature: - signature = get_document_signature(base_schema_doc, "schema", key_pair, algo) - - base_schema_proof["proofValue"] = signature - - return base_schema_doc, base_schema_proof + if not updated_schema: + if not signature: + signature = get_document_signature(base_schema_doc, "schema", key_pair, algo) + base_schema_proof["proofValue"] = signature + return base_schema_doc, base_schema_proof + else: + if not signature: + signature = get_document_signature(updated_schema, "schema", key_pair, algo) + base_schema_proof["proofValue"] = signature + return updated_schema, base_schema_proof -def generate_cred_status_document(key_pair, cred_author, vm, signature=None, algo="Ed25519Signature2020"): +def generate_cred_status_document(key_pair, cred_author, vm, signature=None, algo="Ed25519Signature2020", updated_credstatus_doc=None): base_cred_status_doc = { - "claim": { - "id": "", - "currentStatus": "Live", - "statusReason": "Credential Active" - }, + "id": "", "issuer": "did:hid:devnet:z3861habXtUFLNuu6J7m5p8VPsoBMduYbYeUxfx9CnWZR", "issuanceDate": "2022-08-16T09:37:12Z", - "expirationDate": "2023-08-16T09:40:12Z", - "credentialHash": "f35c3a4e3f1b8ba54ee3cf59d3de91b8b357f707fdb72a46473b65b46f92f80b" + "merkleRootHash": "f35c3a4e3f1b8ba54ee3cf59d3de91b8b357f707fdb72a46473b65b46f92f80b" } proof_type = "" @@ -165,7 +164,7 @@ def generate_cred_status_document(key_pair, cred_author, vm, signature=None, alg proof_type = "EcdsaSecp256k1RecoverySignature2020" elif algo == "BbsBlsSignature2020": proof_type = "BbsBlsSignature2020" - elif algo == "bjj": + elif algo == "BabyJubJubSignature2023": proof_type = "BabyJubJubSignature2023" else: raise Exception("Invalid signing algo: " + algo) @@ -173,21 +172,24 @@ def generate_cred_status_document(key_pair, cred_author, vm, signature=None, alg base_cred_status_proof = { "type": proof_type, "created": "2022-08-16T09:37:12Z", - "updated": "2022-08-16T09:37:12Z", "verificationMethod": "", "proofValue": "", - "proofPurpose": "assertion" + "proofPurpose": "assertionMethod" } cred_id = generate_document_id("cred-status", algo=algo) - base_cred_status_doc["claim"]["id"] = cred_id + base_cred_status_doc["id"] = cred_id base_cred_status_doc["issuer"] = cred_author base_cred_status_proof["verificationMethod"] = vm # Form Signature - if not signature: - signature = get_document_signature(base_cred_status_doc, "cred-status", key_pair, algo) - - base_cred_status_proof["proofValue"] = signature - - return base_cred_status_doc, base_cred_status_proof \ No newline at end of file + if not updated_credstatus_doc: + if not signature: + signature = get_document_signature(base_cred_status_doc, "cred-status", key_pair, algo) + base_cred_status_proof["proofValue"] = signature + return base_cred_status_doc, base_cred_status_proof + else: + if not signature: + signature = get_document_signature(updated_credstatus_doc, "cred-status", key_pair, algo) + base_cred_status_proof["proofValue"] = signature + return updated_credstatus_doc, base_cred_status_proof \ No newline at end of file diff --git a/tests/e2e/ssi_tests/run.py b/tests/e2e/ssi_tests/run.py index 733a362..7363c0c 100644 --- a/tests/e2e/ssi_tests/run.py +++ b/tests/e2e/ssi_tests/run.py @@ -22,7 +22,7 @@ def generate_report(func): print("Test report generation failed\n", e) def run_all_tests(): - print("============= 🔧️ Running all x/ssi e2e tests ============== \n") + print("============= Running all x/ssi e2e tests ============== \n") create_did_test() update_did_test() @@ -38,7 +38,7 @@ def run_all_tests(): bbs_signature_test() bjj_signature_test() - print("============= 😃️ All test cases completed successfully ============== \n") + print("============= All test cases completed successfully ============== \n") if __name__=='__main__': # Assert if blockchain is currently running diff --git a/tests/e2e/ssi_tests/transactions.py b/tests/e2e/ssi_tests/transactions.py index eba8382..f3dea02 100644 --- a/tests/e2e/ssi_tests/transactions.py +++ b/tests/e2e/ssi_tests/transactions.py @@ -5,111 +5,101 @@ from utils import run_command import json -from utils import run_command +from utils import run_command, get_document_signature COMMON_TX_COMMAND_FLAGS = "--chain-id hidnode --output json --broadcast-mode block --keyring-backend test --yes" def form_did_create_tx_multisig(diddoc, signPairs, blockchain_account): - signPairStr = "" + proofsStr = "" for signPair in signPairs: - private_key = "" vmId = signPair["verificationMethodId"] signAlgo = signPair["signing_algo"] - if signAlgo in ["EcdsaSecp256k1RecoverySignature2020", "bjj"]: - private_key = signPair["kp"]["priv_key_hex"] - else: - private_key = signPair["kp"]["priv_key_base_64"] + base_diddoc_proof = { + "type": signAlgo, + "created": "2022-08-16T10:22:12Z", + "verificationMethod": vmId, + "proofPurpose": "assertionMethod", + "proofValue": "", + } - signPairStr += f"{vmId} {private_key} {signAlgo} " + signature = get_document_signature(diddoc, "did", signPair["kp"], signAlgo) + base_diddoc_proof["proofValue"] = signature + proofsStr += f"'{json.dumps(base_diddoc_proof)}' " - cmd_string = f"hid-noded tx ssi create-did '{json.dumps(diddoc)}' {signPairStr} --from {blockchain_account} " + COMMON_TX_COMMAND_FLAGS + cmd_string = f"hid-noded tx ssi register-did '{json.dumps(diddoc)}' {proofsStr} --from {blockchain_account} " + COMMON_TX_COMMAND_FLAGS return cmd_string def form_did_update_tx_multisig(diddoc, signPairs, blockchain_account): - signPairStr = "" + proofsStr = "" for signPair in signPairs: - private_key = "" vmId = signPair["verificationMethodId"] signAlgo = signPair["signing_algo"] - if signAlgo in ["EcdsaSecp256k1RecoverySignature2020", "bjj"]: - private_key = signPair["kp"]["priv_key_hex"] - else: - private_key = signPair["kp"]["priv_key_base_64"] + base_diddoc_proof = { + "type": signAlgo, + "created": "2022-08-16T10:22:12Z", + "verificationMethod": vmId, + "proofPurpose": "assertionMethod", + "proofValue": "", + } - signPairStr += f"{vmId} {private_key} {signAlgo} " + signature = get_document_signature(diddoc, "did", signPair["kp"], signAlgo) + base_diddoc_proof["proofValue"] = signature + proofsStr += f"'{json.dumps(base_diddoc_proof)}' " version_id = query_did(diddoc["id"])["didDocumentMetadata"]["versionId"] - cmd_string = f"hid-noded tx ssi update-did '{json.dumps(diddoc)}' '{version_id}' {signPairStr} --from {blockchain_account} " + COMMON_TX_COMMAND_FLAGS + cmd_string = f"hid-noded tx ssi update-did '{json.dumps(diddoc)}' '{version_id}' {proofsStr} --from {blockchain_account} " + COMMON_TX_COMMAND_FLAGS return cmd_string def form_did_deactivate_tx_multisig(didId, signPairs, blockchain_account): - signPairStr = "" + proofsStr = "" + didDocState = query_did(didId) + diddoc = didDocState["didDocument"] + version_id = didDocState["didDocumentMetadata"]["versionId"] for signPair in signPairs: - private_key = "" vmId = signPair["verificationMethodId"] signAlgo = signPair["signing_algo"] - if signAlgo in ["EcdsaSecp256k1RecoverySignature2020", "bjj"]: - private_key = signPair["kp"]["priv_key_hex"] - else: - private_key = signPair["kp"]["priv_key_base_64"] - - signPairStr += f"{vmId} {private_key} {signAlgo} " - - version_id = query_did(didId)["didDocumentMetadata"]["versionId"] - cmd_string = f"hid-noded tx ssi deactivate-did '{didId}' '{version_id}' {signPairStr} --from {blockchain_account} " + COMMON_TX_COMMAND_FLAGS - return cmd_string - -def form_did_create_tx(did_doc, kp, blockchain_account, verificationMethodId=None, signing_algo="ed25519"): - if signing_algo in ["EcdsaSecp256k1RecoverySignature2020", "bjj"]: - private_key = kp["priv_key_hex"] - else: - private_key = kp["priv_key_base_64"] - - if not verificationMethodId: - verificationMethodId = did_doc["authentication"][0] + base_diddoc_proof = { + "type": signAlgo, + "created": "2022-08-16T10:22:12Z", + "verificationMethod": vmId, + "proofPurpose": "assertionMethod", + "proofValue": "", + } + + signature = get_document_signature(diddoc, "did", signPair["kp"], signAlgo) + base_diddoc_proof["proofValue"] = signature + proofsStr += f"'{json.dumps(base_diddoc_proof)}' " - cmd_string = f"hid-noded tx ssi create-did '{json.dumps(did_doc)}' {verificationMethodId} {private_key} {signing_algo} --from {blockchain_account} " + COMMON_TX_COMMAND_FLAGS + cmd_string = f"hid-noded tx ssi deactivate-did '{didId}' '{version_id}' {proofsStr} --from {blockchain_account} " + COMMON_TX_COMMAND_FLAGS return cmd_string def form_create_schema_tx(schema_msg, schema_proof, blockchain_account): cmd_string = f"hid-noded tx ssi create-schema '{json.dumps(schema_msg)}' '{json.dumps(schema_proof)}' --from {blockchain_account} " + COMMON_TX_COMMAND_FLAGS return cmd_string -def form_create_cred_status_tx(cred_msg, cred_proof, blockchain_account): - cmd_string = f"hid-noded tx ssi register-credential-status '{json.dumps(cred_msg)}' '{json.dumps(cred_proof)}' --from {blockchain_account} " + COMMON_TX_COMMAND_FLAGS +def form_update_schema_tx(schema_msg, schema_proof, blockchain_account): + cmd_string = f"hid-noded tx ssi update-schema '{json.dumps(schema_msg)}' '{json.dumps(schema_proof)}' --from {blockchain_account} " + COMMON_TX_COMMAND_FLAGS return cmd_string -def form_did_update_tx(did_doc, kp, blockchain_account, verificationMethodId=None, signing_algo="ed25519"): - if signing_algo in ["EcdsaSecp256k1RecoverySignature2020", "bjj"]: - private_key = kp["priv_key_hex"] - else: - private_key = kp["priv_key_base_64"] - - if not verificationMethodId: - verificationMethodId = did_doc["authentication"][0] - version_id = query_did(did_doc["id"])["didDocumentMetadata"]["versionId"] - cmd_string = f"hid-noded tx ssi update-did '{json.dumps(did_doc)}' '{version_id}' '{verificationMethodId}' {private_key} {signing_algo} --from {blockchain_account} " + COMMON_TX_COMMAND_FLAGS +def form_create_cred_status_tx(cred_msg, cred_proof, blockchain_account): + cmd_string = f"hid-noded tx ssi register-credential-status '{json.dumps(cred_msg)}' '{json.dumps(cred_proof)}' --from {blockchain_account} " + COMMON_TX_COMMAND_FLAGS return cmd_string -def form_did_deactivate_tx(did_doc_id, kp, blockchain_account, verificationMethodId=None, signing_algo="ed25519"): - if signing_algo in ["EcdsaSecp256k1RecoverySignature2020", "hex"]: - private_key = kp["priv_key_hex"] - else: - private_key = kp["priv_key_base_64"] - - if not verificationMethodId: - verificationMethodId = query_did(did_doc_id)["didDocument"]["authentication"][0] - version_id = query_did(did_doc_id)["didDocumentMetadata"]["versionId"] - cmd_string = f"hid-noded tx ssi deactivate-did '{did_doc_id}' '{version_id}' '{verificationMethodId}' {private_key} {signing_algo} --from {blockchain_account} " + COMMON_TX_COMMAND_FLAGS +def form_update_cred_status_tx(cred_msg, cred_proof, blockchain_account): + cmd_string = f"hid-noded tx ssi update-credential-status '{json.dumps(cred_msg)}' '{json.dumps(cred_proof)}' --from {blockchain_account} " + COMMON_TX_COMMAND_FLAGS return cmd_string def query_did(did_id): cmd_string = f"hid-noded q ssi did {did_id} --output json" did_doc, _ = run_command(cmd_string) - return json.loads(did_doc) \ No newline at end of file + + if did_doc == "": + raise Exception(f"unable to fetch DID Document {did_id} from server") + + return json.loads(did_doc) diff --git a/tests/e2e/ssi_tests/utils.py b/tests/e2e/ssi_tests/utils.py index 7ac83b7..1bb61d1 100644 --- a/tests/e2e/ssi_tests/utils.py +++ b/tests/e2e/ssi_tests/utils.py @@ -55,7 +55,7 @@ def generate_key_pair(algo="Ed25519Signature2020"): cmd = "hid-noded debug secp256k1 eth-hex-random" elif algo == "BbsBlsSignature2020": cmd = "hid-noded debug bbs random" - elif algo == "bjj": + elif algo == "BabyJubJubSignature2023": cmd = "hid-noded debug bjj random" else: raise Exception(algo + " is not a supported signing algorithm") @@ -109,7 +109,7 @@ def is_blockchain_active(rpc_port): assert s.connect_ex(('localhost', rpc_port)) == 0, f"hid-noded is not running" def get_document_signature(doc: dict, doc_type: str, key_pair: dict, algo: str = "ed25519"): - if algo in ["EcdsaSecp256k1RecoverySignature2020", "bjj"]: + if algo in ["EcdsaSecp256k1RecoverySignature2020", "BabyJubJubSignature2023"]: private_key = key_pair["priv_key_hex"] else: private_key = key_pair["priv_key_base_64"] @@ -118,6 +118,8 @@ def get_document_signature(doc: dict, doc_type: str, key_pair: dict, algo: str = doc_cmd = "cred-status-doc" elif doc_type == "schema": doc_cmd = "schema-doc" + elif doc_type == "did": + doc_cmd = "did-doc" else: raise Exception("Invalid value for doc_type param: " + doc_type) diff --git a/x/ssi/abci.go b/x/ssi/abci.go deleted file mode 100644 index cb16dd8..0000000 --- a/x/ssi/abci.go +++ /dev/null @@ -1,15 +0,0 @@ -package ssi - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/hypersign-protocol/hid-node/x/ssi/keeper" -) - -// BeginBlocker is called at the beginning of every block -func BeginBlocker(ctx sdk.Context, k keeper.Keeper) { - // Set all the credential status that have passed their expiration date - // to Expired - if err := k.SetCredentialStatusToExpired(ctx); err != nil { - panic(err) - } -} diff --git a/x/ssi/client/cli/query_ssi.go b/x/ssi/client/cli/query_ssi.go index cc1ab64..dab8e42 100644 --- a/x/ssi/client/cli/query_ssi.go +++ b/x/ssi/client/cli/query_ssi.go @@ -1,16 +1,12 @@ package cli import ( - "strconv" - "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" "github.com/hypersign-protocol/hid-node/x/ssi/types" "github.com/spf13/cobra" ) -var _ = strconv.Itoa(0) - func CmdGetSchema() *cobra.Command { cmd := &cobra.Command{ Use: "schema [schema-id]", @@ -26,9 +22,9 @@ func CmdGetSchema() *cobra.Command { queryClient := types.NewQueryClient(clientCtx) - params := &types.QuerySchemaRequest{SchemaId: argSchemaId} + params := &types.QueryCredentialSchemaRequest{SchemaId: argSchemaId} - res, err := queryClient.QuerySchema(cmd.Context(), params) + res, err := queryClient.CredentialSchemaByID(cmd.Context(), params) if err != nil { return err } @@ -59,7 +55,7 @@ func CmdResolveDID() *cobra.Command { params := &types.QueryDidDocumentRequest{DidId: argDidDocId} - res, err := queryClient.QueryDidDocument(cmd.Context(), params) + res, err := queryClient.DidDocumentByID(cmd.Context(), params) if err != nil { return err } @@ -88,9 +84,9 @@ func CmdGetCredentialStatus() *cobra.Command { queryClient := types.NewQueryClient(clientCtx) - params := &types.QueryCredentialRequest{CredId: argCredId} + params := &types.QueryCredentialStatusRequest{CredId: argCredId} - res, err := queryClient.QueryCredential(cmd.Context(), params) + res, err := queryClient.CredentialStatusByID(cmd.Context(), params) if err != nil { return err } diff --git a/x/ssi/client/cli/tx.go b/x/ssi/client/cli/tx.go index 0702209..0601f07 100644 --- a/x/ssi/client/cli/tx.go +++ b/x/ssi/client/cli/tx.go @@ -18,11 +18,13 @@ func GetTxCmd() *cobra.Command { RunE: client.ValidateCmd, } - cmd.AddCommand(CmdCreateDID()) + cmd.AddCommand(CmdRegisterDID()) cmd.AddCommand(CmdUpdateDID()) cmd.AddCommand(CmdCreateSchema()) + cmd.AddCommand(CmdUpdateSchema()) cmd.AddCommand(CmdDeactivateDID()) cmd.AddCommand(CmdRegisterCredentialStatus()) + cmd.AddCommand(CmdUpdateCredentialStatus()) return cmd } diff --git a/x/ssi/client/cli/tx_ssi.go b/x/ssi/client/cli/tx_ssi.go index 048fe39..63a8599 100644 --- a/x/ssi/client/cli/tx_ssi.go +++ b/x/ssi/client/cli/tx_ssi.go @@ -5,20 +5,22 @@ import ( "fmt" "os" "path/filepath" + "time" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/client/tx" "github.com/cosmos/cosmos-sdk/crypto/keyring" + ldcontext "github.com/hypersign-protocol/hid-node/x/ssi/ld-context" "github.com/hypersign-protocol/hid-node/x/ssi/types" "github.com/spf13/cobra" ) const didAliasFlag = "did-alias" -func CmdCreateDID() *cobra.Command { +func CmdRegisterDID() *cobra.Command { cmd := &cobra.Command{ - Use: "create-did [did-doc-string] ([vm-id-1] [sign-key-1] [sign-key-algo-1] ... [vm-id-N] [sign-key-N] [sign-key-algo-N]) [flags]\n hid-noded tx ssi create-did --did-alias [flags]", + Use: "register-did [did-document] ([did-document-proof-1], [did-document-proof-2] .... [did-document-proof-N]) [flags]\n hid-noded tx ssi register-did --did-alias [flags]", Short: "Registers a DID Document", Args: cobra.ArbitraryArgs, RunE: func(cmd *cobra.Command, args []string) (err error) { @@ -32,27 +34,27 @@ func CmdCreateDID() *cobra.Command { return err } - var didDoc types.Did - var signInfos []*types.SignInfo + var didDoc types.DidDocument + var didDocumentProofs []*types.DocumentProof txAuthorAddr := clientCtx.GetFromAddress() txAuthorAddrString := clientCtx.GetFromAddress().String() if didAlias == "" { - // Minimum 4 CLI arguments are expected - if len(args) < 4 { - return fmt.Errorf("requires at least 4 arg(s), only received %v", len(args)) + // Minimum 2 CLI arguments are expected + if len(args) < 2 { + return fmt.Errorf("requires at least 2 arg(s), only received %v", len(args)) } - argDidDocString := args[0] + argDidDoc := args[0] // Unmarshal DidDocString - err = clientCtx.Codec.UnmarshalJSON([]byte(argDidDocString), &didDoc) + err = clientCtx.Codec.UnmarshalJSON([]byte(argDidDoc), &didDoc) if err != nil { return err } // Prepare Signatures - signInfos, err = getSignatures(cmd, &didDoc, args[1:]) + didDocumentProofs, err = getDocumentProofs(clientCtx, args[1:]) if err != nil { return err } @@ -86,12 +88,17 @@ func CmdCreateDID() *cobra.Command { } // Sign the DID Document using Keyring to get theSignInfo. Currently, "test" keyring-backend is only supported + didDocCanonizedHash, err := ldcontext.EcdsaSecp256k1Signature2019Canonize(&didDoc) + if err != nil { + return err + } + keyringBackend, err := cmd.Flags().GetString(flags.FlagKeyringBackend) if err != nil { return err } if keyringBackend != "test" { - return fmt.Errorf("unsupporeted keyring backend for DID Document Alias Signing: %v", keyringBackend) + return fmt.Errorf("unsupported keyring backend for DID Document Alias Signing: %v", keyringBackend) } kr, err := keyring.New("hid-node-app", keyringBackend, didAliasConfig.HidNodeConfigDir, nil) @@ -99,25 +106,28 @@ func CmdCreateDID() *cobra.Command { return err } - signatureBytes, _, err := kr.SignByAddress(txAuthorAddr, didDocBytes) + signatureBytes, _, err := kr.SignByAddress(txAuthorAddr, didDocCanonizedHash) if err != nil { return err } signatureStr := base64.StdEncoding.EncodeToString(signatureBytes) - signInfos = []*types.SignInfo{ + didDocumentProofs = []*types.DocumentProof{ { - VerificationMethodId: didDoc.VerificationMethod[0].Id, - Signature: signatureStr, + Type: types.EcdsaSecp256k1Signature2019, + VerificationMethod: didDoc.VerificationMethod[0].Id, + ProofPurpose: "assertionMethod", + ProofValue: signatureStr, + Created: time.Now().Format("2006-01-02T15:04:00Z"), // RFC3339 format }, } } - // Submit CreateDID Tx - msg := types.MsgCreateDID{ - DidDocString: &didDoc, - Signatures: signInfos, - Creator: txAuthorAddrString, + // Submit RegisterDID Tx + msg := types.MsgRegisterDID{ + DidDocument: &didDoc, + DidDocumentProofs: didDocumentProofs, + TxAuthor: txAuthorAddrString, } if err := msg.ValidateBasic(); err != nil { @@ -134,11 +144,11 @@ func CmdCreateDID() *cobra.Command { func CmdUpdateDID() *cobra.Command { cmd := &cobra.Command{ - Use: "update-did [did-doc-string] [version-id] [vm-id-1] [sign-key-1] [sign-key-algo-1] ... [vm-id-N] [sign-key-N] [sign-key-algo-N]", + Use: "update-did [did-doc] [version-id] ([did-document-proof-1], [did-document-proof-2] .... [did-document-proof-N])", Short: "Updates Did Document", - Args: cobra.MinimumNArgs(5), + Args: cobra.MinimumNArgs(3), RunE: func(cmd *cobra.Command, args []string) (err error) { - argDidDocString := args[0] + argDidDoc := args[0] argVersionId := args[1] clientCtx, err := client.GetClientTxContext(cmd) @@ -147,22 +157,22 @@ func CmdUpdateDID() *cobra.Command { } // Unmarshal DidDocString - var didDoc types.Did - err = clientCtx.Codec.UnmarshalJSON([]byte(argDidDocString), &didDoc) + var didDoc types.DidDocument + err = clientCtx.Codec.UnmarshalJSON([]byte(argDidDoc), &didDoc) if err != nil { return err } - signInfos, err := getSignatures(cmd, &didDoc, args[2:]) + didDocumentProofs, err := getDocumentProofs(clientCtx, args[2:]) if err != nil { return err } msg := types.MsgUpdateDID{ - Creator: clientCtx.GetFromAddress().String(), - DidDocString: &didDoc, - VersionId: argVersionId, - Signatures: signInfos, + DidDocument: &didDoc, + VersionId: argVersionId, + DidDocumentProofs: didDocumentProofs, + TxAuthor: clientCtx.GetFromAddress().String(), } if err := msg.ValidateBasic(); err != nil { @@ -180,7 +190,53 @@ func CmdUpdateDID() *cobra.Command { func CmdCreateSchema() *cobra.Command { cmd := &cobra.Command{ Use: "create-schema [schema-doc] [schema-proof]", - Short: "Creates Schema", + Short: "Creates Credential Schema", + Args: cobra.ExactArgs(2), + RunE: func(cmd *cobra.Command, args []string) (err error) { + argSchemaDoc := args[0] + argSchemaProof := args[1] + + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + + // Unmarshal Schema Document + var schemaDoc types.CredentialSchemaDocument + err = clientCtx.Codec.UnmarshalJSON([]byte(argSchemaDoc), &schemaDoc) + if err != nil { + return err + } + + // Unmarshal Schema Proof + var schemaProof types.DocumentProof + err = clientCtx.Codec.UnmarshalJSON([]byte(argSchemaProof), &schemaProof) + if err != nil { + return err + } + + msg := types.MsgRegisterCredentialSchema{ + CredentialSchemaDocument: &schemaDoc, + CredentialSchemaProof: &schemaProof, + TxAuthor: clientCtx.GetFromAddress().String(), + } + + if err := msg.ValidateBasic(); err != nil { + return err + } + + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), &msg) + }, + } + + flags.AddTxFlagsToCmd(cmd) + return cmd +} + +func CmdUpdateSchema() *cobra.Command { + cmd := &cobra.Command{ + Use: "update-schema [schema-doc] [schema-proof]", + Short: "Updates Credential Schema", Args: cobra.ExactArgs(2), RunE: func(cmd *cobra.Command, args []string) (err error) { argSchemaDoc := args[0] @@ -192,23 +248,23 @@ func CmdCreateSchema() *cobra.Command { } // Unmarshal Schema Document - var schemaDoc types.SchemaDocument + var schemaDoc types.CredentialSchemaDocument err = clientCtx.Codec.UnmarshalJSON([]byte(argSchemaDoc), &schemaDoc) if err != nil { return err } // Unmarshal Schema Proof - var schemaProof types.SchemaProof + var schemaProof types.DocumentProof err = clientCtx.Codec.UnmarshalJSON([]byte(argSchemaProof), &schemaProof) if err != nil { return err } - msg := types.MsgCreateSchema{ - SchemaDoc: &schemaDoc, - SchemaProof: &schemaProof, - Creator: clientCtx.GetFromAddress().String(), + msg := types.MsgUpdateCredentialSchema{ + CredentialSchemaDocument: &schemaDoc, + CredentialSchemaProof: &schemaProof, + TxAuthor: clientCtx.GetFromAddress().String(), } if err := msg.ValidateBasic(); err != nil { @@ -225,9 +281,9 @@ func CmdCreateSchema() *cobra.Command { func CmdDeactivateDID() *cobra.Command { cmd := &cobra.Command{ - Use: "deactivate-did [did-id] [version-id] [vm-id-1] [sign-key-1] [sign-key-algo-1] ... [vm-id-N] [sign-key-N] [sign-key-algo-N]", + Use: "deactivate-did [did-id] [version-id] ([did-document-proof-1], [did-document-proof-2] .... [did-document-proof-N])", Short: "Deactivates Did Document", - Args: cobra.MinimumNArgs(5), + Args: cobra.MinimumNArgs(3), RunE: func(cmd *cobra.Command, args []string) (err error) { argDidId := args[0] argVersionId := args[1] @@ -240,22 +296,20 @@ func CmdDeactivateDID() *cobra.Command { // Query Did Document from store using Did Id queryClient := types.NewQueryClient(clientCtx) requestParams := &types.QueryDidDocumentRequest{DidId: argDidId} - resolvedDidDocument, err := queryClient.QueryDidDocument(cmd.Context(), requestParams) - if err != nil { + if _, err := queryClient.DidDocumentByID(cmd.Context(), requestParams); err != nil { return err } - didDoc := resolvedDidDocument.GetDidDocument() - signInfos, err := getSignatures(cmd, didDoc, args[2:]) + didDocumentProofs, err := getDocumentProofs(clientCtx, args[2:]) if err != nil { return err } msg := types.MsgDeactivateDID{ - Creator: clientCtx.GetFromAddress().String(), - DidId: argDidId, - VersionId: argVersionId, - Signatures: signInfos, + DidDocumentId: argDidId, + VersionId: argVersionId, + DidDocumentProofs: didDocumentProofs, + TxAuthor: clientCtx.GetFromAddress().String(), } if err := msg.ValidateBasic(); err != nil { @@ -286,8 +340,8 @@ func CmdRegisterCredentialStatus() *cobra.Command { // Unmarshal Credential Status var ( - credentialStatus types.CredentialStatus - proof types.CredentialProof + credentialStatus types.CredentialStatusDocument + proof types.DocumentProof ) err = clientCtx.Codec.UnmarshalJSON([]byte(argCredStatus), &credentialStatus) @@ -302,9 +356,58 @@ func CmdRegisterCredentialStatus() *cobra.Command { } msg := types.MsgRegisterCredentialStatus{ - CredentialStatus: &credentialStatus, - Proof: &proof, - Creator: clientCtx.GetFromAddress().String(), + CredentialStatusDocument: &credentialStatus, + CredentialStatusProof: &proof, + TxAuthor: clientCtx.GetFromAddress().String(), + } + + if err := msg.ValidateBasic(); err != nil { + return err + } + + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), &msg) + }, + } + + flags.AddTxFlagsToCmd(cmd) + return cmd +} + +func CmdUpdateCredentialStatus() *cobra.Command { + cmd := &cobra.Command{ + Use: "update-credential-status [credential-status] [proof]", + Short: "Updates the status of Verifiable Credential", + Args: cobra.ExactArgs(2), + RunE: func(cmd *cobra.Command, args []string) (err error) { + argCredStatus := args[0] + argProof := args[1] + + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + + // Unmarshal Credential Status + var ( + credentialStatus types.CredentialStatusDocument + proof types.DocumentProof + ) + + err = clientCtx.Codec.UnmarshalJSON([]byte(argCredStatus), &credentialStatus) + if err != nil { + return err + } + + // Unmarshal Proof + err = clientCtx.Codec.UnmarshalJSON([]byte(argProof), &proof) + if err != nil { + return err + } + + msg := types.MsgUpdateCredentialStatus{ + CredentialStatusDocument: &credentialStatus, + CredentialStatusProof: &proof, + TxAuthor: clientCtx.GetFromAddress().String(), } if err := msg.ValidateBasic(); err != nil { diff --git a/x/ssi/client/cli/tx_utils.go b/x/ssi/client/cli/tx_utils.go index 5acfab6..57bebe0 100644 --- a/x/ssi/client/cli/tx_utils.go +++ b/x/ssi/client/cli/tx_utils.go @@ -8,8 +8,8 @@ import ( "fmt" "math/big" + "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/types/bech32" - ldcontext "github.com/hypersign-protocol/hid-node/x/ssi/ld-context" "github.com/hypersign-protocol/hid-node/x/ssi/types" "github.com/multiformats/go-multibase" secp256k1 "github.com/tendermint/tendermint/crypto/secp256k1" @@ -23,36 +23,8 @@ import ( bbs "github.com/hyperledger/aries-framework-go/component/kmscrypto/crypto/primitive/bbs12381g2pub" "github.com/iden3/go-iden3-crypto/babyjub" - "github.com/spf13/cobra" ) -// Extract Verification Method Ids and their respective signatures from Arguments -// NOTE: Only Verificaiton Method Ids, Signatures and Signing Algorithms are supposed to be passed, -// and the sequence of arguments are to be preserved. -func extractDIDSigningElements(cmdArgs []string) ([]DIDSigningElements, error) { - // Since, a trio of VM Id, Siganature and Signing Algorithm are expected, an error should be thrown - // if the number of argumens isn't a multiple of 3 - nArgs := len(cmdArgs) - if nArgs%3 != 0 { - return nil, fmt.Errorf("unexpected number of arguments recieved") - } - - var didSigningElementsList []DIDSigningElements - - for i := 0; i < nArgs; i += 3 { - didSigningElementsList = append( - didSigningElementsList, - DIDSigningElements{ - VerificationMethodId: cmdArgs[i], - SignKey: cmdArgs[i+1], - SignAlgo: cmdArgs[i+2], - }, - ) - } - - return didSigningElementsList, nil -} - // GetBbsBlsSignature2020 signs a message and returns a BBS signature func GetBbsBlsSignature2020(privateKey string, message []byte) (string, error) { privKeyBytes, err := base64.StdEncoding.DecodeString(privateKey) @@ -71,7 +43,7 @@ func GetBbsBlsSignature2020(privateKey string, message []byte) (string, error) { } // Get BabyJubJub Signature -func GetBJJSignature(privateKey string, message []byte) (string, error) { +func GetBabyJubJubSignature2023(privateKey string, message []byte) (string, error) { // Decode private key from hex privateKeyBytes, err := hex.DecodeString(privateKey) if err != nil { @@ -147,77 +119,21 @@ func GetEd25519Signature2020(privateKey string, message []byte) (string, error) return multibase.Encode(multibase.Base58BTC, signatureBytes) } -func getSignatures(cmd *cobra.Command, didDoc *types.Did, cmdArgs []string) ([]*types.SignInfo, error) { - var signInfoList []*types.SignInfo +func getDocumentProofs(ctx client.Context, proofStrings []string) ([]*types.DocumentProof, error) { + var documentProofs []*types.DocumentProof - didSigningElementsList, err := extractDIDSigningElements(cmdArgs) - if err != nil { - return nil, err - } + for i := 0; i < len(proofStrings); i++ { + var documentProof types.DocumentProof + err := ctx.Codec.UnmarshalJSON([]byte(proofStrings[i]), &documentProof) + if err != nil { + return nil, fmt.Errorf("unable to process the proof: %v", proofStrings[i]) + } - for i := 0; i < len(didSigningElementsList); i++ { // Get the VM Ids - signInfoList = append(signInfoList, &types.SignInfo{ - VerificationMethodId: didSigningElementsList[i].VerificationMethodId, - }) - - // Sign based on the Signing Algorithm - switch didSigningElementsList[i].SignAlgo { - case types.Ed25519Signature2020: - // Perform EdDSACryptoSuite2020 Normalization - didDocBytes, err := ldcontext.EdDSACryptoSuite2020Canonize(didDoc) - if err != nil { - return nil, err - } - - signInfoList[i].Signature, err = GetEd25519Signature2020(didSigningElementsList[i].SignKey, didDocBytes[:]) - if err != nil { - return nil, err - } - case types.EcdsaSecp256k1Signature2019: - didDocBytes, err := ldcontext.EcdsaSecp256k1Signature2019Canonize(didDoc) - if err != nil { - return nil, err - } - - signInfoList[i].Signature, err = GetEcdsaSecp256k1Signature2019(didSigningElementsList[i].SignKey, didDocBytes) - if err != nil { - return nil, err - } - case types.EcdsaSecp256k1RecoverySignature2020: - didDocBytes, err := ldcontext.EcdsaSecp256k1RecoverySignature2020Canonize(didDoc) - if err != nil { - return nil, err - } - - signInfoList[i].Signature, err = GetEcdsaSecp256k1RecoverySignature2020(didSigningElementsList[i].SignKey, didDocBytes) - if err != nil { - return nil, err - } - case types.BbsBlsSignature2020: - didDocBytes, err := ldcontext.BbsBlsSignature2020Canonize(didDoc) - if err != nil { - return nil, err - } - - signInfoList[i].Signature, err = GetBbsBlsSignature2020(didSigningElementsList[i].SignKey, didDocBytes) - if err != nil { - return nil, err - } - case "bjj": - signInfoList[i].Signature, err = GetBJJSignature(didSigningElementsList[i].SignKey, didDoc.GetSignBytes()) - if err != nil { - return nil, err - } - default: - return nil, fmt.Errorf( - "unsupported signing algorithm %s, supported signing algorithms: ['Ed25519Signature2020', 'secp256k1', 'recover-eth', 'bbs', 'bjj']", - didSigningElementsList[i].SignAlgo, - ) - } + documentProofs = append(documentProofs, &documentProof) } - return signInfoList, nil + return documentProofs, nil } // validateDidAliasSignerAddress checks if the signer address provided in the --from flag matches diff --git a/x/ssi/handler.go b/x/ssi/handler.go index 81aa71e..12864c9 100644 --- a/x/ssi/handler.go +++ b/x/ssi/handler.go @@ -16,21 +16,27 @@ func NewHandler(k keeper.Keeper) sdk.Handler { ctx = ctx.WithEventManager(sdk.NewEventManager()) switch msg := msg.(type) { - case *types.MsgCreateDID: - res, err := msgServer.CreateDID(sdk.WrapSDKContext(ctx), msg) + case *types.MsgRegisterDID: + res, err := msgServer.RegisterDID(sdk.WrapSDKContext(ctx), msg) return sdk.WrapServiceResult(ctx, res, err) case *types.MsgUpdateDID: res, err := msgServer.UpdateDID(sdk.WrapSDKContext(ctx), msg) return sdk.WrapServiceResult(ctx, res, err) - case *types.MsgCreateSchema: - res, err := msgServer.CreateSchema(sdk.WrapSDKContext(ctx), msg) - return sdk.WrapServiceResult(ctx, res, err) case *types.MsgDeactivateDID: res, err := msgServer.DeactivateDID(sdk.WrapSDKContext(ctx), msg) return sdk.WrapServiceResult(ctx, res, err) + case *types.MsgRegisterCredentialSchema: + res, err := msgServer.RegisterCredentialSchema(sdk.WrapSDKContext(ctx), msg) + return sdk.WrapServiceResult(ctx, res, err) + case *types.MsgUpdateCredentialSchema: + res, err := msgServer.UpdateCredentialSchema(sdk.WrapSDKContext(ctx), msg) + return sdk.WrapServiceResult(ctx, res, err) case *types.MsgRegisterCredentialStatus: res, err := msgServer.RegisterCredentialStatus(sdk.WrapSDKContext(ctx), msg) return sdk.WrapServiceResult(ctx, res, err) + case *types.MsgUpdateCredentialStatus: + res, err := msgServer.UpdateCredentialStatus(sdk.WrapSDKContext(ctx), msg) + return sdk.WrapServiceResult(ctx, res, err) default: errMsg := fmt.Sprintf("unrecognized %s message type: %T", types.ModuleName, msg) return nil, sdkerrors.Wrap(sdkerrors.ErrUnknownRequest, errMsg) diff --git a/x/ssi/keeper/grpc_query_credential.go b/x/ssi/keeper/grpc_query_credential.go index 51fc8d7..6200f43 100644 --- a/x/ssi/keeper/grpc_query_credential.go +++ b/x/ssi/keeper/grpc_query_credential.go @@ -12,7 +12,10 @@ import ( "google.golang.org/grpc/status" ) -func (k Keeper) QueryCredential(goCtx context.Context, req *types.QueryCredentialRequest) (*types.QueryCredentialResponse, error) { +func (k Keeper) CredentialStatusByID( + goCtx context.Context, + req *types.QueryCredentialStatusRequest, +) (*types.QueryCredentialStatusResponse, error) { if req == nil { return nil, status.Error(codes.InvalidArgument, "invalid request") } @@ -23,16 +26,19 @@ func (k Keeper) QueryCredential(goCtx context.Context, req *types.QueryCredentia return nil, sdkerrors.Wrap(types.ErrCredentialStatusNotFound, err.Error()) } - return &types.QueryCredentialResponse{CredStatus: cred}, nil + return &types.QueryCredentialStatusResponse{CredentialStatus: cred}, nil } -func (k Keeper) QueryCredentials(goCtx context.Context, req *types.QueryCredentialsRequest) (*types.QueryCredentialsResponse, error) { +func (k Keeper) CredentialStatuses( + goCtx context.Context, + req *types.QueryCredentialStatusesRequest, +) (*types.QueryCredentialStatusesResponse, error) { if req == nil { return nil, status.Error(codes.InvalidArgument, "invalid request") } // Define a variable that will store a list of credentials - var credentials []*types.Credential + var credentials []*types.CredentialStatusState // Get context with the information about the environment ctx := sdk.UnwrapSDKContext(goCtx) // Get the key-value module store using the store key @@ -41,7 +47,7 @@ func (k Keeper) QueryCredentials(goCtx context.Context, req *types.QueryCredenti credStore := prefix.NewStore(store, []byte(types.CredKey)) // Paginate the credential store based on PageRequest _, err := query.Paginate(credStore, req.Pagination, func(key []byte, value []byte) error { - var credential types.Credential + var credential types.CredentialStatusState if err := k.cdc.Unmarshal(value, &credential); err != nil { return err } @@ -52,5 +58,9 @@ func (k Keeper) QueryCredentials(goCtx context.Context, req *types.QueryCredenti if err != nil { return nil, status.Error(codes.Internal, err.Error()) } - return &types.QueryCredentialsResponse{Credentials: credentials, TotalCount: k.GetCredentialStatusCount(ctx)}, nil + + return &types.QueryCredentialStatusesResponse{ + CredentialStatuses: credentials, + Count: k.GetCredentialStatusCount(ctx), + }, nil } diff --git a/x/ssi/keeper/grpc_query_did.go b/x/ssi/keeper/grpc_query_did.go index 483edcf..2b3df35 100644 --- a/x/ssi/keeper/grpc_query_did.go +++ b/x/ssi/keeper/grpc_query_did.go @@ -13,7 +13,7 @@ import ( "google.golang.org/grpc/status" ) -func (k Keeper) QueryDidDocuments(goCtx context.Context, req *types.QueryDidDocumentsRequest) (*types.QueryDidDocumentsResponse, error) { +func (k Keeper) DidDocuments(goCtx context.Context, req *types.QueryDidDocumentsRequest) (*types.QueryDidDocumentsResponse, error) { if req == nil { return nil, status.Error(codes.InvalidArgument, "invalid request") } @@ -21,20 +21,14 @@ func (k Keeper) QueryDidDocuments(goCtx context.Context, req *types.QueryDidDocu ctx := sdk.UnwrapSDKContext(goCtx) store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.DidKey)) - var didResolveList []*types.QueryDidDocumentResponse + var didDocuments []*types.DidDocumentState _, err := query.Paginate(store, req.Pagination, func(key []byte, value []byte) error { - var ( - didResolve types.QueryDidDocumentResponse - didDoc types.DidDocumentState - ) - if err := k.cdc.Unmarshal(value, &didDoc); err != nil { - return err + didDoc, err := k.GetDidDocumentState(&ctx, string(key)) + if err != nil { + return sdkerrors.Wrap(types.ErrDidDocNotFound, err.Error()) } - didResolve.DidDocument = didDoc.DidDocument - didResolve.DidDocumentMetadata = didDoc.DidDocumentMetadata - - didResolveList = append(didResolveList, &didResolve) + didDocuments = append(didDocuments, didDoc) return nil }) @@ -44,14 +38,11 @@ func (k Keeper) QueryDidDocuments(goCtx context.Context, req *types.QueryDidDocu } var didDocCount uint64 = k.GetDidCount(ctx) - if req.Count { - return &types.QueryDidDocumentsResponse{TotalDidCount: didDocCount}, nil - } - return &types.QueryDidDocumentsResponse{TotalDidCount: didDocCount, DidDocList: didResolveList}, nil + + return &types.QueryDidDocumentsResponse{DidDocuments: didDocuments, Count: didDocCount}, nil } -// Ref: https://w3c-ccg.github.io/did-resolution/#resolving-algorithm -func (k Keeper) QueryDidDocument(goCtx context.Context, req *types.QueryDidDocumentRequest) (*types.QueryDidDocumentResponse, error) { +func (k Keeper) DidDocumentByID(goCtx context.Context, req *types.QueryDidDocumentRequest) (*types.QueryDidDocumentResponse, error) { if req == nil { return nil, status.Error(codes.InvalidArgument, "invalid request") } diff --git a/x/ssi/keeper/grpc_query_schema.go b/x/ssi/keeper/grpc_query_schema.go index 39be07d..f4599d9 100644 --- a/x/ssi/keeper/grpc_query_schema.go +++ b/x/ssi/keeper/grpc_query_schema.go @@ -11,26 +11,35 @@ import ( "google.golang.org/grpc/status" ) -func (k Keeper) QuerySchema(goCtx context.Context, req *types.QuerySchemaRequest) (*types.QuerySchemaResponse, error) { +func (k Keeper) CredentialSchemaByID( + goCtx context.Context, + req *types.QueryCredentialSchemaRequest, +) (*types.QueryCredentialSchemaResponse, error) { if req == nil { return nil, status.Error(codes.InvalidArgument, "invalid request") } ctx := sdk.UnwrapSDKContext(goCtx) - var schema []*types.Schema = k.GetSchemaFromStore(ctx, req.SchemaId) + schema, err := k.getCredentialSchemaFromStore(ctx, req.SchemaId) + if err != nil { + return nil, status.Error(codes.NotFound, err.Error()) + } - return &types.QuerySchemaResponse{ - Schema: schema, + return &types.QueryCredentialSchemaResponse{ + CredentialSchemas: schema, }, nil } -func (k Keeper) QuerySchemas(goCtx context.Context, req *types.QuerySchemasRequest) (*types.QuerySchemasResponse, error) { +func (k Keeper) CredentialSchemas( + goCtx context.Context, + req *types.QueryCredentialSchemasRequest, +) (*types.QueryCredentialSchemasResponse, error) { if req == nil { return nil, status.Error(codes.InvalidArgument, "invalid request") } // Define a variable that will store a list of schemas - var schemas []*types.Schema + var schemas []*types.CredentialSchemaState // Get context with the information about the environment ctx := sdk.UnwrapSDKContext(goCtx) // Get the key-value module store using the store key (in our case store key is "chain") @@ -39,7 +48,7 @@ func (k Keeper) QuerySchemas(goCtx context.Context, req *types.QuerySchemasReque schemaStore := prefix.NewStore(store, []byte(types.SchemaKey)) // Paginate the schema store based on PageRequest _, err := query.Paginate(schemaStore, req.Pagination, func(key []byte, value []byte) error { - var schema types.Schema + var schema types.CredentialSchemaState if err := k.cdc.Unmarshal(value, &schema); err != nil { return err } @@ -50,5 +59,8 @@ func (k Keeper) QuerySchemas(goCtx context.Context, req *types.QuerySchemasReque if err != nil { return nil, status.Error(codes.Internal, err.Error()) } - return &types.QuerySchemasResponse{SchemaList: schemas, TotalCount: k.GetSchemaCount(ctx)}, nil + return &types.QueryCredentialSchemasResponse{ + CredentialSchemas: schemas, + Count: k.GetSchemaCount(ctx), + }, nil } diff --git a/x/ssi/keeper/msg_server.go b/x/ssi/keeper/msg_server.go index 30ae87d..2aad7fd 100644 --- a/x/ssi/keeper/msg_server.go +++ b/x/ssi/keeper/msg_server.go @@ -1,6 +1,7 @@ package keeper import ( + "encoding/hex" "fmt" sdk "github.com/cosmos/cosmos-sdk/types" @@ -48,7 +49,7 @@ func (k msgServer) checkControllerPresenceInState( // every verification method of every controller needs to be valid func (k msgServer) formMustControllerVmListMap(ctx sdk.Context, controllers []string, verificationMethods []*types.VerificationMethod, - inputSignMap map[string]*types.SignInfo, + inputSignMap map[string]*types.DocumentProof, ) (map[string][]*types.ExtendedVerificationMethod, error) { var controllerMap map[string][]*types.ExtendedVerificationMethod = map[string][]*types.ExtendedVerificationMethod{} var vmMap map[string]*types.VerificationMethod = map[string]*types.VerificationMethod{} @@ -116,7 +117,7 @@ func (k msgServer) formMustControllerVmListMap(ctx sdk.Context, // atleast one verification method of any controller needs to be valid func (k msgServer) formAnyControllerVmListMap(ctx sdk.Context, controllers []string, verificationMethods []*types.VerificationMethod, - inputSignMap map[string]*types.SignInfo, + inputSignMap map[string]*types.DocumentProof, ) (map[string][]*types.ExtendedVerificationMethod, error) { var controllerMap map[string][]*types.ExtendedVerificationMethod = map[string][]*types.ExtendedVerificationMethod{} var vmMap map[string]*types.VerificationMethod = map[string]*types.VerificationMethod{} @@ -154,8 +155,8 @@ func (k msgServer) formAnyControllerVmListMap(ctx sdk.Context, _, presentInControllerMap := controllerMap[vmState.Controller] if presentInControllerMap { // Skip X25519KeyAgreementKey2020 or X25519KeyAgreementKey2020 because these - // are not allowed for Authentication and Assertion purposes - if (vmState.Type != types.X25519KeyAgreementKey2020) && (vmState.Type != types.X25519KeyAgreementKeyEIP5630) { + // are not allowed for Authentication and Assertion purposes + if (vmState.Type != types.X25519KeyAgreementKey2020) && (vmState.Type != types.X25519KeyAgreementKeyEIP5630) { vmExtended := types.CreateExtendedVerificationMethod(vmState, sign) controllerMap[controller] = append(controllerMap[controller], vmExtended) } @@ -184,7 +185,7 @@ func (k msgServer) getControllerVmFromState(ctx sdk.Context, verificationMethodI } // VerifyDocumentProof verifies the proof of a SSI Document -func (k msgServer) VerifyDocumentProof(ctx sdk.Context, ssiMsg types.SsiMsg, inputDocProof types.SSIProofInterface, clientSpec *types.ClientSpec) error { +func (k msgServer) VerifyDocumentProof(ctx sdk.Context, ssiMsg types.SsiMsg, inputDocProof types.SSIProofInterface) error { // Get DID Document from State docProofVmId := inputDocProof.GetVerificationMethod() didId, _ := types.SplitDidUrl(docProofVmId) @@ -210,7 +211,7 @@ func (k msgServer) VerifyDocumentProof(ctx sdk.Context, ssiMsg types.SsiMsg, inp // However, they are not allowed to be used for Authentication or Assertion purposes. Since, their corresponding values in the map // are empty string, the following check is in place. if types.VerificationKeySignatureMap[docVm.Type] == "" { - return fmt.Errorf("unsupported proof type: %v", docVm.Type) + return fmt.Errorf("proof type must be specified") } // Check if the Proof Type is correct @@ -225,12 +226,12 @@ func (k msgServer) VerifyDocumentProof(ctx sdk.Context, ssiMsg types.SsiMsg, inp } // Verify signature - signInfo := &types.SignInfo{ - VerificationMethodId: inputDocProof.GetVerificationMethod(), - Signature: inputDocProof.GetProofValue(), - ClientSpec: clientSpec, + documentProof := &types.DocumentProof{ + VerificationMethod: inputDocProof.GetVerificationMethod(), + ProofValue: inputDocProof.GetProofValue(), + ClientSpecType: inputDocProof.GetClientSpecType(), } - err = verification.VerifyDocumentProofSignature(ssiMsg, docVm, signInfo) + err = verification.VerifyDocumentProofSignature(ssiMsg, docVm, documentProof) if err != nil { return err } @@ -239,12 +240,31 @@ func (k msgServer) VerifyDocumentProof(ctx sdk.Context, ssiMsg types.SsiMsg, inp } // makeSignatureMap converts []SignInfo to map -func makeSignatureMap(inputSignatures []*types.SignInfo) map[string]*types.SignInfo { - var signMap map[string]*types.SignInfo = map[string]*types.SignInfo{} +func makeSignatureMap(inputSignatures []*types.DocumentProof) map[string]*types.DocumentProof { + var signMap map[string]*types.DocumentProof = map[string]*types.DocumentProof{} for _, sign := range inputSignatures { - signMap[sign.VerificationMethodId] = sign + signMap[sign.VerificationMethod] = sign } return signMap } + +// verifyCredentialMerkleRootHash verifies the MerkleRootHash of Credential Status +func verifyCredentialMerkleRootHash(credHash string) error { + decodedCredentialHash, err := hex.DecodeString(credHash) + if err != nil { + return fmt.Errorf("merkle root hash %v is an invalid hex string", credHash) + } + + if len(decodedCredentialHash) != 32 { + return fmt.Errorf( + "expected merkle root hash %v to be of length %v, got %v", + credHash, + 32, + len(credHash), + ) + } + + return nil +} diff --git a/x/ssi/keeper/msg_server_create_credential.go b/x/ssi/keeper/msg_server_create_credential.go new file mode 100644 index 0000000..ffd9db2 --- /dev/null +++ b/x/ssi/keeper/msg_server_create_credential.go @@ -0,0 +1,91 @@ +package keeper + +import ( + "context" + "fmt" + "time" + + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/hypersign-protocol/hid-node/x/ssi/types" + "github.com/hypersign-protocol/hid-node/x/ssi/verification" +) + +func (k msgServer) RegisterCredentialStatus(goCtx context.Context, msg *types.MsgRegisterCredentialStatus) (*types.MsgRegisterCredentialStatusResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + + msgCredStatus := msg.GetCredentialStatusDocument() + msgCredProof := msg.GetCredentialStatusProof() + + credId := msgCredStatus.GetId() + + chainNamespace := k.GetChainNamespace(&ctx) + + // Check the format of Credential Status ID + err := verification.IsValidID(credId, chainNamespace, "credDocument") + if err != nil { + return nil, sdkerrors.Wrap(types.ErrInvalidCredentialStatusID, err.Error()) + } + + // Check if the credential already exist in the store + if k.HasCredential(ctx, credId) { + return nil, types.ErrCredentialStatusExists + } + + // Check if the DID of the issuer exists + issuerId := msgCredStatus.GetIssuer() + if !k.HasDid(ctx, issuerId) { + return nil, sdkerrors.Wrap(sdkerrors.ErrKeyNotFound, fmt.Sprintf("Issuer`s DID %s doesnt exists", issuerId)) + } + + // Check if issuer's DID is deactivated + issuerDidDocument, err := k.GetDidDocumentState(&ctx, issuerId) + if err != nil { + return nil, sdkerrors.Wrap(types.ErrInvalidDidDoc, err.Error()) + } + if issuerDidDocument.DidDocumentMetadata.Deactivated { + return nil, sdkerrors.Wrap(types.ErrDidDocDeactivated, fmt.Sprintf("%s is deactivated and cannot used be used to register credential status", issuerDidDocument.DidDocument.Id)) + } + + issuanceDate := msgCredStatus.GetIssuanceDate() + issuanceDateParsed, err := time.Parse(time.RFC3339, issuanceDate) + if err != nil { + return nil, sdkerrors.Wrapf(types.ErrInvalidDate, fmt.Sprintf("invalid issuance date format: %s", issuanceDate)) + } + + // Check if the created date before issuance date + currentDate, _ := time.Parse(time.RFC3339, msgCredProof.Created) + if currentDate.Before(issuanceDateParsed) { + return nil, sdkerrors.Wrapf(types.ErrInvalidDate, "proof attached has a creation date before issuance date") + } + + // Validate Merkle Root Hash + if err := verifyCredentialMerkleRootHash(msgCredStatus.GetMerkleRootHash()); err != nil { + return nil, sdkerrors.Wrapf(types.ErrInvalidCredentialMerkleRootHash, err.Error()) + } + + // Validate Document Proof + if err := msgCredProof.Validate(); err != nil { + return nil, err + } + + // Verify Signature + err = k.VerifyDocumentProof(ctx, msgCredStatus, msgCredProof) + if err != nil { + return nil, sdkerrors.Wrapf(types.ErrInvalidSignature, err.Error()) + } + + cred := &types.CredentialStatusState{ + CredentialStatusDocument: msgCredStatus, + CredentialStatusProof: msgCredProof, + } + + k.SetCredentialStatusInState(ctx, cred) + + // Emit a successful Credential Status Registration event + ctx.EventManager().EmitEvent( + sdk.NewEvent("create_credential_status", sdk.NewAttribute("tx_author", msg.GetTxAuthor())), + ) + + return &types.MsgRegisterCredentialStatusResponse{}, nil +} diff --git a/x/ssi/keeper/msg_server_create_did.go b/x/ssi/keeper/msg_server_create_did.go index 4c0dfb0..769461a 100644 --- a/x/ssi/keeper/msg_server_create_did.go +++ b/x/ssi/keeper/msg_server_create_did.go @@ -8,16 +8,17 @@ import ( sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/hypersign-protocol/hid-node/x/ssi/types" "github.com/hypersign-protocol/hid-node/x/ssi/verification" + "github.com/hypersign-protocol/hid-node/x/ssi/utils" ) -// CreateDID is a RPC method for registration of a DID Document -func (k msgServer) CreateDID(goCtx context.Context, msg *types.MsgCreateDID) (*types.MsgCreateDIDResponse, error) { +// RegisterDID is a RPC method for registration of a DID Document +func (k msgServer) RegisterDID(goCtx context.Context, msg *types.MsgRegisterDID) (*types.MsgRegisterDIDResponse, error) { // Unwrap Go Context to Cosmos SDK Context ctx := sdk.UnwrapSDKContext(goCtx) // Get the RPC inputs - msgDidDocument := msg.DidDocString - msgSignatures := msg.Signatures + msgDidDocument := msg.DidDocument + msgDidDocumentProofs := msg.DidDocumentProofs // Validate DID Document if err := msgDidDocument.ValidateDidDocument(); err != nil { @@ -40,6 +41,13 @@ func (k msgServer) CreateDID(goCtx context.Context, msg *types.MsgCreateDID) (*t return nil, sdkerrors.Wrap(types.ErrDidDocExists, msgDidDocument.Id) } + // Validate Document Proofs + for _, proof := range msgDidDocumentProofs { + if err := proof.Validate(); err != nil { + return nil, err + } + } + // Check if any of the blockchainAccountId is present in any registered DID Document. If so, throw error for _, vm := range msgDidDocument.VerificationMethod { if vm.BlockchainAccountId != "" { @@ -69,7 +77,7 @@ func (k msgServer) CreateDID(goCtx context.Context, msg *types.MsgCreateDID) (*t } // Associate Signatures - signMap := makeSignatureMap(msgSignatures) + signMap := makeSignatureMap(msgDidDocumentProofs) requiredVmMap, err := k.formMustControllerVmListMap(ctx, controllerList, requiredVMs, signMap) if err != nil { @@ -92,7 +100,7 @@ func (k msgServer) CreateDID(goCtx context.Context, msg *types.MsgCreateDID) (*t } // Register DID Document in Store once all validation checks are passed - id := k.RegisterDidDocumentInStore(ctx, &didDocumentState) + k.RegisterDidDocumentInStore(ctx, &didDocumentState) // After successful registration of the DID Document, every blockchainAccountIds // can be added to the store @@ -104,10 +112,10 @@ func (k msgServer) CreateDID(goCtx context.Context, msg *types.MsgCreateDID) (*t // Emit a successful DID Document Registration event ctx.EventManager().EmitEvent( - sdk.NewEvent("create_did", sdk.NewAttribute("tx_author", msg.GetCreator())), + sdk.NewEvent("create_did", sdk.NewAttribute("tx_author", msg.GetTxAuthor())), ) - return &types.MsgCreateDIDResponse{Id: id}, nil + return &types.MsgRegisterDIDResponse{}, nil } // checkMethodSpecificIdOwnership validates the ownership of blockchain account id passed in the method specific @@ -143,7 +151,7 @@ func checkMethodSpecificIdOwnership(verificationMethods []*types.VerificationMet // getControllersForCreateDID returns a list of controller DIDs // from controller and verification method attributes -func getControllersForCreateDID(didDocument *types.Did) []string { +func getControllersForCreateDID(didDocument *types.DidDocument) []string { var controllerList []string // DID Subject is assumed to be the DID Controller if the controller list is empty @@ -161,7 +169,7 @@ func getControllersForCreateDID(didDocument *types.Did) []string { } // getVerificationMethodsForCreateDID fetches all the Verification Methods needed to be verified -func getVerificationMethodsForCreateDID(didDocument *types.Did) ([]*types.VerificationMethod, error) { +func getVerificationMethodsForCreateDID(didDocument *types.DidDocument) ([]*types.VerificationMethod, error) { var mustHaveVerificaitonMethods []*types.VerificationMethod = []*types.VerificationMethod{} var foundAtleastOneSubjectVM bool = false @@ -180,7 +188,7 @@ func getVerificationMethodsForCreateDID(didDocument *types.Did) ([]*types.Verifi mustHaveVerificaitonMethods = append(mustHaveVerificaitonMethods, vm) } - if !foundAtleastOneSubjectVM && types.FindInSlice(didDocument.Controller, didDocument.Id) { + if !foundAtleastOneSubjectVM && utils.FindInSlice(didDocument.Controller, didDocument.Id) { return nil, fmt.Errorf( "there should be atleast one verification method of DID Subject %v", didDocument.Id) } diff --git a/x/ssi/keeper/msg_server_credential.go b/x/ssi/keeper/msg_server_credential.go deleted file mode 100644 index ad7250d..0000000 --- a/x/ssi/keeper/msg_server_credential.go +++ /dev/null @@ -1,291 +0,0 @@ -package keeper - -import ( - "context" - "fmt" - "time" - - sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - "github.com/hypersign-protocol/hid-node/x/ssi/types" - "github.com/hypersign-protocol/hid-node/x/ssi/verification" -) - -func (k msgServer) RegisterCredentialStatus(goCtx context.Context, msg *types.MsgRegisterCredentialStatus) (*types.MsgRegisterCredentialStatusResponse, error) { - var id uint64 - - ctx := sdk.UnwrapSDKContext(goCtx) - - msgCredStatus := msg.GetCredentialStatus() - msgCredProof := msg.GetProof() - msgCredClientSpec := msg.GetClientSpec() - - credId := msgCredStatus.GetClaim().GetId() - - chainNamespace := k.GetChainNamespace(&ctx) - - // Check the format of Credential ID - err := verification.IsValidID(credId, chainNamespace, "credDocument") - if err != nil { - return nil, sdkerrors.Wrap(types.ErrInvalidSchemaID, err.Error()) - } - - // Check if the credential already exist in the store - if !k.HasCredential(ctx, credId) { - // Check for the correct credential status - credStatus := msgCredStatus.GetClaim().GetCurrentStatus() - if credStatus != "Live" { - return nil, sdkerrors.Wrap(types.ErrInvalidCredentialStatus, fmt.Sprintf("expected credential status to be `Live`, got %s", credStatus)) - } - - // Check if the DID of the issuer exists - issuerId := msgCredStatus.GetIssuer() - if !k.HasDid(ctx, issuerId) { - return nil, sdkerrors.Wrap(sdkerrors.ErrKeyNotFound, fmt.Sprintf("Issuer`s DID %s doesnt exists", issuerId)) - } - - // Check if issuer's DID is deactivated - issuerDidDocument, err := k.GetDidDocumentState(&ctx, issuerId) - if err != nil { - return nil, sdkerrors.Wrap(types.ErrInvalidDidDoc, err.Error()) - } - if issuerDidDocument.DidDocumentMetadata.Deactivated { - return nil, sdkerrors.Wrap(types.ErrDidDocDeactivated, fmt.Sprintf("%s is deactivated and cannot used be used to register credential status", issuerDidDocument.DidDocument.Id)) - } - - // Check if the expiration date is not before the issuance date. - expirationDate := msgCredStatus.GetExpirationDate() - expirationDateParsed, err := time.Parse(time.RFC3339, expirationDate) - if err != nil { - return nil, sdkerrors.Wrapf(types.ErrInvalidDate, fmt.Sprintf("invalid expiration date format: %s", expirationDate)) - } - - issuanceDate := msgCredStatus.GetIssuanceDate() - issuanceDateParsed, err := time.Parse(time.RFC3339, issuanceDate) - if err != nil { - return nil, sdkerrors.Wrapf(types.ErrInvalidDate, fmt.Sprintf("invalid issuance date format: %s", issuanceDate)) - } - - if err := verification.VerifyCredentialStatusDates(issuanceDateParsed, expirationDateParsed); err != nil { - return nil, sdkerrors.Wrapf(types.ErrInvalidCredentialField, err.Error()) - } - - // Check if updated date is similar to created date - if err := verification.VerifyCredentialProofDates(msgCredProof, true); err != nil { - return nil, sdkerrors.Wrapf(types.ErrInvalidCredentialField, err.Error()) - } - - // Check if the created date lies between issuance and expiration - currentDate, _ := time.Parse(time.RFC3339, msgCredProof.Created) - if currentDate.After(expirationDateParsed) || currentDate.Before(issuanceDateParsed) { - return nil, sdkerrors.Wrapf(types.ErrInvalidDate, "credential registeration is happening on a date which doesn`t lie between issuance date and expiration date") - } - - // Check the hash type of credentialHash - isValidCredentialHash := verification.VerifyCredentialHash(msgCredStatus.GetCredentialHash()) - if !isValidCredentialHash { - return nil, sdkerrors.Wrapf(types.ErrInvalidCredentialHash, "supported hashing algorithms: sha256") - } - - // Verify Signature - err = k.VerifyDocumentProof(ctx, msgCredStatus, msgCredProof, msgCredClientSpec) - if err != nil { - return nil, sdkerrors.Wrapf(types.ErrInvalidSignature, err.Error()) - } - - cred := &types.Credential{ - Claim: msgCredStatus.GetClaim(), - Issuer: msgCredStatus.GetIssuer(), - IssuanceDate: msgCredStatus.GetIssuanceDate(), - ExpirationDate: msgCredStatus.GetExpirationDate(), - CredentialHash: msgCredStatus.GetCredentialHash(), - Proof: msgCredProof, - } - - id = k.RegisterCredentialStatusInState(ctx, cred) - - // Emit a successful Credential Status Registration event - ctx.EventManager().EmitEvent( - sdk.NewEvent("create_credential_status", sdk.NewAttribute("tx_author", msg.GetCreator())), - ) - - } else { - cred, err := k.updateCredentialStatus(ctx, msg) - if err != nil { - return nil, err - } - id = k.RegisterCredentialStatusInState(ctx, cred) - } - - return &types.MsgRegisterCredentialStatusResponse{Id: id}, nil -} - -func (k msgServer) updateCredentialStatus(ctx sdk.Context, msg *types.MsgRegisterCredentialStatus) (*types.Credential, error) { - msgNewCredStatus := msg.CredentialStatus - msgNewCredProof := msg.Proof - msgNewCredClientSpec := msg.ClientSpec - - credId := msgNewCredStatus.GetClaim().GetId() - - // Get Credential from store - oldCredStatus, err := k.GetCredentialStatusFromState(&ctx, credId) - if err != nil { - return nil, sdkerrors.Wrap(types.ErrCredentialStatusNotFound, err.Error()) - } - - // Check if the DID of the issuer exists - issuerId := msgNewCredStatus.GetIssuer() - if !k.HasDid(ctx, issuerId) { - return nil, sdkerrors.Wrap(sdkerrors.ErrKeyNotFound, fmt.Sprintf("Issuer`s DID %s doesnt exists", issuerId)) - } - - // Check if issuer's DID is deactivated - issuerDidDocument, err := k.GetDidDocumentState(&ctx, issuerId) - if err != nil { - return nil, sdkerrors.Wrap(types.ErrDidDocNotFound, err.Error()) - } - if issuerDidDocument.DidDocumentMetadata.Deactivated { - return nil, sdkerrors.Wrap(types.ErrDidDocDeactivated, fmt.Sprintf("%s is deactivated and cannot used be used to register credential status", issuerDidDocument.DidDocument.Id)) - } - - // Check if the provided isser Id is the one who issued the VC - if issuerId != oldCredStatus.GetIssuer() { - return nil, sdkerrors.Wrapf(types.ErrInvalidCredentialField, - fmt.Sprintf("issuer id %s is not issuer of verifiable credential id %s", issuerId, credId)) - } - - // Check if the new expiration date and issuance date are same as old one. - newExpirationDate := msgNewCredStatus.GetExpirationDate() - newExpirationDateParsed, err := time.Parse(time.RFC3339, newExpirationDate) - if err != nil { - return nil, sdkerrors.Wrapf(types.ErrInvalidDate, fmt.Sprintf("invalid expiration date format: %s", newExpirationDate)) - } - - newIssuanceDate := msgNewCredStatus.GetIssuanceDate() - newIssuanceDateParsed, err := time.Parse(time.RFC3339, newIssuanceDate) - if err != nil { - return nil, sdkerrors.Wrapf(types.ErrInvalidDate, fmt.Sprintf("invalid issuance date format: %s", newIssuanceDate)) - } - - oldExpirationDateParsed, err := time.Parse(time.RFC3339, oldCredStatus.GetExpirationDate()) - if err != nil { - return nil, sdkerrors.Wrapf(types.ErrInvalidDate, fmt.Sprintf("invalid existing expiration date format: %s", oldCredStatus.GetExpirationDate())) - } - - oldIssuanceDateParsed, err := time.Parse(time.RFC3339, oldCredStatus.GetIssuanceDate()) - if err != nil { - return nil, sdkerrors.Wrapf(types.ErrInvalidDate, fmt.Sprintf("invalid existing issuance date format: %s", oldCredStatus.GetIssuanceDate())) - } - - if !newIssuanceDateParsed.Equal(oldIssuanceDateParsed) { - return nil, sdkerrors.Wrapf(types.ErrInvalidDate, fmt.Sprintf("issuance date should be same, new issuance date provided : %s", newIssuanceDate)) - } - - if !newExpirationDateParsed.Equal(oldExpirationDateParsed) { - return nil, sdkerrors.Wrapf(types.ErrInvalidDate, fmt.Sprintf("expiration date should be same, new expiration date provided : %s", newExpirationDate)) - } - - // Check if new expiration date isn't less than new issuance date - if err := verification.VerifyCredentialStatusDates(newIssuanceDateParsed, newExpirationDateParsed); err != nil { - return nil, sdkerrors.Wrap(types.ErrInvalidCredentialField, err.Error()) - } - - // Check if updated date iss imilar to created date - if err := verification.VerifyCredentialProofDates(msgNewCredProof, false); err != nil { - return nil, sdkerrors.Wrap(types.ErrInvalidCredentialField, err.Error()) - } - - // Check if the created date lies between issuance and expiration - currentDate, _ := time.Parse(time.RFC3339, msgNewCredProof.Created) - if currentDate.After(newExpirationDateParsed) || currentDate.Before(newIssuanceDateParsed) { - return nil, sdkerrors.Wrapf(types.ErrInvalidDate, "credential update is happening on a date which doesn`t lie between issuance date and expiration date") - } - - // Check for the correct credential status - oldClaimStatus := oldCredStatus.GetClaim().GetCurrentStatus() - newClaimStatus := msgNewCredStatus.GetClaim().GetCurrentStatus() - statusFound := 0 - for _, acceptablestatus := range verification.GetAcceptedCredentialClaimStatuses() { - if newClaimStatus == acceptablestatus { - statusFound = 1 - } - } - if statusFound == 0 { - return nil, sdkerrors.Wrap( - types.ErrInvalidCredentialStatus, - fmt.Sprintf("unsupported credential claim status %s", newClaimStatus)) - } - - // Old and New Credential Claim Check - - // Reject manual status change to Expired - if newClaimStatus == verification.ClaimStatus_expired { - return nil, sdkerrors.Wrapf( - types.ErrInvalidCredentialStatus, - "claim status cannot be manually changed to Expired") - } - - switch oldClaimStatus { - case verification.ClaimStatus_live: - switch newClaimStatus { - case verification.ClaimStatus_live: - return nil, sdkerrors.Wrapf( - types.ErrInvalidCredentialStatus, - fmt.Sprintf("credential claim status is already %s", newClaimStatus)) - case verification.ClaimStatus_suspended, verification.ClaimStatus_revoked: - newStatusReason := msgNewCredStatus.GetClaim().GetStatusReason() - if len(newStatusReason) == 0 { - return nil, sdkerrors.Wrapf( - types.ErrInvalidCredentialStatus, - "claim status reason cannot be empty", - ) - } - } - - case verification.ClaimStatus_suspended: - switch newClaimStatus { - case verification.ClaimStatus_live, verification.ClaimStatus_revoked: - newStatusReason := msgNewCredStatus.GetClaim().GetStatusReason() - if len(newStatusReason) == 0 { - return nil, sdkerrors.Wrapf( - types.ErrInvalidCredentialStatus, - "claim status reason cannot be empty", - ) - } - case verification.ClaimStatus_suspended: - return nil, sdkerrors.Wrapf( - types.ErrInvalidCredentialStatus, - fmt.Sprintf("credential claim status is already %s", newClaimStatus)) - } - - case verification.ClaimStatus_revoked, verification.ClaimStatus_expired: - if newClaimStatus == oldClaimStatus { - return nil, sdkerrors.Wrapf( - types.ErrInvalidCredentialStatus, - fmt.Sprintf("credential claim status is already %s", newClaimStatus)) - } - - if newClaimStatus != oldClaimStatus { - return nil, sdkerrors.Wrapf( - types.ErrInvalidCredentialStatus, - fmt.Sprintf("credential claim status cannot be updated from %s to %s", oldClaimStatus, newClaimStatus)) - } - } - - // Verify Signature - err = k.VerifyDocumentProof(ctx, msgNewCredStatus, msgNewCredProof, msgNewCredClientSpec) - if err != nil { - return nil, sdkerrors.Wrap(types.ErrInvalidSignature, err.Error()) - } - - cred := types.Credential{ - Claim: msgNewCredStatus.GetClaim(), - Issuer: msgNewCredStatus.GetIssuer(), - IssuanceDate: msgNewCredStatus.GetIssuanceDate(), - ExpirationDate: msgNewCredStatus.GetExpirationDate(), - CredentialHash: msgNewCredStatus.GetCredentialHash(), - Proof: msgNewCredProof, - } - - return &cred, nil -} diff --git a/x/ssi/keeper/msg_server_deactivate_did.go b/x/ssi/keeper/msg_server_deactivate_did.go index ed3c664..0d5f8c7 100644 --- a/x/ssi/keeper/msg_server_deactivate_did.go +++ b/x/ssi/keeper/msg_server_deactivate_did.go @@ -17,14 +17,21 @@ func (k msgServer) DeactivateDID(goCtx context.Context, msg *types.MsgDeactivate ctx := sdk.UnwrapSDKContext(goCtx) // Get the RPC inputs - msgDidId := msg.DidId - msgSignatures := msg.Signatures + msgDidId := msg.DidDocumentId + msgDidDocumentProofs := msg.DidDocumentProofs // Checks if the Did Document is already registered if !k.HasDid(ctx, msgDidId) { return nil, sdkerrors.Wrap(types.ErrDidDocNotFound, msgDidId) } + // Validate Document Proofs + for _, proof := range msgDidDocumentProofs { + if err := proof.Validate(); err != nil { + return nil, err + } + } + // Get the DID Document from state didDocumentState, err := k.GetDidDocumentState(&ctx, msgDidId) if err != nil { @@ -54,7 +61,7 @@ func (k msgServer) DeactivateDID(goCtx context.Context, msg *types.MsgDeactivate return nil, sdkerrors.Wrap(types.ErrInvalidDidDoc, err.Error()) } - signMap := makeSignatureMap(msgSignatures) + signMap := makeSignatureMap(msgDidDocumentProofs) // Get controller VM map controllerMap, err := k.formAnyControllerVmListMap(ctx, controllers, @@ -92,11 +99,11 @@ func (k msgServer) DeactivateDID(goCtx context.Context, msg *types.MsgDeactivate } } - return &types.MsgDeactivateDIDResponse{Id: 1}, nil + return &types.MsgDeactivateDIDResponse{}, nil } // getControllersForDeactivateDID returns a list of controllers required for Deactivate DID Operation -func getControllersForDeactivateDID(didDocument *types.Did) []string { +func getControllersForDeactivateDID(didDocument *types.DidDocument) []string { var controllers []string = []string{} // If the controller list is empty, DID Subject is assumed to be the sole controller of DID Document diff --git a/x/ssi/keeper/msg_server_schema.go b/x/ssi/keeper/msg_server_schema.go index 88120be..1bb3bb9 100644 --- a/x/ssi/keeper/msg_server_schema.go +++ b/x/ssi/keeper/msg_server_schema.go @@ -3,7 +3,6 @@ package keeper import ( "context" "fmt" - "time" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" @@ -11,80 +10,76 @@ import ( "github.com/hypersign-protocol/hid-node/x/ssi/verification" ) -func (k msgServer) CreateSchema(goCtx context.Context, msg *types.MsgCreateSchema) (*types.MsgCreateSchemaResponse, error) { +func storeCredentialSchema( + k msgServer, + goCtx context.Context, + schemaDoc *types.CredentialSchemaDocument, + schemaProof *types.DocumentProof, + txAuthor string, + msgTypeUrl string, +) error { ctx := sdk.UnwrapSDKContext(goCtx) - - schemaDoc := msg.GetSchemaDoc() - schemaProof := msg.GetSchemaProof() + schemaID := schemaDoc.GetId() - schemaClientSpec := msg.GetClientSpec() - chainNamespace := k.GetChainNamespace(&ctx) - // Get the Did Document of Schema's Author - authorDidDocument, err := k.GetDidDocumentState(&ctx, schemaDoc.GetAuthor()) - if err != nil { - return nil, sdkerrors.Wrap(err, fmt.Sprintf("unable to get author`s DID %s from store", schemaDoc.GetAuthor())) - } - // Check if author's DID is deactivated - if authorDidDocument.DidDocumentMetadata.Deactivated { - return nil, sdkerrors.Wrap(types.ErrDidDocDeactivated, fmt.Sprintf("%s is deactivated and cannot used be used to create schema", authorDidDocument.DidDocument.Id)) + // Validate Document Proof + if err := schemaProof.Validate(); err != nil { + return err } - // Check if Schema ID is valid - err = verification.IsValidID(schemaID, chainNamespace, "schemaDocument") + // Get the Did Document of Schema's Author and check if Author's DID is deactivated + authorDidDocumentState, err := k.GetDidDocumentState(&ctx, schemaDoc.GetAuthor()) if err != nil { - return nil, sdkerrors.Wrap(types.ErrInvalidSchemaID, err.Error()) + return sdkerrors.Wrap(err, fmt.Sprintf("unable to get author`s DID %s from store", schemaDoc.GetAuthor())) } - - // Check if Schema already exists - if k.HasSchema(ctx, schemaID) { - return nil, sdkerrors.Wrap(types.ErrSchemaExists, fmt.Sprintf("Schema ID: %s", schemaID)) + if authorDidDocumentState.DidDocumentMetadata.Deactivated { + return sdkerrors.Wrap(types.ErrDidDocDeactivated, fmt.Sprintf("%s is deactivated and cannot used be used to create schema", authorDidDocumentState.DidDocument.Id)) } - // Check proper date syntax for `authored` and `created` - blockTime := ctx.BlockTime() - - authoredDate := schemaDoc.GetAuthored() - authoredDateParsed, err := time.Parse(time.RFC3339, authoredDate) - if err != nil { - return nil, sdkerrors.Wrapf(types.ErrInvalidDate, fmt.Sprintf("invalid authored date format: %s", authoredDateParsed)) - } - if authoredDateParsed.After(blockTime) { - return nil, sdkerrors.Wrapf(types.ErrInvalidDate, "authored date provided shouldn't be greater than the current block time") + // Check if Schema ID is valid + if err := verification.IsValidID(schemaID, chainNamespace, "schemaDocument"); err != nil { + return sdkerrors.Wrap(types.ErrInvalidSchemaID, err.Error()) } - createdDate := schemaProof.GetCreated() - createdDateParsed, err := time.Parse(time.RFC3339, createdDate) - if err != nil { - return nil, sdkerrors.Wrapf(types.ErrInvalidDate, fmt.Sprintf("invalid created date format: %s", createdDateParsed)) - } - if createdDateParsed.After(blockTime) { - return nil, sdkerrors.Wrapf(types.ErrInvalidDate, "created date provided shouldn't be greater than the current block time") + // Check if Schema already exists + if k.HasSchema(ctx, schemaID) { + return sdkerrors.Wrap(types.ErrSchemaExists, fmt.Sprintf("Schema ID: %s", schemaID)) } // Signature check - if err := k.VerifyDocumentProof(ctx, schemaDoc, schemaProof, schemaClientSpec); err != nil { - return nil, sdkerrors.Wrap(types.ErrInvalidClientSpecType, err.Error()) + if err := k.VerifyDocumentProof(ctx, schemaDoc, schemaProof); err != nil { + return sdkerrors.Wrap(types.ErrInvalidClientSpecType, err.Error()) } - var schema = types.Schema{ - Type: schemaDoc.GetType(), - ModelVersion: schemaDoc.GetModelVersion(), - Id: schemaDoc.GetId(), - Name: schemaDoc.GetName(), - Author: schemaDoc.GetAuthor(), - Authored: schemaDoc.GetAuthored(), - Schema: schemaDoc.GetSchema(), - Proof: schemaProof, + var schema = types.CredentialSchemaState{ + CredentialSchemaDocument: schemaDoc, + CredentialSchemaProof: schemaProof, } - id := k.RegisterSchemaInStore(ctx, schema) + k.setCredentialSchemaInStore(ctx, schema) // Emit a successful Schema Registration event ctx.EventManager().EmitEvent( - sdk.NewEvent("create_schema", sdk.NewAttribute("tx_author", msg.GetCreator())), + sdk.NewEvent(msgTypeUrl, sdk.NewAttribute("tx_author", txAuthor)), ) - return &types.MsgCreateSchemaResponse{Id: id}, nil + return nil +} + +func (k msgServer) RegisterCredentialSchema(goCtx context.Context, msg *types.MsgRegisterCredentialSchema) (*types.MsgRegisterCredentialSchemaResponse, error) { + if err := storeCredentialSchema(k, goCtx, msg.CredentialSchemaDocument, msg.CredentialSchemaProof, msg.TxAuthor, msg.Type()); err != nil { + return nil, err + } + + return &types.MsgRegisterCredentialSchemaResponse{}, nil +} + +func (k msgServer) UpdateCredentialSchema(goCtx context.Context, msg *types.MsgUpdateCredentialSchema) (*types.MsgUpdateCredentialSchemaResponse, error) { + if err := storeCredentialSchema(k, goCtx, msg.CredentialSchemaDocument, msg.CredentialSchemaProof, msg.TxAuthor, msg.Type()); err != nil { + return nil, err + } + + return &types.MsgUpdateCredentialSchemaResponse{}, nil } + diff --git a/x/ssi/keeper/msg_server_update_credential.go b/x/ssi/keeper/msg_server_update_credential.go new file mode 100644 index 0000000..8e16d6b --- /dev/null +++ b/x/ssi/keeper/msg_server_update_credential.go @@ -0,0 +1,100 @@ +package keeper + +import ( + "context" + "fmt" + "time" + + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/hypersign-protocol/hid-node/x/ssi/types" +) + +func (k msgServer) UpdateCredentialStatus(goCtx context.Context, msg *types.MsgUpdateCredentialStatus) (*types.MsgUpdateCredentialStatusResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + + msgNewCredStatus := msg.GetCredentialStatusDocument() + msgNewCredProof := msg.GetCredentialStatusProof() + + credId := msgNewCredStatus.GetId() + + // Get Credential from store + oldCredStatusState, err := k.GetCredentialStatusFromState(&ctx, credId) + if err != nil { + return nil, sdkerrors.Wrap(types.ErrCredentialStatusNotFound, err.Error()) + } + oldCredStatus := oldCredStatusState.CredentialStatusDocument + + // Check if the DID of the issuer exists + issuerId := msgNewCredStatus.GetIssuer() + if !k.HasDid(ctx, issuerId) { + return nil, sdkerrors.Wrap(sdkerrors.ErrKeyNotFound, fmt.Sprintf("Issuer`s DID %s doesnt exists", issuerId)) + } + + // Check if issuer's DID is deactivated + issuerDidDocument, err := k.GetDidDocumentState(&ctx, issuerId) + if err != nil { + return nil, sdkerrors.Wrap(types.ErrDidDocNotFound, err.Error()) + } + if issuerDidDocument.DidDocumentMetadata.Deactivated { + return nil, sdkerrors.Wrap(types.ErrDidDocDeactivated, fmt.Sprintf("%s is deactivated and cannot used be used to register credential status", issuerDidDocument.DidDocument.Id)) + } + + // Check if the provided isser Id is the one who issued the VC + if issuerId != oldCredStatus.GetIssuer() { + return nil, sdkerrors.Wrapf(types.ErrInvalidCredentialField, + fmt.Sprintf("issuer id %s is not issuer of verifiable credential id %s", issuerId, credId)) + } + + // Check if the credential is already revoked + if oldCredStatus.Revoked { + return nil, sdkerrors.Wrapf(types.ErrInvalidCredentialStatus, "credential status %v could not be updated since it is revoked", oldCredStatus.Id) + } + + // Check if the new issuance date are same as old one. + newIssuanceDate := msgNewCredStatus.GetIssuanceDate() + newIssuanceDateParsed, err := time.Parse(time.RFC3339, newIssuanceDate) + if err != nil { + return nil, sdkerrors.Wrapf(types.ErrInvalidDate, fmt.Sprintf("invalid issuance date format: %s", newIssuanceDate)) + } + + oldIssuanceDateParsed, err := time.Parse(time.RFC3339, oldCredStatus.GetIssuanceDate()) + if err != nil { + return nil, sdkerrors.Wrapf(types.ErrInvalidDate, fmt.Sprintf("invalid existing issuance date format: %s", oldCredStatus.GetIssuanceDate())) + } + + if !newIssuanceDateParsed.Equal(oldIssuanceDateParsed) { + return nil, sdkerrors.Wrapf(types.ErrInvalidDate, fmt.Sprintf("issuance date should be same, new issuance date provided : %s", newIssuanceDate)) + } + + // Validate Merkle Root Hash + if err := verifyCredentialMerkleRootHash(msgNewCredStatus.GetMerkleRootHash()); err != nil { + return nil, sdkerrors.Wrapf(types.ErrInvalidCredentialMerkleRootHash, err.Error()) + } + + // Check if the created date before issuance date + currentDate, _ := time.Parse(time.RFC3339, msgNewCredProof.Created) + if currentDate.Before(newIssuanceDateParsed) { + return nil, sdkerrors.Wrapf(types.ErrInvalidDate, "proof attached has a creation date before issuance date") + } + + // Validate Document Proof + if err := msgNewCredProof.Validate(); err != nil { + return nil, err + } + + // Verify Signature + err = k.VerifyDocumentProof(ctx, msgNewCredStatus, msgNewCredProof) + if err != nil { + return nil, sdkerrors.Wrap(types.ErrInvalidSignature, err.Error()) + } + + cred := types.CredentialStatusState{ + CredentialStatusDocument: msgNewCredStatus, + CredentialStatusProof: msgNewCredProof, + } + + k.SetCredentialStatusInState(ctx, &cred) + + return &types.MsgUpdateCredentialStatusResponse{}, nil +} diff --git a/x/ssi/keeper/msg_server_update_did.go b/x/ssi/keeper/msg_server_update_did.go index 09d8af1..4c8e251 100644 --- a/x/ssi/keeper/msg_server_update_did.go +++ b/x/ssi/keeper/msg_server_update_did.go @@ -17,8 +17,8 @@ func (k msgServer) UpdateDID(goCtx context.Context, msg *types.MsgUpdateDID) (*t ctx := sdk.UnwrapSDKContext(goCtx) // Get the RPC inputs - msgDidDocument := msg.DidDocString - msgSignatures := msg.Signatures + msgDidDocument := msg.DidDocument + msgDidDocumentProofs := msg.DidDocumentProofs // Validate DID Document if err := msgDidDocument.ValidateDidDocument(); err != nil { @@ -36,6 +36,13 @@ func (k msgServer) UpdateDID(goCtx context.Context, msg *types.MsgUpdateDID) (*t return nil, sdkerrors.Wrap(types.ErrDidDocNotFound, msgDidDocument.Id) } + // Verify Document Proofs + for _, proof := range msgDidDocumentProofs { + if err := proof.Validate(); err != nil { + return nil, err + } + } + // Fetch registered Did Document from state existingDidDocumentState, err := k.GetDidDocumentState(&ctx, msgDidDocument.Id) if err != nil { @@ -63,7 +70,7 @@ func (k msgServer) UpdateDID(goCtx context.Context, msg *types.MsgUpdateDID) (*t return nil, sdkerrors.Wrap(types.ErrUnexpectedDidVersion, errMsg) } - signMap := makeSignatureMap(msgSignatures) + signMap := makeSignatureMap(msgDidDocumentProofs) // Check if there is any change in controllers var optionalVmMap map[string][]*types.ExtendedVerificationMethod @@ -191,13 +198,13 @@ func (k msgServer) UpdateDID(goCtx context.Context, msg *types.MsgUpdateDID) (*t k.SetBlockchainAddressInStore(&ctx, vm.BlockchainAccountId, vm.Controller) } - return &types.MsgUpdateDIDResponse{UpdateId: msgDidDocument.Id}, nil + return &types.MsgUpdateDIDResponse{}, nil } // getControllersForUpdateDID returns two lists of controllers. The first parameter is a list of controllers, // where every controller needs to be verified. The second parameter is a list of controllers, where atleast one // of the controllers require verification. -func getControllersForUpdateDID(existingDidDoc *types.Did, incomingDidDoc *types.Did) ([]string, []string) { +func getControllersForUpdateDID(existingDidDoc *types.DidDocument, incomingDidDoc *types.DidDocument) ([]string, []string) { var mandatoryControllers []string = []string{} var anyControllers []string = []string{} diff --git a/x/ssi/keeper/schema.go b/x/ssi/keeper/store_credential_schema.go similarity index 71% rename from x/ssi/keeper/schema.go rename to x/ssi/keeper/store_credential_schema.go index 43fd2cf..0ce01a3 100644 --- a/x/ssi/keeper/schema.go +++ b/x/ssi/keeper/store_credential_schema.go @@ -41,34 +41,34 @@ func (k Keeper) SetSchemaCount(ctx sdk.Context, count uint64) { store.Set(byteKey, bz) } -func (k Keeper) RegisterSchemaInStore(ctx sdk.Context, schema types.Schema) uint64 { +func (k Keeper) setCredentialSchemaInStore(ctx sdk.Context, schema types.CredentialSchemaState) { // Get the current number of Schemas in the store count := k.GetSchemaCount(ctx) // Get the store store := prefix.NewStore(ctx.KVStore(k.storeKey), []byte(types.SchemaKey)) // Marshal the Schema into bytes schemaBytes := k.cdc.MustMarshal(&schema) - store.Set([]byte(schema.Id), schemaBytes) + store.Set([]byte(schema.GetCredentialSchemaDocument().GetId()), schemaBytes) // Update the Schema count k.SetSchemaCount(ctx, count+1) - return count } -// Get the schema from store -func (k Keeper) GetSchemaFromStore(ctx sdk.Context, querySchemaId string) []*types.Schema { +// Get Credential Schema from Store +func (k Keeper) getCredentialSchemaFromStore(ctx sdk.Context, credentialSchemaId string) ([]*types.CredentialSchemaState, error) { store := prefix.NewStore(ctx.KVStore(k.storeKey), []byte(types.SchemaKey)) var versionNumLengthWithColon int = 4 - var schemas []*types.Schema + var credentialSchemas []*types.CredentialSchemaState iterator := sdk.KVStorePrefixIterator(store, []byte{}) for ; iterator.Valid(); iterator.Next() { - var schema types.Schema - k.cdc.MustUnmarshal(iterator.Value(), &schema) + var credentialSchema types.CredentialSchemaState + k.cdc.MustUnmarshal(iterator.Value(), &credentialSchema) - if querySchemaId == schema.Id[0:len(schema.Id)-versionNumLengthWithColon] || querySchemaId == schema.Id { - schemas = append(schemas, &schema) + storedSchemaId := credentialSchema.CredentialSchemaDocument.Id + if credentialSchemaId == storedSchemaId[0:len(storedSchemaId)-versionNumLengthWithColon] || credentialSchemaId == storedSchemaId { + credentialSchemas = append(credentialSchemas, &credentialSchema) } } - return schemas + return credentialSchemas, nil } diff --git a/x/ssi/keeper/credential.go b/x/ssi/keeper/store_credential_status.go similarity index 56% rename from x/ssi/keeper/credential.go rename to x/ssi/keeper/store_credential_status.go index bdda5fe..c8ef40d 100644 --- a/x/ssi/keeper/credential.go +++ b/x/ssi/keeper/store_credential_status.go @@ -3,29 +3,27 @@ package keeper import ( "encoding/binary" "fmt" - "time" "github.com/cosmos/cosmos-sdk/store/prefix" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/hypersign-protocol/hid-node/x/ssi/types" ) -func (k Keeper) RegisterCredentialStatusInState(ctx sdk.Context, cred *types.Credential) uint64 { +func (k Keeper) SetCredentialStatusInState(ctx sdk.Context, cred *types.CredentialStatusState) { count := k.GetCredentialStatusCount(ctx) store := prefix.NewStore(ctx.KVStore(k.storeKey), []byte(types.CredKey)) - id := cred.GetClaim().GetId() + id := cred.CredentialStatusDocument.Id credBytes := k.cdc.MustMarshal(cred) store.Set([]byte(id), credBytes) k.SetCredentialStatusCount(ctx, count+1) - return count } -func (k Keeper) GetCredentialStatusFromState(ctx *sdk.Context, id string) (*types.Credential, error) { +func (k Keeper) GetCredentialStatusFromState(ctx *sdk.Context, id string) (*types.CredentialStatusState, error) { store := prefix.NewStore(ctx.KVStore(k.storeKey), []byte(types.CredKey)) - var cred types.Credential + var cred types.CredentialStatusState var bytes = store.Get([]byte(id)) if len(bytes) == 0 { return nil, fmt.Errorf("credential status document %s not found", id) @@ -61,36 +59,3 @@ func (k Keeper) SetCredentialStatusCount(ctx sdk.Context, count uint64) { binary.BigEndian.PutUint64(bz, count) store.Set(byteKey, bz) } - -// Invoked during BeginBlock, it checks the block time against credential -// expiration date. If the expiration date is past current block time, the status -// of the credential(s) are set to `Expired`. -func (k Keeper) SetCredentialStatusToExpired(ctx sdk.Context) error { - store := prefix.NewStore(ctx.KVStore(k.storeKey), []byte(types.CredKey)) - iterator := sdk.KVStorePrefixIterator(store, []byte{}) - defer iterator.Close() - - for ; iterator.Valid(); iterator.Next() { - var cred types.Credential - if err := k.cdc.Unmarshal(iterator.Value(), &cred); err != nil { - return err - } - - currentBlockTime := ctx.BlockTime() - expirationDate, err := time.Parse(time.RFC3339, cred.GetExpirationDate()) - if err != nil { - return err - } - - // Set the Credential Status to Expired - if currentBlockTime.After(expirationDate) { - cred.Claim.CurrentStatus = "Expired" - cred.Claim.StatusReason = "Credential Expired" - cred.Proof.Updated = currentBlockTime.Format(time.RFC3339) - - updatedCredBytes := k.cdc.MustMarshal(&cred) - store.Set([]byte(cred.Claim.Id), updatedCredBytes) - } - } - return nil -} diff --git a/x/ssi/keeper/did.go b/x/ssi/keeper/store_did_document.go similarity index 98% rename from x/ssi/keeper/did.go rename to x/ssi/keeper/store_did_document.go index 7ceb89b..c8b58a7 100644 --- a/x/ssi/keeper/did.go +++ b/x/ssi/keeper/store_did_document.go @@ -3,7 +3,7 @@ package keeper import ( "encoding/binary" "fmt" - + "github.com/cosmos/cosmos-sdk/store/prefix" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/hypersign-protocol/hid-node/utils" @@ -78,16 +78,15 @@ func (k Keeper) UpdateDidDocumentInStore(ctx sdk.Context, didDoc types.DidDocume } // Creates record for a new DID Document -func (k Keeper) RegisterDidDocumentInStore(ctx sdk.Context, didDoc *types.DidDocumentState) uint64 { +func (k Keeper) RegisterDidDocumentInStore(ctx sdk.Context, didDoc *types.DidDocumentState) { didCount := k.GetDidCount(ctx) store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.DidKey)) idBytes := []byte(didDoc.GetDidDocument().GetId()) didDocBytes := k.cdc.MustMarshal(didDoc) - + store.Set(idBytes, didDocBytes) k.SetDidCount(ctx, didCount+1) - return didCount } // Set the BlockchainAccountId in Store diff --git a/x/ssi/ld-context/context.go b/x/ssi/ld-context/context.go index 6b4f83e..a46d820 100644 --- a/x/ssi/ld-context/context.go +++ b/x/ssi/ld-context/context.go @@ -1,16 +1,16 @@ package ldcontext -const didContext string = "https://www.w3.org/ns/did/v1" -const ed25519Context2020 string = "https://w3id.org/security/suites/ed25519-2020/v1" -const x25519KeyAgreement2020Context string = "https://ns.did.ai/suites/x25519-2020/v1" -const secp256k1Recovery2020Context string = "https://ns.did.ai/suites/secp256k1-2020/v1" -const bbsSignature2020Context string = "https://ns.did.ai/suites/bls12381-2020/v1" -const secp256k12019Context string = "https://ns.did.ai/suites/secp256k1-2019/v1" +const DidContext string = "https://www.w3.org/ns/did/v1" +const Ed25519Context2020 string = "https://w3id.org/security/suites/ed25519-2020/v1" +const X25519KeyAgreement2020Context string = "https://ns.did.ai/suites/x25519-2020/v1" +const Secp256k1Recovery2020Context string = "https://ns.did.ai/suites/secp256k1-2020/v1" +const BbsSignature2020Context string = "https://ns.did.ai/suites/bls12381-2020/v1" +const Secp256k12019Context string = "https://ns.did.ai/suites/secp256k1-2019/v1" // As hid-node is not supposed to perform any GET request, the complete Context body of their // respective Context urls has been maintained below. var ContextUrlMap map[string]contextObject = map[string]contextObject{ - didContext: { + DidContext: { "@protected": true, "id": "@id", "type": "@type", @@ -65,7 +65,7 @@ var ContextUrlMap map[string]contextObject = map[string]contextObject{ "@type": "@id", }, }, - ed25519Context2020: { + Ed25519Context2020: { "id": "@id", "type": "@type", "@protected": true, @@ -156,7 +156,7 @@ var ContextUrlMap map[string]contextObject = map[string]contextObject{ }, }, }, - x25519KeyAgreement2020Context: { + X25519KeyAgreement2020Context: { "id": "@id", "type": "@type", "@protected": true, @@ -181,7 +181,7 @@ var ContextUrlMap map[string]contextObject = map[string]contextObject{ }, }, }, - secp256k1Recovery2020Context: { + Secp256k1Recovery2020Context: { "id": "@id", "type": "@type", "@protected": true, @@ -362,7 +362,7 @@ var ContextUrlMap map[string]contextObject = map[string]contextObject{ }, }, }, - bbsSignature2020Context: { + BbsSignature2020Context: { "@version": 1.1, "id": "@id", "type": "@type", @@ -509,7 +509,7 @@ var ContextUrlMap map[string]contextObject = map[string]contextObject{ }, }, }, - secp256k12019Context: { + Secp256k12019Context: { "id": "@id", "type": "@type", "@protected": true, diff --git a/x/ssi/ld-context/normalize.go b/x/ssi/ld-context/normalize.go index 074f1f8..785fc40 100644 --- a/x/ssi/ld-context/normalize.go +++ b/x/ssi/ld-context/normalize.go @@ -6,7 +6,7 @@ import ( // NormalizeByVerificationMethodType canonizes DID Document based on the input Verification // Method type -func NormalizeByVerificationMethodType(didDoc *types.Did, vmType string) ([]byte, error) { +func NormalizeByVerificationMethodType(didDoc *types.DidDocument, vmType string) ([]byte, error) { switch vmType { case types.Ed25519VerificationKey2020: didDocBytes, err := EdDSACryptoSuite2020Canonize(didDoc) diff --git a/x/ssi/ld-context/suite.go b/x/ssi/ld-context/suite.go index 1c1b18a..fb620ad 100644 --- a/x/ssi/ld-context/suite.go +++ b/x/ssi/ld-context/suite.go @@ -8,7 +8,7 @@ import ( // EdDSACryptoSuite2020Canonize canonizes DID Document in accordance with // EdDSA Cryptosuite v2020 (https://www.w3.org/community/reports/credentials/CG-FINAL-di-eddsa-2020-20220724/) -func EdDSACryptoSuite2020Canonize(didDoc *types.Did) ([]byte, error) { +func EdDSACryptoSuite2020Canonize(didDoc *types.DidDocument) ([]byte, error) { jsonLdDid := NewJsonLdDid(didDoc) canonizedDidDocument, err := jsonLdDid.NormalizeWithURDNA2015() if err != nil { @@ -22,7 +22,7 @@ func EdDSACryptoSuite2020Canonize(didDoc *types.Did) ([]byte, error) { // the Identity Foundation draft on EcdsaSecp256k1RecoverySignature2020 // Read more: https://identity.foundation/EcdsaSecp256k1RecoverySignature2020/ // LD Context: https://ns.did.ai/suites/secp256k1-2020/v1 -func EcdsaSecp256k1RecoverySignature2020Canonize(didDoc *types.Did) ([]byte, error) { +func EcdsaSecp256k1RecoverySignature2020Canonize(didDoc *types.DidDocument) ([]byte, error) { jsonLdDid := NewJsonLdDid(didDoc) canonizedDidDocument, err := jsonLdDid.NormalizeWithURDNA2015() if err != nil { @@ -35,7 +35,7 @@ func EcdsaSecp256k1RecoverySignature2020Canonize(didDoc *types.Did) ([]byte, err // BbsBlsSignature2020Canonize canonizes the DID Document for the // BbsBlsSignature2020 signature type -func BbsBlsSignature2020Canonize(didDoc *types.Did) ([]byte, error) { +func BbsBlsSignature2020Canonize(didDoc *types.DidDocument) ([]byte, error) { jsonLdDid := NewJsonLdDid(didDoc) canonizedDidDocument, err := jsonLdDid.NormalizeWithURDNA2015() if err != nil { @@ -49,13 +49,12 @@ func BbsBlsSignature2020Canonize(didDoc *types.Did) ([]byte, error) { // EcdsaSecp256k1Signature2019Canonize canonizes the DID Document for the // EcdsaSecp256k1Signature2019 signature type -func EcdsaSecp256k1Signature2019Canonize(didDoc *types.Did) ([]byte, error) { +func EcdsaSecp256k1Signature2019Canonize(didDoc *types.DidDocument) ([]byte, error) { jsonLdDid := NewJsonLdDid(didDoc) canonizedDidDocument, err := jsonLdDid.NormalizeWithURDNA2015() if err != nil { return nil, err } - canonizedDidDocumentHash := sha256.Sum256([]byte(canonizedDidDocument)) return canonizedDidDocumentHash[:], nil } diff --git a/x/ssi/ld-context/types.go b/x/ssi/ld-context/types.go index 2985532..6409389 100644 --- a/x/ssi/ld-context/types.go +++ b/x/ssi/ld-context/types.go @@ -28,7 +28,7 @@ type JsonLdDid struct { } // NewJsonLdDid returns a new JsonLdDid struct from input Did -func NewJsonLdDid(didDoc *types.Did) *JsonLdDid { +func NewJsonLdDid(didDoc *types.DidDocument) *JsonLdDid { if len(didDoc.Context) == 0 { panic("atleast one context url must be provided for DID Document for Canonization") } diff --git a/x/ssi/module.go b/x/ssi/module.go index f4e68fc..8f4c966 100644 --- a/x/ssi/module.go +++ b/x/ssi/module.go @@ -172,7 +172,6 @@ func (AppModule) ConsensusVersion() uint64 { return 2 } // BeginBlock executes all ABCI BeginBlock logic respective to the capability module. func (am AppModule) BeginBlock(ctx sdk.Context, _ abci.RequestBeginBlock) { - BeginBlocker(ctx, am.keeper) } // EndBlock executes all ABCI EndBlock logic respective to the capability module. It diff --git a/x/ssi/tests/README.md b/x/ssi/tests/README.md deleted file mode 100644 index c164e8d..0000000 --- a/x/ssi/tests/README.md +++ /dev/null @@ -1,19 +0,0 @@ -# Running Tests - -To run all SSI related tests: - -``` -go test -v -count=1 "./x/ssi/tests" -``` - -If you want to run a single unit test of a particular test file (say `TestVerificationMethodRotation()`): - -``` -go test -v -count=1 -run "^TestVerificationMethodRotation$" "./x/ssi/tests" -``` - -To run multiple tests: - -``` -go test -v -count=1 -run ^(TestDidResolve|TestDidParam)$ "./x/ssi/tests" -``` diff --git a/x/ssi/tests/common.go b/x/ssi/tests/common.go deleted file mode 100644 index 309f1c3..0000000 --- a/x/ssi/tests/common.go +++ /dev/null @@ -1,301 +0,0 @@ -package tests - -import ( - "context" - "crypto/ed25519" - "crypto/rand" - "crypto/sha256" - "encoding/base64" - "encoding/hex" - "strings" - - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/hypersign-protocol/hid-node/x/ssi/keeper" - "github.com/hypersign-protocol/hid-node/x/ssi/types" - "github.com/multiformats/go-multibase" - secp256k1 "github.com/tendermint/tendermint/crypto/secp256k1" -) - -func getDidSigningInfo(didDoc *types.Did, signingElements []DidSigningElements) []*types.SignInfo { - var signingInfos []*types.SignInfo - - for i := 0; i < len(signingElements); i++ { - signature := SignGeneric(signingElements[i].keyPair, didDoc.GetSignBytes()) - signingInfos = append(signingInfos, &types.SignInfo{ - VerificationMethodId: signingElements[i].vmId, - Signature: base64.StdEncoding.EncodeToString(signature), - }) - } - return signingInfos -} - -func UpdateCredStatus(newStatus string, credRpcElem CredRpcElements, keyPair ed25519KeyPair) CredRpcElements { - credRpcElem.Status.Claim.CurrentStatus = newStatus - credRpcElem.Status.Claim.StatusReason = "Status changed for Testing" - credRpcElem.Proof.Updated = "2022-05-12T00:00:00Z" - - updatedSignature := base64.StdEncoding.EncodeToString( - ed25519.Sign(keyPair.privateKey, credRpcElem.Status.GetSignBytes()), - ) - - credRpcElem.Proof.ProofValue = updatedSignature - - return credRpcElem -} - -func GetModifiedDidDocumentSignature(modifiedDidDocument *types.Did, keyPair ed25519KeyPair, verificationMethodId string) DidRpcElements { - var signingElements []DidSigningElements - - signingElements = append(signingElements, - DidSigningElements{ - keyPair: keyPair, - vmId: verificationMethodId, - }) - - var signatures []*types.SignInfo = getDidSigningInfo( - modifiedDidDocument, - signingElements, - ) - - return DidRpcElements{ - DidDocument: modifiedDidDocument, - Signatures: signatures, - Creator: Creator, - } -} - -func GenerateDidDocumentRPCElements(keyPair GenericKeyPair, signingElements []DidSigningElements) DidRpcElements { - publicKey, optionalID := GetPublicKeyAndOptionalID(keyPair) - var didId string - if optionalID == "" { - didId = "did:" + DidMethod + ":" + ChainNamespace + ":" + publicKey - } else { - didId = "did:" + DidMethod + ":" + ChainNamespace + ":" + optionalID - } - - var verificationMethodId string = didId + "#" + "key-1" - - var vmType string - switch keyPair.(type) { - case ed25519KeyPair: - vmType = types.Ed25519VerificationKey2020 - case secp256k1KeyPair: - vmType = types.EcdsaSecp256k1VerificationKey2019 - } - - var vm = &types.VerificationMethod{ - Id: verificationMethodId, - Type: vmType, - Controller: didId, - PublicKeyMultibase: publicKey, - } - - var service *types.Service = &types.Service{ - Id: didId + "#" + "linkedDomains", - Type: "LinkedDomains", - ServiceEndpoint: "http://www.example.com", - } - - var controllers []string - if len(signingElements) > 0 { - for i := 0; i < len(signingElements); i++ { - controllers = append( - controllers, - stripDidFromVerificationMethod(signingElements[i].vmId)) - } - } else { - signingElements = []DidSigningElements{ - { - keyPair: keyPair, - vmId: vm.Id, - }, - } - controllers = []string{didId} - } - - var didDocument *types.Did = &types.Did{ - Context: []string{ - "https://www.w3.org/ns/did/v1", - }, - Id: didId, - Controller: controllers, - VerificationMethod: []*types.VerificationMethod{ - vm, - }, - Service: []*types.Service{ - service, - }, - Authentication: []string{verificationMethodId}, - AssertionMethod: []string{verificationMethodId}, - } - - var signInfo []*types.SignInfo = getDidSigningInfo(didDocument, signingElements) - - return DidRpcElements{ - DidDocument: didDocument, - Signatures: signInfo, - Creator: Creator, - } -} - -func GenerateSchemaDocumentRPCElements(keyPair GenericKeyPair, authorId string, verficationMethodId string) SchemaRpcElements { - var schemaId string = "sch:" + DidMethod + ":" + "devnet" + ":" + strings.Split(authorId, ":")[3] + ":1.0" - var schemaDocument *types.SchemaDocument = &types.SchemaDocument{ - Type: "https://w3c-ccg.github.io/vc-json-schemas/schema/1.0/schema.json", - ModelVersion: "v1.0", - Name: "HS Credential", - Author: authorId, - Id: schemaId, - Authored: "2022-04-10T04:07:12Z", - Schema: &types.SchemaProperty{ - Schema: "https://json-schema.org/draft-07/schema#", - Description: "test", - Type: "Object", - Properties: "{myString:{type:string}}", - Required: []string{"myString"}, - AdditionalProperties: false, - }, - } - - var schemaDocumentSignature string = base64.StdEncoding.EncodeToString( - SignGeneric(keyPair, schemaDocument.GetSignBytes()), - ) - - var proofType string - switch keyPair.(type) { - case ed25519KeyPair: - proofType = types.VerificationKeySignatureMap["Ed25519VerificationKey2020"] - case secp256k1KeyPair: - proofType = types.VerificationKeySignatureMap["EcdsaSecp256k1VerificationKey2019"] - } - - var schemaProof *types.SchemaProof = &types.SchemaProof{ - Type: proofType, - Created: "2022-04-10T04:07:12Z", - VerificationMethod: verficationMethodId, - ProofValue: schemaDocumentSignature, - ProofPurpose: "assertionMethod", - } - - return SchemaRpcElements{ - SchemaDocument: schemaDocument, - SchemaProof: schemaProof, - Creator: Creator, - } -} - -func GenerateCredStatusRPCElements(keyPair GenericKeyPair, issuerId string, verficationMethod *types.VerificationMethod) CredRpcElements { - var credentialId = "vc:" + DidMethod + ":" + "devnet:" + strings.Split(issuerId, ":")[3] - var credHash = sha256.Sum256([]byte("Hash1234")) - var credentialStatus *types.CredentialStatus = &types.CredentialStatus{ - Claim: &types.Claim{ - Id: credentialId, - CurrentStatus: "Live", - StatusReason: "Valid", - }, - Issuer: issuerId, - IssuanceDate: "2022-04-10T04:07:12Z", - ExpirationDate: "2023-02-22T13:45:55Z", - CredentialHash: hex.EncodeToString(credHash[:]), - } - - var credentialStatusSignature string = base64.StdEncoding.EncodeToString( - SignGeneric(keyPair, credentialStatus.GetSignBytes()), - ) - - var proofType string - switch keyPair.(type) { - case ed25519KeyPair: - proofType = types.VerificationKeySignatureMap["Ed25519VerificationKey2020"] - case secp256k1KeyPair: - proofType = types.VerificationKeySignatureMap["EcdsaSecp256k1VerificationKey2019"] - } - - var credentialProof *types.CredentialProof = &types.CredentialProof{ - Type: proofType, - Created: "2022-04-10T04:07:12Z", - Updated: "2022-04-10T04:07:12Z", - VerificationMethod: verficationMethod.Id, - ProofValue: credentialStatusSignature, - ProofPurpose: "assertionMethod", - } - - return CredRpcElements{ - Status: credentialStatus, - Proof: credentialProof, - Creator: Creator, - } -} - -func GenerateEd25519KeyPair() ed25519KeyPair { - publicKey, privateKey, err := ed25519.GenerateKey(rand.Reader) - if err != nil { - panic(err) - } - - publicKeyBase58Encoded, err := multibase.Encode(multibase.Base58BTC, publicKey) - if err != nil { - panic("Error while encoding multibase string") - } - - return ed25519KeyPair{ - publicKey: publicKeyBase58Encoded, - privateKey: privateKey, - } -} - -func GenerateSecp256k1KeyPair() secp256k1KeyPair { - privateKey := secp256k1.GenPrivKey() - - publicKey := privateKey.PubKey().Bytes() - - publicKeyMultibase, err := multibase.Encode(multibase.Base58BTC, publicKey) - if err != nil { - panic("Error while encoding multibase string") - } - return secp256k1KeyPair{ - publicKey: publicKeyMultibase, - privateKey: &privateKey, - } -} - -func CreateDidTx(msgServer types.MsgServer, ctx context.Context, keyPair ed25519KeyPair) (string, error) { - rpcElements := GenerateDidDocumentRPCElements(keyPair, []DidSigningElements{}) - - msgCreateDID := &types.MsgCreateDID{ - DidDocString: rpcElements.DidDocument, - Signatures: rpcElements.Signatures, - Creator: rpcElements.Creator, - } - - _, err := msgServer.CreateDID(ctx, msgCreateDID) - if err != nil { - return "", err - } - - return rpcElements.DidDocument.Id, nil -} - -func UpdateDidTx(msgServer types.MsgServer, ctx context.Context, rpcElements DidRpcElements, versionId string) error { - msgUpdateDID := &types.MsgUpdateDID{ - DidDocString: rpcElements.DidDocument, - Signatures: rpcElements.Signatures, - Creator: rpcElements.Creator, - VersionId: versionId, - } - - _, err := msgServer.UpdateDID(ctx, msgUpdateDID) - if err != nil { - return err - } - return nil -} - -func QueryDid(k *keeper.Keeper, ctx sdk.Context, Id string) *types.DidDocumentState { - resolvedDidDocument, errResolve := k.GetDidDocumentState(&ctx, Id) - if errResolve != nil { - panic(errResolve) - } - - return resolvedDidDocument -} diff --git a/x/ssi/tests/constants.go b/x/ssi/tests/constants.go deleted file mode 100644 index 2326a80..0000000 --- a/x/ssi/tests/constants.go +++ /dev/null @@ -1,5 +0,0 @@ -package tests - -const Creator = "hid1kxqk5ejca8nfpw8pg47484rppv359xh7qcasy4" -const DidMethod = "hid" -const ChainNamespace = "devnet" diff --git a/x/ssi/tests/query_credential_test.go b/x/ssi/tests/query_credential_test.go deleted file mode 100644 index ce51f72..0000000 --- a/x/ssi/tests/query_credential_test.go +++ /dev/null @@ -1,158 +0,0 @@ -package tests - -import ( - "testing" - "time" - - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/hypersign-protocol/hid-node/x/ssi/keeper" - "github.com/hypersign-protocol/hid-node/x/ssi/types" - "github.com/stretchr/testify/assert" -) - -func TestQueryCredential(t *testing.T) { - t.Log("Running test for QueryCredential (Query)") - k, ctx := TestKeeper(t) - msgServer := keeper.NewMsgServerImpl(*k) - goCtx := sdk.WrapSDKContext(ctx) - - k.SetChainNamespace(&ctx, "devnet") - - keyPair1 := GenerateEd25519KeyPair() - didRpcElements := GenerateDidDocumentRPCElements(keyPair1, []DidSigningElements{}) - didId := didRpcElements.DidDocument.GetId() - t.Logf("Registering DID with DID Id: %s", didId) - - msgCreateDID := &types.MsgCreateDID{ - DidDocString: didRpcElements.DidDocument, - Signatures: didRpcElements.Signatures, - Creator: didRpcElements.Creator, - } - - _, errCreateDID := msgServer.CreateDID(goCtx, msgCreateDID) - if errCreateDID != nil { - t.Error("DID Registeration Failed") - t.Log(didRpcElements.DidDocument.Id) - t.Error(errCreateDID) - t.FailNow() - } - - t.Log("Did Registeration Successful") - - credRpcElements := GenerateCredStatusRPCElements( - keyPair1, - didRpcElements.DidDocument.Id, - didRpcElements.DidDocument.VerificationMethod[0], - ) - - msgRegisterCredentialStatus := &types.MsgRegisterCredentialStatus{ - CredentialStatus: credRpcElements.Status, - Proof: credRpcElements.Proof, - Creator: Creator, - } - credId := credRpcElements.Status.GetClaim().GetId() - t.Logf("Registering Credential Status with Id: %s", credId) - - t.Logf("Block Time: %s", ctx.BlockTime().Format(time.RFC3339)) - - _, errCredStatus := msgServer.RegisterCredentialStatus(goCtx, msgRegisterCredentialStatus) - if errCredStatus != nil { - t.Error("Credential Status Registeration Failed") - t.Error(errCredStatus) - t.FailNow() - } - t.Log("Credential Status Registeration Successful") - - t.Log("Querying the Credential Status from store") - - req := &types.QueryCredentialRequest{ - CredId: credId, - } - - res, errResponse := k.QueryCredential(goCtx, req) - if errResponse != nil { - t.Error("Credential Status Resolve Failed") - t.Error(errResponse) - t.FailNow() - } - t.Log("Querying successful") - - // To check if queried Schema Document is not nil - assert.NotNil(t, res.CredStatus) - - t.Log("QueryCredential Test Completed") -} - -func TestQueryCredentials(t *testing.T) { - t.Log("Running test for QueryCredentials (Query)") - k, ctx := TestKeeper(t) - msgServer := keeper.NewMsgServerImpl(*k) - goCtx := sdk.WrapSDKContext(ctx) - - k.SetChainNamespace(&ctx, "devnet") - - keyPair1 := GenerateEd25519KeyPair() - didRpcElements := GenerateDidDocumentRPCElements(keyPair1, []DidSigningElements{}) - didId := didRpcElements.DidDocument.GetId() - t.Logf("Registering DID with DID Id: %s", didId) - - msgCreateDID := &types.MsgCreateDID{ - DidDocString: didRpcElements.DidDocument, - Signatures: didRpcElements.Signatures, - Creator: didRpcElements.Creator, - } - - _, errCreateDID := msgServer.CreateDID(goCtx, msgCreateDID) - if errCreateDID != nil { - t.Error("DID Registeration Failed") - t.Error(errCreateDID) - t.FailNow() - } - - t.Log("Did Registeration Successful") - - credRpcElements := GenerateCredStatusRPCElements( - keyPair1, - didRpcElements.DidDocument.Id, - didRpcElements.DidDocument.VerificationMethod[0], - ) - - msgRegisterCredentialStatus := &types.MsgRegisterCredentialStatus{ - CredentialStatus: credRpcElements.Status, - Proof: credRpcElements.Proof, - Creator: Creator, - } - credId := credRpcElements.Status.GetClaim().GetId() - t.Logf("Registering Credential Status with Id: %s", credId) - - t.Logf("Block Time: %s", ctx.BlockTime().Format(time.RFC3339)) - - _, errCredStatus := msgServer.RegisterCredentialStatus(goCtx, msgRegisterCredentialStatus) - if errCredStatus != nil { - t.Error("Credential Status Registeration Failed") - t.Error(errCredStatus) - t.FailNow() - } - t.Log("Credential Status Registeration Successful") - - t.Log("Querying list of Credential Statuses from store") - - req := &types.QueryCredentialsRequest{} - - res, errResponse := k.QueryCredentials(goCtx, req) - if errResponse != nil { - t.Error("Credential Status Resolve Failed") - t.Error(errResponse) - t.FailNow() - } - t.Log("Querying successful") - - // Schema Document Count should't be zero - assert.NotEqual(t, "0", res.TotalCount) - // List should be populated with a single Schema Document - assert.Equal(t, 1, len(res.Credentials)) - // Schema Document shouldnt be nil - assert.NotNil(t, res.Credentials[0]) - - t.Log("QueryCredentials Test Completed") -} diff --git a/x/ssi/tests/query_did_test.go b/x/ssi/tests/query_did_test.go deleted file mode 100644 index e8f4363..0000000 --- a/x/ssi/tests/query_did_test.go +++ /dev/null @@ -1,107 +0,0 @@ -package tests - -import ( - "testing" - - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/hypersign-protocol/hid-node/x/ssi/keeper" - "github.com/hypersign-protocol/hid-node/x/ssi/types" - "github.com/stretchr/testify/assert" -) - -func TestQueryDidDocument(t *testing.T) { - t.Log("Running test for QueryDidDocument (Query)") - k, ctx := TestKeeper(t) - msgServer := keeper.NewMsgServerImpl(*k) - goCtx := sdk.WrapSDKContext(ctx) - - k.SetChainNamespace(&ctx, "devnet") - - keyPair1 := GenerateEd25519KeyPair() - rpcElements := GenerateDidDocumentRPCElements(keyPair1, []DidSigningElements{}) - didId := rpcElements.DidDocument.GetId() - t.Logf("Registering DID with DID Id: %s", didId) - - msgCreateDID := &types.MsgCreateDID{ - DidDocString: rpcElements.DidDocument, - Signatures: rpcElements.Signatures, - Creator: rpcElements.Creator, - } - - _, errCreateDID := msgServer.CreateDID(goCtx, msgCreateDID) - if errCreateDID != nil { - t.Error("DID Registeration Failed") - t.Log(rpcElements.DidDocument.Id) - t.Error(errCreateDID) - t.FailNow() - } - - t.Log("Did Registeration Successful") - t.Log("Querying the DID from store") - - req := &types.QueryDidDocumentRequest{ - DidId: didId, - } - - res, errResponse := k.QueryDidDocument(goCtx, req) - if errResponse != nil { - t.Error("Did Resolve Failed") - t.Error(errResponse) - t.FailNow() - } - t.Log("Querying successful") - // To check if queried Did Document is not nil - assert.NotNil(t, res.DidDocument) - t.Log("Did Resolve Test Completed") -} - -func TestQueryDidDocuments(t *testing.T) { - t.Log("Running test for QueryDocuments (Query)") - k, ctx := TestKeeper(t) - msgServer := keeper.NewMsgServerImpl(*k) - goCtx := sdk.WrapSDKContext(ctx) - - k.SetChainNamespace(&ctx, "devnet") - - keyPair1 := GenerateEd25519KeyPair() - rpcElements := GenerateDidDocumentRPCElements(keyPair1, []DidSigningElements{}) - didId := rpcElements.DidDocument.GetId() - t.Logf("Registering DID with DID Id: %s", didId) - - msgCreateDID := &types.MsgCreateDID{ - DidDocString: rpcElements.DidDocument, - Signatures: rpcElements.Signatures, - Creator: rpcElements.Creator, - } - - _, errCreateDID := msgServer.CreateDID(goCtx, msgCreateDID) - if errCreateDID != nil { - t.Error("DID Registeration Failed") - t.Log(rpcElements.DidDocument.Id) - t.Error(errCreateDID) - t.FailNow() - } - - t.Log("Did Registeration Successful") - t.Log("Querying the list of Did Documents") - - req := &types.QueryDidDocumentsRequest{} - - res, errResponse := k.QueryDidDocuments(goCtx, req) - if errResponse != nil { - t.Error("Did Resolve Failed") - t.Error(errResponse) - t.FailNow() - } - - t.Log("Querying successful") - - // Did Document Count should't be zero - assert.NotEqual(t, "0", res.TotalDidCount) - // List should be populated with a single Did Document - assert.Equal(t, 1, len(res.DidDocList)) - // Did Document shouldnt be nil - assert.NotNil(t, res.DidDocList[0].DidDocument) - - t.Log("Did Param Test Completed") -} diff --git a/x/ssi/tests/query_schema_test.go b/x/ssi/tests/query_schema_test.go deleted file mode 100644 index b8c46d0..0000000 --- a/x/ssi/tests/query_schema_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package tests - -import ( - "testing" - - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/hypersign-protocol/hid-node/x/ssi/keeper" - "github.com/hypersign-protocol/hid-node/x/ssi/types" - "github.com/stretchr/testify/assert" -) - -func TestQuerySchema(t *testing.T) { - t.Log("Running test for QuerySchema (Query)") - k, ctx := TestKeeper(t) - msgServer := keeper.NewMsgServerImpl(*k) - goCtx := sdk.WrapSDKContext(ctx) - - k.SetChainNamespace(&ctx, "devnet") - - keyPair1 := GenerateEd25519KeyPair() - rpcElements := GenerateDidDocumentRPCElements(keyPair1, []DidSigningElements{}) - didId := rpcElements.DidDocument.GetId() - t.Logf("Registering DID with DID Id: %s", didId) - - msgCreateDID := &types.MsgCreateDID{ - DidDocString: rpcElements.DidDocument, - Signatures: rpcElements.Signatures, - Creator: rpcElements.Creator, - } - - _, errCreateDID := msgServer.CreateDID(goCtx, msgCreateDID) - if errCreateDID != nil { - t.Error("DID Registeration Failed") - t.Log(rpcElements.DidDocument.Id) - t.Error(errCreateDID) - t.FailNow() - } - - t.Log("Did Registeration Successful") - - t.Log("Registering Schema") - schemaRpcElements := GenerateSchemaDocumentRPCElements( - keyPair1, - rpcElements.DidDocument.Id, - rpcElements.DidDocument.AssertionMethod[0], - ) - - msgCreateSchema := &types.MsgCreateSchema{ - SchemaDoc: schemaRpcElements.SchemaDocument, - SchemaProof: schemaRpcElements.SchemaProof, - Creator: schemaRpcElements.Creator, - } - - _, errCreateSchema := msgServer.CreateSchema(goCtx, msgCreateSchema) - if errCreateSchema != nil { - t.Error("Schema Registeration Failed") - t.Error(errCreateSchema) - t.FailNow() - } - t.Log("Schema Registered Successfully") - - t.Log("Querying the Schema from store") - - req := &types.QuerySchemaRequest{ - SchemaId: schemaRpcElements.SchemaDocument.GetId(), - } - - res, errResponse := k.QuerySchema(goCtx, req) - if errResponse != nil { - t.Error("Schema Resolve Failed") - t.Error(errResponse) - t.FailNow() - } - t.Log("Querying successful") - - // To check if queried Schema Document is not nil - assert.NotNil(t, res.Schema) - - t.Log("GetSchema Test Completed") -} - -func TestQuerySchemas(t *testing.T) { - t.Log("Running test for QuerySchemas (Query)") - k, ctx := TestKeeper(t) - msgServer := keeper.NewMsgServerImpl(*k) - goCtx := sdk.WrapSDKContext(ctx) - - k.SetChainNamespace(&ctx, "devnet") - - keyPair1 := GenerateEd25519KeyPair() - rpcElements := GenerateDidDocumentRPCElements(keyPair1, []DidSigningElements{}) - didId := rpcElements.DidDocument.GetId() - t.Logf("Registering DID with DID Id: %s", didId) - - msgCreateDID := &types.MsgCreateDID{ - DidDocString: rpcElements.DidDocument, - Signatures: rpcElements.Signatures, - Creator: rpcElements.Creator, - } - - _, errCreateDID := msgServer.CreateDID(goCtx, msgCreateDID) - if errCreateDID != nil { - t.Error("DID Registeration Failed") - t.Error(errCreateDID) - t.FailNow() - } - - t.Log("Did Registeration Successful") - - t.Log("Registering Schema") - schemaRpcElements := GenerateSchemaDocumentRPCElements( - keyPair1, - rpcElements.DidDocument.Id, - rpcElements.DidDocument.AssertionMethod[0], - ) - - msgCreateSchema := &types.MsgCreateSchema{ - SchemaDoc: schemaRpcElements.SchemaDocument, - SchemaProof: schemaRpcElements.SchemaProof, - Creator: schemaRpcElements.Creator, - } - - _, errCreateSchema := msgServer.CreateSchema(goCtx, msgCreateSchema) - if errCreateSchema != nil { - t.Error("Schema Registeration Failed") - t.Error(errCreateSchema) - t.FailNow() - } - t.Log("Schema Registered Successfully") - - t.Log("Querying the list of Schema Documents") - - req := &types.QuerySchemasRequest{} - - res, errResponse := k.QuerySchemas(goCtx, req) - if errResponse != nil { - t.Error("Schema List Resolve Failed") - t.Error(errResponse) - t.FailNow() - } - - t.Log("Querying successful") - - // Schema Document Count should't be zero - assert.NotEqual(t, "0", res.TotalCount) - // List should be populated with a single Schema Document - assert.Equal(t, 1, len(res.SchemaList)) - // Schema Document shouldnt be nil - assert.NotNil(t, res.SchemaList[0]) - - t.Log("SchemaParam Test Completed") -} diff --git a/x/ssi/tests/setup.go b/x/ssi/tests/setup.go deleted file mode 100644 index 3f5028f..0000000 --- a/x/ssi/tests/setup.go +++ /dev/null @@ -1,55 +0,0 @@ -package tests - -import ( - "testing" - "time" - - "github.com/cosmos/cosmos-sdk/codec" - codectypes "github.com/cosmos/cosmos-sdk/codec/types" - "github.com/cosmos/cosmos-sdk/store" - storetypes "github.com/cosmos/cosmos-sdk/store/types" - sdk "github.com/cosmos/cosmos-sdk/types" - typesparams "github.com/cosmos/cosmos-sdk/x/params/types" - "github.com/hypersign-protocol/hid-node/x/ssi/keeper" - "github.com/hypersign-protocol/hid-node/x/ssi/types" - "github.com/stretchr/testify/require" - "github.com/tendermint/tendermint/libs/log" - tmproto "github.com/tendermint/tendermint/proto/tendermint/types" - tmdb "github.com/tendermint/tm-db" -) - -func TestKeeper(t testing.TB) (*keeper.Keeper, sdk.Context) { - storeKey := sdk.NewKVStoreKey(types.StoreKey) - memStoreKey := storetypes.NewMemoryStoreKey(types.MemStoreKey) - - db := tmdb.NewMemDB() - stateStore := store.NewCommitMultiStore(db) - stateStore.MountStoreWithDB(storeKey, sdk.StoreTypeIAVL, db) - stateStore.MountStoreWithDB(memStoreKey, sdk.StoreTypeMemory, nil) - require.NoError(t, stateStore.LoadLatestVersion()) - - registry := codectypes.NewInterfaceRegistry() - cdc := codec.NewProtoCodec(registry) - - paramsSubspace := typesparams.NewSubspace(cdc, - types.Amino, - storeKey, - memStoreKey, - "SsiParams", - ) - k := keeper.NewKeeper( - cdc, - storeKey, - memStoreKey, - paramsSubspace, - ) - - blockTime, _ := time.Parse(time.RFC3339, "2022-05-10T00:00:00Z") - ctx := sdk.NewContext(stateStore, - tmproto.Header{ - ChainID: "hidnode", - Time: blockTime, - }, false, log.NewNopLogger()) - - return k, ctx -} diff --git a/x/ssi/tests/tx_create_did_test.go b/x/ssi/tests/tx_create_did_test.go deleted file mode 100644 index d5f68d6..0000000 --- a/x/ssi/tests/tx_create_did_test.go +++ /dev/null @@ -1,184 +0,0 @@ -package tests - -import ( - "testing" - - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/hypersign-protocol/hid-node/x/ssi/keeper" - "github.com/hypersign-protocol/hid-node/x/ssi/types" -) - -func TestCreateDIDUsingEd25519KeyPair(t *testing.T) { - t.Log("Running test for Valid Create DID Tx") - k, ctx := TestKeeper(t) - msgServer := keeper.NewMsgServerImpl(*k) - goCtx := sdk.WrapSDKContext(ctx) - - k.SetChainNamespace(&ctx, "devnet") - - keyPair1 := GenerateEd25519KeyPair() - rpcElements := GenerateDidDocumentRPCElements(keyPair1, []DidSigningElements{}) - t.Logf("Registering DID with DID Id: %s", rpcElements.DidDocument.GetId()) - - msgCreateDID := &types.MsgCreateDID{ - DidDocString: rpcElements.DidDocument, - Signatures: rpcElements.Signatures, - Creator: rpcElements.Creator, - } - - _, err := msgServer.CreateDID(goCtx, msgCreateDID) - if err != nil { - t.Error("DID Registeration Failed") - t.Error(err) - t.FailNow() - } - t.Log("Did Registeration Successful") - - t.Log("Create DID Tx Test Completed") -} - -func TestCreateDIDUsingSecp256k1KeyPair(t *testing.T) { - t.Log("Create DID with Secp256k1") - - k, ctx := TestKeeper(t) - msgServer := keeper.NewMsgServerImpl(*k) - goCtx := sdk.WrapSDKContext(ctx) - - k.SetChainNamespace(&ctx, "devnet") - - keyPair1 := GenerateSecp256k1KeyPair() - rpcElements := GenerateDidDocumentRPCElements(keyPair1, []DidSigningElements{}) - - msgCreateDID := &types.MsgCreateDID{ - DidDocString: rpcElements.DidDocument, - Signatures: rpcElements.Signatures, - Creator: rpcElements.Creator, - } - t.Logf("Signature in base64: %v", msgCreateDID.Signatures[0].Signature) - _, err := msgServer.CreateDID(goCtx, msgCreateDID) - if err != nil { - t.Error("DID Registeration Failed") - t.Error(err) - t.FailNow() - } - t.Log("Did Registeration Successful") - - t.Log("Create DID Tx Test Completed") -} - -func TestInvalidServiceType(t *testing.T) { - t.Log("Running test for Invalid Service Type") - k, ctx := TestKeeper(t) - msgServer := keeper.NewMsgServerImpl(*k) - goCtx := sdk.WrapSDKContext(ctx) - - keyPair1 := GenerateEd25519KeyPair() - rpcElements := GenerateDidDocumentRPCElements(keyPair1, []DidSigningElements{}) - // Set Namespace - k.SetChainNamespace(&ctx, "devnet") - - // Changing Service Type from "LinkedDomains" to "DIDComm" which is not supported type - invalidServiceType := "DIDComm" - rpcElements.DidDocument.Service[0].Type = invalidServiceType - - updatedRpcElements := GetModifiedDidDocumentSignature( - rpcElements.DidDocument, - keyPair1, - rpcElements.DidDocument.VerificationMethod[0].Id, - ) - t.Logf("Registering DID with DID Id: %s", rpcElements.DidDocument.GetId()) - - msgCreateDID := &types.MsgCreateDID{ - DidDocString: updatedRpcElements.DidDocument, - Signatures: updatedRpcElements.Signatures, - Creator: rpcElements.Creator, - } - - _, err := msgServer.CreateDID(goCtx, msgCreateDID) - if err == nil { - t.Error("DID Document Registeration was expected to fail, as the service type provided was invalid") - t.FailNow() - } - - t.Log("Test Completed") -} - -func TestCheckValidMethodSpecificId(t *testing.T) { - t.Log("Running test to check valid method-specific Id") - - didIdValidMethodSpecificId := "hid17kuuyfz5pq2raapxet3t06c2f0xxd4yesa5we2" - didIdInvalidMethodSpecificId1 := "abc2322222" - didIdInvalidMethodSpecificId2 := "abc_2322222" - - k, ctx := TestKeeper(t) - msgServer := keeper.NewMsgServerImpl(*k) - goCtx := sdk.WrapSDKContext(ctx) - // Set Namespace - k.SetChainNamespace(&ctx, "devnet") - - keyPair1 := GenerateEd25519KeyPair() - keyPair1.optionalID = didIdValidMethodSpecificId - - keyPair2 := GenerateSecp256k1KeyPair() - keyPair2.optionalID = didIdInvalidMethodSpecificId1 - - keyPair3 := GenerateEd25519KeyPair() - keyPair3.optionalID = didIdInvalidMethodSpecificId2 - - var rpcElements DidRpcElements - var msgCreateDID *types.MsgCreateDID - - t.Log("Registering DID Document with Valid Method Specific ID") - - rpcElements = GenerateDidDocumentRPCElements(keyPair1, []DidSigningElements{}) - msgCreateDID = &types.MsgCreateDID{ - DidDocString: rpcElements.DidDocument, - Signatures: rpcElements.Signatures, - Creator: rpcElements.Creator, - } - - _, err := msgServer.CreateDID(goCtx, msgCreateDID) - if err != nil { - t.Error("DID Registeration Failed") - t.Error(err) - t.FailNow() - } - t.Log("DID Document Registeration with Valid Method Specific Id is successful") - - t.Logf("Registering DID Document with Invalid Method Specific ID - %s", keyPair2.optionalID) - - rpcElements = GenerateDidDocumentRPCElements(keyPair2, []DidSigningElements{}) - msgCreateDID = &types.MsgCreateDID{ - DidDocString: rpcElements.DidDocument, - Signatures: rpcElements.Signatures, - Creator: rpcElements.Creator, - } - - _, err = msgServer.CreateDID(goCtx, msgCreateDID) - if err == nil { - t.Error("DID Registeration was intended to fail, but it did not") - t.Error(err) - t.FailNow() - } - - t.Logf("DID Document Registeration with invalid method specific id - %s failed as expected", keyPair2.optionalID) - - t.Logf("Registering DID Document with Invalid Method Specific ID - %s", keyPair3.optionalID) - - rpcElements = GenerateDidDocumentRPCElements(keyPair3, []DidSigningElements{}) - msgCreateDID = &types.MsgCreateDID{ - DidDocString: rpcElements.DidDocument, - Signatures: rpcElements.Signatures, - Creator: rpcElements.Creator, - } - - _, err = msgServer.CreateDID(goCtx, msgCreateDID) - if err == nil { - t.Error("DID Registeration was intended to fail, but it did not") - t.Error(err) - t.FailNow() - } - - t.Logf("DID Document Registeration with invalid method specific id - %s failed as expected", keyPair3.optionalID) - -} diff --git a/x/ssi/tests/tx_create_schema_test.go b/x/ssi/tests/tx_create_schema_test.go deleted file mode 100644 index b9d666b..0000000 --- a/x/ssi/tests/tx_create_schema_test.go +++ /dev/null @@ -1,59 +0,0 @@ -package tests - -import ( - "testing" - - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/hypersign-protocol/hid-node/x/ssi/keeper" - "github.com/hypersign-protocol/hid-node/x/ssi/types" -) - -func TestCreateSchema(t *testing.T) { - t.Log("Running test for Valid Create Schmea Tx") - k, ctx := TestKeeper(t) - msgServer := keeper.NewMsgServerImpl(*k) - goCtx := sdk.WrapSDKContext(ctx) - - k.SetChainNamespace(&ctx, "devnet") - - keyPair1 := GenerateSecp256k1KeyPair() - rpcElements := GenerateDidDocumentRPCElements(keyPair1, []DidSigningElements{}) - t.Logf("Registering DID with DID Id: %s", rpcElements.DidDocument.GetId()) - - msgCreateDID := &types.MsgCreateDID{ - DidDocString: rpcElements.DidDocument, - Signatures: rpcElements.Signatures, - Creator: rpcElements.Creator, - } - - _, err := msgServer.CreateDID(goCtx, msgCreateDID) - if err != nil { - t.Error("DID Registeration Failed") - t.Error(err) - t.FailNow() - } - t.Log("DID Registered Successfully") - - t.Log("Registering Schema") - schemaRpcElements := GenerateSchemaDocumentRPCElements( - keyPair1, - rpcElements.DidDocument.Id, - rpcElements.DidDocument.AssertionMethod[0], - ) - - msgCreateSchema := &types.MsgCreateSchema{ - SchemaDoc: schemaRpcElements.SchemaDocument, - SchemaProof: schemaRpcElements.SchemaProof, - Creator: schemaRpcElements.Creator, - } - - _, errCreateSchema := msgServer.CreateSchema(goCtx, msgCreateSchema) - if errCreateSchema != nil { - t.Error("Schema Registeration Failed") - t.Error(errCreateSchema) - t.FailNow() - } - t.Log("Schema Registered Successfully") - - t.Log("Create Schema Tx Test Completed") -} diff --git a/x/ssi/tests/tx_deactivate_did_test.go b/x/ssi/tests/tx_deactivate_did_test.go deleted file mode 100644 index 56045df..0000000 --- a/x/ssi/tests/tx_deactivate_did_test.go +++ /dev/null @@ -1,64 +0,0 @@ -package tests - -import ( - "testing" - - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/hypersign-protocol/hid-node/x/ssi/keeper" - "github.com/hypersign-protocol/hid-node/x/ssi/types" -) - -func TestDeactivateDID(t *testing.T) { - t.Log("Running test for Valid Deactivate DID Tx") - k, ctx := TestKeeper(t) - msgServer := keeper.NewMsgServerImpl(*k) - goCtx := sdk.WrapSDKContext(ctx) - - k.SetChainNamespace(&ctx, "devnet") - - keyPair1 := GenerateEd25519KeyPair() - rpcElements := GenerateDidDocumentRPCElements(keyPair1, []DidSigningElements{}) - t.Logf("Registering DID with DID Id: %s", rpcElements.DidDocument.GetId()) - - msgCreateDID := &types.MsgCreateDID{ - DidDocString: rpcElements.DidDocument, - Signatures: rpcElements.Signatures, - Creator: rpcElements.Creator, - } - - _, err := msgServer.CreateDID(goCtx, msgCreateDID) - if err != nil { - t.Error("DID Registeration Failed") - t.Error(err) - t.FailNow() - } else { - t.Log("Did Registeration Successful") - } - - // Querying registered did document to get the version ID - resolvedDidDocument, errResolve := k.GetDidDocumentState(&ctx, rpcElements.DidDocument.GetId()) - if errResolve != nil { - t.Error("Error in retrieving registered did document") - t.Error(errResolve) - t.FailNow() - } - versionId := resolvedDidDocument.GetDidDocumentMetadata().GetVersionId() - - t.Logf("Deactivating DID with Id: %s", rpcElements.DidDocument.GetId()) - msgDeactivateDID := &types.MsgDeactivateDID{ - DidId: rpcElements.DidDocument.Id, - Signatures: rpcElements.Signatures, - VersionId: versionId, - Creator: rpcElements.Creator, - } - - _, errDeactivateDID := msgServer.DeactivateDID(goCtx, msgDeactivateDID) - if errDeactivateDID != nil { - t.Error("DID Deactivation Failed") - t.Error(errDeactivateDID) - t.FailNow() - } - t.Log("DID Deactivation Successful") - - t.Log("Deactivate DID Tx Test Completed") -} diff --git a/x/ssi/tests/tx_register_credential_status_test.go b/x/ssi/tests/tx_register_credential_status_test.go deleted file mode 100644 index e21774e..0000000 --- a/x/ssi/tests/tx_register_credential_status_test.go +++ /dev/null @@ -1,169 +0,0 @@ -package tests - -import ( - "testing" - "time" - - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/hypersign-protocol/hid-node/x/ssi/keeper" - "github.com/hypersign-protocol/hid-node/x/ssi/types" -) - -func TestRegisterCredentialStatus(t *testing.T) { - t.Log("Running test for Valid Register Cred Tx") - k, ctx := TestKeeper(t) - msgServer := keeper.NewMsgServerImpl(*k) - goCtx := sdk.WrapSDKContext(ctx) - - k.SetChainNamespace(&ctx, "devnet") - - keyPair1 := GenerateSecp256k1KeyPair() - didRpcElements := GenerateDidDocumentRPCElements(keyPair1, []DidSigningElements{}) - t.Logf("Registering DID with DID Id: %s", didRpcElements.DidDocument.GetId()) - - msgCreateDID := &types.MsgCreateDID{ - DidDocString: didRpcElements.DidDocument, - Signatures: didRpcElements.Signatures, - Creator: didRpcElements.Creator, - } - - _, err := msgServer.CreateDID(goCtx, msgCreateDID) - if err != nil { - t.Error("DID Registeration Failed") - t.Log(didRpcElements.DidDocument.Id) - t.Error(err) - t.FailNow() - } - t.Log("Did Registeration Successful") - - credRpcElements := GenerateCredStatusRPCElements( - keyPair1, - didRpcElements.DidDocument.Id, - didRpcElements.DidDocument.VerificationMethod[0], - ) - - msgRegisterCredentialStatus := &types.MsgRegisterCredentialStatus{ - CredentialStatus: credRpcElements.Status, - Proof: credRpcElements.Proof, - Creator: Creator, - } - t.Logf("Registering Credential Status with Id: %s", credRpcElements.Status.GetClaim().GetId()) - - t.Logf("Block Time: %s", ctx.BlockTime().Format(time.RFC3339)) - - _, errCredStatus := msgServer.RegisterCredentialStatus(goCtx, msgRegisterCredentialStatus) - if errCredStatus != nil { - t.Error("Credential Status Registeration Failed") - t.Error(errCredStatus) - t.FailNow() - } - t.Log("Credential Status Registeration Successful") - - t.Log("Valid Register Cred Tx Test Completed") -} - -func TestUpdateCredentialStatus(t *testing.T) { - t.Log("Running test for updating status of registered credential status") - k, ctx := TestKeeper(t) - msgServer := keeper.NewMsgServerImpl(*k) - goCtx := sdk.WrapSDKContext(ctx) - - k.SetChainNamespace(&ctx, "devnet") - - keyPair1 := GenerateEd25519KeyPair() - didRpcElements := GenerateDidDocumentRPCElements(keyPair1, []DidSigningElements{}) - t.Logf("Registering DID with DID Id: %s", didRpcElements.DidDocument.GetId()) - - msgCreateDID := &types.MsgCreateDID{ - DidDocString: didRpcElements.DidDocument, - Signatures: didRpcElements.Signatures, - Creator: didRpcElements.Creator, - } - - _, err := msgServer.CreateDID(goCtx, msgCreateDID) - if err != nil { - t.Error("DID Registeration Failed") - t.Log(didRpcElements.DidDocument.Id) - t.Error(err) - t.FailNow() - } - t.Log("Did Registeration Successful") - - credRpcElements := GenerateCredStatusRPCElements( - keyPair1, - didRpcElements.DidDocument.Id, - didRpcElements.DidDocument.VerificationMethod[0], - ) - - msgRegisterCredentialStatus := &types.MsgRegisterCredentialStatus{ - CredentialStatus: credRpcElements.Status, - Proof: credRpcElements.Proof, - Creator: Creator, - } - t.Logf("Registering Credential Status with Id: %s", credRpcElements.Status.GetClaim().GetId()) - - t.Logf("Block Time: %s", ctx.BlockTime().Format(time.RFC3339)) - - _, errCredStatus := msgServer.RegisterCredentialStatus(goCtx, msgRegisterCredentialStatus) - if errCredStatus != nil { - t.Error("Credential Status Registeration Failed") - t.Error(errCredStatus) - t.FailNow() - } - t.Log("Credential Status Registeration Successful") - - t.Logf("Updating Credential Status (Id: %s) from Live to Suspended", credRpcElements.Status.GetClaim().GetId()) - - updatedRpcCredElements := UpdateCredStatus("Suspended", credRpcElements, keyPair1) - - msgUpdateCredentialStatus := &types.MsgRegisterCredentialStatus{ - CredentialStatus: updatedRpcCredElements.Status, - Proof: updatedRpcCredElements.Proof, - Creator: Creator, - } - - _, errUpdatedCredStatus := msgServer.RegisterCredentialStatus(goCtx, msgUpdateCredentialStatus) - if errUpdatedCredStatus != nil { - t.Error("Credential Status Update Failed") - t.Error(errUpdatedCredStatus) - t.FailNow() - } - t.Log("Credential Status Update Successful") - - t.Logf("Updating Credential Status (Id: %s) from Suspended back to Live", credRpcElements.Status.GetClaim().GetId()) - - updatedRpcCredElements = UpdateCredStatus("Live", credRpcElements, keyPair1) - - msgUpdateCredentialStatus = &types.MsgRegisterCredentialStatus{ - CredentialStatus: updatedRpcCredElements.Status, - Proof: updatedRpcCredElements.Proof, - Creator: Creator, - } - - _, errUpdatedCredStatus = msgServer.RegisterCredentialStatus(goCtx, msgUpdateCredentialStatus) - if errUpdatedCredStatus != nil { - t.Error("Credential Status Update Failed") - t.Error(errUpdatedCredStatus) - t.FailNow() - } - t.Log("Credential Status Update Successful") - - t.Logf("Updating Credential Status (Id: %s) from Live to Expired", credRpcElements.Status.GetClaim().GetId()) - - updatedRpcCredElements = UpdateCredStatus("Expired", credRpcElements, keyPair1) - - msgUpdateCredentialStatus = &types.MsgRegisterCredentialStatus{ - CredentialStatus: updatedRpcCredElements.Status, - Proof: updatedRpcCredElements.Proof, - Creator: Creator, - } - - _, errUpdatedCredStatus = msgServer.RegisterCredentialStatus(goCtx, msgUpdateCredentialStatus) - if errUpdatedCredStatus == nil { - t.Error("Credential Status Update was supposed to failed") - t.Error(errUpdatedCredStatus) - t.FailNow() - } - t.Log("Credential Status Update did not succeed as expected") - t.Log("Test Completed") -} diff --git a/x/ssi/tests/tx_update_did_test.go b/x/ssi/tests/tx_update_did_test.go deleted file mode 100644 index 1f4b71a..0000000 --- a/x/ssi/tests/tx_update_did_test.go +++ /dev/null @@ -1,74 +0,0 @@ -package tests - -import ( - "testing" - - sdk "github.com/cosmos/cosmos-sdk/types" - testkeeper "github.com/hypersign-protocol/hid-node/testutil/keeper" - "github.com/hypersign-protocol/hid-node/x/ssi/keeper" - "github.com/hypersign-protocol/hid-node/x/ssi/types" -) - -func TestUpdateDID(t *testing.T) { - t.Log("Running test for Valid Update DID Tx") - k, ctx := testkeeper.SsiKeeper(t) - msgServ := keeper.NewMsgServerImpl(*k) - goCtx := sdk.WrapSDKContext(ctx) - - k.SetChainNamespace(&ctx, "devnet") - - keyPair1 := GenerateEd25519KeyPair() - rpcElements := GenerateDidDocumentRPCElements(keyPair1, []DidSigningElements{}) - t.Logf("Registering DID with DID Id: %s", rpcElements.DidDocument.GetId()) - - msgCreateDID := &types.MsgCreateDID{ - DidDocString: rpcElements.DidDocument, - Signatures: rpcElements.Signatures, - Creator: rpcElements.Creator, - } - - _, err := msgServ.CreateDID(goCtx, msgCreateDID) - if err != nil { - t.Error("DID Registeration Failed") - t.Error(err) - t.FailNow() - } else { - t.Log("Did Registeration Successful") - } - - // Querying registered did document to get the version ID - resolvedDidDocument, errResolve := k.GetDidDocumentState(&ctx, rpcElements.DidDocument.GetId()) - if errResolve != nil { - t.Error("Error in retrieving registered did document") - t.Error(errResolve) - t.FailNow() - } - versionId := resolvedDidDocument.GetDidDocumentMetadata().GetVersionId() - - // Updated the existing DID by appending a link - resolvedDidDocument.DidDocument.Context = append(resolvedDidDocument.DidDocument.Context, "http://www.example.com") - - updateRpcElements := GetModifiedDidDocumentSignature( - resolvedDidDocument.DidDocument, - keyPair1, - resolvedDidDocument.DidDocument.VerificationMethod[0].Id, - ) - t.Logf("Updating context field of the registered did with Id: %s", updateRpcElements.DidDocument.Id) - - msgUpdateDID := &types.MsgUpdateDID{ - DidDocString: updateRpcElements.DidDocument, - Signatures: updateRpcElements.Signatures, - VersionId: versionId, - Creator: updateRpcElements.Creator, - } - - _, errUpdateDID := msgServ.UpdateDID(goCtx, msgUpdateDID) - if errUpdateDID != nil { - t.Error("DID Update Failed") - t.Error(errUpdateDID) - t.FailNow() - } - t.Log("Did Update Successful") - - t.Log("Update DID Tx Test Completed") -} diff --git a/x/ssi/tests/types.go b/x/ssi/tests/types.go deleted file mode 100644 index e2bd130..0000000 --- a/x/ssi/tests/types.go +++ /dev/null @@ -1,50 +0,0 @@ -package tests - -import ( - "crypto/ed25519" - - "github.com/hypersign-protocol/hid-node/x/ssi/types" - secp256k1 "github.com/tendermint/tendermint/crypto/secp256k1" -) - -// Structs - -type ed25519KeyPair struct { - publicKey string - privateKey ed25519.PrivateKey - optionalID string // If this field is not empty, it will override publicKey as the method specific id -} - -type secp256k1KeyPair struct { - publicKey string - privateKey *secp256k1.PrivKey - optionalID string // If this field is not empty, it will override publicKey as the method specific id -} - -type DidRpcElements struct { - DidDocument *types.Did - Signatures []*types.SignInfo - Creator string -} - -type SchemaRpcElements struct { - SchemaDocument *types.SchemaDocument - SchemaProof *types.SchemaProof - Creator string -} - -type CredRpcElements struct { - Status *types.CredentialStatus - Proof *types.CredentialProof - Creator string -} - -type DidSigningElements struct { - keyPair interface{} - vmId string -} - -// Interfaces - -// An interface to support multiple Key Pair Structs -type GenericKeyPair = interface{} diff --git a/x/ssi/tests/utils.go b/x/ssi/tests/utils.go deleted file mode 100644 index 4ba1a18..0000000 --- a/x/ssi/tests/utils.go +++ /dev/null @@ -1,38 +0,0 @@ -package tests - -import ( - "crypto/ed25519" - "strings" -) - -func SignGeneric(keyPair GenericKeyPair, data []byte) []byte { - switch kp := keyPair.(type) { - case ed25519KeyPair: - signature := ed25519.Sign(kp.privateKey, data) - return signature - case secp256k1KeyPair: - signature, err := kp.privateKey.Sign(data) - if err != nil { - panic(err) - } - return signature - default: - panic("Unsupported Key Pair Type") - } -} - -func GetPublicKeyAndOptionalID(keyPair GenericKeyPair) (string, string) { - switch kp := keyPair.(type) { - case ed25519KeyPair: - return kp.publicKey, kp.optionalID - case secp256k1KeyPair: - return kp.publicKey, kp.optionalID - default: - panic("Unsupported Key Pair Type") - } -} - -func stripDidFromVerificationMethod(vmId string) string { - segments := strings.Split(vmId, "#") - return segments[0] -} diff --git a/x/ssi/tests/verification_method_rotation_test.go b/x/ssi/tests/verification_method_rotation_test.go deleted file mode 100644 index 1e51822..0000000 --- a/x/ssi/tests/verification_method_rotation_test.go +++ /dev/null @@ -1,54 +0,0 @@ -package tests - -import ( - "testing" - - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/hypersign-protocol/hid-node/x/ssi/keeper" - "github.com/stretchr/testify/assert" -) - -func TestVerificationMethodRotation(t *testing.T) { - t.Logf("Verification Rotation Test Started") - - k, ctx := TestKeeper(t) - msgServer := keeper.NewMsgServerImpl(*k) - goCtx := sdk.WrapSDKContext(ctx) - - k.SetChainNamespace(&ctx, "devnet") - - // Create a DID with pubKey1 - keyPair1 := GenerateEd25519KeyPair() - didId1, err := CreateDidTx(msgServer, goCtx, keyPair1) - if err != nil { - t.Error(err) - t.FailNow() - } - t.Logf("DID registerd with ID: %s", didId1) - - // Update the DID by adding pubKey2 - keyPair2 := GenerateEd25519KeyPair() - - resolvedDidDocument := QueryDid(k, ctx, didId1) - versionId := resolvedDidDocument.GetDidDocumentMetadata().GetVersionId() - - // Replace the old public key with new one - resolvedDidDocument.DidDocument.VerificationMethod[0].PublicKeyMultibase = keyPair2.publicKey - - updatedDidRpcElements := GetModifiedDidDocumentSignature( - resolvedDidDocument.DidDocument, - keyPair1, - resolvedDidDocument.DidDocument.VerificationMethod[0].Id, - ) - - err = UpdateDidTx(msgServer, goCtx, updatedDidRpcElements, versionId) - if err != nil { - t.Error("Unable to rotate key") - t.Error(err) - t.FailNow() - } - - resolvedDidDocument = QueryDid(k, ctx, didId1) - // Assert if the update was successful - assert.Equal(t, keyPair2.publicKey, resolvedDidDocument.DidDocument.VerificationMethod[0].PublicKeyMultibase) -} diff --git a/x/ssi/types/chain_namespace_validation.go b/x/ssi/types/chain_namespace_validation.go index 97dfedb..489d23b 100644 --- a/x/ssi/types/chain_namespace_validation.go +++ b/x/ssi/types/chain_namespace_validation.go @@ -19,7 +19,7 @@ func chainNamespaceValidation(docId string, validChainNamespace string) error { } // DidDocNamespaceValidation validates the namespace in Did Document -func DidChainNamespaceValidation(didDoc *Did, validChainNamespace string) error { +func DidChainNamespaceValidation(didDoc *DidDocument, validChainNamespace string) error { // Subject ID check if err := chainNamespaceValidation(didDoc.Id, validChainNamespace); err != nil { return err diff --git a/x/ssi/types/clientSpec.pb.go b/x/ssi/types/clientSpec.pb.go deleted file mode 100644 index 8e6fdcd..0000000 --- a/x/ssi/types/clientSpec.pb.go +++ /dev/null @@ -1,368 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: ssi/v1/clientSpec.proto - -package types - -import ( - fmt "fmt" - proto "github.com/gogo/protobuf/proto" - io "io" - math "math" - math_bits "math/bits" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package - -type ClientSpec struct { - Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"` - Adr036SignerAddress string `protobuf:"bytes,2,opt,name=adr036SignerAddress,proto3" json:"adr036SignerAddress,omitempty"` -} - -func (m *ClientSpec) Reset() { *m = ClientSpec{} } -func (m *ClientSpec) String() string { return proto.CompactTextString(m) } -func (*ClientSpec) ProtoMessage() {} -func (*ClientSpec) Descriptor() ([]byte, []int) { - return fileDescriptor_9073ac3e959d95c1, []int{0} -} -func (m *ClientSpec) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ClientSpec) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_ClientSpec.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *ClientSpec) XXX_Merge(src proto.Message) { - xxx_messageInfo_ClientSpec.Merge(m, src) -} -func (m *ClientSpec) XXX_Size() int { - return m.Size() -} -func (m *ClientSpec) XXX_DiscardUnknown() { - xxx_messageInfo_ClientSpec.DiscardUnknown(m) -} - -var xxx_messageInfo_ClientSpec proto.InternalMessageInfo - -func (m *ClientSpec) GetType() string { - if m != nil { - return m.Type - } - return "" -} - -func (m *ClientSpec) GetAdr036SignerAddress() string { - if m != nil { - return m.Adr036SignerAddress - } - return "" -} - -func init() { - proto.RegisterType((*ClientSpec)(nil), "hypersignprotocol.hidnode.ssi.ClientSpec") -} - -func init() { proto.RegisterFile("ssi/v1/clientSpec.proto", fileDescriptor_9073ac3e959d95c1) } - -var fileDescriptor_9073ac3e959d95c1 = []byte{ - // 196 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x2f, 0x2e, 0xce, 0xd4, - 0x2f, 0x33, 0xd4, 0x4f, 0xce, 0xc9, 0x4c, 0xcd, 0x2b, 0x09, 0x2e, 0x48, 0x4d, 0xd6, 0x2b, 0x28, - 0xca, 0x2f, 0xc9, 0x17, 0x92, 0xcd, 0xa8, 0x2c, 0x48, 0x2d, 0x2a, 0xce, 0x4c, 0xcf, 0x03, 0xf3, - 0x93, 0xf3, 0x73, 0xf4, 0x32, 0x32, 0x53, 0xf2, 0xf2, 0x53, 0x52, 0xf5, 0x8a, 0x8b, 0x33, 0x95, - 0x82, 0xb8, 0xb8, 0x9c, 0xe1, 0x5a, 0x84, 0x84, 0xb8, 0x58, 0x4a, 0x2a, 0x0b, 0x52, 0x25, 0x18, - 0x15, 0x18, 0x35, 0x38, 0x83, 0xc0, 0x6c, 0x21, 0x03, 0x2e, 0xe1, 0xc4, 0x94, 0x22, 0x03, 0x63, - 0xb3, 0xe0, 0xcc, 0xf4, 0xbc, 0xd4, 0x22, 0xc7, 0x94, 0x94, 0xa2, 0xd4, 0xe2, 0x62, 0x09, 0x26, - 0xb0, 0x12, 0x6c, 0x52, 0x4e, 0x3e, 0x27, 0x1e, 0xc9, 0x31, 0x5e, 0x78, 0x24, 0xc7, 0xf8, 0xe0, - 0x91, 0x1c, 0xe3, 0x84, 0xc7, 0x72, 0x0c, 0x17, 0x1e, 0xcb, 0x31, 0xdc, 0x78, 0x2c, 0xc7, 0x10, - 0x65, 0x94, 0x9e, 0x59, 0x92, 0x51, 0x9a, 0xa4, 0x97, 0x9c, 0x9f, 0xab, 0x0f, 0x77, 0x97, 0x2e, - 0xcc, 0x61, 0xfa, 0x19, 0x99, 0x29, 0xba, 0x20, 0x97, 0xe9, 0x57, 0xe8, 0x83, 0xbc, 0x03, 0xb2, - 0xbe, 0x38, 0x89, 0x0d, 0x2c, 0x6d, 0x0c, 0x08, 0x00, 0x00, 0xff, 0xff, 0x37, 0x23, 0x08, 0xe7, - 0xe2, 0x00, 0x00, 0x00, -} - -func (m *ClientSpec) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ClientSpec) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ClientSpec) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Adr036SignerAddress) > 0 { - i -= len(m.Adr036SignerAddress) - copy(dAtA[i:], m.Adr036SignerAddress) - i = encodeVarintClientSpec(dAtA, i, uint64(len(m.Adr036SignerAddress))) - i-- - dAtA[i] = 0x12 - } - if len(m.Type) > 0 { - i -= len(m.Type) - copy(dAtA[i:], m.Type) - i = encodeVarintClientSpec(dAtA, i, uint64(len(m.Type))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func encodeVarintClientSpec(dAtA []byte, offset int, v uint64) int { - offset -= sovClientSpec(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *ClientSpec) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Type) - if l > 0 { - n += 1 + l + sovClientSpec(uint64(l)) - } - l = len(m.Adr036SignerAddress) - if l > 0 { - n += 1 + l + sovClientSpec(uint64(l)) - } - return n -} - -func sovClientSpec(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozClientSpec(x uint64) (n int) { - return sovClientSpec(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *ClientSpec) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowClientSpec - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ClientSpec: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ClientSpec: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowClientSpec - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthClientSpec - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthClientSpec - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Type = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Adr036SignerAddress", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowClientSpec - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthClientSpec - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthClientSpec - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Adr036SignerAddress = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipClientSpec(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthClientSpec - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipClientSpec(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowClientSpec - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowClientSpec - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowClientSpec - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthClientSpec - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupClientSpec - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthClientSpec - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthClientSpec = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowClientSpec = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupClientSpec = fmt.Errorf("proto: unexpected end of group") -) diff --git a/x/ssi/types/client_spec.pb.go b/x/ssi/types/client_spec.pb.go new file mode 100644 index 0000000..0923e3b --- /dev/null +++ b/x/ssi/types/client_spec.pb.go @@ -0,0 +1,76 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: ssi/v1/client_spec.proto + +package types + +import ( + fmt "fmt" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/gogo/protobuf/proto" + math "math" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +type ClientSpecType int32 + +const ( + CLIENT_SPEC_TYPE_NONE ClientSpecType = 0 + CLIENT_SPEC_TYPE_COSMOS_ADR036 ClientSpecType = 1 + CLIENT_SPEC_TYPE_ETH_PERSONAL_SIGN ClientSpecType = 2 +) + +var ClientSpecType_name = map[int32]string{ + 0: "CLIENT_SPEC_TYPE_NONE", + 1: "CLIENT_SPEC_TYPE_COSMOS_ADR036", + 2: "CLIENT_SPEC_TYPE_ETH_PERSONAL_SIGN", +} + +var ClientSpecType_value = map[string]int32{ + "CLIENT_SPEC_TYPE_NONE": 0, + "CLIENT_SPEC_TYPE_COSMOS_ADR036": 1, + "CLIENT_SPEC_TYPE_ETH_PERSONAL_SIGN": 2, +} + +func (x ClientSpecType) String() string { + return proto.EnumName(ClientSpecType_name, int32(x)) +} + +func (ClientSpecType) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_24c903dcd56f8ab7, []int{0} +} + +func init() { + proto.RegisterEnum("hypersign.ssi.v1.ClientSpecType", ClientSpecType_name, ClientSpecType_value) +} + +func init() { proto.RegisterFile("ssi/v1/client_spec.proto", fileDescriptor_24c903dcd56f8ab7) } + +var fileDescriptor_24c903dcd56f8ab7 = []byte{ + // 248 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x28, 0x2e, 0xce, 0xd4, + 0x2f, 0x33, 0xd4, 0x4f, 0xce, 0xc9, 0x4c, 0xcd, 0x2b, 0x89, 0x2f, 0x2e, 0x48, 0x4d, 0xd6, 0x2b, + 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0xc8, 0xa8, 0x2c, 0x48, 0x2d, 0x2a, 0xce, 0x4c, 0xcf, 0xd3, + 0x2b, 0x2e, 0xce, 0xd4, 0x2b, 0x33, 0x94, 0x12, 0x49, 0xcf, 0x4f, 0xcf, 0x07, 0x4b, 0xea, 0x83, + 0x58, 0x10, 0x75, 0x5a, 0xb5, 0x5c, 0x7c, 0xce, 0x60, 0xcd, 0xc1, 0x05, 0xa9, 0xc9, 0x21, 0x95, + 0x05, 0xa9, 0x42, 0x92, 0x5c, 0xa2, 0xce, 0x3e, 0x9e, 0xae, 0x7e, 0x21, 0xf1, 0xc1, 0x01, 0xae, + 0xce, 0xf1, 0x21, 0x91, 0x01, 0xae, 0xf1, 0x7e, 0xfe, 0x7e, 0xae, 0x02, 0x0c, 0x42, 0x4a, 0x5c, + 0x72, 0x18, 0x52, 0xce, 0xfe, 0xc1, 0xbe, 0xfe, 0xc1, 0xf1, 0x8e, 0x2e, 0x41, 0x06, 0xc6, 0x66, + 0x02, 0x8c, 0x42, 0x6a, 0x5c, 0x4a, 0x18, 0x6a, 0x5c, 0x43, 0x3c, 0xe2, 0x03, 0x5c, 0x83, 0x82, + 0xfd, 0xfd, 0x1c, 0x7d, 0xe2, 0x83, 0x3d, 0xdd, 0xfd, 0x04, 0x98, 0xa4, 0x58, 0x3a, 0x16, 0xcb, + 0x31, 0x38, 0xf9, 0x9c, 0x78, 0x24, 0xc7, 0x78, 0xe1, 0x91, 0x1c, 0xe3, 0x83, 0x47, 0x72, 0x8c, + 0x13, 0x1e, 0xcb, 0x31, 0x5c, 0x78, 0x2c, 0xc7, 0x70, 0xe3, 0xb1, 0x1c, 0x43, 0x94, 0x51, 0x7a, + 0x66, 0x49, 0x46, 0x69, 0x92, 0x5e, 0x72, 0x7e, 0xae, 0x3e, 0xdc, 0x2f, 0xba, 0x60, 0x47, 0x27, + 0xe7, 0xe7, 0xe8, 0x67, 0x64, 0xa6, 0xe8, 0xe6, 0xe5, 0xa7, 0xa4, 0xea, 0x57, 0xe8, 0x83, 0xc2, + 0xa0, 0xa4, 0xb2, 0x20, 0xb5, 0x38, 0x89, 0x0d, 0x2c, 0x6d, 0x0c, 0x08, 0x00, 0x00, 0xff, 0xff, + 0x15, 0xe9, 0x1a, 0xb8, 0x17, 0x01, 0x00, 0x00, +} diff --git a/x/ssi/types/codec.go b/x/ssi/types/codec.go index 6624a84..5cf17fe 100644 --- a/x/ssi/types/codec.go +++ b/x/ssi/types/codec.go @@ -8,25 +8,34 @@ import ( ) func RegisterCodec(cdc *codec.LegacyAmino) { - cdc.RegisterConcrete(&MsgCreateDID{}, "ssi/CreateDID", nil) + cdc.RegisterConcrete(&MsgRegisterDID{}, "ssi/RegisterDID", nil) cdc.RegisterConcrete(&MsgUpdateDID{}, "ssi/UpdateDID", nil) - cdc.RegisterConcrete(&MsgCreateSchema{}, "ssi/CreateSchema", nil) + cdc.RegisterConcrete(&MsgRegisterCredentialSchema{}, "ssi/RegisterCredentialSchema", nil) cdc.RegisterConcrete(&MsgDeactivateDID{}, "ssi/DeactivateDID", nil) + cdc.RegisterConcrete(&MsgRegisterCredentialStatus{}, "ssi/RegisterCredentialStatus", nil) } func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { - registry.RegisterImplementations((*sdk.Msg)(nil), - &MsgCreateDID{}, + registry.RegisterImplementations( + (*sdk.Msg)(nil), + &MsgRegisterDID{}, ) - registry.RegisterImplementations((*sdk.Msg)(nil), + registry.RegisterImplementations( + (*sdk.Msg)(nil), &MsgUpdateDID{}, ) - registry.RegisterImplementations((*sdk.Msg)(nil), - &MsgCreateSchema{}, + registry.RegisterImplementations( + (*sdk.Msg)(nil), + &MsgRegisterCredentialSchema{}, ) - registry.RegisterImplementations((*sdk.Msg)(nil), + registry.RegisterImplementations( + (*sdk.Msg)(nil), &MsgDeactivateDID{}, ) + registry.RegisterImplementations( + (*sdk.Msg)(nil), + &MsgRegisterCredentialStatus{}, + ) msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) } diff --git a/x/ssi/types/common.go b/x/ssi/types/common.go index 99ad149..4b4d68b 100644 --- a/x/ssi/types/common.go +++ b/x/ssi/types/common.go @@ -4,6 +4,9 @@ package types const MSIBlockchainAccountId = "MSIBlockchainAccountId" const MSINonBlockchainAccountId = "MSINonBlockchainAccountId" +// Valid Proof Purpose values + + // Supported Verification Method Types const Ed25519VerificationKey2020 = "Ed25519VerificationKey2020" const EcdsaSecp256k1VerificationKey2019 = "EcdsaSecp256k1VerificationKey2019" diff --git a/x/ssi/types/credential.pb.go b/x/ssi/types/credential.pb.go deleted file mode 100644 index 51f5df2..0000000 --- a/x/ssi/types/credential.pb.go +++ /dev/null @@ -1,1684 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: ssi/v1/credential.proto - -package types - -import ( - fmt "fmt" - proto "github.com/gogo/protobuf/proto" - io "io" - math "math" - math_bits "math/bits" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package - -type Claim struct { - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` - CurrentStatus string `protobuf:"bytes,2,opt,name=currentStatus,proto3" json:"currentStatus,omitempty"` - StatusReason string `protobuf:"bytes,3,opt,name=statusReason,proto3" json:"statusReason,omitempty"` -} - -func (m *Claim) Reset() { *m = Claim{} } -func (m *Claim) String() string { return proto.CompactTextString(m) } -func (*Claim) ProtoMessage() {} -func (*Claim) Descriptor() ([]byte, []int) { - return fileDescriptor_ad0debf69e83e4bb, []int{0} -} -func (m *Claim) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Claim) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Claim.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *Claim) XXX_Merge(src proto.Message) { - xxx_messageInfo_Claim.Merge(m, src) -} -func (m *Claim) XXX_Size() int { - return m.Size() -} -func (m *Claim) XXX_DiscardUnknown() { - xxx_messageInfo_Claim.DiscardUnknown(m) -} - -var xxx_messageInfo_Claim proto.InternalMessageInfo - -func (m *Claim) GetId() string { - if m != nil { - return m.Id - } - return "" -} - -func (m *Claim) GetCurrentStatus() string { - if m != nil { - return m.CurrentStatus - } - return "" -} - -func (m *Claim) GetStatusReason() string { - if m != nil { - return m.StatusReason - } - return "" -} - -type CredentialStatus struct { - Claim *Claim `protobuf:"bytes,1,opt,name=claim,proto3" json:"claim,omitempty"` - Issuer string `protobuf:"bytes,2,opt,name=issuer,proto3" json:"issuer,omitempty"` - IssuanceDate string `protobuf:"bytes,3,opt,name=issuanceDate,proto3" json:"issuanceDate,omitempty"` - ExpirationDate string `protobuf:"bytes,4,opt,name=expirationDate,proto3" json:"expirationDate,omitempty"` - CredentialHash string `protobuf:"bytes,5,opt,name=credentialHash,proto3" json:"credentialHash,omitempty"` -} - -func (m *CredentialStatus) Reset() { *m = CredentialStatus{} } -func (m *CredentialStatus) String() string { return proto.CompactTextString(m) } -func (*CredentialStatus) ProtoMessage() {} -func (*CredentialStatus) Descriptor() ([]byte, []int) { - return fileDescriptor_ad0debf69e83e4bb, []int{1} -} -func (m *CredentialStatus) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *CredentialStatus) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_CredentialStatus.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *CredentialStatus) XXX_Merge(src proto.Message) { - xxx_messageInfo_CredentialStatus.Merge(m, src) -} -func (m *CredentialStatus) XXX_Size() int { - return m.Size() -} -func (m *CredentialStatus) XXX_DiscardUnknown() { - xxx_messageInfo_CredentialStatus.DiscardUnknown(m) -} - -var xxx_messageInfo_CredentialStatus proto.InternalMessageInfo - -func (m *CredentialStatus) GetClaim() *Claim { - if m != nil { - return m.Claim - } - return nil -} - -func (m *CredentialStatus) GetIssuer() string { - if m != nil { - return m.Issuer - } - return "" -} - -func (m *CredentialStatus) GetIssuanceDate() string { - if m != nil { - return m.IssuanceDate - } - return "" -} - -func (m *CredentialStatus) GetExpirationDate() string { - if m != nil { - return m.ExpirationDate - } - return "" -} - -func (m *CredentialStatus) GetCredentialHash() string { - if m != nil { - return m.CredentialHash - } - return "" -} - -type CredentialProof struct { - Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"` - Created string `protobuf:"bytes,2,opt,name=created,proto3" json:"created,omitempty"` - Updated string `protobuf:"bytes,3,opt,name=updated,proto3" json:"updated,omitempty"` - VerificationMethod string `protobuf:"bytes,4,opt,name=verificationMethod,proto3" json:"verificationMethod,omitempty"` - ProofPurpose string `protobuf:"bytes,5,opt,name=proofPurpose,proto3" json:"proofPurpose,omitempty"` - ProofValue string `protobuf:"bytes,6,opt,name=proofValue,proto3" json:"proofValue,omitempty"` -} - -func (m *CredentialProof) Reset() { *m = CredentialProof{} } -func (m *CredentialProof) String() string { return proto.CompactTextString(m) } -func (*CredentialProof) ProtoMessage() {} -func (*CredentialProof) Descriptor() ([]byte, []int) { - return fileDescriptor_ad0debf69e83e4bb, []int{2} -} -func (m *CredentialProof) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *CredentialProof) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_CredentialProof.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *CredentialProof) XXX_Merge(src proto.Message) { - xxx_messageInfo_CredentialProof.Merge(m, src) -} -func (m *CredentialProof) XXX_Size() int { - return m.Size() -} -func (m *CredentialProof) XXX_DiscardUnknown() { - xxx_messageInfo_CredentialProof.DiscardUnknown(m) -} - -var xxx_messageInfo_CredentialProof proto.InternalMessageInfo - -func (m *CredentialProof) GetType() string { - if m != nil { - return m.Type - } - return "" -} - -func (m *CredentialProof) GetCreated() string { - if m != nil { - return m.Created - } - return "" -} - -func (m *CredentialProof) GetUpdated() string { - if m != nil { - return m.Updated - } - return "" -} - -func (m *CredentialProof) GetVerificationMethod() string { - if m != nil { - return m.VerificationMethod - } - return "" -} - -func (m *CredentialProof) GetProofPurpose() string { - if m != nil { - return m.ProofPurpose - } - return "" -} - -func (m *CredentialProof) GetProofValue() string { - if m != nil { - return m.ProofValue - } - return "" -} - -type Credential struct { - Claim *Claim `protobuf:"bytes,1,opt,name=claim,proto3" json:"claim,omitempty"` - Issuer string `protobuf:"bytes,2,opt,name=issuer,proto3" json:"issuer,omitempty"` - IssuanceDate string `protobuf:"bytes,3,opt,name=issuanceDate,proto3" json:"issuanceDate,omitempty"` - ExpirationDate string `protobuf:"bytes,4,opt,name=expirationDate,proto3" json:"expirationDate,omitempty"` - CredentialHash string `protobuf:"bytes,5,opt,name=credentialHash,proto3" json:"credentialHash,omitempty"` - Proof *CredentialProof `protobuf:"bytes,6,opt,name=proof,proto3" json:"proof,omitempty"` -} - -func (m *Credential) Reset() { *m = Credential{} } -func (m *Credential) String() string { return proto.CompactTextString(m) } -func (*Credential) ProtoMessage() {} -func (*Credential) Descriptor() ([]byte, []int) { - return fileDescriptor_ad0debf69e83e4bb, []int{3} -} -func (m *Credential) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Credential) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Credential.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *Credential) XXX_Merge(src proto.Message) { - xxx_messageInfo_Credential.Merge(m, src) -} -func (m *Credential) XXX_Size() int { - return m.Size() -} -func (m *Credential) XXX_DiscardUnknown() { - xxx_messageInfo_Credential.DiscardUnknown(m) -} - -var xxx_messageInfo_Credential proto.InternalMessageInfo - -func (m *Credential) GetClaim() *Claim { - if m != nil { - return m.Claim - } - return nil -} - -func (m *Credential) GetIssuer() string { - if m != nil { - return m.Issuer - } - return "" -} - -func (m *Credential) GetIssuanceDate() string { - if m != nil { - return m.IssuanceDate - } - return "" -} - -func (m *Credential) GetExpirationDate() string { - if m != nil { - return m.ExpirationDate - } - return "" -} - -func (m *Credential) GetCredentialHash() string { - if m != nil { - return m.CredentialHash - } - return "" -} - -func (m *Credential) GetProof() *CredentialProof { - if m != nil { - return m.Proof - } - return nil -} - -func init() { - proto.RegisterType((*Claim)(nil), "hypersignprotocol.hidnode.ssi.Claim") - proto.RegisterType((*CredentialStatus)(nil), "hypersignprotocol.hidnode.ssi.CredentialStatus") - proto.RegisterType((*CredentialProof)(nil), "hypersignprotocol.hidnode.ssi.CredentialProof") - proto.RegisterType((*Credential)(nil), "hypersignprotocol.hidnode.ssi.Credential") -} - -func init() { proto.RegisterFile("ssi/v1/credential.proto", fileDescriptor_ad0debf69e83e4bb) } - -var fileDescriptor_ad0debf69e83e4bb = []byte{ - // 419 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xdc, 0x93, 0x31, 0x6f, 0xd4, 0x30, - 0x14, 0xc7, 0x2f, 0xa1, 0x39, 0xc4, 0x2b, 0x14, 0xe4, 0x01, 0xb2, 0x10, 0xa1, 0xa8, 0x42, 0x2c, - 0x75, 0xc4, 0xb1, 0x31, 0xd2, 0x0e, 0x0c, 0x20, 0x55, 0x41, 0x62, 0x60, 0x73, 0xed, 0xd7, 0xc6, - 0x52, 0x1a, 0x47, 0xb6, 0x53, 0xf5, 0xbe, 0x05, 0x33, 0x9f, 0x88, 0x05, 0xe9, 0x46, 0xc4, 0x84, - 0xee, 0xbe, 0x08, 0xf2, 0x4b, 0x72, 0x77, 0x41, 0x08, 0x76, 0x36, 0xbf, 0xff, 0xfb, 0xfb, 0xf9, - 0xf7, 0xb7, 0x13, 0x78, 0xe2, 0x9c, 0x2e, 0x6e, 0x5e, 0x16, 0xd2, 0xa2, 0xc2, 0xc6, 0x6b, 0x51, - 0xf3, 0xd6, 0x1a, 0x6f, 0xd8, 0xd3, 0x6a, 0xd9, 0xa2, 0x75, 0xfa, 0xaa, 0xa1, 0x5a, 0x9a, 0x9a, - 0x57, 0x5a, 0x35, 0x46, 0x21, 0x77, 0x4e, 0xe7, 0x02, 0x92, 0xd3, 0x5a, 0xe8, 0x6b, 0x76, 0x04, - 0xb1, 0x56, 0x69, 0xf4, 0x2c, 0x7a, 0x71, 0xaf, 0x8c, 0xb5, 0x62, 0xc7, 0xf0, 0x40, 0x76, 0xd6, - 0x62, 0xe3, 0x3f, 0x78, 0xe1, 0x3b, 0x97, 0xc6, 0xd4, 0x9a, 0x8a, 0x2c, 0x87, 0xfb, 0x8e, 0x56, - 0x25, 0x0a, 0x67, 0x9a, 0xf4, 0x0e, 0x99, 0x26, 0x5a, 0xfe, 0x23, 0x82, 0x47, 0xa7, 0x5b, 0xac, - 0x61, 0xe3, 0x6b, 0x48, 0x64, 0x38, 0x97, 0x4e, 0x3c, 0x5c, 0x1c, 0xf3, 0xbf, 0x62, 0x72, 0x62, - 0x2c, 0xfb, 0x2d, 0xec, 0x31, 0xcc, 0xb5, 0x73, 0x1d, 0xda, 0x81, 0x69, 0xa8, 0x02, 0x4c, 0x58, - 0x89, 0x46, 0xe2, 0x99, 0xf0, 0x38, 0xc2, 0xec, 0x6b, 0xec, 0x39, 0x1c, 0xe1, 0x6d, 0xab, 0xad, - 0xf0, 0xda, 0x34, 0xe4, 0x3a, 0x20, 0xd7, 0x6f, 0x6a, 0xf0, 0xed, 0xae, 0xf2, 0xad, 0x70, 0x55, - 0x9a, 0xf4, 0xbe, 0xa9, 0x9a, 0x7f, 0x8b, 0xe0, 0xe1, 0x2e, 0xdc, 0xb9, 0x35, 0xe6, 0x92, 0x31, - 0x38, 0xf0, 0xcb, 0x16, 0x87, 0xcb, 0xa4, 0x35, 0x4b, 0xe1, 0xae, 0xb4, 0x28, 0x3c, 0xaa, 0x01, - 0x7a, 0x2c, 0x43, 0xa7, 0x6b, 0x15, 0x75, 0x7a, 0xe0, 0xb1, 0x64, 0x1c, 0xd8, 0x0d, 0x5a, 0x7d, - 0xa9, 0x25, 0x71, 0xbd, 0x47, 0x5f, 0x19, 0x35, 0xf0, 0xfe, 0xa1, 0x13, 0xf2, 0xb7, 0x01, 0xe0, - 0xbc, 0xb3, 0xad, 0x71, 0x38, 0x10, 0x4f, 0x34, 0x96, 0x01, 0x50, 0xfd, 0x51, 0xd4, 0x1d, 0xa6, - 0x73, 0x72, 0xec, 0x29, 0xf9, 0x97, 0x18, 0x60, 0x97, 0xe7, 0x7f, 0x79, 0x26, 0x76, 0x06, 0x09, - 0x85, 0xa4, 0xc4, 0x87, 0x0b, 0xfe, 0xaf, 0x1c, 0xd3, 0x17, 0x2d, 0xfb, 0xcd, 0x6f, 0xde, 0x7d, - 0x5d, 0x67, 0xd1, 0x6a, 0x9d, 0x45, 0x3f, 0xd7, 0x59, 0xf4, 0x79, 0x93, 0xcd, 0x56, 0x9b, 0x6c, - 0xf6, 0x7d, 0x93, 0xcd, 0x3e, 0x2d, 0xae, 0xb4, 0xaf, 0xba, 0x0b, 0x2e, 0xcd, 0x75, 0xb1, 0x1d, - 0x7d, 0x32, 0xce, 0x2e, 0x2a, 0xad, 0x4e, 0xc2, 0xf0, 0xe2, 0xb6, 0x08, 0xff, 0x69, 0xf8, 0x22, - 0xdc, 0xc5, 0x9c, 0xda, 0xaf, 0x7e, 0x05, 0x00, 0x00, 0xff, 0xff, 0x5c, 0x80, 0x27, 0x58, 0xbb, - 0x03, 0x00, 0x00, -} - -func (m *Claim) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Claim) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Claim) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.StatusReason) > 0 { - i -= len(m.StatusReason) - copy(dAtA[i:], m.StatusReason) - i = encodeVarintCredential(dAtA, i, uint64(len(m.StatusReason))) - i-- - dAtA[i] = 0x1a - } - if len(m.CurrentStatus) > 0 { - i -= len(m.CurrentStatus) - copy(dAtA[i:], m.CurrentStatus) - i = encodeVarintCredential(dAtA, i, uint64(len(m.CurrentStatus))) - i-- - dAtA[i] = 0x12 - } - if len(m.Id) > 0 { - i -= len(m.Id) - copy(dAtA[i:], m.Id) - i = encodeVarintCredential(dAtA, i, uint64(len(m.Id))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *CredentialStatus) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *CredentialStatus) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *CredentialStatus) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.CredentialHash) > 0 { - i -= len(m.CredentialHash) - copy(dAtA[i:], m.CredentialHash) - i = encodeVarintCredential(dAtA, i, uint64(len(m.CredentialHash))) - i-- - dAtA[i] = 0x2a - } - if len(m.ExpirationDate) > 0 { - i -= len(m.ExpirationDate) - copy(dAtA[i:], m.ExpirationDate) - i = encodeVarintCredential(dAtA, i, uint64(len(m.ExpirationDate))) - i-- - dAtA[i] = 0x22 - } - if len(m.IssuanceDate) > 0 { - i -= len(m.IssuanceDate) - copy(dAtA[i:], m.IssuanceDate) - i = encodeVarintCredential(dAtA, i, uint64(len(m.IssuanceDate))) - i-- - dAtA[i] = 0x1a - } - if len(m.Issuer) > 0 { - i -= len(m.Issuer) - copy(dAtA[i:], m.Issuer) - i = encodeVarintCredential(dAtA, i, uint64(len(m.Issuer))) - i-- - dAtA[i] = 0x12 - } - if m.Claim != nil { - { - size, err := m.Claim.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintCredential(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *CredentialProof) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *CredentialProof) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *CredentialProof) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.ProofValue) > 0 { - i -= len(m.ProofValue) - copy(dAtA[i:], m.ProofValue) - i = encodeVarintCredential(dAtA, i, uint64(len(m.ProofValue))) - i-- - dAtA[i] = 0x32 - } - if len(m.ProofPurpose) > 0 { - i -= len(m.ProofPurpose) - copy(dAtA[i:], m.ProofPurpose) - i = encodeVarintCredential(dAtA, i, uint64(len(m.ProofPurpose))) - i-- - dAtA[i] = 0x2a - } - if len(m.VerificationMethod) > 0 { - i -= len(m.VerificationMethod) - copy(dAtA[i:], m.VerificationMethod) - i = encodeVarintCredential(dAtA, i, uint64(len(m.VerificationMethod))) - i-- - dAtA[i] = 0x22 - } - if len(m.Updated) > 0 { - i -= len(m.Updated) - copy(dAtA[i:], m.Updated) - i = encodeVarintCredential(dAtA, i, uint64(len(m.Updated))) - i-- - dAtA[i] = 0x1a - } - if len(m.Created) > 0 { - i -= len(m.Created) - copy(dAtA[i:], m.Created) - i = encodeVarintCredential(dAtA, i, uint64(len(m.Created))) - i-- - dAtA[i] = 0x12 - } - if len(m.Type) > 0 { - i -= len(m.Type) - copy(dAtA[i:], m.Type) - i = encodeVarintCredential(dAtA, i, uint64(len(m.Type))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Credential) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Credential) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Credential) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Proof != nil { - { - size, err := m.Proof.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintCredential(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x32 - } - if len(m.CredentialHash) > 0 { - i -= len(m.CredentialHash) - copy(dAtA[i:], m.CredentialHash) - i = encodeVarintCredential(dAtA, i, uint64(len(m.CredentialHash))) - i-- - dAtA[i] = 0x2a - } - if len(m.ExpirationDate) > 0 { - i -= len(m.ExpirationDate) - copy(dAtA[i:], m.ExpirationDate) - i = encodeVarintCredential(dAtA, i, uint64(len(m.ExpirationDate))) - i-- - dAtA[i] = 0x22 - } - if len(m.IssuanceDate) > 0 { - i -= len(m.IssuanceDate) - copy(dAtA[i:], m.IssuanceDate) - i = encodeVarintCredential(dAtA, i, uint64(len(m.IssuanceDate))) - i-- - dAtA[i] = 0x1a - } - if len(m.Issuer) > 0 { - i -= len(m.Issuer) - copy(dAtA[i:], m.Issuer) - i = encodeVarintCredential(dAtA, i, uint64(len(m.Issuer))) - i-- - dAtA[i] = 0x12 - } - if m.Claim != nil { - { - size, err := m.Claim.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintCredential(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func encodeVarintCredential(dAtA []byte, offset int, v uint64) int { - offset -= sovCredential(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *Claim) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Id) - if l > 0 { - n += 1 + l + sovCredential(uint64(l)) - } - l = len(m.CurrentStatus) - if l > 0 { - n += 1 + l + sovCredential(uint64(l)) - } - l = len(m.StatusReason) - if l > 0 { - n += 1 + l + sovCredential(uint64(l)) - } - return n -} - -func (m *CredentialStatus) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Claim != nil { - l = m.Claim.Size() - n += 1 + l + sovCredential(uint64(l)) - } - l = len(m.Issuer) - if l > 0 { - n += 1 + l + sovCredential(uint64(l)) - } - l = len(m.IssuanceDate) - if l > 0 { - n += 1 + l + sovCredential(uint64(l)) - } - l = len(m.ExpirationDate) - if l > 0 { - n += 1 + l + sovCredential(uint64(l)) - } - l = len(m.CredentialHash) - if l > 0 { - n += 1 + l + sovCredential(uint64(l)) - } - return n -} - -func (m *CredentialProof) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Type) - if l > 0 { - n += 1 + l + sovCredential(uint64(l)) - } - l = len(m.Created) - if l > 0 { - n += 1 + l + sovCredential(uint64(l)) - } - l = len(m.Updated) - if l > 0 { - n += 1 + l + sovCredential(uint64(l)) - } - l = len(m.VerificationMethod) - if l > 0 { - n += 1 + l + sovCredential(uint64(l)) - } - l = len(m.ProofPurpose) - if l > 0 { - n += 1 + l + sovCredential(uint64(l)) - } - l = len(m.ProofValue) - if l > 0 { - n += 1 + l + sovCredential(uint64(l)) - } - return n -} - -func (m *Credential) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Claim != nil { - l = m.Claim.Size() - n += 1 + l + sovCredential(uint64(l)) - } - l = len(m.Issuer) - if l > 0 { - n += 1 + l + sovCredential(uint64(l)) - } - l = len(m.IssuanceDate) - if l > 0 { - n += 1 + l + sovCredential(uint64(l)) - } - l = len(m.ExpirationDate) - if l > 0 { - n += 1 + l + sovCredential(uint64(l)) - } - l = len(m.CredentialHash) - if l > 0 { - n += 1 + l + sovCredential(uint64(l)) - } - if m.Proof != nil { - l = m.Proof.Size() - n += 1 + l + sovCredential(uint64(l)) - } - return n -} - -func sovCredential(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozCredential(x uint64) (n int) { - return sovCredential(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *Claim) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCredential - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Claim: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Claim: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCredential - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthCredential - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthCredential - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Id = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field CurrentStatus", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCredential - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthCredential - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthCredential - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.CurrentStatus = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field StatusReason", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCredential - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthCredential - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthCredential - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.StatusReason = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipCredential(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthCredential - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *CredentialStatus) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCredential - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: CredentialStatus: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: CredentialStatus: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Claim", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCredential - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthCredential - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthCredential - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Claim == nil { - m.Claim = &Claim{} - } - if err := m.Claim.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Issuer", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCredential - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthCredential - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthCredential - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Issuer = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field IssuanceDate", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCredential - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthCredential - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthCredential - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.IssuanceDate = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ExpirationDate", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCredential - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthCredential - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthCredential - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ExpirationDate = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field CredentialHash", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCredential - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthCredential - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthCredential - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.CredentialHash = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipCredential(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthCredential - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *CredentialProof) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCredential - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: CredentialProof: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: CredentialProof: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCredential - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthCredential - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthCredential - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Type = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Created", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCredential - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthCredential - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthCredential - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Created = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Updated", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCredential - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthCredential - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthCredential - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Updated = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field VerificationMethod", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCredential - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthCredential - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthCredential - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.VerificationMethod = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ProofPurpose", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCredential - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthCredential - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthCredential - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ProofPurpose = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ProofValue", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCredential - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthCredential - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthCredential - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ProofValue = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipCredential(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthCredential - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Credential) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCredential - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Credential: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Credential: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Claim", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCredential - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthCredential - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthCredential - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Claim == nil { - m.Claim = &Claim{} - } - if err := m.Claim.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Issuer", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCredential - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthCredential - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthCredential - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Issuer = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field IssuanceDate", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCredential - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthCredential - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthCredential - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.IssuanceDate = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ExpirationDate", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCredential - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthCredential - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthCredential - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ExpirationDate = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field CredentialHash", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCredential - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthCredential - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthCredential - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.CredentialHash = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Proof", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCredential - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthCredential - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthCredential - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Proof == nil { - m.Proof = &CredentialProof{} - } - if err := m.Proof.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipCredential(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthCredential - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipCredential(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowCredential - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowCredential - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowCredential - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthCredential - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupCredential - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthCredential - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthCredential = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowCredential = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupCredential = fmt.Errorf("proto: unexpected end of group") -) diff --git a/x/ssi/types/credential_schema.pb.go b/x/ssi/types/credential_schema.pb.go new file mode 100644 index 0000000..6d12c59 --- /dev/null +++ b/x/ssi/types/credential_schema.pb.go @@ -0,0 +1,1304 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: ssi/v1/credential_schema.proto + +package types + +import ( + fmt "fmt" + proto "github.com/gogo/protobuf/proto" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +type CredentialSchemaDocument struct { + Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"` + ModelVersion string `protobuf:"bytes,2,opt,name=modelVersion,proto3" json:"modelVersion,omitempty"` + Id string `protobuf:"bytes,3,opt,name=id,proto3" json:"id,omitempty"` + Name string `protobuf:"bytes,4,opt,name=name,proto3" json:"name,omitempty"` + Author string `protobuf:"bytes,5,opt,name=author,proto3" json:"author,omitempty"` + Authored string `protobuf:"bytes,6,opt,name=authored,proto3" json:"authored,omitempty"` + Schema *CredentialSchemaProperty `protobuf:"bytes,7,opt,name=schema,proto3" json:"schema,omitempty"` +} + +func (m *CredentialSchemaDocument) Reset() { *m = CredentialSchemaDocument{} } +func (m *CredentialSchemaDocument) String() string { return proto.CompactTextString(m) } +func (*CredentialSchemaDocument) ProtoMessage() {} +func (*CredentialSchemaDocument) Descriptor() ([]byte, []int) { + return fileDescriptor_9a5852fe559c17be, []int{0} +} +func (m *CredentialSchemaDocument) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *CredentialSchemaDocument) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_CredentialSchemaDocument.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *CredentialSchemaDocument) XXX_Merge(src proto.Message) { + xxx_messageInfo_CredentialSchemaDocument.Merge(m, src) +} +func (m *CredentialSchemaDocument) XXX_Size() int { + return m.Size() +} +func (m *CredentialSchemaDocument) XXX_DiscardUnknown() { + xxx_messageInfo_CredentialSchemaDocument.DiscardUnknown(m) +} + +var xxx_messageInfo_CredentialSchemaDocument proto.InternalMessageInfo + +func (m *CredentialSchemaDocument) GetType() string { + if m != nil { + return m.Type + } + return "" +} + +func (m *CredentialSchemaDocument) GetModelVersion() string { + if m != nil { + return m.ModelVersion + } + return "" +} + +func (m *CredentialSchemaDocument) GetId() string { + if m != nil { + return m.Id + } + return "" +} + +func (m *CredentialSchemaDocument) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +func (m *CredentialSchemaDocument) GetAuthor() string { + if m != nil { + return m.Author + } + return "" +} + +func (m *CredentialSchemaDocument) GetAuthored() string { + if m != nil { + return m.Authored + } + return "" +} + +func (m *CredentialSchemaDocument) GetSchema() *CredentialSchemaProperty { + if m != nil { + return m.Schema + } + return nil +} + +type CredentialSchemaProperty struct { + Schema string `protobuf:"bytes,1,opt,name=schema,proto3" json:"schema,omitempty"` + Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` + Type string `protobuf:"bytes,3,opt,name=type,proto3" json:"type,omitempty"` + Properties string `protobuf:"bytes,4,opt,name=properties,proto3" json:"properties,omitempty"` + Required []string `protobuf:"bytes,5,rep,name=required,proto3" json:"required,omitempty"` + AdditionalProperties bool `protobuf:"varint,6,opt,name=additionalProperties,proto3" json:"additionalProperties,omitempty"` +} + +func (m *CredentialSchemaProperty) Reset() { *m = CredentialSchemaProperty{} } +func (m *CredentialSchemaProperty) String() string { return proto.CompactTextString(m) } +func (*CredentialSchemaProperty) ProtoMessage() {} +func (*CredentialSchemaProperty) Descriptor() ([]byte, []int) { + return fileDescriptor_9a5852fe559c17be, []int{1} +} +func (m *CredentialSchemaProperty) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *CredentialSchemaProperty) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_CredentialSchemaProperty.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *CredentialSchemaProperty) XXX_Merge(src proto.Message) { + xxx_messageInfo_CredentialSchemaProperty.Merge(m, src) +} +func (m *CredentialSchemaProperty) XXX_Size() int { + return m.Size() +} +func (m *CredentialSchemaProperty) XXX_DiscardUnknown() { + xxx_messageInfo_CredentialSchemaProperty.DiscardUnknown(m) +} + +var xxx_messageInfo_CredentialSchemaProperty proto.InternalMessageInfo + +func (m *CredentialSchemaProperty) GetSchema() string { + if m != nil { + return m.Schema + } + return "" +} + +func (m *CredentialSchemaProperty) GetDescription() string { + if m != nil { + return m.Description + } + return "" +} + +func (m *CredentialSchemaProperty) GetType() string { + if m != nil { + return m.Type + } + return "" +} + +func (m *CredentialSchemaProperty) GetProperties() string { + if m != nil { + return m.Properties + } + return "" +} + +func (m *CredentialSchemaProperty) GetRequired() []string { + if m != nil { + return m.Required + } + return nil +} + +func (m *CredentialSchemaProperty) GetAdditionalProperties() bool { + if m != nil { + return m.AdditionalProperties + } + return false +} + +type CredentialSchemaState struct { + CredentialSchemaDocument *CredentialSchemaDocument `protobuf:"bytes,1,opt,name=credentialSchemaDocument,proto3" json:"credentialSchemaDocument,omitempty"` + CredentialSchemaProof *DocumentProof `protobuf:"bytes,2,opt,name=credentialSchemaProof,proto3" json:"credentialSchemaProof,omitempty"` +} + +func (m *CredentialSchemaState) Reset() { *m = CredentialSchemaState{} } +func (m *CredentialSchemaState) String() string { return proto.CompactTextString(m) } +func (*CredentialSchemaState) ProtoMessage() {} +func (*CredentialSchemaState) Descriptor() ([]byte, []int) { + return fileDescriptor_9a5852fe559c17be, []int{2} +} +func (m *CredentialSchemaState) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *CredentialSchemaState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_CredentialSchemaState.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *CredentialSchemaState) XXX_Merge(src proto.Message) { + xxx_messageInfo_CredentialSchemaState.Merge(m, src) +} +func (m *CredentialSchemaState) XXX_Size() int { + return m.Size() +} +func (m *CredentialSchemaState) XXX_DiscardUnknown() { + xxx_messageInfo_CredentialSchemaState.DiscardUnknown(m) +} + +var xxx_messageInfo_CredentialSchemaState proto.InternalMessageInfo + +func (m *CredentialSchemaState) GetCredentialSchemaDocument() *CredentialSchemaDocument { + if m != nil { + return m.CredentialSchemaDocument + } + return nil +} + +func (m *CredentialSchemaState) GetCredentialSchemaProof() *DocumentProof { + if m != nil { + return m.CredentialSchemaProof + } + return nil +} + +func init() { + proto.RegisterType((*CredentialSchemaDocument)(nil), "hypersign.ssi.v1.CredentialSchemaDocument") + proto.RegisterType((*CredentialSchemaProperty)(nil), "hypersign.ssi.v1.CredentialSchemaProperty") + proto.RegisterType((*CredentialSchemaState)(nil), "hypersign.ssi.v1.CredentialSchemaState") +} + +func init() { proto.RegisterFile("ssi/v1/credential_schema.proto", fileDescriptor_9a5852fe559c17be) } + +var fileDescriptor_9a5852fe559c17be = []byte{ + // 419 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x92, 0x3d, 0x8f, 0xd3, 0x30, + 0x1c, 0xc6, 0xeb, 0xf6, 0x2e, 0x1c, 0x2e, 0x42, 0xc8, 0xe2, 0x90, 0x75, 0x83, 0x89, 0x32, 0x9d, + 0x90, 0x2e, 0xd1, 0x85, 0x6f, 0x70, 0x30, 0x32, 0x9c, 0x52, 0xc1, 0xc0, 0x82, 0x52, 0xdb, 0x6d, + 0x2c, 0x25, 0x71, 0xb0, 0x9d, 0x8a, 0x7e, 0x0b, 0x3e, 0x16, 0x63, 0x27, 0xd4, 0x11, 0xb5, 0x3b, + 0x9f, 0x01, 0xd9, 0x79, 0x69, 0xe9, 0x8b, 0x74, 0xdb, 0xff, 0xf5, 0xb1, 0x7f, 0x8f, 0x0d, 0x89, + 0xd6, 0x22, 0x5a, 0xdc, 0x47, 0x54, 0x71, 0xc6, 0x4b, 0x23, 0xd2, 0xfc, 0x9b, 0xa6, 0x19, 0x2f, + 0xd2, 0xb0, 0x52, 0xd2, 0x48, 0xf4, 0x2a, 0x5b, 0x56, 0x5c, 0x69, 0x31, 0x2f, 0x43, 0xad, 0x45, + 0xb8, 0xb8, 0xbf, 0x41, 0xed, 0x46, 0xa5, 0xa4, 0x9c, 0x35, 0x53, 0xc1, 0x5f, 0x00, 0xf1, 0x87, + 0x5e, 0x61, 0xe2, 0x04, 0x3e, 0x4a, 0x5a, 0x17, 0xbc, 0x34, 0x08, 0xc1, 0x0b, 0xb3, 0xac, 0x38, + 0x06, 0x3e, 0xb8, 0x7d, 0x9e, 0xb8, 0x18, 0x05, 0xf0, 0x45, 0x21, 0x19, 0xcf, 0xbf, 0x58, 0x6d, + 0x59, 0xe2, 0xa1, 0xeb, 0xfd, 0x57, 0x43, 0x2f, 0xe1, 0x50, 0x30, 0x3c, 0x72, 0x9d, 0xa1, 0x60, + 0x56, 0xa7, 0x4c, 0x0b, 0x8e, 0x2f, 0x1a, 0x1d, 0x1b, 0xa3, 0x37, 0xd0, 0x4b, 0x6b, 0x93, 0x49, + 0x85, 0x2f, 0x5d, 0xb5, 0xcd, 0xd0, 0x0d, 0xbc, 0x6a, 0x22, 0xce, 0xb0, 0xe7, 0x3a, 0x7d, 0x8e, + 0x1e, 0xa0, 0xd7, 0x20, 0xe2, 0x67, 0x3e, 0xb8, 0x1d, 0xc7, 0xef, 0xc2, 0x43, 0xc6, 0xf0, 0x90, + 0xe5, 0x51, 0xc9, 0x8a, 0x2b, 0xb3, 0x4c, 0xda, 0xcd, 0x60, 0x7d, 0x02, 0xb8, 0x1b, 0xb2, 0x97, + 0x6a, 0x0f, 0x68, 0x90, 0xdb, 0x0c, 0xf9, 0x70, 0xcc, 0xb8, 0xa6, 0x4a, 0x54, 0x66, 0xc7, 0xbc, + 0x5f, 0xea, 0xad, 0x1a, 0xed, 0x59, 0x45, 0x20, 0xac, 0x1a, 0x65, 0xc1, 0x75, 0x0b, 0xbf, 0x57, + 0xb1, 0xa8, 0x8a, 0x7f, 0xaf, 0x85, 0x45, 0xbd, 0xf4, 0x47, 0x16, 0xb5, 0xcb, 0x51, 0x0c, 0x5f, + 0xa7, 0x8c, 0x09, 0xab, 0x9d, 0xe6, 0x8f, 0x3b, 0x15, 0x6b, 0xc9, 0x55, 0x72, 0xb2, 0x17, 0xfc, + 0x06, 0xf0, 0xfa, 0x10, 0x6d, 0x62, 0x52, 0xc3, 0xd1, 0x0c, 0x62, 0x7a, 0xe6, 0x91, 0x1d, 0xe9, + 0x93, 0xac, 0xec, 0x36, 0x92, 0xb3, 0x5a, 0xe8, 0x33, 0xbc, 0xa6, 0xc7, 0xde, 0xca, 0x99, 0x73, + 0x6c, 0x1c, 0xbf, 0x3d, 0x3e, 0xa4, 0x5b, 0x75, 0x63, 0xc9, 0xe9, 0xed, 0x87, 0x4f, 0xbf, 0x36, + 0x04, 0xac, 0x36, 0x04, 0xfc, 0xd9, 0x10, 0xf0, 0x73, 0x4b, 0x06, 0xab, 0x2d, 0x19, 0xac, 0xb7, + 0x64, 0xf0, 0x35, 0x9e, 0x0b, 0x93, 0xd5, 0xd3, 0x90, 0xca, 0x22, 0xea, 0xb5, 0xef, 0xdc, 0xd7, + 0xa6, 0x32, 0x8f, 0x32, 0xc1, 0xee, 0x4a, 0xc9, 0x78, 0xf4, 0x23, 0xb2, 0x7f, 0xdf, 0xbe, 0x8a, + 0x9e, 0x7a, 0xae, 0xfd, 0xfe, 0x5f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xae, 0x9f, 0xe4, 0xda, 0x41, + 0x03, 0x00, 0x00, +} + +func (m *CredentialSchemaDocument) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *CredentialSchemaDocument) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *CredentialSchemaDocument) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Schema != nil { + { + size, err := m.Schema.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintCredentialSchema(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x3a + } + if len(m.Authored) > 0 { + i -= len(m.Authored) + copy(dAtA[i:], m.Authored) + i = encodeVarintCredentialSchema(dAtA, i, uint64(len(m.Authored))) + i-- + dAtA[i] = 0x32 + } + if len(m.Author) > 0 { + i -= len(m.Author) + copy(dAtA[i:], m.Author) + i = encodeVarintCredentialSchema(dAtA, i, uint64(len(m.Author))) + i-- + dAtA[i] = 0x2a + } + if len(m.Name) > 0 { + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarintCredentialSchema(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0x22 + } + if len(m.Id) > 0 { + i -= len(m.Id) + copy(dAtA[i:], m.Id) + i = encodeVarintCredentialSchema(dAtA, i, uint64(len(m.Id))) + i-- + dAtA[i] = 0x1a + } + if len(m.ModelVersion) > 0 { + i -= len(m.ModelVersion) + copy(dAtA[i:], m.ModelVersion) + i = encodeVarintCredentialSchema(dAtA, i, uint64(len(m.ModelVersion))) + i-- + dAtA[i] = 0x12 + } + if len(m.Type) > 0 { + i -= len(m.Type) + copy(dAtA[i:], m.Type) + i = encodeVarintCredentialSchema(dAtA, i, uint64(len(m.Type))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *CredentialSchemaProperty) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *CredentialSchemaProperty) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *CredentialSchemaProperty) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.AdditionalProperties { + i-- + if m.AdditionalProperties { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x30 + } + if len(m.Required) > 0 { + for iNdEx := len(m.Required) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.Required[iNdEx]) + copy(dAtA[i:], m.Required[iNdEx]) + i = encodeVarintCredentialSchema(dAtA, i, uint64(len(m.Required[iNdEx]))) + i-- + dAtA[i] = 0x2a + } + } + if len(m.Properties) > 0 { + i -= len(m.Properties) + copy(dAtA[i:], m.Properties) + i = encodeVarintCredentialSchema(dAtA, i, uint64(len(m.Properties))) + i-- + dAtA[i] = 0x22 + } + if len(m.Type) > 0 { + i -= len(m.Type) + copy(dAtA[i:], m.Type) + i = encodeVarintCredentialSchema(dAtA, i, uint64(len(m.Type))) + i-- + dAtA[i] = 0x1a + } + if len(m.Description) > 0 { + i -= len(m.Description) + copy(dAtA[i:], m.Description) + i = encodeVarintCredentialSchema(dAtA, i, uint64(len(m.Description))) + i-- + dAtA[i] = 0x12 + } + if len(m.Schema) > 0 { + i -= len(m.Schema) + copy(dAtA[i:], m.Schema) + i = encodeVarintCredentialSchema(dAtA, i, uint64(len(m.Schema))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *CredentialSchemaState) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *CredentialSchemaState) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *CredentialSchemaState) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.CredentialSchemaProof != nil { + { + size, err := m.CredentialSchemaProof.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintCredentialSchema(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if m.CredentialSchemaDocument != nil { + { + size, err := m.CredentialSchemaDocument.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintCredentialSchema(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintCredentialSchema(dAtA []byte, offset int, v uint64) int { + offset -= sovCredentialSchema(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *CredentialSchemaDocument) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Type) + if l > 0 { + n += 1 + l + sovCredentialSchema(uint64(l)) + } + l = len(m.ModelVersion) + if l > 0 { + n += 1 + l + sovCredentialSchema(uint64(l)) + } + l = len(m.Id) + if l > 0 { + n += 1 + l + sovCredentialSchema(uint64(l)) + } + l = len(m.Name) + if l > 0 { + n += 1 + l + sovCredentialSchema(uint64(l)) + } + l = len(m.Author) + if l > 0 { + n += 1 + l + sovCredentialSchema(uint64(l)) + } + l = len(m.Authored) + if l > 0 { + n += 1 + l + sovCredentialSchema(uint64(l)) + } + if m.Schema != nil { + l = m.Schema.Size() + n += 1 + l + sovCredentialSchema(uint64(l)) + } + return n +} + +func (m *CredentialSchemaProperty) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Schema) + if l > 0 { + n += 1 + l + sovCredentialSchema(uint64(l)) + } + l = len(m.Description) + if l > 0 { + n += 1 + l + sovCredentialSchema(uint64(l)) + } + l = len(m.Type) + if l > 0 { + n += 1 + l + sovCredentialSchema(uint64(l)) + } + l = len(m.Properties) + if l > 0 { + n += 1 + l + sovCredentialSchema(uint64(l)) + } + if len(m.Required) > 0 { + for _, s := range m.Required { + l = len(s) + n += 1 + l + sovCredentialSchema(uint64(l)) + } + } + if m.AdditionalProperties { + n += 2 + } + return n +} + +func (m *CredentialSchemaState) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.CredentialSchemaDocument != nil { + l = m.CredentialSchemaDocument.Size() + n += 1 + l + sovCredentialSchema(uint64(l)) + } + if m.CredentialSchemaProof != nil { + l = m.CredentialSchemaProof.Size() + n += 1 + l + sovCredentialSchema(uint64(l)) + } + return n +} + +func sovCredentialSchema(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozCredentialSchema(x uint64) (n int) { + return sovCredentialSchema(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *CredentialSchemaDocument) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCredentialSchema + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: CredentialSchemaDocument: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: CredentialSchemaDocument: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCredentialSchema + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthCredentialSchema + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthCredentialSchema + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Type = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ModelVersion", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCredentialSchema + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthCredentialSchema + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthCredentialSchema + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ModelVersion = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCredentialSchema + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthCredentialSchema + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthCredentialSchema + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Id = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCredentialSchema + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthCredentialSchema + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthCredentialSchema + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Author", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCredentialSchema + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthCredentialSchema + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthCredentialSchema + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Author = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Authored", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCredentialSchema + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthCredentialSchema + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthCredentialSchema + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Authored = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Schema", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCredentialSchema + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthCredentialSchema + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthCredentialSchema + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Schema == nil { + m.Schema = &CredentialSchemaProperty{} + } + if err := m.Schema.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipCredentialSchema(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthCredentialSchema + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *CredentialSchemaProperty) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCredentialSchema + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: CredentialSchemaProperty: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: CredentialSchemaProperty: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Schema", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCredentialSchema + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthCredentialSchema + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthCredentialSchema + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Schema = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Description", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCredentialSchema + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthCredentialSchema + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthCredentialSchema + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Description = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCredentialSchema + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthCredentialSchema + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthCredentialSchema + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Type = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Properties", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCredentialSchema + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthCredentialSchema + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthCredentialSchema + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Properties = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Required", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCredentialSchema + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthCredentialSchema + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthCredentialSchema + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Required = append(m.Required, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 6: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field AdditionalProperties", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCredentialSchema + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.AdditionalProperties = bool(v != 0) + default: + iNdEx = preIndex + skippy, err := skipCredentialSchema(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthCredentialSchema + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *CredentialSchemaState) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCredentialSchema + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: CredentialSchemaState: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: CredentialSchemaState: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CredentialSchemaDocument", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCredentialSchema + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthCredentialSchema + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthCredentialSchema + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.CredentialSchemaDocument == nil { + m.CredentialSchemaDocument = &CredentialSchemaDocument{} + } + if err := m.CredentialSchemaDocument.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CredentialSchemaProof", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCredentialSchema + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthCredentialSchema + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthCredentialSchema + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.CredentialSchemaProof == nil { + m.CredentialSchemaProof = &DocumentProof{} + } + if err := m.CredentialSchemaProof.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipCredentialSchema(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthCredentialSchema + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipCredentialSchema(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowCredentialSchema + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowCredentialSchema + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowCredentialSchema + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthCredentialSchema + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupCredentialSchema + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthCredentialSchema + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthCredentialSchema = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowCredentialSchema = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupCredentialSchema = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/ssi/types/credential_status.pb.go b/x/ssi/types/credential_status.pb.go new file mode 100644 index 0000000..3490b21 --- /dev/null +++ b/x/ssi/types/credential_status.pb.go @@ -0,0 +1,851 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: ssi/v1/credential_status.proto + +package types + +import ( + fmt "fmt" + proto "github.com/gogo/protobuf/proto" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +type CredentialStatusDocument struct { + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Revoked bool `protobuf:"varint,2,opt,name=revoked,proto3" json:"revoked,omitempty"` + Suspended bool `protobuf:"varint,3,opt,name=suspended,proto3" json:"suspended,omitempty"` + Remarks string `protobuf:"bytes,4,opt,name=remarks,proto3" json:"remarks,omitempty"` + Issuer string `protobuf:"bytes,5,opt,name=issuer,proto3" json:"issuer,omitempty"` + IssuanceDate string `protobuf:"bytes,6,opt,name=issuanceDate,proto3" json:"issuanceDate,omitempty"` + MerkleRootHash string `protobuf:"bytes,7,opt,name=merkleRootHash,proto3" json:"merkleRootHash,omitempty"` +} + +func (m *CredentialStatusDocument) Reset() { *m = CredentialStatusDocument{} } +func (m *CredentialStatusDocument) String() string { return proto.CompactTextString(m) } +func (*CredentialStatusDocument) ProtoMessage() {} +func (*CredentialStatusDocument) Descriptor() ([]byte, []int) { + return fileDescriptor_9807097035021c62, []int{0} +} +func (m *CredentialStatusDocument) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *CredentialStatusDocument) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_CredentialStatusDocument.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *CredentialStatusDocument) XXX_Merge(src proto.Message) { + xxx_messageInfo_CredentialStatusDocument.Merge(m, src) +} +func (m *CredentialStatusDocument) XXX_Size() int { + return m.Size() +} +func (m *CredentialStatusDocument) XXX_DiscardUnknown() { + xxx_messageInfo_CredentialStatusDocument.DiscardUnknown(m) +} + +var xxx_messageInfo_CredentialStatusDocument proto.InternalMessageInfo + +func (m *CredentialStatusDocument) GetId() string { + if m != nil { + return m.Id + } + return "" +} + +func (m *CredentialStatusDocument) GetRevoked() bool { + if m != nil { + return m.Revoked + } + return false +} + +func (m *CredentialStatusDocument) GetSuspended() bool { + if m != nil { + return m.Suspended + } + return false +} + +func (m *CredentialStatusDocument) GetRemarks() string { + if m != nil { + return m.Remarks + } + return "" +} + +func (m *CredentialStatusDocument) GetIssuer() string { + if m != nil { + return m.Issuer + } + return "" +} + +func (m *CredentialStatusDocument) GetIssuanceDate() string { + if m != nil { + return m.IssuanceDate + } + return "" +} + +func (m *CredentialStatusDocument) GetMerkleRootHash() string { + if m != nil { + return m.MerkleRootHash + } + return "" +} + +type CredentialStatusState struct { + CredentialStatusDocument *CredentialStatusDocument `protobuf:"bytes,1,opt,name=credentialStatusDocument,proto3" json:"credentialStatusDocument,omitempty"` + CredentialStatusProof *DocumentProof `protobuf:"bytes,2,opt,name=credentialStatusProof,proto3" json:"credentialStatusProof,omitempty"` +} + +func (m *CredentialStatusState) Reset() { *m = CredentialStatusState{} } +func (m *CredentialStatusState) String() string { return proto.CompactTextString(m) } +func (*CredentialStatusState) ProtoMessage() {} +func (*CredentialStatusState) Descriptor() ([]byte, []int) { + return fileDescriptor_9807097035021c62, []int{1} +} +func (m *CredentialStatusState) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *CredentialStatusState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_CredentialStatusState.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *CredentialStatusState) XXX_Merge(src proto.Message) { + xxx_messageInfo_CredentialStatusState.Merge(m, src) +} +func (m *CredentialStatusState) XXX_Size() int { + return m.Size() +} +func (m *CredentialStatusState) XXX_DiscardUnknown() { + xxx_messageInfo_CredentialStatusState.DiscardUnknown(m) +} + +var xxx_messageInfo_CredentialStatusState proto.InternalMessageInfo + +func (m *CredentialStatusState) GetCredentialStatusDocument() *CredentialStatusDocument { + if m != nil { + return m.CredentialStatusDocument + } + return nil +} + +func (m *CredentialStatusState) GetCredentialStatusProof() *DocumentProof { + if m != nil { + return m.CredentialStatusProof + } + return nil +} + +func init() { + proto.RegisterType((*CredentialStatusDocument)(nil), "hypersign.ssi.v1.CredentialStatusDocument") + proto.RegisterType((*CredentialStatusState)(nil), "hypersign.ssi.v1.CredentialStatusState") +} + +func init() { proto.RegisterFile("ssi/v1/credential_status.proto", fileDescriptor_9807097035021c62) } + +var fileDescriptor_9807097035021c62 = []byte{ + // 351 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x52, 0xcd, 0x4e, 0x32, 0x31, + 0x14, 0xa5, 0x7c, 0xdf, 0x07, 0x1f, 0xc5, 0x10, 0xd3, 0x04, 0xd3, 0x18, 0x33, 0x12, 0x16, 0x86, + 0x98, 0x30, 0x13, 0xf0, 0x0d, 0x94, 0x85, 0x0b, 0x17, 0x66, 0x8c, 0x1b, 0x37, 0x66, 0x98, 0x5e, + 0x98, 0x06, 0x66, 0x3a, 0xe9, 0xed, 0x10, 0x79, 0x0b, 0x1f, 0xcb, 0x25, 0x2b, 0xe3, 0x92, 0xc0, + 0x8b, 0x98, 0x29, 0x3f, 0xc6, 0x51, 0x36, 0x4d, 0xef, 0x3d, 0xf7, 0x9c, 0xe6, 0x9c, 0x5b, 0xea, + 0x20, 0x4a, 0x6f, 0xd6, 0xf3, 0x42, 0x0d, 0x02, 0x12, 0x23, 0x83, 0xe9, 0x33, 0x9a, 0xc0, 0x64, + 0xe8, 0xa6, 0x5a, 0x19, 0xc5, 0x8e, 0xa3, 0x79, 0x0a, 0x1a, 0xe5, 0x38, 0x71, 0x11, 0xa5, 0x3b, + 0xeb, 0x9d, 0xb2, 0x2d, 0x23, 0xd5, 0x4a, 0x8d, 0x36, 0x53, 0xed, 0x25, 0xa1, 0xfc, 0x66, 0xaf, + 0xf0, 0x60, 0x05, 0x06, 0x2a, 0xcc, 0x62, 0x48, 0x0c, 0x6b, 0xd0, 0xb2, 0x14, 0x9c, 0xb4, 0x48, + 0xa7, 0xe6, 0x97, 0xa5, 0x60, 0x9c, 0x56, 0x35, 0xcc, 0xd4, 0x04, 0x04, 0x2f, 0xb7, 0x48, 0xe7, + 0xbf, 0xbf, 0x2b, 0xd9, 0x19, 0xad, 0x61, 0x86, 0x29, 0x24, 0x02, 0x04, 0xff, 0x63, 0xb1, 0xaf, + 0xc6, 0x86, 0x17, 0x07, 0x7a, 0x82, 0xfc, 0xaf, 0x15, 0xdb, 0x95, 0xec, 0x84, 0x56, 0x24, 0x62, + 0x06, 0x9a, 0xff, 0xb3, 0xc0, 0xb6, 0x62, 0x6d, 0x7a, 0x94, 0xdf, 0x82, 0x24, 0x84, 0x41, 0x60, + 0x80, 0x57, 0x2c, 0xfa, 0xad, 0xc7, 0x2e, 0x68, 0x23, 0x06, 0x3d, 0x99, 0x82, 0xaf, 0x94, 0xb9, + 0x0d, 0x30, 0xe2, 0x55, 0x3b, 0x55, 0xe8, 0xb6, 0xdf, 0x09, 0x6d, 0x16, 0x2d, 0xe6, 0x27, 0xb0, + 0x11, 0xe5, 0xe1, 0x01, 0xef, 0xd6, 0x75, 0xbd, 0x7f, 0xe9, 0x16, 0x53, 0x74, 0x0f, 0xa5, 0xe5, + 0x1f, 0xd4, 0x62, 0x8f, 0xb4, 0x59, 0xc4, 0xee, 0xf3, 0x1d, 0xd8, 0x14, 0xeb, 0xfd, 0xf3, 0x9f, + 0x8f, 0xec, 0xa8, 0x76, 0xcc, 0xff, 0x9d, 0x7d, 0x7d, 0xf7, 0xb6, 0x72, 0xc8, 0x62, 0xe5, 0x90, + 0xe5, 0xca, 0x21, 0xaf, 0x6b, 0xa7, 0xb4, 0x58, 0x3b, 0xa5, 0x8f, 0xb5, 0x53, 0x7a, 0xea, 0x8f, + 0xa5, 0x89, 0xb2, 0xa1, 0x1b, 0xaa, 0xd8, 0xdb, 0x6b, 0x77, 0xed, 0xc6, 0x43, 0x35, 0xf5, 0x22, + 0x29, 0xba, 0x89, 0x12, 0xe0, 0xbd, 0x78, 0xf9, 0x97, 0x30, 0xf3, 0x14, 0x70, 0x58, 0xb1, 0xf0, + 0xd5, 0x67, 0x00, 0x00, 0x00, 0xff, 0xff, 0x11, 0x6f, 0x85, 0x46, 0x58, 0x02, 0x00, 0x00, +} + +func (m *CredentialStatusDocument) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *CredentialStatusDocument) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *CredentialStatusDocument) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.MerkleRootHash) > 0 { + i -= len(m.MerkleRootHash) + copy(dAtA[i:], m.MerkleRootHash) + i = encodeVarintCredentialStatus(dAtA, i, uint64(len(m.MerkleRootHash))) + i-- + dAtA[i] = 0x3a + } + if len(m.IssuanceDate) > 0 { + i -= len(m.IssuanceDate) + copy(dAtA[i:], m.IssuanceDate) + i = encodeVarintCredentialStatus(dAtA, i, uint64(len(m.IssuanceDate))) + i-- + dAtA[i] = 0x32 + } + if len(m.Issuer) > 0 { + i -= len(m.Issuer) + copy(dAtA[i:], m.Issuer) + i = encodeVarintCredentialStatus(dAtA, i, uint64(len(m.Issuer))) + i-- + dAtA[i] = 0x2a + } + if len(m.Remarks) > 0 { + i -= len(m.Remarks) + copy(dAtA[i:], m.Remarks) + i = encodeVarintCredentialStatus(dAtA, i, uint64(len(m.Remarks))) + i-- + dAtA[i] = 0x22 + } + if m.Suspended { + i-- + if m.Suspended { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x18 + } + if m.Revoked { + i-- + if m.Revoked { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x10 + } + if len(m.Id) > 0 { + i -= len(m.Id) + copy(dAtA[i:], m.Id) + i = encodeVarintCredentialStatus(dAtA, i, uint64(len(m.Id))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *CredentialStatusState) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *CredentialStatusState) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *CredentialStatusState) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.CredentialStatusProof != nil { + { + size, err := m.CredentialStatusProof.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintCredentialStatus(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if m.CredentialStatusDocument != nil { + { + size, err := m.CredentialStatusDocument.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintCredentialStatus(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintCredentialStatus(dAtA []byte, offset int, v uint64) int { + offset -= sovCredentialStatus(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *CredentialStatusDocument) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Id) + if l > 0 { + n += 1 + l + sovCredentialStatus(uint64(l)) + } + if m.Revoked { + n += 2 + } + if m.Suspended { + n += 2 + } + l = len(m.Remarks) + if l > 0 { + n += 1 + l + sovCredentialStatus(uint64(l)) + } + l = len(m.Issuer) + if l > 0 { + n += 1 + l + sovCredentialStatus(uint64(l)) + } + l = len(m.IssuanceDate) + if l > 0 { + n += 1 + l + sovCredentialStatus(uint64(l)) + } + l = len(m.MerkleRootHash) + if l > 0 { + n += 1 + l + sovCredentialStatus(uint64(l)) + } + return n +} + +func (m *CredentialStatusState) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.CredentialStatusDocument != nil { + l = m.CredentialStatusDocument.Size() + n += 1 + l + sovCredentialStatus(uint64(l)) + } + if m.CredentialStatusProof != nil { + l = m.CredentialStatusProof.Size() + n += 1 + l + sovCredentialStatus(uint64(l)) + } + return n +} + +func sovCredentialStatus(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozCredentialStatus(x uint64) (n int) { + return sovCredentialStatus(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *CredentialStatusDocument) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCredentialStatus + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: CredentialStatusDocument: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: CredentialStatusDocument: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCredentialStatus + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthCredentialStatus + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthCredentialStatus + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Id = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Revoked", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCredentialStatus + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Revoked = bool(v != 0) + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Suspended", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCredentialStatus + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Suspended = bool(v != 0) + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Remarks", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCredentialStatus + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthCredentialStatus + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthCredentialStatus + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Remarks = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Issuer", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCredentialStatus + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthCredentialStatus + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthCredentialStatus + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Issuer = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field IssuanceDate", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCredentialStatus + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthCredentialStatus + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthCredentialStatus + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.IssuanceDate = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MerkleRootHash", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCredentialStatus + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthCredentialStatus + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthCredentialStatus + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.MerkleRootHash = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipCredentialStatus(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthCredentialStatus + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *CredentialStatusState) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCredentialStatus + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: CredentialStatusState: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: CredentialStatusState: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CredentialStatusDocument", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCredentialStatus + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthCredentialStatus + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthCredentialStatus + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.CredentialStatusDocument == nil { + m.CredentialStatusDocument = &CredentialStatusDocument{} + } + if err := m.CredentialStatusDocument.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CredentialStatusProof", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCredentialStatus + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthCredentialStatus + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthCredentialStatus + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.CredentialStatusProof == nil { + m.CredentialStatusProof = &DocumentProof{} + } + if err := m.CredentialStatusProof.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipCredentialStatus(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthCredentialStatus + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipCredentialStatus(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowCredentialStatus + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowCredentialStatus + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowCredentialStatus + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthCredentialStatus + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupCredentialStatus + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthCredentialStatus + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthCredentialStatus = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowCredentialStatus = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupCredentialStatus = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/ssi/types/did.pb.go b/x/ssi/types/did.pb.go index b264abd..9394d5e 100644 --- a/x/ssi/types/did.pb.go +++ b/x/ssi/types/did.pb.go @@ -23,8 +23,8 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package -type Did struct { - Context []string `protobuf:"bytes,1,rep,name=context,proto3" json:"@context"` +type DidDocument struct { + Context []string `protobuf:"bytes,1,rep,name=context,json=@context,proto3" json:"@context"` Id string `protobuf:"bytes,2,opt,name=id,proto3" json:"id,omitempty"` Controller []string `protobuf:"bytes,3,rep,name=controller,proto3" json:"controller,omitempty"` AlsoKnownAs []string `protobuf:"bytes,4,rep,name=alsoKnownAs,proto3" json:"alsoKnownAs,omitempty"` @@ -37,18 +37,18 @@ type Did struct { Service []*Service `protobuf:"bytes,11,rep,name=service,proto3" json:"service,omitempty"` } -func (m *Did) Reset() { *m = Did{} } -func (m *Did) String() string { return proto.CompactTextString(m) } -func (*Did) ProtoMessage() {} -func (*Did) Descriptor() ([]byte, []int) { +func (m *DidDocument) Reset() { *m = DidDocument{} } +func (m *DidDocument) String() string { return proto.CompactTextString(m) } +func (*DidDocument) ProtoMessage() {} +func (*DidDocument) Descriptor() ([]byte, []int) { return fileDescriptor_cddfa22cf6c6aba3, []int{0} } -func (m *Did) XXX_Unmarshal(b []byte) error { +func (m *DidDocument) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *Did) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *DidDocument) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_Did.Marshal(b, m, deterministic) + return xxx_messageInfo_DidDocument.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -58,114 +58,114 @@ func (m *Did) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return b[:n], nil } } -func (m *Did) XXX_Merge(src proto.Message) { - xxx_messageInfo_Did.Merge(m, src) +func (m *DidDocument) XXX_Merge(src proto.Message) { + xxx_messageInfo_DidDocument.Merge(m, src) } -func (m *Did) XXX_Size() int { +func (m *DidDocument) XXX_Size() int { return m.Size() } -func (m *Did) XXX_DiscardUnknown() { - xxx_messageInfo_Did.DiscardUnknown(m) +func (m *DidDocument) XXX_DiscardUnknown() { + xxx_messageInfo_DidDocument.DiscardUnknown(m) } -var xxx_messageInfo_Did proto.InternalMessageInfo +var xxx_messageInfo_DidDocument proto.InternalMessageInfo -func (m *Did) GetContext() []string { +func (m *DidDocument) GetContext() []string { if m != nil { return m.Context } return nil } -func (m *Did) GetId() string { +func (m *DidDocument) GetId() string { if m != nil { return m.Id } return "" } -func (m *Did) GetController() []string { +func (m *DidDocument) GetController() []string { if m != nil { return m.Controller } return nil } -func (m *Did) GetAlsoKnownAs() []string { +func (m *DidDocument) GetAlsoKnownAs() []string { if m != nil { return m.AlsoKnownAs } return nil } -func (m *Did) GetVerificationMethod() []*VerificationMethod { +func (m *DidDocument) GetVerificationMethod() []*VerificationMethod { if m != nil { return m.VerificationMethod } return nil } -func (m *Did) GetAuthentication() []string { +func (m *DidDocument) GetAuthentication() []string { if m != nil { return m.Authentication } return nil } -func (m *Did) GetAssertionMethod() []string { +func (m *DidDocument) GetAssertionMethod() []string { if m != nil { return m.AssertionMethod } return nil } -func (m *Did) GetKeyAgreement() []string { +func (m *DidDocument) GetKeyAgreement() []string { if m != nil { return m.KeyAgreement } return nil } -func (m *Did) GetCapabilityInvocation() []string { +func (m *DidDocument) GetCapabilityInvocation() []string { if m != nil { return m.CapabilityInvocation } return nil } -func (m *Did) GetCapabilityDelegation() []string { +func (m *DidDocument) GetCapabilityDelegation() []string { if m != nil { return m.CapabilityDelegation } return nil } -func (m *Did) GetService() []*Service { +func (m *DidDocument) GetService() []*Service { if m != nil { return m.Service } return nil } -type Metadata struct { +type DidDocumentMetadata struct { Created string `protobuf:"bytes,1,opt,name=created,proto3" json:"created,omitempty"` Updated string `protobuf:"bytes,2,opt,name=updated,proto3" json:"updated,omitempty"` Deactivated bool `protobuf:"varint,3,opt,name=deactivated,proto3" json:"deactivated,omitempty"` VersionId string `protobuf:"bytes,4,opt,name=versionId,proto3" json:"versionId,omitempty"` } -func (m *Metadata) Reset() { *m = Metadata{} } -func (m *Metadata) String() string { return proto.CompactTextString(m) } -func (*Metadata) ProtoMessage() {} -func (*Metadata) Descriptor() ([]byte, []int) { +func (m *DidDocumentMetadata) Reset() { *m = DidDocumentMetadata{} } +func (m *DidDocumentMetadata) String() string { return proto.CompactTextString(m) } +func (*DidDocumentMetadata) ProtoMessage() {} +func (*DidDocumentMetadata) Descriptor() ([]byte, []int) { return fileDescriptor_cddfa22cf6c6aba3, []int{1} } -func (m *Metadata) XXX_Unmarshal(b []byte) error { +func (m *DidDocumentMetadata) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *Metadata) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *DidDocumentMetadata) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_Metadata.Marshal(b, m, deterministic) + return xxx_messageInfo_DidDocumentMetadata.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -175,40 +175,40 @@ func (m *Metadata) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return b[:n], nil } } -func (m *Metadata) XXX_Merge(src proto.Message) { - xxx_messageInfo_Metadata.Merge(m, src) +func (m *DidDocumentMetadata) XXX_Merge(src proto.Message) { + xxx_messageInfo_DidDocumentMetadata.Merge(m, src) } -func (m *Metadata) XXX_Size() int { +func (m *DidDocumentMetadata) XXX_Size() int { return m.Size() } -func (m *Metadata) XXX_DiscardUnknown() { - xxx_messageInfo_Metadata.DiscardUnknown(m) +func (m *DidDocumentMetadata) XXX_DiscardUnknown() { + xxx_messageInfo_DidDocumentMetadata.DiscardUnknown(m) } -var xxx_messageInfo_Metadata proto.InternalMessageInfo +var xxx_messageInfo_DidDocumentMetadata proto.InternalMessageInfo -func (m *Metadata) GetCreated() string { +func (m *DidDocumentMetadata) GetCreated() string { if m != nil { return m.Created } return "" } -func (m *Metadata) GetUpdated() string { +func (m *DidDocumentMetadata) GetUpdated() string { if m != nil { return m.Updated } return "" } -func (m *Metadata) GetDeactivated() bool { +func (m *DidDocumentMetadata) GetDeactivated() bool { if m != nil { return m.Deactivated } return false } -func (m *Metadata) GetVersionId() string { +func (m *DidDocumentMetadata) GetVersionId() string { if m != nil { return m.VersionId } @@ -351,76 +351,16 @@ func (m *Service) GetServiceEndpoint() string { return "" } -type SignInfo struct { - VerificationMethodId string `protobuf:"bytes,1,opt,name=verification_method_id,json=verificationMethodId,proto3" json:"verification_method_id,omitempty"` - Signature string `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` - ClientSpec *ClientSpec `protobuf:"bytes,3,opt,name=clientSpec,proto3" json:"clientSpec,omitempty"` -} - -func (m *SignInfo) Reset() { *m = SignInfo{} } -func (m *SignInfo) String() string { return proto.CompactTextString(m) } -func (*SignInfo) ProtoMessage() {} -func (*SignInfo) Descriptor() ([]byte, []int) { - return fileDescriptor_cddfa22cf6c6aba3, []int{4} -} -func (m *SignInfo) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *SignInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_SignInfo.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *SignInfo) XXX_Merge(src proto.Message) { - xxx_messageInfo_SignInfo.Merge(m, src) -} -func (m *SignInfo) XXX_Size() int { - return m.Size() -} -func (m *SignInfo) XXX_DiscardUnknown() { - xxx_messageInfo_SignInfo.DiscardUnknown(m) -} - -var xxx_messageInfo_SignInfo proto.InternalMessageInfo - -func (m *SignInfo) GetVerificationMethodId() string { - if m != nil { - return m.VerificationMethodId - } - return "" -} - -func (m *SignInfo) GetSignature() string { - if m != nil { - return m.Signature - } - return "" -} - -func (m *SignInfo) GetClientSpec() *ClientSpec { - if m != nil { - return m.ClientSpec - } - return nil -} - type DidDocumentState struct { - DidDocument *Did `protobuf:"bytes,1,opt,name=didDocument,proto3" json:"didDocument,omitempty"` - DidDocumentMetadata *Metadata `protobuf:"bytes,2,opt,name=didDocumentMetadata,proto3" json:"didDocumentMetadata,omitempty"` + DidDocument *DidDocument `protobuf:"bytes,1,opt,name=didDocument,proto3" json:"didDocument,omitempty"` + DidDocumentMetadata *DidDocumentMetadata `protobuf:"bytes,2,opt,name=didDocumentMetadata,proto3" json:"didDocumentMetadata,omitempty"` } func (m *DidDocumentState) Reset() { *m = DidDocumentState{} } func (m *DidDocumentState) String() string { return proto.CompactTextString(m) } func (*DidDocumentState) ProtoMessage() {} func (*DidDocumentState) Descriptor() ([]byte, []int) { - return fileDescriptor_cddfa22cf6c6aba3, []int{5} + return fileDescriptor_cddfa22cf6c6aba3, []int{4} } func (m *DidDocumentState) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -449,14 +389,14 @@ func (m *DidDocumentState) XXX_DiscardUnknown() { var xxx_messageInfo_DidDocumentState proto.InternalMessageInfo -func (m *DidDocumentState) GetDidDocument() *Did { +func (m *DidDocumentState) GetDidDocument() *DidDocument { if m != nil { return m.DidDocument } return nil } -func (m *DidDocumentState) GetDidDocumentMetadata() *Metadata { +func (m *DidDocumentState) GetDidDocumentMetadata() *DidDocumentMetadata { if m != nil { return m.DidDocumentMetadata } @@ -464,63 +404,58 @@ func (m *DidDocumentState) GetDidDocumentMetadata() *Metadata { } func init() { - proto.RegisterType((*Did)(nil), "hypersignprotocol.hidnode.ssi.Did") - proto.RegisterType((*Metadata)(nil), "hypersignprotocol.hidnode.ssi.Metadata") - proto.RegisterType((*VerificationMethod)(nil), "hypersignprotocol.hidnode.ssi.VerificationMethod") - proto.RegisterType((*Service)(nil), "hypersignprotocol.hidnode.ssi.Service") - proto.RegisterType((*SignInfo)(nil), "hypersignprotocol.hidnode.ssi.SignInfo") - proto.RegisterType((*DidDocumentState)(nil), "hypersignprotocol.hidnode.ssi.DidDocumentState") + proto.RegisterType((*DidDocument)(nil), "hypersign.ssi.v1.DidDocument") + proto.RegisterType((*DidDocumentMetadata)(nil), "hypersign.ssi.v1.DidDocumentMetadata") + proto.RegisterType((*VerificationMethod)(nil), "hypersign.ssi.v1.VerificationMethod") + proto.RegisterType((*Service)(nil), "hypersign.ssi.v1.Service") + proto.RegisterType((*DidDocumentState)(nil), "hypersign.ssi.v1.DidDocumentState") } func init() { proto.RegisterFile("ssi/v1/did.proto", fileDescriptor_cddfa22cf6c6aba3) } var fileDescriptor_cddfa22cf6c6aba3 = []byte{ - // 671 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x54, 0xc1, 0x6e, 0xd3, 0x4a, - 0x14, 0xad, 0x9b, 0xbc, 0x26, 0xb9, 0xae, 0xda, 0x6a, 0x5a, 0xbd, 0x67, 0x55, 0xef, 0xf9, 0x45, - 0x5e, 0x94, 0xb0, 0xa8, 0x4d, 0x03, 0x1f, 0xd0, 0x96, 0xb0, 0x88, 0x4a, 0x37, 0x8e, 0x04, 0x82, - 0x4d, 0x35, 0x99, 0x99, 0xda, 0xa3, 0xba, 0x33, 0x96, 0x3d, 0x0e, 0xcd, 0x86, 0x05, 0x5f, 0xc0, - 0x6f, 0xb0, 0x66, 0xc7, 0x17, 0xb0, 0xec, 0x92, 0x15, 0x42, 0xed, 0x8e, 0xaf, 0x40, 0x9e, 0xd8, - 0x89, 0x9b, 0x44, 0x84, 0xdd, 0xcc, 0x39, 0xf7, 0xcc, 0x3d, 0xbe, 0xf7, 0xc8, 0xb0, 0x93, 0xa6, - 0xdc, 0x1b, 0x1d, 0x79, 0x94, 0x53, 0x37, 0x4e, 0xa4, 0x92, 0xe8, 0xbf, 0x70, 0x1c, 0xb3, 0x24, - 0xe5, 0x81, 0xd0, 0x77, 0x22, 0x23, 0x37, 0xe4, 0x54, 0x48, 0xca, 0xdc, 0x34, 0xe5, 0xfb, 0xff, - 0x14, 0x02, 0x12, 0x71, 0x26, 0xd4, 0x20, 0x66, 0x64, 0xa2, 0xdb, 0xdf, 0x0b, 0x64, 0x20, 0xf5, - 0xd1, 0xcb, 0x4f, 0x13, 0xd4, 0xf9, 0x50, 0x87, 0x5a, 0x8f, 0x53, 0x74, 0x00, 0x0d, 0x22, 0x85, - 0x62, 0x37, 0xca, 0x32, 0xda, 0xb5, 0x4e, 0xeb, 0x74, 0xf3, 0xe7, 0xf7, 0xff, 0x9b, 0xc7, 0x05, - 0xe6, 0x97, 0x24, 0xda, 0x82, 0x75, 0x4e, 0xad, 0xf5, 0xb6, 0xd1, 0x69, 0xf9, 0xeb, 0x9c, 0x22, - 0x1b, 0x20, 0xa7, 0x12, 0x19, 0x45, 0x2c, 0xb1, 0x6a, 0xb9, 0xd4, 0xaf, 0x20, 0xa8, 0x0d, 0x26, - 0x8e, 0x52, 0x79, 0x26, 0xe4, 0x3b, 0x71, 0x92, 0x5a, 0x75, 0x5d, 0x50, 0x85, 0x10, 0x06, 0x34, - 0x62, 0x09, 0xbf, 0xe4, 0x04, 0x2b, 0x2e, 0xc5, 0x39, 0x53, 0xa1, 0xa4, 0xd6, 0x5f, 0xed, 0x5a, - 0xc7, 0xec, 0x1e, 0xb9, 0xbf, 0xfd, 0x58, 0xf7, 0xd5, 0x82, 0xd0, 0x5f, 0xf2, 0x18, 0x3a, 0x80, - 0x2d, 0x9c, 0xa9, 0x90, 0x09, 0x55, 0xe0, 0xd6, 0x86, 0xf6, 0x31, 0x87, 0xa2, 0x0e, 0x6c, 0xe3, - 0x34, 0x65, 0x49, 0xc5, 0x47, 0x43, 0x17, 0xce, 0xc3, 0xc8, 0x81, 0xcd, 0x2b, 0x36, 0x3e, 0x09, - 0x12, 0xc6, 0xae, 0x99, 0x50, 0x56, 0x53, 0x97, 0x3d, 0xc0, 0x50, 0x17, 0xf6, 0x08, 0x8e, 0xf1, - 0x90, 0x47, 0x5c, 0x8d, 0xfb, 0x62, 0x24, 0x8b, 0xde, 0x2d, 0x5d, 0xbb, 0x94, 0x7b, 0xa8, 0xe9, - 0xb1, 0x88, 0x05, 0x13, 0x0d, 0xcc, 0x6b, 0x66, 0x1c, 0x3a, 0x86, 0x46, 0xca, 0x92, 0x11, 0x27, - 0xcc, 0x32, 0xf5, 0xd4, 0x0e, 0x56, 0x4c, 0x6d, 0x30, 0xa9, 0xf6, 0x4b, 0x99, 0xf3, 0x1e, 0x9a, - 0xe7, 0x4c, 0x61, 0x8a, 0x15, 0x46, 0x16, 0x34, 0x48, 0xc2, 0xb0, 0x62, 0xd4, 0x32, 0xf4, 0x96, - 0xcb, 0x6b, 0xce, 0x64, 0x31, 0xd5, 0xcc, 0x64, 0xff, 0xe5, 0x35, 0x5f, 0x32, 0x65, 0x98, 0x28, - 0x3e, 0xd2, 0x6c, 0xad, 0x6d, 0x74, 0x9a, 0x7e, 0x15, 0x42, 0xff, 0x42, 0x6b, 0x94, 0x3b, 0x92, - 0xa2, 0x4f, 0xad, 0xba, 0x56, 0xcf, 0x00, 0xe7, 0x8b, 0x01, 0x68, 0x71, 0x95, 0x45, 0xd6, 0x8c, - 0x69, 0xd6, 0x10, 0xd4, 0xd5, 0x38, 0x66, 0x45, 0x77, 0x7d, 0x5e, 0xc8, 0x9f, 0x31, 0x97, 0x3f, - 0x17, 0x50, 0x9c, 0x0d, 0x23, 0x4e, 0xce, 0xd8, 0xf8, 0x3c, 0x8b, 0x14, 0x1f, 0xe2, 0x94, 0x15, - 0x0e, 0x96, 0x30, 0xe8, 0x09, 0xec, 0x0e, 0x23, 0x49, 0xae, 0x48, 0x88, 0xb9, 0x38, 0x21, 0x44, - 0x66, 0x42, 0xf5, 0xf3, 0x38, 0xe6, 0x82, 0x65, 0x94, 0xf3, 0x1a, 0x1a, 0xc5, 0x40, 0xff, 0xc8, - 0x70, 0x07, 0xb6, 0x8b, 0xb1, 0xbf, 0x10, 0x34, 0x96, 0x5c, 0xa8, 0xc2, 0xf5, 0x3c, 0xec, 0x7c, - 0x32, 0xa0, 0x39, 0xe0, 0x81, 0xe8, 0x8b, 0x4b, 0x89, 0x9e, 0xc1, 0xdf, 0xd5, 0x60, 0x5f, 0x5c, - 0xeb, 0x11, 0x5d, 0x4c, 0xdb, 0xed, 0x2d, 0xc6, 0xbe, 0xaf, 0xc7, 0x9e, 0xa7, 0x00, 0xab, 0x2c, - 0x29, 0x5d, 0xcc, 0x00, 0xd4, 0x07, 0x98, 0xfd, 0x25, 0xb4, 0x0b, 0xb3, 0xfb, 0x78, 0x45, 0x76, - 0x9e, 0x4f, 0x05, 0x7e, 0x45, 0xec, 0x7c, 0x36, 0x60, 0xa7, 0xc7, 0x69, 0x4f, 0x92, 0x2c, 0xcf, - 0xfe, 0x40, 0x61, 0xc5, 0x50, 0x0f, 0x4c, 0x3a, 0xc3, 0xb4, 0x51, 0xb3, 0xeb, 0xac, 0x68, 0xd0, - 0xe3, 0xd4, 0xaf, 0xca, 0xd0, 0x1b, 0xd8, 0xad, 0x5c, 0xcb, 0x9c, 0xea, 0xaf, 0x31, 0xbb, 0x8f, - 0x56, 0xbc, 0x56, 0x96, 0xfb, 0xcb, 0xde, 0x38, 0x7d, 0xf9, 0xf5, 0xce, 0x36, 0x6e, 0xef, 0x6c, - 0xe3, 0xc7, 0x9d, 0x6d, 0x7c, 0xbc, 0xb7, 0xd7, 0x6e, 0xef, 0xed, 0xb5, 0x6f, 0xf7, 0xf6, 0xda, - 0xdb, 0x6e, 0xc0, 0x55, 0x98, 0x0d, 0x5d, 0x22, 0xaf, 0xbd, 0x69, 0x87, 0xc3, 0xb2, 0x85, 0x17, - 0x72, 0x7a, 0x98, 0xf7, 0xf0, 0x6e, 0xbc, 0xfc, 0x77, 0x9b, 0x2f, 0x36, 0x1d, 0x6e, 0x68, 0xfa, - 0xe9, 0xaf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x5d, 0x6f, 0x49, 0xfe, 0xb3, 0x05, 0x00, 0x00, -} - -func (m *Did) Marshal() (dAtA []byte, err error) { + // 597 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x54, 0x4d, 0x4e, 0xdb, 0x4e, + 0x14, 0x67, 0x08, 0x7f, 0x42, 0x9e, 0x11, 0xa0, 0x81, 0x85, 0xff, 0x55, 0xeb, 0x46, 0x51, 0x3f, + 0xb2, 0xc1, 0x2e, 0xe1, 0x00, 0x2d, 0x88, 0x2e, 0x10, 0x65, 0x63, 0xaa, 0x22, 0x75, 0x37, 0x99, + 0x79, 0x4d, 0x46, 0x98, 0x19, 0xcb, 0x33, 0x76, 0xc9, 0x11, 0xba, 0xeb, 0x41, 0x7a, 0x82, 0x9e, + 0xa0, 0x4b, 0x96, 0x5d, 0x55, 0x15, 0xec, 0xba, 0xeb, 0x0d, 0x2a, 0x4f, 0x1c, 0x62, 0x92, 0xa8, + 0xea, 0x6e, 0xfc, 0xfb, 0x98, 0xf7, 0xfc, 0x7e, 0x4f, 0x03, 0x5b, 0xc6, 0xc8, 0xa8, 0xd8, 0x8b, + 0x84, 0x14, 0x61, 0x9a, 0x69, 0xab, 0xe9, 0xd6, 0x70, 0x94, 0x62, 0x66, 0xe4, 0x40, 0x85, 0xc6, + 0xc8, 0xb0, 0xd8, 0x7b, 0xb0, 0x33, 0xd0, 0x03, 0xed, 0xc8, 0xa8, 0x3c, 0x8d, 0x75, 0x9d, 0xdf, + 0x0d, 0xf0, 0x8e, 0xa4, 0x38, 0xd2, 0x3c, 0xbf, 0x44, 0x65, 0xe9, 0x73, 0x68, 0x72, 0xad, 0x2c, + 0x5e, 0x59, 0x9f, 0xb4, 0x1b, 0xdd, 0xd6, 0xe1, 0xfa, 0xaf, 0x1f, 0x8f, 0xd7, 0x5e, 0x55, 0x58, + 0x7c, 0x77, 0xa2, 0x1b, 0xb0, 0x2c, 0x85, 0xbf, 0xdc, 0x26, 0xdd, 0x56, 0xbc, 0x2c, 0x05, 0x0d, + 0x00, 0x4a, 0x2a, 0xd3, 0x49, 0x82, 0x99, 0xdf, 0x28, 0xbd, 0x71, 0x0d, 0xa1, 0x6d, 0xf0, 0x58, + 0x62, 0xf4, 0x89, 0xd2, 0x1f, 0xd5, 0x81, 0xf1, 0x57, 0x9c, 0xa0, 0x0e, 0xd1, 0xb7, 0x40, 0x0b, + 0xcc, 0xe4, 0x07, 0xc9, 0x99, 0x95, 0x5a, 0x9d, 0xa2, 0x1d, 0x6a, 0xe1, 0xff, 0xd7, 0x6e, 0x74, + 0xbd, 0xde, 0x93, 0x70, 0xf6, 0x7f, 0xc2, 0x77, 0x73, 0xda, 0x78, 0x81, 0x9f, 0x3e, 0x83, 0x0d, + 0x96, 0xdb, 0x21, 0x2a, 0x5b, 0xe1, 0xfe, 0xaa, 0x2b, 0x3d, 0x83, 0xd2, 0x2e, 0x6c, 0x32, 0x63, + 0x30, 0xab, 0x95, 0x6e, 0x3a, 0xe1, 0x2c, 0x4c, 0x3b, 0xb0, 0x7e, 0x81, 0xa3, 0x83, 0x41, 0x86, + 0x58, 0x8e, 0xcc, 0x5f, 0x73, 0xb2, 0x7b, 0x18, 0xed, 0xc1, 0x0e, 0x67, 0x29, 0xeb, 0xcb, 0x44, + 0xda, 0xd1, 0xb1, 0x2a, 0x74, 0x55, 0xbb, 0xe5, 0xb4, 0x0b, 0xb9, 0xfb, 0x9e, 0x23, 0x4c, 0x70, + 0x30, 0xf6, 0xc0, 0xac, 0x67, 0xca, 0xd1, 0x7d, 0x68, 0x1a, 0xcc, 0x0a, 0xc9, 0xd1, 0xf7, 0xdc, + 0xa0, 0xfe, 0x9f, 0x1f, 0xd4, 0xd9, 0x58, 0x10, 0x4f, 0x94, 0x9d, 0x4f, 0x04, 0xb6, 0x6b, 0x99, + 0x9f, 0xa2, 0x65, 0x82, 0x59, 0x46, 0x7d, 0x68, 0xf2, 0x0c, 0x99, 0x45, 0xe1, 0x13, 0x97, 0xeb, + 0xe4, 0xb3, 0x64, 0xf2, 0x54, 0x38, 0x66, 0x9c, 0xf8, 0xe4, 0xb3, 0x8c, 0x55, 0x20, 0xe3, 0x56, + 0x16, 0x8e, 0x6d, 0xb4, 0x49, 0x77, 0x2d, 0xae, 0x43, 0xf4, 0x21, 0xb4, 0x8a, 0xb2, 0x21, 0xad, + 0x8e, 0x85, 0xbf, 0xe2, 0xdc, 0x53, 0xa0, 0xf3, 0x95, 0x00, 0x9d, 0x4f, 0xb2, 0xda, 0x2e, 0x72, + 0xb7, 0x5d, 0x14, 0x56, 0xec, 0x28, 0xc5, 0xaa, 0xba, 0x3b, 0xcf, 0x6d, 0x1c, 0x99, 0xd9, 0xb8, + 0x10, 0x68, 0x9a, 0xf7, 0x13, 0xc9, 0x4f, 0x70, 0x74, 0x9a, 0x27, 0x56, 0xf6, 0x99, 0xc1, 0xaa, + 0x83, 0x05, 0x0c, 0x7d, 0x01, 0xdb, 0xfd, 0x44, 0xf3, 0x0b, 0x3e, 0x64, 0x52, 0x1d, 0x70, 0xae, + 0x73, 0x65, 0x8f, 0xcb, 0x05, 0x2c, 0x0d, 0x8b, 0xa8, 0xce, 0x39, 0x34, 0xab, 0xe1, 0xfe, 0x53, + 0xc3, 0x5d, 0xd8, 0xac, 0x22, 0x78, 0xad, 0x44, 0xaa, 0xa5, 0xb2, 0x55, 0xd7, 0xb3, 0x70, 0xe7, + 0x0b, 0x81, 0xad, 0x5a, 0x42, 0x67, 0x96, 0x59, 0xa4, 0x2f, 0xc1, 0x13, 0x53, 0xcc, 0xd5, 0xf2, + 0x7a, 0x8f, 0xe6, 0xf3, 0xae, 0x19, 0xe3, 0xba, 0x83, 0x9e, 0xc3, 0xb6, 0x98, 0x8f, 0xdd, 0xb5, + 0xe8, 0xf5, 0x9e, 0xfe, 0xf5, 0xa2, 0x89, 0x38, 0x5e, 0x74, 0xc3, 0xe1, 0x9b, 0x6f, 0x37, 0x01, + 0xb9, 0xbe, 0x09, 0xc8, 0xcf, 0x9b, 0x80, 0x7c, 0xbe, 0x0d, 0x96, 0xae, 0x6f, 0x83, 0xa5, 0xef, + 0xb7, 0xc1, 0xd2, 0xfb, 0xde, 0x40, 0xda, 0x61, 0xde, 0x0f, 0xb9, 0xbe, 0x8c, 0xee, 0xee, 0xdf, + 0x75, 0x4f, 0x0f, 0xd7, 0x49, 0x34, 0x94, 0x62, 0x57, 0x69, 0x81, 0xd1, 0x55, 0x54, 0xbe, 0x60, + 0xe5, 0x94, 0x4c, 0x7f, 0xd5, 0xd1, 0xfb, 0x7f, 0x02, 0x00, 0x00, 0xff, 0xff, 0xfe, 0x95, 0xd0, + 0x89, 0xd5, 0x04, 0x00, 0x00, +} + +func (m *DidDocument) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -530,12 +465,12 @@ func (m *Did) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *Did) MarshalTo(dAtA []byte) (int, error) { +func (m *DidDocument) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *Did) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *DidDocument) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -650,7 +585,7 @@ func (m *Did) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *Metadata) Marshal() (dAtA []byte, err error) { +func (m *DidDocumentMetadata) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -660,12 +595,12 @@ func (m *Metadata) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *Metadata) MarshalTo(dAtA []byte) (int, error) { +func (m *DidDocumentMetadata) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *Metadata) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *DidDocumentMetadata) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -806,55 +741,6 @@ func (m *Service) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *SignInfo) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *SignInfo) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *SignInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.ClientSpec != nil { - { - size, err := m.ClientSpec.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintDid(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - if len(m.Signature) > 0 { - i -= len(m.Signature) - copy(dAtA[i:], m.Signature) - i = encodeVarintDid(dAtA, i, uint64(len(m.Signature))) - i-- - dAtA[i] = 0x12 - } - if len(m.VerificationMethodId) > 0 { - i -= len(m.VerificationMethodId) - copy(dAtA[i:], m.VerificationMethodId) - i = encodeVarintDid(dAtA, i, uint64(len(m.VerificationMethodId))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - func (m *DidDocumentState) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -913,7 +799,7 @@ func encodeVarintDid(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } -func (m *Did) Size() (n int) { +func (m *DidDocument) Size() (n int) { if m == nil { return 0 } @@ -986,7 +872,7 @@ func (m *Did) Size() (n int) { return n } -func (m *Metadata) Size() (n int) { +func (m *DidDocumentMetadata) Size() (n int) { if m == nil { return 0 } @@ -1060,27 +946,6 @@ func (m *Service) Size() (n int) { return n } -func (m *SignInfo) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.VerificationMethodId) - if l > 0 { - n += 1 + l + sovDid(uint64(l)) - } - l = len(m.Signature) - if l > 0 { - n += 1 + l + sovDid(uint64(l)) - } - if m.ClientSpec != nil { - l = m.ClientSpec.Size() - n += 1 + l + sovDid(uint64(l)) - } - return n -} - func (m *DidDocumentState) Size() (n int) { if m == nil { return 0 @@ -1104,7 +969,7 @@ func sovDid(x uint64) (n int) { func sozDid(x uint64) (n int) { return sovDid(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } -func (m *Did) Unmarshal(dAtA []byte) error { +func (m *DidDocument) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1127,10 +992,10 @@ func (m *Did) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: Did: wiretype end group for non-group") + return fmt.Errorf("proto: DidDocument: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: Did: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: DidDocument: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -1510,7 +1375,7 @@ func (m *Did) Unmarshal(dAtA []byte) error { } return nil } -func (m *Metadata) Unmarshal(dAtA []byte) error { +func (m *DidDocumentMetadata) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1533,10 +1398,10 @@ func (m *Metadata) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: Metadata: wiretype end group for non-group") + return fmt.Errorf("proto: DidDocumentMetadata: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: Metadata: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: DidDocumentMetadata: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -2032,156 +1897,6 @@ func (m *Service) Unmarshal(dAtA []byte) error { } return nil } -func (m *SignInfo) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowDid - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: SignInfo: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: SignInfo: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field VerificationMethodId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowDid - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthDid - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthDid - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.VerificationMethodId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Signature", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowDid - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthDid - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthDid - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Signature = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ClientSpec", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowDid - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthDid - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthDid - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.ClientSpec == nil { - m.ClientSpec = &ClientSpec{} - } - if err := m.ClientSpec.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipDid(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthDid - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} func (m *DidDocumentState) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -2241,7 +1956,7 @@ func (m *DidDocumentState) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.DidDocument == nil { - m.DidDocument = &Did{} + m.DidDocument = &DidDocument{} } if err := m.DidDocument.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -2277,7 +1992,7 @@ func (m *DidDocumentState) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.DidDocumentMetadata == nil { - m.DidDocumentMetadata = &Metadata{} + m.DidDocumentMetadata = &DidDocumentMetadata{} } if err := m.DidDocumentMetadata.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err diff --git a/x/ssi/types/diddoc_validation.go b/x/ssi/types/diddoc_validation.go index 77b393b..ac26384 100644 --- a/x/ssi/types/diddoc_validation.go +++ b/x/ssi/types/diddoc_validation.go @@ -327,7 +327,7 @@ func validateVerificationMethods(vms []*VerificationMethod) error { return nil } -func validateVmRelationships(didDoc *Did) error { +func validateVmRelationships(didDoc *DidDocument) error { // make verificationMethodType map between VM Id and VM type vmTypeMap := map[string]string{} for _, vm := range didDoc.VerificationMethod { @@ -417,7 +417,7 @@ func validateBlockchainAccountId(blockchainAccountId string) error { } // ValidateDidDocument validates the DID Document -func (didDoc *Did) ValidateDidDocument() error { +func (didDoc *DidDocument) ValidateDidDocument() error { // Id check err := isValidDidDocId(didDoc.Id) if err != nil { diff --git a/x/ssi/types/errors.go b/x/ssi/types/errors.go index bda79f4..12760c7 100644 --- a/x/ssi/types/errors.go +++ b/x/ssi/types/errors.go @@ -8,19 +8,22 @@ import ( // x/ssi module sentinel errors var ( - ErrDidDocExists = sdkerrors.Register(ModuleName, 101, "didDoc already exists") - ErrInvalidDidDoc = sdkerrors.Register(ModuleName, 102, "didDoc is invalid") - ErrVerificationMethodNotFound = sdkerrors.Register(ModuleName, 103, "verification method not found") - ErrInvalidSignature = sdkerrors.Register(ModuleName, 104, "invalid signature detected") - ErrDidDocNotFound = sdkerrors.Register(ModuleName, 105, "didDoc not found") - ErrSchemaExists = sdkerrors.Register(ModuleName, 106, "schema already exists") - ErrInvalidSchemaID = sdkerrors.Register(ModuleName, 107, "invalid schema Id") - ErrUnexpectedDidVersion = sdkerrors.Register(ModuleName, 108, "unexpected DID version") - ErrDidDocDeactivated = sdkerrors.Register(ModuleName, 109, "didDoc is deactivated") - ErrInvalidCredentialStatus = sdkerrors.Register(ModuleName, 110, "invalid Credential Status") - ErrInvalidDate = sdkerrors.Register(ModuleName, 111, "invalid Date") - ErrInvalidCredentialField = sdkerrors.Register(ModuleName, 112, "invalid Credential Field") - ErrInvalidCredentialHash = sdkerrors.Register(ModuleName, 113, "invalid Credential Hash") - ErrInvalidClientSpecType = sdkerrors.Register(ModuleName, 114, "invalid Client Spec Type") - ErrCredentialStatusNotFound = sdkerrors.Register(ModuleName, 115, "credentialStatus document not found") + ErrDidDocExists = sdkerrors.Register(ModuleName, 101, "didDoc already exists") + ErrInvalidDidDoc = sdkerrors.Register(ModuleName, 102, "didDoc is invalid") + ErrVerificationMethodNotFound = sdkerrors.Register(ModuleName, 103, "verification method not found") + ErrInvalidSignature = sdkerrors.Register(ModuleName, 104, "invalid signature detected") + ErrDidDocNotFound = sdkerrors.Register(ModuleName, 105, "didDoc not found") + ErrSchemaExists = sdkerrors.Register(ModuleName, 106, "schema already exists") + ErrInvalidSchemaID = sdkerrors.Register(ModuleName, 107, "invalid schema Id") + ErrUnexpectedDidVersion = sdkerrors.Register(ModuleName, 108, "unexpected DID version") + ErrDidDocDeactivated = sdkerrors.Register(ModuleName, 109, "didDoc is deactivated") + ErrInvalidCredentialStatus = sdkerrors.Register(ModuleName, 110, "invalid Credential Status") + ErrInvalidDate = sdkerrors.Register(ModuleName, 111, "invalid Date") + ErrInvalidCredentialField = sdkerrors.Register(ModuleName, 112, "invalid Credential Field") + ErrInvalidCredentialMerkleRootHash = sdkerrors.Register(ModuleName, 113, "invalid Credential merkle root hash") + ErrInvalidClientSpecType = sdkerrors.Register(ModuleName, 114, "invalid Client Spec Type") + ErrCredentialStatusNotFound = sdkerrors.Register(ModuleName, 115, "credential status document not found") + ErrCredentialStatusExists = sdkerrors.Register(ModuleName, 116, "credential status document already exists") + ErrInvalidCredentialStatusID = sdkerrors.Register(ModuleName, 117, "invalid credential status Id") + ErrInvalidProof = sdkerrors.Register(ModuleName, 118, "invalid document proof") ) diff --git a/x/ssi/types/genesis.pb.go b/x/ssi/types/genesis.pb.go index 90b85bd..ec7c34c 100644 --- a/x/ssi/types/genesis.pb.go +++ b/x/ssi/types/genesis.pb.go @@ -5,7 +5,6 @@ package types import ( fmt "fmt" - _ "github.com/gogo/protobuf/gogoproto" proto "github.com/gogo/protobuf/proto" io "io" math "math" @@ -25,7 +24,7 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // GenesisState defines the ssi module's genesis state. type GenesisState struct { - ChainNamespace string `protobuf:"bytes,1,opt,name=chain_namespace,json=chainNamespace,proto3" json:"chain_namespace,omitempty"` + ChainNamespace string `protobuf:"bytes,1,opt,name=chainNamespace,proto3" json:"chainNamespace,omitempty"` } func (m *GenesisState) Reset() { *m = GenesisState{} } @@ -69,26 +68,24 @@ func (m *GenesisState) GetChainNamespace() string { } func init() { - proto.RegisterType((*GenesisState)(nil), "hypersignprotocol.hidnode.ssi.GenesisState") + proto.RegisterType((*GenesisState)(nil), "hypersign.ssi.v1.GenesisState") } func init() { proto.RegisterFile("ssi/v1/genesis.proto", fileDescriptor_3cbaf0a49767e32e) } var fileDescriptor_3cbaf0a49767e32e = []byte{ - // 199 bytes of a gzipped FileDescriptorProto + // 176 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x29, 0x2e, 0xce, 0xd4, 0x2f, 0x33, 0xd4, 0x4f, 0x4f, 0xcd, 0x4b, 0x2d, 0xce, 0x2c, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, - 0x17, 0x92, 0xcd, 0xa8, 0x2c, 0x48, 0x2d, 0x2a, 0xce, 0x4c, 0xcf, 0x03, 0xf3, 0x93, 0xf3, 0x73, - 0xf4, 0x32, 0x32, 0x53, 0xf2, 0xf2, 0x53, 0x52, 0xf5, 0x8a, 0x8b, 0x33, 0xa5, 0x44, 0xd2, 0xf3, - 0xd3, 0xf3, 0xc1, 0x32, 0xfa, 0x20, 0x16, 0x44, 0x93, 0x92, 0x39, 0x17, 0x8f, 0x3b, 0xc4, 0x94, - 0xe0, 0x92, 0xc4, 0x92, 0x54, 0x21, 0x75, 0x2e, 0xfe, 0xe4, 0x8c, 0xc4, 0xcc, 0xbc, 0xf8, 0xbc, - 0xc4, 0xdc, 0xd4, 0xe2, 0x82, 0xc4, 0xe4, 0x54, 0x09, 0x46, 0x05, 0x46, 0x0d, 0xce, 0x20, 0x3e, - 0xb0, 0xb0, 0x1f, 0x4c, 0xd4, 0xc9, 0xe7, 0xc4, 0x23, 0x39, 0xc6, 0x0b, 0x8f, 0xe4, 0x18, 0x1f, - 0x3c, 0x92, 0x63, 0x9c, 0xf0, 0x58, 0x8e, 0xe1, 0xc2, 0x63, 0x39, 0x86, 0x1b, 0x8f, 0xe5, 0x18, - 0xa2, 0x8c, 0xd2, 0x33, 0x4b, 0x32, 0x4a, 0x93, 0xf4, 0x92, 0xf3, 0x73, 0xf5, 0xe1, 0x4e, 0xd2, - 0x85, 0xb9, 0x49, 0x3f, 0x23, 0x33, 0x45, 0x17, 0xe4, 0x28, 0xfd, 0x0a, 0x7d, 0x90, 0x37, 0x4a, - 0x2a, 0x0b, 0x52, 0x8b, 0x93, 0xd8, 0xc0, 0xd2, 0xc6, 0x80, 0x00, 0x00, 0x00, 0xff, 0xff, 0x7b, - 0xc5, 0xd5, 0x29, 0xda, 0x00, 0x00, 0x00, + 0x17, 0x12, 0xc8, 0xa8, 0x2c, 0x48, 0x2d, 0x2a, 0xce, 0x4c, 0xcf, 0xd3, 0x2b, 0x2e, 0xce, 0xd4, + 0x2b, 0x33, 0x54, 0x32, 0xe3, 0xe2, 0x71, 0x87, 0x28, 0x09, 0x2e, 0x49, 0x2c, 0x49, 0x15, 0x52, + 0xe3, 0xe2, 0x4b, 0xce, 0x48, 0xcc, 0xcc, 0xf3, 0x4b, 0xcc, 0x4d, 0x2d, 0x2e, 0x48, 0x4c, 0x4e, + 0x95, 0x60, 0x54, 0x60, 0xd4, 0xe0, 0x0c, 0x42, 0x13, 0x75, 0xf2, 0x39, 0xf1, 0x48, 0x8e, 0xf1, + 0xc2, 0x23, 0x39, 0xc6, 0x07, 0x8f, 0xe4, 0x18, 0x27, 0x3c, 0x96, 0x63, 0xb8, 0xf0, 0x58, 0x8e, + 0xe1, 0xc6, 0x63, 0x39, 0x86, 0x28, 0xa3, 0xf4, 0xcc, 0x92, 0x8c, 0xd2, 0x24, 0xbd, 0xe4, 0xfc, + 0x5c, 0x7d, 0xb8, 0x75, 0xba, 0x60, 0xfb, 0x93, 0xf3, 0x73, 0xf4, 0x33, 0x32, 0x53, 0x74, 0xf3, + 0xf2, 0x53, 0x52, 0xf5, 0x2b, 0xf4, 0x41, 0x4e, 0x2c, 0xa9, 0x2c, 0x48, 0x2d, 0x4e, 0x62, 0x03, + 0x4b, 0x1b, 0x03, 0x02, 0x00, 0x00, 0xff, 0xff, 0x35, 0xae, 0xa6, 0x95, 0xb6, 0x00, 0x00, 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { diff --git a/x/ssi/types/message_credential.go b/x/ssi/types/message_credential.go index 68e0f0b..e7ffb06 100644 --- a/x/ssi/types/message_credential.go +++ b/x/ssi/types/message_credential.go @@ -9,10 +9,50 @@ const TypeMsgRegisterCredentialStatus = "register_credential_status" var _ sdk.Msg = &MsgRegisterCredentialStatus{} -func NewMsgRegisterCredentialStatus(creator string, credentialStatus *CredentialStatus) *MsgRegisterCredentialStatus { +func (msg *MsgUpdateCredentialStatus) Route() string { + return RouterKey +} + +func (msg *MsgUpdateCredentialStatus) Type() string { + return TypeMsgRegisterCredentialSchema +} + +func (msg *MsgUpdateCredentialStatus) GetSigners() []sdk.AccAddress { + creator, err := sdk.AccAddressFromBech32(msg.TxAuthor) + if err != nil { + panic(err) + } + return []sdk.AccAddress{creator} +} + +func (msg *MsgUpdateCredentialStatus) GetSignBytes() []byte { + bz := ModuleCdc.MustMarshalJSON(msg) + return sdk.MustSortJSON(bz) +} + +func (msg *MsgUpdateCredentialStatus) ValidateBasic() error { + _, err := sdk.AccAddressFromBech32(msg.TxAuthor) + if err != nil { + return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid transaction author's address (%s)", err) + } + return nil +} + +// Update Credential Status + +const TypeMsgUpdateCredentialStatus = "update_credential_status" + +var _ sdk.Msg = &MsgRegisterCredentialStatus{} + +func NewMsgRegisterCredentialStatus( + credentialStatusDocument *CredentialStatusDocument, + credentialStatusProof *DocumentProof, + txAuthor string, +) *MsgRegisterCredentialStatus { return &MsgRegisterCredentialStatus{ - Creator: creator, - CredentialStatus: credentialStatus, + CredentialStatusDocument: credentialStatusDocument, + CredentialStatusProof: credentialStatusProof, + TxAuthor: txAuthor, } } @@ -21,11 +61,11 @@ func (msg *MsgRegisterCredentialStatus) Route() string { } func (msg *MsgRegisterCredentialStatus) Type() string { - return TypeMsgCreateSchema + return TypeMsgRegisterCredentialSchema } func (msg *MsgRegisterCredentialStatus) GetSigners() []sdk.AccAddress { - creator, err := sdk.AccAddressFromBech32(msg.Creator) + creator, err := sdk.AccAddressFromBech32(msg.TxAuthor) if err != nil { panic(err) } @@ -37,14 +77,14 @@ func (msg *MsgRegisterCredentialStatus) GetSignBytes() []byte { return sdk.MustSortJSON(bz) } -func (msg *CredentialStatus) GetSignBytes() []byte { +func (msg *CredentialStatusDocument) GetSignBytes() []byte { return ModuleCdc.MustMarshal(msg) } func (msg *MsgRegisterCredentialStatus) ValidateBasic() error { - _, err := sdk.AccAddressFromBech32(msg.Creator) + _, err := sdk.AccAddressFromBech32(msg.TxAuthor) if err != nil { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid creator address (%s)", err) + return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid transaction author's address (%s)", err) } return nil } diff --git a/x/ssi/types/message_did.go b/x/ssi/types/message_did.go index 9b67323..600ba94 100644 --- a/x/ssi/types/message_did.go +++ b/x/ssi/types/message_did.go @@ -1,48 +1,54 @@ package types import ( + "encoding/hex" + "strings" + "time" + sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/tendermint/tendermint/crypto/tmhash" ) -func (msg *Did) GetSignBytes() []byte { +func (msg *DidDocument) GetSignBytes() []byte { return ModuleCdc.MustMarshal(msg) } // MsgCreateDID Type Methods +const TypeMsgCreateDID = "register_did" -const TypeMsgCreateDID = "create_did" - -var _ sdk.Msg = &MsgCreateDID{} +var _ sdk.Msg = &MsgRegisterDID{} -func NewMsgCreateDID(did string, didDocString *Did) *MsgCreateDID { - return &MsgCreateDID{ - DidDocString: didDocString, +func NewMsgCreateDID(didDoc *DidDocument, documentProofs []*DocumentProof, txAuthor string) *MsgRegisterDID { + return &MsgRegisterDID{ + DidDocument: didDoc, + DidDocumentProofs: documentProofs, + TxAuthor: txAuthor, } } -func (msg *MsgCreateDID) Route() string { +func (msg *MsgRegisterDID) Route() string { return RouterKey } -func (msg *MsgCreateDID) Type() string { +func (msg *MsgRegisterDID) Type() string { return TypeMsgCreateDID } -func (msg *MsgCreateDID) GetSigners() []sdk.AccAddress { - creator, err := sdk.AccAddressFromBech32(msg.Creator) +func (msg *MsgRegisterDID) GetSigners() []sdk.AccAddress { + creator, err := sdk.AccAddressFromBech32(msg.TxAuthor) if err != nil { panic(err) } return []sdk.AccAddress{creator} } -func (msg *MsgCreateDID) GetSignBytes() []byte { +func (msg *MsgRegisterDID) GetSignBytes() []byte { return ModuleCdc.MustMarshal(msg) } -func (msg *MsgCreateDID) ValidateBasic() error { - didDoc := msg.DidDocString +func (msg *MsgRegisterDID) ValidateBasic() error { + didDoc := msg.DidDocument if err := didDoc.ValidateDidDocument(); err != nil { return err } @@ -55,11 +61,17 @@ const TypeMsgUpdateDID = "update_did" var _ sdk.Msg = &MsgUpdateDID{} -func NewMsgUpdateDID(creator string, didDocString *Did, signatures []*SignInfo) *MsgUpdateDID { +func NewMsgUpdateDID( + didDoc *DidDocument, + documentProofs []*DocumentProof, + versionId string, + txAuthor string, +) *MsgUpdateDID { return &MsgUpdateDID{ - Creator: creator, - DidDocString: didDocString, - Signatures: signatures, + DidDocument: didDoc, + DidDocumentProofs: documentProofs, + VersionId: versionId, + TxAuthor: txAuthor, } } @@ -72,7 +84,7 @@ func (msg *MsgUpdateDID) Type() string { } func (msg *MsgUpdateDID) GetSigners() []sdk.AccAddress { - creator, err := sdk.AccAddressFromBech32(msg.Creator) + creator, err := sdk.AccAddressFromBech32(msg.TxAuthor) if err != nil { panic(err) } @@ -85,7 +97,7 @@ func (msg *MsgUpdateDID) GetSignBytes() []byte { } func (msg *MsgUpdateDID) ValidateBasic() error { - didDoc := msg.DidDocString + didDoc := msg.DidDocument if err := didDoc.ValidateDidDocument(); err != nil { return err } @@ -98,12 +110,12 @@ const TypeMsgDeactivateDID = "deactivate_did" var _ sdk.Msg = &MsgDeactivateDID{} -func NewMsgDeactivateDID(creator string, didId string, versionId string, signatures []*SignInfo) *MsgDeactivateDID { +func NewMsgDeactivateDID(didId string, versionId string, documentProofs []*DocumentProof, txAuthor string) *MsgDeactivateDID { return &MsgDeactivateDID{ - Creator: creator, - DidId: didId, - VersionId: versionId, - Signatures: signatures, + DidDocumentId: didId, + VersionId: versionId, + DidDocumentProofs: documentProofs, + TxAuthor: txAuthor, } } @@ -116,7 +128,7 @@ func (msg *MsgDeactivateDID) Type() string { } func (msg *MsgDeactivateDID) GetSigners() []sdk.AccAddress { - creator, err := sdk.AccAddressFromBech32(msg.Creator) + creator, err := sdk.AccAddressFromBech32(msg.TxAuthor) if err != nil { panic(err) } @@ -129,9 +141,18 @@ func (msg *MsgDeactivateDID) GetSignBytes() []byte { } func (msg *MsgDeactivateDID) ValidateBasic() error { - _, err := sdk.AccAddressFromBech32(msg.Creator) + _, err := sdk.AccAddressFromBech32(msg.TxAuthor) if err != nil { return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid creator address (%s)", err) } return nil } + +func CreateNewMetadata(ctx sdk.Context) DidDocumentMetadata { + return DidDocumentMetadata{ + VersionId: strings.ToUpper(hex.EncodeToString(tmhash.Sum([]byte(ctx.TxBytes())))), + Deactivated: false, + Created: ctx.BlockTime().Format(time.RFC3339), + Updated: ctx.BlockTime().Format(time.RFC3339), + } +} diff --git a/x/ssi/types/message_schema.go b/x/ssi/types/message_schema.go index 63a0dc2..d733e1e 100644 --- a/x/ssi/types/message_schema.go +++ b/x/ssi/types/message_schema.go @@ -5,45 +5,85 @@ import ( sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ) -const TypeMsgCreateSchema = "create_schema" +const TypeMsgRegisterCredentialSchema = "register_credential_schema" -var _ sdk.Msg = &MsgCreateSchema{} +var _ sdk.Msg = &MsgRegisterCredentialSchema{} -func NewMsgCreateSchema(creator string, schemaDoc *SchemaDocument, schemaProof *SchemaProof) *MsgCreateSchema { - return &MsgCreateSchema{ - Creator: creator, - SchemaDoc: schemaDoc, - SchemaProof: schemaProof, +func NewMsgRegisterSchema( + schemaDoc *CredentialSchemaDocument, + schemaProof *DocumentProof, + clientSpecType ClientSpecType, + txAuthor string, +) *MsgRegisterCredentialSchema { + return &MsgRegisterCredentialSchema{ + CredentialSchemaDocument: schemaDoc, + CredentialSchemaProof: schemaProof, + TxAuthor: txAuthor, } } -func (msg *MsgCreateSchema) Route() string { +func (msg *MsgRegisterCredentialSchema) Route() string { return RouterKey } -func (msg *MsgCreateSchema) Type() string { - return TypeMsgCreateSchema +func (msg *MsgRegisterCredentialSchema) Type() string { + return TypeMsgRegisterCredentialSchema } -func (msg *MsgCreateSchema) GetSigners() []sdk.AccAddress { - creator, err := sdk.AccAddressFromBech32(msg.Creator) +func (msg *MsgRegisterCredentialSchema) GetSigners() []sdk.AccAddress { + creator, err := sdk.AccAddressFromBech32(msg.TxAuthor) if err != nil { panic(err) } return []sdk.AccAddress{creator} } -func (msg *MsgCreateSchema) GetSignBytes() []byte { +func (msg *MsgRegisterCredentialSchema) GetSignBytes() []byte { bz := ModuleCdc.MustMarshalJSON(msg) return sdk.MustSortJSON(bz) } -func (msg *SchemaDocument) GetSignBytes() []byte { +func (msg *CredentialSchemaDocument) GetSignBytes() []byte { return ModuleCdc.MustMarshal(msg) } -func (msg *MsgCreateSchema) ValidateBasic() error { - _, err := sdk.AccAddressFromBech32(msg.Creator) +func (msg *MsgRegisterCredentialSchema) ValidateBasic() error { + _, err := sdk.AccAddressFromBech32(msg.TxAuthor) + if err != nil { + return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid creator address (%s)", err) + } + return nil +} + +// Update Credential Schema + +const TypeMsgUpdateCredentialSchema = "update_credential_schema" + +var _ sdk.Msg = &MsgUpdateCredentialSchema{} + +func (msg *MsgUpdateCredentialSchema) Route() string { + return RouterKey +} + +func (msg *MsgUpdateCredentialSchema) Type() string { + return TypeMsgUpdateCredentialSchema +} + +func (msg *MsgUpdateCredentialSchema) GetSigners() []sdk.AccAddress { + creator, err := sdk.AccAddressFromBech32(msg.TxAuthor) + if err != nil { + panic(err) + } + return []sdk.AccAddress{creator} +} + +func (msg *MsgUpdateCredentialSchema) GetSignBytes() []byte { + bz := ModuleCdc.MustMarshalJSON(msg) + return sdk.MustSortJSON(bz) +} + +func (msg *MsgUpdateCredentialSchema) ValidateBasic() error { + _, err := sdk.AccAddressFromBech32(msg.TxAuthor) if err != nil { return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid creator address (%s)", err) } diff --git a/x/ssi/types/metadata.go b/x/ssi/types/metadata.go deleted file mode 100644 index 4f1c0eb..0000000 --- a/x/ssi/types/metadata.go +++ /dev/null @@ -1,19 +0,0 @@ -package types - -import ( - "encoding/hex" - "strings" - "time" - - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/tendermint/tendermint/crypto/tmhash" -) - -func CreateNewMetadata(ctx sdk.Context) Metadata { - return Metadata{ - VersionId: strings.ToUpper(hex.EncodeToString(tmhash.Sum([]byte(ctx.TxBytes())))), - Deactivated: false, - Created: ctx.BlockTime().Format(time.RFC3339), //Ref: https://www.w3.org/TR/did-core/#did-document-metadata - Updated: ctx.BlockTime().Format(time.RFC3339), - } -} diff --git a/x/ssi/types/proof.pb.go b/x/ssi/types/proof.pb.go new file mode 100644 index 0000000..750e236 --- /dev/null +++ b/x/ssi/types/proof.pb.go @@ -0,0 +1,562 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: ssi/v1/proof.proto + +package types + +import ( + fmt "fmt" + proto "github.com/gogo/protobuf/proto" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +type DocumentProof struct { + Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"` + Created string `protobuf:"bytes,2,opt,name=created,proto3" json:"created,omitempty"` + VerificationMethod string `protobuf:"bytes,3,opt,name=verificationMethod,proto3" json:"verificationMethod,omitempty"` + ProofPurpose string `protobuf:"bytes,4,opt,name=proofPurpose,proto3" json:"proofPurpose,omitempty"` + ProofValue string `protobuf:"bytes,5,opt,name=proofValue,proto3" json:"proofValue,omitempty"` + ClientSpecType ClientSpecType `protobuf:"varint,6,opt,name=clientSpecType,proto3,enum=hypersign.ssi.v1.ClientSpecType" json:"clientSpecType,omitempty"` +} + +func (m *DocumentProof) Reset() { *m = DocumentProof{} } +func (m *DocumentProof) String() string { return proto.CompactTextString(m) } +func (*DocumentProof) ProtoMessage() {} +func (*DocumentProof) Descriptor() ([]byte, []int) { + return fileDescriptor_0b5e641dcc78ecd3, []int{0} +} +func (m *DocumentProof) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *DocumentProof) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_DocumentProof.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *DocumentProof) XXX_Merge(src proto.Message) { + xxx_messageInfo_DocumentProof.Merge(m, src) +} +func (m *DocumentProof) XXX_Size() int { + return m.Size() +} +func (m *DocumentProof) XXX_DiscardUnknown() { + xxx_messageInfo_DocumentProof.DiscardUnknown(m) +} + +var xxx_messageInfo_DocumentProof proto.InternalMessageInfo + +func (m *DocumentProof) GetType() string { + if m != nil { + return m.Type + } + return "" +} + +func (m *DocumentProof) GetCreated() string { + if m != nil { + return m.Created + } + return "" +} + +func (m *DocumentProof) GetVerificationMethod() string { + if m != nil { + return m.VerificationMethod + } + return "" +} + +func (m *DocumentProof) GetProofPurpose() string { + if m != nil { + return m.ProofPurpose + } + return "" +} + +func (m *DocumentProof) GetProofValue() string { + if m != nil { + return m.ProofValue + } + return "" +} + +func (m *DocumentProof) GetClientSpecType() ClientSpecType { + if m != nil { + return m.ClientSpecType + } + return CLIENT_SPEC_TYPE_NONE +} + +func init() { + proto.RegisterType((*DocumentProof)(nil), "hypersign.ssi.v1.DocumentProof") +} + +func init() { proto.RegisterFile("ssi/v1/proof.proto", fileDescriptor_0b5e641dcc78ecd3) } + +var fileDescriptor_0b5e641dcc78ecd3 = []byte{ + // 289 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x90, 0xb1, 0x4e, 0xc3, 0x30, + 0x14, 0x45, 0x63, 0x28, 0x45, 0x58, 0x50, 0x21, 0x4f, 0x16, 0x83, 0x15, 0x75, 0xea, 0x52, 0x5b, + 0x2d, 0x7f, 0x00, 0x0c, 0x0c, 0x20, 0x55, 0x05, 0x31, 0xb0, 0xa0, 0xd4, 0x79, 0x6d, 0x2c, 0xa5, + 0xb1, 0x65, 0x3b, 0x11, 0xfd, 0x0b, 0x3e, 0x8b, 0xb1, 0x23, 0x23, 0x4a, 0x3e, 0x83, 0x05, 0xc5, + 0x05, 0x44, 0xab, 0x6e, 0x7e, 0xf7, 0x1d, 0x3f, 0xdd, 0x7b, 0x31, 0x71, 0x4e, 0x89, 0x6a, 0x24, + 0x8c, 0xd5, 0x7a, 0xce, 0x8d, 0xd5, 0x5e, 0x93, 0xf3, 0x6c, 0x65, 0xc0, 0x3a, 0xb5, 0x28, 0xb8, + 0x73, 0x8a, 0x57, 0xa3, 0x0b, 0xfa, 0x43, 0xc9, 0x5c, 0x41, 0xe1, 0x5f, 0x9c, 0x01, 0xb9, 0x61, + 0xfb, 0x5f, 0x08, 0x9f, 0xdd, 0x68, 0x59, 0x2e, 0xa1, 0xf0, 0x93, 0xf6, 0x06, 0x21, 0xb8, 0xe3, + 0x57, 0x06, 0x28, 0x8a, 0xd1, 0xe0, 0x64, 0x1a, 0xde, 0x84, 0xe2, 0x63, 0x69, 0x21, 0xf1, 0x90, + 0xd2, 0x83, 0x20, 0xff, 0x8e, 0x84, 0x63, 0x52, 0x81, 0x55, 0x73, 0x25, 0x13, 0xaf, 0x74, 0x71, + 0x0f, 0x3e, 0xd3, 0x29, 0x3d, 0x0c, 0xd0, 0x9e, 0x0d, 0xe9, 0xe3, 0xd3, 0x60, 0x75, 0x52, 0x5a, + 0xa3, 0x1d, 0xd0, 0x4e, 0x20, 0xb7, 0x34, 0xc2, 0x30, 0x0e, 0xf3, 0x53, 0x92, 0x97, 0x40, 0x8f, + 0x02, 0xf1, 0x4f, 0x21, 0xb7, 0xb8, 0xb7, 0x09, 0xf2, 0x60, 0x40, 0x3e, 0xb6, 0x5e, 0xbb, 0x31, + 0x1a, 0xf4, 0xc6, 0x31, 0xdf, 0x0d, 0xce, 0xaf, 0xb7, 0xb8, 0xe9, 0xce, 0xbf, 0xab, 0xbb, 0xf7, + 0x9a, 0xa1, 0x75, 0xcd, 0xd0, 0x67, 0xcd, 0xd0, 0x5b, 0xc3, 0xa2, 0x75, 0xc3, 0xa2, 0x8f, 0x86, + 0x45, 0xcf, 0xe3, 0x85, 0xf2, 0x59, 0x39, 0xe3, 0x52, 0x2f, 0xc5, 0xdf, 0xd5, 0x61, 0xe8, 0x4c, + 0xea, 0x5c, 0x64, 0x2a, 0x1d, 0x16, 0x3a, 0x05, 0xf1, 0x2a, 0xda, 0x6a, 0xdb, 0x92, 0xdc, 0xac, + 0x1b, 0xd6, 0x97, 0xdf, 0x01, 0x00, 0x00, 0xff, 0xff, 0x37, 0x56, 0x5e, 0x05, 0x94, 0x01, 0x00, + 0x00, +} + +func (m *DocumentProof) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *DocumentProof) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *DocumentProof) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.ClientSpecType != 0 { + i = encodeVarintProof(dAtA, i, uint64(m.ClientSpecType)) + i-- + dAtA[i] = 0x30 + } + if len(m.ProofValue) > 0 { + i -= len(m.ProofValue) + copy(dAtA[i:], m.ProofValue) + i = encodeVarintProof(dAtA, i, uint64(len(m.ProofValue))) + i-- + dAtA[i] = 0x2a + } + if len(m.ProofPurpose) > 0 { + i -= len(m.ProofPurpose) + copy(dAtA[i:], m.ProofPurpose) + i = encodeVarintProof(dAtA, i, uint64(len(m.ProofPurpose))) + i-- + dAtA[i] = 0x22 + } + if len(m.VerificationMethod) > 0 { + i -= len(m.VerificationMethod) + copy(dAtA[i:], m.VerificationMethod) + i = encodeVarintProof(dAtA, i, uint64(len(m.VerificationMethod))) + i-- + dAtA[i] = 0x1a + } + if len(m.Created) > 0 { + i -= len(m.Created) + copy(dAtA[i:], m.Created) + i = encodeVarintProof(dAtA, i, uint64(len(m.Created))) + i-- + dAtA[i] = 0x12 + } + if len(m.Type) > 0 { + i -= len(m.Type) + copy(dAtA[i:], m.Type) + i = encodeVarintProof(dAtA, i, uint64(len(m.Type))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintProof(dAtA []byte, offset int, v uint64) int { + offset -= sovProof(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *DocumentProof) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Type) + if l > 0 { + n += 1 + l + sovProof(uint64(l)) + } + l = len(m.Created) + if l > 0 { + n += 1 + l + sovProof(uint64(l)) + } + l = len(m.VerificationMethod) + if l > 0 { + n += 1 + l + sovProof(uint64(l)) + } + l = len(m.ProofPurpose) + if l > 0 { + n += 1 + l + sovProof(uint64(l)) + } + l = len(m.ProofValue) + if l > 0 { + n += 1 + l + sovProof(uint64(l)) + } + if m.ClientSpecType != 0 { + n += 1 + sovProof(uint64(m.ClientSpecType)) + } + return n +} + +func sovProof(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozProof(x uint64) (n int) { + return sovProof(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *DocumentProof) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProof + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: DocumentProof: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: DocumentProof: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProof + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthProof + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthProof + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Type = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Created", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProof + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthProof + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthProof + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Created = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field VerificationMethod", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProof + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthProof + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthProof + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.VerificationMethod = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ProofPurpose", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProof + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthProof + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthProof + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ProofPurpose = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ProofValue", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProof + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthProof + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthProof + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ProofValue = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 6: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ClientSpecType", wireType) + } + m.ClientSpecType = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProof + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ClientSpecType |= ClientSpecType(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipProof(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthProof + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipProof(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowProof + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowProof + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowProof + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthProof + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupProof + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthProof + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthProof = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowProof = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupProof = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/ssi/types/proof_validation.go b/x/ssi/types/proof_validation.go new file mode 100644 index 0000000..094fea0 --- /dev/null +++ b/x/ssi/types/proof_validation.go @@ -0,0 +1,54 @@ +package types + +import ( + "time" + + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/hypersign-protocol/hid-node/x/ssi/utils" +) + +// Valid Proof Types +const ( + authentication = "authentication" + assertionMethod = "assertionMethod" + keyAgreement = "keyAgreement" + capabilityInvocation = "capabilityInvocation" + capabilityDelegation = "capabilityDelegation" +) + +var validProofPurposes []string = []string{ + authentication, + assertionMethod, + keyAgreement, + capabilityInvocation, + capabilityDelegation, +} + +// Validate Document Proof +func (proof *DocumentProof) Validate() error { + // Validate Proof Type + if !utils.FindInSlice(validProofPurposes, proof.ProofPurpose) { + return invalidProofErrorMsg("invalid proof purpose %v", proof.ProofPurpose) + } + + // Validate Proof Created + _, err := time.Parse(time.RFC3339, proof.Created) + if err != nil { + return invalidProofErrorMsg("invalid created date format: %v", proof.Created) + } + + // Validate VerificationMethod + if len(proof.VerificationMethod) == 0 { + return invalidProofErrorMsg("'verificationMethod' attribute in document proof cannot be empty") + } + + if len(proof.ProofValue) == 0 { + return invalidProofErrorMsg("'proofValue' attribute in document proof cannot be empty") + } + + return nil +} + +func invalidProofErrorMsg(errMsg string, errMsgArgs ...interface{}) error { + return sdkerrors.Wrapf(ErrInvalidProof, errMsg, errMsgArgs...) +} \ No newline at end of file diff --git a/x/ssi/types/query.pb.go b/x/ssi/types/query.pb.go index 0eb50b8..5d791ff 100644 --- a/x/ssi/types/query.pb.go +++ b/x/ssi/types/query.pb.go @@ -7,7 +7,6 @@ import ( context "context" fmt "fmt" query "github.com/cosmos/cosmos-sdk/types/query" - _ "github.com/gogo/protobuf/gogoproto" grpc1 "github.com/gogo/protobuf/grpc" proto "github.com/gogo/protobuf/proto" _ "google.golang.org/genproto/googleapis/api/annotations" @@ -30,22 +29,22 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package -type QuerySchemaRequest struct { +type QueryCredentialSchemaRequest struct { SchemaId string `protobuf:"bytes,1,opt,name=schemaId,proto3" json:"schemaId,omitempty"` } -func (m *QuerySchemaRequest) Reset() { *m = QuerySchemaRequest{} } -func (m *QuerySchemaRequest) String() string { return proto.CompactTextString(m) } -func (*QuerySchemaRequest) ProtoMessage() {} -func (*QuerySchemaRequest) Descriptor() ([]byte, []int) { +func (m *QueryCredentialSchemaRequest) Reset() { *m = QueryCredentialSchemaRequest{} } +func (m *QueryCredentialSchemaRequest) String() string { return proto.CompactTextString(m) } +func (*QueryCredentialSchemaRequest) ProtoMessage() {} +func (*QueryCredentialSchemaRequest) Descriptor() ([]byte, []int) { return fileDescriptor_0f525f26163d85f3, []int{0} } -func (m *QuerySchemaRequest) XXX_Unmarshal(b []byte) error { +func (m *QueryCredentialSchemaRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QuerySchemaRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryCredentialSchemaRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QuerySchemaRequest.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryCredentialSchemaRequest.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -55,41 +54,41 @@ func (m *QuerySchemaRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, return b[:n], nil } } -func (m *QuerySchemaRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QuerySchemaRequest.Merge(m, src) +func (m *QueryCredentialSchemaRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryCredentialSchemaRequest.Merge(m, src) } -func (m *QuerySchemaRequest) XXX_Size() int { +func (m *QueryCredentialSchemaRequest) XXX_Size() int { return m.Size() } -func (m *QuerySchemaRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QuerySchemaRequest.DiscardUnknown(m) +func (m *QueryCredentialSchemaRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryCredentialSchemaRequest.DiscardUnknown(m) } -var xxx_messageInfo_QuerySchemaRequest proto.InternalMessageInfo +var xxx_messageInfo_QueryCredentialSchemaRequest proto.InternalMessageInfo -func (m *QuerySchemaRequest) GetSchemaId() string { +func (m *QueryCredentialSchemaRequest) GetSchemaId() string { if m != nil { return m.SchemaId } return "" } -type QuerySchemaResponse struct { - Schema []*Schema `protobuf:"bytes,1,rep,name=schema,proto3" json:"schema,omitempty"` +type QueryCredentialSchemaResponse struct { + CredentialSchemas []*CredentialSchemaState `protobuf:"bytes,1,rep,name=credentialSchemas,proto3" json:"credentialSchemas,omitempty"` } -func (m *QuerySchemaResponse) Reset() { *m = QuerySchemaResponse{} } -func (m *QuerySchemaResponse) String() string { return proto.CompactTextString(m) } -func (*QuerySchemaResponse) ProtoMessage() {} -func (*QuerySchemaResponse) Descriptor() ([]byte, []int) { +func (m *QueryCredentialSchemaResponse) Reset() { *m = QueryCredentialSchemaResponse{} } +func (m *QueryCredentialSchemaResponse) String() string { return proto.CompactTextString(m) } +func (*QueryCredentialSchemaResponse) ProtoMessage() {} +func (*QueryCredentialSchemaResponse) Descriptor() ([]byte, []int) { return fileDescriptor_0f525f26163d85f3, []int{1} } -func (m *QuerySchemaResponse) XXX_Unmarshal(b []byte) error { +func (m *QueryCredentialSchemaResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QuerySchemaResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryCredentialSchemaResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QuerySchemaResponse.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryCredentialSchemaResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -99,41 +98,41 @@ func (m *QuerySchemaResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, return b[:n], nil } } -func (m *QuerySchemaResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QuerySchemaResponse.Merge(m, src) +func (m *QueryCredentialSchemaResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryCredentialSchemaResponse.Merge(m, src) } -func (m *QuerySchemaResponse) XXX_Size() int { +func (m *QueryCredentialSchemaResponse) XXX_Size() int { return m.Size() } -func (m *QuerySchemaResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QuerySchemaResponse.DiscardUnknown(m) +func (m *QueryCredentialSchemaResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryCredentialSchemaResponse.DiscardUnknown(m) } -var xxx_messageInfo_QuerySchemaResponse proto.InternalMessageInfo +var xxx_messageInfo_QueryCredentialSchemaResponse proto.InternalMessageInfo -func (m *QuerySchemaResponse) GetSchema() []*Schema { +func (m *QueryCredentialSchemaResponse) GetCredentialSchemas() []*CredentialSchemaState { if m != nil { - return m.Schema + return m.CredentialSchemas } return nil } -type QuerySchemasRequest struct { +type QueryCredentialSchemasRequest struct { Pagination *query.PageRequest `protobuf:"bytes,1,opt,name=pagination,proto3" json:"pagination,omitempty"` } -func (m *QuerySchemasRequest) Reset() { *m = QuerySchemasRequest{} } -func (m *QuerySchemasRequest) String() string { return proto.CompactTextString(m) } -func (*QuerySchemasRequest) ProtoMessage() {} -func (*QuerySchemasRequest) Descriptor() ([]byte, []int) { +func (m *QueryCredentialSchemasRequest) Reset() { *m = QueryCredentialSchemasRequest{} } +func (m *QueryCredentialSchemasRequest) String() string { return proto.CompactTextString(m) } +func (*QueryCredentialSchemasRequest) ProtoMessage() {} +func (*QueryCredentialSchemasRequest) Descriptor() ([]byte, []int) { return fileDescriptor_0f525f26163d85f3, []int{2} } -func (m *QuerySchemasRequest) XXX_Unmarshal(b []byte) error { +func (m *QueryCredentialSchemasRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QuerySchemasRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryCredentialSchemasRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QuerySchemasRequest.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryCredentialSchemasRequest.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -143,42 +142,42 @@ func (m *QuerySchemasRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, return b[:n], nil } } -func (m *QuerySchemasRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QuerySchemasRequest.Merge(m, src) +func (m *QueryCredentialSchemasRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryCredentialSchemasRequest.Merge(m, src) } -func (m *QuerySchemasRequest) XXX_Size() int { +func (m *QueryCredentialSchemasRequest) XXX_Size() int { return m.Size() } -func (m *QuerySchemasRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QuerySchemasRequest.DiscardUnknown(m) +func (m *QueryCredentialSchemasRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryCredentialSchemasRequest.DiscardUnknown(m) } -var xxx_messageInfo_QuerySchemasRequest proto.InternalMessageInfo +var xxx_messageInfo_QueryCredentialSchemasRequest proto.InternalMessageInfo -func (m *QuerySchemasRequest) GetPagination() *query.PageRequest { +func (m *QueryCredentialSchemasRequest) GetPagination() *query.PageRequest { if m != nil { return m.Pagination } return nil } -type QuerySchemasResponse struct { - TotalCount uint64 `protobuf:"varint,1,opt,name=totalCount,proto3" json:"totalCount,omitempty"` - SchemaList []*Schema `protobuf:"bytes,2,rep,name=schemaList,proto3" json:"schemaList,omitempty"` +type QueryCredentialSchemasResponse struct { + Count uint64 `protobuf:"varint,1,opt,name=count,proto3" json:"count,omitempty"` + CredentialSchemas []*CredentialSchemaState `protobuf:"bytes,2,rep,name=credentialSchemas,proto3" json:"credentialSchemas,omitempty"` } -func (m *QuerySchemasResponse) Reset() { *m = QuerySchemasResponse{} } -func (m *QuerySchemasResponse) String() string { return proto.CompactTextString(m) } -func (*QuerySchemasResponse) ProtoMessage() {} -func (*QuerySchemasResponse) Descriptor() ([]byte, []int) { +func (m *QueryCredentialSchemasResponse) Reset() { *m = QueryCredentialSchemasResponse{} } +func (m *QueryCredentialSchemasResponse) String() string { return proto.CompactTextString(m) } +func (*QueryCredentialSchemasResponse) ProtoMessage() {} +func (*QueryCredentialSchemasResponse) Descriptor() ([]byte, []int) { return fileDescriptor_0f525f26163d85f3, []int{3} } -func (m *QuerySchemasResponse) XXX_Unmarshal(b []byte) error { +func (m *QueryCredentialSchemasResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QuerySchemasResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryCredentialSchemasResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QuerySchemasResponse.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryCredentialSchemasResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -188,48 +187,48 @@ func (m *QuerySchemasResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte return b[:n], nil } } -func (m *QuerySchemasResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QuerySchemasResponse.Merge(m, src) +func (m *QueryCredentialSchemasResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryCredentialSchemasResponse.Merge(m, src) } -func (m *QuerySchemasResponse) XXX_Size() int { +func (m *QueryCredentialSchemasResponse) XXX_Size() int { return m.Size() } -func (m *QuerySchemasResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QuerySchemasResponse.DiscardUnknown(m) +func (m *QueryCredentialSchemasResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryCredentialSchemasResponse.DiscardUnknown(m) } -var xxx_messageInfo_QuerySchemasResponse proto.InternalMessageInfo +var xxx_messageInfo_QueryCredentialSchemasResponse proto.InternalMessageInfo -func (m *QuerySchemasResponse) GetTotalCount() uint64 { +func (m *QueryCredentialSchemasResponse) GetCount() uint64 { if m != nil { - return m.TotalCount + return m.Count } return 0 } -func (m *QuerySchemasResponse) GetSchemaList() []*Schema { +func (m *QueryCredentialSchemasResponse) GetCredentialSchemas() []*CredentialSchemaState { if m != nil { - return m.SchemaList + return m.CredentialSchemas } return nil } -type QueryCredentialRequest struct { +type QueryCredentialStatusRequest struct { CredId string `protobuf:"bytes,1,opt,name=credId,proto3" json:"credId,omitempty"` } -func (m *QueryCredentialRequest) Reset() { *m = QueryCredentialRequest{} } -func (m *QueryCredentialRequest) String() string { return proto.CompactTextString(m) } -func (*QueryCredentialRequest) ProtoMessage() {} -func (*QueryCredentialRequest) Descriptor() ([]byte, []int) { +func (m *QueryCredentialStatusRequest) Reset() { *m = QueryCredentialStatusRequest{} } +func (m *QueryCredentialStatusRequest) String() string { return proto.CompactTextString(m) } +func (*QueryCredentialStatusRequest) ProtoMessage() {} +func (*QueryCredentialStatusRequest) Descriptor() ([]byte, []int) { return fileDescriptor_0f525f26163d85f3, []int{4} } -func (m *QueryCredentialRequest) XXX_Unmarshal(b []byte) error { +func (m *QueryCredentialStatusRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryCredentialRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryCredentialStatusRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryCredentialRequest.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryCredentialStatusRequest.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -239,41 +238,41 @@ func (m *QueryCredentialRequest) XXX_Marshal(b []byte, deterministic bool) ([]by return b[:n], nil } } -func (m *QueryCredentialRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryCredentialRequest.Merge(m, src) +func (m *QueryCredentialStatusRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryCredentialStatusRequest.Merge(m, src) } -func (m *QueryCredentialRequest) XXX_Size() int { +func (m *QueryCredentialStatusRequest) XXX_Size() int { return m.Size() } -func (m *QueryCredentialRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryCredentialRequest.DiscardUnknown(m) +func (m *QueryCredentialStatusRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryCredentialStatusRequest.DiscardUnknown(m) } -var xxx_messageInfo_QueryCredentialRequest proto.InternalMessageInfo +var xxx_messageInfo_QueryCredentialStatusRequest proto.InternalMessageInfo -func (m *QueryCredentialRequest) GetCredId() string { +func (m *QueryCredentialStatusRequest) GetCredId() string { if m != nil { return m.CredId } return "" } -type QueryCredentialResponse struct { - CredStatus *Credential `protobuf:"bytes,1,opt,name=credStatus,proto3" json:"credStatus,omitempty"` +type QueryCredentialStatusResponse struct { + CredentialStatus *CredentialStatusState `protobuf:"bytes,1,opt,name=credentialStatus,proto3" json:"credentialStatus,omitempty"` } -func (m *QueryCredentialResponse) Reset() { *m = QueryCredentialResponse{} } -func (m *QueryCredentialResponse) String() string { return proto.CompactTextString(m) } -func (*QueryCredentialResponse) ProtoMessage() {} -func (*QueryCredentialResponse) Descriptor() ([]byte, []int) { +func (m *QueryCredentialStatusResponse) Reset() { *m = QueryCredentialStatusResponse{} } +func (m *QueryCredentialStatusResponse) String() string { return proto.CompactTextString(m) } +func (*QueryCredentialStatusResponse) ProtoMessage() {} +func (*QueryCredentialStatusResponse) Descriptor() ([]byte, []int) { return fileDescriptor_0f525f26163d85f3, []int{5} } -func (m *QueryCredentialResponse) XXX_Unmarshal(b []byte) error { +func (m *QueryCredentialStatusResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryCredentialResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryCredentialStatusResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryCredentialResponse.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryCredentialStatusResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -283,41 +282,41 @@ func (m *QueryCredentialResponse) XXX_Marshal(b []byte, deterministic bool) ([]b return b[:n], nil } } -func (m *QueryCredentialResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryCredentialResponse.Merge(m, src) +func (m *QueryCredentialStatusResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryCredentialStatusResponse.Merge(m, src) } -func (m *QueryCredentialResponse) XXX_Size() int { +func (m *QueryCredentialStatusResponse) XXX_Size() int { return m.Size() } -func (m *QueryCredentialResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryCredentialResponse.DiscardUnknown(m) +func (m *QueryCredentialStatusResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryCredentialStatusResponse.DiscardUnknown(m) } -var xxx_messageInfo_QueryCredentialResponse proto.InternalMessageInfo +var xxx_messageInfo_QueryCredentialStatusResponse proto.InternalMessageInfo -func (m *QueryCredentialResponse) GetCredStatus() *Credential { +func (m *QueryCredentialStatusResponse) GetCredentialStatus() *CredentialStatusState { if m != nil { - return m.CredStatus + return m.CredentialStatus } return nil } -type QueryCredentialsRequest struct { +type QueryCredentialStatusesRequest struct { Pagination *query.PageRequest `protobuf:"bytes,1,opt,name=pagination,proto3" json:"pagination,omitempty"` } -func (m *QueryCredentialsRequest) Reset() { *m = QueryCredentialsRequest{} } -func (m *QueryCredentialsRequest) String() string { return proto.CompactTextString(m) } -func (*QueryCredentialsRequest) ProtoMessage() {} -func (*QueryCredentialsRequest) Descriptor() ([]byte, []int) { +func (m *QueryCredentialStatusesRequest) Reset() { *m = QueryCredentialStatusesRequest{} } +func (m *QueryCredentialStatusesRequest) String() string { return proto.CompactTextString(m) } +func (*QueryCredentialStatusesRequest) ProtoMessage() {} +func (*QueryCredentialStatusesRequest) Descriptor() ([]byte, []int) { return fileDescriptor_0f525f26163d85f3, []int{6} } -func (m *QueryCredentialsRequest) XXX_Unmarshal(b []byte) error { +func (m *QueryCredentialStatusesRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryCredentialsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryCredentialStatusesRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryCredentialsRequest.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryCredentialStatusesRequest.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -327,42 +326,42 @@ func (m *QueryCredentialsRequest) XXX_Marshal(b []byte, deterministic bool) ([]b return b[:n], nil } } -func (m *QueryCredentialsRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryCredentialsRequest.Merge(m, src) +func (m *QueryCredentialStatusesRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryCredentialStatusesRequest.Merge(m, src) } -func (m *QueryCredentialsRequest) XXX_Size() int { +func (m *QueryCredentialStatusesRequest) XXX_Size() int { return m.Size() } -func (m *QueryCredentialsRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryCredentialsRequest.DiscardUnknown(m) +func (m *QueryCredentialStatusesRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryCredentialStatusesRequest.DiscardUnknown(m) } -var xxx_messageInfo_QueryCredentialsRequest proto.InternalMessageInfo +var xxx_messageInfo_QueryCredentialStatusesRequest proto.InternalMessageInfo -func (m *QueryCredentialsRequest) GetPagination() *query.PageRequest { +func (m *QueryCredentialStatusesRequest) GetPagination() *query.PageRequest { if m != nil { return m.Pagination } return nil } -type QueryCredentialsResponse struct { - TotalCount uint64 `protobuf:"varint,1,opt,name=totalCount,proto3" json:"totalCount,omitempty"` - Credentials []*Credential `protobuf:"bytes,2,rep,name=credentials,proto3" json:"credentials,omitempty"` +type QueryCredentialStatusesResponse struct { + Count uint64 `protobuf:"varint,1,opt,name=count,proto3" json:"count,omitempty"` + CredentialStatuses []*CredentialStatusState `protobuf:"bytes,2,rep,name=credentialStatuses,proto3" json:"credentialStatuses,omitempty"` } -func (m *QueryCredentialsResponse) Reset() { *m = QueryCredentialsResponse{} } -func (m *QueryCredentialsResponse) String() string { return proto.CompactTextString(m) } -func (*QueryCredentialsResponse) ProtoMessage() {} -func (*QueryCredentialsResponse) Descriptor() ([]byte, []int) { +func (m *QueryCredentialStatusesResponse) Reset() { *m = QueryCredentialStatusesResponse{} } +func (m *QueryCredentialStatusesResponse) String() string { return proto.CompactTextString(m) } +func (*QueryCredentialStatusesResponse) ProtoMessage() {} +func (*QueryCredentialStatusesResponse) Descriptor() ([]byte, []int) { return fileDescriptor_0f525f26163d85f3, []int{7} } -func (m *QueryCredentialsResponse) XXX_Unmarshal(b []byte) error { +func (m *QueryCredentialStatusesResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryCredentialsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryCredentialStatusesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryCredentialsResponse.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryCredentialStatusesResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -372,28 +371,28 @@ func (m *QueryCredentialsResponse) XXX_Marshal(b []byte, deterministic bool) ([] return b[:n], nil } } -func (m *QueryCredentialsResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryCredentialsResponse.Merge(m, src) +func (m *QueryCredentialStatusesResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryCredentialStatusesResponse.Merge(m, src) } -func (m *QueryCredentialsResponse) XXX_Size() int { +func (m *QueryCredentialStatusesResponse) XXX_Size() int { return m.Size() } -func (m *QueryCredentialsResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryCredentialsResponse.DiscardUnknown(m) +func (m *QueryCredentialStatusesResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryCredentialStatusesResponse.DiscardUnknown(m) } -var xxx_messageInfo_QueryCredentialsResponse proto.InternalMessageInfo +var xxx_messageInfo_QueryCredentialStatusesResponse proto.InternalMessageInfo -func (m *QueryCredentialsResponse) GetTotalCount() uint64 { +func (m *QueryCredentialStatusesResponse) GetCount() uint64 { if m != nil { - return m.TotalCount + return m.Count } return 0 } -func (m *QueryCredentialsResponse) GetCredentials() []*Credential { +func (m *QueryCredentialStatusesResponse) GetCredentialStatuses() []*CredentialStatusState { if m != nil { - return m.Credentials + return m.CredentialStatuses } return nil } @@ -443,8 +442,8 @@ func (m *QueryDidDocumentRequest) GetDidId() string { } type QueryDidDocumentResponse struct { - DidDocument *Did `protobuf:"bytes,1,opt,name=didDocument,proto3" json:"didDocument,omitempty"` - DidDocumentMetadata *Metadata `protobuf:"bytes,2,opt,name=didDocumentMetadata,proto3" json:"didDocumentMetadata,omitempty"` + DidDocument *DidDocument `protobuf:"bytes,1,opt,name=didDocument,proto3" json:"didDocument,omitempty"` + DidDocumentMetadata *DidDocumentMetadata `protobuf:"bytes,2,opt,name=didDocumentMetadata,proto3" json:"didDocumentMetadata,omitempty"` } func (m *QueryDidDocumentResponse) Reset() { *m = QueryDidDocumentResponse{} } @@ -480,14 +479,14 @@ func (m *QueryDidDocumentResponse) XXX_DiscardUnknown() { var xxx_messageInfo_QueryDidDocumentResponse proto.InternalMessageInfo -func (m *QueryDidDocumentResponse) GetDidDocument() *Did { +func (m *QueryDidDocumentResponse) GetDidDocument() *DidDocument { if m != nil { return m.DidDocument } return nil } -func (m *QueryDidDocumentResponse) GetDidDocumentMetadata() *Metadata { +func (m *QueryDidDocumentResponse) GetDidDocumentMetadata() *DidDocumentMetadata { if m != nil { return m.DidDocumentMetadata } @@ -495,8 +494,7 @@ func (m *QueryDidDocumentResponse) GetDidDocumentMetadata() *Metadata { } type QueryDidDocumentsRequest struct { - Count bool `protobuf:"varint,1,opt,name=count,proto3" json:"count,omitempty"` - Pagination *query.PageRequest `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` + Pagination *query.PageRequest `protobuf:"bytes,1,opt,name=pagination,proto3" json:"pagination,omitempty"` } func (m *QueryDidDocumentsRequest) Reset() { *m = QueryDidDocumentsRequest{} } @@ -532,13 +530,6 @@ func (m *QueryDidDocumentsRequest) XXX_DiscardUnknown() { var xxx_messageInfo_QueryDidDocumentsRequest proto.InternalMessageInfo -func (m *QueryDidDocumentsRequest) GetCount() bool { - if m != nil { - return m.Count - } - return false -} - func (m *QueryDidDocumentsRequest) GetPagination() *query.PageRequest { if m != nil { return m.Pagination @@ -547,8 +538,8 @@ func (m *QueryDidDocumentsRequest) GetPagination() *query.PageRequest { } type QueryDidDocumentsResponse struct { - TotalDidCount uint64 `protobuf:"varint,1,opt,name=totalDidCount,proto3" json:"totalDidCount,omitempty"` - DidDocList []*QueryDidDocumentResponse `protobuf:"bytes,2,rep,name=didDocList,proto3" json:"didDocList,omitempty"` + Count uint64 `protobuf:"varint,1,opt,name=count,proto3" json:"count,omitempty"` + DidDocuments []*DidDocumentState `protobuf:"bytes,2,rep,name=didDocuments,proto3" json:"didDocuments,omitempty"` } func (m *QueryDidDocumentsResponse) Reset() { *m = QueryDidDocumentsResponse{} } @@ -584,89 +575,86 @@ func (m *QueryDidDocumentsResponse) XXX_DiscardUnknown() { var xxx_messageInfo_QueryDidDocumentsResponse proto.InternalMessageInfo -func (m *QueryDidDocumentsResponse) GetTotalDidCount() uint64 { +func (m *QueryDidDocumentsResponse) GetCount() uint64 { if m != nil { - return m.TotalDidCount + return m.Count } return 0 } -func (m *QueryDidDocumentsResponse) GetDidDocList() []*QueryDidDocumentResponse { +func (m *QueryDidDocumentsResponse) GetDidDocuments() []*DidDocumentState { if m != nil { - return m.DidDocList + return m.DidDocuments } return nil } func init() { - proto.RegisterType((*QuerySchemaRequest)(nil), "hypersignprotocol.hidnode.ssi.QuerySchemaRequest") - proto.RegisterType((*QuerySchemaResponse)(nil), "hypersignprotocol.hidnode.ssi.QuerySchemaResponse") - proto.RegisterType((*QuerySchemasRequest)(nil), "hypersignprotocol.hidnode.ssi.QuerySchemasRequest") - proto.RegisterType((*QuerySchemasResponse)(nil), "hypersignprotocol.hidnode.ssi.QuerySchemasResponse") - proto.RegisterType((*QueryCredentialRequest)(nil), "hypersignprotocol.hidnode.ssi.QueryCredentialRequest") - proto.RegisterType((*QueryCredentialResponse)(nil), "hypersignprotocol.hidnode.ssi.QueryCredentialResponse") - proto.RegisterType((*QueryCredentialsRequest)(nil), "hypersignprotocol.hidnode.ssi.QueryCredentialsRequest") - proto.RegisterType((*QueryCredentialsResponse)(nil), "hypersignprotocol.hidnode.ssi.QueryCredentialsResponse") - proto.RegisterType((*QueryDidDocumentRequest)(nil), "hypersignprotocol.hidnode.ssi.QueryDidDocumentRequest") - proto.RegisterType((*QueryDidDocumentResponse)(nil), "hypersignprotocol.hidnode.ssi.QueryDidDocumentResponse") - proto.RegisterType((*QueryDidDocumentsRequest)(nil), "hypersignprotocol.hidnode.ssi.QueryDidDocumentsRequest") - proto.RegisterType((*QueryDidDocumentsResponse)(nil), "hypersignprotocol.hidnode.ssi.QueryDidDocumentsResponse") + proto.RegisterType((*QueryCredentialSchemaRequest)(nil), "hypersign.ssi.v1.QueryCredentialSchemaRequest") + proto.RegisterType((*QueryCredentialSchemaResponse)(nil), "hypersign.ssi.v1.QueryCredentialSchemaResponse") + proto.RegisterType((*QueryCredentialSchemasRequest)(nil), "hypersign.ssi.v1.QueryCredentialSchemasRequest") + proto.RegisterType((*QueryCredentialSchemasResponse)(nil), "hypersign.ssi.v1.QueryCredentialSchemasResponse") + proto.RegisterType((*QueryCredentialStatusRequest)(nil), "hypersign.ssi.v1.QueryCredentialStatusRequest") + proto.RegisterType((*QueryCredentialStatusResponse)(nil), "hypersign.ssi.v1.QueryCredentialStatusResponse") + proto.RegisterType((*QueryCredentialStatusesRequest)(nil), "hypersign.ssi.v1.QueryCredentialStatusesRequest") + proto.RegisterType((*QueryCredentialStatusesResponse)(nil), "hypersign.ssi.v1.QueryCredentialStatusesResponse") + proto.RegisterType((*QueryDidDocumentRequest)(nil), "hypersign.ssi.v1.QueryDidDocumentRequest") + proto.RegisterType((*QueryDidDocumentResponse)(nil), "hypersign.ssi.v1.QueryDidDocumentResponse") + proto.RegisterType((*QueryDidDocumentsRequest)(nil), "hypersign.ssi.v1.QueryDidDocumentsRequest") + proto.RegisterType((*QueryDidDocumentsResponse)(nil), "hypersign.ssi.v1.QueryDidDocumentsResponse") } func init() { proto.RegisterFile("ssi/v1/query.proto", fileDescriptor_0f525f26163d85f3) } var fileDescriptor_0f525f26163d85f3 = []byte{ - // 786 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x55, 0x41, 0x6f, 0x13, 0x39, - 0x14, 0xee, 0x64, 0xb7, 0x55, 0xf7, 0x65, 0x57, 0xdb, 0x75, 0xab, 0x36, 0x1b, 0xed, 0x46, 0xd5, - 0xec, 0xb6, 0xdb, 0x6d, 0xe9, 0x4c, 0x93, 0xa8, 0x05, 0x84, 0xb8, 0xd0, 0x80, 0x54, 0x51, 0x24, - 0x98, 0x22, 0x21, 0x90, 0x38, 0x38, 0xb1, 0x35, 0xb1, 0x94, 0x8c, 0xd3, 0xd8, 0xa9, 0x5a, 0x55, - 0xb9, 0x70, 0xe1, 0x8a, 0xc4, 0x8d, 0x3f, 0xc0, 0x91, 0x03, 0x07, 0x90, 0x10, 0x77, 0x4e, 0xa8, - 0x12, 0x17, 0x8e, 0xa8, 0xe5, 0x87, 0xa0, 0xd8, 0x9e, 0xc4, 0x69, 0x5a, 0x92, 0xa9, 0xb8, 0x8d, - 0x9f, 0xfd, 0x7d, 0xef, 0x7b, 0xdf, 0xf3, 0x3c, 0x03, 0x12, 0x82, 0xf9, 0x7b, 0x79, 0x7f, 0xb7, - 0x45, 0x9b, 0x07, 0x5e, 0xa3, 0xc9, 0x25, 0x47, 0x7f, 0x57, 0x0f, 0x1a, 0xb4, 0x29, 0x58, 0x18, - 0xa9, 0x75, 0x85, 0xd7, 0xbc, 0x2a, 0x23, 0x11, 0x27, 0xd4, 0x13, 0x82, 0x65, 0x67, 0x42, 0x1e, - 0x72, 0xb5, 0xe3, 0x77, 0xbe, 0x34, 0x28, 0xfb, 0x57, 0xc8, 0x79, 0x58, 0xa3, 0x3e, 0x6e, 0x30, - 0x1f, 0x47, 0x11, 0x97, 0x58, 0x32, 0x1e, 0x09, 0xb3, 0xbb, 0x5c, 0xe1, 0xa2, 0xce, 0x85, 0x5f, - 0xc6, 0x82, 0xea, 0x5c, 0xfe, 0x5e, 0xbe, 0x4c, 0x25, 0xce, 0xfb, 0x0d, 0x1c, 0xb2, 0x48, 0x1d, - 0x36, 0x67, 0xa7, 0x8d, 0x24, 0x51, 0xa9, 0xd2, 0x3a, 0x36, 0xc1, 0x29, 0x13, 0x24, 0x8c, 0x98, - 0xc8, 0x9c, 0x89, 0x54, 0x9a, 0x94, 0xd0, 0x48, 0x32, 0x5c, 0xd3, 0x1b, 0xee, 0x1a, 0xa0, 0x7b, - 0x9d, 0x0c, 0x3b, 0x0a, 0x1f, 0xd0, 0xdd, 0x16, 0x15, 0x12, 0x65, 0x61, 0x52, 0x13, 0x6e, 0x91, - 0x8c, 0x33, 0xef, 0x2c, 0xfd, 0x12, 0x74, 0xd7, 0xee, 0x7d, 0x98, 0xee, 0x43, 0x88, 0x06, 0x8f, - 0x04, 0x45, 0xd7, 0x61, 0x42, 0x1f, 0xc9, 0x38, 0xf3, 0x3f, 0x2d, 0xa5, 0x0b, 0x0b, 0xde, 0x77, - 0x8d, 0xf1, 0x0c, 0xdc, 0x80, 0xdc, 0xc7, 0x7d, 0xac, 0x22, 0x16, 0x72, 0x0b, 0xa0, 0x57, 0xb2, - 0x92, 0x92, 0x2e, 0x2c, 0x7a, 0xda, 0x1f, 0xaf, 0xe3, 0x8f, 0xa7, 0x7b, 0x61, 0xfc, 0xf1, 0xee, - 0xe2, 0x90, 0x1a, 0x6c, 0x60, 0x21, 0xdd, 0x36, 0xcc, 0xf4, 0xd3, 0x1b, 0xd5, 0x39, 0x00, 0xc9, - 0x25, 0xae, 0x6d, 0xf2, 0x56, 0x24, 0x15, 0xff, 0xcf, 0x81, 0x15, 0x41, 0x37, 0x01, 0xb4, 0xc0, - 0x6d, 0x26, 0x64, 0x26, 0x95, 0xa4, 0x32, 0x0b, 0xe8, 0xae, 0xc1, 0xac, 0x4a, 0xbf, 0xd9, 0xb5, - 0x3f, 0x2e, 0x70, 0x16, 0x26, 0x3a, 0x3d, 0xe9, 0xfa, 0x6c, 0x56, 0x2e, 0x81, 0xb9, 0x01, 0x84, - 0xd1, 0xbc, 0x05, 0xd0, 0x39, 0xb4, 0x23, 0xb1, 0x6c, 0x09, 0xe3, 0xc9, 0xff, 0x43, 0x34, 0x59, - 0x34, 0x16, 0xd8, 0xc5, 0x03, 0x59, 0x7e, 0xb8, 0xf3, 0x4f, 0x1d, 0xc8, 0x0c, 0xe6, 0x18, 0xd1, - 0xfe, 0xdb, 0x90, 0xee, 0xdd, 0x58, 0x61, 0xfc, 0x4f, 0x50, 0xab, 0x8d, 0x76, 0x7d, 0x53, 0x6c, - 0x89, 0x91, 0x12, 0xaf, 0xb4, 0xea, 0x34, 0x92, 0x71, 0xb1, 0x33, 0x30, 0x4e, 0x58, 0xaf, 0x09, - 0x7a, 0xe1, 0xbe, 0x8b, 0xa5, 0xf7, 0x21, 0x8c, 0xf4, 0x12, 0xa4, 0x49, 0x2f, 0x6c, 0x0c, 0x72, - 0x87, 0x48, 0x2b, 0x31, 0x12, 0xd8, 0x30, 0xf4, 0x10, 0xa6, 0xad, 0xe5, 0x1d, 0x2a, 0x31, 0xc1, - 0x12, 0x67, 0x52, 0x8a, 0xed, 0xbf, 0x21, 0x6c, 0xf1, 0xf1, 0xe0, 0x2c, 0x0e, 0x77, 0x7f, 0x50, - 0xbc, 0xb0, 0xea, 0xad, 0x74, 0x2d, 0x9f, 0x0c, 0xf4, 0xe2, 0x54, 0xcb, 0x53, 0x17, 0x6e, 0xf9, - 0x0b, 0x07, 0xfe, 0x3c, 0x23, 0xb5, 0x31, 0xee, 0x5f, 0xf8, 0x4d, 0x75, 0xb8, 0xc4, 0x88, 0xdd, - 0xf6, 0xfe, 0x20, 0x7a, 0x00, 0xa0, 0x8b, 0xb2, 0x7e, 0xbc, 0xcb, 0x43, 0xfc, 0x38, 0xaf, 0x57, - 0x81, 0x45, 0x55, 0xf8, 0x38, 0x09, 0xe3, 0xea, 0x20, 0x7a, 0xe5, 0x40, 0xda, 0x1a, 0x0a, 0x28, - 0x3f, 0x0a, 0x7d, 0xdf, 0x9c, 0xcc, 0x16, 0x92, 0x40, 0xb4, 0x18, 0xf7, 0xea, 0x93, 0x4f, 0x5f, - 0x9f, 0xa7, 0x8a, 0x28, 0xef, 0x77, 0xb1, 0xab, 0x31, 0xd8, 0x37, 0x60, 0xbf, 0x33, 0xae, 0xf5, - 0xfc, 0xf0, 0x0f, 0xe3, 0xc9, 0xdb, 0x46, 0x2f, 0x1d, 0xf8, 0xd5, 0x1e, 0x63, 0x28, 0x41, 0xfe, - 0xb8, 0xf7, 0xd9, 0x62, 0x22, 0x8c, 0x11, 0xed, 0x29, 0xd1, 0x4b, 0x68, 0x71, 0x34, 0xd1, 0xe8, - 0xad, 0x03, 0x53, 0xa7, 0xdb, 0x81, 0x36, 0x12, 0xf7, 0x4f, 0x2b, 0xbe, 0x68, 0xdf, 0xdd, 0xa2, - 0x52, 0xbd, 0x8a, 0x56, 0x86, 0xa9, 0x26, 0x8c, 0xf8, 0x87, 0xea, 0xa7, 0x6f, 0xa3, 0xd7, 0x0e, - 0xfc, 0x31, 0x70, 0x7b, 0x51, 0x52, 0x0d, 0x5d, 0xbb, 0xaf, 0x24, 0x07, 0x1a, 0xf5, 0x2b, 0x4a, - 0xfd, 0x02, 0xfa, 0x67, 0x04, 0xf5, 0xe8, 0xbd, 0x03, 0xbf, 0x9f, 0x1a, 0xb3, 0x68, 0x7d, 0x94, - 0xd4, 0x03, 0x4f, 0x52, 0x76, 0x23, 0x29, 0xcc, 0xe8, 0xbd, 0xa6, 0xf4, 0xae, 0xa3, 0xe2, 0x30, - 0xbd, 0xbd, 0xa1, 0xec, 0x1f, 0xea, 0xe7, 0xae, 0x8d, 0xde, 0xc4, 0x17, 0xc6, 0x7a, 0x26, 0x50, - 0x42, 0x25, 0x22, 0xd1, 0x85, 0x39, 0xe3, 0x3d, 0x72, 0x0b, 0xaa, 0x84, 0x4b, 0x68, 0x79, 0xf4, - 0x12, 0x6e, 0x6c, 0x7f, 0x38, 0xce, 0x39, 0x47, 0xc7, 0x39, 0xe7, 0xcb, 0x71, 0xce, 0x79, 0x76, - 0x92, 0x1b, 0x3b, 0x3a, 0xc9, 0x8d, 0x7d, 0x3e, 0xc9, 0x8d, 0x3d, 0x2a, 0x84, 0x4c, 0x56, 0x5b, - 0x65, 0xaf, 0xc2, 0xeb, 0xe7, 0xf0, 0xad, 0x2a, 0xc2, 0x7d, 0x45, 0x29, 0x0f, 0x1a, 0x54, 0x94, - 0x27, 0xd4, 0x76, 0xf1, 0x5b, 0x00, 0x00, 0x00, 0xff, 0xff, 0x6a, 0xd8, 0xb4, 0x97, 0x6b, 0x0a, - 0x00, 0x00, + // 749 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x55, 0xc1, 0x6b, 0x13, 0x4f, + 0x14, 0xee, 0xf4, 0xf7, 0x6b, 0xa9, 0xaf, 0x05, 0xdb, 0xb1, 0x68, 0x0c, 0xed, 0x5a, 0x56, 0x5a, + 0x6b, 0x6b, 0x77, 0x9a, 0x04, 0x05, 0xf5, 0x20, 0xd4, 0x52, 0x28, 0x28, 0x68, 0x8a, 0x14, 0xbc, + 0xc8, 0x64, 0x77, 0xd8, 0x2c, 0x34, 0x3b, 0x69, 0x66, 0x12, 0x0c, 0xa5, 0x17, 0x3d, 0x0b, 0x05, + 0xbd, 0x7a, 0xf5, 0xe6, 0x45, 0xfa, 0x47, 0x78, 0x2c, 0x78, 0xf1, 0x28, 0xad, 0x7f, 0x88, 0x64, + 0x76, 0x36, 0xd9, 0x66, 0x93, 0xed, 0x88, 0x3d, 0xce, 0xbe, 0xf7, 0x7d, 0xef, 0x7b, 0xef, 0x9b, + 0x7d, 0x03, 0x58, 0x88, 0x80, 0xb4, 0x0a, 0x64, 0xbf, 0xc9, 0x1a, 0x6d, 0xa7, 0xde, 0xe0, 0x92, + 0xe3, 0xe9, 0x6a, 0xbb, 0xce, 0x1a, 0x22, 0xf0, 0x43, 0x47, 0x88, 0xc0, 0x69, 0x15, 0xf2, 0x73, + 0x3e, 0xe7, 0xfe, 0x1e, 0x23, 0xb4, 0x1e, 0x10, 0x1a, 0x86, 0x5c, 0x52, 0x19, 0xf0, 0x50, 0x44, + 0xf9, 0xf9, 0x15, 0x97, 0x8b, 0x1a, 0x17, 0xa4, 0x42, 0x05, 0x8b, 0x88, 0x48, 0xab, 0x50, 0x61, + 0x92, 0x16, 0x48, 0x9d, 0xfa, 0x41, 0xa8, 0x92, 0x75, 0xae, 0xa5, 0xeb, 0xb9, 0x0d, 0xe6, 0xb1, + 0x50, 0x06, 0x74, 0xef, 0x8d, 0x70, 0xab, 0xac, 0x46, 0x75, 0x7c, 0x5a, 0xc7, 0xbd, 0xc0, 0xcb, + 0x40, 0x48, 0x2a, 0x9b, 0xba, 0xba, 0xfd, 0x08, 0xe6, 0x5e, 0x76, 0x6a, 0x3e, 0xed, 0xc6, 0x77, + 0x14, 0x61, 0x99, 0xed, 0x37, 0x99, 0x90, 0x38, 0x0f, 0x13, 0x51, 0x85, 0x6d, 0x2f, 0x87, 0x16, + 0xd0, 0xf2, 0x95, 0x72, 0xf7, 0x6c, 0xb7, 0x60, 0x7e, 0x08, 0x56, 0xd4, 0x79, 0x28, 0x18, 0x7e, + 0x05, 0x33, 0x6e, 0x5f, 0x4c, 0xe4, 0xd0, 0xc2, 0x7f, 0xcb, 0x93, 0xc5, 0x3b, 0x4e, 0xff, 0x98, + 0x9c, 0x7e, 0x9a, 0x1d, 0x49, 0x25, 0x2b, 0xa7, 0x19, 0x6c, 0x7f, 0x48, 0x5d, 0x11, 0x8b, 0xde, + 0x02, 0xe8, 0x8d, 0x4e, 0xc9, 0x9e, 0x2c, 0x2e, 0x39, 0xd1, 0x9c, 0x9d, 0xce, 0x9c, 0x9d, 0xc8, + 0x30, 0x3d, 0x67, 0xe7, 0x05, 0xf5, 0x99, 0xc6, 0x96, 0x13, 0x48, 0xfb, 0x03, 0x02, 0x6b, 0x58, + 0x25, 0xdd, 0xe2, 0x2c, 0x8c, 0xb9, 0xbc, 0x19, 0x4a, 0x55, 0xe5, 0xff, 0x72, 0x74, 0x18, 0xdc, + 0xf8, 0xe8, 0x3f, 0x37, 0xfe, 0x20, 0x6d, 0x96, 0xf2, 0x32, 0xee, 0xfb, 0x3a, 0x8c, 0x77, 0x40, + 0x5d, 0xab, 0xf4, 0xc9, 0x96, 0xe9, 0x81, 0x69, 0x9c, 0xee, 0x62, 0x07, 0xa6, 0xdd, 0xbe, 0x98, + 0x1e, 0x5b, 0xb6, 0x5c, 0x95, 0x19, 0xc9, 0x4d, 0x11, 0xd8, 0xd5, 0xf4, 0xf0, 0x54, 0x80, 0x5d, + 0xba, 0x4f, 0x47, 0x08, 0x6e, 0x0d, 0x2d, 0x95, 0x69, 0xd4, 0x2e, 0x60, 0x37, 0x85, 0x31, 0x72, + 0x2a, 0xd1, 0xfa, 0x00, 0x0a, 0x9b, 0xc0, 0x0d, 0xa5, 0x68, 0x33, 0xf0, 0x36, 0xb9, 0xdb, 0xac, + 0xb1, 0x50, 0xc6, 0x5d, 0xcf, 0xc2, 0x98, 0x17, 0xf4, 0x4c, 0x8a, 0x0e, 0xf6, 0x31, 0x82, 0x5c, + 0x1a, 0xa1, 0xc5, 0x3f, 0x81, 0x49, 0xaf, 0xf7, 0x59, 0x4f, 0x6a, 0x3e, 0xad, 0x2f, 0x89, 0x4d, + 0x22, 0xf0, 0x2e, 0x5c, 0x4b, 0x1c, 0x9f, 0x33, 0x49, 0x3d, 0x2a, 0x69, 0x6e, 0x54, 0x11, 0x2d, + 0x66, 0x12, 0xc5, 0xc9, 0xe5, 0x41, 0x0c, 0x76, 0x25, 0xad, 0xfa, 0xd2, 0xed, 0x6d, 0xc3, 0xcd, + 0x01, 0x35, 0x32, 0x7d, 0xdd, 0x82, 0xa9, 0x84, 0xda, 0xd8, 0x51, 0x3b, 0xb3, 0xd1, 0xc8, 0xcc, + 0x73, 0xb8, 0xe2, 0xfb, 0x09, 0x18, 0x53, 0xb5, 0xf1, 0x37, 0x04, 0xb3, 0xfd, 0x3f, 0xea, 0x46, + 0x7b, 0x7b, 0x13, 0x3b, 0x69, 0xd2, 0xac, 0x8d, 0x9a, 0x27, 0xc6, 0xf9, 0x51, 0x87, 0xf6, 0xc3, + 0x77, 0x3f, 0x7e, 0x7f, 0x1c, 0x2d, 0xe1, 0x02, 0xe9, 0x02, 0xd7, 0xd4, 0xf2, 0x76, 0xf9, 0x1e, + 0xa9, 0x06, 0x5e, 0xc8, 0x3d, 0x46, 0x3a, 0x6b, 0x3e, 0x5a, 0xcc, 0xe4, 0x20, 0x5e, 0xd0, 0x87, + 0xf8, 0x0b, 0x82, 0x99, 0xd4, 0xee, 0xc2, 0xa6, 0x0a, 0x62, 0x23, 0xf3, 0xeb, 0xe6, 0x00, 0xad, + 0xd9, 0x51, 0x9a, 0x97, 0xf1, 0x92, 0x99, 0x66, 0xfc, 0x19, 0xc1, 0xd5, 0x84, 0x15, 0x6a, 0xb0, + 0x77, 0x87, 0x54, 0x4d, 0xff, 0x52, 0xf9, 0x15, 0x93, 0x54, 0x2d, 0xad, 0xa4, 0xa4, 0xad, 0xe1, + 0xd5, 0x8b, 0xa4, 0x79, 0x81, 0x47, 0x0e, 0xd4, 0xcf, 0x79, 0x88, 0x3f, 0x21, 0x98, 0x4a, 0x5e, + 0x3f, 0x6c, 0x50, 0xb1, 0x3b, 0xbe, 0x55, 0xa3, 0x5c, 0x2d, 0x6f, 0x55, 0xc9, 0x5b, 0xc4, 0xb7, + 0x0d, 0xe4, 0xe1, 0xe3, 0xf3, 0x97, 0x52, 0x2d, 0x1f, 0xd3, 0x4b, 0x99, 0x7c, 0x39, 0x4c, 0x2e, + 0xe5, 0xb9, 0x17, 0xc3, 0x7e, 0xac, 0x64, 0xde, 0xc7, 0xa5, 0x8b, 0x64, 0xf6, 0x76, 0x23, 0x39, + 0x88, 0x9e, 0xa3, 0x43, 0xfc, 0x15, 0x01, 0x4e, 0xaf, 0x6a, 0xbc, 0x6e, 0x28, 0xa2, 0xfb, 0x80, + 0xe4, 0x0b, 0x7f, 0x81, 0xd0, 0xc2, 0x8b, 0x4a, 0xf8, 0x3d, 0xbc, 0x62, 0x2e, 0x7c, 0xe3, 0xd9, + 0xf7, 0x53, 0x0b, 0x9d, 0x9c, 0x5a, 0xe8, 0xd7, 0xa9, 0x85, 0x8e, 0xce, 0xac, 0x91, 0x93, 0x33, + 0x6b, 0xe4, 0xe7, 0x99, 0x35, 0xf2, 0xba, 0xe8, 0x07, 0xb2, 0xda, 0xac, 0x38, 0x2e, 0xaf, 0x0d, + 0xe1, 0x5b, 0x53, 0x84, 0x6f, 0x15, 0xa5, 0x6c, 0xd7, 0x99, 0xa8, 0x8c, 0xab, 0x70, 0xe9, 0x4f, + 0x00, 0x00, 0x00, 0xff, 0xff, 0x43, 0xb0, 0xd8, 0x41, 0x3d, 0x0a, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -682,17 +670,17 @@ const _ = grpc.SupportPackageIsVersion4 // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type QueryClient interface { // Get the Schema Document for a specified schema id - QuerySchema(ctx context.Context, in *QuerySchemaRequest, opts ...grpc.CallOption) (*QuerySchemaResponse, error) + CredentialSchemaByID(ctx context.Context, in *QueryCredentialSchemaRequest, opts ...grpc.CallOption) (*QueryCredentialSchemaResponse, error) // Get the count and list of registered Schemas - QuerySchemas(ctx context.Context, in *QuerySchemasRequest, opts ...grpc.CallOption) (*QuerySchemasResponse, error) + CredentialSchemas(ctx context.Context, in *QueryCredentialSchemasRequest, opts ...grpc.CallOption) (*QueryCredentialSchemasResponse, error) // Get the Did Document for a specified DID id - QueryDidDocument(ctx context.Context, in *QueryDidDocumentRequest, opts ...grpc.CallOption) (*QueryDidDocumentResponse, error) + DidDocumentByID(ctx context.Context, in *QueryDidDocumentRequest, opts ...grpc.CallOption) (*QueryDidDocumentResponse, error) // Get the count and list of registered Did Documents - QueryDidDocuments(ctx context.Context, in *QueryDidDocumentsRequest, opts ...grpc.CallOption) (*QueryDidDocumentsResponse, error) + DidDocuments(ctx context.Context, in *QueryDidDocumentsRequest, opts ...grpc.CallOption) (*QueryDidDocumentsResponse, error) // Get the Credential Status for a given credential id - QueryCredential(ctx context.Context, in *QueryCredentialRequest, opts ...grpc.CallOption) (*QueryCredentialResponse, error) + CredentialStatusByID(ctx context.Context, in *QueryCredentialStatusRequest, opts ...grpc.CallOption) (*QueryCredentialStatusResponse, error) // Get all the registed Credential Statuses - QueryCredentials(ctx context.Context, in *QueryCredentialsRequest, opts ...grpc.CallOption) (*QueryCredentialsResponse, error) + CredentialStatuses(ctx context.Context, in *QueryCredentialStatusesRequest, opts ...grpc.CallOption) (*QueryCredentialStatusesResponse, error) } type queryClient struct { @@ -703,54 +691,54 @@ func NewQueryClient(cc grpc1.ClientConn) QueryClient { return &queryClient{cc} } -func (c *queryClient) QuerySchema(ctx context.Context, in *QuerySchemaRequest, opts ...grpc.CallOption) (*QuerySchemaResponse, error) { - out := new(QuerySchemaResponse) - err := c.cc.Invoke(ctx, "/hypersignprotocol.hidnode.ssi.Query/QuerySchema", in, out, opts...) +func (c *queryClient) CredentialSchemaByID(ctx context.Context, in *QueryCredentialSchemaRequest, opts ...grpc.CallOption) (*QueryCredentialSchemaResponse, error) { + out := new(QueryCredentialSchemaResponse) + err := c.cc.Invoke(ctx, "/hypersign.ssi.v1.Query/CredentialSchemaByID", in, out, opts...) if err != nil { return nil, err } return out, nil } -func (c *queryClient) QuerySchemas(ctx context.Context, in *QuerySchemasRequest, opts ...grpc.CallOption) (*QuerySchemasResponse, error) { - out := new(QuerySchemasResponse) - err := c.cc.Invoke(ctx, "/hypersignprotocol.hidnode.ssi.Query/QuerySchemas", in, out, opts...) +func (c *queryClient) CredentialSchemas(ctx context.Context, in *QueryCredentialSchemasRequest, opts ...grpc.CallOption) (*QueryCredentialSchemasResponse, error) { + out := new(QueryCredentialSchemasResponse) + err := c.cc.Invoke(ctx, "/hypersign.ssi.v1.Query/CredentialSchemas", in, out, opts...) if err != nil { return nil, err } return out, nil } -func (c *queryClient) QueryDidDocument(ctx context.Context, in *QueryDidDocumentRequest, opts ...grpc.CallOption) (*QueryDidDocumentResponse, error) { +func (c *queryClient) DidDocumentByID(ctx context.Context, in *QueryDidDocumentRequest, opts ...grpc.CallOption) (*QueryDidDocumentResponse, error) { out := new(QueryDidDocumentResponse) - err := c.cc.Invoke(ctx, "/hypersignprotocol.hidnode.ssi.Query/QueryDidDocument", in, out, opts...) + err := c.cc.Invoke(ctx, "/hypersign.ssi.v1.Query/DidDocumentByID", in, out, opts...) if err != nil { return nil, err } return out, nil } -func (c *queryClient) QueryDidDocuments(ctx context.Context, in *QueryDidDocumentsRequest, opts ...grpc.CallOption) (*QueryDidDocumentsResponse, error) { +func (c *queryClient) DidDocuments(ctx context.Context, in *QueryDidDocumentsRequest, opts ...grpc.CallOption) (*QueryDidDocumentsResponse, error) { out := new(QueryDidDocumentsResponse) - err := c.cc.Invoke(ctx, "/hypersignprotocol.hidnode.ssi.Query/QueryDidDocuments", in, out, opts...) + err := c.cc.Invoke(ctx, "/hypersign.ssi.v1.Query/DidDocuments", in, out, opts...) if err != nil { return nil, err } return out, nil } -func (c *queryClient) QueryCredential(ctx context.Context, in *QueryCredentialRequest, opts ...grpc.CallOption) (*QueryCredentialResponse, error) { - out := new(QueryCredentialResponse) - err := c.cc.Invoke(ctx, "/hypersignprotocol.hidnode.ssi.Query/QueryCredential", in, out, opts...) +func (c *queryClient) CredentialStatusByID(ctx context.Context, in *QueryCredentialStatusRequest, opts ...grpc.CallOption) (*QueryCredentialStatusResponse, error) { + out := new(QueryCredentialStatusResponse) + err := c.cc.Invoke(ctx, "/hypersign.ssi.v1.Query/CredentialStatusByID", in, out, opts...) if err != nil { return nil, err } return out, nil } -func (c *queryClient) QueryCredentials(ctx context.Context, in *QueryCredentialsRequest, opts ...grpc.CallOption) (*QueryCredentialsResponse, error) { - out := new(QueryCredentialsResponse) - err := c.cc.Invoke(ctx, "/hypersignprotocol.hidnode.ssi.Query/QueryCredentials", in, out, opts...) +func (c *queryClient) CredentialStatuses(ctx context.Context, in *QueryCredentialStatusesRequest, opts ...grpc.CallOption) (*QueryCredentialStatusesResponse, error) { + out := new(QueryCredentialStatusesResponse) + err := c.cc.Invoke(ctx, "/hypersign.ssi.v1.Query/CredentialStatuses", in, out, opts...) if err != nil { return nil, err } @@ -760,188 +748,188 @@ func (c *queryClient) QueryCredentials(ctx context.Context, in *QueryCredentials // QueryServer is the server API for Query service. type QueryServer interface { // Get the Schema Document for a specified schema id - QuerySchema(context.Context, *QuerySchemaRequest) (*QuerySchemaResponse, error) + CredentialSchemaByID(context.Context, *QueryCredentialSchemaRequest) (*QueryCredentialSchemaResponse, error) // Get the count and list of registered Schemas - QuerySchemas(context.Context, *QuerySchemasRequest) (*QuerySchemasResponse, error) + CredentialSchemas(context.Context, *QueryCredentialSchemasRequest) (*QueryCredentialSchemasResponse, error) // Get the Did Document for a specified DID id - QueryDidDocument(context.Context, *QueryDidDocumentRequest) (*QueryDidDocumentResponse, error) + DidDocumentByID(context.Context, *QueryDidDocumentRequest) (*QueryDidDocumentResponse, error) // Get the count and list of registered Did Documents - QueryDidDocuments(context.Context, *QueryDidDocumentsRequest) (*QueryDidDocumentsResponse, error) + DidDocuments(context.Context, *QueryDidDocumentsRequest) (*QueryDidDocumentsResponse, error) // Get the Credential Status for a given credential id - QueryCredential(context.Context, *QueryCredentialRequest) (*QueryCredentialResponse, error) + CredentialStatusByID(context.Context, *QueryCredentialStatusRequest) (*QueryCredentialStatusResponse, error) // Get all the registed Credential Statuses - QueryCredentials(context.Context, *QueryCredentialsRequest) (*QueryCredentialsResponse, error) + CredentialStatuses(context.Context, *QueryCredentialStatusesRequest) (*QueryCredentialStatusesResponse, error) } // UnimplementedQueryServer can be embedded to have forward compatible implementations. type UnimplementedQueryServer struct { } -func (*UnimplementedQueryServer) QuerySchema(ctx context.Context, req *QuerySchemaRequest) (*QuerySchemaResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method QuerySchema not implemented") +func (*UnimplementedQueryServer) CredentialSchemaByID(ctx context.Context, req *QueryCredentialSchemaRequest) (*QueryCredentialSchemaResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CredentialSchemaByID not implemented") } -func (*UnimplementedQueryServer) QuerySchemas(ctx context.Context, req *QuerySchemasRequest) (*QuerySchemasResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method QuerySchemas not implemented") +func (*UnimplementedQueryServer) CredentialSchemas(ctx context.Context, req *QueryCredentialSchemasRequest) (*QueryCredentialSchemasResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CredentialSchemas not implemented") } -func (*UnimplementedQueryServer) QueryDidDocument(ctx context.Context, req *QueryDidDocumentRequest) (*QueryDidDocumentResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method QueryDidDocument not implemented") +func (*UnimplementedQueryServer) DidDocumentByID(ctx context.Context, req *QueryDidDocumentRequest) (*QueryDidDocumentResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method DidDocumentByID not implemented") } -func (*UnimplementedQueryServer) QueryDidDocuments(ctx context.Context, req *QueryDidDocumentsRequest) (*QueryDidDocumentsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method QueryDidDocuments not implemented") +func (*UnimplementedQueryServer) DidDocuments(ctx context.Context, req *QueryDidDocumentsRequest) (*QueryDidDocumentsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method DidDocuments not implemented") } -func (*UnimplementedQueryServer) QueryCredential(ctx context.Context, req *QueryCredentialRequest) (*QueryCredentialResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method QueryCredential not implemented") +func (*UnimplementedQueryServer) CredentialStatusByID(ctx context.Context, req *QueryCredentialStatusRequest) (*QueryCredentialStatusResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CredentialStatusByID not implemented") } -func (*UnimplementedQueryServer) QueryCredentials(ctx context.Context, req *QueryCredentialsRequest) (*QueryCredentialsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method QueryCredentials not implemented") +func (*UnimplementedQueryServer) CredentialStatuses(ctx context.Context, req *QueryCredentialStatusesRequest) (*QueryCredentialStatusesResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CredentialStatuses not implemented") } func RegisterQueryServer(s grpc1.Server, srv QueryServer) { s.RegisterService(&_Query_serviceDesc, srv) } -func _Query_QuerySchema_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QuerySchemaRequest) +func _Query_CredentialSchemaByID_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryCredentialSchemaRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(QueryServer).QuerySchema(ctx, in) + return srv.(QueryServer).CredentialSchemaByID(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/hypersignprotocol.hidnode.ssi.Query/QuerySchema", + FullMethod: "/hypersign.ssi.v1.Query/CredentialSchemaByID", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).QuerySchema(ctx, req.(*QuerySchemaRequest)) + return srv.(QueryServer).CredentialSchemaByID(ctx, req.(*QueryCredentialSchemaRequest)) } return interceptor(ctx, in, info, handler) } -func _Query_QuerySchemas_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QuerySchemasRequest) +func _Query_CredentialSchemas_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryCredentialSchemasRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(QueryServer).QuerySchemas(ctx, in) + return srv.(QueryServer).CredentialSchemas(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/hypersignprotocol.hidnode.ssi.Query/QuerySchemas", + FullMethod: "/hypersign.ssi.v1.Query/CredentialSchemas", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).QuerySchemas(ctx, req.(*QuerySchemasRequest)) + return srv.(QueryServer).CredentialSchemas(ctx, req.(*QueryCredentialSchemasRequest)) } return interceptor(ctx, in, info, handler) } -func _Query_QueryDidDocument_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { +func _Query_DidDocumentByID_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(QueryDidDocumentRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(QueryServer).QueryDidDocument(ctx, in) + return srv.(QueryServer).DidDocumentByID(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/hypersignprotocol.hidnode.ssi.Query/QueryDidDocument", + FullMethod: "/hypersign.ssi.v1.Query/DidDocumentByID", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).QueryDidDocument(ctx, req.(*QueryDidDocumentRequest)) + return srv.(QueryServer).DidDocumentByID(ctx, req.(*QueryDidDocumentRequest)) } return interceptor(ctx, in, info, handler) } -func _Query_QueryDidDocuments_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { +func _Query_DidDocuments_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(QueryDidDocumentsRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(QueryServer).QueryDidDocuments(ctx, in) + return srv.(QueryServer).DidDocuments(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/hypersignprotocol.hidnode.ssi.Query/QueryDidDocuments", + FullMethod: "/hypersign.ssi.v1.Query/DidDocuments", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).QueryDidDocuments(ctx, req.(*QueryDidDocumentsRequest)) + return srv.(QueryServer).DidDocuments(ctx, req.(*QueryDidDocumentsRequest)) } return interceptor(ctx, in, info, handler) } -func _Query_QueryCredential_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryCredentialRequest) +func _Query_CredentialStatusByID_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryCredentialStatusRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(QueryServer).QueryCredential(ctx, in) + return srv.(QueryServer).CredentialStatusByID(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/hypersignprotocol.hidnode.ssi.Query/QueryCredential", + FullMethod: "/hypersign.ssi.v1.Query/CredentialStatusByID", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).QueryCredential(ctx, req.(*QueryCredentialRequest)) + return srv.(QueryServer).CredentialStatusByID(ctx, req.(*QueryCredentialStatusRequest)) } return interceptor(ctx, in, info, handler) } -func _Query_QueryCredentials_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryCredentialsRequest) +func _Query_CredentialStatuses_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryCredentialStatusesRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(QueryServer).QueryCredentials(ctx, in) + return srv.(QueryServer).CredentialStatuses(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/hypersignprotocol.hidnode.ssi.Query/QueryCredentials", + FullMethod: "/hypersign.ssi.v1.Query/CredentialStatuses", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).QueryCredentials(ctx, req.(*QueryCredentialsRequest)) + return srv.(QueryServer).CredentialStatuses(ctx, req.(*QueryCredentialStatusesRequest)) } return interceptor(ctx, in, info, handler) } var _Query_serviceDesc = grpc.ServiceDesc{ - ServiceName: "hypersignprotocol.hidnode.ssi.Query", + ServiceName: "hypersign.ssi.v1.Query", HandlerType: (*QueryServer)(nil), Methods: []grpc.MethodDesc{ { - MethodName: "QuerySchema", - Handler: _Query_QuerySchema_Handler, + MethodName: "CredentialSchemaByID", + Handler: _Query_CredentialSchemaByID_Handler, }, { - MethodName: "QuerySchemas", - Handler: _Query_QuerySchemas_Handler, + MethodName: "CredentialSchemas", + Handler: _Query_CredentialSchemas_Handler, }, { - MethodName: "QueryDidDocument", - Handler: _Query_QueryDidDocument_Handler, + MethodName: "DidDocumentByID", + Handler: _Query_DidDocumentByID_Handler, }, { - MethodName: "QueryDidDocuments", - Handler: _Query_QueryDidDocuments_Handler, + MethodName: "DidDocuments", + Handler: _Query_DidDocuments_Handler, }, { - MethodName: "QueryCredential", - Handler: _Query_QueryCredential_Handler, + MethodName: "CredentialStatusByID", + Handler: _Query_CredentialStatusByID_Handler, }, { - MethodName: "QueryCredentials", - Handler: _Query_QueryCredentials_Handler, + MethodName: "CredentialStatuses", + Handler: _Query_CredentialStatuses_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "ssi/v1/query.proto", } -func (m *QuerySchemaRequest) Marshal() (dAtA []byte, err error) { +func (m *QueryCredentialSchemaRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -951,12 +939,12 @@ func (m *QuerySchemaRequest) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QuerySchemaRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryCredentialSchemaRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QuerySchemaRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryCredentialSchemaRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -971,7 +959,7 @@ func (m *QuerySchemaRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *QuerySchemaResponse) Marshal() (dAtA []byte, err error) { +func (m *QueryCredentialSchemaResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -981,20 +969,20 @@ func (m *QuerySchemaResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QuerySchemaResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryCredentialSchemaResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QuerySchemaResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryCredentialSchemaResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if len(m.Schema) > 0 { - for iNdEx := len(m.Schema) - 1; iNdEx >= 0; iNdEx-- { + if len(m.CredentialSchemas) > 0 { + for iNdEx := len(m.CredentialSchemas) - 1; iNdEx >= 0; iNdEx-- { { - size, err := m.Schema[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + size, err := m.CredentialSchemas[iNdEx].MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -1008,7 +996,7 @@ func (m *QuerySchemaResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *QuerySchemasRequest) Marshal() (dAtA []byte, err error) { +func (m *QueryCredentialSchemasRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1018,12 +1006,12 @@ func (m *QuerySchemasRequest) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QuerySchemasRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryCredentialSchemasRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QuerySchemasRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryCredentialSchemasRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -1043,7 +1031,7 @@ func (m *QuerySchemasRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *QuerySchemasResponse) Marshal() (dAtA []byte, err error) { +func (m *QueryCredentialSchemasResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1053,20 +1041,20 @@ func (m *QuerySchemasResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QuerySchemasResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryCredentialSchemasResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QuerySchemasResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryCredentialSchemasResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if len(m.SchemaList) > 0 { - for iNdEx := len(m.SchemaList) - 1; iNdEx >= 0; iNdEx-- { + if len(m.CredentialSchemas) > 0 { + for iNdEx := len(m.CredentialSchemas) - 1; iNdEx >= 0; iNdEx-- { { - size, err := m.SchemaList[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + size, err := m.CredentialSchemas[iNdEx].MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -1077,15 +1065,15 @@ func (m *QuerySchemasResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { dAtA[i] = 0x12 } } - if m.TotalCount != 0 { - i = encodeVarintQuery(dAtA, i, uint64(m.TotalCount)) + if m.Count != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.Count)) i-- dAtA[i] = 0x8 } return len(dAtA) - i, nil } -func (m *QueryCredentialRequest) Marshal() (dAtA []byte, err error) { +func (m *QueryCredentialStatusRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1095,12 +1083,12 @@ func (m *QueryCredentialRequest) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryCredentialRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryCredentialStatusRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryCredentialRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryCredentialStatusRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -1115,7 +1103,7 @@ func (m *QueryCredentialRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) return len(dAtA) - i, nil } -func (m *QueryCredentialResponse) Marshal() (dAtA []byte, err error) { +func (m *QueryCredentialStatusResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1125,19 +1113,19 @@ func (m *QueryCredentialResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryCredentialResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryCredentialStatusResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryCredentialResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryCredentialStatusResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if m.CredStatus != nil { + if m.CredentialStatus != nil { { - size, err := m.CredStatus.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.CredentialStatus.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -1150,7 +1138,7 @@ func (m *QueryCredentialResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) return len(dAtA) - i, nil } -func (m *QueryCredentialsRequest) Marshal() (dAtA []byte, err error) { +func (m *QueryCredentialStatusesRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1160,12 +1148,12 @@ func (m *QueryCredentialsRequest) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryCredentialsRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryCredentialStatusesRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryCredentialsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryCredentialStatusesRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -1185,7 +1173,7 @@ func (m *QueryCredentialsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) return len(dAtA) - i, nil } -func (m *QueryCredentialsResponse) Marshal() (dAtA []byte, err error) { +func (m *QueryCredentialStatusesResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1195,20 +1183,20 @@ func (m *QueryCredentialsResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryCredentialsResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryCredentialStatusesResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryCredentialsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryCredentialStatusesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if len(m.Credentials) > 0 { - for iNdEx := len(m.Credentials) - 1; iNdEx >= 0; iNdEx-- { + if len(m.CredentialStatuses) > 0 { + for iNdEx := len(m.CredentialStatuses) - 1; iNdEx >= 0; iNdEx-- { { - size, err := m.Credentials[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + size, err := m.CredentialStatuses[iNdEx].MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -1219,8 +1207,8 @@ func (m *QueryCredentialsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error dAtA[i] = 0x12 } } - if m.TotalCount != 0 { - i = encodeVarintQuery(dAtA, i, uint64(m.TotalCount)) + if m.Count != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.Count)) i-- dAtA[i] = 0x8 } @@ -1334,17 +1322,7 @@ func (m *QueryDidDocumentsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error i = encodeVarintQuery(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x12 - } - if m.Count { - i-- - if m.Count { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x8 + dAtA[i] = 0xa } return len(dAtA) - i, nil } @@ -1369,10 +1347,10 @@ func (m *QueryDidDocumentsResponse) MarshalToSizedBuffer(dAtA []byte) (int, erro _ = i var l int _ = l - if len(m.DidDocList) > 0 { - for iNdEx := len(m.DidDocList) - 1; iNdEx >= 0; iNdEx-- { + if len(m.DidDocuments) > 0 { + for iNdEx := len(m.DidDocuments) - 1; iNdEx >= 0; iNdEx-- { { - size, err := m.DidDocList[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + size, err := m.DidDocuments[iNdEx].MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -1383,8 +1361,8 @@ func (m *QueryDidDocumentsResponse) MarshalToSizedBuffer(dAtA []byte) (int, erro dAtA[i] = 0x12 } } - if m.TotalDidCount != 0 { - i = encodeVarintQuery(dAtA, i, uint64(m.TotalDidCount)) + if m.Count != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.Count)) i-- dAtA[i] = 0x8 } @@ -1402,7 +1380,7 @@ func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } -func (m *QuerySchemaRequest) Size() (n int) { +func (m *QueryCredentialSchemaRequest) Size() (n int) { if m == nil { return 0 } @@ -1415,14 +1393,14 @@ func (m *QuerySchemaRequest) Size() (n int) { return n } -func (m *QuerySchemaResponse) Size() (n int) { +func (m *QueryCredentialSchemaResponse) Size() (n int) { if m == nil { return 0 } var l int _ = l - if len(m.Schema) > 0 { - for _, e := range m.Schema { + if len(m.CredentialSchemas) > 0 { + for _, e := range m.CredentialSchemas { l = e.Size() n += 1 + l + sovQuery(uint64(l)) } @@ -1430,7 +1408,7 @@ func (m *QuerySchemaResponse) Size() (n int) { return n } -func (m *QuerySchemasRequest) Size() (n int) { +func (m *QueryCredentialSchemasRequest) Size() (n int) { if m == nil { return 0 } @@ -1443,17 +1421,17 @@ func (m *QuerySchemasRequest) Size() (n int) { return n } -func (m *QuerySchemasResponse) Size() (n int) { +func (m *QueryCredentialSchemasResponse) Size() (n int) { if m == nil { return 0 } var l int _ = l - if m.TotalCount != 0 { - n += 1 + sovQuery(uint64(m.TotalCount)) + if m.Count != 0 { + n += 1 + sovQuery(uint64(m.Count)) } - if len(m.SchemaList) > 0 { - for _, e := range m.SchemaList { + if len(m.CredentialSchemas) > 0 { + for _, e := range m.CredentialSchemas { l = e.Size() n += 1 + l + sovQuery(uint64(l)) } @@ -1461,7 +1439,7 @@ func (m *QuerySchemasResponse) Size() (n int) { return n } -func (m *QueryCredentialRequest) Size() (n int) { +func (m *QueryCredentialStatusRequest) Size() (n int) { if m == nil { return 0 } @@ -1474,20 +1452,20 @@ func (m *QueryCredentialRequest) Size() (n int) { return n } -func (m *QueryCredentialResponse) Size() (n int) { +func (m *QueryCredentialStatusResponse) Size() (n int) { if m == nil { return 0 } var l int _ = l - if m.CredStatus != nil { - l = m.CredStatus.Size() + if m.CredentialStatus != nil { + l = m.CredentialStatus.Size() n += 1 + l + sovQuery(uint64(l)) } return n } -func (m *QueryCredentialsRequest) Size() (n int) { +func (m *QueryCredentialStatusesRequest) Size() (n int) { if m == nil { return 0 } @@ -1500,17 +1478,17 @@ func (m *QueryCredentialsRequest) Size() (n int) { return n } -func (m *QueryCredentialsResponse) Size() (n int) { +func (m *QueryCredentialStatusesResponse) Size() (n int) { if m == nil { return 0 } var l int _ = l - if m.TotalCount != 0 { - n += 1 + sovQuery(uint64(m.TotalCount)) + if m.Count != 0 { + n += 1 + sovQuery(uint64(m.Count)) } - if len(m.Credentials) > 0 { - for _, e := range m.Credentials { + if len(m.CredentialStatuses) > 0 { + for _, e := range m.CredentialStatuses { l = e.Size() n += 1 + l + sovQuery(uint64(l)) } @@ -1554,9 +1532,6 @@ func (m *QueryDidDocumentsRequest) Size() (n int) { } var l int _ = l - if m.Count { - n += 2 - } if m.Pagination != nil { l = m.Pagination.Size() n += 1 + l + sovQuery(uint64(l)) @@ -1570,11 +1545,11 @@ func (m *QueryDidDocumentsResponse) Size() (n int) { } var l int _ = l - if m.TotalDidCount != 0 { - n += 1 + sovQuery(uint64(m.TotalDidCount)) + if m.Count != 0 { + n += 1 + sovQuery(uint64(m.Count)) } - if len(m.DidDocList) > 0 { - for _, e := range m.DidDocList { + if len(m.DidDocuments) > 0 { + for _, e := range m.DidDocuments { l = e.Size() n += 1 + l + sovQuery(uint64(l)) } @@ -1588,7 +1563,7 @@ func sovQuery(x uint64) (n int) { func sozQuery(x uint64) (n int) { return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } -func (m *QuerySchemaRequest) Unmarshal(dAtA []byte) error { +func (m *QueryCredentialSchemaRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1611,10 +1586,10 @@ func (m *QuerySchemaRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QuerySchemaRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryCredentialSchemaRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QuerySchemaRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryCredentialSchemaRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -1670,7 +1645,7 @@ func (m *QuerySchemaRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QuerySchemaResponse) Unmarshal(dAtA []byte) error { +func (m *QueryCredentialSchemaResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1693,15 +1668,15 @@ func (m *QuerySchemaResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QuerySchemaResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryCredentialSchemaResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QuerySchemaResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryCredentialSchemaResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Schema", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field CredentialSchemas", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -1728,8 +1703,8 @@ func (m *QuerySchemaResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Schema = append(m.Schema, &Schema{}) - if err := m.Schema[len(m.Schema)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.CredentialSchemas = append(m.CredentialSchemas, &CredentialSchemaState{}) + if err := m.CredentialSchemas[len(m.CredentialSchemas)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -1754,7 +1729,7 @@ func (m *QuerySchemaResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QuerySchemasRequest) Unmarshal(dAtA []byte) error { +func (m *QueryCredentialSchemasRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1777,10 +1752,10 @@ func (m *QuerySchemasRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QuerySchemasRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryCredentialSchemasRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QuerySchemasRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryCredentialSchemasRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -1840,7 +1815,7 @@ func (m *QuerySchemasRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QuerySchemasResponse) Unmarshal(dAtA []byte) error { +func (m *QueryCredentialSchemasResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1863,17 +1838,17 @@ func (m *QuerySchemasResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QuerySchemasResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryCredentialSchemasResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QuerySchemasResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryCredentialSchemasResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field TotalCount", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Count", wireType) } - m.TotalCount = 0 + m.Count = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -1883,14 +1858,14 @@ func (m *QuerySchemasResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.TotalCount |= uint64(b&0x7F) << shift + m.Count |= uint64(b&0x7F) << shift if b < 0x80 { break } } case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field SchemaList", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field CredentialSchemas", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -1917,8 +1892,8 @@ func (m *QuerySchemasResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.SchemaList = append(m.SchemaList, &Schema{}) - if err := m.SchemaList[len(m.SchemaList)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.CredentialSchemas = append(m.CredentialSchemas, &CredentialSchemaState{}) + if err := m.CredentialSchemas[len(m.CredentialSchemas)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -1943,7 +1918,7 @@ func (m *QuerySchemasResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryCredentialRequest) Unmarshal(dAtA []byte) error { +func (m *QueryCredentialStatusRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1966,10 +1941,10 @@ func (m *QueryCredentialRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryCredentialRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryCredentialStatusRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryCredentialRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryCredentialStatusRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -2025,7 +2000,7 @@ func (m *QueryCredentialRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryCredentialResponse) Unmarshal(dAtA []byte) error { +func (m *QueryCredentialStatusResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2048,15 +2023,15 @@ func (m *QueryCredentialResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryCredentialResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryCredentialStatusResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryCredentialResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryCredentialStatusResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field CredStatus", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field CredentialStatus", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -2083,10 +2058,10 @@ func (m *QueryCredentialResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.CredStatus == nil { - m.CredStatus = &Credential{} + if m.CredentialStatus == nil { + m.CredentialStatus = &CredentialStatusState{} } - if err := m.CredStatus.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.CredentialStatus.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -2111,7 +2086,7 @@ func (m *QueryCredentialResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryCredentialsRequest) Unmarshal(dAtA []byte) error { +func (m *QueryCredentialStatusesRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2134,10 +2109,10 @@ func (m *QueryCredentialsRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryCredentialsRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryCredentialStatusesRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryCredentialsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryCredentialStatusesRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -2197,7 +2172,7 @@ func (m *QueryCredentialsRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryCredentialsResponse) Unmarshal(dAtA []byte) error { +func (m *QueryCredentialStatusesResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2220,17 +2195,17 @@ func (m *QueryCredentialsResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryCredentialsResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryCredentialStatusesResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryCredentialsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryCredentialStatusesResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field TotalCount", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Count", wireType) } - m.TotalCount = 0 + m.Count = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -2240,14 +2215,14 @@ func (m *QueryCredentialsResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.TotalCount |= uint64(b&0x7F) << shift + m.Count |= uint64(b&0x7F) << shift if b < 0x80 { break } } case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Credentials", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field CredentialStatuses", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -2274,8 +2249,8 @@ func (m *QueryCredentialsResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Credentials = append(m.Credentials, &Credential{}) - if err := m.Credentials[len(m.Credentials)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.CredentialStatuses = append(m.CredentialStatuses, &CredentialStatusState{}) + if err := m.CredentialStatuses[len(m.CredentialStatuses)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -2441,7 +2416,7 @@ func (m *QueryDidDocumentResponse) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.DidDocument == nil { - m.DidDocument = &Did{} + m.DidDocument = &DidDocument{} } if err := m.DidDocument.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -2477,7 +2452,7 @@ func (m *QueryDidDocumentResponse) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.DidDocumentMetadata == nil { - m.DidDocumentMetadata = &Metadata{} + m.DidDocumentMetadata = &DidDocumentMetadata{} } if err := m.DidDocumentMetadata.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -2534,26 +2509,6 @@ func (m *QueryDidDocumentsRequest) Unmarshal(dAtA []byte) error { } switch fieldNum { case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Count", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Count = bool(v != 0) - case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) } @@ -2641,9 +2596,9 @@ func (m *QueryDidDocumentsResponse) Unmarshal(dAtA []byte) error { switch fieldNum { case 1: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field TotalDidCount", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Count", wireType) } - m.TotalDidCount = 0 + m.Count = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -2653,14 +2608,14 @@ func (m *QueryDidDocumentsResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.TotalDidCount |= uint64(b&0x7F) << shift + m.Count |= uint64(b&0x7F) << shift if b < 0x80 { break } } case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field DidDocList", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field DidDocuments", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -2687,8 +2642,8 @@ func (m *QueryDidDocumentsResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.DidDocList = append(m.DidDocList, &QueryDidDocumentResponse{}) - if err := m.DidDocList[len(m.DidDocList)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.DidDocuments = append(m.DidDocuments, &DidDocumentState{}) + if err := m.DidDocuments[len(m.DidDocuments)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex diff --git a/x/ssi/types/query.pb.gw.go b/x/ssi/types/query.pb.gw.go index 83f117b..d4a4abb 100644 --- a/x/ssi/types/query.pb.gw.go +++ b/x/ssi/types/query.pb.gw.go @@ -33,8 +33,8 @@ var _ = utilities.NewDoubleArray var _ = descriptor.ForMessage var _ = metadata.Join -func request_Query_QuerySchema_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QuerySchemaRequest +func request_Query_CredentialSchemaByID_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryCredentialSchemaRequest var metadata runtime.ServerMetadata var ( @@ -55,13 +55,13 @@ func request_Query_QuerySchema_0(ctx context.Context, marshaler runtime.Marshale return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "schemaId", err) } - msg, err := client.QuerySchema(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + msg, err := client.CredentialSchemaByID(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } -func local_request_Query_QuerySchema_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QuerySchemaRequest +func local_request_Query_CredentialSchemaByID_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryCredentialSchemaRequest var metadata runtime.ServerMetadata var ( @@ -82,48 +82,48 @@ func local_request_Query_QuerySchema_0(ctx context.Context, marshaler runtime.Ma return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "schemaId", err) } - msg, err := server.QuerySchema(ctx, &protoReq) + msg, err := server.CredentialSchemaByID(ctx, &protoReq) return msg, metadata, err } var ( - filter_Query_QuerySchemas_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} + filter_Query_CredentialSchemas_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} ) -func request_Query_QuerySchemas_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QuerySchemasRequest +func request_Query_CredentialSchemas_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryCredentialSchemasRequest var metadata runtime.ServerMetadata if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_QuerySchemas_0); err != nil { + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_CredentialSchemas_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - msg, err := client.QuerySchemas(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + msg, err := client.CredentialSchemas(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } -func local_request_Query_QuerySchemas_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QuerySchemasRequest +func local_request_Query_CredentialSchemas_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryCredentialSchemasRequest var metadata runtime.ServerMetadata if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_QuerySchemas_0); err != nil { + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_CredentialSchemas_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - msg, err := server.QuerySchemas(ctx, &protoReq) + msg, err := server.CredentialSchemas(ctx, &protoReq) return msg, metadata, err } -func request_Query_QueryDidDocument_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { +func request_Query_DidDocumentByID_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq QueryDidDocumentRequest var metadata runtime.ServerMetadata @@ -145,12 +145,12 @@ func request_Query_QueryDidDocument_0(ctx context.Context, marshaler runtime.Mar return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "didId", err) } - msg, err := client.QueryDidDocument(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + msg, err := client.DidDocumentByID(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } -func local_request_Query_QueryDidDocument_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { +func local_request_Query_DidDocumentByID_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq QueryDidDocumentRequest var metadata runtime.ServerMetadata @@ -172,49 +172,49 @@ func local_request_Query_QueryDidDocument_0(ctx context.Context, marshaler runti return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "didId", err) } - msg, err := server.QueryDidDocument(ctx, &protoReq) + msg, err := server.DidDocumentByID(ctx, &protoReq) return msg, metadata, err } var ( - filter_Query_QueryDidDocuments_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} + filter_Query_DidDocuments_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} ) -func request_Query_QueryDidDocuments_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { +func request_Query_DidDocuments_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq QueryDidDocumentsRequest var metadata runtime.ServerMetadata if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_QueryDidDocuments_0); err != nil { + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_DidDocuments_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - msg, err := client.QueryDidDocuments(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + msg, err := client.DidDocuments(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } -func local_request_Query_QueryDidDocuments_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { +func local_request_Query_DidDocuments_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq QueryDidDocumentsRequest var metadata runtime.ServerMetadata if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_QueryDidDocuments_0); err != nil { + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_DidDocuments_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - msg, err := server.QueryDidDocuments(ctx, &protoReq) + msg, err := server.DidDocuments(ctx, &protoReq) return msg, metadata, err } -func request_Query_QueryCredential_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryCredentialRequest +func request_Query_CredentialStatusByID_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryCredentialStatusRequest var metadata runtime.ServerMetadata var ( @@ -235,13 +235,13 @@ func request_Query_QueryCredential_0(ctx context.Context, marshaler runtime.Mars return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "credId", err) } - msg, err := client.QueryCredential(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + msg, err := client.CredentialStatusByID(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } -func local_request_Query_QueryCredential_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryCredentialRequest +func local_request_Query_CredentialStatusByID_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryCredentialStatusRequest var metadata runtime.ServerMetadata var ( @@ -262,43 +262,43 @@ func local_request_Query_QueryCredential_0(ctx context.Context, marshaler runtim return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "credId", err) } - msg, err := server.QueryCredential(ctx, &protoReq) + msg, err := server.CredentialStatusByID(ctx, &protoReq) return msg, metadata, err } var ( - filter_Query_QueryCredentials_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} + filter_Query_CredentialStatuses_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} ) -func request_Query_QueryCredentials_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryCredentialsRequest +func request_Query_CredentialStatuses_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryCredentialStatusesRequest var metadata runtime.ServerMetadata if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_QueryCredentials_0); err != nil { + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_CredentialStatuses_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - msg, err := client.QueryCredentials(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + msg, err := client.CredentialStatuses(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } -func local_request_Query_QueryCredentials_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryCredentialsRequest +func local_request_Query_CredentialStatuses_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryCredentialStatusesRequest var metadata runtime.ServerMetadata if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_QueryCredentials_0); err != nil { + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_CredentialStatuses_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - msg, err := server.QueryCredentials(ctx, &protoReq) + msg, err := server.CredentialStatuses(ctx, &protoReq) return msg, metadata, err } @@ -309,7 +309,7 @@ func local_request_Query_QueryCredentials_0(ctx context.Context, marshaler runti // Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error { - mux.Handle("GET", pattern_Query_QuerySchema_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_CredentialSchemaByID_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -320,7 +320,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Query_QuerySchema_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_CredentialSchemaByID_0(rctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -328,11 +328,11 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } - forward_Query_QuerySchema_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_CredentialSchemaByID_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_Query_QuerySchemas_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_CredentialSchemas_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -343,7 +343,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Query_QuerySchemas_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_CredentialSchemas_0(rctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -351,11 +351,11 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } - forward_Query_QuerySchemas_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_CredentialSchemas_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_Query_QueryDidDocument_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_DidDocumentByID_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -366,7 +366,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Query_QueryDidDocument_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_DidDocumentByID_0(rctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -374,11 +374,11 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } - forward_Query_QueryDidDocument_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_DidDocumentByID_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_Query_QueryDidDocuments_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_DidDocuments_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -389,7 +389,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Query_QueryDidDocuments_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_DidDocuments_0(rctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -397,11 +397,11 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } - forward_Query_QueryDidDocuments_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_DidDocuments_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_Query_QueryCredential_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_CredentialStatusByID_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -412,7 +412,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Query_QueryCredential_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_CredentialStatusByID_0(rctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -420,11 +420,11 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } - forward_Query_QueryCredential_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_CredentialStatusByID_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_Query_QueryCredentials_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_CredentialStatuses_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -435,7 +435,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Query_QueryCredentials_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_CredentialStatuses_0(rctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -443,7 +443,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } - forward_Query_QueryCredentials_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_CredentialStatuses_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -488,7 +488,7 @@ func RegisterQueryHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc // "QueryClient" to call the correct interceptors. func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, client QueryClient) error { - mux.Handle("GET", pattern_Query_QuerySchema_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_CredentialSchemaByID_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) @@ -497,18 +497,18 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_Query_QuerySchema_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_Query_CredentialSchemaByID_0(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_Query_QuerySchema_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_CredentialSchemaByID_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_Query_QuerySchemas_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_CredentialSchemas_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) @@ -517,18 +517,18 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_Query_QuerySchemas_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_Query_CredentialSchemas_0(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_Query_QuerySchemas_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_CredentialSchemas_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_Query_QueryDidDocument_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_DidDocumentByID_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) @@ -537,18 +537,18 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_Query_QueryDidDocument_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_Query_DidDocumentByID_0(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_Query_QueryDidDocument_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_DidDocumentByID_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_Query_QueryDidDocuments_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_DidDocuments_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) @@ -557,18 +557,18 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_Query_QueryDidDocuments_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_Query_DidDocuments_0(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_Query_QueryDidDocuments_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_DidDocuments_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_Query_QueryCredential_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_CredentialStatusByID_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) @@ -577,18 +577,18 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_Query_QueryCredential_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_Query_CredentialStatusByID_0(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_Query_QueryCredential_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_CredentialStatusByID_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_Query_QueryCredentials_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_CredentialStatuses_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) @@ -597,14 +597,14 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_Query_QueryCredentials_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_Query_CredentialStatuses_0(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_Query_QueryCredentials_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_CredentialStatuses_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -612,29 +612,29 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie } var ( - pattern_Query_QuerySchema_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"hypersign-protocol", "hidnode", "ssi", "schema", "schemaId"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_Query_CredentialSchemaByID_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"hypersign-protocol", "hidnode", "ssi", "schema", "schemaId"}, "", runtime.AssumeColonVerbOpt(false))) - pattern_Query_QuerySchemas_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"hypersign-protocol", "hidnode", "ssi", "schema"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_Query_CredentialSchemas_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"hypersign-protocol", "hidnode", "ssi", "schema"}, "", runtime.AssumeColonVerbOpt(false))) - pattern_Query_QueryDidDocument_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"hypersign-protocol", "hidnode", "ssi", "did", "didId"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_Query_DidDocumentByID_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"hypersign-protocol", "hidnode", "ssi", "did", "didId"}, "", runtime.AssumeColonVerbOpt(false))) - pattern_Query_QueryDidDocuments_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"hypersign-protocol", "hidnode", "ssi", "did"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_Query_DidDocuments_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"hypersign-protocol", "hidnode", "ssi", "did"}, "", runtime.AssumeColonVerbOpt(false))) - pattern_Query_QueryCredential_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"hypersign-protocol", "hidnode", "ssi", "credential", "credId"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_Query_CredentialStatusByID_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"hypersign-protocol", "hidnode", "ssi", "credential", "credId"}, "", runtime.AssumeColonVerbOpt(false))) - pattern_Query_QueryCredentials_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"hypersign-protocol", "hidnode", "ssi", "credential"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_Query_CredentialStatuses_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"hypersign-protocol", "hidnode", "ssi", "credential"}, "", runtime.AssumeColonVerbOpt(false))) ) var ( - forward_Query_QuerySchema_0 = runtime.ForwardResponseMessage + forward_Query_CredentialSchemaByID_0 = runtime.ForwardResponseMessage - forward_Query_QuerySchemas_0 = runtime.ForwardResponseMessage + forward_Query_CredentialSchemas_0 = runtime.ForwardResponseMessage - forward_Query_QueryDidDocument_0 = runtime.ForwardResponseMessage + forward_Query_DidDocumentByID_0 = runtime.ForwardResponseMessage - forward_Query_QueryDidDocuments_0 = runtime.ForwardResponseMessage + forward_Query_DidDocuments_0 = runtime.ForwardResponseMessage - forward_Query_QueryCredential_0 = runtime.ForwardResponseMessage + forward_Query_CredentialStatusByID_0 = runtime.ForwardResponseMessage - forward_Query_QueryCredentials_0 = runtime.ForwardResponseMessage + forward_Query_CredentialStatuses_0 = runtime.ForwardResponseMessage ) diff --git a/x/ssi/types/schema.pb.go b/x/ssi/types/schema.pb.go deleted file mode 100644 index d851313..0000000 --- a/x/ssi/types/schema.pb.go +++ /dev/null @@ -1,1986 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: ssi/v1/schema.proto - -package types - -import ( - fmt "fmt" - proto "github.com/gogo/protobuf/proto" - io "io" - math "math" - math_bits "math/bits" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package - -type SchemaDocument struct { - Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"` - ModelVersion string `protobuf:"bytes,2,opt,name=modelVersion,proto3" json:"modelVersion,omitempty"` - Id string `protobuf:"bytes,3,opt,name=id,proto3" json:"id,omitempty"` - Name string `protobuf:"bytes,4,opt,name=name,proto3" json:"name,omitempty"` - Author string `protobuf:"bytes,5,opt,name=author,proto3" json:"author,omitempty"` - Authored string `protobuf:"bytes,6,opt,name=authored,proto3" json:"authored,omitempty"` - Schema *SchemaProperty `protobuf:"bytes,7,opt,name=schema,proto3" json:"schema,omitempty"` -} - -func (m *SchemaDocument) Reset() { *m = SchemaDocument{} } -func (m *SchemaDocument) String() string { return proto.CompactTextString(m) } -func (*SchemaDocument) ProtoMessage() {} -func (*SchemaDocument) Descriptor() ([]byte, []int) { - return fileDescriptor_3d55333c8301c7bb, []int{0} -} -func (m *SchemaDocument) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *SchemaDocument) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_SchemaDocument.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *SchemaDocument) XXX_Merge(src proto.Message) { - xxx_messageInfo_SchemaDocument.Merge(m, src) -} -func (m *SchemaDocument) XXX_Size() int { - return m.Size() -} -func (m *SchemaDocument) XXX_DiscardUnknown() { - xxx_messageInfo_SchemaDocument.DiscardUnknown(m) -} - -var xxx_messageInfo_SchemaDocument proto.InternalMessageInfo - -func (m *SchemaDocument) GetType() string { - if m != nil { - return m.Type - } - return "" -} - -func (m *SchemaDocument) GetModelVersion() string { - if m != nil { - return m.ModelVersion - } - return "" -} - -func (m *SchemaDocument) GetId() string { - if m != nil { - return m.Id - } - return "" -} - -func (m *SchemaDocument) GetName() string { - if m != nil { - return m.Name - } - return "" -} - -func (m *SchemaDocument) GetAuthor() string { - if m != nil { - return m.Author - } - return "" -} - -func (m *SchemaDocument) GetAuthored() string { - if m != nil { - return m.Authored - } - return "" -} - -func (m *SchemaDocument) GetSchema() *SchemaProperty { - if m != nil { - return m.Schema - } - return nil -} - -type SchemaProperty struct { - Schema string `protobuf:"bytes,1,opt,name=schema,proto3" json:"schema,omitempty"` - Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` - Type string `protobuf:"bytes,3,opt,name=type,proto3" json:"type,omitempty"` - Properties string `protobuf:"bytes,4,opt,name=properties,proto3" json:"properties,omitempty"` - Required []string `protobuf:"bytes,5,rep,name=required,proto3" json:"required,omitempty"` - AdditionalProperties bool `protobuf:"varint,6,opt,name=additionalProperties,proto3" json:"additionalProperties,omitempty"` -} - -func (m *SchemaProperty) Reset() { *m = SchemaProperty{} } -func (m *SchemaProperty) String() string { return proto.CompactTextString(m) } -func (*SchemaProperty) ProtoMessage() {} -func (*SchemaProperty) Descriptor() ([]byte, []int) { - return fileDescriptor_3d55333c8301c7bb, []int{1} -} -func (m *SchemaProperty) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *SchemaProperty) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_SchemaProperty.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *SchemaProperty) XXX_Merge(src proto.Message) { - xxx_messageInfo_SchemaProperty.Merge(m, src) -} -func (m *SchemaProperty) XXX_Size() int { - return m.Size() -} -func (m *SchemaProperty) XXX_DiscardUnknown() { - xxx_messageInfo_SchemaProperty.DiscardUnknown(m) -} - -var xxx_messageInfo_SchemaProperty proto.InternalMessageInfo - -func (m *SchemaProperty) GetSchema() string { - if m != nil { - return m.Schema - } - return "" -} - -func (m *SchemaProperty) GetDescription() string { - if m != nil { - return m.Description - } - return "" -} - -func (m *SchemaProperty) GetType() string { - if m != nil { - return m.Type - } - return "" -} - -func (m *SchemaProperty) GetProperties() string { - if m != nil { - return m.Properties - } - return "" -} - -func (m *SchemaProperty) GetRequired() []string { - if m != nil { - return m.Required - } - return nil -} - -func (m *SchemaProperty) GetAdditionalProperties() bool { - if m != nil { - return m.AdditionalProperties - } - return false -} - -type SchemaProof struct { - Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"` - Created string `protobuf:"bytes,2,opt,name=created,proto3" json:"created,omitempty"` - VerificationMethod string `protobuf:"bytes,4,opt,name=verificationMethod,proto3" json:"verificationMethod,omitempty"` - ProofPurpose string `protobuf:"bytes,5,opt,name=proofPurpose,proto3" json:"proofPurpose,omitempty"` - ProofValue string `protobuf:"bytes,6,opt,name=proofValue,proto3" json:"proofValue,omitempty"` -} - -func (m *SchemaProof) Reset() { *m = SchemaProof{} } -func (m *SchemaProof) String() string { return proto.CompactTextString(m) } -func (*SchemaProof) ProtoMessage() {} -func (*SchemaProof) Descriptor() ([]byte, []int) { - return fileDescriptor_3d55333c8301c7bb, []int{2} -} -func (m *SchemaProof) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *SchemaProof) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_SchemaProof.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *SchemaProof) XXX_Merge(src proto.Message) { - xxx_messageInfo_SchemaProof.Merge(m, src) -} -func (m *SchemaProof) XXX_Size() int { - return m.Size() -} -func (m *SchemaProof) XXX_DiscardUnknown() { - xxx_messageInfo_SchemaProof.DiscardUnknown(m) -} - -var xxx_messageInfo_SchemaProof proto.InternalMessageInfo - -func (m *SchemaProof) GetType() string { - if m != nil { - return m.Type - } - return "" -} - -func (m *SchemaProof) GetCreated() string { - if m != nil { - return m.Created - } - return "" -} - -func (m *SchemaProof) GetVerificationMethod() string { - if m != nil { - return m.VerificationMethod - } - return "" -} - -func (m *SchemaProof) GetProofPurpose() string { - if m != nil { - return m.ProofPurpose - } - return "" -} - -func (m *SchemaProof) GetProofValue() string { - if m != nil { - return m.ProofValue - } - return "" -} - -type Schema struct { - Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"` - ModelVersion string `protobuf:"bytes,2,opt,name=modelVersion,proto3" json:"modelVersion,omitempty"` - Id string `protobuf:"bytes,3,opt,name=id,proto3" json:"id,omitempty"` - Name string `protobuf:"bytes,4,opt,name=name,proto3" json:"name,omitempty"` - Author string `protobuf:"bytes,5,opt,name=author,proto3" json:"author,omitempty"` - Authored string `protobuf:"bytes,6,opt,name=authored,proto3" json:"authored,omitempty"` - Schema *SchemaProperty `protobuf:"bytes,7,opt,name=schema,proto3" json:"schema,omitempty"` - Proof *SchemaProof `protobuf:"bytes,8,opt,name=proof,proto3" json:"proof,omitempty"` -} - -func (m *Schema) Reset() { *m = Schema{} } -func (m *Schema) String() string { return proto.CompactTextString(m) } -func (*Schema) ProtoMessage() {} -func (*Schema) Descriptor() ([]byte, []int) { - return fileDescriptor_3d55333c8301c7bb, []int{3} -} -func (m *Schema) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Schema) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Schema.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *Schema) XXX_Merge(src proto.Message) { - xxx_messageInfo_Schema.Merge(m, src) -} -func (m *Schema) XXX_Size() int { - return m.Size() -} -func (m *Schema) XXX_DiscardUnknown() { - xxx_messageInfo_Schema.DiscardUnknown(m) -} - -var xxx_messageInfo_Schema proto.InternalMessageInfo - -func (m *Schema) GetType() string { - if m != nil { - return m.Type - } - return "" -} - -func (m *Schema) GetModelVersion() string { - if m != nil { - return m.ModelVersion - } - return "" -} - -func (m *Schema) GetId() string { - if m != nil { - return m.Id - } - return "" -} - -func (m *Schema) GetName() string { - if m != nil { - return m.Name - } - return "" -} - -func (m *Schema) GetAuthor() string { - if m != nil { - return m.Author - } - return "" -} - -func (m *Schema) GetAuthored() string { - if m != nil { - return m.Authored - } - return "" -} - -func (m *Schema) GetSchema() *SchemaProperty { - if m != nil { - return m.Schema - } - return nil -} - -func (m *Schema) GetProof() *SchemaProof { - if m != nil { - return m.Proof - } - return nil -} - -func init() { - proto.RegisterType((*SchemaDocument)(nil), "hypersignprotocol.hidnode.ssi.SchemaDocument") - proto.RegisterType((*SchemaProperty)(nil), "hypersignprotocol.hidnode.ssi.SchemaProperty") - proto.RegisterType((*SchemaProof)(nil), "hypersignprotocol.hidnode.ssi.SchemaProof") - proto.RegisterType((*Schema)(nil), "hypersignprotocol.hidnode.ssi.Schema") -} - -func init() { proto.RegisterFile("ssi/v1/schema.proto", fileDescriptor_3d55333c8301c7bb) } - -var fileDescriptor_3d55333c8301c7bb = []byte{ - // 450 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xdc, 0x94, 0x4f, 0x8a, 0x13, 0x41, - 0x14, 0x87, 0xd3, 0xc9, 0xa4, 0x27, 0xbe, 0xc8, 0x2c, 0x4a, 0x91, 0x42, 0xb0, 0x09, 0xbd, 0x1a, - 0x84, 0x74, 0x63, 0xbc, 0x80, 0x88, 0xee, 0x14, 0x42, 0x84, 0x59, 0xb8, 0xeb, 0xe9, 0x7a, 0x99, - 0x2e, 0x48, 0x77, 0x95, 0x55, 0xd5, 0x83, 0xb9, 0x85, 0x57, 0xf0, 0x04, 0x5e, 0xc3, 0x95, 0xcc, - 0xd2, 0xa5, 0x24, 0x0b, 0xaf, 0x21, 0xf5, 0x27, 0x3d, 0x1d, 0x08, 0xe2, 0xda, 0x5d, 0xbd, 0xf7, - 0x4b, 0x7d, 0xa9, 0xef, 0x55, 0xd1, 0xf0, 0x48, 0x6b, 0x9e, 0xdf, 0xbe, 0xc8, 0x75, 0x59, 0x61, - 0x5d, 0x64, 0x52, 0x09, 0x23, 0xc8, 0xb3, 0x6a, 0x2b, 0x51, 0x69, 0x7e, 0xd3, 0xb8, 0xba, 0x14, - 0x9b, 0xac, 0xe2, 0xac, 0x11, 0x0c, 0x33, 0xad, 0x79, 0xfa, 0x3b, 0x82, 0x8b, 0x0f, 0xee, 0xf7, - 0x6f, 0x44, 0xd9, 0xd6, 0xd8, 0x18, 0x42, 0xe0, 0xcc, 0x6c, 0x25, 0xd2, 0x68, 0x16, 0x5d, 0x3e, - 0x58, 0xb9, 0x35, 0x49, 0xe1, 0x61, 0x2d, 0x18, 0x6e, 0xae, 0x2c, 0x4a, 0x34, 0x74, 0xe8, 0xb2, - 0xa3, 0x1e, 0xb9, 0x80, 0x21, 0x67, 0x74, 0xe4, 0x92, 0x21, 0x67, 0x96, 0xd3, 0x14, 0x35, 0xd2, - 0x33, 0xcf, 0xb1, 0x6b, 0xf2, 0x04, 0xe2, 0xa2, 0x35, 0x95, 0x50, 0x74, 0xec, 0xba, 0xa1, 0x22, - 0x4f, 0x61, 0xe2, 0x57, 0xc8, 0x68, 0xec, 0x92, 0xae, 0x26, 0x6f, 0x21, 0xf6, 0x46, 0xf4, 0x7c, - 0x16, 0x5d, 0x4e, 0x17, 0xf3, 0xec, 0xaf, 0x4a, 0x99, 0xd7, 0x59, 0x2a, 0x21, 0x51, 0x99, 0xed, - 0x2a, 0x6c, 0x4e, 0x7f, 0x74, 0xa6, 0x87, 0xc8, 0x9e, 0x26, 0x90, 0xbd, 0x6b, 0xa8, 0xc8, 0x0c, - 0xa6, 0x0c, 0x75, 0xa9, 0xb8, 0x34, 0xf7, 0xb2, 0xfd, 0x56, 0x37, 0xa3, 0x51, 0x6f, 0x46, 0x09, - 0x80, 0xf4, 0x64, 0x8e, 0x3a, 0x58, 0xf7, 0x3a, 0xd6, 0x51, 0xe1, 0xa7, 0x96, 0x5b, 0xc7, 0xf1, - 0x6c, 0x64, 0x1d, 0x0f, 0x35, 0x59, 0xc0, 0xe3, 0x82, 0x31, 0x6e, 0xd9, 0xc5, 0x66, 0x79, 0x4f, - 0xb1, 0xb3, 0x98, 0xac, 0x4e, 0x66, 0xe9, 0xb7, 0x08, 0xa6, 0x9d, 0x90, 0x58, 0x9f, 0xbc, 0x37, - 0x0a, 0xe7, 0xa5, 0xc2, 0xc2, 0x20, 0x0b, 0x16, 0x87, 0x92, 0x64, 0x40, 0x6e, 0x51, 0xf1, 0x35, - 0x2f, 0x0b, 0x4b, 0x7e, 0x8f, 0xa6, 0x12, 0x2c, 0x9c, 0xfa, 0x44, 0x62, 0x5f, 0x80, 0xb4, 0x7f, - 0xb3, 0x6c, 0x95, 0x14, 0x1a, 0xc3, 0xfd, 0x1d, 0xf5, 0xc2, 0x04, 0xc4, 0xfa, 0xaa, 0xd8, 0xb4, - 0x18, 0xee, 0xb1, 0xd7, 0x49, 0xbf, 0x0e, 0x21, 0xf6, 0x27, 0xfe, 0x4f, 0x1f, 0x19, 0x79, 0x05, - 0x63, 0xe7, 0x4b, 0x27, 0x8e, 0xf2, 0xfc, 0x5f, 0x29, 0x62, 0xbd, 0xf2, 0x1b, 0x5f, 0xbf, 0xfb, - 0xbe, 0x4b, 0xa2, 0xbb, 0x5d, 0x12, 0xfd, 0xda, 0x25, 0xd1, 0x97, 0x7d, 0x32, 0xb8, 0xdb, 0x27, - 0x83, 0x9f, 0xfb, 0x64, 0xf0, 0x71, 0x71, 0xc3, 0x4d, 0xd5, 0x5e, 0x67, 0xa5, 0xa8, 0xf3, 0x0e, - 0x3b, 0x3f, 0x70, 0xf3, 0x8a, 0xb3, 0xb9, 0x05, 0xe7, 0x9f, 0x73, 0xfb, 0x1d, 0xb0, 0x13, 0xd5, - 0xd7, 0xb1, 0x8b, 0x5f, 0xfe, 0x09, 0x00, 0x00, 0xff, 0xff, 0x2f, 0xa7, 0xc2, 0x8b, 0x1b, 0x04, - 0x00, 0x00, -} - -func (m *SchemaDocument) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *SchemaDocument) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *SchemaDocument) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Schema != nil { - { - size, err := m.Schema.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintSchema(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x3a - } - if len(m.Authored) > 0 { - i -= len(m.Authored) - copy(dAtA[i:], m.Authored) - i = encodeVarintSchema(dAtA, i, uint64(len(m.Authored))) - i-- - dAtA[i] = 0x32 - } - if len(m.Author) > 0 { - i -= len(m.Author) - copy(dAtA[i:], m.Author) - i = encodeVarintSchema(dAtA, i, uint64(len(m.Author))) - i-- - dAtA[i] = 0x2a - } - if len(m.Name) > 0 { - i -= len(m.Name) - copy(dAtA[i:], m.Name) - i = encodeVarintSchema(dAtA, i, uint64(len(m.Name))) - i-- - dAtA[i] = 0x22 - } - if len(m.Id) > 0 { - i -= len(m.Id) - copy(dAtA[i:], m.Id) - i = encodeVarintSchema(dAtA, i, uint64(len(m.Id))) - i-- - dAtA[i] = 0x1a - } - if len(m.ModelVersion) > 0 { - i -= len(m.ModelVersion) - copy(dAtA[i:], m.ModelVersion) - i = encodeVarintSchema(dAtA, i, uint64(len(m.ModelVersion))) - i-- - dAtA[i] = 0x12 - } - if len(m.Type) > 0 { - i -= len(m.Type) - copy(dAtA[i:], m.Type) - i = encodeVarintSchema(dAtA, i, uint64(len(m.Type))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *SchemaProperty) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *SchemaProperty) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *SchemaProperty) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.AdditionalProperties { - i-- - if m.AdditionalProperties { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x30 - } - if len(m.Required) > 0 { - for iNdEx := len(m.Required) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.Required[iNdEx]) - copy(dAtA[i:], m.Required[iNdEx]) - i = encodeVarintSchema(dAtA, i, uint64(len(m.Required[iNdEx]))) - i-- - dAtA[i] = 0x2a - } - } - if len(m.Properties) > 0 { - i -= len(m.Properties) - copy(dAtA[i:], m.Properties) - i = encodeVarintSchema(dAtA, i, uint64(len(m.Properties))) - i-- - dAtA[i] = 0x22 - } - if len(m.Type) > 0 { - i -= len(m.Type) - copy(dAtA[i:], m.Type) - i = encodeVarintSchema(dAtA, i, uint64(len(m.Type))) - i-- - dAtA[i] = 0x1a - } - if len(m.Description) > 0 { - i -= len(m.Description) - copy(dAtA[i:], m.Description) - i = encodeVarintSchema(dAtA, i, uint64(len(m.Description))) - i-- - dAtA[i] = 0x12 - } - if len(m.Schema) > 0 { - i -= len(m.Schema) - copy(dAtA[i:], m.Schema) - i = encodeVarintSchema(dAtA, i, uint64(len(m.Schema))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *SchemaProof) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *SchemaProof) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *SchemaProof) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.ProofValue) > 0 { - i -= len(m.ProofValue) - copy(dAtA[i:], m.ProofValue) - i = encodeVarintSchema(dAtA, i, uint64(len(m.ProofValue))) - i-- - dAtA[i] = 0x32 - } - if len(m.ProofPurpose) > 0 { - i -= len(m.ProofPurpose) - copy(dAtA[i:], m.ProofPurpose) - i = encodeVarintSchema(dAtA, i, uint64(len(m.ProofPurpose))) - i-- - dAtA[i] = 0x2a - } - if len(m.VerificationMethod) > 0 { - i -= len(m.VerificationMethod) - copy(dAtA[i:], m.VerificationMethod) - i = encodeVarintSchema(dAtA, i, uint64(len(m.VerificationMethod))) - i-- - dAtA[i] = 0x22 - } - if len(m.Created) > 0 { - i -= len(m.Created) - copy(dAtA[i:], m.Created) - i = encodeVarintSchema(dAtA, i, uint64(len(m.Created))) - i-- - dAtA[i] = 0x12 - } - if len(m.Type) > 0 { - i -= len(m.Type) - copy(dAtA[i:], m.Type) - i = encodeVarintSchema(dAtA, i, uint64(len(m.Type))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Schema) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Schema) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Schema) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Proof != nil { - { - size, err := m.Proof.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintSchema(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x42 - } - if m.Schema != nil { - { - size, err := m.Schema.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintSchema(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x3a - } - if len(m.Authored) > 0 { - i -= len(m.Authored) - copy(dAtA[i:], m.Authored) - i = encodeVarintSchema(dAtA, i, uint64(len(m.Authored))) - i-- - dAtA[i] = 0x32 - } - if len(m.Author) > 0 { - i -= len(m.Author) - copy(dAtA[i:], m.Author) - i = encodeVarintSchema(dAtA, i, uint64(len(m.Author))) - i-- - dAtA[i] = 0x2a - } - if len(m.Name) > 0 { - i -= len(m.Name) - copy(dAtA[i:], m.Name) - i = encodeVarintSchema(dAtA, i, uint64(len(m.Name))) - i-- - dAtA[i] = 0x22 - } - if len(m.Id) > 0 { - i -= len(m.Id) - copy(dAtA[i:], m.Id) - i = encodeVarintSchema(dAtA, i, uint64(len(m.Id))) - i-- - dAtA[i] = 0x1a - } - if len(m.ModelVersion) > 0 { - i -= len(m.ModelVersion) - copy(dAtA[i:], m.ModelVersion) - i = encodeVarintSchema(dAtA, i, uint64(len(m.ModelVersion))) - i-- - dAtA[i] = 0x12 - } - if len(m.Type) > 0 { - i -= len(m.Type) - copy(dAtA[i:], m.Type) - i = encodeVarintSchema(dAtA, i, uint64(len(m.Type))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func encodeVarintSchema(dAtA []byte, offset int, v uint64) int { - offset -= sovSchema(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *SchemaDocument) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Type) - if l > 0 { - n += 1 + l + sovSchema(uint64(l)) - } - l = len(m.ModelVersion) - if l > 0 { - n += 1 + l + sovSchema(uint64(l)) - } - l = len(m.Id) - if l > 0 { - n += 1 + l + sovSchema(uint64(l)) - } - l = len(m.Name) - if l > 0 { - n += 1 + l + sovSchema(uint64(l)) - } - l = len(m.Author) - if l > 0 { - n += 1 + l + sovSchema(uint64(l)) - } - l = len(m.Authored) - if l > 0 { - n += 1 + l + sovSchema(uint64(l)) - } - if m.Schema != nil { - l = m.Schema.Size() - n += 1 + l + sovSchema(uint64(l)) - } - return n -} - -func (m *SchemaProperty) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Schema) - if l > 0 { - n += 1 + l + sovSchema(uint64(l)) - } - l = len(m.Description) - if l > 0 { - n += 1 + l + sovSchema(uint64(l)) - } - l = len(m.Type) - if l > 0 { - n += 1 + l + sovSchema(uint64(l)) - } - l = len(m.Properties) - if l > 0 { - n += 1 + l + sovSchema(uint64(l)) - } - if len(m.Required) > 0 { - for _, s := range m.Required { - l = len(s) - n += 1 + l + sovSchema(uint64(l)) - } - } - if m.AdditionalProperties { - n += 2 - } - return n -} - -func (m *SchemaProof) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Type) - if l > 0 { - n += 1 + l + sovSchema(uint64(l)) - } - l = len(m.Created) - if l > 0 { - n += 1 + l + sovSchema(uint64(l)) - } - l = len(m.VerificationMethod) - if l > 0 { - n += 1 + l + sovSchema(uint64(l)) - } - l = len(m.ProofPurpose) - if l > 0 { - n += 1 + l + sovSchema(uint64(l)) - } - l = len(m.ProofValue) - if l > 0 { - n += 1 + l + sovSchema(uint64(l)) - } - return n -} - -func (m *Schema) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Type) - if l > 0 { - n += 1 + l + sovSchema(uint64(l)) - } - l = len(m.ModelVersion) - if l > 0 { - n += 1 + l + sovSchema(uint64(l)) - } - l = len(m.Id) - if l > 0 { - n += 1 + l + sovSchema(uint64(l)) - } - l = len(m.Name) - if l > 0 { - n += 1 + l + sovSchema(uint64(l)) - } - l = len(m.Author) - if l > 0 { - n += 1 + l + sovSchema(uint64(l)) - } - l = len(m.Authored) - if l > 0 { - n += 1 + l + sovSchema(uint64(l)) - } - if m.Schema != nil { - l = m.Schema.Size() - n += 1 + l + sovSchema(uint64(l)) - } - if m.Proof != nil { - l = m.Proof.Size() - n += 1 + l + sovSchema(uint64(l)) - } - return n -} - -func sovSchema(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozSchema(x uint64) (n int) { - return sovSchema(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *SchemaDocument) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSchema - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: SchemaDocument: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: SchemaDocument: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSchema - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthSchema - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthSchema - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Type = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ModelVersion", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSchema - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthSchema - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthSchema - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ModelVersion = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSchema - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthSchema - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthSchema - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Id = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSchema - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthSchema - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthSchema - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Name = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Author", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSchema - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthSchema - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthSchema - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Author = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Authored", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSchema - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthSchema - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthSchema - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Authored = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 7: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Schema", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSchema - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthSchema - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthSchema - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Schema == nil { - m.Schema = &SchemaProperty{} - } - if err := m.Schema.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipSchema(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthSchema - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *SchemaProperty) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSchema - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: SchemaProperty: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: SchemaProperty: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Schema", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSchema - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthSchema - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthSchema - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Schema = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Description", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSchema - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthSchema - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthSchema - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Description = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSchema - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthSchema - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthSchema - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Type = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Properties", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSchema - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthSchema - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthSchema - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Properties = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Required", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSchema - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthSchema - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthSchema - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Required = append(m.Required, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - case 6: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field AdditionalProperties", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSchema - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.AdditionalProperties = bool(v != 0) - default: - iNdEx = preIndex - skippy, err := skipSchema(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthSchema - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *SchemaProof) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSchema - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: SchemaProof: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: SchemaProof: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSchema - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthSchema - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthSchema - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Type = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Created", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSchema - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthSchema - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthSchema - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Created = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field VerificationMethod", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSchema - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthSchema - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthSchema - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.VerificationMethod = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ProofPurpose", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSchema - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthSchema - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthSchema - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ProofPurpose = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ProofValue", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSchema - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthSchema - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthSchema - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ProofValue = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipSchema(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthSchema - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Schema) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSchema - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Schema: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Schema: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSchema - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthSchema - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthSchema - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Type = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ModelVersion", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSchema - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthSchema - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthSchema - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ModelVersion = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSchema - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthSchema - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthSchema - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Id = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSchema - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthSchema - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthSchema - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Name = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Author", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSchema - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthSchema - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthSchema - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Author = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Authored", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSchema - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthSchema - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthSchema - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Authored = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 7: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Schema", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSchema - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthSchema - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthSchema - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Schema == nil { - m.Schema = &SchemaProperty{} - } - if err := m.Schema.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 8: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Proof", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSchema - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthSchema - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthSchema - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Proof == nil { - m.Proof = &SchemaProof{} - } - if err := m.Proof.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipSchema(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthSchema - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipSchema(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowSchema - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowSchema - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowSchema - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthSchema - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupSchema - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthSchema - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthSchema = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowSchema = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupSchema = fmt.Errorf("proto: unexpected end of group") -) diff --git a/x/ssi/types/ssi_types.go b/x/ssi/types/ssi_types.go index 5a68bee..eb06345 100644 --- a/x/ssi/types/ssi_types.go +++ b/x/ssi/types/ssi_types.go @@ -5,6 +5,7 @@ import ( "strings" proto "github.com/gogo/protobuf/proto" + "github.com/hypersign-protocol/hid-node/x/ssi/utils" ) type ( @@ -34,35 +35,25 @@ type ( Controller string PublicKeyMultibase string BlockchainAccountId string - Signature string - ClientSpec *ClientSpec + ProofValue string + ClientSpecType ClientSpecType } ) -func CreateExtendedVerificationMethod(vm *VerificationMethod, signInfo *SignInfo) *ExtendedVerificationMethod { +func CreateExtendedVerificationMethod(vm *VerificationMethod, documentProof *DocumentProof) *ExtendedVerificationMethod { extendedVm := &ExtendedVerificationMethod{ Id: vm.Id, Type: vm.Type, Controller: vm.Controller, PublicKeyMultibase: vm.PublicKeyMultibase, BlockchainAccountId: vm.BlockchainAccountId, - Signature: signInfo.Signature, - } - - if signInfo.ClientSpec != nil { - extendedVm.ClientSpec = signInfo.ClientSpec + ProofValue: documentProof.ProofValue, + ClientSpecType: documentProof.ClientSpecType, } return extendedVm } -// Struct catering to supported Client Spec's required inputs -type ClientSpecOpts struct { - ClientSpecType string - SSIDoc SsiMsg - SignerAddress string -} - // Cosmos ADR SignDoc Struct Definitions type ( Val struct { @@ -95,6 +86,7 @@ type SSIProofInterface interface { GetProofValue() string GetType() string GetVerificationMethod() string + GetClientSpecType() ClientSpecType } // CAIP-10 Blockchain Account Id @@ -123,7 +115,7 @@ func NewBlockchainId(blockchainAccountId string) (*BlockchainId, error) { } func (bid *BlockchainId) ValidateSupportedCAIP10Prefix() error { - if !FindInSlice(SupportedCAIP10Prefixes, bid.CAIP10Prefix) { + if !utils.FindInSlice(SupportedCAIP10Prefixes, bid.CAIP10Prefix) { return fmt.Errorf( "unsupported CAIP-10 prefix: '%v', supported CAIP-10 prefixes are %v", bid.CAIP10Prefix, @@ -136,7 +128,7 @@ func (bid *BlockchainId) ValidateSupportedCAIP10Prefix() error { func (bid *BlockchainId) ValidateSupportChainId() error { supportedChainIds := SupportedCAIP10PrefixChainIdsMap[bid.CAIP10Prefix] - if !FindInSlice(supportedChainIds, bid.ChainId) { + if !utils.FindInSlice(supportedChainIds, bid.ChainId) { return fmt.Errorf( "unsupported CAIP-10 chain-id: '%v', supported CAIP-10 chain-ids are %v", bid.ChainId, diff --git a/x/ssi/types/tx.pb.go b/x/ssi/types/tx.pb.go index 7994720..852303c 100644 --- a/x/ssi/types/tx.pb.go +++ b/x/ssi/types/tx.pb.go @@ -27,24 +27,24 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package -type MsgCreateDID struct { - DidDocString *Did `protobuf:"bytes,1,opt,name=didDocString,proto3" json:"didDocString,omitempty"` - Signatures []*SignInfo `protobuf:"bytes,2,rep,name=signatures,proto3" json:"signatures,omitempty"` - Creator string `protobuf:"bytes,3,opt,name=creator,proto3" json:"creator,omitempty"` +type MsgRegisterDID struct { + DidDocument *DidDocument `protobuf:"bytes,1,opt,name=didDocument,proto3" json:"didDocument,omitempty"` + DidDocumentProofs []*DocumentProof `protobuf:"bytes,2,rep,name=didDocumentProofs,proto3" json:"didDocumentProofs,omitempty"` + TxAuthor string `protobuf:"bytes,3,opt,name=txAuthor,proto3" json:"txAuthor,omitempty"` } -func (m *MsgCreateDID) Reset() { *m = MsgCreateDID{} } -func (m *MsgCreateDID) String() string { return proto.CompactTextString(m) } -func (*MsgCreateDID) ProtoMessage() {} -func (*MsgCreateDID) Descriptor() ([]byte, []int) { +func (m *MsgRegisterDID) Reset() { *m = MsgRegisterDID{} } +func (m *MsgRegisterDID) String() string { return proto.CompactTextString(m) } +func (*MsgRegisterDID) ProtoMessage() {} +func (*MsgRegisterDID) Descriptor() ([]byte, []int) { return fileDescriptor_73a1aa6c7279248b, []int{0} } -func (m *MsgCreateDID) XXX_Unmarshal(b []byte) error { +func (m *MsgRegisterDID) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *MsgCreateDID) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *MsgRegisterDID) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_MsgCreateDID.Marshal(b, m, deterministic) + return xxx_messageInfo_MsgRegisterDID.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -54,55 +54,54 @@ func (m *MsgCreateDID) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) return b[:n], nil } } -func (m *MsgCreateDID) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgCreateDID.Merge(m, src) +func (m *MsgRegisterDID) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgRegisterDID.Merge(m, src) } -func (m *MsgCreateDID) XXX_Size() int { +func (m *MsgRegisterDID) XXX_Size() int { return m.Size() } -func (m *MsgCreateDID) XXX_DiscardUnknown() { - xxx_messageInfo_MsgCreateDID.DiscardUnknown(m) +func (m *MsgRegisterDID) XXX_DiscardUnknown() { + xxx_messageInfo_MsgRegisterDID.DiscardUnknown(m) } -var xxx_messageInfo_MsgCreateDID proto.InternalMessageInfo +var xxx_messageInfo_MsgRegisterDID proto.InternalMessageInfo -func (m *MsgCreateDID) GetDidDocString() *Did { +func (m *MsgRegisterDID) GetDidDocument() *DidDocument { if m != nil { - return m.DidDocString + return m.DidDocument } return nil } -func (m *MsgCreateDID) GetSignatures() []*SignInfo { +func (m *MsgRegisterDID) GetDidDocumentProofs() []*DocumentProof { if m != nil { - return m.Signatures + return m.DidDocumentProofs } return nil } -func (m *MsgCreateDID) GetCreator() string { +func (m *MsgRegisterDID) GetTxAuthor() string { if m != nil { - return m.Creator + return m.TxAuthor } return "" } -type MsgCreateDIDResponse struct { - Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` +type MsgRegisterDIDResponse struct { } -func (m *MsgCreateDIDResponse) Reset() { *m = MsgCreateDIDResponse{} } -func (m *MsgCreateDIDResponse) String() string { return proto.CompactTextString(m) } -func (*MsgCreateDIDResponse) ProtoMessage() {} -func (*MsgCreateDIDResponse) Descriptor() ([]byte, []int) { +func (m *MsgRegisterDIDResponse) Reset() { *m = MsgRegisterDIDResponse{} } +func (m *MsgRegisterDIDResponse) String() string { return proto.CompactTextString(m) } +func (*MsgRegisterDIDResponse) ProtoMessage() {} +func (*MsgRegisterDIDResponse) Descriptor() ([]byte, []int) { return fileDescriptor_73a1aa6c7279248b, []int{1} } -func (m *MsgCreateDIDResponse) XXX_Unmarshal(b []byte) error { +func (m *MsgRegisterDIDResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *MsgCreateDIDResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *MsgRegisterDIDResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_MsgCreateDIDResponse.Marshal(b, m, deterministic) + return xxx_messageInfo_MsgRegisterDIDResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -112,30 +111,23 @@ func (m *MsgCreateDIDResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte return b[:n], nil } } -func (m *MsgCreateDIDResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgCreateDIDResponse.Merge(m, src) +func (m *MsgRegisterDIDResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgRegisterDIDResponse.Merge(m, src) } -func (m *MsgCreateDIDResponse) XXX_Size() int { +func (m *MsgRegisterDIDResponse) XXX_Size() int { return m.Size() } -func (m *MsgCreateDIDResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgCreateDIDResponse.DiscardUnknown(m) +func (m *MsgRegisterDIDResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgRegisterDIDResponse.DiscardUnknown(m) } -var xxx_messageInfo_MsgCreateDIDResponse proto.InternalMessageInfo - -func (m *MsgCreateDIDResponse) GetId() uint64 { - if m != nil { - return m.Id - } - return 0 -} +var xxx_messageInfo_MsgRegisterDIDResponse proto.InternalMessageInfo type MsgUpdateDID struct { - DidDocString *Did `protobuf:"bytes,1,opt,name=didDocString,proto3" json:"didDocString,omitempty"` - VersionId string `protobuf:"bytes,2,opt,name=version_id,json=versionId,proto3" json:"version_id,omitempty"` - Signatures []*SignInfo `protobuf:"bytes,3,rep,name=signatures,proto3" json:"signatures,omitempty"` - Creator string `protobuf:"bytes,4,opt,name=creator,proto3" json:"creator,omitempty"` + DidDocument *DidDocument `protobuf:"bytes,1,opt,name=didDocument,proto3" json:"didDocument,omitempty"` + DidDocumentProofs []*DocumentProof `protobuf:"bytes,2,rep,name=didDocumentProofs,proto3" json:"didDocumentProofs,omitempty"` + VersionId string `protobuf:"bytes,3,opt,name=versionId,proto3" json:"versionId,omitempty"` + TxAuthor string `protobuf:"bytes,4,opt,name=txAuthor,proto3" json:"txAuthor,omitempty"` } func (m *MsgUpdateDID) Reset() { *m = MsgUpdateDID{} } @@ -171,36 +163,35 @@ func (m *MsgUpdateDID) XXX_DiscardUnknown() { var xxx_messageInfo_MsgUpdateDID proto.InternalMessageInfo -func (m *MsgUpdateDID) GetDidDocString() *Did { +func (m *MsgUpdateDID) GetDidDocument() *DidDocument { if m != nil { - return m.DidDocString + return m.DidDocument } return nil } -func (m *MsgUpdateDID) GetVersionId() string { +func (m *MsgUpdateDID) GetDidDocumentProofs() []*DocumentProof { if m != nil { - return m.VersionId + return m.DidDocumentProofs } - return "" + return nil } -func (m *MsgUpdateDID) GetSignatures() []*SignInfo { +func (m *MsgUpdateDID) GetVersionId() string { if m != nil { - return m.Signatures + return m.VersionId } - return nil + return "" } -func (m *MsgUpdateDID) GetCreator() string { +func (m *MsgUpdateDID) GetTxAuthor() string { if m != nil { - return m.Creator + return m.TxAuthor } return "" } type MsgUpdateDIDResponse struct { - UpdateId string `protobuf:"bytes,1,opt,name=updateId,proto3" json:"updateId,omitempty"` } func (m *MsgUpdateDIDResponse) Reset() { *m = MsgUpdateDIDResponse{} } @@ -236,32 +227,25 @@ func (m *MsgUpdateDIDResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgUpdateDIDResponse proto.InternalMessageInfo -func (m *MsgUpdateDIDResponse) GetUpdateId() string { - if m != nil { - return m.UpdateId - } - return "" -} - -type MsgCreateSchema struct { - Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"` - SchemaDoc *SchemaDocument `protobuf:"bytes,2,opt,name=schemaDoc,proto3" json:"schemaDoc,omitempty"` - SchemaProof *SchemaProof `protobuf:"bytes,3,opt,name=schemaProof,proto3" json:"schemaProof,omitempty"` - ClientSpec *ClientSpec `protobuf:"bytes,4,opt,name=clientSpec,proto3" json:"clientSpec,omitempty"` +type MsgDeactivateDID struct { + DidDocumentId string `protobuf:"bytes,1,opt,name=didDocumentId,proto3" json:"didDocumentId,omitempty"` + DidDocumentProofs []*DocumentProof `protobuf:"bytes,2,rep,name=didDocumentProofs,proto3" json:"didDocumentProofs,omitempty"` + VersionId string `protobuf:"bytes,3,opt,name=versionId,proto3" json:"versionId,omitempty"` + TxAuthor string `protobuf:"bytes,4,opt,name=txAuthor,proto3" json:"txAuthor,omitempty"` } -func (m *MsgCreateSchema) Reset() { *m = MsgCreateSchema{} } -func (m *MsgCreateSchema) String() string { return proto.CompactTextString(m) } -func (*MsgCreateSchema) ProtoMessage() {} -func (*MsgCreateSchema) Descriptor() ([]byte, []int) { +func (m *MsgDeactivateDID) Reset() { *m = MsgDeactivateDID{} } +func (m *MsgDeactivateDID) String() string { return proto.CompactTextString(m) } +func (*MsgDeactivateDID) ProtoMessage() {} +func (*MsgDeactivateDID) Descriptor() ([]byte, []int) { return fileDescriptor_73a1aa6c7279248b, []int{4} } -func (m *MsgCreateSchema) XXX_Unmarshal(b []byte) error { +func (m *MsgDeactivateDID) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *MsgCreateSchema) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *MsgDeactivateDID) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_MsgCreateSchema.Marshal(b, m, deterministic) + return xxx_messageInfo_MsgDeactivateDID.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -271,62 +255,61 @@ func (m *MsgCreateSchema) XXX_Marshal(b []byte, deterministic bool) ([]byte, err return b[:n], nil } } -func (m *MsgCreateSchema) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgCreateSchema.Merge(m, src) +func (m *MsgDeactivateDID) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgDeactivateDID.Merge(m, src) } -func (m *MsgCreateSchema) XXX_Size() int { +func (m *MsgDeactivateDID) XXX_Size() int { return m.Size() } -func (m *MsgCreateSchema) XXX_DiscardUnknown() { - xxx_messageInfo_MsgCreateSchema.DiscardUnknown(m) +func (m *MsgDeactivateDID) XXX_DiscardUnknown() { + xxx_messageInfo_MsgDeactivateDID.DiscardUnknown(m) } -var xxx_messageInfo_MsgCreateSchema proto.InternalMessageInfo +var xxx_messageInfo_MsgDeactivateDID proto.InternalMessageInfo -func (m *MsgCreateSchema) GetCreator() string { +func (m *MsgDeactivateDID) GetDidDocumentId() string { if m != nil { - return m.Creator + return m.DidDocumentId } return "" } -func (m *MsgCreateSchema) GetSchemaDoc() *SchemaDocument { +func (m *MsgDeactivateDID) GetDidDocumentProofs() []*DocumentProof { if m != nil { - return m.SchemaDoc + return m.DidDocumentProofs } return nil } -func (m *MsgCreateSchema) GetSchemaProof() *SchemaProof { +func (m *MsgDeactivateDID) GetVersionId() string { if m != nil { - return m.SchemaProof + return m.VersionId } - return nil + return "" } -func (m *MsgCreateSchema) GetClientSpec() *ClientSpec { +func (m *MsgDeactivateDID) GetTxAuthor() string { if m != nil { - return m.ClientSpec + return m.TxAuthor } - return nil + return "" } -type MsgCreateSchemaResponse struct { - Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` +type MsgDeactivateDIDResponse struct { } -func (m *MsgCreateSchemaResponse) Reset() { *m = MsgCreateSchemaResponse{} } -func (m *MsgCreateSchemaResponse) String() string { return proto.CompactTextString(m) } -func (*MsgCreateSchemaResponse) ProtoMessage() {} -func (*MsgCreateSchemaResponse) Descriptor() ([]byte, []int) { +func (m *MsgDeactivateDIDResponse) Reset() { *m = MsgDeactivateDIDResponse{} } +func (m *MsgDeactivateDIDResponse) String() string { return proto.CompactTextString(m) } +func (*MsgDeactivateDIDResponse) ProtoMessage() {} +func (*MsgDeactivateDIDResponse) Descriptor() ([]byte, []int) { return fileDescriptor_73a1aa6c7279248b, []int{5} } -func (m *MsgCreateSchemaResponse) XXX_Unmarshal(b []byte) error { +func (m *MsgDeactivateDIDResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *MsgCreateSchemaResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *MsgDeactivateDIDResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_MsgCreateSchemaResponse.Marshal(b, m, deterministic) + return xxx_messageInfo_MsgDeactivateDIDResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -336,44 +319,36 @@ func (m *MsgCreateSchemaResponse) XXX_Marshal(b []byte, deterministic bool) ([]b return b[:n], nil } } -func (m *MsgCreateSchemaResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgCreateSchemaResponse.Merge(m, src) +func (m *MsgDeactivateDIDResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgDeactivateDIDResponse.Merge(m, src) } -func (m *MsgCreateSchemaResponse) XXX_Size() int { +func (m *MsgDeactivateDIDResponse) XXX_Size() int { return m.Size() } -func (m *MsgCreateSchemaResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgCreateSchemaResponse.DiscardUnknown(m) +func (m *MsgDeactivateDIDResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgDeactivateDIDResponse.DiscardUnknown(m) } -var xxx_messageInfo_MsgCreateSchemaResponse proto.InternalMessageInfo - -func (m *MsgCreateSchemaResponse) GetId() uint64 { - if m != nil { - return m.Id - } - return 0 -} +var xxx_messageInfo_MsgDeactivateDIDResponse proto.InternalMessageInfo -type MsgDeactivateDID struct { - Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"` - DidId string `protobuf:"bytes,2,opt,name=didId,proto3" json:"didId,omitempty"` - VersionId string `protobuf:"bytes,3,opt,name=version_id,json=versionId,proto3" json:"version_id,omitempty"` - Signatures []*SignInfo `protobuf:"bytes,4,rep,name=signatures,proto3" json:"signatures,omitempty"` +type MsgRegisterCredentialSchema struct { + CredentialSchemaDocument *CredentialSchemaDocument `protobuf:"bytes,1,opt,name=credentialSchemaDocument,proto3" json:"credentialSchemaDocument,omitempty"` + CredentialSchemaProof *DocumentProof `protobuf:"bytes,2,opt,name=credentialSchemaProof,proto3" json:"credentialSchemaProof,omitempty"` + TxAuthor string `protobuf:"bytes,3,opt,name=txAuthor,proto3" json:"txAuthor,omitempty"` } -func (m *MsgDeactivateDID) Reset() { *m = MsgDeactivateDID{} } -func (m *MsgDeactivateDID) String() string { return proto.CompactTextString(m) } -func (*MsgDeactivateDID) ProtoMessage() {} -func (*MsgDeactivateDID) Descriptor() ([]byte, []int) { +func (m *MsgRegisterCredentialSchema) Reset() { *m = MsgRegisterCredentialSchema{} } +func (m *MsgRegisterCredentialSchema) String() string { return proto.CompactTextString(m) } +func (*MsgRegisterCredentialSchema) ProtoMessage() {} +func (*MsgRegisterCredentialSchema) Descriptor() ([]byte, []int) { return fileDescriptor_73a1aa6c7279248b, []int{6} } -func (m *MsgDeactivateDID) XXX_Unmarshal(b []byte) error { +func (m *MsgRegisterCredentialSchema) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *MsgDeactivateDID) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *MsgRegisterCredentialSchema) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_MsgDeactivateDID.Marshal(b, m, deterministic) + return xxx_messageInfo_MsgRegisterCredentialSchema.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -383,62 +358,93 @@ func (m *MsgDeactivateDID) XXX_Marshal(b []byte, deterministic bool) ([]byte, er return b[:n], nil } } -func (m *MsgDeactivateDID) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgDeactivateDID.Merge(m, src) +func (m *MsgRegisterCredentialSchema) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgRegisterCredentialSchema.Merge(m, src) } -func (m *MsgDeactivateDID) XXX_Size() int { +func (m *MsgRegisterCredentialSchema) XXX_Size() int { return m.Size() } -func (m *MsgDeactivateDID) XXX_DiscardUnknown() { - xxx_messageInfo_MsgDeactivateDID.DiscardUnknown(m) +func (m *MsgRegisterCredentialSchema) XXX_DiscardUnknown() { + xxx_messageInfo_MsgRegisterCredentialSchema.DiscardUnknown(m) } -var xxx_messageInfo_MsgDeactivateDID proto.InternalMessageInfo +var xxx_messageInfo_MsgRegisterCredentialSchema proto.InternalMessageInfo -func (m *MsgDeactivateDID) GetCreator() string { +func (m *MsgRegisterCredentialSchema) GetCredentialSchemaDocument() *CredentialSchemaDocument { if m != nil { - return m.Creator + return m.CredentialSchemaDocument } - return "" + return nil } -func (m *MsgDeactivateDID) GetDidId() string { +func (m *MsgRegisterCredentialSchema) GetCredentialSchemaProof() *DocumentProof { if m != nil { - return m.DidId + return m.CredentialSchemaProof } - return "" + return nil } -func (m *MsgDeactivateDID) GetVersionId() string { +func (m *MsgRegisterCredentialSchema) GetTxAuthor() string { if m != nil { - return m.VersionId + return m.TxAuthor } return "" } -func (m *MsgDeactivateDID) GetSignatures() []*SignInfo { - if m != nil { - return m.Signatures +type MsgRegisterCredentialSchemaResponse struct { +} + +func (m *MsgRegisterCredentialSchemaResponse) Reset() { *m = MsgRegisterCredentialSchemaResponse{} } +func (m *MsgRegisterCredentialSchemaResponse) String() string { return proto.CompactTextString(m) } +func (*MsgRegisterCredentialSchemaResponse) ProtoMessage() {} +func (*MsgRegisterCredentialSchemaResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_73a1aa6c7279248b, []int{7} +} +func (m *MsgRegisterCredentialSchemaResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgRegisterCredentialSchemaResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgRegisterCredentialSchemaResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil } - return nil +} +func (m *MsgRegisterCredentialSchemaResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgRegisterCredentialSchemaResponse.Merge(m, src) +} +func (m *MsgRegisterCredentialSchemaResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgRegisterCredentialSchemaResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgRegisterCredentialSchemaResponse.DiscardUnknown(m) } -type MsgDeactivateDIDResponse struct { - Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` +var xxx_messageInfo_MsgRegisterCredentialSchemaResponse proto.InternalMessageInfo + +type MsgUpdateCredentialSchema struct { + CredentialSchemaDocument *CredentialSchemaDocument `protobuf:"bytes,1,opt,name=credentialSchemaDocument,proto3" json:"credentialSchemaDocument,omitempty"` + CredentialSchemaProof *DocumentProof `protobuf:"bytes,2,opt,name=credentialSchemaProof,proto3" json:"credentialSchemaProof,omitempty"` + TxAuthor string `protobuf:"bytes,3,opt,name=txAuthor,proto3" json:"txAuthor,omitempty"` } -func (m *MsgDeactivateDIDResponse) Reset() { *m = MsgDeactivateDIDResponse{} } -func (m *MsgDeactivateDIDResponse) String() string { return proto.CompactTextString(m) } -func (*MsgDeactivateDIDResponse) ProtoMessage() {} -func (*MsgDeactivateDIDResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_73a1aa6c7279248b, []int{7} +func (m *MsgUpdateCredentialSchema) Reset() { *m = MsgUpdateCredentialSchema{} } +func (m *MsgUpdateCredentialSchema) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateCredentialSchema) ProtoMessage() {} +func (*MsgUpdateCredentialSchema) Descriptor() ([]byte, []int) { + return fileDescriptor_73a1aa6c7279248b, []int{8} } -func (m *MsgDeactivateDIDResponse) XXX_Unmarshal(b []byte) error { +func (m *MsgUpdateCredentialSchema) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *MsgDeactivateDIDResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *MsgUpdateCredentialSchema) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_MsgDeactivateDIDResponse.Marshal(b, m, deterministic) + return xxx_messageInfo_MsgUpdateCredentialSchema.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -448,37 +454,86 @@ func (m *MsgDeactivateDIDResponse) XXX_Marshal(b []byte, deterministic bool) ([] return b[:n], nil } } -func (m *MsgDeactivateDIDResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgDeactivateDIDResponse.Merge(m, src) +func (m *MsgUpdateCredentialSchema) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateCredentialSchema.Merge(m, src) } -func (m *MsgDeactivateDIDResponse) XXX_Size() int { +func (m *MsgUpdateCredentialSchema) XXX_Size() int { return m.Size() } -func (m *MsgDeactivateDIDResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgDeactivateDIDResponse.DiscardUnknown(m) +func (m *MsgUpdateCredentialSchema) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateCredentialSchema.DiscardUnknown(m) } -var xxx_messageInfo_MsgDeactivateDIDResponse proto.InternalMessageInfo +var xxx_messageInfo_MsgUpdateCredentialSchema proto.InternalMessageInfo -func (m *MsgDeactivateDIDResponse) GetId() uint64 { +func (m *MsgUpdateCredentialSchema) GetCredentialSchemaDocument() *CredentialSchemaDocument { if m != nil { - return m.Id + return m.CredentialSchemaDocument + } + return nil +} + +func (m *MsgUpdateCredentialSchema) GetCredentialSchemaProof() *DocumentProof { + if m != nil { + return m.CredentialSchemaProof + } + return nil +} + +func (m *MsgUpdateCredentialSchema) GetTxAuthor() string { + if m != nil { + return m.TxAuthor + } + return "" +} + +type MsgUpdateCredentialSchemaResponse struct { +} + +func (m *MsgUpdateCredentialSchemaResponse) Reset() { *m = MsgUpdateCredentialSchemaResponse{} } +func (m *MsgUpdateCredentialSchemaResponse) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateCredentialSchemaResponse) ProtoMessage() {} +func (*MsgUpdateCredentialSchemaResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_73a1aa6c7279248b, []int{9} +} +func (m *MsgUpdateCredentialSchemaResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateCredentialSchemaResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateCredentialSchemaResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil } - return 0 +} +func (m *MsgUpdateCredentialSchemaResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateCredentialSchemaResponse.Merge(m, src) +} +func (m *MsgUpdateCredentialSchemaResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateCredentialSchemaResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateCredentialSchemaResponse.DiscardUnknown(m) } +var xxx_messageInfo_MsgUpdateCredentialSchemaResponse proto.InternalMessageInfo + type MsgRegisterCredentialStatus struct { - Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"` - CredentialStatus *CredentialStatus `protobuf:"bytes,2,opt,name=credentialStatus,proto3" json:"credentialStatus,omitempty"` - Proof *CredentialProof `protobuf:"bytes,3,opt,name=proof,proto3" json:"proof,omitempty"` - ClientSpec *ClientSpec `protobuf:"bytes,4,opt,name=clientSpec,proto3" json:"clientSpec,omitempty"` + CredentialStatusDocument *CredentialStatusDocument `protobuf:"bytes,1,opt,name=credentialStatusDocument,proto3" json:"credentialStatusDocument,omitempty"` + CredentialStatusProof *DocumentProof `protobuf:"bytes,2,opt,name=credentialStatusProof,proto3" json:"credentialStatusProof,omitempty"` + TxAuthor string `protobuf:"bytes,3,opt,name=txAuthor,proto3" json:"txAuthor,omitempty"` } func (m *MsgRegisterCredentialStatus) Reset() { *m = MsgRegisterCredentialStatus{} } func (m *MsgRegisterCredentialStatus) String() string { return proto.CompactTextString(m) } func (*MsgRegisterCredentialStatus) ProtoMessage() {} func (*MsgRegisterCredentialStatus) Descriptor() ([]byte, []int) { - return fileDescriptor_73a1aa6c7279248b, []int{8} + return fileDescriptor_73a1aa6c7279248b, []int{10} } func (m *MsgRegisterCredentialStatus) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -507,43 +562,35 @@ func (m *MsgRegisterCredentialStatus) XXX_DiscardUnknown() { var xxx_messageInfo_MsgRegisterCredentialStatus proto.InternalMessageInfo -func (m *MsgRegisterCredentialStatus) GetCreator() string { - if m != nil { - return m.Creator - } - return "" -} - -func (m *MsgRegisterCredentialStatus) GetCredentialStatus() *CredentialStatus { +func (m *MsgRegisterCredentialStatus) GetCredentialStatusDocument() *CredentialStatusDocument { if m != nil { - return m.CredentialStatus + return m.CredentialStatusDocument } return nil } -func (m *MsgRegisterCredentialStatus) GetProof() *CredentialProof { +func (m *MsgRegisterCredentialStatus) GetCredentialStatusProof() *DocumentProof { if m != nil { - return m.Proof + return m.CredentialStatusProof } return nil } -func (m *MsgRegisterCredentialStatus) GetClientSpec() *ClientSpec { +func (m *MsgRegisterCredentialStatus) GetTxAuthor() string { if m != nil { - return m.ClientSpec + return m.TxAuthor } - return nil + return "" } type MsgRegisterCredentialStatusResponse struct { - Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` } func (m *MsgRegisterCredentialStatusResponse) Reset() { *m = MsgRegisterCredentialStatusResponse{} } func (m *MsgRegisterCredentialStatusResponse) String() string { return proto.CompactTextString(m) } func (*MsgRegisterCredentialStatusResponse) ProtoMessage() {} func (*MsgRegisterCredentialStatusResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_73a1aa6c7279248b, []int{9} + return fileDescriptor_73a1aa6c7279248b, []int{11} } func (m *MsgRegisterCredentialStatusResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -572,71 +619,162 @@ func (m *MsgRegisterCredentialStatusResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgRegisterCredentialStatusResponse proto.InternalMessageInfo -func (m *MsgRegisterCredentialStatusResponse) GetId() uint64 { +type MsgUpdateCredentialStatus struct { + CredentialStatusDocument *CredentialStatusDocument `protobuf:"bytes,1,opt,name=credentialStatusDocument,proto3" json:"credentialStatusDocument,omitempty"` + CredentialStatusProof *DocumentProof `protobuf:"bytes,2,opt,name=credentialStatusProof,proto3" json:"credentialStatusProof,omitempty"` + TxAuthor string `protobuf:"bytes,3,opt,name=txAuthor,proto3" json:"txAuthor,omitempty"` +} + +func (m *MsgUpdateCredentialStatus) Reset() { *m = MsgUpdateCredentialStatus{} } +func (m *MsgUpdateCredentialStatus) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateCredentialStatus) ProtoMessage() {} +func (*MsgUpdateCredentialStatus) Descriptor() ([]byte, []int) { + return fileDescriptor_73a1aa6c7279248b, []int{12} +} +func (m *MsgUpdateCredentialStatus) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateCredentialStatus) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateCredentialStatus.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgUpdateCredentialStatus) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateCredentialStatus.Merge(m, src) +} +func (m *MsgUpdateCredentialStatus) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateCredentialStatus) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateCredentialStatus.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateCredentialStatus proto.InternalMessageInfo + +func (m *MsgUpdateCredentialStatus) GetCredentialStatusDocument() *CredentialStatusDocument { + if m != nil { + return m.CredentialStatusDocument + } + return nil +} + +func (m *MsgUpdateCredentialStatus) GetCredentialStatusProof() *DocumentProof { + if m != nil { + return m.CredentialStatusProof + } + return nil +} + +func (m *MsgUpdateCredentialStatus) GetTxAuthor() string { if m != nil { - return m.Id + return m.TxAuthor + } + return "" +} + +type MsgUpdateCredentialStatusResponse struct { +} + +func (m *MsgUpdateCredentialStatusResponse) Reset() { *m = MsgUpdateCredentialStatusResponse{} } +func (m *MsgUpdateCredentialStatusResponse) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateCredentialStatusResponse) ProtoMessage() {} +func (*MsgUpdateCredentialStatusResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_73a1aa6c7279248b, []int{13} +} +func (m *MsgUpdateCredentialStatusResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateCredentialStatusResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateCredentialStatusResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil } - return 0 +} +func (m *MsgUpdateCredentialStatusResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateCredentialStatusResponse.Merge(m, src) +} +func (m *MsgUpdateCredentialStatusResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateCredentialStatusResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateCredentialStatusResponse.DiscardUnknown(m) } +var xxx_messageInfo_MsgUpdateCredentialStatusResponse proto.InternalMessageInfo + func init() { - proto.RegisterType((*MsgCreateDID)(nil), "hypersignprotocol.hidnode.ssi.MsgCreateDID") - proto.RegisterType((*MsgCreateDIDResponse)(nil), "hypersignprotocol.hidnode.ssi.MsgCreateDIDResponse") - proto.RegisterType((*MsgUpdateDID)(nil), "hypersignprotocol.hidnode.ssi.MsgUpdateDID") - proto.RegisterType((*MsgUpdateDIDResponse)(nil), "hypersignprotocol.hidnode.ssi.MsgUpdateDIDResponse") - proto.RegisterType((*MsgCreateSchema)(nil), "hypersignprotocol.hidnode.ssi.MsgCreateSchema") - proto.RegisterType((*MsgCreateSchemaResponse)(nil), "hypersignprotocol.hidnode.ssi.MsgCreateSchemaResponse") - proto.RegisterType((*MsgDeactivateDID)(nil), "hypersignprotocol.hidnode.ssi.MsgDeactivateDID") - proto.RegisterType((*MsgDeactivateDIDResponse)(nil), "hypersignprotocol.hidnode.ssi.MsgDeactivateDIDResponse") - proto.RegisterType((*MsgRegisterCredentialStatus)(nil), "hypersignprotocol.hidnode.ssi.MsgRegisterCredentialStatus") - proto.RegisterType((*MsgRegisterCredentialStatusResponse)(nil), "hypersignprotocol.hidnode.ssi.MsgRegisterCredentialStatusResponse") + proto.RegisterType((*MsgRegisterDID)(nil), "hypersign.ssi.v1.MsgRegisterDID") + proto.RegisterType((*MsgRegisterDIDResponse)(nil), "hypersign.ssi.v1.MsgRegisterDIDResponse") + proto.RegisterType((*MsgUpdateDID)(nil), "hypersign.ssi.v1.MsgUpdateDID") + proto.RegisterType((*MsgUpdateDIDResponse)(nil), "hypersign.ssi.v1.MsgUpdateDIDResponse") + proto.RegisterType((*MsgDeactivateDID)(nil), "hypersign.ssi.v1.MsgDeactivateDID") + proto.RegisterType((*MsgDeactivateDIDResponse)(nil), "hypersign.ssi.v1.MsgDeactivateDIDResponse") + proto.RegisterType((*MsgRegisterCredentialSchema)(nil), "hypersign.ssi.v1.MsgRegisterCredentialSchema") + proto.RegisterType((*MsgRegisterCredentialSchemaResponse)(nil), "hypersign.ssi.v1.MsgRegisterCredentialSchemaResponse") + proto.RegisterType((*MsgUpdateCredentialSchema)(nil), "hypersign.ssi.v1.MsgUpdateCredentialSchema") + proto.RegisterType((*MsgUpdateCredentialSchemaResponse)(nil), "hypersign.ssi.v1.MsgUpdateCredentialSchemaResponse") + proto.RegisterType((*MsgRegisterCredentialStatus)(nil), "hypersign.ssi.v1.MsgRegisterCredentialStatus") + proto.RegisterType((*MsgRegisterCredentialStatusResponse)(nil), "hypersign.ssi.v1.MsgRegisterCredentialStatusResponse") + proto.RegisterType((*MsgUpdateCredentialStatus)(nil), "hypersign.ssi.v1.MsgUpdateCredentialStatus") + proto.RegisterType((*MsgUpdateCredentialStatusResponse)(nil), "hypersign.ssi.v1.MsgUpdateCredentialStatusResponse") } func init() { proto.RegisterFile("ssi/v1/tx.proto", fileDescriptor_73a1aa6c7279248b) } var fileDescriptor_73a1aa6c7279248b = []byte{ - // 655 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x56, 0xc1, 0x6e, 0xd3, 0x40, - 0x10, 0xad, 0x93, 0x14, 0xf0, 0xb8, 0xd0, 0xca, 0x54, 0xaa, 0x65, 0x54, 0xab, 0x32, 0x12, 0xb4, - 0x45, 0xb5, 0x85, 0x2b, 0x40, 0xe2, 0xd8, 0x5a, 0x20, 0x8b, 0x46, 0x42, 0x8e, 0xb8, 0xc0, 0x01, - 0xb9, 0xde, 0xad, 0xb3, 0x52, 0xe3, 0xb5, 0xbc, 0x9b, 0xa8, 0xfd, 0x0b, 0xb8, 0x72, 0xe7, 0xc2, - 0x1f, 0xf0, 0x07, 0x1c, 0x7b, 0xec, 0x11, 0xb5, 0x9f, 0xc0, 0x0f, 0xa0, 0xd8, 0x8e, 0x63, 0xbb, - 0x72, 0x9c, 0x56, 0x39, 0xce, 0xec, 0xbc, 0x99, 0x37, 0x2f, 0xcf, 0xa3, 0xc0, 0x2a, 0x63, 0xc4, - 0x1c, 0xbd, 0x34, 0xf9, 0x99, 0x11, 0xc5, 0x94, 0x53, 0x79, 0xb3, 0x7f, 0x1e, 0xe1, 0x98, 0x91, - 0x20, 0x4c, 0x62, 0x9f, 0x9e, 0x1a, 0x7d, 0x82, 0x42, 0x8a, 0xb0, 0xc1, 0x18, 0x51, 0x1f, 0x67, - 0xf5, 0xcc, 0xef, 0xe3, 0x81, 0x97, 0x62, 0xd4, 0xb5, 0x2c, 0x89, 0x08, 0xca, 0x32, 0x1b, 0x59, - 0xc6, 0x8f, 0x31, 0xc2, 0x21, 0x27, 0xde, 0x69, 0xf5, 0xe1, 0x94, 0xe0, 0x90, 0xf7, 0x22, 0xec, - 0xa7, 0x0f, 0xfa, 0x6f, 0x01, 0x56, 0xba, 0x2c, 0x38, 0x8c, 0xb1, 0xc7, 0xb1, 0xed, 0xd8, 0xf2, - 0x3b, 0x58, 0x41, 0x04, 0xd9, 0xd4, 0xef, 0xf1, 0x98, 0x84, 0x81, 0x22, 0x6c, 0x09, 0xdb, 0x92, - 0xa5, 0x1b, 0x33, 0xf9, 0x19, 0x36, 0x41, 0x6e, 0x09, 0x27, 0xbf, 0x07, 0x18, 0x57, 0x7b, 0x7c, - 0x18, 0x63, 0xa6, 0xb4, 0xb6, 0xda, 0xdb, 0x92, 0xf5, 0xbc, 0xa1, 0x4b, 0x8f, 0x04, 0xa1, 0x13, - 0x9e, 0x50, 0xb7, 0x00, 0x95, 0x15, 0xb8, 0xef, 0x8f, 0xd9, 0xd1, 0x58, 0x69, 0x6f, 0x09, 0xdb, - 0xa2, 0x3b, 0x09, 0xf5, 0x67, 0xb0, 0x5e, 0xa4, 0xee, 0x62, 0x16, 0xd1, 0x90, 0x61, 0xf9, 0x11, - 0xb4, 0x08, 0x4a, 0x88, 0x77, 0xdc, 0x16, 0x41, 0xfa, 0x65, 0xba, 0xe3, 0xa7, 0x08, 0x2d, 0x78, - 0xc7, 0x4d, 0x80, 0xd1, 0x18, 0x40, 0xc3, 0xaf, 0x04, 0x29, 0xad, 0x84, 0x9d, 0x98, 0x65, 0x1c, - 0x54, 0x91, 0xa0, 0xbd, 0x10, 0x09, 0x3a, 0x65, 0x09, 0xac, 0x44, 0x82, 0x7c, 0xb3, 0x5c, 0x02, - 0x15, 0x1e, 0x0c, 0x93, 0xa4, 0x93, 0x0a, 0x21, 0xba, 0x79, 0xac, 0x7f, 0x6f, 0xc1, 0x6a, 0xae, - 0x5b, 0x2f, 0x31, 0x54, 0x71, 0x82, 0x50, 0x9a, 0x20, 0x7f, 0x00, 0x31, 0x35, 0x9d, 0x4d, 0xfd, - 0x64, 0x45, 0xc9, 0xda, 0x6b, 0xda, 0x61, 0x52, 0x3f, 0x1c, 0xe0, 0x90, 0xbb, 0x53, 0xbc, 0x7c, - 0x04, 0x52, 0x1a, 0x7c, 0x8c, 0x29, 0x3d, 0x49, 0x7e, 0x4f, 0xc9, 0xda, 0x9d, 0xab, 0x5d, 0x82, - 0x70, 0x8b, 0x70, 0xd9, 0x01, 0x98, 0xfa, 0x39, 0x51, 0x46, 0xb2, 0x76, 0x1a, 0x9a, 0x1d, 0xe6, - 0x00, 0xb7, 0x00, 0xd6, 0x77, 0x60, 0xa3, 0x22, 0x49, 0xad, 0x9b, 0x7e, 0x09, 0xb0, 0xd6, 0x65, - 0x81, 0x8d, 0x3d, 0x9f, 0x93, 0x51, 0xe6, 0xa8, 0x7a, 0xfd, 0xd6, 0x61, 0x19, 0x11, 0xe4, 0x4c, - 0xec, 0x91, 0x06, 0x15, 0xe7, 0xb4, 0x67, 0x3b, 0xa7, 0x73, 0x67, 0xe7, 0xe8, 0xbb, 0xa0, 0x54, - 0xb9, 0xd6, 0x2e, 0xf6, 0xb3, 0x05, 0x4f, 0xba, 0x2c, 0x70, 0x71, 0x40, 0x18, 0xc7, 0xf1, 0x61, - 0x7e, 0x43, 0x7a, 0xdc, 0xe3, 0x43, 0x36, 0x63, 0xc7, 0x2f, 0xb0, 0xe6, 0x57, 0xaa, 0x33, 0xab, - 0x98, 0x4d, 0x3f, 0x47, 0x05, 0xe6, 0xde, 0x68, 0x24, 0xdb, 0xb0, 0x1c, 0x15, 0xdc, 0x62, 0xcc, - 0xdd, 0x31, 0x75, 0x4c, 0x0a, 0x5e, 0xa4, 0x57, 0x5e, 0xc1, 0xd3, 0x19, 0x32, 0xd5, 0xc9, 0x6b, - 0xfd, 0xeb, 0x40, 0xbb, 0xcb, 0x02, 0x79, 0x00, 0xe2, 0xf4, 0xda, 0xbe, 0x68, 0xa0, 0x50, 0xbc, - 0x6f, 0xea, 0xfe, 0x2d, 0x8a, 0x73, 0x1a, 0x03, 0x10, 0xa7, 0x87, 0x6f, 0x8e, 0x71, 0x79, 0xf1, - 0x3c, 0xe3, 0x6e, 0x1e, 0x9e, 0x11, 0xac, 0x94, 0x0e, 0x8b, 0x31, 0x2f, 0xe7, 0xb4, 0x5e, 0x7d, - 0x7d, 0xbb, 0xfa, 0x7c, 0xee, 0x39, 0x3c, 0x2c, 0x7f, 0x91, 0x66, 0x73, 0xa3, 0x12, 0x40, 0x7d, - 0x73, 0x4b, 0x40, 0x3e, 0xfa, 0x87, 0x00, 0x4a, 0xed, 0x47, 0xf3, 0xb6, 0xb9, 0x6b, 0x1d, 0x56, - 0x3d, 0xb8, 0x3b, 0x76, 0x42, 0xee, 0xe0, 0xe8, 0xcf, 0x95, 0x26, 0x5c, 0x5c, 0x69, 0xc2, 0xdf, - 0x2b, 0x4d, 0xf8, 0x76, 0xad, 0x2d, 0x5d, 0x5c, 0x6b, 0x4b, 0x97, 0xd7, 0xda, 0xd2, 0x67, 0x2b, - 0x20, 0xbc, 0x3f, 0x3c, 0x36, 0x7c, 0x3a, 0x30, 0xf3, 0x39, 0x7b, 0x93, 0x41, 0x66, 0x9f, 0xa0, - 0xbd, 0xf1, 0x24, 0xf3, 0xcc, 0x1c, 0xff, 0x77, 0xe0, 0xe7, 0x11, 0x66, 0xc7, 0xf7, 0x92, 0xe7, - 0xfd, 0xff, 0x01, 0x00, 0x00, 0xff, 0xff, 0x3c, 0xb6, 0x94, 0x92, 0xbf, 0x08, 0x00, 0x00, + // 612 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe4, 0x96, 0x4f, 0x6f, 0xd3, 0x4c, + 0x10, 0xc6, 0xb3, 0xcd, 0xab, 0xea, 0xcd, 0x84, 0x42, 0xb0, 0x20, 0x32, 0x06, 0x4c, 0x48, 0x01, + 0x45, 0x45, 0xb1, 0xd5, 0x44, 0x9c, 0x11, 0x34, 0x97, 0x48, 0x44, 0x42, 0xae, 0x7a, 0x80, 0x4b, + 0x95, 0xda, 0x5b, 0x67, 0xa5, 0xc6, 0x6b, 0x79, 0x37, 0x51, 0xca, 0x89, 0x8f, 0xc0, 0x81, 0x8f, + 0xc3, 0x85, 0x1b, 0xc7, 0x1e, 0x7b, 0x44, 0xc9, 0x77, 0x40, 0x1c, 0x51, 0x36, 0xee, 0xc6, 0x76, + 0xec, 0xfc, 0xe9, 0xa9, 0x82, 0xa3, 0x67, 0x9e, 0x67, 0x67, 0x7f, 0xe3, 0xf1, 0xae, 0xe1, 0x0e, + 0x63, 0xc4, 0x1c, 0xee, 0x9b, 0x7c, 0x64, 0xf8, 0x01, 0xe5, 0x54, 0x29, 0xf5, 0xce, 0x7d, 0x1c, + 0x30, 0xe2, 0x7a, 0x06, 0x63, 0xc4, 0x18, 0xee, 0x6b, 0x7a, 0x28, 0xb1, 0x03, 0xec, 0x60, 0x8f, + 0x93, 0xee, 0xd9, 0x31, 0xb3, 0x7b, 0xb8, 0xdf, 0x9d, 0x39, 0xb4, 0x52, 0x98, 0x77, 0x88, 0x13, + 0x46, 0xd2, 0x1c, 0xbc, 0xcb, 0x07, 0x2c, 0xcc, 0x2b, 0x61, 0xde, 0x0f, 0x28, 0x3d, 0x9d, 0xc5, + 0xaa, 0xdf, 0x10, 0xdc, 0xee, 0x30, 0xd7, 0xc2, 0x2e, 0x61, 0x1c, 0x07, 0xad, 0x76, 0x4b, 0x79, + 0x0d, 0x45, 0x87, 0x38, 0x2d, 0x6a, 0x0f, 0xfa, 0xd8, 0xe3, 0x2a, 0xaa, 0xa0, 0x5a, 0xb1, 0xf1, + 0xd8, 0x48, 0x6e, 0xd0, 0x68, 0xcd, 0x45, 0x56, 0xd4, 0xa1, 0x74, 0xe0, 0x6e, 0xe4, 0xf1, 0xfd, + 0xb4, 0x1a, 0x53, 0xb7, 0x2a, 0xf9, 0x5a, 0xb1, 0xf1, 0x24, 0x65, 0x99, 0xa8, 0xce, 0x5a, 0x74, + 0x2a, 0x1a, 0xfc, 0xcf, 0x47, 0x6f, 0x06, 0xbc, 0x47, 0x03, 0x35, 0x5f, 0x41, 0xb5, 0x82, 0x25, + 0x9f, 0xab, 0x2a, 0x94, 0xe3, 0xbb, 0xb7, 0x30, 0xf3, 0xa9, 0xc7, 0x70, 0xf5, 0x12, 0xc1, 0xad, + 0x0e, 0x73, 0x8f, 0x7c, 0xa7, 0xcb, 0xf1, 0x4d, 0xc4, 0x7a, 0x04, 0x85, 0xe1, 0xd4, 0x42, 0xbd, + 0xb6, 0x13, 0x72, 0xcd, 0x03, 0x31, 0xe8, 0xff, 0x12, 0xd0, 0x65, 0xb8, 0x17, 0x25, 0x93, 0xc8, + 0xdf, 0x11, 0x94, 0x3a, 0xcc, 0x6d, 0xe1, 0xae, 0xcd, 0xc9, 0x30, 0xc4, 0x7e, 0x06, 0x3b, 0x91, + 0xda, 0x6d, 0x47, 0x80, 0x17, 0xac, 0x78, 0xf0, 0xe6, 0xb0, 0x69, 0xa0, 0x26, 0x11, 0x24, 0xdf, + 0x6f, 0x04, 0x0f, 0x23, 0x6f, 0xfb, 0x40, 0x8e, 0xf9, 0xa1, 0xf8, 0x2e, 0x94, 0x53, 0x50, 0xed, + 0x44, 0x2c, 0xf1, 0xba, 0xf7, 0x16, 0x59, 0x0e, 0x32, 0x1c, 0x56, 0xe6, 0x5a, 0xca, 0x11, 0xdc, + 0x4f, 0xe6, 0x04, 0xb7, 0xba, 0x25, 0x8a, 0xac, 0x6c, 0x58, 0xba, 0x7b, 0xe9, 0x9c, 0x3f, 0x87, + 0xdd, 0x25, 0xe4, 0xb2, 0x43, 0xbf, 0x10, 0x3c, 0x90, 0xa3, 0xf1, 0x2f, 0xf5, 0x67, 0x17, 0x9e, + 0x66, 0x72, 0xaf, 0x31, 0x3f, 0xe2, 0x94, 0x4c, 0xf4, 0x47, 0xc4, 0x36, 0xea, 0x4f, 0xcc, 0x61, + 0x65, 0xae, 0x95, 0xe8, 0x8f, 0xc8, 0x5d, 0xbb, 0x3f, 0x73, 0xf7, 0xf5, 0xe6, 0x47, 0xf8, 0x57, + 0xce, 0xcf, 0x5f, 0xdf, 0x9f, 0x8c, 0xf9, 0x89, 0x75, 0xa7, 0xf1, 0x75, 0x1b, 0xf2, 0x1d, 0xe6, + 0x2a, 0x1f, 0xa0, 0x18, 0xbd, 0x2f, 0x2b, 0x8b, 0xfb, 0x89, 0xdf, 0x49, 0x5a, 0x6d, 0x95, 0xe2, + 0xaa, 0x84, 0x72, 0x08, 0x85, 0xf9, 0x8d, 0xa5, 0xa7, 0xda, 0x64, 0x5e, 0x7b, 0xb1, 0x3c, 0x2f, + 0x17, 0x3d, 0x86, 0x9d, 0xf8, 0x9d, 0x50, 0x4d, 0x35, 0xc6, 0x34, 0xda, 0xde, 0x6a, 0x8d, 0x2c, + 0xf0, 0x19, 0x81, 0x9a, 0x79, 0x2a, 0xd7, 0x97, 0xc2, 0x27, 0xe5, 0xda, 0xab, 0x8d, 0xe4, 0x72, + 0x0b, 0x9f, 0xa0, 0x9c, 0x71, 0xea, 0xbd, 0x5c, 0xd2, 0xa5, 0x85, 0xea, 0xcd, 0x0d, 0xc4, 0xab, + 0xf0, 0x67, 0x1f, 0xcd, 0xda, 0xf8, 0x42, 0xbe, 0x3e, 0x7e, 0x6c, 0x34, 0x53, 0xf1, 0x67, 0xf5, + 0xd7, 0xc4, 0x9f, 0x55, 0x6f, 0x6e, 0x20, 0xbe, 0xaa, 0xfd, 0xf6, 0xdd, 0x8f, 0xb1, 0x8e, 0x2e, + 0xc6, 0x3a, 0xfa, 0x39, 0xd6, 0xd1, 0x97, 0x89, 0x9e, 0xbb, 0x98, 0xe8, 0xb9, 0xcb, 0x89, 0x9e, + 0xfb, 0xd8, 0x70, 0x09, 0xef, 0x0d, 0x4e, 0x0c, 0x9b, 0xf6, 0x4d, 0xb9, 0x70, 0x5d, 0xfc, 0x78, + 0xda, 0xf4, 0xcc, 0xec, 0x11, 0xa7, 0xee, 0x51, 0x07, 0x9b, 0x23, 0x73, 0xfa, 0x67, 0xca, 0xcf, + 0x7d, 0xcc, 0x4e, 0xb6, 0x45, 0xba, 0xf9, 0x27, 0x00, 0x00, 0xff, 0xff, 0xbf, 0xe5, 0x50, 0x92, + 0x22, 0x0b, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -651,11 +789,13 @@ const _ = grpc.SupportPackageIsVersion4 // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type MsgClient interface { - CreateDID(ctx context.Context, in *MsgCreateDID, opts ...grpc.CallOption) (*MsgCreateDIDResponse, error) + RegisterDID(ctx context.Context, in *MsgRegisterDID, opts ...grpc.CallOption) (*MsgRegisterDIDResponse, error) UpdateDID(ctx context.Context, in *MsgUpdateDID, opts ...grpc.CallOption) (*MsgUpdateDIDResponse, error) - CreateSchema(ctx context.Context, in *MsgCreateSchema, opts ...grpc.CallOption) (*MsgCreateSchemaResponse, error) DeactivateDID(ctx context.Context, in *MsgDeactivateDID, opts ...grpc.CallOption) (*MsgDeactivateDIDResponse, error) + RegisterCredentialSchema(ctx context.Context, in *MsgRegisterCredentialSchema, opts ...grpc.CallOption) (*MsgRegisterCredentialSchemaResponse, error) + UpdateCredentialSchema(ctx context.Context, in *MsgUpdateCredentialSchema, opts ...grpc.CallOption) (*MsgUpdateCredentialSchemaResponse, error) RegisterCredentialStatus(ctx context.Context, in *MsgRegisterCredentialStatus, opts ...grpc.CallOption) (*MsgRegisterCredentialStatusResponse, error) + UpdateCredentialStatus(ctx context.Context, in *MsgUpdateCredentialStatus, opts ...grpc.CallOption) (*MsgUpdateCredentialStatusResponse, error) } type msgClient struct { @@ -666,9 +806,9 @@ func NewMsgClient(cc grpc1.ClientConn) MsgClient { return &msgClient{cc} } -func (c *msgClient) CreateDID(ctx context.Context, in *MsgCreateDID, opts ...grpc.CallOption) (*MsgCreateDIDResponse, error) { - out := new(MsgCreateDIDResponse) - err := c.cc.Invoke(ctx, "/hypersignprotocol.hidnode.ssi.Msg/CreateDID", in, out, opts...) +func (c *msgClient) RegisterDID(ctx context.Context, in *MsgRegisterDID, opts ...grpc.CallOption) (*MsgRegisterDIDResponse, error) { + out := new(MsgRegisterDIDResponse) + err := c.cc.Invoke(ctx, "/hypersign.ssi.v1.Msg/RegisterDID", in, out, opts...) if err != nil { return nil, err } @@ -677,25 +817,34 @@ func (c *msgClient) CreateDID(ctx context.Context, in *MsgCreateDID, opts ...grp func (c *msgClient) UpdateDID(ctx context.Context, in *MsgUpdateDID, opts ...grpc.CallOption) (*MsgUpdateDIDResponse, error) { out := new(MsgUpdateDIDResponse) - err := c.cc.Invoke(ctx, "/hypersignprotocol.hidnode.ssi.Msg/UpdateDID", in, out, opts...) + err := c.cc.Invoke(ctx, "/hypersign.ssi.v1.Msg/UpdateDID", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) DeactivateDID(ctx context.Context, in *MsgDeactivateDID, opts ...grpc.CallOption) (*MsgDeactivateDIDResponse, error) { + out := new(MsgDeactivateDIDResponse) + err := c.cc.Invoke(ctx, "/hypersign.ssi.v1.Msg/DeactivateDID", in, out, opts...) if err != nil { return nil, err } return out, nil } -func (c *msgClient) CreateSchema(ctx context.Context, in *MsgCreateSchema, opts ...grpc.CallOption) (*MsgCreateSchemaResponse, error) { - out := new(MsgCreateSchemaResponse) - err := c.cc.Invoke(ctx, "/hypersignprotocol.hidnode.ssi.Msg/CreateSchema", in, out, opts...) +func (c *msgClient) RegisterCredentialSchema(ctx context.Context, in *MsgRegisterCredentialSchema, opts ...grpc.CallOption) (*MsgRegisterCredentialSchemaResponse, error) { + out := new(MsgRegisterCredentialSchemaResponse) + err := c.cc.Invoke(ctx, "/hypersign.ssi.v1.Msg/RegisterCredentialSchema", in, out, opts...) if err != nil { return nil, err } return out, nil } -func (c *msgClient) DeactivateDID(ctx context.Context, in *MsgDeactivateDID, opts ...grpc.CallOption) (*MsgDeactivateDIDResponse, error) { - out := new(MsgDeactivateDIDResponse) - err := c.cc.Invoke(ctx, "/hypersignprotocol.hidnode.ssi.Msg/DeactivateDID", in, out, opts...) +func (c *msgClient) UpdateCredentialSchema(ctx context.Context, in *MsgUpdateCredentialSchema, opts ...grpc.CallOption) (*MsgUpdateCredentialSchemaResponse, error) { + out := new(MsgUpdateCredentialSchemaResponse) + err := c.cc.Invoke(ctx, "/hypersign.ssi.v1.Msg/UpdateCredentialSchema", in, out, opts...) if err != nil { return nil, err } @@ -704,7 +853,16 @@ func (c *msgClient) DeactivateDID(ctx context.Context, in *MsgDeactivateDID, opt func (c *msgClient) RegisterCredentialStatus(ctx context.Context, in *MsgRegisterCredentialStatus, opts ...grpc.CallOption) (*MsgRegisterCredentialStatusResponse, error) { out := new(MsgRegisterCredentialStatusResponse) - err := c.cc.Invoke(ctx, "/hypersignprotocol.hidnode.ssi.Msg/RegisterCredentialStatus", in, out, opts...) + err := c.cc.Invoke(ctx, "/hypersign.ssi.v1.Msg/RegisterCredentialStatus", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) UpdateCredentialStatus(ctx context.Context, in *MsgUpdateCredentialStatus, opts ...grpc.CallOption) (*MsgUpdateCredentialStatusResponse, error) { + out := new(MsgUpdateCredentialStatusResponse) + err := c.cc.Invoke(ctx, "/hypersign.ssi.v1.Msg/UpdateCredentialStatus", in, out, opts...) if err != nil { return nil, err } @@ -713,51 +871,59 @@ func (c *msgClient) RegisterCredentialStatus(ctx context.Context, in *MsgRegiste // MsgServer is the server API for Msg service. type MsgServer interface { - CreateDID(context.Context, *MsgCreateDID) (*MsgCreateDIDResponse, error) + RegisterDID(context.Context, *MsgRegisterDID) (*MsgRegisterDIDResponse, error) UpdateDID(context.Context, *MsgUpdateDID) (*MsgUpdateDIDResponse, error) - CreateSchema(context.Context, *MsgCreateSchema) (*MsgCreateSchemaResponse, error) DeactivateDID(context.Context, *MsgDeactivateDID) (*MsgDeactivateDIDResponse, error) + RegisterCredentialSchema(context.Context, *MsgRegisterCredentialSchema) (*MsgRegisterCredentialSchemaResponse, error) + UpdateCredentialSchema(context.Context, *MsgUpdateCredentialSchema) (*MsgUpdateCredentialSchemaResponse, error) RegisterCredentialStatus(context.Context, *MsgRegisterCredentialStatus) (*MsgRegisterCredentialStatusResponse, error) + UpdateCredentialStatus(context.Context, *MsgUpdateCredentialStatus) (*MsgUpdateCredentialStatusResponse, error) } // UnimplementedMsgServer can be embedded to have forward compatible implementations. type UnimplementedMsgServer struct { } -func (*UnimplementedMsgServer) CreateDID(ctx context.Context, req *MsgCreateDID) (*MsgCreateDIDResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method CreateDID not implemented") +func (*UnimplementedMsgServer) RegisterDID(ctx context.Context, req *MsgRegisterDID) (*MsgRegisterDIDResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method RegisterDID not implemented") } func (*UnimplementedMsgServer) UpdateDID(ctx context.Context, req *MsgUpdateDID) (*MsgUpdateDIDResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method UpdateDID not implemented") } -func (*UnimplementedMsgServer) CreateSchema(ctx context.Context, req *MsgCreateSchema) (*MsgCreateSchemaResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method CreateSchema not implemented") -} func (*UnimplementedMsgServer) DeactivateDID(ctx context.Context, req *MsgDeactivateDID) (*MsgDeactivateDIDResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method DeactivateDID not implemented") } +func (*UnimplementedMsgServer) RegisterCredentialSchema(ctx context.Context, req *MsgRegisterCredentialSchema) (*MsgRegisterCredentialSchemaResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method RegisterCredentialSchema not implemented") +} +func (*UnimplementedMsgServer) UpdateCredentialSchema(ctx context.Context, req *MsgUpdateCredentialSchema) (*MsgUpdateCredentialSchemaResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateCredentialSchema not implemented") +} func (*UnimplementedMsgServer) RegisterCredentialStatus(ctx context.Context, req *MsgRegisterCredentialStatus) (*MsgRegisterCredentialStatusResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method RegisterCredentialStatus not implemented") } +func (*UnimplementedMsgServer) UpdateCredentialStatus(ctx context.Context, req *MsgUpdateCredentialStatus) (*MsgUpdateCredentialStatusResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateCredentialStatus not implemented") +} func RegisterMsgServer(s grpc1.Server, srv MsgServer) { s.RegisterService(&_Msg_serviceDesc, srv) } -func _Msg_CreateDID_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgCreateDID) +func _Msg_RegisterDID_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgRegisterDID) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(MsgServer).CreateDID(ctx, in) + return srv.(MsgServer).RegisterDID(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/hypersignprotocol.hidnode.ssi.Msg/CreateDID", + FullMethod: "/hypersign.ssi.v1.Msg/RegisterDID", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).CreateDID(ctx, req.(*MsgCreateDID)) + return srv.(MsgServer).RegisterDID(ctx, req.(*MsgRegisterDID)) } return interceptor(ctx, in, info, handler) } @@ -772,7 +938,7 @@ func _Msg_UpdateDID_Handler(srv interface{}, ctx context.Context, dec func(inter } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/hypersignprotocol.hidnode.ssi.Msg/UpdateDID", + FullMethod: "/hypersign.ssi.v1.Msg/UpdateDID", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(MsgServer).UpdateDID(ctx, req.(*MsgUpdateDID)) @@ -780,38 +946,56 @@ func _Msg_UpdateDID_Handler(srv interface{}, ctx context.Context, dec func(inter return interceptor(ctx, in, info, handler) } -func _Msg_CreateSchema_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgCreateSchema) +func _Msg_DeactivateDID_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgDeactivateDID) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(MsgServer).CreateSchema(ctx, in) + return srv.(MsgServer).DeactivateDID(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/hypersignprotocol.hidnode.ssi.Msg/CreateSchema", + FullMethod: "/hypersign.ssi.v1.Msg/DeactivateDID", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).CreateSchema(ctx, req.(*MsgCreateSchema)) + return srv.(MsgServer).DeactivateDID(ctx, req.(*MsgDeactivateDID)) } return interceptor(ctx, in, info, handler) } -func _Msg_DeactivateDID_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgDeactivateDID) +func _Msg_RegisterCredentialSchema_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgRegisterCredentialSchema) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(MsgServer).DeactivateDID(ctx, in) + return srv.(MsgServer).RegisterCredentialSchema(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/hypersignprotocol.hidnode.ssi.Msg/DeactivateDID", + FullMethod: "/hypersign.ssi.v1.Msg/RegisterCredentialSchema", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).DeactivateDID(ctx, req.(*MsgDeactivateDID)) + return srv.(MsgServer).RegisterCredentialSchema(ctx, req.(*MsgRegisterCredentialSchema)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_UpdateCredentialSchema_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgUpdateCredentialSchema) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).UpdateCredentialSchema(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/hypersign.ssi.v1.Msg/UpdateCredentialSchema", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).UpdateCredentialSchema(ctx, req.(*MsgUpdateCredentialSchema)) } return interceptor(ctx, in, info, handler) } @@ -826,7 +1010,7 @@ func _Msg_RegisterCredentialStatus_Handler(srv interface{}, ctx context.Context, } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/hypersignprotocol.hidnode.ssi.Msg/RegisterCredentialStatus", + FullMethod: "/hypersign.ssi.v1.Msg/RegisterCredentialStatus", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(MsgServer).RegisterCredentialStatus(ctx, req.(*MsgRegisterCredentialStatus)) @@ -834,36 +1018,62 @@ func _Msg_RegisterCredentialStatus_Handler(srv interface{}, ctx context.Context, return interceptor(ctx, in, info, handler) } -var _Msg_serviceDesc = grpc.ServiceDesc{ - ServiceName: "hypersignprotocol.hidnode.ssi.Msg", - HandlerType: (*MsgServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "CreateDID", - Handler: _Msg_CreateDID_Handler, - }, - { - MethodName: "UpdateDID", - Handler: _Msg_UpdateDID_Handler, +func _Msg_UpdateCredentialStatus_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgUpdateCredentialStatus) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).UpdateCredentialStatus(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/hypersign.ssi.v1.Msg/UpdateCredentialStatus", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).UpdateCredentialStatus(ctx, req.(*MsgUpdateCredentialStatus)) + } + return interceptor(ctx, in, info, handler) +} + +var _Msg_serviceDesc = grpc.ServiceDesc{ + ServiceName: "hypersign.ssi.v1.Msg", + HandlerType: (*MsgServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "RegisterDID", + Handler: _Msg_RegisterDID_Handler, }, { - MethodName: "CreateSchema", - Handler: _Msg_CreateSchema_Handler, + MethodName: "UpdateDID", + Handler: _Msg_UpdateDID_Handler, }, { MethodName: "DeactivateDID", Handler: _Msg_DeactivateDID_Handler, }, + { + MethodName: "RegisterCredentialSchema", + Handler: _Msg_RegisterCredentialSchema_Handler, + }, + { + MethodName: "UpdateCredentialSchema", + Handler: _Msg_UpdateCredentialSchema_Handler, + }, { MethodName: "RegisterCredentialStatus", Handler: _Msg_RegisterCredentialStatus_Handler, }, + { + MethodName: "UpdateCredentialStatus", + Handler: _Msg_UpdateCredentialStatus_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "ssi/v1/tx.proto", } -func (m *MsgCreateDID) Marshal() (dAtA []byte, err error) { +func (m *MsgRegisterDID) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -873,27 +1083,27 @@ func (m *MsgCreateDID) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *MsgCreateDID) MarshalTo(dAtA []byte) (int, error) { +func (m *MsgRegisterDID) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MsgCreateDID) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *MsgRegisterDID) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if len(m.Creator) > 0 { - i -= len(m.Creator) - copy(dAtA[i:], m.Creator) - i = encodeVarintTx(dAtA, i, uint64(len(m.Creator))) + if len(m.TxAuthor) > 0 { + i -= len(m.TxAuthor) + copy(dAtA[i:], m.TxAuthor) + i = encodeVarintTx(dAtA, i, uint64(len(m.TxAuthor))) i-- dAtA[i] = 0x1a } - if len(m.Signatures) > 0 { - for iNdEx := len(m.Signatures) - 1; iNdEx >= 0; iNdEx-- { + if len(m.DidDocumentProofs) > 0 { + for iNdEx := len(m.DidDocumentProofs) - 1; iNdEx >= 0; iNdEx-- { { - size, err := m.Signatures[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + size, err := m.DidDocumentProofs[iNdEx].MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -904,9 +1114,9 @@ func (m *MsgCreateDID) MarshalToSizedBuffer(dAtA []byte) (int, error) { dAtA[i] = 0x12 } } - if m.DidDocString != nil { + if m.DidDocument != nil { { - size, err := m.DidDocString.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.DidDocument.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -919,7 +1129,7 @@ func (m *MsgCreateDID) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *MsgCreateDIDResponse) Marshal() (dAtA []byte, err error) { +func (m *MsgRegisterDIDResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -929,21 +1139,16 @@ func (m *MsgCreateDIDResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *MsgCreateDIDResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *MsgRegisterDIDResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MsgCreateDIDResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *MsgRegisterDIDResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if m.Id != 0 { - i = encodeVarintTx(dAtA, i, uint64(m.Id)) - i-- - dAtA[i] = 0x8 - } return len(dAtA) - i, nil } @@ -967,17 +1172,24 @@ func (m *MsgUpdateDID) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if len(m.Creator) > 0 { - i -= len(m.Creator) - copy(dAtA[i:], m.Creator) - i = encodeVarintTx(dAtA, i, uint64(len(m.Creator))) + if len(m.TxAuthor) > 0 { + i -= len(m.TxAuthor) + copy(dAtA[i:], m.TxAuthor) + i = encodeVarintTx(dAtA, i, uint64(len(m.TxAuthor))) i-- dAtA[i] = 0x22 } - if len(m.Signatures) > 0 { - for iNdEx := len(m.Signatures) - 1; iNdEx >= 0; iNdEx-- { + if len(m.VersionId) > 0 { + i -= len(m.VersionId) + copy(dAtA[i:], m.VersionId) + i = encodeVarintTx(dAtA, i, uint64(len(m.VersionId))) + i-- + dAtA[i] = 0x1a + } + if len(m.DidDocumentProofs) > 0 { + for iNdEx := len(m.DidDocumentProofs) - 1; iNdEx >= 0; iNdEx-- { { - size, err := m.Signatures[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + size, err := m.DidDocumentProofs[iNdEx].MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -985,19 +1197,12 @@ func (m *MsgUpdateDID) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintTx(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x1a + dAtA[i] = 0x12 } } - if len(m.VersionId) > 0 { - i -= len(m.VersionId) - copy(dAtA[i:], m.VersionId) - i = encodeVarintTx(dAtA, i, uint64(len(m.VersionId))) - i-- - dAtA[i] = 0x12 - } - if m.DidDocString != nil { + if m.DidDocument != nil { { - size, err := m.DidDocString.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.DidDocument.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -1030,17 +1235,68 @@ func (m *MsgUpdateDIDResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if len(m.UpdateId) > 0 { - i -= len(m.UpdateId) - copy(dAtA[i:], m.UpdateId) - i = encodeVarintTx(dAtA, i, uint64(len(m.UpdateId))) + return len(dAtA) - i, nil +} + +func (m *MsgDeactivateDID) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgDeactivateDID) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgDeactivateDID) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.TxAuthor) > 0 { + i -= len(m.TxAuthor) + copy(dAtA[i:], m.TxAuthor) + i = encodeVarintTx(dAtA, i, uint64(len(m.TxAuthor))) + i-- + dAtA[i] = 0x22 + } + if len(m.VersionId) > 0 { + i -= len(m.VersionId) + copy(dAtA[i:], m.VersionId) + i = encodeVarintTx(dAtA, i, uint64(len(m.VersionId))) + i-- + dAtA[i] = 0x1a + } + if len(m.DidDocumentProofs) > 0 { + for iNdEx := len(m.DidDocumentProofs) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.DidDocumentProofs[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + if len(m.DidDocumentId) > 0 { + i -= len(m.DidDocumentId) + copy(dAtA[i:], m.DidDocumentId) + i = encodeVarintTx(dAtA, i, uint64(len(m.DidDocumentId))) i-- dAtA[i] = 0xa } return len(dAtA) - i, nil } -func (m *MsgCreateSchema) Marshal() (dAtA []byte, err error) { +func (m *MsgDeactivateDIDResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1050,31 +1306,49 @@ func (m *MsgCreateSchema) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *MsgCreateSchema) MarshalTo(dAtA []byte) (int, error) { +func (m *MsgDeactivateDIDResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MsgCreateSchema) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *MsgDeactivateDIDResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if m.ClientSpec != nil { - { - size, err := m.ClientSpec.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } + return len(dAtA) - i, nil +} + +func (m *MsgRegisterCredentialSchema) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgRegisterCredentialSchema) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgRegisterCredentialSchema) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.TxAuthor) > 0 { + i -= len(m.TxAuthor) + copy(dAtA[i:], m.TxAuthor) + i = encodeVarintTx(dAtA, i, uint64(len(m.TxAuthor))) i-- - dAtA[i] = 0x22 + dAtA[i] = 0x1a } - if m.SchemaProof != nil { + if m.CredentialSchemaProof != nil { { - size, err := m.SchemaProof.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.CredentialSchemaProof.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -1082,11 +1356,11 @@ func (m *MsgCreateSchema) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintTx(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x1a + dAtA[i] = 0x12 } - if m.SchemaDoc != nil { + if m.CredentialSchemaDocument != nil { { - size, err := m.SchemaDoc.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.CredentialSchemaDocument.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -1094,19 +1368,12 @@ func (m *MsgCreateSchema) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintTx(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x12 - } - if len(m.Creator) > 0 { - i -= len(m.Creator) - copy(dAtA[i:], m.Creator) - i = encodeVarintTx(dAtA, i, uint64(len(m.Creator))) - i-- dAtA[i] = 0xa } return len(dAtA) - i, nil } -func (m *MsgCreateSchemaResponse) Marshal() (dAtA []byte, err error) { +func (m *MsgRegisterCredentialSchemaResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1116,25 +1383,20 @@ func (m *MsgCreateSchemaResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *MsgCreateSchemaResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *MsgRegisterCredentialSchemaResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MsgCreateSchemaResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *MsgRegisterCredentialSchemaResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if m.Id != 0 { - i = encodeVarintTx(dAtA, i, uint64(m.Id)) - i-- - dAtA[i] = 0x8 - } return len(dAtA) - i, nil } -func (m *MsgDeactivateDID) Marshal() (dAtA []byte, err error) { +func (m *MsgUpdateCredentialSchema) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1144,55 +1406,51 @@ func (m *MsgDeactivateDID) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *MsgDeactivateDID) MarshalTo(dAtA []byte) (int, error) { +func (m *MsgUpdateCredentialSchema) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MsgDeactivateDID) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *MsgUpdateCredentialSchema) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if len(m.Signatures) > 0 { - for iNdEx := len(m.Signatures) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Signatures[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x22 - } - } - if len(m.VersionId) > 0 { - i -= len(m.VersionId) - copy(dAtA[i:], m.VersionId) - i = encodeVarintTx(dAtA, i, uint64(len(m.VersionId))) + if len(m.TxAuthor) > 0 { + i -= len(m.TxAuthor) + copy(dAtA[i:], m.TxAuthor) + i = encodeVarintTx(dAtA, i, uint64(len(m.TxAuthor))) i-- dAtA[i] = 0x1a } - if len(m.DidId) > 0 { - i -= len(m.DidId) - copy(dAtA[i:], m.DidId) - i = encodeVarintTx(dAtA, i, uint64(len(m.DidId))) + if m.CredentialSchemaProof != nil { + { + size, err := m.CredentialSchemaProof.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } i-- dAtA[i] = 0x12 } - if len(m.Creator) > 0 { - i -= len(m.Creator) - copy(dAtA[i:], m.Creator) - i = encodeVarintTx(dAtA, i, uint64(len(m.Creator))) + if m.CredentialSchemaDocument != nil { + { + size, err := m.CredentialSchemaDocument.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } i-- dAtA[i] = 0xa } return len(dAtA) - i, nil } -func (m *MsgDeactivateDIDResponse) Marshal() (dAtA []byte, err error) { +func (m *MsgUpdateCredentialSchemaResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1202,21 +1460,16 @@ func (m *MsgDeactivateDIDResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *MsgDeactivateDIDResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *MsgUpdateCredentialSchemaResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MsgDeactivateDIDResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *MsgUpdateCredentialSchemaResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if m.Id != 0 { - i = encodeVarintTx(dAtA, i, uint64(m.Id)) - i-- - dAtA[i] = 0x8 - } return len(dAtA) - i, nil } @@ -1240,9 +1493,16 @@ func (m *MsgRegisterCredentialStatus) MarshalToSizedBuffer(dAtA []byte) (int, er _ = i var l int _ = l - if m.ClientSpec != nil { + if len(m.TxAuthor) > 0 { + i -= len(m.TxAuthor) + copy(dAtA[i:], m.TxAuthor) + i = encodeVarintTx(dAtA, i, uint64(len(m.TxAuthor))) + i-- + dAtA[i] = 0x1a + } + if m.CredentialStatusProof != nil { { - size, err := m.ClientSpec.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.CredentialStatusProof.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -1250,11 +1510,11 @@ func (m *MsgRegisterCredentialStatus) MarshalToSizedBuffer(dAtA []byte) (int, er i = encodeVarintTx(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x22 + dAtA[i] = 0x12 } - if m.Proof != nil { + if m.CredentialStatusDocument != nil { { - size, err := m.Proof.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.CredentialStatusDocument.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -1262,11 +1522,64 @@ func (m *MsgRegisterCredentialStatus) MarshalToSizedBuffer(dAtA []byte) (int, er i = encodeVarintTx(dAtA, i, uint64(size)) } i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgRegisterCredentialStatusResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgRegisterCredentialStatusResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgRegisterCredentialStatusResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgUpdateCredentialStatus) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgUpdateCredentialStatus) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateCredentialStatus) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.TxAuthor) > 0 { + i -= len(m.TxAuthor) + copy(dAtA[i:], m.TxAuthor) + i = encodeVarintTx(dAtA, i, uint64(len(m.TxAuthor))) + i-- dAtA[i] = 0x1a } - if m.CredentialStatus != nil { + if m.CredentialStatusProof != nil { { - size, err := m.CredentialStatus.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.CredentialStatusProof.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -1276,17 +1589,22 @@ func (m *MsgRegisterCredentialStatus) MarshalToSizedBuffer(dAtA []byte) (int, er i-- dAtA[i] = 0x12 } - if len(m.Creator) > 0 { - i -= len(m.Creator) - copy(dAtA[i:], m.Creator) - i = encodeVarintTx(dAtA, i, uint64(len(m.Creator))) + if m.CredentialStatusDocument != nil { + { + size, err := m.CredentialStatusDocument.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } i-- dAtA[i] = 0xa } return len(dAtA) - i, nil } -func (m *MsgRegisterCredentialStatusResponse) Marshal() (dAtA []byte, err error) { +func (m *MsgUpdateCredentialStatusResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1296,21 +1614,16 @@ func (m *MsgRegisterCredentialStatusResponse) Marshal() (dAtA []byte, err error) return dAtA[:n], nil } -func (m *MsgRegisterCredentialStatusResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *MsgUpdateCredentialStatusResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MsgRegisterCredentialStatusResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *MsgUpdateCredentialStatusResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if m.Id != 0 { - i = encodeVarintTx(dAtA, i, uint64(m.Id)) - i-- - dAtA[i] = 0x8 - } return len(dAtA) - i, nil } @@ -1325,38 +1638,35 @@ func encodeVarintTx(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } -func (m *MsgCreateDID) Size() (n int) { +func (m *MsgRegisterDID) Size() (n int) { if m == nil { return 0 } var l int _ = l - if m.DidDocString != nil { - l = m.DidDocString.Size() + if m.DidDocument != nil { + l = m.DidDocument.Size() n += 1 + l + sovTx(uint64(l)) } - if len(m.Signatures) > 0 { - for _, e := range m.Signatures { + if len(m.DidDocumentProofs) > 0 { + for _, e := range m.DidDocumentProofs { l = e.Size() n += 1 + l + sovTx(uint64(l)) } } - l = len(m.Creator) + l = len(m.TxAuthor) if l > 0 { n += 1 + l + sovTx(uint64(l)) } return n } -func (m *MsgCreateDIDResponse) Size() (n int) { +func (m *MsgRegisterDIDResponse) Size() (n int) { if m == nil { return 0 } var l int _ = l - if m.Id != 0 { - n += 1 + sovTx(uint64(m.Id)) - } return n } @@ -1366,21 +1676,21 @@ func (m *MsgUpdateDID) Size() (n int) { } var l int _ = l - if m.DidDocString != nil { - l = m.DidDocString.Size() - n += 1 + l + sovTx(uint64(l)) - } - l = len(m.VersionId) - if l > 0 { + if m.DidDocument != nil { + l = m.DidDocument.Size() n += 1 + l + sovTx(uint64(l)) } - if len(m.Signatures) > 0 { - for _, e := range m.Signatures { + if len(m.DidDocumentProofs) > 0 { + for _, e := range m.DidDocumentProofs { l = e.Size() n += 1 + l + sovTx(uint64(l)) } } - l = len(m.Creator) + l = len(m.VersionId) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.TxAuthor) if l > 0 { n += 1 + l + sovTx(uint64(l)) } @@ -1393,109 +1703,121 @@ func (m *MsgUpdateDIDResponse) Size() (n int) { } var l int _ = l - l = len(m.UpdateId) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } return n } -func (m *MsgCreateSchema) Size() (n int) { +func (m *MsgDeactivateDID) Size() (n int) { if m == nil { return 0 } var l int _ = l - l = len(m.Creator) + l = len(m.DidDocumentId) if l > 0 { n += 1 + l + sovTx(uint64(l)) } - if m.SchemaDoc != nil { - l = m.SchemaDoc.Size() - n += 1 + l + sovTx(uint64(l)) + if len(m.DidDocumentProofs) > 0 { + for _, e := range m.DidDocumentProofs { + l = e.Size() + n += 1 + l + sovTx(uint64(l)) + } } - if m.SchemaProof != nil { - l = m.SchemaProof.Size() + l = len(m.VersionId) + if l > 0 { n += 1 + l + sovTx(uint64(l)) } - if m.ClientSpec != nil { - l = m.ClientSpec.Size() + l = len(m.TxAuthor) + if l > 0 { n += 1 + l + sovTx(uint64(l)) } return n } -func (m *MsgCreateSchemaResponse) Size() (n int) { +func (m *MsgDeactivateDIDResponse) Size() (n int) { if m == nil { return 0 } var l int _ = l - if m.Id != 0 { - n += 1 + sovTx(uint64(m.Id)) - } return n } -func (m *MsgDeactivateDID) Size() (n int) { +func (m *MsgRegisterCredentialSchema) Size() (n int) { if m == nil { return 0 } var l int _ = l - l = len(m.Creator) - if l > 0 { + if m.CredentialSchemaDocument != nil { + l = m.CredentialSchemaDocument.Size() n += 1 + l + sovTx(uint64(l)) } - l = len(m.DidId) - if l > 0 { + if m.CredentialSchemaProof != nil { + l = m.CredentialSchemaProof.Size() n += 1 + l + sovTx(uint64(l)) } - l = len(m.VersionId) + l = len(m.TxAuthor) if l > 0 { n += 1 + l + sovTx(uint64(l)) } - if len(m.Signatures) > 0 { - for _, e := range m.Signatures { - l = e.Size() - n += 1 + l + sovTx(uint64(l)) - } - } return n } -func (m *MsgDeactivateDIDResponse) Size() (n int) { +func (m *MsgRegisterCredentialSchemaResponse) Size() (n int) { if m == nil { return 0 } var l int _ = l - if m.Id != 0 { - n += 1 + sovTx(uint64(m.Id)) - } return n } -func (m *MsgRegisterCredentialStatus) Size() (n int) { +func (m *MsgUpdateCredentialSchema) Size() (n int) { if m == nil { return 0 } var l int _ = l - l = len(m.Creator) + if m.CredentialSchemaDocument != nil { + l = m.CredentialSchemaDocument.Size() + n += 1 + l + sovTx(uint64(l)) + } + if m.CredentialSchemaProof != nil { + l = m.CredentialSchemaProof.Size() + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.TxAuthor) if l > 0 { n += 1 + l + sovTx(uint64(l)) } - if m.CredentialStatus != nil { - l = m.CredentialStatus.Size() + return n +} + +func (m *MsgUpdateCredentialSchemaResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgRegisterCredentialStatus) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.CredentialStatusDocument != nil { + l = m.CredentialStatusDocument.Size() n += 1 + l + sovTx(uint64(l)) } - if m.Proof != nil { - l = m.Proof.Size() + if m.CredentialStatusProof != nil { + l = m.CredentialStatusProof.Size() n += 1 + l + sovTx(uint64(l)) } - if m.ClientSpec != nil { - l = m.ClientSpec.Size() + l = len(m.TxAuthor) + if l > 0 { n += 1 + l + sovTx(uint64(l)) } return n @@ -1507,9 +1829,36 @@ func (m *MsgRegisterCredentialStatusResponse) Size() (n int) { } var l int _ = l - if m.Id != 0 { - n += 1 + sovTx(uint64(m.Id)) + return n +} + +func (m *MsgUpdateCredentialStatus) Size() (n int) { + if m == nil { + return 0 } + var l int + _ = l + if m.CredentialStatusDocument != nil { + l = m.CredentialStatusDocument.Size() + n += 1 + l + sovTx(uint64(l)) + } + if m.CredentialStatusProof != nil { + l = m.CredentialStatusProof.Size() + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.TxAuthor) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgUpdateCredentialStatusResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l return n } @@ -1519,7 +1868,7 @@ func sovTx(x uint64) (n int) { func sozTx(x uint64) (n int) { return sovTx(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } -func (m *MsgCreateDID) Unmarshal(dAtA []byte) error { +func (m *MsgRegisterDID) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1542,15 +1891,15 @@ func (m *MsgCreateDID) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgCreateDID: wiretype end group for non-group") + return fmt.Errorf("proto: MsgRegisterDID: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgCreateDID: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgRegisterDID: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field DidDocString", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field DidDocument", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -1577,16 +1926,16 @@ func (m *MsgCreateDID) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.DidDocString == nil { - m.DidDocString = &Did{} + if m.DidDocument == nil { + m.DidDocument = &DidDocument{} } - if err := m.DidDocString.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.DidDocument.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Signatures", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field DidDocumentProofs", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -1613,14 +1962,14 @@ func (m *MsgCreateDID) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Signatures = append(m.Signatures, &SignInfo{}) - if err := m.Signatures[len(m.Signatures)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.DidDocumentProofs = append(m.DidDocumentProofs, &DocumentProof{}) + if err := m.DidDocumentProofs[len(m.DidDocumentProofs)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Creator", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field TxAuthor", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1648,7 +1997,7 @@ func (m *MsgCreateDID) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Creator = string(dAtA[iNdEx:postIndex]) + m.TxAuthor = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -1671,7 +2020,7 @@ func (m *MsgCreateDID) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgCreateDIDResponse) Unmarshal(dAtA []byte) error { +func (m *MsgRegisterDIDResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1694,17 +2043,103 @@ func (m *MsgCreateDIDResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgCreateDIDResponse: wiretype end group for non-group") + return fmt.Errorf("proto: MsgRegisterDIDResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgCreateDIDResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgRegisterDIDResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgUpdateDID) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgUpdateDID: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateDID: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DidDocument", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.DidDocument == nil { + m.DidDocument = &DidDocument{} + } + if err := m.DidDocument.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DidDocumentProofs", wireType) } - m.Id = 0 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -1714,11 +2149,90 @@ func (m *MsgCreateDIDResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Id |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.DidDocumentProofs = append(m.DidDocumentProofs, &DocumentProof{}) + if err := m.DidDocumentProofs[len(m.DidDocumentProofs)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field VersionId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.VersionId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TxAuthor", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.TxAuthor = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipTx(dAtA[iNdEx:]) @@ -1740,7 +2254,7 @@ func (m *MsgCreateDIDResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgUpdateDID) Unmarshal(dAtA []byte) error { +func (m *MsgUpdateDIDResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1763,15 +2277,97 @@ func (m *MsgUpdateDID) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgUpdateDID: wiretype end group for non-group") + return fmt.Errorf("proto: MsgUpdateDIDResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgUpdateDID: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgUpdateDIDResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgDeactivateDID) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgDeactivateDID: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgDeactivateDID: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field DidDocString", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field DidDocumentId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.DidDocumentId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DidDocumentProofs", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -1798,14 +2394,12 @@ func (m *MsgUpdateDID) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.DidDocString == nil { - m.DidDocString = &Did{} - } - if err := m.DidDocString.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.DidDocumentProofs = append(m.DidDocumentProofs, &DocumentProof{}) + if err := m.DidDocumentProofs[len(m.DidDocumentProofs)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex - case 2: + case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field VersionId", wireType) } @@ -1828,18 +2422,186 @@ func (m *MsgUpdateDID) Unmarshal(dAtA []byte) error { if intStringLen < 0 { return ErrInvalidLengthTx } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.VersionId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TxAuthor", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.TxAuthor = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgDeactivateDIDResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgDeactivateDIDResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgDeactivateDIDResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgRegisterCredentialSchema) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgRegisterCredentialSchema: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgRegisterCredentialSchema: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CredentialSchemaDocument", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthTx } if postIndex > l { return io.ErrUnexpectedEOF } - m.VersionId = string(dAtA[iNdEx:postIndex]) + if m.CredentialSchemaDocument == nil { + m.CredentialSchemaDocument = &CredentialSchemaDocument{} + } + if err := m.CredentialSchemaDocument.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex - case 3: + case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Signatures", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field CredentialSchemaProof", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -1866,14 +2628,16 @@ func (m *MsgUpdateDID) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Signatures = append(m.Signatures, &SignInfo{}) - if err := m.Signatures[len(m.Signatures)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if m.CredentialSchemaProof == nil { + m.CredentialSchemaProof = &DocumentProof{} + } + if err := m.CredentialSchemaProof.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex - case 4: + case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Creator", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field TxAuthor", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1901,7 +2665,7 @@ func (m *MsgUpdateDID) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Creator = string(dAtA[iNdEx:postIndex]) + m.TxAuthor = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -1924,7 +2688,7 @@ func (m *MsgUpdateDID) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgUpdateDIDResponse) Unmarshal(dAtA []byte) error { +func (m *MsgRegisterCredentialSchemaResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1947,44 +2711,12 @@ func (m *MsgUpdateDIDResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgUpdateDIDResponse: wiretype end group for non-group") + return fmt.Errorf("proto: MsgRegisterCredentialSchemaResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgUpdateDIDResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgRegisterCredentialSchemaResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field UpdateId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.UpdateId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipTx(dAtA[iNdEx:]) @@ -2006,7 +2738,7 @@ func (m *MsgUpdateDIDResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgCreateSchema) Unmarshal(dAtA []byte) error { +func (m *MsgUpdateCredentialSchema) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2029,47 +2761,15 @@ func (m *MsgCreateSchema) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgCreateSchema: wiretype end group for non-group") + return fmt.Errorf("proto: MsgUpdateCredentialSchema: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgCreateSchema: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgUpdateCredentialSchema: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Creator", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Creator = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field SchemaDoc", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field CredentialSchemaDocument", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -2096,16 +2796,16 @@ func (m *MsgCreateSchema) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.SchemaDoc == nil { - m.SchemaDoc = &SchemaDocument{} + if m.CredentialSchemaDocument == nil { + m.CredentialSchemaDocument = &CredentialSchemaDocument{} } - if err := m.SchemaDoc.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.CredentialSchemaDocument.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex - case 3: + case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field SchemaProof", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field CredentialSchemaProof", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -2132,18 +2832,18 @@ func (m *MsgCreateSchema) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.SchemaProof == nil { - m.SchemaProof = &SchemaProof{} + if m.CredentialSchemaProof == nil { + m.CredentialSchemaProof = &DocumentProof{} } - if err := m.SchemaProof.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.CredentialSchemaProof.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex - case 4: + case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ClientSpec", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field TxAuthor", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -2153,27 +2853,23 @@ func (m *MsgCreateSchema) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthTx } - postIndex := iNdEx + msglen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthTx } if postIndex > l { return io.ErrUnexpectedEOF } - if m.ClientSpec == nil { - m.ClientSpec = &ClientSpec{} - } - if err := m.ClientSpec.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } + m.TxAuthor = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -2196,7 +2892,7 @@ func (m *MsgCreateSchema) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgCreateSchemaResponse) Unmarshal(dAtA []byte) error { +func (m *MsgUpdateCredentialSchemaResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2219,31 +2915,12 @@ func (m *MsgCreateSchemaResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgCreateSchemaResponse: wiretype end group for non-group") + return fmt.Errorf("proto: MsgUpdateCredentialSchemaResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgCreateSchemaResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgUpdateCredentialSchemaResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) - } - m.Id = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Id |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } default: iNdEx = preIndex skippy, err := skipTx(dAtA[iNdEx:]) @@ -2265,7 +2942,7 @@ func (m *MsgCreateSchemaResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgDeactivateDID) Unmarshal(dAtA []byte) error { +func (m *MsgRegisterCredentialStatus) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2288,17 +2965,17 @@ func (m *MsgDeactivateDID) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgDeactivateDID: wiretype end group for non-group") + return fmt.Errorf("proto: MsgRegisterCredentialStatus: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgDeactivateDID: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgRegisterCredentialStatus: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Creator", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field CredentialStatusDocument", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -2308,29 +2985,33 @@ func (m *MsgDeactivateDID) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthTx } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthTx } if postIndex > l { return io.ErrUnexpectedEOF } - m.Creator = string(dAtA[iNdEx:postIndex]) + if m.CredentialStatusDocument == nil { + m.CredentialStatusDocument = &CredentialStatusDocument{} + } + if err := m.CredentialStatusDocument.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field DidId", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field CredentialStatusProof", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -2340,27 +3021,31 @@ func (m *MsgDeactivateDID) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthTx } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthTx } if postIndex > l { return io.ErrUnexpectedEOF } - m.DidId = string(dAtA[iNdEx:postIndex]) + if m.CredentialStatusProof == nil { + m.CredentialStatusProof = &DocumentProof{} + } + if err := m.CredentialStatusProof.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field VersionId", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field TxAuthor", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -2388,41 +3073,7 @@ func (m *MsgDeactivateDID) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.VersionId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Signatures", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Signatures = append(m.Signatures, &SignInfo{}) - if err := m.Signatures[len(m.Signatures)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } + m.TxAuthor = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -2445,7 +3096,7 @@ func (m *MsgDeactivateDID) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgDeactivateDIDResponse) Unmarshal(dAtA []byte) error { +func (m *MsgRegisterCredentialStatusResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2468,31 +3119,12 @@ func (m *MsgDeactivateDIDResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgDeactivateDIDResponse: wiretype end group for non-group") + return fmt.Errorf("proto: MsgRegisterCredentialStatusResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgDeactivateDIDResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgRegisterCredentialStatusResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) - } - m.Id = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Id |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } default: iNdEx = preIndex skippy, err := skipTx(dAtA[iNdEx:]) @@ -2514,7 +3146,7 @@ func (m *MsgDeactivateDIDResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgRegisterCredentialStatus) Unmarshal(dAtA []byte) error { +func (m *MsgUpdateCredentialStatus) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2537,47 +3169,15 @@ func (m *MsgRegisterCredentialStatus) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgRegisterCredentialStatus: wiretype end group for non-group") + return fmt.Errorf("proto: MsgUpdateCredentialStatus: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgRegisterCredentialStatus: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgUpdateCredentialStatus: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Creator", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Creator = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field CredentialStatus", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field CredentialStatusDocument", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -2604,16 +3204,16 @@ func (m *MsgRegisterCredentialStatus) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.CredentialStatus == nil { - m.CredentialStatus = &CredentialStatus{} + if m.CredentialStatusDocument == nil { + m.CredentialStatusDocument = &CredentialStatusDocument{} } - if err := m.CredentialStatus.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.CredentialStatusDocument.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex - case 3: + case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Proof", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field CredentialStatusProof", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -2640,18 +3240,18 @@ func (m *MsgRegisterCredentialStatus) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.Proof == nil { - m.Proof = &CredentialProof{} + if m.CredentialStatusProof == nil { + m.CredentialStatusProof = &DocumentProof{} } - if err := m.Proof.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.CredentialStatusProof.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex - case 4: + case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ClientSpec", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field TxAuthor", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -2661,27 +3261,23 @@ func (m *MsgRegisterCredentialStatus) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthTx } - postIndex := iNdEx + msglen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthTx } if postIndex > l { return io.ErrUnexpectedEOF } - if m.ClientSpec == nil { - m.ClientSpec = &ClientSpec{} - } - if err := m.ClientSpec.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } + m.TxAuthor = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -2704,7 +3300,7 @@ func (m *MsgRegisterCredentialStatus) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgRegisterCredentialStatusResponse) Unmarshal(dAtA []byte) error { +func (m *MsgUpdateCredentialStatusResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2727,31 +3323,12 @@ func (m *MsgRegisterCredentialStatusResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgRegisterCredentialStatusResponse: wiretype end group for non-group") + return fmt.Errorf("proto: MsgUpdateCredentialStatusResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgRegisterCredentialStatusResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgUpdateCredentialStatusResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) - } - m.Id = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Id |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } default: iNdEx = preIndex skippy, err := skipTx(dAtA[iNdEx:]) diff --git a/x/ssi/types/utils.go b/x/ssi/types/utils.go index 224e3e1..39bdbf0 100644 --- a/x/ssi/types/utils.go +++ b/x/ssi/types/utils.go @@ -38,16 +38,6 @@ func GetUniqueElements(list []string) []string { return uniqueList } -// FindInSlice checks if an element is present in the list -func FindInSlice(list []string, element string) bool { - for _, x := range list { - if x == element { - return true - } - } - return false -} - // checkDuplicateItems return a duplicate Id from the list, if found func checkDuplicateItems(list []string) string { presentMap := map[string]bool{} diff --git a/x/ssi/utils/utils.go b/x/ssi/utils/utils.go new file mode 100644 index 0000000..34b4bef --- /dev/null +++ b/x/ssi/utils/utils.go @@ -0,0 +1,11 @@ +package utils + +// FindInSlice checks if an element is present in a Slice +func FindInSlice(slice []string, elementToFind string) bool { + for _, elem := range slice { + if elem == elementToFind { + return true + } + } + return false +} \ No newline at end of file diff --git a/x/ssi/verification/client_spec.go b/x/ssi/verification/client_spec.go index 2ed7c09..bdb020a 100644 --- a/x/ssi/verification/client_spec.go +++ b/x/ssi/verification/client_spec.go @@ -12,7 +12,7 @@ import ( // Read more about Cosmos's ADR Spec from the following: // https://docs.cosmos.network/v0.45/architecture/adr-036-arbitrary-signature.html -func getCosmosADR036SignDocBytes(ssiDocBytes []byte, clientSpec *types.ClientSpec) ([]byte, error) { +func getCosmosADR036SignDocBytes(ssiDocBytes []byte, signerAddress string) ([]byte, error) { var msgSignData types.Msg = types.Msg{ Type: "sign/MsgSignData", Value: types.Val{ @@ -37,7 +37,7 @@ func getCosmosADR036SignDocBytes(ssiDocBytes []byte, clientSpec *types.ClientSpe baseCosmosADR036SignDoc.Msgs[0].Value.Data = base64.StdEncoding.EncodeToString( ssiDocBytes) - baseCosmosADR036SignDoc.Msgs[0].Value.Signer = clientSpec.Adr036SignerAddress + baseCosmosADR036SignDoc.Msgs[0].Value.Signer = signerAddress updatedSignDocBytes, err := json.Marshal(baseCosmosADR036SignDoc) if err != nil { @@ -54,48 +54,46 @@ func getPersonalSignSpecDocBytes(ssiMsg types.SsiMsg) ([]byte, error) { // Get the updated marshaled SSI document for the respective ClientSpec func getDocBytesByClientSpec(ssiMsg types.SsiMsg, extendedVm *types.ExtendedVerificationMethod) ([]byte, error) { - if extendedVm.ClientSpec != nil { - switch extendedVm.ClientSpec.Type { - case types.ADR036ClientSpec: - if didDoc, ok := ssiMsg.(*types.Did); ok { - canonizedDidDocHash, err := ldcontext.EcdsaSecp256k1Signature2019Canonize(didDoc) - if err != nil { - return nil, err - } + switch extendedVm.ClientSpecType { + case types.CLIENT_SPEC_TYPE_NONE: + if didDoc, ok := ssiMsg.(*types.DidDocument); ok && len(didDoc.Context) > 0 { + return ldcontext.NormalizeByVerificationMethodType(didDoc, extendedVm.Type) + } + return ssiMsg.GetSignBytes(), nil + case types.CLIENT_SPEC_TYPE_COSMOS_ADR036: + signerAddress, err := getBlockchainAddress(extendedVm.BlockchainAccountId) + if err != nil { + return nil, err + } - return getCosmosADR036SignDocBytes(canonizedDidDocHash, extendedVm.ClientSpec) + if didDoc, ok := ssiMsg.(*types.DidDocument); ok && len(didDoc.Context) > 0 { + canonizedDidDocHash, err := ldcontext.EcdsaSecp256k1Signature2019Canonize(didDoc) + if err != nil { + return nil, err } - return getCosmosADR036SignDocBytes(ssiMsg.GetSignBytes(), extendedVm.ClientSpec) - case types.PersonalSignClientSpec: - if didDoc, ok := ssiMsg.(*types.Did); ok { - canonizedDidDocHash, err := ldcontext.EcdsaSecp256k1RecoverySignature2020Canonize(didDoc) - if err != nil { - return nil, err - } - // TODO: This is temporary fix eth.personal.sign() client function, since it only signs JSON - // stringified document and hence the following struct was used to sign from the Client end. - return json.Marshal(struct{ - DidId string `json:"didId"` - DidDocDigest string `json:"didDocDigest"` - } { - DidId: didDoc.Id, - DidDocDigest: hex.EncodeToString(canonizedDidDocHash), - }) - } - return getPersonalSignSpecDocBytes(ssiMsg) - default: - return nil, fmt.Errorf( - "supported clientSpecs: %v", - types.SupportedClientSpecs, - ) + return getCosmosADR036SignDocBytes(canonizedDidDocHash, signerAddress) } - } else { - // If DID Document, perform RDF normalisation and return its SHA-256 Hash - didDoc, ok := ssiMsg.(*types.Did) - if ok { - return ldcontext.NormalizeByVerificationMethodType(didDoc, extendedVm.Type) + return getCosmosADR036SignDocBytes(ssiMsg.GetSignBytes(), signerAddress) + case types.CLIENT_SPEC_TYPE_ETH_PERSONAL_SIGN: + if didDoc, ok := ssiMsg.(*types.DidDocument); ok && len(didDoc.Context) > 0 { + canonizedDidDocHash, err := ldcontext.EcdsaSecp256k1RecoverySignature2020Canonize(didDoc) + if err != nil { + return nil, err + } + + // TODO: This is temporary fix eth.personal.sign() client function, since it only signs JSON + // stringified document and hence the following struct was used to sign from the Client end. + return json.Marshal(struct{ + DidId string `json:"didId"` + DidDocDigest string `json:"didDocDigest"` + } { + DidId: didDoc.Id, + DidDocDigest: hex.EncodeToString(canonizedDidDocHash), + }) } - return ssiMsg.GetSignBytes(), nil + return getPersonalSignSpecDocBytes(ssiMsg) + default: + return nil, fmt.Errorf("unsupported clientSpecType %v", extendedVm.ClientSpecType) } } diff --git a/x/ssi/verification/credential_verification.go b/x/ssi/verification/credential_verification.go deleted file mode 100644 index 33e6cee..0000000 --- a/x/ssi/verification/credential_verification.go +++ /dev/null @@ -1,84 +0,0 @@ -package verification - -import ( - "fmt" - "regexp" - "time" - - "github.com/hypersign-protocol/hid-node/x/ssi/types" -) - -func VerifyCredentialHash(credHash string) bool { - var matchFound bool = false - var supportedCredentialHash map[string]string = map[string]string{ - "sha256": "[a-f0-9]{64}", - } - - for _, regexPattern := range supportedCredentialHash { - matchFound, _ = regexp.MatchString(regexPattern, credHash) - if matchFound { - return true - } - } - - return matchFound -} - -func VerifyCredentialStatusDates(issuanceDate time.Time, expirationDate time.Time) error { - var dateDiff int64 = int64(expirationDate.Sub(issuanceDate)) / 1e9 // converting nanoseconds to seconds - // Check if the expiration date predates the issuance date. - if dateDiff < 0 { - return fmt.Errorf( - "expiration date %s cannot be less than issuance date %s", - expirationDate, - issuanceDate, - ) - } - - return nil -} - -func VerifyCredentialProofDates(credProof *types.CredentialProof, credRegistration bool) error { - var dateDiff int64 - - proofCreatedDate := credProof.GetCreated() - proofCreatedDateParsed, err := time.Parse(time.RFC3339, proofCreatedDate) - if err != nil { - return fmt.Errorf( - "invalid created date format: %s", - proofCreatedDate, - ) - } - - proofUpdatedDate := credProof.GetUpdated() - proofUpdatedDateParsed, err := time.Parse(time.RFC3339, proofUpdatedDate) - if err != nil { - return fmt.Errorf( - "invalid created date format: %s", - proofUpdatedDate, - ) - } - - // If credRegistration is True, check for equity of updated and created dates will proceeed - // else, check for updated date being greater than created date will proceeed - if credRegistration { - if !proofUpdatedDateParsed.Equal(proofCreatedDateParsed) { - return fmt.Errorf( - "updated date %s should be similar to created date %s", - proofUpdatedDate, - proofCreatedDate, - ) - } - } else { - dateDiff = int64(proofUpdatedDateParsed.Sub(proofCreatedDateParsed)) / 1e9 // converting nanoseconds to seconds - if dateDiff <= 0 { - return fmt.Errorf( - "update date %s cannot be less than or equal to created date %s in case of credential status update", - proofUpdatedDate, - proofCreatedDate, - ) - } - } - - return nil -} diff --git a/x/ssi/verification/crypto.go b/x/ssi/verification/crypto.go index 1c8bb8e..c18ca5e 100644 --- a/x/ssi/verification/crypto.go +++ b/x/ssi/verification/crypto.go @@ -6,6 +6,7 @@ import ( "encoding/hex" "fmt" "math/big" + "golang.org/x/crypto/sha3" "github.com/hypersign-protocol/hid-node/x/ssi/types" @@ -59,25 +60,26 @@ func verify(extendedVm *types.ExtendedVerificationMethod, ssiMsg types.SsiMsg) e case types.Ed25519VerificationKey2020: return verifyEd25519Signature2020(extendedVm, docBytes) case types.EcdsaSecp256k1VerificationKey2019: - return verifyEcdsaSecp256k1Signature2019Key(extendedVm, docBytes) + return verifyEcdsaSecp256k1Signature2019(extendedVm, docBytes) case types.EcdsaSecp256k1RecoveryMethod2020: return verifyEcdsaSecp256k1RecoverySignature2020(extendedVm, docBytes) case types.X25519KeyAgreementKey2020: - return verifyX25519KeyAgreementKey2020Key(extendedVm) + return verifyX25519KeyAgreementKey2020(extendedVm) case types.X25519KeyAgreementKeyEIP5630: - return verifyX25519KeyAgreementKeyEIP5630Key(extendedVm) + return verifyX25519KeyAgreementKeyEIP5630(extendedVm) case types.Bls12381G2Key2020: return verifyBbsBlsSignature2020(extendedVm, docBytes) case types.BabyJubJubVerificationKey2023: - return verifyBabyJubJubVerificationKey2023Key(extendedVm, docBytes) + return verifyBabyJubJubSignature2023(extendedVm, docBytes) default: return fmt.Errorf("unsupported verification method: %s", extendedVm.Type) } } -func verifyBabyJubJubVerificationKey2023Key(extendedVm *types.ExtendedVerificationMethod, documentBytes []byte) error { +// verifyBabyJubJubSignature2023 verifies the verification key for verification method type BabyJubJubSignature2023 +func verifyBabyJubJubSignature2023(extendedVm *types.ExtendedVerificationMethod, documentBytes []byte) error { // Process siganture - signatureBytes, err := hex.DecodeString(extendedVm.Signature) + signatureBytes, err := hex.DecodeString(extendedVm.ProofValue) if err != nil { panic(err) } @@ -117,7 +119,7 @@ func verifyBabyJubJubVerificationKey2023Key(extendedVm *types.ExtendedVerificati if !publicKeyObj.VerifyPoseidon(msgBigInt, signatureObj) { return fmt.Errorf("signature could not be verified for verificationMethodId: %v", extendedVm.Id) } - + return nil } @@ -133,7 +135,7 @@ func verifyBbsBlsSignature2020(extendedVm *types.ExtendedVerificationMethod, doc } // Decode Signature to Bytes - sigBytes, err := base64.StdEncoding.DecodeString(extendedVm.Signature) + sigBytes, err := base64.StdEncoding.DecodeString(extendedVm.ProofValue) if err != nil { return err } @@ -175,7 +177,7 @@ func verifyEcdsaSecp256k1RecoverySignature2020(extendedVm *types.ExtendedVerific } } -// verifyEd25519Signature2020 verifies Ed25519Signature2020 signature using Ed25519VerificationKey2020 publicKeyMultibase +// verifyEd25519Signature2020 verifies Ed25519Signature2020 signature using Ed25519VerificationKey2020 publicKeyMultibase func verifyEd25519Signature2020(extendedVm *types.ExtendedVerificationMethod, documentBytes []byte) error { // Decode Public Key encoding, publicKeyBytes, err := multibase.Decode(extendedVm.PublicKeyMultibase) @@ -203,7 +205,7 @@ func verifyEd25519Signature2020(extendedVm *types.ExtendedVerificationMethod, do publicKeyBytes = publicKeyBytes[2:] // Decode Signatures - encoding, signatureBytes, err := multibase.Decode(extendedVm.Signature) + encoding, signatureBytes, err := multibase.Decode(extendedVm.ProofValue) if err != nil { return err } @@ -221,10 +223,10 @@ func verifyEd25519Signature2020(extendedVm *types.ExtendedVerificationMethod, do } } -// verifyEcdsaSecp256k1Signature2019Key verifies the verification key for verification method type EcdsaSecp256k1VerificationKey2019 -func verifyEcdsaSecp256k1Signature2019Key(extendedVm *types.ExtendedVerificationMethod, documentBytes []byte) error { +// verifyEcdsaSecp256k1Signature2019 verifies the verification key for verification method type EcdsaSecp256k1VerificationKey2019 +func verifyEcdsaSecp256k1Signature2019(extendedVm *types.ExtendedVerificationMethod, documentBytes []byte) error { // Decode and Parse Signature - signatureBytes, err := base64.StdEncoding.DecodeString(extendedVm.Signature) + signatureBytes, err := base64.StdEncoding.DecodeString(extendedVm.ProofValue) if err != nil { return err } @@ -331,7 +333,7 @@ func verifyEthereumBlockchainAccountId(extendedVm *types.ExtendedVerificationMet msgHash := etheraccounts.TextHash(documentBytes) // Decode hex-encoded signature string to bytes - signatureBytes, err := etherhexutil.Decode(extendedVm.Signature) + signatureBytes, err := etherhexutil.Decode(extendedVm.ProofValue) if err != nil { return err } @@ -358,8 +360,8 @@ func verifyEthereumBlockchainAccountId(extendedVm *types.ExtendedVerificationMet } } -// verifyX25519KeyAgreementKey2020Key verifies the verification key for verification method type X25519KeyAgreementKey2020 -func verifyX25519KeyAgreementKey2020Key(extendedVm *types.ExtendedVerificationMethod) error { +// verifyX25519KeyAgreementKey2020 verifies the verification key for verification method type X25519KeyAgreementKey2020 +func verifyX25519KeyAgreementKey2020(extendedVm *types.ExtendedVerificationMethod) error { _, _, err := multibase.Decode(extendedVm.PublicKeyMultibase) if err != nil { return fmt.Errorf( @@ -371,8 +373,8 @@ func verifyX25519KeyAgreementKey2020Key(extendedVm *types.ExtendedVerificationMe return nil } -// verifyX25519KeyAgreementKeyEIP5630Key verifies the verification key for verification method type X25519KeyAgreementKeyEIP5630 -func verifyX25519KeyAgreementKeyEIP5630Key(extendedVm *types.ExtendedVerificationMethod) error { +// verifyX25519KeyAgreementKeyEIP5630 verifies the verification key for verification method type X25519KeyAgreementKeyEIP5630 +func verifyX25519KeyAgreementKeyEIP5630(extendedVm *types.ExtendedVerificationMethod) error { _, _, err := multibase.Decode(extendedVm.PublicKeyMultibase) if err != nil { return fmt.Errorf( diff --git a/x/ssi/verification/signature_verification.go b/x/ssi/verification/signature_verification.go index e6c0340..ee9fb1c 100644 --- a/x/ssi/verification/signature_verification.go +++ b/x/ssi/verification/signature_verification.go @@ -43,8 +43,8 @@ func VerifySignatureOfAnyController( } // VerifyDocumentProofSignature verfies the proof of the SSI Document such as Credential Schema and Credential Status -func VerifyDocumentProofSignature(ssiMsg types.SsiMsg, vm *types.VerificationMethod, signInfo *types.SignInfo) error { - vmExtended := types.CreateExtendedVerificationMethod(vm, signInfo) +func VerifyDocumentProofSignature(ssiMsg types.SsiMsg, vm *types.VerificationMethod, documentProof *types.DocumentProof) error { + vmExtended := types.CreateExtendedVerificationMethod(vm, documentProof) if err := verify(vmExtended, ssiMsg); err != nil { return err } diff --git a/x/ssi/verification/vars.go b/x/ssi/verification/vars.go index 5f44f11..6abf6c8 100644 --- a/x/ssi/verification/vars.go +++ b/x/ssi/verification/vars.go @@ -5,19 +5,3 @@ var ServiceTypes = []string{ } const DidMethod string = "hid" - -// Acceptable Credential Status. -// Ref: https://github.com/hypersign-protocol/hid-node/discussions/141#discussioncomment-2825349 -const ClaimStatus_live = "Live" -const ClaimStatus_suspended = "Suspended" -const ClaimStatus_revoked = "Revoked" -const ClaimStatus_expired = "Expired" - -func GetAcceptedCredentialClaimStatuses() []string { - return []string{ - ClaimStatus_live, - ClaimStatus_suspended, - ClaimStatus_revoked, - ClaimStatus_expired, - } -}