feat: add support for parent field and resources list in Capability message

This commit is contained in:
Prad Nukala
2024-11-26 20:51:58 -05:00
parent 93770d481a
commit f89260bacd
9 changed files with 838 additions and 199 deletions
+45 -45
View File
@@ -62,7 +62,7 @@ func (x *_Credential_3_list) IsValid() bool {
var (
md_Credential protoreflect.MessageDescriptor
fd_Credential_id protoreflect.FieldDescriptor
fd_Credential_type protoreflect.FieldDescriptor
fd_Credential_kind protoreflect.FieldDescriptor
fd_Credential_transports protoreflect.FieldDescriptor
fd_Credential_public_key protoreflect.FieldDescriptor
fd_Credential_attestation_type protoreflect.FieldDescriptor
@@ -73,7 +73,7 @@ func init() {
file_dwn_v1_state_proto_init()
md_Credential = File_dwn_v1_state_proto.Messages().ByName("Credential")
fd_Credential_id = md_Credential.Fields().ByName("id")
fd_Credential_type = md_Credential.Fields().ByName("type")
fd_Credential_kind = md_Credential.Fields().ByName("kind")
fd_Credential_transports = md_Credential.Fields().ByName("transports")
fd_Credential_public_key = md_Credential.Fields().ByName("public_key")
fd_Credential_attestation_type = md_Credential.Fields().ByName("attestation_type")
@@ -151,9 +151,9 @@ func (x *fastReflection_Credential) Range(f func(protoreflect.FieldDescriptor, p
return
}
}
if x.Type_ != "" {
value := protoreflect.ValueOfString(x.Type_)
if !f(fd_Credential_type, value) {
if x.Kind != "" {
value := protoreflect.ValueOfString(x.Kind)
if !f(fd_Credential_kind, value) {
return
}
}
@@ -198,8 +198,8 @@ func (x *fastReflection_Credential) Has(fd protoreflect.FieldDescriptor) bool {
switch fd.FullName() {
case "dwn.v1.Credential.id":
return len(x.Id) != 0
case "dwn.v1.Credential.type":
return x.Type_ != ""
case "dwn.v1.Credential.kind":
return x.Kind != ""
case "dwn.v1.Credential.transports":
return len(x.Transports) != 0
case "dwn.v1.Credential.public_key":
@@ -226,8 +226,8 @@ func (x *fastReflection_Credential) Clear(fd protoreflect.FieldDescriptor) {
switch fd.FullName() {
case "dwn.v1.Credential.id":
x.Id = nil
case "dwn.v1.Credential.type":
x.Type_ = ""
case "dwn.v1.Credential.kind":
x.Kind = ""
case "dwn.v1.Credential.transports":
x.Transports = nil
case "dwn.v1.Credential.public_key":
@@ -255,8 +255,8 @@ func (x *fastReflection_Credential) Get(descriptor protoreflect.FieldDescriptor)
case "dwn.v1.Credential.id":
value := x.Id
return protoreflect.ValueOfBytes(value)
case "dwn.v1.Credential.type":
value := x.Type_
case "dwn.v1.Credential.kind":
value := x.Kind
return protoreflect.ValueOfString(value)
case "dwn.v1.Credential.transports":
if len(x.Transports) == 0 {
@@ -295,8 +295,8 @@ func (x *fastReflection_Credential) Set(fd protoreflect.FieldDescriptor, value p
switch fd.FullName() {
case "dwn.v1.Credential.id":
x.Id = value.Bytes()
case "dwn.v1.Credential.type":
x.Type_ = value.Interface().(string)
case "dwn.v1.Credential.kind":
x.Kind = value.Interface().(string)
case "dwn.v1.Credential.transports":
lv := value.List()
clv := lv.(*_Credential_3_list)
@@ -335,8 +335,8 @@ func (x *fastReflection_Credential) Mutable(fd protoreflect.FieldDescriptor) pro
return protoreflect.ValueOfList(value)
case "dwn.v1.Credential.id":
panic(fmt.Errorf("field id of message dwn.v1.Credential is not mutable"))
case "dwn.v1.Credential.type":
panic(fmt.Errorf("field type of message dwn.v1.Credential is not mutable"))
case "dwn.v1.Credential.kind":
panic(fmt.Errorf("field kind of message dwn.v1.Credential is not mutable"))
case "dwn.v1.Credential.public_key":
panic(fmt.Errorf("field public_key of message dwn.v1.Credential is not mutable"))
case "dwn.v1.Credential.attestation_type":
@@ -358,7 +358,7 @@ func (x *fastReflection_Credential) NewField(fd protoreflect.FieldDescriptor) pr
switch fd.FullName() {
case "dwn.v1.Credential.id":
return protoreflect.ValueOfBytes(nil)
case "dwn.v1.Credential.type":
case "dwn.v1.Credential.kind":
return protoreflect.ValueOfString("")
case "dwn.v1.Credential.transports":
list := []string{}
@@ -442,7 +442,7 @@ func (x *fastReflection_Credential) ProtoMethods() *protoiface.Methods {
if l > 0 {
n += 1 + l + runtime.Sov(uint64(l))
}
l = len(x.Type_)
l = len(x.Kind)
if l > 0 {
n += 1 + l + runtime.Sov(uint64(l))
}
@@ -520,10 +520,10 @@ func (x *fastReflection_Credential) ProtoMethods() *protoiface.Methods {
dAtA[i] = 0x1a
}
}
if len(x.Type_) > 0 {
i -= len(x.Type_)
copy(dAtA[i:], x.Type_)
i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Type_)))
if len(x.Kind) > 0 {
i -= len(x.Kind)
copy(dAtA[i:], x.Kind)
i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Kind)))
i--
dAtA[i] = 0x12
}
@@ -619,7 +619,7 @@ func (x *fastReflection_Credential) ProtoMethods() *protoiface.Methods {
iNdEx = postIndex
case 2:
if wireType != 2 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Type_", wireType)
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Kind", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
@@ -647,7 +647,7 @@ func (x *fastReflection_Credential) ProtoMethods() *protoiface.Methods {
if postIndex > l {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
}
x.Type_ = string(dAtA[iNdEx:postIndex])
x.Kind = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 3:
if wireType != 2 {
@@ -1290,7 +1290,7 @@ type Credential struct {
unknownFields protoimpl.UnknownFields
Id []byte `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` // The credential ID as a byte array
Type_ string `protobuf:"bytes,2,opt,name=type,proto3" json:"type,omitempty"` // The credential type (e.g. "public-key")
Kind string `protobuf:"bytes,2,opt,name=kind,proto3" json:"kind,omitempty"` // The credential type (e.g. "public-key")
Transports []string `protobuf:"bytes,3,rep,name=transports,proto3" json:"transports,omitempty"` // Optional transport hints (usb, nfc, ble, internal)
PublicKey []byte `protobuf:"bytes,4,opt,name=public_key,json=publicKey,proto3" json:"public_key,omitempty"` // The credential's public key
AttestationType string `protobuf:"bytes,5,opt,name=attestation_type,json=attestationType,proto3" json:"attestation_type,omitempty"` // The attestation type used (e.g. "none", "indirect", etc)
@@ -1324,9 +1324,9 @@ func (x *Credential) GetId() []byte {
return nil
}
func (x *Credential) GetType_() string {
func (x *Credential) GetKind() string {
if x != nil {
return x.Type_
return x.Kind
}
return ""
}
@@ -1408,10 +1408,10 @@ var file_dwn_v1_state_proto_rawDesc = []byte{
0x0a, 0x12, 0x64, 0x77, 0x6e, 0x2f, 0x76, 0x31, 0x2f, 0x73, 0x74, 0x61, 0x74, 0x65, 0x2e, 0x70,
0x72, 0x6f, 0x74, 0x6f, 0x12, 0x06, 0x64, 0x77, 0x6e, 0x2e, 0x76, 0x31, 0x1a, 0x17, 0x63, 0x6f,
0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x6f, 0x72, 0x6d, 0x2f, 0x76, 0x31, 0x2f, 0x6f, 0x72, 0x6d, 0x2e,
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xd3, 0x01, 0x0a, 0x0a, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e,
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xc9, 0x01, 0x0a, 0x0a, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e,
0x74, 0x69, 0x61, 0x6c, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c,
0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01,
0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x74, 0x72, 0x61, 0x6e,
0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6b, 0x69, 0x6e, 0x64, 0x18, 0x02, 0x20, 0x01,
0x28, 0x09, 0x52, 0x04, 0x6b, 0x69, 0x6e, 0x64, 0x12, 0x1e, 0x0a, 0x0a, 0x74, 0x72, 0x61, 0x6e,
0x73, 0x70, 0x6f, 0x72, 0x74, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0a, 0x74, 0x72,
0x61, 0x6e, 0x73, 0x70, 0x6f, 0x72, 0x74, 0x73, 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x75, 0x62, 0x6c,
0x69, 0x63, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x70, 0x75,
@@ -1420,22 +1420,22 @@ var file_dwn_v1_state_proto_rawDesc = []byte{
0x09, 0x52, 0x0f, 0x61, 0x74, 0x74, 0x65, 0x73, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x79,
0x70, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74,
0x18, 0x06, 0x20, 0x01, 0x28, 0x04, 0x52, 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41,
0x74, 0x3a, 0x18, 0xf2, 0x9e, 0xd3, 0x8e, 0x03, 0x12, 0x0a, 0x04, 0x0a, 0x02, 0x69, 0x64, 0x12,
0x08, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x10, 0x01, 0x18, 0x01, 0x22, 0x5c, 0x0a, 0x07, 0x50,
0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e,
0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74,
0x12, 0x16, 0x0a, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04,
0x52, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x3a, 0x1f, 0xf2, 0x9e, 0xd3, 0x8e, 0x03, 0x19,
0x0a, 0x09, 0x0a, 0x07, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x0a, 0x0a, 0x06, 0x61,
0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x10, 0x01, 0x18, 0x02, 0x42, 0x7a, 0x0a, 0x0a, 0x63, 0x6f, 0x6d,
0x2e, 0x64, 0x77, 0x6e, 0x2e, 0x76, 0x31, 0x42, 0x0a, 0x53, 0x74, 0x61, 0x74, 0x65, 0x50, 0x72,
0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x27, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f,
0x6d, 0x2f, 0x6f, 0x6e, 0x73, 0x6f, 0x6e, 0x72, 0x2f, 0x73, 0x6f, 0x6e, 0x72, 0x2f, 0x61, 0x70,
0x69, 0x2f, 0x64, 0x77, 0x6e, 0x2f, 0x76, 0x31, 0x3b, 0x64, 0x77, 0x6e, 0x76, 0x31, 0xa2, 0x02,
0x03, 0x44, 0x58, 0x58, 0xaa, 0x02, 0x06, 0x44, 0x77, 0x6e, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x06,
0x44, 0x77, 0x6e, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x12, 0x44, 0x77, 0x6e, 0x5c, 0x56, 0x31, 0x5c,
0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x07, 0x44, 0x77,
0x6e, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
0x74, 0x3a, 0x0e, 0xf2, 0x9e, 0xd3, 0x8e, 0x03, 0x08, 0x0a, 0x04, 0x0a, 0x02, 0x69, 0x64, 0x18,
0x01, 0x22, 0x5c, 0x0a, 0x07, 0x50, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x12, 0x18, 0x0a, 0x07,
0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x61,
0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74,
0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x3a, 0x1f,
0xf2, 0x9e, 0xd3, 0x8e, 0x03, 0x19, 0x0a, 0x09, 0x0a, 0x07, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e,
0x74, 0x12, 0x0a, 0x0a, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x10, 0x01, 0x18, 0x02, 0x42,
0x7a, 0x0a, 0x0a, 0x63, 0x6f, 0x6d, 0x2e, 0x64, 0x77, 0x6e, 0x2e, 0x76, 0x31, 0x42, 0x0a, 0x53,
0x74, 0x61, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x27, 0x67, 0x69, 0x74,
0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6f, 0x6e, 0x73, 0x6f, 0x6e, 0x72, 0x2f, 0x73,
0x6f, 0x6e, 0x72, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x64, 0x77, 0x6e, 0x2f, 0x76, 0x31, 0x3b, 0x64,
0x77, 0x6e, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x44, 0x58, 0x58, 0xaa, 0x02, 0x06, 0x44, 0x77, 0x6e,
0x2e, 0x56, 0x31, 0xca, 0x02, 0x06, 0x44, 0x77, 0x6e, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x12, 0x44,
0x77, 0x6e, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74,
0x61, 0xea, 0x02, 0x07, 0x44, 0x77, 0x6e, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f,
0x74, 0x6f, 0x33,
}
var (