feat: add PKL schema for message formats

This commit is contained in:
Prad Nukala
2024-09-30 19:44:16 -04:00
parent d9b1ac72a3
commit aa830517f3
58 changed files with 1201 additions and 133 deletions
-1
View File
@@ -101,7 +101,6 @@ func (k Keeper) CurrentSchema(ctx sdk.Context) (*dwn.Schema, error) {
Jwk: schema.Jwk,
Grant: schema.Grant,
Keyshare: schema.Keyshare,
PublicKey: schema.PublicKey,
Profile: schema.Profile,
}, nil
}
-3
View File
@@ -49,9 +49,6 @@ func (s *Schema) Equal(that *Schema) bool {
if s.Keyshare != that.Keyshare {
return false
}
if s.PublicKey != that.PublicKey {
return false
}
if s.Profile != that.Profile {
return false
}
+29 -81
View File
@@ -139,8 +139,7 @@ type Schema struct {
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"`
PublicKey string `protobuf:"bytes,9,opt,name=publicKey,proto3" json:"publicKey,omitempty"`
Profile string `protobuf:"bytes,10,opt,name=profile,proto3" json:"profile,omitempty"`
Profile string `protobuf:"bytes,9,opt,name=profile,proto3" json:"profile,omitempty"`
}
func (m *Schema) Reset() { *m = Schema{} }
@@ -232,13 +231,6 @@ func (m *Schema) GetKeyshare() string {
return ""
}
func (m *Schema) GetPublicKey() string {
if m != nil {
return m.PublicKey
}
return ""
}
func (m *Schema) GetProfile() string {
if m != nil {
return m.Profile
@@ -255,35 +247,34 @@ func init() {
func init() { proto.RegisterFile("vault/v1/genesis.proto", fileDescriptor_4c971b352fb6cc17) }
var fileDescriptor_4c971b352fb6cc17 = []byte{
// 440 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x5c, 0x92, 0xb1, 0x6f, 0xd3, 0x40,
0x14, 0xc6, 0xed, 0xb6, 0x71, 0x93, 0xd7, 0x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, 0x2a, 0x8d, 0x7e, 0xac, 0xd2, 0xe8, 0xdd, 0xe3,
0x52, 0xf9, 0xe9, 0x7c, 0x92, 0x49, 0x33, 0xcb, 0x8d, 0x76, 0x46, 0xdb, 0x9c, 0x8e, 0x8f, 0x79,
0x78, 0x47, 0xbf, 0xa8, 0xd1, 0x4d, 0x12, 0xfa, 0x79, 0x9e, 0xfd, 0x0d, 0x00, 0x00, 0xff, 0xff,
0x57, 0x11, 0x84, 0xf3, 0x89, 0x02, 0x00, 0x00,
// 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, 0x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0xb7, 0x3e, 0x7c, 0xbc,
0x94, 0x29, 0x19, 0xdd, 0xd8, 0xed, 0xa9, 0x1c, 0x98, 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,
}
func (this *Params) Equal(that interface{}) bool {
@@ -429,13 +420,6 @@ func (m *Schema) MarshalToSizedBuffer(dAtA []byte) (int, error) {
copy(dAtA[i:], m.Profile)
i = encodeVarintGenesis(dAtA, i, uint64(len(m.Profile)))
i--
dAtA[i] = 0x52
}
if len(m.PublicKey) > 0 {
i -= len(m.PublicKey)
copy(dAtA[i:], m.PublicKey)
i = encodeVarintGenesis(dAtA, i, uint64(len(m.PublicKey)))
i--
dAtA[i] = 0x4a
}
if len(m.Keyshare) > 0 {
@@ -573,10 +557,6 @@ func (m *Schema) Size() (n int) {
if l > 0 {
n += 1 + l + sovGenesis(uint64(l))
}
l = len(m.PublicKey)
if l > 0 {
n += 1 + l + sovGenesis(uint64(l))
}
l = len(m.Profile)
if l > 0 {
n += 1 + l + sovGenesis(uint64(l))
@@ -1072,38 +1052,6 @@ func (m *Schema) Unmarshal(dAtA []byte) error {
m.Keyshare = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 9:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field PublicKey", 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.PublicKey = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 10:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Profile", wireType)
}
-1
View File
@@ -40,7 +40,6 @@ func DefaultSchema() *Schema {
Jwk: "++, kty, crv, x, y, n, e",
Grant: "++, subject, controller, origin, token, scopes, createdAt, updatedAt",
Keyshare: "++, id, data, role, createdAt, lastRefreshed",
PublicKey: "++, role, algorithm, encoding, curve, key_type, raw, jwk",
Profile: "++, id, subject, controller, originUri, publicMetadata, privateMetadata, createdAt, updatedAt",
}
}