diff --git a/docs/proto/provider.md b/docs/proto/provider.md index 51b32224..6326e8da 100644 --- a/docs/proto/provider.md +++ b/docs/proto/provider.md @@ -81,6 +81,12 @@ - [ClusterRPC](#akash.inventory.v1.ClusterRPC) - [NodeRPC](#akash.inventory.v1.NodeRPC) + - [akash/inventory/v1/workloads.proto](#akash/inventory/v1/workloads.proto) + - [Workload](#akash.inventory.v1.Workload) + - [WorkloadReplica](#akash.inventory.v1.WorkloadReplica) + - [WorkloadService](#akash.inventory.v1.WorkloadService) + - [WorkloadStatus](#akash.inventory.v1.WorkloadStatus) + - [Scalar Value Types](#scalar-value-types) @@ -1054,6 +1060,80 @@ + + +

Top

+ + ## akash/inventory/v1/workloads.proto + + + + + + ### Workload + + + + | Field | Type | Label | Description | + | ----- | ---- | ----- | ----------- | + | `namespace` | [string](#string) | | | + | `order_id` | [google.protobuf.Any](#google.protobuf.Any) | | | + | `services` | [WorkloadService](#akash.inventory.v1.WorkloadService) | repeated | | + + + + + + + + + ### WorkloadReplica + + + + | Field | Type | Label | Description | + | ----- | ---- | ----- | ----------- | + | `status` | [WorkloadStatus](#akash.inventory.v1.WorkloadStatus) | | | + | `resources` | [NodeResources](#akash.inventory.v1.NodeResources) | | | + + + + + + + + + ### WorkloadService + + + + | Field | Type | Label | Description | + | ----- | ---- | ----- | ----------- | + | `replicas` | [WorkloadReplica](#akash.inventory.v1.WorkloadReplica) | repeated | | + + + + + + + + + ### WorkloadStatus + + + + + + + + + + + + + + + ## Scalar Value Types diff --git a/go/inventory/v1/workloads.pb.go b/go/inventory/v1/workloads.pb.go new file mode 100644 index 00000000..b9688c92 --- /dev/null +++ b/go/inventory/v1/workloads.pb.go @@ -0,0 +1,984 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: akash/inventory/v1/workloads.proto + +package v1 + +import ( + fmt "fmt" + types "github.com/cosmos/cosmos-sdk/codec/types" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/gogo/protobuf/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 + +type Workload struct { + Namespace string `protobuf:"bytes,1,opt,name=namespace,proto3" json:"namespace,omitempty"` + OrderID *types.Any `protobuf:"bytes,2,opt,name=order_id,json=orderId,proto3" json:"order_id" yaml:"order_id"` + Services []*WorkloadService `protobuf:"bytes,3,rep,name=services,proto3" json:"services" yaml:"services"` +} + +func (m *Workload) Reset() { *m = Workload{} } +func (m *Workload) String() string { return proto.CompactTextString(m) } +func (*Workload) ProtoMessage() {} +func (*Workload) Descriptor() ([]byte, []int) { + return fileDescriptor_0f55e10ed5e68826, []int{0} +} +func (m *Workload) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Workload) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Workload.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 *Workload) XXX_Merge(src proto.Message) { + xxx_messageInfo_Workload.Merge(m, src) +} +func (m *Workload) XXX_Size() int { + return m.Size() +} +func (m *Workload) XXX_DiscardUnknown() { + xxx_messageInfo_Workload.DiscardUnknown(m) +} + +var xxx_messageInfo_Workload proto.InternalMessageInfo + +func (m *Workload) GetNamespace() string { + if m != nil { + return m.Namespace + } + return "" +} + +func (m *Workload) GetOrderID() *types.Any { + if m != nil { + return m.OrderID + } + return nil +} + +func (m *Workload) GetServices() []*WorkloadService { + if m != nil { + return m.Services + } + return nil +} + +type WorkloadService struct { + Replicas []WorkloadReplica `protobuf:"bytes,1,rep,name=replicas,proto3" json:"replicas" yaml:"replicas"` +} + +func (m *WorkloadService) Reset() { *m = WorkloadService{} } +func (m *WorkloadService) String() string { return proto.CompactTextString(m) } +func (*WorkloadService) ProtoMessage() {} +func (*WorkloadService) Descriptor() ([]byte, []int) { + return fileDescriptor_0f55e10ed5e68826, []int{1} +} +func (m *WorkloadService) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *WorkloadService) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_WorkloadService.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 *WorkloadService) XXX_Merge(src proto.Message) { + xxx_messageInfo_WorkloadService.Merge(m, src) +} +func (m *WorkloadService) XXX_Size() int { + return m.Size() +} +func (m *WorkloadService) XXX_DiscardUnknown() { + xxx_messageInfo_WorkloadService.DiscardUnknown(m) +} + +var xxx_messageInfo_WorkloadService proto.InternalMessageInfo + +func (m *WorkloadService) GetReplicas() []WorkloadReplica { + if m != nil { + return m.Replicas + } + return nil +} + +type WorkloadStatus struct { +} + +func (m *WorkloadStatus) Reset() { *m = WorkloadStatus{} } +func (m *WorkloadStatus) String() string { return proto.CompactTextString(m) } +func (*WorkloadStatus) ProtoMessage() {} +func (*WorkloadStatus) Descriptor() ([]byte, []int) { + return fileDescriptor_0f55e10ed5e68826, []int{2} +} +func (m *WorkloadStatus) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *WorkloadStatus) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_WorkloadStatus.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 *WorkloadStatus) XXX_Merge(src proto.Message) { + xxx_messageInfo_WorkloadStatus.Merge(m, src) +} +func (m *WorkloadStatus) XXX_Size() int { + return m.Size() +} +func (m *WorkloadStatus) XXX_DiscardUnknown() { + xxx_messageInfo_WorkloadStatus.DiscardUnknown(m) +} + +var xxx_messageInfo_WorkloadStatus proto.InternalMessageInfo + +type WorkloadReplica struct { + Status WorkloadStatus `protobuf:"bytes,1,opt,name=status,proto3" json:"status" yaml:"resources"` + Resources NodeResources `protobuf:"bytes,2,opt,name=resources,proto3" json:"resources" yaml:"resources"` +} + +func (m *WorkloadReplica) Reset() { *m = WorkloadReplica{} } +func (m *WorkloadReplica) String() string { return proto.CompactTextString(m) } +func (*WorkloadReplica) ProtoMessage() {} +func (*WorkloadReplica) Descriptor() ([]byte, []int) { + return fileDescriptor_0f55e10ed5e68826, []int{3} +} +func (m *WorkloadReplica) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *WorkloadReplica) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_WorkloadReplica.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 *WorkloadReplica) XXX_Merge(src proto.Message) { + xxx_messageInfo_WorkloadReplica.Merge(m, src) +} +func (m *WorkloadReplica) XXX_Size() int { + return m.Size() +} +func (m *WorkloadReplica) XXX_DiscardUnknown() { + xxx_messageInfo_WorkloadReplica.DiscardUnknown(m) +} + +var xxx_messageInfo_WorkloadReplica proto.InternalMessageInfo + +func (m *WorkloadReplica) GetStatus() WorkloadStatus { + if m != nil { + return m.Status + } + return WorkloadStatus{} +} + +func (m *WorkloadReplica) GetResources() NodeResources { + if m != nil { + return m.Resources + } + return NodeResources{} +} + +func init() { + proto.RegisterType((*Workload)(nil), "akash.inventory.v1.Workload") + proto.RegisterType((*WorkloadService)(nil), "akash.inventory.v1.WorkloadService") + proto.RegisterType((*WorkloadStatus)(nil), "akash.inventory.v1.WorkloadStatus") + proto.RegisterType((*WorkloadReplica)(nil), "akash.inventory.v1.WorkloadReplica") +} + +func init() { + proto.RegisterFile("akash/inventory/v1/workloads.proto", fileDescriptor_0f55e10ed5e68826) +} + +var fileDescriptor_0f55e10ed5e68826 = []byte{ + // 450 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x53, 0x3f, 0x6f, 0xd4, 0x30, + 0x1c, 0x3d, 0x53, 0xe9, 0x7a, 0xe7, 0x93, 0x68, 0x15, 0x75, 0x08, 0x15, 0x4a, 0x0e, 0xb3, 0xdc, + 0x00, 0xb6, 0x1a, 0x36, 0x36, 0x22, 0x96, 0x4a, 0x08, 0xa4, 0x30, 0x20, 0xb1, 0x54, 0xbe, 0xc4, + 0xe4, 0xa2, 0xe6, 0xe2, 0xc8, 0x4e, 0x82, 0x32, 0xf3, 0x05, 0xf8, 0x58, 0x1d, 0x3b, 0x32, 0x45, + 0x28, 0xb7, 0xdd, 0x84, 0xba, 0xb2, 0xa0, 0x38, 0x76, 0xc2, 0x9f, 0x13, 0xdd, 0xec, 0xf7, 0xde, + 0xef, 0xbd, 0x27, 0xff, 0x81, 0x88, 0x5e, 0x53, 0xb9, 0x21, 0x49, 0x56, 0xb1, 0xac, 0xe0, 0xa2, + 0x26, 0xd5, 0x05, 0xf9, 0xcc, 0xc5, 0x75, 0xca, 0x69, 0x24, 0x71, 0x2e, 0x78, 0xc1, 0x2d, 0x4b, + 0x69, 0xf0, 0xa0, 0xc1, 0xd5, 0xc5, 0xf9, 0xa1, 0x39, 0xc1, 0x24, 0x2f, 0x45, 0xc8, 0xf4, 0xdc, + 0xf9, 0x59, 0xcc, 0x63, 0xae, 0x96, 0xa4, 0x5b, 0x69, 0xf4, 0x51, 0xcc, 0x79, 0x9c, 0x32, 0xa2, + 0x76, 0xeb, 0xf2, 0x13, 0xa1, 0x59, 0xdd, 0x53, 0xe8, 0x27, 0x80, 0xb3, 0x0f, 0x3a, 0xdc, 0x7a, + 0x0c, 0xe7, 0x19, 0xdd, 0x32, 0x99, 0xd3, 0x90, 0xd9, 0x60, 0x09, 0x56, 0xf3, 0x60, 0x04, 0xac, + 0x2b, 0x38, 0xe3, 0x22, 0x62, 0xe2, 0x2a, 0x89, 0xec, 0x07, 0x4b, 0xb0, 0x5a, 0x78, 0x67, 0xb8, + 0x37, 0xc6, 0xc6, 0x18, 0xbf, 0xca, 0x6a, 0x1f, 0xdf, 0x34, 0x2e, 0x68, 0x1b, 0xf7, 0xf8, 0x5d, + 0xa7, 0xbe, 0x7c, 0xbd, 0x6f, 0xdc, 0x61, 0xf0, 0xae, 0x71, 0x4f, 0x6a, 0xba, 0x4d, 0x5f, 0x22, + 0x83, 0xa0, 0xe0, 0x58, 0x2d, 0x2f, 0x23, 0x2b, 0x87, 0x33, 0xc9, 0x44, 0x95, 0x84, 0x4c, 0xda, + 0x47, 0xcb, 0xa3, 0xd5, 0xc2, 0x7b, 0x8a, 0xff, 0x3d, 0x07, 0x6c, 0xea, 0xbe, 0xef, 0xb5, 0x3e, + 0xd1, 0x79, 0x33, 0x0d, 0xc8, 0x2e, 0xd0, 0x18, 0x8d, 0x81, 0x06, 0x41, 0xc1, 0x40, 0xa2, 0x2f, + 0x00, 0x9e, 0xfc, 0x65, 0xd7, 0xb5, 0x10, 0x2c, 0x4f, 0x93, 0x90, 0x4a, 0x1b, 0xdc, 0xdf, 0x22, + 0xe8, 0xb5, 0xaa, 0xc5, 0xa4, 0x6b, 0xa1, 0x01, 0xd5, 0xc2, 0x18, 0x8d, 0x2d, 0x0c, 0x82, 0x82, + 0x81, 0x44, 0xa7, 0xf0, 0xe1, 0x50, 0xa2, 0xa0, 0x45, 0x29, 0xd1, 0x8f, 0xdf, 0x7a, 0x69, 0x3f, + 0x6b, 0x03, 0xa7, 0x52, 0xb1, 0xea, 0x66, 0x16, 0x1e, 0xfa, 0xef, 0xd9, 0x28, 0xa5, 0xff, 0x4c, + 0x97, 0x9a, 0xf6, 0xfb, 0x7d, 0xe3, 0x6a, 0x8f, 0xbb, 0xc6, 0x3d, 0x35, 0x85, 0xf4, 0x0b, 0x42, + 0x81, 0xe6, 0x2c, 0x09, 0xe7, 0x03, 0xaa, 0x6f, 0xfa, 0xc9, 0xa1, 0xb0, 0xb7, 0x3c, 0x62, 0x81, + 0x11, 0xfa, 0x9e, 0xce, 0x9a, 0x0f, 0xd0, 0xbe, 0x71, 0x47, 0xa3, 0x83, 0x89, 0x23, 0xed, 0xbf, + 0xb9, 0x69, 0x1d, 0x70, 0xdb, 0x3a, 0xe0, 0x7b, 0xeb, 0x80, 0xaf, 0x3b, 0x67, 0x72, 0xbb, 0x73, + 0x26, 0xdf, 0x76, 0xce, 0xe4, 0xa3, 0x17, 0x27, 0xc5, 0xa6, 0x5c, 0xe3, 0x90, 0x6f, 0x89, 0x6a, + 0xf1, 0x3c, 0x63, 0x45, 0xf7, 0x61, 0xf4, 0x8e, 0xe6, 0x09, 0x89, 0xf9, 0x1f, 0xff, 0x62, 0x3d, + 0x55, 0x2f, 0xf2, 0xc5, 0xaf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x29, 0x8b, 0x4b, 0x13, 0x6c, 0x03, + 0x00, 0x00, +} + +func (m *Workload) 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 *Workload) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Workload) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Services) > 0 { + for iNdEx := len(m.Services) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Services[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintWorkloads(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + } + if m.OrderID != nil { + { + size, err := m.OrderID.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintWorkloads(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.Namespace) > 0 { + i -= len(m.Namespace) + copy(dAtA[i:], m.Namespace) + i = encodeVarintWorkloads(dAtA, i, uint64(len(m.Namespace))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *WorkloadService) 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 *WorkloadService) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *WorkloadService) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Replicas) > 0 { + for iNdEx := len(m.Replicas) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Replicas[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintWorkloads(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *WorkloadStatus) 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 *WorkloadStatus) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *WorkloadStatus) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *WorkloadReplica) 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 *WorkloadReplica) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *WorkloadReplica) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Resources.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintWorkloads(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + { + size, err := m.Status.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintWorkloads(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func encodeVarintWorkloads(dAtA []byte, offset int, v uint64) int { + offset -= sovWorkloads(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *Workload) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Namespace) + if l > 0 { + n += 1 + l + sovWorkloads(uint64(l)) + } + if m.OrderID != nil { + l = m.OrderID.Size() + n += 1 + l + sovWorkloads(uint64(l)) + } + if len(m.Services) > 0 { + for _, e := range m.Services { + l = e.Size() + n += 1 + l + sovWorkloads(uint64(l)) + } + } + return n +} + +func (m *WorkloadService) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Replicas) > 0 { + for _, e := range m.Replicas { + l = e.Size() + n += 1 + l + sovWorkloads(uint64(l)) + } + } + return n +} + +func (m *WorkloadStatus) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *WorkloadReplica) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Status.Size() + n += 1 + l + sovWorkloads(uint64(l)) + l = m.Resources.Size() + n += 1 + l + sovWorkloads(uint64(l)) + return n +} + +func sovWorkloads(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozWorkloads(x uint64) (n int) { + return sovWorkloads(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *Workload) 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 ErrIntOverflowWorkloads + } + 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: Workload: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Workload: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Namespace", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowWorkloads + } + 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 ErrInvalidLengthWorkloads + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthWorkloads + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Namespace = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OrderID", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowWorkloads + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthWorkloads + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthWorkloads + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.OrderID == nil { + m.OrderID = &types.Any{} + } + if err := m.OrderID.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Services", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowWorkloads + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthWorkloads + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthWorkloads + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Services = append(m.Services, &WorkloadService{}) + if err := m.Services[len(m.Services)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipWorkloads(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthWorkloads + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *WorkloadService) 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 ErrIntOverflowWorkloads + } + 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: WorkloadService: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: WorkloadService: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Replicas", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowWorkloads + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthWorkloads + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthWorkloads + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Replicas = append(m.Replicas, WorkloadReplica{}) + if err := m.Replicas[len(m.Replicas)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipWorkloads(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthWorkloads + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *WorkloadStatus) 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 ErrIntOverflowWorkloads + } + 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: WorkloadStatus: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: WorkloadStatus: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipWorkloads(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthWorkloads + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *WorkloadReplica) 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 ErrIntOverflowWorkloads + } + 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: WorkloadReplica: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: WorkloadReplica: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowWorkloads + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthWorkloads + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthWorkloads + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Status.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Resources", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowWorkloads + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthWorkloads + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthWorkloads + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Resources.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipWorkloads(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthWorkloads + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipWorkloads(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, ErrIntOverflowWorkloads + } + 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, ErrIntOverflowWorkloads + } + 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, ErrIntOverflowWorkloads + } + 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, ErrInvalidLengthWorkloads + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupWorkloads + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthWorkloads + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthWorkloads = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowWorkloads = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupWorkloads = fmt.Errorf("proto: unexpected end of group") +) diff --git a/go/node/types/offchain/sign/sign.go b/go/node/types/offchain/sign/sign.go new file mode 100644 index 00000000..a90947df --- /dev/null +++ b/go/node/types/offchain/sign/sign.go @@ -0,0 +1,82 @@ +package sign + +import ( + "encoding/json" + "reflect" + + "github.com/cosmos/cosmos-sdk/codec" + "github.com/cosmos/cosmos-sdk/codec/legacy" + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/x/auth/legacy/legacytx" +) + +var ( + MsgTypeSignData = "" +) + +var ( + _ sdk.Msg = (*MsgSignData)(nil) + _ legacytx.LegacyMsg = (*MsgSignData)(nil) +) + +func init() { + MsgTypeSignData = reflect.TypeOf(&MsgSignData{}).Elem().Name() +} + +// Type implements the sdk.Msg interface +func (m *MsgSignData) Type() string { + return MsgTypeSignData +} + +// ValidateBasic does basic validation +func (m MsgSignData) ValidateBasic() error { + if _, err := sdk.AccAddressFromBech32(m.Signer); err != nil { + return sdkerrors.Wrap(sdkerrors.ErrInvalidAddress, "MsgSignData: Invalid Signer Address") + } + + return nil +} + +// GetSigners defines whose signature is required +func (m MsgSignData) GetSigners() []sdk.AccAddress { + signer, err := sdk.AccAddressFromBech32(m.Signer) + if err != nil { + panic(err) + } + + return []sdk.AccAddress{signer} +} + +// GetSignBytes encodes the message for signing +func (m *MsgSignData) GetSignBytes() []byte { + return sdk.MustSortJSON(legacy.Cdc.MustMarshalJSON(m)) +} + +func (m *MsgSignData) Route() string { + return "signData" +} + +// StdSignBytes returns the bytes to sign for a transaction. +func StdSignBytes(cdc *codec.LegacyAmino, chainID string, accnum, sequence, timeout uint64, fee legacytx.StdFee, msgs []sdk.Msg, memo string) []byte { + msgsBytes := make([]json.RawMessage, 0, len(msgs)) + for _, msg := range msgs { + bz := cdc.MustMarshalJSON(msg) + msgsBytes = append(msgsBytes, sdk.MustSortJSON(bz)) + } + + bz, err := cdc.MarshalJSON(legacytx.StdSignDoc{ + AccountNumber: accnum, + ChainID: chainID, + Fee: fee.Bytes(), + Memo: memo, + Msgs: msgsBytes, + Sequence: sequence, + TimeoutHeight: timeout, + }) + if err != nil { + panic(err) + } + + return sdk.MustSortJSON(bz) +} diff --git a/go/node/types/offchain/sign/sign.pb.go b/go/node/types/offchain/sign/sign.pb.go new file mode 100644 index 00000000..b5e48103 --- /dev/null +++ b/go/node/types/offchain/sign/sign.pb.go @@ -0,0 +1,378 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: akash/base/offchain/sign/sign.proto + +package sign + +import ( + fmt "fmt" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/gogo/protobuf/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 + +// MsgSignData defines an arbitrary, general-purpose, off-chain message +type MsgSignData struct { + // Signer is the sdk.AccAddress of the message signer + Signer string `protobuf:"bytes,1,opt,name=signer,proto3" json:"signer" yaml:"signer"` + // Data represents the raw bytes of the content that is signed (text, json, etc) + Data []byte `protobuf:"bytes,2,opt,name=data,proto3" json:"data"` +} + +func (m *MsgSignData) Reset() { *m = MsgSignData{} } +func (m *MsgSignData) String() string { return proto.CompactTextString(m) } +func (*MsgSignData) ProtoMessage() {} +func (*MsgSignData) Descriptor() ([]byte, []int) { + return fileDescriptor_a71446b1cab28cbc, []int{0} +} +func (m *MsgSignData) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgSignData) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgSignData.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 *MsgSignData) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgSignData.Merge(m, src) +} +func (m *MsgSignData) XXX_Size() int { + return m.Size() +} +func (m *MsgSignData) XXX_DiscardUnknown() { + xxx_messageInfo_MsgSignData.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgSignData proto.InternalMessageInfo + +func (m *MsgSignData) GetSigner() string { + if m != nil { + return m.Signer + } + return "" +} + +func (m *MsgSignData) GetData() []byte { + if m != nil { + return m.Data + } + return nil +} + +func init() { + proto.RegisterType((*MsgSignData)(nil), "akash.base.offchain.sign.MsgSignData") +} + +func init() { + proto.RegisterFile("akash/base/offchain/sign/sign.proto", fileDescriptor_a71446b1cab28cbc) +} + +var fileDescriptor_a71446b1cab28cbc = []byte{ + // 235 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x4e, 0xcc, 0x4e, 0x2c, + 0xce, 0xd0, 0x4f, 0x4a, 0x2c, 0x4e, 0xd5, 0xcf, 0x4f, 0x4b, 0x4b, 0xce, 0x48, 0xcc, 0xcc, 0xd3, + 0x2f, 0xce, 0x4c, 0x87, 0x10, 0x7a, 0x05, 0x45, 0xf9, 0x25, 0xf9, 0x42, 0x12, 0x60, 0x45, 0x7a, + 0x20, 0x45, 0x7a, 0x30, 0x45, 0x7a, 0x20, 0x79, 0x29, 0x91, 0xf4, 0xfc, 0xf4, 0x7c, 0xb0, 0x22, + 0x7d, 0x10, 0x0b, 0xa2, 0x5e, 0x29, 0x81, 0x8b, 0xdb, 0xb7, 0x38, 0x3d, 0x38, 0x33, 0x3d, 0xcf, + 0x25, 0xb1, 0x24, 0x51, 0xc8, 0x98, 0x8b, 0x0d, 0xa4, 0x38, 0xb5, 0x48, 0x82, 0x51, 0x81, 0x51, + 0x83, 0xd3, 0x49, 0xfa, 0xd5, 0x3d, 0x79, 0xa8, 0xc8, 0xa7, 0x7b, 0xf2, 0xbc, 0x95, 0x89, 0xb9, + 0x39, 0x56, 0x4a, 0x10, 0xbe, 0x52, 0x10, 0x54, 0x42, 0x48, 0x86, 0x8b, 0x25, 0x25, 0xb1, 0x24, + 0x51, 0x82, 0x49, 0x81, 0x51, 0x83, 0xc7, 0x89, 0xe3, 0xd5, 0x3d, 0x79, 0x30, 0x3f, 0x08, 0x4c, + 0x3a, 0x45, 0x9c, 0x78, 0x24, 0xc7, 0x78, 0xe1, 0x91, 0x1c, 0xe3, 0x83, 0x47, 0x72, 0x8c, 0x13, + 0x1e, 0xcb, 0x31, 0x5c, 0x78, 0x2c, 0xc7, 0x70, 0xe3, 0xb1, 0x1c, 0x43, 0x94, 0x5d, 0x7a, 0x66, + 0x49, 0x46, 0x69, 0x92, 0x5e, 0x72, 0x7e, 0xae, 0x3e, 0xd8, 0xd9, 0xba, 0x79, 0xa9, 0x25, 0xe5, + 0xf9, 0x45, 0xd9, 0x50, 0x5e, 0x62, 0x41, 0xa6, 0x7e, 0x7a, 0xbe, 0x7e, 0x5e, 0x7e, 0x4a, 0xaa, + 0x7e, 0x49, 0x65, 0x41, 0x6a, 0x31, 0xaa, 0xb7, 0x93, 0xd8, 0xc0, 0x5e, 0x30, 0x06, 0x04, 0x00, + 0x00, 0xff, 0xff, 0xc4, 0x57, 0x81, 0xde, 0x19, 0x01, 0x00, 0x00, +} + +func (m *MsgSignData) 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 *MsgSignData) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgSignData) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Data) > 0 { + i -= len(m.Data) + copy(dAtA[i:], m.Data) + i = encodeVarintSign(dAtA, i, uint64(len(m.Data))) + i-- + dAtA[i] = 0x12 + } + if len(m.Signer) > 0 { + i -= len(m.Signer) + copy(dAtA[i:], m.Signer) + i = encodeVarintSign(dAtA, i, uint64(len(m.Signer))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintSign(dAtA []byte, offset int, v uint64) int { + offset -= sovSign(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *MsgSignData) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Signer) + if l > 0 { + n += 1 + l + sovSign(uint64(l)) + } + l = len(m.Data) + if l > 0 { + n += 1 + l + sovSign(uint64(l)) + } + return n +} + +func sovSign(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozSign(x uint64) (n int) { + return sovSign(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *MsgSignData) 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 ErrIntOverflowSign + } + 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: MsgSignData: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgSignData: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Signer", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSign + } + 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 ErrInvalidLengthSign + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthSign + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Signer = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSign + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthSign + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthSign + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Data = append(m.Data[:0], dAtA[iNdEx:postIndex]...) + if m.Data == nil { + m.Data = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipSign(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthSign + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipSign(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, ErrIntOverflowSign + } + 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, ErrIntOverflowSign + } + 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, ErrIntOverflowSign + } + 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, ErrInvalidLengthSign + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupSign + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthSign + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthSign = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowSign = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupSign = fmt.Errorf("proto: unexpected end of group") +) diff --git a/go/util/jwt/es256k.go b/go/util/jwt/es256k.go index c844d5df..cd01c481 100644 --- a/go/util/jwt/es256k.go +++ b/go/util/jwt/es256k.go @@ -6,44 +6,17 @@ package jwt import ( "fmt" - "github.com/cosmos/cosmos-sdk/crypto/keyring" - cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/golang-jwt/jwt/v5" ) -// SignerI wraps cosmos keyring and account info to provide a signer interface -type SignerI interface { - keyring.Signer - GetAddress() sdk.Address -} - -// Signer implements SignerI interface -type Signer struct { - keyring.Signer - addr sdk.Address -} - type signer struct{} -var _ SignerI = &Signer{} var _ jwt.SigningMethod = (*signer)(nil) var ( SigningMethodES256K *signer ) -func (s Signer) GetAddress() sdk.Address { - return s.addr -} - -func NewSigner(kr keyring.Keyring, addr sdk.Address) SignerI { - return &Signer{ - Signer: kr, - addr: addr, - } -} - func (s *signer) Sign(signingString string, key interface{}) ([]byte, error) { switch key := key.(type) { case SignerI: @@ -59,8 +32,8 @@ func (s *signer) Sign(signingString string, key interface{}) ([]byte, error) { func (s *signer) Verify(signingString string, sig []byte, key interface{}) error { switch key := key.(type) { - case cryptotypes.PubKey: - if !key.VerifySignature([]byte(signingString), sig) { + case VerifyI: + if !key.Pubkey().VerifySignature([]byte(signingString), sig) { return jwt.ErrTokenSignatureInvalid } diff --git a/go/util/jwt/es256k_test.go b/go/util/jwt/es256k_test.go index 8b0ecd55..d76f5134 100644 --- a/go/util/jwt/es256k_test.go +++ b/go/util/jwt/es256k_test.go @@ -3,6 +3,7 @@ package jwt import ( "encoding/json" "strings" + "testing" "github.com/golang-jwt/jwt/v5" "github.com/stretchr/testify/require" @@ -38,40 +39,43 @@ func (s *ES256kTest) TestSignVerify() { } for _, tc := range testCases { - parts := strings.Split(tc.TokenString, ".") - require.Len(s.T(), parts, 3, "Invalid token string: %v", tc.TokenString) - - expectedClaims := &jwt.RegisteredClaims{Issuer: "bar"} - - key := Signer{ - Signer: s.kr, - addr: s.info.GetAddress(), - } - - expectedTok := jwt.NewWithClaims(SigningMethodES256K, expectedClaims) - sigString, err := expectedTok.SignedString(key) - require.NoError(s.T(), err) - - toSign := strings.Join(parts[0:2], ".") - method := jwt.GetSigningMethod(tc.Expected.Alg) - sig, err := method.Sign(toSign, key) - require.NoError(s.T(), err, "Error signing token: %v", err) - - ssig := encodeSegment(sig) - dsig := decodeSegment(s.T(), parts[2]) - - err = method.Verify(toSign, dsig, s.info.GetPubKey()) - - if !tc.MustFail { - require.Equal(s.T(), parts[2], ssig, "Identical signatures\nbefore:\n%v\nafter:\n%v", parts[2], ssig) - require.NoError(s.T(), err, "Sign produced an invalid signature: %v", err) - require.Equal(s.T(), tc.TokenString, sigString) - require.NotEqual(s.T(), sig, parts[2]) - } else { - require.NotEqual(s.T(), parts[2], ssig, "Identical signatures\nbefore:\n%v\nafter:\n%v", parts[2], ssig) - require.NotEqual(s.T(), tc.TokenString, sigString) - require.Error(s.T(), err) - } + s.T().Run(tc.Description, func(t *testing.T) { + parts := strings.Split(tc.TokenString, ".") + require.Len(t, parts, 3, "Invalid token string: %v", tc.TokenString) + + signer := NewSigner(s.kr, s.addr) + verifier := NewVerifier(s.pubKey, s.addr) + + expectedTok := jwt.NewWithClaims(jwt.GetSigningMethod(tc.Expected.Alg), tc.Expected.Claims) + sstr, err := expectedTok.SigningString() + require.NoError(t, err) + + s.T().Log(sstr) + + sigString, err := expectedTok.SignedString(signer) + require.NoError(t, err) + + toSign := strings.Join(parts[0:2], ".") + method := jwt.GetSigningMethod(tc.Expected.Alg) + sig, err := method.Sign(toSign, signer) + require.NoError(t, err, "Error signing token: %v", err) + + ssig := encodeSegment(sig) + dsig := decodeSegment(t, parts[2]) + + err = method.Verify(toSign, dsig, verifier) + + if !tc.MustFail { + require.Equal(t, parts[2], ssig, "Identical signatures\nbefore:\n%v\nafter:\n%v", parts[2], ssig) + require.NoError(t, err, "Sign produced an invalid signature: %v", err) + require.Equal(t, tc.TokenString, sigString) + require.NotEqual(t, sig, parts[2]) + } else { + require.NotEqual(t, parts[2], ssig, "Identical signatures\nbefore:\n%v\nafter:\n%v", parts[2], ssig) + require.NotEqual(t, tc.TokenString, sigString) + require.Error(t, err) + } + }) } } diff --git a/go/util/jwt/es256kadr36.go b/go/util/jwt/es256kadr36.go new file mode 100644 index 00000000..1a9a6b2d --- /dev/null +++ b/go/util/jwt/es256kadr36.go @@ -0,0 +1,87 @@ +// Package jwt provides JWT signing and verification methods for the Cosmos SDK. +// It includes functionality for creating and verifying JWT tokens using the ES256K +// signing method. +package jwt + +import ( + "fmt" + + "github.com/cosmos/cosmos-sdk/codec" + "github.com/golang-jwt/jwt/v5" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/x/auth/legacy/legacytx" + + offchain "github.com/akash-network/akash-api/go/node/types/offchain/sign" +) + +// signerADR36 this contraption is to get JWT sign work with web base wallets like Keplr/Leap +// `signArbitrary` there does not sign provided data directly for chain security reasons, +// rather wraps data in fake tx and signs it. Such an approach does not allow to validate +// JWT token on the provider side with purely ES256K signature +type signerADR36 struct { + cdc *codec.LegacyAmino +} + +var _ jwt.SigningMethod = (*signerADR36)(nil) + +var ( + SigningMethodES256KADR36 *signerADR36 +) + +func (s *signerADR36) Sign(signingString string, key interface{}) ([]byte, error) { + switch key := key.(type) { + case SignerI: + signBytes := offchain.StdSignBytes(s.cdc, "", 0, 0, 0, legacytx.StdFee{}, []sdk.Msg{ + &offchain.MsgSignData{ + Signer: key.GetAddress().String(), + Data: []byte(signingString), + }, + }, "") + + res, _, err := key.SignByAddress(key.GetAddress(), signBytes) + if err != nil { + return nil, err + } + return res, nil + default: + return nil, fmt.Errorf("%w: ES256KADR36 sign expects cryptotypes.LedgerPrivKey", jwt.ErrInvalidKeyType) + } +} + +func (s *signerADR36) Verify(signingString string, sig []byte, key interface{}) error { + switch key := key.(type) { + case VerifyI: + signBytes := offchain.StdSignBytes(s.cdc, "", 0, 0, 0, legacytx.StdFee{}, []sdk.Msg{ + &offchain.MsgSignData{ + Signer: key.GetAddress().String(), + Data: []byte(signingString), + }, + }, "") + + if !key.Pubkey().VerifySignature(signBytes, sig) { + return jwt.ErrTokenSignatureInvalid + } + + return nil + default: + return fmt.Errorf("%w: ES256KADR36 verify expects cryptotypes.PubKey", jwt.ErrInvalidKeyType) + } +} + +func (s *signerADR36) Alg() string { + return "ES256KADR36" +} + +func init() { + cdc := codec.NewLegacyAmino() + cdc.RegisterConcrete(&offchain.MsgSignData{}, "sign/MsgSignData", nil) + + SigningMethodES256KADR36 = &signerADR36{ + cdc: cdc, + } + + jwt.RegisterSigningMethod(SigningMethodES256KADR36.Alg(), func() jwt.SigningMethod { + return SigningMethodES256KADR36 + }) +} diff --git a/go/util/jwt/jwt_test.go b/go/util/jwt/jwt_test.go index 16a52570..d9db6acd 100644 --- a/go/util/jwt/jwt_test.go +++ b/go/util/jwt/jwt_test.go @@ -3,16 +3,18 @@ package jwt import ( "bytes" "encoding/json" + "fmt" "strings" "testing" "text/template" "time" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/golang-jwt/jwt/v5" "github.com/stretchr/testify/require" "github.com/xeipuuv/gojsonschema" + sdk "github.com/cosmos/cosmos-sdk/types" + jwttests "github.com/akash-network/akash-api/testdata/jwt" ) @@ -25,6 +27,7 @@ type jwtTestCase struct { Claims Claims `json:"claims"` TokenString string `json:"tokenString"` Expected struct { + Alg string `json:"alg"` SignFail bool `json:"signFail"` VerifyFail bool `json:"verifyFail"` BypassSchemaValidation bool `json:"bypassSchemaValidation"` @@ -42,7 +45,7 @@ type testTemplate struct { Exp48h int64 } -func (s *JWTTestSuite) initClaims(tc jwtTestCase) jwtTestCase { +func (s *JWTTestSuite) initClaims(tc jwtTestCase) []jwtTestCase { var err error if tc.Claims.Issuer != "" { @@ -51,26 +54,37 @@ func (s *JWTTestSuite) initClaims(tc jwtTestCase) jwtTestCase { } if tc.TokenString != "" { - return tc + return []jwtTestCase{tc} } - ehdr := encodeSegment([]byte(`{"alg":"ES256K","typ":"JWT"}`)) + res := make([]jwtTestCase, 0, 2) + + for _, alg := range []string{"ES256K", "ES256KADR36"} { + ntc := tc - claims, err := json.Marshal(tc.Claims) - require.NoError(s.T(), err) + ehdr := encodeSegment([]byte(fmt.Sprintf(`{"alg":"%s","typ":"JWT"}`, alg))) - eclaims := encodeSegment(claims) - data := ehdr + "." + eclaims + claims, err := json.Marshal(tc.Claims) + require.NoError(s.T(), err) + + eclaims := encodeSegment(claims) + data := ehdr + "." + eclaims - method := jwt.GetSigningMethod("ES256K") - sig, err := method.Sign(data, Signer{ - Signer: s.kr, - addr: s.info.GetAddress(), - }) + method := jwt.GetSigningMethod(alg) + sig, err := method.Sign(data, Signer{ + Signer: s.kr, + addr: s.addr, + }) - tc.TokenString = data + "." + encodeSegment(sig) + require.NoError(s.T(), err) - return tc + ntc.Expected.Alg = alg + ntc.TokenString = data + "." + encodeSegment(sig) + + res = append(res, ntc) + } + + return res } func (s *JWTTestSuite) TestSigning() { @@ -78,11 +92,12 @@ func (s *JWTTestSuite) TestSigning() { for _, tc := range testCases { s.Run(tc.Description, func() { - token := jwt.NewWithClaims(jwt.GetSigningMethod("ES256K"), tc.Claims) - tokenString, err := token.SignedString(Signer{ - Signer: s.kr, - addr: s.info.GetAddress(), - }) + token := jwt.NewWithClaims(jwt.GetSigningMethod(tc.Expected.Alg), tc.Claims) + + signer := NewSigner(s.kr, s.addr) + verifier := NewVerifier(s.pubKey, s.addr) + + tokenString, err := token.SignedString(signer) if tc.Expected.SignFail { require.Error(s.T(), err) @@ -95,8 +110,8 @@ func (s *JWTTestSuite) TestSigning() { if !tc.Expected.VerifyFail { claims := &Claims{} _, err := jwt.ParseWithClaims(tokenString, claims, func(token *jwt.Token) (interface{}, error) { - return s.info.GetPubKey(), nil - }, jwt.WithValidMethods([]string{"ES256K"})) + return verifier, nil + }, jwt.WithValidMethods([]string{"ES256K", "ES256KADR36"})) require.Equal(s.T(), &tc.Claims, claims) @@ -104,11 +119,8 @@ func (s *JWTTestSuite) TestSigning() { } else { claims := &Claims{} _, err := jwt.ParseWithClaims(tokenString, claims, func(token *jwt.Token) (interface{}, error) { - if token.Header["alg"] != "ES256K" { - return nil, jwt.ErrInvalidKeyType - } - return s.info.GetPubKey(), nil - }, jwt.WithValidMethods([]string{"ES256K"})) + return verifier, nil + }, jwt.WithValidMethods([]string{"ES256K", "ES256KADR36"})) require.ErrorContains(s.T(), err, tc.Expected.Err) } @@ -176,11 +188,15 @@ func (s *JWTTestSuite) prepareTestCases(t *testing.T) []jwtTestCase { s.T().Fatalf("could not unmarshal test data: %v", err) } + res := make([]jwtTestCase, 0, len(testCases)) + for i := range testCases { - testCases[i] = s.initClaims(testCases[i]) + for _, tc := range s.initClaims(testCases[i]) { + res = append(res, tc) + } } - return testCases + return res } func TestGetSupportedScopes(t *testing.T) { diff --git a/go/util/jwt/signer.go b/go/util/jwt/signer.go new file mode 100644 index 00000000..d5309cdd --- /dev/null +++ b/go/util/jwt/signer.go @@ -0,0 +1,31 @@ +package jwt + +import ( + "github.com/cosmos/cosmos-sdk/crypto/keyring" + sdk "github.com/cosmos/cosmos-sdk/types" +) + +// SignerI wraps cosmos keyring and account info to provide a signer interface +type SignerI interface { + keyring.Signer + GetAddress() sdk.Address +} + +// Signer implements SignerI interface +type Signer struct { + keyring.Signer + addr sdk.Address +} + +var _ SignerI = &Signer{} + +func (s Signer) GetAddress() sdk.Address { + return s.addr +} + +func NewSigner(kr keyring.Keyring, addr sdk.Address) SignerI { + return &Signer{ + Signer: kr, + addr: addr, + } +} diff --git a/go/util/jwt/suite_test.go b/go/util/jwt/suite_test.go index a010153a..859013f8 100644 --- a/go/util/jwt/suite_test.go +++ b/go/util/jwt/suite_test.go @@ -7,6 +7,7 @@ import ( "github.com/cosmos/cosmos-sdk/crypto/hd" "github.com/cosmos/cosmos-sdk/crypto/keyring" + cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/require" "github.com/stretchr/testify/suite" @@ -20,6 +21,8 @@ type IntegrationTestSuite struct { kr keyring.Keyring info keyring.Info + addr sdk.Address + pubKey cryptotypes.PubKey } func (s *IntegrationTestSuite) SetupSuite() { @@ -44,6 +47,10 @@ func (s *IntegrationTestSuite) SetupSuite() { s.info, err = s.kr.NewAccount("test", strings.TrimSuffix(string(mnemonic), "\n"), "", hdPath, algo) require.NoError(s.T(), err) + s.addr = s.info.GetAddress() + + s.pubKey = s.info.GetPubKey() + s.T().Log("setting up integration test suite done") } diff --git a/go/util/jwt/verifier.go b/go/util/jwt/verifier.go new file mode 100644 index 00000000..f8a3371e --- /dev/null +++ b/go/util/jwt/verifier.go @@ -0,0 +1,34 @@ +package jwt + +import ( + cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" + sdk "github.com/cosmos/cosmos-sdk/types" +) + +// VerifyI wraps cosmos keyring and account info to provide a signer interface +type VerifyI interface { + Pubkey() cryptotypes.PubKey + GetAddress() sdk.Address +} + +type Verify struct { + cryptotypes.PubKey + addr sdk.Address +} + +var _ VerifyI = &Verify{} + +func NewVerifier(pubkey cryptotypes.PubKey, addr sdk.Address) VerifyI { + return &Verify{ + PubKey: pubkey, + addr: addr, + } +} + +func (v Verify) Pubkey() cryptotypes.PubKey { + return v.PubKey +} + +func (v Verify) GetAddress() sdk.Address { + return v.addr +} diff --git a/proto/node/akash/base/offchain/sign/sign.proto b/proto/node/akash/base/offchain/sign/sign.proto new file mode 100644 index 00000000..159b319d --- /dev/null +++ b/proto/node/akash/base/offchain/sign/sign.proto @@ -0,0 +1,20 @@ +syntax = "proto3"; +package akash.base.offchain.sign; + +import "gogoproto/gogo.proto"; + +option go_package = "github.com/akash-network/akash-api/go/node/types/offchain/sign"; + +// MsgSignData defines an arbitrary, general-purpose, off-chain message +message MsgSignData { + // Signer is the sdk.AccAddress of the message signer + string signer = 1 [ + (gogoproto.jsontag) = "signer", + (gogoproto.moretags) = "yaml:\"signer\"" + ]; + + // Data represents the raw bytes of the content that is signed (text, json, etc) + bytes data = 2 [ + (gogoproto.jsontag) = "data" + ]; +} diff --git a/testdata/jwt/cases_es256k.json b/testdata/jwt/cases_es256k.json index d4b56805..6ababcba 100644 --- a/testdata/jwt/cases_es256k.json +++ b/testdata/jwt/cases_es256k.json @@ -1,7 +1,7 @@ [ { "description": "ES256K - Valid Signature", - "tokenString": "eyJhbGciOiJFUzI1NksiLCJ0eXAiOiJKV1QifQ.eyJpc3MiOiJiYXIifQ.uq2X8CtBrg-fPvkJ5Dl-AHWQ1HPVnZfA1o0azRlHEBkE7YzOdr44UWmlkavjrl3lMHr4jhROugXi8cjrrZ2Kzw", + "tokenString": "eyJhbGciOiJFUzI1NksiLCJ0eXAiOiJKV1QifQ.eyJ2ZXJzaW9uIjoiIiwibGVhc2VzIjp7ImFjY2VzcyI6IiJ9fQ.fQFwGyhJDyF9i_zCX6IwJ43_arjs_1qJmxNSph6t8INMMZ7hBvrzwg0Ym8N06G7O_ZDw0mujQCfmOmR1jegnmA", "expected": { "alg": "ES256K", "claims": { @@ -12,7 +12,7 @@ }, { "description": "ES256K - Invalid Signature", - "tokenString": "eyJ0eXAiOiJKV1QiLCJhbGciOiJFUzI1NksifQ.eyJpc3MiOiJiYXIifQ.MEQCIHoSJnmGlPaVQDqacx_2XlXEhhqtWceVopjomc2PJLtdAiAUTeGPoNYxZw0z8mgOnnIcjoxRuNDVZvybRZF3wR1l8W", + "tokenString": "eyJ0eXAiOiJKV1QiLCJhbGciOiJFUzI1NksifQ.eyJ2ZXJzaW9uIjoiIiwibGVhc2VzIjp7ImFjY2VzcyI6IiJ9fQ.MEQCIHoSJnmGlPaVQDqacx_2XlXEhhqtWceVopjomc2PJLtdAiAUTeGPoNYxZw0z8mgOnnIcjoxRuNDVZvybRZF3wR1l8W", "expected": { "alg": "ES256K", "claims": { @@ -23,5 +23,54 @@ "issuer": "bar" }, "mustFail": true + }, + { + "description": "ES256KADR36 - Valid Signature/with scoped claims", + "tokenString": "eyJhbGciOiJFUzI1NktBRFIzNiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJha2FzaDFxdWZhM3h6cmYzNHF2d3llamtodm5jNHBzZjQ5ZmZ0YXcwYXNtaCIsImV4cCI6MTc2MDQwNjc0MCwibmJmIjoxNzYwNDA0OTQwLCJpYXQiOjE3NjA0MDQ5NDAsInZlcnNpb24iOiJ2MSIsImxlYXNlcyI6eyJhY2Nlc3MiOiJzY29wZWQiLCJzY29wZSI6WyJzdGF0dXMiLCJzaGVsbCIsImV2ZW50cyIsImxvZ3MiXX19.dl8m8L0kExz2CCXvDXY65L0F3G7T21Zk5zfK_Ld78owfZrQbtNQW-FSsLtER2PFBwkEAgXgtrxl3kfImrEGLeg", + "expected": { + "alg": "ES256KADR36", + "claims": { + "iss": "akash1qufa3xzrf34qvwyejkhvnc4psf49fftaw0asmh", + "exp": 1760406740, + "iat": 1760404940, + "nbf": 1760404940, + "version": "v1", + "leases": { + "access": "scoped", + "scope": [ + "status", + "shell", + "events", + "logs" + ] + } + } + }, + "mustFail": false + }, + { + "description": "ES256KADR36 - Valid Signature / short", + "tokenString": "eyJhbGciOiJFUzI1NktBRFIzNiIsInR5cCI6IkpXVCJ9.eyJ2ZXJzaW9uIjoiIiwibGVhc2VzIjp7ImFjY2VzcyI6IiJ9fQ.22E6loqRf26cdpE-SqL2g1bN2utaFxNSEo-tFgbr8ZYpewJzy13Oo7xePj_WHgPJh6xpU9iw58TYyf5rEayTeA", + "expected": { + "alg": "ES256KADR36", + "claims": { + "issuer": "bar" + } + }, + "mustFail": false + }, + { + "description": "ES256KADR36 - Invalid Signature", + "tokenString": "eyJhbGciOiJFUzI1NktBUkQzNiIsInR5cCI6IkpXVCJ9.eyJ2ZXJzaW9uIjoiIiwibGVhc2VzIjp7ImFjY2VzcyI6IiJ9fQ.FkLJICFkfXXT9rLZ8MLCKypKoLOoKIjxDIX-cyTiGklh-2sK5T2DTV0e1YVMhwQyeAN4qcgjm1gHSXdbS-xrYQ", + "expected": { + "alg": "ES256KADR36", + "claims": { + "issuer": "bar" + } + }, + "claims": { + "issuer": "bar" + }, + "mustFail": true } ] diff --git a/testdata/jwt/cases_jwt.json.tmpl b/testdata/jwt/cases_jwt.json.tmpl index f625d6fa..d9682b45 100644 --- a/testdata/jwt/cases_jwt.json.tmpl +++ b/testdata/jwt/cases_jwt.json.tmpl @@ -4,6 +4,7 @@ "tokenString": "eyJhbGciOiJFUzI1NksiLCJ0eXAiOiJKV1QifQ.eyJ2ZXJzaW9uIjoiIiwibGVhc2VzIjp7ImFjY2VzcyI6IiJ9fQ.fQFwGyhJDyF9i_zCX6IwJ43_arjs_1qJmxNSph6t8INMMZ7hBvrzwg0Ym8N06G7O_ZDw0mujQCfmOmR1jegnmA", "claims": {}, "expected": { + "alg": "ES256K", "error": "token has invalid claims", "signFail": false, "verifyFail": true @@ -16,6 +17,7 @@ "iss": "{{.Issuer}}" }, "expected": { + "alg": "ES256K", "error": "token has invalid claims", "signFail": false, "verifyFail": true @@ -35,6 +37,7 @@ } }, "expected": { + "alg": "ES256K", "signFail": false, "verifyFail": false }