mirror of
https://github.com/sonr-io/sonr.git
synced 2026-08-04 10:21:40 +00:00
feat: add support for parent field and resources list in Capability message
This commit is contained in:
@@ -81,7 +81,6 @@ func (k Keeper) Logger() log.Logger {
|
||||
|
||||
// InitGenesis initializes the module's state from a genesis state.
|
||||
func (k *Keeper) InitGenesis(ctx context.Context, data *types.GenesisState) error {
|
||||
|
||||
if err := data.Params.Validate(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -1,5 +1,36 @@
|
||||
package types
|
||||
|
||||
// Define capability hierarchy for smart account operations
|
||||
const (
|
||||
// Root capabilities
|
||||
CAP_OWNER = "OWNER" // Full account control
|
||||
CAP_OPERATOR = "OPERATOR" // Can perform operations
|
||||
CAP_OBSERVER = "OBSERVER" // Can view account state
|
||||
|
||||
// Operation capabilities
|
||||
CAP_EXECUTE = "EXECUTE" // Can execute transactions
|
||||
CAP_PROPOSE = "PROPOSE" // Can propose transactions
|
||||
CAP_SIGN = "SIGN" // Can sign transactions
|
||||
|
||||
// Policy capabilities
|
||||
CAP_SET_POLICY = "SET_POLICY" // Can modify account policies
|
||||
CAP_SET_THRESHOLD = "SET_THRESHOLD" // Can modify signing threshold
|
||||
|
||||
// Recovery capabilities
|
||||
CAP_RECOVER = "RECOVER" // Can initiate recovery
|
||||
CAP_SOCIAL = "SOCIAL" // Can act as social recovery
|
||||
)
|
||||
|
||||
// Resource types for smart account operations
|
||||
type ResourceType string
|
||||
|
||||
const (
|
||||
RES_ACCOUNT = "account"
|
||||
RES_TRANSACTION = "tx"
|
||||
RES_POLICY = "policy"
|
||||
RES_RECOVERY = "recovery"
|
||||
)
|
||||
|
||||
// DefaultIndex is the default global index
|
||||
const DefaultIndex uint64 = 1
|
||||
|
||||
|
||||
+162
-53
@@ -132,8 +132,10 @@ func (m *Params) GetSchema() *Schema {
|
||||
|
||||
// Capability reprensents the available capabilities of a decentralized web node
|
||||
type Capability struct {
|
||||
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
|
||||
Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"`
|
||||
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
|
||||
Parent string `protobuf:"bytes,2,opt,name=parent,proto3" json:"parent,omitempty"`
|
||||
Description string `protobuf:"bytes,3,opt,name=description,proto3" json:"description,omitempty"`
|
||||
Resources []string `protobuf:"bytes,4,rep,name=resources,proto3" json:"resources,omitempty"`
|
||||
}
|
||||
|
||||
func (m *Capability) Reset() { *m = Capability{} }
|
||||
@@ -176,6 +178,13 @@ func (m *Capability) GetName() string {
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *Capability) GetParent() string {
|
||||
if m != nil {
|
||||
return m.Parent
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *Capability) GetDescription() string {
|
||||
if m != nil {
|
||||
return m.Description
|
||||
@@ -183,10 +192,17 @@ func (m *Capability) GetDescription() string {
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *Capability) GetResources() []string {
|
||||
if m != nil {
|
||||
return m.Resources
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Resource reprensents the available resources of a decentralized web node
|
||||
type Resource struct {
|
||||
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
|
||||
Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"`
|
||||
Kind string `protobuf:"bytes,1,opt,name=kind,proto3" json:"kind,omitempty"`
|
||||
Template string `protobuf:"bytes,2,opt,name=template,proto3" json:"template,omitempty"`
|
||||
}
|
||||
|
||||
func (m *Resource) Reset() { *m = Resource{} }
|
||||
@@ -222,16 +238,16 @@ func (m *Resource) XXX_DiscardUnknown() {
|
||||
|
||||
var xxx_messageInfo_Resource proto.InternalMessageInfo
|
||||
|
||||
func (m *Resource) GetName() string {
|
||||
func (m *Resource) GetKind() string {
|
||||
if m != nil {
|
||||
return m.Name
|
||||
return m.Kind
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *Resource) GetDescription() string {
|
||||
func (m *Resource) GetTemplate() string {
|
||||
if m != nil {
|
||||
return m.Description
|
||||
return m.Template
|
||||
}
|
||||
return ""
|
||||
}
|
||||
@@ -364,37 +380,40 @@ func init() {
|
||||
func init() { proto.RegisterFile("dwn/v1/genesis.proto", fileDescriptor_8e7492a25d5871dc) }
|
||||
|
||||
var fileDescriptor_8e7492a25d5871dc = []byte{
|
||||
// 478 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x92, 0x31, 0x8f, 0xd3, 0x30,
|
||||
0x1c, 0xc5, 0x13, 0xae, 0xcd, 0xb5, 0xff, 0x9e, 0x10, 0x58, 0x1d, 0x4c, 0x87, 0xf4, 0xd4, 0x01,
|
||||
0x21, 0x84, 0x12, 0x1d, 0x6c, 0xa8, 0x03, 0x14, 0x21, 0x56, 0x94, 0xdb, 0x58, 0x2a, 0xd7, 0xf1,
|
||||
0xa5, 0xbe, 0x26, 0x76, 0x64, 0xbb, 0x29, 0xfd, 0x0a, 0x4c, 0x8c, 0x8c, 0x37, 0x33, 0xf1, 0x31,
|
||||
0x6e, 0xbc, 0x91, 0x09, 0xa1, 0x76, 0x80, 0x8f, 0xc0, 0x88, 0x6c, 0xe7, 0x50, 0x59, 0x6f, 0xb1,
|
||||
0xfe, 0xef, 0xf7, 0xfe, 0x79, 0x79, 0xb2, 0x0c, 0xc3, 0x7c, 0x23, 0xd2, 0xe6, 0x2c, 0x2d, 0x98,
|
||||
0x60, 0x9a, 0xeb, 0xa4, 0x56, 0xd2, 0x48, 0x14, 0xe5, 0x1b, 0x91, 0x34, 0x67, 0xa3, 0x61, 0x21,
|
||||
0x0b, 0xe9, 0x50, 0x6a, 0x27, 0xef, 0x8e, 0x1e, 0x92, 0x8a, 0x0b, 0x99, 0xba, 0xd3, 0xa3, 0xc9,
|
||||
0x14, 0x4e, 0xde, 0xf9, 0x84, 0x73, 0x43, 0x0c, 0x43, 0xcf, 0x20, 0xaa, 0x89, 0x22, 0x95, 0xc6,
|
||||
0xe1, 0x69, 0xf8, 0x64, 0xf0, 0xfc, 0x7e, 0xe2, 0x13, 0x93, 0xf7, 0x8e, 0xce, 0x3a, 0xd7, 0x3f,
|
||||
0xc6, 0x41, 0xd6, 0xee, 0x4c, 0xbe, 0x86, 0x10, 0x79, 0x03, 0x8d, 0x61, 0xc0, 0xeb, 0x0b, 0x3d,
|
||||
0x27, 0xd4, 0xf0, 0x86, 0xb9, 0xaf, 0x7b, 0x19, 0x58, 0xf4, 0xda, 0x11, 0x34, 0x85, 0x51, 0x29,
|
||||
0x29, 0x29, 0xe7, 0x8a, 0x15, 0x5c, 0x1b, 0x45, 0x0c, 0x97, 0x62, 0xce, 0x04, 0x59, 0x94, 0x2c,
|
||||
0xc7, 0xf7, 0xdc, 0x3e, 0x76, 0x1b, 0xd9, 0xc1, 0xc2, 0x5b, 0xef, 0xa3, 0xc7, 0x10, 0x69, 0xba,
|
||||
0x64, 0x15, 0xc1, 0x9d, 0xff, 0x7b, 0x9d, 0x3b, 0x9a, 0xb5, 0xee, 0xcb, 0x47, 0x5f, 0xae, 0xc6,
|
||||
0xc1, 0xef, 0xab, 0x71, 0xf8, 0xe9, 0xd7, 0xb7, 0xa7, 0x27, 0x0d, 0x59, 0x97, 0x26, 0x6d, 0xcb,
|
||||
0xce, 0x00, 0xde, 0x90, 0x9a, 0x2c, 0x78, 0xc9, 0xcd, 0x16, 0x21, 0xe8, 0x08, 0x52, 0xf9, 0xa2,
|
||||
0xfd, 0xcc, 0xcd, 0xe8, 0x14, 0x06, 0x39, 0xd3, 0x54, 0xf1, 0xda, 0xfe, 0xda, 0x75, 0xea, 0x67,
|
||||
0x87, 0x68, 0xf2, 0x0a, 0x7a, 0x19, 0xd3, 0x72, 0xad, 0x28, 0xbb, 0x63, 0xc2, 0x9f, 0x10, 0x22,
|
||||
0xdf, 0x19, 0x61, 0x38, 0x6e, 0x98, 0xd2, 0x76, 0xd1, 0x66, 0x74, 0xb3, 0x5b, 0x69, 0x1d, 0x42,
|
||||
0xa9, 0x5c, 0x0b, 0xd3, 0x46, 0xdc, 0x4a, 0x34, 0x84, 0x2e, 0xd1, 0x9a, 0x19, 0x7c, 0xe4, 0xb8,
|
||||
0x17, 0x96, 0xd2, 0x25, 0xe1, 0xc2, 0x5d, 0x4e, 0x3f, 0xf3, 0x02, 0xc5, 0x00, 0x54, 0xb1, 0x9c,
|
||||
0x09, 0xc3, 0x49, 0x89, 0xbb, 0xce, 0x3a, 0x20, 0xe8, 0x01, 0x1c, 0xe5, 0x3c, 0xc7, 0x91, 0x33,
|
||||
0xec, 0x68, 0xc9, 0xe5, 0x66, 0x85, 0x8f, 0x3d, 0xb9, 0xdc, 0xac, 0x6c, 0x72, 0xa1, 0x88, 0x30,
|
||||
0xb8, 0xe7, 0x93, 0x9d, 0x40, 0x23, 0xe8, 0xad, 0xd8, 0x56, 0x2f, 0x89, 0x62, 0xb8, 0xef, 0x8c,
|
||||
0x7f, 0xda, 0x76, 0xaf, 0x95, 0xbc, 0xe0, 0x25, 0xc3, 0xe0, 0xbb, 0xb7, 0x72, 0x36, 0xbd, 0xde,
|
||||
0xc5, 0xe1, 0xcd, 0x2e, 0x0e, 0x7f, 0xee, 0xe2, 0xf0, 0xf3, 0x3e, 0x0e, 0x6e, 0xf6, 0x71, 0xf0,
|
||||
0x7d, 0x1f, 0x07, 0x1f, 0x26, 0x05, 0x37, 0xcb, 0xf5, 0x22, 0xa1, 0xb2, 0x4a, 0xa5, 0xd0, 0x52,
|
||||
0xa8, 0xd4, 0x1d, 0x1f, 0x53, 0xfb, 0xca, 0xcd, 0xb6, 0x66, 0x7a, 0x11, 0xb9, 0x07, 0xfb, 0xe2,
|
||||
0x6f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xfa, 0x30, 0xe3, 0x96, 0xf9, 0x02, 0x00, 0x00,
|
||||
// 519 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x54, 0x93, 0x31, 0x6f, 0x13, 0x31,
|
||||
0x14, 0xc7, 0x73, 0x34, 0xbd, 0xe6, 0x5e, 0x2b, 0x04, 0x56, 0x85, 0x4c, 0x84, 0x2e, 0x51, 0x06,
|
||||
0x54, 0x21, 0x94, 0x53, 0x61, 0xab, 0xb2, 0x50, 0x84, 0x58, 0xd1, 0x75, 0x63, 0x89, 0x9c, 0xbb,
|
||||
0xd7, 0x8b, 0x9b, 0x3b, 0xfb, 0x64, 0x3b, 0x49, 0xf3, 0x15, 0x98, 0x18, 0x19, 0x3b, 0x33, 0xf1,
|
||||
0x31, 0x3a, 0x76, 0x64, 0x42, 0x28, 0x19, 0xe0, 0x23, 0x30, 0x22, 0xdb, 0x97, 0x12, 0x16, 0xeb,
|
||||
0xfd, 0x7f, 0xff, 0xe7, 0xe7, 0xff, 0x8b, 0x72, 0x70, 0x9c, 0x2f, 0x45, 0xb2, 0x38, 0x4d, 0x0a,
|
||||
0x14, 0xa8, 0xb9, 0x1e, 0xd6, 0x4a, 0x1a, 0x49, 0xc2, 0x7c, 0x29, 0x86, 0x8b, 0xd3, 0xee, 0x71,
|
||||
0x21, 0x0b, 0xe9, 0x50, 0x62, 0x2b, 0xef, 0x76, 0x1f, 0xb3, 0x8a, 0x0b, 0x99, 0xb8, 0xd3, 0xa3,
|
||||
0xc1, 0x08, 0x8e, 0xde, 0xfb, 0x09, 0x17, 0x86, 0x19, 0x24, 0x2f, 0x21, 0xac, 0x99, 0x62, 0x95,
|
||||
0xa6, 0x41, 0x3f, 0x38, 0x39, 0x7c, 0xf5, 0x70, 0xe8, 0x27, 0x0e, 0x3f, 0x38, 0x7a, 0xde, 0xbe,
|
||||
0xfd, 0xd1, 0x6b, 0xa5, 0x4d, 0xcf, 0xe0, 0x6b, 0x00, 0xa1, 0x37, 0x48, 0x0f, 0x0e, 0x79, 0x7d,
|
||||
0xa9, 0xc7, 0x2c, 0x33, 0x7c, 0x81, 0xee, 0x76, 0x27, 0x05, 0x8b, 0xde, 0x38, 0x42, 0x46, 0xd0,
|
||||
0x2d, 0x65, 0xc6, 0xca, 0xb1, 0xc2, 0x82, 0x6b, 0xa3, 0x98, 0xe1, 0x52, 0x8c, 0x51, 0xb0, 0x49,
|
||||
0x89, 0x39, 0x7d, 0xe0, 0xfa, 0xa9, 0xeb, 0x48, 0x77, 0x1a, 0xde, 0x79, 0x9f, 0x3c, 0x87, 0x50,
|
||||
0x67, 0x53, 0xac, 0x18, 0x6d, 0xff, 0x9f, 0xeb, 0xc2, 0xd1, 0xb4, 0x71, 0xcf, 0x9e, 0x7e, 0xb9,
|
||||
0xe9, 0xb5, 0x7e, 0xdf, 0xf4, 0x82, 0x4f, 0xbf, 0xbe, 0xbd, 0x38, 0x5a, 0xb0, 0x79, 0x69, 0x92,
|
||||
0x26, 0xec, 0x35, 0xc0, 0x5b, 0x56, 0xb3, 0x09, 0x2f, 0xb9, 0x59, 0x11, 0x02, 0x6d, 0xc1, 0x2a,
|
||||
0x1f, 0x34, 0x4a, 0x5d, 0x4d, 0x9e, 0xb8, 0xe5, 0x51, 0x18, 0x17, 0x27, 0x4a, 0x1b, 0x45, 0xfa,
|
||||
0x70, 0x98, 0xa3, 0xce, 0x14, 0xaf, 0x6d, 0x24, 0xba, 0xe7, 0xcc, 0x5d, 0x44, 0x9e, 0x41, 0xa4,
|
||||
0x50, 0xcb, 0xb9, 0xca, 0x50, 0xd3, 0x76, 0x7f, 0xef, 0x24, 0x4a, 0xff, 0x81, 0xc1, 0x19, 0x74,
|
||||
0xd2, 0x46, 0xd8, 0x77, 0x67, 0x5c, 0xe4, 0xdb, 0x77, 0x6d, 0x4d, 0xba, 0xd0, 0x31, 0x58, 0xd5,
|
||||
0x25, 0x33, 0xd8, 0xbc, 0x7c, 0xaf, 0x07, 0x7f, 0x02, 0x08, 0xfd, 0x8e, 0x84, 0xc2, 0xc1, 0x02,
|
||||
0x95, 0xb6, 0x11, 0xec, 0xed, 0xfd, 0x74, 0x2b, 0xad, 0xc3, 0xb2, 0x4c, 0xce, 0xef, 0x93, 0x6f,
|
||||
0x25, 0x39, 0x86, 0x7d, 0xa6, 0x35, 0x9a, 0x26, 0xb4, 0x17, 0x96, 0x66, 0x53, 0xc6, 0x85, 0xfb,
|
||||
0x31, 0xa3, 0xd4, 0x0b, 0x12, 0x03, 0x64, 0x0a, 0x73, 0x14, 0x86, 0xb3, 0x92, 0xee, 0x3b, 0x6b,
|
||||
0x87, 0x90, 0x47, 0xb0, 0x97, 0xf3, 0x9c, 0x86, 0xce, 0xb0, 0xa5, 0x25, 0x57, 0xcb, 0x19, 0x3d,
|
||||
0xf0, 0xe4, 0x6a, 0x39, 0xb3, 0x93, 0x0b, 0xc5, 0x84, 0xa1, 0x1d, 0x3f, 0xd9, 0x09, 0xbb, 0xe0,
|
||||
0x0c, 0x57, 0x7a, 0xca, 0x14, 0xd2, 0xc8, 0x2f, 0xb8, 0xd5, 0x36, 0x7b, 0xad, 0xe4, 0x25, 0x2f,
|
||||
0x91, 0x82, 0xcf, 0xde, 0xc8, 0xf3, 0xd1, 0xed, 0x3a, 0x0e, 0xee, 0xd6, 0x71, 0xf0, 0x73, 0x1d,
|
||||
0x07, 0x9f, 0x37, 0x71, 0xeb, 0x6e, 0x13, 0xb7, 0xbe, 0x6f, 0xe2, 0xd6, 0xc7, 0x41, 0xc1, 0xcd,
|
||||
0x74, 0x3e, 0x19, 0x66, 0xb2, 0x4a, 0xa4, 0xd0, 0x52, 0xa8, 0xc4, 0x1d, 0xd7, 0x89, 0xfd, 0x2a,
|
||||
0xcc, 0xaa, 0x46, 0x3d, 0x09, 0xdd, 0x1f, 0xfc, 0xf5, 0xdf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x9d,
|
||||
0x36, 0x1c, 0x5c, 0x29, 0x03, 0x00, 0x00,
|
||||
}
|
||||
|
||||
func (this *Params) Equal(that interface{}) bool {
|
||||
@@ -535,11 +554,27 @@ func (m *Capability) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
_ = i
|
||||
var l int
|
||||
_ = l
|
||||
if len(m.Resources) > 0 {
|
||||
for iNdEx := len(m.Resources) - 1; iNdEx >= 0; iNdEx-- {
|
||||
i -= len(m.Resources[iNdEx])
|
||||
copy(dAtA[i:], m.Resources[iNdEx])
|
||||
i = encodeVarintGenesis(dAtA, i, uint64(len(m.Resources[iNdEx])))
|
||||
i--
|
||||
dAtA[i] = 0x22
|
||||
}
|
||||
}
|
||||
if len(m.Description) > 0 {
|
||||
i -= len(m.Description)
|
||||
copy(dAtA[i:], m.Description)
|
||||
i = encodeVarintGenesis(dAtA, i, uint64(len(m.Description)))
|
||||
i--
|
||||
dAtA[i] = 0x1a
|
||||
}
|
||||
if len(m.Parent) > 0 {
|
||||
i -= len(m.Parent)
|
||||
copy(dAtA[i:], m.Parent)
|
||||
i = encodeVarintGenesis(dAtA, i, uint64(len(m.Parent)))
|
||||
i--
|
||||
dAtA[i] = 0x12
|
||||
}
|
||||
if len(m.Name) > 0 {
|
||||
@@ -572,17 +607,17 @@ func (m *Resource) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
_ = i
|
||||
var l int
|
||||
_ = l
|
||||
if len(m.Description) > 0 {
|
||||
i -= len(m.Description)
|
||||
copy(dAtA[i:], m.Description)
|
||||
i = encodeVarintGenesis(dAtA, i, uint64(len(m.Description)))
|
||||
if len(m.Template) > 0 {
|
||||
i -= len(m.Template)
|
||||
copy(dAtA[i:], m.Template)
|
||||
i = encodeVarintGenesis(dAtA, i, uint64(len(m.Template)))
|
||||
i--
|
||||
dAtA[i] = 0x12
|
||||
}
|
||||
if len(m.Name) > 0 {
|
||||
i -= len(m.Name)
|
||||
copy(dAtA[i:], m.Name)
|
||||
i = encodeVarintGenesis(dAtA, i, uint64(len(m.Name)))
|
||||
if len(m.Kind) > 0 {
|
||||
i -= len(m.Kind)
|
||||
copy(dAtA[i:], m.Kind)
|
||||
i = encodeVarintGenesis(dAtA, i, uint64(len(m.Kind)))
|
||||
i--
|
||||
dAtA[i] = 0xa
|
||||
}
|
||||
@@ -731,10 +766,20 @@ func (m *Capability) Size() (n int) {
|
||||
if l > 0 {
|
||||
n += 1 + l + sovGenesis(uint64(l))
|
||||
}
|
||||
l = len(m.Parent)
|
||||
if l > 0 {
|
||||
n += 1 + l + sovGenesis(uint64(l))
|
||||
}
|
||||
l = len(m.Description)
|
||||
if l > 0 {
|
||||
n += 1 + l + sovGenesis(uint64(l))
|
||||
}
|
||||
if len(m.Resources) > 0 {
|
||||
for _, s := range m.Resources {
|
||||
l = len(s)
|
||||
n += 1 + l + sovGenesis(uint64(l))
|
||||
}
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
@@ -744,11 +789,11 @@ func (m *Resource) Size() (n int) {
|
||||
}
|
||||
var l int
|
||||
_ = l
|
||||
l = len(m.Name)
|
||||
l = len(m.Kind)
|
||||
if l > 0 {
|
||||
n += 1 + l + sovGenesis(uint64(l))
|
||||
}
|
||||
l = len(m.Description)
|
||||
l = len(m.Template)
|
||||
if l > 0 {
|
||||
n += 1 + l + sovGenesis(uint64(l))
|
||||
}
|
||||
@@ -1080,6 +1125,38 @@ func (m *Capability) Unmarshal(dAtA []byte) error {
|
||||
m.Name = string(dAtA[iNdEx:postIndex])
|
||||
iNdEx = postIndex
|
||||
case 2:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Parent", wireType)
|
||||
}
|
||||
var stringLen uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowGenesis
|
||||
}
|
||||
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 ErrInvalidLengthGenesis
|
||||
}
|
||||
postIndex := iNdEx + intStringLen
|
||||
if postIndex < 0 {
|
||||
return ErrInvalidLengthGenesis
|
||||
}
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
m.Parent = string(dAtA[iNdEx:postIndex])
|
||||
iNdEx = postIndex
|
||||
case 3:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Description", wireType)
|
||||
}
|
||||
@@ -1111,6 +1188,38 @@ func (m *Capability) Unmarshal(dAtA []byte) error {
|
||||
}
|
||||
m.Description = string(dAtA[iNdEx:postIndex])
|
||||
iNdEx = postIndex
|
||||
case 4:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Resources", wireType)
|
||||
}
|
||||
var stringLen uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowGenesis
|
||||
}
|
||||
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 ErrInvalidLengthGenesis
|
||||
}
|
||||
postIndex := iNdEx + intStringLen
|
||||
if postIndex < 0 {
|
||||
return ErrInvalidLengthGenesis
|
||||
}
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
m.Resources = append(m.Resources, string(dAtA[iNdEx:postIndex]))
|
||||
iNdEx = postIndex
|
||||
default:
|
||||
iNdEx = preIndex
|
||||
skippy, err := skipGenesis(dAtA[iNdEx:])
|
||||
@@ -1163,7 +1272,7 @@ func (m *Resource) Unmarshal(dAtA []byte) error {
|
||||
switch fieldNum {
|
||||
case 1:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType)
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Kind", wireType)
|
||||
}
|
||||
var stringLen uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
@@ -1191,11 +1300,11 @@ func (m *Resource) Unmarshal(dAtA []byte) error {
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
m.Name = string(dAtA[iNdEx:postIndex])
|
||||
m.Kind = string(dAtA[iNdEx:postIndex])
|
||||
iNdEx = postIndex
|
||||
case 2:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Description", wireType)
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Template", wireType)
|
||||
}
|
||||
var stringLen uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
@@ -1223,7 +1332,7 @@ func (m *Resource) Unmarshal(dAtA []byte) error {
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
m.Description = string(dAtA[iNdEx:postIndex])
|
||||
m.Template = string(dAtA[iNdEx:postIndex])
|
||||
iNdEx = postIndex
|
||||
default:
|
||||
iNdEx = preIndex
|
||||
|
||||
+32
-32
@@ -25,7 +25,7 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
|
||||
|
||||
type Credential struct {
|
||||
Id []byte `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
|
||||
Type string `protobuf:"bytes,2,opt,name=type,proto3" json:"type,omitempty"`
|
||||
Kind string `protobuf:"bytes,2,opt,name=kind,proto3" json:"kind,omitempty"`
|
||||
Transports []string `protobuf:"bytes,3,rep,name=transports,proto3" json:"transports,omitempty"`
|
||||
PublicKey []byte `protobuf:"bytes,4,opt,name=public_key,json=publicKey,proto3" json:"public_key,omitempty"`
|
||||
AttestationType string `protobuf:"bytes,5,opt,name=attestation_type,json=attestationType,proto3" json:"attestation_type,omitempty"`
|
||||
@@ -72,9 +72,9 @@ func (m *Credential) GetId() []byte {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Credential) GetType() string {
|
||||
func (m *Credential) GetKind() string {
|
||||
if m != nil {
|
||||
return m.Type
|
||||
return m.Kind
|
||||
}
|
||||
return ""
|
||||
}
|
||||
@@ -167,29 +167,29 @@ func init() {
|
||||
func init() { proto.RegisterFile("dwn/v1/state.proto", fileDescriptor_040a9b061177db90) }
|
||||
|
||||
var fileDescriptor_040a9b061177db90 = []byte{
|
||||
// 342 bytes of a gzipped FileDescriptorProto
|
||||
// 339 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x4c, 0x91, 0xb1, 0x4e, 0xeb, 0x30,
|
||||
0x18, 0x85, 0xeb, 0x34, 0x37, 0xbd, 0xf9, 0x75, 0x75, 0x6f, 0xe5, 0xe1, 0x62, 0x90, 0x1a, 0xa2,
|
||||
0x4e, 0x61, 0x69, 0x54, 0xb1, 0x55, 0x2c, 0xc0, 0xc8, 0x82, 0x22, 0x26, 0x84, 0x54, 0xb9, 0x89,
|
||||
0x01, 0x8b, 0xc6, 0x8e, 0xec, 0xbf, 0x2d, 0x7d, 0x09, 0xc4, 0x13, 0xf0, 0x3c, 0x8c, 0x95, 0xba,
|
||||
0x30, 0xa2, 0xf6, 0x0d, 0x78, 0x02, 0x14, 0xb7, 0x45, 0x5d, 0x2c, 0x9f, 0xe3, 0xe3, 0xcf, 0xc7,
|
||||
0x36, 0xd0, 0x62, 0xa6, 0xd2, 0x69, 0x3f, 0xb5, 0xc8, 0x51, 0xf4, 0x2a, 0xa3, 0x51, 0xd3, 0xa0,
|
||||
0x98, 0xa9, 0xde, 0xb4, 0x7f, 0x74, 0x90, 0x6b, 0x5b, 0x6a, 0x9b, 0x6a, 0x53, 0xd6, 0x11, 0x6d,
|
||||
0xca, 0x4d, 0xa0, 0xbb, 0x24, 0x00, 0x97, 0x46, 0x14, 0x42, 0xa1, 0xe4, 0x63, 0xfa, 0x17, 0x3c,
|
||||
0x59, 0x30, 0x12, 0x93, 0xe4, 0x4f, 0xe6, 0xc9, 0x82, 0x52, 0xf0, 0x71, 0x5e, 0x09, 0xe6, 0xc5,
|
||||
0x24, 0x09, 0x33, 0x37, 0xa7, 0x11, 0x00, 0x1a, 0xae, 0x6c, 0xa5, 0x0d, 0x5a, 0xd6, 0x8c, 0x9b,
|
||||
0x49, 0x98, 0xed, 0x39, 0xb4, 0x03, 0x50, 0x4d, 0x46, 0x63, 0x99, 0x0f, 0x9f, 0xc4, 0x9c, 0xf9,
|
||||
0x8e, 0x15, 0x6e, 0x9c, 0x2b, 0x31, 0xa7, 0x27, 0xd0, 0xe6, 0x88, 0xa2, 0x6e, 0x29, 0xb5, 0x1a,
|
||||
0x3a, 0xfc, 0x2f, 0x87, 0xff, 0xb7, 0xe7, 0xdf, 0xd4, 0x27, 0x75, 0x00, 0x72, 0x23, 0x38, 0x8a,
|
||||
0x62, 0xc8, 0x91, 0x05, 0x31, 0x49, 0xfc, 0x2c, 0xdc, 0x3a, 0xe7, 0x38, 0x60, 0x5f, 0x6f, 0xcb,
|
||||
0x97, 0x26, 0x05, 0xbf, 0x2e, 0x4d, 0x7f, 0x6f, 0xaa, 0xb6, 0x09, 0x23, 0xdd, 0x3b, 0x68, 0x5d,
|
||||
0x1b, 0x7d, 0x2f, 0xc7, 0x82, 0x32, 0x68, 0xf1, 0x3c, 0xd7, 0x13, 0x85, 0xdb, 0x6b, 0xed, 0x24,
|
||||
0xfd, 0x0f, 0x01, 0x2f, 0xdd, 0x82, 0xe7, 0xc8, 0x5b, 0x35, 0x38, 0x76, 0xd8, 0x43, 0x08, 0x7f,
|
||||
0x76, 0x52, 0xd8, 0x45, 0xdb, 0x84, 0x79, 0x17, 0x67, 0xef, 0xab, 0x88, 0x2c, 0x56, 0x11, 0xf9,
|
||||
0x5c, 0x45, 0xe4, 0x75, 0x1d, 0x35, 0x16, 0xeb, 0xa8, 0xf1, 0xb1, 0x8e, 0x1a, 0xb7, 0xdd, 0x07,
|
||||
0x89, 0x8f, 0x93, 0x51, 0x2f, 0xd7, 0x65, 0xaa, 0x95, 0xd5, 0xca, 0xa4, 0x6e, 0x78, 0x4e, 0xeb,
|
||||
0xbf, 0xa9, 0xeb, 0xd9, 0x51, 0xe0, 0x1e, 0xfe, 0xf4, 0x3b, 0x00, 0x00, 0xff, 0xff, 0x23, 0x73,
|
||||
0xed, 0xc6, 0xaf, 0x01, 0x00, 0x00,
|
||||
0x14, 0x86, 0xeb, 0x34, 0x37, 0xbd, 0x39, 0xba, 0xea, 0xad, 0x3c, 0x80, 0x41, 0x22, 0x44, 0x9d,
|
||||
0xc2, 0xd2, 0xa8, 0x62, 0xab, 0x58, 0x80, 0x91, 0x05, 0x45, 0x4c, 0x08, 0xa9, 0x72, 0x13, 0x03,
|
||||
0x56, 0x1b, 0x3b, 0x72, 0x4e, 0x5b, 0xf2, 0x12, 0x88, 0x27, 0xe0, 0x79, 0x60, 0xab, 0xc4, 0xc2,
|
||||
0x88, 0xda, 0x37, 0xe0, 0x09, 0x50, 0xdc, 0x16, 0x75, 0xb1, 0x7c, 0x3e, 0xff, 0xfe, 0x74, 0x8e,
|
||||
0x0d, 0x34, 0x9b, 0xab, 0x78, 0xd6, 0x8f, 0x4b, 0xe4, 0x28, 0x7a, 0x85, 0xd1, 0xa8, 0xa9, 0x97,
|
||||
0xcd, 0x55, 0x6f, 0xd6, 0x3f, 0xdc, 0x4f, 0x75, 0x99, 0xeb, 0x32, 0xd6, 0x26, 0xaf, 0x23, 0xda,
|
||||
0xe4, 0xeb, 0x40, 0xf7, 0x9d, 0x00, 0x5c, 0x1a, 0x91, 0x09, 0x85, 0x92, 0x4f, 0x68, 0x1b, 0x1c,
|
||||
0x99, 0x31, 0x12, 0x92, 0xe8, 0x5f, 0xe2, 0xc8, 0x8c, 0x52, 0x70, 0xc7, 0x52, 0x65, 0xcc, 0x09,
|
||||
0x49, 0xe4, 0x27, 0x76, 0x4f, 0x03, 0x00, 0x34, 0x5c, 0x95, 0x85, 0x36, 0x58, 0xb2, 0x66, 0xd8,
|
||||
0x8c, 0xfc, 0x64, 0x87, 0xd0, 0x23, 0x80, 0x62, 0x3a, 0x9a, 0xc8, 0x74, 0x38, 0x16, 0x15, 0x73,
|
||||
0xad, 0xcb, 0x5f, 0x93, 0x2b, 0x51, 0xd1, 0x13, 0xe8, 0x70, 0x44, 0x51, 0x77, 0x29, 0xb5, 0x1a,
|
||||
0x62, 0x55, 0x08, 0xf6, 0xc7, 0xea, 0xff, 0xef, 0xf0, 0x9b, 0xaa, 0x10, 0xb5, 0x29, 0x35, 0x82,
|
||||
0xa3, 0xc8, 0x86, 0x1c, 0x99, 0x17, 0x92, 0xc8, 0x4d, 0xfc, 0x0d, 0x39, 0xc7, 0x41, 0xfb, 0xfb,
|
||||
0xf5, 0xe3, 0xb9, 0xf9, 0x17, 0xdc, 0x75, 0xd3, 0xdd, 0x3b, 0x68, 0x5d, 0x1b, 0x7d, 0x2f, 0x27,
|
||||
0x82, 0x32, 0x68, 0xf1, 0x34, 0xd5, 0x53, 0x85, 0x9b, 0x61, 0xb6, 0x25, 0xdd, 0x03, 0x8f, 0xe7,
|
||||
0xf6, 0xc0, 0xb1, 0xbe, 0x4d, 0x35, 0x38, 0xb6, 0xb2, 0x03, 0xf0, 0x7f, 0x6f, 0x52, 0xd8, 0x46,
|
||||
0x3b, 0x84, 0x39, 0x17, 0x67, 0x6f, 0xcb, 0x80, 0x2c, 0x96, 0x01, 0xf9, 0x5a, 0x06, 0xe4, 0x65,
|
||||
0x15, 0x34, 0x16, 0xab, 0xa0, 0xf1, 0xb9, 0x0a, 0x1a, 0xb7, 0xdd, 0x07, 0x89, 0x8f, 0xd3, 0x51,
|
||||
0x2f, 0xd5, 0x79, 0xac, 0x55, 0xa9, 0x95, 0x89, 0xed, 0xf2, 0x14, 0xd7, 0x3f, 0x52, 0x0f, 0x58,
|
||||
0x8e, 0x3c, 0xfb, 0xdc, 0xa7, 0x3f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x45, 0xf1, 0xed, 0xf9, 0xa5,
|
||||
0x01, 0x00, 0x00,
|
||||
}
|
||||
|
||||
func (m *Credential) Marshal() (dAtA []byte, err error) {
|
||||
@@ -240,10 +240,10 @@ func (m *Credential) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
dAtA[i] = 0x1a
|
||||
}
|
||||
}
|
||||
if len(m.Type) > 0 {
|
||||
i -= len(m.Type)
|
||||
copy(dAtA[i:], m.Type)
|
||||
i = encodeVarintState(dAtA, i, uint64(len(m.Type)))
|
||||
if len(m.Kind) > 0 {
|
||||
i -= len(m.Kind)
|
||||
copy(dAtA[i:], m.Kind)
|
||||
i = encodeVarintState(dAtA, i, uint64(len(m.Kind)))
|
||||
i--
|
||||
dAtA[i] = 0x12
|
||||
}
|
||||
@@ -313,7 +313,7 @@ func (m *Credential) Size() (n int) {
|
||||
if l > 0 {
|
||||
n += 1 + l + sovState(uint64(l))
|
||||
}
|
||||
l = len(m.Type)
|
||||
l = len(m.Kind)
|
||||
if l > 0 {
|
||||
n += 1 + l + sovState(uint64(l))
|
||||
}
|
||||
@@ -424,7 +424,7 @@ func (m *Credential) Unmarshal(dAtA []byte) error {
|
||||
iNdEx = postIndex
|
||||
case 2:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType)
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Kind", wireType)
|
||||
}
|
||||
var stringLen uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
@@ -452,7 +452,7 @@ func (m *Credential) Unmarshal(dAtA []byte) error {
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
m.Type = string(dAtA[iNdEx:postIndex])
|
||||
m.Kind = string(dAtA[iNdEx:postIndex])
|
||||
iNdEx = postIndex
|
||||
case 3:
|
||||
if wireType != 2 {
|
||||
|
||||
Reference in New Issue
Block a user