mirror of
https://github.com/sonr-io/sonr.git
synced 2026-08-03 01:41:44 +00:00
feature/implement did state (#15)
* refactor: update model proto * feat: add status field to Controller * feat: add Verification.Kind field to state protobuf to support different verification types * fix: remove QueryService and QueryResolve RPCs from query.proto
This commit is contained in:
@@ -1,27 +0,0 @@
|
||||
package types
|
||||
|
||||
import "lukechampine.com/blake3"
|
||||
|
||||
func (g *GlobalIntegrity) Update(address string) bool {
|
||||
return true
|
||||
}
|
||||
|
||||
func (g *GlobalIntegrity) getProof() (*Proof, error) {
|
||||
if g.Accumulator == nil {
|
||||
return NewProof(g.Controller, g.proofProperty(), g.seedKdf())
|
||||
}
|
||||
return &Proof{
|
||||
Issuer: g.Controller,
|
||||
Property: g.proofProperty(),
|
||||
Accumulator: g.Accumulator,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (g *GlobalIntegrity) proofProperty() string {
|
||||
return "did:sonr:integrity"
|
||||
}
|
||||
|
||||
func (g *GlobalIntegrity) seedKdf() []byte {
|
||||
res := blake3.Sum256([]byte(g.Seed))
|
||||
return res[:]
|
||||
}
|
||||
+82
-356
@@ -23,67 +23,6 @@ var _ = math.Inf
|
||||
// proto package needs to be updated.
|
||||
const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
|
||||
|
||||
// Alias defines a subject/origin pair
|
||||
type Alias struct {
|
||||
Subject string `protobuf:"bytes,1,opt,name=subject,proto3" json:"subject,omitempty"`
|
||||
Origin string `protobuf:"bytes,2,opt,name=origin,proto3" json:"origin,omitempty"`
|
||||
Controller string `protobuf:"bytes,3,opt,name=controller,proto3" json:"controller,omitempty"`
|
||||
}
|
||||
|
||||
func (m *Alias) Reset() { *m = Alias{} }
|
||||
func (m *Alias) String() string { return proto.CompactTextString(m) }
|
||||
func (*Alias) ProtoMessage() {}
|
||||
func (*Alias) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_739bb5ab5cb60751, []int{0}
|
||||
}
|
||||
func (m *Alias) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
}
|
||||
func (m *Alias) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
if deterministic {
|
||||
return xxx_messageInfo_Alias.Marshal(b, m, deterministic)
|
||||
} else {
|
||||
b = b[:cap(b)]
|
||||
n, err := m.MarshalToSizedBuffer(b)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return b[:n], nil
|
||||
}
|
||||
}
|
||||
func (m *Alias) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_Alias.Merge(m, src)
|
||||
}
|
||||
func (m *Alias) XXX_Size() int {
|
||||
return m.Size()
|
||||
}
|
||||
func (m *Alias) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_Alias.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_Alias proto.InternalMessageInfo
|
||||
|
||||
func (m *Alias) GetSubject() string {
|
||||
if m != nil {
|
||||
return m.Subject
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *Alias) GetOrigin() string {
|
||||
if m != nil {
|
||||
return m.Origin
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *Alias) GetController() string {
|
||||
if m != nil {
|
||||
return m.Controller
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type Credential struct {
|
||||
Subject string `protobuf:"bytes,1,opt,name=subject,proto3" json:"subject,omitempty"`
|
||||
AttestationType string `protobuf:"bytes,2,opt,name=attestation_type,json=attestationType,proto3" json:"attestation_type,omitempty"`
|
||||
@@ -103,7 +42,7 @@ func (m *Credential) Reset() { *m = Credential{} }
|
||||
func (m *Credential) String() string { return proto.CompactTextString(m) }
|
||||
func (*Credential) ProtoMessage() {}
|
||||
func (*Credential) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_739bb5ab5cb60751, []int{1}
|
||||
return fileDescriptor_739bb5ab5cb60751, []int{0}
|
||||
}
|
||||
func (m *Credential) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
@@ -231,7 +170,7 @@ func (m *Document) Reset() { *m = Document{} }
|
||||
func (m *Document) String() string { return proto.CompactTextString(m) }
|
||||
func (*Document) ProtoMessage() {}
|
||||
func (*Document) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_739bb5ab5cb60751, []int{2}
|
||||
return fileDescriptor_739bb5ab5cb60751, []int{1}
|
||||
}
|
||||
func (m *Document) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
@@ -323,7 +262,7 @@ func (m *Keyshare) Reset() { *m = Keyshare{} }
|
||||
func (m *Keyshare) String() string { return proto.CompactTextString(m) }
|
||||
func (*Keyshare) ProtoMessage() {}
|
||||
func (*Keyshare) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_739bb5ab5cb60751, []int{3}
|
||||
return fileDescriptor_739bb5ab5cb60751, []int{2}
|
||||
}
|
||||
func (m *Keyshare) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
@@ -405,7 +344,7 @@ func (m *Permissions) Reset() { *m = Permissions{} }
|
||||
func (m *Permissions) String() string { return proto.CompactTextString(m) }
|
||||
func (*Permissions) ProtoMessage() {}
|
||||
func (*Permissions) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_739bb5ab5cb60751, []int{4}
|
||||
return fileDescriptor_739bb5ab5cb60751, []int{3}
|
||||
}
|
||||
func (m *Permissions) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
@@ -463,7 +402,7 @@ func (m *PubKey) Reset() { *m = PubKey{} }
|
||||
func (m *PubKey) String() string { return proto.CompactTextString(m) }
|
||||
func (*PubKey) ProtoMessage() {}
|
||||
func (*PubKey) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_739bb5ab5cb60751, []int{5}
|
||||
return fileDescriptor_739bb5ab5cb60751, []int{4}
|
||||
}
|
||||
func (m *PubKey) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
@@ -555,7 +494,7 @@ func (m *PubKey_JWK) Reset() { *m = PubKey_JWK{} }
|
||||
func (m *PubKey_JWK) String() string { return proto.CompactTextString(m) }
|
||||
func (*PubKey_JWK) ProtoMessage() {}
|
||||
func (*PubKey_JWK) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_739bb5ab5cb60751, []int{5, 0}
|
||||
return fileDescriptor_739bb5ab5cb60751, []int{4, 0}
|
||||
}
|
||||
func (m *PubKey_JWK) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
@@ -641,7 +580,7 @@ func (m *Service) Reset() { *m = Service{} }
|
||||
func (m *Service) String() string { return proto.CompactTextString(m) }
|
||||
func (*Service) ProtoMessage() {}
|
||||
func (*Service) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_739bb5ab5cb60751, []int{6}
|
||||
return fileDescriptor_739bb5ab5cb60751, []int{5}
|
||||
}
|
||||
func (m *Service) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
@@ -731,7 +670,7 @@ func (m *ServiceInfo) Reset() { *m = ServiceInfo{} }
|
||||
func (m *ServiceInfo) String() string { return proto.CompactTextString(m) }
|
||||
func (*ServiceInfo) ProtoMessage() {}
|
||||
func (*ServiceInfo) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_739bb5ab5cb60751, []int{7}
|
||||
return fileDescriptor_739bb5ab5cb60751, []int{6}
|
||||
}
|
||||
func (m *ServiceInfo) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
@@ -800,7 +739,7 @@ func (m *FirstPartyCaveat) Reset() { *m = FirstPartyCaveat{} }
|
||||
func (m *FirstPartyCaveat) String() string { return proto.CompactTextString(m) }
|
||||
func (*FirstPartyCaveat) ProtoMessage() {}
|
||||
func (*FirstPartyCaveat) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_739bb5ab5cb60751, []int{8}
|
||||
return fileDescriptor_739bb5ab5cb60751, []int{7}
|
||||
}
|
||||
func (m *FirstPartyCaveat) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
@@ -869,7 +808,7 @@ func (m *ThirdPartyCaveat) Reset() { *m = ThirdPartyCaveat{} }
|
||||
func (m *ThirdPartyCaveat) String() string { return proto.CompactTextString(m) }
|
||||
func (*ThirdPartyCaveat) ProtoMessage() {}
|
||||
func (*ThirdPartyCaveat) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_739bb5ab5cb60751, []int{9}
|
||||
return fileDescriptor_739bb5ab5cb60751, []int{8}
|
||||
}
|
||||
func (m *ThirdPartyCaveat) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
@@ -927,7 +866,6 @@ func (m *ThirdPartyCaveat) GetAud() string {
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*Alias)(nil), "did.v1.Alias")
|
||||
proto.RegisterType((*Credential)(nil), "did.v1.Credential")
|
||||
proto.RegisterType((*Document)(nil), "did.v1.Document")
|
||||
proto.RegisterType((*Keyshare)(nil), "did.v1.Keyshare")
|
||||
@@ -946,123 +884,78 @@ func init() {
|
||||
func init() { proto.RegisterFile("did/v1/models.proto", fileDescriptor_739bb5ab5cb60751) }
|
||||
|
||||
var fileDescriptor_739bb5ab5cb60751 = []byte{
|
||||
// 1146 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x56, 0xcf, 0x6e, 0xdb, 0xc6,
|
||||
0x13, 0x0e, 0x45, 0x4b, 0x96, 0x46, 0x8a, 0xec, 0xdf, 0xc6, 0xf9, 0x95, 0x30, 0x52, 0x41, 0x51,
|
||||
0xda, 0x54, 0x29, 0x0a, 0x09, 0x51, 0x50, 0xa0, 0x48, 0x7b, 0x49, 0x6d, 0x17, 0x70, 0x8c, 0x14,
|
||||
0x06, 0x13, 0x34, 0x68, 0x2f, 0xc2, 0x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 0xeb, 0x9b, 0xde, 0xb5, 0xef, 0x06,
|
||||
0x73, 0xa6, 0xce, 0xf3, 0xd9, 0x28, 0xe2, 0x8b, 0x31, 0x4f, 0x25, 0x4f, 0xc5, 0xd8, 0xfc, 0xb9,
|
||||
0x1c, 0xeb, 0xdf, 0x6a, 0x7a, 0xdc, 0xe5, 0xac, 0x61, 0xae, 0xf7, 0x07, 0x7f, 0x06, 0x00, 0x00,
|
||||
0xff, 0xff, 0x38, 0x84, 0xad, 0x32, 0xdc, 0x09, 0x00, 0x00,
|
||||
}
|
||||
|
||||
func (m *Alias) Marshal() (dAtA []byte, err error) {
|
||||
size := m.Size()
|
||||
dAtA = make([]byte, size)
|
||||
n, err := m.MarshalToSizedBuffer(dAtA[:size])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return dAtA[:n], nil
|
||||
}
|
||||
|
||||
func (m *Alias) MarshalTo(dAtA []byte) (int, error) {
|
||||
size := m.Size()
|
||||
return m.MarshalToSizedBuffer(dAtA[:size])
|
||||
}
|
||||
|
||||
func (m *Alias) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
i := len(dAtA)
|
||||
_ = i
|
||||
var l int
|
||||
_ = l
|
||||
if len(m.Controller) > 0 {
|
||||
i -= len(m.Controller)
|
||||
copy(dAtA[i:], m.Controller)
|
||||
i = encodeVarintModels(dAtA, i, uint64(len(m.Controller)))
|
||||
i--
|
||||
dAtA[i] = 0x1a
|
||||
}
|
||||
if len(m.Origin) > 0 {
|
||||
i -= len(m.Origin)
|
||||
copy(dAtA[i:], m.Origin)
|
||||
i = encodeVarintModels(dAtA, i, uint64(len(m.Origin)))
|
||||
i--
|
||||
dAtA[i] = 0x12
|
||||
}
|
||||
if len(m.Subject) > 0 {
|
||||
i -= len(m.Subject)
|
||||
copy(dAtA[i:], m.Subject)
|
||||
i = encodeVarintModels(dAtA, i, uint64(len(m.Subject)))
|
||||
i--
|
||||
dAtA[i] = 0xa
|
||||
}
|
||||
return len(dAtA) - i, nil
|
||||
// 1125 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x56, 0x4f, 0x6f, 0x1b, 0x45,
|
||||
0x14, 0xef, 0x7a, 0x63, 0xc7, 0x3b, 0x76, 0x9d, 0x30, 0x4d, 0x61, 0x15, 0x15, 0xcb, 0x75, 0xa1,
|
||||
0xb8, 0x08, 0xd9, 0xaa, 0x2b, 0x24, 0x54, 0xb8, 0x40, 0x12, 0xa4, 0x34, 0x2a, 0x8a, 0xb6, 0x15,
|
||||
0x95, 0xb8, 0x58, 0xe3, 0xdd, 0x97, 0xf5, 0x34, 0xeb, 0x99, 0xd5, 0xcc, 0xac, 0x9b, 0x3d, 0x72,
|
||||
0xe5, 0x04, 0x9f, 0x81, 0x2f, 0xc3, 0xb1, 0x47, 0x8e, 0xa8, 0x85, 0xef, 0x81, 0xe6, 0xcf, 0xda,
|
||||
0x5b, 0x97, 0x0a, 0x71, 0xe1, 0x92, 0xbc, 0xf7, 0x7b, 0xbf, 0xb7, 0xf3, 0xf6, 0xf7, 0xde, 0x9b,
|
||||
0x35, 0xba, 0x91, 0xd0, 0x64, 0xb2, 0xba, 0x3f, 0x59, 0xf2, 0x04, 0x32, 0x39, 0xce, 0x05, 0x57,
|
||||
0x1c, 0xb7, 0x12, 0x9a, 0x8c, 0x57, 0xf7, 0x0f, 0x0f, 0x5c, 0x30, 0x05, 0x06, 0x92, 0xba, 0xe8,
|
||||
0xe1, 0x41, 0xca, 0x53, 0x6e, 0xcc, 0x89, 0xb6, 0x2c, 0x3a, 0xfc, 0xd5, 0x47, 0xe8, 0x48, 0x40,
|
||||
0x02, 0x4c, 0x51, 0x92, 0xe1, 0x10, 0xed, 0xca, 0x62, 0xfe, 0x1c, 0x62, 0x15, 0x7a, 0x03, 0x6f,
|
||||
0x14, 0x44, 0x95, 0x8b, 0xef, 0xa1, 0x7d, 0xa2, 0x14, 0x48, 0x45, 0x14, 0xe5, 0x6c, 0xa6, 0xca,
|
||||
0x1c, 0xc2, 0x86, 0xa1, 0xec, 0xd5, 0xf0, 0xa7, 0x65, 0x0e, 0xf8, 0x7d, 0xd4, 0xe2, 0x82, 0xa6,
|
||||
0x94, 0x85, 0xbe, 0x21, 0x38, 0x0f, 0xdf, 0x41, 0xd7, 0xe3, 0xf5, 0x51, 0x33, 0x9a, 0x84, 0x3b,
|
||||
0x03, 0x6f, 0xd4, 0x8d, 0xba, 0x1b, 0xf0, 0x34, 0xc1, 0x1f, 0x22, 0x94, 0x17, 0xf3, 0x8c, 0xc6,
|
||||
0xb3, 0x4b, 0x28, 0xc3, 0xa6, 0x61, 0x04, 0x16, 0x39, 0x83, 0x12, 0xdf, 0x42, 0x81, 0x12, 0x84,
|
||||
0xc9, 0x9c, 0x0b, 0x15, 0xb6, 0x06, 0xfe, 0x28, 0x88, 0x36, 0x80, 0x4e, 0x96, 0x34, 0x65, 0xb3,
|
||||
0x98, 0x17, 0x4c, 0x85, 0xbb, 0x03, 0x6f, 0x74, 0x3d, 0x0a, 0x34, 0x72, 0xa4, 0x01, 0x7c, 0x1b,
|
||||
0x75, 0x0b, 0x09, 0x62, 0x96, 0x0b, 0x90, 0xc0, 0x54, 0xd8, 0x1e, 0x78, 0xa3, 0x76, 0xd4, 0xd1,
|
||||
0xd8, 0xb9, 0x85, 0x74, 0x8d, 0x86, 0xb2, 0x02, 0x41, 0x2f, 0x28, 0x24, 0x61, 0x60, 0x38, 0x26,
|
||||
0xef, 0x7b, 0x87, 0xe1, 0x4f, 0xd0, 0xde, 0x9c, 0xc4, 0x97, 0x45, 0x3e, 0x83, 0x8c, 0xa6, 0x74,
|
||||
0x9e, 0x41, 0x88, 0x0c, 0xad, 0x67, 0xe1, 0x13, 0x87, 0xea, 0x03, 0x1d, 0x51, 0xeb, 0x03, 0x61,
|
||||
0xc7, 0x1e, 0x68, 0xb1, 0x27, 0x1a, 0x32, 0xa2, 0x64, 0x9c, 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x16, 0xbb, 0x74, 0xc7, 0x6f, 0x80, 0xda, 0xc7, 0x61, 0xe7, 0x8d, 0x8f,
|
||||
0xc3, 0x00, 0x75, 0x12, 0x90, 0xb1, 0xa0, 0xb9, 0xaa, 0x56, 0x22, 0x88, 0xea, 0x10, 0x8e, 0xd0,
|
||||
0x7b, 0xd5, 0xd1, 0xc0, 0x92, 0x9c, 0x53, 0x3d, 0x84, 0x2d, 0xb3, 0xb0, 0x1f, 0x57, 0x6a, 0xb9,
|
||||
0xb2, 0xab, 0xff, 0x27, 0x15, 0xcf, 0xee, 0xed, 0xbe, 0xdc, 0x82, 0xf1, 0xe7, 0xa8, 0x93, 0x6f,
|
||||
0x86, 0xdb, 0x69, 0x7f, 0xe3, 0xed, 0x21, 0x95, 0x51, 0x9d, 0x77, 0x78, 0x84, 0x6e, 0xfe, 0xe3,
|
||||
0x09, 0xff, 0x65, 0x2b, 0x87, 0x3f, 0x79, 0xa8, 0xe3, 0x9e, 0x72, 0xca, 0x2e, 0xb8, 0x56, 0x06,
|
||||
0xae, 0xa8, 0x34, 0x9b, 0xa5, 0x3f, 0x01, 0xce, 0xab, 0x29, 0xd6, 0xd8, 0x56, 0xec, 0x82, 0xb2,
|
||||
0x14, 0x44, 0x2e, 0x28, 0x53, 0x4e, 0xe9, 0x3a, 0x84, 0xef, 0x6d, 0x2e, 0xcf, 0x1d, 0xf3, 0x66,
|
||||
0x7b, 0x5b, 0x3a, 0x6d, 0x6e, 0x53, 0x89, 0xf6, 0xbf, 0xa5, 0x42, 0xaa, 0x73, 0x22, 0x54, 0x79,
|
||||
0x44, 0x56, 0x40, 0x74, 0x7a, 0xd3, 0x6c, 0xa5, 0xa9, 0xe7, 0x1d, 0xb2, 0x58, 0x86, 0x7e, 0x6f,
|
||||
0xb8, 0xca, 0x4d, 0x81, 0x7e, 0xa4, 0x4d, 0x33, 0x8e, 0xec, 0xc2, 0x55, 0xa5, 0x4d, 0x8d, 0x90,
|
||||
0x22, 0x71, 0x6d, 0xd7, 0xa6, 0x3e, 0xf4, 0xe9, 0x82, 0x8a, 0xe4, 0xff, 0x3c, 0xf4, 0x9b, 0xaf,
|
||||
0x7e, 0x7b, 0xd5, 0xf7, 0x5e, 0xbe, 0xea, 0x7b, 0x7f, 0xbc, 0xea, 0x7b, 0x3f, 0xbf, 0xee, 0x5f,
|
||||
0x7b, 0xf9, 0xba, 0x7f, 0xed, 0xf7, 0xd7, 0xfd, 0x6b, 0x3f, 0x0c, 0x53, 0xaa, 0x16, 0xc5, 0x7c,
|
||||
0x1c, 0xf3, 0xe5, 0x84, 0x33, 0xc9, 0x99, 0x98, 0x98, 0x3f, 0x57, 0x13, 0xfd, 0x83, 0x4a, 0x8f,
|
||||
0xbb, 0x9c, 0xb7, 0xcc, 0xf5, 0xfe, 0xe0, 0xef, 0x00, 0x00, 0x00, 0xff, 0xff, 0xcf, 0x9b, 0xe9,
|
||||
0xda, 0x81, 0x09, 0x00, 0x00,
|
||||
}
|
||||
|
||||
func (m *Credential) Marshal() (dAtA []byte, err error) {
|
||||
@@ -1814,27 +1707,6 @@ func encodeVarintModels(dAtA []byte, offset int, v uint64) int {
|
||||
dAtA[offset] = uint8(v)
|
||||
return base
|
||||
}
|
||||
func (m *Alias) Size() (n int) {
|
||||
if m == nil {
|
||||
return 0
|
||||
}
|
||||
var l int
|
||||
_ = l
|
||||
l = len(m.Subject)
|
||||
if l > 0 {
|
||||
n += 1 + l + sovModels(uint64(l))
|
||||
}
|
||||
l = len(m.Origin)
|
||||
if l > 0 {
|
||||
n += 1 + l + sovModels(uint64(l))
|
||||
}
|
||||
l = len(m.Controller)
|
||||
if l > 0 {
|
||||
n += 1 + l + sovModels(uint64(l))
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
func (m *Credential) Size() (n int) {
|
||||
if m == nil {
|
||||
return 0
|
||||
@@ -2185,152 +2057,6 @@ func sovModels(x uint64) (n int) {
|
||||
func sozModels(x uint64) (n int) {
|
||||
return sovModels(uint64((x << 1) ^ uint64((int64(x) >> 63))))
|
||||
}
|
||||
func (m *Alias) Unmarshal(dAtA []byte) error {
|
||||
l := len(dAtA)
|
||||
iNdEx := 0
|
||||
for iNdEx < l {
|
||||
preIndex := iNdEx
|
||||
var wire uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowModels
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
wire |= uint64(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
fieldNum := int32(wire >> 3)
|
||||
wireType := int(wire & 0x7)
|
||||
if wireType == 4 {
|
||||
return fmt.Errorf("proto: Alias: wiretype end group for non-group")
|
||||
}
|
||||
if fieldNum <= 0 {
|
||||
return fmt.Errorf("proto: Alias: illegal tag %d (wire type %d)", fieldNum, wire)
|
||||
}
|
||||
switch fieldNum {
|
||||
case 1:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Subject", wireType)
|
||||
}
|
||||
var stringLen uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowModels
|
||||
}
|
||||
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 ErrInvalidLengthModels
|
||||
}
|
||||
postIndex := iNdEx + intStringLen
|
||||
if postIndex < 0 {
|
||||
return ErrInvalidLengthModels
|
||||
}
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
m.Subject = string(dAtA[iNdEx:postIndex])
|
||||
iNdEx = postIndex
|
||||
case 2:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Origin", wireType)
|
||||
}
|
||||
var stringLen uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowModels
|
||||
}
|
||||
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 ErrInvalidLengthModels
|
||||
}
|
||||
postIndex := iNdEx + intStringLen
|
||||
if postIndex < 0 {
|
||||
return ErrInvalidLengthModels
|
||||
}
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
m.Origin = string(dAtA[iNdEx:postIndex])
|
||||
iNdEx = postIndex
|
||||
case 3:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Controller", wireType)
|
||||
}
|
||||
var stringLen uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowModels
|
||||
}
|
||||
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 ErrInvalidLengthModels
|
||||
}
|
||||
postIndex := iNdEx + intStringLen
|
||||
if postIndex < 0 {
|
||||
return ErrInvalidLengthModels
|
||||
}
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
m.Controller = string(dAtA[iNdEx:postIndex])
|
||||
iNdEx = postIndex
|
||||
default:
|
||||
iNdEx = preIndex
|
||||
skippy, err := skipModels(dAtA[iNdEx:])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if (skippy < 0) || (iNdEx+skippy) < 0 {
|
||||
return ErrInvalidLengthModels
|
||||
}
|
||||
if (iNdEx + skippy) > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
iNdEx += skippy
|
||||
}
|
||||
}
|
||||
|
||||
if iNdEx > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (m *Credential) Unmarshal(dAtA []byte) error {
|
||||
l := len(dAtA)
|
||||
iNdEx := 0
|
||||
|
||||
+222
-1204
File diff suppressed because it is too large
Load Diff
@@ -1,155 +0,0 @@
|
||||
package types
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/onsonr/crypto/accumulator"
|
||||
"github.com/onsonr/crypto/core/curves"
|
||||
)
|
||||
|
||||
// Accumulator is the accumulator for the ZKP
|
||||
type Accumulator []byte
|
||||
|
||||
// Element is the element for the BLS scheme
|
||||
type Element = accumulator.Element
|
||||
|
||||
// Witness is the witness for the ZKP
|
||||
type Witness []byte
|
||||
|
||||
// NewProof creates a new Proof which is used for ZKP
|
||||
func NewProof(issuer, property string, pubKey []byte) (*Proof, error) {
|
||||
input := append(pubKey, []byte(property)...)
|
||||
hash := []byte(input)
|
||||
|
||||
curve := curves.BLS12381(&curves.PointBls12381G1{})
|
||||
key, err := new(accumulator.SecretKey).New(curve, hash[:])
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to create secret key: %w", err)
|
||||
}
|
||||
|
||||
keyBytes, err := key.MarshalBinary()
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to marshal secret key: %w", err)
|
||||
}
|
||||
|
||||
return &Proof{
|
||||
Issuer: issuer,
|
||||
Property: property,
|
||||
Accumulator: keyBytes,
|
||||
}, nil
|
||||
}
|
||||
|
||||
// CreateAccumulator creates a new accumulator for a Proof
|
||||
func CreateAccumulator(proof *Proof, values ...string) error {
|
||||
curve := curves.BLS12381(&curves.PointBls12381G1{})
|
||||
acc, err := new(accumulator.Accumulator).New(curve)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
secretKey := new(accumulator.SecretKey)
|
||||
if err := secretKey.UnmarshalBinary(proof.Accumulator); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
fin, _, err := acc.Update(secretKey, ConvertValuesToZeroKnowledgeElements(values), nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
accBytes, err := fin.MarshalBinary()
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to marshal accumulator: %w", err)
|
||||
}
|
||||
|
||||
proof.Accumulator = accBytes
|
||||
return nil
|
||||
}
|
||||
|
||||
// CreateWitness creates a witness for the accumulator in a Proof for a given value
|
||||
func CreateWitness(proof *Proof, value string) ([]byte, error) {
|
||||
curve := curves.BLS12381(&curves.PointBls12381G1{})
|
||||
element := curve.Scalar.Hash([]byte(value))
|
||||
|
||||
secretKey := new(accumulator.SecretKey)
|
||||
if err := secretKey.UnmarshalBinary(proof.Accumulator); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
accObj := new(accumulator.Accumulator)
|
||||
if err := accObj.UnmarshalBinary(proof.Accumulator); err != nil {
|
||||
return nil, fmt.Errorf("failed to unmarshal accumulator: %w", err)
|
||||
}
|
||||
|
||||
mw, err := new(accumulator.MembershipWitness).New(element, accObj, secretKey)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
witnessBytes, err := mw.MarshalBinary()
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to marshal witness: %w", err)
|
||||
}
|
||||
return witnessBytes, nil
|
||||
}
|
||||
|
||||
// VerifyWitness proves that a value is a member of the accumulator
|
||||
func VerifyWitness(proof *Proof, acc Accumulator, witness Witness) error {
|
||||
secretKey := new(accumulator.SecretKey)
|
||||
if err := secretKey.UnmarshalBinary([]byte(proof.Id)); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
curve := curves.BLS12381(&curves.PointBls12381G1{})
|
||||
publicKey, err := secretKey.GetPublicKey(curve)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
accObj := new(accumulator.Accumulator)
|
||||
if err := accObj.UnmarshalBinary(proof.Accumulator); err != nil {
|
||||
return fmt.Errorf("failed to unmarshal accumulator: %w", err)
|
||||
}
|
||||
|
||||
witnessObj := new(accumulator.MembershipWitness)
|
||||
if err := witnessObj.UnmarshalBinary(witness); err != nil {
|
||||
return fmt.Errorf("failed to unmarshal witness: %w", err)
|
||||
}
|
||||
return witnessObj.Verify(publicKey, accObj)
|
||||
}
|
||||
|
||||
// UpdateAccumulator updates the accumulator in a Proof with new values
|
||||
func UpdateAccumulator(proof *Proof, addValues []string, removeValues []string) error {
|
||||
secretKey := new(accumulator.SecretKey)
|
||||
if err := secretKey.UnmarshalBinary(proof.Accumulator); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
accObj := new(accumulator.Accumulator)
|
||||
if err := accObj.UnmarshalBinary(proof.Accumulator); err != nil {
|
||||
return fmt.Errorf("failed to unmarshal accumulator: %w", err)
|
||||
}
|
||||
|
||||
updatedAcc, _, err := accObj.Update(secretKey, ConvertValuesToZeroKnowledgeElements(addValues), ConvertValuesToZeroKnowledgeElements(removeValues))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
updatedAccBytes, err := updatedAcc.MarshalBinary()
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to marshal updated accumulator: %w", err)
|
||||
}
|
||||
|
||||
proof.Accumulator = updatedAccBytes
|
||||
return nil
|
||||
}
|
||||
|
||||
// ConvertValuesToZeroKnowledgeElements converts a slice of strings to a slice of accumulator elements
|
||||
func ConvertValuesToZeroKnowledgeElements(values []string) []Element {
|
||||
curve := curves.BLS12381(&curves.PointBls12381G1{})
|
||||
elements := make([]accumulator.Element, len(values))
|
||||
for i, value := range values {
|
||||
elements[i] = curve.Scalar.Hash([]byte(value))
|
||||
}
|
||||
return elements
|
||||
}
|
||||
Reference in New Issue
Block a user