diff --git a/Dockerfile b/Dockerfile index 19afcdb8c..69daa6b83 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,7 +9,7 @@ RUN mkdir -p /code && chown ${DEVBOX_USER}:${DEVBOX_USER} /code USER ${DEVBOX_USER}:${DEVBOX_USER} COPY --chown=${DEVBOX_USER}:${DEVBOX_USER} devbox.json devbox.json -COPY --chown=${DEVBOX_USER}:${DEVBOX_USER} deploy/process-compose.yaml process-compose.yaml +COPY --chown=${DEVBOX_USER}:${DEVBOX_USER} process-compose.yaml process-compose.yaml RUN devbox run -- echo "Installed Packages." @@ -26,7 +26,7 @@ RUN mkdir -p /code && chown ${DEVBOX_USER}:${DEVBOX_USER} /code USER ${DEVBOX_USER}:${DEVBOX_USER} COPY --chown=${DEVBOX_USER}:${DEVBOX_USER} devbox.json devbox.json -COPY --chown=${DEVBOX_USER}:${DEVBOX_USER} deploy/process-compose.yaml process-compose.yaml +COPY --chown=${DEVBOX_USER}:${DEVBOX_USER} process-compose.yaml process-compose.yaml COPY --chown=${DEVBOX_USER}:${DEVBOX_USER} . . RUN devbox run -- echo "Installed Packages." diff --git a/Makefile b/Makefile index e08652cd6..99733b555 100644 --- a/Makefile +++ b/Makefile @@ -305,7 +305,7 @@ dwn: motr: @echo "(web) Building app.wasm -> Deploy to Cloudflare Workers" - GOOS=js GOARCH=wasm go build -o ./web/build/app.wasm ./web/src/main.go + GOOS=js GOARCH=wasm go build -o ./pkg/proxy/build/app.wasm ./pkg/proxy/main.go templ: @echo "(templ) Generating templ files" @@ -324,7 +324,7 @@ air: go install github.com/air-verse/air@latest air -c ./deploy/air.toml -ipfs-cluster-start: +ipfs: @echo "(ipfs) Starting ipfs-cluster" ipfs-cluster-service init --consensus crdt ipfs-cluster-service daemon diff --git a/api/did/v1/genesis.pulsar.go b/api/did/v1/genesis.pulsar.go index ebf2f237a..2185cd597 100644 --- a/api/did/v1/genesis.pulsar.go +++ b/api/did/v1/genesis.pulsar.go @@ -16,16 +16,14 @@ import ( ) var ( - md_GenesisState protoreflect.MessageDescriptor - fd_GenesisState_params protoreflect.FieldDescriptor - fd_GenesisState_global_integrity protoreflect.FieldDescriptor + md_GenesisState protoreflect.MessageDescriptor + fd_GenesisState_params protoreflect.FieldDescriptor ) func init() { file_did_v1_genesis_proto_init() md_GenesisState = File_did_v1_genesis_proto.Messages().ByName("GenesisState") fd_GenesisState_params = md_GenesisState.Fields().ByName("params") - fd_GenesisState_global_integrity = md_GenesisState.Fields().ByName("global_integrity") } var _ protoreflect.Message = (*fastReflection_GenesisState)(nil) @@ -99,12 +97,6 @@ func (x *fastReflection_GenesisState) Range(f func(protoreflect.FieldDescriptor, return } } - if x.GlobalIntegrity != nil { - value := protoreflect.ValueOfMessage(x.GlobalIntegrity.ProtoReflect()) - if !f(fd_GenesisState_global_integrity, value) { - return - } - } } // Has reports whether a field is populated. @@ -122,8 +114,6 @@ func (x *fastReflection_GenesisState) Has(fd protoreflect.FieldDescriptor) bool switch fd.FullName() { case "did.v1.GenesisState.params": return x.Params != nil - case "did.v1.GenesisState.global_integrity": - return x.GlobalIntegrity != nil default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: did.v1.GenesisState")) @@ -142,8 +132,6 @@ func (x *fastReflection_GenesisState) Clear(fd protoreflect.FieldDescriptor) { switch fd.FullName() { case "did.v1.GenesisState.params": x.Params = nil - case "did.v1.GenesisState.global_integrity": - x.GlobalIntegrity = nil default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: did.v1.GenesisState")) @@ -163,9 +151,6 @@ func (x *fastReflection_GenesisState) Get(descriptor protoreflect.FieldDescripto case "did.v1.GenesisState.params": value := x.Params return protoreflect.ValueOfMessage(value.ProtoReflect()) - case "did.v1.GenesisState.global_integrity": - value := x.GlobalIntegrity - return protoreflect.ValueOfMessage(value.ProtoReflect()) default: if descriptor.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: did.v1.GenesisState")) @@ -188,8 +173,6 @@ func (x *fastReflection_GenesisState) Set(fd protoreflect.FieldDescriptor, value switch fd.FullName() { case "did.v1.GenesisState.params": x.Params = value.Message().Interface().(*Params) - case "did.v1.GenesisState.global_integrity": - x.GlobalIntegrity = value.Message().Interface().(*GlobalIntegrity) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: did.v1.GenesisState")) @@ -215,11 +198,6 @@ func (x *fastReflection_GenesisState) Mutable(fd protoreflect.FieldDescriptor) p x.Params = new(Params) } return protoreflect.ValueOfMessage(x.Params.ProtoReflect()) - case "did.v1.GenesisState.global_integrity": - if x.GlobalIntegrity == nil { - x.GlobalIntegrity = new(GlobalIntegrity) - } - return protoreflect.ValueOfMessage(x.GlobalIntegrity.ProtoReflect()) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: did.v1.GenesisState")) @@ -236,9 +214,6 @@ func (x *fastReflection_GenesisState) NewField(fd protoreflect.FieldDescriptor) case "did.v1.GenesisState.params": m := new(Params) return protoreflect.ValueOfMessage(m.ProtoReflect()) - case "did.v1.GenesisState.global_integrity": - m := new(GlobalIntegrity) - return protoreflect.ValueOfMessage(m.ProtoReflect()) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: did.v1.GenesisState")) @@ -312,10 +287,6 @@ func (x *fastReflection_GenesisState) ProtoMethods() *protoiface.Methods { l = options.Size(x.Params) n += 1 + l + runtime.Sov(uint64(l)) } - if x.GlobalIntegrity != nil { - l = options.Size(x.GlobalIntegrity) - n += 1 + l + runtime.Sov(uint64(l)) - } if x.unknownFields != nil { n += len(x.unknownFields) } @@ -345,20 +316,6 @@ func (x *fastReflection_GenesisState) ProtoMethods() *protoiface.Methods { i -= len(x.unknownFields) copy(dAtA[i:], x.unknownFields) } - if x.GlobalIntegrity != nil { - encoded, err := options.Marshal(x.GlobalIntegrity) - if err != nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) - i-- - dAtA[i] = 0x12 - } if x.Params != nil { encoded, err := options.Marshal(x.Params) if err != nil { @@ -458,640 +415,6 @@ func (x *fastReflection_GenesisState) ProtoMethods() *protoiface.Methods { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err } iNdEx = postIndex - case 2: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field GlobalIntegrity", wireType) - } - var msglen int - 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++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - postIndex := iNdEx + msglen - 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 - } - if x.GlobalIntegrity == nil { - x.GlobalIntegrity = &GlobalIntegrity{} - } - if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.GlobalIntegrity); err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := runtime.Skip(dAtA[iNdEx:]) - if err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - if !options.DiscardUnknown { - x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - } - iNdEx += skippy - } - } - - if iNdEx > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil - } - return &protoiface.Methods{ - NoUnkeyedLiterals: struct{}{}, - Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, - Size: size, - Marshal: marshal, - Unmarshal: unmarshal, - Merge: nil, - CheckInitialized: nil, - } -} - -var ( - md_GlobalIntegrity protoreflect.MessageDescriptor - fd_GlobalIntegrity_controller protoreflect.FieldDescriptor - fd_GlobalIntegrity_seed protoreflect.FieldDescriptor - fd_GlobalIntegrity_accumulator protoreflect.FieldDescriptor - fd_GlobalIntegrity_count protoreflect.FieldDescriptor -) - -func init() { - file_did_v1_genesis_proto_init() - md_GlobalIntegrity = File_did_v1_genesis_proto.Messages().ByName("GlobalIntegrity") - fd_GlobalIntegrity_controller = md_GlobalIntegrity.Fields().ByName("controller") - fd_GlobalIntegrity_seed = md_GlobalIntegrity.Fields().ByName("seed") - fd_GlobalIntegrity_accumulator = md_GlobalIntegrity.Fields().ByName("accumulator") - fd_GlobalIntegrity_count = md_GlobalIntegrity.Fields().ByName("count") -} - -var _ protoreflect.Message = (*fastReflection_GlobalIntegrity)(nil) - -type fastReflection_GlobalIntegrity GlobalIntegrity - -func (x *GlobalIntegrity) ProtoReflect() protoreflect.Message { - return (*fastReflection_GlobalIntegrity)(x) -} - -func (x *GlobalIntegrity) slowProtoReflect() protoreflect.Message { - mi := &file_did_v1_genesis_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -var _fastReflection_GlobalIntegrity_messageType fastReflection_GlobalIntegrity_messageType -var _ protoreflect.MessageType = fastReflection_GlobalIntegrity_messageType{} - -type fastReflection_GlobalIntegrity_messageType struct{} - -func (x fastReflection_GlobalIntegrity_messageType) Zero() protoreflect.Message { - return (*fastReflection_GlobalIntegrity)(nil) -} -func (x fastReflection_GlobalIntegrity_messageType) New() protoreflect.Message { - return new(fastReflection_GlobalIntegrity) -} -func (x fastReflection_GlobalIntegrity_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_GlobalIntegrity -} - -// Descriptor returns message descriptor, which contains only the protobuf -// type information for the message. -func (x *fastReflection_GlobalIntegrity) Descriptor() protoreflect.MessageDescriptor { - return md_GlobalIntegrity -} - -// Type returns the message type, which encapsulates both Go and protobuf -// type information. If the Go type information is not needed, -// it is recommended that the message descriptor be used instead. -func (x *fastReflection_GlobalIntegrity) Type() protoreflect.MessageType { - return _fastReflection_GlobalIntegrity_messageType -} - -// New returns a newly allocated and mutable empty message. -func (x *fastReflection_GlobalIntegrity) New() protoreflect.Message { - return new(fastReflection_GlobalIntegrity) -} - -// Interface unwraps the message reflection interface and -// returns the underlying ProtoMessage interface. -func (x *fastReflection_GlobalIntegrity) Interface() protoreflect.ProtoMessage { - return (*GlobalIntegrity)(x) -} - -// Range iterates over every populated field in an undefined order, -// calling f for each field descriptor and value encountered. -// Range returns immediately if f returns false. -// While iterating, mutating operations may only be performed -// on the current field descriptor. -func (x *fastReflection_GlobalIntegrity) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - if x.Controller != "" { - value := protoreflect.ValueOfString(x.Controller) - if !f(fd_GlobalIntegrity_controller, value) { - return - } - } - if x.Seed != "" { - value := protoreflect.ValueOfString(x.Seed) - if !f(fd_GlobalIntegrity_seed, value) { - return - } - } - if len(x.Accumulator) != 0 { - value := protoreflect.ValueOfBytes(x.Accumulator) - if !f(fd_GlobalIntegrity_accumulator, value) { - return - } - } - if x.Count != uint64(0) { - value := protoreflect.ValueOfUint64(x.Count) - if !f(fd_GlobalIntegrity_count, value) { - return - } - } -} - -// Has reports whether a field is populated. -// -// Some fields have the property of nullability where it is possible to -// distinguish between the default value of a field and whether the field -// was explicitly populated with the default value. Singular message fields, -// member fields of a oneof, and proto2 scalar fields are nullable. Such -// fields are populated only if explicitly set. -// -// In other cases (aside from the nullable cases above), -// a proto3 scalar field is populated if it contains a non-zero value, and -// a repeated field is populated if it is non-empty. -func (x *fastReflection_GlobalIntegrity) Has(fd protoreflect.FieldDescriptor) bool { - switch fd.FullName() { - case "did.v1.GlobalIntegrity.controller": - return x.Controller != "" - case "did.v1.GlobalIntegrity.seed": - return x.Seed != "" - case "did.v1.GlobalIntegrity.accumulator": - return len(x.Accumulator) != 0 - case "did.v1.GlobalIntegrity.count": - return x.Count != uint64(0) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: did.v1.GlobalIntegrity")) - } - panic(fmt.Errorf("message did.v1.GlobalIntegrity does not contain field %s", fd.FullName())) - } -} - -// Clear clears the field such that a subsequent Has call reports false. -// -// Clearing an extension field clears both the extension type and value -// associated with the given field number. -// -// Clear is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_GlobalIntegrity) Clear(fd protoreflect.FieldDescriptor) { - switch fd.FullName() { - case "did.v1.GlobalIntegrity.controller": - x.Controller = "" - case "did.v1.GlobalIntegrity.seed": - x.Seed = "" - case "did.v1.GlobalIntegrity.accumulator": - x.Accumulator = nil - case "did.v1.GlobalIntegrity.count": - x.Count = uint64(0) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: did.v1.GlobalIntegrity")) - } - panic(fmt.Errorf("message did.v1.GlobalIntegrity does not contain field %s", fd.FullName())) - } -} - -// Get retrieves the value for a field. -// -// For unpopulated scalars, it returns the default value, where -// the default value of a bytes scalar is guaranteed to be a copy. -// For unpopulated composite types, it returns an empty, read-only view -// of the value; to obtain a mutable reference, use Mutable. -func (x *fastReflection_GlobalIntegrity) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { - switch descriptor.FullName() { - case "did.v1.GlobalIntegrity.controller": - value := x.Controller - return protoreflect.ValueOfString(value) - case "did.v1.GlobalIntegrity.seed": - value := x.Seed - return protoreflect.ValueOfString(value) - case "did.v1.GlobalIntegrity.accumulator": - value := x.Accumulator - return protoreflect.ValueOfBytes(value) - case "did.v1.GlobalIntegrity.count": - value := x.Count - return protoreflect.ValueOfUint64(value) - default: - if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: did.v1.GlobalIntegrity")) - } - panic(fmt.Errorf("message did.v1.GlobalIntegrity does not contain field %s", descriptor.FullName())) - } -} - -// Set stores the value for a field. -// -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType. -// When setting a composite type, it is unspecified whether the stored value -// aliases the source's memory in any way. If the composite value is an -// empty, read-only value, then it panics. -// -// Set is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_GlobalIntegrity) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { - switch fd.FullName() { - case "did.v1.GlobalIntegrity.controller": - x.Controller = value.Interface().(string) - case "did.v1.GlobalIntegrity.seed": - x.Seed = value.Interface().(string) - case "did.v1.GlobalIntegrity.accumulator": - x.Accumulator = value.Bytes() - case "did.v1.GlobalIntegrity.count": - x.Count = value.Uint() - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: did.v1.GlobalIntegrity")) - } - panic(fmt.Errorf("message did.v1.GlobalIntegrity does not contain field %s", fd.FullName())) - } -} - -// Mutable returns a mutable reference to a composite type. -// -// If the field is unpopulated, it may allocate a composite value. -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType -// if not already stored. -// It panics if the field does not contain a composite type. -// -// Mutable is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_GlobalIntegrity) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "did.v1.GlobalIntegrity.controller": - panic(fmt.Errorf("field controller of message did.v1.GlobalIntegrity is not mutable")) - case "did.v1.GlobalIntegrity.seed": - panic(fmt.Errorf("field seed of message did.v1.GlobalIntegrity is not mutable")) - case "did.v1.GlobalIntegrity.accumulator": - panic(fmt.Errorf("field accumulator of message did.v1.GlobalIntegrity is not mutable")) - case "did.v1.GlobalIntegrity.count": - panic(fmt.Errorf("field count of message did.v1.GlobalIntegrity is not mutable")) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: did.v1.GlobalIntegrity")) - } - panic(fmt.Errorf("message did.v1.GlobalIntegrity does not contain field %s", fd.FullName())) - } -} - -// NewField returns a new value that is assignable to the field -// for the given descriptor. For scalars, this returns the default value. -// For lists, maps, and messages, this returns a new, empty, mutable value. -func (x *fastReflection_GlobalIntegrity) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "did.v1.GlobalIntegrity.controller": - return protoreflect.ValueOfString("") - case "did.v1.GlobalIntegrity.seed": - return protoreflect.ValueOfString("") - case "did.v1.GlobalIntegrity.accumulator": - return protoreflect.ValueOfBytes(nil) - case "did.v1.GlobalIntegrity.count": - return protoreflect.ValueOfUint64(uint64(0)) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: did.v1.GlobalIntegrity")) - } - panic(fmt.Errorf("message did.v1.GlobalIntegrity does not contain field %s", fd.FullName())) - } -} - -// WhichOneof reports which field within the oneof is populated, -// returning nil if none are populated. -// It panics if the oneof descriptor does not belong to this message. -func (x *fastReflection_GlobalIntegrity) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { - switch d.FullName() { - default: - panic(fmt.Errorf("%s is not a oneof field in did.v1.GlobalIntegrity", d.FullName())) - } - panic("unreachable") -} - -// GetUnknown retrieves the entire list of unknown fields. -// The caller may only mutate the contents of the RawFields -// if the mutated bytes are stored back into the message with SetUnknown. -func (x *fastReflection_GlobalIntegrity) GetUnknown() protoreflect.RawFields { - return x.unknownFields -} - -// SetUnknown stores an entire list of unknown fields. -// The raw fields must be syntactically valid according to the wire format. -// An implementation may panic if this is not the case. -// Once stored, the caller must not mutate the content of the RawFields. -// An empty RawFields may be passed to clear the fields. -// -// SetUnknown is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_GlobalIntegrity) SetUnknown(fields protoreflect.RawFields) { - x.unknownFields = fields -} - -// IsValid reports whether the message is valid. -// -// An invalid message is an empty, read-only value. -// -// An invalid message often corresponds to a nil pointer of the concrete -// message type, but the details are implementation dependent. -// Validity is not part of the protobuf data model, and may not -// be preserved in marshaling or other operations. -func (x *fastReflection_GlobalIntegrity) IsValid() bool { - return x != nil -} - -// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. -// This method may return nil. -// -// The returned methods type is identical to -// "google.golang.org/protobuf/runtime/protoiface".Methods. -// Consult the protoiface package documentation for details. -func (x *fastReflection_GlobalIntegrity) ProtoMethods() *protoiface.Methods { - size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*GlobalIntegrity) - if x == nil { - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: 0, - } - } - options := runtime.SizeInputToOptions(input) - _ = options - var n int - var l int - _ = l - l = len(x.Controller) - if l > 0 { - n += 1 + l + runtime.Sov(uint64(l)) - } - l = len(x.Seed) - if l > 0 { - n += 1 + l + runtime.Sov(uint64(l)) - } - l = len(x.Accumulator) - if l > 0 { - n += 1 + l + runtime.Sov(uint64(l)) - } - if x.Count != 0 { - n += 1 + runtime.Sov(uint64(x.Count)) - } - if x.unknownFields != nil { - n += len(x.unknownFields) - } - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: n, - } - } - - marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { - x := input.Message.Interface().(*GlobalIntegrity) - if x == nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - options := runtime.MarshalInputToOptions(input) - _ = options - size := options.Size(x) - dAtA := make([]byte, size) - i := len(dAtA) - _ = i - var l int - _ = l - if x.unknownFields != nil { - i -= len(x.unknownFields) - copy(dAtA[i:], x.unknownFields) - } - if x.Count != 0 { - i = runtime.EncodeVarint(dAtA, i, uint64(x.Count)) - i-- - dAtA[i] = 0x20 - } - if len(x.Accumulator) > 0 { - i -= len(x.Accumulator) - copy(dAtA[i:], x.Accumulator) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Accumulator))) - i-- - dAtA[i] = 0x1a - } - if len(x.Seed) > 0 { - i -= len(x.Seed) - copy(dAtA[i:], x.Seed) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Seed))) - i-- - dAtA[i] = 0x12 - } - if len(x.Controller) > 0 { - i -= len(x.Controller) - copy(dAtA[i:], x.Controller) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Controller))) - i-- - dAtA[i] = 0xa - } - if input.Buf != nil { - input.Buf = append(input.Buf, dAtA...) - } else { - input.Buf = dAtA - } - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { - x := input.Message.Interface().(*GlobalIntegrity) - if x == nil { - return protoiface.UnmarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Flags: input.Flags, - }, nil - } - options := runtime.UnmarshalInputToOptions(input) - _ = options - dAtA := input.Buf - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire 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++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: GlobalIntegrity: wiretype end group for non-group") - } - if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: GlobalIntegrity: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Controller", 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.Controller = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Seed", 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.Seed = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Accumulator", wireType) - } - var byteLen int - 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++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - postIndex := iNdEx + byteLen - 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.Accumulator = append(x.Accumulator[:0], dAtA[iNdEx:postIndex]...) - if x.Accumulator == nil { - x.Accumulator = []byte{} - } - iNdEx = postIndex - case 4: - if wireType != 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Count", wireType) - } - x.Count = 0 - 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++ - x.Count |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } default: iNdEx = preIndex skippy, err := runtime.Skip(dAtA[iNdEx:]) @@ -1344,7 +667,7 @@ func (x *Params) ProtoReflect() protoreflect.Message { } func (x *Params) slowProtoReflect() protoreflect.Message { - mi := &file_did_v1_genesis_proto_msgTypes[2] + mi := &file_did_v1_genesis_proto_msgTypes[1] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -7613,8 +6936,6 @@ type GenesisState struct { // Params defines all the parameters of the module. Params *Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params,omitempty"` - // GlobalIntegrity defines a zkp integrity proof for the entire DID namespace - GlobalIntegrity *GlobalIntegrity `protobuf:"bytes,2,opt,name=global_integrity,json=globalIntegrity,proto3" json:"global_integrity,omitempty"` } func (x *GenesisState) Reset() { @@ -7644,73 +6965,6 @@ func (x *GenesisState) GetParams() *Params { return nil } -func (x *GenesisState) GetGlobalIntegrity() *GlobalIntegrity { - if x != nil { - return x.GlobalIntegrity - } - return nil -} - -// GlobalIntegrity defines a zkp integrity proof for the entire DID namespace -type GlobalIntegrity struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Controller string `protobuf:"bytes,1,opt,name=controller,proto3" json:"controller,omitempty"` - Seed string `protobuf:"bytes,2,opt,name=seed,proto3" json:"seed,omitempty"` - Accumulator []byte `protobuf:"bytes,3,opt,name=accumulator,proto3" json:"accumulator,omitempty"` - Count uint64 `protobuf:"varint,4,opt,name=count,proto3" json:"count,omitempty"` -} - -func (x *GlobalIntegrity) Reset() { - *x = GlobalIntegrity{} - if protoimpl.UnsafeEnabled { - mi := &file_did_v1_genesis_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *GlobalIntegrity) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GlobalIntegrity) ProtoMessage() {} - -// Deprecated: Use GlobalIntegrity.ProtoReflect.Descriptor instead. -func (*GlobalIntegrity) Descriptor() ([]byte, []int) { - return file_did_v1_genesis_proto_rawDescGZIP(), []int{1} -} - -func (x *GlobalIntegrity) GetController() string { - if x != nil { - return x.Controller - } - return "" -} - -func (x *GlobalIntegrity) GetSeed() string { - if x != nil { - return x.Seed - } - return "" -} - -func (x *GlobalIntegrity) GetAccumulator() []byte { - if x != nil { - return x.Accumulator - } - return nil -} - -func (x *GlobalIntegrity) GetCount() uint64 { - if x != nil { - return x.Count - } - return 0 -} - // Params defines the set of module parameters. type Params struct { state protoimpl.MessageState @@ -7734,7 +6988,7 @@ type Params struct { func (x *Params) Reset() { *x = Params{} if protoimpl.UnsafeEnabled { - mi := &file_did_v1_genesis_proto_msgTypes[2] + mi := &file_did_v1_genesis_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -7748,7 +7002,7 @@ func (*Params) ProtoMessage() {} // Deprecated: Use Params.ProtoReflect.Descriptor instead. func (*Params) Descriptor() ([]byte, []int) { - return file_did_v1_genesis_proto_rawDescGZIP(), []int{2} + return file_did_v1_genesis_proto_rawDescGZIP(), []int{1} } func (x *Params) GetWhitelistedAssets() []*AssetInfo { @@ -8464,18 +7718,6 @@ func file_did_v1_genesis_proto_init() { } } file_did_v1_genesis_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GlobalIntegrity); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_did_v1_genesis_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Params); i { case 0: return &v.state diff --git a/api/did/v1/state.pulsar.go b/api/did/v1/state.pulsar.go index 332fd4912..3d0e07460 100644 --- a/api/did/v1/state.pulsar.go +++ b/api/did/v1/state.pulsar.go @@ -2777,7 +2777,7 @@ var file_did_v1_state_proto_rawDesc = []byte{ 0x74, 0x68, 0x6f, 0x64, 0x2c, 0x69, 0x73, 0x73, 0x75, 0x65, 0x72, 0x10, 0x02, 0x18, 0x01, 0x12, 0x26, 0x0a, 0x20, 0x76, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x2c, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2c, 0x69, 0x73, 0x73, - 0x75, 0x65, 0x72, 0x10, 0x03, 0x18, 0x01, 0x18, 0x05, 0x42, 0x7a, 0x0a, 0x0a, 0x63, 0x6f, 0x6d, + 0x75, 0x65, 0x72, 0x10, 0x03, 0x18, 0x01, 0x18, 0x04, 0x42, 0x7a, 0x0a, 0x0a, 0x63, 0x6f, 0x6d, 0x2e, 0x64, 0x69, 0x64, 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, diff --git a/api/did/v1/tx.pulsar.go b/api/did/v1/tx.pulsar.go index f7e93460b..0232e6220 100644 --- a/api/did/v1/tx.pulsar.go +++ b/api/did/v1/tx.pulsar.go @@ -16,925 +16,6 @@ import ( sync "sync" ) -var ( - md_MsgUpdateParams protoreflect.MessageDescriptor - fd_MsgUpdateParams_authority protoreflect.FieldDescriptor - fd_MsgUpdateParams_params protoreflect.FieldDescriptor - fd_MsgUpdateParams_token protoreflect.FieldDescriptor -) - -func init() { - file_did_v1_tx_proto_init() - md_MsgUpdateParams = File_did_v1_tx_proto.Messages().ByName("MsgUpdateParams") - fd_MsgUpdateParams_authority = md_MsgUpdateParams.Fields().ByName("authority") - fd_MsgUpdateParams_params = md_MsgUpdateParams.Fields().ByName("params") - fd_MsgUpdateParams_token = md_MsgUpdateParams.Fields().ByName("token") -} - -var _ protoreflect.Message = (*fastReflection_MsgAllocateVault)(nil) - -type fastReflection_MsgAllocateVault MsgAllocateVault - -func (x *MsgAllocateVault) ProtoReflect() protoreflect.Message { - return (*fastReflection_MsgAllocateVault)(x) -} - -func (x *MsgAllocateVault) slowProtoReflect() protoreflect.Message { - mi := &file_did_v1_tx_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -var _fastReflection_MsgAllocateVault_messageType fastReflection_MsgAllocateVault_messageType -var _ protoreflect.MessageType = fastReflection_MsgAllocateVault_messageType{} - -type fastReflection_MsgAllocateVault_messageType struct{} - -func (x fastReflection_MsgAllocateVault_messageType) Zero() protoreflect.Message { - return (*fastReflection_MsgAllocateVault)(nil) -} -func (x fastReflection_MsgAllocateVault_messageType) New() protoreflect.Message { - return new(fastReflection_MsgAllocateVault) -} -func (x fastReflection_MsgAllocateVault_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_MsgAllocateVault -} - -// Descriptor returns message descriptor, which contains only the protobuf -// type information for the message. -func (x *fastReflection_MsgAllocateVault) Descriptor() protoreflect.MessageDescriptor { - return md_MsgAllocateVault -} - -// Type returns the message type, which encapsulates both Go and protobuf -// type information. If the Go type information is not needed, -// it is recommended that the message descriptor be used instead. -func (x *fastReflection_MsgAllocateVault) Type() protoreflect.MessageType { - return _fastReflection_MsgAllocateVault_messageType -} - -// New returns a newly allocated and mutable empty message. -func (x *fastReflection_MsgAllocateVault) New() protoreflect.Message { - return new(fastReflection_MsgAllocateVault) -} - -// Interface unwraps the message reflection interface and -// returns the underlying ProtoMessage interface. -func (x *fastReflection_MsgAllocateVault) Interface() protoreflect.ProtoMessage { - return (*MsgAllocateVault)(x) -} - -// Range iterates over every populated field in an undefined order, -// calling f for each field descriptor and value encountered. -// Range returns immediately if f returns false. -// While iterating, mutating operations may only be performed -// on the current field descriptor. -func (x *fastReflection_MsgAllocateVault) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - if x.Authority != "" { - value := protoreflect.ValueOfString(x.Authority) - if !f(fd_MsgAllocateVault_authority, value) { - return - } - } - if x.Params != nil { - value := protoreflect.ValueOfMessage(x.Params.ProtoReflect()) - if !f(fd_MsgUpdateParams_params, value) { - return - } - } - if x.Token != "" { - value := protoreflect.ValueOfString(x.Token) - if !f(fd_MsgUpdateParams_token, value) { - return - } - } -} - -// Has reports whether a field is populated. -// -// Some fields have the property of nullability where it is possible to -// distinguish between the default value of a field and whether the field -// was explicitly populated with the default value. Singular message fields, -// member fields of a oneof, and proto2 scalar fields are nullable. Such -// fields are populated only if explicitly set. -// -// In other cases (aside from the nullable cases above), -// a proto3 scalar field is populated if it contains a non-zero value, and -// a repeated field is populated if it is non-empty. -func (x *fastReflection_MsgUpdateParams) Has(fd protoreflect.FieldDescriptor) bool { - switch fd.FullName() { - case "did.v1.MsgUpdateParams.authority": - return x.Authority != "" - case "did.v1.MsgUpdateParams.params": - return x.Params != nil - case "did.v1.MsgUpdateParams.token": - return x.Token != "" - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: did.v1.MsgUpdateParams")) - } - panic(fmt.Errorf("message did.v1.MsgUpdateParams does not contain field %s", fd.FullName())) - } -} - -// Clear clears the field such that a subsequent Has call reports false. -// -// Clearing an extension field clears both the extension type and value -// associated with the given field number. -// -// Clear is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_MsgUpdateParams) Clear(fd protoreflect.FieldDescriptor) { - switch fd.FullName() { - case "did.v1.MsgUpdateParams.authority": - x.Authority = "" - case "did.v1.MsgUpdateParams.params": - x.Params = nil - case "did.v1.MsgUpdateParams.token": - x.Token = "" - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: did.v1.MsgUpdateParams")) - } - panic(fmt.Errorf("message did.v1.MsgUpdateParams does not contain field %s", fd.FullName())) - } -} - -// Get retrieves the value for a field. -// -// For unpopulated scalars, it returns the default value, where -// the default value of a bytes scalar is guaranteed to be a copy. -// For unpopulated composite types, it returns an empty, read-only view -// of the value; to obtain a mutable reference, use Mutable. -func (x *fastReflection_MsgUpdateParams) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { - switch descriptor.FullName() { - case "did.v1.MsgUpdateParams.authority": - value := x.Authority - return protoreflect.ValueOfString(value) - case "did.v1.MsgUpdateParams.params": - value := x.Params - return protoreflect.ValueOfMessage(value.ProtoReflect()) - case "did.v1.MsgUpdateParams.token": - value := x.Token - return protoreflect.ValueOfString(value) - default: - if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: did.v1.MsgUpdateParams")) - } - panic(fmt.Errorf("message did.v1.MsgUpdateParams does not contain field %s", descriptor.FullName())) - } -} - -// Set stores the value for a field. -// -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType. -// When setting a composite type, it is unspecified whether the stored value -// aliases the source's memory in any way. If the composite value is an -// empty, read-only value, then it panics. -// -// Set is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_MsgUpdateParams) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { - switch fd.FullName() { - case "did.v1.MsgUpdateParams.authority": - x.Authority = value.Interface().(string) - case "did.v1.MsgUpdateParams.params": - x.Params = value.Message().Interface().(*Params) - case "did.v1.MsgUpdateParams.token": - x.Token = value.Interface().(string) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: did.v1.MsgUpdateParams")) - } - panic(fmt.Errorf("message did.v1.MsgUpdateParams does not contain field %s", fd.FullName())) - } -} - -// Mutable returns a mutable reference to a composite type. -// -// If the field is unpopulated, it may allocate a composite value. -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType -// if not already stored. -// It panics if the field does not contain a composite type. -// -// Mutable is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_MsgUpdateParams) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "did.v1.MsgUpdateParams.params": - if x.Params == nil { - x.Params = new(Params) - } - return protoreflect.ValueOfMessage(x.Params.ProtoReflect()) - case "did.v1.MsgUpdateParams.authority": - panic(fmt.Errorf("field authority of message did.v1.MsgUpdateParams is not mutable")) - case "did.v1.MsgUpdateParams.token": - panic(fmt.Errorf("field token of message did.v1.MsgUpdateParams is not mutable")) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: did.v1.MsgUpdateParams")) - } - panic(fmt.Errorf("message did.v1.MsgUpdateParams does not contain field %s", fd.FullName())) - } -} - -// NewField returns a new value that is assignable to the field -// for the given descriptor. For scalars, this returns the default value. -// For lists, maps, and messages, this returns a new, empty, mutable value. -func (x *fastReflection_MsgUpdateParams) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "did.v1.MsgUpdateParams.authority": - return protoreflect.ValueOfString("") - case "did.v1.MsgUpdateParams.params": - m := new(Params) - return protoreflect.ValueOfMessage(m.ProtoReflect()) - case "did.v1.MsgUpdateParams.token": - return protoreflect.ValueOfString("") - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: did.v1.MsgUpdateParams")) - } - panic(fmt.Errorf("message did.v1.MsgUpdateParams does not contain field %s", fd.FullName())) - } -} - -// WhichOneof reports which field within the oneof is populated, -// returning nil if none are populated. -// It panics if the oneof descriptor does not belong to this message. -func (x *fastReflection_MsgUpdateParams) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { - switch d.FullName() { - default: - panic(fmt.Errorf("%s is not a oneof field in did.v1.MsgUpdateParams", d.FullName())) - } - panic("unreachable") -} - -// GetUnknown retrieves the entire list of unknown fields. -// The caller may only mutate the contents of the RawFields -// if the mutated bytes are stored back into the message with SetUnknown. -func (x *fastReflection_MsgUpdateParams) GetUnknown() protoreflect.RawFields { - return x.unknownFields -} - -// SetUnknown stores an entire list of unknown fields. -// The raw fields must be syntactically valid according to the wire format. -// An implementation may panic if this is not the case. -// Once stored, the caller must not mutate the content of the RawFields. -// An empty RawFields may be passed to clear the fields. -// -// SetUnknown is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_MsgUpdateParams) SetUnknown(fields protoreflect.RawFields) { - x.unknownFields = fields -} - -// IsValid reports whether the message is valid. -// -// An invalid message is an empty, read-only value. -// -// An invalid message often corresponds to a nil pointer of the concrete -// message type, but the details are implementation dependent. -// Validity is not part of the protobuf data model, and may not -// be preserved in marshaling or other operations. -func (x *fastReflection_MsgUpdateParams) IsValid() bool { - return x != nil -} - -// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. -// This method may return nil. -// -// The returned methods type is identical to -// "google.golang.org/protobuf/runtime/protoiface".Methods. -// Consult the protoiface package documentation for details. -func (x *fastReflection_MsgUpdateParams) ProtoMethods() *protoiface.Methods { - size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*MsgUpdateParams) - if x == nil { - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: 0, - } - } - options := runtime.SizeInputToOptions(input) - _ = options - var n int - var l int - _ = l - l = len(x.Authority) - if l > 0 { - n += 1 + l + runtime.Sov(uint64(l)) - } - if x.Params != nil { - l = options.Size(x.Params) - n += 1 + l + runtime.Sov(uint64(l)) - } - l = len(x.Token) - if l > 0 { - n += 1 + l + runtime.Sov(uint64(l)) - } - if x.unknownFields != nil { - n += len(x.unknownFields) - } - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: n, - } - } - - marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { - x := input.Message.Interface().(*MsgUpdateParams) - if x == nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - options := runtime.MarshalInputToOptions(input) - _ = options - size := options.Size(x) - dAtA := make([]byte, size) - i := len(dAtA) - _ = i - var l int - _ = l - if x.unknownFields != nil { - i -= len(x.unknownFields) - copy(dAtA[i:], x.unknownFields) - } - if len(x.Token) > 0 { - i -= len(x.Token) - copy(dAtA[i:], x.Token) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Token))) - i-- - dAtA[i] = 0x1a - } - if x.Params != nil { - encoded, err := options.Marshal(x.Params) - if err != nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) - i-- - dAtA[i] = 0x12 - } - if len(x.Authority) > 0 { - i -= len(x.Authority) - copy(dAtA[i:], x.Authority) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Authority))) - i-- - dAtA[i] = 0xa - } - if input.Buf != nil { - input.Buf = append(input.Buf, dAtA...) - } else { - input.Buf = dAtA - } - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { - x := input.Message.Interface().(*MsgUpdateParams) - if x == nil { - return protoiface.UnmarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Flags: input.Flags, - }, nil - } - options := runtime.UnmarshalInputToOptions(input) - _ = options - dAtA := input.Buf - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire 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++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgUpdateParams: wiretype end group for non-group") - } - if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgUpdateParams: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Authority", 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.Authority = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) - } - var msglen int - 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++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - postIndex := iNdEx + msglen - 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 - } - if x.Params == nil { - x.Params = &Params{} - } - if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Params); err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Token", 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.Token = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := runtime.Skip(dAtA[iNdEx:]) - if err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - if !options.DiscardUnknown { - x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - } - iNdEx += skippy - } - } - - if iNdEx > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil - } - return &protoiface.Methods{ - NoUnkeyedLiterals: struct{}{}, - Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, - Size: size, - Marshal: marshal, - Unmarshal: unmarshal, - Merge: nil, - CheckInitialized: nil, - } -} - -var ( - md_MsgUpdateParamsResponse protoreflect.MessageDescriptor -) - -func init() { - file_did_v1_tx_proto_init() - md_MsgUpdateParamsResponse = File_did_v1_tx_proto.Messages().ByName("MsgUpdateParamsResponse") -} - -var _ protoreflect.Message = (*fastReflection_MsgUpdateParamsResponse)(nil) - -type fastReflection_MsgUpdateParamsResponse MsgUpdateParamsResponse - -func (x *MsgUpdateParamsResponse) ProtoReflect() protoreflect.Message { - return (*fastReflection_MsgUpdateParamsResponse)(x) -} - -func (x *MsgUpdateParamsResponse) slowProtoReflect() protoreflect.Message { - mi := &file_did_v1_tx_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -var _fastReflection_MsgUpdateParamsResponse_messageType fastReflection_MsgUpdateParamsResponse_messageType -var _ protoreflect.MessageType = fastReflection_MsgUpdateParamsResponse_messageType{} - -type fastReflection_MsgUpdateParamsResponse_messageType struct{} - -func (x fastReflection_MsgUpdateParamsResponse_messageType) Zero() protoreflect.Message { - return (*fastReflection_MsgUpdateParamsResponse)(nil) -} -func (x fastReflection_MsgUpdateParamsResponse_messageType) New() protoreflect.Message { - return new(fastReflection_MsgUpdateParamsResponse) -} -func (x fastReflection_MsgUpdateParamsResponse_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_MsgUpdateParamsResponse -} - -// Descriptor returns message descriptor, which contains only the protobuf -// type information for the message. -func (x *fastReflection_MsgUpdateParamsResponse) Descriptor() protoreflect.MessageDescriptor { - return md_MsgUpdateParamsResponse -} - -// Type returns the message type, which encapsulates both Go and protobuf -// type information. If the Go type information is not needed, -// it is recommended that the message descriptor be used instead. -func (x *fastReflection_MsgUpdateParamsResponse) Type() protoreflect.MessageType { - return _fastReflection_MsgUpdateParamsResponse_messageType -} - -// New returns a newly allocated and mutable empty message. -func (x *fastReflection_MsgUpdateParamsResponse) New() protoreflect.Message { - return new(fastReflection_MsgUpdateParamsResponse) -} - -// Interface unwraps the message reflection interface and -// returns the underlying ProtoMessage interface. -func (x *fastReflection_MsgUpdateParamsResponse) Interface() protoreflect.ProtoMessage { - return (*MsgUpdateParamsResponse)(x) -} - -// Range iterates over every populated field in an undefined order, -// calling f for each field descriptor and value encountered. -// Range returns immediately if f returns false. -// While iterating, mutating operations may only be performed -// on the current field descriptor. -func (x *fastReflection_MsgUpdateParamsResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { -} - -// Has reports whether a field is populated. -// -// Some fields have the property of nullability where it is possible to -// distinguish between the default value of a field and whether the field -// was explicitly populated with the default value. Singular message fields, -// member fields of a oneof, and proto2 scalar fields are nullable. Such -// fields are populated only if explicitly set. -// -// In other cases (aside from the nullable cases above), -// a proto3 scalar field is populated if it contains a non-zero value, and -// a repeated field is populated if it is non-empty. -func (x *fastReflection_MsgUpdateParamsResponse) Has(fd protoreflect.FieldDescriptor) bool { - switch fd.FullName() { - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: did.v1.MsgUpdateParamsResponse")) - } - panic(fmt.Errorf("message did.v1.MsgUpdateParamsResponse does not contain field %s", fd.FullName())) - } -} - -// Clear clears the field such that a subsequent Has call reports false. -// -// Clearing an extension field clears both the extension type and value -// associated with the given field number. -// -// Clear is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_MsgUpdateParamsResponse) Clear(fd protoreflect.FieldDescriptor) { - switch fd.FullName() { - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: did.v1.MsgUpdateParamsResponse")) - } - panic(fmt.Errorf("message did.v1.MsgUpdateParamsResponse does not contain field %s", fd.FullName())) - } -} - -// Get retrieves the value for a field. -// -// For unpopulated scalars, it returns the default value, where -// the default value of a bytes scalar is guaranteed to be a copy. -// For unpopulated composite types, it returns an empty, read-only view -// of the value; to obtain a mutable reference, use Mutable. -func (x *fastReflection_MsgUpdateParamsResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { - switch descriptor.FullName() { - default: - if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: did.v1.MsgUpdateParamsResponse")) - } - panic(fmt.Errorf("message did.v1.MsgUpdateParamsResponse does not contain field %s", descriptor.FullName())) - } -} - -// Set stores the value for a field. -// -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType. -// When setting a composite type, it is unspecified whether the stored value -// aliases the source's memory in any way. If the composite value is an -// empty, read-only value, then it panics. -// -// Set is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_MsgUpdateParamsResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { - switch fd.FullName() { - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: did.v1.MsgUpdateParamsResponse")) - } - panic(fmt.Errorf("message did.v1.MsgUpdateParamsResponse does not contain field %s", fd.FullName())) - } -} - -// Mutable returns a mutable reference to a composite type. -// -// If the field is unpopulated, it may allocate a composite value. -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType -// if not already stored. -// It panics if the field does not contain a composite type. -// -// Mutable is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_MsgUpdateParamsResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: did.v1.MsgUpdateParamsResponse")) - } - panic(fmt.Errorf("message did.v1.MsgUpdateParamsResponse does not contain field %s", fd.FullName())) - } -} - -// NewField returns a new value that is assignable to the field -// for the given descriptor. For scalars, this returns the default value. -// For lists, maps, and messages, this returns a new, empty, mutable value. -func (x *fastReflection_MsgUpdateParamsResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: did.v1.MsgUpdateParamsResponse")) - } - panic(fmt.Errorf("message did.v1.MsgUpdateParamsResponse does not contain field %s", fd.FullName())) - } -} - -// WhichOneof reports which field within the oneof is populated, -// returning nil if none are populated. -// It panics if the oneof descriptor does not belong to this message. -func (x *fastReflection_MsgUpdateParamsResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { - switch d.FullName() { - default: - panic(fmt.Errorf("%s is not a oneof field in did.v1.MsgUpdateParamsResponse", d.FullName())) - } - panic("unreachable") -} - -// GetUnknown retrieves the entire list of unknown fields. -// The caller may only mutate the contents of the RawFields -// if the mutated bytes are stored back into the message with SetUnknown. -func (x *fastReflection_MsgUpdateParamsResponse) GetUnknown() protoreflect.RawFields { - return x.unknownFields -} - -// SetUnknown stores an entire list of unknown fields. -// The raw fields must be syntactically valid according to the wire format. -// An implementation may panic if this is not the case. -// Once stored, the caller must not mutate the content of the RawFields. -// An empty RawFields may be passed to clear the fields. -// -// SetUnknown is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_MsgUpdateParamsResponse) SetUnknown(fields protoreflect.RawFields) { - x.unknownFields = fields -} - -// IsValid reports whether the message is valid. -// -// An invalid message is an empty, read-only value. -// -// An invalid message often corresponds to a nil pointer of the concrete -// message type, but the details are implementation dependent. -// Validity is not part of the protobuf data model, and may not -// be preserved in marshaling or other operations. -func (x *fastReflection_MsgUpdateParamsResponse) IsValid() bool { - return x != nil -} - -// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. -// This method may return nil. -// -// The returned methods type is identical to -// "google.golang.org/protobuf/runtime/protoiface".Methods. -// Consult the protoiface package documentation for details. -func (x *fastReflection_MsgUpdateParamsResponse) ProtoMethods() *protoiface.Methods { - size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*MsgUpdateParamsResponse) - if x == nil { - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: 0, - } - } - options := runtime.SizeInputToOptions(input) - _ = options - var n int - var l int - _ = l - if x.unknownFields != nil { - n += len(x.unknownFields) - } - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: n, - } - } - - marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { - x := input.Message.Interface().(*MsgUpdateParamsResponse) - if x == nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - options := runtime.MarshalInputToOptions(input) - _ = options - size := options.Size(x) - dAtA := make([]byte, size) - i := len(dAtA) - _ = i - var l int - _ = l - if x.unknownFields != nil { - i -= len(x.unknownFields) - copy(dAtA[i:], x.unknownFields) - } - if input.Buf != nil { - input.Buf = append(input.Buf, dAtA...) - } else { - input.Buf = dAtA - } - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { - x := input.Message.Interface().(*MsgUpdateParamsResponse) - if x == nil { - return protoiface.UnmarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Flags: input.Flags, - }, nil - } - options := runtime.UnmarshalInputToOptions(input) - _ = options - dAtA := input.Buf - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire 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++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgUpdateParamsResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgUpdateParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := runtime.Skip(dAtA[iNdEx:]) - if err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - if !options.DiscardUnknown { - x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - } - iNdEx += skippy - } - } - - if iNdEx > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil - } - return &protoiface.Methods{ - NoUnkeyedLiterals: struct{}{}, - Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, - Size: size, - Marshal: marshal, - Unmarshal: unmarshal, - Merge: nil, - CheckInitialized: nil, - } -} - var ( md_MsgAllocateVault protoreflect.MessageDescriptor fd_MsgAllocateVault_authority protoreflect.FieldDescriptor @@ -959,7 +40,7 @@ func (x *MsgAllocateVault) ProtoReflect() protoreflect.Message { } func (x *MsgAllocateVault) slowProtoReflect() protoreflect.Message { - mi := &file_did_v1_tx_proto_msgTypes[2] + mi := &file_did_v1_tx_proto_msgTypes[0] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1509,7 +590,7 @@ func (x *MsgAllocateVaultResponse) ProtoReflect() protoreflect.Message { } func (x *MsgAllocateVaultResponse) slowProtoReflect() protoreflect.Message { - mi := &file_did_v1_tx_proto_msgTypes[3] + mi := &file_did_v1_tx_proto_msgTypes[1] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2233,7 +1314,7 @@ func (x *MsgRegisterController) ProtoReflect() protoreflect.Message { } func (x *MsgRegisterController) slowProtoReflect() protoreflect.Message { - mi := &file_did_v1_tx_proto_msgTypes[4] + mi := &file_did_v1_tx_proto_msgTypes[2] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2967,7 +2048,7 @@ func (x *MsgRegisterControllerResponse) ProtoReflect() protoreflect.Message { } func (x *MsgRegisterControllerResponse) slowProtoReflect() protoreflect.Message { - mi := &file_did_v1_tx_proto_msgTypes[5] + mi := &file_did_v1_tx_proto_msgTypes[3] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -3639,6 +2720,1270 @@ func (x *fastReflection_MsgRegisterControllerResponse) ProtoMethods() *protoifac } } +var _ protoreflect.Map = (*_MsgExecuteTx_2_map)(nil) + +type _MsgExecuteTx_2_map struct { + m *map[string][]byte +} + +func (x *_MsgExecuteTx_2_map) Len() int { + if x.m == nil { + return 0 + } + return len(*x.m) +} + +func (x *_MsgExecuteTx_2_map) Range(f func(protoreflect.MapKey, protoreflect.Value) bool) { + if x.m == nil { + return + } + for k, v := range *x.m { + mapKey := (protoreflect.MapKey)(protoreflect.ValueOfString(k)) + mapValue := protoreflect.ValueOfBytes(v) + if !f(mapKey, mapValue) { + break + } + } +} + +func (x *_MsgExecuteTx_2_map) Has(key protoreflect.MapKey) bool { + if x.m == nil { + return false + } + keyUnwrapped := key.String() + concreteValue := keyUnwrapped + _, ok := (*x.m)[concreteValue] + return ok +} + +func (x *_MsgExecuteTx_2_map) Clear(key protoreflect.MapKey) { + if x.m == nil { + return + } + keyUnwrapped := key.String() + concreteKey := keyUnwrapped + delete(*x.m, concreteKey) +} + +func (x *_MsgExecuteTx_2_map) Get(key protoreflect.MapKey) protoreflect.Value { + if x.m == nil { + return protoreflect.Value{} + } + keyUnwrapped := key.String() + concreteKey := keyUnwrapped + v, ok := (*x.m)[concreteKey] + if !ok { + return protoreflect.Value{} + } + return protoreflect.ValueOfBytes(v) +} + +func (x *_MsgExecuteTx_2_map) Set(key protoreflect.MapKey, value protoreflect.Value) { + if !key.IsValid() || !value.IsValid() { + panic("invalid key or value provided") + } + keyUnwrapped := key.String() + concreteKey := keyUnwrapped + valueUnwrapped := value.Bytes() + concreteValue := valueUnwrapped + (*x.m)[concreteKey] = concreteValue +} + +func (x *_MsgExecuteTx_2_map) Mutable(key protoreflect.MapKey) protoreflect.Value { + panic("should not call Mutable on protoreflect.Map whose value is not of type protoreflect.Message") +} + +func (x *_MsgExecuteTx_2_map) NewValue() protoreflect.Value { + var v []byte + return protoreflect.ValueOfBytes(v) +} + +func (x *_MsgExecuteTx_2_map) IsValid() bool { + return x.m != nil +} + +var ( + md_MsgExecuteTx protoreflect.MessageDescriptor + fd_MsgExecuteTx_controller protoreflect.FieldDescriptor + fd_MsgExecuteTx_messages protoreflect.FieldDescriptor + fd_MsgExecuteTx_macaroon_token protoreflect.FieldDescriptor +) + +func init() { + file_did_v1_tx_proto_init() + md_MsgExecuteTx = File_did_v1_tx_proto.Messages().ByName("MsgExecuteTx") + fd_MsgExecuteTx_controller = md_MsgExecuteTx.Fields().ByName("controller") + fd_MsgExecuteTx_messages = md_MsgExecuteTx.Fields().ByName("messages") + fd_MsgExecuteTx_macaroon_token = md_MsgExecuteTx.Fields().ByName("macaroon_token") +} + +var _ protoreflect.Message = (*fastReflection_MsgExecuteTx)(nil) + +type fastReflection_MsgExecuteTx MsgExecuteTx + +func (x *MsgExecuteTx) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgExecuteTx)(x) +} + +func (x *MsgExecuteTx) slowProtoReflect() protoreflect.Message { + mi := &file_did_v1_tx_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_MsgExecuteTx_messageType fastReflection_MsgExecuteTx_messageType +var _ protoreflect.MessageType = fastReflection_MsgExecuteTx_messageType{} + +type fastReflection_MsgExecuteTx_messageType struct{} + +func (x fastReflection_MsgExecuteTx_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgExecuteTx)(nil) +} +func (x fastReflection_MsgExecuteTx_messageType) New() protoreflect.Message { + return new(fastReflection_MsgExecuteTx) +} +func (x fastReflection_MsgExecuteTx_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgExecuteTx +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_MsgExecuteTx) Descriptor() protoreflect.MessageDescriptor { + return md_MsgExecuteTx +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_MsgExecuteTx) Type() protoreflect.MessageType { + return _fastReflection_MsgExecuteTx_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_MsgExecuteTx) New() protoreflect.Message { + return new(fastReflection_MsgExecuteTx) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_MsgExecuteTx) Interface() protoreflect.ProtoMessage { + return (*MsgExecuteTx)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_MsgExecuteTx) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Controller != "" { + value := protoreflect.ValueOfString(x.Controller) + if !f(fd_MsgExecuteTx_controller, value) { + return + } + } + if len(x.Messages) != 0 { + value := protoreflect.ValueOfMap(&_MsgExecuteTx_2_map{m: &x.Messages}) + if !f(fd_MsgExecuteTx_messages, value) { + return + } + } + if x.MacaroonToken != "" { + value := protoreflect.ValueOfString(x.MacaroonToken) + if !f(fd_MsgExecuteTx_macaroon_token, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_MsgExecuteTx) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "did.v1.MsgExecuteTx.controller": + return x.Controller != "" + case "did.v1.MsgExecuteTx.messages": + return len(x.Messages) != 0 + case "did.v1.MsgExecuteTx.macaroon_token": + return x.MacaroonToken != "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: did.v1.MsgExecuteTx")) + } + panic(fmt.Errorf("message did.v1.MsgExecuteTx does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgExecuteTx) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "did.v1.MsgExecuteTx.controller": + x.Controller = "" + case "did.v1.MsgExecuteTx.messages": + x.Messages = nil + case "did.v1.MsgExecuteTx.macaroon_token": + x.MacaroonToken = "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: did.v1.MsgExecuteTx")) + } + panic(fmt.Errorf("message did.v1.MsgExecuteTx does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_MsgExecuteTx) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "did.v1.MsgExecuteTx.controller": + value := x.Controller + return protoreflect.ValueOfString(value) + case "did.v1.MsgExecuteTx.messages": + if len(x.Messages) == 0 { + return protoreflect.ValueOfMap(&_MsgExecuteTx_2_map{}) + } + mapValue := &_MsgExecuteTx_2_map{m: &x.Messages} + return protoreflect.ValueOfMap(mapValue) + case "did.v1.MsgExecuteTx.macaroon_token": + value := x.MacaroonToken + return protoreflect.ValueOfString(value) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: did.v1.MsgExecuteTx")) + } + panic(fmt.Errorf("message did.v1.MsgExecuteTx does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgExecuteTx) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "did.v1.MsgExecuteTx.controller": + x.Controller = value.Interface().(string) + case "did.v1.MsgExecuteTx.messages": + mv := value.Map() + cmv := mv.(*_MsgExecuteTx_2_map) + x.Messages = *cmv.m + case "did.v1.MsgExecuteTx.macaroon_token": + x.MacaroonToken = value.Interface().(string) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: did.v1.MsgExecuteTx")) + } + panic(fmt.Errorf("message did.v1.MsgExecuteTx does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgExecuteTx) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "did.v1.MsgExecuteTx.messages": + if x.Messages == nil { + x.Messages = make(map[string][]byte) + } + value := &_MsgExecuteTx_2_map{m: &x.Messages} + return protoreflect.ValueOfMap(value) + case "did.v1.MsgExecuteTx.controller": + panic(fmt.Errorf("field controller of message did.v1.MsgExecuteTx is not mutable")) + case "did.v1.MsgExecuteTx.macaroon_token": + panic(fmt.Errorf("field macaroon_token of message did.v1.MsgExecuteTx is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: did.v1.MsgExecuteTx")) + } + panic(fmt.Errorf("message did.v1.MsgExecuteTx does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_MsgExecuteTx) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "did.v1.MsgExecuteTx.controller": + return protoreflect.ValueOfString("") + case "did.v1.MsgExecuteTx.messages": + m := make(map[string][]byte) + return protoreflect.ValueOfMap(&_MsgExecuteTx_2_map{m: &m}) + case "did.v1.MsgExecuteTx.macaroon_token": + return protoreflect.ValueOfString("") + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: did.v1.MsgExecuteTx")) + } + panic(fmt.Errorf("message did.v1.MsgExecuteTx does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_MsgExecuteTx) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in did.v1.MsgExecuteTx", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_MsgExecuteTx) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgExecuteTx) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_MsgExecuteTx) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_MsgExecuteTx) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*MsgExecuteTx) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + l = len(x.Controller) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if len(x.Messages) > 0 { + SiZeMaP := func(k string, v []byte) { + l = 1 + len(v) + runtime.Sov(uint64(len(v))) + mapEntrySize := 1 + len(k) + runtime.Sov(uint64(len(k))) + l + n += mapEntrySize + 1 + runtime.Sov(uint64(mapEntrySize)) + } + if options.Deterministic { + sortme := make([]string, 0, len(x.Messages)) + for k := range x.Messages { + sortme = append(sortme, k) + } + sort.Strings(sortme) + for _, k := range sortme { + v := x.Messages[k] + SiZeMaP(k, v) + } + } else { + for k, v := range x.Messages { + SiZeMaP(k, v) + } + } + } + l = len(x.MacaroonToken) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*MsgExecuteTx) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if len(x.MacaroonToken) > 0 { + i -= len(x.MacaroonToken) + copy(dAtA[i:], x.MacaroonToken) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.MacaroonToken))) + i-- + dAtA[i] = 0x1a + } + if len(x.Messages) > 0 { + MaRsHaLmAp := func(k string, v []byte) (protoiface.MarshalOutput, error) { + baseI := i + i -= len(v) + copy(dAtA[i:], v) + i = runtime.EncodeVarint(dAtA, i, uint64(len(v))) + i-- + dAtA[i] = 0x12 + i -= len(k) + copy(dAtA[i:], k) + i = runtime.EncodeVarint(dAtA, i, uint64(len(k))) + i-- + dAtA[i] = 0xa + i = runtime.EncodeVarint(dAtA, i, uint64(baseI-i)) + i-- + dAtA[i] = 0x12 + return protoiface.MarshalOutput{}, nil + } + if options.Deterministic { + keysForMessages := make([]string, 0, len(x.Messages)) + for k := range x.Messages { + keysForMessages = append(keysForMessages, string(k)) + } + sort.Slice(keysForMessages, func(i, j int) bool { + return keysForMessages[i] < keysForMessages[j] + }) + for iNdEx := len(keysForMessages) - 1; iNdEx >= 0; iNdEx-- { + v := x.Messages[string(keysForMessages[iNdEx])] + out, err := MaRsHaLmAp(keysForMessages[iNdEx], v) + if err != nil { + return out, err + } + } + } else { + for k := range x.Messages { + v := x.Messages[k] + out, err := MaRsHaLmAp(k, v) + if err != nil { + return out, err + } + } + } + } + if len(x.Controller) > 0 { + i -= len(x.Controller) + copy(dAtA[i:], x.Controller) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Controller))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*MsgExecuteTx) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire 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++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgExecuteTx: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgExecuteTx: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Controller", 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.Controller = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Messages", wireType) + } + var msglen int + 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++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + 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 + } + if x.Messages == nil { + x.Messages = make(map[string][]byte) + } + var mapkey string + var mapvalue []byte + for iNdEx < postIndex { + entryPreIndex := iNdEx + var wire 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++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + if fieldNum == 1 { + var stringLenmapkey 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++ + stringLenmapkey |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLenmapkey := int(stringLenmapkey) + if intStringLenmapkey < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postStringIndexmapkey := iNdEx + intStringLenmapkey + if postStringIndexmapkey < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postStringIndexmapkey > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) + iNdEx = postStringIndexmapkey + } else if fieldNum == 2 { + var mapbyteLen 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++ + mapbyteLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intMapbyteLen := int(mapbyteLen) + if intMapbyteLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postbytesIndex := iNdEx + intMapbyteLen + if postbytesIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postbytesIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + mapvalue = make([]byte, mapbyteLen) + copy(mapvalue, dAtA[iNdEx:postbytesIndex]) + iNdEx = postbytesIndex + } else { + iNdEx = entryPreIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > postIndex { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + x.Messages[mapkey] = mapvalue + iNdEx = postIndex + case 3: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field MacaroonToken", 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.MacaroonToken = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var ( + md_MsgExecuteTxResponse protoreflect.MessageDescriptor + fd_MsgExecuteTxResponse_success protoreflect.FieldDescriptor + fd_MsgExecuteTxResponse_tx_hash protoreflect.FieldDescriptor +) + +func init() { + file_did_v1_tx_proto_init() + md_MsgExecuteTxResponse = File_did_v1_tx_proto.Messages().ByName("MsgExecuteTxResponse") + fd_MsgExecuteTxResponse_success = md_MsgExecuteTxResponse.Fields().ByName("success") + fd_MsgExecuteTxResponse_tx_hash = md_MsgExecuteTxResponse.Fields().ByName("tx_hash") +} + +var _ protoreflect.Message = (*fastReflection_MsgExecuteTxResponse)(nil) + +type fastReflection_MsgExecuteTxResponse MsgExecuteTxResponse + +func (x *MsgExecuteTxResponse) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgExecuteTxResponse)(x) +} + +func (x *MsgExecuteTxResponse) slowProtoReflect() protoreflect.Message { + mi := &file_did_v1_tx_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_MsgExecuteTxResponse_messageType fastReflection_MsgExecuteTxResponse_messageType +var _ protoreflect.MessageType = fastReflection_MsgExecuteTxResponse_messageType{} + +type fastReflection_MsgExecuteTxResponse_messageType struct{} + +func (x fastReflection_MsgExecuteTxResponse_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgExecuteTxResponse)(nil) +} +func (x fastReflection_MsgExecuteTxResponse_messageType) New() protoreflect.Message { + return new(fastReflection_MsgExecuteTxResponse) +} +func (x fastReflection_MsgExecuteTxResponse_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgExecuteTxResponse +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_MsgExecuteTxResponse) Descriptor() protoreflect.MessageDescriptor { + return md_MsgExecuteTxResponse +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_MsgExecuteTxResponse) Type() protoreflect.MessageType { + return _fastReflection_MsgExecuteTxResponse_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_MsgExecuteTxResponse) New() protoreflect.Message { + return new(fastReflection_MsgExecuteTxResponse) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_MsgExecuteTxResponse) Interface() protoreflect.ProtoMessage { + return (*MsgExecuteTxResponse)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_MsgExecuteTxResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Success != false { + value := protoreflect.ValueOfBool(x.Success) + if !f(fd_MsgExecuteTxResponse_success, value) { + return + } + } + if x.TxHash != "" { + value := protoreflect.ValueOfString(x.TxHash) + if !f(fd_MsgExecuteTxResponse_tx_hash, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_MsgExecuteTxResponse) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "did.v1.MsgExecuteTxResponse.success": + return x.Success != false + case "did.v1.MsgExecuteTxResponse.tx_hash": + return x.TxHash != "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: did.v1.MsgExecuteTxResponse")) + } + panic(fmt.Errorf("message did.v1.MsgExecuteTxResponse does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgExecuteTxResponse) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "did.v1.MsgExecuteTxResponse.success": + x.Success = false + case "did.v1.MsgExecuteTxResponse.tx_hash": + x.TxHash = "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: did.v1.MsgExecuteTxResponse")) + } + panic(fmt.Errorf("message did.v1.MsgExecuteTxResponse does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_MsgExecuteTxResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "did.v1.MsgExecuteTxResponse.success": + value := x.Success + return protoreflect.ValueOfBool(value) + case "did.v1.MsgExecuteTxResponse.tx_hash": + value := x.TxHash + return protoreflect.ValueOfString(value) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: did.v1.MsgExecuteTxResponse")) + } + panic(fmt.Errorf("message did.v1.MsgExecuteTxResponse does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgExecuteTxResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "did.v1.MsgExecuteTxResponse.success": + x.Success = value.Bool() + case "did.v1.MsgExecuteTxResponse.tx_hash": + x.TxHash = value.Interface().(string) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: did.v1.MsgExecuteTxResponse")) + } + panic(fmt.Errorf("message did.v1.MsgExecuteTxResponse does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgExecuteTxResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "did.v1.MsgExecuteTxResponse.success": + panic(fmt.Errorf("field success of message did.v1.MsgExecuteTxResponse is not mutable")) + case "did.v1.MsgExecuteTxResponse.tx_hash": + panic(fmt.Errorf("field tx_hash of message did.v1.MsgExecuteTxResponse is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: did.v1.MsgExecuteTxResponse")) + } + panic(fmt.Errorf("message did.v1.MsgExecuteTxResponse does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_MsgExecuteTxResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "did.v1.MsgExecuteTxResponse.success": + return protoreflect.ValueOfBool(false) + case "did.v1.MsgExecuteTxResponse.tx_hash": + return protoreflect.ValueOfString("") + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: did.v1.MsgExecuteTxResponse")) + } + panic(fmt.Errorf("message did.v1.MsgExecuteTxResponse does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_MsgExecuteTxResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in did.v1.MsgExecuteTxResponse", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_MsgExecuteTxResponse) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgExecuteTxResponse) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_MsgExecuteTxResponse) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_MsgExecuteTxResponse) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*MsgExecuteTxResponse) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if x.Success { + n += 2 + } + l = len(x.TxHash) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*MsgExecuteTxResponse) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if len(x.TxHash) > 0 { + i -= len(x.TxHash) + copy(dAtA[i:], x.TxHash) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.TxHash))) + i-- + dAtA[i] = 0x12 + } + if x.Success { + i-- + if x.Success { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x8 + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*MsgExecuteTxResponse) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire 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++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgExecuteTxResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgExecuteTxResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Success", wireType) + } + var v int + 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++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + x.Success = bool(v != 0) + case 2: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field TxHash", 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.TxHash = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + var _ protoreflect.Map = (*_MsgAuthorizeService_3_map)(nil) type _MsgAuthorizeService_3_map struct { @@ -5938,6 +6283,925 @@ func (x *fastReflection_MsgRegisterServiceResponse) ProtoMethods() *protoiface.M } } +var ( + md_MsgUpdateParams protoreflect.MessageDescriptor + fd_MsgUpdateParams_authority protoreflect.FieldDescriptor + fd_MsgUpdateParams_params protoreflect.FieldDescriptor + fd_MsgUpdateParams_token protoreflect.FieldDescriptor +) + +func init() { + file_did_v1_tx_proto_init() + md_MsgUpdateParams = File_did_v1_tx_proto.Messages().ByName("MsgUpdateParams") + fd_MsgUpdateParams_authority = md_MsgUpdateParams.Fields().ByName("authority") + fd_MsgUpdateParams_params = md_MsgUpdateParams.Fields().ByName("params") + fd_MsgUpdateParams_token = md_MsgUpdateParams.Fields().ByName("token") +} + +var _ protoreflect.Message = (*fastReflection_MsgUpdateParams)(nil) + +type fastReflection_MsgUpdateParams MsgUpdateParams + +func (x *MsgUpdateParams) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgUpdateParams)(x) +} + +func (x *MsgUpdateParams) slowProtoReflect() protoreflect.Message { + mi := &file_did_v1_tx_proto_msgTypes[10] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_MsgUpdateParams_messageType fastReflection_MsgUpdateParams_messageType +var _ protoreflect.MessageType = fastReflection_MsgUpdateParams_messageType{} + +type fastReflection_MsgUpdateParams_messageType struct{} + +func (x fastReflection_MsgUpdateParams_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgUpdateParams)(nil) +} +func (x fastReflection_MsgUpdateParams_messageType) New() protoreflect.Message { + return new(fastReflection_MsgUpdateParams) +} +func (x fastReflection_MsgUpdateParams_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgUpdateParams +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_MsgUpdateParams) Descriptor() protoreflect.MessageDescriptor { + return md_MsgUpdateParams +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_MsgUpdateParams) Type() protoreflect.MessageType { + return _fastReflection_MsgUpdateParams_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_MsgUpdateParams) New() protoreflect.Message { + return new(fastReflection_MsgUpdateParams) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_MsgUpdateParams) Interface() protoreflect.ProtoMessage { + return (*MsgUpdateParams)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_MsgUpdateParams) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Authority != "" { + value := protoreflect.ValueOfString(x.Authority) + if !f(fd_MsgUpdateParams_authority, value) { + return + } + } + if x.Params != nil { + value := protoreflect.ValueOfMessage(x.Params.ProtoReflect()) + if !f(fd_MsgUpdateParams_params, value) { + return + } + } + if x.Token != "" { + value := protoreflect.ValueOfString(x.Token) + if !f(fd_MsgUpdateParams_token, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_MsgUpdateParams) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "did.v1.MsgUpdateParams.authority": + return x.Authority != "" + case "did.v1.MsgUpdateParams.params": + return x.Params != nil + case "did.v1.MsgUpdateParams.token": + return x.Token != "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: did.v1.MsgUpdateParams")) + } + panic(fmt.Errorf("message did.v1.MsgUpdateParams does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgUpdateParams) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "did.v1.MsgUpdateParams.authority": + x.Authority = "" + case "did.v1.MsgUpdateParams.params": + x.Params = nil + case "did.v1.MsgUpdateParams.token": + x.Token = "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: did.v1.MsgUpdateParams")) + } + panic(fmt.Errorf("message did.v1.MsgUpdateParams does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_MsgUpdateParams) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "did.v1.MsgUpdateParams.authority": + value := x.Authority + return protoreflect.ValueOfString(value) + case "did.v1.MsgUpdateParams.params": + value := x.Params + return protoreflect.ValueOfMessage(value.ProtoReflect()) + case "did.v1.MsgUpdateParams.token": + value := x.Token + return protoreflect.ValueOfString(value) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: did.v1.MsgUpdateParams")) + } + panic(fmt.Errorf("message did.v1.MsgUpdateParams does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgUpdateParams) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "did.v1.MsgUpdateParams.authority": + x.Authority = value.Interface().(string) + case "did.v1.MsgUpdateParams.params": + x.Params = value.Message().Interface().(*Params) + case "did.v1.MsgUpdateParams.token": + x.Token = value.Interface().(string) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: did.v1.MsgUpdateParams")) + } + panic(fmt.Errorf("message did.v1.MsgUpdateParams does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgUpdateParams) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "did.v1.MsgUpdateParams.params": + if x.Params == nil { + x.Params = new(Params) + } + return protoreflect.ValueOfMessage(x.Params.ProtoReflect()) + case "did.v1.MsgUpdateParams.authority": + panic(fmt.Errorf("field authority of message did.v1.MsgUpdateParams is not mutable")) + case "did.v1.MsgUpdateParams.token": + panic(fmt.Errorf("field token of message did.v1.MsgUpdateParams is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: did.v1.MsgUpdateParams")) + } + panic(fmt.Errorf("message did.v1.MsgUpdateParams does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_MsgUpdateParams) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "did.v1.MsgUpdateParams.authority": + return protoreflect.ValueOfString("") + case "did.v1.MsgUpdateParams.params": + m := new(Params) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + case "did.v1.MsgUpdateParams.token": + return protoreflect.ValueOfString("") + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: did.v1.MsgUpdateParams")) + } + panic(fmt.Errorf("message did.v1.MsgUpdateParams does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_MsgUpdateParams) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in did.v1.MsgUpdateParams", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_MsgUpdateParams) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgUpdateParams) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_MsgUpdateParams) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_MsgUpdateParams) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*MsgUpdateParams) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + l = len(x.Authority) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.Params != nil { + l = options.Size(x.Params) + n += 1 + l + runtime.Sov(uint64(l)) + } + l = len(x.Token) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*MsgUpdateParams) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if len(x.Token) > 0 { + i -= len(x.Token) + copy(dAtA[i:], x.Token) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Token))) + i-- + dAtA[i] = 0x1a + } + if x.Params != nil { + encoded, err := options.Marshal(x.Params) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0x12 + } + if len(x.Authority) > 0 { + i -= len(x.Authority) + copy(dAtA[i:], x.Authority) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Authority))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*MsgUpdateParams) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire 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++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgUpdateParams: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgUpdateParams: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Authority", 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.Authority = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + } + var msglen int + 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++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + 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 + } + if x.Params == nil { + x.Params = &Params{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Params); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Token", 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.Token = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var ( + md_MsgUpdateParamsResponse protoreflect.MessageDescriptor +) + +func init() { + file_did_v1_tx_proto_init() + md_MsgUpdateParamsResponse = File_did_v1_tx_proto.Messages().ByName("MsgUpdateParamsResponse") +} + +var _ protoreflect.Message = (*fastReflection_MsgUpdateParamsResponse)(nil) + +type fastReflection_MsgUpdateParamsResponse MsgUpdateParamsResponse + +func (x *MsgUpdateParamsResponse) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgUpdateParamsResponse)(x) +} + +func (x *MsgUpdateParamsResponse) slowProtoReflect() protoreflect.Message { + mi := &file_did_v1_tx_proto_msgTypes[11] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_MsgUpdateParamsResponse_messageType fastReflection_MsgUpdateParamsResponse_messageType +var _ protoreflect.MessageType = fastReflection_MsgUpdateParamsResponse_messageType{} + +type fastReflection_MsgUpdateParamsResponse_messageType struct{} + +func (x fastReflection_MsgUpdateParamsResponse_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgUpdateParamsResponse)(nil) +} +func (x fastReflection_MsgUpdateParamsResponse_messageType) New() protoreflect.Message { + return new(fastReflection_MsgUpdateParamsResponse) +} +func (x fastReflection_MsgUpdateParamsResponse_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgUpdateParamsResponse +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_MsgUpdateParamsResponse) Descriptor() protoreflect.MessageDescriptor { + return md_MsgUpdateParamsResponse +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_MsgUpdateParamsResponse) Type() protoreflect.MessageType { + return _fastReflection_MsgUpdateParamsResponse_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_MsgUpdateParamsResponse) New() protoreflect.Message { + return new(fastReflection_MsgUpdateParamsResponse) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_MsgUpdateParamsResponse) Interface() protoreflect.ProtoMessage { + return (*MsgUpdateParamsResponse)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_MsgUpdateParamsResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_MsgUpdateParamsResponse) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: did.v1.MsgUpdateParamsResponse")) + } + panic(fmt.Errorf("message did.v1.MsgUpdateParamsResponse does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgUpdateParamsResponse) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: did.v1.MsgUpdateParamsResponse")) + } + panic(fmt.Errorf("message did.v1.MsgUpdateParamsResponse does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_MsgUpdateParamsResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: did.v1.MsgUpdateParamsResponse")) + } + panic(fmt.Errorf("message did.v1.MsgUpdateParamsResponse does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgUpdateParamsResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: did.v1.MsgUpdateParamsResponse")) + } + panic(fmt.Errorf("message did.v1.MsgUpdateParamsResponse does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgUpdateParamsResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: did.v1.MsgUpdateParamsResponse")) + } + panic(fmt.Errorf("message did.v1.MsgUpdateParamsResponse does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_MsgUpdateParamsResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: did.v1.MsgUpdateParamsResponse")) + } + panic(fmt.Errorf("message did.v1.MsgUpdateParamsResponse does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_MsgUpdateParamsResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in did.v1.MsgUpdateParamsResponse", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_MsgUpdateParamsResponse) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgUpdateParamsResponse) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_MsgUpdateParamsResponse) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_MsgUpdateParamsResponse) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*MsgUpdateParamsResponse) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*MsgUpdateParamsResponse) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*MsgUpdateParamsResponse) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire 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++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgUpdateParamsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgUpdateParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.0 @@ -5959,10 +7223,10 @@ type MsgAllocateVault struct { // authority is the address of the service account. Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` - // params defines the parameters to update. - Params *Params `protobuf:"bytes,2,opt,name=params,proto3" json:"params,omitempty"` - // token is the macron token to authenticate the operation. - Token string `protobuf:"bytes,3,opt,name=token,proto3" json:"token,omitempty"` + // subject is a unique human-defined identifier to associate with the vault. + Subject string `protobuf:"bytes,2,opt,name=subject,proto3" json:"subject,omitempty"` + // origin is the origin of the request in wildcard form. + Origin string `protobuf:"bytes,3,opt,name=origin,proto3" json:"origin,omitempty"` } func (x *MsgAllocateVault) Reset() { @@ -5999,100 +7263,6 @@ func (x *MsgAllocateVault) GetSubject() string { return "" } -func (x *MsgUpdateParams) GetToken() string { - if x != nil { - return x.Token - } - return "" -} - -// MsgUpdateParamsResponse defines the response structure for executing a -// MsgUpdateParams message. -// -// Since: cosmos-sdk 0.47 -type MsgUpdateParamsResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // CID is the content identifier of the vault. - Cid string `protobuf:"bytes,1,opt,name=cid,proto3" json:"cid,omitempty"` - // ExpiryBlock is the block number at which the vault will expire. - ExpiryBlock int64 `protobuf:"varint,2,opt,name=expiry_block,json=expiryBlock,proto3" json:"expiry_block,omitempty"` - // RegistrationOptions is a json string of the PublicKeyCredentialCreationOptions for WebAuthn - Token string `protobuf:"bytes,3,opt,name=token,proto3" json:"token,omitempty"` - // IsLocalhost is a flag to indicate if the vault is localhost - Localhost bool `protobuf:"varint,4,opt,name=localhost,proto3" json:"localhost,omitempty"` -} - -func (x *MsgAllocateVaultResponse) Reset() { - *x = MsgAllocateVaultResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_did_v1_tx_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *MsgAllocateVaultResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*MsgAllocateVaultResponse) ProtoMessage() {} - -// Deprecated: Use MsgAllocateVaultResponse.ProtoReflect.Descriptor instead. -func (*MsgAllocateVaultResponse) Descriptor() ([]byte, []int) { - return file_did_v1_tx_proto_rawDescGZIP(), []int{1} -} - -// MsgAllocateVault is the message type for the AllocateVault RPC. -type MsgAllocateVault struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // authority is the address of the service account. - Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` - // subject is a unique human-defined identifier to associate with the vault. - Subject string `protobuf:"bytes,2,opt,name=subject,proto3" json:"subject,omitempty"` - // origin is the origin of the request in wildcard form. - Origin string `protobuf:"bytes,3,opt,name=origin,proto3" json:"origin,omitempty"` -} - -func (x *MsgAllocateVault) Reset() { - *x = MsgAllocateVault{} - if protoimpl.UnsafeEnabled { - mi := &file_did_v1_tx_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *MsgAllocateVault) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*MsgAllocateVault) ProtoMessage() {} - -// Deprecated: Use MsgAllocateVault.ProtoReflect.Descriptor instead. -func (*MsgAllocateVault) Descriptor() ([]byte, []int) { - return file_did_v1_tx_proto_rawDescGZIP(), []int{2} -} - -func (x *MsgAllocateVault) GetAuthority() string { - if x != nil { - return x.Authority - } - return "" -} - -func (x *MsgAllocateVault) GetSubject() string { - if x != nil { - return x.Subject - } - return "" -} - func (x *MsgAllocateVault) GetOrigin() string { if x != nil { return x.Origin @@ -6119,7 +7289,7 @@ type MsgAllocateVaultResponse struct { func (x *MsgAllocateVaultResponse) Reset() { *x = MsgAllocateVaultResponse{} if protoimpl.UnsafeEnabled { - mi := &file_did_v1_tx_proto_msgTypes[3] + mi := &file_did_v1_tx_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -6133,7 +7303,7 @@ func (*MsgAllocateVaultResponse) ProtoMessage() {} // Deprecated: Use MsgAllocateVaultResponse.ProtoReflect.Descriptor instead. func (*MsgAllocateVaultResponse) Descriptor() ([]byte, []int) { - return file_did_v1_tx_proto_rawDescGZIP(), []int{3} + return file_did_v1_tx_proto_rawDescGZIP(), []int{1} } func (x *MsgAllocateVaultResponse) GetCid() string { @@ -6183,7 +7353,7 @@ type MsgRegisterController struct { func (x *MsgRegisterController) Reset() { *x = MsgRegisterController{} if protoimpl.UnsafeEnabled { - mi := &file_did_v1_tx_proto_msgTypes[4] + mi := &file_did_v1_tx_proto_msgTypes[2] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -6197,7 +7367,7 @@ func (*MsgRegisterController) ProtoMessage() {} // Deprecated: Use MsgRegisterController.ProtoReflect.Descriptor instead. func (*MsgRegisterController) Descriptor() ([]byte, []int) { - return file_did_v1_tx_proto_rawDescGZIP(), []int{4} + return file_did_v1_tx_proto_rawDescGZIP(), []int{2} } func (x *MsgRegisterController) GetAuthority() string { @@ -6245,7 +7415,7 @@ type MsgRegisterControllerResponse struct { func (x *MsgRegisterControllerResponse) Reset() { *x = MsgRegisterControllerResponse{} if protoimpl.UnsafeEnabled { - mi := &file_did_v1_tx_proto_msgTypes[5] + mi := &file_did_v1_tx_proto_msgTypes[3] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -6259,7 +7429,7 @@ func (*MsgRegisterControllerResponse) ProtoMessage() {} // Deprecated: Use MsgRegisterControllerResponse.ProtoReflect.Descriptor instead. func (*MsgRegisterControllerResponse) Descriptor() ([]byte, []int) { - return file_did_v1_tx_proto_rawDescGZIP(), []int{5} + return file_did_v1_tx_proto_rawDescGZIP(), []int{3} } func (x *MsgRegisterControllerResponse) GetSuccess() bool { @@ -6283,6 +7453,105 @@ func (x *MsgRegisterControllerResponse) GetAccounts() map[string]string { return nil } +// MsgExecuteTx is the message type for the ExecuteTx RPC. +type MsgExecuteTx struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Controller is the address of the controller to authenticate. + Controller string `protobuf:"bytes,1,opt,name=controller,proto3" json:"controller,omitempty"` + // Messages is the list of messages to execute. + Messages map[string][]byte `protobuf:"bytes,2,rep,name=messages,proto3" json:"messages,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + // MacaroonToken is the macaroon token to authenticate the operation. + MacaroonToken string `protobuf:"bytes,3,opt,name=macaroon_token,json=macaroonToken,proto3" json:"macaroon_token,omitempty"` +} + +func (x *MsgExecuteTx) Reset() { + *x = MsgExecuteTx{} + if protoimpl.UnsafeEnabled { + mi := &file_did_v1_tx_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgExecuteTx) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgExecuteTx) ProtoMessage() {} + +// Deprecated: Use MsgExecuteTx.ProtoReflect.Descriptor instead. +func (*MsgExecuteTx) Descriptor() ([]byte, []int) { + return file_did_v1_tx_proto_rawDescGZIP(), []int{4} +} + +func (x *MsgExecuteTx) GetController() string { + if x != nil { + return x.Controller + } + return "" +} + +func (x *MsgExecuteTx) GetMessages() map[string][]byte { + if x != nil { + return x.Messages + } + return nil +} + +func (x *MsgExecuteTx) GetMacaroonToken() string { + if x != nil { + return x.MacaroonToken + } + return "" +} + +// MsgExecuteTxResponse is the response type for the ExecuteTx RPC. +type MsgExecuteTxResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + TxHash string `protobuf:"bytes,2,opt,name=tx_hash,json=txHash,proto3" json:"tx_hash,omitempty"` +} + +func (x *MsgExecuteTxResponse) Reset() { + *x = MsgExecuteTxResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_did_v1_tx_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgExecuteTxResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgExecuteTxResponse) ProtoMessage() {} + +// Deprecated: Use MsgExecuteTxResponse.ProtoReflect.Descriptor instead. +func (*MsgExecuteTxResponse) Descriptor() ([]byte, []int) { + return file_did_v1_tx_proto_rawDescGZIP(), []int{5} +} + +func (x *MsgExecuteTxResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *MsgExecuteTxResponse) GetTxHash() string { + if x != nil { + return x.TxHash + } + return "" +} + // MsgAuthorizeService is the message type for the AuthorizeService RPC. type MsgAuthorizeService struct { state protoimpl.MessageState @@ -6481,6 +7750,93 @@ func (x *MsgRegisterServiceResponse) GetDid() string { return "" } +// MsgUpdateParams is the Msg/UpdateParams request type. +// +// Since: cosmos-sdk 0.47 +type MsgUpdateParams struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // authority is the address of the governance account. + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` + // params defines the parameters to update. + Params *Params `protobuf:"bytes,2,opt,name=params,proto3" json:"params,omitempty"` + // token is the macron token to authenticate the operation. + Token string `protobuf:"bytes,3,opt,name=token,proto3" json:"token,omitempty"` +} + +func (x *MsgUpdateParams) Reset() { + *x = MsgUpdateParams{} + if protoimpl.UnsafeEnabled { + mi := &file_did_v1_tx_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgUpdateParams) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgUpdateParams) ProtoMessage() {} + +// Deprecated: Use MsgUpdateParams.ProtoReflect.Descriptor instead. +func (*MsgUpdateParams) Descriptor() ([]byte, []int) { + return file_did_v1_tx_proto_rawDescGZIP(), []int{10} +} + +func (x *MsgUpdateParams) GetAuthority() string { + if x != nil { + return x.Authority + } + return "" +} + +func (x *MsgUpdateParams) GetParams() *Params { + if x != nil { + return x.Params + } + return nil +} + +func (x *MsgUpdateParams) GetToken() string { + if x != nil { + return x.Token + } + return "" +} + +// MsgUpdateParamsResponse defines the response structure for executing a +// MsgUpdateParams message. +// +// Since: cosmos-sdk 0.47 +type MsgUpdateParamsResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *MsgUpdateParamsResponse) Reset() { + *x = MsgUpdateParamsResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_did_v1_tx_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgUpdateParamsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgUpdateParamsResponse) ProtoMessage() {} + +// Deprecated: Use MsgUpdateParamsResponse.ProtoReflect.Descriptor instead. +func (*MsgUpdateParamsResponse) Descriptor() ([]byte, []int) { + return file_did_v1_tx_proto_rawDescGZIP(), []int{11} +} + var File_did_v1_tx_proto protoreflect.FileDescriptor var file_did_v1_tx_proto_rawDesc = []byte{ @@ -6491,65 +7847,74 @@ var file_did_v1_tx_proto_rawDesc = []byte{ 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x14, 0x64, 0x69, 0x64, 0x2f, 0x76, 0x31, 0x2f, 0x67, 0x65, 0x6e, 0x65, 0x73, 0x69, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x14, 0x67, 0x6f, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, - 0x6f, 0x67, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x9d, 0x01, 0x0a, 0x0f, 0x4d, 0x73, - 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x36, 0x0a, - 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, - 0x42, 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, - 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x09, 0x61, 0x75, 0x74, 0x68, - 0x6f, 0x72, 0x69, 0x74, 0x79, 0x12, 0x2c, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x64, 0x69, 0x64, 0x2e, 0x76, 0x31, 0x2e, 0x50, - 0x61, 0x72, 0x61, 0x6d, 0x73, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x06, 0x70, 0x61, 0x72, - 0x61, 0x6d, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x03, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x3a, 0x0e, 0x82, 0xe7, 0xb0, 0x2a, 0x09, - 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x22, 0x19, 0x0a, 0x17, 0x4d, 0x73, 0x67, - 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x8c, 0x01, 0x0a, 0x10, 0x4d, 0x73, 0x67, 0x41, 0x6c, 0x6c, 0x6f, - 0x63, 0x61, 0x74, 0x65, 0x56, 0x61, 0x75, 0x6c, 0x74, 0x12, 0x36, 0x0a, 0x09, 0x61, 0x75, 0x74, - 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, - 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, - 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, - 0x79, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x07, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x6f, - 0x72, 0x69, 0x67, 0x69, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6f, 0x72, 0x69, - 0x67, 0x69, 0x6e, 0x3a, 0x0e, 0x82, 0xe7, 0xb0, 0x2a, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, - 0x69, 0x74, 0x79, 0x22, 0x83, 0x01, 0x0a, 0x18, 0x4d, 0x73, 0x67, 0x41, 0x6c, 0x6c, 0x6f, 0x63, - 0x61, 0x74, 0x65, 0x56, 0x61, 0x75, 0x6c, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x12, 0x10, 0x0a, 0x03, 0x63, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x63, - 0x69, 0x64, 0x12, 0x21, 0x0a, 0x0c, 0x65, 0x78, 0x70, 0x69, 0x72, 0x79, 0x5f, 0x62, 0x6c, 0x6f, - 0x63, 0x6b, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0b, 0x65, 0x78, 0x70, 0x69, 0x72, 0x79, - 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x03, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x1c, 0x0a, 0x09, 0x6c, - 0x6f, 0x63, 0x61, 0x6c, 0x68, 0x6f, 0x73, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, - 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x68, 0x6f, 0x73, 0x74, 0x22, 0xc3, 0x01, 0x0a, 0x15, 0x4d, 0x73, - 0x67, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, - 0x6c, 0x65, 0x72, 0x12, 0x36, 0x0a, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, - 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, - 0x52, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x12, 0x1e, 0x0a, 0x0a, 0x61, - 0x73, 0x73, 0x65, 0x72, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0c, 0x52, - 0x0a, 0x61, 0x73, 0x73, 0x65, 0x72, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x1c, 0x0a, 0x09, 0x6b, - 0x65, 0x79, 0x73, 0x68, 0x61, 0x72, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x09, - 0x6b, 0x65, 0x79, 0x73, 0x68, 0x61, 0x72, 0x65, 0x73, 0x12, 0x24, 0x0a, 0x0d, 0x76, 0x65, 0x72, - 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0c, - 0x52, 0x0d, 0x76, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x3a, - 0x0e, 0x82, 0xe7, 0xb0, 0x2a, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x22, - 0x81, 0x02, 0x0a, 0x1d, 0x4d, 0x73, 0x67, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x43, - 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x08, 0x52, 0x07, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x12, 0x38, 0x0a, 0x0a, 0x63, - 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, - 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, - 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x0a, 0x63, 0x6f, 0x6e, 0x74, 0x72, - 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x12, 0x4f, 0x0a, 0x08, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, - 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x33, 0x2e, 0x64, 0x69, 0x64, 0x2e, 0x76, 0x31, - 0x2e, 0x4d, 0x73, 0x67, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x74, - 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x41, - 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x08, 0x61, 0x63, - 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x1a, 0x3b, 0x0a, 0x0d, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, - 0x74, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, - 0x02, 0x38, 0x01, 0x22, 0x9e, 0x02, 0x0a, 0x13, 0x4d, 0x73, 0x67, 0x41, 0x75, 0x74, 0x68, 0x6f, + 0x6f, 0x67, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x8c, 0x01, 0x0a, 0x10, 0x4d, 0x73, + 0x67, 0x41, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x65, 0x56, 0x61, 0x75, 0x6c, 0x74, 0x12, 0x36, + 0x0a, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, + 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x09, 0x61, 0x75, 0x74, + 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, + 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, + 0x12, 0x16, 0x0a, 0x06, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x06, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x3a, 0x0e, 0x82, 0xe7, 0xb0, 0x2a, 0x09, 0x61, + 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x22, 0x83, 0x01, 0x0a, 0x18, 0x4d, 0x73, 0x67, + 0x41, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x65, 0x56, 0x61, 0x75, 0x6c, 0x74, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x63, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x03, 0x63, 0x69, 0x64, 0x12, 0x21, 0x0a, 0x0c, 0x65, 0x78, 0x70, 0x69, 0x72, + 0x79, 0x5f, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0b, 0x65, + 0x78, 0x70, 0x69, 0x72, 0x79, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, + 0x6b, 0x65, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, + 0x12, 0x1c, 0x0a, 0x09, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x68, 0x6f, 0x73, 0x74, 0x18, 0x04, 0x20, + 0x01, 0x28, 0x08, 0x52, 0x09, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x68, 0x6f, 0x73, 0x74, 0x22, 0xc3, + 0x01, 0x0a, 0x15, 0x4d, 0x73, 0x67, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x43, 0x6f, + 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x12, 0x36, 0x0a, 0x09, 0x61, 0x75, 0x74, 0x68, + 0x6f, 0x72, 0x69, 0x74, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, + 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, + 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, + 0x12, 0x1e, 0x0a, 0x0a, 0x61, 0x73, 0x73, 0x65, 0x72, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x02, + 0x20, 0x03, 0x28, 0x0c, 0x52, 0x0a, 0x61, 0x73, 0x73, 0x65, 0x72, 0x74, 0x69, 0x6f, 0x6e, 0x73, + 0x12, 0x1c, 0x0a, 0x09, 0x6b, 0x65, 0x79, 0x73, 0x68, 0x61, 0x72, 0x65, 0x73, 0x18, 0x03, 0x20, + 0x03, 0x28, 0x0c, 0x52, 0x09, 0x6b, 0x65, 0x79, 0x73, 0x68, 0x61, 0x72, 0x65, 0x73, 0x12, 0x24, + 0x0a, 0x0d, 0x76, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, + 0x04, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x0d, 0x76, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x73, 0x3a, 0x0e, 0x82, 0xe7, 0xb0, 0x2a, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, + 0x72, 0x69, 0x74, 0x79, 0x22, 0x81, 0x02, 0x0a, 0x1d, 0x4d, 0x73, 0x67, 0x52, 0x65, 0x67, 0x69, + 0x73, 0x74, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, + 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, + 0x12, 0x38, 0x0a, 0x0a, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, + 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x0a, + 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x12, 0x4f, 0x0a, 0x08, 0x61, 0x63, + 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x33, 0x2e, 0x64, + 0x69, 0x64, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, + 0x72, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x2e, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x45, 0x6e, 0x74, 0x72, + 0x79, 0x52, 0x08, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x1a, 0x3b, 0x0a, 0x0d, 0x41, + 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, + 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, + 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, + 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0xfd, 0x01, 0x0a, 0x0c, 0x4d, 0x73, 0x67, + 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x65, 0x54, 0x78, 0x12, 0x38, 0x0a, 0x0a, 0x63, 0x6f, 0x6e, + 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, + 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, + 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x0a, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, + 0x6c, 0x65, 0x72, 0x12, 0x3e, 0x0a, 0x08, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x18, + 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x64, 0x69, 0x64, 0x2e, 0x76, 0x31, 0x2e, 0x4d, + 0x73, 0x67, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x65, 0x54, 0x78, 0x2e, 0x4d, 0x65, 0x73, 0x73, + 0x61, 0x67, 0x65, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x08, 0x6d, 0x65, 0x73, 0x73, 0x61, + 0x67, 0x65, 0x73, 0x12, 0x25, 0x0a, 0x0e, 0x6d, 0x61, 0x63, 0x61, 0x72, 0x6f, 0x6f, 0x6e, 0x5f, + 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x6d, 0x61, 0x63, + 0x61, 0x72, 0x6f, 0x6f, 0x6e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x1a, 0x3b, 0x0a, 0x0d, 0x4d, 0x65, + 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, + 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, + 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x76, 0x61, + 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x3a, 0x0f, 0x82, 0xe7, 0xb0, 0x2a, 0x0a, 0x63, 0x6f, + 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x22, 0x49, 0x0a, 0x14, 0x4d, 0x73, 0x67, 0x45, + 0x78, 0x65, 0x63, 0x75, 0x74, 0x65, 0x54, 0x78, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x18, 0x0a, 0x07, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x08, 0x52, 0x07, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x12, 0x17, 0x0a, 0x07, 0x74, 0x78, + 0x5f, 0x68, 0x61, 0x73, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x74, 0x78, 0x48, + 0x61, 0x73, 0x68, 0x22, 0x9e, 0x02, 0x0a, 0x13, 0x4d, 0x73, 0x67, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x38, 0x0a, 0x0a, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, @@ -6585,42 +7950,58 @@ var file_did_v1_tx_proto_rawDesc = []byte{ 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x12, 0x10, 0x0a, 0x03, 0x64, 0x69, 0x64, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x64, 0x69, 0x64, 0x32, 0xa8, 0x03, 0x0a, 0x03, 0x4d, - 0x73, 0x67, 0x12, 0x48, 0x0a, 0x0c, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, - 0x6d, 0x73, 0x12, 0x17, 0x2e, 0x64, 0x69, 0x64, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x55, - 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x1a, 0x1f, 0x2e, 0x64, 0x69, - 0x64, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, - 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x54, 0x0a, 0x10, - 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, - 0x12, 0x1b, 0x2e, 0x64, 0x69, 0x64, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x41, 0x75, 0x74, - 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x1a, 0x23, 0x2e, - 0x64, 0x69, 0x64, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, - 0x69, 0x7a, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x12, 0x4b, 0x0a, 0x0d, 0x41, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x65, 0x56, 0x61, - 0x75, 0x6c, 0x74, 0x12, 0x18, 0x2e, 0x64, 0x69, 0x64, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, - 0x41, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x65, 0x56, 0x61, 0x75, 0x6c, 0x74, 0x1a, 0x20, 0x2e, - 0x64, 0x69, 0x64, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x41, 0x6c, 0x6c, 0x6f, 0x63, 0x61, - 0x74, 0x65, 0x56, 0x61, 0x75, 0x6c, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, - 0x5a, 0x0a, 0x12, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x74, 0x72, - 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x12, 0x1d, 0x2e, 0x64, 0x69, 0x64, 0x2e, 0x76, 0x31, 0x2e, 0x4d, - 0x73, 0x67, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x6f, - 0x6c, 0x6c, 0x65, 0x72, 0x1a, 0x25, 0x2e, 0x64, 0x69, 0x64, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, - 0x67, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, - 0x6c, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x51, 0x0a, 0x0f, 0x52, - 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x1a, - 0x2e, 0x64, 0x69, 0x64, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x52, 0x65, 0x67, 0x69, 0x73, - 0x74, 0x65, 0x72, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x1a, 0x22, 0x2e, 0x64, 0x69, 0x64, - 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x53, - 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x1a, 0x05, - 0x80, 0xe7, 0xb0, 0x2a, 0x01, 0x42, 0x77, 0x0a, 0x0a, 0x63, 0x6f, 0x6d, 0x2e, 0x64, 0x69, 0x64, - 0x2e, 0x76, 0x31, 0x42, 0x07, 0x54, 0x78, 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, 0x69, 0x64, 0x2f, 0x76, - 0x31, 0x3b, 0x64, 0x69, 0x64, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x44, 0x58, 0x58, 0xaa, 0x02, 0x06, - 0x44, 0x69, 0x64, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x06, 0x44, 0x69, 0x64, 0x5c, 0x56, 0x31, 0xe2, - 0x02, 0x12, 0x44, 0x69, 0x64, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, - 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x07, 0x44, 0x69, 0x64, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x64, 0x69, 0x64, 0x22, 0x9d, 0x01, 0x0a, 0x0f, 0x4d, + 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x36, + 0x0a, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, + 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x09, 0x61, 0x75, 0x74, + 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x12, 0x2c, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x64, 0x69, 0x64, 0x2e, 0x76, 0x31, 0x2e, + 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x06, 0x70, 0x61, + 0x72, 0x61, 0x6d, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x3a, 0x0e, 0x82, 0xe7, 0xb0, 0x2a, + 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x22, 0x19, 0x0a, 0x17, 0x4d, 0x73, + 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0xe9, 0x03, 0x0a, 0x03, 0x4d, 0x73, 0x67, 0x12, 0x4b, 0x0a, + 0x0d, 0x41, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x65, 0x56, 0x61, 0x75, 0x6c, 0x74, 0x12, 0x18, + 0x2e, 0x64, 0x69, 0x64, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x41, 0x6c, 0x6c, 0x6f, 0x63, + 0x61, 0x74, 0x65, 0x56, 0x61, 0x75, 0x6c, 0x74, 0x1a, 0x20, 0x2e, 0x64, 0x69, 0x64, 0x2e, 0x76, + 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x41, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x65, 0x56, 0x61, 0x75, + 0x6c, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x54, 0x0a, 0x10, 0x41, 0x75, + 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x1b, + 0x2e, 0x64, 0x69, 0x64, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x41, 0x75, 0x74, 0x68, 0x6f, + 0x72, 0x69, 0x7a, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x1a, 0x23, 0x2e, 0x64, 0x69, + 0x64, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, + 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x3f, 0x0a, 0x09, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x65, 0x54, 0x78, 0x12, 0x14, 0x2e, + 0x64, 0x69, 0x64, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, + 0x65, 0x54, 0x78, 0x1a, 0x1c, 0x2e, 0x64, 0x69, 0x64, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, + 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x65, 0x54, 0x78, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x12, 0x5a, 0x0a, 0x12, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x43, 0x6f, 0x6e, + 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x12, 0x1d, 0x2e, 0x64, 0x69, 0x64, 0x2e, 0x76, 0x31, + 0x2e, 0x4d, 0x73, 0x67, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x74, + 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x1a, 0x25, 0x2e, 0x64, 0x69, 0x64, 0x2e, 0x76, 0x31, 0x2e, + 0x4d, 0x73, 0x67, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x74, 0x72, + 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x51, 0x0a, + 0x0f, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, + 0x12, 0x1a, 0x2e, 0x64, 0x69, 0x64, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x52, 0x65, 0x67, + 0x69, 0x73, 0x74, 0x65, 0x72, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x1a, 0x22, 0x2e, 0x64, + 0x69, 0x64, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, + 0x72, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x48, 0x0a, 0x0c, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, + 0x12, 0x17, 0x2e, 0x64, 0x69, 0x64, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, + 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x1a, 0x1f, 0x2e, 0x64, 0x69, 0x64, 0x2e, + 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, + 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x1a, 0x05, 0x80, 0xe7, 0xb0, 0x2a, + 0x01, 0x42, 0x77, 0x0a, 0x0a, 0x63, 0x6f, 0x6d, 0x2e, 0x64, 0x69, 0x64, 0x2e, 0x76, 0x31, 0x42, + 0x07, 0x54, 0x78, 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, 0x69, 0x64, 0x2f, 0x76, 0x31, 0x3b, 0x64, 0x69, + 0x64, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x44, 0x58, 0x58, 0xaa, 0x02, 0x06, 0x44, 0x69, 0x64, 0x2e, + 0x56, 0x31, 0xca, 0x02, 0x06, 0x44, 0x69, 0x64, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x12, 0x44, 0x69, + 0x64, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, + 0xea, 0x02, 0x07, 0x44, 0x69, 0x64, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x33, } var ( @@ -6635,43 +8016,49 @@ func file_did_v1_tx_proto_rawDescGZIP() []byte { return file_did_v1_tx_proto_rawDescData } -var file_did_v1_tx_proto_msgTypes = make([]protoimpl.MessageInfo, 12) +var file_did_v1_tx_proto_msgTypes = make([]protoimpl.MessageInfo, 15) var file_did_v1_tx_proto_goTypes = []interface{}{ - (*MsgUpdateParams)(nil), // 0: did.v1.MsgUpdateParams - (*MsgUpdateParamsResponse)(nil), // 1: did.v1.MsgUpdateParamsResponse - (*MsgAllocateVault)(nil), // 2: did.v1.MsgAllocateVault - (*MsgAllocateVaultResponse)(nil), // 3: did.v1.MsgAllocateVaultResponse - (*MsgRegisterController)(nil), // 4: did.v1.MsgRegisterController - (*MsgRegisterControllerResponse)(nil), // 5: did.v1.MsgRegisterControllerResponse + (*MsgAllocateVault)(nil), // 0: did.v1.MsgAllocateVault + (*MsgAllocateVaultResponse)(nil), // 1: did.v1.MsgAllocateVaultResponse + (*MsgRegisterController)(nil), // 2: did.v1.MsgRegisterController + (*MsgRegisterControllerResponse)(nil), // 3: did.v1.MsgRegisterControllerResponse + (*MsgExecuteTx)(nil), // 4: did.v1.MsgExecuteTx + (*MsgExecuteTxResponse)(nil), // 5: did.v1.MsgExecuteTxResponse (*MsgAuthorizeService)(nil), // 6: did.v1.MsgAuthorizeService (*MsgAuthorizeServiceResponse)(nil), // 7: did.v1.MsgAuthorizeServiceResponse (*MsgRegisterService)(nil), // 8: did.v1.MsgRegisterService (*MsgRegisterServiceResponse)(nil), // 9: did.v1.MsgRegisterServiceResponse - nil, // 10: did.v1.MsgRegisterControllerResponse.AccountsEntry - nil, // 11: did.v1.MsgAuthorizeService.PermissionsEntry - (*Params)(nil), // 12: did.v1.Params - (*Service)(nil), // 13: did.v1.Service + (*MsgUpdateParams)(nil), // 10: did.v1.MsgUpdateParams + (*MsgUpdateParamsResponse)(nil), // 11: did.v1.MsgUpdateParamsResponse + nil, // 12: did.v1.MsgRegisterControllerResponse.AccountsEntry + nil, // 13: did.v1.MsgExecuteTx.MessagesEntry + nil, // 14: did.v1.MsgAuthorizeService.PermissionsEntry + (*Service)(nil), // 15: did.v1.Service + (*Params)(nil), // 16: did.v1.Params } var file_did_v1_tx_proto_depIdxs = []int32{ - 12, // 0: did.v1.MsgUpdateParams.params:type_name -> did.v1.Params - 10, // 1: did.v1.MsgRegisterControllerResponse.accounts:type_name -> did.v1.MsgRegisterControllerResponse.AccountsEntry - 11, // 2: did.v1.MsgAuthorizeService.permissions:type_name -> did.v1.MsgAuthorizeService.PermissionsEntry - 13, // 3: did.v1.MsgRegisterService.service:type_name -> did.v1.Service - 0, // 4: did.v1.Msg.UpdateParams:input_type -> did.v1.MsgUpdateParams - 6, // 5: did.v1.Msg.AuthorizeService:input_type -> did.v1.MsgAuthorizeService - 2, // 6: did.v1.Msg.AllocateVault:input_type -> did.v1.MsgAllocateVault - 4, // 7: did.v1.Msg.RegisterController:input_type -> did.v1.MsgRegisterController - 8, // 8: did.v1.Msg.RegisterService:input_type -> did.v1.MsgRegisterService - 1, // 9: did.v1.Msg.UpdateParams:output_type -> did.v1.MsgUpdateParamsResponse - 7, // 10: did.v1.Msg.AuthorizeService:output_type -> did.v1.MsgAuthorizeServiceResponse - 3, // 11: did.v1.Msg.AllocateVault:output_type -> did.v1.MsgAllocateVaultResponse - 5, // 12: did.v1.Msg.RegisterController:output_type -> did.v1.MsgRegisterControllerResponse - 9, // 13: did.v1.Msg.RegisterService:output_type -> did.v1.MsgRegisterServiceResponse - 9, // [9:14] is the sub-list for method output_type - 4, // [4:9] is the sub-list for method input_type - 4, // [4:4] is the sub-list for extension type_name - 4, // [4:4] is the sub-list for extension extendee - 0, // [0:4] is the sub-list for field type_name + 12, // 0: did.v1.MsgRegisterControllerResponse.accounts:type_name -> did.v1.MsgRegisterControllerResponse.AccountsEntry + 13, // 1: did.v1.MsgExecuteTx.messages:type_name -> did.v1.MsgExecuteTx.MessagesEntry + 14, // 2: did.v1.MsgAuthorizeService.permissions:type_name -> did.v1.MsgAuthorizeService.PermissionsEntry + 15, // 3: did.v1.MsgRegisterService.service:type_name -> did.v1.Service + 16, // 4: did.v1.MsgUpdateParams.params:type_name -> did.v1.Params + 0, // 5: did.v1.Msg.AllocateVault:input_type -> did.v1.MsgAllocateVault + 6, // 6: did.v1.Msg.AuthorizeService:input_type -> did.v1.MsgAuthorizeService + 4, // 7: did.v1.Msg.ExecuteTx:input_type -> did.v1.MsgExecuteTx + 2, // 8: did.v1.Msg.RegisterController:input_type -> did.v1.MsgRegisterController + 8, // 9: did.v1.Msg.RegisterService:input_type -> did.v1.MsgRegisterService + 10, // 10: did.v1.Msg.UpdateParams:input_type -> did.v1.MsgUpdateParams + 1, // 11: did.v1.Msg.AllocateVault:output_type -> did.v1.MsgAllocateVaultResponse + 7, // 12: did.v1.Msg.AuthorizeService:output_type -> did.v1.MsgAuthorizeServiceResponse + 5, // 13: did.v1.Msg.ExecuteTx:output_type -> did.v1.MsgExecuteTxResponse + 3, // 14: did.v1.Msg.RegisterController:output_type -> did.v1.MsgRegisterControllerResponse + 9, // 15: did.v1.Msg.RegisterService:output_type -> did.v1.MsgRegisterServiceResponse + 11, // 16: did.v1.Msg.UpdateParams:output_type -> did.v1.MsgUpdateParamsResponse + 11, // [11:17] is the sub-list for method output_type + 5, // [5:11] is the sub-list for method input_type + 5, // [5:5] is the sub-list for extension type_name + 5, // [5:5] is the sub-list for extension extendee + 0, // [0:5] is the sub-list for field type_name } func init() { file_did_v1_tx_proto_init() } @@ -6706,30 +8093,6 @@ func file_did_v1_tx_proto_init() { } } file_did_v1_tx_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MsgAllocateVault); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_did_v1_tx_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MsgAllocateVaultResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_did_v1_tx_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*MsgRegisterController); i { case 0: return &v.state @@ -6741,7 +8104,7 @@ func file_did_v1_tx_proto_init() { return nil } } - file_did_v1_tx_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + file_did_v1_tx_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*MsgRegisterControllerResponse); i { case 0: return &v.state @@ -6753,6 +8116,30 @@ func file_did_v1_tx_proto_init() { return nil } } + file_did_v1_tx_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MsgExecuteTx); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_did_v1_tx_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MsgExecuteTxResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } file_did_v1_tx_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*MsgAuthorizeService); i { case 0: @@ -6801,7 +8188,7 @@ func file_did_v1_tx_proto_init() { return nil } } - file_did_v1_tx_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + file_did_v1_tx_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*MsgUpdateParams); i { case 0: return &v.state @@ -6813,7 +8200,7 @@ func file_did_v1_tx_proto_init() { return nil } } - file_did_v1_tx_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + file_did_v1_tx_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*MsgUpdateParamsResponse); i { case 0: return &v.state @@ -6832,7 +8219,7 @@ func file_did_v1_tx_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_did_v1_tx_proto_rawDesc, NumEnums: 0, - NumMessages: 12, + NumMessages: 15, NumExtensions: 0, NumServices: 1, }, diff --git a/api/did/v1/tx_grpc.pb.go b/api/did/v1/tx_grpc.pb.go index 8ce8e0729..8dd2d5d05 100644 --- a/api/did/v1/tx_grpc.pb.go +++ b/api/did/v1/tx_grpc.pb.go @@ -19,30 +19,31 @@ import ( const _ = grpc.SupportPackageIsVersion7 const ( - Msg_UpdateParams_FullMethodName = "/did.v1.Msg/UpdateParams" - Msg_AuthorizeService_FullMethodName = "/did.v1.Msg/AuthorizeService" Msg_AllocateVault_FullMethodName = "/did.v1.Msg/AllocateVault" + Msg_AuthorizeService_FullMethodName = "/did.v1.Msg/AuthorizeService" + Msg_ExecuteTx_FullMethodName = "/did.v1.Msg/ExecuteTx" Msg_RegisterController_FullMethodName = "/did.v1.Msg/RegisterController" Msg_RegisterService_FullMethodName = "/did.v1.Msg/RegisterService" + Msg_UpdateParams_FullMethodName = "/did.v1.Msg/UpdateParams" ) // MsgClient is the client API for Msg service. // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. type MsgClient interface { - // UpdateParams defines a governance operation for updating the parameters. - // - // Since: cosmos-sdk 0.47 - UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) - // AuthorizeService asserts the given controller is the owner of the given address. - AuthorizeService(ctx context.Context, in *MsgAuthorizeService, opts ...grpc.CallOption) (*MsgAuthorizeServiceResponse, error) // AllocateVault assembles a sqlite3 database in a local directory and returns the CID of the database. // this operation is called by services initiating a controller registration. AllocateVault(ctx context.Context, in *MsgAllocateVault, opts ...grpc.CallOption) (*MsgAllocateVaultResponse, error) + // AuthorizeService asserts the given controller is the owner of the given address. + AuthorizeService(ctx context.Context, in *MsgAuthorizeService, opts ...grpc.CallOption) (*MsgAuthorizeServiceResponse, error) + // ExecuteTx executes a transaction on the Sonr Blockchain. It leverages Macaroon for verification. + ExecuteTx(ctx context.Context, in *MsgExecuteTx, opts ...grpc.CallOption) (*MsgExecuteTxResponse, error) // RegisterController initializes a controller with the given authentication set, address, cid, publicKey, and user-defined alias. RegisterController(ctx context.Context, in *MsgRegisterController, opts ...grpc.CallOption) (*MsgRegisterControllerResponse, error) // RegisterService initializes a Service with a given permission scope and URI. The domain must have a valid TXT record containing the public key. RegisterService(ctx context.Context, in *MsgRegisterService, opts ...grpc.CallOption) (*MsgRegisterServiceResponse, error) + // UpdateParams defines a governance operation for updating the parameters. + UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) } type msgClient struct { @@ -53,9 +54,9 @@ func NewMsgClient(cc grpc.ClientConnInterface) MsgClient { return &msgClient{cc} } -func (c *msgClient) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) { - out := new(MsgUpdateParamsResponse) - err := c.cc.Invoke(ctx, Msg_UpdateParams_FullMethodName, in, out, opts...) +func (c *msgClient) AllocateVault(ctx context.Context, in *MsgAllocateVault, opts ...grpc.CallOption) (*MsgAllocateVaultResponse, error) { + out := new(MsgAllocateVaultResponse) + err := c.cc.Invoke(ctx, Msg_AllocateVault_FullMethodName, in, out, opts...) if err != nil { return nil, err } @@ -71,9 +72,9 @@ func (c *msgClient) AuthorizeService(ctx context.Context, in *MsgAuthorizeServic return out, nil } -func (c *msgClient) AllocateVault(ctx context.Context, in *MsgAllocateVault, opts ...grpc.CallOption) (*MsgAllocateVaultResponse, error) { - out := new(MsgAllocateVaultResponse) - err := c.cc.Invoke(ctx, Msg_AllocateVault_FullMethodName, in, out, opts...) +func (c *msgClient) ExecuteTx(ctx context.Context, in *MsgExecuteTx, opts ...grpc.CallOption) (*MsgExecuteTxResponse, error) { + out := new(MsgExecuteTxResponse) + err := c.cc.Invoke(ctx, Msg_ExecuteTx_FullMethodName, in, out, opts...) if err != nil { return nil, err } @@ -98,23 +99,32 @@ func (c *msgClient) RegisterService(ctx context.Context, in *MsgRegisterService, return out, nil } +func (c *msgClient) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) { + out := new(MsgUpdateParamsResponse) + err := c.cc.Invoke(ctx, Msg_UpdateParams_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // MsgServer is the server API for Msg service. // All implementations must embed UnimplementedMsgServer // for forward compatibility type MsgServer interface { - // UpdateParams defines a governance operation for updating the parameters. - // - // Since: cosmos-sdk 0.47 - UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) - // AuthorizeService asserts the given controller is the owner of the given address. - AuthorizeService(context.Context, *MsgAuthorizeService) (*MsgAuthorizeServiceResponse, error) // AllocateVault assembles a sqlite3 database in a local directory and returns the CID of the database. // this operation is called by services initiating a controller registration. AllocateVault(context.Context, *MsgAllocateVault) (*MsgAllocateVaultResponse, error) + // AuthorizeService asserts the given controller is the owner of the given address. + AuthorizeService(context.Context, *MsgAuthorizeService) (*MsgAuthorizeServiceResponse, error) + // ExecuteTx executes a transaction on the Sonr Blockchain. It leverages Macaroon for verification. + ExecuteTx(context.Context, *MsgExecuteTx) (*MsgExecuteTxResponse, error) // RegisterController initializes a controller with the given authentication set, address, cid, publicKey, and user-defined alias. RegisterController(context.Context, *MsgRegisterController) (*MsgRegisterControllerResponse, error) // RegisterService initializes a Service with a given permission scope and URI. The domain must have a valid TXT record containing the public key. RegisterService(context.Context, *MsgRegisterService) (*MsgRegisterServiceResponse, error) + // UpdateParams defines a governance operation for updating the parameters. + UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) mustEmbedUnimplementedMsgServer() } @@ -122,14 +132,14 @@ type MsgServer interface { type UnimplementedMsgServer struct { } -func (UnimplementedMsgServer) UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method UpdateParams not implemented") +func (UnimplementedMsgServer) AllocateVault(context.Context, *MsgAllocateVault) (*MsgAllocateVaultResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method AllocateVault not implemented") } func (UnimplementedMsgServer) AuthorizeService(context.Context, *MsgAuthorizeService) (*MsgAuthorizeServiceResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method AuthorizeService not implemented") } -func (UnimplementedMsgServer) AllocateVault(context.Context, *MsgAllocateVault) (*MsgAllocateVaultResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method AllocateVault not implemented") +func (UnimplementedMsgServer) ExecuteTx(context.Context, *MsgExecuteTx) (*MsgExecuteTxResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ExecuteTx not implemented") } func (UnimplementedMsgServer) RegisterController(context.Context, *MsgRegisterController) (*MsgRegisterControllerResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method RegisterController not implemented") @@ -137,6 +147,9 @@ func (UnimplementedMsgServer) RegisterController(context.Context, *MsgRegisterCo func (UnimplementedMsgServer) RegisterService(context.Context, *MsgRegisterService) (*MsgRegisterServiceResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method RegisterService not implemented") } +func (UnimplementedMsgServer) UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateParams not implemented") +} func (UnimplementedMsgServer) mustEmbedUnimplementedMsgServer() {} // UnsafeMsgServer may be embedded to opt out of forward compatibility for this service. @@ -150,20 +163,20 @@ func RegisterMsgServer(s grpc.ServiceRegistrar, srv MsgServer) { s.RegisterService(&Msg_ServiceDesc, srv) } -func _Msg_UpdateParams_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgUpdateParams) +func _Msg_AllocateVault_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgAllocateVault) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(MsgServer).UpdateParams(ctx, in) + return srv.(MsgServer).AllocateVault(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: Msg_UpdateParams_FullMethodName, + FullMethod: Msg_AllocateVault_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).UpdateParams(ctx, req.(*MsgUpdateParams)) + return srv.(MsgServer).AllocateVault(ctx, req.(*MsgAllocateVault)) } return interceptor(ctx, in, info, handler) } @@ -186,20 +199,20 @@ func _Msg_AuthorizeService_Handler(srv interface{}, ctx context.Context, dec fun return interceptor(ctx, in, info, handler) } -func _Msg_AllocateVault_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgAllocateVault) +func _Msg_ExecuteTx_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgExecuteTx) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(MsgServer).AllocateVault(ctx, in) + return srv.(MsgServer).ExecuteTx(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: Msg_AllocateVault_FullMethodName, + FullMethod: Msg_ExecuteTx_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).AllocateVault(ctx, req.(*MsgAllocateVault)) + return srv.(MsgServer).ExecuteTx(ctx, req.(*MsgExecuteTx)) } return interceptor(ctx, in, info, handler) } @@ -240,6 +253,24 @@ func _Msg_RegisterService_Handler(srv interface{}, ctx context.Context, dec func return interceptor(ctx, in, info, handler) } +func _Msg_UpdateParams_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgUpdateParams) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).UpdateParams(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Msg_UpdateParams_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).UpdateParams(ctx, req.(*MsgUpdateParams)) + } + return interceptor(ctx, in, info, handler) +} + // Msg_ServiceDesc is the grpc.ServiceDesc for Msg service. // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) @@ -248,16 +279,16 @@ var Msg_ServiceDesc = grpc.ServiceDesc{ HandlerType: (*MsgServer)(nil), Methods: []grpc.MethodDesc{ { - MethodName: "UpdateParams", - Handler: _Msg_UpdateParams_Handler, + MethodName: "AllocateVault", + Handler: _Msg_AllocateVault_Handler, }, { MethodName: "AuthorizeService", Handler: _Msg_AuthorizeService_Handler, }, { - MethodName: "AllocateVault", - Handler: _Msg_AllocateVault_Handler, + MethodName: "ExecuteTx", + Handler: _Msg_ExecuteTx_Handler, }, { MethodName: "RegisterController", @@ -267,6 +298,10 @@ var Msg_ServiceDesc = grpc.ServiceDesc{ MethodName: "RegisterService", Handler: _Msg_RegisterService_Handler, }, + { + MethodName: "UpdateParams", + Handler: _Msg_UpdateParams_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "did/v1/tx.proto", diff --git a/app/ante.go b/app/ante.go index b79eaa7fe..6638869f6 100644 --- a/app/ante.go +++ b/app/ante.go @@ -57,7 +57,7 @@ func NewAnteHandler(options HandlerOptions) (sdk.AnteHandler, error) { ante.NewValidateBasicDecorator(), ante.NewTxTimeoutHeightDecorator(), ante.NewValidateMemoDecorator(options.AccountKeeper), - ante.NewConsumeGasForTxSizeDecorator(options.AccountKeeper), + // ante.NewConsumeGasForTxSizeDecorator(options.AccountKeeper), globalfeeante.NewFeeDecorator(options.BypassMinFeeMsgTypes, options.GlobalFeeKeeper, options.StakingKeeper, 2_000_000), // ante.NewDeductFeeDecorator(options.AccountKeeper, options.BankKeeper, options.FeegrantKeeper, options.TxFeeChecker), ante.NewSetPubKeyDecorator(options.AccountKeeper), // SetPubKeyDecorator must be called before all signature verification decorators diff --git a/app/app.go b/app/app.go index 45893a3e4..077441b0a 100644 --- a/app/app.go +++ b/app/app.go @@ -1127,6 +1127,8 @@ func GetDefaultBypassFeeMessages() []string { sdk.MsgTypeURL(&ibcchanneltypes.MsgChannelOpenTry{}), sdk.MsgTypeURL(&ibcchanneltypes.MsgChannelOpenConfirm{}), sdk.MsgTypeURL(&ibcchanneltypes.MsgChannelOpenAck{}), + sdk.MsgTypeURL(&didtypes.MsgAllocateVault{}), + sdk.MsgTypeURL(&didtypes.MsgRegisterController{}), } } diff --git a/cmd/dwn/main.go b/cmd/dwn/main.go deleted file mode 100644 index 51a42fc4c..000000000 --- a/cmd/dwn/main.go +++ /dev/null @@ -1,40 +0,0 @@ -//go:build js && wasm -// +build js,wasm - -package main - -import ( - "github.com/labstack/echo/v4" - "github.com/onsonr/sonr/internal/vfs/wasm" - - "github.com/onsonr/sonr/internal/db" -) - -var dwn *DWN - -type DWN struct { - *echo.Echo - DB *db.DB -} - -func main() { - dwn = initRails() - wasm.Serve(dwn.Echo) -} - -// initRails initializes the Rails application -func initRails() *DWN { - // Open the database - e := echo.New() - db, err := db.New() - if err != nil { - panic(err.Error()) - } - db.ServeEcho(e.Group("/dwn")) - - // Initialize the htmx handler - return &DWN{ - Echo: e, - DB: db, - } -} diff --git a/cmd/motr/main.go b/cmd/motr/main.go deleted file mode 100644 index 8fdf0d6ba..000000000 --- a/cmd/motr/main.go +++ /dev/null @@ -1,61 +0,0 @@ -//go:build wasm - -package main - -import ( - "github.com/labstack/echo/v4" - "github.com/syumai/workers" - - "github.com/onsonr/sonr/internal/db" - - "github.com/onsonr/sonr/internal/gui/views" - "github.com/onsonr/sonr/internal/mdw" - "github.com/onsonr/sonr/internal/svc" -) - -func main() { - // Configure the server - e := echo.New() - - // Use Middlewares - e.Use(mdw.UseSession) - - // Setup routes - registerFrontend(e) - registerOpenID(e.Group("/authorize")) - registerVault(e.Group("/vault")) - - // Serve Worker - workers.Serve(e) -} - -func registerFrontend(e *echo.Echo) { - // Add Public Pages - e.GET("/", views.HomeView) - e.GET("/login", views.LoginView) - e.POST("/login/:identifier", svc.HandleCredentialAssertion) - e.GET("/register", views.RegisterView) - e.POST("/register/:subject", svc.HandleCredentialCreation) - e.POST("/register/:subject/check", svc.CheckSubjectIsValid) - e.GET("/profile", views.ProfileView) -} - -func registerOpenID(g *echo.Group) { - // Add Authenticated Pages - g.Use(mdw.MacaroonMiddleware("test", "test")) - g.GET("/", views.AuthorizeView) - g.GET("/discovery", svc.GetDiscovery) - g.GET("/jwks", svc.GetJWKS) - g.GET("/token", svc.GetToken) - g.POST("/:origin/grant/:subject", svc.GrantAuthorization) -} - -func registerVault(g *echo.Group) { - // Add Authenticated Pages - g.Use(mdw.MacaroonMiddleware("test", "test")) - vault, err := db.New(db.WitDir("vault")) - if err != nil { - // panic(err) - } - vault.ServeEcho(g) -} diff --git a/cmd/motr/wrangler.toml b/cmd/motr/wrangler.toml deleted file mode 100644 index 10bce7926..000000000 --- a/cmd/motr/wrangler.toml +++ /dev/null @@ -1,10 +0,0 @@ -name = "sonr-id" -main = "./build/worker.mjs" -compatibility_date = "2024-07-26" - -[dev] -ip = "localhost" -port = 4202 - -[build] -command = "devbox run build:motr" diff --git a/cmd/sonrd/motr.go b/cmd/sonrd/motr.go new file mode 100644 index 000000000..06ab7d0f9 --- /dev/null +++ b/cmd/sonrd/motr.go @@ -0,0 +1 @@ +package main diff --git a/deploy/Dockerfile b/deploy/Dockerfile new file mode 100644 index 000000000..19afcdb8c --- /dev/null +++ b/deploy/Dockerfile @@ -0,0 +1,89 @@ +FROM jetpackio/devbox:latest AS sonrvm + +# Installing your devbox project +WORKDIR /code +USER root:root + +RUN mkdir -p /code && chown ${DEVBOX_USER}:${DEVBOX_USER} /code + +USER ${DEVBOX_USER}:${DEVBOX_USER} + +COPY --chown=${DEVBOX_USER}:${DEVBOX_USER} devbox.json devbox.json +COPY --chown=${DEVBOX_USER}:${DEVBOX_USER} deploy/process-compose.yaml process-compose.yaml + +RUN devbox run -- echo "Installed Packages." + +ENTRYPOINT ["devbox", "run"] + +# -------------------------------------------------------- +FROM jetpackio/devbox:latest AS sonr-runner + +WORKDIR /code +USER root:root + +RUN mkdir -p /code && chown ${DEVBOX_USER}:${DEVBOX_USER} /code + +USER ${DEVBOX_USER}:${DEVBOX_USER} + +COPY --chown=${DEVBOX_USER}:${DEVBOX_USER} devbox.json devbox.json +COPY --chown=${DEVBOX_USER}:${DEVBOX_USER} deploy/process-compose.yaml process-compose.yaml +COPY --chown=${DEVBOX_USER}:${DEVBOX_USER} . . + +RUN devbox run -- echo "Installed Packages." + +RUN git config --global --add safe.directory /code +ENTRYPOINT ["devbox", "run", "testnet"] + +# -------------------------------------------------------- +FROM golang:1.22-alpine AS go-builder + +SHELL ["/bin/sh", "-ecuxo", "pipefail"] + +RUN apk add --no-cache ca-certificates build-base git + +WORKDIR /code + +COPY go.mod go.sum ./ +RUN set -eux; \ + export ARCH=$(uname -m); \ + WASM_VERSION=$(go list -m all | grep github.com/CosmWasm/wasmvm || true); \ + if [ ! -z "${WASM_VERSION}" ]; then \ + WASMVM_REPO=$(echo $WASM_VERSION | awk '{print $1}');\ + WASMVM_VERS=$(echo $WASM_VERSION | awk '{print $2}');\ + wget -O /lib/libwasmvm_muslc.a https://${WASMVM_REPO}/releases/download/${WASMVM_VERS}/libwasmvm_muslc.$(uname -m).a;\ + fi; \ + go mod download; + +# Copy over code +COPY . /code + +# force it to use static lib (from above) not standard libgo_cosmwasm.so file +# then log output of file /code/bin/sonrd +# then ensure static linking +RUN LEDGER_ENABLED=false BUILD_TAGS=muslc LINK_STATICALLY=true make build \ + && file /code/build/sonrd \ + && echo "Ensuring binary is statically linked ..." \ + && (file /code/build/sonrd | grep "statically linked") + +# -------------------------------------------------------- +FROM debian:11-slim + +COPY --from=go-builder /code/build/sonrd /usr/bin/sonrd + +# Install dependencies for Debian 11 +RUN apt-get update && apt-get install -y \ + curl \ + make \ + bash \ + jq \ + sed \ + && rm -rf /var/lib/apt/lists/* + +COPY scripts/test_node.sh /usr/bin/test_node.sh + +WORKDIR /opt + +# rest server, tendermint p2p, tendermint rpc +EXPOSE 1317 26656 26657 6060 + +ENTRYPOINT ["/usr/bin/sonrd"] diff --git a/deploy/air.toml b/deploy/air.toml index 1fc4c2ec2..b39d53c8f 100644 --- a/deploy/air.toml +++ b/deploy/air.toml @@ -10,7 +10,7 @@ exclude_file = [] exclude_regex = ["_test.go", ".pk.go", "_templ.go", ".pb.go"] exclude_unchanged = true follow_symlink = false -full_bin = "bunx wrangler -c ./web/wrangler.toml dev" +full_bin = "bunx wrangler -c ./pkg/proxy/wrangler.toml dev" include_dir = ["web", "internal/dwn", "pkl"] include_ext = ["go", "templ", "html", "pkl", "js", "mjs"] include_file = [ diff --git a/deploy/process-compose.dev.yaml b/deploy/process-compose.dev.yaml deleted file mode 100644 index 8338ec468..000000000 --- a/deploy/process-compose.dev.yaml +++ /dev/null @@ -1,25 +0,0 @@ -version: "0.6" - -processes: - sonr: - namespace: testnet - command: "devbox run serve:sonr" - restart: on_failure - max_restarts: 3 - depends: - - caddy: - namespace: testnet - command: "devbox run serve:xcaddy" - restart: on_failure - max_restarts: 3 - depends: - - sonr - - air: - namespace: testnet - command: "devbox run serve:air" - restart: on_failure - max_restarts: 3 - depends: - - sonr diff --git a/deploy/process-compose.yaml b/deploy/process-compose.yaml deleted file mode 100644 index 6fc59f530..000000000 --- a/deploy/process-compose.yaml +++ /dev/null @@ -1,17 +0,0 @@ -version: "0.6" - -processes: - sonr: - namespace: testnet - command: "devbox run serve:sonr" - restart: on_failure - max_restarts: 3 - depends: - - caddy: - namespace: testnet - command: "devbox run serve:xcaddy" - restart: on_failure - max_restarts: 3 - depends: - - sonr diff --git a/devbox.json b/devbox.json index 914f40e5b..8691cb570 100644 --- a/devbox.json +++ b/devbox.json @@ -45,17 +45,14 @@ "serve:air": [ "make air" ], + "serve:ipfs": [ + "make ipfs" + ], "serve:xcaddy": [ "make xcaddy" ], "serve:sonr": [ "make sh-testnet" - ], - "local": [ - "process-compose -f ./deploy/process-compose.dev.yaml" - ], - "testnet": [ - "process-compose -f ./deploy/process-compose.yaml" ] } } diff --git a/go.mod b/go.mod index 65608f681..6b3704989 100644 --- a/go.mod +++ b/go.mod @@ -54,7 +54,6 @@ require ( github.com/charmbracelet/huh v0.5.3 github.com/charmbracelet/lipgloss v0.13.0 github.com/cometbft/cometbft v0.38.8 - github.com/cosmos/btcutil v1.0.5 github.com/cosmos/cosmos-db v1.0.2 github.com/cosmos/cosmos-proto v1.0.0-beta.5 github.com/cosmos/cosmos-sdk v0.50.5 @@ -96,7 +95,6 @@ require ( cloud.google.com/go/iam v1.1.6 // indirect cloud.google.com/go/storage v1.38.0 // indirect filippo.io/edwards25519 v1.1.0 // indirect - git.sr.ht/~sircmpwn/go-bare v0.0.0-20210406120253-ab86bc2846d9 // indirect github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect github.com/99designs/keyring v1.2.1 // indirect github.com/DataDog/datadog-go v3.2.0+incompatible // indirect @@ -131,6 +129,7 @@ require ( github.com/cometbft/cometbft-db v0.9.1 // indirect github.com/consensys/bavard v0.1.13 // indirect github.com/consensys/gnark-crypto v0.12.1 // indirect + github.com/cosmos/btcutil v1.0.5 // indirect github.com/cosmos/go-bip39 v1.0.0 // indirect github.com/cosmos/gogogateway v1.2.0 // indirect github.com/cosmos/iavl v1.1.2 // indirect @@ -227,8 +226,6 @@ require ( github.com/ipld/go-codec-dagpb v1.6.0 // indirect github.com/ipld/go-ipld-prime v0.21.0 // indirect github.com/jbenet/goprocess v0.1.4 // indirect - github.com/jinzhu/inflection v1.0.0 // indirect - github.com/jinzhu/now v1.1.5 // indirect github.com/jmespath/go-jmespath v0.4.0 // indirect github.com/jmhodges/levigo v1.0.0 // indirect github.com/klauspost/compress v1.17.9 // indirect @@ -264,6 +261,7 @@ require ( github.com/mitchellh/hashstructure/v2 v2.0.2 // indirect github.com/mitchellh/mapstructure v1.5.0 // indirect github.com/mmcloughlin/addchain v0.4.0 // indirect + github.com/mr-tron/base58 v1.2.0 // indirect github.com/mtibben/percent v0.2.1 // indirect github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6 // indirect github.com/muesli/cancelreader v0.2.2 // indirect @@ -277,7 +275,6 @@ require ( github.com/multiformats/go-multihash v0.2.3 // indirect github.com/multiformats/go-multistream v0.5.0 // indirect github.com/multiformats/go-varint v0.0.7 // indirect - github.com/ncruces/julianday v1.0.0 // indirect github.com/oasisprotocol/curve25519-voi v0.0.0-20230904125328-1f23a7beb09a // indirect github.com/oklog/run v1.1.0 // indirect github.com/onsi/ginkgo v1.16.5 // indirect @@ -309,7 +306,6 @@ require ( github.com/subosito/gotenv v1.6.0 // indirect github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d // indirect github.com/tendermint/go-amino v0.16.0 // indirect - github.com/tetratelabs/wazero v1.8.0 // indirect github.com/tidwall/btree v1.7.0 // indirect github.com/ulikunitz/xz v0.5.11 // indirect github.com/valyala/bytebufferpool v1.0.0 // indirect @@ -348,11 +344,11 @@ require ( google.golang.org/api v0.169.0 // indirect google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240617180043-68d350f18fd4 // indirect - gopkg.in/errgo.v1 v1.0.1 // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect gotest.tools/v3 v3.5.1 // indirect + lukechampine.com/blake3 v1.3.0 // indirect nhooyr.io/websocket v1.8.10 // indirect pgregory.net/rapid v1.1.0 // indirect rsc.io/tmplfunc v0.0.3 // indirect diff --git a/go.sum b/go.sum index b44bf1f17..29da40697 100644 --- a/go.sum +++ b/go.sum @@ -803,9 +803,6 @@ filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA= filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4= gioui.org v0.0.0-20210308172011-57750fc8a0a6/go.mod h1:RSH6KIUZ0p2xy5zHDxgAM4zumjgTw83q2ge/PI+yyw8= git.sr.ht/~sbinet/gg v0.3.1/go.mod h1:KGYtlADtqsqANL9ueOFkWymvzUvLMQllU5Ixo+8v3pc= -git.sr.ht/~sircmpwn/getopt v0.0.0-20191230200459-23622cc906b3/go.mod h1:wMEGFFFNuPos7vHmWXfszqImLppbc0wEhh6JBfJIUgw= -git.sr.ht/~sircmpwn/go-bare v0.0.0-20210406120253-ab86bc2846d9 h1:Ahny8Ud1LjVMMAlt8utUFKhhxJtwBAualvsbc/Sk7cE= -git.sr.ht/~sircmpwn/go-bare v0.0.0-20210406120253-ab86bc2846d9/go.mod h1:BVJwbDfVjCjoFiKrhkei6NdGcZYpkDkdyCdg1ukytRA= github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 h1:/vQbFIOMbk2FiG/kXiLl8BRyzTWDw7gX/Hz7Dd5eDMs= github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4/go.mod h1:hN7oaIRCjzsZ2dE+yG5k+rsdt3qcwykqK6HVGcKwsw4= github.com/AndreasBriese/bbloom v0.0.0-20190825152654-46b345b51c96 h1:cTp8I5+VIoKjsnZuH8vjyaysT/ses3EvZeaV/1UkF2M= @@ -1195,7 +1192,6 @@ github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY= github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/go-macaroon-bakery/macaroonpb v1.0.0/go.mod h1:UzrGOcbiwTXISFP2XDLDPjfhMINZa+fX/7A2lMd31zc= github.com/go-pdf/fpdf v0.5.0/go.mod h1:HzcnA+A23uwogo0tp9yU+l3V+KXhiESpt1PMayhOh5M= github.com/go-pdf/fpdf v0.6.0/go.mod h1:HzcnA+A23uwogo0tp9yU+l3V+KXhiESpt1PMayhOh5M= github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= @@ -1282,7 +1278,6 @@ github.com/google/btree v1.1.2 h1:xf4v41cLI2Z6FxbKm+8Bu+m8ifhj15JuZ9sa0jZCMUU= github.com/google/btree v1.1.2/go.mod h1:qOPhT0dTNdNzV6Z/lhRX0YXUafgPLFUh+gZMl761Gm4= github.com/google/flatbuffers v2.0.8+incompatible/go.mod h1:1AeVuKshWv4vARoZatz6mlQ0JxURH0Kv5+zNeJKJCa8= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= -github.com/google/go-cmp v0.2.1-0.20190312032427-6f77996f0c42/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= @@ -1583,10 +1578,6 @@ github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= github.com/jhump/protoreflect v1.15.3 h1:6SFRuqU45u9hIZPJAoZ8c28T3nK64BNdp9w6jFonzls= github.com/jhump/protoreflect v1.15.3/go.mod h1:4ORHmSBmlCW8fh3xHmJMGyul1zNqZK4Elxc8qKP+p1k= -github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD/E= -github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc= -github.com/jinzhu/now v1.1.5 h1:/o9tlHleP7gOFmsnYNz3RGnqzefHA47wQpKrrdTIwXQ= -github.com/jinzhu/now v1.1.5/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8= github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9YPoQUg= github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo= github.com/jmespath/go-jmespath/internal/testify v1.5.1 h1:shLQSRRSCCPj3f2gpwzGwWFoC7ycTf1rcQZHOlsJ6N8= @@ -1603,12 +1594,6 @@ github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1 github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo= github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= -github.com/juju/mgotest v1.0.1/go.mod h1:vTaDufYul+Ps8D7bgseHjq87X8eu0ivlKLp9mVc/Bfc= -github.com/juju/postgrestest v1.1.0/go.mod h1:/n17Y2T6iFozzXwSCO0JYJ5gSiz2caEtSwAjh/uLXDM= -github.com/juju/qthttptest v0.0.1/go.mod h1://LCf/Ls22/rPw2u1yWukUJvYtfPY4nYpWUl2uZhryo= -github.com/juju/schema v1.0.0/go.mod h1:Y+ThzXpUJ0E7NYYocAbuvJ7vTivXfrof/IfRPq/0abI= -github.com/juju/webbrowser v0.0.0-20160309143629-54b8c57083b4/go.mod h1:G6PCelgkM6cuvyD10iYJsjLBsSadVXtJ+nBxFAxE2BU= -github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM= github.com/jung-kurt/gofpdf v1.0.0/go.mod h1:7Id9E/uU8ce6rXgefFLlgrJj/GYY22cpxn+r32jIOes= github.com/jung-kurt/gofpdf v1.0.3-0.20190309125859-24315acbbda5/go.mod h1:7Id9E/uU8ce6rXgefFLlgrJj/GYY22cpxn+r32jIOes= @@ -1651,8 +1636,6 @@ github.com/labstack/gommon v0.4.0/go.mod h1:uW6kP17uPlLJsD3ijUYn3/M5bAxtlZhMI6m3 github.com/leanovate/gopter v0.2.9 h1:fQjYxZaynp97ozCzfOyOuAGOU4aU/z37zf/tOujFk7c= github.com/leanovate/gopter v0.2.9/go.mod h1:U2L/78B+KVFIx2VmW6onHJQzXtFb+p5y3y2Sh+Jxxv8= github.com/leodido/go-urn v1.2.1/go.mod h1:zt4jvISO2HfUBqxjfIshjdMTYS56ZS/qv49ictyFfxY= -github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= -github.com/lib/pq v1.3.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/lib/pq v1.10.7 h1:p7ZhMD+KsSRozJr34udlUrhboJwWAgCg34+/ZZNvZZw= github.com/lib/pq v1.10.7/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= github.com/libp2p/go-buffer-pool v0.1.0 h1:oK4mSFcQz7cTQIfqbe4MIj9gLW+mnanjyFtc6cdF0Y8= @@ -1823,12 +1806,6 @@ github.com/nats-io/nats.go v1.30.2/go.mod h1:dcfhUgmQNN4GJEfIb2f9R7Fow+gzBF4emzD github.com/nats-io/nkeys v0.4.4/go.mod h1:XUkxdLPTufzlihbamfzQ7mw/VGx6ObUs+0bN5sNvt64= github.com/nats-io/nkeys v0.4.5/go.mod h1:XUkxdLPTufzlihbamfzQ7mw/VGx6ObUs+0bN5sNvt64= github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c= -github.com/ncruces/go-sqlite3 v0.18.2 h1:m7QXhBWIwXsp84HE11t+ze0n1v3LRU+zGFg4uHjBeFA= -github.com/ncruces/go-sqlite3 v0.18.2/go.mod h1:4sZHOm+b/FM8FJRVGN4TemkPPDq5JXGK/1EHIEWxsYo= -github.com/ncruces/go-sqlite3/gormlite v0.18.0 h1:KqP9a9wlX/Ba+yG+aeVX4pnNBNdaSO6xHdNDWzPxPnk= -github.com/ncruces/go-sqlite3/gormlite v0.18.0/go.mod h1:RXeT1hknrz3A0tBDL6IfluDHuNkHdJeImn5TBMQg9zc= -github.com/ncruces/julianday v1.0.0 h1:fH0OKwa7NWvniGQtxdJRxAgkBMolni2BjDHaWTxqt7M= -github.com/ncruces/julianday v1.0.0/go.mod h1:Dusn2KvZrrovOMJuOt0TNXL6tB7U2E8kvza5fFc9G7g= github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= github.com/nlepage/go-js-promise v1.0.0 h1:K7OmJ3+0BgWJ2LfXchg2sI6RDr7AW/KWR8182epFwGQ= github.com/nlepage/go-js-promise v1.0.0/go.mod h1:bdOP0wObXu34euibyK39K1hoBCtlgTKXGc56AGflaRo= @@ -2075,8 +2052,6 @@ github.com/syumai/workers v0.26.3 h1:AF+IBaRccbR4JIj2kNJLJblruPFMD/pAbzkopejGcP8 github.com/syumai/workers v0.26.3/go.mod h1:ZnqmdiHNBrbxOLrZ/HJ5jzHy6af9cmiNZk10R9NrIEA= github.com/tendermint/go-amino v0.16.0 h1:GyhmgQKvqF82e2oZeuMSp9JTN0N09emoSZlb2lyGa2E= github.com/tendermint/go-amino v0.16.0/go.mod h1:TQU0M1i/ImAo+tYpZi73AU3V/dKeCoMC9Sphe2ZwGME= -github.com/tetratelabs/wazero v1.8.0 h1:iEKu0d4c2Pd+QSRieYbnQC9yiFlMS9D+Jr0LsRmcF4g= -github.com/tetratelabs/wazero v1.8.0/go.mod h1:yAI0XTsMBhREkM/YDAK/zNou3GoiAce1P6+rp/wQhjs= github.com/tidwall/btree v1.7.0 h1:L1fkJH/AuEh5zBnnBbmTwQ5Lt+bRJ5A8EWecslvo9iI= github.com/tidwall/btree v1.7.0/go.mod h1:twD9XRA5jj9VUQGELzDO4HPQTNJsoWWfYEL+EUQ2cKY= github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM= @@ -2211,7 +2186,6 @@ go4.org v0.0.0-20230225012048-214862532bf5/go.mod h1:F57wTi5Lrj6WLyswp5EYV1ncrEb golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20180723164146-c126467f60eb/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20190404164418-38d8ce5564a5/go.mod h1:WFFai1msRO1wXaEeE5yQxYXgSfI8pQAWXbQop6sCtWE= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190611184440-5c40567a22f8/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= @@ -2447,7 +2421,6 @@ golang.org/x/sys v0.0.0-20190130150945-aca44879d564/go.mod h1:STP8DvDyc/dI5b8T5h golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190403152447-81d4e9dc473e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -3034,12 +3007,8 @@ gopkg.in/check.v1 v1.0.0-20200902074654-038fdea0a05b/go.mod h1:Co6ibVJAznAaIkqp8 gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/cheggaaa/pb.v1 v1.0.27/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qStrOgw= -gopkg.in/errgo.v1 v1.0.0/go.mod h1:CxwszS/Xz1C49Ucd2i6Zil5UToP1EmyrFhKaMVbg1mk= -gopkg.in/errgo.v1 v1.0.1 h1:oQFRXzZ7CkBGdm1XZm/EbQYaYNNEElNBOd09M6cqNso= -gopkg.in/errgo.v1 v1.0.1/go.mod h1:3NjfXwocQRYAPTq4/fzX+CwUhPRcR/azYRhj8G+LqMo= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= -gopkg.in/httprequest.v1 v1.2.0/go.mod h1:T61ZUaJLpMnzvoJDO03ZD8yRXD4nZzBeDoW5e9sffjg= gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA= gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/macaroon.v2 v2.1.0 h1:HZcsjBCzq9t0eBPMKqTN/uSN6JOm78ZJ2INbqcBQOUI= @@ -3060,8 +3029,6 @@ gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gorm.io/gorm v1.25.11 h1:/Wfyg1B/je1hnDx3sMkX+gAlxrlZpn6X0BXRlwXlvHg= -gorm.io/gorm v1.25.11/go.mod h1:xh7N7RHfYlNc5EmcI/El95gXusucDrQnHXe0+CgWcLQ= gotest.tools/v3 v3.5.1 h1:EENdUnS3pdur5nybKYIh2Vfgc8IUNBjxDPSjtiJcOzU= gotest.tools/v3 v3.5.1/go.mod h1:isy3WKz7GK6uNw/sbHzfKBLvlvXwUyV06n6brMxxopU= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= @@ -3072,8 +3039,6 @@ honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= honnef.co/go/tools v0.1.3/go.mod h1:NgwopIslSNH47DimFoV78dnkksY2EFtX0ajyb3K/las= -lukechampine.com/adiantum v1.1.1 h1:4fp6gTxWCqpEbLy40ExiYDDED3oUNWx5cTqBCtPdZqA= -lukechampine.com/adiantum v1.1.1/go.mod h1:LrAYVnTYLnUtE/yMp5bQr0HstAf060YUF8nM0B6+rUw= lukechampine.com/blake3 v1.3.0 h1:sJ3XhFINmHSrYCgl958hscfIa3bw8x4DqMP3u1YvoYE= lukechampine.com/blake3 v1.3.0/go.mod h1:0OFRp7fBtAylGVCO40o87sbupkyIGgbpv1+M1k1LM6k= lukechampine.com/uint128 v1.1.1/go.mod h1:c4eWIwlEGaxC/+H1VguhU4PHXNWDCDMUlWdIWl2j1gk= diff --git a/internal/db/actions.go b/internal/db/actions.go deleted file mode 100644 index cf0354acf..000000000 --- a/internal/db/actions.go +++ /dev/null @@ -1,330 +0,0 @@ -package db - -import ( - "fmt" - - "github.com/onsonr/sonr/internal/db/orm" - "gorm.io/gorm" -) - -// createInitialTables creates the initial tables in the database. -func createInitialTables(db *gorm.DB) (*DB, error) { - err := db.AutoMigrate( - &orm.Account{}, - &orm.Asset{}, - &orm.Credential{}, - &orm.Keyshare{}, - &orm.Permission{}, - &orm.Profile{}, - &orm.Property{}, - ) - if err != nil { - return nil, fmt.Errorf("failed to create table: %w", err) - } - - return &DB{db}, nil -} - -// AddAccount adds a new account to the database -func (db *DB) AddAccount(account *orm.Account) error { - tx := db.Create(account) - if tx.Error != nil { - return fmt.Errorf("failed to add account: %w", tx.Error) - } - - return nil -} - -// GetAccount gets an account from the database -func (db *DB) GetAccount(account *orm.Account) error { - tx := db.First(account) - if tx.Error != nil { - return fmt.Errorf("failed to get account: %w", tx.Error) - } - - return nil -} - -// UpdateAccount updates an existing account in the database -func (db *DB) UpdateAccount(account *orm.Account) error { - tx := db.Save(account) - if tx.Error != nil { - return fmt.Errorf("failed to update account: %w", tx.Error) - } - - return nil -} - -// DeleteAccount deletes an existing account from the database -func (db *DB) DeleteAccount(account *orm.Account) error { - tx := db.Delete(account) - if tx.Error != nil { - return fmt.Errorf("failed to delete account: %w", tx.Error) - } - - return nil -} - -// AddAsset adds a new asset to the database -func (db *DB) AddAsset(asset *orm.Asset) error { - tx := db.Create(asset) - - if tx.Error != nil { - return fmt.Errorf("failed to add asset: %w", tx.Error) - } - - return nil -} - -// GetAsset gets an asset from the database -func (db *DB) GetAsset(asset *orm.Asset) error { - tx := db.First(asset) - - if tx.Error != nil { - return fmt.Errorf("failed to get asset: %w", tx.Error) - } - - return nil -} - -// UpdateAsset updates an existing asset in the database -func (db *DB) UpdateAsset(asset *orm.Asset) error { - tx := db.Save(asset) - - if tx.Error != nil { - return fmt.Errorf("failed to update asset: %w", tx.Error) - } - - return nil -} - -// DeleteAsset deletes an existing asset from the database -func (db *DB) DeleteAsset(asset *orm.Asset) error { - tx := db.Delete(asset) - - if tx.Error != nil { - return fmt.Errorf("failed to delete asset: %w", tx.Error) - } - - return nil -} - -// AddCredential adds a new credential to the database -func (db *DB) AddCredential(credential *orm.Credential) error { - tx := db.Create(credential) - - if tx.Error != nil { - return fmt.Errorf("failed to add credential: %w", tx.Error) - } - - return nil -} - -// GetCredential gets an credential from the database -func (db *DB) GetCredential(credential *orm.Credential) error { - tx := db.First(credential) - - if tx.Error != nil { - return fmt.Errorf("failed to get credential: %w", tx.Error) - } - - return nil -} - -// UpdateCredential updates an existing credential in the database -func (db *DB) UpdateCredential(credential *orm.Credential) error { - tx := db.Save(credential) - - if tx.Error != nil { - return fmt.Errorf("failed to update credential: %w", tx.Error) - } - - return nil -} - -// DeleteCredential deletes an existing credential from the database -func (db *DB) DeleteCredential(credential *orm.Credential) error { - tx := db.Delete(credential) - - if tx.Error != nil { - return fmt.Errorf("failed to delete credential: %w", tx.Error) - } - - return nil -} - -// AddKeyshare adds a new keyshare to the database -func (db *DB) AddKeyshare(keyshare *orm.Keyshare) error { - tx := db.Create(keyshare) - - if tx.Error != nil { - return fmt.Errorf("failed to add keyshare: %w", tx.Error) - } - - return nil -} - -// GetKeyshare gets an keyshare from the database -func (db *DB) GetKeyshare(keyshare *orm.Keyshare) error { - tx := db.First(keyshare) - - if tx.Error != nil { - return fmt.Errorf("failed to get keyshare: %w", tx.Error) - } - - return nil -} - -// UpdateKeyshare updates an existing keyshare in the database -func (db *DB) UpdateKeyshare(keyshare *orm.Keyshare) error { - tx := db.Save(keyshare) - - if tx.Error != nil { - return fmt.Errorf("failed to update keyshare: %w", tx.Error) - } - - return nil -} - -// DeleteKeyshare deletes an existing keyshare from the database -func (db *DB) DeleteKeyshare(keyshare *orm.Keyshare) error { - tx := db.Delete(keyshare) - - if tx.Error != nil { - return fmt.Errorf("failed to delete keyshare: %w", tx.Error) - } - - return nil -} - -// AddPermission adds a new permission to the database -func (db *DB) AddPermission(permission *orm.Permission) error { - tx := db.Create(permission) - - if tx.Error != nil { - return fmt.Errorf("failed to add permission: %w", tx.Error) - } - - return nil -} - -// GetPermission gets an permission from the database -func (db *DB) GetPermission(permission *orm.Permission) error { - tx := db.First(permission) - - if tx.Error != nil { - return fmt.Errorf("failed to get permission: %w", tx.Error) - } - - return nil -} - -// UpdatePermission updates an existing permission in the database -func (db *DB) UpdatePermission(permission *orm.Permission) error { - tx := db.Save(permission) - - if tx.Error != nil { - return fmt.Errorf("failed to update permission: %w", tx.Error) - } - - return nil -} - -// DeletePermission deletes an existing permission from the database -func (db *DB) DeletePermission(permission *orm.Permission) error { - tx := db.Delete(permission) - - if tx.Error != nil { - return fmt.Errorf("failed to delete permission: %w", tx.Error) - } - - return nil -} - -// AddProfile adds a new profile to the database -func (db *DB) AddProfile(profile *orm.Profile) error { - tx := db.Create(profile) - - if tx.Error != nil { - return fmt.Errorf("failed to add profile: %w", tx.Error) - } - - return nil -} - -// GetProfile gets an profile from the database -func (db *DB) GetProfile(profile *orm.Profile) error { - tx := db.First(profile) - - if tx.Error != nil { - return fmt.Errorf("failed to get profile: %w", tx.Error) - } - - return nil -} - -// UpdateProfile updates an existing profile in the database -func (db *DB) UpdateProfile(profile *orm.Profile) error { - tx := db.Save(profile) - - if tx.Error != nil { - return fmt.Errorf("failed to update profile: %w", tx.Error) - } - - return nil -} - -// DeleteProfile deletes an existing profile from the database -func (db *DB) DeleteProfile(profile *orm.Profile) error { - tx := db.Delete(profile) - - if tx.Error != nil { - return fmt.Errorf("failed to delete profile: %w", tx.Error) - } - - return nil -} - -// AddProperty adds a new property to the database -func (db *DB) AddProperty(property *orm.Property) error { - tx := db.Create(property) - - if tx.Error != nil { - return fmt.Errorf("failed to add property: %w", tx.Error) - } - - return nil -} - -// GetProperty gets an property from the database -func (db *DB) GetProperty(property *orm.Property) error { - tx := db.First(property) - - if tx.Error != nil { - return fmt.Errorf("failed to get property: %w", tx.Error) - } - - return nil -} - -// UpdateProperty updates an existing property in the database -func (db *DB) UpdateProperty(property *orm.Property) error { - tx := db.Save(property) - - if tx.Error != nil { - return fmt.Errorf("failed to update property: %w", tx.Error) - } - - return nil -} - -// DeleteProperty deletes an existing property from the database -func (db *DB) DeleteProperty(property *orm.Property) error { - tx := db.Delete(property) - - if tx.Error != nil { - return fmt.Errorf("failed to delete property: %w", tx.Error) - } - - return nil -} diff --git a/internal/db/database.go b/internal/db/database.go deleted file mode 100644 index 12bb158ed..000000000 --- a/internal/db/database.go +++ /dev/null @@ -1,54 +0,0 @@ -package db - -import ( - "crypto/rand" - - "github.com/ncruces/go-sqlite3/gormlite" - "golang.org/x/crypto/argon2" - "gorm.io/gorm" - "lukechampine.com/adiantum/hbsh" - "lukechampine.com/adiantum/hpolyc" -) - -type DB struct { - *gorm.DB -} - -func New(opts ...DBOption) (*DB, error) { - config := &DBConfig{ - fileName: "vault.db", - } - for _, opt := range opts { - opt(config) - } - gormdb, err := gorm.Open(gormlite.Open(config.ConnectionString())) - if err != nil { - return nil, err - } - db, err := createInitialTables(gormdb) - if err != nil { - return nil, err - } - return db, nil -} - -// HBSH creates an HBSH cipher given a key. -func (c *DB) HBSH(key []byte) *hbsh.HBSH { - if len(key) != 32 { - // Key is not appropriate, return nil. - return nil - } - return hpolyc.New(key) -} - -// KDF gets a key from a secret. -func (c *DB) KDF(secret string) []byte { - if secret == "" { - // No secret is given, generate a random key. - key := make([]byte, 32) - n, _ := rand.Read(key) - return key[:n] - } - // Hash the secret with a KDF. - return argon2.IDKey([]byte(secret), []byte("hpolyc"), 3, 64*1024, 4, 32) -} diff --git a/internal/db/handlers.go b/internal/db/handlers.go deleted file mode 100644 index e4f739c77..000000000 --- a/internal/db/handlers.go +++ /dev/null @@ -1,195 +0,0 @@ -package db - -import ( - "github.com/labstack/echo/v4" - "github.com/onsonr/sonr/internal/db/orm" -) - -func (db *DB) ServeEcho(e *echo.Group) { - e.GET("/accounts", db.HandleAccount) - e.GET("/assets", db.HandleAsset) - e.GET("/credentials", db.HandleCredential) - e.GET("/keyshares", db.HandleKeyshare) - e.GET("/permissions", db.HandlePermission) - e.GET("/profiles", db.HandleProfile) - e.GET("/properties", db.HandleProperty) -} - -func (db *DB) HandleAccount(c echo.Context) error { - data := new(orm.Account) - if err := c.Bind(data); err != nil { - return err - } - // Check the method for GET, POST, PUT, DELETE - switch c.Request().Method { - case echo.POST: - - if err := db.AddAccount(data); err != nil { - return err - } - return c.JSON(200, "OK") - case echo.PUT: - - if err := db.UpdateAccount(data); err != nil { - return err - } - return c.JSON(200, "OK") - case echo.DELETE: - if err := db.DeleteAccount(data); err != nil { - return err - } - return c.JSON(200, nil) - } - return c.JSON(200, data) -} - -func (db *DB) HandleAsset(c echo.Context) error { - data := new(orm.Asset) - if err := c.Bind(data); err != nil { - return err - } - - switch c.Request().Method { - case echo.POST: - if err := db.AddAsset(data); err != nil { - return err - } - return c.JSON(200, "OK") - case echo.PUT: - if err := db.UpdateAsset(data); err != nil { - return err - } - return c.JSON(200, "OK") - case echo.DELETE: - if err := db.DeleteAsset(data); err != nil { - return err - } - return c.JSON(200, "OK") - } - return c.JSON(200, data) -} - -func (db *DB) HandleCredential(c echo.Context) error { - data := new(orm.Credential) - if err := c.Bind(data); err != nil { - return err - } - - switch c.Request().Method { - case echo.POST: - if err := db.AddCredential(data); err != nil { - return err - } - return c.JSON(200, "OK") - case echo.PUT: - if err := db.UpdateCredential(data); err != nil { - return err - } - return c.JSON(200, "OK") - case echo.DELETE: - if err := db.DeleteCredential(data); err != nil { - return err - } - } - return c.JSON(200, data) -} - -func (db *DB) HandleKeyshare(c echo.Context) error { - data := new(orm.Keyshare) - if err := c.Bind(data); err != nil { - return err - } - - switch c.Request().Method { - case echo.POST: - if err := db.AddKeyshare(data); err != nil { - return err - } - return c.JSON(200, "OK") - case echo.PUT: - if err := db.UpdateKeyshare(data); err != nil { - return err - } - return c.JSON(200, "OK") - case echo.DELETE: - if err := db.DeleteKeyshare(data); err != nil { - return err - } - } - return c.JSON(200, data) -} - -func (db *DB) HandlePermission(c echo.Context) error { - data := new(orm.Permission) - if err := c.Bind(data); err != nil { - return err - } - - switch c.Request().Method { - case echo.POST: - if err := db.AddPermission(data); err != nil { - return err - } - return c.JSON(200, "OK") - case echo.PUT: - if err := db.UpdatePermission(data); err != nil { - return err - } - return c.JSON(200, "OK") - case echo.DELETE: - if err := db.DeletePermission(data); err != nil { - return err - } - } - return c.JSON(200, data) -} - -func (db *DB) HandleProfile(c echo.Context) error { - data := new(orm.Profile) - if err := c.Bind(data); err != nil { - return err - } - - switch c.Request().Method { - case echo.POST: - if err := db.AddProfile(data); err != nil { - return err - } - return c.JSON(200, "OK") - case echo.PUT: - if err := db.UpdateProfile(data); err != nil { - return err - } - return c.JSON(200, "OK") - case echo.DELETE: - if err := db.DeleteProfile(data); err != nil { - return err - } - } - return c.JSON(200, data) -} - -func (db *DB) HandleProperty(c echo.Context) error { - data := new(orm.Property) - if err := c.Bind(data); err != nil { - return err - } - - switch c.Request().Method { - case echo.POST: - if err := db.AddProperty(data); err != nil { - return err - } - return c.JSON(200, "OK") - case echo.PUT: - if err := db.UpdateProperty(data); err != nil { - return err - } - return c.JSON(200, "OK") - case echo.DELETE: - if err := db.DeleteProperty(data); err != nil { - return err - } - } - return c.JSON(200, data) -} diff --git a/internal/db/idb/idb.go b/internal/db/idb/idb.go deleted file mode 100644 index 5dab6c074..000000000 --- a/internal/db/idb/idb.go +++ /dev/null @@ -1,131 +0,0 @@ -//go:build js && wasm -// +build js,wasm - -package idb - -import ( - "context" - "encoding/json" - "errors" - "syscall/js" - - "github.com/hack-pad/go-indexeddb/idb" -) - -// Model is an interface that must be implemented by types used with Table -type Model interface { - Table() string -} - -// Table is a generic wrapper around IDB for easier database operations on a specific table -type Table[T Model] struct { - db *idb.Database - dbName string - keyPath string -} - -// NewTable creates a new Table instance -func NewTable[T Model](dbName string, version uint, keyPath string) (*Table[T], error) { - ctx := context.Background() - factory := idb.Global() - - var model T - tableName := model.Table() - - openRequest, err := factory.Open(ctx, dbName, version, func(db *idb.Database, oldVersion, newVersion uint) error { - _, err := db.CreateObjectStore(tableName, idb.ObjectStoreOptions{ - KeyPath: js.ValueOf(keyPath), - }) - return err - }) - if err != nil { - return nil, err - } - db, err := openRequest.Await(ctx) - if err != nil { - return nil, err - } - return &Table[T]{ - db: db, - dbName: dbName, - keyPath: keyPath, - }, nil -} - -// Insert adds a new record to the table -func (t *Table[T]) Insert(data T) error { - tx, err := t.db.Transaction(idb.TransactionReadWrite, data.Table()) - if err != nil { - return err - } - defer tx.Commit() - - objectStore, err := tx.ObjectStore(data.Table()) - if err != nil { - return err - } - - jsonData, err := json.Marshal(data) - if err != nil { - return err - } - - _, err = objectStore.Add(js.ValueOf(string(jsonData))) - return err -} - -// Query retrieves a record from the table based on a key -func (t *Table[T]) Query(key interface{}) (T, error) { - var result T - - tx, err := t.db.Transaction(idb.TransactionReadOnly, result.Table()) - if err != nil { - return result, err - } - defer tx.Commit() - - objectStore, err := tx.ObjectStore(result.Table()) - if err != nil { - return result, err - } - - request, err := objectStore.Get(js.ValueOf(key)) - if err != nil { - return result, err - } - - value, err := request.Await(context.Background()) - if err != nil { - return result, err - } - - if value.IsUndefined() || value.IsNull() { - return result, errors.New("record not found") - } - - err = json.Unmarshal([]byte(value.String()), &result) - return result, err -} - -// Delete removes a record from the table based on a key -func (t *Table[T]) Delete(key interface{}) error { - var model T - tx, err := t.db.Transaction(idb.TransactionReadWrite, model.Table()) - if err != nil { - return err - } - defer tx.Commit() - - objectStore, err := tx.ObjectStore(model.Table()) - if err != nil { - return err - } - - _, err = objectStore.Delete(js.ValueOf(key)) - return err -} - -// Close closes the database connection -func (t *Table[T]) Close() error { - return t.db.Close() -} diff --git a/internal/db/options.go b/internal/db/options.go deleted file mode 100644 index 47f2e1f31..000000000 --- a/internal/db/options.go +++ /dev/null @@ -1,40 +0,0 @@ -package db - -import ( - _ "github.com/ncruces/go-sqlite3/embed" - "github.com/onsonr/sonr/internal/db/orm" -) - -type DBOption func(config *DBConfig) - -func WitDir(dir string) DBOption { - return func(config *DBConfig) { - config.Dir = dir - } -} - -func WithSecretKey(secretKey string) DBOption { - return func(config *DBConfig) { - config.SecretKey = secretKey - } -} - -type DBConfig struct { - Dir string - SecretKey string - - fileName string - initialAccounts []*orm.Account - initialAssets []*orm.Asset - initialCredentials []*orm.Credential - initialKeyshares []*orm.Keyshare - initialPermissions []*orm.Permission - initialProfiles []*orm.Profile - initialProperties []*orm.Property -} - -func (config *DBConfig) ConnectionString() string { - connStr := "file:" - connStr += config.fileName - return connStr -} diff --git a/internal/db/orm/Account.pkl.go b/internal/db/orm/Account.pkl.go deleted file mode 100644 index 09a4e0b1a..000000000 --- a/internal/db/orm/Account.pkl.go +++ /dev/null @@ -1,14 +0,0 @@ -// Code generated from Pkl module `orm`. DO NOT EDIT. -package orm - -type Account struct { - Id uint `pkl:"id" gorm:"primaryKey,autoIncrement" json:"id,omitempty" query:"id"` - - Name string `pkl:"name" json:"name,omitempty" param:"name"` - - Address string `pkl:"address" json:"address,omitempty" param:"address"` - - PublicKey string `pkl:"publicKey" json:"publicKey,omitempty" param:"publicKey"` - - CreatedAt *string `pkl:"createdAt" json:"createdAt,omitempty" param:"createdAt"` -} diff --git a/internal/db/orm/Asset.pkl.go b/internal/db/orm/Asset.pkl.go deleted file mode 100644 index fd28cc9f7..000000000 --- a/internal/db/orm/Asset.pkl.go +++ /dev/null @@ -1,16 +0,0 @@ -// Code generated from Pkl module `orm`. DO NOT EDIT. -package orm - -type Asset struct { - Id uint `pkl:"id" gorm:"primaryKey,autoIncrement" json:"id,omitempty" query:"id"` - - Name string `pkl:"name" json:"name,omitempty" param:"name"` - - Symbol string `pkl:"symbol" json:"symbol,omitempty" param:"symbol"` - - Decimals int `pkl:"decimals" json:"decimals,omitempty" param:"decimals"` - - ChainId *int `pkl:"chainId" json:"chainId,omitempty" param:"chainId"` - - CreatedAt *string `pkl:"createdAt" json:"createdAt,omitempty" param:"createdAt"` -} diff --git a/internal/db/orm/Chain.pkl.go b/internal/db/orm/Chain.pkl.go deleted file mode 100644 index 6b3544d18..000000000 --- a/internal/db/orm/Chain.pkl.go +++ /dev/null @@ -1,12 +0,0 @@ -// Code generated from Pkl module `orm`. DO NOT EDIT. -package orm - -type Chain struct { - Id uint `pkl:"id" gorm:"primaryKey,autoIncrement" json:"id,omitempty" query:"id"` - - Name string `pkl:"name" json:"name,omitempty" param:"name"` - - NetworkId string `pkl:"networkId" json:"networkId,omitempty" param:"networkId"` - - CreatedAt *string `pkl:"createdAt" json:"createdAt,omitempty" param:"createdAt"` -} diff --git a/internal/db/orm/Credential.pkl.go b/internal/db/orm/Credential.pkl.go deleted file mode 100644 index b05f04c9b..000000000 --- a/internal/db/orm/Credential.pkl.go +++ /dev/null @@ -1,36 +0,0 @@ -// Code generated from Pkl module `orm`. DO NOT EDIT. -package orm - -type Credential struct { - Id uint `pkl:"id" gorm:"primaryKey,autoIncrement" json:"id,omitempty" query:"id"` - - Subject string `pkl:"subject" json:"subject,omitempty" param:"subject"` - - Controller string `pkl:"controller" json:"controller,omitempty" param:"controller"` - - AttestationType string `pkl:"attestationType" json:"attestationType,omitempty" param:"attestationType"` - - Origin string `pkl:"origin" json:"origin,omitempty" param:"origin"` - - CredentialId string `pkl:"credentialId" json:"credentialId,omitempty" param:"credentialId"` - - PublicKey string `pkl:"publicKey" json:"publicKey,omitempty" param:"publicKey"` - - Transport string `pkl:"transport" json:"transport,omitempty" param:"transport"` - - SignCount uint `pkl:"signCount" json:"signCount,omitempty" param:"signCount"` - - UserPresent bool `pkl:"userPresent" json:"userPresent,omitempty" param:"userPresent"` - - UserVerified bool `pkl:"userVerified" json:"userVerified,omitempty" param:"userVerified"` - - BackupEligible bool `pkl:"backupEligible" json:"backupEligible,omitempty" param:"backupEligible"` - - BackupState bool `pkl:"backupState" json:"backupState,omitempty" param:"backupState"` - - CloneWarning bool `pkl:"cloneWarning" json:"cloneWarning,omitempty" param:"cloneWarning"` - - CreatedAt *string `pkl:"createdAt" json:"createdAt,omitempty" param:"createdAt"` - - UpdatedAt *string `pkl:"updatedAt" json:"updatedAt,omitempty" param:"updatedAt"` -} diff --git a/internal/db/orm/Keyshare.pkl.go b/internal/db/orm/Keyshare.pkl.go deleted file mode 100644 index ed51e7a94..000000000 --- a/internal/db/orm/Keyshare.pkl.go +++ /dev/null @@ -1,12 +0,0 @@ -// Code generated from Pkl module `orm`. DO NOT EDIT. -package orm - -type Keyshare struct { - Id uint `pkl:"id" gorm:"primaryKey,autoIncrement" json:"id,omitempty" query:"id"` - - Data string `pkl:"data" json:"data,omitempty" param:"data"` - - Role int `pkl:"role" json:"role,omitempty" param:"role"` - - CreatedAt *string `pkl:"createdAt" json:"createdAt,omitempty" param:"createdAt"` -} diff --git a/internal/db/orm/Orm.pkl.go b/internal/db/orm/Orm.pkl.go deleted file mode 100644 index 8c2222fb0..000000000 --- a/internal/db/orm/Orm.pkl.go +++ /dev/null @@ -1,36 +0,0 @@ -// Code generated from Pkl module `orm`. DO NOT EDIT. -package orm - -import ( - "context" - - "github.com/apple/pkl-go/pkl" -) - -type Orm struct { -} - -// LoadFromPath loads the pkl module at the given path and evaluates it into a Orm -func LoadFromPath(ctx context.Context, path string) (ret *Orm, err error) { - evaluator, err := pkl.NewEvaluator(ctx, pkl.PreconfiguredOptions) - if err != nil { - return nil, err - } - defer func() { - cerr := evaluator.Close() - if err == nil { - err = cerr - } - }() - ret, err = Load(ctx, evaluator, pkl.FileSource(path)) - return ret, err -} - -// Load loads the pkl module at the given source and evaluates it with the given evaluator into a Orm -func Load(ctx context.Context, evaluator pkl.Evaluator, source *pkl.ModuleSource) (*Orm, error) { - var ret Orm - if err := evaluator.EvaluateModule(ctx, source, &ret); err != nil { - return nil, err - } - return &ret, nil -} diff --git a/internal/db/orm/Permission.pkl.go b/internal/db/orm/Permission.pkl.go deleted file mode 100644 index 0e93df3c3..000000000 --- a/internal/db/orm/Permission.pkl.go +++ /dev/null @@ -1,16 +0,0 @@ -// Code generated from Pkl module `orm`. DO NOT EDIT. -package orm - -type Permission struct { - Id uint `pkl:"id" gorm:"primaryKey,autoIncrement" json:"id,omitempty" query:"id"` - - ServiceId string `pkl:"serviceId" json:"serviceId,omitempty" param:"serviceId"` - - Grants string `pkl:"grants" json:"grants,omitempty" param:"grants"` - - Scopes string `pkl:"scopes" json:"scopes,omitempty" param:"scopes"` - - CreatedAt *string `pkl:"createdAt" json:"createdAt,omitempty" param:"createdAt"` - - UpdatedAt *string `pkl:"updatedAt" json:"updatedAt,omitempty" param:"updatedAt"` -} diff --git a/internal/db/orm/Profile.pkl.go b/internal/db/orm/Profile.pkl.go deleted file mode 100644 index c0153cc3c..000000000 --- a/internal/db/orm/Profile.pkl.go +++ /dev/null @@ -1,20 +0,0 @@ -// Code generated from Pkl module `orm`. DO NOT EDIT. -package orm - -type Profile struct { - Id string `pkl:"id" gorm:"primaryKey,autoIncrement" json:"id,omitempty" query:"id"` - - Subject string `pkl:"subject" json:"subject,omitempty" param:"subject"` - - Controller string `pkl:"controller" json:"controller,omitempty" param:"controller"` - - OriginUri *string `pkl:"originUri" json:"originUri,omitempty" param:"originUri"` - - PublicMetadata *string `pkl:"publicMetadata" json:"publicMetadata,omitempty" param:"publicMetadata"` - - PrivateMetadata *string `pkl:"privateMetadata" json:"privateMetadata,omitempty" param:"privateMetadata"` - - CreatedAt *string `pkl:"createdAt" json:"createdAt,omitempty" param:"createdAt"` - - UpdatedAt *string `pkl:"updatedAt" json:"updatedAt,omitempty" param:"updatedAt"` -} diff --git a/internal/db/orm/Property.pkl.go b/internal/db/orm/Property.pkl.go deleted file mode 100644 index 937b6209a..000000000 --- a/internal/db/orm/Property.pkl.go +++ /dev/null @@ -1,14 +0,0 @@ -// Code generated from Pkl module `orm`. DO NOT EDIT. -package orm - -type Property struct { - Id uint `pkl:"id" gorm:"primaryKey,autoIncrement" json:"id,omitempty" query:"id"` - - ProfileId string `pkl:"profileId" json:"profileId,omitempty" param:"profileId"` - - Key string `pkl:"key" json:"key,omitempty" param:"key"` - - Accumulator string `pkl:"accumulator" json:"accumulator,omitempty" param:"accumulator"` - - PropertyKey string `pkl:"propertyKey" json:"propertyKey,omitempty" param:"propertyKey"` -} diff --git a/internal/db/orm/init.pkl.go b/internal/db/orm/init.pkl.go deleted file mode 100644 index 817be2b7c..000000000 --- a/internal/db/orm/init.pkl.go +++ /dev/null @@ -1,16 +0,0 @@ -// Code generated from Pkl module `orm`. DO NOT EDIT. -package orm - -import "github.com/apple/pkl-go/pkl" - -func init() { - pkl.RegisterMapping("orm", Orm{}) - pkl.RegisterMapping("orm#Account", Account{}) - pkl.RegisterMapping("orm#Asset", Asset{}) - pkl.RegisterMapping("orm#Chain", Chain{}) - pkl.RegisterMapping("orm#Credential", Credential{}) - pkl.RegisterMapping("orm#Profile", Profile{}) - pkl.RegisterMapping("orm#Property", Property{}) - pkl.RegisterMapping("orm#Keyshare", Keyshare{}) - pkl.RegisterMapping("orm#Permission", Permission{}) -} diff --git a/internal/db/orm/orm.go b/internal/db/orm/orm.go deleted file mode 100644 index 1b1266bf1..000000000 --- a/internal/db/orm/orm.go +++ /dev/null @@ -1,29 +0,0 @@ -package orm - -func (a *Account) Table() string { - return "accounts" -} - -func (a *Asset) Table() string { - return "assets" -} - -func (a *Credential) Table() string { - return "credentials" -} - -func (a *Keyshare) Table() string { - return "keyshares" -} - -func (a *Permission) Table() string { - return "permissions" -} - -func (a *Profile) Table() string { - return "profiles" -} - -func (a *Property) Table() string { - return "properties" -} diff --git a/internal/dwn/handlers/manifest.go b/internal/dwn/handlers/manifest.go deleted file mode 100644 index 5ac8282f4..000000000 --- a/internal/dwn/handlers/manifest.go +++ /dev/null @@ -1 +0,0 @@ -package handlers diff --git a/internal/dwn/handlers/views.go b/internal/dwn/handlers/views.go deleted file mode 100644 index 5ac8282f4..000000000 --- a/internal/dwn/handlers/views.go +++ /dev/null @@ -1 +0,0 @@ -package handlers diff --git a/internal/dwn/handlers/wellknown.go b/internal/dwn/handlers/wellknown.go deleted file mode 100644 index 5ac8282f4..000000000 --- a/internal/dwn/handlers/wellknown.go +++ /dev/null @@ -1 +0,0 @@ -package handlers diff --git a/internal/dwn/main.go b/internal/dwn/main.go index 6aad26089..a48a8c059 100644 --- a/internal/dwn/main.go +++ b/internal/dwn/main.go @@ -14,16 +14,16 @@ import ( "github.com/labstack/echo/v4" promise "github.com/nlepage/go-js-promise" - "github.com/onsonr/sonr/internal/dwn/handlers" "github.com/onsonr/sonr/internal/dwn/middleware" + "github.com/onsonr/sonr/internal/dwn/state" "github.com/onsonr/sonr/pkg/nebula" ) func main() { e := echo.New() e.Use(middleware.UseSession) - nebula.RouteViews(e) - handlers.RegisterState(e) + nebula.RegisterHandlers(e) + state.RegisterHandlers(e) Serve(e) } diff --git a/internal/dwn/handlers/auth.go b/internal/dwn/state/auth.go similarity index 98% rename from internal/dwn/handlers/auth.go rename to internal/dwn/state/auth.go index d725449a3..6aa053b12 100644 --- a/internal/dwn/handlers/auth.go +++ b/internal/dwn/state/auth.go @@ -1,4 +1,4 @@ -package handlers +package state import ( "encoding/json" diff --git a/internal/dwn/state/manifest.go b/internal/dwn/state/manifest.go new file mode 100644 index 000000000..7bf2df5b4 --- /dev/null +++ b/internal/dwn/state/manifest.go @@ -0,0 +1 @@ +package state diff --git a/internal/dwn/handlers/openid.go b/internal/dwn/state/openid.go similarity index 96% rename from internal/dwn/handlers/openid.go rename to internal/dwn/state/openid.go index 0d981247f..941c3d1a3 100644 --- a/internal/dwn/handlers/openid.go +++ b/internal/dwn/state/openid.go @@ -1,4 +1,4 @@ -package handlers +package state import ( "github.com/labstack/echo/v4" diff --git a/internal/dwn/handlers/routes.go b/internal/dwn/state/routes.go similarity index 91% rename from internal/dwn/handlers/routes.go rename to internal/dwn/state/routes.go index 0b8af5917..25e052343 100644 --- a/internal/dwn/handlers/routes.go +++ b/internal/dwn/state/routes.go @@ -1,11 +1,11 @@ -package handlers +package state import ( "github.com/labstack/echo/v4" middleware "github.com/onsonr/sonr/internal/dwn/middleware" ) -func RegisterState(e *echo.Echo) { +func RegisterHandlers(e *echo.Echo) { g := e.Group("state") g.POST("/login/:identifier", handleCredentialAssertion) // g.GET("/discovery", state.GetDiscovery) diff --git a/internal/dwn/state/views.go b/internal/dwn/state/views.go new file mode 100644 index 000000000..7bf2df5b4 --- /dev/null +++ b/internal/dwn/state/views.go @@ -0,0 +1 @@ +package state diff --git a/internal/dwn/state/wellknown.go b/internal/dwn/state/wellknown.go new file mode 100644 index 000000000..7bf2df5b4 --- /dev/null +++ b/internal/dwn/state/wellknown.go @@ -0,0 +1 @@ +package state diff --git a/internal/gui/elements/alert.templ b/internal/gui/elements/alert.templ deleted file mode 100644 index 89f977aea..000000000 --- a/internal/gui/elements/alert.templ +++ /dev/null @@ -1,67 +0,0 @@ -package elements - -func Alert(variant Variant, icon Icon, title, message string) templ.Component { - return alertElement(variant.Attributes(), title, message, icon.Render()) -} - -templ alertElement(attrs templ.Attributes, title, message string, icon templ.Component) { -
- @icon -
{ title }
-
{ message }
-
-} - -type AlertVariant int - -const ( - AlertVariant_Default AlertVariant = iota - AlertVariant_Info - AlertVariant_Error - AlertVariant_Success - AlertVariant_Warning - AlertVariant_Subtle_Info - AlertVariant_Subtle_Error - AlertVariant_Subtle_Success - AlertVariant_Subtle_Warning -) - -func (v AlertVariant) Attributes() templ.Attributes { - switch v { - case AlertVariant_Info: - return templ.Attributes{ - "class": "relative w-full rounded-lg border border-transparent bg-blue-600 p-4 [&>svg]:absolute [&>svg]:text-foreground [&>svg]:left-4 [&>svg]:top-4 [&>svg+div]:translate-y-[-3px] [&:has(svg)]:pl-11 text-white", - } - case AlertVariant_Error: - return templ.Attributes{ - "class": "relative w-full rounded-lg border border-transparent bg-red-600 p-4 [&>svg]:absolute [&>svg]:text-foreground [&>svg]:left-4 [&>svg]:top-4 [&>svg+div]:translate-y-[-3px] [&:has(svg)]:pl-11 text-white", - } - case AlertVariant_Success: - return templ.Attributes{ - "class": "relative w-full rounded-lg border border-transparent bg-green-500 p-4 [&>svg]:absolute [&>svg]:text-foreground [&>svg]:left-4 [&>svg]:top-4 [&>svg+div]:translate-y-[-3px] [&:has(svg)]:pl-11 text-white", - } - case AlertVariant_Warning: - return templ.Attributes{ - "class": "relative w-full rounded-lg border border-transparent bg-yellow-500 p-4 [&>svg]:absolute [&>svg]:text-foreground [&>svg]:left-4 [&>svg]:top-4 [&>svg+div]:translate-y-[-3px] [&:has(svg)]:pl-11 text-white", - } - case AlertVariant_Subtle_Info: - return templ.Attributes{ - "class": "relative w-full rounded-lg border border-transparent bg-blue-50 p-4 [&>svg]:absolute [&>svg]:text-foreground [&>svg]:left-4 [&>svg]:top-4 [&>svg+div]:translate-y-[-3px] [&:has(svg)]:pl-11 text-blue-600", - } - case AlertVariant_Subtle_Error: - return templ.Attributes{ - "class": "relative w-full rounded-lg border border-transparent bg-red-50 p-4 [&>svg]:absolute [&>svg]:text-foreground [&>svg]:left-4 [&>svg]:top-4 [&>svg+div]:translate-y-[-3px] [&:has(svg)]:pl-11 text-red-600", - } - case AlertVariant_Subtle_Success: - return templ.Attributes{ - "class": "relative w-full rounded-lg border border-transparent bg-green-50 p-4 [&>svg]:absolute [&>svg]:text-foreground [&>svg]:left-4 [&>svg]:top-4 [&>svg+div]:translate-y-[-3px] [&:has(svg)]:pl-11 text-green-600", - } - case AlertVariant_Subtle_Warning: - return templ.Attributes{ - "class": "relative w-full rounded-lg border border-transparent bg-yellow-50 p-4 [&>svg]:absolute [&>svg]:text-foreground [&>svg]:left-4 [&>svg]:top-4 [&>svg+div]:translate-y-[-3px] [&:has(svg)]:pl-11 text-yellow-600", - } - } - return templ.Attributes{ - "class": "relative w-full rounded-lg border bg-white p-4 [&>svg]:absolute [&>svg]:text-foreground [&>svg]:left-4 [&>svg]:top-4 [&>svg+div]:translate-y-[-3px] [&:has(svg)]:pl-11 text-neutral-900", - } -} diff --git a/internal/gui/elements/alert_templ.go b/internal/gui/elements/alert_templ.go deleted file mode 100644 index 0a95440bb..000000000 --- a/internal/gui/elements/alert_templ.go +++ /dev/null @@ -1,140 +0,0 @@ -// Code generated by templ - DO NOT EDIT. - -// templ: version: v0.2.778 -package elements - -//lint:file-ignore SA4006 This context is only used if a nested component is present. - -import "github.com/a-h/templ" -import templruntime "github.com/a-h/templ/runtime" - -func Alert(variant Variant, icon Icon, title, message string) templ.Component { - return alertElement(variant.Attributes(), title, message, icon.Render()) -} - -func alertElement(attrs templ.Attributes, title, message string, icon templ.Component) templ.Component { - return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { - templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { - return templ_7745c5c3_CtxErr - } - templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) - if !templ_7745c5c3_IsBuffer { - defer func() { - templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) - if templ_7745c5c3_Err == nil { - templ_7745c5c3_Err = templ_7745c5c3_BufErr - } - }() - } - ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var1 := templ.GetChildren(ctx) - if templ_7745c5c3_Var1 == nil { - templ_7745c5c3_Var1 = templ.NopComponent - } - ctx = templ.ClearChildren(ctx) - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = icon.Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - var templ_7745c5c3_Var2 string - templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(title) - if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/gui/elements/alert.templ`, Line: 10, Col: 66} - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var2)) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - var templ_7745c5c3_Var3 string - templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(message) - if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/gui/elements/alert.templ`, Line: 11, Col: 43} - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3)) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - return templ_7745c5c3_Err - }) -} - -type AlertVariant int - -const ( - AlertVariant_Default AlertVariant = iota - AlertVariant_Info - AlertVariant_Error - AlertVariant_Success - AlertVariant_Warning - AlertVariant_Subtle_Info - AlertVariant_Subtle_Error - AlertVariant_Subtle_Success - AlertVariant_Subtle_Warning -) - -func (v AlertVariant) Attributes() templ.Attributes { - switch v { - case AlertVariant_Info: - return templ.Attributes{ - "class": "relative w-full rounded-lg border border-transparent bg-blue-600 p-4 [&>svg]:absolute [&>svg]:text-foreground [&>svg]:left-4 [&>svg]:top-4 [&>svg+div]:translate-y-[-3px] [&:has(svg)]:pl-11 text-white", - } - case AlertVariant_Error: - return templ.Attributes{ - "class": "relative w-full rounded-lg border border-transparent bg-red-600 p-4 [&>svg]:absolute [&>svg]:text-foreground [&>svg]:left-4 [&>svg]:top-4 [&>svg+div]:translate-y-[-3px] [&:has(svg)]:pl-11 text-white", - } - case AlertVariant_Success: - return templ.Attributes{ - "class": "relative w-full rounded-lg border border-transparent bg-green-500 p-4 [&>svg]:absolute [&>svg]:text-foreground [&>svg]:left-4 [&>svg]:top-4 [&>svg+div]:translate-y-[-3px] [&:has(svg)]:pl-11 text-white", - } - case AlertVariant_Warning: - return templ.Attributes{ - "class": "relative w-full rounded-lg border border-transparent bg-yellow-500 p-4 [&>svg]:absolute [&>svg]:text-foreground [&>svg]:left-4 [&>svg]:top-4 [&>svg+div]:translate-y-[-3px] [&:has(svg)]:pl-11 text-white", - } - case AlertVariant_Subtle_Info: - return templ.Attributes{ - "class": "relative w-full rounded-lg border border-transparent bg-blue-50 p-4 [&>svg]:absolute [&>svg]:text-foreground [&>svg]:left-4 [&>svg]:top-4 [&>svg+div]:translate-y-[-3px] [&:has(svg)]:pl-11 text-blue-600", - } - case AlertVariant_Subtle_Error: - return templ.Attributes{ - "class": "relative w-full rounded-lg border border-transparent bg-red-50 p-4 [&>svg]:absolute [&>svg]:text-foreground [&>svg]:left-4 [&>svg]:top-4 [&>svg+div]:translate-y-[-3px] [&:has(svg)]:pl-11 text-red-600", - } - case AlertVariant_Subtle_Success: - return templ.Attributes{ - "class": "relative w-full rounded-lg border border-transparent bg-green-50 p-4 [&>svg]:absolute [&>svg]:text-foreground [&>svg]:left-4 [&>svg]:top-4 [&>svg+div]:translate-y-[-3px] [&:has(svg)]:pl-11 text-green-600", - } - case AlertVariant_Subtle_Warning: - return templ.Attributes{ - "class": "relative w-full rounded-lg border border-transparent bg-yellow-50 p-4 [&>svg]:absolute [&>svg]:text-foreground [&>svg]:left-4 [&>svg]:top-4 [&>svg+div]:translate-y-[-3px] [&:has(svg)]:pl-11 text-yellow-600", - } - } - return templ.Attributes{ - "class": "relative w-full rounded-lg border bg-white p-4 [&>svg]:absolute [&>svg]:text-foreground [&>svg]:left-4 [&>svg]:top-4 [&>svg+div]:translate-y-[-3px] [&:has(svg)]:pl-11 text-neutral-900", - } -} - -var _ = templruntime.GeneratedTemplate diff --git a/internal/gui/elements/animation.templ b/internal/gui/elements/animation.templ deleted file mode 100644 index 9d7f988ff..000000000 --- a/internal/gui/elements/animation.templ +++ /dev/null @@ -1,5 +0,0 @@ -package elements - -templ Animation() { - -} diff --git a/internal/gui/elements/animation_templ.go b/internal/gui/elements/animation_templ.go deleted file mode 100644 index 523e659da..000000000 --- a/internal/gui/elements/animation_templ.go +++ /dev/null @@ -1,40 +0,0 @@ -// Code generated by templ - DO NOT EDIT. - -// templ: version: v0.2.778 -package elements - -//lint:file-ignore SA4006 This context is only used if a nested component is present. - -import "github.com/a-h/templ" -import templruntime "github.com/a-h/templ/runtime" - -func Animation() templ.Component { - return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { - templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { - return templ_7745c5c3_CtxErr - } - templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) - if !templ_7745c5c3_IsBuffer { - defer func() { - templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) - if templ_7745c5c3_Err == nil { - templ_7745c5c3_Err = templ_7745c5c3_BufErr - } - }() - } - ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var1 := templ.GetChildren(ctx) - if templ_7745c5c3_Var1 == nil { - templ_7745c5c3_Var1 = templ.NopComponent - } - ctx = templ.ClearChildren(ctx) - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - return templ_7745c5c3_Err - }) -} - -var _ = templruntime.GeneratedTemplate diff --git a/internal/gui/elements/badge.templ b/internal/gui/elements/badge.templ deleted file mode 100644 index af512f4ac..000000000 --- a/internal/gui/elements/badge.templ +++ /dev/null @@ -1,59 +0,0 @@ -package elements - -templ PoweredBySonr() { -
-
-
- - Powered by - - - - - - -
-
- sonr image -
-

The creative platform for developers. Community, tools, products, and more

-

- - - - Joined June 2020 -

-
-
-
-
-
-
-} diff --git a/internal/gui/elements/badge_templ.go b/internal/gui/elements/badge_templ.go deleted file mode 100644 index c7dd81760..000000000 --- a/internal/gui/elements/badge_templ.go +++ /dev/null @@ -1,40 +0,0 @@ -// Code generated by templ - DO NOT EDIT. - -// templ: version: v0.2.778 -package elements - -//lint:file-ignore SA4006 This context is only used if a nested component is present. - -import "github.com/a-h/templ" -import templruntime "github.com/a-h/templ/runtime" - -func PoweredBySonr() templ.Component { - return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { - templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { - return templ_7745c5c3_CtxErr - } - templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) - if !templ_7745c5c3_IsBuffer { - defer func() { - templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) - if templ_7745c5c3_Err == nil { - templ_7745c5c3_Err = templ_7745c5c3_BufErr - } - }() - } - ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var1 := templ.GetChildren(ctx) - if templ_7745c5c3_Var1 == nil { - templ_7745c5c3_Var1 = templ.NopComponent - } - ctx = templ.ClearChildren(ctx) - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
Powered by
\"sonr

The creative platform for developers. Community, tools, products, and more

Joined June 2020

") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - return templ_7745c5c3_Err - }) -} - -var _ = templruntime.GeneratedTemplate diff --git a/internal/gui/elements/breadcrumbs.templ b/internal/gui/elements/breadcrumbs.templ deleted file mode 100644 index 45eed0d78..000000000 --- a/internal/gui/elements/breadcrumbs.templ +++ /dev/null @@ -1,35 +0,0 @@ -package elements - -templ Breadcrumbs() { - -} - -templ breadcrumbItem(title string, active bool) { - if (active) { -
  • { title }
  • - } else { -
  • { title }
  • - } -} - -templ breadcrumbIcon() { - - - - - -} diff --git a/internal/gui/elements/breadcrumbs_templ.go b/internal/gui/elements/breadcrumbs_templ.go deleted file mode 100644 index 219bb897f..000000000 --- a/internal/gui/elements/breadcrumbs_templ.go +++ /dev/null @@ -1,163 +0,0 @@ -// Code generated by templ - DO NOT EDIT. - -// templ: version: v0.2.778 -package elements - -//lint:file-ignore SA4006 This context is only used if a nested component is present. - -import "github.com/a-h/templ" -import templruntime "github.com/a-h/templ/runtime" - -func Breadcrumbs() templ.Component { - return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { - templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { - return templ_7745c5c3_CtxErr - } - templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) - if !templ_7745c5c3_IsBuffer { - defer func() { - templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) - if templ_7745c5c3_Err == nil { - templ_7745c5c3_Err = templ_7745c5c3_BufErr - } - }() - } - ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var1 := templ.GetChildren(ctx) - if templ_7745c5c3_Var1 == nil { - templ_7745c5c3_Var1 = templ.NopComponent - } - ctx = templ.ClearChildren(ctx) - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - return templ_7745c5c3_Err - }) -} - -func breadcrumbItem(title string, active bool) templ.Component { - return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { - templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { - return templ_7745c5c3_CtxErr - } - templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) - if !templ_7745c5c3_IsBuffer { - defer func() { - templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) - if templ_7745c5c3_Err == nil { - templ_7745c5c3_Err = templ_7745c5c3_BufErr - } - }() - } - ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var2 := templ.GetChildren(ctx) - if templ_7745c5c3_Var2 == nil { - templ_7745c5c3_Var2 = templ.NopComponent - } - ctx = templ.ClearChildren(ctx) - if active { - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
  • ") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - var templ_7745c5c3_Var3 string - templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(title) - if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/gui/elements/breadcrumbs.templ`, Line: 23, Col: 126} - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3)) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
  • ") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - } else { - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
  • ") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - var templ_7745c5c3_Var4 string - templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(title) - if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/gui/elements/breadcrumbs.templ`, Line: 25, Col: 118} - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var4)) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
  • ") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - } - return templ_7745c5c3_Err - }) -} - -func breadcrumbIcon() templ.Component { - return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { - templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { - return templ_7745c5c3_CtxErr - } - templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) - if !templ_7745c5c3_IsBuffer { - defer func() { - templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) - if templ_7745c5c3_Err == nil { - templ_7745c5c3_Err = templ_7745c5c3_BufErr - } - }() - } - ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var5 := templ.GetChildren(ctx) - if templ_7745c5c3_Var5 == nil { - templ_7745c5c3_Var5 = templ.NopComponent - } - ctx = templ.ClearChildren(ctx) - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - return templ_7745c5c3_Err - }) -} - -var _ = templruntime.GeneratedTemplate diff --git a/internal/gui/elements/button.templ b/internal/gui/elements/button.templ deleted file mode 100644 index 12b58480b..000000000 --- a/internal/gui/elements/button.templ +++ /dev/null @@ -1,218 +0,0 @@ -package elements - -type button struct { - variant Variant - hxGet string - hxPost string - hxTarget string - hxTrigger string - hxSwap string -} - -type ButtonOpt func(button *button) - -func PrimaryButtonStyle() ButtonOpt { - return func(button *button) { - button.variant = ButtonVariantPrimary - } -} - -func InfoButtonStyle() ButtonOpt { - return func(button *button) { - button.variant = ButtonVariantInfo - } -} - -func ErrorButtonStyle() ButtonOpt { - return func(button *button) { - button.variant = ButtonVariantError - } -} - -func SuccessButtonStyle() ButtonOpt { - return func(button *button) { - button.variant = ButtonVariantSuccess - } -} - -func WarningButtonStyle() ButtonOpt { - return func(button *button) { - button.variant = ButtonVariantWarning - } -} - -func GET(action string, target string) ButtonOpt { - return func(button *button) { - button.hxGet = action - button.hxTarget = target - button.hxTrigger = "click" - button.hxSwap = "outerHTML" - } -} - -func POST(action string, target string) ButtonOpt { - return func(button *button) { - button.hxPost = action - button.hxTarget = target - button.hxTrigger = "click" - button.hxSwap = "outerHTML" - } -} - -func Button(opts ...ButtonOpt) templ.Component { - button := button{ - variant: ButtonVariantDefault, - } - for _, opt := range opts { - opt(&button) - } - if button.hxGet != "" { - return renderHxGetButton(&button, button.variant.Attributes()) - } - - if button.hxPost != "" { - return renderHxPostButton(&button, button.variant.Attributes()) - } - return renderButton(button.variant.Attributes()) -} - -templ renderButton(attrs templ.Attributes) { - -} - -templ renderHxGetButton(c *button, attrs templ.Attributes) { - -} - -templ renderHxPostButton(c *button, attrs templ.Attributes) { - -} - -type ButtonVariant int - -const ( - ButtonVariantDefault ButtonVariant = iota - ButtonVariantPrimary - ButtonVariantInfo - ButtonVariantError - ButtonVariantSuccess - ButtonVariantWarning -) - -func (v ButtonVariant) Attributes() templ.Attributes { - switch v { - case ButtonVariantPrimary: - return templ.Attributes{ - "class": "inline-flex items-center justify-center px-4 py-2 text-sm font-medium tracking-wide text-white transition-colors duration-200 rounded-md bg-neutral-950 hover:bg-neutral-900 focus:ring-2 focus:ring-offset-2 focus:ring-neutral-900 focus:shadow-outline focus:outline-none", - "type": "button", - } - case ButtonVariantInfo: - return templ.Attributes{ - "class": "inline-flex items-center justify-center px-4 py-2 text-sm font-medium tracking-wide text-white transition-colors duration-200 bg-blue-600 rounded-md hover:bg-blue-700 focus:ring-2 focus:ring-offset-2 focus:ring-blue-700 focus:shadow-outline focus:outline-none", - "type": "button", - } - case ButtonVariantError: - return templ.Attributes{ - "class": "inline-flex items-center justify-center px-4 py-2 text-sm font-medium tracking-wide text-white transition-colors duration-200 rounded-md bg-red-600 hover:bg-red-700 focus:ring-2 focus:ring-offset-2 focus:ring-red-700 focus:shadow-outline focus:outline-none", - "type": "button", - } - case ButtonVariantSuccess: - return templ.Attributes{ - "class": "inline-flex items-center justify-center px-4 py-2 text-sm font-medium tracking-wide text-white transition-colors duration-200 rounded-md bg-green-600 hover:bg-green-700 focus:ring-2 focus:ring-offset-2 focus:ring-green-700 focus:shadow-outline focus:outline-none", - "type": "button", - } - case ButtonVariantWarning: - return templ.Attributes{ - "class": "inline-flex items-center justify-center px-4 py-2 text-sm font-medium tracking-wide text-white transition-colors duration-200 rounded-md bg-yellow-600 hover:bg-yellow-700 focus:ring-2 focus:ring-offset-2 focus:ring-yellow-700 focus:shadow-outline focus:outline-none", - "type": "button", - } - } - return templ.Attributes{ - "class": "inline-flex items-center justify-center px-4 py-2 text-sm font-medium tracking-wide transition-colors duration-200 bg-white border rounded-md text-neutral-500 hover:text-neutral-700 border-neutral-200/70 hover:bg-neutral-100 active:bg-white focus:bg-white focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-neutral-200/60 focus:shadow-outline", - "type": "button", - } -} - -type SubtleButtonVariant int - -const ( - SubtleButtonVariantDefault SubtleButtonVariant = iota - SubtleButtonVariantInfo - SubtleButtonVariantError - SubtleButtonVariantSuccess - SubtleButtonVariantWarning -) - -func (v SubtleButtonVariant) Attributes() templ.Attributes { - switch v { - case SubtleButtonVariantInfo: - return templ.Attributes{ - "class": "inline-flex items-center justify-center px-4 py-2 text-sm font-medium tracking-wide text-blue-500 transition-colors duration-100 rounded-md focus:ring-2 focus:ring-offset-2 focus:ring-blue-100 bg-blue-50 hover:text-blue-600 hover:bg-blue-100", - "type": "button", - } - case SubtleButtonVariantError: - return templ.Attributes{ - "class": "inline-flex items-center justify-center px-4 py-2 text-sm font-medium tracking-wide text-red-500 transition-colors duration-100 rounded-md focus:ring-2 focus:ring-offset-2 focus:ring-red-100 bg-red-50 hover:text-red-600 hover:bg-red-100", - "type": "button", - } - case SubtleButtonVariantSuccess: - return templ.Attributes{ - "class": "inline-flex items-center justify-center px-4 py-2 text-sm font-medium tracking-wide text-green-500 transition-colors duration-100 rounded-md focus:ring-2 focus:ring-offset-2 focus:ring-green-100 bg-green-50 hover:text-green-600 hover:bg-green-100", - "type": "button", - } - case SubtleButtonVariantWarning: - return templ.Attributes{ - "class": "inline-flex items-center justify-center px-4 py-2 text-sm font-medium tracking-wide text-yellow-600 transition-colors duration-100 rounded-md focus:ring-2 focus:ring-offset-2 focus:ring-yellow-100 bg-yellow-50 hover:text-yellow-700 hover:bg-yellow-100", - "type": "button", - } - } - return templ.Attributes{ - "class": "inline-flex items-center justify-center px-4 py-2 text-sm font-medium tracking-wide transition-colors duration-100 rounded-md text-neutral-500 bg-neutral-50 focus:ring-2 focus:ring-offset-2 focus:ring-neutral-100 hover:text-neutral-600 hover:bg-neutral-100", - "type": "button", - } -} - -type OutlineButtonVariant int - -const ( - OutlineButtonVariantDefault OutlineButtonVariant = iota - OutlineButtonVariantInfo - OutlineButtonVariantError - OutlineButtonVariantSuccess - OutlineButtonVariantWarning -) - -func (v OutlineButtonVariant) Attributes() templ.Attributes { - switch v { - case OutlineButtonVariantInfo: - return templ.Attributes{ - "class": "inline-flex items-center justify-center px-4 py-2 text-sm font-medium tracking-wide text-blue-600 transition-colors duration-100 bg-white border-2 border-blue-600 rounded-md hover:text-white hover:bg-blue-600", - "type": "button", - } - case OutlineButtonVariantError: - return templ.Attributes{ - "class": "inline-flex items-center justify-center px-4 py-2 text-sm font-medium tracking-wide text-red-600 transition-colors duration-100 bg-white border-2 border-red-600 rounded-md hover:text-white hover:bg-red-600", - "type": "button", - } - case OutlineButtonVariantSuccess: - return templ.Attributes{ - "class": "inline-flex items-center justify-center px-4 py-2 text-sm font-medium tracking-wide text-green-600 transition-colors duration-100 bg-white border-2 border-green-600 rounded-md hover:text-white hover:bg-green-600", - "type": "button", - } - case OutlineButtonVariantWarning: - return templ.Attributes{ - "class": "inline-flex items-center justify-center px-4 py-2 text-sm font-medium tracking-wide text-yellow-600 transition-colors duration-100 bg-white border-2 border-yellow-500 rounded-md hover:text-white hover:bg-yellow-500", - "type": "button", - } - } - return templ.Attributes{ - "class": "inline-flex items-center justify-center px-4 py-2 text-sm font-medium tracking-wide transition-colors duration-100 bg-white border-2 rounded-md text-neutral-900 hover:text-white border-neutral-900 hover:bg-neutral-900", - "type": "button", - } -} diff --git a/internal/gui/elements/button_templ.go b/internal/gui/elements/button_templ.go deleted file mode 100644 index ad66da28e..000000000 --- a/internal/gui/elements/button_templ.go +++ /dev/null @@ -1,449 +0,0 @@ -// Code generated by templ - DO NOT EDIT. - -// templ: version: v0.2.778 -package elements - -//lint:file-ignore SA4006 This context is only used if a nested component is present. - -import "github.com/a-h/templ" -import templruntime "github.com/a-h/templ/runtime" - -type button struct { - variant Variant - hxGet string - hxPost string - hxTarget string - hxTrigger string - hxSwap string -} - -type ButtonOpt func(button *button) - -func PrimaryButtonStyle() ButtonOpt { - return func(button *button) { - button.variant = ButtonVariantPrimary - } -} - -func InfoButtonStyle() ButtonOpt { - return func(button *button) { - button.variant = ButtonVariantInfo - } -} - -func ErrorButtonStyle() ButtonOpt { - return func(button *button) { - button.variant = ButtonVariantError - } -} - -func SuccessButtonStyle() ButtonOpt { - return func(button *button) { - button.variant = ButtonVariantSuccess - } -} - -func WarningButtonStyle() ButtonOpt { - return func(button *button) { - button.variant = ButtonVariantWarning - } -} - -func GET(action string, target string) ButtonOpt { - return func(button *button) { - button.hxGet = action - button.hxTarget = target - button.hxTrigger = "click" - button.hxSwap = "outerHTML" - } -} - -func POST(action string, target string) ButtonOpt { - return func(button *button) { - button.hxPost = action - button.hxTarget = target - button.hxTrigger = "click" - button.hxSwap = "outerHTML" - } -} - -func Button(opts ...ButtonOpt) templ.Component { - button := button{ - variant: ButtonVariantDefault, - } - for _, opt := range opts { - opt(&button) - } - if button.hxGet != "" { - return renderHxGetButton(&button, button.variant.Attributes()) - } - - if button.hxPost != "" { - return renderHxPostButton(&button, button.variant.Attributes()) - } - return renderButton(button.variant.Attributes()) -} - -func renderButton(attrs templ.Attributes) templ.Component { - return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { - templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { - return templ_7745c5c3_CtxErr - } - templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) - if !templ_7745c5c3_IsBuffer { - defer func() { - templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) - if templ_7745c5c3_Err == nil { - templ_7745c5c3_Err = templ_7745c5c3_BufErr - } - }() - } - ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var1 := templ.GetChildren(ctx) - if templ_7745c5c3_Var1 == nil { - templ_7745c5c3_Var1 = templ.NopComponent - } - ctx = templ.ClearChildren(ctx) - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templ_7745c5c3_Var1.Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - return templ_7745c5c3_Err - }) -} - -func renderHxGetButton(c *button, attrs templ.Attributes) templ.Component { - return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { - templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { - return templ_7745c5c3_CtxErr - } - templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) - if !templ_7745c5c3_IsBuffer { - defer func() { - templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) - if templ_7745c5c3_Err == nil { - templ_7745c5c3_Err = templ_7745c5c3_BufErr - } - }() - } - ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var2 := templ.GetChildren(ctx) - if templ_7745c5c3_Var2 == nil { - templ_7745c5c3_Var2 = templ.NopComponent - } - ctx = templ.ClearChildren(ctx) - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - return templ_7745c5c3_Err - }) -} - -func renderHxPostButton(c *button, attrs templ.Attributes) templ.Component { - return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { - templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { - return templ_7745c5c3_CtxErr - } - templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) - if !templ_7745c5c3_IsBuffer { - defer func() { - templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) - if templ_7745c5c3_Err == nil { - templ_7745c5c3_Err = templ_7745c5c3_BufErr - } - }() - } - ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var7 := templ.GetChildren(ctx) - if templ_7745c5c3_Var7 == nil { - templ_7745c5c3_Var7 = templ.NopComponent - } - ctx = templ.ClearChildren(ctx) - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - return templ_7745c5c3_Err - }) -} - -type ButtonVariant int - -const ( - ButtonVariantDefault ButtonVariant = iota - ButtonVariantPrimary - ButtonVariantInfo - ButtonVariantError - ButtonVariantSuccess - ButtonVariantWarning -) - -func (v ButtonVariant) Attributes() templ.Attributes { - switch v { - case ButtonVariantPrimary: - return templ.Attributes{ - "class": "inline-flex items-center justify-center px-4 py-2 text-sm font-medium tracking-wide text-white transition-colors duration-200 rounded-md bg-neutral-950 hover:bg-neutral-900 focus:ring-2 focus:ring-offset-2 focus:ring-neutral-900 focus:shadow-outline focus:outline-none", - "type": "button", - } - case ButtonVariantInfo: - return templ.Attributes{ - "class": "inline-flex items-center justify-center px-4 py-2 text-sm font-medium tracking-wide text-white transition-colors duration-200 bg-blue-600 rounded-md hover:bg-blue-700 focus:ring-2 focus:ring-offset-2 focus:ring-blue-700 focus:shadow-outline focus:outline-none", - "type": "button", - } - case ButtonVariantError: - return templ.Attributes{ - "class": "inline-flex items-center justify-center px-4 py-2 text-sm font-medium tracking-wide text-white transition-colors duration-200 rounded-md bg-red-600 hover:bg-red-700 focus:ring-2 focus:ring-offset-2 focus:ring-red-700 focus:shadow-outline focus:outline-none", - "type": "button", - } - case ButtonVariantSuccess: - return templ.Attributes{ - "class": "inline-flex items-center justify-center px-4 py-2 text-sm font-medium tracking-wide text-white transition-colors duration-200 rounded-md bg-green-600 hover:bg-green-700 focus:ring-2 focus:ring-offset-2 focus:ring-green-700 focus:shadow-outline focus:outline-none", - "type": "button", - } - case ButtonVariantWarning: - return templ.Attributes{ - "class": "inline-flex items-center justify-center px-4 py-2 text-sm font-medium tracking-wide text-white transition-colors duration-200 rounded-md bg-yellow-600 hover:bg-yellow-700 focus:ring-2 focus:ring-offset-2 focus:ring-yellow-700 focus:shadow-outline focus:outline-none", - "type": "button", - } - } - return templ.Attributes{ - "class": "inline-flex items-center justify-center px-4 py-2 text-sm font-medium tracking-wide transition-colors duration-200 bg-white border rounded-md text-neutral-500 hover:text-neutral-700 border-neutral-200/70 hover:bg-neutral-100 active:bg-white focus:bg-white focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-neutral-200/60 focus:shadow-outline", - "type": "button", - } -} - -type SubtleButtonVariant int - -const ( - SubtleButtonVariantDefault SubtleButtonVariant = iota - SubtleButtonVariantInfo - SubtleButtonVariantError - SubtleButtonVariantSuccess - SubtleButtonVariantWarning -) - -func (v SubtleButtonVariant) Attributes() templ.Attributes { - switch v { - case SubtleButtonVariantInfo: - return templ.Attributes{ - "class": "inline-flex items-center justify-center px-4 py-2 text-sm font-medium tracking-wide text-blue-500 transition-colors duration-100 rounded-md focus:ring-2 focus:ring-offset-2 focus:ring-blue-100 bg-blue-50 hover:text-blue-600 hover:bg-blue-100", - "type": "button", - } - case SubtleButtonVariantError: - return templ.Attributes{ - "class": "inline-flex items-center justify-center px-4 py-2 text-sm font-medium tracking-wide text-red-500 transition-colors duration-100 rounded-md focus:ring-2 focus:ring-offset-2 focus:ring-red-100 bg-red-50 hover:text-red-600 hover:bg-red-100", - "type": "button", - } - case SubtleButtonVariantSuccess: - return templ.Attributes{ - "class": "inline-flex items-center justify-center px-4 py-2 text-sm font-medium tracking-wide text-green-500 transition-colors duration-100 rounded-md focus:ring-2 focus:ring-offset-2 focus:ring-green-100 bg-green-50 hover:text-green-600 hover:bg-green-100", - "type": "button", - } - case SubtleButtonVariantWarning: - return templ.Attributes{ - "class": "inline-flex items-center justify-center px-4 py-2 text-sm font-medium tracking-wide text-yellow-600 transition-colors duration-100 rounded-md focus:ring-2 focus:ring-offset-2 focus:ring-yellow-100 bg-yellow-50 hover:text-yellow-700 hover:bg-yellow-100", - "type": "button", - } - } - return templ.Attributes{ - "class": "inline-flex items-center justify-center px-4 py-2 text-sm font-medium tracking-wide transition-colors duration-100 rounded-md text-neutral-500 bg-neutral-50 focus:ring-2 focus:ring-offset-2 focus:ring-neutral-100 hover:text-neutral-600 hover:bg-neutral-100", - "type": "button", - } -} - -type OutlineButtonVariant int - -const ( - OutlineButtonVariantDefault OutlineButtonVariant = iota - OutlineButtonVariantInfo - OutlineButtonVariantError - OutlineButtonVariantSuccess - OutlineButtonVariantWarning -) - -func (v OutlineButtonVariant) Attributes() templ.Attributes { - switch v { - case OutlineButtonVariantInfo: - return templ.Attributes{ - "class": "inline-flex items-center justify-center px-4 py-2 text-sm font-medium tracking-wide text-blue-600 transition-colors duration-100 bg-white border-2 border-blue-600 rounded-md hover:text-white hover:bg-blue-600", - "type": "button", - } - case OutlineButtonVariantError: - return templ.Attributes{ - "class": "inline-flex items-center justify-center px-4 py-2 text-sm font-medium tracking-wide text-red-600 transition-colors duration-100 bg-white border-2 border-red-600 rounded-md hover:text-white hover:bg-red-600", - "type": "button", - } - case OutlineButtonVariantSuccess: - return templ.Attributes{ - "class": "inline-flex items-center justify-center px-4 py-2 text-sm font-medium tracking-wide text-green-600 transition-colors duration-100 bg-white border-2 border-green-600 rounded-md hover:text-white hover:bg-green-600", - "type": "button", - } - case OutlineButtonVariantWarning: - return templ.Attributes{ - "class": "inline-flex items-center justify-center px-4 py-2 text-sm font-medium tracking-wide text-yellow-600 transition-colors duration-100 bg-white border-2 border-yellow-500 rounded-md hover:text-white hover:bg-yellow-500", - "type": "button", - } - } - return templ.Attributes{ - "class": "inline-flex items-center justify-center px-4 py-2 text-sm font-medium tracking-wide transition-colors duration-100 bg-white border-2 rounded-md text-neutral-900 hover:text-white border-neutral-900 hover:bg-neutral-900", - "type": "button", - } -} - -var _ = templruntime.GeneratedTemplate diff --git a/internal/gui/elements/card.templ b/internal/gui/elements/card.templ deleted file mode 100644 index 59113a1a9..000000000 --- a/internal/gui/elements/card.templ +++ /dev/null @@ -1,47 +0,0 @@ -package elements - -func Card(id string, size Size) templ.Component { - return renderCard(id, size.CardAttributes()) -} - -templ renderCard(id string, attrs templ.Attributes) { -
    -
    -
    -
    - { children... } -
    -
    -
    -
    -} - -templ ProfileCard() { -
    - -
    -
    - -
    - -
    Adam Wathan
    - adamwathan -
    - -
    -
    -

    Creator of @tailwindcss. Listener of Slayer. Austin 3:16. BTW, Pines UI is super cool!

    - -
    -
    -} diff --git a/internal/gui/elements/card_templ.go b/internal/gui/elements/card_templ.go deleted file mode 100644 index 6e086c670..000000000 --- a/internal/gui/elements/card_templ.go +++ /dev/null @@ -1,102 +0,0 @@ -// Code generated by templ - DO NOT EDIT. - -// templ: version: v0.2.778 -package elements - -//lint:file-ignore SA4006 This context is only used if a nested component is present. - -import "github.com/a-h/templ" -import templruntime "github.com/a-h/templ/runtime" - -func Card(id string, size Size) templ.Component { - return renderCard(id, size.CardAttributes()) -} - -func renderCard(id string, attrs templ.Attributes) templ.Component { - return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { - templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { - return templ_7745c5c3_CtxErr - } - templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) - if !templ_7745c5c3_IsBuffer { - defer func() { - templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) - if templ_7745c5c3_Err == nil { - templ_7745c5c3_Err = templ_7745c5c3_BufErr - } - }() - } - ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var1 := templ.GetChildren(ctx) - if templ_7745c5c3_Var1 == nil { - templ_7745c5c3_Var1 = templ.NopComponent - } - ctx = templ.ClearChildren(ctx) - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
    ") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templ_7745c5c3_Var1.Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
    ") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - return templ_7745c5c3_Err - }) -} - -func ProfileCard() templ.Component { - return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { - templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { - return templ_7745c5c3_CtxErr - } - templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) - if !templ_7745c5c3_IsBuffer { - defer func() { - templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) - if templ_7745c5c3_Err == nil { - templ_7745c5c3_Err = templ_7745c5c3_BufErr - } - }() - } - ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var3 := templ.GetChildren(ctx) - if templ_7745c5c3_Var3 == nil { - templ_7745c5c3_Var3 = templ.NopComponent - } - ctx = templ.ClearChildren(ctx) - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("

    Creator of @tailwindcss. Listener of Slayer. Austin 3:16. BTW, Pines UI is super cool!

    ") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - return templ_7745c5c3_Err - }) -} - -var _ = templruntime.GeneratedTemplate diff --git a/internal/gui/elements/elements.go b/internal/gui/elements/elements.go deleted file mode 100644 index a923c57c7..000000000 --- a/internal/gui/elements/elements.go +++ /dev/null @@ -1,47 +0,0 @@ -package elements - -import ( - "strings" - - "github.com/a-h/templ" -) - -type Icon interface { - Render() templ.Component -} - -type Variant interface { - Attributes() templ.Attributes -} - -func clsxMerge(variants ...Variant) templ.Attributes { - combinedAttrs := templ.Attributes{} - var classElements []string - - for _, variant := range variants { - attrs := variant.Attributes() - if class, ok := attrs["class"].(string); ok { - classElements = append(classElements, strings.Fields(class)...) - } - for key, value := range attrs { - if key != "class" { - combinedAttrs[key] = value - } - } - } - - if len(classElements) > 0 { - combinedAttrs["class"] = strings.Join(classElements, " ") - } - return combinedAttrs -} - -func clsxBuilder(classes ...string) templ.Attributes { - if len(classes) == 0 { - return templ.Attributes{} - } - class := strings.Join(classes, " ") - return templ.Attributes{ - "class": class, - } -} diff --git a/internal/gui/elements/fonts.templ b/internal/gui/elements/fonts.templ deleted file mode 100644 index f05d49f83..000000000 --- a/internal/gui/elements/fonts.templ +++ /dev/null @@ -1,62 +0,0 @@ -package elements - -func H1(content string) templ.Component { - return renderText(1, content) -} - -func H2(content string) templ.Component { - return renderText(2, content) -} - -func H3(content string) templ.Component { - return renderText(3, content) -} - -func Text(content string) templ.Component { - return renderText(0, content) -} - -templ renderText(level int, text string) { - switch level { - case 1: -

    - { text } -

    - case 2: -

    - { text } -

    - case 3: -

    - { text } -

    - default: -

    - { text } -

    - } -} - -templ renderLink(attrs templ.Attributes, text string) { - - { text } - -} - -templ renderStrong(attrs templ.Attributes, text string) { - - { text } - -} - -templ renderEmphasis(attrs templ.Attributes, text string) { - - { text } - -} - -templ renderCode(attrs templ.Attributes, text string) { - - { text } - -} diff --git a/internal/gui/elements/fonts_templ.go b/internal/gui/elements/fonts_templ.go deleted file mode 100644 index 4022c9887..000000000 --- a/internal/gui/elements/fonts_templ.go +++ /dev/null @@ -1,326 +0,0 @@ -// Code generated by templ - DO NOT EDIT. - -// templ: version: v0.2.778 -package elements - -//lint:file-ignore SA4006 This context is only used if a nested component is present. - -import "github.com/a-h/templ" -import templruntime "github.com/a-h/templ/runtime" - -func H1(content string) templ.Component { - return renderText(1, content) -} - -func H2(content string) templ.Component { - return renderText(2, content) -} - -func H3(content string) templ.Component { - return renderText(3, content) -} - -func Text(content string) templ.Component { - return renderText(0, content) -} - -func renderText(level int, text string) templ.Component { - return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { - templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { - return templ_7745c5c3_CtxErr - } - templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) - if !templ_7745c5c3_IsBuffer { - defer func() { - templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) - if templ_7745c5c3_Err == nil { - templ_7745c5c3_Err = templ_7745c5c3_BufErr - } - }() - } - ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var1 := templ.GetChildren(ctx) - if templ_7745c5c3_Var1 == nil { - templ_7745c5c3_Var1 = templ.NopComponent - } - ctx = templ.ClearChildren(ctx) - switch level { - case 1: - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("

    ") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - var templ_7745c5c3_Var2 string - templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(text) - if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/gui/elements/fonts.templ`, Line: 23, Col: 10} - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var2)) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("

    ") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - case 2: - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("

    ") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - var templ_7745c5c3_Var3 string - templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(text) - if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/gui/elements/fonts.templ`, Line: 27, Col: 10} - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3)) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("

    ") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - case 3: - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("

    ") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - var templ_7745c5c3_Var4 string - templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(text) - if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/gui/elements/fonts.templ`, Line: 31, Col: 10} - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var4)) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("

    ") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - default: - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("

    ") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - var templ_7745c5c3_Var5 string - templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(text) - if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/gui/elements/fonts.templ`, Line: 35, Col: 10} - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var5)) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("

    ") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - } - return templ_7745c5c3_Err - }) -} - -func renderLink(attrs templ.Attributes, text string) templ.Component { - return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { - templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { - return templ_7745c5c3_CtxErr - } - templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) - if !templ_7745c5c3_IsBuffer { - defer func() { - templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) - if templ_7745c5c3_Err == nil { - templ_7745c5c3_Err = templ_7745c5c3_BufErr - } - }() - } - ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var6 := templ.GetChildren(ctx) - if templ_7745c5c3_Var6 == nil { - templ_7745c5c3_Var6 = templ.NopComponent - } - ctx = templ.ClearChildren(ctx) - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - var templ_7745c5c3_Var7 string - templ_7745c5c3_Var7, templ_7745c5c3_Err = templ.JoinStringErrs(text) - if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/gui/elements/fonts.templ`, Line: 42, Col: 8} - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var7)) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - return templ_7745c5c3_Err - }) -} - -func renderStrong(attrs templ.Attributes, text string) templ.Component { - return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { - templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { - return templ_7745c5c3_CtxErr - } - templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) - if !templ_7745c5c3_IsBuffer { - defer func() { - templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) - if templ_7745c5c3_Err == nil { - templ_7745c5c3_Err = templ_7745c5c3_BufErr - } - }() - } - ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var8 := templ.GetChildren(ctx) - if templ_7745c5c3_Var8 == nil { - templ_7745c5c3_Var8 = templ.NopComponent - } - ctx = templ.ClearChildren(ctx) - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - var templ_7745c5c3_Var9 string - templ_7745c5c3_Var9, templ_7745c5c3_Err = templ.JoinStringErrs(text) - if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/gui/elements/fonts.templ`, Line: 48, Col: 8} - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var9)) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - return templ_7745c5c3_Err - }) -} - -func renderEmphasis(attrs templ.Attributes, text string) templ.Component { - return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { - templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { - return templ_7745c5c3_CtxErr - } - templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) - if !templ_7745c5c3_IsBuffer { - defer func() { - templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) - if templ_7745c5c3_Err == nil { - templ_7745c5c3_Err = templ_7745c5c3_BufErr - } - }() - } - ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var10 := templ.GetChildren(ctx) - if templ_7745c5c3_Var10 == nil { - templ_7745c5c3_Var10 = templ.NopComponent - } - ctx = templ.ClearChildren(ctx) - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - var templ_7745c5c3_Var11 string - templ_7745c5c3_Var11, templ_7745c5c3_Err = templ.JoinStringErrs(text) - if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/gui/elements/fonts.templ`, Line: 54, Col: 8} - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var11)) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - return templ_7745c5c3_Err - }) -} - -func renderCode(attrs templ.Attributes, text string) templ.Component { - return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { - templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { - return templ_7745c5c3_CtxErr - } - templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) - if !templ_7745c5c3_IsBuffer { - defer func() { - templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) - if templ_7745c5c3_Err == nil { - templ_7745c5c3_Err = templ_7745c5c3_BufErr - } - }() - } - ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var12 := templ.GetChildren(ctx) - if templ_7745c5c3_Var12 == nil { - templ_7745c5c3_Var12 = templ.NopComponent - } - ctx = templ.ClearChildren(ctx) - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - var templ_7745c5c3_Var13 string - templ_7745c5c3_Var13, templ_7745c5c3_Err = templ.JoinStringErrs(text) - if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/gui/elements/fonts.templ`, Line: 60, Col: 8} - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var13)) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - return templ_7745c5c3_Err - }) -} - -var _ = templruntime.GeneratedTemplate diff --git a/internal/gui/elements/global.templ b/internal/gui/elements/global.templ deleted file mode 100644 index 3ae2a3c3a..000000000 --- a/internal/gui/elements/global.templ +++ /dev/null @@ -1,54 +0,0 @@ -package elements - -templ Layout(title string) { - - - - @defaultStyles() - { title } - - -
    - { children... } -
    - - -} - -templ Spacer() { -
    -} - -templ ServiceWorker(path string) { - -} - -templ defaultStyles() { - - - - - - - - - -} - -templ Rows() { -
    - { children... } -
    -} - -templ Columns() { -
    - { children... } -
    -} - -css main() { - font-family: R-Flex, system-ui, Avenir, Helvetica, Arial, sans-serif; -} diff --git a/internal/gui/elements/global_templ.go b/internal/gui/elements/global_templ.go deleted file mode 100644 index d9a36c6e7..000000000 --- a/internal/gui/elements/global_templ.go +++ /dev/null @@ -1,240 +0,0 @@ -// Code generated by templ - DO NOT EDIT. - -// templ: version: v0.2.778 -package elements - -//lint:file-ignore SA4006 This context is only used if a nested component is present. - -import "github.com/a-h/templ" -import templruntime "github.com/a-h/templ/runtime" - -func Layout(title string) templ.Component { - return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { - templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { - return templ_7745c5c3_CtxErr - } - templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) - if !templ_7745c5c3_IsBuffer { - defer func() { - templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) - if templ_7745c5c3_Err == nil { - templ_7745c5c3_Err = templ_7745c5c3_BufErr - } - }() - } - ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var1 := templ.GetChildren(ctx) - if templ_7745c5c3_Var1 == nil { - templ_7745c5c3_Var1 = templ.NopComponent - } - ctx = templ.ClearChildren(ctx) - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = defaultStyles().Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - var templ_7745c5c3_Var2 string - templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(title) - if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/gui/elements/global.templ`, Line: 8, Col: 17} - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var2)) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
    ") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templ_7745c5c3_Var1.Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
    ") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - return templ_7745c5c3_Err - }) -} - -func Spacer() templ.Component { - return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { - templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { - return templ_7745c5c3_CtxErr - } - templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) - if !templ_7745c5c3_IsBuffer { - defer func() { - templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) - if templ_7745c5c3_Err == nil { - templ_7745c5c3_Err = templ_7745c5c3_BufErr - } - }() - } - ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var3 := templ.GetChildren(ctx) - if templ_7745c5c3_Var3 == nil { - templ_7745c5c3_Var3 = templ.NopComponent - } - ctx = templ.ClearChildren(ctx) - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
    ") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - return templ_7745c5c3_Err - }) -} - -func ServiceWorker(path string) templ.Component { - return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { - templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { - return templ_7745c5c3_CtxErr - } - templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) - if !templ_7745c5c3_IsBuffer { - defer func() { - templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) - if templ_7745c5c3_Err == nil { - templ_7745c5c3_Err = templ_7745c5c3_BufErr - } - }() - } - ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var4 := templ.GetChildren(ctx) - if templ_7745c5c3_Var4 == nil { - templ_7745c5c3_Var4 = templ.NopComponent - } - ctx = templ.ClearChildren(ctx) - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - return templ_7745c5c3_Err - }) -} - -func defaultStyles() templ.Component { - return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { - templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { - return templ_7745c5c3_CtxErr - } - templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) - if !templ_7745c5c3_IsBuffer { - defer func() { - templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) - if templ_7745c5c3_Err == nil { - templ_7745c5c3_Err = templ_7745c5c3_BufErr - } - }() - } - ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var5 := templ.GetChildren(ctx) - if templ_7745c5c3_Var5 == nil { - templ_7745c5c3_Var5 = templ.NopComponent - } - ctx = templ.ClearChildren(ctx) - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - return templ_7745c5c3_Err - }) -} - -func Rows() templ.Component { - return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { - templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { - return templ_7745c5c3_CtxErr - } - templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) - if !templ_7745c5c3_IsBuffer { - defer func() { - templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) - if templ_7745c5c3_Err == nil { - templ_7745c5c3_Err = templ_7745c5c3_BufErr - } - }() - } - ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var6 := templ.GetChildren(ctx) - if templ_7745c5c3_Var6 == nil { - templ_7745c5c3_Var6 = templ.NopComponent - } - ctx = templ.ClearChildren(ctx) - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
    ") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templ_7745c5c3_Var6.Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
    ") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - return templ_7745c5c3_Err - }) -} - -func Columns() templ.Component { - return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { - templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { - return templ_7745c5c3_CtxErr - } - templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) - if !templ_7745c5c3_IsBuffer { - defer func() { - templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) - if templ_7745c5c3_Err == nil { - templ_7745c5c3_Err = templ_7745c5c3_BufErr - } - }() - } - ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var7 := templ.GetChildren(ctx) - if templ_7745c5c3_Var7 == nil { - templ_7745c5c3_Var7 = templ.NopComponent - } - ctx = templ.ClearChildren(ctx) - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
    ") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templ_7745c5c3_Var7.Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
    ") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - return templ_7745c5c3_Err - }) -} - -func main() templ.CSSClass { - templ_7745c5c3_CSSBuilder := templruntime.GetBuilder() - templ_7745c5c3_CSSBuilder.WriteString(`font-family:R-Flex, system-ui, Avenir, Helvetica, Arial, sans-serif;`) - templ_7745c5c3_CSSID := templ.CSSID(`main`, templ_7745c5c3_CSSBuilder.String()) - return templ.ComponentCSSClass{ - ID: templ_7745c5c3_CSSID, - Class: templ.SafeCSS(`.` + templ_7745c5c3_CSSID + `{` + templ_7745c5c3_CSSBuilder.String() + `}`), - } -} - -var _ = templruntime.GeneratedTemplate diff --git a/internal/gui/elements/icons.templ b/internal/gui/elements/icons.templ deleted file mode 100644 index b13e3fd4a..000000000 --- a/internal/gui/elements/icons.templ +++ /dev/null @@ -1,31 +0,0 @@ -package elements - -type Icons int - -const ( - Icons_Info Icons = iota - Icons_Error - Icons_Success - Icons_Warning -) - -func (v Icons) Render() templ.Component { - return renderIconVariant(v) -} - -templ renderIconVariant(v Icons) { - switch v { - case Icons_Info: - - case Icons_Error: - - case Icons_Success: - - case Icons_Warning: - - } - -} - -templ SonrIcon() { -} diff --git a/internal/gui/elements/icons_templ.go b/internal/gui/elements/icons_templ.go deleted file mode 100644 index 1b45bb48f..000000000 --- a/internal/gui/elements/icons_templ.go +++ /dev/null @@ -1,100 +0,0 @@ -// Code generated by templ - DO NOT EDIT. - -// templ: version: v0.2.778 -package elements - -//lint:file-ignore SA4006 This context is only used if a nested component is present. - -import "github.com/a-h/templ" -import templruntime "github.com/a-h/templ/runtime" - -type Icons int - -const ( - Icons_Info Icons = iota - Icons_Error - Icons_Success - Icons_Warning -) - -func (v Icons) Render() templ.Component { - return renderIconVariant(v) -} - -func renderIconVariant(v Icons) templ.Component { - return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { - templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { - return templ_7745c5c3_CtxErr - } - templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) - if !templ_7745c5c3_IsBuffer { - defer func() { - templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) - if templ_7745c5c3_Err == nil { - templ_7745c5c3_Err = templ_7745c5c3_BufErr - } - }() - } - ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var1 := templ.GetChildren(ctx) - if templ_7745c5c3_Var1 == nil { - templ_7745c5c3_Var1 = templ.NopComponent - } - ctx = templ.ClearChildren(ctx) - switch v { - case Icons_Info: - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - case Icons_Error: - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - case Icons_Success: - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - case Icons_Warning: - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - return templ_7745c5c3_Err - }) -} - -func SonrIcon() templ.Component { - return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { - templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { - return templ_7745c5c3_CtxErr - } - templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) - if !templ_7745c5c3_IsBuffer { - defer func() { - templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) - if templ_7745c5c3_Err == nil { - templ_7745c5c3_Err = templ_7745c5c3_BufErr - } - }() - } - ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var2 := templ.GetChildren(ctx) - if templ_7745c5c3_Var2 == nil { - templ_7745c5c3_Var2 = templ.NopComponent - } - ctx = templ.ClearChildren(ctx) - return templ_7745c5c3_Err - }) -} - -var _ = templruntime.GeneratedTemplate diff --git a/internal/gui/elements/inputs.templ b/internal/gui/elements/inputs.templ deleted file mode 100644 index 73227660a..000000000 --- a/internal/gui/elements/inputs.templ +++ /dev/null @@ -1,29 +0,0 @@ -package elements - -type InputState int - -const ( - InputStateDefault InputState = iota - InputStateError - InputStateSuccess -) - -templ TextInput(state InputState, label string, placeholder string) { - switch (state) { - case InputStateDefault: -
    - - -
    - case InputStateError: -
    - - -
    - case InputStateSuccess: -
    - - -
    - } -} diff --git a/internal/gui/elements/inputs_templ.go b/internal/gui/elements/inputs_templ.go deleted file mode 100644 index 545265f72..000000000 --- a/internal/gui/elements/inputs_templ.go +++ /dev/null @@ -1,100 +0,0 @@ -// Code generated by templ - DO NOT EDIT. - -// templ: version: v0.2.778 -package elements - -//lint:file-ignore SA4006 This context is only used if a nested component is present. - -import "github.com/a-h/templ" -import templruntime "github.com/a-h/templ/runtime" - -type InputState int - -const ( - InputStateDefault InputState = iota - InputStateError - InputStateSuccess -) - -func TextInput(state InputState, label string, placeholder string) templ.Component { - return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { - templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { - return templ_7745c5c3_CtxErr - } - templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) - if !templ_7745c5c3_IsBuffer { - defer func() { - templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) - if templ_7745c5c3_Err == nil { - templ_7745c5c3_Err = templ_7745c5c3_BufErr - } - }() - } - ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var1 := templ.GetChildren(ctx) - if templ_7745c5c3_Var1 == nil { - templ_7745c5c3_Var1 = templ.NopComponent - } - ctx = templ.ClearChildren(ctx) - switch state { - case InputStateDefault: - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
    ") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - case InputStateError: - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
    ") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - case InputStateSuccess: - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
    ") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - } - return templ_7745c5c3_Err - }) -} - -var _ = templruntime.GeneratedTemplate diff --git a/internal/gui/elements/radios.templ b/internal/gui/elements/radios.templ deleted file mode 100644 index 0200e04cd..000000000 --- a/internal/gui/elements/radios.templ +++ /dev/null @@ -1,37 +0,0 @@ -package elements - -templ RadioGroup() { -
    - -
    -} diff --git a/internal/gui/elements/radios_templ.go b/internal/gui/elements/radios_templ.go deleted file mode 100644 index 0f69a82fa..000000000 --- a/internal/gui/elements/radios_templ.go +++ /dev/null @@ -1,40 +0,0 @@ -// Code generated by templ - DO NOT EDIT. - -// templ: version: v0.2.778 -package elements - -//lint:file-ignore SA4006 This context is only used if a nested component is present. - -import "github.com/a-h/templ" -import templruntime "github.com/a-h/templ/runtime" - -func RadioGroup() templ.Component { - return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { - templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { - return templ_7745c5c3_CtxErr - } - templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) - if !templ_7745c5c3_IsBuffer { - defer func() { - templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) - if templ_7745c5c3_Err == nil { - templ_7745c5c3_Err = templ_7745c5c3_BufErr - } - }() - } - ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var1 := templ.GetChildren(ctx) - if templ_7745c5c3_Var1 == nil { - templ_7745c5c3_Var1 = templ.NopComponent - } - ctx = templ.ClearChildren(ctx) - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
    ") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - return templ_7745c5c3_Err - }) -} - -var _ = templruntime.GeneratedTemplate diff --git a/internal/gui/elements/sizes.templ b/internal/gui/elements/sizes.templ deleted file mode 100644 index 40e70998d..000000000 --- a/internal/gui/elements/sizes.templ +++ /dev/null @@ -1,61 +0,0 @@ -package elements - -type Size int - -const ( - SizeDefault Size = iota - SizeSmall - SizeMedium - SizeLarge -) - -func (s Size) CardAttributes() templ.Attributes { - switch s { - case SizeSmall: - return templ.Attributes{ - "class": "max-w-lg bg-white border rounded-lg shadow-sm p-7 border-neutral-200/60", - } - case SizeLarge: - return templ.Attributes{ - "class": "max-w-2xl bg-white border rounded-lg shadow-sm p-7 border-neutral-200/60", - } - } - return templ.Attributes{ - "class": "max-w-xl bg-white border rounded-lg shadow-sm p-7 border-neutral-200/60", - } -} - -func (s Size) SvgAttributes() templ.Attributes { - switch s { - case SizeSmall: - return templ.Attributes{ - "height": "16", - "width": "16", - } - case SizeLarge: - return templ.Attributes{ - "height": "32", - "width": "32", - } - } - return templ.Attributes{ - "height": "24", - "width": "24", - } -} - -func (s Size) TextAttributes() templ.Attributes { - switch s { - case SizeSmall: - return templ.Attributes{ - "class": "text-sm", - } - case SizeLarge: - return templ.Attributes{ - "class": "text-lg", - } - } - return templ.Attributes{ - "class": "text-md", - } -} diff --git a/internal/gui/elements/sizes_templ.go b/internal/gui/elements/sizes_templ.go deleted file mode 100644 index 5a60b8fef..000000000 --- a/internal/gui/elements/sizes_templ.go +++ /dev/null @@ -1,71 +0,0 @@ -// Code generated by templ - DO NOT EDIT. - -// templ: version: v0.2.778 -package elements - -//lint:file-ignore SA4006 This context is only used if a nested component is present. - -import "github.com/a-h/templ" -import templruntime "github.com/a-h/templ/runtime" - -type Size int - -const ( - SizeDefault Size = iota - SizeSmall - SizeMedium - SizeLarge -) - -func (s Size) CardAttributes() templ.Attributes { - switch s { - case SizeSmall: - return templ.Attributes{ - "class": "max-w-lg bg-white border rounded-lg shadow-sm p-7 border-neutral-200/60", - } - case SizeLarge: - return templ.Attributes{ - "class": "max-w-2xl bg-white border rounded-lg shadow-sm p-7 border-neutral-200/60", - } - } - return templ.Attributes{ - "class": "max-w-xl bg-white border rounded-lg shadow-sm p-7 border-neutral-200/60", - } -} - -func (s Size) SvgAttributes() templ.Attributes { - switch s { - case SizeSmall: - return templ.Attributes{ - "height": "16", - "width": "16", - } - case SizeLarge: - return templ.Attributes{ - "height": "32", - "width": "32", - } - } - return templ.Attributes{ - "height": "24", - "width": "24", - } -} - -func (s Size) TextAttributes() templ.Attributes { - switch s { - case SizeSmall: - return templ.Attributes{ - "class": "text-sm", - } - case SizeLarge: - return templ.Attributes{ - "class": "text-lg", - } - } - return templ.Attributes{ - "class": "text-md", - } -} - -var _ = templruntime.GeneratedTemplate diff --git a/internal/gui/elements/tabs.templ b/internal/gui/elements/tabs.templ deleted file mode 100644 index 8b478f482..000000000 --- a/internal/gui/elements/tabs.templ +++ /dev/null @@ -1,109 +0,0 @@ -package elements - -templ Tabs() { -
    -
    - - - -
    -
    -
    -
    - @Table() -
    -
    - And, this is the content for Tab2 -
    -
    - Finally, this is the content for Tab3 -
    -
    -
    -} - -templ Table() { -
    -
    -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameAgeAddressAction
    Richard Hendricks30Pied Piper HQ, Palo Alto - Edit -
    Erlich Bachman405230 Penfield Ave, Woodland Hills - Edit -
    Monica Hall352030 Stewart Drive, Sunnyvale - Edit -
    Dinesh Chugtai28Pied Piper HQ, Palo Alto - Edit -
    Gilfoyle32Pied Piper HQ, Palo Alto - Edit -
    -
    -
    -
    -
    -} diff --git a/internal/gui/elements/tabs_templ.go b/internal/gui/elements/tabs_templ.go deleted file mode 100644 index 9b974744e..000000000 --- a/internal/gui/elements/tabs_templ.go +++ /dev/null @@ -1,77 +0,0 @@ -// Code generated by templ - DO NOT EDIT. - -// templ: version: v0.2.778 -package elements - -//lint:file-ignore SA4006 This context is only used if a nested component is present. - -import "github.com/a-h/templ" -import templruntime "github.com/a-h/templ/runtime" - -func Tabs() templ.Component { - return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { - templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { - return templ_7745c5c3_CtxErr - } - templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) - if !templ_7745c5c3_IsBuffer { - defer func() { - templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) - if templ_7745c5c3_Err == nil { - templ_7745c5c3_Err = templ_7745c5c3_BufErr - } - }() - } - ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var1 := templ.GetChildren(ctx) - if templ_7745c5c3_Var1 == nil { - templ_7745c5c3_Var1 = templ.NopComponent - } - ctx = templ.ClearChildren(ctx) - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
    ") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = Table().Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
    And, this is the content for Tab2
    Finally, this is the content for Tab3
    ") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - return templ_7745c5c3_Err - }) -} - -func Table() templ.Component { - return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { - templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { - return templ_7745c5c3_CtxErr - } - templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) - if !templ_7745c5c3_IsBuffer { - defer func() { - templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) - if templ_7745c5c3_Err == nil { - templ_7745c5c3_Err = templ_7745c5c3_BufErr - } - }() - } - ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var2 := templ.GetChildren(ctx) - if templ_7745c5c3_Var2 == nil { - templ_7745c5c3_Var2 = templ.NopComponent - } - ctx = templ.ClearChildren(ctx) - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
    NameAgeAddressAction
    Richard Hendricks30Pied Piper HQ, Palo AltoEdit
    Erlich Bachman405230 Penfield Ave, Woodland HillsEdit
    Monica Hall352030 Stewart Drive, SunnyvaleEdit
    Dinesh Chugtai28Pied Piper HQ, Palo AltoEdit
    Gilfoyle32Pied Piper HQ, Palo AltoEdit
    ") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - return templ_7745c5c3_Err - }) -} - -var _ = templruntime.GeneratedTemplate diff --git a/internal/gui/forms/forms.go b/internal/gui/forms/forms.go deleted file mode 100644 index 0b7e1ad5f..000000000 --- a/internal/gui/forms/forms.go +++ /dev/null @@ -1,41 +0,0 @@ -package forms - -import ( - "bytes" - - "github.com/a-h/templ" - "github.com/labstack/echo/v4" -) - -func echoFormResponse(c echo.Context, cmp templ.Component, state FormState) error { - // Create a buffer to store the rendered HTML - buf := &bytes.Buffer{} - // Render the component to the buffer - err := cmp.Render(c.Request().Context(), buf) - if err != nil { - return err - } - - // Set the content type - c.Response().Header().Set(echo.HeaderContentType, echo.MIMETextHTML) - c.Response().Header().Set("X-Status", string(state)) - - // Write the buffered content to the response - _, err = c.Response().Write(buf.Bytes()) - return err -} - -type FormState string - -const ( - InitialForm FormState = "initial" - ErrorForm FormState = "error" - SuccessForm FormState = "success" - WarningForm FormState = "warning" -) - -type Form struct { - State FormState - Title string - Description string -} diff --git a/internal/gui/forms/register.templ b/internal/gui/forms/register.templ deleted file mode 100644 index 76b0c1d99..000000000 --- a/internal/gui/forms/register.templ +++ /dev/null @@ -1,25 +0,0 @@ -package forms - -import "github.com/labstack/echo/v4" - -templ BasicInfo(c echo.Context, state FormState) { - switch (state) { - default: -
    -
    -

    Account

    -

    Make changes to your account here. Click save when you're done.

    -
    -
    -
    -
    -
    -
    - } -} - -templ CreateCredentials(state FormState) { -} - -templ PrivacyTerms(state FormState) { -} diff --git a/internal/gui/forms/register_templ.go b/internal/gui/forms/register_templ.go deleted file mode 100644 index a9309199a..000000000 --- a/internal/gui/forms/register_templ.go +++ /dev/null @@ -1,95 +0,0 @@ -// Code generated by templ - DO NOT EDIT. - -// templ: version: v0.2.778 -package forms - -//lint:file-ignore SA4006 This context is only used if a nested component is present. - -import "github.com/a-h/templ" -import templruntime "github.com/a-h/templ/runtime" - -import "github.com/labstack/echo/v4" - -func BasicInfo(c echo.Context, state FormState) templ.Component { - return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { - templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { - return templ_7745c5c3_CtxErr - } - templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) - if !templ_7745c5c3_IsBuffer { - defer func() { - templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) - if templ_7745c5c3_Err == nil { - templ_7745c5c3_Err = templ_7745c5c3_BufErr - } - }() - } - ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var1 := templ.GetChildren(ctx) - if templ_7745c5c3_Var1 == nil { - templ_7745c5c3_Var1 = templ.NopComponent - } - ctx = templ.ClearChildren(ctx) - switch state { - default: - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("

    Account

    Make changes to your account here. Click save when you're done.

    ") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - } - return templ_7745c5c3_Err - }) -} - -func CreateCredentials(state FormState) templ.Component { - return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { - templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { - return templ_7745c5c3_CtxErr - } - templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) - if !templ_7745c5c3_IsBuffer { - defer func() { - templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) - if templ_7745c5c3_Err == nil { - templ_7745c5c3_Err = templ_7745c5c3_BufErr - } - }() - } - ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var2 := templ.GetChildren(ctx) - if templ_7745c5c3_Var2 == nil { - templ_7745c5c3_Var2 = templ.NopComponent - } - ctx = templ.ClearChildren(ctx) - return templ_7745c5c3_Err - }) -} - -func PrivacyTerms(state FormState) templ.Component { - return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { - templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { - return templ_7745c5c3_CtxErr - } - templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) - if !templ_7745c5c3_IsBuffer { - defer func() { - templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) - if templ_7745c5c3_Err == nil { - templ_7745c5c3_Err = templ_7745c5c3_BufErr - } - }() - } - ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var3 := templ.GetChildren(ctx) - if templ_7745c5c3_Var3 == nil { - templ_7745c5c3_Var3 = templ.NopComponent - } - ctx = templ.ClearChildren(ctx) - return templ_7745c5c3_Err - }) -} - -var _ = templruntime.GeneratedTemplate diff --git a/internal/gui/views/home.templ b/internal/gui/views/home.templ deleted file mode 100644 index 34b505522..000000000 --- a/internal/gui/views/home.templ +++ /dev/null @@ -1,29 +0,0 @@ -package views - -import ( - "github.com/labstack/echo/v4" - "github.com/onsonr/sonr/internal/gui/elements" -) - -func HomeView(c echo.Context) error { - return echoComponentResponse(c, renderHomeView()) -} - -templ renderHomeView() { - @elements.Layout("Sonr.ID") { - @elements.Card("home-view", elements.SizeLarge) { - @elements.H1("Sonr.ID") - @elements.Text("A Decentralized Web Node Client for the Sonr Network.") - @elements.Spacer() -
    - @elements.Button(elements.GET("/register", "#home-view"), elements.PrimaryButtonStyle()) { - @elements.Text("Get Started") - } - @elements.Button(elements.GET("/login", "#home-view")) { - @elements.Text("Login") - } -
    - @elements.PoweredBySonr() - } - } -} diff --git a/internal/gui/views/home_templ.go b/internal/gui/views/home_templ.go deleted file mode 100644 index 1254e7d14..000000000 --- a/internal/gui/views/home_templ.go +++ /dev/null @@ -1,157 +0,0 @@ -// Code generated by templ - DO NOT EDIT. - -// templ: version: v0.2.778 -package views - -//lint:file-ignore SA4006 This context is only used if a nested component is present. - -import "github.com/a-h/templ" -import templruntime "github.com/a-h/templ/runtime" - -import ( - "github.com/labstack/echo/v4" - "github.com/onsonr/sonr/internal/gui/elements" -) - -func HomeView(c echo.Context) error { - return echoComponentResponse(c, renderHomeView()) -} - -func renderHomeView() templ.Component { - return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { - templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { - return templ_7745c5c3_CtxErr - } - templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) - if !templ_7745c5c3_IsBuffer { - defer func() { - templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) - if templ_7745c5c3_Err == nil { - templ_7745c5c3_Err = templ_7745c5c3_BufErr - } - }() - } - ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var1 := templ.GetChildren(ctx) - if templ_7745c5c3_Var1 == nil { - templ_7745c5c3_Var1 = templ.NopComponent - } - ctx = templ.ClearChildren(ctx) - templ_7745c5c3_Var2 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { - templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) - if !templ_7745c5c3_IsBuffer { - defer func() { - templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) - if templ_7745c5c3_Err == nil { - templ_7745c5c3_Err = templ_7745c5c3_BufErr - } - }() - } - ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var3 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { - templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) - if !templ_7745c5c3_IsBuffer { - defer func() { - templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) - if templ_7745c5c3_Err == nil { - templ_7745c5c3_Err = templ_7745c5c3_BufErr - } - }() - } - ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Err = elements.H1("Sonr.ID").Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = elements.Text("A Decentralized Web Node Client for the Sonr Network.").Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = elements.Spacer().Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
    ") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Var4 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { - templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) - if !templ_7745c5c3_IsBuffer { - defer func() { - templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) - if templ_7745c5c3_Err == nil { - templ_7745c5c3_Err = templ_7745c5c3_BufErr - } - }() - } - ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Err = elements.Text("Get Started").Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - return templ_7745c5c3_Err - }) - templ_7745c5c3_Err = elements.Button(elements.GET("/register", "#home-view"), elements.PrimaryButtonStyle()).Render(templ.WithChildren(ctx, templ_7745c5c3_Var4), templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Var5 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { - templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) - if !templ_7745c5c3_IsBuffer { - defer func() { - templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) - if templ_7745c5c3_Err == nil { - templ_7745c5c3_Err = templ_7745c5c3_BufErr - } - }() - } - ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Err = elements.Text("Login").Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - return templ_7745c5c3_Err - }) - templ_7745c5c3_Err = elements.Button(elements.GET("/login", "#home-view")).Render(templ.WithChildren(ctx, templ_7745c5c3_Var5), templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
    ") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = elements.PoweredBySonr().Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - return templ_7745c5c3_Err - }) - templ_7745c5c3_Err = elements.Card("home-view", elements.SizeLarge).Render(templ.WithChildren(ctx, templ_7745c5c3_Var3), templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - return templ_7745c5c3_Err - }) - templ_7745c5c3_Err = elements.Layout("Sonr.ID").Render(templ.WithChildren(ctx, templ_7745c5c3_Var2), templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - return templ_7745c5c3_Err - }) -} - -var _ = templruntime.GeneratedTemplate diff --git a/internal/gui/views/login.templ b/internal/gui/views/login.templ deleted file mode 100644 index 601dc0aae..000000000 --- a/internal/gui/views/login.templ +++ /dev/null @@ -1,25 +0,0 @@ -package views - -import ( - "github.com/labstack/echo/v4" - "github.com/onsonr/sonr/internal/gui/elements" -) - -func LoginView(c echo.Context) error { - return echoComponentResponse(c, renderLoginView()) -} - -templ renderLoginView() { - @elements.Layout("Login | Sonr.ID") { - @elements.Card("login-view", elements.SizeLarge) { - @elements.H1("Sonr.ID") - @elements.Text("Neo-tree is a file manager for NeoFS.") - @elements.Spacer() - @elements.RadioGroup() - @elements.Spacer() - @elements.Button(elements.GET("/", "#login-view")) { - @elements.Text("Cancel") - } - } - } -} diff --git a/internal/gui/views/login_templ.go b/internal/gui/views/login_templ.go deleted file mode 100644 index 87d103eb0..000000000 --- a/internal/gui/views/login_templ.go +++ /dev/null @@ -1,143 +0,0 @@ -// Code generated by templ - DO NOT EDIT. - -// templ: version: v0.2.778 -package views - -//lint:file-ignore SA4006 This context is only used if a nested component is present. - -import "github.com/a-h/templ" -import templruntime "github.com/a-h/templ/runtime" - -import ( - "github.com/labstack/echo/v4" - "github.com/onsonr/sonr/internal/gui/elements" -) - -func LoginView(c echo.Context) error { - return echoComponentResponse(c, renderLoginView()) -} - -func renderLoginView() templ.Component { - return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { - templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { - return templ_7745c5c3_CtxErr - } - templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) - if !templ_7745c5c3_IsBuffer { - defer func() { - templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) - if templ_7745c5c3_Err == nil { - templ_7745c5c3_Err = templ_7745c5c3_BufErr - } - }() - } - ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var1 := templ.GetChildren(ctx) - if templ_7745c5c3_Var1 == nil { - templ_7745c5c3_Var1 = templ.NopComponent - } - ctx = templ.ClearChildren(ctx) - templ_7745c5c3_Var2 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { - templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) - if !templ_7745c5c3_IsBuffer { - defer func() { - templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) - if templ_7745c5c3_Err == nil { - templ_7745c5c3_Err = templ_7745c5c3_BufErr - } - }() - } - ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var3 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { - templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) - if !templ_7745c5c3_IsBuffer { - defer func() { - templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) - if templ_7745c5c3_Err == nil { - templ_7745c5c3_Err = templ_7745c5c3_BufErr - } - }() - } - ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Err = elements.H1("Sonr.ID").Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = elements.Text("Neo-tree is a file manager for NeoFS.").Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = elements.Spacer().Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = elements.RadioGroup().Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = elements.Spacer().Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Var4 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { - templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) - if !templ_7745c5c3_IsBuffer { - defer func() { - templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) - if templ_7745c5c3_Err == nil { - templ_7745c5c3_Err = templ_7745c5c3_BufErr - } - }() - } - ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Err = elements.Text("Cancel").Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - return templ_7745c5c3_Err - }) - templ_7745c5c3_Err = elements.Button(elements.GET("/", "#login-view")).Render(templ.WithChildren(ctx, templ_7745c5c3_Var4), templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - return templ_7745c5c3_Err - }) - templ_7745c5c3_Err = elements.Card("login-view", elements.SizeLarge).Render(templ.WithChildren(ctx, templ_7745c5c3_Var3), templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - return templ_7745c5c3_Err - }) - templ_7745c5c3_Err = elements.Layout("Login | Sonr.ID").Render(templ.WithChildren(ctx, templ_7745c5c3_Var2), templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - return templ_7745c5c3_Err - }) -} - -var _ = templruntime.GeneratedTemplate diff --git a/internal/gui/views/openid.templ b/internal/gui/views/openid.templ deleted file mode 100644 index f09cdc270..000000000 --- a/internal/gui/views/openid.templ +++ /dev/null @@ -1,19 +0,0 @@ -package views - -import ( - "github.com/labstack/echo/v4" - "github.com/onsonr/sonr/internal/gui/elements" -) - -func AuthorizeView(c echo.Context) error { - return echoComponentResponse(c, renderAuthorizeView()) -} - -templ renderAuthorizeView() { - @elements.Layout("Login | Sonr.ID") { - @elements.Card("authorize-view", elements.SizeMedium) { - @elements.H1("Sonr.ID") - @elements.Text("Neo-tree is a file manager for NeoFS.") - } - } -} diff --git a/internal/gui/views/openid_templ.go b/internal/gui/views/openid_templ.go deleted file mode 100644 index d0c6a899a..000000000 --- a/internal/gui/views/openid_templ.go +++ /dev/null @@ -1,93 +0,0 @@ -// Code generated by templ - DO NOT EDIT. - -// templ: version: v0.2.778 -package views - -//lint:file-ignore SA4006 This context is only used if a nested component is present. - -import "github.com/a-h/templ" -import templruntime "github.com/a-h/templ/runtime" - -import ( - "github.com/labstack/echo/v4" - "github.com/onsonr/sonr/internal/gui/elements" -) - -func AuthorizeView(c echo.Context) error { - return echoComponentResponse(c, renderAuthorizeView()) -} - -func renderAuthorizeView() templ.Component { - return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { - templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { - return templ_7745c5c3_CtxErr - } - templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) - if !templ_7745c5c3_IsBuffer { - defer func() { - templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) - if templ_7745c5c3_Err == nil { - templ_7745c5c3_Err = templ_7745c5c3_BufErr - } - }() - } - ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var1 := templ.GetChildren(ctx) - if templ_7745c5c3_Var1 == nil { - templ_7745c5c3_Var1 = templ.NopComponent - } - ctx = templ.ClearChildren(ctx) - templ_7745c5c3_Var2 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { - templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) - if !templ_7745c5c3_IsBuffer { - defer func() { - templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) - if templ_7745c5c3_Err == nil { - templ_7745c5c3_Err = templ_7745c5c3_BufErr - } - }() - } - ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var3 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { - templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) - if !templ_7745c5c3_IsBuffer { - defer func() { - templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) - if templ_7745c5c3_Err == nil { - templ_7745c5c3_Err = templ_7745c5c3_BufErr - } - }() - } - ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Err = elements.H1("Sonr.ID").Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = elements.Text("Neo-tree is a file manager for NeoFS.").Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - return templ_7745c5c3_Err - }) - templ_7745c5c3_Err = elements.Card("authorize-view", elements.SizeMedium).Render(templ.WithChildren(ctx, templ_7745c5c3_Var3), templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - return templ_7745c5c3_Err - }) - templ_7745c5c3_Err = elements.Layout("Login | Sonr.ID").Render(templ.WithChildren(ctx, templ_7745c5c3_Var2), templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - return templ_7745c5c3_Err - }) -} - -var _ = templruntime.GeneratedTemplate diff --git a/internal/gui/views/profile.templ b/internal/gui/views/profile.templ deleted file mode 100644 index 25c272e99..000000000 --- a/internal/gui/views/profile.templ +++ /dev/null @@ -1,19 +0,0 @@ -package views - -import ( - "github.com/labstack/echo/v4" - "github.com/onsonr/sonr/internal/gui/elements" -) - -func ProfileView(c echo.Context) error { - return echoComponentResponse(c, renderProfileView()) -} - -templ renderProfileView() { - @elements.Layout("Profile | Sonr.ID") { - @elements.Card("profile-view", elements.SizeLarge) { - @elements.ProfileCard() - @elements.Tabs() - } - } -} diff --git a/internal/gui/views/profile_templ.go b/internal/gui/views/profile_templ.go deleted file mode 100644 index 08af9920c..000000000 --- a/internal/gui/views/profile_templ.go +++ /dev/null @@ -1,93 +0,0 @@ -// Code generated by templ - DO NOT EDIT. - -// templ: version: v0.2.778 -package views - -//lint:file-ignore SA4006 This context is only used if a nested component is present. - -import "github.com/a-h/templ" -import templruntime "github.com/a-h/templ/runtime" - -import ( - "github.com/labstack/echo/v4" - "github.com/onsonr/sonr/internal/gui/elements" -) - -func ProfileView(c echo.Context) error { - return echoComponentResponse(c, renderProfileView()) -} - -func renderProfileView() templ.Component { - return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { - templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { - return templ_7745c5c3_CtxErr - } - templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) - if !templ_7745c5c3_IsBuffer { - defer func() { - templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) - if templ_7745c5c3_Err == nil { - templ_7745c5c3_Err = templ_7745c5c3_BufErr - } - }() - } - ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var1 := templ.GetChildren(ctx) - if templ_7745c5c3_Var1 == nil { - templ_7745c5c3_Var1 = templ.NopComponent - } - ctx = templ.ClearChildren(ctx) - templ_7745c5c3_Var2 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { - templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) - if !templ_7745c5c3_IsBuffer { - defer func() { - templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) - if templ_7745c5c3_Err == nil { - templ_7745c5c3_Err = templ_7745c5c3_BufErr - } - }() - } - ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var3 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { - templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) - if !templ_7745c5c3_IsBuffer { - defer func() { - templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) - if templ_7745c5c3_Err == nil { - templ_7745c5c3_Err = templ_7745c5c3_BufErr - } - }() - } - ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Err = elements.ProfileCard().Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = elements.Tabs().Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - return templ_7745c5c3_Err - }) - templ_7745c5c3_Err = elements.Card("profile-view", elements.SizeLarge).Render(templ.WithChildren(ctx, templ_7745c5c3_Var3), templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - return templ_7745c5c3_Err - }) - templ_7745c5c3_Err = elements.Layout("Profile | Sonr.ID").Render(templ.WithChildren(ctx, templ_7745c5c3_Var2), templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - return templ_7745c5c3_Err - }) -} - -var _ = templruntime.GeneratedTemplate diff --git a/internal/gui/views/register.templ b/internal/gui/views/register.templ deleted file mode 100644 index 076d4d992..000000000 --- a/internal/gui/views/register.templ +++ /dev/null @@ -1,26 +0,0 @@ -package views - -import ( - "github.com/labstack/echo/v4" - "github.com/onsonr/sonr/internal/gui/elements" - "github.com/onsonr/sonr/internal/gui/forms" -) - -func RegisterView(c echo.Context) error { - return echoComponentResponse(c, renderRegisterView(c)) -} - -templ renderRegisterView(c echo.Context) { - @elements.Layout("Register | Sonr.ID") { - @elements.Card("register-view", elements.SizeMedium) { - @elements.H2("Account Registration") - @elements.Spacer() - @elements.Breadcrumbs() - @forms.BasicInfo(c, forms.InitialForm) - @elements.Spacer() - @elements.Button(elements.GET("/", "#register-view")) { - @elements.Text("Cancel") - } - } - } -} diff --git a/internal/gui/views/register_templ.go b/internal/gui/views/register_templ.go deleted file mode 100644 index d54ee67bd..000000000 --- a/internal/gui/views/register_templ.go +++ /dev/null @@ -1,144 +0,0 @@ -// Code generated by templ - DO NOT EDIT. - -// templ: version: v0.2.778 -package views - -//lint:file-ignore SA4006 This context is only used if a nested component is present. - -import "github.com/a-h/templ" -import templruntime "github.com/a-h/templ/runtime" - -import ( - "github.com/labstack/echo/v4" - "github.com/onsonr/sonr/internal/gui/elements" - "github.com/onsonr/sonr/internal/gui/forms" -) - -func RegisterView(c echo.Context) error { - return echoComponentResponse(c, renderRegisterView(c)) -} - -func renderRegisterView(c echo.Context) templ.Component { - return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { - templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { - return templ_7745c5c3_CtxErr - } - templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) - if !templ_7745c5c3_IsBuffer { - defer func() { - templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) - if templ_7745c5c3_Err == nil { - templ_7745c5c3_Err = templ_7745c5c3_BufErr - } - }() - } - ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var1 := templ.GetChildren(ctx) - if templ_7745c5c3_Var1 == nil { - templ_7745c5c3_Var1 = templ.NopComponent - } - ctx = templ.ClearChildren(ctx) - templ_7745c5c3_Var2 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { - templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) - if !templ_7745c5c3_IsBuffer { - defer func() { - templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) - if templ_7745c5c3_Err == nil { - templ_7745c5c3_Err = templ_7745c5c3_BufErr - } - }() - } - ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var3 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { - templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) - if !templ_7745c5c3_IsBuffer { - defer func() { - templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) - if templ_7745c5c3_Err == nil { - templ_7745c5c3_Err = templ_7745c5c3_BufErr - } - }() - } - ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Err = elements.H2("Account Registration").Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = elements.Spacer().Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = elements.Breadcrumbs().Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = forms.BasicInfo(c, forms.InitialForm).Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = elements.Spacer().Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Var4 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { - templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) - if !templ_7745c5c3_IsBuffer { - defer func() { - templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) - if templ_7745c5c3_Err == nil { - templ_7745c5c3_Err = templ_7745c5c3_BufErr - } - }() - } - ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Err = elements.Text("Cancel").Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - return templ_7745c5c3_Err - }) - templ_7745c5c3_Err = elements.Button(elements.GET("/", "#register-view")).Render(templ.WithChildren(ctx, templ_7745c5c3_Var4), templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - return templ_7745c5c3_Err - }) - templ_7745c5c3_Err = elements.Card("register-view", elements.SizeMedium).Render(templ.WithChildren(ctx, templ_7745c5c3_Var3), templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - return templ_7745c5c3_Err - }) - templ_7745c5c3_Err = elements.Layout("Register | Sonr.ID").Render(templ.WithChildren(ctx, templ_7745c5c3_Var2), templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - return templ_7745c5c3_Err - }) -} - -var _ = templruntime.GeneratedTemplate diff --git a/internal/mdw/authz.go b/internal/mdw/authz.go deleted file mode 100644 index c9fcc5153..000000000 --- a/internal/mdw/authz.go +++ /dev/null @@ -1,95 +0,0 @@ -package mdw - -import ( - "fmt" - "net/http" - "time" - - "github.com/labstack/echo/v4" - "gopkg.in/macaroon.v2" -) - -const ( - OriginMacroonCaveat MacroonCaveat = "origin" - ScopesMacroonCaveat MacroonCaveat = "scopes" - SubjectMacroonCaveat MacroonCaveat = "subject" - ExpMacroonCaveat MacroonCaveat = "exp" - TokenMacroonCaveat MacroonCaveat = "token" -) - -type MacroonCaveat string - -func (c MacroonCaveat) Equal(other string) bool { - return string(c) == other -} - -func (c MacroonCaveat) String() string { - return string(c) -} - -func (c MacroonCaveat) Verify(value string) error { - switch c { - case OriginMacroonCaveat: - return nil - case ScopesMacroonCaveat: - return nil - case SubjectMacroonCaveat: - return nil - case ExpMacroonCaveat: - // Check if the expiration time is still valid - exp, err := time.Parse(time.RFC3339, value) - if err != nil { - return err - } - if time.Now().After(exp) { - return fmt.Errorf("expired") - } - return nil - case TokenMacroonCaveat: - return nil - default: - return fmt.Errorf("unknown caveat: %s", c) - } -} - -var MacroonCaveats = []MacroonCaveat{OriginMacroonCaveat, ScopesMacroonCaveat, SubjectMacroonCaveat, ExpMacroonCaveat, TokenMacroonCaveat} - -func MacaroonMiddleware(secretKeyStr string, location string) echo.MiddlewareFunc { - secretKey := []byte(secretKeyStr) - return func(next echo.HandlerFunc) echo.HandlerFunc { - return func(c echo.Context) error { - // Extract the macaroon from the Authorization header - auth := c.Request().Header.Get("Authorization") - if auth == "" { - return c.JSON(http.StatusUnauthorized, map[string]string{"error": "Missing Authorization header"}) - } - - // Decode the macaroon - mac, err := macaroon.Base64Decode([]byte(auth)) - if err != nil { - return c.JSON(http.StatusBadRequest, map[string]string{"error": "Invalid macaroon encoding"}) - } - - token, err := macaroon.New(secretKey, mac, location, macaroon.LatestVersion) - if err != nil { - return c.JSON(http.StatusBadRequest, map[string]string{"error": "Invalid macaroon"}) - } - - // Verify the macaroon - err = token.Verify(secretKey, func(caveat string) error { - for _, c := range MacroonCaveats { - if c.String() == caveat { - return nil - } - } - return nil // Return nil if the caveat is valid - }, nil) - if err != nil { - return c.JSON(http.StatusUnauthorized, map[string]string{"error": "Invalid macaroon"}) - } - - // Macaroon is valid, proceed to the next handler - return next(c) - } - } -} diff --git a/internal/mdw/client.go b/internal/mdw/client.go deleted file mode 100644 index c7be79ac1..000000000 --- a/internal/mdw/client.go +++ /dev/null @@ -1,3 +0,0 @@ -package mdw - -type AuthClient struct{} diff --git a/internal/mdw/headers.go b/internal/mdw/headers.go deleted file mode 100644 index 68fa253ed..000000000 --- a/internal/mdw/headers.go +++ /dev/null @@ -1,55 +0,0 @@ -package mdw - -type RequestHeaders struct { - Authorization *string `header:"Authorization"` - CacheControl *string `header:"Cache-Control"` - DeviceMemory *string `header:"Device-Memory"` - Forwarded *string `header:"Forwarded"` - From *string `header:"From"` - Host *string `header:"Host"` - Link *string `header:"Link"` - PermissionsPolicy *string `header:"Permissions-Policy"` - ProxyAuthorization *string `header:"Proxy-Authorization"` - Referer *string `header:"Referer"` - UserAgent *string `header:"User-Agent"` - ViewportWidth *string `header:"Viewport-Width"` - Width *string `header:"Width"` - WWWAuthenticate *string `header:"WWW-Authenticate"` - - // HTMX Specific - HXBoosted *string `header:"HX-Boosted"` - HXCurrentURL *string `header:"HX-Current-URL"` - HXHistoryRestoreRequest *string `header:"HX-History-Restore-Request"` - HXPrompt *string `header:"HX-Prompt"` - HXRequest *string `header:"HX-Request"` - HXTarget *string `header:"HX-Target"` - HXTriggerName *string `header:"HX-Trigger-Name"` - HXTrigger *string `header:"HX-Trigger"` -} - -type ResponseHeaders struct { - AcceptCH *string `header:"Accept-CH"` - AccessControlAllowCredentials *string `header:"Access-Control-Allow-Credentials"` - AccessControlAllowHeaders *string `header:"Access-Control-Allow-Headers"` - AccessControlAllowMethods *string `header:"Access-Control-Allow-Methods"` - AccessControlExposeHeaders *string `header:"Access-Control-Expose-Headers"` - AccessControlRequestHeaders *string `header:"Access-Control-Request-Headers"` - ContentSecurityPolicy *string `header:"Content-Security-Policy"` - CrossOriginEmbedderPolicy *string `header:"Cross-Origin-Embedder-Policy"` - PermissionsPolicy *string `header:"Permissions-Policy"` - ProxyAuthorization *string `header:"Proxy-Authorization"` - WWWAuthenticate *string `header:"WWW-Authenticate"` - - // HTMX Specific - HXLocation *string `header:"HX-Location"` - HXPushURL *string `header:"HX-Push-Url"` - HXRedirect *string `header:"HX-Redirect"` - HXRefresh *string `header:"HX-Refresh"` - HXReplaceURL *string `header:"HX-Replace-Url"` - HXReswap *string `header:"HX-Reswap"` - HXRetarget *string `header:"HX-Retarget"` - HXReselect *string `header:"HX-Reselect"` - HXTrigger *string `header:"HX-Trigger"` - HXTriggerAfterSettle *string `header:"HX-Trigger-After-Settle"` - HXTriggerAfterSwap *string `header:"HX-Trigger-After-Swap"` -} diff --git a/internal/mdw/session.go b/internal/mdw/session.go deleted file mode 100644 index 8907bc1e2..000000000 --- a/internal/mdw/session.go +++ /dev/null @@ -1,72 +0,0 @@ -package mdw - -import ( - "net/http" - "time" - - "github.com/donseba/go-htmx" - "github.com/labstack/echo/v4" - "github.com/onsonr/sonr/internal/db" - "github.com/segmentio/ksuid" -) - -type Session struct { - echo.Context - htmx *htmx.HTMX - dB *db.DB -} - -// GetSession returns the current Session -func GetSession(c echo.Context) *Session { - return c.(*Session) -} - -// UseSession establishes a Session Cookie. -func UseSession(next echo.HandlerFunc) echo.HandlerFunc { - return func(c echo.Context) error { - sc := initSession(c) - headers := new(RequestHeaders) - sc.Bind(headers) - return next(sc) - } -} - -func (c *Session) DB() *db.DB { - return c.dB -} - -func (c *Session) Htmx() *htmx.HTMX { - return c.htmx -} - -func (c *Session) ID() string { - return readCookie(c, "session") -} - -func initSession(c echo.Context) *Session { - s := &Session{Context: c} - if val := readCookie(c, "session"); val == "" { - id := ksuid.New().String() - writeCookie(c, "session", id) - } - return s -} - -func readCookie(c echo.Context, key string) string { - cookie, err := c.Cookie(key) - if err != nil { - return "" - } - if cookie == nil { - return "" - } - return cookie.Value -} - -func writeCookie(c echo.Context, key string, value string) { - cookie := new(http.Cookie) - cookie.Name = key - cookie.Value = value - cookie.Expires = time.Now().Add(24 * time.Hour) - c.SetCookie(cookie) -} diff --git a/internal/svc/openid.go b/internal/svc/openid.go deleted file mode 100644 index 78b97119f..000000000 --- a/internal/svc/openid.go +++ /dev/null @@ -1,46 +0,0 @@ -package svc - -import ( - "fmt" - - "github.com/labstack/echo/v4" - oidc "github.com/onsonr/sonr/x/did/types/oidc" -) - -func GrantAuthorization(e echo.Context) error { - // Implement authorization endpoint using passkey authentication - // Store session data in cache - return nil -} - -func GetJWKS(e echo.Context) error { - // Implement token endpoint - // Use cached session data for validation - return nil -} - -func GetToken(e echo.Context) error { - // Implement token endpoint - // Use cached session data for validation - return nil -} - -func GetDiscovery(e echo.Context) error { - baseURL := "https://" + e.Request().Host // Ensure this is the correct base URL for your service - discoveryDoc := &oidc.DiscoveryDocument{ - Issuer: baseURL, - AuthorizationEndpoint: fmt.Sprintf("%s/auth", baseURL), - TokenEndpoint: fmt.Sprintf("%s/token", baseURL), - UserinfoEndpoint: fmt.Sprintf("%s/userinfo", baseURL), - JwksUri: fmt.Sprintf("%s/jwks", baseURL), - RegistrationEndpoint: fmt.Sprintf("%s/register", baseURL), - ScopesSupported: []string{"openid", "profile", "email", "web3", "sonr"}, - ResponseTypesSupported: []string{"code"}, - ResponseModesSupported: []string{"query", "form_post"}, - GrantTypesSupported: []string{"authorization_code", "refresh_token"}, - AcrValuesSupported: []string{"passkey"}, - SubjectTypesSupported: []string{"public"}, - ClaimsSupported: []string{"sub", "iss", "name", "email"}, - } - return e.JSON(200, discoveryDoc) -} diff --git a/internal/svc/webauth.go b/internal/svc/webauth.go deleted file mode 100644 index ac08255c7..000000000 --- a/internal/svc/webauth.go +++ /dev/null @@ -1,43 +0,0 @@ -package svc - -import ( - "encoding/json" - "fmt" - - "github.com/go-webauthn/webauthn/protocol" - "github.com/labstack/echo/v4" -) - -func CheckSubjectIsValid(e echo.Context) error { - credentialID := e.FormValue("credentialID") - return e.JSON(200, credentialID) -} - -func HandleCredentialAssertion(e echo.Context) error { - return e.JSON(200, "HandleCredentialAssertion") -} - -func HandleCredentialCreation(e echo.Context) error { - // Get the serialized credential data from the form - credentialDataJSON := e.FormValue("credentialData") - - // Deserialize the JSON into a temporary struct - var ccr protocol.CredentialCreationResponse - err := json.Unmarshal([]byte(credentialDataJSON), &ccr) - if err != nil { - return e.JSON(500, err.Error()) - } - // - // // Parse the CredentialCreationResponse - // parsedData, err := ccr.Parse() - // if err != nil { - // return e.JSON(500, err.Error()) - // } - // - // // Create the Credential - // // credential := orm.NewCredential(parsedData, e.Request().Host, "") - // - // // Set additional fields - // credential.Controller = "" // Set this to the appropriate controller value - return e.JSON(200, fmt.Sprintf("REGISTER: %s", string(ccr.ID))) -} diff --git a/internal/tui/authmodel/authmodel.go b/internal/tui/authmodel/authmodel.go deleted file mode 100644 index 2f83c115f..000000000 --- a/internal/tui/authmodel/authmodel.go +++ /dev/null @@ -1,322 +0,0 @@ -package txmodel - -import ( - "fmt" - "strings" - - tea "github.com/charmbracelet/bubbletea" - "github.com/charmbracelet/huh" - "github.com/charmbracelet/lipgloss" - "github.com/cosmos/cosmos-sdk/codec" - codectypes "github.com/cosmos/cosmos-sdk/codec/types" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/tx" - banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" -) - -const maxWidth = 100 - -var ( - red = lipgloss.AdaptiveColor{Light: "#FE5F86", Dark: "#FE5F86"} - indigo = lipgloss.AdaptiveColor{Light: "#5A56E0", Dark: "#7571F9"} - green = lipgloss.AdaptiveColor{Light: "#02BA84", Dark: "#02BF87"} -) - -type Styles struct { - Base, - HeaderText, - Status, - StatusHeader, - Highlight, - ErrorHeaderText, - Help lipgloss.Style -} - -func NewStyles(lg *lipgloss.Renderer) *Styles { - s := Styles{} - s.Base = lg.NewStyle(). - Padding(1, 2, 0, 1) - s.HeaderText = lg.NewStyle(). - Foreground(indigo). - Bold(true). - Padding(0, 1, 0, 1) - s.Status = lg.NewStyle(). - Border(lipgloss.RoundedBorder()). - BorderForeground(indigo). - PaddingLeft(1). - MarginTop(1) - s.StatusHeader = lg.NewStyle(). - Foreground(green). - Bold(true) - s.Highlight = lg.NewStyle(). - Foreground(lipgloss.Color("212")) - s.ErrorHeaderText = s.HeaderText. - Foreground(red) - s.Help = lg.NewStyle(). - Foreground(lipgloss.Color("240")) - return &s -} - -type state int - -const ( - statusNormal state = iota - stateDone -) - -type Model struct { - state state - lg *lipgloss.Renderer - styles *Styles - form *huh.Form - width int - message *tx.TxBody -} - -func NewModel() Model { - m := Model{width: maxWidth} - m.lg = lipgloss.DefaultRenderer() - m.styles = NewStyles(m.lg) - - m.form = huh.NewForm( - huh.NewGroup( - huh.NewInput(). - Key("from"). - Title("From Address"). - Placeholder("cosmos1..."). - Validate(func(s string) error { - if !strings.HasPrefix(s, "cosmos1") { - return fmt.Errorf("invalid address format") - } - return nil - }), - - huh.NewInput(). - Key("to"). - Title("To Address"). - Placeholder("cosmos1..."). - Validate(func(s string) error { - if !strings.HasPrefix(s, "cosmos1") { - return fmt.Errorf("invalid address format") - } - return nil - }), - - huh.NewInput(). - Key("amount"). - Title("Amount"). - Placeholder("100"). - Validate(func(s string) error { - if _, err := sdk.ParseCoinNormalized(s + "atom"); err != nil { - return fmt.Errorf("invalid coin amount") - } - return nil - }), - - huh.NewSelect[string](). - Key("denom"). - Title("Denom"). - Options(huh.NewOptions("atom", "osmo", "usnr", "snr")...), - - huh.NewInput(). - Key("memo"). - Title("Memo"). - Placeholder("Optional"), - - huh.NewConfirm(). - Key("done"). - Title("Ready to convert?"). - Validate(func(v bool) error { - if !v { - return fmt.Errorf("Please confirm when you're ready to convert") - } - return nil - }). - Affirmative("Yes, convert!"). - Negative("Not yet"), - ), - ). - WithWidth(60). - WithShowHelp(false). - WithShowErrors(false) - - return m -} - -func (m Model) Init() tea.Cmd { - return m.form.Init() -} - -func min(x, y int) int { - if x > y { - return y - } - return x -} - -func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) { - switch msg := msg.(type) { - case tea.WindowSizeMsg: - m.width = min(msg.Width, maxWidth) - m.styles.Base.GetHorizontalFrameSize() - case tea.KeyMsg: - switch msg.String() { - case "esc", "ctrl+c", "q": - return m, tea.Quit - } - } - - var cmds []tea.Cmd - - form, cmd := m.form.Update(msg) - if f, ok := form.(*huh.Form); ok { - m.form = f - cmds = append(cmds, cmd) - } - - if m.form.State == huh.StateCompleted { - m.buildMessage() - cmds = append(cmds, tea.Quit) - } - - return m, tea.Batch(cmds...) -} - -func (m Model) View() string { - s := m.styles - - switch m.form.State { - case huh.StateCompleted: - pklCode := m.generatePkl() - messageView := m.getMessageView() - var b strings.Builder - fmt.Fprintf(&b, "Final Tx:\n\n%s\n\n%s", pklCode, messageView) - return s.Status.Margin(0, 1).Padding(1, 2).Width(80).Render(b.String()) + "\n\n" - default: - var schemaType string - if m.form.GetString("schemaType") != "" { - schemaType = "Schema Type: " + m.form.GetString("schemaType") - } - - v := strings.TrimSuffix(m.form.View(), "\n\n") - form := m.lg.NewStyle().Margin(1, 0).Render(v) - - var status string - { - preview := "(Preview will appear here)" - if m.form.GetString("schema") != "" { - preview = m.generatePkl() - } - - const statusWidth = 40 - statusMarginLeft := m.width - statusWidth - lipgloss.Width(form) - s.Status.GetMarginRight() - status = s.Status. - Height(lipgloss.Height(form)). - Width(statusWidth). - MarginLeft(statusMarginLeft). - Render(s.StatusHeader.Render("Pkl Preview") + "\n" + - schemaType + "\n\n" + - preview) - } - - errors := m.form.Errors() - header := m.appBoundaryView("Sonr TX Builder") - if len(errors) > 0 { - header = m.appErrorBoundaryView(m.errorView()) - } - body := lipgloss.JoinHorizontal(lipgloss.Top, form, status) - - footer := m.appBoundaryView(m.form.Help().ShortHelpView(m.form.KeyBinds())) - if len(errors) > 0 { - footer = m.appErrorBoundaryView("") - } - - return s.Base.Render(header + "\n" + body + "\n\n" + footer) - } -} - -func (m Model) errorView() string { - var s string - for _, err := range m.form.Errors() { - s += err.Error() - } - return s -} - -func (m Model) appBoundaryView(text string) string { - return lipgloss.PlaceHorizontal( - m.width, - lipgloss.Left, - m.styles.HeaderText.Render(text), - lipgloss.WithWhitespaceChars("="), - lipgloss.WithWhitespaceForeground(indigo), - ) -} - -func (m Model) appErrorBoundaryView(text string) string { - return lipgloss.PlaceHorizontal( - m.width, - lipgloss.Left, - m.styles.ErrorHeaderText.Render(text), - lipgloss.WithWhitespaceChars("="), - lipgloss.WithWhitespaceForeground(red), - ) -} - -func (m Model) generatePkl() string { - schemaType := m.form.GetString("schemaType") - schema := m.form.GetString("schema") - - // This is a placeholder for the actual conversion logic - // In a real implementation, you would parse the schema and generate Pkl code - return fmt.Sprintf("// Converted from %s\n\nclass ConvertedSchema {\n // TODO: Implement conversion from %s\n // Original schema:\n /*\n%s\n */\n}", schemaType, schemaType, schema) -} - -func (m *Model) buildMessage() { - from := m.form.GetString("from") - to := m.form.GetString("to") - amount := m.form.GetString("amount") - denom := m.form.GetString("denom") - memo := m.form.GetString("memo") - - coin, _ := sdk.ParseCoinNormalized(fmt.Sprintf("%s%s", amount, denom)) - sendMsg := &banktypes.MsgSend{ - FromAddress: from, - ToAddress: to, - Amount: sdk.NewCoins(coin), - } - - anyMsg, _ := codectypes.NewAnyWithValue(sendMsg) - m.message = &tx.TxBody{ - Messages: []*codectypes.Any{anyMsg}, - Memo: memo, - } -} - -func (m Model) getMessageView() string { - if m.message == nil { - return "Current Message: None" - } - - interfaceRegistry := codectypes.NewInterfaceRegistry() - marshaler := codec.NewProtoCodec(interfaceRegistry) - jsonBytes, _ := marshaler.MarshalJSON(m.message) - - return fmt.Sprintf("Current Message:\n%s", string(jsonBytes)) -} - -func RunTUIForm() (*tx.TxBody, error) { - m := NewModel() - p := tea.NewProgram(m) - - finalModel, err := p.Run() - if err != nil { - return nil, fmt.Errorf("failed to run program: %w", err) - } - - finalM, ok := finalModel.(Model) - if !ok || finalM.message == nil { - return nil, fmt.Errorf("form not completed") - } - - return finalM.message, nil -} diff --git a/internal/tui/dexmodel/dexmodel.go b/internal/tui/dexmodel/dexmodel.go deleted file mode 100644 index c6a77a8d8..000000000 --- a/internal/tui/dexmodel/dexmodel.go +++ /dev/null @@ -1,165 +0,0 @@ -package dexmodel - -import ( - "fmt" - "time" - - "github.com/charmbracelet/bubbles/table" - tea "github.com/charmbracelet/bubbletea" - "github.com/charmbracelet/lipgloss" - "github.com/spf13/cobra" -) - -var ( - subtle = lipgloss.AdaptiveColor{Light: "#D9DCCF", Dark: "#383838"} - highlight = lipgloss.AdaptiveColor{Light: "#874BFD", Dark: "#7D56F4"} - special = lipgloss.AdaptiveColor{Light: "#43BF6D", Dark: "#73F59F"} - - titleStyle = lipgloss.NewStyle(). - MarginLeft(1). - MarginRight(5). - Padding(0, 1). - Italic(true). - Foreground(lipgloss.Color("#FFF7DB")). - SetString("Cosmos Block Explorer") - - infoStyle = lipgloss.NewStyle(). - BorderStyle(lipgloss.NormalBorder()). - BorderTop(true). - BorderForeground(subtle) -) - -type model struct { - blocks []string - transactionTable table.Model - stats map[string]string - width int - height int -} - -func initialModel() model { - columns := []table.Column{ - {Title: "Hash", Width: 10}, - {Title: "Type", Width: 15}, - {Title: "Height", Width: 10}, - {Title: "Time", Width: 20}, - } - - rows := []table.Row{ - {"abc123", "Transfer", "1000", time.Now().Format(time.RFC3339)}, - {"def456", "Delegate", "999", time.Now().Add(-1 * time.Minute).Format(time.RFC3339)}, - {"ghi789", "Vote", "998", time.Now().Add(-2 * time.Minute).Format(time.RFC3339)}, - } - - t := table.New( - table.WithColumns(columns), - table.WithRows(rows), - table.WithFocused(true), - table.WithHeight(7), - ) - - s := table.DefaultStyles() - s.Header = s.Header. - BorderStyle(lipgloss.NormalBorder()). - BorderForeground(lipgloss.Color("240")). - BorderBottom(true). - Bold(false) - s.Selected = s.Selected. - Foreground(lipgloss.Color("229")). - Background(lipgloss.Color("57")). - Bold(false) - t.SetStyles(s) - - return model{ - blocks: []string{"Block 1", "Block 2", "Block 3"}, - transactionTable: t, - stats: map[string]string{ - "Latest Block": "1000", - "Validators": "100", - "Bonded Tokens": "1,000,000", - }, - } -} - -func (m model) Init() tea.Cmd { - return tick -} - -func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) { - var cmd tea.Cmd - switch msg := msg.(type) { - case tea.KeyMsg: - switch msg.String() { - case "q", "ctrl+c": - return m, tea.Quit - case "enter": - return m, tea.Batch( - tea.Printf("Selected transaction: %s", m.transactionTable.SelectedRow()[0]), - ) - } - case tea.WindowSizeMsg: - m.height = msg.Height - m.width = msg.Width - case tickMsg: - // Update data here - m.blocks = append([]string{"New Block"}, m.blocks...) - if len(m.blocks) > 5 { - m.blocks = m.blocks[:5] - } - - // Add a new transaction to the table - newRow := table.Row{ - fmt.Sprintf("tx%d", time.Now().Unix()), - "NewTxType", - fmt.Sprintf("%d", 1000+len(m.transactionTable.Rows())), - time.Now().Format(time.RFC3339), - } - m.transactionTable.SetRows(append([]table.Row{newRow}, m.transactionTable.Rows()...)) - if len(m.transactionTable.Rows()) > 10 { - m.transactionTable.SetRows(m.transactionTable.Rows()[:10]) - } - - return m, tick - } - m.transactionTable, cmd = m.transactionTable.Update(msg) - return m, cmd -} - -func (m model) View() string { - s := titleStyle.Render("Cosmos Block Explorer") - s += "\n\n" - - // Blocks - s += lipgloss.NewStyle().Bold(true).Render("Recent Blocks") + "\n" - for _, block := range m.blocks { - s += "• " + block + "\n" - } - s += "\n" - - // Transactions - s += lipgloss.NewStyle().Bold(true).Render("Recent Transactions") + "\n" - s += m.transactionTable.View() + "\n\n" - - // Stats - s += lipgloss.NewStyle().Bold(true).Render("Network Statistics") + "\n" - for key, value := range m.stats { - s += fmt.Sprintf("%s: %s\n", key, value) - } - - return s -} - -type tickMsg time.Time - -func tick() tea.Msg { - time.Sleep(time.Second) - return tickMsg{} -} - -func RunExplorerTUI(cmd *cobra.Command, args []string) error { - p := tea.NewProgram(initialModel(), tea.WithAltScreen()) - if _, err := p.Run(); err != nil { - return fmt.Errorf("error running explorer: %v", err) - } - return nil -} diff --git a/internal/tui/tui.go b/internal/tui/tui.go deleted file mode 100644 index 0ac4d76c0..000000000 --- a/internal/tui/tui.go +++ /dev/null @@ -1,49 +0,0 @@ -package tui - -import ( - "fmt" - - "github.com/cosmos/cosmos-sdk/codec" - codectypes "github.com/cosmos/cosmos-sdk/codec/types" - "github.com/onsonr/sonr/internal/tui/dexmodel" - "github.com/onsonr/sonr/internal/tui/txmodel" - "github.com/spf13/cobra" -) - -func AddTUICmds(rootCmd *cobra.Command) { - rootCmd.AddCommand(newBuildTxnTUICmd()) - rootCmd.AddCommand(newExplorerTUICmd()) -} - -func newBuildTxnTUICmd() *cobra.Command { - return &cobra.Command{ - Use: "dash", - Short: "TUI for managing the local Sonr validator node", - RunE: func(cmd *cobra.Command, args []string) error { - txBody, err := txmodel.RunBuildTxnTUI() - if err != nil { - return err - } - - interfaceRegistry := codectypes.NewInterfaceRegistry() - marshaler := codec.NewProtoCodec(interfaceRegistry) - jsonBytes, err := marshaler.MarshalJSON(txBody) - if err != nil { - return fmt.Errorf("failed to marshal tx body: %w", err) - } - - fmt.Println("Generated Protobuf Message (JSON format):") - fmt.Println(string(jsonBytes)) - - return nil - }, - } -} - -func newExplorerTUICmd() *cobra.Command { - return &cobra.Command{ - Use: "cosmos-explorer", - Short: "A terminal-based Cosmos blockchain explorer", - RunE: dexmodel.RunExplorerTUI, - } -} diff --git a/internal/tui/txmodel/txmodel.go b/internal/tui/txmodel/txmodel.go deleted file mode 100644 index 4c493ad24..000000000 --- a/internal/tui/txmodel/txmodel.go +++ /dev/null @@ -1,322 +0,0 @@ -package txmodel - -import ( - "fmt" - "strings" - - tea "github.com/charmbracelet/bubbletea" - "github.com/charmbracelet/huh" - "github.com/charmbracelet/lipgloss" - "github.com/cosmos/cosmos-sdk/codec" - codectypes "github.com/cosmos/cosmos-sdk/codec/types" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/tx" - banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" -) - -const maxWidth = 100 - -var ( - red = lipgloss.AdaptiveColor{Light: "#FE5F86", Dark: "#FE5F86"} - indigo = lipgloss.AdaptiveColor{Light: "#5A56E0", Dark: "#7571F9"} - green = lipgloss.AdaptiveColor{Light: "#02BA84", Dark: "#02BF87"} -) - -type Styles struct { - Base, - HeaderText, - Status, - StatusHeader, - Highlight, - ErrorHeaderText, - Help lipgloss.Style -} - -func NewStyles(lg *lipgloss.Renderer) *Styles { - s := Styles{} - s.Base = lg.NewStyle(). - Padding(1, 2, 0, 1) - s.HeaderText = lg.NewStyle(). - Foreground(indigo). - Bold(true). - Padding(0, 1, 0, 1) - s.Status = lg.NewStyle(). - Border(lipgloss.RoundedBorder()). - BorderForeground(indigo). - PaddingLeft(1). - MarginTop(1) - s.StatusHeader = lg.NewStyle(). - Foreground(green). - Bold(true) - s.Highlight = lg.NewStyle(). - Foreground(lipgloss.Color("212")) - s.ErrorHeaderText = s.HeaderText. - Foreground(red) - s.Help = lg.NewStyle(). - Foreground(lipgloss.Color("240")) - return &s -} - -type state int - -const ( - statusNormal state = iota - stateDone -) - -type Model struct { - state state - lg *lipgloss.Renderer - styles *Styles - form *huh.Form - width int - message *tx.TxBody -} - -func NewModel() Model { - m := Model{width: maxWidth} - m.lg = lipgloss.DefaultRenderer() - m.styles = NewStyles(m.lg) - - m.form = huh.NewForm( - huh.NewGroup( - huh.NewInput(). - Key("from"). - Title("From Address"). - Placeholder("cosmos1..."). - Validate(func(s string) error { - if !strings.HasPrefix(s, "cosmos1") { - return fmt.Errorf("invalid address format") - } - return nil - }), - - huh.NewInput(). - Key("to"). - Title("To Address"). - Placeholder("cosmos1..."). - Validate(func(s string) error { - if !strings.HasPrefix(s, "cosmos1") { - return fmt.Errorf("invalid address format") - } - return nil - }), - - huh.NewInput(). - Key("amount"). - Title("Amount"). - Placeholder("100"). - Validate(func(s string) error { - if _, err := sdk.ParseCoinNormalized(s + "atom"); err != nil { - return fmt.Errorf("invalid coin amount") - } - return nil - }), - - huh.NewSelect[string](). - Key("denom"). - Title("Denom"). - Options(huh.NewOptions("atom", "osmo", "usnr", "snr")...), - - huh.NewInput(). - Key("memo"). - Title("Memo"). - Placeholder("Optional"), - - huh.NewConfirm(). - Key("done"). - Title("Ready to convert?"). - Validate(func(v bool) error { - if !v { - return fmt.Errorf("Please confirm when you're ready to convert") - } - return nil - }). - Affirmative("Yes, convert!"). - Negative("Not yet"), - ), - ). - WithWidth(60). - WithShowHelp(false). - WithShowErrors(false) - - return m -} - -func (m Model) Init() tea.Cmd { - return m.form.Init() -} - -func min(x, y int) int { - if x > y { - return y - } - return x -} - -func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) { - switch msg := msg.(type) { - case tea.WindowSizeMsg: - m.width = min(msg.Width, maxWidth) - m.styles.Base.GetHorizontalFrameSize() - case tea.KeyMsg: - switch msg.String() { - case "esc", "ctrl+c", "q": - return m, tea.Quit - } - } - - var cmds []tea.Cmd - - form, cmd := m.form.Update(msg) - if f, ok := form.(*huh.Form); ok { - m.form = f - cmds = append(cmds, cmd) - } - - if m.form.State == huh.StateCompleted { - m.buildMessage() - cmds = append(cmds, tea.Quit) - } - - return m, tea.Batch(cmds...) -} - -func (m Model) View() string { - s := m.styles - - switch m.form.State { - case huh.StateCompleted: - pklCode := m.generatePkl() - messageView := m.getMessageView() - var b strings.Builder - fmt.Fprintf(&b, "Final Tx:\n\n%s\n\n%s", pklCode, messageView) - return s.Status.Margin(0, 1).Padding(1, 2).Width(80).Render(b.String()) + "\n\n" - default: - var schemaType string - if m.form.GetString("schemaType") != "" { - schemaType = "Schema Type: " + m.form.GetString("schemaType") - } - - v := strings.TrimSuffix(m.form.View(), "\n\n") - form := m.lg.NewStyle().Margin(1, 0).Render(v) - - var status string - { - preview := "(Preview will appear here)" - if m.form.GetString("schema") != "" { - preview = m.generatePkl() - } - - const statusWidth = 40 - statusMarginLeft := m.width - statusWidth - lipgloss.Width(form) - s.Status.GetMarginRight() - status = s.Status. - Height(lipgloss.Height(form)). - Width(statusWidth). - MarginLeft(statusMarginLeft). - Render(s.StatusHeader.Render("Pkl Preview") + "\n" + - schemaType + "\n\n" + - preview) - } - - errors := m.form.Errors() - header := m.appBoundaryView("Sonr TX Builder") - if len(errors) > 0 { - header = m.appErrorBoundaryView(m.errorView()) - } - body := lipgloss.JoinHorizontal(lipgloss.Top, form, status) - - footer := m.appBoundaryView(m.form.Help().ShortHelpView(m.form.KeyBinds())) - if len(errors) > 0 { - footer = m.appErrorBoundaryView("") - } - - return s.Base.Render(header + "\n" + body + "\n\n" + footer) - } -} - -func (m Model) errorView() string { - var s string - for _, err := range m.form.Errors() { - s += err.Error() - } - return s -} - -func (m Model) appBoundaryView(text string) string { - return lipgloss.PlaceHorizontal( - m.width, - lipgloss.Left, - m.styles.HeaderText.Render(text), - lipgloss.WithWhitespaceChars("="), - lipgloss.WithWhitespaceForeground(indigo), - ) -} - -func (m Model) appErrorBoundaryView(text string) string { - return lipgloss.PlaceHorizontal( - m.width, - lipgloss.Left, - m.styles.ErrorHeaderText.Render(text), - lipgloss.WithWhitespaceChars("="), - lipgloss.WithWhitespaceForeground(red), - ) -} - -func (m Model) generatePkl() string { - schemaType := m.form.GetString("schemaType") - schema := m.form.GetString("schema") - - // This is a placeholder for the actual conversion logic - // In a real implementation, you would parse the schema and generate Pkl code - return fmt.Sprintf("// Converted from %s\n\nclass ConvertedSchema {\n // TODO: Implement conversion from %s\n // Original schema:\n /*\n%s\n */\n}", schemaType, schemaType, schema) -} - -func (m *Model) buildMessage() { - from := m.form.GetString("from") - to := m.form.GetString("to") - amount := m.form.GetString("amount") - denom := m.form.GetString("denom") - memo := m.form.GetString("memo") - - coin, _ := sdk.ParseCoinNormalized(fmt.Sprintf("%s%s", amount, denom)) - sendMsg := &banktypes.MsgSend{ - FromAddress: from, - ToAddress: to, - Amount: sdk.NewCoins(coin), - } - - anyMsg, _ := codectypes.NewAnyWithValue(sendMsg) - m.message = &tx.TxBody{ - Messages: []*codectypes.Any{anyMsg}, - Memo: memo, - } -} - -func (m Model) getMessageView() string { - if m.message == nil { - return "Current Message: None" - } - - interfaceRegistry := codectypes.NewInterfaceRegistry() - marshaler := codec.NewProtoCodec(interfaceRegistry) - jsonBytes, _ := marshaler.MarshalJSON(m.message) - - return fmt.Sprintf("Current Message:\n%s", string(jsonBytes)) -} - -func RunBuildTxnTUI() (*tx.TxBody, error) { - m := NewModel() - p := tea.NewProgram(m) - - finalModel, err := p.Run() - if err != nil { - return nil, fmt.Errorf("failed to run program: %w", err) - } - - finalM, ok := finalModel.(Model) - if !ok || finalM.message == nil { - return nil, fmt.Errorf("form not completed") - } - - return finalM.message, nil -} diff --git a/internal/vfs/assemble.go b/internal/vfs/assemble.go deleted file mode 100644 index 07545ebc7..000000000 --- a/internal/vfs/assemble.go +++ /dev/null @@ -1,20 +0,0 @@ -package vfs - -import ( - "github.com/ipfs/boxo/files" -) - -var ( - kServiceWorkerFileName = "server/sw.js" - kVaultFileName = "server/vault.wasm" - kIndexFileName = "index.html" -) - -func AssembleDirectory() files.Directory { - fileMap := map[string]files.Node{ - kVaultFileName: DWNWasmFile(), - kServiceWorkerFileName: SWJSFile(), - } - - return files.NewMapDirectory(fileMap) -} diff --git a/internal/vfs/dwn.wasm b/internal/vfs/dwn.wasm deleted file mode 100755 index 272ccbefa..000000000 Binary files a/internal/vfs/dwn.wasm and /dev/null differ diff --git a/internal/vfs/embed.go b/internal/vfs/embed.go deleted file mode 100644 index d7dcc4db6..000000000 --- a/internal/vfs/embed.go +++ /dev/null @@ -1,22 +0,0 @@ -package vfs - -import ( - _ "embed" - - "github.com/ipfs/boxo/files" -) - -//go:embed dwn.wasm -var dwnWasmData []byte - -//go:embed sw.js -var swJSData []byte - -func DWNWasmFile() files.Node { - return files.NewBytesFile(dwnWasmData) -} - -// Use ServiceWorkerJS template to generate the service worker file -func SWJSFile() files.Node { - return files.NewBytesFile(swJSData) -} diff --git a/internal/vfs/sw.js b/internal/vfs/sw.js deleted file mode 100644 index a5654ed5d..000000000 --- a/internal/vfs/sw.js +++ /dev/null @@ -1,8 +0,0 @@ -importScripts( - "https://cdn.jsdelivr.net/gh/golang/go@go1.18.4/misc/wasm/wasm_exec.js", - "https://cdn.jsdelivr.net/gh/nlepage/go-wasm-http-server@v1.1.0/sw.js", - "https://cdn.jsdelivr.net/npm/htmx.org@1.9.12/dist/htmx.min.js", - "https://cdn.jsdelivr.net/npm/alpinejs@3.14.1/dist/cdn.min.js", -); - -registerWasmHTTPListener("dwn.wasm"); diff --git a/internal/vfs/wasm/request.go b/internal/vfs/wasm/request.go deleted file mode 100644 index c7aeb7d5a..000000000 --- a/internal/vfs/wasm/request.go +++ /dev/null @@ -1,37 +0,0 @@ -//go:build js && wasm - -package wasm - -import ( - "bytes" - "net/http" - "net/http/httptest" - "syscall/js" - - promise "github.com/nlepage/go-js-promise" -) - -// Request builds and returns the equivalent http.Request -func Request(r js.Value) *http.Request { - jsBody := js.Global().Get("Uint8Array").New(promise.Await(r.Call("arrayBuffer"))) - body := make([]byte, jsBody.Get("length").Int()) - js.CopyBytesToGo(body, jsBody) - - req := httptest.NewRequest( - r.Get("method").String(), - r.Get("url").String(), - bytes.NewBuffer(body), - ) - - headersIt := r.Get("headers").Call("entries") - for { - e := headersIt.Call("next") - if e.Get("done").Bool() { - break - } - v := e.Get("value") - req.Header.Set(v.Index(0).String(), v.Index(1).String()) - } - - return req -} diff --git a/internal/vfs/wasm/response.go b/internal/vfs/wasm/response.go deleted file mode 100644 index 632538b87..000000000 --- a/internal/vfs/wasm/response.go +++ /dev/null @@ -1,50 +0,0 @@ -//go:build js && wasm - -package wasm - -import ( - "io" - "net/http/httptest" - "syscall/js" -) - -// ResponseRecorder uses httptest.ResponseRecorder to build a JS Response -type ResponseRecorder struct { - *httptest.ResponseRecorder -} - -// NewResponseRecorder returns a new ResponseRecorder -func NewResponseRecorder() ResponseRecorder { - return ResponseRecorder{httptest.NewRecorder()} -} - -// JSResponse builds and returns the equivalent JS Response -func (rr ResponseRecorder) JSResponse() js.Value { - res := rr.Result() - - body := js.Undefined() - if res.ContentLength != 0 { - b, err := io.ReadAll(res.Body) - if err != nil { - panic(err) - } - body = js.Global().Get("Uint8Array").New(len(b)) - js.CopyBytesToJS(body, b) - } - - init := make(map[string]interface{}, 2) - - if res.StatusCode != 0 { - init["status"] = res.StatusCode - } - - if len(res.Header) != 0 { - headers := make(map[string]interface{}, len(res.Header)) - for k := range res.Header { - headers[k] = res.Header.Get(k) - } - init["headers"] = headers - } - - return js.Global().Get("Response").New(body, init) -} diff --git a/internal/vfs/wasm/serve.go b/internal/vfs/wasm/serve.go deleted file mode 100644 index 846280928..000000000 --- a/internal/vfs/wasm/serve.go +++ /dev/null @@ -1,59 +0,0 @@ -//go:build js && wasm - -package wasm - -import ( - "fmt" - "net/http" - "strings" - "syscall/js" - - promise "github.com/nlepage/go-js-promise" -) - -// Serve serves HTTP requests using handler or http.DefaultServeMux if handler is nil. -func Serve(handler http.Handler) func() { - h := handler - if h == nil { - h = http.DefaultServeMux - } - - prefix := js.Global().Get("wasmhttp").Get("path").String() - for strings.HasSuffix(prefix, "/") { - prefix = strings.TrimSuffix(prefix, "/") - } - - if prefix != "" { - mux := http.NewServeMux() - mux.Handle(prefix+"/", http.StripPrefix(prefix, h)) - h = mux - } - - cb := js.FuncOf(func(_ js.Value, args []js.Value) interface{} { - resPromise, resolve, reject := promise.New() - - go func() { - defer func() { - if r := recover(); r != nil { - if err, ok := r.(error); ok { - reject(fmt.Sprintf("wasmhttp: panic: %+v\n", err)) - } else { - reject(fmt.Sprintf("wasmhttp: panic: %v\n", r)) - } - } - }() - - res := NewResponseRecorder() - - h.ServeHTTP(res, Request(args[0])) - - resolve(res.JSResponse()) - }() - - return resPromise - }) - - js.Global().Get("wasmhttp").Call("setHandler", cb) - - return cb.Release -} diff --git a/pkg/nebula/islands/forms.go b/pkg/nebula/islands/forms.go deleted file mode 100644 index 5c75ae942..000000000 --- a/pkg/nebula/islands/forms.go +++ /dev/null @@ -1,41 +0,0 @@ -package islands - -import ( - "bytes" - - "github.com/a-h/templ" - "github.com/labstack/echo/v4" -) - -func echoFormResponse(c echo.Context, cmp templ.Component, state FormState) error { - // Create a buffer to store the rendered HTML - buf := &bytes.Buffer{} - // Render the component to the buffer - err := cmp.Render(c.Request().Context(), buf) - if err != nil { - return err - } - - // Set the content type - c.Response().Header().Set(echo.HeaderContentType, echo.MIMETextHTML) - c.Response().Header().Set("X-Status", string(state)) - - // Write the buffered content to the response - _, err = c.Response().Write(buf.Bytes()) - return err -} - -type FormState string - -const ( - InitialForm FormState = "initial" - ErrorForm FormState = "error" - SuccessForm FormState = "success" - WarningForm FormState = "warning" -) - -type Form struct { - State FormState - Title string - Description string -} diff --git a/pkg/nebula/islands/register.templ b/pkg/nebula/islands/register.templ deleted file mode 100644 index 953ea0dc3..000000000 --- a/pkg/nebula/islands/register.templ +++ /dev/null @@ -1,25 +0,0 @@ -package islands - -import "github.com/labstack/echo/v4" - -templ BasicInfo(c echo.Context, state FormState) { - switch (state) { - default: -
    -
    -

    Account

    -

    Make changes to your account here. Click save when you're done.

    -
    -
    -
    -
    -
    -
    - } -} - -templ CreateCredentials(c echo.Context, state FormState) { -} - -templ PrivacyTerms(c echo.Context, state FormState) { -} diff --git a/pkg/nebula/islands/register_templ.go b/pkg/nebula/islands/register_templ.go deleted file mode 100644 index 2f56be082..000000000 --- a/pkg/nebula/islands/register_templ.go +++ /dev/null @@ -1,95 +0,0 @@ -// Code generated by templ - DO NOT EDIT. - -// templ: version: v0.2.778 -package islands - -//lint:file-ignore SA4006 This context is only used if a nested component is present. - -import "github.com/a-h/templ" -import templruntime "github.com/a-h/templ/runtime" - -import "github.com/labstack/echo/v4" - -func BasicInfo(c echo.Context, state FormState) templ.Component { - return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { - templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { - return templ_7745c5c3_CtxErr - } - templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) - if !templ_7745c5c3_IsBuffer { - defer func() { - templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) - if templ_7745c5c3_Err == nil { - templ_7745c5c3_Err = templ_7745c5c3_BufErr - } - }() - } - ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var1 := templ.GetChildren(ctx) - if templ_7745c5c3_Var1 == nil { - templ_7745c5c3_Var1 = templ.NopComponent - } - ctx = templ.ClearChildren(ctx) - switch state { - default: - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("

    Account

    Make changes to your account here. Click save when you're done.

    ") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - } - return templ_7745c5c3_Err - }) -} - -func CreateCredentials(c echo.Context, state FormState) templ.Component { - return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { - templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { - return templ_7745c5c3_CtxErr - } - templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) - if !templ_7745c5c3_IsBuffer { - defer func() { - templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) - if templ_7745c5c3_Err == nil { - templ_7745c5c3_Err = templ_7745c5c3_BufErr - } - }() - } - ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var2 := templ.GetChildren(ctx) - if templ_7745c5c3_Var2 == nil { - templ_7745c5c3_Var2 = templ.NopComponent - } - ctx = templ.ClearChildren(ctx) - return templ_7745c5c3_Err - }) -} - -func PrivacyTerms(c echo.Context, state FormState) templ.Component { - return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { - templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { - return templ_7745c5c3_CtxErr - } - templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) - if !templ_7745c5c3_IsBuffer { - defer func() { - templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) - if templ_7745c5c3_Err == nil { - templ_7745c5c3_Err = templ_7745c5c3_BufErr - } - }() - } - ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var3 := templ.GetChildren(ctx) - if templ_7745c5c3_Var3 == nil { - templ_7745c5c3_Var3 = templ.NopComponent - } - ctx = templ.ClearChildren(ctx) - return templ_7745c5c3_Err - }) -} - -var _ = templruntime.GeneratedTemplate diff --git a/pkg/nebula/nebula.go b/pkg/nebula/nebula.go new file mode 100644 index 000000000..a3237757b --- /dev/null +++ b/pkg/nebula/nebula.go @@ -0,0 +1,14 @@ +package nebula + +import ( + "github.com/labstack/echo/v4" + "github.com/onsonr/sonr/pkg/nebula/pages" +) + +func RegisterHandlers(e *echo.Echo) { + e.GET("/home", pages.Home) + e.GET("/login", pages.Login) + e.GET("/register", pages.Register) + e.GET("/profile", pages.Profile) + e.GET("/authorize", pages.Authorize) +} diff --git a/pkg/nebula/pages/home.templ b/pkg/nebula/pages/home.templ index f21586f07..d5d0f2a93 100644 --- a/pkg/nebula/pages/home.templ +++ b/pkg/nebula/pages/home.templ @@ -5,7 +5,11 @@ import ( "github.com/onsonr/sonr/pkg/nebula/blocks" ) -templ Home(c echo.Context) { +func Home(c echo.Context) error { + return echoResponse(c, homeView()) +} + +templ homeView() { @blocks.Card("home-view", blocks.SizeLarge) { @blocks.H1("Sonr.ID") @blocks.Text("A Decentralized Web Node Client for the Sonr Network.") diff --git a/pkg/nebula/pages/home_templ.go b/pkg/nebula/pages/home_templ.go index 75e611f56..8b438f4d6 100644 --- a/pkg/nebula/pages/home_templ.go +++ b/pkg/nebula/pages/home_templ.go @@ -13,7 +13,11 @@ import ( "github.com/onsonr/sonr/pkg/nebula/blocks" ) -func Home(c echo.Context) templ.Component { +func Home(c echo.Context) error { + return echoResponse(c, homeView()) +} + +func homeView() templ.Component { return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { diff --git a/pkg/nebula/pages/login.templ b/pkg/nebula/pages/login.templ index 3db82aed7..9374f1a84 100644 --- a/pkg/nebula/pages/login.templ +++ b/pkg/nebula/pages/login.templ @@ -5,7 +5,11 @@ import ( "github.com/onsonr/sonr/pkg/nebula/blocks" ) -templ Login(c echo.Context) { +func Login(c echo.Context) error { + return echoResponse(c, loginView(c)) +} + +templ loginView(c echo.Context) { @blocks.Card("login-view", blocks.SizeLarge) { @blocks.H1("Sonr.ID") @blocks.Text("Neo-tree is a file manager for NeoFS.") diff --git a/pkg/nebula/pages/login_templ.go b/pkg/nebula/pages/login_templ.go index 0c7bb0ce8..ae48b92d8 100644 --- a/pkg/nebula/pages/login_templ.go +++ b/pkg/nebula/pages/login_templ.go @@ -13,7 +13,11 @@ import ( "github.com/onsonr/sonr/pkg/nebula/blocks" ) -func Login(c echo.Context) templ.Component { +func Login(c echo.Context) error { + return echoResponse(c, loginView(c)) +} + +func loginView(c echo.Context) templ.Component { return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { diff --git a/pkg/nebula/pages/openid.templ b/pkg/nebula/pages/openid.templ index c0482ec52..9120e3724 100644 --- a/pkg/nebula/pages/openid.templ +++ b/pkg/nebula/pages/openid.templ @@ -5,7 +5,11 @@ import ( "github.com/onsonr/sonr/pkg/nebula/blocks" ) -templ Authorize(c echo.Context) { +func Authorize(c echo.Context) error { + return echoResponse(c, authorizeView(c)) +} + +templ authorizeView(c echo.Context) { @blocks.Card("authorize-view", blocks.SizeMedium) { @blocks.H1("Sonr.ID") @blocks.Text("Neo-tree is a file manager for NeoFS.") diff --git a/pkg/nebula/pages/openid_templ.go b/pkg/nebula/pages/openid_templ.go index c87093a10..aeaa16d34 100644 --- a/pkg/nebula/pages/openid_templ.go +++ b/pkg/nebula/pages/openid_templ.go @@ -13,7 +13,11 @@ import ( "github.com/onsonr/sonr/pkg/nebula/blocks" ) -func Authorize(c echo.Context) templ.Component { +func Authorize(c echo.Context) error { + return echoResponse(c, authorizeView(c)) +} + +func authorizeView(c echo.Context) templ.Component { return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { diff --git a/internal/gui/views/views.go b/pkg/nebula/pages/pages.go similarity index 79% rename from internal/gui/views/views.go rename to pkg/nebula/pages/pages.go index cc62f7aed..de34ff40c 100644 --- a/internal/gui/views/views.go +++ b/pkg/nebula/pages/pages.go @@ -1,4 +1,4 @@ -package views +package pages import ( "bytes" @@ -7,11 +7,9 @@ import ( "github.com/labstack/echo/v4" ) -// render renders a templ.Component -func echoComponentResponse(c echo.Context, cmp templ.Component) error { +func echoResponse(c echo.Context, cmp templ.Component) error { // Create a buffer to store the rendered HTML buf := &bytes.Buffer{} - // Render the component to the buffer err := cmp.Render(c.Request().Context(), buf) if err != nil { diff --git a/pkg/nebula/pages/profile.templ b/pkg/nebula/pages/profile.templ index 72fe1c6e5..1abca0e8d 100644 --- a/pkg/nebula/pages/profile.templ +++ b/pkg/nebula/pages/profile.templ @@ -5,7 +5,11 @@ import ( "github.com/onsonr/sonr/pkg/nebula/blocks" ) -templ Profile(c echo.Context) { +func Profile(c echo.Context) error { + return echoResponse(c, profileView(c)) +} + +templ profileView(c echo.Context) { @blocks.Card("profile-view", blocks.SizeLarge) { @blocks.ProfileCard() @blocks.Tabs() diff --git a/pkg/nebula/pages/profile_templ.go b/pkg/nebula/pages/profile_templ.go index dc588d663..c4f4a6a2d 100644 --- a/pkg/nebula/pages/profile_templ.go +++ b/pkg/nebula/pages/profile_templ.go @@ -13,7 +13,11 @@ import ( "github.com/onsonr/sonr/pkg/nebula/blocks" ) -func Profile(c echo.Context) templ.Component { +func Profile(c echo.Context) error { + return echoResponse(c, profileView(c)) +} + +func profileView(c echo.Context) templ.Component { return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { diff --git a/pkg/nebula/pages/register.templ b/pkg/nebula/pages/register.templ index 2b785a20d..6f4ef0bf0 100644 --- a/pkg/nebula/pages/register.templ +++ b/pkg/nebula/pages/register.templ @@ -3,18 +3,46 @@ package pages import ( "github.com/labstack/echo/v4" "github.com/onsonr/sonr/pkg/nebula/blocks" - "github.com/onsonr/sonr/pkg/nebula/islands" ) -templ Register(c echo.Context) { +type FormState string + +const ( + InitialForm FormState = "initial" + ErrorForm FormState = "error" + SuccessForm FormState = "success" + WarningForm FormState = "warning" +) + +func Register(c echo.Context) error { + return echoResponse(c, registerView(c)) +} + +templ registerView(c echo.Context) { @blocks.Card("register-view", blocks.SizeMedium) { @blocks.H2("Account Registration") @blocks.Spacer() @blocks.Breadcrumbs() - @islands.BasicInfo(c, islands.InitialForm) + @basicInfoForm(InitialForm) @blocks.Spacer() @blocks.Button(blocks.GET("/", "#register-view")) { @blocks.Text("Cancel") } } } + +templ basicInfoForm(state FormState) { + switch (state) { + default: +
    +
    +

    Account

    +

    Make changes to your account here. Click save when you're done.

    +
    +
    +
    +
    +
    +
    + } +} diff --git a/pkg/nebula/pages/register_templ.go b/pkg/nebula/pages/register_templ.go index ad23e673b..dabc8bcd5 100644 --- a/pkg/nebula/pages/register_templ.go +++ b/pkg/nebula/pages/register_templ.go @@ -11,10 +11,22 @@ import templruntime "github.com/a-h/templ/runtime" import ( "github.com/labstack/echo/v4" "github.com/onsonr/sonr/pkg/nebula/blocks" - "github.com/onsonr/sonr/pkg/nebula/islands" ) -func Register(c echo.Context) templ.Component { +type FormState string + +const ( + InitialForm FormState = "initial" + ErrorForm FormState = "error" + SuccessForm FormState = "success" + WarningForm FormState = "warning" +) + +func Register(c echo.Context) error { + return echoResponse(c, registerView(c)) +} + +func registerView(c echo.Context) templ.Component { return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { @@ -71,7 +83,7 @@ func Register(c echo.Context) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = islands.BasicInfo(c, islands.InitialForm).Render(ctx, templ_7745c5c3_Buffer) + templ_7745c5c3_Err = basicInfoForm(InitialForm).Render(ctx, templ_7745c5c3_Buffer) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -119,4 +131,36 @@ func Register(c echo.Context) templ.Component { }) } +func basicInfoForm(state FormState) templ.Component { + return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { + templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context + if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { + return templ_7745c5c3_CtxErr + } + templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) + if !templ_7745c5c3_IsBuffer { + defer func() { + templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) + if templ_7745c5c3_Err == nil { + templ_7745c5c3_Err = templ_7745c5c3_BufErr + } + }() + } + ctx = templ.InitializeContext(ctx) + templ_7745c5c3_Var4 := templ.GetChildren(ctx) + if templ_7745c5c3_Var4 == nil { + templ_7745c5c3_Var4 = templ.NopComponent + } + ctx = templ.ClearChildren(ctx) + switch state { + default: + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("

    Account

    Make changes to your account here. Click save when you're done.

    ") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + } + return templ_7745c5c3_Err + }) +} + var _ = templruntime.GeneratedTemplate diff --git a/pkg/nebula/router.go b/pkg/nebula/router.go deleted file mode 100644 index 86e63dd1c..000000000 --- a/pkg/nebula/router.go +++ /dev/null @@ -1,15 +0,0 @@ -package nebula - -import ( - "github.com/labstack/echo/v4" - "github.com/onsonr/sonr/pkg/nebula/routes" - "github.com/onsonr/sonr/pkg/nebula/view" -) - -func RouteViews(e *echo.Echo) { - e.GET("/home", view.Render(routes.HomeRoute)) - e.GET("/login", view.Render(routes.LoginRoute)) - e.GET("/register", view.Render(routes.RegisterRoute)) - e.GET("/profile", view.Render(routes.ProfileRoute)) - e.GET("/authorize", view.Render(routes.AuthorizeRoute)) -} diff --git a/pkg/nebula/routes/routes.go b/pkg/nebula/routes/routes.go deleted file mode 100644 index c8908c650..000000000 --- a/pkg/nebula/routes/routes.go +++ /dev/null @@ -1,37 +0,0 @@ -package routes - -import ( - "github.com/a-h/templ" - "github.com/labstack/echo/v4" - "github.com/onsonr/sonr/pkg/nebula/pages" -) - -type Route string - -const ( - HomeRoute Route = "/home" - LoginRoute Route = "/login" - RegisterRoute Route = "/register" - ProfileRoute Route = "/profile" - AuthorizeRoute Route = "/authorize" -) - -func (r Route) Route() string { - return string(r) -} - -func (r Route) Component(c echo.Context) templ.Component { - switch r { - case HomeRoute: - return pages.Home(c) - case LoginRoute: - return pages.Login(c) - case RegisterRoute: - return pages.Register(c) - case ProfileRoute: - return pages.Profile(c) - case AuthorizeRoute: - return pages.Authorize(c) - } - return nil -} diff --git a/pkg/nebula/view/view.go b/pkg/nebula/view.go similarity index 64% rename from pkg/nebula/view/view.go rename to pkg/nebula/view.go index 6dfeb3122..fe72ad483 100644 --- a/pkg/nebula/view/view.go +++ b/pkg/nebula/view.go @@ -1,20 +1,18 @@ -package view +package nebula import ( "bytes" + "github.com/a-h/templ" "github.com/labstack/echo/v4" - "github.com/onsonr/sonr/pkg/nebula/routes" ) -// render renders a templ.Component -func Render(r routes.Route) echo.HandlerFunc { +func Render(cmp templ.Component) echo.HandlerFunc { return func(c echo.Context) error { // Create a buffer to store the rendered HTML - buf := bytes.NewBuffer(nil) - + buf := &bytes.Buffer{} // Render the component to the buffer - err := r.Component(c).Render(c.Request().Context(), buf) + err := cmp.Render(c.Request().Context(), buf) if err != nil { return err } diff --git a/pkg/proxy/wrangler.toml b/pkg/proxy/wrangler.toml index 10bce7926..959f185c1 100644 --- a/pkg/proxy/wrangler.toml +++ b/pkg/proxy/wrangler.toml @@ -4,7 +4,6 @@ compatibility_date = "2024-07-26" [dev] ip = "localhost" -port = 4202 [build] command = "devbox run build:motr" diff --git a/pkl/api.pkl b/pkl/api.pkl deleted file mode 100644 index f18251ac6..000000000 --- a/pkl/api.pkl +++ /dev/null @@ -1,37 +0,0 @@ -@go.Package { name = "github.com/onsonr/sonr/motr/api" } - -module api - -import "package://pkg.pkl-lang.org/pkl-go/pkl.golang@0.5.0#/go.pkl" - -class JsonField extends go.Field { - structTags { - ["json"] = "%{name},omitempty" - } -} - -abstract class Request { - route: String - method: String - headers: Map - origin: String? - userAgent: String? - body: Dynamic -} - -abstract class Response { - statusCode: Int - headers: Map - body: Dynamic -} - -class GetAccountsRequest extends Request { - route = "/accounts" - method = "GET" - headers = { - "Content-Type" = "application/json" - } - origin = null - userAgent = null - body = null -} diff --git a/pkl/bake.pkl b/pkl/bake.pkl deleted file mode 100644 index 927e5ea37..000000000 --- a/pkl/bake.pkl +++ /dev/null @@ -1,30 +0,0 @@ -@go.Package { name = "github.com/onsonr/sonr/motr/api/bake" } - -module bake - -import "package://pkg.pkl-lang.org/pkl-go/pkl.golang@0.5.0#/go.pkl" - -class JsonField extends go.Field { - structTags { - ["json"] = "%{name},omitempty" - } -} - -abstract class Macroon { - id: String - location: String -} - -abstract class FirstPartyCaveats { - scope: String - exp: Int - cnf: String - aud: String -} - -abstract class ThirdPartyCaveats { - scope: String - exp: Int - cnf: String - aud: String -} diff --git a/pkl/oidc.pkl b/pkl/oidc.pkl deleted file mode 100644 index 2437be298..000000000 --- a/pkl/oidc.pkl +++ /dev/null @@ -1,59 +0,0 @@ -@go.Package { name = "github.com/onsonr/sonr/x/did/types/oidc" } - -module oidc - -import "package://pkg.pkl-lang.org/pkl-go/pkl.golang@0.5.0#/go.pkl" - -class JsonField extends go.Field { - structTags { - ["json"] = "%{name},omitempty" - ["param"] = "%{name}" - } -} - -class DiscoveryDocument { - @JsonField - issuer: String - - @JsonField - authorization_endpoint: String - - @JsonField - token_endpoint: String - - @JsonField - userinfo_endpoint: String - - @JsonField - jwks_uri: String - - @JsonField - registration_endpoint: String - - @JsonField - scopes_supported: List - - @JsonField - response_types_supported: List - - @JsonField - response_modes_supported: List - - @JsonField - subject_types_supported: List - - @JsonField - id_token_signing_alg_values_supported: List - - @JsonField - claims_supported: List - - @JsonField - grant_types_supported: List - - @JsonField - acr_values_supported: List - - @JsonField - token_endpoint_auth_methods_supported: List -} diff --git a/pkl/orm.pkl b/pkl/orm.pkl deleted file mode 100644 index 86bc5e06f..000000000 --- a/pkl/orm.pkl +++ /dev/null @@ -1,227 +0,0 @@ -@go.Package { name = "github.com/onsonr/sonr/internal/db/orm" } - -module orm - -import "package://pkg.pkl-lang.org/pkl-go/pkl.golang@0.5.0#/go.pkl" - -class PrimaryKey extends go.Field { - structTags { - ["gorm"] = "primaryKey,autoIncrement" - ["json"] = "%{name},omitempty" - ["query"] = "%{name}" - } -} - -class Unique extends go.Field { - structTags { - ["gorm"] = "unique" - ["json"] = "%{name},omitempty" - } -} - -class Default extends go.Field { - defaultValue: String - structTags { - ["gorm"] = "default:%{defaultValue}" - ["json"] = "%{name},omitempty" - } -} - -class NotNull extends go.Field { - structTags { - ["gorm"] = "not null" - } -} - -class ForeignKey extends go.Field { - references: String - structTags { - ["gorm"] = "foreignKey:%{references}" - } -} - -class JsonField extends go.Field { - structTags { - ["json"] = "%{name},omitempty" - ["param"] = "%{name}" - } -} - -class Account { - @PrimaryKey - id: UInt - - @JsonField - name: String - - @JsonField - address: String - - @JsonField - publicKey: String - - @JsonField - createdAt: String? -} - -class Asset { - @PrimaryKey - id: UInt - - @JsonField - name: String - - @JsonField - symbol: String - - @JsonField - decimals: Int - - @JsonField - chainId: Int? - - @JsonField - createdAt: String? -} - -class Chain { - @PrimaryKey - id: UInt - - @JsonField - name: String - - @JsonField - networkId: String - - @JsonField - createdAt: String? -} - -class Credential { - @PrimaryKey - id: UInt - - @JsonField - subject: String - - @JsonField - controller: String - - @JsonField - attestationType: String - - @JsonField - origin: String - - @JsonField - credentialId: String - - @JsonField - publicKey: String - - @JsonField - transport: String - - @JsonField - signCount: UInt - - @JsonField - userPresent: Boolean - - @JsonField - userVerified: Boolean - - @JsonField - backupEligible: Boolean - - @JsonField - backupState: Boolean - - @JsonField - cloneWarning: Boolean - - @JsonField - createdAt: String? - - @JsonField - updatedAt: String? -} - -class Profile { - @PrimaryKey - id: String - - @JsonField - subject: String - - @JsonField - controller: String - - @JsonField - originUri: String? - - @JsonField - publicMetadata: String? - - @JsonField - privateMetadata: String? - - @JsonField - createdAt: String? - - @JsonField - updatedAt: String? -} - -class Property { - @PrimaryKey - id: UInt - - @JsonField - profileId: String - - @JsonField - key: String - - @JsonField - accumulator: String - - @JsonField - propertyKey: String -} - -class Keyshare { - @PrimaryKey - id: UInt - - @JsonField - data: String - - @JsonField - role: Int - - @JsonField - createdAt: String? -} - -class Permission { - @PrimaryKey - id: UInt - - @JsonField - serviceId: String - - @JsonField - grants: String - - @JsonField - scopes: String - - @JsonField - createdAt: String? - - @JsonField - updatedAt: String? -} - diff --git a/pkl/txns.pkl b/pkl/txns.pkl deleted file mode 100644 index beda46381..000000000 --- a/pkl/txns.pkl +++ /dev/null @@ -1,175 +0,0 @@ -@go.Package { name = "github.com/onsonr/sonr/x/did/types/txns" } - -module txns - -import "package://pkg.pkl-lang.org/pkl-go/pkl.golang@0.5.0#/go.pkl" - -/// Common Cosmos SDK types -typealias Coin = Dynamic -typealias AccAddress = String -typealias ValAddress = String -typealias Timestamp = String - -/// Base class for all messages -abstract class Msg { - /// The type URL for the message - typeUrl: String -} - -/// Base class for all proposals -class Proposal { - /// The title of the proposal - title: String - - /// The description of the proposal - description: String -} - - -/// Gov module messages -class MsgGovSubmitProposal extends Msg { - typeUrl = "/cosmos.gov.v1beta1.MsgSubmitProposal" - content: Proposal - initialDeposit: List - proposer: AccAddress -} - -class MsgGovVote extends Msg { - typeUrl = "/cosmos.gov.v1beta1.MsgVote" - proposalId: Int - voter: AccAddress - option: Int -} - -class MsgGovDeposit extends Msg { - typeUrl = "/cosmos.gov.v1beta1.MsgDeposit" - proposalId: Int - depositor: AccAddress - amount: List -} - -/// Group module messages - class MsgGroupCreateGroup extends Msg { - typeUrl = "/cosmos.group.v1.MsgCreateGroup" - admin: AccAddress - members: List - metadata: String - } - - class MsgGroupSubmitProposal extends Msg { - typeUrl = "/cosmos.group.v1.MsgSubmitProposal" - groupPolicyAddress: AccAddress - proposers: List - metadata: String - messages: List - exec: Int - } - - class MsgGroupVote extends Msg { - typeUrl = "/cosmos.group.v1.MsgVote" - proposalId: Int - voter: AccAddress - option: Int - metadata: String - exec: Int - } - -/// Staking module messages - class MsgStakingCreateValidator extends Msg { - typeUrl = "/cosmos.staking.v1beta1.MsgCreateValidator" - description: Dynamic - commission: Dynamic - minSelfDelegation: String - delegatorAddress: AccAddress - validatorAddress: ValAddress - pubkey: Dynamic - value: Coin - } - - class MsgStakingDelegate extends Msg { - typeUrl = "/cosmos.staking.v1beta1.MsgDelegate" - delegatorAddress: AccAddress - validatorAddress: ValAddress - amount: Coin - } - - class MsgStakingUndelegate extends Msg { - typeUrl = "/cosmos.staking.v1beta1.MsgUndelegate" - delegatorAddress: AccAddress - validatorAddress: ValAddress - amount: Coin - } - - class MsgStakingBeginRedelegate extends Msg { - typeUrl = "/cosmos.staking.v1beta1.MsgBeginRedelegate" - delegatorAddress: AccAddress - validatorSrcAddress: ValAddress - validatorDstAddress: ValAddress - amount: Coin - } - class MsgDidUpdateParams extends Msg { - typeUrl = "/sonr.did.v1.MsgUpdateParams" - authority: AccAddress - params: Dynamic - token: Dynamic - } - - class MsgDidAllocateVault extends Msg { - typeUrl = "/sonr.did.v1.MsgAllocateVault" - authority: AccAddress - subject: String - token: Dynamic - } - - class MsgDidProveWitness extends Msg { - typeUrl = "/sonr.did.v1.MsgProveWitness" - authority: AccAddress - property: String - witness: Listing - token: Dynamic - } - - class MsgDidSyncVault extends Msg { - typeUrl = "/sonr.did.v1.MsgSyncVault" - controller: AccAddress - token: Dynamic - } - -class MsgDidRegisterController extends Msg { - typeUrl = "/sonr.did.v1.MsgRegisterController" - authority: AccAddress - cid: String - origin: String - authentication: List - token: Dynamic - } - -class MsgDidAuthorize extends Msg { - typeUrl = "/sonr.did.v1.MsgAuthorize" - authority: AccAddress - controller: AccAddress - address: AccAddress - origin: String - token: Dynamic - } - -class MsgDidRegisterService extends Msg { - typeUrl = "/sonr.did.v1.MsgRegisterService" - controller: AccAddress - originUri: String - scopes: Dynamic - description: String - serviceEndpoints: Map - metadata: Dynamic - token: Dynamic - } - -/// Represents a transaction body -class TxBody { - messages: List - memo: String? - timeoutHeight: Int? - extensionOptions: List? - nonCriticalExtensionOptions: List? -} - diff --git a/process-compose.yaml b/process-compose.yaml index 62f947ffe..aa415b839 100644 --- a/process-compose.yaml +++ b/process-compose.yaml @@ -1,9 +1,9 @@ version: "0.6" processes: - ipfs: + air: namespace: testnet - command: "ipfs-cluster-service init --consensus crdt && ipfs-cluster-service daemon" + command: "devbox run serve:air" background: true availability: restart: on_failure @@ -11,8 +11,7 @@ processes: sonr: namespace: testnet - command: "make sh-testnet" + command: "devbox run serve:sonr" restart: on_failure max_restarts: 3 depends: - - ipfs diff --git a/proto/did/v1/genesis.proto b/proto/did/v1/genesis.proto index 03e7f69be..65e92ed09 100644 --- a/proto/did/v1/genesis.proto +++ b/proto/did/v1/genesis.proto @@ -10,17 +10,6 @@ option go_package = "github.com/onsonr/sonr/x/did/types"; message GenesisState { // Params defines all the parameters of the module. Params params = 1 [(gogoproto.nullable) = false]; - - // GlobalIntegrity defines a zkp integrity proof for the entire DID namespace - GlobalIntegrity global_integrity = 2; -} - -// GlobalIntegrity defines a zkp integrity proof for the entire DID namespace -message GlobalIntegrity { - string controller = 1; - string seed = 2; - bytes accumulator = 3; - uint64 count = 4; } // Params defines the set of module parameters. diff --git a/proto/did/v1/tx.proto b/proto/did/v1/tx.proto index 7e620dfad..b242a37d8 100644 --- a/proto/did/v1/tx.proto +++ b/proto/did/v1/tx.proto @@ -12,23 +12,24 @@ option go_package = "github.com/onsonr/sonr/x/did/types"; // Msg defines the Msg service. service Msg { option (cosmos.msg.v1.service) = true; - // UpdateParams defines a governance operation for updating the parameters. - // - // Since: cosmos-sdk 0.47 - rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse); + // AllocateVault assembles a sqlite3 database in a local directory and returns the CID of the database. + // this operation is called by services initiating a controller registration. + rpc AllocateVault(MsgAllocateVault) returns (MsgAllocateVaultResponse); // AuthorizeService asserts the given controller is the owner of the given address. rpc AuthorizeService(MsgAuthorizeService) returns (MsgAuthorizeServiceResponse); - // AllocateVault assembles a sqlite3 database in a local directory and returns the CID of the database. - // this operation is called by services initiating a controller registration. - rpc AllocateVault(MsgAllocateVault) returns (MsgAllocateVaultResponse); + // ExecuteTx executes a transaction on the Sonr Blockchain. It leverages Macaroon for verification. + rpc ExecuteTx(MsgExecuteTx) returns (MsgExecuteTxResponse); // RegisterController initializes a controller with the given authentication set, address, cid, publicKey, and user-defined alias. rpc RegisterController(MsgRegisterController) returns (MsgRegisterControllerResponse); // RegisterService initializes a Service with a given permission scope and URI. The domain must have a valid TXT record containing the public key. rpc RegisterService(MsgRegisterService) returns (MsgRegisterServiceResponse); + + // UpdateParams defines a governance operation for updating the parameters. + rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse); } // MsgAllocateVault is the message type for the AllocateVault RPC. @@ -89,6 +90,26 @@ message MsgRegisterControllerResponse { map accounts = 3; } +// MsgExecuteTx is the message type for the ExecuteTx RPC. +message MsgExecuteTx { + option (cosmos.msg.v1.signer) = "controller"; + + // Controller is the address of the controller to authenticate. + string controller = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + + // Messages is the list of messages to execute. + map messages = 2; + + // MacaroonToken is the macaroon token to authenticate the operation. + string macaroon_token = 3; +} + +// MsgExecuteTxResponse is the response type for the ExecuteTx RPC. +message MsgExecuteTxResponse { + bool success = 1; + string tx_hash = 2; +} + // MsgAuthorizeService is the message type for the AuthorizeService RPC. message MsgAuthorizeService { option (cosmos.msg.v1.signer) = "controller"; diff --git a/x/did/builder/api.go b/x/did/builder/api.go deleted file mode 100644 index d042ba441..000000000 --- a/x/did/builder/api.go +++ /dev/null @@ -1,251 +0,0 @@ -package builder - -import ( - "encoding/base64" - "fmt" - - "github.com/go-webauthn/webauthn/protocol" - - "github.com/go-webauthn/webauthn/protocol/webauthncose" - didv1 "github.com/onsonr/sonr/api/did/v1" - "github.com/onsonr/sonr/x/did/types" -) - -func APIFormatDIDNamespace(namespace types.DIDNamespace) didv1.DIDNamespace { - return didv1.DIDNamespace(namespace) -} - -func APIFormatDIDNamespaces(namespaces []types.DIDNamespace) []didv1.DIDNamespace { - var s []didv1.DIDNamespace - for _, namespace := range namespaces { - s = append(s, APIFormatDIDNamespace(namespace)) - } - return s -} - -func APIFormatKeyRole(role types.KeyRole) didv1.KeyRole { - return didv1.KeyRole(role) -} - -func APIFormatKeyAlgorithm(algorithm types.KeyAlgorithm) didv1.KeyAlgorithm { - return didv1.KeyAlgorithm(algorithm) -} - -func APIFormatKeyEncoding(encoding types.KeyEncoding) didv1.KeyEncoding { - return didv1.KeyEncoding(encoding) -} - -func APIFormatKeyCurve(curve types.KeyCurve) didv1.KeyCurve { - return didv1.KeyCurve(curve) -} - -func APIFormatKeyType(keyType types.KeyType) didv1.KeyType { - return didv1.KeyType(keyType) -} - -func APIFormatPermissions(permissions *types.Permissions) *didv1.Permissions { - if permissions == nil { - return nil - } - p := didv1.Permissions{ - Grants: APIFormatDIDNamespaces(permissions.Grants), - Scopes: APIFormatPermissionScopes(permissions.Scopes), - } - return &p -} - -func APIFormatPermissionScope(scope types.PermissionScope) didv1.PermissionScope { - return didv1.PermissionScope(scope) -} - -func APIFormatPermissionScopes(scopes []types.PermissionScope) []didv1.PermissionScope { - var s []didv1.PermissionScope - for _, scope := range scopes { - s = append(s, APIFormatPermissionScope(scope)) - } - return s -} - -func APIFormatServiceRecord(service *types.Service) *didv1.ServiceRecord { - return &didv1.ServiceRecord{ - Id: service.Id, - ServiceType: service.ServiceType, - Authority: service.Authority, - Origin: service.Origin, - Description: service.Description, - ServiceEndpoints: service.ServiceEndpoints, - Permissions: APIFormatPermissions(service.Permissions), - } -} - -func APIFormatPubKeyJWK(jwk *types.PubKey_JWK) *didv1.PubKey_JWK { - return &didv1.PubKey_JWK{ - Kty: jwk.Kty, - Crv: jwk.Crv, - X: jwk.X, - Y: jwk.Y, - N: jwk.N, - E: jwk.E, - } -} - -func APIFormatPubKey(key *types.PubKey) *didv1.PubKey { - return &didv1.PubKey{ - Role: APIFormatKeyRole(key.GetRole()), - Algorithm: APIFormatKeyAlgorithm(key.GetAlgorithm()), - Encoding: APIFormatKeyEncoding(key.GetEncoding()), - Curve: APIFormatKeyCurve(key.GetCurve()), - KeyType: APIFormatKeyType(key.GetKeyType()), - Raw: key.GetRaw(), - } -} - -func FormatEC2PublicKey(key *webauthncose.EC2PublicKeyData) (*types.PubKey_JWK, error) { - curve, err := GetCOSECurveName(key.Curve) - if err != nil { - return nil, err - } - - jwkMap := map[string]interface{}{ - "kty": "EC", - "crv": curve, - "x": base64.RawURLEncoding.EncodeToString(key.XCoord), - "y": base64.RawURLEncoding.EncodeToString(key.YCoord), - } - - return MapToJWK(jwkMap) -} - -func FormatRSAPublicKey(key *webauthncose.RSAPublicKeyData) (*types.PubKey_JWK, error) { - jwkMap := map[string]interface{}{ - "kty": "RSA", - "n": base64.RawURLEncoding.EncodeToString(key.Modulus), - "e": base64.RawURLEncoding.EncodeToString(key.Exponent), - } - - return MapToJWK(jwkMap) -} - -func FormatOKPPublicKey(key *webauthncose.OKPPublicKeyData) (*types.PubKey_JWK, error) { - curve, err := GetOKPCurveName(key.Curve) - if err != nil { - return nil, err - } - - jwkMap := map[string]interface{}{ - "kty": "OKP", - "crv": curve, - "x": base64.RawURLEncoding.EncodeToString(key.XCoord), - } - - return MapToJWK(jwkMap) -} - -func MapToJWK(m map[string]interface{}) (*types.PubKey_JWK, error) { - jwk := &types.PubKey_JWK{} - for k, v := range m { - switch k { - case "kty": - jwk.Kty = v.(string) - case "crv": - jwk.Crv = v.(string) - case "x": - jwk.X = v.(string) - case "y": - jwk.Y = v.(string) - case "n": - jwk.N = v.(string) - case "e": - jwk.E = v.(string) - } - } - return jwk, nil -} - -func GetCOSECurveName(curveID int64) (string, error) { - switch curveID { - case int64(webauthncose.P256): - return "P-256", nil - case int64(webauthncose.P384): - return "P-384", nil - case int64(webauthncose.P521): - return "P-521", nil - default: - return "", fmt.Errorf("unknown curve ID: %d", curveID) - } -} - -func GetOKPCurveName(curveID int64) (string, error) { - switch curveID { - case int64(webauthncose.Ed25519): - return "Ed25519", nil - default: - return "", fmt.Errorf("unknown OKP curve ID: %d", curveID) - } -} - -// NormalizeTransports returns the transports as strings -func NormalizeTransports(transports []protocol.AuthenticatorTransport) []string { - tss := make([]string, len(transports)) - for i, t := range transports { - tss[i] = string(t) - } - return tss -} - -// GetTransports returns the protocol.AuthenticatorTransport -func ModuleTransportsToProtocol(transport []string) []protocol.AuthenticatorTransport { - tss := make([]protocol.AuthenticatorTransport, len(transport)) - for i, t := range transport { - tss[i] = protocol.AuthenticatorTransport(t) - } - return tss -} - -// ModuleFormatAPIServiceRecord formats a service record for the module -func ModuleFormatAPIServiceRecord(service *didv1.ServiceRecord) *types.Service { - return &types.Service{ - Id: service.Id, - ServiceType: service.ServiceType, - Authority: service.Authority, - Origin: service.Origin, - Description: service.Description, - ServiceEndpoints: service.ServiceEndpoints, - Permissions: ModuleFormatAPIPermissions(service.Permissions), - } -} - -func ModuleFormatAPIPermissions(permissions *didv1.Permissions) *types.Permissions { - if permissions == nil { - return nil - } - p := types.Permissions{ - Grants: ModuleFormatAPIDIDNamespaces(permissions.Grants), - Scopes: ModuleFormatAPIPermissionScopes(permissions.Scopes), - } - return &p -} - -func ModuleFormatAPIPermissionScope(scope didv1.PermissionScope) types.PermissionScope { - return types.PermissionScope(scope) -} - -func ModuleFormatAPIPermissionScopes(scopes []didv1.PermissionScope) []types.PermissionScope { - var s []types.PermissionScope - for _, scope := range scopes { - s = append(s, ModuleFormatAPIPermissionScope(scope)) - } - return s -} - -func ModuleFormatAPIDIDNamespace(namespace didv1.DIDNamespace) types.DIDNamespace { - return types.DIDNamespace(namespace) -} - -func ModuleFormatAPIDIDNamespaces(namespaces []didv1.DIDNamespace) []types.DIDNamespace { - var s []types.DIDNamespace - for _, namespace := range namespaces { - s = append(s, ModuleFormatAPIDIDNamespace(namespace)) - } - return s -} diff --git a/x/did/builder/chains.go b/x/did/builder/chains.go deleted file mode 100644 index eb3cf805a..000000000 --- a/x/did/builder/chains.go +++ /dev/null @@ -1,70 +0,0 @@ -package builder - -import ( - "crypto/hmac" - "crypto/sha512" - "encoding/binary" - "errors" - "math/big" - - "github.com/btcsuite/btcd/btcec/v2" - "github.com/onsonr/sonr/x/did/types" -) - -// ComputeAccountPublicKey computes the public key of a child key given the extended public key, chain code, and index. -func computeBip32AccountPublicKey(extPubKey PublicKey, chainCode types.ChainCode, index int) (*types.PubKey, error) { - // Check if the index is a hardened child key - if chainCode&0x80000000 != 0 && index < 0 { - return nil, errors.New("invalid index") - } - - // Serialize the public key - pubKey, err := btcec.ParsePubKey(extPubKey.GetRaw()) - if err != nil { - return nil, err - } - pubKeyBytes := pubKey.SerializeCompressed() - - // Serialize the index - indexBytes := make([]byte, 4) - binary.BigEndian.PutUint32(indexBytes, uint32(index)) - - // Compute the HMAC-SHA512 - mac := hmac.New(sha512.New, []byte{byte(chainCode)}) - mac.Write(pubKeyBytes) - mac.Write(indexBytes) - I := mac.Sum(nil) - - // Split I into two 32-byte sequences - IL := I[:32] - - // Convert IL to a big integer - ilNum := new(big.Int).SetBytes(IL) - - // Check if parse256(IL) >= n - curve := btcec.S256() - if ilNum.Cmp(curve.N) >= 0 { - return nil, errors.New("invalid child key") - } - - // Compute the child public key - ilx, ily := curve.ScalarBaseMult(IL) - childX, childY := curve.Add(ilx, ily, pubKey.X(), pubKey.Y()) - lx := newBigIntFieldVal(childX) - ly := newBigIntFieldVal(childY) - - // Create the child public key - childPubKey := btcec.NewPublicKey(lx, ly) - pk, err := types.NewPublicKey(childPubKey.SerializeCompressed(), types.ChainCodeKeyInfos[chainCode]) - if err != nil { - return nil, err - } - return pk, nil -} - -// newBigIntFieldVal creates a new field value from a big integer. -func newBigIntFieldVal(val *big.Int) *btcec.FieldVal { - lx := new(btcec.FieldVal) - lx.SetByteSlice(val.Bytes()) - return lx -} diff --git a/x/did/builder/constants.go b/x/did/builder/constants.go deleted file mode 100644 index be06402c8..000000000 --- a/x/did/builder/constants.go +++ /dev/null @@ -1,334 +0,0 @@ -package builder - -import ( - "github.com/onsonr/sonr/x/did/types" -) - -type ( - AuthenticatorAttachment string - AuthenticatorTransport string -) - -const ( - // Platform represents a platform authenticator is attached using a client device-specific transport, called - // platform attachment, and is usually not removable from the client device. A public key credential bound to a - // platform authenticator is called a platform credential. - Platform AuthenticatorAttachment = "platform" - - // CrossPlatform represents a roaming authenticator is attached using cross-platform transports, called - // cross-platform attachment. Authenticators of this class are removable from, and can "roam" among, client devices. - // A public key credential bound to a roaming authenticator is called a roaming credential. - CrossPlatform AuthenticatorAttachment = "cross-platform" -) - -func ParseAuthenticatorAttachment(s string) AuthenticatorAttachment { - switch s { - case "platform": - return Platform - default: - return CrossPlatform - } -} - -const ( - // USB indicates the respective authenticator can be contacted over removable USB. - USB AuthenticatorTransport = "usb" - - // NFC indicates the respective authenticator can be contacted over Near Field Communication (NFC). - NFC AuthenticatorTransport = "nfc" - - // BLE indicates the respective authenticator can be contacted over Bluetooth Smart (Bluetooth Low Energy / BLE). - BLE AuthenticatorTransport = "ble" - - // SmartCard indicates the respective authenticator can be contacted over ISO/IEC 7816 smart card with contacts. - // - // WebAuthn Level 3. - SmartCard AuthenticatorTransport = "smart-card" - - // Hybrid indicates the respective authenticator can be contacted using a combination of (often separate) - // data-transport and proximity mechanisms. This supports, for example, authentication on a desktop computer using - // a smartphone. - // - // WebAuthn Level 3. - Hybrid AuthenticatorTransport = "hybrid" - - // Internal indicates the respective authenticator is contacted using a client device-specific transport, i.e., it - // is a platform authenticator. These authenticators are not removable from the client device. - Internal AuthenticatorTransport = "internal" -) - -func ParseAuthenticatorTransport(s string) AuthenticatorTransport { - switch s { - case "usb": - return USB - case "nfc": - return NFC - case "ble": - return BLE - case "smart-card": - return SmartCard - case "hybrid": - return Hybrid - default: - return Internal - } -} - -type AuthenticatorFlags byte - -const ( - // FlagUserPresent Bit 00000001 in the byte sequence. Tells us if user is present. Also referred to as the UP flag. - FlagUserPresent AuthenticatorFlags = 1 << iota // Referred to as UP - - // FlagRFU1 is a reserved for future use flag. - FlagRFU1 - - // FlagUserVerified Bit 00000100 in the byte sequence. Tells us if user is verified - // by the authenticator using a biometric or PIN. Also referred to as the UV flag. - FlagUserVerified - - // FlagBackupEligible Bit 00001000 in the byte sequence. Tells us if a backup is eligible for device. Also referred - // to as the BE flag. - FlagBackupEligible // Referred to as BE - - // FlagBackupState Bit 00010000 in the byte sequence. Tells us if a backup state for device. Also referred to as the - // BS flag. - FlagBackupState - - // FlagRFU2 is a reserved for future use flag. - FlagRFU2 - - // FlagAttestedCredentialData Bit 01000000 in the byte sequence. Indicates whether - // the authenticator added attested credential data. Also referred to as the AT flag. - FlagAttestedCredentialData - - // FlagHasExtensions Bit 10000000 in the byte sequence. Indicates if the authenticator data has extensions. Also - // referred to as the ED flag. - FlagHasExtensions -) - -type AttestationFormat string - -const ( - // AttestationFormatPacked is the "packed" attestation statement format is a WebAuthn-optimized format for - // attestation. It uses a very compact but still extensible encoding method. This format is implementable by - // authenticators with limited resources (e.g., secure elements). - AttestationFormatPacked AttestationFormat = "packed" - - // AttestationFormatTPM is the TPM attestation statement format returns an attestation statement in the same format - // as the packed attestation statement format, although the rawData and signature fields are computed differently. - AttestationFormatTPM AttestationFormat = "tpm" - - // AttestationFormatAndroidKey is the attestation statement format for platform authenticators on versions "N", and - // later, which may provide this proprietary "hardware attestation" statement. - AttestationFormatAndroidKey AttestationFormat = "android-key" - - // AttestationFormatAndroidSafetyNet is the attestation statement format that Android-based platform authenticators - // MAY produce an attestation statement based on the Android SafetyNet API. - AttestationFormatAndroidSafetyNet AttestationFormat = "android-safetynet" - - // AttestationFormatFIDOUniversalSecondFactor is the attestation statement format that is used with FIDO U2F - // authenticators. - AttestationFormatFIDOUniversalSecondFactor AttestationFormat = "fido-u2f" - - // AttestationFormatApple is the attestation statement format that is used with Apple devices' platform - // authenticators. - AttestationFormatApple AttestationFormat = "apple" - - // AttestationFormatNone is the attestation statement format that is used to replace any authenticator-provided - // attestation statement when a WebAuthn Relying Party indicates it does not wish to receive attestation information. - AttestationFormatNone AttestationFormat = "none" -) - -func ExtractAttestationFormats(p *types.Params) []AttestationFormat { - var formats []AttestationFormat - for _, v := range p.AttestationFormats { - formats = append(formats, parseAttestationFormat(v)) - } - return formats -} - -func parseAttestationFormat(s string) AttestationFormat { - switch s { - case "packed": - return AttestationFormatPacked - case "tpm": - return AttestationFormatTPM - case "android-key": - return AttestationFormatAndroidKey - case "android-safetynet": - return AttestationFormatAndroidSafetyNet - case "fido-u2f": - return AttestationFormatFIDOUniversalSecondFactor - case "apple": - return AttestationFormatApple - case "none": - return AttestationFormatNone - default: - return AttestationFormatPacked - } -} - -type CredentialType string - -const ( - CredentialTypePublicKeyCredential CredentialType = "public-key" -) - -type ConveyancePreference string - -const ( - // PreferNoAttestation is a ConveyancePreference value. - // - // This value indicates that the Relying Party is not interested in authenticator attestation. For example, in order - // to potentially avoid having to obtain user consent to relay identifying information to the Relying Party, or to - // save a round trip to an Attestation CA or Anonymization CA. - // - // This is the default value. - // - // Specification: §5.4.7. Attestation Conveyance Preference Enumeration (https://www.w3.org/TR/webauthn/#dom-attestationconveyancepreference-none) - PreferNoAttestation ConveyancePreference = "none" - - // PreferIndirectAttestation is a ConveyancePreference value. - // - // This value indicates that the Relying Party prefers an attestation conveyance yielding verifiable attestation - // statements, but allows the client to decide how to obtain such attestation statements. The client MAY replace the - // authenticator-generated attestation statements with attestation statements generated by an Anonymization CA, in - // order to protect the user’s privacy, or to assist Relying Parties with attestation verification in a - // heterogeneous ecosystem. - // - // Note: There is no guarantee that the Relying Party will obtain a verifiable attestation statement in this case. - // For example, in the case that the authenticator employs self attestation. - // - // Specification: §5.4.7. Attestation Conveyance Preference Enumeration (https://www.w3.org/TR/webauthn/#dom-attestationconveyancepreference-indirect) - PreferIndirectAttestation ConveyancePreference = "indirect" - - // PreferDirectAttestation is a ConveyancePreference value. - // - // This value indicates that the Relying Party wants to receive the attestation statement as generated by the - // authenticator. - // - // Specification: §5.4.7. Attestation Conveyance Preference Enumeration (https://www.w3.org/TR/webauthn/#dom-attestationconveyancepreference-direct) - PreferDirectAttestation ConveyancePreference = "direct" - - // PreferEnterpriseAttestation is a ConveyancePreference value. - // - // This value indicates that the Relying Party wants to receive an attestation statement that may include uniquely - // identifying information. This is intended for controlled deployments within an enterprise where the organization - // wishes to tie registrations to specific authenticators. User agents MUST NOT provide such an attestation unless - // the user agent or authenticator configuration permits it for the requested RP ID. - // - // If permitted, the user agent SHOULD signal to the authenticator (at invocation time) that enterprise - // attestation is requested, and convey the resulting AAGUID and attestation statement, unaltered, to the Relying - // Party. - // - // Specification: §5.4.7. Attestation Conveyance Preference Enumeration (https://www.w3.org/TR/webauthn/#dom-attestationconveyancepreference-enterprise) - PreferEnterpriseAttestation ConveyancePreference = "enterprise" -) - -func ExtractConveyancePreference(p *types.Params) ConveyancePreference { - switch p.ConveyancePreference { - case "none": - return PreferNoAttestation - case "indirect": - return PreferIndirectAttestation - case "direct": - return PreferDirectAttestation - case "enterprise": - return PreferEnterpriseAttestation - default: - return PreferNoAttestation - } -} - -type PublicKeyCredentialHints string - -const ( - // PublicKeyCredentialHintSecurityKey is a PublicKeyCredentialHint that indicates that the Relying Party believes - // that users will satisfy this request with a physical security key. For example, an enterprise Relying Party may - // set this hint if they have issued security keys to their employees and will only accept those authenticators for - // registration and authentication. - // - // For compatibility with older user agents, when this hint is used in PublicKeyCredentialCreationOptions, the - // authenticatorAttachment SHOULD be set to cross-platform. - PublicKeyCredentialHintSecurityKey PublicKeyCredentialHints = "security-key" - - // PublicKeyCredentialHintClientDevice is a PublicKeyCredentialHint that indicates that the Relying Party believes - // that users will satisfy this request with a platform authenticator attached to the client device. - // - // For compatibility with older user agents, when this hint is used in PublicKeyCredentialCreationOptions, the - // authenticatorAttachment SHOULD be set to platform. - PublicKeyCredentialHintClientDevice PublicKeyCredentialHints = "client-device" - - // PublicKeyCredentialHintHybrid is a PublicKeyCredentialHint that indicates that the Relying Party believes that - // users will satisfy this request with general-purpose authenticators such as smartphones. For example, a consumer - // Relying Party may believe that only a small fraction of their customers possesses dedicated security keys. This - // option also implies that the local platform authenticator should not be promoted in the UI. - // - // For compatibility with older user agents, when this hint is used in PublicKeyCredentialCreationOptions, the - // authenticatorAttachment SHOULD be set to cross-platform. - PublicKeyCredentialHintHybrid PublicKeyCredentialHints = "hybrid" -) - -func ParsePublicKeyCredentialHints(s string) PublicKeyCredentialHints { - switch s { - case "security-key": - return PublicKeyCredentialHintSecurityKey - case "client-device": - return PublicKeyCredentialHintClientDevice - case "hybrid": - return PublicKeyCredentialHintHybrid - default: - return "" - } -} - -type AttestedCredentialData struct { - AAGUID []byte `json:"aaguid"` - CredentialID []byte `json:"credential_id"` - - // The raw credential public key bytes received from the attestation data. - CredentialPublicKey []byte `json:"public_key"` -} - -type ResidentKeyRequirement string - -const ( - // ResidentKeyRequirementDiscouraged indicates the Relying Party prefers creating a server-side credential, but will - // accept a client-side discoverable credential. This is the default. - ResidentKeyRequirementDiscouraged ResidentKeyRequirement = "discouraged" - - // ResidentKeyRequirementPreferred indicates to the client we would prefer a discoverable credential. - ResidentKeyRequirementPreferred ResidentKeyRequirement = "preferred" - - // ResidentKeyRequirementRequired indicates the Relying Party requires a client-side discoverable credential, and is - // prepared to receive an error if a client-side discoverable credential cannot be created. - ResidentKeyRequirementRequired ResidentKeyRequirement = "required" -) - -func ParseResidentKeyRequirement(s string) ResidentKeyRequirement { - switch s { - case "discouraged": - return ResidentKeyRequirementDiscouraged - case "preferred": - return ResidentKeyRequirementPreferred - default: - return ResidentKeyRequirementRequired - } -} - -type ( - AuthenticationExtensions map[string]any - UserVerificationRequirement string -) - -const ( - // VerificationRequired User verification is required to create/release a credential - VerificationRequired UserVerificationRequirement = "required" - - // VerificationPreferred User verification is preferred to create/release a credential - VerificationPreferred UserVerificationRequirement = "preferred" // This is the default - - // VerificationDiscouraged The authenticator should not verify the user for the credential - VerificationDiscouraged UserVerificationRequirement = "discouraged" -) diff --git a/x/did/builder/macroon.go b/x/did/builder/macroon.go deleted file mode 100644 index aacdbfb2a..000000000 --- a/x/did/builder/macroon.go +++ /dev/null @@ -1,48 +0,0 @@ -package builder - -import ( - "net/http" - - "github.com/labstack/echo/v4" - "gopkg.in/macaroon.v2" - - "gopkg.in/macaroon-bakery.v2/bakery/checkers" -) - -var PermissionNamespace *checkers.Namespace - -func ValidateMacaroonMiddleware(secretKey []byte, location string) echo.MiddlewareFunc { - return func(next echo.HandlerFunc) echo.HandlerFunc { - return func(c echo.Context) error { - // Extract the macaroon from the Authorization header - auth := c.Request().Header.Get("Authorization") - if auth == "" { - return c.JSON(http.StatusUnauthorized, map[string]string{"error": "Missing Authorization header"}) - } - - // Decode the macaroon - mac, err := macaroon.Base64Decode([]byte(auth)) - if err != nil { - return c.JSON(http.StatusBadRequest, map[string]string{"error": "Invalid macaroon encoding"}) - } - - token, err := macaroon.New(secretKey, mac, location, macaroon.LatestVersion) - if err != nil { - return c.JSON(http.StatusBadRequest, map[string]string{"error": "Invalid macaroon"}) - } - - // Verify the macaroon - err = token.Verify(secretKey, func(caveat string) error { - // Implement your caveat verification logic here - // For example, you might check if the caveat is still valid (e.g., not expired) - return nil // Return nil if the caveat is valid - }, nil) - if err != nil { - return c.JSON(http.StatusUnauthorized, map[string]string{"error": "Invalid macaroon"}) - } - - // Macaroon is valid, proceed to the next handler - return next(c) - } - } -} diff --git a/x/did/builder/openid.go b/x/did/builder/openid.go deleted file mode 100644 index acd3ba380..000000000 --- a/x/did/builder/openid.go +++ /dev/null @@ -1,27 +0,0 @@ -package builder - -import ( - "fmt" - - "github.com/onsonr/sonr/x/did/types/oidc" -) - -func GetDiscovery(origin string) *oidc.DiscoveryDocument { - baseURL := "https://" + origin // Ensure this is the correct base URL for your service - discoveryDoc := &oidc.DiscoveryDocument{ - Issuer: baseURL, - AuthorizationEndpoint: fmt.Sprintf("%s/auth", baseURL), - TokenEndpoint: fmt.Sprintf("%s/token", baseURL), - UserinfoEndpoint: fmt.Sprintf("%s/userinfo", baseURL), - JwksUri: fmt.Sprintf("%s/jwks", baseURL), - RegistrationEndpoint: fmt.Sprintf("%s/register", baseURL), - ScopesSupported: []string{"openid", "profile", "email", "web3", "sonr"}, - ResponseTypesSupported: []string{"code"}, - ResponseModesSupported: []string{"query", "form_post"}, - GrantTypesSupported: []string{"authorization_code", "refresh_token"}, - AcrValuesSupported: []string{"passkey"}, - SubjectTypesSupported: []string{"public"}, - ClaimsSupported: []string{"sub", "iss", "name", "email"}, - } - return discoveryDoc -} diff --git a/x/did/builder/options.go b/x/did/builder/options.go deleted file mode 100644 index 828af608e..000000000 --- a/x/did/builder/options.go +++ /dev/null @@ -1,82 +0,0 @@ -package builder - -import ( - "encoding/json" - - "github.com/onsonr/sonr/x/did/types" -) - -type AuthenticatorResponse struct { - // From the spec https://www.w3.org/TR/webauthn/#dom-authenticatorresponse-clientdatajson - // This attribute contains a JSON serialization of the client data passed to the authenticator - // by the client in its call to either create() or get(). - ClientDataJSON URLEncodedBase64 `json:"clientDataJSON"` -} - -type AuthenticatorAttestationResponse struct { - // The byte slice of clientDataJSON, which becomes CollectedClientData - AuthenticatorResponse - - Transports []string `json:"transports,omitempty"` - - AuthenticatorData URLEncodedBase64 `json:"authenticatorData"` - - PublicKey URLEncodedBase64 `json:"publicKey"` - - PublicKeyAlgorithm int64 `json:"publicKeyAlgorithm"` - - // AttestationObject is the byte slice version of attestationObject. - // This attribute contains an attestation object, which is opaque to, and - // cryptographically protected against tampering by, the client. The - // attestation object contains both authenticator data and an attestation - // statement. The former contains the AAGUID, a unique credential ID, and - // the credential public key. The contents of the attestation statement are - // determined by the attestation statement format used by the authenticator. - // It also contains any additional information that the Relying Party's server - // requires to validate the attestation statement, as well as to decode and - // validate the authenticator data along with the JSON-serialized client data. - AttestationObject URLEncodedBase64 `json:"attestationObject"` -} - -type PublicKeyCredentialCreationOptions struct { - RelyingParty RelyingPartyEntity `json:"rp"` - User UserEntity `json:"user"` - Challenge URLEncodedBase64 `json:"challenge"` - Parameters []CredentialParameter `json:"pubKeyCredParams,omitempty"` - Timeout int `json:"timeout,omitempty"` - CredentialExcludeList []CredentialDescriptor `json:"excludeCredentials,omitempty"` - AuthenticatorSelection AuthenticatorSelection `json:"authenticatorSelection,omitempty"` - Hints []PublicKeyCredentialHints `json:"hints,omitempty"` - Attestation ConveyancePreference `json:"attestation,omitempty"` - AttestationFormats []AttestationFormat `json:"attestationFormats,omitempty"` - Extensions AuthenticationExtensions `json:"extensions,omitempty"` -} - -func GetPublicKeyCredentialCreationOptions(origin string, subject string, vaultCID string, params *types.Params) (*PublicKeyCredentialCreationOptions, error) { - chal, err := CreateChallenge() - if err != nil { - return nil, err - } - return &PublicKeyCredentialCreationOptions{ - RelyingParty: NewRelayingParty(origin, subject), - User: NewUserEntity(subject, subject, vaultCID), - Parameters: ExtractCredentialParameters(params), - Timeout: 20, - CredentialExcludeList: nil, - Challenge: chal, - AuthenticatorSelection: AuthenticatorSelection{}, - Hints: nil, - Attestation: ExtractConveyancePreference(params), - AttestationFormats: ExtractAttestationFormats(params), - Extensions: nil, - }, nil -} - -func UnmarshalAuthenticatorResponse(data []byte) (*AuthenticatorResponse, error) { - var ar AuthenticatorResponse - err := json.Unmarshal(data, &ar) - if err != nil { - return nil, err - } - return &ar, nil -} diff --git a/x/did/builder/pubkey.go b/x/did/builder/pubkey.go deleted file mode 100644 index 2c408b1ab..000000000 --- a/x/did/builder/pubkey.go +++ /dev/null @@ -1,81 +0,0 @@ -package builder - -import ( - "fmt" - - cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" - didv1 "github.com/onsonr/sonr/api/did/v1" - "github.com/onsonr/sonr/x/did/types" - - "github.com/go-webauthn/webauthn/protocol/webauthncose" -) - -// PublicKey is an interface for a public key -type PublicKey interface { - cryptotypes.PubKey - Clone() cryptotypes.PubKey - GetRaw() []byte - GetRole() types.KeyRole - GetAlgorithm() types.KeyAlgorithm - GetEncoding() types.KeyEncoding - GetCurve() types.KeyCurve - GetKeyType() types.KeyType -} - -// CreateAuthnVerification creates a new verification method for an authn method -func CreateAuthnVerification(namespace types.DIDNamespace, issuer string, controller string, pubkey *types.PubKey, identifier string) *types.VerificationMethod { - return &types.VerificationMethod{ - Method: namespace, - Controller: controller, - PublicKey: pubkey, - Id: identifier, - Issuer: issuer, - } -} - -// CreateWalletVerification creates a new verification method for a wallet -func CreateWalletVerification(namespace types.DIDNamespace, controller string, pubkey *types.PubKey, identifier string) *didv1.VerificationMethod { - return &didv1.VerificationMethod{ - Method: APIFormatDIDNamespace(namespace), - Controller: controller, - PublicKey: APIFormatPubKey(pubkey), - Id: identifier, - } -} - -// ExtractWebAuthnPublicKey parses the raw public key bytes and returns a JWK representation -func ExtractWebAuthnPublicKey(keyBytes []byte) (*types.PubKey_JWK, error) { - key, err := webauthncose.ParsePublicKey(keyBytes) - if err != nil { - return nil, fmt.Errorf("failed to parse public key: %w", err) - } - - switch k := key.(type) { - case *webauthncose.EC2PublicKeyData: - return FormatEC2PublicKey(k) - case *webauthncose.RSAPublicKeyData: - return FormatRSAPublicKey(k) - case *webauthncose.OKPPublicKeyData: - return FormatOKPPublicKey(k) - default: - return nil, fmt.Errorf("unsupported key type") - } -} - -// NewInitialWalletAccounts creates a new set of verification methods for a wallet -func NewInitialWalletAccounts(controller string, pubkey *types.PubKey) ([]*didv1.VerificationMethod, error) { - var verificationMethods []*didv1.VerificationMethod - for method, chain := range types.InitialChainCodes { - nk, err := computeBip32AccountPublicKey(pubkey, chain, 0) - if err != nil { - return nil, err - } - - addr, err := chain.FormatAddress(nk) - if err != nil { - return nil, nil - } - verificationMethods = append(verificationMethods, CreateWalletVerification(method, controller, nk, method.FormatDID(addr))) - } - return verificationMethods, nil -} diff --git a/x/did/builder/scopes.go b/x/did/builder/scopes.go deleted file mode 100644 index 2635d6204..000000000 --- a/x/did/builder/scopes.go +++ /dev/null @@ -1,56 +0,0 @@ -package builder - -import ( - "github.com/onsonr/sonr/x/did/types" - "gopkg.in/macaroon-bakery.v2/bakery/checkers" -) - -var ( - GenericPermissionScopeStrings = [...]string{ - "profile.name", - "identifiers.email", - "identifiers.phone", - "transactions.read", - "transactions.write", - "wallets.read", - "wallets.create", - "wallets.subscribe", - "wallets.update", - "transactions.verify", - "transactions.broadcast", - "admin.user", - "admin.validator", - } - - StringToModulePermissionScope = map[string]types.PermissionScope{ - "PERMISSION_SCOPE_UNSPECIFIED": types.PermissionScope_PERMISSION_SCOPE_UNSPECIFIED, - "PERMISSION_SCOPE_BASIC_INFO": types.PermissionScope_PERMISSION_SCOPE_BASIC_INFO, - "PERMISSION_SCOPE_IDENTIFIERS_EMAIL": types.PermissionScope_PERMISSION_SCOPE_PERMISSIONS_READ, - "PERMISSION_SCOPE_IDENTIFIERS_PHONE": types.PermissionScope_PERMISSION_SCOPE_PERMISSIONS_WRITE, - "PERMISSION_SCOPE_TRANSACTIONS_READ": types.PermissionScope_PERMISSION_SCOPE_TRANSACTIONS_READ, - "PERMISSION_SCOPE_TRANSACTIONS_WRITE": types.PermissionScope_PERMISSION_SCOPE_TRANSACTIONS_WRITE, - "PERMISSION_SCOPE_WALLETS_READ": types.PermissionScope_PERMISSION_SCOPE_WALLETS_READ, - "PERMISSION_SCOPE_WALLETS_CREATE": types.PermissionScope_PERMISSION_SCOPE_WALLETS_CREATE, - "PERMISSION_SCOPE_WALLETS_SUBSCRIBE": types.PermissionScope_PERMISSION_SCOPE_WALLETS_SUBSCRIBE, - "PERMISSION_SCOPE_WALLETS_UPDATE": types.PermissionScope_PERMISSION_SCOPE_WALLETS_UPDATE, - "PERMISSION_SCOPE_TRANSACTIONS_VERIFY": types.PermissionScope_PERMISSION_SCOPE_TRANSACTIONS_VERIFY, - "PERMISSION_SCOPE_TRANSACTIONS_BROADCAST": types.PermissionScope_PERMISSION_SCOPE_TRANSACTIONS_BROADCAST, - "PERMISSION_SCOPE_ADMIN_USER": types.PermissionScope_PERMISSION_SCOPE_ADMIN_USER, - "PERMISSION_SCOPE_ADMIN_VALIDATOR": types.PermissionScope_PERMISSION_SCOPE_ADMIN_VALIDATOR, - } -) - -func ResolvePermissionScope(scope string) (types.PermissionScope, bool) { - uriToPrefix := make(map[string]string) - for _, scope := range GenericPermissionScopeStrings { - uriToPrefix["https://example.com/auth/"+scope] = scope - } - PermissionNamespace := checkers.NewNamespace(uriToPrefix) - - prefix, ok := PermissionNamespace.Resolve("https://example.com/auth/" + scope) - if !ok { - return 0, false - } - permScope, ok := StringToModulePermissionScope[prefix] - return permScope, ok -} diff --git a/x/did/builder/service.go b/x/did/builder/service.go deleted file mode 100644 index b5e33a96f..000000000 --- a/x/did/builder/service.go +++ /dev/null @@ -1,103 +0,0 @@ -package builder - -import ( - "crypto/rand" - "strings" - - "github.com/onsonr/sonr/x/did/types" -) - -// ChallengeLength - Length of bytes to generate for a challenge. -const ChallengeLength = 32 - -// CreateChallenge creates a new challenge that should be signed and returned by the authenticator. The spec recommends -// using at least 16 bytes with 100 bits of entropy. We use 32 bytes. -func CreateChallenge() (challenge URLEncodedBase64, err error) { - challenge = make([]byte, ChallengeLength) - - if _, err = rand.Read(challenge); err != nil { - return nil, err - } - - return challenge, nil -} - -type CredentialEntity struct { - // A human-palatable name for the entity. Its function depends on what the PublicKeyCredentialEntity represents: - // - // When inherited by PublicKeyCredentialRpEntity it is a human-palatable identifier for the Relying Party, - // intended only for display. For example, "ACME Corporation", "Wonderful Widgets, Inc." or "ОАО Примертех". - // - // When inherited by PublicKeyCredentialUserEntity, it is a human-palatable identifier for a user account. It is - // intended only for display, i.e., aiding the user in determining the difference between user accounts with similar - // displayNames. For example, "alexm", "alex.p.mueller@example.com" or "+14255551234". - Name string `json:"name"` -} - -func NewCredentialEntity(name string) CredentialEntity { - return CredentialEntity{ - Name: name, - } -} - -type CredentialParameter struct { - Type CredentialType `json:"type"` - Algorithm types.COSEAlgorithmIdentifier `json:"alg"` -} - -func NewCredentialParameter(ki *types.KeyInfo) CredentialParameter { - return CredentialParameter{ - Type: CredentialTypePublicKeyCredential, - Algorithm: ki.Algorithm.CoseIdentifier(), - } -} - -func ExtractCredentialParameters(p *types.Params) []CredentialParameter { - var keys []*types.KeyInfo - for k, v := range p.AllowedPublicKeys { - if strings.Contains(k, "webauthn") { - keys = append(keys, v) - } - } - var cparams []CredentialParameter - for _, ki := range keys { - cparams = append(cparams, NewCredentialParameter(ki)) - } - return cparams -} - -type RelyingPartyEntity struct { - CredentialEntity - - // A unique identifier for the Relying Party entity, which sets the RP ID. - ID string `json:"id"` -} - -func NewRelayingParty(name string, origin string) RelyingPartyEntity { - return RelyingPartyEntity{ - CredentialEntity: NewCredentialEntity(origin), - ID: origin, - } -} - -type UserEntity struct { - CredentialEntity - // A human-palatable name for the user account, intended only for display. - // For example, "Alex P. Müller" or "田中 倫". The Relying Party SHOULD let - // the user choose this, and SHOULD NOT restrict the choice more than necessary. - DisplayName string `json:"displayName"` - - // ID is the user handle of the user account entity. To ensure secure operation, - // authentication and authorization decisions MUST be made on the basis of this id - // member, not the displayName nor name members. See Section 6.1 of - // [RFC8266](https://www.w3.org/TR/webauthn/#biblio-rfc8266). - ID any `json:"id"` -} - -func NewUserEntity(name string, subject string, cid string) UserEntity { - return UserEntity{ - CredentialEntity: NewCredentialEntity(name), - DisplayName: subject, - ID: cid, - } -} diff --git a/x/did/builder/signer.go b/x/did/builder/signer.go deleted file mode 100644 index b7b3fc33a..000000000 --- a/x/did/builder/signer.go +++ /dev/null @@ -1,59 +0,0 @@ -package builder - -import ( - "github.com/onsonr/crypto" - "github.com/onsonr/sonr/x/did/types" -) - -type Signer interface { - Sign(msg []byte) ([]byte, error) - Verify(msg []byte, sig []byte) error - PublicKey() []byte -} - -type signer struct { - user *types.Keyshare - val *types.Keyshare -} - -func (k signer) Sign(msg []byte) ([]byte, error) { - valSignFunc, err := crypto.GetSignFunc(k.val, msg) - if err != nil { - return nil, err - } - usrSignFunc, err := crypto.GetSignFunc(k.user, msg) - if err != nil { - return nil, err - } - sig, err := crypto.RunMPCSign(valSignFunc, usrSignFunc) - if err != nil { - return nil, err - } - return crypto.SerializeMPCSignature(sig) -} - -func (k signer) Verify(msg []byte, sig []byte) error { - sigMpc, err := crypto.DeserializeMPCSignature(sig) - if err != nil { - return err - } - pk, err := crypto.GetECDSAPublicKey(k.val) - if err != nil { - return err - } - ok := crypto.VerifyMPCSignature(sigMpc, msg, pk) - if !ok { - return types.ErrInvalidSignature - } - return nil -} - -func (k signer) PublicKey() []byte { - if k.user != nil { - return k.user.PublicKey - } - if k.val != nil { - return k.val.PublicKey - } - return nil -} diff --git a/x/did/builder/webauthn.go b/x/did/builder/webauthn.go deleted file mode 100644 index 098f91356..000000000 --- a/x/did/builder/webauthn.go +++ /dev/null @@ -1,169 +0,0 @@ -package builder - -import ( - "bytes" - "encoding/base64" - "reflect" - - "github.com/go-webauthn/webauthn/protocol" -) - -// Credential contains all needed information about a WebAuthn credential for storage. -type Credential struct { - Subject string `json:"handle"` - AttestationType string `json:"attestationType"` - Origin string `json:"origin"` - CredentialID []byte `json:"id"` - PublicKey []byte `json:"publicKey"` - Transport []string `json:"transport"` - SignCount uint32 `json:"signCount"` - UserPresent bool `json:"userPresent"` - UserVerified bool `json:"userVerified"` - BackupEligible bool `json:"backupEligible"` - BackupState bool `json:"backupState"` - CloneWarning bool `json:"cloneWarning"` -} - -// NewCredential will return a credential pointer on successful validation of a registration response. -func NewCredential(c *protocol.ParsedCredentialCreationData, origin, handle string) *Credential { - return &Credential{ - Subject: handle, - Origin: origin, - AttestationType: c.Response.AttestationObject.Format, - CredentialID: c.Response.AttestationObject.AuthData.AttData.CredentialID, - PublicKey: c.Response.AttestationObject.AuthData.AttData.CredentialPublicKey, - Transport: NormalizeTransports(c.Response.Transports), - SignCount: c.Response.AttestationObject.AuthData.Counter, - UserPresent: c.Response.AttestationObject.AuthData.Flags.HasUserPresent(), - UserVerified: c.Response.AttestationObject.AuthData.Flags.HasUserVerified(), - BackupEligible: c.Response.AttestationObject.AuthData.Flags.HasBackupEligible(), - BackupState: c.Response.AttestationObject.AuthData.Flags.HasAttestedCredentialData(), - } -} - -// Descriptor converts a Credential into a protocol.CredentialDescriptor. -func (c *Credential) Descriptor() protocol.CredentialDescriptor { - return protocol.CredentialDescriptor{ - Type: protocol.PublicKeyCredentialType, - CredentialID: c.CredentialID, - Transport: ModuleTransportsToProtocol(c.Transport), - AttestationType: c.AttestationType, - } -} - -// This is a signal that the authenticator may be cloned, see CloneWarning above for more information. -func (a *Credential) UpdateCounter(authDataCount uint32) { - if authDataCount <= a.SignCount && (authDataCount != 0 || a.SignCount != 0) { - a.CloneWarning = true - return - } - - a.SignCount = authDataCount -} - -type CredentialDescriptor struct { - // The valid credential types. - Type CredentialType `json:"type"` - - // CredentialID The ID of a credential to allow/disallow. - CredentialID URLEncodedBase64 `json:"id"` - - // The authenticator transports that can be used. - Transport []AuthenticatorTransport `json:"transports,omitempty"` - - // The AttestationType from the Credential. Used internally only. - AttestationType string `json:"-"` -} - -func NewCredentialDescriptor(credentialID string, transports []AuthenticatorTransport, attestationType string) *CredentialDescriptor { - return &CredentialDescriptor{ - CredentialID: URLEncodedBase64(credentialID), - Transport: transports, - AttestationType: attestationType, - Type: CredentialTypePublicKeyCredential, - } -} - -type AuthenticatorSelection struct { - // AuthenticatorAttachment If this member is present, eligible authenticators are filtered to only - // authenticators attached with the specified AuthenticatorAttachment enum. - AuthenticatorAttachment AuthenticatorAttachment `json:"authenticatorAttachment,omitempty"` - - // RequireResidentKey this member describes the Relying Party's requirements regarding resident - // credentials. If the parameter is set to true, the authenticator MUST create a client-side-resident - // public key credential source when creating a public key credential. - RequireResidentKey *bool `json:"requireResidentKey,omitempty"` - - // ResidentKey this member describes the Relying Party's requirements regarding resident - // credentials per Webauthn Level 2. - ResidentKey ResidentKeyRequirement `json:"residentKey,omitempty"` - - // UserVerification This member describes the Relying Party's requirements regarding user verification for - // the create() operation. Eligible authenticators are filtered to only those capable of satisfying this - // requirement. - UserVerification UserVerificationRequirement `json:"userVerification,omitempty"` -} - -type AuthenticatorData struct { - RPIDHash []byte `json:"rpid"` - Flags AuthenticatorFlags `json:"flags"` - Counter uint32 `json:"sign_count"` - AttData AttestedCredentialData `json:"att_data"` - ExtData []byte `json:"ext_data"` -} - -type AttestationObject struct { - // The authenticator data, including the newly created public key. See AuthenticatorData for more info - AuthData AuthenticatorData - - // The byteform version of the authenticator data, used in part for signature validation - RawAuthData []byte `json:"authData"` - - // The format of the Attestation data. - Format string `json:"fmt"` - - // The attestation statement data sent back if attestation is requested. - AttStatement map[string]any `json:"attStmt,omitempty"` -} - -type URLEncodedBase64 []byte - -func (e URLEncodedBase64) String() string { - return base64.RawURLEncoding.EncodeToString(e) -} - -// UnmarshalJSON base64 decodes a URL-encoded value, storing the result in the -// provided byte slice. -func (e *URLEncodedBase64) UnmarshalJSON(data []byte) error { - if bytes.Equal(data, []byte("null")) { - return nil - } - - // Trim the leading spaces. - data = bytes.Trim(data, "\"") - - // Trim the trailing equal characters. - data = bytes.TrimRight(data, "=") - - out := make([]byte, base64.RawURLEncoding.DecodedLen(len(data))) - - n, err := base64.RawURLEncoding.Decode(out, data) - if err != nil { - return err - } - - v := reflect.ValueOf(e).Elem() - v.SetBytes(out[:n]) - - return nil -} - -// MarshalJSON base64 encodes a non URL-encoded value, storing the result in the -// provided byte slice. -func (e URLEncodedBase64) MarshalJSON() ([]byte, error) { - if e == nil { - return []byte("null"), nil - } - - return []byte(`"` + base64.RawURLEncoding.EncodeToString(e) + `"`), nil -} diff --git a/x/did/keeper/genesis.go b/x/did/keeper/genesis.go index c1ff8a62a..a1b904878 100644 --- a/x/did/keeper/genesis.go +++ b/x/did/keeper/genesis.go @@ -2,7 +2,6 @@ package keeper import ( "context" - "time" "cosmossdk.io/log" sdk "github.com/cosmos/cosmos-sdk/types" diff --git a/x/did/keeper/ipfs.go b/x/did/keeper/ipfs.go deleted file mode 100644 index c02b39dea..000000000 --- a/x/did/keeper/ipfs.go +++ /dev/null @@ -1,106 +0,0 @@ -package keeper - -import ( - "context" - "fmt" - "time" - - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/ipfs/boxo/files" - "github.com/ipfs/boxo/path" - "github.com/ipfs/kubo/client/rpc" - "github.com/ipfs/kubo/core/coreiface/options" - "github.com/onsonr/sonr/internal/vfs" -) - -// assembleInitialVault assembles the initial vault -func (k Keeper) assembleInitialVault(ctx sdk.Context) (string, int64, error) { - cid, err := k.ipfsClient.Unixfs().Add(context.Background(), vfs.AssembleDirectory()) - if err != nil { - return "", 0, err - } - return cid.String(), k.GetExpirationBlockHeight(ctx, time.Second*15), nil -} - -// pinInitialVault pins the initial vault to the local IPFS node -func (k Keeper) pinInitialVault(_ sdk.Context, cid string, address string) (bool, error) { - // Resolve the path - path, err := path.NewPath(cid) - if err != nil { - return false, err - } - - // 1. Initialize vault.db sqlite database in local IPFS with Mount - - // 2. Insert the InitialWalletAccounts - - // 3. Publish the path to the IPNS - _, err = k.ipfsClient.Name().Publish(context.Background(), path, options.Name.Key(address)) - if err != nil { - return false, err - } - - // 4. Insert the accounts into x/auth - - // 5. Insert the controller into state - return true, nil -} - -// GetFromIPFS gets a file from the local IPFS node -func (k Keeper) GetFromIPFS(ctx sdk.Context, cid string) (files.Directory, error) { - path, err := path.NewPath(cid) - if err != nil { - return nil, err - } - node, err := k.ipfsClient.Unixfs().Get(ctx, path) - if err != nil { - return nil, err - } - dir, ok := node.(files.Directory) - if !ok { - return nil, fmt.Errorf("retrieved node is not a directory") - } - return dir, nil -} - -// HasIPFSConnection returns true if the IPFS client is initialized -func (k *Keeper) HasIPFSConnection() bool { - if k.ipfsClient == nil { - ipfsClient, err := rpc.NewLocalApi() - if err != nil { - return false - } - k.ipfsClient = ipfsClient - } - return k.ipfsClient != nil -} - -// HasPathInIPFS checks if a file is in the local IPFS node -func (k Keeper) HasPathInIPFS(ctx sdk.Context, cid string) (bool, error) { - path, err := path.NewPath(cid) - if err != nil { - return false, err - } - v, err := k.ipfsClient.Unixfs().Get(ctx, path) - if err != nil { - return false, err - } - - if v == nil { - return false, nil - } - return true, nil -} - -// PinToIPFS pins a file to the local IPFS node -func (k Keeper) PinToIPFS(ctx sdk.Context, cid string, name string) error { - path, err := path.NewPath(cid) - if err != nil { - return err - } - err = k.ipfsClient.Pin().Add(ctx, path, options.Pin.Name(name)) - if err != nil { - return err - } - return nil -} diff --git a/x/did/keeper/server.go b/x/did/keeper/server.go index 7abf637a2..8796dbf41 100644 --- a/x/did/keeper/server.go +++ b/x/did/keeper/server.go @@ -2,7 +2,6 @@ package keeper import ( "context" - "encoding/json" "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" @@ -107,3 +106,10 @@ func (ms msgServer) UpdateParams( } return nil, ms.k.Params.Set(ctx, msg.Params) } + +// ExecuteTx implements types.MsgServer. +func (ms msgServer) ExecuteTx(ctx context.Context, msg *types.MsgExecuteTx) (*types.MsgExecuteTxResponse, error) { + // ctx := sdk.UnwrapSDKContext(goCtx) + panic("ExecuteTx is unimplemented") + return &types.MsgExecuteTxResponse{}, nil +} diff --git a/x/did/keeper/state.go b/x/did/keeper/state.go deleted file mode 100644 index f8d8ac04b..000000000 --- a/x/did/keeper/state.go +++ /dev/null @@ -1,37 +0,0 @@ -package keeper - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/onsonr/sonr/x/did/builder" - "github.com/onsonr/sonr/x/did/types" -) - -// insertService inserts a service record into the database -func (k Keeper) insertService( - ctx sdk.Context, - svc *types.Service, -) (*types.MsgRegisterServiceResponse, error) { - record := builder.APIFormatServiceRecord(svc) - err := k.OrmDB.ServiceRecordTable().Insert(ctx, record) - if err != nil { - return nil, err - } - return &types.MsgRegisterServiceResponse{ - Success: true, - Did: record.Id, - }, nil -func (k Keeper) insertAliasFromDisplayName() { -} - -func (k Keeper) insertAssertionFromIdentity() { -} - -func (k Keeper) insertAuthenticationFromCredential() { -} - -func (k Keeper) insertControllerFromMotrVault() { -} - -func (k Keeper) insertDelegationFromAccount() { -} diff --git a/x/did/module.go b/x/did/module.go index 606c2b5b1..3d04d2c14 100644 --- a/x/did/module.go +++ b/x/did/module.go @@ -67,8 +67,7 @@ func (a AppModuleBasic) Name() string { func (a AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { return cdc.MustMarshalJSON(&types.GenesisState{ - GlobalIntegrity: types.DefaultGlobalIntegrity(), - Params: types.DefaultParams(), + Params: types.DefaultParams(), }) } @@ -104,11 +103,11 @@ func (a AppModule) InitGenesis(ctx sdk.Context, marshaler codec.JSONCodec, messa if err := a.keeper.Params.Set(ctx, didGenesisState.Params); err != nil { panic(err) } - nftGenesisState := nft.DefaultGenesisState() - if err := types.DefaultNFTClasses(nftGenesisState); err != nil { - panic(err) - } - a.nftKeeper.InitGenesis(ctx, nftGenesisState) + // nftGenesisState := nft.DefaultGenesisState() + // if err := types.DefaultNFTClasses(nftGenesisState); err != nil { + // panic(err) + // } + // a.nftKeeper.InitGenesis(ctx, nftGenesisState) return nil } diff --git a/x/did/types/account.go b/x/did/types/account.go new file mode 100644 index 000000000..ab1254f4c --- /dev/null +++ b/x/did/types/account.go @@ -0,0 +1 @@ +package types diff --git a/x/did/types/accounts.pb.go b/x/did/types/accounts.pb.go deleted file mode 100644 index 4b9328774..000000000 --- a/x/did/types/accounts.pb.go +++ /dev/null @@ -1,634 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: did/v1/accounts.proto - -package types - -import ( - fmt "fmt" - proto "github.com/cosmos/gogoproto/proto" - io "io" - math "math" - math_bits "math/bits" - math "math" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package - -type BtcAccount struct { -} - -func (m *BtcAccount) Reset() { *m = BtcAccount{} } -func (m *BtcAccount) String() string { return proto.CompactTextString(m) } -func (*BtcAccount) ProtoMessage() {} -func (*BtcAccount) Descriptor() ([]byte, []int) { - return fileDescriptor_2125a09fb14c3bc3, []int{0} -} -func (m *BtcAccount) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *BtcAccount) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_BtcAccount.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 *BtcAccount) XXX_Merge(src proto.Message) { - xxx_messageInfo_BtcAccount.Merge(m, src) -} -func (m *BtcAccount) XXX_Size() int { - return m.Size() -} -func (m *BtcAccount) XXX_DiscardUnknown() { - xxx_messageInfo_BtcAccount.DiscardUnknown(m) -} - -var xxx_messageInfo_BtcAccount proto.InternalMessageInfo - -type EthAccount struct { -} - -func (m *EthAccount) Reset() { *m = EthAccount{} } -func (m *EthAccount) String() string { return proto.CompactTextString(m) } -func (*EthAccount) ProtoMessage() {} -func (*EthAccount) Descriptor() ([]byte, []int) { - return fileDescriptor_2125a09fb14c3bc3, []int{1} -} -func (m *EthAccount) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *EthAccount) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_EthAccount.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 *EthAccount) XXX_Merge(src proto.Message) { - xxx_messageInfo_EthAccount.Merge(m, src) -} -func (m *EthAccount) XXX_Size() int { - return m.Size() -} -func (m *EthAccount) XXX_DiscardUnknown() { - xxx_messageInfo_EthAccount.DiscardUnknown(m) -} - -var xxx_messageInfo_EthAccount proto.InternalMessageInfo - -type IBCAccount struct { -} - -func (m *IBCAccount) Reset() { *m = IBCAccount{} } -func (m *IBCAccount) String() string { return proto.CompactTextString(m) } -func (*IBCAccount) ProtoMessage() {} -func (*IBCAccount) Descriptor() ([]byte, []int) { - return fileDescriptor_2125a09fb14c3bc3, []int{2} -} -func (m *IBCAccount) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *IBCAccount) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_IBCAccount.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 *IBCAccount) XXX_Merge(src proto.Message) { - xxx_messageInfo_IBCAccount.Merge(m, src) -} -func (m *IBCAccount) XXX_Size() int { - return m.Size() -} -func (m *IBCAccount) XXX_DiscardUnknown() { - xxx_messageInfo_IBCAccount.DiscardUnknown(m) -} - -var xxx_messageInfo_IBCAccount proto.InternalMessageInfo - -type SnrAccount struct { -} - -func (m *SnrAccount) Reset() { *m = SnrAccount{} } -func (m *SnrAccount) String() string { return proto.CompactTextString(m) } -func (*SnrAccount) ProtoMessage() {} -func (*SnrAccount) Descriptor() ([]byte, []int) { - return fileDescriptor_2125a09fb14c3bc3, []int{3} -} -func (m *SnrAccount) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *SnrAccount) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_SnrAccount.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 *SnrAccount) XXX_Merge(src proto.Message) { - xxx_messageInfo_SnrAccount.Merge(m, src) -} -func (m *SnrAccount) XXX_Size() int { - return m.Size() -} -func (m *SnrAccount) XXX_DiscardUnknown() { - xxx_messageInfo_SnrAccount.DiscardUnknown(m) -} - -var xxx_messageInfo_SnrAccount proto.InternalMessageInfo - -func init() { - proto.RegisterType((*BtcAccount)(nil), "did.v1.BtcAccount") - proto.RegisterType((*EthAccount)(nil), "did.v1.EthAccount") - proto.RegisterType((*IBCAccount)(nil), "did.v1.IBCAccount") - proto.RegisterType((*SnrAccount)(nil), "did.v1.SnrAccount") -} - -func init() { proto.RegisterFile("did/v1/accounts.proto", fileDescriptor_2125a09fb14c3bc3) } - -var fileDescriptor_2125a09fb14c3bc3 = []byte{ - // 145 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x4d, 0xc9, 0x4c, 0xd1, - 0x2f, 0x33, 0xd4, 0x4f, 0x4c, 0x4e, 0xce, 0x2f, 0xcd, 0x2b, 0x29, 0xd6, 0x2b, 0x28, 0xca, 0x2f, - 0xc9, 0x17, 0x62, 0x4b, 0xc9, 0x4c, 0xd1, 0x2b, 0x33, 0x54, 0xe2, 0xe1, 0xe2, 0x72, 0x2a, 0x49, - 0x76, 0x84, 0x48, 0x82, 0x78, 0xae, 0x25, 0x19, 0x48, 0x3c, 0x4f, 0x27, 0x67, 0x24, 0x5e, 0x70, - 0x5e, 0x11, 0x94, 0xe7, 0x64, 0x73, 0xe2, 0x91, 0x1c, 0xe3, 0x85, 0x47, 0x72, 0x8c, 0x0f, 0x1e, - 0xc9, 0x31, 0x4e, 0x78, 0x2c, 0xc7, 0x70, 0xe1, 0xb1, 0x1c, 0xc3, 0x8d, 0xc7, 0x72, 0x0c, 0x51, - 0x4a, 0xe9, 0x99, 0x25, 0x19, 0xa5, 0x49, 0x7a, 0xc9, 0xf9, 0xb9, 0xfa, 0xf9, 0x79, 0xc5, 0xf9, - 0x79, 0x45, 0xfa, 0x60, 0xa2, 0x42, 0x1f, 0xe4, 0x92, 0x92, 0xca, 0x82, 0xd4, 0xe2, 0x24, 0x36, - 0xb0, 0x23, 0x8c, 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0x82, 0x7e, 0x89, 0x0a, 0x9d, 0x00, 0x00, - 0x00, -} - -func (m *BtcAccount) 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 *BtcAccount) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *BtcAccount) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func (m *EthAccount) 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 *EthAccount) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *EthAccount) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func (m *IBCAccount) 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 *IBCAccount) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *IBCAccount) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func (m *SnrAccount) 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 *SnrAccount) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *SnrAccount) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func encodeVarintAccounts(dAtA []byte, offset int, v uint64) int { - offset -= sovAccounts(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *BtcAccount) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *EthAccount) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *IBCAccount) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *SnrAccount) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func sovAccounts(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozAccounts(x uint64) (n int) { - return sovAccounts(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *BtcAccount) 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 ErrIntOverflowAccounts - } - 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: BtcAccount: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: BtcAccount: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipAccounts(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthAccounts - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *EthAccount) 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 ErrIntOverflowAccounts - } - 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: EthAccount: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: EthAccount: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipAccounts(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthAccounts - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *IBCAccount) 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 ErrIntOverflowAccounts - } - 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: IBCAccount: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: IBCAccount: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipAccounts(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthAccounts - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *SnrAccount) 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 ErrIntOverflowAccounts - } - 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: SnrAccount: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: SnrAccount: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipAccounts(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthAccounts - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipAccounts(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowAccounts - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowAccounts - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowAccounts - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthAccounts - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupAccounts - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthAccounts - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthAccounts = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowAccounts = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupAccounts = fmt.Errorf("proto: unexpected end of group") -) -func init() { proto.RegisterFile("did/v1/accounts.proto", fileDescriptor_2125a09fb14c3bc3) } - -var fileDescriptor_2125a09fb14c3bc3 = []byte{ - // 122 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x4d, 0xc9, 0x4c, 0xd1, - 0x2f, 0x33, 0xd4, 0x4f, 0x4c, 0x4e, 0xce, 0x2f, 0xcd, 0x2b, 0x29, 0xd6, 0x2b, 0x28, 0xca, 0x2f, - 0xc9, 0x17, 0x62, 0x4b, 0xc9, 0x4c, 0xd1, 0x2b, 0x33, 0x74, 0xb2, 0x39, 0xf1, 0x48, 0x8e, 0xf1, - 0xc2, 0x23, 0x39, 0xc6, 0x07, 0x8f, 0xe4, 0x18, 0x27, 0x3c, 0x96, 0x63, 0xb8, 0xf0, 0x58, 0x8e, - 0xe1, 0xc6, 0x63, 0x39, 0x86, 0x28, 0xa5, 0xf4, 0xcc, 0x92, 0x8c, 0xd2, 0x24, 0xbd, 0xe4, 0xfc, - 0x5c, 0xfd, 0xfc, 0xbc, 0xe2, 0xfc, 0xbc, 0x22, 0xfd, 0x8c, 0xf2, 0xc4, 0x4a, 0xfd, 0x0a, 0x7d, - 0x90, 0x89, 0x25, 0x95, 0x05, 0xa9, 0xc5, 0x49, 0x6c, 0x60, 0xc3, 0x8c, 0x01, 0x01, 0x00, 0x00, - 0xff, 0xff, 0x28, 0xd1, 0x54, 0x54, 0x65, 0x00, 0x00, 0x00, -} diff --git a/x/did/types/codec.go b/x/did/types/codec.go index c883ac6aa..c2913f290 100644 --- a/x/did/types/codec.go +++ b/x/did/types/codec.go @@ -13,8 +13,6 @@ import ( cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/msgservice" - "github.com/mr-tron/base58/base58" - "github.com/onsonr/crypto" // this line is used by starport scaffolding # 1 ) diff --git a/x/did/types/coins.go b/x/did/types/coins.go deleted file mode 100644 index f5e03ab09..000000000 --- a/x/did/types/coins.go +++ /dev/null @@ -1,31 +0,0 @@ -package types - -// Coin represents a cryptocurrency -type Coin interface { - // FormatAddress formats a public key into an address - FormatAddress(pubKey []byte) (string, error) - - // GetIndex returns the coin type index - GetIndex() int64 - - // GetPath returns the coin component path - GetPath() uint32 - - // GetSymbol returns the coin symbol - GetSymbol() string - - // GetMethod returns the coin DID method - GetMethod() string - - // GetName returns the coin name - GetName() string -} - -// CoinBTCType is the coin type for BTC -const CoinBTCType = int64(0) - -// CoinETHType is the coin type for ETH -const CoinETHType = int64(60) - -// CoinSNRType is the coin type for SNR -const CoinSNRType = int64(703) diff --git a/x/did/types/genesis.go b/x/did/types/genesis.go index 34da6e029..2a4ea7fc6 100644 --- a/x/did/types/genesis.go +++ b/x/did/types/genesis.go @@ -41,8 +41,7 @@ const DefaultIndex uint64 = 1 func DefaultGenesis() *GenesisState { return &GenesisState{ // this line is used by starport scaffolding # genesis/types/default - GlobalIntegrity: DefaultGlobalIntegrity(), - Params: DefaultParams(), + Params: DefaultParams(), } } @@ -50,9 +49,7 @@ func DefaultGenesis() *GenesisState { // failure. func (gs GenesisState) Validate() error { // this line is used by starport scaffolding # genesis/types/validate - if gs.GlobalIntegrity == nil { - return fmt.Errorf("global integrity proof is nil") - } + return gs.Params.Validate() } diff --git a/x/did/types/genesis.pb.go b/x/did/types/genesis.pb.go index f0a9d2267..24b1d6dce 100644 --- a/x/did/types/genesis.pb.go +++ b/x/did/types/genesis.pb.go @@ -28,8 +28,6 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package type GenesisState struct { // Params defines all the parameters of the module. Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` - // GlobalIntegrity defines a zkp integrity proof for the entire DID namespace - GlobalIntegrity *GlobalIntegrity `protobuf:"bytes,2,opt,name=global_integrity,json=globalIntegrity,proto3" json:"global_integrity,omitempty"` } func (m *GenesisState) Reset() { *m = GenesisState{} } @@ -72,82 +70,6 @@ func (m *GenesisState) GetParams() Params { return Params{} } -func (m *GenesisState) GetGlobalIntegrity() *GlobalIntegrity { - if m != nil { - return m.GlobalIntegrity - } - return nil -} - -// GlobalIntegrity defines a zkp integrity proof for the entire DID namespace -type GlobalIntegrity struct { - Controller string `protobuf:"bytes,1,opt,name=controller,proto3" json:"controller,omitempty"` - Seed string `protobuf:"bytes,2,opt,name=seed,proto3" json:"seed,omitempty"` - Accumulator []byte `protobuf:"bytes,3,opt,name=accumulator,proto3" json:"accumulator,omitempty"` - Count uint64 `protobuf:"varint,4,opt,name=count,proto3" json:"count,omitempty"` -} - -func (m *GlobalIntegrity) Reset() { *m = GlobalIntegrity{} } -func (m *GlobalIntegrity) String() string { return proto.CompactTextString(m) } -func (*GlobalIntegrity) ProtoMessage() {} -func (*GlobalIntegrity) Descriptor() ([]byte, []int) { - return fileDescriptor_fda181cae44f7c00, []int{1} -} -func (m *GlobalIntegrity) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *GlobalIntegrity) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_GlobalIntegrity.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 *GlobalIntegrity) XXX_Merge(src proto.Message) { - xxx_messageInfo_GlobalIntegrity.Merge(m, src) -} -func (m *GlobalIntegrity) XXX_Size() int { - return m.Size() -} -func (m *GlobalIntegrity) XXX_DiscardUnknown() { - xxx_messageInfo_GlobalIntegrity.DiscardUnknown(m) -} - -var xxx_messageInfo_GlobalIntegrity proto.InternalMessageInfo - -func (m *GlobalIntegrity) GetController() string { - if m != nil { - return m.Controller - } - return "" -} - -func (m *GlobalIntegrity) GetSeed() string { - if m != nil { - return m.Seed - } - return "" -} - -func (m *GlobalIntegrity) GetAccumulator() []byte { - if m != nil { - return m.Accumulator - } - return nil -} - -func (m *GlobalIntegrity) GetCount() uint64 { - if m != nil { - return m.Count - } - return 0 -} - // Params defines the set of module parameters. type Params struct { // Whitelisted Assets @@ -167,7 +89,7 @@ type Params struct { func (m *Params) Reset() { *m = Params{} } func (*Params) ProtoMessage() {} func (*Params) Descriptor() ([]byte, []int) { - return fileDescriptor_fda181cae44f7c00, []int{2} + return fileDescriptor_fda181cae44f7c00, []int{1} } func (m *Params) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -772,7 +694,6 @@ func (m *Service) GetPermissions() map[string]string { func init() { proto.RegisterType((*GenesisState)(nil), "did.v1.GenesisState") - proto.RegisterType((*GlobalIntegrity)(nil), "did.v1.GlobalIntegrity") proto.RegisterType((*Params)(nil), "did.v1.Params") proto.RegisterMapType((map[string]*KeyInfo)(nil), "did.v1.Params.AllowedPublicKeysEntry") proto.RegisterType((*AssetInfo)(nil), "did.v1.AssetInfo") @@ -927,18 +848,6 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if m.GlobalIntegrity != nil { - { - size, err := m.GlobalIntegrity.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenesis(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } { size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) if err != nil { @@ -952,55 +861,6 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *GlobalIntegrity) 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 *GlobalIntegrity) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *GlobalIntegrity) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Count != 0 { - i = encodeVarintGenesis(dAtA, i, uint64(m.Count)) - i-- - dAtA[i] = 0x20 - } - if len(m.Accumulator) > 0 { - i -= len(m.Accumulator) - copy(dAtA[i:], m.Accumulator) - i = encodeVarintGenesis(dAtA, i, uint64(len(m.Accumulator))) - i-- - dAtA[i] = 0x1a - } - if len(m.Seed) > 0 { - i -= len(m.Seed) - copy(dAtA[i:], m.Seed) - i = encodeVarintGenesis(dAtA, i, uint64(len(m.Seed))) - i-- - dAtA[i] = 0x12 - } - if len(m.Controller) > 0 { - i -= len(m.Controller) - copy(dAtA[i:], m.Controller) - i = encodeVarintGenesis(dAtA, i, uint64(len(m.Controller))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - func (m *Params) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -1560,34 +1420,6 @@ func (m *GenesisState) Size() (n int) { _ = l l = m.Params.Size() n += 1 + l + sovGenesis(uint64(l)) - if m.GlobalIntegrity != nil { - l = m.GlobalIntegrity.Size() - n += 1 + l + sovGenesis(uint64(l)) - } - return n -} - -func (m *GlobalIntegrity) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Controller) - if l > 0 { - n += 1 + l + sovGenesis(uint64(l)) - } - l = len(m.Seed) - if l > 0 { - n += 1 + l + sovGenesis(uint64(l)) - } - l = len(m.Accumulator) - if l > 0 { - n += 1 + l + sovGenesis(uint64(l)) - } - if m.Count != 0 { - n += 1 + sovGenesis(uint64(m.Count)) - } return n } @@ -1926,209 +1758,6 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field GlobalIntegrity", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenesis - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenesis - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.GlobalIntegrity == nil { - m.GlobalIntegrity = &GlobalIntegrity{} - } - if err := m.GlobalIntegrity.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenesis(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenesis - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *GlobalIntegrity) 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 ErrIntOverflowGenesis - } - 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: GlobalIntegrity: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: GlobalIntegrity: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - 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 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.Controller = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Seed", 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.Seed = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Accumulator", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthGenesis - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthGenesis - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Accumulator = append(m.Accumulator[:0], dAtA[iNdEx:postIndex]...) - if m.Accumulator == nil { - m.Accumulator = []byte{} - } - iNdEx = postIndex - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Count", wireType) - } - m.Count = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Count |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } default: iNdEx = preIndex skippy, err := skipGenesis(dAtA[iNdEx:]) diff --git a/x/did/types/integrity.go b/x/did/types/integrity.go deleted file mode 100644 index e7eeb1eff..000000000 --- a/x/did/types/integrity.go +++ /dev/null @@ -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[:] -} diff --git a/x/did/types/models.pb.go b/x/did/types/models.pb.go deleted file mode 100644 index ba75c43a3..000000000 --- a/x/did/types/models.pb.go +++ /dev/null @@ -1,4991 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: did/v1/models.proto - -package types - -import ( - fmt "fmt" - _ "github.com/cosmos/gogoproto/gogoproto" - proto "github.com/cosmos/gogoproto/proto" - io "io" - math "math" - math_bits "math/bits" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// 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"` - Origin string `protobuf:"bytes,3,opt,name=origin,proto3" json:"origin,omitempty"` - CredentialId []byte `protobuf:"bytes,4,opt,name=credential_id,json=credentialId,proto3" json:"credential_id,omitempty"` - PublicKey []byte `protobuf:"bytes,5,opt,name=public_key,json=publicKey,proto3" json:"public_key,omitempty"` - Transport []string `protobuf:"bytes,6,rep,name=transport,proto3" json:"transport,omitempty"` - SignCount uint32 `protobuf:"varint,7,opt,name=sign_count,json=signCount,proto3" json:"sign_count,omitempty"` - UserPresent bool `protobuf:"varint,8,opt,name=user_present,json=userPresent,proto3" json:"user_present,omitempty"` - UserVerified bool `protobuf:"varint,9,opt,name=user_verified,json=userVerified,proto3" json:"user_verified,omitempty"` - BackupEligible bool `protobuf:"varint,10,opt,name=backup_eligible,json=backupEligible,proto3" json:"backup_eligible,omitempty"` - BackupState bool `protobuf:"varint,11,opt,name=backup_state,json=backupState,proto3" json:"backup_state,omitempty"` - CloneWarning bool `protobuf:"varint,12,opt,name=clone_warning,json=cloneWarning,proto3" json:"clone_warning,omitempty"` -} - -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} -} -func (m *Credential) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Credential) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Credential.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 *Credential) XXX_Merge(src proto.Message) { - xxx_messageInfo_Credential.Merge(m, src) -} -func (m *Credential) XXX_Size() int { - return m.Size() -} -func (m *Credential) XXX_DiscardUnknown() { - xxx_messageInfo_Credential.DiscardUnknown(m) -} - -var xxx_messageInfo_Credential proto.InternalMessageInfo - -func (m *Credential) GetSubject() string { - if m != nil { - return m.Subject - } - return "" -} - -func (m *Credential) GetAttestationType() string { - if m != nil { - return m.AttestationType - } - return "" -} - -func (m *Credential) GetOrigin() string { - if m != nil { - return m.Origin - } - return "" -} - -func (m *Credential) GetCredentialId() []byte { - if m != nil { - return m.CredentialId - } - return nil -} - -func (m *Credential) GetPublicKey() []byte { - if m != nil { - return m.PublicKey - } - return nil -} - -func (m *Credential) GetTransport() []string { - if m != nil { - return m.Transport - } - return nil -} - -func (m *Credential) GetSignCount() uint32 { - if m != nil { - return m.SignCount - } - return 0 -} - -func (m *Credential) GetUserPresent() bool { - if m != nil { - return m.UserPresent - } - return false -} - -func (m *Credential) GetUserVerified() bool { - if m != nil { - return m.UserVerified - } - return false -} - -func (m *Credential) GetBackupEligible() bool { - if m != nil { - return m.BackupEligible - } - return false -} - -func (m *Credential) GetBackupState() bool { - if m != nil { - return m.BackupState - } - return false -} - -func (m *Credential) GetCloneWarning() bool { - if m != nil { - return m.CloneWarning - } - return false -} - -// Document defines a DID document -type Document struct { - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` - Controller string `protobuf:"bytes,2,opt,name=controller,proto3" json:"controller,omitempty"` - Authentication []string `protobuf:"bytes,3,rep,name=authentication,proto3" json:"authentication,omitempty"` - AssertionMethod []string `protobuf:"bytes,4,rep,name=assertion_method,json=assertionMethod,proto3" json:"assertion_method,omitempty"` - CapabilityDelegation []string `protobuf:"bytes,5,rep,name=capability_delegation,json=capabilityDelegation,proto3" json:"capability_delegation,omitempty"` - CapabilityInvocation []string `protobuf:"bytes,6,rep,name=capability_invocation,json=capabilityInvocation,proto3" json:"capability_invocation,omitempty"` - Service []string `protobuf:"bytes,7,rep,name=service,proto3" json:"service,omitempty"` -} - -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} -} -func (m *Document) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Document) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Document.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 *Document) XXX_Merge(src proto.Message) { - xxx_messageInfo_Document.Merge(m, src) -} -func (m *Document) XXX_Size() int { - return m.Size() -} -func (m *Document) XXX_DiscardUnknown() { - xxx_messageInfo_Document.DiscardUnknown(m) -} - -var xxx_messageInfo_Document proto.InternalMessageInfo - -func (m *Document) GetId() string { - if m != nil { - return m.Id - } - return "" -} - -func (m *Document) GetController() string { - if m != nil { - return m.Controller - } - return "" -} - -func (m *Document) GetAuthentication() []string { - if m != nil { - return m.Authentication - } - return nil -} - -func (m *Document) GetAssertionMethod() []string { - if m != nil { - return m.AssertionMethod - } - return nil -} - -func (m *Document) GetCapabilityDelegation() []string { - if m != nil { - return m.CapabilityDelegation - } - return nil -} - -func (m *Document) GetCapabilityInvocation() []string { - if m != nil { - return m.CapabilityInvocation - } - return nil -} - -func (m *Document) GetService() []string { - if m != nil { - return m.Service - } - return nil -} - -// Keyshare defines a keyshare from the MPC protocol -type Keyshare struct { - Metadata map[string]string `protobuf:"bytes,1,rep,name=metadata,proto3" json:"metadata,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` - Payloads map[string][]byte `protobuf:"bytes,2,rep,name=payloads,proto3" json:"payloads,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` - Protocol string `protobuf:"bytes,3,opt,name=protocol,proto3" json:"protocol,omitempty"` - PublicKey []byte `protobuf:"bytes,4,opt,name=public_key,json=publicKey,proto3" json:"public_key,omitempty"` - Version uint32 `protobuf:"varint,5,opt,name=version,proto3" json:"version,omitempty"` - Role int32 `protobuf:"varint,6,opt,name=role,proto3" json:"role,omitempty"` -} - -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} -} -func (m *Keyshare) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Keyshare) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Keyshare.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 *Keyshare) XXX_Merge(src proto.Message) { - xxx_messageInfo_Keyshare.Merge(m, src) -} -func (m *Keyshare) XXX_Size() int { - return m.Size() -} -func (m *Keyshare) XXX_DiscardUnknown() { - xxx_messageInfo_Keyshare.DiscardUnknown(m) -} - -var xxx_messageInfo_Keyshare proto.InternalMessageInfo - -func (m *Keyshare) GetMetadata() map[string]string { - if m != nil { - return m.Metadata - } - return nil -} - -func (m *Keyshare) GetPayloads() map[string][]byte { - if m != nil { - return m.Payloads - } - return nil -} - -func (m *Keyshare) GetProtocol() string { - if m != nil { - return m.Protocol - } - return "" -} - -func (m *Keyshare) GetPublicKey() []byte { - if m != nil { - return m.PublicKey - } - return nil -} - -func (m *Keyshare) GetVersion() uint32 { - if m != nil { - return m.Version - } - return 0 -} - -func (m *Keyshare) GetRole() int32 { - if m != nil { - return m.Role - } - return 0 -} - -// Permissions contains a list of grants and access control rules for -// a Service. -type Permissions struct { - Grants []DIDNamespace `protobuf:"varint,1,rep,packed,name=grants,proto3,enum=did.v1.DIDNamespace" json:"grants,omitempty"` - Scopes []PermissionScope `protobuf:"varint,2,rep,packed,name=scopes,proto3,enum=did.v1.PermissionScope" json:"scopes,omitempty"` -} - -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} -} -func (m *Permissions) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Permissions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Permissions.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 *Permissions) XXX_Merge(src proto.Message) { - xxx_messageInfo_Permissions.Merge(m, src) -} -func (m *Permissions) XXX_Size() int { - return m.Size() -} -func (m *Permissions) XXX_DiscardUnknown() { - xxx_messageInfo_Permissions.DiscardUnknown(m) -} - -var xxx_messageInfo_Permissions proto.InternalMessageInfo - -func (m *Permissions) GetGrants() []DIDNamespace { - if m != nil { - return m.Grants - } - return nil -} - -func (m *Permissions) GetScopes() []PermissionScope { - if m != nil { - return m.Scopes - } - return nil -} - -// PubKey defines a public key for a did -type PubKey struct { - Role KeyRole `protobuf:"varint,1,opt,name=role,proto3,enum=did.v1.KeyRole" json:"role,omitempty"` - Algorithm KeyAlgorithm `protobuf:"varint,2,opt,name=algorithm,proto3,enum=did.v1.KeyAlgorithm" json:"algorithm,omitempty"` - Encoding KeyEncoding `protobuf:"varint,3,opt,name=encoding,proto3,enum=did.v1.KeyEncoding" json:"encoding,omitempty"` - Curve KeyCurve `protobuf:"varint,4,opt,name=curve,proto3,enum=did.v1.KeyCurve" json:"curve,omitempty"` - KeyType KeyType `protobuf:"varint,5,opt,name=key_type,json=keyType,proto3,enum=did.v1.KeyType" json:"key_type,omitempty"` - Raw []byte `protobuf:"bytes,6,opt,name=raw,proto3" json:"raw,omitempty"` - Jwk *PubKey_JWK `protobuf:"bytes,7,opt,name=jwk,proto3" json:"jwk,omitempty"` -} - -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} -} -func (m *PubKey) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *PubKey) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_PubKey.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 *PubKey) XXX_Merge(src proto.Message) { - xxx_messageInfo_PubKey.Merge(m, src) -} -func (m *PubKey) XXX_Size() int { - return m.Size() -} -func (m *PubKey) XXX_DiscardUnknown() { - xxx_messageInfo_PubKey.DiscardUnknown(m) -} - -var xxx_messageInfo_PubKey proto.InternalMessageInfo - -func (m *PubKey) GetRole() KeyRole { - if m != nil { - return m.Role - } - return KeyRole_KEY_ROLE_UNSPECIFIED -} - -func (m *PubKey) GetAlgorithm() KeyAlgorithm { - if m != nil { - return m.Algorithm - } - return KeyAlgorithm_KEY_ALGORITHM_UNSPECIFIED -} - -func (m *PubKey) GetEncoding() KeyEncoding { - if m != nil { - return m.Encoding - } - return KeyEncoding_KEY_ENCODING_UNSPECIFIED -} - -func (m *PubKey) GetCurve() KeyCurve { - if m != nil { - return m.Curve - } - return KeyCurve_KEY_CURVE_UNSPECIFIED -} - -func (m *PubKey) GetKeyType() KeyType { - if m != nil { - return m.KeyType - } - return KeyType_KEY_TYPE_UNSPECIFIED -} - -func (m *PubKey) GetRaw() []byte { - if m != nil { - return m.Raw - } - return nil -} - -func (m *PubKey) GetJwk() *PubKey_JWK { - if m != nil { - return m.Jwk - } - return nil -} - -// JWK represents a JSON Web Key -type PubKey_JWK struct { - Kty string `protobuf:"bytes,1,opt,name=kty,proto3" json:"kty,omitempty"` - Crv string `protobuf:"bytes,2,opt,name=crv,proto3" json:"crv,omitempty"` - X string `protobuf:"bytes,3,opt,name=x,proto3" json:"x,omitempty"` - Y string `protobuf:"bytes,4,opt,name=y,proto3" json:"y,omitempty"` - N string `protobuf:"bytes,5,opt,name=n,proto3" json:"n,omitempty"` - E string `protobuf:"bytes,6,opt,name=e,proto3" json:"e,omitempty"` -} - -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} -} -func (m *PubKey_JWK) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *PubKey_JWK) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_PubKey_JWK.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 *PubKey_JWK) XXX_Merge(src proto.Message) { - xxx_messageInfo_PubKey_JWK.Merge(m, src) -} -func (m *PubKey_JWK) XXX_Size() int { - return m.Size() -} -func (m *PubKey_JWK) XXX_DiscardUnknown() { - xxx_messageInfo_PubKey_JWK.DiscardUnknown(m) -} - -var xxx_messageInfo_PubKey_JWK proto.InternalMessageInfo - -func (m *PubKey_JWK) GetKty() string { - if m != nil { - return m.Kty - } - return "" -} - -func (m *PubKey_JWK) GetCrv() string { - if m != nil { - return m.Crv - } - return "" -} - -func (m *PubKey_JWK) GetX() string { - if m != nil { - return m.X - } - return "" -} - -func (m *PubKey_JWK) GetY() string { - if m != nil { - return m.Y - } - return "" -} - -func (m *PubKey_JWK) GetN() string { - if m != nil { - return m.N - } - return "" -} - -func (m *PubKey_JWK) GetE() string { - if m != nil { - return m.E - } - return "" -} - -// Service defines a Decentralized Service on the Sonr Blockchain -type Service struct { - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` - ServiceType string `protobuf:"bytes,2,opt,name=service_type,json=serviceType,proto3" json:"service_type,omitempty"` - Authority string `protobuf:"bytes,3,opt,name=authority,proto3" json:"authority,omitempty"` - Origin string `protobuf:"bytes,4,opt,name=origin,proto3" json:"origin,omitempty"` - Description string `protobuf:"bytes,5,opt,name=description,proto3" json:"description,omitempty"` - ServiceEndpoints map[string]string `protobuf:"bytes,6,rep,name=service_endpoints,json=serviceEndpoints,proto3" json:"service_endpoints,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` - Permissions *Permissions `protobuf:"bytes,7,opt,name=permissions,proto3" json:"permissions,omitempty"` -} - -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} -} -func (m *Service) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Service) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Service.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 *Service) XXX_Merge(src proto.Message) { - xxx_messageInfo_Service.Merge(m, src) -} -func (m *Service) XXX_Size() int { - return m.Size() -} -func (m *Service) XXX_DiscardUnknown() { - xxx_messageInfo_Service.DiscardUnknown(m) -} - -var xxx_messageInfo_Service proto.InternalMessageInfo - -func (m *Service) GetId() string { - if m != nil { - return m.Id - } - return "" -} - -func (m *Service) GetServiceType() string { - if m != nil { - return m.ServiceType - } - return "" -} - -func (m *Service) GetAuthority() string { - if m != nil { - return m.Authority - } - return "" -} - -func (m *Service) GetOrigin() string { - if m != nil { - return m.Origin - } - return "" -} - -func (m *Service) GetDescription() string { - if m != nil { - return m.Description - } - return "" -} - -func (m *Service) GetServiceEndpoints() map[string]string { - if m != nil { - return m.ServiceEndpoints - } - return nil -} - -func (m *Service) GetPermissions() *Permissions { - if m != nil { - return m.Permissions - } - return nil -} - -// ServicceInfo defines a Decentralized Service on the Sonr Blockchain -type ServiceInfo struct { - Exists bool `protobuf:"varint,1,opt,name=exists,proto3" json:"exists,omitempty"` - Origin string `protobuf:"bytes,2,opt,name=origin,proto3" json:"origin,omitempty"` - Fingerprint string `protobuf:"bytes,3,opt,name=fingerprint,proto3" json:"fingerprint,omitempty"` - Service *Service `protobuf:"bytes,4,opt,name=service,proto3" json:"service,omitempty"` -} - -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} -} -func (m *ServiceInfo) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ServiceInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_ServiceInfo.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 *ServiceInfo) XXX_Merge(src proto.Message) { - xxx_messageInfo_ServiceInfo.Merge(m, src) -} -func (m *ServiceInfo) XXX_Size() int { - return m.Size() -} -func (m *ServiceInfo) XXX_DiscardUnknown() { - xxx_messageInfo_ServiceInfo.DiscardUnknown(m) -} - -var xxx_messageInfo_ServiceInfo proto.InternalMessageInfo - -func (m *ServiceInfo) GetExists() bool { - if m != nil { - return m.Exists - } - return false -} - -func (m *ServiceInfo) GetOrigin() string { - if m != nil { - return m.Origin - } - return "" -} - -func (m *ServiceInfo) GetFingerprint() string { - if m != nil { - return m.Fingerprint - } - return "" -} - -func (m *ServiceInfo) GetService() *Service { - if m != nil { - return m.Service - } - return nil -} - -// FirstPartyCaveat defines a first party caveat -type FirstPartyCaveat struct { - Scope *Permissions `protobuf:"bytes,1,opt,name=scope,proto3" json:"scope,omitempty"` - Exp int64 `protobuf:"varint,2,opt,name=exp,proto3" json:"exp,omitempty"` - Cnf string `protobuf:"bytes,3,opt,name=cnf,proto3" json:"cnf,omitempty"` - Aud string `protobuf:"bytes,4,opt,name=aud,proto3" json:"aud,omitempty"` -} - -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} -} -func (m *FirstPartyCaveat) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *FirstPartyCaveat) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_FirstPartyCaveat.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 *FirstPartyCaveat) XXX_Merge(src proto.Message) { - xxx_messageInfo_FirstPartyCaveat.Merge(m, src) -} -func (m *FirstPartyCaveat) XXX_Size() int { - return m.Size() -} -func (m *FirstPartyCaveat) XXX_DiscardUnknown() { - xxx_messageInfo_FirstPartyCaveat.DiscardUnknown(m) -} - -var xxx_messageInfo_FirstPartyCaveat proto.InternalMessageInfo - -func (m *FirstPartyCaveat) GetScope() *Permissions { - if m != nil { - return m.Scope - } - return nil -} - -func (m *FirstPartyCaveat) GetExp() int64 { - if m != nil { - return m.Exp - } - return 0 -} - -func (m *FirstPartyCaveat) GetCnf() string { - if m != nil { - return m.Cnf - } - return "" -} - -func (m *FirstPartyCaveat) GetAud() string { - if m != nil { - return m.Aud - } - return "" -} - -// ThirdPartyCaveat defines a third party caveat -type ThirdPartyCaveat struct { - Scope *Permissions `protobuf:"bytes,1,opt,name=scope,proto3" json:"scope,omitempty"` - Exp int64 `protobuf:"varint,2,opt,name=exp,proto3" json:"exp,omitempty"` - Cnf string `protobuf:"bytes,3,opt,name=cnf,proto3" json:"cnf,omitempty"` - Aud string `protobuf:"bytes,4,opt,name=aud,proto3" json:"aud,omitempty"` -} - -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} -} -func (m *ThirdPartyCaveat) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ThirdPartyCaveat) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_ThirdPartyCaveat.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 *ThirdPartyCaveat) XXX_Merge(src proto.Message) { - xxx_messageInfo_ThirdPartyCaveat.Merge(m, src) -} -func (m *ThirdPartyCaveat) XXX_Size() int { - return m.Size() -} -func (m *ThirdPartyCaveat) XXX_DiscardUnknown() { - xxx_messageInfo_ThirdPartyCaveat.DiscardUnknown(m) -} - -var xxx_messageInfo_ThirdPartyCaveat proto.InternalMessageInfo - -func (m *ThirdPartyCaveat) GetScope() *Permissions { - if m != nil { - return m.Scope - } - return nil -} - -func (m *ThirdPartyCaveat) GetExp() int64 { - if m != nil { - return m.Exp - } - return 0 -} - -func (m *ThirdPartyCaveat) GetCnf() string { - if m != nil { - return m.Cnf - } - return "" -} - -func (m *ThirdPartyCaveat) GetAud() string { - if m != nil { - return m.Aud - } - return "" -} - -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") - proto.RegisterMapType((map[string]string)(nil), "did.v1.Keyshare.MetadataEntry") - proto.RegisterMapType((map[string][]byte)(nil), "did.v1.Keyshare.PayloadsEntry") - proto.RegisterType((*Permissions)(nil), "did.v1.Permissions") - proto.RegisterType((*PubKey)(nil), "did.v1.PubKey") - proto.RegisterType((*PubKey_JWK)(nil), "did.v1.PubKey.JWK") - proto.RegisterType((*Service)(nil), "did.v1.Service") - proto.RegisterMapType((map[string]string)(nil), "did.v1.Service.ServiceEndpointsEntry") - proto.RegisterType((*ServiceInfo)(nil), "did.v1.ServiceInfo") - proto.RegisterType((*FirstPartyCaveat)(nil), "did.v1.FirstPartyCaveat") - proto.RegisterType((*ThirdPartyCaveat)(nil), "did.v1.ThirdPartyCaveat") -} - -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, 0x8a, 0x1c, 0xcb, 0x1b, 0x53, 0x5c, 0x62, 0x77, 0xa9, 0x98, - 0xc7, 0x5e, 0x7b, 0x6a, 0x9f, 0xa1, 0x2f, 0xd3, 0x63, 0x8e, 0x3d, 0x16, 0x49, 0xfb, 0x1e, 0xc5, - 0xfe, 0xa1, 0x44, 0x2b, 0x4d, 0x8b, 0x5e, 0x7a, 0xb1, 0x77, 0xbe, 0xf9, 0x86, 0x33, 0xfc, 0x66, - 0x66, 0x29, 0xb8, 0x11, 0xb3, 0x78, 0xbc, 0xbc, 0x3f, 0x5e, 0xf0, 0x18, 0x13, 0x39, 0xca, 0x04, - 0x57, 0x9c, 0x34, 0x62, 0x16, 0x8f, 0x96, 0xf7, 0xf7, 0xf7, 0x9c, 0x73, 0x8e, 0x29, 0x4a, 0xe6, - 0xbc, 0xfb, 0x7b, 0x73, 0x3e, 0xe7, 0xe6, 0x38, 0xd6, 0x27, 0x8b, 0x0e, 0xbe, 0x85, 0xfa, 0xa3, - 0x84, 0x51, 0x49, 0x02, 0xd8, 0x96, 0xf9, 0xec, 0x05, 0x46, 0x2a, 0xf0, 0xfa, 0xde, 0xb0, 0x15, - 0x96, 0x26, 0xf9, 0x3f, 0x34, 0xb8, 0x60, 0x73, 0x96, 0x06, 0x35, 0xe3, 0x70, 0x16, 0xe9, 0x01, - 0x44, 0x3c, 0x55, 0x82, 0x27, 0x09, 0x8a, 0xc0, 0x37, 0xbe, 0x0a, 0x32, 0xf8, 0xd9, 0x07, 0x38, - 0x10, 0x18, 0x63, 0xaa, 0x18, 0x4d, 0xfe, 0x26, 0xc1, 0x3d, 0xd8, 0xa5, 0x4a, 0xa1, 0x54, 0x54, - 0x31, 0x9e, 0x4e, 0x55, 0x91, 0xa1, 0x4b, 0xb5, 0x53, 0xc1, 0x9f, 0x15, 0x19, 0x56, 0x6a, 0xf1, - 0xaf, 0xd4, 0x72, 0x07, 0xae, 0x47, 0xab, 0x54, 0x53, 0x16, 0x07, 0x5b, 0x7d, 0x6f, 0xd8, 0x09, - 0x3b, 0x6b, 0xf0, 0x38, 0x26, 0xef, 0x03, 0x64, 0xf9, 0x2c, 0x61, 0xd1, 0xf4, 0x02, 0x8b, 0xa0, - 0x6e, 0x18, 0x2d, 0x8b, 0x9c, 0x60, 0x41, 0x6e, 0x41, 0x4b, 0x09, 0x9a, 0xca, 0x8c, 0x0b, 0x15, - 0x34, 0xfa, 0xfe, 0xb0, 0x15, 0xae, 0x01, 0x1d, 0x2c, 0xd9, 0x3c, 0x9d, 0x46, 0x3c, 0x4f, 0x55, - 0xb0, 0xdd, 0xf7, 0x86, 0xd7, 0xc3, 0x96, 0x46, 0x0e, 0x34, 0x40, 0x6e, 0x43, 0x27, 0x97, 0x28, - 0xa6, 0x99, 0x40, 0x89, 0xa9, 0x0a, 0x9a, 0x7d, 0x6f, 0xd8, 0x0c, 0xdb, 0x1a, 0x3b, 0xb5, 0x90, - 0xae, 0xd1, 0x50, 0x96, 0x28, 0xd8, 0x19, 0xc3, 0x38, 0x68, 0x19, 0x8e, 0x89, 0xfb, 0xc6, 0x61, - 0xe4, 0x23, 0xd8, 0x99, 0xd1, 0xe8, 0x22, 0xcf, 0xa6, 0x98, 0xb0, 0x39, 0x9b, 0x25, 0x18, 0x80, - 0xa1, 0x75, 0x2d, 0x7c, 0xe4, 0x50, 0x9d, 0xd0, 0x11, 0xb5, 0x3e, 0x18, 0xb4, 0x6d, 0x42, 0x8b, - 0x3d, 0xd5, 0x90, 0x11, 0x25, 0xe1, 0x29, 0x4e, 0x5f, 0x52, 0x91, 0xb2, 0x74, 0x1e, 0x74, 0x6c, - 0x42, 0x03, 0x3e, 0xb7, 0xd8, 0xe0, 0xa7, 0x1a, 0x34, 0x0f, 0x79, 0x94, 0x2f, 0x74, 0x89, 0x5d, - 0xa8, 0xb1, 0xd8, 0xb5, 0xa7, 0xc6, 0xe2, 0x8d, 0x16, 0xd7, 0x36, 0x5b, 0x4c, 0xee, 0x42, 0x97, - 0xe6, 0xea, 0x5c, 0x2b, 0x1c, 0x99, 0x26, 0x05, 0xbe, 0xd1, 0x6d, 0x03, 0x35, 0x1d, 0x96, 0x12, - 0x85, 0xe9, 0xef, 0x02, 0xd5, 0x39, 0xd7, 0x1d, 0xf2, 0x4d, 0x87, 0x4b, 0xfc, 0x89, 0x81, 0xc9, - 0x03, 0xb8, 0x19, 0xd1, 0x8c, 0xce, 0x58, 0xc2, 0x54, 0x31, 0x8d, 0x31, 0xc1, 0xb9, 0x7d, 0x72, - 0xdd, 0xf0, 0xf7, 0xd6, 0xce, 0xc3, 0x95, 0x6f, 0x23, 0x88, 0xa5, 0x4b, 0xee, 0xca, 0x69, 0x6c, - 0x06, 0x1d, 0xaf, 0x7c, 0x66, 0x20, 0x51, 0x2c, 0x59, 0x84, 0xc1, 0xb6, 0xa1, 0x95, 0xe6, 0xe0, - 0x8f, 0x1a, 0x34, 0x4f, 0xb0, 0x90, 0xe7, 0x54, 0x20, 0x79, 0x08, 0xcd, 0x05, 0x2a, 0x1a, 0x53, - 0x45, 0x03, 0xaf, 0xef, 0x0f, 0xdb, 0x93, 0xde, 0xc8, 0x2e, 0xda, 0xa8, 0xe4, 0x8c, 0x9e, 0x38, - 0xc2, 0x51, 0xaa, 0x44, 0x11, 0xae, 0xf8, 0x3a, 0x36, 0xa3, 0x45, 0xc2, 0x69, 0x2c, 0x83, 0xda, - 0x3b, 0x62, 0x4f, 0x1d, 0xc1, 0xc5, 0x96, 0x7c, 0xb2, 0x0f, 0x4d, 0xb3, 0xa2, 0x11, 0x4f, 0xdc, - 0xb0, 0xaf, 0xec, 0x8d, 0x49, 0xde, 0xda, 0x9c, 0xe4, 0x00, 0xb6, 0x97, 0x28, 0xa4, 0x55, 0x4d, - 0x0f, 0x6a, 0x69, 0x12, 0x02, 0x5b, 0x82, 0x27, 0x18, 0x34, 0xfa, 0xde, 0xb0, 0x1e, 0x9a, 0xf3, - 0xfe, 0xe7, 0x70, 0xfd, 0x4a, 0xfd, 0x64, 0x17, 0x7c, 0xfd, 0x58, 0x3b, 0x06, 0xfa, 0x48, 0xf6, - 0xa0, 0xbe, 0xa4, 0x49, 0x5e, 0xae, 0xa5, 0x35, 0x1e, 0xd6, 0x3e, 0xf3, 0x74, 0xf0, 0x95, 0x17, - 0xf8, 0xa7, 0xe0, 0x4e, 0x25, 0x78, 0x90, 0x40, 0xfb, 0x14, 0xc5, 0x82, 0x49, 0x5d, 0x9b, 0x24, - 0x9f, 0x40, 0x63, 0x2e, 0x68, 0xaa, 0xa4, 0xd1, 0xb9, 0x3b, 0xd9, 0x2b, 0xb5, 0x3a, 0x3c, 0x3e, - 0xfc, 0x9a, 0x2e, 0x50, 0x66, 0x34, 0xc2, 0xd0, 0x71, 0xc8, 0x18, 0x1a, 0x32, 0xe2, 0x19, 0x5a, - 0x65, 0xbb, 0x93, 0xf7, 0x4a, 0xf6, 0xfa, 0x91, 0x4f, 0xb5, 0x3f, 0x74, 0xb4, 0xc1, 0xf7, 0x3e, - 0x34, 0x4e, 0xf3, 0x99, 0x16, 0xe8, 0x8e, 0x93, 0x41, 0x57, 0xd9, 0x9d, 0xec, 0x54, 0x7a, 0x12, - 0xf2, 0x04, 0xad, 0x2e, 0x64, 0x02, 0x2d, 0x9a, 0xcc, 0xb9, 0x60, 0xea, 0x7c, 0x61, 0x6a, 0xaf, - 0x54, 0x74, 0x82, 0xc5, 0xa3, 0xd2, 0x17, 0xae, 0x69, 0x64, 0x0c, 0x4d, 0x4c, 0x23, 0x1e, 0xeb, - 0x6d, 0xf3, 0x4d, 0xc8, 0x8d, 0x4a, 0xc8, 0x91, 0x73, 0x85, 0x2b, 0x12, 0xb9, 0x0b, 0xf5, 0x28, - 0x17, 0x4b, 0x34, 0x4d, 0xec, 0x4e, 0x76, 0x2b, 0xec, 0x03, 0x8d, 0x87, 0xd6, 0x4d, 0x3e, 0x86, - 0xe6, 0x05, 0x16, 0xf6, 0x6e, 0xac, 0xbf, 0x55, 0xb5, 0xbe, 0x1b, 0xc3, 0xed, 0x0b, 0x7b, 0xd0, - 0x2d, 0x10, 0xf4, 0xa5, 0xe9, 0x71, 0x27, 0xd4, 0x47, 0xf2, 0x01, 0xf8, 0x2f, 0x5e, 0x5e, 0x98, - 0x5b, 0xab, 0x3d, 0x21, 0x2b, 0xa1, 0x8c, 0x18, 0xa3, 0xc7, 0xcf, 0x4f, 0x42, 0xed, 0xde, 0xa7, - 0xe0, 0x3f, 0x7e, 0x7e, 0x62, 0x3a, 0xa8, 0xd6, 0x1d, 0x54, 0xa6, 0xa7, 0x91, 0x58, 0xba, 0xe6, - 0xeb, 0x23, 0xe9, 0x80, 0x77, 0xe9, 0xa6, 0xd2, 0xbb, 0xd4, 0x96, 0x9d, 0xc2, 0x56, 0xe8, 0x15, - 0xda, 0xb2, 0x73, 0xd7, 0x0a, 0xbd, 0x54, 0x5b, 0x76, 0xdc, 0x5a, 0xa1, 0x87, 0x83, 0xdf, 0x6b, - 0xb0, 0xfd, 0xd4, 0x6e, 0xd9, 0x5b, 0x97, 0xcd, 0x6d, 0xe8, 0xb8, 0x05, 0xac, 0x7e, 0x02, 0xda, - 0x0e, 0x33, 0x6f, 0x76, 0x0b, 0x5a, 0xfa, 0x66, 0xd1, 0x62, 0x17, 0x2e, 0xfd, 0x1a, 0xa8, 0x7c, - 0x1c, 0xb6, 0xae, 0x7c, 0x1c, 0xfa, 0xd0, 0x8e, 0x51, 0x46, 0x82, 0x65, 0xaa, 0x5c, 0x89, 0x56, - 0x58, 0x85, 0x48, 0x08, 0xff, 0x2b, 0x53, 0x63, 0x1a, 0x67, 0x9c, 0xe9, 0x21, 0x6c, 0x98, 0x85, - 0xfd, 0xb0, 0x54, 0xcb, 0x95, 0x5d, 0xfe, 0x3f, 0x2a, 0x79, 0x76, 0x6f, 0x77, 0xe5, 0x06, 0x4c, - 0x3e, 0x85, 0x76, 0xb6, 0x1e, 0x6e, 0xa7, 0xfd, 0x8d, 0xb7, 0x87, 0x54, 0x86, 0x55, 0xde, 0xfe, - 0x01, 0xdc, 0xfc, 0xcb, 0x0c, 0xff, 0x66, 0x2b, 0x07, 0x3f, 0x78, 0xd0, 0x76, 0x4f, 0x39, 0x4e, - 0xcf, 0xb8, 0x56, 0x06, 0x2f, 0x99, 0x34, 0x9b, 0xa5, 0x3f, 0x01, 0xce, 0x7a, 0xe7, 0xa7, 0xbd, - 0x0f, 0xed, 0x33, 0x96, 0xce, 0x51, 0x64, 0x82, 0xa5, 0xca, 0x29, 0x5d, 0x85, 0xc8, 0xbd, 0xf5, - 0xe5, 0xb9, 0x65, 0xde, 0x6c, 0x67, 0x43, 0xa7, 0xf5, 0x6d, 0x2a, 0x61, 0xf7, 0x2b, 0x26, 0xa4, - 0x3a, 0xa5, 0x42, 0x15, 0x07, 0x74, 0x89, 0x54, 0x87, 0xd7, 0xcd, 0x56, 0x9a, 0x7a, 0xde, 0x21, - 0x8b, 0x65, 0xe8, 0xf7, 0xc6, 0xcb, 0xcc, 0x14, 0xe8, 0x87, 0xfa, 0x68, 0xc6, 0x31, 0x3d, 0x73, - 0x55, 0xe9, 0xa3, 0x46, 0x68, 0x1e, 0xbb, 0xb6, 0xeb, 0xa3, 0x4e, 0xfa, 0xec, 0x9c, 0x89, 0xf8, - 0xbf, 0x4c, 0xfa, 0xe5, 0x17, 0xbf, 0xbc, 0xee, 0x79, 0xaf, 0x5e, 0xf7, 0xbc, 0xdf, 0x5e, 0xf7, - 0xbc, 0x1f, 0xdf, 0xf4, 0xae, 0xbd, 0x7a, 0xd3, 0xbb, 0xf6, 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 -} - -func (m *Credential) 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 *Credential) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Credential) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.CloneWarning { - i-- - if m.CloneWarning { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x60 - } - if m.BackupState { - i-- - if m.BackupState { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x58 - } - if m.BackupEligible { - i-- - if m.BackupEligible { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x50 - } - if m.UserVerified { - i-- - if m.UserVerified { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x48 - } - if m.UserPresent { - i-- - if m.UserPresent { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x40 - } - if m.SignCount != 0 { - i = encodeVarintModels(dAtA, i, uint64(m.SignCount)) - i-- - dAtA[i] = 0x38 - } - if len(m.Transport) > 0 { - for iNdEx := len(m.Transport) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.Transport[iNdEx]) - copy(dAtA[i:], m.Transport[iNdEx]) - i = encodeVarintModels(dAtA, i, uint64(len(m.Transport[iNdEx]))) - i-- - dAtA[i] = 0x32 - } - } - if len(m.PublicKey) > 0 { - i -= len(m.PublicKey) - copy(dAtA[i:], m.PublicKey) - i = encodeVarintModels(dAtA, i, uint64(len(m.PublicKey))) - i-- - dAtA[i] = 0x2a - } - if len(m.CredentialId) > 0 { - i -= len(m.CredentialId) - copy(dAtA[i:], m.CredentialId) - i = encodeVarintModels(dAtA, i, uint64(len(m.CredentialId))) - i-- - dAtA[i] = 0x22 - } - 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] = 0x1a - } - if len(m.AttestationType) > 0 { - i -= len(m.AttestationType) - copy(dAtA[i:], m.AttestationType) - i = encodeVarintModels(dAtA, i, uint64(len(m.AttestationType))) - 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 -} - -func (m *Document) 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 *Document) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Document) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Service) > 0 { - for iNdEx := len(m.Service) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.Service[iNdEx]) - copy(dAtA[i:], m.Service[iNdEx]) - i = encodeVarintModels(dAtA, i, uint64(len(m.Service[iNdEx]))) - i-- - dAtA[i] = 0x3a - } - } - if len(m.CapabilityInvocation) > 0 { - for iNdEx := len(m.CapabilityInvocation) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.CapabilityInvocation[iNdEx]) - copy(dAtA[i:], m.CapabilityInvocation[iNdEx]) - i = encodeVarintModels(dAtA, i, uint64(len(m.CapabilityInvocation[iNdEx]))) - i-- - dAtA[i] = 0x32 - } - } - if len(m.CapabilityDelegation) > 0 { - for iNdEx := len(m.CapabilityDelegation) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.CapabilityDelegation[iNdEx]) - copy(dAtA[i:], m.CapabilityDelegation[iNdEx]) - i = encodeVarintModels(dAtA, i, uint64(len(m.CapabilityDelegation[iNdEx]))) - i-- - dAtA[i] = 0x2a - } - } - if len(m.AssertionMethod) > 0 { - for iNdEx := len(m.AssertionMethod) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.AssertionMethod[iNdEx]) - copy(dAtA[i:], m.AssertionMethod[iNdEx]) - i = encodeVarintModels(dAtA, i, uint64(len(m.AssertionMethod[iNdEx]))) - i-- - dAtA[i] = 0x22 - } - } - if len(m.Authentication) > 0 { - for iNdEx := len(m.Authentication) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.Authentication[iNdEx]) - copy(dAtA[i:], m.Authentication[iNdEx]) - i = encodeVarintModels(dAtA, i, uint64(len(m.Authentication[iNdEx]))) - i-- - dAtA[i] = 0x1a - } - } - 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] = 0x12 - } - if len(m.Id) > 0 { - i -= len(m.Id) - copy(dAtA[i:], m.Id) - i = encodeVarintModels(dAtA, i, uint64(len(m.Id))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Keyshare) 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 *Keyshare) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Keyshare) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Role != 0 { - i = encodeVarintModels(dAtA, i, uint64(m.Role)) - i-- - dAtA[i] = 0x30 - } - if m.Version != 0 { - i = encodeVarintModels(dAtA, i, uint64(m.Version)) - i-- - dAtA[i] = 0x28 - } - if len(m.PublicKey) > 0 { - i -= len(m.PublicKey) - copy(dAtA[i:], m.PublicKey) - i = encodeVarintModels(dAtA, i, uint64(len(m.PublicKey))) - i-- - dAtA[i] = 0x22 - } - if len(m.Protocol) > 0 { - i -= len(m.Protocol) - copy(dAtA[i:], m.Protocol) - i = encodeVarintModels(dAtA, i, uint64(len(m.Protocol))) - i-- - dAtA[i] = 0x1a - } - if len(m.Payloads) > 0 { - for k := range m.Payloads { - v := m.Payloads[k] - baseI := i - if len(v) > 0 { - i -= len(v) - copy(dAtA[i:], v) - i = encodeVarintModels(dAtA, i, uint64(len(v))) - i-- - dAtA[i] = 0x12 - } - i -= len(k) - copy(dAtA[i:], k) - i = encodeVarintModels(dAtA, i, uint64(len(k))) - i-- - dAtA[i] = 0xa - i = encodeVarintModels(dAtA, i, uint64(baseI-i)) - i-- - dAtA[i] = 0x12 - } - } - if len(m.Metadata) > 0 { - for k := range m.Metadata { - v := m.Metadata[k] - baseI := i - i -= len(v) - copy(dAtA[i:], v) - i = encodeVarintModels(dAtA, i, uint64(len(v))) - i-- - dAtA[i] = 0x12 - i -= len(k) - copy(dAtA[i:], k) - i = encodeVarintModels(dAtA, i, uint64(len(k))) - i-- - dAtA[i] = 0xa - i = encodeVarintModels(dAtA, i, uint64(baseI-i)) - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func (m *Permissions) 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 *Permissions) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Permissions) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Scopes) > 0 { - dAtA2 := make([]byte, len(m.Scopes)*10) - var j1 int - for _, num := range m.Scopes { - for num >= 1<<7 { - dAtA2[j1] = uint8(uint64(num)&0x7f | 0x80) - num >>= 7 - j1++ - } - dAtA2[j1] = uint8(num) - j1++ - } - i -= j1 - copy(dAtA[i:], dAtA2[:j1]) - i = encodeVarintModels(dAtA, i, uint64(j1)) - i-- - dAtA[i] = 0x12 - } - if len(m.Grants) > 0 { - dAtA4 := make([]byte, len(m.Grants)*10) - var j3 int - for _, num := range m.Grants { - for num >= 1<<7 { - dAtA4[j3] = uint8(uint64(num)&0x7f | 0x80) - num >>= 7 - j3++ - } - dAtA4[j3] = uint8(num) - j3++ - } - i -= j3 - copy(dAtA[i:], dAtA4[:j3]) - i = encodeVarintModels(dAtA, i, uint64(j3)) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *PubKey) 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 *PubKey) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *PubKey) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Jwk != nil { - { - size, err := m.Jwk.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintModels(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x3a - } - if len(m.Raw) > 0 { - i -= len(m.Raw) - copy(dAtA[i:], m.Raw) - i = encodeVarintModels(dAtA, i, uint64(len(m.Raw))) - i-- - dAtA[i] = 0x32 - } - if m.KeyType != 0 { - i = encodeVarintModels(dAtA, i, uint64(m.KeyType)) - i-- - dAtA[i] = 0x28 - } - if m.Curve != 0 { - i = encodeVarintModels(dAtA, i, uint64(m.Curve)) - i-- - dAtA[i] = 0x20 - } - if m.Encoding != 0 { - i = encodeVarintModels(dAtA, i, uint64(m.Encoding)) - i-- - dAtA[i] = 0x18 - } - if m.Algorithm != 0 { - i = encodeVarintModels(dAtA, i, uint64(m.Algorithm)) - i-- - dAtA[i] = 0x10 - } - if m.Role != 0 { - i = encodeVarintModels(dAtA, i, uint64(m.Role)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *PubKey_JWK) 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 *PubKey_JWK) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *PubKey_JWK) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.E) > 0 { - i -= len(m.E) - copy(dAtA[i:], m.E) - i = encodeVarintModels(dAtA, i, uint64(len(m.E))) - i-- - dAtA[i] = 0x32 - } - if len(m.N) > 0 { - i -= len(m.N) - copy(dAtA[i:], m.N) - i = encodeVarintModels(dAtA, i, uint64(len(m.N))) - i-- - dAtA[i] = 0x2a - } - if len(m.Y) > 0 { - i -= len(m.Y) - copy(dAtA[i:], m.Y) - i = encodeVarintModels(dAtA, i, uint64(len(m.Y))) - i-- - dAtA[i] = 0x22 - } - if len(m.X) > 0 { - i -= len(m.X) - copy(dAtA[i:], m.X) - i = encodeVarintModels(dAtA, i, uint64(len(m.X))) - i-- - dAtA[i] = 0x1a - } - if len(m.Crv) > 0 { - i -= len(m.Crv) - copy(dAtA[i:], m.Crv) - i = encodeVarintModels(dAtA, i, uint64(len(m.Crv))) - i-- - dAtA[i] = 0x12 - } - if len(m.Kty) > 0 { - i -= len(m.Kty) - copy(dAtA[i:], m.Kty) - i = encodeVarintModels(dAtA, i, uint64(len(m.Kty))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Service) 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 *Service) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Service) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Permissions != nil { - { - size, err := m.Permissions.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintModels(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x3a - } - if len(m.ServiceEndpoints) > 0 { - for k := range m.ServiceEndpoints { - v := m.ServiceEndpoints[k] - baseI := i - i -= len(v) - copy(dAtA[i:], v) - i = encodeVarintModels(dAtA, i, uint64(len(v))) - i-- - dAtA[i] = 0x12 - i -= len(k) - copy(dAtA[i:], k) - i = encodeVarintModels(dAtA, i, uint64(len(k))) - i-- - dAtA[i] = 0xa - i = encodeVarintModels(dAtA, i, uint64(baseI-i)) - i-- - dAtA[i] = 0x32 - } - } - if len(m.Description) > 0 { - i -= len(m.Description) - copy(dAtA[i:], m.Description) - i = encodeVarintModels(dAtA, i, uint64(len(m.Description))) - i-- - dAtA[i] = 0x2a - } - 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] = 0x22 - } - if len(m.Authority) > 0 { - i -= len(m.Authority) - copy(dAtA[i:], m.Authority) - i = encodeVarintModels(dAtA, i, uint64(len(m.Authority))) - i-- - dAtA[i] = 0x1a - } - if len(m.ServiceType) > 0 { - i -= len(m.ServiceType) - copy(dAtA[i:], m.ServiceType) - i = encodeVarintModels(dAtA, i, uint64(len(m.ServiceType))) - i-- - dAtA[i] = 0x12 - } - if len(m.Id) > 0 { - i -= len(m.Id) - copy(dAtA[i:], m.Id) - i = encodeVarintModels(dAtA, i, uint64(len(m.Id))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *ServiceInfo) 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 *ServiceInfo) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ServiceInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Service != nil { - { - size, err := m.Service.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintModels(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x22 - } - if len(m.Fingerprint) > 0 { - i -= len(m.Fingerprint) - copy(dAtA[i:], m.Fingerprint) - i = encodeVarintModels(dAtA, i, uint64(len(m.Fingerprint))) - 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 m.Exists { - i-- - if m.Exists { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *FirstPartyCaveat) 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 *FirstPartyCaveat) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *FirstPartyCaveat) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Aud) > 0 { - i -= len(m.Aud) - copy(dAtA[i:], m.Aud) - i = encodeVarintModels(dAtA, i, uint64(len(m.Aud))) - i-- - dAtA[i] = 0x22 - } - if len(m.Cnf) > 0 { - i -= len(m.Cnf) - copy(dAtA[i:], m.Cnf) - i = encodeVarintModels(dAtA, i, uint64(len(m.Cnf))) - i-- - dAtA[i] = 0x1a - } - if m.Exp != 0 { - i = encodeVarintModels(dAtA, i, uint64(m.Exp)) - i-- - dAtA[i] = 0x10 - } - if m.Scope != nil { - { - size, err := m.Scope.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintModels(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *ThirdPartyCaveat) 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 *ThirdPartyCaveat) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ThirdPartyCaveat) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Aud) > 0 { - i -= len(m.Aud) - copy(dAtA[i:], m.Aud) - i = encodeVarintModels(dAtA, i, uint64(len(m.Aud))) - i-- - dAtA[i] = 0x22 - } - if len(m.Cnf) > 0 { - i -= len(m.Cnf) - copy(dAtA[i:], m.Cnf) - i = encodeVarintModels(dAtA, i, uint64(len(m.Cnf))) - i-- - dAtA[i] = 0x1a - } - if m.Exp != 0 { - i = encodeVarintModels(dAtA, i, uint64(m.Exp)) - i-- - dAtA[i] = 0x10 - } - if m.Scope != nil { - { - size, err := m.Scope.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintModels(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func encodeVarintModels(dAtA []byte, offset int, v uint64) int { - offset -= sovModels(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - 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 - } - var l int - _ = l - l = len(m.Subject) - if l > 0 { - n += 1 + l + sovModels(uint64(l)) - } - l = len(m.AttestationType) - 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.CredentialId) - if l > 0 { - n += 1 + l + sovModels(uint64(l)) - } - l = len(m.PublicKey) - if l > 0 { - n += 1 + l + sovModels(uint64(l)) - } - if len(m.Transport) > 0 { - for _, s := range m.Transport { - l = len(s) - n += 1 + l + sovModels(uint64(l)) - } - } - if m.SignCount != 0 { - n += 1 + sovModels(uint64(m.SignCount)) - } - if m.UserPresent { - n += 2 - } - if m.UserVerified { - n += 2 - } - if m.BackupEligible { - n += 2 - } - if m.BackupState { - n += 2 - } - if m.CloneWarning { - n += 2 - } - return n -} - -func (m *Document) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Id) - if l > 0 { - n += 1 + l + sovModels(uint64(l)) - } - l = len(m.Controller) - if l > 0 { - n += 1 + l + sovModels(uint64(l)) - } - if len(m.Authentication) > 0 { - for _, s := range m.Authentication { - l = len(s) - n += 1 + l + sovModels(uint64(l)) - } - } - if len(m.AssertionMethod) > 0 { - for _, s := range m.AssertionMethod { - l = len(s) - n += 1 + l + sovModels(uint64(l)) - } - } - if len(m.CapabilityDelegation) > 0 { - for _, s := range m.CapabilityDelegation { - l = len(s) - n += 1 + l + sovModels(uint64(l)) - } - } - if len(m.CapabilityInvocation) > 0 { - for _, s := range m.CapabilityInvocation { - l = len(s) - n += 1 + l + sovModels(uint64(l)) - } - } - if len(m.Service) > 0 { - for _, s := range m.Service { - l = len(s) - n += 1 + l + sovModels(uint64(l)) - } - } - return n -} - -func (m *Keyshare) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Metadata) > 0 { - for k, v := range m.Metadata { - _ = k - _ = v - mapEntrySize := 1 + len(k) + sovModels(uint64(len(k))) + 1 + len(v) + sovModels(uint64(len(v))) - n += mapEntrySize + 1 + sovModels(uint64(mapEntrySize)) - } - } - if len(m.Payloads) > 0 { - for k, v := range m.Payloads { - _ = k - _ = v - l = 0 - if len(v) > 0 { - l = 1 + len(v) + sovModels(uint64(len(v))) - } - mapEntrySize := 1 + len(k) + sovModels(uint64(len(k))) + l - n += mapEntrySize + 1 + sovModels(uint64(mapEntrySize)) - } - } - l = len(m.Protocol) - if l > 0 { - n += 1 + l + sovModels(uint64(l)) - } - l = len(m.PublicKey) - if l > 0 { - n += 1 + l + sovModels(uint64(l)) - } - if m.Version != 0 { - n += 1 + sovModels(uint64(m.Version)) - } - if m.Role != 0 { - n += 1 + sovModels(uint64(m.Role)) - } - return n -} - -func (m *Permissions) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Grants) > 0 { - l = 0 - for _, e := range m.Grants { - l += sovModels(uint64(e)) - } - n += 1 + sovModels(uint64(l)) + l - } - if len(m.Scopes) > 0 { - l = 0 - for _, e := range m.Scopes { - l += sovModels(uint64(e)) - } - n += 1 + sovModels(uint64(l)) + l - } - return n -} - -func (m *PubKey) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Role != 0 { - n += 1 + sovModels(uint64(m.Role)) - } - if m.Algorithm != 0 { - n += 1 + sovModels(uint64(m.Algorithm)) - } - if m.Encoding != 0 { - n += 1 + sovModels(uint64(m.Encoding)) - } - if m.Curve != 0 { - n += 1 + sovModels(uint64(m.Curve)) - } - if m.KeyType != 0 { - n += 1 + sovModels(uint64(m.KeyType)) - } - l = len(m.Raw) - if l > 0 { - n += 1 + l + sovModels(uint64(l)) - } - if m.Jwk != nil { - l = m.Jwk.Size() - n += 1 + l + sovModels(uint64(l)) - } - return n -} - -func (m *PubKey_JWK) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Kty) - if l > 0 { - n += 1 + l + sovModels(uint64(l)) - } - l = len(m.Crv) - if l > 0 { - n += 1 + l + sovModels(uint64(l)) - } - l = len(m.X) - if l > 0 { - n += 1 + l + sovModels(uint64(l)) - } - l = len(m.Y) - if l > 0 { - n += 1 + l + sovModels(uint64(l)) - } - l = len(m.N) - if l > 0 { - n += 1 + l + sovModels(uint64(l)) - } - l = len(m.E) - if l > 0 { - n += 1 + l + sovModels(uint64(l)) - } - return n -} - -func (m *Service) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Id) - if l > 0 { - n += 1 + l + sovModels(uint64(l)) - } - l = len(m.ServiceType) - if l > 0 { - n += 1 + l + sovModels(uint64(l)) - } - l = len(m.Authority) - 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.Description) - if l > 0 { - n += 1 + l + sovModels(uint64(l)) - } - if len(m.ServiceEndpoints) > 0 { - for k, v := range m.ServiceEndpoints { - _ = k - _ = v - mapEntrySize := 1 + len(k) + sovModels(uint64(len(k))) + 1 + len(v) + sovModels(uint64(len(v))) - n += mapEntrySize + 1 + sovModels(uint64(mapEntrySize)) - } - } - if m.Permissions != nil { - l = m.Permissions.Size() - n += 1 + l + sovModels(uint64(l)) - } - return n -} - -func (m *ServiceInfo) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Exists { - n += 2 - } - l = len(m.Origin) - if l > 0 { - n += 1 + l + sovModels(uint64(l)) - } - l = len(m.Fingerprint) - if l > 0 { - n += 1 + l + sovModels(uint64(l)) - } - if m.Service != nil { - l = m.Service.Size() - n += 1 + l + sovModels(uint64(l)) - } - return n -} - -func (m *FirstPartyCaveat) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Scope != nil { - l = m.Scope.Size() - n += 1 + l + sovModels(uint64(l)) - } - if m.Exp != 0 { - n += 1 + sovModels(uint64(m.Exp)) - } - l = len(m.Cnf) - if l > 0 { - n += 1 + l + sovModels(uint64(l)) - } - l = len(m.Aud) - if l > 0 { - n += 1 + l + sovModels(uint64(l)) - } - return n -} - -func (m *ThirdPartyCaveat) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Scope != nil { - l = m.Scope.Size() - n += 1 + l + sovModels(uint64(l)) - } - if m.Exp != 0 { - n += 1 + sovModels(uint64(m.Exp)) - } - l = len(m.Cnf) - if l > 0 { - n += 1 + l + sovModels(uint64(l)) - } - l = len(m.Aud) - if l > 0 { - n += 1 + l + sovModels(uint64(l)) - } - return n -} - -func sovModels(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -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 - 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: Credential: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Credential: 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 AttestationType", 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.AttestationType = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - 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 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field CredentialId", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowModels - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthModels - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthModels - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.CredentialId = append(m.CredentialId[:0], dAtA[iNdEx:postIndex]...) - if m.CredentialId == nil { - m.CredentialId = []byte{} - } - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PublicKey", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowModels - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthModels - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthModels - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.PublicKey = append(m.PublicKey[:0], dAtA[iNdEx:postIndex]...) - if m.PublicKey == nil { - m.PublicKey = []byte{} - } - iNdEx = postIndex - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Transport", 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.Transport = append(m.Transport, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - case 7: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field SignCount", wireType) - } - m.SignCount = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowModels - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.SignCount |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 8: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field UserPresent", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowModels - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.UserPresent = bool(v != 0) - case 9: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field UserVerified", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowModels - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.UserVerified = bool(v != 0) - case 10: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field BackupEligible", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowModels - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.BackupEligible = bool(v != 0) - case 11: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field BackupState", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowModels - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.BackupState = bool(v != 0) - case 12: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field CloneWarning", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowModels - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.CloneWarning = bool(v != 0) - 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 *Document) 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: Document: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Document: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Id", 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.Id = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - 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 - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Authentication", 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.Authentication = append(m.Authentication, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field AssertionMethod", 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.AssertionMethod = append(m.AssertionMethod, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field CapabilityDelegation", 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.CapabilityDelegation = append(m.CapabilityDelegation, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field CapabilityInvocation", 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.CapabilityInvocation = append(m.CapabilityInvocation, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - case 7: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Service", 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.Service = append(m.Service, 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 *Keyshare) 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: Keyshare: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Keyshare: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Metadata", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowModels - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthModels - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthModels - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Metadata == nil { - m.Metadata = make(map[string]string) - } - var mapkey string - var mapvalue string - for iNdEx < postIndex { - entryPreIndex := 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) - if fieldNum == 1 { - var stringLenmapkey uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowModels - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLenmapkey |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLenmapkey := int(stringLenmapkey) - if intStringLenmapkey < 0 { - return ErrInvalidLengthModels - } - postStringIndexmapkey := iNdEx + intStringLenmapkey - if postStringIndexmapkey < 0 { - return ErrInvalidLengthModels - } - if postStringIndexmapkey > l { - return io.ErrUnexpectedEOF - } - mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) - iNdEx = postStringIndexmapkey - } else if fieldNum == 2 { - var stringLenmapvalue uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowModels - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLenmapvalue |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLenmapvalue := int(stringLenmapvalue) - if intStringLenmapvalue < 0 { - return ErrInvalidLengthModels - } - postStringIndexmapvalue := iNdEx + intStringLenmapvalue - if postStringIndexmapvalue < 0 { - return ErrInvalidLengthModels - } - if postStringIndexmapvalue > l { - return io.ErrUnexpectedEOF - } - mapvalue = string(dAtA[iNdEx:postStringIndexmapvalue]) - iNdEx = postStringIndexmapvalue - } else { - iNdEx = entryPreIndex - skippy, err := skipModels(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthModels - } - if (iNdEx + skippy) > postIndex { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - m.Metadata[mapkey] = mapvalue - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Payloads", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowModels - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthModels - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthModels - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Payloads == nil { - m.Payloads = make(map[string][]byte) - } - var mapkey string - mapvalue := []byte{} - for iNdEx < postIndex { - entryPreIndex := 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) - if fieldNum == 1 { - var stringLenmapkey uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowModels - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLenmapkey |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLenmapkey := int(stringLenmapkey) - if intStringLenmapkey < 0 { - return ErrInvalidLengthModels - } - postStringIndexmapkey := iNdEx + intStringLenmapkey - if postStringIndexmapkey < 0 { - return ErrInvalidLengthModels - } - if postStringIndexmapkey > l { - return io.ErrUnexpectedEOF - } - mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) - iNdEx = postStringIndexmapkey - } else if fieldNum == 2 { - var mapbyteLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowModels - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - mapbyteLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intMapbyteLen := int(mapbyteLen) - if intMapbyteLen < 0 { - return ErrInvalidLengthModels - } - postbytesIndex := iNdEx + intMapbyteLen - if postbytesIndex < 0 { - return ErrInvalidLengthModels - } - if postbytesIndex > l { - return io.ErrUnexpectedEOF - } - mapvalue = make([]byte, mapbyteLen) - copy(mapvalue, dAtA[iNdEx:postbytesIndex]) - iNdEx = postbytesIndex - } else { - iNdEx = entryPreIndex - skippy, err := skipModels(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthModels - } - if (iNdEx + skippy) > postIndex { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - m.Payloads[mapkey] = mapvalue - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Protocol", 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.Protocol = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PublicKey", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowModels - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthModels - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthModels - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.PublicKey = append(m.PublicKey[:0], dAtA[iNdEx:postIndex]...) - if m.PublicKey == nil { - m.PublicKey = []byte{} - } - iNdEx = postIndex - case 5: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Version", wireType) - } - m.Version = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowModels - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Version |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 6: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Role", wireType) - } - m.Role = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowModels - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Role |= int32(b&0x7F) << shift - if b < 0x80 { - break - } - } - 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 *Permissions) 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: Permissions: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Permissions: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType == 0 { - var v DIDNamespace - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowModels - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= DIDNamespace(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Grants = append(m.Grants, v) - } else if wireType == 2 { - var packedLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowModels - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - packedLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if packedLen < 0 { - return ErrInvalidLengthModels - } - postIndex := iNdEx + packedLen - if postIndex < 0 { - return ErrInvalidLengthModels - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - var elementCount int - if elementCount != 0 && len(m.Grants) == 0 { - m.Grants = make([]DIDNamespace, 0, elementCount) - } - for iNdEx < postIndex { - var v DIDNamespace - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowModels - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= DIDNamespace(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Grants = append(m.Grants, v) - } - } else { - return fmt.Errorf("proto: wrong wireType = %d for field Grants", wireType) - } - case 2: - if wireType == 0 { - var v PermissionScope - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowModels - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= PermissionScope(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Scopes = append(m.Scopes, v) - } else if wireType == 2 { - var packedLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowModels - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - packedLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if packedLen < 0 { - return ErrInvalidLengthModels - } - postIndex := iNdEx + packedLen - if postIndex < 0 { - return ErrInvalidLengthModels - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - var elementCount int - if elementCount != 0 && len(m.Scopes) == 0 { - m.Scopes = make([]PermissionScope, 0, elementCount) - } - for iNdEx < postIndex { - var v PermissionScope - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowModels - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= PermissionScope(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Scopes = append(m.Scopes, v) - } - } else { - return fmt.Errorf("proto: wrong wireType = %d for field Scopes", wireType) - } - 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 *PubKey) 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: PubKey: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: PubKey: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Role", wireType) - } - m.Role = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowModels - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Role |= KeyRole(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Algorithm", wireType) - } - m.Algorithm = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowModels - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Algorithm |= KeyAlgorithm(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Encoding", wireType) - } - m.Encoding = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowModels - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Encoding |= KeyEncoding(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Curve", wireType) - } - m.Curve = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowModels - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Curve |= KeyCurve(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 5: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field KeyType", wireType) - } - m.KeyType = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowModels - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.KeyType |= KeyType(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Raw", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowModels - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthModels - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthModels - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Raw = append(m.Raw[:0], dAtA[iNdEx:postIndex]...) - if m.Raw == nil { - m.Raw = []byte{} - } - iNdEx = postIndex - case 7: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Jwk", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowModels - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthModels - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthModels - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Jwk == nil { - m.Jwk = &PubKey_JWK{} - } - if err := m.Jwk.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - 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 *PubKey_JWK) 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: JWK: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: JWK: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Kty", 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.Kty = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Crv", 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.Crv = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field X", 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.X = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Y", 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.Y = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field N", 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.N = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field E", 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.E = 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 *Service) 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: Service: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Service: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Id", 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.Id = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ServiceType", 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.ServiceType = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Authority", 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.Authority = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - 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 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Description", 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.Description = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ServiceEndpoints", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowModels - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthModels - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthModels - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.ServiceEndpoints == nil { - m.ServiceEndpoints = make(map[string]string) - } - var mapkey string - var mapvalue string - for iNdEx < postIndex { - entryPreIndex := 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) - if fieldNum == 1 { - var stringLenmapkey uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowModels - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLenmapkey |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLenmapkey := int(stringLenmapkey) - if intStringLenmapkey < 0 { - return ErrInvalidLengthModels - } - postStringIndexmapkey := iNdEx + intStringLenmapkey - if postStringIndexmapkey < 0 { - return ErrInvalidLengthModels - } - if postStringIndexmapkey > l { - return io.ErrUnexpectedEOF - } - mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) - iNdEx = postStringIndexmapkey - } else if fieldNum == 2 { - var stringLenmapvalue uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowModels - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLenmapvalue |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLenmapvalue := int(stringLenmapvalue) - if intStringLenmapvalue < 0 { - return ErrInvalidLengthModels - } - postStringIndexmapvalue := iNdEx + intStringLenmapvalue - if postStringIndexmapvalue < 0 { - return ErrInvalidLengthModels - } - if postStringIndexmapvalue > l { - return io.ErrUnexpectedEOF - } - mapvalue = string(dAtA[iNdEx:postStringIndexmapvalue]) - iNdEx = postStringIndexmapvalue - } else { - iNdEx = entryPreIndex - skippy, err := skipModels(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthModels - } - if (iNdEx + skippy) > postIndex { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - m.ServiceEndpoints[mapkey] = mapvalue - iNdEx = postIndex - case 7: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Permissions", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowModels - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthModels - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthModels - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Permissions == nil { - m.Permissions = &Permissions{} - } - if err := m.Permissions.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - 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 *ServiceInfo) 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: ServiceInfo: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ServiceInfo: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Exists", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowModels - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Exists = bool(v != 0) - 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 Fingerprint", 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.Fingerprint = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Service", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowModels - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthModels - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthModels - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Service == nil { - m.Service = &Service{} - } - if err := m.Service.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - 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 *FirstPartyCaveat) 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: FirstPartyCaveat: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: FirstPartyCaveat: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Scope", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowModels - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthModels - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthModels - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Scope == nil { - m.Scope = &Permissions{} - } - if err := m.Scope.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Exp", wireType) - } - m.Exp = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowModels - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Exp |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Cnf", 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.Cnf = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Aud", 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.Aud = 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 *ThirdPartyCaveat) 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: ThirdPartyCaveat: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ThirdPartyCaveat: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Scope", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowModels - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthModels - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthModels - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Scope == nil { - m.Scope = &Permissions{} - } - if err := m.Scope.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Exp", wireType) - } - m.Exp = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowModels - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Exp |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Cnf", 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.Cnf = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Aud", 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.Aud = 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 skipModels(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowModels - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowModels - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowModels - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthModels - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupModels - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthModels - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthModels = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowModels = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupModels = fmt.Errorf("proto: unexpected end of group") -) diff --git a/x/did/types/namespace.go b/x/did/types/namespace.go deleted file mode 100644 index 1e6da75c9..000000000 --- a/x/did/types/namespace.go +++ /dev/null @@ -1,102 +0,0 @@ -package types - -import ( - "cosmossdk.io/x/nft" -) - -func (n DIDNamespace) ID() string { - switch n { - case DIDNamespace_DID_NAMESPACE_DWN: - return "did:dwn:0" - case DIDNamespace_DID_NAMESPACE_SONR: - return "did:sonr:0" - case DIDNamespace_DID_NAMESPACE_BITCOIN: - return "did:btc:0" - case DIDNamespace_DID_NAMESPACE_ETHEREUM: - return "did:eth:0" - case DIDNamespace_DID_NAMESPACE_IBC: - return "did:ibc:0" - case DIDNamespace_DID_NAMESPACE_WEBAUTHN: - return "did:authn:0" - case DIDNamespace_DID_NAMESPACE_SERVICE: - return "did:web:0" - case DIDNamespace_DID_NAMESPACE_IPFS: - return "did:ipfs:0" - } - return "" -} - -func (n DIDNamespace) Name() string { - switch n { - case DIDNamespace_DID_NAMESPACE_DWN: - return "DecentralizedWebNode" - case DIDNamespace_DID_NAMESPACE_SONR: - return "SonrNetwork" - case DIDNamespace_DID_NAMESPACE_BITCOIN: - return "BitcoinNetwork" - case DIDNamespace_DID_NAMESPACE_ETHEREUM: - return "EthereumNetwork" - case DIDNamespace_DID_NAMESPACE_IBC: - return "IBCNetwork" - case DIDNamespace_DID_NAMESPACE_WEBAUTHN: - return "WebAuthentication" - case DIDNamespace_DID_NAMESPACE_SERVICE: - return "DecentrlizedService" - case DIDNamespace_DID_NAMESPACE_IPFS: - return "IPFSStorage" - } - return "" -} - -func (n DIDNamespace) Symbol() string { - switch n { - case DIDNamespace_DID_NAMESPACE_DWN: - return "DWN" - case DIDNamespace_DID_NAMESPACE_SONR: - return "SONR" - case DIDNamespace_DID_NAMESPACE_BITCOIN: - return "BTC" - case DIDNamespace_DID_NAMESPACE_ETHEREUM: - return "ETH" - case DIDNamespace_DID_NAMESPACE_IBC: - return "IBC" - case DIDNamespace_DID_NAMESPACE_WEBAUTHN: - return "WEBAUTHN" - case DIDNamespace_DID_NAMESPACE_SERVICE: - return "SERVICE" - case DIDNamespace_DID_NAMESPACE_IPFS: - return "IPFS" - } - return "" -} - -func (n DIDNamespace) Description() string { - switch n { - case DIDNamespace_DID_NAMESPACE_DWN: - return "DWN Service Provider" - case DIDNamespace_DID_NAMESPACE_SONR: - return "Sonr Network Gateway" - case DIDNamespace_DID_NAMESPACE_BITCOIN: - return "Bitcoin Network Gateway" - case DIDNamespace_DID_NAMESPACE_ETHEREUM: - return "Ethereum Network Gateway" - case DIDNamespace_DID_NAMESPACE_IBC: - return "IBC Network Gateway" - case DIDNamespace_DID_NAMESPACE_WEBAUTHN: - return "Web Authentication Key" - case DIDNamespace_DID_NAMESPACE_SERVICE: - return "Decentrlized Service" - case DIDNamespace_DID_NAMESPACE_IPFS: - return "Data Storage on IPFS" - } - return "" -} - -func (n DIDNamespace) GetNFTClass() *nft.Class { - return &nft.Class{ - Id: n.ID(), - Name: n.Name(), - Symbol: n.Symbol(), - Description: n.Description(), - } -} diff --git a/x/did/types/oidc/DiscoveryDocument.pkl.go b/x/did/types/oidc/DiscoveryDocument.pkl.go deleted file mode 100644 index d25cce456..000000000 --- a/x/did/types/oidc/DiscoveryDocument.pkl.go +++ /dev/null @@ -1,34 +0,0 @@ -// Code generated from Pkl module `oidc`. DO NOT EDIT. -package oidc - -type DiscoveryDocument struct { - Issuer string `pkl:"issuer" json:"issuer,omitempty" param:"issuer"` - - AuthorizationEndpoint string `pkl:"authorization_endpoint" json:"authorization_endpoint,omitempty" param:"authorization_endpoint"` - - TokenEndpoint string `pkl:"token_endpoint" json:"token_endpoint,omitempty" param:"token_endpoint"` - - UserinfoEndpoint string `pkl:"userinfo_endpoint" json:"userinfo_endpoint,omitempty" param:"userinfo_endpoint"` - - JwksUri string `pkl:"jwks_uri" json:"jwks_uri,omitempty" param:"jwks_uri"` - - RegistrationEndpoint string `pkl:"registration_endpoint" json:"registration_endpoint,omitempty" param:"registration_endpoint"` - - ScopesSupported []string `pkl:"scopes_supported" json:"scopes_supported,omitempty" param:"scopes_supported"` - - ResponseTypesSupported []string `pkl:"response_types_supported" json:"response_types_supported,omitempty" param:"response_types_supported"` - - ResponseModesSupported []string `pkl:"response_modes_supported" json:"response_modes_supported,omitempty" param:"response_modes_supported"` - - SubjectTypesSupported []string `pkl:"subject_types_supported" json:"subject_types_supported,omitempty" param:"subject_types_supported"` - - IdTokenSigningAlgValuesSupported []string `pkl:"id_token_signing_alg_values_supported" json:"id_token_signing_alg_values_supported,omitempty" param:"id_token_signing_alg_values_supported"` - - ClaimsSupported []string `pkl:"claims_supported" json:"claims_supported,omitempty" param:"claims_supported"` - - GrantTypesSupported []string `pkl:"grant_types_supported" json:"grant_types_supported,omitempty" param:"grant_types_supported"` - - AcrValuesSupported []string `pkl:"acr_values_supported" json:"acr_values_supported,omitempty" param:"acr_values_supported"` - - TokenEndpointAuthMethodsSupported []string `pkl:"token_endpoint_auth_methods_supported" json:"token_endpoint_auth_methods_supported,omitempty" param:"token_endpoint_auth_methods_supported"` -} diff --git a/x/did/types/oidc/Oidc.pkl.go b/x/did/types/oidc/Oidc.pkl.go deleted file mode 100644 index 3a4e4a67a..000000000 --- a/x/did/types/oidc/Oidc.pkl.go +++ /dev/null @@ -1,36 +0,0 @@ -// Code generated from Pkl module `oidc`. DO NOT EDIT. -package oidc - -import ( - "context" - - "github.com/apple/pkl-go/pkl" -) - -type Oidc struct { -} - -// LoadFromPath loads the pkl module at the given path and evaluates it into a Oidc -func LoadFromPath(ctx context.Context, path string) (ret *Oidc, err error) { - evaluator, err := pkl.NewEvaluator(ctx, pkl.PreconfiguredOptions) - if err != nil { - return nil, err - } - defer func() { - cerr := evaluator.Close() - if err == nil { - err = cerr - } - }() - ret, err = Load(ctx, evaluator, pkl.FileSource(path)) - return ret, err -} - -// Load loads the pkl module at the given source and evaluates it with the given evaluator into a Oidc -func Load(ctx context.Context, evaluator pkl.Evaluator, source *pkl.ModuleSource) (*Oidc, error) { - var ret Oidc - if err := evaluator.EvaluateModule(ctx, source, &ret); err != nil { - return nil, err - } - return &ret, nil -} diff --git a/x/did/types/oidc/init.pkl.go b/x/did/types/oidc/init.pkl.go deleted file mode 100644 index 0f351c673..000000000 --- a/x/did/types/oidc/init.pkl.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated from Pkl module `oidc`. DO NOT EDIT. -package oidc - -import "github.com/apple/pkl-go/pkl" - -func init() { - pkl.RegisterMapping("oidc", Oidc{}) - pkl.RegisterMapping("oidc#DiscoveryDocument", DiscoveryDocument{}) -} diff --git a/x/did/types/pubkey.go b/x/did/types/pubkey.go index 8d75ac1fb..ab1254f4c 100644 --- a/x/did/types/pubkey.go +++ b/x/did/types/pubkey.go @@ -1,153 +1 @@ package types - -import ( - "crypto/ecdsa" - "encoding/hex" - - cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" - "github.com/mr-tron/base58/base58" - "github.com/onsonr/crypto" - "github.com/onsonr/crypto/macaroon" -) - -var WalletKeyInfo = &KeyInfo{ - Role: KeyRole_KEY_ROLE_DELEGATION, - Curve: KeyCurve_KEY_CURVE_SECP256K1, - Algorithm: KeyAlgorithm_KEY_ALGORITHM_ECDSA, - Encoding: KeyEncoding_KEY_ENCODING_HEX, - Type: KeyType_KEY_TYPE_BIP32, -} - -var EthKeyInfo = &KeyInfo{ - Role: KeyRole_KEY_ROLE_DELEGATION, - Curve: KeyCurve_KEY_CURVE_KECCAK256, - Algorithm: KeyAlgorithm_KEY_ALGORITHM_ECDSA, - Encoding: KeyEncoding_KEY_ENCODING_HEX, - Type: KeyType_KEY_TYPE_BIP32, -} - -var SonrKeyInfo = &KeyInfo{ - Role: KeyRole_KEY_ROLE_INVOCATION, - Curve: KeyCurve_KEY_CURVE_P256, - Algorithm: KeyAlgorithm_KEY_ALGORITHM_ECDSA, - Encoding: KeyEncoding_KEY_ENCODING_HEX, - Type: KeyType_KEY_TYPE_MPC, -} - -var ChainCodeKeyInfos = map[ChainCode]*KeyInfo{ - ChainCodeBTC: WalletKeyInfo, - ChainCodeETH: EthKeyInfo, - ChainCodeSNR: SonrKeyInfo, - ChainCodeIBC: WalletKeyInfo, -} - -// NewEthPublicKey returns a new ethereum public key -func NewPublicKey(data []byte, keyInfo *KeyInfo) (*PubKey, error) { - encKey, err := keyInfo.Encoding.EncodeRaw(data) - if err != nil { - return nil, err - } - - return &PubKey{ - Raw: encKey, - Role: keyInfo.Role, - Encoding: keyInfo.Encoding, - Algorithm: keyInfo.Algorithm, - Curve: keyInfo.Curve, - KeyType: keyInfo.Type, - }, nil -} - -// Address returns the address of the public key -func (k *PubKey) Address() cryptotypes.Address { - return nil -} - -// Bytes returns the raw bytes of the public key -func (k *PubKey) Bytes() []byte { - bz, _ := k.GetEncoding().DecodeRaw(k.GetRaw()) - return bz -} - -// Clone returns a copy of the public key -func (k *PubKey) Clone() cryptotypes.PubKey { - return &PubKey{ - Raw: k.GetRaw(), - Role: k.GetRole(), - Encoding: k.GetEncoding(), - Algorithm: k.GetAlgorithm(), - Curve: k.GetCurve(), - KeyType: k.GetKeyType(), - } -} - -// IssueMacaroon returns a macaroon for the public key with the given id and location -func (pk *PubKey) IssueMacaroon(subject string, origin string) (*macaroon.Macaroon, error) { - return macaroon.New(pk.Bytes(), []byte(subject), origin, macaroon.LatestVersion) -} - -// ECDSA returns the ECDSA public key -func (k *PubKey) ECDSA() (*ecdsa.PublicKey, error) { - return crypto.ComputeEcdsaPublicKey(k.Bytes()) -} - -// VerifySignature verifies a signature over the given message -func (k *PubKey) VerifySignature(msg []byte, sig []byte) bool { - pk, err := crypto.ComputeEcdsaPublicKey(k.Bytes()) - sigMpc, err := crypto.DeserializeMPCSignature(sig) - if err != nil { - return false - } - return crypto.VerifyMPCSignature(sigMpc, msg, pk) -} - -// Equals returns true if two public keys are equal -func (k *PubKey) Equals(k2 cryptotypes.PubKey) bool { - if k == nil && k2 == nil { - return true - } - return false -} - -// Type returns the type of the public key -func (k *PubKey) Type() string { - return k.KeyType.String() -} - -// DecodePublicKey extracts the public key from the given data -func (k *KeyInfo) DecodePublicKey(data interface{}) ([]byte, error) { - var bz []byte - switch v := data.(type) { - case string: - bz = []byte(v) - case []byte: - bz = v - default: - return nil, ErrUnsupportedKeyEncoding - } - - if k.Encoding == KeyEncoding_KEY_ENCODING_RAW { - return bz, nil - } - if k.Encoding == KeyEncoding_KEY_ENCODING_HEX { - return hex.DecodeString(string(bz)) - } - if k.Encoding == KeyEncoding_KEY_ENCODING_MULTIBASE { - return base58.Decode(string(bz)) - } - return nil, ErrUnsupportedKeyEncoding -} - -// EncodePublicKey encodes the public key according to the KeyInfo's encoding -func (k *KeyInfo) EncodePublicKey(data []byte) (string, error) { - if k.Encoding == KeyEncoding_KEY_ENCODING_RAW { - return string(data), nil - } - if k.Encoding == KeyEncoding_KEY_ENCODING_HEX { - return hex.EncodeToString(data), nil - } - if k.Encoding == KeyEncoding_KEY_ENCODING_MULTIBASE { - return base58.Encode(data), nil - } - return "", ErrUnsupportedKeyEncoding -} diff --git a/x/did/types/scopes.go b/x/did/types/scopes.go deleted file mode 100644 index c64c97922..000000000 --- a/x/did/types/scopes.go +++ /dev/null @@ -1,53 +0,0 @@ -package types - -import "gopkg.in/macaroon-bakery.v2/bakery/checkers" - -var ( - PermissionScopeStrings = [...]string{ - "profile.name", - "identifiers.email", - "identifiers.phone", - "transactions.read", - "transactions.write", - "wallets.read", - "wallets.create", - "wallets.subscribe", - "wallets.update", - "transactions.verify", - "transactions.broadcast", - "admin.user", - "admin.validator", - } - - StringToPermissionScope = map[string]PermissionScope{ - "PERMISSION_SCOPE_UNSPECIFIED": PermissionScope_PERMISSION_SCOPE_UNSPECIFIED, - "PERMISSION_SCOPE_BASIC_INFO": PermissionScope_PERMISSION_SCOPE_BASIC_INFO, - "PERMISSION_SCOPE_IDENTIFIERS_EMAIL": PermissionScope_PERMISSION_SCOPE_PERMISSIONS_READ, - "PERMISSION_SCOPE_IDENTIFIERS_PHONE": PermissionScope_PERMISSION_SCOPE_PERMISSIONS_WRITE, - "PERMISSION_SCOPE_TRANSACTIONS_READ": PermissionScope_PERMISSION_SCOPE_TRANSACTIONS_READ, - "PERMISSION_SCOPE_TRANSACTIONS_WRITE": PermissionScope_PERMISSION_SCOPE_TRANSACTIONS_WRITE, - "PERMISSION_SCOPE_WALLETS_READ": PermissionScope_PERMISSION_SCOPE_WALLETS_READ, - "PERMISSION_SCOPE_WALLETS_CREATE": PermissionScope_PERMISSION_SCOPE_WALLETS_CREATE, - "PERMISSION_SCOPE_WALLETS_SUBSCRIBE": PermissionScope_PERMISSION_SCOPE_WALLETS_SUBSCRIBE, - "PERMISSION_SCOPE_WALLETS_UPDATE": PermissionScope_PERMISSION_SCOPE_WALLETS_UPDATE, - "PERMISSION_SCOPE_TRANSACTIONS_VERIFY": PermissionScope_PERMISSION_SCOPE_TRANSACTIONS_VERIFY, - "PERMISSION_SCOPE_TRANSACTIONS_BROADCAST": PermissionScope_PERMISSION_SCOPE_TRANSACTIONS_BROADCAST, - "PERMISSION_SCOPE_ADMIN_USER": PermissionScope_PERMISSION_SCOPE_ADMIN_USER, - "PERMISSION_SCOPE_ADMIN_VALIDATOR": PermissionScope_PERMISSION_SCOPE_ADMIN_VALIDATOR, - } -) - -func ResolvePermissionScope(scope string) (PermissionScope, bool) { - uriToPrefix := make(map[string]string) - for _, scope := range PermissionScopeStrings { - uriToPrefix["https://example.com/auth/"+scope] = scope - } - PermissionNamespace := checkers.NewNamespace(uriToPrefix) - - prefix, ok := PermissionNamespace.Resolve("https://example.com/auth/" + scope) - if !ok { - return 0, false - } - permScope, ok := StringToPermissionScope[prefix] - return permScope, ok -} diff --git a/x/did/types/state.pb.go b/x/did/types/state.pb.go index a2c173085..2ae9ec672 100644 --- a/x/did/types/state.pb.go +++ b/x/did/types/state.pb.go @@ -345,11 +345,11 @@ var fileDescriptor_f44bb702879c34b4 = []byte{ 0xb7, 0x97, 0xed, 0x3f, 0x03, 0x79, 0x06, 0xfb, 0xb3, 0x52, 0xff, 0x03, 0x35, 0x9f, 0x32, 0x17, 0x4c, 0x50, 0x3e, 0x78, 0x37, 0x9f, 0xb2, 0xfe, 0xd4, 0x18, 0x7c, 0xb5, 0x59, 0x58, 0xdb, 0x4d, 0xd7, 0x69, 0x1b, 0x8b, 0x3b, 0xf0, 0x70, 0x33, 0x5e, 0x77, 0x33, 0x5b, 0xd7, 0x72, 0x8d, 0xe7, - 0xc7, 0xd0, 0xbe, 0x23, 0xba, 0xba, 0x64, 0xc5, 0xf3, 0x09, 0x22, 0xd5, 0xd7, 0xaf, 0x7e, 0x2c, + 0xc7, 0xd0, 0xbe, 0x23, 0xba, 0xba, 0x64, 0xc5, 0xf3, 0x09, 0x22, 0x95, 0xd7, 0xaf, 0x7e, 0x2c, 0x42, 0x74, 0xb3, 0x08, 0xd1, 0x9f, 0x45, 0x88, 0xbe, 0x2e, 0xc3, 0x9d, 0x9b, 0x65, 0xb8, 0xf3, 0x6b, 0x19, 0xee, 0x7c, 0xe8, 0x0c, 0xb9, 0x1a, 0x15, 0x49, 0x2f, 0x15, 0x93, 0x48, 0x64, 0x3a, 0xe9, 0xc8, 0x7c, 0x3e, 0x47, 0xfa, 0xd9, 0xea, 0x1b, 0x65, 0x52, 0x33, 0x4f, 0xf6, 0xe5, 0xbf, - 0x00, 0x00, 0x00, 0xff, 0xff, 0x58, 0x8d, 0xb9, 0xaa, 0xff, 0x03, 0x00, 0x00, + 0x00, 0x00, 0x00, 0xff, 0xff, 0xb0, 0x53, 0x80, 0x70, 0xff, 0x03, 0x00, 0x00, } func (m *Alias) Marshal() (dAtA []byte, err error) { diff --git a/x/did/types/tx.pb.go b/x/did/types/tx.pb.go index 07dea1660..b2dea3f72 100644 --- a/x/did/types/tx.pb.go +++ b/x/did/types/tx.pb.go @@ -30,110 +30,6 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package -// MsgAllocateVault is the message type for the AllocateVault RPC. -type MsgAllocateVault struct { - // authority is the address of the service account. - Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` - // params defines the parameters to update. - Params Params `protobuf:"bytes,2,opt,name=params,proto3" json:"params"` - // token is the macron token to authenticate the operation. - Token string `protobuf:"bytes,3,opt,name=token,proto3" json:"token,omitempty"` -} - -func (m *MsgAllocateVault) Reset() { *m = MsgAllocateVault{} } -func (m *MsgAllocateVault) String() string { return proto.CompactTextString(m) } -func (*MsgAllocateVault) ProtoMessage() {} -func (*MsgAllocateVault) Descriptor() ([]byte, []int) { - return fileDescriptor_d73284df019ff211, []int{0} -} -func (m *MsgAllocateVault) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgAllocateVault) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgAllocateVault.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 *MsgAllocateVault) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgAllocateVault.Merge(m, src) -} -func (m *MsgAllocateVault) XXX_Size() int { - return m.Size() -} -func (m *MsgAllocateVault) XXX_DiscardUnknown() { - xxx_messageInfo_MsgAllocateVault.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgAllocateVault proto.InternalMessageInfo - -func (m *MsgAllocateVault) GetAuthority() string { - if m != nil { - return m.Authority - } - return "" -} - -func (m *MsgAllocateVault) GetSubject() string { - if m != nil { - return m.Params - } - return Params{} -} - -func (m *MsgUpdateParams) GetToken() string { - if m != nil { - return m.Token - } - return "" -} - -// MsgUpdateParamsResponse defines the response structure for executing a -// MsgUpdateParams message. -// -// Since: cosmos-sdk 0.47 -type MsgUpdateParamsResponse struct { -} - -func (m *MsgUpdateParamsResponse) Reset() { *m = MsgUpdateParamsResponse{} } -func (m *MsgUpdateParamsResponse) String() string { return proto.CompactTextString(m) } -func (*MsgUpdateParamsResponse) ProtoMessage() {} -func (*MsgUpdateParamsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_d73284df019ff211, []int{1} -} -func (m *MsgUpdateParamsResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgUpdateParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgUpdateParamsResponse.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 *MsgUpdateParamsResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgUpdateParamsResponse.Merge(m, src) -} -func (m *MsgUpdateParamsResponse) XXX_Size() int { - return m.Size() -} -func (m *MsgUpdateParamsResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgUpdateParamsResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgUpdateParamsResponse proto.InternalMessageInfo - // MsgAllocateVault is the message type for the AllocateVault RPC. type MsgAllocateVault struct { // authority is the address of the service account. @@ -148,7 +44,7 @@ func (m *MsgAllocateVault) Reset() { *m = MsgAllocateVault{} } func (m *MsgAllocateVault) String() string { return proto.CompactTextString(m) } func (*MsgAllocateVault) ProtoMessage() {} func (*MsgAllocateVault) Descriptor() ([]byte, []int) { - return fileDescriptor_d73284df019ff211, []int{2} + return fileDescriptor_d73284df019ff211, []int{0} } func (m *MsgAllocateVault) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -214,7 +110,7 @@ func (m *MsgAllocateVaultResponse) Reset() { *m = MsgAllocateVaultRespon func (m *MsgAllocateVaultResponse) String() string { return proto.CompactTextString(m) } func (*MsgAllocateVaultResponse) ProtoMessage() {} func (*MsgAllocateVaultResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_d73284df019ff211, []int{3} + return fileDescriptor_d73284df019ff211, []int{1} } func (m *MsgAllocateVaultResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -287,7 +183,7 @@ func (m *MsgRegisterController) Reset() { *m = MsgRegisterController{} } func (m *MsgRegisterController) String() string { return proto.CompactTextString(m) } func (*MsgRegisterController) ProtoMessage() {} func (*MsgRegisterController) Descriptor() ([]byte, []int) { - return fileDescriptor_d73284df019ff211, []int{4} + return fileDescriptor_d73284df019ff211, []int{2} } func (m *MsgRegisterController) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -358,7 +254,7 @@ func (m *MsgRegisterControllerResponse) Reset() { *m = MsgRegisterContro func (m *MsgRegisterControllerResponse) String() string { return proto.CompactTextString(m) } func (*MsgRegisterControllerResponse) ProtoMessage() {} func (*MsgRegisterControllerResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_d73284df019ff211, []int{5} + return fileDescriptor_d73284df019ff211, []int{3} } func (m *MsgRegisterControllerResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -408,6 +304,123 @@ func (m *MsgRegisterControllerResponse) GetAccounts() map[string]string { return nil } +// MsgExecuteTx is the message type for the ExecuteTx RPC. +type MsgExecuteTx struct { + // Controller is the address of the controller to authenticate. + Controller string `protobuf:"bytes,1,opt,name=controller,proto3" json:"controller,omitempty"` + // Messages is the list of messages to execute. + Messages map[string][]byte `protobuf:"bytes,2,rep,name=messages,proto3" json:"messages,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + // MacaroonToken is the macaroon token to authenticate the operation. + MacaroonToken string `protobuf:"bytes,3,opt,name=macaroon_token,json=macaroonToken,proto3" json:"macaroon_token,omitempty"` +} + +func (m *MsgExecuteTx) Reset() { *m = MsgExecuteTx{} } +func (m *MsgExecuteTx) String() string { return proto.CompactTextString(m) } +func (*MsgExecuteTx) ProtoMessage() {} +func (*MsgExecuteTx) Descriptor() ([]byte, []int) { + return fileDescriptor_d73284df019ff211, []int{4} +} +func (m *MsgExecuteTx) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgExecuteTx) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgExecuteTx.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 *MsgExecuteTx) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgExecuteTx.Merge(m, src) +} +func (m *MsgExecuteTx) XXX_Size() int { + return m.Size() +} +func (m *MsgExecuteTx) XXX_DiscardUnknown() { + xxx_messageInfo_MsgExecuteTx.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgExecuteTx proto.InternalMessageInfo + +func (m *MsgExecuteTx) GetController() string { + if m != nil { + return m.Controller + } + return "" +} + +func (m *MsgExecuteTx) GetMessages() map[string][]byte { + if m != nil { + return m.Messages + } + return nil +} + +func (m *MsgExecuteTx) GetMacaroonToken() string { + if m != nil { + return m.MacaroonToken + } + return "" +} + +// MsgExecuteTxResponse is the response type for the ExecuteTx RPC. +type MsgExecuteTxResponse struct { + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + TxHash string `protobuf:"bytes,2,opt,name=tx_hash,json=txHash,proto3" json:"tx_hash,omitempty"` +} + +func (m *MsgExecuteTxResponse) Reset() { *m = MsgExecuteTxResponse{} } +func (m *MsgExecuteTxResponse) String() string { return proto.CompactTextString(m) } +func (*MsgExecuteTxResponse) ProtoMessage() {} +func (*MsgExecuteTxResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_d73284df019ff211, []int{5} +} +func (m *MsgExecuteTxResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgExecuteTxResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgExecuteTxResponse.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 *MsgExecuteTxResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgExecuteTxResponse.Merge(m, src) +} +func (m *MsgExecuteTxResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgExecuteTxResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgExecuteTxResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgExecuteTxResponse proto.InternalMessageInfo + +func (m *MsgExecuteTxResponse) GetSuccess() bool { + if m != nil { + return m.Success + } + return false +} + +func (m *MsgExecuteTxResponse) GetTxHash() string { + if m != nil { + return m.TxHash + } + return "" +} + // MsgAuthorizeService is the message type for the AuthorizeService RPC. type MsgAuthorizeService struct { // Controller is the address of the controller to authenticate. @@ -642,14 +655,121 @@ func (m *MsgRegisterServiceResponse) GetDid() string { return "" } +// MsgUpdateParams is the Msg/UpdateParams request type. +// +// Since: cosmos-sdk 0.47 +type MsgUpdateParams struct { + // authority is the address of the governance account. + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` + // params defines the parameters to update. + Params Params `protobuf:"bytes,2,opt,name=params,proto3" json:"params"` + // token is the macron token to authenticate the operation. + Token string `protobuf:"bytes,3,opt,name=token,proto3" json:"token,omitempty"` +} + +func (m *MsgUpdateParams) Reset() { *m = MsgUpdateParams{} } +func (m *MsgUpdateParams) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateParams) ProtoMessage() {} +func (*MsgUpdateParams) Descriptor() ([]byte, []int) { + return fileDescriptor_d73284df019ff211, []int{10} +} +func (m *MsgUpdateParams) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateParams.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 *MsgUpdateParams) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateParams.Merge(m, src) +} +func (m *MsgUpdateParams) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateParams) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateParams.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateParams proto.InternalMessageInfo + +func (m *MsgUpdateParams) GetAuthority() string { + if m != nil { + return m.Authority + } + return "" +} + +func (m *MsgUpdateParams) GetParams() Params { + if m != nil { + return m.Params + } + return Params{} +} + +func (m *MsgUpdateParams) GetToken() string { + if m != nil { + return m.Token + } + return "" +} + +// MsgUpdateParamsResponse defines the response structure for executing a +// MsgUpdateParams message. +// +// Since: cosmos-sdk 0.47 +type MsgUpdateParamsResponse struct { +} + +func (m *MsgUpdateParamsResponse) Reset() { *m = MsgUpdateParamsResponse{} } +func (m *MsgUpdateParamsResponse) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateParamsResponse) ProtoMessage() {} +func (*MsgUpdateParamsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_d73284df019ff211, []int{11} +} +func (m *MsgUpdateParamsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateParamsResponse.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 *MsgUpdateParamsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateParamsResponse.Merge(m, src) +} +func (m *MsgUpdateParamsResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateParamsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateParamsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateParamsResponse proto.InternalMessageInfo + func init() { - proto.RegisterType((*MsgUpdateParams)(nil), "did.v1.MsgUpdateParams") - proto.RegisterType((*MsgUpdateParamsResponse)(nil), "did.v1.MsgUpdateParamsResponse") proto.RegisterType((*MsgAllocateVault)(nil), "did.v1.MsgAllocateVault") proto.RegisterType((*MsgAllocateVaultResponse)(nil), "did.v1.MsgAllocateVaultResponse") proto.RegisterType((*MsgRegisterController)(nil), "did.v1.MsgRegisterController") proto.RegisterType((*MsgRegisterControllerResponse)(nil), "did.v1.MsgRegisterControllerResponse") proto.RegisterMapType((map[string]string)(nil), "did.v1.MsgRegisterControllerResponse.AccountsEntry") + proto.RegisterType((*MsgExecuteTx)(nil), "did.v1.MsgExecuteTx") + proto.RegisterMapType((map[string][]byte)(nil), "did.v1.MsgExecuteTx.MessagesEntry") + proto.RegisterType((*MsgExecuteTxResponse)(nil), "did.v1.MsgExecuteTxResponse") proto.RegisterType((*MsgAuthorizeService)(nil), "did.v1.MsgAuthorizeService") proto.RegisterMapType((map[string]string)(nil), "did.v1.MsgAuthorizeService.PermissionsEntry") proto.RegisterType((*MsgAuthorizeServiceResponse)(nil), "did.v1.MsgAuthorizeServiceResponse") @@ -662,58 +782,65 @@ func init() { func init() { proto.RegisterFile("did/v1/tx.proto", fileDescriptor_d73284df019ff211) } var fileDescriptor_d73284df019ff211 = []byte{ - // 806 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x55, 0x4f, 0x6f, 0xfb, 0x44, - 0x10, 0x8d, 0xe3, 0xfc, 0xf2, 0x6b, 0x26, 0x6d, 0x13, 0x2d, 0x85, 0xba, 0x2e, 0x4d, 0x83, 0x01, - 0x29, 0x54, 0x25, 0x51, 0x5b, 0x09, 0x55, 0x05, 0x21, 0x35, 0x08, 0xa9, 0x12, 0x0a, 0x14, 0x17, - 0x38, 0xf4, 0x52, 0x39, 0xf6, 0xe2, 0x2c, 0x71, 0xbc, 0xd1, 0xee, 0x26, 0x6a, 0x38, 0xf1, 0xe7, - 0x86, 0x38, 0xf0, 0x05, 0xe0, 0xcc, 0xb1, 0x07, 0xbe, 0x01, 0x97, 0x1e, 0x2b, 0x4e, 0x9c, 0x10, - 0x6a, 0x0f, 0xfd, 0x1a, 0xc8, 0x5e, 0xdb, 0x71, 0xfe, 0x34, 0x6a, 0xcb, 0x25, 0xf2, 0xcc, 0x1b, - 0xcf, 0xbe, 0x37, 0xf3, 0xb2, 0x86, 0x92, 0x43, 0x9c, 0xc6, 0x70, 0xaf, 0x21, 0x2e, 0xeb, 0x7d, - 0x46, 0x05, 0x45, 0x79, 0x87, 0x38, 0xf5, 0xe1, 0x9e, 0xbe, 0x6e, 0x53, 0xde, 0xa3, 0xbc, 0xd1, - 0xe3, 0x6e, 0x80, 0xf7, 0xb8, 0x2b, 0x0b, 0xf4, 0x0d, 0x09, 0x5c, 0x84, 0x51, 0x43, 0x06, 0x11, - 0xb4, 0x16, 0x35, 0x73, 0xb1, 0x8f, 0x39, 0x49, 0xb2, 0x2e, 0x75, 0xa9, 0xac, 0x0e, 0x9e, 0x64, - 0xd6, 0xf8, 0x55, 0x81, 0x52, 0x8b, 0xbb, 0x5f, 0xf6, 0x1d, 0x4b, 0xe0, 0x53, 0x8b, 0x59, 0x3d, - 0x8e, 0xde, 0x83, 0x82, 0x35, 0x10, 0x1d, 0xca, 0x88, 0x18, 0x69, 0x4a, 0x55, 0xa9, 0x15, 0x9a, - 0xda, 0x5f, 0x7f, 0xbc, 0xbb, 0x16, 0x1d, 0x72, 0xec, 0x38, 0x0c, 0x73, 0x7e, 0x26, 0x18, 0xf1, - 0x5d, 0x73, 0x5c, 0x8a, 0x76, 0x21, 0xdf, 0x0f, 0x3b, 0x68, 0xd9, 0xaa, 0x52, 0x2b, 0xee, 0xaf, - 0xd6, 0xa5, 0x88, 0xba, 0xec, 0xdb, 0xcc, 0x5d, 0xff, 0xb3, 0x9d, 0x31, 0xa3, 0x1a, 0xb4, 0x06, - 0x2f, 0x04, 0xed, 0x62, 0x5f, 0x53, 0x83, 0x13, 0x4c, 0x19, 0x1c, 0xad, 0xfe, 0x70, 0x7f, 0xb5, - 0x33, 0xee, 0x69, 0x6c, 0xc0, 0xfa, 0x14, 0x3d, 0x13, 0xf3, 0x3e, 0xf5, 0x39, 0x36, 0x7e, 0x56, - 0xa0, 0xdc, 0xe2, 0xee, 0xb1, 0xe7, 0x51, 0xdb, 0x12, 0xf8, 0x2b, 0x6b, 0xe0, 0x89, 0x67, 0x73, - 0xd7, 0xe0, 0x25, 0x1f, 0xb4, 0xbf, 0xc1, 0xb6, 0x08, 0xc9, 0x17, 0xcc, 0x38, 0x44, 0xaf, 0x41, - 0x9e, 0x32, 0xe2, 0x92, 0x98, 0x68, 0x14, 0xcd, 0x30, 0xfd, 0x51, 0x01, 0x6d, 0x9a, 0x4e, 0xcc, - 0x15, 0x95, 0x41, 0xb5, 0x89, 0x23, 0x09, 0x99, 0xc1, 0x23, 0x7a, 0x03, 0x96, 0xf1, 0x65, 0x9f, - 0xb0, 0xd1, 0x45, 0xdb, 0xa3, 0x76, 0x37, 0x3c, 0x55, 0x35, 0x8b, 0x32, 0xd7, 0x0c, 0x52, 0xf3, - 0x27, 0x84, 0x5e, 0x87, 0x42, 0x70, 0x82, 0xd7, 0xa1, 0x5c, 0x68, 0xb9, 0xaa, 0x52, 0x5b, 0x32, - 0xc7, 0x09, 0xe3, 0x4f, 0x05, 0x5e, 0x6d, 0x71, 0xd7, 0xc4, 0x2e, 0xe1, 0x02, 0xb3, 0x8f, 0xa8, - 0x2f, 0x18, 0xf5, 0x3c, 0xcc, 0x9e, 0x3d, 0x99, 0x0a, 0x80, 0xc5, 0x39, 0x66, 0x82, 0x50, 0x3f, - 0xd8, 0xac, 0x5a, 0x5b, 0x36, 0x53, 0x99, 0x80, 0x4f, 0x17, 0x8f, 0x78, 0xc7, 0x62, 0x98, 0x6b, - 0x6a, 0x08, 0x8f, 0x13, 0xe8, 0x2d, 0x58, 0x19, 0x62, 0x46, 0xbe, 0x26, 0xb6, 0x25, 0x1b, 0xe4, - 0xc2, 0x8a, 0xc9, 0xe4, 0xcc, 0x2c, 0xbf, 0xcf, 0xc2, 0xd6, 0x5c, 0x15, 0xc9, 0x40, 0xc3, 0x7d, - 0xd9, 0x36, 0xe6, 0x3c, 0xd4, 0xb2, 0x64, 0xc6, 0x21, 0x3a, 0x04, 0xb0, 0x93, 0x7a, 0xb9, 0xcc, - 0x05, 0x42, 0x53, 0xb5, 0xe8, 0x33, 0x58, 0xb2, 0x6c, 0x9b, 0x0e, 0x7c, 0x21, 0x85, 0x14, 0xf7, - 0x0f, 0x62, 0x07, 0x2f, 0x24, 0x53, 0x3f, 0x8e, 0xde, 0xfa, 0xd8, 0x17, 0x6c, 0x64, 0x26, 0x4d, - 0xf4, 0xf7, 0x61, 0x65, 0x02, 0x0a, 0x6c, 0xd0, 0xc5, 0xa3, 0xd8, 0x06, 0x5d, 0x3c, 0x0a, 0x76, - 0x3c, 0xb4, 0xbc, 0x01, 0x8e, 0x5c, 0x27, 0x83, 0xa3, 0xec, 0xa1, 0x62, 0xfc, 0x96, 0x85, 0x57, - 0x02, 0x3f, 0xc9, 0xa1, 0x7c, 0x8b, 0xcf, 0x30, 0x1b, 0x12, 0x1b, 0x4f, 0xe9, 0x53, 0x9e, 0xa0, - 0x6f, 0xec, 0xe4, 0x6c, 0xda, 0xc9, 0xe8, 0x53, 0x28, 0xf6, 0x31, 0xeb, 0x11, 0xce, 0xc3, 0x0d, - 0x49, 0xe9, 0xbb, 0x29, 0xe9, 0xd3, 0x1c, 0xea, 0xa7, 0xe3, 0x72, 0xa9, 0x39, 0xdd, 0x60, 0xec, - 0xdb, 0x5c, 0xca, 0xb7, 0xfa, 0x87, 0x50, 0x9e, 0x7e, 0xed, 0x29, 0xf3, 0x38, 0x2a, 0x05, 0x1e, - 0x49, 0xc9, 0x31, 0x5a, 0xb0, 0x39, 0x87, 0xdb, 0x23, 0x1c, 0x92, 0xf0, 0xcb, 0xa6, 0xf8, 0x19, - 0x3f, 0x29, 0x80, 0x52, 0x6b, 0xfe, 0xff, 0xe3, 0x7e, 0x07, 0x5e, 0x72, 0xd9, 0x24, 0xba, 0x0f, - 0x4b, 0xf1, 0x48, 0x63, 0xaa, 0x31, 0x3e, 0xab, 0xed, 0x04, 0xf4, 0x59, 0x2e, 0x8f, 0x90, 0x56, - 0x06, 0xd5, 0x21, 0x4e, 0x24, 0x2c, 0x78, 0xdc, 0xff, 0x5d, 0x05, 0xb5, 0xc5, 0x5d, 0x74, 0x02, - 0xcb, 0x13, 0x97, 0xfc, 0x7a, 0x6a, 0xbf, 0x69, 0x40, 0xdf, 0x7e, 0x00, 0x48, 0x4e, 0xff, 0x02, - 0xca, 0x33, 0xa6, 0xdc, 0x5c, 0xe0, 0x16, 0xfd, 0xcd, 0x05, 0x60, 0xd2, 0xf5, 0x13, 0x58, 0x99, - 0xbc, 0xc9, 0xb5, 0xf4, 0x5b, 0x69, 0x44, 0xaf, 0x3e, 0x84, 0x24, 0xcd, 0xce, 0x01, 0xcd, 0xb9, - 0x01, 0xb7, 0x16, 0xfe, 0x9b, 0xf5, 0xb7, 0x1f, 0xf5, 0x67, 0x47, 0x9f, 0x43, 0x69, 0xda, 0x23, - 0xfa, 0x9c, 0x37, 0x63, 0xf1, 0xc6, 0xc3, 0x58, 0xdc, 0x52, 0x7f, 0xf1, 0xdd, 0xfd, 0xd5, 0x8e, - 0xd2, 0xfc, 0xe0, 0xfa, 0xb6, 0xa2, 0xdc, 0xdc, 0x56, 0x94, 0x7f, 0x6f, 0x2b, 0xca, 0x2f, 0x77, - 0x95, 0xcc, 0xcd, 0x5d, 0x25, 0xf3, 0xf7, 0x5d, 0x25, 0x73, 0x6e, 0xb8, 0x44, 0x74, 0x06, 0xed, - 0xba, 0x4d, 0x7b, 0x0d, 0xea, 0x73, 0xea, 0xb3, 0x46, 0xf8, 0x73, 0xd9, 0x08, 0x3e, 0xf5, 0x62, - 0xd4, 0xc7, 0xbc, 0x9d, 0x0f, 0x3f, 0xe8, 0x07, 0xff, 0x05, 0x00, 0x00, 0xff, 0xff, 0x20, 0x91, - 0xda, 0xb5, 0x4b, 0x08, 0x00, 0x00, + // 922 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x56, 0x4f, 0x6f, 0x1b, 0x45, + 0x14, 0xcf, 0xda, 0xa9, 0x93, 0x3c, 0x3b, 0xb1, 0x35, 0x18, 0xb2, 0xdd, 0xb6, 0x6e, 0x58, 0xa8, + 0x14, 0xaa, 0x62, 0xab, 0xa9, 0x84, 0xaa, 0x80, 0x8a, 0x12, 0x54, 0x29, 0x08, 0x19, 0xca, 0x36, + 0x70, 0xe8, 0x25, 0xda, 0xec, 0x0e, 0xeb, 0xc1, 0xf6, 0x8e, 0x35, 0x6f, 0x6c, 0xd9, 0x9c, 0xf8, + 0x73, 0x43, 0x1c, 0xf8, 0x02, 0xf0, 0x19, 0x7a, 0xe0, 0x1b, 0x70, 0xe9, 0xb1, 0xe2, 0xc4, 0x09, + 0xa1, 0xe4, 0x50, 0xf1, 0x21, 0x90, 0xd0, 0xee, 0xec, 0xae, 0xc7, 0x7f, 0x62, 0xdc, 0xe6, 0x62, + 0xed, 0xbc, 0xf7, 0xe6, 0x37, 0xbf, 0xdf, 0x9b, 0xdf, 0xbe, 0x35, 0x94, 0x7d, 0xe6, 0x37, 0x06, + 0x77, 0x1b, 0x72, 0x58, 0xef, 0x09, 0x2e, 0x39, 0x29, 0xf8, 0xcc, 0xaf, 0x0f, 0xee, 0x5a, 0xdb, + 0x1e, 0xc7, 0x2e, 0xc7, 0x46, 0x17, 0x83, 0x28, 0xdf, 0xc5, 0x40, 0x15, 0x58, 0x57, 0x55, 0xe2, + 0x24, 0x5e, 0x35, 0xd4, 0x22, 0x49, 0x55, 0x13, 0xb0, 0x80, 0x86, 0x14, 0x59, 0x16, 0x0d, 0x78, + 0xc0, 0x55, 0x75, 0xf4, 0xa4, 0xa2, 0xf6, 0x4f, 0x06, 0x54, 0x9a, 0x18, 0x1c, 0x74, 0x3a, 0xdc, + 0x73, 0x25, 0xfd, 0xd2, 0xed, 0x77, 0x24, 0x79, 0x0f, 0x36, 0xdc, 0xbe, 0x6c, 0x71, 0xc1, 0xe4, + 0xc8, 0x34, 0x76, 0x8c, 0xdd, 0x8d, 0x43, 0xf3, 0x8f, 0xdf, 0xde, 0xad, 0x26, 0xa7, 0x1c, 0xf8, + 0xbe, 0xa0, 0x88, 0x8f, 0xa5, 0x60, 0x61, 0xe0, 0x8c, 0x4b, 0x89, 0x09, 0x6b, 0xd8, 0x3f, 0xfd, + 0x9a, 0x7a, 0xd2, 0xcc, 0x45, 0xbb, 0x9c, 0x74, 0x49, 0xde, 0x80, 0x02, 0x17, 0x2c, 0x60, 0xa1, + 0x99, 0x8f, 0x13, 0xc9, 0x6a, 0x7f, 0xeb, 0xfb, 0x17, 0x4f, 0x6f, 0x8f, 0x11, 0xec, 0x1f, 0x0c, + 0x30, 0xa7, 0xe9, 0x38, 0x14, 0x7b, 0x3c, 0x44, 0x4a, 0x2a, 0x90, 0xf7, 0x98, 0xaf, 0x08, 0x39, + 0xd1, 0x23, 0x79, 0x13, 0x4a, 0x74, 0xd8, 0x63, 0x62, 0x74, 0x72, 0xda, 0xe1, 0x5e, 0x3b, 0x3e, + 0x35, 0xef, 0x14, 0x55, 0xec, 0x30, 0x0a, 0x91, 0x2a, 0x5c, 0x91, 0xbc, 0x4d, 0xd3, 0x83, 0xd5, + 0x82, 0x5c, 0x87, 0x8d, 0xe8, 0x84, 0x4e, 0x8b, 0xa3, 0x34, 0x57, 0x77, 0x8c, 0xdd, 0x75, 0x67, + 0x1c, 0xb0, 0x7f, 0x37, 0xe0, 0xf5, 0x26, 0x06, 0x0e, 0x0d, 0x18, 0x4a, 0x2a, 0x3e, 0xe2, 0xa1, + 0x14, 0xbc, 0xd3, 0xa1, 0xe2, 0x95, 0x3b, 0x53, 0x03, 0x70, 0x11, 0xa9, 0x90, 0x8c, 0x87, 0x68, + 0xe6, 0x76, 0xf2, 0xbb, 0x25, 0x47, 0x8b, 0x44, 0x7c, 0xda, 0x74, 0x84, 0x2d, 0x57, 0x50, 0x34, + 0xf3, 0x71, 0x7a, 0x1c, 0x20, 0x6f, 0xc3, 0xe6, 0x80, 0x0a, 0xf6, 0x15, 0xf3, 0x5c, 0x05, 0xb0, + 0x1a, 0x57, 0x4c, 0x06, 0x67, 0x7a, 0xf9, 0x5d, 0x0e, 0x6e, 0xcc, 0x55, 0x91, 0x35, 0x34, 0xbe, + 0x2f, 0xcf, 0xa3, 0x88, 0xb1, 0x96, 0x75, 0x27, 0x5d, 0x92, 0xfb, 0x00, 0x5e, 0x56, 0xaf, 0x2e, + 0x73, 0x81, 0x50, 0xad, 0x96, 0x7c, 0x06, 0xeb, 0xae, 0xe7, 0xf1, 0x7e, 0x28, 0x95, 0x90, 0xe2, + 0xde, 0xbd, 0xba, 0xf2, 0x72, 0x7d, 0x21, 0x99, 0xfa, 0x41, 0xb2, 0xeb, 0x61, 0x28, 0xc5, 0xc8, + 0xc9, 0x40, 0xac, 0xf7, 0x61, 0x73, 0x22, 0x15, 0xd9, 0xa0, 0x4d, 0x47, 0xa9, 0x0d, 0xda, 0x74, + 0x14, 0xdd, 0xf1, 0xc0, 0xed, 0xf4, 0x69, 0xe2, 0x3a, 0xb5, 0xd8, 0xcf, 0xdd, 0x37, 0xec, 0x7f, + 0x0d, 0x28, 0x35, 0x31, 0x78, 0x38, 0xa4, 0x5e, 0x5f, 0xd2, 0xe3, 0xe1, 0x94, 0x30, 0xe3, 0x25, + 0x84, 0x3d, 0x80, 0xf5, 0x2e, 0x45, 0x74, 0x03, 0xaa, 0x2e, 0xb0, 0xb8, 0x67, 0x6b, 0xc2, 0xb2, + 0x13, 0xea, 0xcd, 0xa4, 0x28, 0xd1, 0x91, 0xee, 0x21, 0xb7, 0x60, 0xab, 0xeb, 0x7a, 0xae, 0xe0, + 0x3c, 0x3c, 0xd1, 0x1d, 0xb9, 0x99, 0x46, 0x8f, 0xa3, 0x60, 0x24, 0x77, 0x02, 0xe1, 0xff, 0xe4, + 0x96, 0x34, 0xb9, 0xfb, 0xe5, 0xc8, 0x02, 0x1a, 0x69, 0xfb, 0x63, 0xa8, 0xea, 0xe4, 0x96, 0xb8, + 0xf9, 0x6d, 0x58, 0x93, 0xc3, 0x93, 0x96, 0x8b, 0xad, 0xa4, 0x9b, 0x05, 0x39, 0x3c, 0x72, 0xb1, + 0x65, 0xff, 0x9a, 0x83, 0xd7, 0xa2, 0x57, 0x53, 0xf9, 0xeb, 0x1b, 0xfa, 0x98, 0x8a, 0x01, 0xf3, + 0xe8, 0x25, 0x3a, 0x3a, 0x1e, 0x0a, 0x39, 0x7d, 0x28, 0x90, 0x4f, 0xa1, 0xd8, 0xa3, 0xa2, 0xcb, + 0x10, 0x63, 0xb3, 0x2b, 0x17, 0xdd, 0xd1, 0x9a, 0x3d, 0xcd, 0xa1, 0xfe, 0x68, 0x5c, 0xae, 0xda, + 0xae, 0x03, 0x8c, 0x47, 0xc0, 0xaa, 0x36, 0x02, 0xac, 0x07, 0x50, 0x99, 0xde, 0xf6, 0x32, 0xd6, + 0x9a, 0xed, 0x75, 0x13, 0xae, 0xcd, 0xe1, 0xb6, 0x44, 0xcb, 0x33, 0x7e, 0x39, 0x8d, 0x9f, 0xfd, + 0xa3, 0x01, 0x44, 0x7b, 0x63, 0x2e, 0xdf, 0xee, 0x77, 0x60, 0x0d, 0x15, 0x48, 0x7c, 0x50, 0x71, + 0xaf, 0x9c, 0xb6, 0x34, 0xa5, 0x9a, 0xe6, 0x67, 0xb5, 0x1d, 0x81, 0x35, 0xcb, 0x65, 0x09, 0x69, + 0x15, 0xc8, 0xfb, 0xcc, 0x4f, 0x84, 0x45, 0x8f, 0xf6, 0x2f, 0x06, 0x94, 0x9b, 0x18, 0x7c, 0xd1, + 0xf3, 0x5d, 0x49, 0x1f, 0xb9, 0xc2, 0xed, 0xe2, 0x2b, 0x4f, 0xd5, 0x3b, 0x50, 0xe8, 0xc5, 0x08, + 0x89, 0xa0, 0xad, 0x54, 0x90, 0xc2, 0x3d, 0x5c, 0x7d, 0xf6, 0xd7, 0xcd, 0x15, 0x27, 0xa9, 0x99, + 0xff, 0x25, 0x98, 0x99, 0x9a, 0x57, 0x61, 0x7b, 0x8a, 0x5e, 0x2a, 0x73, 0xef, 0x9f, 0x3c, 0xe4, + 0x9b, 0x18, 0x90, 0x4f, 0x60, 0x73, 0xf2, 0x7b, 0x69, 0xea, 0xde, 0xd4, 0x33, 0xd6, 0xce, 0x45, + 0x99, 0xac, 0x77, 0xc7, 0x50, 0x99, 0x79, 0xa5, 0xae, 0x2d, 0xf0, 0xba, 0xf5, 0xd6, 0x82, 0x64, + 0x86, 0xfa, 0x21, 0x6c, 0x8c, 0x67, 0x5e, 0x75, 0xde, 0x9c, 0xb2, 0xae, 0xcf, 0x8b, 0x66, 0x00, + 0x4f, 0x80, 0xcc, 0xf9, 0xfc, 0xdd, 0x58, 0x38, 0xca, 0xad, 0x5b, 0x4b, 0x4d, 0x7a, 0xf2, 0x39, + 0x94, 0xa7, 0x5d, 0x6d, 0xcd, 0xd9, 0x99, 0x0a, 0xb6, 0x2f, 0xce, 0x65, 0x90, 0x47, 0x50, 0x9a, + 0x70, 0xd4, 0xb6, 0xb6, 0x47, 0x4f, 0x58, 0x37, 0x2f, 0x48, 0xa4, 0x48, 0xd6, 0x95, 0x6f, 0x5f, + 0x3c, 0xbd, 0x6d, 0x1c, 0x7e, 0xf0, 0xec, 0xac, 0x66, 0x3c, 0x3f, 0xab, 0x19, 0x7f, 0x9f, 0xd5, + 0x8c, 0x9f, 0xcf, 0x6b, 0x2b, 0xcf, 0xcf, 0x6b, 0x2b, 0x7f, 0x9e, 0xd7, 0x56, 0x9e, 0xd8, 0x01, + 0x93, 0xad, 0xfe, 0x69, 0xdd, 0xe3, 0xdd, 0x06, 0x0f, 0x91, 0x87, 0xa2, 0x11, 0xff, 0x0c, 0x1b, + 0xd1, 0xdf, 0x2e, 0x39, 0xea, 0x51, 0x3c, 0x2d, 0xc4, 0x7f, 0xae, 0xee, 0xfd, 0x17, 0x00, 0x00, + 0xff, 0xff, 0x68, 0x43, 0x51, 0x0c, 0xd7, 0x09, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -728,19 +855,19 @@ const _ = grpc.SupportPackageIsVersion4 // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type MsgClient interface { - // UpdateParams defines a governance operation for updating the parameters. - // - // Since: cosmos-sdk 0.47 - UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) - // AuthorizeService asserts the given controller is the owner of the given address. - AuthorizeService(ctx context.Context, in *MsgAuthorizeService, opts ...grpc.CallOption) (*MsgAuthorizeServiceResponse, error) // AllocateVault assembles a sqlite3 database in a local directory and returns the CID of the database. // this operation is called by services initiating a controller registration. AllocateVault(ctx context.Context, in *MsgAllocateVault, opts ...grpc.CallOption) (*MsgAllocateVaultResponse, error) + // AuthorizeService asserts the given controller is the owner of the given address. + AuthorizeService(ctx context.Context, in *MsgAuthorizeService, opts ...grpc.CallOption) (*MsgAuthorizeServiceResponse, error) + // ExecuteTx executes a transaction on the Sonr Blockchain. It leverages Macaroon for verification. + ExecuteTx(ctx context.Context, in *MsgExecuteTx, opts ...grpc.CallOption) (*MsgExecuteTxResponse, error) // RegisterController initializes a controller with the given authentication set, address, cid, publicKey, and user-defined alias. RegisterController(ctx context.Context, in *MsgRegisterController, opts ...grpc.CallOption) (*MsgRegisterControllerResponse, error) // RegisterService initializes a Service with a given permission scope and URI. The domain must have a valid TXT record containing the public key. RegisterService(ctx context.Context, in *MsgRegisterService, opts ...grpc.CallOption) (*MsgRegisterServiceResponse, error) + // UpdateParams defines a governance operation for updating the parameters. + UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) } type msgClient struct { @@ -751,9 +878,9 @@ func NewMsgClient(cc grpc1.ClientConn) MsgClient { return &msgClient{cc} } -func (c *msgClient) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) { - out := new(MsgUpdateParamsResponse) - err := c.cc.Invoke(ctx, "/did.v1.Msg/UpdateParams", in, out, opts...) +func (c *msgClient) AllocateVault(ctx context.Context, in *MsgAllocateVault, opts ...grpc.CallOption) (*MsgAllocateVaultResponse, error) { + out := new(MsgAllocateVaultResponse) + err := c.cc.Invoke(ctx, "/did.v1.Msg/AllocateVault", in, out, opts...) if err != nil { return nil, err } @@ -769,9 +896,9 @@ func (c *msgClient) AuthorizeService(ctx context.Context, in *MsgAuthorizeServic return out, nil } -func (c *msgClient) AllocateVault(ctx context.Context, in *MsgAllocateVault, opts ...grpc.CallOption) (*MsgAllocateVaultResponse, error) { - out := new(MsgAllocateVaultResponse) - err := c.cc.Invoke(ctx, "/did.v1.Msg/AllocateVault", in, out, opts...) +func (c *msgClient) ExecuteTx(ctx context.Context, in *MsgExecuteTx, opts ...grpc.CallOption) (*MsgExecuteTxResponse, error) { + out := new(MsgExecuteTxResponse) + err := c.cc.Invoke(ctx, "/did.v1.Msg/ExecuteTx", in, out, opts...) if err != nil { return nil, err } @@ -796,35 +923,44 @@ func (c *msgClient) RegisterService(ctx context.Context, in *MsgRegisterService, return out, nil } +func (c *msgClient) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) { + out := new(MsgUpdateParamsResponse) + err := c.cc.Invoke(ctx, "/did.v1.Msg/UpdateParams", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // MsgServer is the server API for Msg service. type MsgServer interface { - // UpdateParams defines a governance operation for updating the parameters. - // - // Since: cosmos-sdk 0.47 - UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) - // AuthorizeService asserts the given controller is the owner of the given address. - AuthorizeService(context.Context, *MsgAuthorizeService) (*MsgAuthorizeServiceResponse, error) // AllocateVault assembles a sqlite3 database in a local directory and returns the CID of the database. // this operation is called by services initiating a controller registration. AllocateVault(context.Context, *MsgAllocateVault) (*MsgAllocateVaultResponse, error) + // AuthorizeService asserts the given controller is the owner of the given address. + AuthorizeService(context.Context, *MsgAuthorizeService) (*MsgAuthorizeServiceResponse, error) + // ExecuteTx executes a transaction on the Sonr Blockchain. It leverages Macaroon for verification. + ExecuteTx(context.Context, *MsgExecuteTx) (*MsgExecuteTxResponse, error) // RegisterController initializes a controller with the given authentication set, address, cid, publicKey, and user-defined alias. RegisterController(context.Context, *MsgRegisterController) (*MsgRegisterControllerResponse, error) // RegisterService initializes a Service with a given permission scope and URI. The domain must have a valid TXT record containing the public key. RegisterService(context.Context, *MsgRegisterService) (*MsgRegisterServiceResponse, error) + // UpdateParams defines a governance operation for updating the parameters. + UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) } // UnimplementedMsgServer can be embedded to have forward compatible implementations. type UnimplementedMsgServer struct { } -func (*UnimplementedMsgServer) UpdateParams(ctx context.Context, req *MsgUpdateParams) (*MsgUpdateParamsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method UpdateParams not implemented") +func (*UnimplementedMsgServer) AllocateVault(ctx context.Context, req *MsgAllocateVault) (*MsgAllocateVaultResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method AllocateVault not implemented") } func (*UnimplementedMsgServer) AuthorizeService(ctx context.Context, req *MsgAuthorizeService) (*MsgAuthorizeServiceResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method AuthorizeService not implemented") } -func (*UnimplementedMsgServer) AllocateVault(ctx context.Context, req *MsgAllocateVault) (*MsgAllocateVaultResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method AllocateVault not implemented") +func (*UnimplementedMsgServer) ExecuteTx(ctx context.Context, req *MsgExecuteTx) (*MsgExecuteTxResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ExecuteTx not implemented") } func (*UnimplementedMsgServer) RegisterController(ctx context.Context, req *MsgRegisterController) (*MsgRegisterControllerResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method RegisterController not implemented") @@ -832,25 +968,28 @@ func (*UnimplementedMsgServer) RegisterController(ctx context.Context, req *MsgR func (*UnimplementedMsgServer) RegisterService(ctx context.Context, req *MsgRegisterService) (*MsgRegisterServiceResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method RegisterService not implemented") } +func (*UnimplementedMsgServer) UpdateParams(ctx context.Context, req *MsgUpdateParams) (*MsgUpdateParamsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateParams not implemented") +} func RegisterMsgServer(s grpc1.Server, srv MsgServer) { s.RegisterService(&_Msg_serviceDesc, srv) } -func _Msg_UpdateParams_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgUpdateParams) +func _Msg_AllocateVault_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgAllocateVault) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(MsgServer).UpdateParams(ctx, in) + return srv.(MsgServer).AllocateVault(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/did.v1.Msg/UpdateParams", + FullMethod: "/did.v1.Msg/AllocateVault", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).UpdateParams(ctx, req.(*MsgUpdateParams)) + return srv.(MsgServer).AllocateVault(ctx, req.(*MsgAllocateVault)) } return interceptor(ctx, in, info, handler) } @@ -873,20 +1012,20 @@ func _Msg_AuthorizeService_Handler(srv interface{}, ctx context.Context, dec fun return interceptor(ctx, in, info, handler) } -func _Msg_AllocateVault_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgAllocateVault) +func _Msg_ExecuteTx_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgExecuteTx) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(MsgServer).AllocateVault(ctx, in) + return srv.(MsgServer).ExecuteTx(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/did.v1.Msg/AllocateVault", + FullMethod: "/did.v1.Msg/ExecuteTx", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).AllocateVault(ctx, req.(*MsgAllocateVault)) + return srv.(MsgServer).ExecuteTx(ctx, req.(*MsgExecuteTx)) } return interceptor(ctx, in, info, handler) } @@ -927,21 +1066,39 @@ func _Msg_RegisterService_Handler(srv interface{}, ctx context.Context, dec func return interceptor(ctx, in, info, handler) } +func _Msg_UpdateParams_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgUpdateParams) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).UpdateParams(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/did.v1.Msg/UpdateParams", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).UpdateParams(ctx, req.(*MsgUpdateParams)) + } + return interceptor(ctx, in, info, handler) +} + var _Msg_serviceDesc = grpc.ServiceDesc{ ServiceName: "did.v1.Msg", HandlerType: (*MsgServer)(nil), Methods: []grpc.MethodDesc{ { - MethodName: "UpdateParams", - Handler: _Msg_UpdateParams_Handler, + MethodName: "AllocateVault", + Handler: _Msg_AllocateVault_Handler, }, { MethodName: "AuthorizeService", Handler: _Msg_AuthorizeService_Handler, }, { - MethodName: "AllocateVault", - Handler: _Msg_AllocateVault_Handler, + MethodName: "ExecuteTx", + Handler: _Msg_ExecuteTx_Handler, }, { MethodName: "RegisterController", @@ -951,6 +1108,10 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ MethodName: "RegisterService", Handler: _Msg_RegisterService_Handler, }, + { + MethodName: "UpdateParams", + Handler: _Msg_UpdateParams_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "did/v1/tx.proto", @@ -971,76 +1132,6 @@ func (m *MsgAllocateVault) MarshalTo(dAtA []byte) (int, error) { return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MsgUpdateParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Token) > 0 { - i -= len(m.Token) - copy(dAtA[i:], m.Token) - i = encodeVarintTx(dAtA, i, uint64(len(m.Token))) - i-- - dAtA[i] = 0x1a - } - { - size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - if len(m.Authority) > 0 { - i -= len(m.Authority) - copy(dAtA[i:], m.Authority) - i = encodeVarintTx(dAtA, i, uint64(len(m.Authority))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *MsgUpdateParamsResponse) 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 *MsgUpdateParamsResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgUpdateParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func (m *MsgAllocateVault) 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 *MsgAllocateVault) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - func (m *MsgAllocateVault) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i @@ -1238,6 +1329,104 @@ func (m *MsgRegisterControllerResponse) MarshalToSizedBuffer(dAtA []byte) (int, return len(dAtA) - i, nil } +func (m *MsgExecuteTx) 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 *MsgExecuteTx) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgExecuteTx) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.MacaroonToken) > 0 { + i -= len(m.MacaroonToken) + copy(dAtA[i:], m.MacaroonToken) + i = encodeVarintTx(dAtA, i, uint64(len(m.MacaroonToken))) + i-- + dAtA[i] = 0x1a + } + if len(m.Messages) > 0 { + for k := range m.Messages { + v := m.Messages[k] + baseI := i + if len(v) > 0 { + i -= len(v) + copy(dAtA[i:], v) + i = encodeVarintTx(dAtA, i, uint64(len(v))) + i-- + dAtA[i] = 0x12 + } + i -= len(k) + copy(dAtA[i:], k) + i = encodeVarintTx(dAtA, i, uint64(len(k))) + i-- + dAtA[i] = 0xa + i = encodeVarintTx(dAtA, i, uint64(baseI-i)) + i-- + dAtA[i] = 0x12 + } + } + if len(m.Controller) > 0 { + i -= len(m.Controller) + copy(dAtA[i:], m.Controller) + i = encodeVarintTx(dAtA, i, uint64(len(m.Controller))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgExecuteTxResponse) 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 *MsgExecuteTxResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgExecuteTxResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.TxHash) > 0 { + i -= len(m.TxHash) + copy(dAtA[i:], m.TxHash) + i = encodeVarintTx(dAtA, i, uint64(len(m.TxHash))) + i-- + dAtA[i] = 0x12 + } + if m.Success { + i-- + if m.Success { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + func (m *MsgAuthorizeService) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -1504,34 +1693,6 @@ func encodeVarintTx(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } -func (m *MsgAllocateVault) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Authority) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = m.Params.Size() - n += 1 + l + sovTx(uint64(l)) - l = len(m.Token) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - return n -} - -func (m *MsgUpdateParamsResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - func (m *MsgAllocateVault) Size() (n int) { if m == nil { return 0 @@ -1631,6 +1792,51 @@ func (m *MsgRegisterControllerResponse) Size() (n int) { return n } +func (m *MsgExecuteTx) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Controller) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if len(m.Messages) > 0 { + for k, v := range m.Messages { + _ = k + _ = v + l = 0 + if len(v) > 0 { + l = 1 + len(v) + sovTx(uint64(len(v))) + } + mapEntrySize := 1 + len(k) + sovTx(uint64(len(k))) + l + n += mapEntrySize + 1 + sovTx(uint64(mapEntrySize)) + } + } + l = len(m.MacaroonToken) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgExecuteTxResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Success { + n += 2 + } + l = len(m.TxHash) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + func (m *MsgAuthorizeService) Size() (n int) { if m == nil { return 0 @@ -1709,209 +1915,40 @@ func (m *MsgRegisterServiceResponse) Size() (n int) { return n } +func (m *MsgUpdateParams) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Authority) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = m.Params.Size() + n += 1 + l + sovTx(uint64(l)) + l = len(m.Token) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgUpdateParamsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + func sovTx(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } func sozTx(x uint64) (n int) { return sovTx(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } -func (m *MsgAllocateVault) 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 ErrIntOverflowTx - } - 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: MsgAllocateVault: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgAllocateVault: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - 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 ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Authority = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Token", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - 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 ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Token = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgUpdateParamsResponse) 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 ErrIntOverflowTx - } - 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: MsgUpdateParamsResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgUpdateParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} func (m *MsgAllocateVault) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -2618,6 +2655,350 @@ func (m *MsgRegisterControllerResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *MsgExecuteTx) 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 ErrIntOverflowTx + } + 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: MsgExecuteTx: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgExecuteTx: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + 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 ErrIntOverflowTx + } + 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 ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Controller = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Messages", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Messages == nil { + m.Messages = make(map[string][]byte) + } + var mapkey string + mapvalue := []byte{} + for iNdEx < postIndex { + entryPreIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + if fieldNum == 1 { + var stringLenmapkey uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLenmapkey |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLenmapkey := int(stringLenmapkey) + if intStringLenmapkey < 0 { + return ErrInvalidLengthTx + } + postStringIndexmapkey := iNdEx + intStringLenmapkey + if postStringIndexmapkey < 0 { + return ErrInvalidLengthTx + } + if postStringIndexmapkey > l { + return io.ErrUnexpectedEOF + } + mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) + iNdEx = postStringIndexmapkey + } else if fieldNum == 2 { + var mapbyteLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + mapbyteLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intMapbyteLen := int(mapbyteLen) + if intMapbyteLen < 0 { + return ErrInvalidLengthTx + } + postbytesIndex := iNdEx + intMapbyteLen + if postbytesIndex < 0 { + return ErrInvalidLengthTx + } + if postbytesIndex > l { + return io.ErrUnexpectedEOF + } + mapvalue = make([]byte, mapbyteLen) + copy(mapvalue, dAtA[iNdEx:postbytesIndex]) + iNdEx = postbytesIndex + } else { + iNdEx = entryPreIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > postIndex { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + m.Messages[mapkey] = mapvalue + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MacaroonToken", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + 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 ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.MacaroonToken = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgExecuteTxResponse) 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 ErrIntOverflowTx + } + 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: MsgExecuteTxResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgExecuteTxResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Success", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Success = bool(v != 0) + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TxHash", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + 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 ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.TxHash = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func (m *MsgAuthorizeService) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -3213,6 +3594,203 @@ func (m *MsgRegisterServiceResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *MsgUpdateParams) 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 ErrIntOverflowTx + } + 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: MsgUpdateParams: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateParams: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + 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 ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Authority = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Token", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + 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 ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Token = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgUpdateParamsResponse) 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 ErrIntOverflowTx + } + 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: MsgUpdateParamsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipTx(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/did/types/txns/Msg.pkl.go b/x/did/types/txns/Msg.pkl.go deleted file mode 100644 index 316adf06d..000000000 --- a/x/did/types/txns/Msg.pkl.go +++ /dev/null @@ -1,6 +0,0 @@ -// Code generated from Pkl module `txns`. DO NOT EDIT. -package txns - -type Msg interface { - GetTypeUrl() string -} diff --git a/x/did/types/txns/MsgDidAllocateVault.pkl.go b/x/did/types/txns/MsgDidAllocateVault.pkl.go deleted file mode 100644 index dcb4a04e4..000000000 --- a/x/did/types/txns/MsgDidAllocateVault.pkl.go +++ /dev/null @@ -1,44 +0,0 @@ -// Code generated from Pkl module `txns`. DO NOT EDIT. -package txns - -import "github.com/apple/pkl-go/pkl" - -type MsgDidAllocateVault interface { - Msg - - GetAuthority() string - - GetSubject() string - - GetToken() *pkl.Object -} - -var _ MsgDidAllocateVault = (*MsgDidAllocateVaultImpl)(nil) - -type MsgDidAllocateVaultImpl struct { - // The type URL for the message - TypeUrl string `pkl:"typeUrl"` - - Authority string `pkl:"authority"` - - Subject string `pkl:"subject"` - - Token *pkl.Object `pkl:"token"` -} - -// The type URL for the message -func (rcv *MsgDidAllocateVaultImpl) GetTypeUrl() string { - return rcv.TypeUrl -} - -func (rcv *MsgDidAllocateVaultImpl) GetAuthority() string { - return rcv.Authority -} - -func (rcv *MsgDidAllocateVaultImpl) GetSubject() string { - return rcv.Subject -} - -func (rcv *MsgDidAllocateVaultImpl) GetToken() *pkl.Object { - return rcv.Token -} diff --git a/x/did/types/txns/MsgDidAuthorize.pkl.go b/x/did/types/txns/MsgDidAuthorize.pkl.go deleted file mode 100644 index 344bbe81a..000000000 --- a/x/did/types/txns/MsgDidAuthorize.pkl.go +++ /dev/null @@ -1,60 +0,0 @@ -// Code generated from Pkl module `txns`. DO NOT EDIT. -package txns - -import "github.com/apple/pkl-go/pkl" - -type MsgDidAuthorize interface { - Msg - - GetAuthority() string - - GetController() string - - GetAddress() string - - GetOrigin() string - - GetToken() *pkl.Object -} - -var _ MsgDidAuthorize = (*MsgDidAuthorizeImpl)(nil) - -type MsgDidAuthorizeImpl struct { - // The type URL for the message - TypeUrl string `pkl:"typeUrl"` - - Authority string `pkl:"authority"` - - Controller string `pkl:"controller"` - - Address string `pkl:"address"` - - Origin string `pkl:"origin"` - - Token *pkl.Object `pkl:"token"` -} - -// The type URL for the message -func (rcv *MsgDidAuthorizeImpl) GetTypeUrl() string { - return rcv.TypeUrl -} - -func (rcv *MsgDidAuthorizeImpl) GetAuthority() string { - return rcv.Authority -} - -func (rcv *MsgDidAuthorizeImpl) GetController() string { - return rcv.Controller -} - -func (rcv *MsgDidAuthorizeImpl) GetAddress() string { - return rcv.Address -} - -func (rcv *MsgDidAuthorizeImpl) GetOrigin() string { - return rcv.Origin -} - -func (rcv *MsgDidAuthorizeImpl) GetToken() *pkl.Object { - return rcv.Token -} diff --git a/x/did/types/txns/MsgDidProveWitness.pkl.go b/x/did/types/txns/MsgDidProveWitness.pkl.go deleted file mode 100644 index 6ea127769..000000000 --- a/x/did/types/txns/MsgDidProveWitness.pkl.go +++ /dev/null @@ -1,52 +0,0 @@ -// Code generated from Pkl module `txns`. DO NOT EDIT. -package txns - -import "github.com/apple/pkl-go/pkl" - -type MsgDidProveWitness interface { - Msg - - GetAuthority() string - - GetProperty() string - - GetWitness() []int - - GetToken() *pkl.Object -} - -var _ MsgDidProveWitness = (*MsgDidProveWitnessImpl)(nil) - -type MsgDidProveWitnessImpl struct { - // The type URL for the message - TypeUrl string `pkl:"typeUrl"` - - Authority string `pkl:"authority"` - - Property string `pkl:"property"` - - Witness []int `pkl:"witness"` - - Token *pkl.Object `pkl:"token"` -} - -// The type URL for the message -func (rcv *MsgDidProveWitnessImpl) GetTypeUrl() string { - return rcv.TypeUrl -} - -func (rcv *MsgDidProveWitnessImpl) GetAuthority() string { - return rcv.Authority -} - -func (rcv *MsgDidProveWitnessImpl) GetProperty() string { - return rcv.Property -} - -func (rcv *MsgDidProveWitnessImpl) GetWitness() []int { - return rcv.Witness -} - -func (rcv *MsgDidProveWitnessImpl) GetToken() *pkl.Object { - return rcv.Token -} diff --git a/x/did/types/txns/MsgDidRegisterController.pkl.go b/x/did/types/txns/MsgDidRegisterController.pkl.go deleted file mode 100644 index dc6d3651b..000000000 --- a/x/did/types/txns/MsgDidRegisterController.pkl.go +++ /dev/null @@ -1,60 +0,0 @@ -// Code generated from Pkl module `txns`. DO NOT EDIT. -package txns - -import "github.com/apple/pkl-go/pkl" - -type MsgDidRegisterController interface { - Msg - - GetAuthority() string - - GetCid() string - - GetOrigin() string - - GetAuthentication() []*pkl.Object - - GetToken() *pkl.Object -} - -var _ MsgDidRegisterController = (*MsgDidRegisterControllerImpl)(nil) - -type MsgDidRegisterControllerImpl struct { - // The type URL for the message - TypeUrl string `pkl:"typeUrl"` - - Authority string `pkl:"authority"` - - Cid string `pkl:"cid"` - - Origin string `pkl:"origin"` - - Authentication []*pkl.Object `pkl:"authentication"` - - Token *pkl.Object `pkl:"token"` -} - -// The type URL for the message -func (rcv *MsgDidRegisterControllerImpl) GetTypeUrl() string { - return rcv.TypeUrl -} - -func (rcv *MsgDidRegisterControllerImpl) GetAuthority() string { - return rcv.Authority -} - -func (rcv *MsgDidRegisterControllerImpl) GetCid() string { - return rcv.Cid -} - -func (rcv *MsgDidRegisterControllerImpl) GetOrigin() string { - return rcv.Origin -} - -func (rcv *MsgDidRegisterControllerImpl) GetAuthentication() []*pkl.Object { - return rcv.Authentication -} - -func (rcv *MsgDidRegisterControllerImpl) GetToken() *pkl.Object { - return rcv.Token -} diff --git a/x/did/types/txns/MsgDidRegisterService.pkl.go b/x/did/types/txns/MsgDidRegisterService.pkl.go deleted file mode 100644 index 3d2f849a5..000000000 --- a/x/did/types/txns/MsgDidRegisterService.pkl.go +++ /dev/null @@ -1,76 +0,0 @@ -// Code generated from Pkl module `txns`. DO NOT EDIT. -package txns - -import "github.com/apple/pkl-go/pkl" - -type MsgDidRegisterService interface { - Msg - - GetController() string - - GetOriginUri() string - - GetScopes() *pkl.Object - - GetDescription() string - - GetServiceEndpoints() map[string]string - - GetMetadata() *pkl.Object - - GetToken() *pkl.Object -} - -var _ MsgDidRegisterService = (*MsgDidRegisterServiceImpl)(nil) - -type MsgDidRegisterServiceImpl struct { - // The type URL for the message - TypeUrl string `pkl:"typeUrl"` - - Controller string `pkl:"controller"` - - OriginUri string `pkl:"originUri"` - - Scopes *pkl.Object `pkl:"scopes"` - - Description string `pkl:"description"` - - ServiceEndpoints map[string]string `pkl:"serviceEndpoints"` - - Metadata *pkl.Object `pkl:"metadata"` - - Token *pkl.Object `pkl:"token"` -} - -// The type URL for the message -func (rcv *MsgDidRegisterServiceImpl) GetTypeUrl() string { - return rcv.TypeUrl -} - -func (rcv *MsgDidRegisterServiceImpl) GetController() string { - return rcv.Controller -} - -func (rcv *MsgDidRegisterServiceImpl) GetOriginUri() string { - return rcv.OriginUri -} - -func (rcv *MsgDidRegisterServiceImpl) GetScopes() *pkl.Object { - return rcv.Scopes -} - -func (rcv *MsgDidRegisterServiceImpl) GetDescription() string { - return rcv.Description -} - -func (rcv *MsgDidRegisterServiceImpl) GetServiceEndpoints() map[string]string { - return rcv.ServiceEndpoints -} - -func (rcv *MsgDidRegisterServiceImpl) GetMetadata() *pkl.Object { - return rcv.Metadata -} - -func (rcv *MsgDidRegisterServiceImpl) GetToken() *pkl.Object { - return rcv.Token -} diff --git a/x/did/types/txns/MsgDidSyncVault.pkl.go b/x/did/types/txns/MsgDidSyncVault.pkl.go deleted file mode 100644 index c7f38de0a..000000000 --- a/x/did/types/txns/MsgDidSyncVault.pkl.go +++ /dev/null @@ -1,36 +0,0 @@ -// Code generated from Pkl module `txns`. DO NOT EDIT. -package txns - -import "github.com/apple/pkl-go/pkl" - -type MsgDidSyncVault interface { - Msg - - GetController() string - - GetToken() *pkl.Object -} - -var _ MsgDidSyncVault = (*MsgDidSyncVaultImpl)(nil) - -type MsgDidSyncVaultImpl struct { - // The type URL for the message - TypeUrl string `pkl:"typeUrl"` - - Controller string `pkl:"controller"` - - Token *pkl.Object `pkl:"token"` -} - -// The type URL for the message -func (rcv *MsgDidSyncVaultImpl) GetTypeUrl() string { - return rcv.TypeUrl -} - -func (rcv *MsgDidSyncVaultImpl) GetController() string { - return rcv.Controller -} - -func (rcv *MsgDidSyncVaultImpl) GetToken() *pkl.Object { - return rcv.Token -} diff --git a/x/did/types/txns/MsgDidUpdateParams.pkl.go b/x/did/types/txns/MsgDidUpdateParams.pkl.go deleted file mode 100644 index 566383b4f..000000000 --- a/x/did/types/txns/MsgDidUpdateParams.pkl.go +++ /dev/null @@ -1,44 +0,0 @@ -// Code generated from Pkl module `txns`. DO NOT EDIT. -package txns - -import "github.com/apple/pkl-go/pkl" - -type MsgDidUpdateParams interface { - Msg - - GetAuthority() string - - GetParams() *pkl.Object - - GetToken() *pkl.Object -} - -var _ MsgDidUpdateParams = (*MsgDidUpdateParamsImpl)(nil) - -type MsgDidUpdateParamsImpl struct { - // The type URL for the message - TypeUrl string `pkl:"typeUrl"` - - Authority string `pkl:"authority"` - - Params *pkl.Object `pkl:"params"` - - Token *pkl.Object `pkl:"token"` -} - -// The type URL for the message -func (rcv *MsgDidUpdateParamsImpl) GetTypeUrl() string { - return rcv.TypeUrl -} - -func (rcv *MsgDidUpdateParamsImpl) GetAuthority() string { - return rcv.Authority -} - -func (rcv *MsgDidUpdateParamsImpl) GetParams() *pkl.Object { - return rcv.Params -} - -func (rcv *MsgDidUpdateParamsImpl) GetToken() *pkl.Object { - return rcv.Token -} diff --git a/x/did/types/txns/MsgGovDeposit.pkl.go b/x/did/types/txns/MsgGovDeposit.pkl.go deleted file mode 100644 index 237e1ff46..000000000 --- a/x/did/types/txns/MsgGovDeposit.pkl.go +++ /dev/null @@ -1,44 +0,0 @@ -// Code generated from Pkl module `txns`. DO NOT EDIT. -package txns - -import "github.com/apple/pkl-go/pkl" - -type MsgGovDeposit interface { - Msg - - GetProposalId() int - - GetDepositor() string - - GetAmount() []*pkl.Object -} - -var _ MsgGovDeposit = (*MsgGovDepositImpl)(nil) - -type MsgGovDepositImpl struct { - // The type URL for the message - TypeUrl string `pkl:"typeUrl"` - - ProposalId int `pkl:"proposalId"` - - Depositor string `pkl:"depositor"` - - Amount []*pkl.Object `pkl:"amount"` -} - -// The type URL for the message -func (rcv *MsgGovDepositImpl) GetTypeUrl() string { - return rcv.TypeUrl -} - -func (rcv *MsgGovDepositImpl) GetProposalId() int { - return rcv.ProposalId -} - -func (rcv *MsgGovDepositImpl) GetDepositor() string { - return rcv.Depositor -} - -func (rcv *MsgGovDepositImpl) GetAmount() []*pkl.Object { - return rcv.Amount -} diff --git a/x/did/types/txns/MsgGovSubmitProposal.pkl.go b/x/did/types/txns/MsgGovSubmitProposal.pkl.go deleted file mode 100644 index 8c7f744fb..000000000 --- a/x/did/types/txns/MsgGovSubmitProposal.pkl.go +++ /dev/null @@ -1,45 +0,0 @@ -// Code generated from Pkl module `txns`. DO NOT EDIT. -package txns - -import "github.com/apple/pkl-go/pkl" - -type MsgGovSubmitProposal interface { - Msg - - GetContent() *Proposal - - GetInitialDeposit() []*pkl.Object - - GetProposer() string -} - -var _ MsgGovSubmitProposal = (*MsgGovSubmitProposalImpl)(nil) - -// Gov module messages -type MsgGovSubmitProposalImpl struct { - // The type URL for the message - TypeUrl string `pkl:"typeUrl"` - - Content *Proposal `pkl:"content"` - - InitialDeposit []*pkl.Object `pkl:"initialDeposit"` - - Proposer string `pkl:"proposer"` -} - -// The type URL for the message -func (rcv *MsgGovSubmitProposalImpl) GetTypeUrl() string { - return rcv.TypeUrl -} - -func (rcv *MsgGovSubmitProposalImpl) GetContent() *Proposal { - return rcv.Content -} - -func (rcv *MsgGovSubmitProposalImpl) GetInitialDeposit() []*pkl.Object { - return rcv.InitialDeposit -} - -func (rcv *MsgGovSubmitProposalImpl) GetProposer() string { - return rcv.Proposer -} diff --git a/x/did/types/txns/MsgGovVote.pkl.go b/x/did/types/txns/MsgGovVote.pkl.go deleted file mode 100644 index 73ff547b2..000000000 --- a/x/did/types/txns/MsgGovVote.pkl.go +++ /dev/null @@ -1,42 +0,0 @@ -// Code generated from Pkl module `txns`. DO NOT EDIT. -package txns - -type MsgGovVote interface { - Msg - - GetProposalId() int - - GetVoter() string - - GetOption() int -} - -var _ MsgGovVote = (*MsgGovVoteImpl)(nil) - -type MsgGovVoteImpl struct { - // The type URL for the message - TypeUrl string `pkl:"typeUrl"` - - ProposalId int `pkl:"proposalId"` - - Voter string `pkl:"voter"` - - Option int `pkl:"option"` -} - -// The type URL for the message -func (rcv *MsgGovVoteImpl) GetTypeUrl() string { - return rcv.TypeUrl -} - -func (rcv *MsgGovVoteImpl) GetProposalId() int { - return rcv.ProposalId -} - -func (rcv *MsgGovVoteImpl) GetVoter() string { - return rcv.Voter -} - -func (rcv *MsgGovVoteImpl) GetOption() int { - return rcv.Option -} diff --git a/x/did/types/txns/MsgGroupCreateGroup.pkl.go b/x/did/types/txns/MsgGroupCreateGroup.pkl.go deleted file mode 100644 index 19fd7173e..000000000 --- a/x/did/types/txns/MsgGroupCreateGroup.pkl.go +++ /dev/null @@ -1,45 +0,0 @@ -// Code generated from Pkl module `txns`. DO NOT EDIT. -package txns - -import "github.com/apple/pkl-go/pkl" - -type MsgGroupCreateGroup interface { - Msg - - GetAdmin() string - - GetMembers() []*pkl.Object - - GetMetadata() string -} - -var _ MsgGroupCreateGroup = (*MsgGroupCreateGroupImpl)(nil) - -// Group module messages -type MsgGroupCreateGroupImpl struct { - // The type URL for the message - TypeUrl string `pkl:"typeUrl"` - - Admin string `pkl:"admin"` - - Members []*pkl.Object `pkl:"members"` - - Metadata string `pkl:"metadata"` -} - -// The type URL for the message -func (rcv *MsgGroupCreateGroupImpl) GetTypeUrl() string { - return rcv.TypeUrl -} - -func (rcv *MsgGroupCreateGroupImpl) GetAdmin() string { - return rcv.Admin -} - -func (rcv *MsgGroupCreateGroupImpl) GetMembers() []*pkl.Object { - return rcv.Members -} - -func (rcv *MsgGroupCreateGroupImpl) GetMetadata() string { - return rcv.Metadata -} diff --git a/x/did/types/txns/MsgGroupSubmitProposal.pkl.go b/x/did/types/txns/MsgGroupSubmitProposal.pkl.go deleted file mode 100644 index 2cb9f0729..000000000 --- a/x/did/types/txns/MsgGroupSubmitProposal.pkl.go +++ /dev/null @@ -1,60 +0,0 @@ -// Code generated from Pkl module `txns`. DO NOT EDIT. -package txns - -import "github.com/apple/pkl-go/pkl" - -type MsgGroupSubmitProposal interface { - Msg - - GetGroupPolicyAddress() string - - GetProposers() []string - - GetMetadata() string - - GetMessages() []*pkl.Object - - GetExec() int -} - -var _ MsgGroupSubmitProposal = (*MsgGroupSubmitProposalImpl)(nil) - -type MsgGroupSubmitProposalImpl struct { - // The type URL for the message - TypeUrl string `pkl:"typeUrl"` - - GroupPolicyAddress string `pkl:"groupPolicyAddress"` - - Proposers []string `pkl:"proposers"` - - Metadata string `pkl:"metadata"` - - Messages []*pkl.Object `pkl:"messages"` - - Exec int `pkl:"exec"` -} - -// The type URL for the message -func (rcv *MsgGroupSubmitProposalImpl) GetTypeUrl() string { - return rcv.TypeUrl -} - -func (rcv *MsgGroupSubmitProposalImpl) GetGroupPolicyAddress() string { - return rcv.GroupPolicyAddress -} - -func (rcv *MsgGroupSubmitProposalImpl) GetProposers() []string { - return rcv.Proposers -} - -func (rcv *MsgGroupSubmitProposalImpl) GetMetadata() string { - return rcv.Metadata -} - -func (rcv *MsgGroupSubmitProposalImpl) GetMessages() []*pkl.Object { - return rcv.Messages -} - -func (rcv *MsgGroupSubmitProposalImpl) GetExec() int { - return rcv.Exec -} diff --git a/x/did/types/txns/MsgGroupVote.pkl.go b/x/did/types/txns/MsgGroupVote.pkl.go deleted file mode 100644 index 79ae04244..000000000 --- a/x/did/types/txns/MsgGroupVote.pkl.go +++ /dev/null @@ -1,58 +0,0 @@ -// Code generated from Pkl module `txns`. DO NOT EDIT. -package txns - -type MsgGroupVote interface { - Msg - - GetProposalId() int - - GetVoter() string - - GetOption() int - - GetMetadata() string - - GetExec() int -} - -var _ MsgGroupVote = (*MsgGroupVoteImpl)(nil) - -type MsgGroupVoteImpl struct { - // The type URL for the message - TypeUrl string `pkl:"typeUrl"` - - ProposalId int `pkl:"proposalId"` - - Voter string `pkl:"voter"` - - Option int `pkl:"option"` - - Metadata string `pkl:"metadata"` - - Exec int `pkl:"exec"` -} - -// The type URL for the message -func (rcv *MsgGroupVoteImpl) GetTypeUrl() string { - return rcv.TypeUrl -} - -func (rcv *MsgGroupVoteImpl) GetProposalId() int { - return rcv.ProposalId -} - -func (rcv *MsgGroupVoteImpl) GetVoter() string { - return rcv.Voter -} - -func (rcv *MsgGroupVoteImpl) GetOption() int { - return rcv.Option -} - -func (rcv *MsgGroupVoteImpl) GetMetadata() string { - return rcv.Metadata -} - -func (rcv *MsgGroupVoteImpl) GetExec() int { - return rcv.Exec -} diff --git a/x/did/types/txns/MsgStakingBeginRedelegate.pkl.go b/x/did/types/txns/MsgStakingBeginRedelegate.pkl.go deleted file mode 100644 index fe803db38..000000000 --- a/x/did/types/txns/MsgStakingBeginRedelegate.pkl.go +++ /dev/null @@ -1,52 +0,0 @@ -// Code generated from Pkl module `txns`. DO NOT EDIT. -package txns - -import "github.com/apple/pkl-go/pkl" - -type MsgStakingBeginRedelegate interface { - Msg - - GetDelegatorAddress() string - - GetValidatorSrcAddress() string - - GetValidatorDstAddress() string - - GetAmount() *pkl.Object -} - -var _ MsgStakingBeginRedelegate = (*MsgStakingBeginRedelegateImpl)(nil) - -type MsgStakingBeginRedelegateImpl struct { - // The type URL for the message - TypeUrl string `pkl:"typeUrl"` - - DelegatorAddress string `pkl:"delegatorAddress"` - - ValidatorSrcAddress string `pkl:"validatorSrcAddress"` - - ValidatorDstAddress string `pkl:"validatorDstAddress"` - - Amount *pkl.Object `pkl:"amount"` -} - -// The type URL for the message -func (rcv *MsgStakingBeginRedelegateImpl) GetTypeUrl() string { - return rcv.TypeUrl -} - -func (rcv *MsgStakingBeginRedelegateImpl) GetDelegatorAddress() string { - return rcv.DelegatorAddress -} - -func (rcv *MsgStakingBeginRedelegateImpl) GetValidatorSrcAddress() string { - return rcv.ValidatorSrcAddress -} - -func (rcv *MsgStakingBeginRedelegateImpl) GetValidatorDstAddress() string { - return rcv.ValidatorDstAddress -} - -func (rcv *MsgStakingBeginRedelegateImpl) GetAmount() *pkl.Object { - return rcv.Amount -} diff --git a/x/did/types/txns/MsgStakingCreateValidator.pkl.go b/x/did/types/txns/MsgStakingCreateValidator.pkl.go deleted file mode 100644 index d3c11015c..000000000 --- a/x/did/types/txns/MsgStakingCreateValidator.pkl.go +++ /dev/null @@ -1,77 +0,0 @@ -// Code generated from Pkl module `txns`. DO NOT EDIT. -package txns - -import "github.com/apple/pkl-go/pkl" - -type MsgStakingCreateValidator interface { - Msg - - GetDescription() *pkl.Object - - GetCommission() *pkl.Object - - GetMinSelfDelegation() string - - GetDelegatorAddress() string - - GetValidatorAddress() string - - GetPubkey() *pkl.Object - - GetValue() *pkl.Object -} - -var _ MsgStakingCreateValidator = (*MsgStakingCreateValidatorImpl)(nil) - -// Staking module messages -type MsgStakingCreateValidatorImpl struct { - // The type URL for the message - TypeUrl string `pkl:"typeUrl"` - - Description *pkl.Object `pkl:"description"` - - Commission *pkl.Object `pkl:"commission"` - - MinSelfDelegation string `pkl:"minSelfDelegation"` - - DelegatorAddress string `pkl:"delegatorAddress"` - - ValidatorAddress string `pkl:"validatorAddress"` - - Pubkey *pkl.Object `pkl:"pubkey"` - - Value *pkl.Object `pkl:"value"` -} - -// The type URL for the message -func (rcv *MsgStakingCreateValidatorImpl) GetTypeUrl() string { - return rcv.TypeUrl -} - -func (rcv *MsgStakingCreateValidatorImpl) GetDescription() *pkl.Object { - return rcv.Description -} - -func (rcv *MsgStakingCreateValidatorImpl) GetCommission() *pkl.Object { - return rcv.Commission -} - -func (rcv *MsgStakingCreateValidatorImpl) GetMinSelfDelegation() string { - return rcv.MinSelfDelegation -} - -func (rcv *MsgStakingCreateValidatorImpl) GetDelegatorAddress() string { - return rcv.DelegatorAddress -} - -func (rcv *MsgStakingCreateValidatorImpl) GetValidatorAddress() string { - return rcv.ValidatorAddress -} - -func (rcv *MsgStakingCreateValidatorImpl) GetPubkey() *pkl.Object { - return rcv.Pubkey -} - -func (rcv *MsgStakingCreateValidatorImpl) GetValue() *pkl.Object { - return rcv.Value -} diff --git a/x/did/types/txns/MsgStakingDelegate.pkl.go b/x/did/types/txns/MsgStakingDelegate.pkl.go deleted file mode 100644 index b6fb170ec..000000000 --- a/x/did/types/txns/MsgStakingDelegate.pkl.go +++ /dev/null @@ -1,44 +0,0 @@ -// Code generated from Pkl module `txns`. DO NOT EDIT. -package txns - -import "github.com/apple/pkl-go/pkl" - -type MsgStakingDelegate interface { - Msg - - GetDelegatorAddress() string - - GetValidatorAddress() string - - GetAmount() *pkl.Object -} - -var _ MsgStakingDelegate = (*MsgStakingDelegateImpl)(nil) - -type MsgStakingDelegateImpl struct { - // The type URL for the message - TypeUrl string `pkl:"typeUrl"` - - DelegatorAddress string `pkl:"delegatorAddress"` - - ValidatorAddress string `pkl:"validatorAddress"` - - Amount *pkl.Object `pkl:"amount"` -} - -// The type URL for the message -func (rcv *MsgStakingDelegateImpl) GetTypeUrl() string { - return rcv.TypeUrl -} - -func (rcv *MsgStakingDelegateImpl) GetDelegatorAddress() string { - return rcv.DelegatorAddress -} - -func (rcv *MsgStakingDelegateImpl) GetValidatorAddress() string { - return rcv.ValidatorAddress -} - -func (rcv *MsgStakingDelegateImpl) GetAmount() *pkl.Object { - return rcv.Amount -} diff --git a/x/did/types/txns/MsgStakingUndelegate.pkl.go b/x/did/types/txns/MsgStakingUndelegate.pkl.go deleted file mode 100644 index c1732c2c2..000000000 --- a/x/did/types/txns/MsgStakingUndelegate.pkl.go +++ /dev/null @@ -1,44 +0,0 @@ -// Code generated from Pkl module `txns`. DO NOT EDIT. -package txns - -import "github.com/apple/pkl-go/pkl" - -type MsgStakingUndelegate interface { - Msg - - GetDelegatorAddress() string - - GetValidatorAddress() string - - GetAmount() *pkl.Object -} - -var _ MsgStakingUndelegate = (*MsgStakingUndelegateImpl)(nil) - -type MsgStakingUndelegateImpl struct { - // The type URL for the message - TypeUrl string `pkl:"typeUrl"` - - DelegatorAddress string `pkl:"delegatorAddress"` - - ValidatorAddress string `pkl:"validatorAddress"` - - Amount *pkl.Object `pkl:"amount"` -} - -// The type URL for the message -func (rcv *MsgStakingUndelegateImpl) GetTypeUrl() string { - return rcv.TypeUrl -} - -func (rcv *MsgStakingUndelegateImpl) GetDelegatorAddress() string { - return rcv.DelegatorAddress -} - -func (rcv *MsgStakingUndelegateImpl) GetValidatorAddress() string { - return rcv.ValidatorAddress -} - -func (rcv *MsgStakingUndelegateImpl) GetAmount() *pkl.Object { - return rcv.Amount -} diff --git a/x/did/types/txns/Proposal.pkl.go b/x/did/types/txns/Proposal.pkl.go deleted file mode 100644 index 70463d42f..000000000 --- a/x/did/types/txns/Proposal.pkl.go +++ /dev/null @@ -1,11 +0,0 @@ -// Code generated from Pkl module `txns`. DO NOT EDIT. -package txns - -// Base class for all proposals -type Proposal struct { - // The title of the proposal - Title string `pkl:"title"` - - // The description of the proposal - Description string `pkl:"description"` -} diff --git a/x/did/types/txns/TxBody.pkl.go b/x/did/types/txns/TxBody.pkl.go deleted file mode 100644 index 407ba4179..000000000 --- a/x/did/types/txns/TxBody.pkl.go +++ /dev/null @@ -1,17 +0,0 @@ -// Code generated from Pkl module `txns`. DO NOT EDIT. -package txns - -import "github.com/apple/pkl-go/pkl" - -// Represents a transaction body -type TxBody struct { - Messages []Msg `pkl:"messages"` - - Memo *string `pkl:"memo"` - - TimeoutHeight *int `pkl:"timeoutHeight"` - - ExtensionOptions *[]*pkl.Object `pkl:"extensionOptions"` - - NonCriticalExtensionOptions *[]*pkl.Object `pkl:"nonCriticalExtensionOptions"` -} diff --git a/x/did/types/txns/Txns.pkl.go b/x/did/types/txns/Txns.pkl.go deleted file mode 100644 index 288c5c5bc..000000000 --- a/x/did/types/txns/Txns.pkl.go +++ /dev/null @@ -1,36 +0,0 @@ -// Code generated from Pkl module `txns`. DO NOT EDIT. -package txns - -import ( - "context" - - "github.com/apple/pkl-go/pkl" -) - -type Txns struct { -} - -// LoadFromPath loads the pkl module at the given path and evaluates it into a Txns -func LoadFromPath(ctx context.Context, path string) (ret *Txns, err error) { - evaluator, err := pkl.NewEvaluator(ctx, pkl.PreconfiguredOptions) - if err != nil { - return nil, err - } - defer func() { - cerr := evaluator.Close() - if err == nil { - err = cerr - } - }() - ret, err = Load(ctx, evaluator, pkl.FileSource(path)) - return ret, err -} - -// Load loads the pkl module at the given source and evaluates it with the given evaluator into a Txns -func Load(ctx context.Context, evaluator pkl.Evaluator, source *pkl.ModuleSource) (*Txns, error) { - var ret Txns - if err := evaluator.EvaluateModule(ctx, source, &ret); err != nil { - return nil, err - } - return &ret, nil -} diff --git a/x/did/types/txns/init.pkl.go b/x/did/types/txns/init.pkl.go deleted file mode 100644 index d92d7649e..000000000 --- a/x/did/types/txns/init.pkl.go +++ /dev/null @@ -1,27 +0,0 @@ -// Code generated from Pkl module `txns`. DO NOT EDIT. -package txns - -import "github.com/apple/pkl-go/pkl" - -func init() { - pkl.RegisterMapping("txns", Txns{}) - pkl.RegisterMapping("txns#Proposal", Proposal{}) - pkl.RegisterMapping("txns#MsgGovSubmitProposal", MsgGovSubmitProposalImpl{}) - pkl.RegisterMapping("txns#MsgGovVote", MsgGovVoteImpl{}) - pkl.RegisterMapping("txns#MsgGovDeposit", MsgGovDepositImpl{}) - pkl.RegisterMapping("txns#MsgGroupCreateGroup", MsgGroupCreateGroupImpl{}) - pkl.RegisterMapping("txns#MsgGroupSubmitProposal", MsgGroupSubmitProposalImpl{}) - pkl.RegisterMapping("txns#MsgGroupVote", MsgGroupVoteImpl{}) - pkl.RegisterMapping("txns#MsgStakingCreateValidator", MsgStakingCreateValidatorImpl{}) - pkl.RegisterMapping("txns#MsgStakingDelegate", MsgStakingDelegateImpl{}) - pkl.RegisterMapping("txns#MsgStakingUndelegate", MsgStakingUndelegateImpl{}) - pkl.RegisterMapping("txns#MsgStakingBeginRedelegate", MsgStakingBeginRedelegateImpl{}) - pkl.RegisterMapping("txns#MsgDidUpdateParams", MsgDidUpdateParamsImpl{}) - pkl.RegisterMapping("txns#MsgDidAllocateVault", MsgDidAllocateVaultImpl{}) - pkl.RegisterMapping("txns#MsgDidProveWitness", MsgDidProveWitnessImpl{}) - pkl.RegisterMapping("txns#MsgDidSyncVault", MsgDidSyncVaultImpl{}) - pkl.RegisterMapping("txns#MsgDidRegisterController", MsgDidRegisterControllerImpl{}) - pkl.RegisterMapping("txns#MsgDidAuthorize", MsgDidAuthorizeImpl{}) - pkl.RegisterMapping("txns#MsgDidRegisterService", MsgDidRegisterServiceImpl{}) - pkl.RegisterMapping("txns#TxBody", TxBody{}) -} diff --git a/x/did/types/zkprop.go b/x/did/types/zkprop.go deleted file mode 100644 index 2674cd60b..000000000 --- a/x/did/types/zkprop.go +++ /dev/null @@ -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 -}