From 876da9acf1f0170cf5460236367637313e72fea2 Mon Sep 17 00:00:00 2001 From: Artem Chernyshev Date: Wed, 22 Oct 2025 20:12:41 +0300 Subject: [PATCH] feat: add method for revoking public key Add it to the `.proto` definition of the auth service. Signed-off-by: Artem Chernyshev --- api/auth/auth.pb.go | 351 +++++++++++---------------- api/auth/auth.pb.gw.go | 256 ++++++++++---------- api/auth/auth.proto | 5 + api/auth/auth_grpc.pb.go | 74 +++++- api/auth/auth_vtproto.pb.go | 460 +++++++++++++++++++++++++----------- go.mod | 1 + go.sum | 2 + 7 files changed, 666 insertions(+), 483 deletions(-) diff --git a/api/auth/auth.pb.go b/api/auth/auth.pb.go index ab996d5..84560a6 100644 --- a/api/auth/auth.pb.go +++ b/api/auth/auth.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.28.1 -// protoc v3.21.12 +// protoc-gen-go v1.36.10 +// protoc v5.29.4 // source: auth/auth.proto package auth @@ -9,6 +9,7 @@ package auth import ( reflect "reflect" sync "sync" + unsafe "unsafe" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" @@ -23,21 +24,18 @@ const ( ) type PublicKey struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + PgpData []byte `protobuf:"bytes,1,opt,name=pgp_data,json=pgpData,proto3" json:"pgp_data,omitempty"` + WebauthnData []byte `protobuf:"bytes,2,opt,name=webauthn_data,json=webauthnData,proto3" json:"webauthn_data,omitempty"` unknownFields protoimpl.UnknownFields - - PgpData []byte `protobuf:"bytes,1,opt,name=pgp_data,json=pgpData,proto3" json:"pgp_data,omitempty"` - WebauthnData []byte `protobuf:"bytes,2,opt,name=webauthn_data,json=webauthnData,proto3" json:"webauthn_data,omitempty"` + sizeCache protoimpl.SizeCache } func (x *PublicKey) Reset() { *x = PublicKey{} - if protoimpl.UnsafeEnabled { - mi := &file_auth_auth_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_auth_auth_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *PublicKey) String() string { @@ -48,7 +46,7 @@ func (*PublicKey) ProtoMessage() {} func (x *PublicKey) ProtoReflect() protoreflect.Message { mi := &file_auth_auth_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -78,20 +76,17 @@ func (x *PublicKey) GetWebauthnData() []byte { } type Identity struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Email string `protobuf:"bytes,1,opt,name=email,proto3" json:"email,omitempty"` unknownFields protoimpl.UnknownFields - - Email string `protobuf:"bytes,1,opt,name=email,proto3" json:"email,omitempty"` + sizeCache protoimpl.SizeCache } func (x *Identity) Reset() { *x = Identity{} - if protoimpl.UnsafeEnabled { - mi := &file_auth_auth_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_auth_auth_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *Identity) String() string { @@ -102,7 +97,7 @@ func (*Identity) ProtoMessage() {} func (x *Identity) ProtoReflect() protoreflect.Message { mi := &file_auth_auth_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -125,25 +120,22 @@ func (x *Identity) GetEmail() string { } type RegisterPublicKeyRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - PublicKey *PublicKey `protobuf:"bytes,1,opt,name=public_key,json=publicKey,proto3" json:"public_key,omitempty"` - Identity *Identity `protobuf:"bytes,2,opt,name=identity,proto3" json:"identity,omitempty"` + state protoimpl.MessageState `protogen:"open.v1"` + PublicKey *PublicKey `protobuf:"bytes,1,opt,name=public_key,json=publicKey,proto3" json:"public_key,omitempty"` + Identity *Identity `protobuf:"bytes,2,opt,name=identity,proto3" json:"identity,omitempty"` // The role of the public key. When skip_user_role is true, this field is ignored. Role string `protobuf:"bytes,5,opt,name=role,proto3" json:"role,omitempty"` // If true, the role field will be used to determine the role of the public key. - SkipUserRole bool `protobuf:"varint,6,opt,name=skip_user_role,json=skipUserRole,proto3" json:"skip_user_role,omitempty"` + SkipUserRole bool `protobuf:"varint,6,opt,name=skip_user_role,json=skipUserRole,proto3" json:"skip_user_role,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *RegisterPublicKeyRequest) Reset() { *x = RegisterPublicKeyRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_auth_auth_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_auth_auth_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *RegisterPublicKeyRequest) String() string { @@ -154,7 +146,7 @@ func (*RegisterPublicKeyRequest) ProtoMessage() {} func (x *RegisterPublicKeyRequest) ProtoReflect() protoreflect.Message { mi := &file_auth_auth_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -198,21 +190,18 @@ func (x *RegisterPublicKeyRequest) GetSkipUserRole() bool { } type RegisterPublicKeyResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + LoginUrl string `protobuf:"bytes,1,opt,name=login_url,json=loginUrl,proto3" json:"login_url,omitempty"` + PublicKeyId string `protobuf:"bytes,2,opt,name=public_key_id,json=publicKeyId,proto3" json:"public_key_id,omitempty"` unknownFields protoimpl.UnknownFields - - LoginUrl string `protobuf:"bytes,1,opt,name=login_url,json=loginUrl,proto3" json:"login_url,omitempty"` - PublicKeyId string `protobuf:"bytes,2,opt,name=public_key_id,json=publicKeyId,proto3" json:"public_key_id,omitempty"` + sizeCache protoimpl.SizeCache } func (x *RegisterPublicKeyResponse) Reset() { *x = RegisterPublicKeyResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_auth_auth_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_auth_auth_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *RegisterPublicKeyResponse) String() string { @@ -223,7 +212,7 @@ func (*RegisterPublicKeyResponse) ProtoMessage() {} func (x *RegisterPublicKeyResponse) ProtoReflect() protoreflect.Message { mi := &file_auth_auth_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -253,20 +242,17 @@ func (x *RegisterPublicKeyResponse) GetPublicKeyId() string { } type AwaitPublicKeyConfirmationRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + PublicKeyId string `protobuf:"bytes,1,opt,name=public_key_id,json=publicKeyId,proto3" json:"public_key_id,omitempty"` unknownFields protoimpl.UnknownFields - - PublicKeyId string `protobuf:"bytes,1,opt,name=public_key_id,json=publicKeyId,proto3" json:"public_key_id,omitempty"` + sizeCache protoimpl.SizeCache } func (x *AwaitPublicKeyConfirmationRequest) Reset() { *x = AwaitPublicKeyConfirmationRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_auth_auth_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_auth_auth_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *AwaitPublicKeyConfirmationRequest) String() string { @@ -277,7 +263,7 @@ func (*AwaitPublicKeyConfirmationRequest) ProtoMessage() {} func (x *AwaitPublicKeyConfirmationRequest) ProtoReflect() protoreflect.Message { mi := &file_auth_auth_proto_msgTypes[4] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -300,20 +286,17 @@ func (x *AwaitPublicKeyConfirmationRequest) GetPublicKeyId() string { } type ConfirmPublicKeyRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + PublicKeyId string `protobuf:"bytes,1,opt,name=public_key_id,json=publicKeyId,proto3" json:"public_key_id,omitempty"` unknownFields protoimpl.UnknownFields - - PublicKeyId string `protobuf:"bytes,1,opt,name=public_key_id,json=publicKeyId,proto3" json:"public_key_id,omitempty"` + sizeCache protoimpl.SizeCache } func (x *ConfirmPublicKeyRequest) Reset() { *x = ConfirmPublicKeyRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_auth_auth_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_auth_auth_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *ConfirmPublicKeyRequest) String() string { @@ -324,7 +307,7 @@ func (*ConfirmPublicKeyRequest) ProtoMessage() {} func (x *ConfirmPublicKeyRequest) ProtoReflect() protoreflect.Message { mi := &file_auth_auth_proto_msgTypes[5] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -346,90 +329,103 @@ func (x *ConfirmPublicKeyRequest) GetPublicKeyId() string { return "" } -var File_auth_auth_proto protoreflect.FileDescriptor +type RevokePublicKeyRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + PublicKeyId string `protobuf:"bytes,1,opt,name=public_key_id,json=publicKeyId,proto3" json:"public_key_id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *RevokePublicKeyRequest) Reset() { + *x = RevokePublicKeyRequest{} + mi := &file_auth_auth_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *RevokePublicKeyRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RevokePublicKeyRequest) ProtoMessage() {} + +func (x *RevokePublicKeyRequest) ProtoReflect() protoreflect.Message { + mi := &file_auth_auth_proto_msgTypes[6] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RevokePublicKeyRequest.ProtoReflect.Descriptor instead. +func (*RevokePublicKeyRequest) Descriptor() ([]byte, []int) { + return file_auth_auth_proto_rawDescGZIP(), []int{6} +} -var file_auth_auth_proto_rawDesc = []byte{ - 0x0a, 0x0f, 0x61, 0x75, 0x74, 0x68, 0x2f, 0x61, 0x75, 0x74, 0x68, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x12, 0x04, 0x61, 0x75, 0x74, 0x68, 0x1a, 0x1b, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x4b, 0x0a, 0x09, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, - 0x79, 0x12, 0x19, 0x0a, 0x08, 0x70, 0x67, 0x70, 0x5f, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x0c, 0x52, 0x07, 0x70, 0x67, 0x70, 0x44, 0x61, 0x74, 0x61, 0x12, 0x23, 0x0a, 0x0d, - 0x77, 0x65, 0x62, 0x61, 0x75, 0x74, 0x68, 0x6e, 0x5f, 0x64, 0x61, 0x74, 0x61, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x0c, 0x52, 0x0c, 0x77, 0x65, 0x62, 0x61, 0x75, 0x74, 0x68, 0x6e, 0x44, 0x61, 0x74, - 0x61, 0x22, 0x20, 0x0a, 0x08, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x12, 0x14, 0x0a, - 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x6d, - 0x61, 0x69, 0x6c, 0x22, 0xbc, 0x01, 0x0a, 0x18, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, - 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x12, 0x2e, 0x0a, 0x0a, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x2e, 0x50, 0x75, 0x62, 0x6c, - 0x69, 0x63, 0x4b, 0x65, 0x79, 0x52, 0x09, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, - 0x12, 0x2a, 0x0a, 0x08, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x2e, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, - 0x74, 0x79, 0x52, 0x08, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x12, 0x12, 0x0a, 0x04, - 0x72, 0x6f, 0x6c, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x72, 0x6f, 0x6c, 0x65, - 0x12, 0x24, 0x0a, 0x0e, 0x73, 0x6b, 0x69, 0x70, 0x5f, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x72, 0x6f, - 0x6c, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0c, 0x73, 0x6b, 0x69, 0x70, 0x55, 0x73, - 0x65, 0x72, 0x52, 0x6f, 0x6c, 0x65, 0x4a, 0x04, 0x08, 0x03, 0x10, 0x04, 0x4a, 0x04, 0x08, 0x04, - 0x10, 0x05, 0x22, 0x5c, 0x0a, 0x19, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x50, 0x75, - 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, - 0x1b, 0x0a, 0x09, 0x6c, 0x6f, 0x67, 0x69, 0x6e, 0x5f, 0x75, 0x72, 0x6c, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x08, 0x6c, 0x6f, 0x67, 0x69, 0x6e, 0x55, 0x72, 0x6c, 0x12, 0x22, 0x0a, 0x0d, - 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x5f, 0x6b, 0x65, 0x79, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x0b, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x49, 0x64, - 0x22, 0x47, 0x0a, 0x21, 0x41, 0x77, 0x61, 0x69, 0x74, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, - 0x65, 0x79, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x72, 0x6d, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x22, 0x0a, 0x0d, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x5f, - 0x6b, 0x65, 0x79, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x70, 0x75, - 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x49, 0x64, 0x22, 0x3d, 0x0a, 0x17, 0x43, 0x6f, 0x6e, - 0x66, 0x69, 0x72, 0x6d, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x12, 0x22, 0x0a, 0x0d, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x5f, 0x6b, - 0x65, 0x79, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x70, 0x75, 0x62, - 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x49, 0x64, 0x32, 0x8d, 0x02, 0x0a, 0x0b, 0x41, 0x75, 0x74, - 0x68, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x54, 0x0a, 0x11, 0x52, 0x65, 0x67, 0x69, - 0x73, 0x74, 0x65, 0x72, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x12, 0x1e, 0x2e, - 0x61, 0x75, 0x74, 0x68, 0x2e, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x50, 0x75, 0x62, - 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1f, 0x2e, - 0x61, 0x75, 0x74, 0x68, 0x2e, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x50, 0x75, 0x62, - 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x5d, - 0x0a, 0x1a, 0x41, 0x77, 0x61, 0x69, 0x74, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, - 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x72, 0x6d, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x27, 0x2e, 0x61, - 0x75, 0x74, 0x68, 0x2e, 0x41, 0x77, 0x61, 0x69, 0x74, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, - 0x65, 0x79, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x72, 0x6d, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12, 0x49, 0x0a, - 0x10, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x72, 0x6d, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, - 0x79, 0x12, 0x1d, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x2e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x72, 0x6d, - 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, - 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x42, 0x31, 0x5a, 0x2f, 0x67, 0x69, 0x74, 0x68, - 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x73, 0x69, 0x64, 0x65, 0x72, 0x6f, 0x6c, 0x61, 0x62, - 0x73, 0x2f, 0x67, 0x6f, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, - 0x72, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x75, 0x74, 0x68, 0x62, 0x06, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x33, +func (x *RevokePublicKeyRequest) GetPublicKeyId() string { + if x != nil { + return x.PublicKeyId + } + return "" } +var File_auth_auth_proto protoreflect.FileDescriptor + +const file_auth_auth_proto_rawDesc = "" + + "\n" + + "\x0fauth/auth.proto\x12\x04auth\x1a\x1bgoogle/protobuf/empty.proto\"K\n" + + "\tPublicKey\x12\x19\n" + + "\bpgp_data\x18\x01 \x01(\fR\apgpData\x12#\n" + + "\rwebauthn_data\x18\x02 \x01(\fR\fwebauthnData\" \n" + + "\bIdentity\x12\x14\n" + + "\x05email\x18\x01 \x01(\tR\x05email\"\xbc\x01\n" + + "\x18RegisterPublicKeyRequest\x12.\n" + + "\n" + + "public_key\x18\x01 \x01(\v2\x0f.auth.PublicKeyR\tpublicKey\x12*\n" + + "\bidentity\x18\x02 \x01(\v2\x0e.auth.IdentityR\bidentity\x12\x12\n" + + "\x04role\x18\x05 \x01(\tR\x04role\x12$\n" + + "\x0eskip_user_role\x18\x06 \x01(\bR\fskipUserRoleJ\x04\b\x03\x10\x04J\x04\b\x04\x10\x05\"\\\n" + + "\x19RegisterPublicKeyResponse\x12\x1b\n" + + "\tlogin_url\x18\x01 \x01(\tR\bloginUrl\x12\"\n" + + "\rpublic_key_id\x18\x02 \x01(\tR\vpublicKeyId\"G\n" + + "!AwaitPublicKeyConfirmationRequest\x12\"\n" + + "\rpublic_key_id\x18\x01 \x01(\tR\vpublicKeyId\"=\n" + + "\x17ConfirmPublicKeyRequest\x12\"\n" + + "\rpublic_key_id\x18\x01 \x01(\tR\vpublicKeyId\"<\n" + + "\x16RevokePublicKeyRequest\x12\"\n" + + "\rpublic_key_id\x18\x01 \x01(\tR\vpublicKeyId2\xd6\x02\n" + + "\vAuthService\x12T\n" + + "\x11RegisterPublicKey\x12\x1e.auth.RegisterPublicKeyRequest\x1a\x1f.auth.RegisterPublicKeyResponse\x12]\n" + + "\x1aAwaitPublicKeyConfirmation\x12'.auth.AwaitPublicKeyConfirmationRequest\x1a\x16.google.protobuf.Empty\x12I\n" + + "\x10ConfirmPublicKey\x12\x1d.auth.ConfirmPublicKeyRequest\x1a\x16.google.protobuf.Empty\x12G\n" + + "\x0fRevokePublicKey\x12\x1c.auth.RevokePublicKeyRequest\x1a\x16.google.protobuf.EmptyB1Z/github.com/siderolabs/go-api-signature/api/authb\x06proto3" + var ( file_auth_auth_proto_rawDescOnce sync.Once - file_auth_auth_proto_rawDescData = file_auth_auth_proto_rawDesc + file_auth_auth_proto_rawDescData []byte ) func file_auth_auth_proto_rawDescGZIP() []byte { file_auth_auth_proto_rawDescOnce.Do(func() { - file_auth_auth_proto_rawDescData = protoimpl.X.CompressGZIP(file_auth_auth_proto_rawDescData) + file_auth_auth_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_auth_auth_proto_rawDesc), len(file_auth_auth_proto_rawDesc))) }) return file_auth_auth_proto_rawDescData } -var file_auth_auth_proto_msgTypes = make([]protoimpl.MessageInfo, 6) -var file_auth_auth_proto_goTypes = []interface{}{ +var file_auth_auth_proto_msgTypes = make([]protoimpl.MessageInfo, 7) +var file_auth_auth_proto_goTypes = []any{ (*PublicKey)(nil), // 0: auth.PublicKey (*Identity)(nil), // 1: auth.Identity (*RegisterPublicKeyRequest)(nil), // 2: auth.RegisterPublicKeyRequest (*RegisterPublicKeyResponse)(nil), // 3: auth.RegisterPublicKeyResponse (*AwaitPublicKeyConfirmationRequest)(nil), // 4: auth.AwaitPublicKeyConfirmationRequest (*ConfirmPublicKeyRequest)(nil), // 5: auth.ConfirmPublicKeyRequest - (*emptypb.Empty)(nil), // 6: google.protobuf.Empty + (*RevokePublicKeyRequest)(nil), // 6: auth.RevokePublicKeyRequest + (*emptypb.Empty)(nil), // 7: google.protobuf.Empty } var file_auth_auth_proto_depIdxs = []int32{ 0, // 0: auth.RegisterPublicKeyRequest.public_key:type_name -> auth.PublicKey @@ -437,11 +433,13 @@ var file_auth_auth_proto_depIdxs = []int32{ 2, // 2: auth.AuthService.RegisterPublicKey:input_type -> auth.RegisterPublicKeyRequest 4, // 3: auth.AuthService.AwaitPublicKeyConfirmation:input_type -> auth.AwaitPublicKeyConfirmationRequest 5, // 4: auth.AuthService.ConfirmPublicKey:input_type -> auth.ConfirmPublicKeyRequest - 3, // 5: auth.AuthService.RegisterPublicKey:output_type -> auth.RegisterPublicKeyResponse - 6, // 6: auth.AuthService.AwaitPublicKeyConfirmation:output_type -> google.protobuf.Empty - 6, // 7: auth.AuthService.ConfirmPublicKey:output_type -> google.protobuf.Empty - 5, // [5:8] is the sub-list for method output_type - 2, // [2:5] is the sub-list for method input_type + 6, // 5: auth.AuthService.RevokePublicKey:input_type -> auth.RevokePublicKeyRequest + 3, // 6: auth.AuthService.RegisterPublicKey:output_type -> auth.RegisterPublicKeyResponse + 7, // 7: auth.AuthService.AwaitPublicKeyConfirmation:output_type -> google.protobuf.Empty + 7, // 8: auth.AuthService.ConfirmPublicKey:output_type -> google.protobuf.Empty + 7, // 9: auth.AuthService.RevokePublicKey:output_type -> google.protobuf.Empty + 6, // [6:10] is the sub-list for method output_type + 2, // [2:6] is the sub-list for method input_type 2, // [2:2] is the sub-list for extension type_name 2, // [2:2] is the sub-list for extension extendee 0, // [0:2] is the sub-list for field type_name @@ -452,87 +450,13 @@ func file_auth_auth_proto_init() { if File_auth_auth_proto != nil { return } - if !protoimpl.UnsafeEnabled { - file_auth_auth_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PublicKey); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_auth_auth_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Identity); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_auth_auth_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*RegisterPublicKeyRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_auth_auth_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*RegisterPublicKeyResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_auth_auth_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AwaitPublicKeyConfirmationRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_auth_auth_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ConfirmPublicKeyRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_auth_auth_proto_rawDesc, + RawDescriptor: unsafe.Slice(unsafe.StringData(file_auth_auth_proto_rawDesc), len(file_auth_auth_proto_rawDesc)), NumEnums: 0, - NumMessages: 6, + NumMessages: 7, NumExtensions: 0, NumServices: 1, }, @@ -541,7 +465,6 @@ func file_auth_auth_proto_init() { MessageInfos: file_auth_auth_proto_msgTypes, }.Build() File_auth_auth_proto = out.File - file_auth_auth_proto_rawDesc = nil file_auth_auth_proto_goTypes = nil file_auth_auth_proto_depIdxs = nil } diff --git a/api/auth/auth.pb.gw.go b/api/auth/auth.pb.gw.go index a4ea60a..aec8efe 100644 --- a/api/auth/auth.pb.gw.go +++ b/api/auth/auth.pb.gw.go @@ -10,6 +10,7 @@ package auth import ( "context" + "errors" "io" "net/http" @@ -24,130 +25,137 @@ import ( ) // Suppress "imported and not used" errors -var _ codes.Code -var _ io.Reader -var _ status.Status -var _ = runtime.String -var _ = utilities.NewDoubleArray -var _ = metadata.Join +var ( + _ codes.Code + _ io.Reader + _ status.Status + _ = errors.New + _ = runtime.String + _ = utilities.NewDoubleArray + _ = metadata.Join +) func request_AuthService_RegisterPublicKey_0(ctx context.Context, marshaler runtime.Marshaler, client AuthServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq RegisterPublicKeyRequest - var metadata runtime.ServerMetadata - - newReader, berr := utilities.IOReaderFactory(req.Body) - if berr != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) - } - if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + var ( + protoReq RegisterPublicKeyRequest + metadata runtime.ServerMetadata + ) + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - + if req.Body != nil { + _, _ = io.Copy(io.Discard, req.Body) + } msg, err := client.RegisterPublicKey(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err - } func local_request_AuthService_RegisterPublicKey_0(ctx context.Context, marshaler runtime.Marshaler, server AuthServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq RegisterPublicKeyRequest - var metadata runtime.ServerMetadata - - newReader, berr := utilities.IOReaderFactory(req.Body) - if berr != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) - } - if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + var ( + protoReq RegisterPublicKeyRequest + metadata runtime.ServerMetadata + ) + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - msg, err := server.RegisterPublicKey(ctx, &protoReq) return msg, metadata, err - } func request_AuthService_AwaitPublicKeyConfirmation_0(ctx context.Context, marshaler runtime.Marshaler, client AuthServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq AwaitPublicKeyConfirmationRequest - var metadata runtime.ServerMetadata - - newReader, berr := utilities.IOReaderFactory(req.Body) - if berr != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) - } - if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + var ( + protoReq AwaitPublicKeyConfirmationRequest + metadata runtime.ServerMetadata + ) + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - + if req.Body != nil { + _, _ = io.Copy(io.Discard, req.Body) + } msg, err := client.AwaitPublicKeyConfirmation(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err - } func local_request_AuthService_AwaitPublicKeyConfirmation_0(ctx context.Context, marshaler runtime.Marshaler, server AuthServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq AwaitPublicKeyConfirmationRequest - var metadata runtime.ServerMetadata - - newReader, berr := utilities.IOReaderFactory(req.Body) - if berr != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) - } - if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + var ( + protoReq AwaitPublicKeyConfirmationRequest + metadata runtime.ServerMetadata + ) + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - msg, err := server.AwaitPublicKeyConfirmation(ctx, &protoReq) return msg, metadata, err - } func request_AuthService_ConfirmPublicKey_0(ctx context.Context, marshaler runtime.Marshaler, client AuthServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq ConfirmPublicKeyRequest - var metadata runtime.ServerMetadata - - newReader, berr := utilities.IOReaderFactory(req.Body) - if berr != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) - } - if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + var ( + protoReq ConfirmPublicKeyRequest + metadata runtime.ServerMetadata + ) + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - + if req.Body != nil { + _, _ = io.Copy(io.Discard, req.Body) + } msg, err := client.ConfirmPublicKey(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err - } func local_request_AuthService_ConfirmPublicKey_0(ctx context.Context, marshaler runtime.Marshaler, server AuthServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq ConfirmPublicKeyRequest - var metadata runtime.ServerMetadata - - newReader, berr := utilities.IOReaderFactory(req.Body) - if berr != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) - } - if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + var ( + protoReq ConfirmPublicKeyRequest + metadata runtime.ServerMetadata + ) + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - msg, err := server.ConfirmPublicKey(ctx, &protoReq) return msg, metadata, err +} +func request_AuthService_RevokePublicKey_0(ctx context.Context, marshaler runtime.Marshaler, client AuthServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var ( + protoReq RevokePublicKeyRequest + metadata runtime.ServerMetadata + ) + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if req.Body != nil { + _, _ = io.Copy(io.Discard, req.Body) + } + msg, err := client.RevokePublicKey(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err +} + +func local_request_AuthService_RevokePublicKey_0(ctx context.Context, marshaler runtime.Marshaler, server AuthServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var ( + protoReq RevokePublicKeyRequest + metadata runtime.ServerMetadata + ) + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + msg, err := server.RevokePublicKey(ctx, &protoReq) + return msg, metadata, err } // RegisterAuthServiceHandlerServer registers the http handlers for service AuthService to "mux". // UnaryRPC :call AuthServiceServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. // Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterAuthServiceHandlerFromEndpoint instead. +// GRPC interceptors will not work for this type of registration. To use interceptors, you must use the "runtime.WithMiddlewares" option in the "runtime.NewServeMux" call. func RegisterAuthServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server AuthServiceServer) error { - - mux.Handle("POST", pattern_AuthService_RegisterPublicKey_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle(http.MethodPost, pattern_AuthService_RegisterPublicKey_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - var err error - var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/auth.AuthService/RegisterPublicKey", runtime.WithHTTPPathPattern("/auth.AuthService/RegisterPublicKey")) + annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/auth.AuthService/RegisterPublicKey", runtime.WithHTTPPathPattern("/auth.AuthService/RegisterPublicKey")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -159,20 +167,15 @@ func RegisterAuthServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } - forward_AuthService_RegisterPublicKey_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) - - mux.Handle("POST", pattern_AuthService_AwaitPublicKeyConfirmation_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle(http.MethodPost, pattern_AuthService_AwaitPublicKeyConfirmation_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - var err error - var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/auth.AuthService/AwaitPublicKeyConfirmation", runtime.WithHTTPPathPattern("/auth.AuthService/AwaitPublicKeyConfirmation")) + annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/auth.AuthService/AwaitPublicKeyConfirmation", runtime.WithHTTPPathPattern("/auth.AuthService/AwaitPublicKeyConfirmation")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -184,20 +187,15 @@ func RegisterAuthServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } - forward_AuthService_AwaitPublicKeyConfirmation_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) - - mux.Handle("POST", pattern_AuthService_ConfirmPublicKey_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle(http.MethodPost, pattern_AuthService_ConfirmPublicKey_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - var err error - var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/auth.AuthService/ConfirmPublicKey", runtime.WithHTTPPathPattern("/auth.AuthService/ConfirmPublicKey")) + annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/auth.AuthService/ConfirmPublicKey", runtime.WithHTTPPathPattern("/auth.AuthService/ConfirmPublicKey")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -209,9 +207,27 @@ func RegisterAuthServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } - forward_AuthService_ConfirmPublicKey_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - + }) + mux.Handle(http.MethodPost, pattern_AuthService_RevokePublicKey_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/auth.AuthService/RevokePublicKey", runtime.WithHTTPPathPattern("/auth.AuthService/RevokePublicKey")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_AuthService_RevokePublicKey_0(annotatedContext, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + forward_AuthService_RevokePublicKey_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) return nil @@ -220,25 +236,24 @@ func RegisterAuthServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux // RegisterAuthServiceHandlerFromEndpoint is same as RegisterAuthServiceHandler but // automatically dials to "endpoint" and closes the connection when "ctx" gets done. func RegisterAuthServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { - conn, err := grpc.DialContext(ctx, endpoint, opts...) + conn, err := grpc.NewClient(endpoint, opts...) if err != nil { return err } defer func() { if err != nil { if cerr := conn.Close(); cerr != nil { - grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr) } return } go func() { <-ctx.Done() if cerr := conn.Close(); cerr != nil { - grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr) } }() }() - return RegisterAuthServiceHandler(ctx, mux, conn) } @@ -252,16 +267,13 @@ func RegisterAuthServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn // to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "AuthServiceClient". // Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "AuthServiceClient" // doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in -// "AuthServiceClient" to call the correct interceptors. +// "AuthServiceClient" to call the correct interceptors. This client ignores the HTTP middlewares. func RegisterAuthServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client AuthServiceClient) error { - - mux.Handle("POST", pattern_AuthService_RegisterPublicKey_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle(http.MethodPost, pattern_AuthService_RegisterPublicKey_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - var err error - var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/auth.AuthService/RegisterPublicKey", runtime.WithHTTPPathPattern("/auth.AuthService/RegisterPublicKey")) + annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/auth.AuthService/RegisterPublicKey", runtime.WithHTTPPathPattern("/auth.AuthService/RegisterPublicKey")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -272,18 +284,13 @@ func RegisterAuthServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } - forward_AuthService_RegisterPublicKey_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) - - mux.Handle("POST", pattern_AuthService_AwaitPublicKeyConfirmation_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle(http.MethodPost, pattern_AuthService_AwaitPublicKeyConfirmation_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - var err error - var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/auth.AuthService/AwaitPublicKeyConfirmation", runtime.WithHTTPPathPattern("/auth.AuthService/AwaitPublicKeyConfirmation")) + annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/auth.AuthService/AwaitPublicKeyConfirmation", runtime.WithHTTPPathPattern("/auth.AuthService/AwaitPublicKeyConfirmation")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -294,18 +301,13 @@ func RegisterAuthServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } - forward_AuthService_AwaitPublicKeyConfirmation_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) - - mux.Handle("POST", pattern_AuthService_ConfirmPublicKey_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle(http.MethodPost, pattern_AuthService_ConfirmPublicKey_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - var err error - var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/auth.AuthService/ConfirmPublicKey", runtime.WithHTTPPathPattern("/auth.AuthService/ConfirmPublicKey")) + annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/auth.AuthService/ConfirmPublicKey", runtime.WithHTTPPathPattern("/auth.AuthService/ConfirmPublicKey")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -316,26 +318,38 @@ func RegisterAuthServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } - forward_AuthService_ConfirmPublicKey_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) - + mux.Handle(http.MethodPost, pattern_AuthService_RevokePublicKey_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/auth.AuthService/RevokePublicKey", runtime.WithHTTPPathPattern("/auth.AuthService/RevokePublicKey")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_AuthService_RevokePublicKey_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + forward_AuthService_RevokePublicKey_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) return nil } var ( - pattern_AuthService_RegisterPublicKey_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"auth.AuthService", "RegisterPublicKey"}, "")) - + pattern_AuthService_RegisterPublicKey_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"auth.AuthService", "RegisterPublicKey"}, "")) pattern_AuthService_AwaitPublicKeyConfirmation_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"auth.AuthService", "AwaitPublicKeyConfirmation"}, "")) - - pattern_AuthService_ConfirmPublicKey_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"auth.AuthService", "ConfirmPublicKey"}, "")) + pattern_AuthService_ConfirmPublicKey_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"auth.AuthService", "ConfirmPublicKey"}, "")) + pattern_AuthService_RevokePublicKey_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"auth.AuthService", "RevokePublicKey"}, "")) ) var ( - forward_AuthService_RegisterPublicKey_0 = runtime.ForwardResponseMessage - + forward_AuthService_RegisterPublicKey_0 = runtime.ForwardResponseMessage forward_AuthService_AwaitPublicKeyConfirmation_0 = runtime.ForwardResponseMessage - - forward_AuthService_ConfirmPublicKey_0 = runtime.ForwardResponseMessage + forward_AuthService_ConfirmPublicKey_0 = runtime.ForwardResponseMessage + forward_AuthService_RevokePublicKey_0 = runtime.ForwardResponseMessage ) diff --git a/api/auth/auth.proto b/api/auth/auth.proto index 35735d2..a6b00bb 100644 --- a/api/auth/auth.proto +++ b/api/auth/auth.proto @@ -38,8 +38,13 @@ message ConfirmPublicKeyRequest { string public_key_id = 1; } +message RevokePublicKeyRequest { + string public_key_id = 1; +} + service AuthService { rpc RegisterPublicKey(RegisterPublicKeyRequest) returns (RegisterPublicKeyResponse); rpc AwaitPublicKeyConfirmation(AwaitPublicKeyConfirmationRequest) returns (google.protobuf.Empty); rpc ConfirmPublicKey(ConfirmPublicKeyRequest) returns (google.protobuf.Empty); + rpc RevokePublicKey(RevokePublicKeyRequest) returns (google.protobuf.Empty); } diff --git a/api/auth/auth_grpc.pb.go b/api/auth/auth_grpc.pb.go index 58889a4..84f55ca 100644 --- a/api/auth/auth_grpc.pb.go +++ b/api/auth/auth_grpc.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.3.0 -// - protoc v3.21.12 +// - protoc-gen-go-grpc v1.5.1 +// - protoc v5.29.4 // source: auth/auth.proto package auth @@ -17,13 +17,14 @@ import ( // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. -// Requires gRPC-Go v1.32.0 or later. -const _ = grpc.SupportPackageIsVersion7 +// Requires gRPC-Go v1.64.0 or later. +const _ = grpc.SupportPackageIsVersion9 const ( AuthService_RegisterPublicKey_FullMethodName = "/auth.AuthService/RegisterPublicKey" AuthService_AwaitPublicKeyConfirmation_FullMethodName = "/auth.AuthService/AwaitPublicKeyConfirmation" AuthService_ConfirmPublicKey_FullMethodName = "/auth.AuthService/ConfirmPublicKey" + AuthService_RevokePublicKey_FullMethodName = "/auth.AuthService/RevokePublicKey" ) // AuthServiceClient is the client API for AuthService service. @@ -33,6 +34,7 @@ type AuthServiceClient interface { RegisterPublicKey(ctx context.Context, in *RegisterPublicKeyRequest, opts ...grpc.CallOption) (*RegisterPublicKeyResponse, error) AwaitPublicKeyConfirmation(ctx context.Context, in *AwaitPublicKeyConfirmationRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) ConfirmPublicKey(ctx context.Context, in *ConfirmPublicKeyRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) + RevokePublicKey(ctx context.Context, in *RevokePublicKeyRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) } type authServiceClient struct { @@ -44,8 +46,9 @@ func NewAuthServiceClient(cc grpc.ClientConnInterface) AuthServiceClient { } func (c *authServiceClient) RegisterPublicKey(ctx context.Context, in *RegisterPublicKeyRequest, opts ...grpc.CallOption) (*RegisterPublicKeyResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(RegisterPublicKeyResponse) - err := c.cc.Invoke(ctx, AuthService_RegisterPublicKey_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, AuthService_RegisterPublicKey_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } @@ -53,8 +56,9 @@ func (c *authServiceClient) RegisterPublicKey(ctx context.Context, in *RegisterP } func (c *authServiceClient) AwaitPublicKeyConfirmation(ctx context.Context, in *AwaitPublicKeyConfirmationRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(emptypb.Empty) - err := c.cc.Invoke(ctx, AuthService_AwaitPublicKeyConfirmation_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, AuthService_AwaitPublicKeyConfirmation_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } @@ -62,8 +66,19 @@ func (c *authServiceClient) AwaitPublicKeyConfirmation(ctx context.Context, in * } func (c *authServiceClient) ConfirmPublicKey(ctx context.Context, in *ConfirmPublicKeyRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(emptypb.Empty) - err := c.cc.Invoke(ctx, AuthService_ConfirmPublicKey_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, AuthService_ConfirmPublicKey_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *authServiceClient) RevokePublicKey(ctx context.Context, in *RevokePublicKeyRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(emptypb.Empty) + err := c.cc.Invoke(ctx, AuthService_RevokePublicKey_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } @@ -72,17 +87,21 @@ func (c *authServiceClient) ConfirmPublicKey(ctx context.Context, in *ConfirmPub // AuthServiceServer is the server API for AuthService service. // All implementations must embed UnimplementedAuthServiceServer -// for forward compatibility +// for forward compatibility. type AuthServiceServer interface { RegisterPublicKey(context.Context, *RegisterPublicKeyRequest) (*RegisterPublicKeyResponse, error) AwaitPublicKeyConfirmation(context.Context, *AwaitPublicKeyConfirmationRequest) (*emptypb.Empty, error) ConfirmPublicKey(context.Context, *ConfirmPublicKeyRequest) (*emptypb.Empty, error) + RevokePublicKey(context.Context, *RevokePublicKeyRequest) (*emptypb.Empty, error) mustEmbedUnimplementedAuthServiceServer() } -// UnimplementedAuthServiceServer must be embedded to have forward compatible implementations. -type UnimplementedAuthServiceServer struct { -} +// UnimplementedAuthServiceServer must be embedded to have +// forward compatible implementations. +// +// NOTE: this should be embedded by value instead of pointer to avoid a nil +// pointer dereference when methods are called. +type UnimplementedAuthServiceServer struct{} func (UnimplementedAuthServiceServer) RegisterPublicKey(context.Context, *RegisterPublicKeyRequest) (*RegisterPublicKeyResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method RegisterPublicKey not implemented") @@ -93,7 +112,11 @@ func (UnimplementedAuthServiceServer) AwaitPublicKeyConfirmation(context.Context func (UnimplementedAuthServiceServer) ConfirmPublicKey(context.Context, *ConfirmPublicKeyRequest) (*emptypb.Empty, error) { return nil, status.Errorf(codes.Unimplemented, "method ConfirmPublicKey not implemented") } +func (UnimplementedAuthServiceServer) RevokePublicKey(context.Context, *RevokePublicKeyRequest) (*emptypb.Empty, error) { + return nil, status.Errorf(codes.Unimplemented, "method RevokePublicKey not implemented") +} func (UnimplementedAuthServiceServer) mustEmbedUnimplementedAuthServiceServer() {} +func (UnimplementedAuthServiceServer) testEmbeddedByValue() {} // UnsafeAuthServiceServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to AuthServiceServer will @@ -103,6 +126,13 @@ type UnsafeAuthServiceServer interface { } func RegisterAuthServiceServer(s grpc.ServiceRegistrar, srv AuthServiceServer) { + // If the following call pancis, it indicates UnimplementedAuthServiceServer was + // embedded by pointer and is nil. This will cause panics if an + // unimplemented method is ever invoked, so we test this at initialization + // time to prevent it from happening at runtime later due to I/O. + if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { + t.testEmbeddedByValue() + } s.RegisterService(&AuthService_ServiceDesc, srv) } @@ -160,6 +190,24 @@ func _AuthService_ConfirmPublicKey_Handler(srv interface{}, ctx context.Context, return interceptor(ctx, in, info, handler) } +func _AuthService_RevokePublicKey_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(RevokePublicKeyRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AuthServiceServer).RevokePublicKey(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: AuthService_RevokePublicKey_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AuthServiceServer).RevokePublicKey(ctx, req.(*RevokePublicKeyRequest)) + } + return interceptor(ctx, in, info, handler) +} + // AuthService_ServiceDesc is the grpc.ServiceDesc for AuthService service. // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) @@ -179,6 +227,10 @@ var AuthService_ServiceDesc = grpc.ServiceDesc{ MethodName: "ConfirmPublicKey", Handler: _AuthService_ConfirmPublicKey_Handler, }, + { + MethodName: "RevokePublicKey", + Handler: _AuthService_RevokePublicKey_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "auth/auth.proto", diff --git a/api/auth/auth_vtproto.pb.go b/api/auth/auth_vtproto.pb.go index 6307da1..145d263 100644 --- a/api/auth/auth_vtproto.pb.go +++ b/api/auth/auth_vtproto.pb.go @@ -1,5 +1,5 @@ // Code generated by protoc-gen-go-vtproto. DO NOT EDIT. -// protoc-gen-go-vtproto version: v0.4.0 +// protoc-gen-go-vtproto version: v0.6.0 // source: auth/auth.proto package auth @@ -7,8 +7,8 @@ package auth import ( fmt "fmt" io "io" - bits "math/bits" + protohelpers "github.com/planetscale/vtprotobuf/protohelpers" proto "google.golang.org/protobuf/proto" protoimpl "google.golang.org/protobuf/runtime/protoimpl" ) @@ -20,6 +20,138 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) +func (m *PublicKey) CloneVT() *PublicKey { + if m == nil { + return (*PublicKey)(nil) + } + r := new(PublicKey) + if rhs := m.PgpData; rhs != nil { + tmpBytes := make([]byte, len(rhs)) + copy(tmpBytes, rhs) + r.PgpData = tmpBytes + } + if rhs := m.WebauthnData; rhs != nil { + tmpBytes := make([]byte, len(rhs)) + copy(tmpBytes, rhs) + r.WebauthnData = tmpBytes + } + if len(m.unknownFields) > 0 { + r.unknownFields = make([]byte, len(m.unknownFields)) + copy(r.unknownFields, m.unknownFields) + } + return r +} + +func (m *PublicKey) CloneMessageVT() proto.Message { + return m.CloneVT() +} + +func (m *Identity) CloneVT() *Identity { + if m == nil { + return (*Identity)(nil) + } + r := new(Identity) + r.Email = m.Email + if len(m.unknownFields) > 0 { + r.unknownFields = make([]byte, len(m.unknownFields)) + copy(r.unknownFields, m.unknownFields) + } + return r +} + +func (m *Identity) CloneMessageVT() proto.Message { + return m.CloneVT() +} + +func (m *RegisterPublicKeyRequest) CloneVT() *RegisterPublicKeyRequest { + if m == nil { + return (*RegisterPublicKeyRequest)(nil) + } + r := new(RegisterPublicKeyRequest) + r.PublicKey = m.PublicKey.CloneVT() + r.Identity = m.Identity.CloneVT() + r.Role = m.Role + r.SkipUserRole = m.SkipUserRole + if len(m.unknownFields) > 0 { + r.unknownFields = make([]byte, len(m.unknownFields)) + copy(r.unknownFields, m.unknownFields) + } + return r +} + +func (m *RegisterPublicKeyRequest) CloneMessageVT() proto.Message { + return m.CloneVT() +} + +func (m *RegisterPublicKeyResponse) CloneVT() *RegisterPublicKeyResponse { + if m == nil { + return (*RegisterPublicKeyResponse)(nil) + } + r := new(RegisterPublicKeyResponse) + r.LoginUrl = m.LoginUrl + r.PublicKeyId = m.PublicKeyId + if len(m.unknownFields) > 0 { + r.unknownFields = make([]byte, len(m.unknownFields)) + copy(r.unknownFields, m.unknownFields) + } + return r +} + +func (m *RegisterPublicKeyResponse) CloneMessageVT() proto.Message { + return m.CloneVT() +} + +func (m *AwaitPublicKeyConfirmationRequest) CloneVT() *AwaitPublicKeyConfirmationRequest { + if m == nil { + return (*AwaitPublicKeyConfirmationRequest)(nil) + } + r := new(AwaitPublicKeyConfirmationRequest) + r.PublicKeyId = m.PublicKeyId + if len(m.unknownFields) > 0 { + r.unknownFields = make([]byte, len(m.unknownFields)) + copy(r.unknownFields, m.unknownFields) + } + return r +} + +func (m *AwaitPublicKeyConfirmationRequest) CloneMessageVT() proto.Message { + return m.CloneVT() +} + +func (m *ConfirmPublicKeyRequest) CloneVT() *ConfirmPublicKeyRequest { + if m == nil { + return (*ConfirmPublicKeyRequest)(nil) + } + r := new(ConfirmPublicKeyRequest) + r.PublicKeyId = m.PublicKeyId + if len(m.unknownFields) > 0 { + r.unknownFields = make([]byte, len(m.unknownFields)) + copy(r.unknownFields, m.unknownFields) + } + return r +} + +func (m *ConfirmPublicKeyRequest) CloneMessageVT() proto.Message { + return m.CloneVT() +} + +func (m *RevokePublicKeyRequest) CloneVT() *RevokePublicKeyRequest { + if m == nil { + return (*RevokePublicKeyRequest)(nil) + } + r := new(RevokePublicKeyRequest) + r.PublicKeyId = m.PublicKeyId + if len(m.unknownFields) > 0 { + r.unknownFields = make([]byte, len(m.unknownFields)) + copy(r.unknownFields, m.unknownFields) + } + return r +} + +func (m *RevokePublicKeyRequest) CloneMessageVT() proto.Message { + return m.CloneVT() +} + func (this *PublicKey) EqualVT(that *PublicKey) bool { if this == that { return true @@ -149,6 +281,25 @@ func (this *ConfirmPublicKeyRequest) EqualMessageVT(thatMsg proto.Message) bool } return this.EqualVT(that) } +func (this *RevokePublicKeyRequest) EqualVT(that *RevokePublicKeyRequest) bool { + if this == that { + return true + } else if this == nil || that == nil { + return false + } + if this.PublicKeyId != that.PublicKeyId { + return false + } + return string(this.unknownFields) == string(that.unknownFields) +} + +func (this *RevokePublicKeyRequest) EqualMessageVT(thatMsg proto.Message) bool { + that, ok := thatMsg.(*RevokePublicKeyRequest) + if !ok { + return false + } + return this.EqualVT(that) +} func (m *PublicKey) MarshalVT() (dAtA []byte, err error) { if m == nil { return nil, nil @@ -182,14 +333,14 @@ func (m *PublicKey) MarshalToSizedBufferVT(dAtA []byte) (int, error) { if len(m.WebauthnData) > 0 { i -= len(m.WebauthnData) copy(dAtA[i:], m.WebauthnData) - i = encodeVarint(dAtA, i, uint64(len(m.WebauthnData))) + i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.WebauthnData))) i-- dAtA[i] = 0x12 } if len(m.PgpData) > 0 { i -= len(m.PgpData) copy(dAtA[i:], m.PgpData) - i = encodeVarint(dAtA, i, uint64(len(m.PgpData))) + i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.PgpData))) i-- dAtA[i] = 0xa } @@ -229,7 +380,7 @@ func (m *Identity) MarshalToSizedBufferVT(dAtA []byte) (int, error) { if len(m.Email) > 0 { i -= len(m.Email) copy(dAtA[i:], m.Email) - i = encodeVarint(dAtA, i, uint64(len(m.Email))) + i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.Email))) i-- dAtA[i] = 0xa } @@ -279,7 +430,7 @@ func (m *RegisterPublicKeyRequest) MarshalToSizedBufferVT(dAtA []byte) (int, err if len(m.Role) > 0 { i -= len(m.Role) copy(dAtA[i:], m.Role) - i = encodeVarint(dAtA, i, uint64(len(m.Role))) + i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.Role))) i-- dAtA[i] = 0x2a } @@ -289,7 +440,7 @@ func (m *RegisterPublicKeyRequest) MarshalToSizedBufferVT(dAtA []byte) (int, err return 0, err } i -= size - i = encodeVarint(dAtA, i, uint64(size)) + i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) i-- dAtA[i] = 0x12 } @@ -299,7 +450,7 @@ func (m *RegisterPublicKeyRequest) MarshalToSizedBufferVT(dAtA []byte) (int, err return 0, err } i -= size - i = encodeVarint(dAtA, i, uint64(size)) + i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) i-- dAtA[i] = 0xa } @@ -339,14 +490,14 @@ func (m *RegisterPublicKeyResponse) MarshalToSizedBufferVT(dAtA []byte) (int, er if len(m.PublicKeyId) > 0 { i -= len(m.PublicKeyId) copy(dAtA[i:], m.PublicKeyId) - i = encodeVarint(dAtA, i, uint64(len(m.PublicKeyId))) + i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.PublicKeyId))) i-- dAtA[i] = 0x12 } if len(m.LoginUrl) > 0 { i -= len(m.LoginUrl) copy(dAtA[i:], m.LoginUrl) - i = encodeVarint(dAtA, i, uint64(len(m.LoginUrl))) + i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.LoginUrl))) i-- dAtA[i] = 0xa } @@ -386,7 +537,7 @@ func (m *AwaitPublicKeyConfirmationRequest) MarshalToSizedBufferVT(dAtA []byte) if len(m.PublicKeyId) > 0 { i -= len(m.PublicKeyId) copy(dAtA[i:], m.PublicKeyId) - i = encodeVarint(dAtA, i, uint64(len(m.PublicKeyId))) + i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.PublicKeyId))) i-- dAtA[i] = 0xa } @@ -426,24 +577,53 @@ func (m *ConfirmPublicKeyRequest) MarshalToSizedBufferVT(dAtA []byte) (int, erro if len(m.PublicKeyId) > 0 { i -= len(m.PublicKeyId) copy(dAtA[i:], m.PublicKeyId) - i = encodeVarint(dAtA, i, uint64(len(m.PublicKeyId))) + i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.PublicKeyId))) i-- dAtA[i] = 0xa } return len(dAtA) - i, nil } -func encodeVarint(dAtA []byte, offset int, v uint64) int { - offset -= sov(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base +func (m *RevokePublicKeyRequest) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *RevokePublicKeyRequest) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *RevokePublicKeyRequest) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if len(m.PublicKeyId) > 0 { + i -= len(m.PublicKeyId) + copy(dAtA[i:], m.PublicKeyId) + i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.PublicKeyId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil } + func (m *PublicKey) SizeVT() (n int) { if m == nil { return 0 @@ -452,11 +632,11 @@ func (m *PublicKey) SizeVT() (n int) { _ = l l = len(m.PgpData) if l > 0 { - n += 1 + l + sov(uint64(l)) + n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) } l = len(m.WebauthnData) if l > 0 { - n += 1 + l + sov(uint64(l)) + n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) } n += len(m.unknownFields) return n @@ -470,7 +650,7 @@ func (m *Identity) SizeVT() (n int) { _ = l l = len(m.Email) if l > 0 { - n += 1 + l + sov(uint64(l)) + n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) } n += len(m.unknownFields) return n @@ -484,15 +664,15 @@ func (m *RegisterPublicKeyRequest) SizeVT() (n int) { _ = l if m.PublicKey != nil { l = m.PublicKey.SizeVT() - n += 1 + l + sov(uint64(l)) + n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) } if m.Identity != nil { l = m.Identity.SizeVT() - n += 1 + l + sov(uint64(l)) + n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) } l = len(m.Role) if l > 0 { - n += 1 + l + sov(uint64(l)) + n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) } if m.SkipUserRole { n += 2 @@ -509,11 +689,11 @@ func (m *RegisterPublicKeyResponse) SizeVT() (n int) { _ = l l = len(m.LoginUrl) if l > 0 { - n += 1 + l + sov(uint64(l)) + n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) } l = len(m.PublicKeyId) if l > 0 { - n += 1 + l + sov(uint64(l)) + n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) } n += len(m.unknownFields) return n @@ -527,7 +707,7 @@ func (m *AwaitPublicKeyConfirmationRequest) SizeVT() (n int) { _ = l l = len(m.PublicKeyId) if l > 0 { - n += 1 + l + sov(uint64(l)) + n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) } n += len(m.unknownFields) return n @@ -541,18 +721,26 @@ func (m *ConfirmPublicKeyRequest) SizeVT() (n int) { _ = l l = len(m.PublicKeyId) if l > 0 { - n += 1 + l + sov(uint64(l)) + n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) } n += len(m.unknownFields) return n } -func sov(x uint64) (n int) { - return (bits.Len64(x|1) + 6) / 7 -} -func soz(x uint64) (n int) { - return sov(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +func (m *RevokePublicKeyRequest) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.PublicKeyId) + if l > 0 { + n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) + } + n += len(m.unknownFields) + return n } + func (m *PublicKey) UnmarshalVT(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -561,7 +749,7 @@ func (m *PublicKey) UnmarshalVT(dAtA []byte) error { var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflow + return protohelpers.ErrIntOverflow } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -589,7 +777,7 @@ func (m *PublicKey) UnmarshalVT(dAtA []byte) error { var byteLen int for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflow + return protohelpers.ErrIntOverflow } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -602,11 +790,11 @@ func (m *PublicKey) UnmarshalVT(dAtA []byte) error { } } if byteLen < 0 { - return ErrInvalidLength + return protohelpers.ErrInvalidLength } postIndex := iNdEx + byteLen if postIndex < 0 { - return ErrInvalidLength + return protohelpers.ErrInvalidLength } if postIndex > l { return io.ErrUnexpectedEOF @@ -623,7 +811,7 @@ func (m *PublicKey) UnmarshalVT(dAtA []byte) error { var byteLen int for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflow + return protohelpers.ErrIntOverflow } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -636,11 +824,11 @@ func (m *PublicKey) UnmarshalVT(dAtA []byte) error { } } if byteLen < 0 { - return ErrInvalidLength + return protohelpers.ErrInvalidLength } postIndex := iNdEx + byteLen if postIndex < 0 { - return ErrInvalidLength + return protohelpers.ErrInvalidLength } if postIndex > l { return io.ErrUnexpectedEOF @@ -652,12 +840,12 @@ func (m *PublicKey) UnmarshalVT(dAtA []byte) error { iNdEx = postIndex default: iNdEx = preIndex - skippy, err := skip(dAtA[iNdEx:]) + skippy, err := protohelpers.Skip(dAtA[iNdEx:]) if err != nil { return err } if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLength + return protohelpers.ErrInvalidLength } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF @@ -680,7 +868,7 @@ func (m *Identity) UnmarshalVT(dAtA []byte) error { var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflow + return protohelpers.ErrIntOverflow } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -708,7 +896,7 @@ func (m *Identity) UnmarshalVT(dAtA []byte) error { var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflow + return protohelpers.ErrIntOverflow } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -722,11 +910,11 @@ func (m *Identity) UnmarshalVT(dAtA []byte) error { } intStringLen := int(stringLen) if intStringLen < 0 { - return ErrInvalidLength + return protohelpers.ErrInvalidLength } postIndex := iNdEx + intStringLen if postIndex < 0 { - return ErrInvalidLength + return protohelpers.ErrInvalidLength } if postIndex > l { return io.ErrUnexpectedEOF @@ -735,12 +923,12 @@ func (m *Identity) UnmarshalVT(dAtA []byte) error { iNdEx = postIndex default: iNdEx = preIndex - skippy, err := skip(dAtA[iNdEx:]) + skippy, err := protohelpers.Skip(dAtA[iNdEx:]) if err != nil { return err } if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLength + return protohelpers.ErrInvalidLength } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF @@ -763,7 +951,7 @@ func (m *RegisterPublicKeyRequest) UnmarshalVT(dAtA []byte) error { var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflow + return protohelpers.ErrIntOverflow } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -791,7 +979,7 @@ func (m *RegisterPublicKeyRequest) UnmarshalVT(dAtA []byte) error { var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflow + return protohelpers.ErrIntOverflow } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -804,11 +992,11 @@ func (m *RegisterPublicKeyRequest) UnmarshalVT(dAtA []byte) error { } } if msglen < 0 { - return ErrInvalidLength + return protohelpers.ErrInvalidLength } postIndex := iNdEx + msglen if postIndex < 0 { - return ErrInvalidLength + return protohelpers.ErrInvalidLength } if postIndex > l { return io.ErrUnexpectedEOF @@ -827,7 +1015,7 @@ func (m *RegisterPublicKeyRequest) UnmarshalVT(dAtA []byte) error { var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflow + return protohelpers.ErrIntOverflow } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -840,11 +1028,11 @@ func (m *RegisterPublicKeyRequest) UnmarshalVT(dAtA []byte) error { } } if msglen < 0 { - return ErrInvalidLength + return protohelpers.ErrInvalidLength } postIndex := iNdEx + msglen if postIndex < 0 { - return ErrInvalidLength + return protohelpers.ErrInvalidLength } if postIndex > l { return io.ErrUnexpectedEOF @@ -863,7 +1051,7 @@ func (m *RegisterPublicKeyRequest) UnmarshalVT(dAtA []byte) error { var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflow + return protohelpers.ErrIntOverflow } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -877,11 +1065,11 @@ func (m *RegisterPublicKeyRequest) UnmarshalVT(dAtA []byte) error { } intStringLen := int(stringLen) if intStringLen < 0 { - return ErrInvalidLength + return protohelpers.ErrInvalidLength } postIndex := iNdEx + intStringLen if postIndex < 0 { - return ErrInvalidLength + return protohelpers.ErrInvalidLength } if postIndex > l { return io.ErrUnexpectedEOF @@ -895,7 +1083,7 @@ func (m *RegisterPublicKeyRequest) UnmarshalVT(dAtA []byte) error { var v int for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflow + return protohelpers.ErrIntOverflow } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -910,12 +1098,12 @@ func (m *RegisterPublicKeyRequest) UnmarshalVT(dAtA []byte) error { m.SkipUserRole = bool(v != 0) default: iNdEx = preIndex - skippy, err := skip(dAtA[iNdEx:]) + skippy, err := protohelpers.Skip(dAtA[iNdEx:]) if err != nil { return err } if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLength + return protohelpers.ErrInvalidLength } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF @@ -938,7 +1126,7 @@ func (m *RegisterPublicKeyResponse) UnmarshalVT(dAtA []byte) error { var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflow + return protohelpers.ErrIntOverflow } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -966,7 +1154,7 @@ func (m *RegisterPublicKeyResponse) UnmarshalVT(dAtA []byte) error { var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflow + return protohelpers.ErrIntOverflow } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -980,11 +1168,11 @@ func (m *RegisterPublicKeyResponse) UnmarshalVT(dAtA []byte) error { } intStringLen := int(stringLen) if intStringLen < 0 { - return ErrInvalidLength + return protohelpers.ErrInvalidLength } postIndex := iNdEx + intStringLen if postIndex < 0 { - return ErrInvalidLength + return protohelpers.ErrInvalidLength } if postIndex > l { return io.ErrUnexpectedEOF @@ -998,7 +1186,7 @@ func (m *RegisterPublicKeyResponse) UnmarshalVT(dAtA []byte) error { var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflow + return protohelpers.ErrIntOverflow } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -1012,11 +1200,11 @@ func (m *RegisterPublicKeyResponse) UnmarshalVT(dAtA []byte) error { } intStringLen := int(stringLen) if intStringLen < 0 { - return ErrInvalidLength + return protohelpers.ErrInvalidLength } postIndex := iNdEx + intStringLen if postIndex < 0 { - return ErrInvalidLength + return protohelpers.ErrInvalidLength } if postIndex > l { return io.ErrUnexpectedEOF @@ -1025,12 +1213,12 @@ func (m *RegisterPublicKeyResponse) UnmarshalVT(dAtA []byte) error { iNdEx = postIndex default: iNdEx = preIndex - skippy, err := skip(dAtA[iNdEx:]) + skippy, err := protohelpers.Skip(dAtA[iNdEx:]) if err != nil { return err } if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLength + return protohelpers.ErrInvalidLength } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF @@ -1053,7 +1241,7 @@ func (m *AwaitPublicKeyConfirmationRequest) UnmarshalVT(dAtA []byte) error { var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflow + return protohelpers.ErrIntOverflow } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -1081,7 +1269,7 @@ func (m *AwaitPublicKeyConfirmationRequest) UnmarshalVT(dAtA []byte) error { var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflow + return protohelpers.ErrIntOverflow } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -1095,11 +1283,11 @@ func (m *AwaitPublicKeyConfirmationRequest) UnmarshalVT(dAtA []byte) error { } intStringLen := int(stringLen) if intStringLen < 0 { - return ErrInvalidLength + return protohelpers.ErrInvalidLength } postIndex := iNdEx + intStringLen if postIndex < 0 { - return ErrInvalidLength + return protohelpers.ErrInvalidLength } if postIndex > l { return io.ErrUnexpectedEOF @@ -1108,12 +1296,12 @@ func (m *AwaitPublicKeyConfirmationRequest) UnmarshalVT(dAtA []byte) error { iNdEx = postIndex default: iNdEx = preIndex - skippy, err := skip(dAtA[iNdEx:]) + skippy, err := protohelpers.Skip(dAtA[iNdEx:]) if err != nil { return err } if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLength + return protohelpers.ErrInvalidLength } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF @@ -1136,7 +1324,7 @@ func (m *ConfirmPublicKeyRequest) UnmarshalVT(dAtA []byte) error { var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflow + return protohelpers.ErrIntOverflow } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -1164,7 +1352,7 @@ func (m *ConfirmPublicKeyRequest) UnmarshalVT(dAtA []byte) error { var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflow + return protohelpers.ErrIntOverflow } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -1178,11 +1366,11 @@ func (m *ConfirmPublicKeyRequest) UnmarshalVT(dAtA []byte) error { } intStringLen := int(stringLen) if intStringLen < 0 { - return ErrInvalidLength + return protohelpers.ErrInvalidLength } postIndex := iNdEx + intStringLen if postIndex < 0 { - return ErrInvalidLength + return protohelpers.ErrInvalidLength } if postIndex > l { return io.ErrUnexpectedEOF @@ -1191,12 +1379,12 @@ func (m *ConfirmPublicKeyRequest) UnmarshalVT(dAtA []byte) error { iNdEx = postIndex default: iNdEx = preIndex - skippy, err := skip(dAtA[iNdEx:]) + skippy, err := protohelpers.Skip(dAtA[iNdEx:]) if err != nil { return err } if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLength + return protohelpers.ErrInvalidLength } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF @@ -1211,88 +1399,86 @@ func (m *ConfirmPublicKeyRequest) UnmarshalVT(dAtA []byte) error { } return nil } - -func skip(dAtA []byte) (n int, err error) { +func (m *RevokePublicKeyRequest) UnmarshalVT(dAtA []byte) error { l := len(dAtA) iNdEx := 0 - depth := 0 for iNdEx < l { + preIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return 0, ErrIntOverflow + return protohelpers.ErrIntOverflow } if iNdEx >= l { - return 0, io.ErrUnexpectedEOF + return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } + fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflow - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } + if wireType == 4 { + return fmt.Errorf("proto: RevokePublicKeyRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: RevokePublicKeyRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { case 1: - iNdEx += 8 - case 2: - var length int + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PublicKeyId", wireType) + } + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return 0, ErrIntOverflow + return protohelpers.ErrIntOverflow } if iNdEx >= l { - return 0, io.ErrUnexpectedEOF + return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ - length |= (int(b) & 0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if length < 0 { - return 0, ErrInvalidLength + intStringLen := int(stringLen) + if intStringLen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protohelpers.ErrInvalidLength } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroup + if postIndex > l { + return io.ErrUnexpectedEOF } - depth-- - case 5: - iNdEx += 4 + m.PublicKeyId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLength - } - if depth == 0 { - return iNdEx, nil + iNdEx = preIndex + skippy, err := protohelpers.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protohelpers.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy } } - return 0, io.ErrUnexpectedEOF -} -var ( - ErrInvalidLength = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflow = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroup = fmt.Errorf("proto: unexpected end of group") -) + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} diff --git a/go.mod b/go.mod index 446d3cb..188c09f 100644 --- a/go.mod +++ b/go.mod @@ -8,6 +8,7 @@ require ( github.com/adrg/xdg v0.5.0 github.com/grpc-ecosystem/grpc-gateway/v2 v2.22.0 github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c + github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10 github.com/stretchr/testify v1.9.0 golang.org/x/sys v0.24.0 google.golang.org/grpc v1.66.0 diff --git a/go.sum b/go.sum index 963f19e..6f0f48d 100644 --- a/go.sum +++ b/go.sum @@ -27,6 +27,8 @@ github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c h1:+mdjkGKdHQG3305AYmd github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c/go.mod h1:7rwL4CYBLnjLxUqIJNnCWiEdr3bn6IUYi15bNlnbCCU= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10 h1:GFCKgmp0tecUJ0sJuv4pzYCqS9+RGSn52M3FUwPs+uo= +github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10/go.mod h1:t/avpk3KcrXxUnYOhZhMXJlSEyie6gQbtLq5NM3loB8= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8=