feat: Add MsgRegisterService to handle service registration

The commit message for these changes would be:

feat: Add MsgRegisterService to handle service registration

This commit adds a new message type `MsgRegisterService` to the DID module's transaction proto file. This message allows users to register a new service with a given permission scope and origin URI. The domain must have a valid TXT record containing the public key.

The changes include:

- Adding the `MsgRegisterService` message type with fields for authority, origin URI, and scopes
- Adding the `MsgRegisterServiceResponse` message type to handle the response
- Updating the Msg service to include a new `RegisterService` RPC method
- Implementing the `RegisterService` method in the keeper

This feature allows users to register new services on the DID chain, which is an important part of the overall DID functionality.
This commit is contained in:
Prad Nukala
2024-08-10 15:24:22 -04:00
committed by Prad Nukala (aider)
parent f91107d88e
commit 24db9de0ad
9 changed files with 5555 additions and 2457 deletions
+16 -9
View File
@@ -29,16 +29,23 @@ func (ms msgServer) UpdateParams(ctx context.Context, msg *types.MsgUpdateParams
return nil, ms.k.Params.Set(ctx, msg.Params)
}
// AuthenticateController implements types.MsgServer.
func (ms msgServer) AuthenticateController(ctx context.Context, msg *types.MsgAuthenticateController) (*types.MsgAuthenticateControllerResponse, error) {
// ctx := sdk.UnwrapSDKContext(goCtx)
panic("AuthenticateController is unimplemented")
return &types.MsgAuthenticateControllerResponse{}, nil
}
// RegisterController implements types.MsgServer.
func (ms msgServer) RegisterController(ctx context.Context, msg *types.MsgInitializeController) (*types.MsgInitializeControllerResponse, error) {
func (ms msgServer) RegisterController(ctx context.Context, msg *types.MsgRegisterController) (*types.MsgRegisterControllerResponse, error) {
// ctx := sdk.UnwrapSDKContext(goCtx)
panic("RegisterController is unimplemented")
return &types.MsgInitializeControllerResponse{}, nil
return &types.MsgRegisterControllerResponse{}, nil
}
// Authenticate implements types.MsgServer.
func (ms msgServer) Authenticate(ctx context.Context, msg *types.MsgAuthenticate) (*types.MsgAuthenticateResponse, error) {
// ctx := sdk.UnwrapSDKContext(goCtx)
panic("Authenticate is unimplemented")
return &types.MsgAuthenticateResponse{}, nil
}
// RegisterService implements types.MsgServer.
func (ms msgServer) RegisterService(ctx context.Context, msg *types.MsgRegisterService) (*types.MsgRegisterServiceResponse, error) {
// ctx := sdk.UnwrapSDKContext(goCtx)
panic("RegisterService is unimplemented")
return &types.MsgRegisterServiceResponse{}, nil
}
+369 -97
View File
@@ -466,10 +466,14 @@ type Service struct {
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
// The type of the service
ServiceType string `protobuf:"bytes,2,opt,name=service_type,json=serviceType,proto3" json:"service_type,omitempty"`
// The service endpoint
ServiceEndpoint string `protobuf:"bytes,3,opt,name=service_endpoint,json=serviceEndpoint,proto3" json:"service_endpoint,omitempty"`
// The controller DID of the service
ControllerDid string `protobuf:"bytes,4,opt,name=controller_did,json=controllerDid,proto3" json:"controller_did,omitempty"`
ControllerDid string `protobuf:"bytes,3,opt,name=controller_did,json=controllerDid,proto3" json:"controller_did,omitempty"`
// The domain name of the service
OriginUri string `protobuf:"bytes,4,opt,name=origin_uri,json=originUri,proto3" json:"origin_uri,omitempty"`
// The service endpoint
ServiceEndpoints map[string]string `protobuf:"bytes,5,rep,name=service_endpoints,json=serviceEndpoints,proto3" json:"service_endpoints,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
// Scopes is the Authorization Grants of the service
Scopes []PermissionScope `protobuf:"varint,6,rep,packed,name=scopes,proto3,enum=did.v1.PermissionScope" json:"scopes,omitempty"`
}
func (m *Service) Reset() { *m = Service{} }
@@ -519,13 +523,6 @@ func (m *Service) GetServiceType() string {
return ""
}
func (m *Service) GetServiceEndpoint() string {
if m != nil {
return m.ServiceEndpoint
}
return ""
}
func (m *Service) GetControllerDid() string {
if m != nil {
return m.ControllerDid
@@ -533,6 +530,27 @@ func (m *Service) GetControllerDid() string {
return ""
}
func (m *Service) GetOriginUri() string {
if m != nil {
return m.OriginUri
}
return ""
}
func (m *Service) GetServiceEndpoints() map[string]string {
if m != nil {
return m.ServiceEndpoints
}
return nil
}
func (m *Service) GetScopes() []PermissionScope {
if m != nil {
return m.Scopes
}
return nil
}
func init() {
proto.RegisterType((*Aliases)(nil), "did.v1.Aliases")
proto.RegisterType((*Assertion)(nil), "did.v1.Assertion")
@@ -542,55 +560,61 @@ func init() {
proto.RegisterType((*Delegation)(nil), "did.v1.Delegation")
proto.RegisterMapType((map[string]string)(nil), "did.v1.Delegation.PublicKeyJwksEntry")
proto.RegisterType((*Service)(nil), "did.v1.Service")
proto.RegisterMapType((map[string]string)(nil), "did.v1.Service.ServiceEndpointsEntry")
}
func init() { proto.RegisterFile("did/v1/state.proto", fileDescriptor_f44bb702879c34b4) }
var fileDescriptor_f44bb702879c34b4 = []byte{
// 685 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x94, 0x3f, 0x6f, 0x13, 0x4d,
0x10, 0xc6, 0x73, 0x3e, 0xff, 0x1d, 0xdb, 0x89, 0xb5, 0x8a, 0xf2, 0xde, 0x6b, 0xc0, 0x18, 0xa3,
0x48, 0xa1, 0xb1, 0x09, 0x34, 0x28, 0xa1, 0xc0, 0x24, 0x29, 0x00, 0x45, 0x42, 0x86, 0x8a, 0xc6,
0x5a, 0x7b, 0x37, 0xf6, 0xe2, 0xf3, 0xee, 0x69, 0x77, 0xed, 0xe4, 0x3a, 0x7a, 0x24, 0x44, 0x41,
0x9d, 0x96, 0x92, 0xaf, 0x41, 0x19, 0x89, 0x86, 0x12, 0x25, 0xdf, 0x80, 0x4f, 0x80, 0xf6, 0xf6,
0x1c, 0x1f, 0x76, 0x00, 0x21, 0xba, 0xec, 0x33, 0x33, 0x99, 0xdf, 0x3c, 0x33, 0x3e, 0x40, 0x84,
0x91, 0xd6, 0x74, 0xbb, 0xa5, 0x34, 0xd6, 0xb4, 0x19, 0x48, 0xa1, 0x05, 0xca, 0x12, 0x46, 0x9a,
0xd3, 0xed, 0xea, 0x7f, 0x7d, 0xa1, 0xc6, 0x42, 0xb5, 0x84, 0x1c, 0x9b, 0x14, 0x21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6f, 0x94, 0xba, 0xb6, 0x05, 0x00, 0x00,
// 755 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x95, 0x3f, 0x6f, 0x3b, 0x35,
0x18, 0xc7, 0x7b, 0xb9, 0xfc, 0x7d, 0xf2, 0x87, 0x60, 0x95, 0x5f, 0x8f, 0x40, 0x43, 0x08, 0xaa,
0x94, 0x29, 0x47, 0xcb, 0x82, 0x5a, 0x06, 0x42, 0xdb, 0x01, 0x50, 0xa5, 0x2a, 0x85, 0x85, 0x25,
0xba, 0x9c, 0xdd, 0xc4, 0xe4, 0xce, 0x3e, 0xd9, 0x4e, 0xda, 0xdb, 0xd8, 0x91, 0x10, 0x03, 0x33,
0x2b, 0x23, 0x6f, 0x83, 0xb1, 0x12, 0x0b, 0x03, 0x03, 0x6a, 0xdf, 0x01, 0xaf, 0x00, 0xdd, 0xd9,
0xd7, 0x5c, 0x93, 0x02, 0xfa, 0xa9, 0x53, 0xe2, 0xcf, 0xf3, 0xd8, 0xcf, 0xf7, 0xf9, 0xfa, 0x49,
0x0c, 0x08, 0x53, 0xec, 0xae, 0x0e, 0x5d, 0xa9, 0x3c, 0x45, 0x86, 0x91, 0xe0, 0x8a, 0xa3, 0x32,
0xa6, 0x78, 0xb8, 0x3a, 0xec, 0xec, 0xf9, 0x5c, 0x86, 0x5c, 0xba, 0x5c, 0x84, 0x49, 0x0a, 0x17,
0xa1, 0x4e, 0xe8, 0xec, 0x9a, 0x4d, 0x33, 0xc2, 0x88, 0xa4, 0xd2, 0xd0, 0xec, 0x28, 0xc2, 0x96,
0xa1, 0x61, 0xfd, 0x5f, 0x2c, 0xa8, 0x8c, 0x02, 0xea, 0x49, 0x22, 0x51, 0x0b, 0x0a, 0x14, 0x3b,
0x56, 0xcf, 0x1a, 0xd4, 0xc6, 0x05, 0x8a, 0xd1, 0x2b, 0x28, 0x73, 0x41, 0x67, 0x94, 0x39,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xba, 0xc9, 0x4b, 0x91, 0xf8, 0x2d, 0xa7,
0xe5, 0xf4, 0x9d, 0xf8, 0xe8, 0x9f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x6b, 0x5a, 0x9d, 0xc9, 0x88,
0x06, 0x00, 0x00,
}
func (m *Aliases) Marshal() (dAtA []byte, err error) {
@@ -944,18 +968,55 @@ func (m *Service) MarshalToSizedBuffer(dAtA []byte) (int, error) {
_ = i
var l int
_ = l
if len(m.Scopes) > 0 {
dAtA2 := make([]byte, len(m.Scopes)*10)
var j1 int
for _, num := range m.Scopes {
for num >= 1<<7 {
dAtA2[j1] = uint8(uint64(num)&0x7f | 0x80)
num >>= 7
j1++
}
dAtA2[j1] = uint8(num)
j1++
}
i -= j1
copy(dAtA[i:], dAtA2[:j1])
i = encodeVarintState(dAtA, i, uint64(j1))
i--
dAtA[i] = 0x32
}
if len(m.ServiceEndpoints) > 0 {
for k := range m.ServiceEndpoints {
v := m.ServiceEndpoints[k]
baseI := i
i -= len(v)
copy(dAtA[i:], v)
i = encodeVarintState(dAtA, i, uint64(len(v)))
i--
dAtA[i] = 0x12
i -= len(k)
copy(dAtA[i:], k)
i = encodeVarintState(dAtA, i, uint64(len(k)))
i--
dAtA[i] = 0xa
i = encodeVarintState(dAtA, i, uint64(baseI-i))
i--
dAtA[i] = 0x2a
}
}
if len(m.OriginUri) > 0 {
i -= len(m.OriginUri)
copy(dAtA[i:], m.OriginUri)
i = encodeVarintState(dAtA, i, uint64(len(m.OriginUri)))
i--
dAtA[i] = 0x22
}
if len(m.ControllerDid) > 0 {
i -= len(m.ControllerDid)
copy(dAtA[i:], m.ControllerDid)
i = encodeVarintState(dAtA, i, uint64(len(m.ControllerDid)))
i--
dAtA[i] = 0x22
}
if len(m.ServiceEndpoint) > 0 {
i -= len(m.ServiceEndpoint)
copy(dAtA[i:], m.ServiceEndpoint)
i = encodeVarintState(dAtA, i, uint64(len(m.ServiceEndpoint)))
i--
dAtA[i] = 0x1a
}
if len(m.ServiceType) > 0 {
@@ -1163,14 +1224,29 @@ func (m *Service) Size() (n int) {
if l > 0 {
n += 1 + l + sovState(uint64(l))
}
l = len(m.ServiceEndpoint)
if l > 0 {
n += 1 + l + sovState(uint64(l))
}
l = len(m.ControllerDid)
if l > 0 {
n += 1 + l + sovState(uint64(l))
}
l = len(m.OriginUri)
if l > 0 {
n += 1 + l + sovState(uint64(l))
}
if len(m.ServiceEndpoints) > 0 {
for k, v := range m.ServiceEndpoints {
_ = k
_ = v
mapEntrySize := 1 + len(k) + sovState(uint64(len(k))) + 1 + len(v) + sovState(uint64(len(v)))
n += mapEntrySize + 1 + sovState(uint64(mapEntrySize))
}
}
if len(m.Scopes) > 0 {
l = 0
for _, e := range m.Scopes {
l += sovState(uint64(e))
}
n += 1 + sovState(uint64(l)) + l
}
return n
}
@@ -2588,38 +2664,6 @@ func (m *Service) Unmarshal(dAtA []byte) error {
m.ServiceType = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 3:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field ServiceEndpoint", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowState
}
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 ErrInvalidLengthState
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthState
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.ServiceEndpoint = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 4:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field ControllerDid", wireType)
}
@@ -2651,6 +2695,234 @@ func (m *Service) Unmarshal(dAtA []byte) error {
}
m.ControllerDid = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 4:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field OriginUri", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowState
}
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 ErrInvalidLengthState
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthState
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.OriginUri = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 5:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field ServiceEndpoints", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowState
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthState
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthState
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if m.ServiceEndpoints == nil {
m.ServiceEndpoints = make(map[string]string)
}
var mapkey string
var mapvalue string
for iNdEx < postIndex {
entryPreIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowState
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
if fieldNum == 1 {
var stringLenmapkey uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowState
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLenmapkey |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLenmapkey := int(stringLenmapkey)
if intStringLenmapkey < 0 {
return ErrInvalidLengthState
}
postStringIndexmapkey := iNdEx + intStringLenmapkey
if postStringIndexmapkey < 0 {
return ErrInvalidLengthState
}
if postStringIndexmapkey > l {
return io.ErrUnexpectedEOF
}
mapkey = string(dAtA[iNdEx:postStringIndexmapkey])
iNdEx = postStringIndexmapkey
} else if fieldNum == 2 {
var stringLenmapvalue uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowState
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLenmapvalue |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLenmapvalue := int(stringLenmapvalue)
if intStringLenmapvalue < 0 {
return ErrInvalidLengthState
}
postStringIndexmapvalue := iNdEx + intStringLenmapvalue
if postStringIndexmapvalue < 0 {
return ErrInvalidLengthState
}
if postStringIndexmapvalue > l {
return io.ErrUnexpectedEOF
}
mapvalue = string(dAtA[iNdEx:postStringIndexmapvalue])
iNdEx = postStringIndexmapvalue
} else {
iNdEx = entryPreIndex
skippy, err := skipState(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthState
}
if (iNdEx + skippy) > postIndex {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
m.ServiceEndpoints[mapkey] = mapvalue
iNdEx = postIndex
case 6:
if wireType == 0 {
var v PermissionScope
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowState
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
v |= PermissionScope(b&0x7F) << shift
if b < 0x80 {
break
}
}
m.Scopes = append(m.Scopes, v)
} else if wireType == 2 {
var packedLen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowState
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
packedLen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if packedLen < 0 {
return ErrInvalidLengthState
}
postIndex := iNdEx + packedLen
if postIndex < 0 {
return ErrInvalidLengthState
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
var elementCount int
if elementCount != 0 && len(m.Scopes) == 0 {
m.Scopes = make([]PermissionScope, 0, elementCount)
}
for iNdEx < postIndex {
var v PermissionScope
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowState
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
v |= PermissionScope(b&0x7F) << shift
if b < 0x80 {
break
}
}
m.Scopes = append(m.Scopes, v)
}
} else {
return fmt.Errorf("proto: wrong wireType = %d for field Scopes", wireType)
}
default:
iNdEx = preIndex
skippy, err := skipState(dAtA[iNdEx:])
+1219 -520
View File
File diff suppressed because it is too large Load Diff