feat: add DID to vault genesis schema

This commit is contained in:
Prad Nukala
2024-10-01 18:55:02 -04:00
parent f5f0578dcc
commit fa6bb93c78
8 changed files with 259 additions and 88 deletions
+100 -27
View File
@@ -999,6 +999,7 @@ var (
fd_Schema_asset protoreflect.FieldDescriptor
fd_Schema_chain protoreflect.FieldDescriptor
fd_Schema_credential protoreflect.FieldDescriptor
fd_Schema_did protoreflect.FieldDescriptor
fd_Schema_jwk protoreflect.FieldDescriptor
fd_Schema_grant protoreflect.FieldDescriptor
fd_Schema_keyshare protoreflect.FieldDescriptor
@@ -1013,6 +1014,7 @@ func init() {
fd_Schema_asset = md_Schema.Fields().ByName("asset")
fd_Schema_chain = md_Schema.Fields().ByName("chain")
fd_Schema_credential = md_Schema.Fields().ByName("credential")
fd_Schema_did = md_Schema.Fields().ByName("did")
fd_Schema_jwk = md_Schema.Fields().ByName("jwk")
fd_Schema_grant = md_Schema.Fields().ByName("grant")
fd_Schema_keyshare = md_Schema.Fields().ByName("keyshare")
@@ -1114,6 +1116,12 @@ func (x *fastReflection_Schema) Range(f func(protoreflect.FieldDescriptor, proto
return
}
}
if x.Did != "" {
value := protoreflect.ValueOfString(x.Did)
if !f(fd_Schema_did, value) {
return
}
}
if x.Jwk != "" {
value := protoreflect.ValueOfString(x.Jwk)
if !f(fd_Schema_jwk, value) {
@@ -1163,6 +1171,8 @@ func (x *fastReflection_Schema) Has(fd protoreflect.FieldDescriptor) bool {
return x.Chain != ""
case "vault.v1.Schema.credential":
return x.Credential != ""
case "vault.v1.Schema.did":
return x.Did != ""
case "vault.v1.Schema.jwk":
return x.Jwk != ""
case "vault.v1.Schema.grant":
@@ -1197,6 +1207,8 @@ func (x *fastReflection_Schema) Clear(fd protoreflect.FieldDescriptor) {
x.Chain = ""
case "vault.v1.Schema.credential":
x.Credential = ""
case "vault.v1.Schema.did":
x.Did = ""
case "vault.v1.Schema.jwk":
x.Jwk = ""
case "vault.v1.Schema.grant":
@@ -1236,6 +1248,9 @@ func (x *fastReflection_Schema) Get(descriptor protoreflect.FieldDescriptor) pro
case "vault.v1.Schema.credential":
value := x.Credential
return protoreflect.ValueOfString(value)
case "vault.v1.Schema.did":
value := x.Did
return protoreflect.ValueOfString(value)
case "vault.v1.Schema.jwk":
value := x.Jwk
return protoreflect.ValueOfString(value)
@@ -1278,6 +1293,8 @@ func (x *fastReflection_Schema) Set(fd protoreflect.FieldDescriptor, value proto
x.Chain = value.Interface().(string)
case "vault.v1.Schema.credential":
x.Credential = value.Interface().(string)
case "vault.v1.Schema.did":
x.Did = value.Interface().(string)
case "vault.v1.Schema.jwk":
x.Jwk = value.Interface().(string)
case "vault.v1.Schema.grant":
@@ -1316,6 +1333,8 @@ func (x *fastReflection_Schema) Mutable(fd protoreflect.FieldDescriptor) protore
panic(fmt.Errorf("field chain of message vault.v1.Schema is not mutable"))
case "vault.v1.Schema.credential":
panic(fmt.Errorf("field credential of message vault.v1.Schema is not mutable"))
case "vault.v1.Schema.did":
panic(fmt.Errorf("field did of message vault.v1.Schema is not mutable"))
case "vault.v1.Schema.jwk":
panic(fmt.Errorf("field jwk of message vault.v1.Schema is not mutable"))
case "vault.v1.Schema.grant":
@@ -1347,6 +1366,8 @@ func (x *fastReflection_Schema) NewField(fd protoreflect.FieldDescriptor) protor
return protoreflect.ValueOfString("")
case "vault.v1.Schema.credential":
return protoreflect.ValueOfString("")
case "vault.v1.Schema.did":
return protoreflect.ValueOfString("")
case "vault.v1.Schema.jwk":
return protoreflect.ValueOfString("")
case "vault.v1.Schema.grant":
@@ -1443,6 +1464,10 @@ func (x *fastReflection_Schema) ProtoMethods() *protoiface.Methods {
if l > 0 {
n += 1 + l + runtime.Sov(uint64(l))
}
l = len(x.Did)
if l > 0 {
n += 1 + l + runtime.Sov(uint64(l))
}
l = len(x.Jwk)
if l > 0 {
n += 1 + l + runtime.Sov(uint64(l))
@@ -1493,27 +1518,34 @@ func (x *fastReflection_Schema) ProtoMethods() *protoiface.Methods {
copy(dAtA[i:], x.Profile)
i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Profile)))
i--
dAtA[i] = 0x4a
dAtA[i] = 0x52
}
if len(x.Keyshare) > 0 {
i -= len(x.Keyshare)
copy(dAtA[i:], x.Keyshare)
i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Keyshare)))
i--
dAtA[i] = 0x42
dAtA[i] = 0x4a
}
if len(x.Grant) > 0 {
i -= len(x.Grant)
copy(dAtA[i:], x.Grant)
i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Grant)))
i--
dAtA[i] = 0x3a
dAtA[i] = 0x42
}
if len(x.Jwk) > 0 {
i -= len(x.Jwk)
copy(dAtA[i:], x.Jwk)
i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Jwk)))
i--
dAtA[i] = 0x3a
}
if len(x.Did) > 0 {
i -= len(x.Did)
copy(dAtA[i:], x.Did)
i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Did)))
i--
dAtA[i] = 0x32
}
if len(x.Credential) > 0 {
@@ -1746,6 +1778,38 @@ func (x *fastReflection_Schema) ProtoMethods() *protoiface.Methods {
x.Credential = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 6:
if wireType != 2 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Did", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow
}
if iNdEx >= l {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength
}
if postIndex > l {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
}
x.Did = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 7:
if wireType != 2 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Jwk", wireType)
}
@@ -1777,7 +1841,7 @@ func (x *fastReflection_Schema) ProtoMethods() *protoiface.Methods {
}
x.Jwk = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 7:
case 8:
if wireType != 2 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Grant", wireType)
}
@@ -1809,7 +1873,7 @@ func (x *fastReflection_Schema) ProtoMethods() *protoiface.Methods {
}
x.Grant = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 8:
case 9:
if wireType != 2 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Keyshare", wireType)
}
@@ -1841,7 +1905,7 @@ func (x *fastReflection_Schema) ProtoMethods() *protoiface.Methods {
}
x.Keyshare = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 9:
case 10:
if wireType != 2 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Profile", wireType)
}
@@ -2020,10 +2084,11 @@ type Schema struct {
Asset string `protobuf:"bytes,3,opt,name=asset,proto3" json:"asset,omitempty"`
Chain string `protobuf:"bytes,4,opt,name=chain,proto3" json:"chain,omitempty"`
Credential string `protobuf:"bytes,5,opt,name=credential,proto3" json:"credential,omitempty"`
Jwk string `protobuf:"bytes,6,opt,name=jwk,proto3" json:"jwk,omitempty"`
Grant string `protobuf:"bytes,7,opt,name=grant,proto3" json:"grant,omitempty"`
Keyshare string `protobuf:"bytes,8,opt,name=keyshare,proto3" json:"keyshare,omitempty"`
Profile string `protobuf:"bytes,9,opt,name=profile,proto3" json:"profile,omitempty"`
Did string `protobuf:"bytes,6,opt,name=did,proto3" json:"did,omitempty"`
Jwk string `protobuf:"bytes,7,opt,name=jwk,proto3" json:"jwk,omitempty"`
Grant string `protobuf:"bytes,8,opt,name=grant,proto3" json:"grant,omitempty"`
Keyshare string `protobuf:"bytes,9,opt,name=keyshare,proto3" json:"keyshare,omitempty"`
Profile string `protobuf:"bytes,10,opt,name=profile,proto3" json:"profile,omitempty"`
}
func (x *Schema) Reset() {
@@ -2081,6 +2146,13 @@ func (x *Schema) GetCredential() string {
return ""
}
func (x *Schema) GetDid() string {
if x != nil {
return x.Did
}
return ""
}
func (x *Schema) GetJwk() string {
if x != nil {
return x.Jwk
@@ -2131,7 +2203,7 @@ var file_vault_v1_genesis_proto_rawDesc = []byte{
0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x76, 0x61, 0x75, 0x6c, 0x74, 0x2e, 0x76, 0x31,
0x2e, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x52, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x3a,
0x19, 0x98, 0xa0, 0x1f, 0x00, 0xe8, 0xa0, 0x1f, 0x01, 0x8a, 0xe7, 0xb0, 0x2a, 0x0c, 0x76, 0x61,
0x75, 0x6c, 0x74, 0x2f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x22, 0xe6, 0x01, 0x0a, 0x06, 0x53,
0x75, 0x6c, 0x74, 0x2f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x22, 0xf8, 0x01, 0x0a, 0x06, 0x53,
0x63, 0x68, 0x65, 0x6d, 0x61, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e,
0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12,
0x18, 0x0a, 0x07, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09,
@@ -2140,22 +2212,23 @@ var file_vault_v1_genesis_proto_rawDesc = []byte{
0x14, 0x0a, 0x05, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05,
0x63, 0x68, 0x61, 0x69, 0x6e, 0x12, 0x1e, 0x0a, 0x0a, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74,
0x69, 0x61, 0x6c, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x63, 0x72, 0x65, 0x64, 0x65,
0x6e, 0x74, 0x69, 0x61, 0x6c, 0x12, 0x10, 0x0a, 0x03, 0x6a, 0x77, 0x6b, 0x18, 0x06, 0x20, 0x01,
0x28, 0x09, 0x52, 0x03, 0x6a, 0x77, 0x6b, 0x12, 0x14, 0x0a, 0x05, 0x67, 0x72, 0x61, 0x6e, 0x74,
0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x67, 0x72, 0x61, 0x6e, 0x74, 0x12, 0x1a, 0x0a,
0x08, 0x6b, 0x65, 0x79, 0x73, 0x68, 0x61, 0x72, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52,
0x08, 0x6b, 0x65, 0x79, 0x73, 0x68, 0x61, 0x72, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x70, 0x72, 0x6f,
0x66, 0x69, 0x6c, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x70, 0x72, 0x6f, 0x66,
0x69, 0x6c, 0x65, 0x42, 0x8a, 0x01, 0x0a, 0x0c, 0x63, 0x6f, 0x6d, 0x2e, 0x76, 0x61, 0x75, 0x6c,
0x74, 0x2e, 0x76, 0x31, 0x42, 0x0c, 0x47, 0x65, 0x6e, 0x65, 0x73, 0x69, 0x73, 0x50, 0x72, 0x6f,
0x74, 0x6f, 0x50, 0x01, 0x5a, 0x2b, 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, 0x76, 0x61, 0x75, 0x6c, 0x74, 0x2f, 0x76, 0x31, 0x3b, 0x76, 0x61, 0x75, 0x6c, 0x74, 0x76,
0x31, 0xa2, 0x02, 0x03, 0x56, 0x58, 0x58, 0xaa, 0x02, 0x08, 0x56, 0x61, 0x75, 0x6c, 0x74, 0x2e,
0x56, 0x31, 0xca, 0x02, 0x08, 0x56, 0x61, 0x75, 0x6c, 0x74, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x14,
0x56, 0x61, 0x75, 0x6c, 0x74, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61,
0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x09, 0x56, 0x61, 0x75, 0x6c, 0x74, 0x3a, 0x3a, 0x56, 0x31,
0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
0x6e, 0x74, 0x69, 0x61, 0x6c, 0x12, 0x10, 0x0a, 0x03, 0x64, 0x69, 0x64, 0x18, 0x06, 0x20, 0x01,
0x28, 0x09, 0x52, 0x03, 0x64, 0x69, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x6a, 0x77, 0x6b, 0x18, 0x07,
0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6a, 0x77, 0x6b, 0x12, 0x14, 0x0a, 0x05, 0x67, 0x72, 0x61,
0x6e, 0x74, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x67, 0x72, 0x61, 0x6e, 0x74, 0x12,
0x1a, 0x0a, 0x08, 0x6b, 0x65, 0x79, 0x73, 0x68, 0x61, 0x72, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28,
0x09, 0x52, 0x08, 0x6b, 0x65, 0x79, 0x73, 0x68, 0x61, 0x72, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x70,
0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x70, 0x72,
0x6f, 0x66, 0x69, 0x6c, 0x65, 0x42, 0x8a, 0x01, 0x0a, 0x0c, 0x63, 0x6f, 0x6d, 0x2e, 0x76, 0x61,
0x75, 0x6c, 0x74, 0x2e, 0x76, 0x31, 0x42, 0x0c, 0x47, 0x65, 0x6e, 0x65, 0x73, 0x69, 0x73, 0x50,
0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x2b, 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, 0x76, 0x61, 0x75, 0x6c, 0x74, 0x2f, 0x76, 0x31, 0x3b, 0x76, 0x61, 0x75, 0x6c,
0x74, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x56, 0x58, 0x58, 0xaa, 0x02, 0x08, 0x56, 0x61, 0x75, 0x6c,
0x74, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x08, 0x56, 0x61, 0x75, 0x6c, 0x74, 0x5c, 0x56, 0x31, 0xe2,
0x02, 0x14, 0x56, 0x61, 0x75, 0x6c, 0x74, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65,
0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x09, 0x56, 0x61, 0x75, 0x6c, 0x74, 0x3a, 0x3a,
0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (