diff --git a/api/vault/v1/genesis.pulsar.go b/api/vault/v1/genesis.pulsar.go index a789d0ff3..527134ec6 100644 --- a/api/vault/v1/genesis.pulsar.go +++ b/api/vault/v1/genesis.pulsar.go @@ -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 ( diff --git a/pkg/orm/DID.pkl.go b/pkg/orm/DID.pkl.go new file mode 100644 index 000000000..0544560e9 --- /dev/null +++ b/pkg/orm/DID.pkl.go @@ -0,0 +1,28 @@ +// Code generated from Pkl module `orm`. DO NOT EDIT. +package orm + +import ( + "github.com/onsonr/sonr/pkg/orm/keyalgorithm" + "github.com/onsonr/sonr/pkg/orm/keycurve" + "github.com/onsonr/sonr/pkg/orm/keyencoding" + "github.com/onsonr/sonr/pkg/orm/keyrole" + "github.com/onsonr/sonr/pkg/orm/keytype" +) + +type DID struct { + Id string `pkl:"id" json:"id,omitempty" query:"id"` + + Role keyrole.KeyRole `pkl:"role"` + + Algorithm keyalgorithm.KeyAlgorithm `pkl:"algorithm"` + + Encoding keyencoding.KeyEncoding `pkl:"encoding"` + + Curve keycurve.KeyCurve `pkl:"curve"` + + KeyType keytype.KeyType `pkl:"key_type"` + + Raw string `pkl:"raw"` + + Jwk *JWK `pkl:"jwk"` +} diff --git a/pkg/orm/Session.pkl.go b/pkg/orm/Session.pkl.go new file mode 100644 index 000000000..605903faf --- /dev/null +++ b/pkg/orm/Session.pkl.go @@ -0,0 +1,16 @@ +// Code generated from Pkl module `orm`. DO NOT EDIT. +package orm + +type Session struct { + Id string `pkl:"id" json:"id,omitempty" query:"id"` + + Subject string `pkl:"subject" json:"subject,omitempty"` + + Controller string `pkl:"controller" json:"controller,omitempty"` + + Origin string `pkl:"origin" json:"origin,omitempty"` + + CreatedAt *string `pkl:"createdAt" json:"createdAt,omitempty"` + + UpdatedAt *string `pkl:"updatedAt" json:"updatedAt,omitempty"` +} diff --git a/pkg/orm/init.pkl.go b/pkg/orm/init.pkl.go index 390916a45..97477b8d1 100644 --- a/pkg/orm/init.pkl.go +++ b/pkg/orm/init.pkl.go @@ -9,9 +9,10 @@ func init() { pkl.RegisterMapping("orm#Asset", Asset{}) pkl.RegisterMapping("orm#Chain", Chain{}) pkl.RegisterMapping("orm#Credential", Credential{}) + pkl.RegisterMapping("orm#DID", DID{}) pkl.RegisterMapping("orm#JWK", JWK{}) pkl.RegisterMapping("orm#Grant", Grant{}) pkl.RegisterMapping("orm#Keyshare", Keyshare{}) - pkl.RegisterMapping("orm#PublicKey", PublicKey{}) pkl.RegisterMapping("orm#Profile", Profile{}) + pkl.RegisterMapping("orm#Session", Session{}) } diff --git a/pkg/orm/schemas.go b/pkg/orm/schemas.go new file mode 100644 index 000000000..58006563e --- /dev/null +++ b/pkg/orm/schemas.go @@ -0,0 +1 @@ +package orm diff --git a/pkl/orm.pkl b/pkl/orm.pkl index 993f71a11..c6164b8df 100644 --- a/pkl/orm.pkl +++ b/pkl/orm.pkl @@ -10,7 +10,6 @@ typealias Base64 = String typealias Bech32 = String typealias Keccak = String -typealias DID = String typealias ChainCode = UInt typealias Scope = String @@ -53,7 +52,7 @@ typealias PermissionScope = "profile"|"metadata"|"permissions"|"wallets"|"transa class Account { @PrimaryKey - id: DID + id: String @JsonField name: String @@ -79,7 +78,7 @@ class Account { class Asset { @PrimaryKey - id: DID + id: String @JsonField name: String @@ -99,7 +98,7 @@ class Asset { class Chain { @PrimaryKey - id: DID + id: String @JsonField name: String @@ -116,7 +115,7 @@ class Chain { class Credential { @PrimaryKey - id: DID + id: String @JsonField subject: String @@ -170,6 +169,18 @@ class Credential { updatedAt: String? } +class DID { + @PrimaryKey + id: String + role: KeyRole + algorithm: KeyAlgorithm + encoding: KeyEncoding + curve: KeyCurve + key_type: KeyType + raw: Base64 + jwk: JWK +} + class JWK { @JsonField kty: String @@ -218,7 +229,7 @@ class Grant { class Keyshare { @PrimaryKey - id: DID + id: String @JsonField data: Base64 @@ -233,17 +244,6 @@ class Keyshare { lastRefreshed: String? } -class PublicKey { - @PrimaryKey - role: KeyRole - algorithm: KeyAlgorithm - encoding: KeyEncoding - curve: KeyCurve - key_type: KeyType - raw: Base58 - jwk: JWK -} - class Profile { @PrimaryKey id: String @@ -290,6 +290,5 @@ class Session { updatedAt: String? } - db_name: String = "vault" db_version: Int = 1 diff --git a/proto/vault/v1/genesis.proto b/proto/vault/v1/genesis.proto index cd59d66d8..0d20d48f3 100644 --- a/proto/vault/v1/genesis.proto +++ b/proto/vault/v1/genesis.proto @@ -29,8 +29,9 @@ message Schema { string asset = 3; string chain = 4; string credential = 5; - string jwk = 6; - string grant = 7; - string keyshare = 8; - string profile = 9; + string did = 6; + string jwk = 7; + string grant = 8; + string keyshare = 9; + string profile = 10; } diff --git a/x/vault/types/genesis.pb.go b/x/vault/types/genesis.pb.go index 643c99572..e3defe5be 100644 --- a/x/vault/types/genesis.pb.go +++ b/x/vault/types/genesis.pb.go @@ -136,10 +136,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 (m *Schema) Reset() { *m = Schema{} } @@ -210,6 +211,13 @@ func (m *Schema) GetCredential() string { return "" } +func (m *Schema) GetDid() string { + if m != nil { + return m.Did + } + return "" +} + func (m *Schema) GetJwk() string { if m != nil { return m.Jwk @@ -247,34 +255,35 @@ func init() { func init() { proto.RegisterFile("vault/v1/genesis.proto", fileDescriptor_4c971b352fb6cc17) } var fileDescriptor_4c971b352fb6cc17 = []byte{ - // 423 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x5c, 0x92, 0xb1, 0x6e, 0xd4, 0x40, - 0x10, 0x86, 0xbd, 0x24, 0xe7, 0xdc, 0x6d, 0x52, 0x84, 0x55, 0x84, 0x96, 0x2b, 0x7c, 0x28, 0xa2, - 0x88, 0x28, 0x6c, 0x05, 0x3a, 0x84, 0x22, 0x11, 0x09, 0xd1, 0x22, 0xa7, 0xa3, 0x39, 0xcd, 0x6d, - 0x26, 0xbe, 0x25, 0xbe, 0x5d, 0x6b, 0x77, 0xcf, 0x90, 0x57, 0xa0, 0xa2, 0xa4, 0xcc, 0x03, 0x50, - 0xf0, 0x18, 0x29, 0x53, 0x52, 0x21, 0x74, 0x27, 0x01, 0x8f, 0x81, 0x3c, 0xeb, 0x43, 0x51, 0x9a, - 0xd5, 0xfc, 0xdf, 0xff, 0x7b, 0xf4, 0x6b, 0x64, 0xfe, 0xa8, 0x85, 0x65, 0x1d, 0x8a, 0xf6, 0xb8, - 0xa8, 0xd0, 0xa0, 0xd7, 0x3e, 0x6f, 0x9c, 0x0d, 0x56, 0x0c, 0x89, 0xe7, 0xed, 0xf1, 0xf8, 0x21, - 0x2c, 0xb4, 0xb1, 0x05, 0xbd, 0xd1, 0x1c, 0x1f, 0x54, 0xb6, 0xb2, 0x34, 0x16, 0xdd, 0x14, 0xe9, - 0xe1, 0x09, 0xdf, 0x7b, 0x1b, 0x77, 0x9c, 0x05, 0x08, 0x28, 0x72, 0x9e, 0x36, 0xe0, 0x60, 0xe1, - 0x25, 0x7b, 0xc2, 0x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, 0x20, 0x77, 0xe2, 0x1e, 0x12, 0x62, 0xcc, - 0x87, 0x97, 0x78, 0xe5, 0xe7, 0xe0, 0x50, 0x0e, 0xc9, 0xf8, 0xaf, 0xbb, 0xa6, 0x8d, 0xb3, 0x17, - 0xba, 0x46, 0x39, 0x8a, 0x4d, 0x7b, 0x79, 0x7a, 0x72, 0xb3, 0xca, 0xd8, 0xed, 0x2a, 0x63, 0xbf, - 0x56, 0x19, 0xfb, 0xb2, 0xce, 0x92, 0xdb, 0x75, 0x96, 0xfc, 0x58, 0x67, 0xc9, 0xfb, 0xa7, 0x95, - 0x0e, 0xf3, 0xe5, 0x2c, 0x57, 0x76, 0x51, 0x58, 0xe3, 0xad, 0x71, 0x05, 0x3d, 0x9f, 0x8a, 0x78, - 0xa9, 0x70, 0xd5, 0xa0, 0x9f, 0xa5, 0xf4, 0x7b, 0xbc, 0xf8, 0x17, 0x00, 0x00, 0xff, 0xff, 0xb6, - 0xf1, 0x38, 0xc9, 0x6b, 0x02, 0x00, 0x00, + // 434 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x5c, 0x92, 0x31, 0x6f, 0xd3, 0x40, + 0x14, 0xc7, 0x6d, 0xda, 0xb8, 0xc9, 0xb5, 0x43, 0x39, 0x55, 0xe8, 0xc8, 0xe0, 0xa0, 0x8a, 0xa1, + 0x62, 0xb0, 0x55, 0xd8, 0x10, 0xaa, 0x44, 0x25, 0xc4, 0x8a, 0xdc, 0x8d, 0x25, 0x7a, 0x71, 0x5e, + 0x9d, 0x6b, 0x9c, 0x3b, 0xeb, 0xee, 0xe2, 0xd2, 0xaf, 0xc0, 0xc4, 0xc8, 0xd8, 0x0f, 0xc0, 0xc0, + 0xc7, 0xe8, 0xd8, 0x91, 0x09, 0xa1, 0x64, 0x80, 0x8f, 0xc0, 0x88, 0xee, 0x9d, 0x83, 0xa2, 0x2e, + 0xa7, 0xf7, 0xff, 0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, 0xb5, 0xa2, 0xaa, 0xbd, 0x62, 0x23, + 0xbd, 0x03, 0x65, 0xa9, 0x97, 0xca, 0x51, 0xa9, 0x41, 0xb1, 0x91, 0xfc, 0x88, 0xf5, 0xc0, 0x5a, + 0x74, 0x62, 0x87, 0x78, 0x10, 0x9e, 0x96, 0x33, 0x90, 0x8a, 0x8a, 0x0d, 0x8a, 0x20, 0x78, 0xca, + 0x58, 0x69, 0x70, 0x8a, 0xca, 0x49, 0xa8, 0x45, 0x8f, 0xac, 0x2d, 0xc2, 0x0f, 0xd9, 0xce, 0x54, + 0x4e, 0x45, 0x42, 0x86, 0x1f, 0x3d, 0xb9, 0xba, 0x9e, 0x8b, 0xbd, 0x40, 0xae, 0xae, 0xe7, 0x7e, + 0x73, 0x65, 0x40, 0x39, 0xd1, 0x0f, 0x9b, 0x49, 0xf0, 0x21, 0xeb, 0xcf, 0xf1, 0xc6, 0xce, 0xc0, + 0xa0, 0x18, 0x90, 0xf1, 0x5f, 0xfb, 0xee, 0x8d, 0xd1, 0x97, 0xb2, 0x46, 0xc1, 0x42, 0xf7, 0x4e, + 0x9e, 0x9f, 0xdd, 0xad, 0xd2, 0xf8, 0x7e, 0x95, 0xc6, 0xbf, 0x56, 0x69, 0xfc, 0x65, 0x9d, 0x46, + 0xf7, 0xeb, 0x34, 0xfa, 0xb1, 0x4e, 0xa3, 0x8f, 0xcf, 0x2b, 0xe9, 0x66, 0xcb, 0x49, 0x56, 0xea, + 0x45, 0xae, 0x95, 0xd5, 0xca, 0xe4, 0xf4, 0x7c, 0xca, 0xc3, 0xed, 0xdc, 0x4d, 0x83, 0x76, 0x92, + 0xd0, 0x0f, 0xf3, 0xea, 0x5f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xc9, 0x54, 0x04, 0x35, 0x7d, 0x02, + 0x00, 0x00, } func (this *Params) Equal(that interface{}) bool { @@ -420,27 +429,34 @@ func (m *Schema) MarshalToSizedBuffer(dAtA []byte) (int, error) { copy(dAtA[i:], m.Profile) i = encodeVarintGenesis(dAtA, i, uint64(len(m.Profile))) i-- - dAtA[i] = 0x4a + dAtA[i] = 0x52 } if len(m.Keyshare) > 0 { i -= len(m.Keyshare) copy(dAtA[i:], m.Keyshare) i = encodeVarintGenesis(dAtA, i, uint64(len(m.Keyshare))) i-- - dAtA[i] = 0x42 + dAtA[i] = 0x4a } if len(m.Grant) > 0 { i -= len(m.Grant) copy(dAtA[i:], m.Grant) i = encodeVarintGenesis(dAtA, i, uint64(len(m.Grant))) i-- - dAtA[i] = 0x3a + dAtA[i] = 0x42 } if len(m.Jwk) > 0 { i -= len(m.Jwk) copy(dAtA[i:], m.Jwk) i = encodeVarintGenesis(dAtA, i, uint64(len(m.Jwk))) i-- + dAtA[i] = 0x3a + } + if len(m.Did) > 0 { + i -= len(m.Did) + copy(dAtA[i:], m.Did) + i = encodeVarintGenesis(dAtA, i, uint64(len(m.Did))) + i-- dAtA[i] = 0x32 } if len(m.Credential) > 0 { @@ -545,6 +561,10 @@ func (m *Schema) Size() (n int) { if l > 0 { n += 1 + l + sovGenesis(uint64(l)) } + l = len(m.Did) + if l > 0 { + n += 1 + l + sovGenesis(uint64(l)) + } l = len(m.Jwk) if l > 0 { n += 1 + l + sovGenesis(uint64(l)) @@ -956,6 +976,38 @@ func (m *Schema) Unmarshal(dAtA []byte) error { m.Credential = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Did", 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.Did = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 7: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Jwk", wireType) } @@ -987,7 +1039,7 @@ func (m *Schema) Unmarshal(dAtA []byte) error { } m.Jwk = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 7: + case 8: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Grant", wireType) } @@ -1019,7 +1071,7 @@ func (m *Schema) Unmarshal(dAtA []byte) error { } m.Grant = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 8: + case 9: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Keyshare", wireType) } @@ -1051,7 +1103,7 @@ func (m *Schema) Unmarshal(dAtA []byte) error { } m.Keyshare = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 9: + case 10: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Profile", wireType) }