diff --git a/buf.yaml b/buf.yaml index fa814d08..5c252608 100644 --- a/buf.yaml +++ b/buf.yaml @@ -27,8 +27,6 @@ lint: - cosmos_proto - google - confio - # TODO: `did` is excluded to odey the W3C spec which uses camel-case, but I guess we can use snake-case. - - panacea/did breaking: use: - FILE diff --git a/proto/panacea/did/v2/did.proto b/proto/panacea/did/v2/did.proto index 86ba8723..758049a4 100644 --- a/proto/panacea/did/v2/did.proto +++ b/proto/panacea/did/v2/did.proto @@ -16,13 +16,13 @@ message DIDDocument { Strings contexts = 1 [json_name = "@context", (gogoproto.jsontag) = "@context", (gogoproto.customtype) = "JSONStringOrStrings"]; string id = 2; Strings controller = 3 [(gogoproto.customtype) = "JSONStringOrStrings"]; - repeated VerificationMethod verificationMethods = 4 [json_name = "verificationMethod", (gogoproto.jsontag) = "verificationMethod,omitempty"]; + repeated VerificationMethod verification_methods = 4 [json_name = "verificationMethod", (gogoproto.jsontag) = "verificationMethod,omitempty"]; // TODO: the repeated gogoproto.customtype has an issue: https://github.com/gogo/protobuf/issues/478 repeated VerificationRelationship authentications = 5 [json_name = "authentication", (gogoproto.jsontag) = "authentication,omitempty", (gogoproto.customtype) = "VerificationRelationship"]; - repeated VerificationRelationship assertionMethods = 6 [json_name = "assertionMethod", (gogoproto.jsontag) = "assertionMethod,omitempty", (gogoproto.customtype) = "VerificationRelationship"]; - repeated VerificationRelationship keyAgreements = 7 [json_name = "keyAgreement", (gogoproto.jsontag) = "keyAgreement,omitempty", (gogoproto.customtype) = "VerificationRelationship"]; - repeated VerificationRelationship capabilityInvocations = 8 [json_name = "capabilityInvocation", (gogoproto.jsontag) = "capabilityInvocation,omitempty", (gogoproto.customtype) = "VerificationRelationship"]; - repeated VerificationRelationship capabilityDelegations = 9 [json_name = "capabilityDelegation", (gogoproto.jsontag) = "capabilityDelegation,omitempty", (gogoproto.customtype) = "VerificationRelationship"]; + repeated VerificationRelationship assertion_methods = 6 [json_name = "assertionMethod", (gogoproto.jsontag) = "assertionMethod,omitempty", (gogoproto.customtype) = "VerificationRelationship"]; + repeated VerificationRelationship key_agreements = 7 [json_name = "keyAgreement", (gogoproto.jsontag) = "keyAgreement,omitempty", (gogoproto.customtype) = "VerificationRelationship"]; + repeated VerificationRelationship capability_invocations = 8 [json_name = "capabilityInvocation", (gogoproto.jsontag) = "capabilityInvocation,omitempty", (gogoproto.customtype) = "VerificationRelationship"]; + repeated VerificationRelationship capability_delegations = 9 [json_name = "capabilityDelegation", (gogoproto.jsontag) = "capabilityDelegation,omitempty", (gogoproto.customtype) = "VerificationRelationship"]; repeated Service services = 10 [json_name = "service", (gogoproto.jsontag) = "service,omitempty"]; } @@ -31,11 +31,12 @@ message VerificationMethod { string id = 1; string type = 2; string controller = 3; - string pubKeyBase58 = 4 [json_name = "publicKeyBase58", (gogoproto.jsontag) = "publicKeyBase58"]; + string public_key_base58 = 4 [json_name = "publicKeyBase58", (gogoproto.jsontag) = "publicKeyBase58"]; } // VerificationRelationship defines a W3C verification relationship message VerificationRelationship { + // VerificationRelationship can be one of a single ID or a VerificationMethod. oneof content { string verification_method_id = 1; VerificationMethod verification_method = 2; @@ -46,17 +47,17 @@ message VerificationRelationship { message Service { string id = 1; string type = 2; - string serviceEndpoint = 3; + string service_endpoint = 3 [json_name = "serviceEndpoint", (gogoproto.jsontag) = "serviceEndpoint,omitempty"]; } // DIDDocumentWithSeq defines a message for DID Document with a sequence number for preventing replay attacks. message DIDDocumentWithSeq { DIDDocument document = 1; - uint64 seq = 2 [json_name = "sequence", (gogoproto.jsontag) = "sequence"]; + uint64 sequence = 2; } // DataWithSeq defines a message for data with a sequence number for preventing replay attacks. message DataWithSeq { bytes data = 1; - uint64 seq = 2; + uint64 sequence = 2; } diff --git a/proto/panacea/did/v2/query.proto b/proto/panacea/did/v2/query.proto index f39f08d2..b1551626 100644 --- a/proto/panacea/did/v2/query.proto +++ b/proto/panacea/did/v2/query.proto @@ -11,8 +11,8 @@ option go_package = "github.com/medibloc/panacea-core/x/did/types"; // Query defines the gRPC querier service. service Query { - // DIDDocumentWithSeq returns a DID Document with a sequence number. - rpc DIDDocumentWithSeq(QueryDIDRequest) returns (QueryDIDResponse) { + // DID returns a DID Document with a sequence number. + rpc DID(QueryDIDRequest) returns (QueryDIDResponse) { option (google.api.http).get = "/panacea/did/v2/dids/{did}"; } } diff --git a/x/did/client/cli/queryDID.go b/x/did/client/cli/queryDID.go index bfe6ad4a..d7830cdc 100644 --- a/x/did/client/cli/queryDID.go +++ b/x/did/client/cli/queryDID.go @@ -28,7 +28,7 @@ func CmdGetDID() *cobra.Command { Did: id, } - res, err := queryClient.DIDDocumentWithSeq(context.Background(), params) + res, err := queryClient.DID(context.Background(), params) if err != nil { return err diff --git a/x/did/client/cli/txDID.go b/x/did/client/cli/txDID.go index cb7ad304..2e1697fd 100644 --- a/x/did/client/cli/txDID.go +++ b/x/did/client/cli/txDID.go @@ -328,10 +328,10 @@ func signUsingCurrentSeq(clientCtx client.Context, did string, privKey crypto.Pr Did: did, } - res, err := queryClient.DIDDocumentWithSeq(context.Background(), params) + res, err := queryClient.DID(context.Background(), params) if err != nil { return []byte{}, err } - return types.Sign(data, res.DidDocumentWithSeq.Seq, privKey) + return types.Sign(data, res.DidDocumentWithSeq.Sequence, privKey) } diff --git a/x/did/client/cli/txDID_test.go b/x/did/client/cli/txDID_test.go index a1c9e04e..8f036847 100644 --- a/x/did/client/cli/txDID_test.go +++ b/x/did/client/cli/txDID_test.go @@ -41,7 +41,7 @@ func (suite txTestSuite) TestNewMsgCreateDID() { // check if verificationMethod is correct verificationMethod, _ := msg.Document.VerificationMethodByID(msg.VerificationMethodId) - pubKey, _ := secp256k1util.PubKeyFromBase58(verificationMethod.PubKeyBase58) + pubKey, _ := secp256k1util.PubKeyFromBase58(verificationMethod.PublicKeyBase58) suite.Require().Equal(privKey.PubKey(), pubKey) // check if the signature can be verifiable with the initial sequence @@ -126,7 +126,7 @@ func (suite txTestSuite) TestReadDIDDocOneContext() { suite.Require().Equal(1, len(doc.VerificationMethods)) suite.Require().Equal("did:panacea:27FnaDeQZApXhsRZZDARhWYs2nKFaw3p7evGd9zUSrBZ", doc.VerificationMethods[0].Controller) suite.Require().Equal("did:panacea:27FnaDeQZApXhsRZZDARhWYs2nKFaw3p7evGd9zUSrBZ#key1", doc.VerificationMethods[0].Id) - suite.Require().Equal("hfiFwEqzHPx3RbQBmkgg4UEMtejfbL27CspYNKiVuURN", doc.VerificationMethods[0].PubKeyBase58) + suite.Require().Equal("hfiFwEqzHPx3RbQBmkgg4UEMtejfbL27CspYNKiVuURN", doc.VerificationMethods[0].PublicKeyBase58) suite.Require().Equal("Secp256k1VerificationKey2018", doc.VerificationMethods[0].Type) suite.Require().Equal(1, len(doc.Authentications)) suite.Require().Equal("did:panacea:27FnaDeQZApXhsRZZDARhWYs2nKFaw3p7evGd9zUSrBZ#key1", doc.Authentications[0].GetVerificationMethodId()) @@ -145,7 +145,7 @@ func (suite txTestSuite) TestReadDIDDocTwoContexts() { suite.Require().Equal(1, len(doc.VerificationMethods)) suite.Require().Equal("did:panacea:27FnaDeQZApXhsRZZDARhWYs2nKFaw3p7evGd9zUSrBZ", doc.VerificationMethods[0].Controller) suite.Require().Equal("did:panacea:27FnaDeQZApXhsRZZDARhWYs2nKFaw3p7evGd9zUSrBZ#key1", doc.VerificationMethods[0].Id) - suite.Require().Equal("hfiFwEqzHPx3RbQBmkgg4UEMtejfbL27CspYNKiVuURN", doc.VerificationMethods[0].PubKeyBase58) + suite.Require().Equal("hfiFwEqzHPx3RbQBmkgg4UEMtejfbL27CspYNKiVuURN", doc.VerificationMethods[0].PublicKeyBase58) suite.Require().Equal("Secp256k1VerificationKey2018", doc.VerificationMethods[0].Type) suite.Require().Equal(1, len(doc.Authentications)) suite.Require().Equal("did:panacea:27FnaDeQZApXhsRZZDARhWYs2nKFaw3p7evGd9zUSrBZ#key1", doc.Authentications[0].GetVerificationMethodId()) @@ -163,7 +163,7 @@ func (suite txTestSuite) TestReadDIDDocMultiRelationship() { suite.Require().Equal("did:panacea:27FnaDeQZApXhsRZZDARhWYs2nKFaw3p7evGd9zUSrBZ", doc.Id) suite.Require().Equal(2, len(doc.VerificationMethods)) suite.Require().Equal("did:panacea:27FnaDeQZApXhsRZZDARhWYs2nKFaw3p7evGd9zUSrBZ", doc.VerificationMethods[0].Controller) - suite.Require().Equal("hfiFwEqzHPx3RbQBmkgg4UEMtejfbL27CspYNKiVuURN", doc.VerificationMethods[0].PubKeyBase58) + suite.Require().Equal("hfiFwEqzHPx3RbQBmkgg4UEMtejfbL27CspYNKiVuURN", doc.VerificationMethods[0].PublicKeyBase58) suite.Require().Equal("Secp256k1VerificationKey2018", doc.VerificationMethods[0].Type) suite.Require().Equal(2, len(doc.Authentications)) suite.Require().Equal("did:panacea:27FnaDeQZApXhsRZZDARhWYs2nKFaw3p7evGd9zUSrBZ#key1", doc.VerificationMethods[0].Id) @@ -172,7 +172,7 @@ func (suite txTestSuite) TestReadDIDDocMultiRelationship() { suite.Require().Equal("did:panacea:27FnaDeQZApXhsRZZDARhWYs2nKFaw3p7evGd9zUSrBZ", doc.Authentications[1].GetVerificationMethod().Controller) suite.Require().Equal("Secp256k1VerificationKey2018", doc.Authentications[1].GetVerificationMethod().Type) suite.Require().Equal("did:panacea:27FnaDeQZApXhsRZZDARhWYs2nKFaw3p7evGd9zUSrBZ#key2", doc.Authentications[1].GetVerificationMethod().Id) - suite.Require().Equal("zH3C2AVvLMv6gmMNam3uVAjZpfkcJCwDwnZn6z3wXmqPV", doc.Authentications[1].GetVerificationMethod().PubKeyBase58) + suite.Require().Equal("zH3C2AVvLMv6gmMNam3uVAjZpfkcJCwDwnZn6z3wXmqPV", doc.Authentications[1].GetVerificationMethod().PublicKeyBase58) suite.Require().Equal(3, len(doc.AssertionMethods)) suite.Require().Equal("did:panacea:27FnaDeQZApXhsRZZDARhWYs2nKFaw3p7evGd9zUSrBZ#key1", doc.AssertionMethods[0].GetVerificationMethodId()) @@ -180,11 +180,11 @@ func (suite txTestSuite) TestReadDIDDocMultiRelationship() { suite.Require().Equal("did:panacea:27FnaDeQZApXhsRZZDARhWYs2nKFaw3p7evGd9zUSrBZ", doc.AssertionMethods[1].GetVerificationMethod().Controller) suite.Require().Equal("Secp256k1VerificationKey2018", doc.AssertionMethods[1].GetVerificationMethod().Type) suite.Require().Equal("did:panacea:27FnaDeQZApXhsRZZDARhWYs2nKFaw3p7evGd9zUSrBZ#key2", doc.AssertionMethods[1].GetVerificationMethod().Id) - suite.Require().Equal("aH3C2AVvLMv6gmMNam3uVAjZpfkcJCwDwnZn6z3wXmqPs", doc.AssertionMethods[1].GetVerificationMethod().PubKeyBase58) + suite.Require().Equal("aH3C2AVvLMv6gmMNam3uVAjZpfkcJCwDwnZn6z3wXmqPs", doc.AssertionMethods[1].GetVerificationMethod().PublicKeyBase58) suite.Require().Equal("did:panacea:27FnaDeQZApXhsRZZDARhWYs2nKFaw3p7evGd9zUSrBZ", doc.AssertionMethods[2].GetVerificationMethod().Controller) suite.Require().Equal("Secp256k1VerificationKey2018", doc.AssertionMethods[2].GetVerificationMethod().Type) suite.Require().Equal("did:panacea:27FnaDeQZApXhsRZZDARhWYs2nKFaw3p7evGd9zUSrBZ#key3", doc.AssertionMethods[2].GetVerificationMethod().Id) - suite.Require().Equal("bH3C2AVvLMv6gmMNam3uVAjZpfkcJCwDwnZn6z3wXmqPo", doc.AssertionMethods[2].GetVerificationMethod().PubKeyBase58) + suite.Require().Equal("bH3C2AVvLMv6gmMNam3uVAjZpfkcJCwDwnZn6z3wXmqPo", doc.AssertionMethods[2].GetVerificationMethod().PublicKeyBase58) suite.Require().Equal(3, len(doc.KeyAgreements)) suite.Require().Equal("did:panacea:27FnaDeQZApXhsRZZDARhWYs2nKFaw3p7evGd9zUSrBZ#key1", doc.KeyAgreements[0].GetVerificationMethodId()) @@ -192,7 +192,7 @@ func (suite txTestSuite) TestReadDIDDocMultiRelationship() { suite.Require().Equal("did:panacea:27FnaDeQZApXhsRZZDARhWYs2nKFaw3p7evGd9zUSrBZ", doc.KeyAgreements[1].GetVerificationMethod().Controller) suite.Require().Equal("Secp256k1VerificationKey2018", doc.KeyAgreements[1].GetVerificationMethod().Type) suite.Require().Equal("did:panacea:27FnaDeQZApXhsRZZDARhWYs2nKFaw3p7evGd9zUSrBZ#key2", doc.KeyAgreements[1].GetVerificationMethod().Id) - suite.Require().Equal("oH3C2AVvLMv6gmMNam3uVAjZpfkcJCwDwnZn6z3wXmqPP", doc.KeyAgreements[1].GetVerificationMethod().PubKeyBase58) + suite.Require().Equal("oH3C2AVvLMv6gmMNam3uVAjZpfkcJCwDwnZn6z3wXmqPP", doc.KeyAgreements[1].GetVerificationMethod().PublicKeyBase58) suite.Require().Equal("did:panacea:27FnaDeQZApXhsRZZDARhWYs2nKFaw3p7evGd9zUSrBZ#key3", doc.KeyAgreements[2].GetVerificationMethodId()) suite.Require().Nil(doc.KeyAgreements[2].GetVerificationMethod()) @@ -202,7 +202,7 @@ func (suite txTestSuite) TestReadDIDDocMultiRelationship() { suite.Require().Equal("did:panacea:27FnaDeQZApXhsRZZDARhWYs2nKFaw3p7evGd9zUSrBZ", doc.CapabilityInvocations[1].GetVerificationMethod().Controller) suite.Require().Equal("Secp256k1VerificationKey2018", doc.CapabilityInvocations[1].GetVerificationMethod().Type) suite.Require().Equal("did:panacea:27FnaDeQZApXhsRZZDARhWYs2nKFaw3p7evGd9zUSrBZ#key2", doc.CapabilityInvocations[1].GetVerificationMethod().Id) - suite.Require().Equal("PH3C2AVvLMv6gmMNam3uVAjZpfkcJCwDwnZn6z3wXmqPp", doc.CapabilityInvocations[1].GetVerificationMethod().PubKeyBase58) + suite.Require().Equal("PH3C2AVvLMv6gmMNam3uVAjZpfkcJCwDwnZn6z3wXmqPp", doc.CapabilityInvocations[1].GetVerificationMethod().PublicKeyBase58) suite.Require().Equal(2, len(doc.CapabilityDelegations)) suite.Require().Equal("did:panacea:27FnaDeQZApXhsRZZDARhWYs2nKFaw3p7evGd9zUSrBZ#key1", doc.CapabilityDelegations[0].GetVerificationMethodId()) @@ -210,5 +210,5 @@ func (suite txTestSuite) TestReadDIDDocMultiRelationship() { suite.Require().Equal("did:panacea:27FnaDeQZApXhsRZZDARhWYs2nKFaw3p7evGd9zUSrBZ", doc.CapabilityDelegations[1].GetVerificationMethod().Controller) suite.Require().Equal("Secp256k1VerificationKey2018", doc.CapabilityDelegations[1].GetVerificationMethod().Type) suite.Require().Equal("did:panacea:27FnaDeQZApXhsRZZDARhWYs2nKFaw3p7evGd9zUSrBZ#key2", doc.CapabilityDelegations[1].GetVerificationMethod().Id) - suite.Require().Equal("qH3C2AVvLMv6gmMNam3uVAjZpfkcJCwDwnZn6z3wXmqPQ", doc.CapabilityDelegations[1].GetVerificationMethod().PubKeyBase58) + suite.Require().Equal("qH3C2AVvLMv6gmMNam3uVAjZpfkcJCwDwnZn6z3wXmqPQ", doc.CapabilityDelegations[1].GetVerificationMethod().PublicKeyBase58) } diff --git a/x/did/genesis_test.go b/x/did/genesis_test.go index def493a1..a6f356f0 100644 --- a/x/did/genesis_test.go +++ b/x/did/genesis_test.go @@ -32,7 +32,7 @@ func (suite genesisTestSuite) TestGenesis() { didKeeper.SetDIDDocument(suite.Ctx, did1, doc1) didKeeper.SetDIDDocument(suite.Ctx, did2, doc2) - doc2Deactivated := doc2.Deactivate(doc2.Seq + 1) + doc2Deactivated := doc2.Deactivate(doc2.Sequence + 1) didKeeper.SetDIDDocument(suite.Ctx, did2, doc2Deactivated) // export a genesis diff --git a/x/did/keeper/grpc_query_did.go b/x/did/keeper/grpc_query_did.go index 5a41c46f..f84af198 100644 --- a/x/did/keeper/grpc_query_did.go +++ b/x/did/keeper/grpc_query_did.go @@ -11,7 +11,7 @@ import ( "google.golang.org/grpc/status" ) -func (k Keeper) DIDDocumentWithSeq(c context.Context, req *types.QueryDIDRequest) (*types.QueryDIDResponse, error) { +func (k Keeper) DID(c context.Context, req *types.QueryDIDRequest) (*types.QueryDIDResponse, error) { if req == nil { return nil, status.Error(codes.InvalidArgument, "invalid request") } diff --git a/x/did/keeper/grpc_query_did_test.go b/x/did/keeper/grpc_query_did_test.go index d6c184e0..cefa5b8c 100644 --- a/x/did/keeper/grpc_query_did_test.go +++ b/x/did/keeper/grpc_query_did_test.go @@ -26,7 +26,7 @@ func (suite queryDIDTestSuite) TestDIDDocumentWithSeq() { didKeeper.SetDIDDocument(suite.Ctx, did, docWithSeq) req := types.QueryDIDRequest{Did: did} - res, err := didKeeper.DIDDocumentWithSeq(sdk.WrapSDKContext(suite.Ctx), &req) + res, err := didKeeper.DID(sdk.WrapSDKContext(suite.Ctx), &req) suite.Require().NoError(err) suite.Require().NotNil(res) suite.Require().Equal(docWithSeq, *res.DidDocumentWithSeq) diff --git a/x/did/keeper/msg_server_did.go b/x/did/keeper/msg_server_did.go index f5dad50f..1ecb8597 100644 --- a/x/did/keeper/msg_server_did.go +++ b/x/did/keeper/msg_server_did.go @@ -44,7 +44,7 @@ func (m msgServer) UpdateDID(goCtx context.Context, msg *types.MsgUpdateDID) (*t return nil, sdkerrors.Wrapf(types.ErrDIDDeactivated, "DID: %s", msg.Did) } - newSeq, err := VerifyDIDOwnership(msg.Document, docWithSeq.Seq, docWithSeq.Document, msg.VerificationMethodId, msg.Signature) + newSeq, err := VerifyDIDOwnership(msg.Document, docWithSeq.Sequence, docWithSeq.Document, msg.VerificationMethodId, msg.Signature) if err != nil { return nil, err } @@ -70,7 +70,7 @@ func (m msgServer) DeactivateDID(goCtx context.Context, msg *types.MsgDeactivate Id: msg.Did, } - newSeq, err := VerifyDIDOwnership(&doc, docWithSeq.Seq, docWithSeq.Document, msg.VerificationMethodId, msg.Signature) + newSeq, err := VerifyDIDOwnership(&doc, docWithSeq.Sequence, docWithSeq.Document, msg.VerificationMethodId, msg.Signature) if err != nil { return nil, err } @@ -92,9 +92,9 @@ func VerifyDIDOwnership(signData *types.DIDDocument, seq uint64, doc *types.DIDD if verificationMethod.Type != types.ES256K_2019 && verificationMethod.Type != types.ES256K_2018 { return 0, sdkerrors.Wrapf(types.ErrVerificationMethodKeyTypeNotImplemented, "VerificationMethod: %v", verificationMethod.Type) } - pubKeySecp256k1, err := secp256k1util.PubKeyFromBase58(verificationMethod.PubKeyBase58) + pubKeySecp256k1, err := secp256k1util.PubKeyFromBase58(verificationMethod.PublicKeyBase58) if err != nil { - return 0, sdkerrors.Wrapf(types.ErrInvalidSecp256k1PublicKey, "PublicKey: %v", verificationMethod.PubKeyBase58) + return 0, sdkerrors.Wrapf(types.ErrInvalidSecp256k1PublicKey, "PublicKey: %v", verificationMethod.PublicKeyBase58) } newSeq, ok := types.Verify(sig, signData, seq, pubKeySecp256k1) if !ok { diff --git a/x/did/keeper/msg_server_did_test.go b/x/did/keeper/msg_server_did_test.go index cfc315d9..be0110e2 100644 --- a/x/did/keeper/msg_server_did_test.go +++ b/x/did/keeper/msg_server_did_test.go @@ -123,7 +123,7 @@ func (suite msgServerTestSuite) TestHandleMsgUpdateDID() { newDoc.VerificationMethods = append(newDoc.VerificationMethods, &verificationMethod) // call - updateMsg := newMsgUpdateDID(suite, *newDoc, verificationMethodID, privKey, origDocWithSeq.Seq) + updateMsg := newMsgUpdateDID(suite, *newDoc, verificationMethodID, privKey, origDocWithSeq.Sequence) updateRes, err := didMsgServer.UpdateDID(goContext, &updateMsg) suite.Require().NoError(err) suite.Require().NotNil(updateRes) @@ -131,7 +131,7 @@ func (suite msgServerTestSuite) TestHandleMsgUpdateDID() { updatedDoc := didKeeper.GetDIDDocument(suite.Ctx, did) suite.Require().Equal(newDoc, updatedDoc.Document) - suite.Require().Equal(origDocWithSeq.Seq+1, updatedDoc.Seq) + suite.Require().Equal(origDocWithSeq.Sequence+1, updatedDoc.Sequence) // call again with the same signature (replay-attack! should be failed!) updateRes, err = didMsgServer.UpdateDID(goContext, &updateMsg) @@ -146,7 +146,7 @@ func (suite msgServerTestSuite) TestHandleMsgUpdateDID_DIDNotFound() { _, origDocWithSeq, privKey, verificationMethodID := suite.makeTestData() // update without creation - msg := newMsgUpdateDID(suite, *origDocWithSeq.Document, verificationMethodID, privKey, origDocWithSeq.Seq) + msg := newMsgUpdateDID(suite, *origDocWithSeq.Document, verificationMethodID, privKey, origDocWithSeq.Sequence) res, err := didMsgServer.UpdateDID(goContext, &msg) suite.ErrorIs(types.ErrDIDNotFound, err) suite.Nil(res) @@ -167,13 +167,13 @@ func (suite msgServerTestSuite) TestHandleMsgUpdateDID_DIDDeactivated() { suite.Require().Equal(origDocWithSeq, didKeeper.GetDIDDocument(suite.Ctx, did)) // deactivate - deactivateMsg := newMsgDeactivateDID(suite, did, verificationMethodID, privKey, origDocWithSeq.Seq) + deactivateMsg := newMsgDeactivateDID(suite, did, verificationMethodID, privKey, origDocWithSeq.Sequence) deactivateRes, err := didMsgServer.DeactivateDID(goContext, &deactivateMsg) suite.Require().NoError(err) suite.Require().NotNil(deactivateRes) // update - updateMsg := newMsgUpdateDID(suite, *origDocWithSeq.Document, verificationMethodID, privKey, origDocWithSeq.Seq) + updateMsg := newMsgUpdateDID(suite, *origDocWithSeq.Document, verificationMethodID, privKey, origDocWithSeq.Sequence) updateRes, err := didMsgServer.UpdateDID(goContext, &updateMsg) suite.Require().ErrorIs(types.ErrDIDDeactivated, err) suite.Require().Nil(updateRes) @@ -203,7 +203,7 @@ func (suite msgServerTestSuite) TestHandleMsgDeactivateDID() { tombstone := didKeeper.GetDIDDocument(suite.Ctx, did) suite.Require().False(tombstone.Empty()) suite.Require().True(tombstone.Deactivated()) - suite.Require().Equal(types.InitialSequence+1, tombstone.Seq) + suite.Require().Equal(types.InitialSequence+1, tombstone.Sequence) } func (suite msgServerTestSuite) TestHandleMsgDeactivateDID_DIDNotFound() { @@ -260,7 +260,7 @@ func (suite msgServerTestSuite) TestHandleMsgDeactivateDID_SigVerificationFailed suite.Require().Equal(1, len(didKeeper.ListDIDs(suite.Ctx))) suite.Require().Equal(docWithSeq, didKeeper.GetDIDDocument(suite.Ctx, did)) - sig, _ := types.Sign(&doc, docWithSeq.Seq, privKey) + sig, _ := types.Sign(&doc, docWithSeq.Sequence, privKey) sig[0] += 1 // pollute the signature deactivateMsg := types.NewMsgDeactivateDID(did, verificationMethodID, sig, sdk.AccAddress{}.String()) @@ -274,11 +274,11 @@ func (suite msgServerTestSuite) TestVerifyDIDOwnership() { docWithSeq, privKey := suite.newDIDDocumentWithSeq(did) doc := docWithSeq.Document - sig, _ := types.Sign(doc, docWithSeq.Seq, privKey) + sig, _ := types.Sign(doc, docWithSeq.Sequence, privKey) - newSeq, err := didkeeper.VerifyDIDOwnership(doc, docWithSeq.Seq, docWithSeq.Document, docWithSeq.Document.VerificationMethods[0].Id, sig) + newSeq, err := didkeeper.VerifyDIDOwnership(doc, docWithSeq.Sequence, docWithSeq.Document, docWithSeq.Document.VerificationMethods[0].Id, sig) suite.Require().NoError(err) - suite.Require().Equal(docWithSeq.Seq+1, newSeq) + suite.Require().Equal(docWithSeq.Sequence+1, newSeq) } func (suite msgServerTestSuite) TestVerifyDIDOwnership_SigVerificationFailed() { @@ -286,9 +286,9 @@ func (suite msgServerTestSuite) TestVerifyDIDOwnership_SigVerificationFailed() { docWithSeq, privKey := suite.newDIDDocumentWithSeq(did) doc := docWithSeq.Document - sig, _ := types.Sign(doc, docWithSeq.Seq+11234, privKey) + sig, _ := types.Sign(doc, docWithSeq.Sequence+11234, privKey) - _, err := didkeeper.VerifyDIDOwnership(doc, docWithSeq.Seq, docWithSeq.Document, docWithSeq.Document.VerificationMethods[0].Id, sig) + _, err := didkeeper.VerifyDIDOwnership(doc, docWithSeq.Sequence, docWithSeq.Document, docWithSeq.Document.VerificationMethods[0].Id, sig) suite.Require().ErrorIs(types.ErrSigVerificationFailed, err) } diff --git a/x/did/keeper/private_test.go b/x/did/keeper/private_test.go index dbd569a6..093e39a9 100644 --- a/x/did/keeper/private_test.go +++ b/x/did/keeper/private_test.go @@ -16,11 +16,11 @@ func TestVerifyDIDOwnership(t *testing.T) { docWithSeq, privKey := newDIDDocumentWithSeq(did) doc := docWithSeq.Document - sig, _ := types.Sign(doc, docWithSeq.Seq, privKey) + sig, _ := types.Sign(doc, docWithSeq.Sequence, privKey) - newSeq, err := VerifyDIDOwnership(doc, docWithSeq.Seq, docWithSeq.Document, docWithSeq.Document.VerificationMethods[0].Id, sig) + newSeq, err := VerifyDIDOwnership(doc, docWithSeq.Sequence, docWithSeq.Document, docWithSeq.Document.VerificationMethods[0].Id, sig) require.NoError(t, err) - require.Equal(t, docWithSeq.Seq+1, newSeq) + require.Equal(t, docWithSeq.Sequence+1, newSeq) } func TestVerifyDIDOwnership_SigVerificationFailed(t *testing.T) { @@ -28,9 +28,9 @@ func TestVerifyDIDOwnership_SigVerificationFailed(t *testing.T) { docWithSeq, privKey := newDIDDocumentWithSeq(did) doc := docWithSeq.Document - sig, _ := types.Sign(doc, docWithSeq.Seq+11234, privKey) + sig, _ := types.Sign(doc, docWithSeq.Sequence+11234, privKey) - _, err := VerifyDIDOwnership(doc, docWithSeq.Seq, docWithSeq.Document, docWithSeq.Document.VerificationMethods[0].Id, sig) + _, err := VerifyDIDOwnership(doc, docWithSeq.Sequence, docWithSeq.Document, docWithSeq.Document.VerificationMethods[0].Id, sig) require.ErrorIs(t, types.ErrSigVerificationFailed, err) } diff --git a/x/did/types/auth.go b/x/did/types/auth.go index f64d92e1..f009ccf9 100644 --- a/x/did/types/auth.go +++ b/x/did/types/auth.go @@ -2,6 +2,7 @@ package types import ( "fmt" + sdkcodec "github.com/cosmos/cosmos-sdk/codec" "github.com/tendermint/tendermint/crypto" ) @@ -27,8 +28,8 @@ func mustGetSignBytesWithSeq(signableData sdkcodec.ProtoMarshaler, seq uint64) [ panic(fmt.Sprintf("marshal failed: %s, signableData: %s", err.Error(), signableData)) } dataWithSeq := DataWithSeq{ - Data: dAtA, - Seq: seq, + Data: dAtA, + Sequence: seq, } dAtA, err = dataWithSeq.Marshal() diff --git a/x/did/types/auth_test.go b/x/did/types/auth_test.go index 435fe2b9..85ed7986 100644 --- a/x/did/types/auth_test.go +++ b/x/did/types/auth_test.go @@ -22,7 +22,7 @@ func TestMustGetSignBytesWithSeq(t *testing.T) { unmarshalDoc := DIDDocument{} require.NoError(t, unmarshalDoc.Unmarshal(dataWithSeq.GetData())) require.Equal(t, doc.Id, unmarshalDoc.Id) - require.Equal(t, uint64(100), dataWithSeq.Seq) + require.Equal(t, uint64(100), dataWithSeq.Sequence) } func TestSequence(t *testing.T) { diff --git a/x/did/types/did.go b/x/did/types/did.go index 3454317c..1b3fff26 100644 --- a/x/did/types/did.go +++ b/x/did/types/did.go @@ -406,10 +406,10 @@ func ValidateKeyType(keyType string) bool { func NewVerificationMethod(id string, keyType string, controller string, pubKey []byte) VerificationMethod { return VerificationMethod{ - Id: id, - Type: keyType, - Controller: controller, - PubKeyBase58: base58.Encode(pubKey), + Id: id, + Type: keyType, + Controller: controller, + PublicKeyBase58: base58.Encode(pubKey), } } @@ -419,7 +419,7 @@ func (pk VerificationMethod) Valid(did string) bool { } pattern := fmt.Sprintf("^[%s]+$", Base58Charset) - matched, _ := regexp.MatchString(pattern, pk.PubKeyBase58) + matched, _ := regexp.MatchString(pattern, pk.PublicKeyBase58) return matched } @@ -484,14 +484,14 @@ func (s Service) Valid() bool { func NewDIDDocumentWithSeq(doc *DIDDocument, seq uint64) DIDDocumentWithSeq { return DIDDocumentWithSeq{ Document: doc, - Seq: seq, + Sequence: seq, } } // Empty returns true if all members in DIDDocumentWithSeq are empty. // The empty struct means that the entity doesn't exist. func (d DIDDocumentWithSeq) Empty() bool { - return d.Document == nil || d.Document.Empty() && d.Seq == InitialSequence + return d.Document == nil || d.Document.Empty() && d.Sequence == InitialSequence } func (d DIDDocumentWithSeq) Valid() bool { @@ -506,5 +506,5 @@ func (d DIDDocumentWithSeq) Deactivate(newSeq uint64) DIDDocumentWithSeq { // Deactivated returns true if the DIDDocument has been activated. func (d DIDDocumentWithSeq) Deactivated() bool { - return d.Document.Empty() && d.Seq != InitialSequence + return d.Document.Empty() && d.Sequence != InitialSequence } diff --git a/x/did/types/did.pb.go b/x/did/types/did.pb.go index b88e6bcf..93ebd615 100644 --- a/x/did/types/did.pb.go +++ b/x/did/types/did.pb.go @@ -73,13 +73,13 @@ type DIDDocument struct { Contexts *JSONStringOrStrings `protobuf:"bytes,1,opt,name=contexts,json=@context,proto3,customtype=JSONStringOrStrings" json:"@context"` Id string `protobuf:"bytes,2,opt,name=id,proto3" json:"id,omitempty"` Controller *JSONStringOrStrings `protobuf:"bytes,3,opt,name=controller,proto3,customtype=JSONStringOrStrings" json:"controller,omitempty"` - VerificationMethods []*VerificationMethod `protobuf:"bytes,4,rep,name=verificationMethods,json=verificationMethod,proto3" json:"verificationMethod,omitempty"` + VerificationMethods []*VerificationMethod `protobuf:"bytes,4,rep,name=verification_methods,json=verificationMethod,proto3" json:"verificationMethod,omitempty"` // TODO: the repeated gogoproto.customtype has an issue: https://github.com/gogo/protobuf/issues/478 Authentications []VerificationRelationship `protobuf:"bytes,5,rep,name=authentications,json=authentication,proto3,customtype=VerificationRelationship" json:"authentication,omitempty"` - AssertionMethods []VerificationRelationship `protobuf:"bytes,6,rep,name=assertionMethods,json=assertionMethod,proto3,customtype=VerificationRelationship" json:"assertionMethod,omitempty"` - KeyAgreements []VerificationRelationship `protobuf:"bytes,7,rep,name=keyAgreements,json=keyAgreement,proto3,customtype=VerificationRelationship" json:"keyAgreement,omitempty"` - CapabilityInvocations []VerificationRelationship `protobuf:"bytes,8,rep,name=capabilityInvocations,json=capabilityInvocation,proto3,customtype=VerificationRelationship" json:"capabilityInvocation,omitempty"` - CapabilityDelegations []VerificationRelationship `protobuf:"bytes,9,rep,name=capabilityDelegations,json=capabilityDelegation,proto3,customtype=VerificationRelationship" json:"capabilityDelegation,omitempty"` + AssertionMethods []VerificationRelationship `protobuf:"bytes,6,rep,name=assertion_methods,json=assertionMethod,proto3,customtype=VerificationRelationship" json:"assertionMethod,omitempty"` + KeyAgreements []VerificationRelationship `protobuf:"bytes,7,rep,name=key_agreements,json=keyAgreement,proto3,customtype=VerificationRelationship" json:"keyAgreement,omitempty"` + CapabilityInvocations []VerificationRelationship `protobuf:"bytes,8,rep,name=capability_invocations,json=capabilityInvocation,proto3,customtype=VerificationRelationship" json:"capabilityInvocation,omitempty"` + CapabilityDelegations []VerificationRelationship `protobuf:"bytes,9,rep,name=capability_delegations,json=capabilityDelegation,proto3,customtype=VerificationRelationship" json:"capabilityDelegation,omitempty"` Services []*Service `protobuf:"bytes,10,rep,name=services,json=service,proto3" json:"service,omitempty"` } @@ -139,10 +139,10 @@ func (m *DIDDocument) GetServices() []*Service { // VerificationMethod defines a W3C verification method type VerificationMethod struct { - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` - Type string `protobuf:"bytes,2,opt,name=type,proto3" json:"type,omitempty"` - Controller string `protobuf:"bytes,3,opt,name=controller,proto3" json:"controller,omitempty"` - PubKeyBase58 string `protobuf:"bytes,4,opt,name=pubKeyBase58,json=publicKeyBase58,proto3" json:"publicKeyBase58"` + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Type string `protobuf:"bytes,2,opt,name=type,proto3" json:"type,omitempty"` + Controller string `protobuf:"bytes,3,opt,name=controller,proto3" json:"controller,omitempty"` + PublicKeyBase58 string `protobuf:"bytes,4,opt,name=public_key_base58,json=publicKeyBase58,proto3" json:"publicKeyBase58"` } func (m *VerificationMethod) Reset() { *m = VerificationMethod{} } @@ -199,15 +199,17 @@ func (m *VerificationMethod) GetController() string { return "" } -func (m *VerificationMethod) GetPubKeyBase58() string { +func (m *VerificationMethod) GetPublicKeyBase58() string { if m != nil { - return m.PubKeyBase58 + return m.PublicKeyBase58 } return "" } // VerificationRelationship defines a W3C verification relationship type VerificationRelationship struct { + // VerificationRelationship can be one of a single ID or a VerificationMethod. + // // Types that are valid to be assigned to Content: // *VerificationRelationship_VerificationMethodId // *VerificationRelationship_VerificationMethod @@ -296,7 +298,7 @@ func (*VerificationRelationship) XXX_OneofWrappers() []interface{} { type Service struct { Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` Type string `protobuf:"bytes,2,opt,name=type,proto3" json:"type,omitempty"` - ServiceEndpoint string `protobuf:"bytes,3,opt,name=serviceEndpoint,proto3" json:"serviceEndpoint,omitempty"` + ServiceEndpoint string `protobuf:"bytes,3,opt,name=service_endpoint,json=serviceEndpoint,proto3" json:"serviceEndpoint,omitempty"` } func (m *Service) Reset() { *m = Service{} } @@ -356,7 +358,7 @@ func (m *Service) GetServiceEndpoint() string { // DIDDocumentWithSeq defines a message for DID Document with a sequence number for preventing replay attacks. type DIDDocumentWithSeq struct { Document *DIDDocument `protobuf:"bytes,1,opt,name=document,proto3" json:"document,omitempty"` - Seq uint64 `protobuf:"varint,2,opt,name=seq,json=sequence,proto3" json:"sequence"` + Sequence uint64 `protobuf:"varint,2,opt,name=sequence,proto3" json:"sequence,omitempty"` } func (m *DIDDocumentWithSeq) Reset() { *m = DIDDocumentWithSeq{} } @@ -399,17 +401,17 @@ func (m *DIDDocumentWithSeq) GetDocument() *DIDDocument { return nil } -func (m *DIDDocumentWithSeq) GetSeq() uint64 { +func (m *DIDDocumentWithSeq) GetSequence() uint64 { if m != nil { - return m.Seq + return m.Sequence } return 0 } // DataWithSeq defines a message for data with a sequence number for preventing replay attacks. type DataWithSeq struct { - Data []byte `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"` - Seq uint64 `protobuf:"varint,2,opt,name=seq,proto3" json:"seq,omitempty"` + Data []byte `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"` + Sequence uint64 `protobuf:"varint,2,opt,name=sequence,proto3" json:"sequence,omitempty"` } func (m *DataWithSeq) Reset() { *m = DataWithSeq{} } @@ -452,9 +454,9 @@ func (m *DataWithSeq) GetData() []byte { return nil } -func (m *DataWithSeq) GetSeq() uint64 { +func (m *DataWithSeq) GetSequence() uint64 { if m != nil { - return m.Seq + return m.Sequence } return 0 } @@ -472,53 +474,54 @@ func init() { func init() { proto.RegisterFile("panacea/did/v2/did.proto", fileDescriptor_6fb0abc66ec091ab) } var fileDescriptor_6fb0abc66ec091ab = []byte{ - // 735 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x55, 0xcd, 0x6e, 0xd3, 0x4a, - 0x14, 0x8e, 0x9b, 0xdc, 0x26, 0x99, 0xe4, 0x36, 0xbd, 0xd3, 0x3f, 0x5f, 0x40, 0x4e, 0x70, 0x37, - 0x59, 0x94, 0x44, 0x4a, 0x45, 0x29, 0x2c, 0x10, 0x58, 0x41, 0x6a, 0x40, 0xd0, 0xca, 0x15, 0x14, - 0xb1, 0xa9, 0x26, 0xf6, 0x21, 0x19, 0xe1, 0x78, 0x5c, 0x7b, 0x1c, 0x35, 0x0f, 0xc0, 0x0a, 0x09, - 0xb1, 0x60, 0xcb, 0x5b, 0xf0, 0x10, 0x2c, 0xbb, 0x44, 0x5d, 0x44, 0xa8, 0xdd, 0x65, 0xc9, 0x13, - 0x20, 0x3b, 0xd3, 0xd4, 0x89, 0xd3, 0xbf, 0x05, 0xab, 0x9c, 0x9c, 0xef, 0xf8, 0x7c, 0x9f, 0xcf, - 0x78, 0xbe, 0x83, 0x64, 0x87, 0xd8, 0xc4, 0x00, 0x52, 0x35, 0xa9, 0x59, 0xed, 0xd6, 0x82, 0x9f, - 0x8a, 0xe3, 0x32, 0xce, 0xf0, 0x9c, 0x40, 0x2a, 0x41, 0xaa, 0x5b, 0xbb, 0xb5, 0xd8, 0x62, 0x2d, - 0x16, 0x42, 0xd5, 0x20, 0x1a, 0x56, 0xa9, 0x77, 0x51, 0x7a, 0x97, 0xbb, 0xd4, 0x6e, 0x79, 0x78, - 0x19, 0xcd, 0x76, 0x89, 0xe5, 0x83, 0x27, 0x4b, 0xa5, 0x64, 0x39, 0xab, 0x8b, 0x7f, 0xea, 0xef, - 0x0c, 0xca, 0xd5, 0x1b, 0xf5, 0x3a, 0x33, 0xfc, 0x0e, 0xd8, 0x1c, 0xbf, 0x45, 0x19, 0x83, 0xd9, - 0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0x00, 0x00, 0xff, 0xff, 0xcd, 0x2b, 0xd1, 0x8a, 0x7a, 0x07, 0x00, 0x00, + // 745 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x55, 0x4d, 0x73, 0xd2, 0x40, + 0x18, 0x66, 0x5b, 0x2c, 0xb0, 0x74, 0xa8, 0xdd, 0x22, 0x8d, 0x55, 0x03, 0xc6, 0x0b, 0x87, 0x0a, + 0x33, 0x38, 0xd6, 0x7a, 0xf0, 0x2b, 0x83, 0x33, 0xa0, 0xa3, 0xed, 0xa4, 0xe3, 0xc7, 0x78, 0x61, + 0x96, 0x64, 0x85, 0x9d, 0x86, 0x6c, 0x9a, 0x2c, 0xb1, 0xfc, 0x01, 0x2f, 0x1e, 0xf4, 0xea, 0xc5, + 0x5f, 0xe1, 0x8f, 0xf0, 0xd8, 0xa3, 0xd3, 0x03, 0xe3, 0xb4, 0x37, 0xfe, 0x80, 0x57, 0x27, 0x61, + 0xa1, 0x81, 0xd0, 0xaf, 0x83, 0xa7, 0x6c, 0xde, 0xe7, 0xdd, 0xf7, 0x79, 0xf2, 0x66, 0xf7, 0x79, + 0xa1, 0x64, 0x63, 0x0b, 0xeb, 0x04, 0x97, 0x0d, 0x6a, 0x94, 0xbd, 0x8a, 0xff, 0x28, 0xd9, 0x0e, + 0xe3, 0x0c, 0x65, 0x04, 0x52, 0xf2, 0x43, 0x5e, 0x65, 0x2d, 0xdb, 0x62, 0x2d, 0x16, 0x40, 0x65, + 0x7f, 0x35, 0xcc, 0x52, 0x6e, 0xc3, 0xc4, 0x0e, 0x77, 0xa8, 0xd5, 0x72, 0x51, 0x0e, 0x2e, 0x78, + 0xd8, 0xec, 0x12, 0x57, 0x02, 0x85, 0xf9, 0x62, 0x4a, 0x13, 0x6f, 0xca, 0xdf, 0x24, 0x4c, 0x57, + 0xeb, 0xd5, 0x2a, 0xd3, 0xbb, 0x1d, 0x62,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0xe8, 0xb9, + 0x3e, 0xa6, 0x88, 0xb4, 0x68, 0x69, 0x0a, 0x42, 0x9f, 0x01, 0xcc, 0xec, 0x92, 0x5e, 0x03, 0xb7, + 0x1c, 0x42, 0xfc, 0x53, 0xe6, 0x4a, 0x89, 0x4b, 0xca, 0xd9, 0x38, 0x47, 0x4e, 0x6e, 0x97, 0xf4, + 0x9e, 0x8d, 0xca, 0x87, 0xb4, 0x2c, 0x86, 0xe3, 0xe8, 0x07, 0x80, 0x39, 0x1d, 0xdb, 0xb8, 0x49, + 0x4d, 0xca, 0x7b, 0x0d, 0x6a, 0x79, 0x6c, 0xf4, 0xbf, 0x92, 0x97, 0x14, 0xf4, 0xf8, 0x1c, 0x41, + 0xf2, 0x09, 0x4f, 0x7d, 0x4c, 0x13, 0x12, 0x96, 0x9d, 0x85, 0x4f, 0x0b, 0x34, 0x88, 0x49, 0x5a, + 0x42, 0x60, 0xea, 0xff, 0x09, 0xac, 0x8e, 0x69, 0x66, 0x0b, 0x3c, 0xc1, 0x51, 0x1d, 0x26, 0x5d, + 0xe2, 0x78, 0x54, 0x27, 0xae, 0x04, 0x03, 0x45, 0xd1, 0x2b, 0x3b, 0xc4, 0xd5, 0x6b, 0x83, 0x7e, + 0x7e, 0x59, 0x24, 0x87, 0xea, 0x26, 0x44, 0x48, 0xf9, 0x0e, 0x20, 0x8a, 0x5e, 0x41, 0x61, 0x13, + 0x60, 0x6c, 0x13, 0x08, 0xc6, 0x79, 0xcf, 0x26, 0xc2, 0x38, 0x82, 0x35, 0x92, 0x23, 0xd6, 0x91, + 0x9a, 0x30, 0x82, 0x27, 0x70, 0xd9, 0xee, 0x36, 0x4d, 0xaa, 0x37, 0xfc, 0x63, 0xd7, 0xc4, 0x2e, + 0xb9, 0xbf, 0x29, 0xc5, 0xfd, 0x34, 0x75, 0x65, 0xd0, 0xcf, 0x2f, 0x0d, 0xc1, 0x97, 0xa4, 0xa7, + 0x06, 0x90, 0x36, 0x1d, 0x50, 0x7e, 0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e6, 0x90, 0xf2, + 0x7e, 0x30, 0x89, 0xfd, 0xe6, 0xb9, 0xcd, 0x85, 0x60, 0xc6, 0xde, 0xfb, 0x17, 0x00, 0x00, 0xff, + 0xff, 0x1b, 0xf7, 0x74, 0xa0, 0xa5, 0x07, 0x00, 0x00, } func (m *Strings) Marshal() (dAtA []byte, err error) { @@ -725,10 +728,10 @@ func (m *VerificationMethod) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if len(m.PubKeyBase58) > 0 { - i -= len(m.PubKeyBase58) - copy(dAtA[i:], m.PubKeyBase58) - i = encodeVarintDid(dAtA, i, uint64(len(m.PubKeyBase58))) + if len(m.PublicKeyBase58) > 0 { + i -= len(m.PublicKeyBase58) + copy(dAtA[i:], m.PublicKeyBase58) + i = encodeVarintDid(dAtA, i, uint64(len(m.PublicKeyBase58))) i-- dAtA[i] = 0x22 } @@ -887,8 +890,8 @@ func (m *DIDDocumentWithSeq) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if m.Seq != 0 { - i = encodeVarintDid(dAtA, i, uint64(m.Seq)) + if m.Sequence != 0 { + i = encodeVarintDid(dAtA, i, uint64(m.Sequence)) i-- dAtA[i] = 0x10 } @@ -927,8 +930,8 @@ func (m *DataWithSeq) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if m.Seq != 0 { - i = encodeVarintDid(dAtA, i, uint64(m.Seq)) + if m.Sequence != 0 { + i = encodeVarintDid(dAtA, i, uint64(m.Sequence)) i-- dAtA[i] = 0x10 } @@ -1049,7 +1052,7 @@ func (m *VerificationMethod) Size() (n int) { if l > 0 { n += 1 + l + sovDid(uint64(l)) } - l = len(m.PubKeyBase58) + l = len(m.PublicKeyBase58) if l > 0 { n += 1 + l + sovDid(uint64(l)) } @@ -1121,8 +1124,8 @@ func (m *DIDDocumentWithSeq) Size() (n int) { l = m.Document.Size() n += 1 + l + sovDid(uint64(l)) } - if m.Seq != 0 { - n += 1 + sovDid(uint64(m.Seq)) + if m.Sequence != 0 { + n += 1 + sovDid(uint64(m.Sequence)) } return n } @@ -1137,8 +1140,8 @@ func (m *DataWithSeq) Size() (n int) { if l > 0 { n += 1 + l + sovDid(uint64(l)) } - if m.Seq != 0 { - n += 1 + sovDid(uint64(m.Seq)) + if m.Sequence != 0 { + n += 1 + sovDid(uint64(m.Sequence)) } return n } @@ -1750,7 +1753,7 @@ func (m *VerificationMethod) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 4: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PubKeyBase58", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field PublicKeyBase58", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1778,7 +1781,7 @@ func (m *VerificationMethod) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.PubKeyBase58 = string(dAtA[iNdEx:postIndex]) + m.PublicKeyBase58 = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -2131,9 +2134,9 @@ func (m *DIDDocumentWithSeq) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 2: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Seq", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Sequence", wireType) } - m.Seq = 0 + m.Sequence = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDid @@ -2143,7 +2146,7 @@ func (m *DIDDocumentWithSeq) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Seq |= uint64(b&0x7F) << shift + m.Sequence |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -2234,9 +2237,9 @@ func (m *DataWithSeq) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 2: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Seq", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Sequence", wireType) } - m.Seq = 0 + m.Sequence = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDid @@ -2246,7 +2249,7 @@ func (m *DataWithSeq) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Seq |= uint64(b&0x7F) << shift + m.Sequence |= uint64(b&0x7F) << shift if b < 0x80 { break } diff --git a/x/did/types/did_test.go b/x/did/types/did_test.go index d151e2ec..1470acbf 100644 --- a/x/did/types/did_test.go +++ b/x/did/types/did_test.go @@ -224,7 +224,7 @@ func TestNewVerificationMethod(t *testing.T) { pub := types.NewVerificationMethod(types.NewVerificationMethodID(did, "key1"), types.ES256K_2019, did, pubKey) require.True(t, pub.Valid(did)) - require.Equal(t, pubKey[:], base58.Decode(pub.PubKeyBase58)) + require.Equal(t, pubKey[:], base58.Decode(pub.PublicKeyBase58)) } func TestVerificationRelationship_Valid(t *testing.T) { @@ -258,7 +258,7 @@ func TestVerificationRelationship_MarshalJSON(t *testing.T) { auth = types.NewVerificationRelationshipDedicated(verificationMethod) bz, err = auth.MarshalJSON() require.NoError(t, err) - regex := fmt.Sprintf(`{"id":"%v","type":"%v","controller":"%v","publicKeyBase58":"%v"}`, verificationMethodID, types.ES256K_2019, did, verificationMethod.PubKeyBase58) + regex := fmt.Sprintf(`{"id":"%v","type":"%v","controller":"%v","publicKeyBase58":"%v"}`, verificationMethodID, types.ES256K_2019, did, verificationMethod.PublicKeyBase58) require.Regexp(t, regex, string(bz)) } @@ -274,7 +274,7 @@ func TestVerificationRelationship_UnmarshalJSON(t *testing.T) { require.Equal(t, types.NewVerificationRelationship(verificationMethodID), auth) require.True(t, auth.Valid(did)) - bz = []byte(fmt.Sprintf(`{"id":"%v","type":"%v","controller":"%v","publicKeyBase58":"%v"}`, verificationMethodID, types.ES256K_2019, did, verificationMethod.PubKeyBase58)) + bz = []byte(fmt.Sprintf(`{"id":"%v","type":"%v","controller":"%v","publicKeyBase58":"%v"}`, verificationMethodID, types.ES256K_2019, did, verificationMethod.PublicKeyBase58)) require.NoError(t, auth.UnmarshalJSON(bz)) require.Equal(t, types.NewVerificationRelationshipDedicated(verificationMethod), auth) require.True(t, auth.Valid(did)) diff --git a/x/did/types/query.go b/x/did/types/query.go deleted file mode 100644 index 8df9107c..00000000 --- a/x/did/types/query.go +++ /dev/null @@ -1,6 +0,0 @@ -package types - -const ( - QueryGetMsgCreateDID = "get-MsgCreateDID" - QueryListMsgCreateDID = "list-MsgCreateDID" -) \ No newline at end of file diff --git a/x/did/types/query.pb.go b/x/did/types/query.pb.go index 6157f50d..251b3a42 100644 --- a/x/did/types/query.pb.go +++ b/x/did/types/query.pb.go @@ -128,27 +128,27 @@ func init() { proto.RegisterFile("panacea/did/v2/query.proto", fileDescriptor_77 var fileDescriptor_77f797fe21802469 = []byte{ // 337 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x90, 0xc1, 0x4a, 0xf3, 0x40, - 0x14, 0x85, 0x9b, 0xff, 0x47, 0xc1, 0x08, 0x5a, 0x06, 0x84, 0x12, 0x4a, 0x2c, 0x71, 0x23, 0xa2, - 0x19, 0x1a, 0xdf, 0x40, 0xb2, 0xb0, 0x3b, 0xad, 0x88, 0xe0, 0xa6, 0x4c, 0x72, 0x2f, 0xe9, 0x85, - 0x66, 0x26, 0xe9, 0x4c, 0xaa, 0xa5, 0xb8, 0x11, 0x1f, 0x40, 0xf0, 0xa5, 0x5c, 0x16, 0xdc, 0xb8, - 0x94, 0xd6, 0x07, 0x91, 0xa6, 0x15, 0x31, 0xc5, 0xdd, 0x30, 0xf7, 0x3b, 0xe7, 0xdc, 0x7b, 0x6c, - 0x27, 0x13, 0x52, 0xc4, 0x28, 0x38, 0x10, 0xf0, 0x51, 0xc0, 0xf3, 0x02, 0x87, 0x63, 0x3f, 0x1b, - 0x2a, 0xa3, 0xd8, 0xce, 0x6a, 0xe6, 0x03, 0x81, 0x3f, 0x0a, 0x9c, 0x66, 0xa2, 0x54, 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7b, 0x9c, 0x90, 0xe9, 0x17, 0x91, 0x1f, 0xab, 0x94, 0xa7, 0x08, 0x14, 0x0d, - 0x54, 0xfc, 0x6d, 0x75, 0x12, 0xab, 0x21, 0xf2, 0xfb, 0xd2, 0xd1, 0x8c, 0x33, 0xd4, 0xd1, 0x66, - 0xd9, 0xf3, 0xe9, 0x57, 0x00, 0x00, 0x00, 0xff, 0xff, 0x01, 0x73, 0x07, 0x3c, 0xf9, 0x01, 0x00, + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x90, 0x41, 0x4b, 0xeb, 0x40, + 0x10, 0xc7, 0x9b, 0x57, 0xde, 0x83, 0x97, 0x07, 0xcf, 0xb2, 0x20, 0x94, 0x50, 0x62, 0x89, 0x17, + 0x11, 0xcd, 0xd2, 0xf8, 0x0d, 0x64, 0x0f, 0xf6, 0xa6, 0x15, 0x11, 0xbc, 0x94, 0x4d, 0x66, 0x48, + 0x07, 0x9a, 0xdd, 0xa4, 0xbb, 0xa9, 0x16, 0xf1, 0xe2, 0x27, 0x10, 0xfc, 0x52, 0x1e, 0x0b, 0x5e, + 0x3c, 0x4a, 0xeb, 0x07, 0x91, 0xa6, 0x15, 0x31, 0xe2, 0x6d, 0xd9, 0xf9, 0xcd, 0xef, 0x3f, 0x33, + 0xae, 0x97, 0x4b, 0x25, 0x13, 0x94, 0x1c, 0x08, 0xf8, 0x34, 0xe2, 0x45, 0x89, 0x93, 0x59, 0x98, + 0x4f, 0xb4, 0xd5, 0xec, 0xff, 0xa6, 0x16, 0x02, 0x41, 0x38, 0x8d, 0xbc, 0x4e, 0xaa, 0x75, 0x3a, + 0x46, 0x2e, 0x73, 0xe2, 0x52, 0x29, 0x6d, 0xa5, 0x25, 0xad, 0xcc, 0x9a, 0xf6, 0xf6, 0x13, 0x6d, + 0x32, 0x6d, 0x78, 0x2c, 0x0d, 0xae, 0x35, 0x7c, 0xda, 0x8b, 0xd1, 0xca, 0x1e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x5d, 0x8f, 0xde, 0x03, 0x00, 0x00, 0xff, 0xff, 0x1d, 0x7a, 0x31, 0xac, 0xe9, 0x01, 0x00, 0x00, } @@ -164,8 +164,8 @@ 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 { - // DIDDocumentWithSeq returns a DID Document with a sequence number. - DIDDocumentWithSeq(ctx context.Context, in *QueryDIDRequest, opts ...grpc.CallOption) (*QueryDIDResponse, error) + // DID returns a DID Document with a sequence number. + DID(ctx context.Context, in *QueryDIDRequest, opts ...grpc.CallOption) (*QueryDIDResponse, error) } type queryClient struct { @@ -176,9 +176,9 @@ func NewQueryClient(cc grpc1.ClientConn) QueryClient { return &queryClient{cc} } -func (c *queryClient) DIDDocumentWithSeq(ctx context.Context, in *QueryDIDRequest, opts ...grpc.CallOption) (*QueryDIDResponse, error) { +func (c *queryClient) DID(ctx context.Context, in *QueryDIDRequest, opts ...grpc.CallOption) (*QueryDIDResponse, error) { out := new(QueryDIDResponse) - err := c.cc.Invoke(ctx, "/panacea.did.v2.Query/DIDDocumentWithSeq", in, out, opts...) + err := c.cc.Invoke(ctx, "/panacea.did.v2.Query/DID", in, out, opts...) if err != nil { return nil, err } @@ -187,36 +187,36 @@ func (c *queryClient) DIDDocumentWithSeq(ctx context.Context, in *QueryDIDReques // QueryServer is the server API for Query service. type QueryServer interface { - // DIDDocumentWithSeq returns a DID Document with a sequence number. - DIDDocumentWithSeq(context.Context, *QueryDIDRequest) (*QueryDIDResponse, error) + // DID returns a DID Document with a sequence number. + DID(context.Context, *QueryDIDRequest) (*QueryDIDResponse, error) } // UnimplementedQueryServer can be embedded to have forward compatible implementations. type UnimplementedQueryServer struct { } -func (*UnimplementedQueryServer) DIDDocumentWithSeq(ctx context.Context, req *QueryDIDRequest) (*QueryDIDResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method DIDDocumentWithSeq not implemented") +func (*UnimplementedQueryServer) DID(ctx context.Context, req *QueryDIDRequest) (*QueryDIDResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method DID not implemented") } func RegisterQueryServer(s grpc1.Server, srv QueryServer) { s.RegisterService(&_Query_serviceDesc, srv) } -func _Query_DIDDocumentWithSeq_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { +func _Query_DID_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(QueryDIDRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(QueryServer).DIDDocumentWithSeq(ctx, in) + return srv.(QueryServer).DID(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/panacea.did.v2.Query/DIDDocumentWithSeq", + FullMethod: "/panacea.did.v2.Query/DID", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).DIDDocumentWithSeq(ctx, req.(*QueryDIDRequest)) + return srv.(QueryServer).DID(ctx, req.(*QueryDIDRequest)) } return interceptor(ctx, in, info, handler) } @@ -226,8 +226,8 @@ var _Query_serviceDesc = grpc.ServiceDesc{ HandlerType: (*QueryServer)(nil), Methods: []grpc.MethodDesc{ { - MethodName: "DIDDocumentWithSeq", - Handler: _Query_DIDDocumentWithSeq_Handler, + MethodName: "DID", + Handler: _Query_DID_Handler, }, }, Streams: []grpc.StreamDesc{}, diff --git a/x/did/types/query.pb.gw.go b/x/did/types/query.pb.gw.go index 2c7aff29..bb696fc2 100644 --- a/x/did/types/query.pb.gw.go +++ b/x/did/types/query.pb.gw.go @@ -31,7 +31,7 @@ var _ = runtime.String var _ = utilities.NewDoubleArray var _ = descriptor.ForMessage -func request_Query_DIDDocumentWithSeq_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { +func request_Query_DID_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq QueryDIDRequest var metadata runtime.ServerMetadata @@ -53,12 +53,12 @@ func request_Query_DIDDocumentWithSeq_0(ctx context.Context, marshaler runtime.M return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "did", err) } - msg, err := client.DIDDocumentWithSeq(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + msg, err := client.DID(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } -func local_request_Query_DIDDocumentWithSeq_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_DID_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq QueryDIDRequest var metadata runtime.ServerMetadata @@ -80,7 +80,7 @@ func local_request_Query_DIDDocumentWithSeq_0(ctx context.Context, marshaler run return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "did", err) } - msg, err := server.DIDDocumentWithSeq(ctx, &protoReq) + msg, err := server.DID(ctx, &protoReq) return msg, metadata, err } @@ -91,7 +91,7 @@ func local_request_Query_DIDDocumentWithSeq_0(ctx context.Context, marshaler run // Note that using this registration option will cause many gRPC library features (such as grpc.SendHeader, etc) to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error { - mux.Handle("GET", pattern_Query_DIDDocumentWithSeq_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_DID_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) @@ -100,14 +100,14 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Query_DIDDocumentWithSeq_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_DID_0(rctx, inboundMarshaler, server, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_Query_DIDDocumentWithSeq_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_DID_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -152,7 +152,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_DIDDocumentWithSeq_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_DID_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) @@ -161,14 +161,14 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_Query_DIDDocumentWithSeq_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_Query_DID_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_DIDDocumentWithSeq_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_DID_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -176,9 +176,9 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie } var ( - pattern_Query_DIDDocumentWithSeq_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 1}, []string{"panacea", "did", "v2", "dids"}, "", runtime.AssumeColonVerbOpt(true))) + pattern_Query_DID_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 1}, []string{"panacea", "did", "v2", "dids"}, "", runtime.AssumeColonVerbOpt(true))) ) var ( - forward_Query_DIDDocumentWithSeq_0 = runtime.ForwardResponseMessage + forward_Query_DID_0 = runtime.ForwardResponseMessage )