auth

package
v1.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 27, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AuthService_RegisterUser_FullMethodName       = "/auth.AuthService/RegisterUser"
	AuthService_LoginUser_FullMethodName          = "/auth.AuthService/LoginUser"
	AuthService_RefreshToken_FullMethodName       = "/auth.AuthService/RefreshToken"
	AuthService_UploadPublicKeys_FullMethodName   = "/auth.AuthService/UploadPublicKeys"
	AuthService_GetPublicKeyBundle_FullMethodName = "/auth.AuthService/GetPublicKeyBundle"
)

Variables

View Source
var AuthService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "auth.AuthService",
	HandlerType: (*AuthServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "RegisterUser",
			Handler:    _AuthService_RegisterUser_Handler,
		},
		{
			MethodName: "LoginUser",
			Handler:    _AuthService_LoginUser_Handler,
		},
		{
			MethodName: "RefreshToken",
			Handler:    _AuthService_RefreshToken_Handler,
		},
		{
			MethodName: "UploadPublicKeys",
			Handler:    _AuthService_UploadPublicKeys_Handler,
		},
		{
			MethodName: "GetPublicKeyBundle",
			Handler:    _AuthService_GetPublicKeyBundle_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "proto/auth/auth.proto",
}

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)

View Source
var File_proto_auth_auth_proto protoreflect.FileDescriptor

Functions

func RegisterAuthServiceServer

func RegisterAuthServiceServer(s grpc.ServiceRegistrar, srv AuthServiceServer)

Types

type AuthServiceClient

type AuthServiceClient interface {
	RegisterUser(ctx context.Context, in *RegisterRequest, opts ...grpc.CallOption) (*RegisterResponse, error)
	LoginUser(ctx context.Context, in *LoginRequest, opts ...grpc.CallOption) (*LoginResponse, error)
	RefreshToken(ctx context.Context, in *RefreshTokenRequest, opts ...grpc.CallOption) (*RefreshTokenResponse, error)
	UploadPublicKeys(ctx context.Context, in *PublicKeyUploadRequest, opts ...grpc.CallOption) (*PublicKeyUploadResponse, error)
	GetPublicKeyBundle(ctx context.Context, in *PublicKeyBundleRequest, opts ...grpc.CallOption) (*PublicKeyBundleResponse, error)
}

AuthServiceClient is the client API for AuthService service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.

Define the authentication service.

type AuthServiceServer

type AuthServiceServer interface {
	RegisterUser(context.Context, *RegisterRequest) (*RegisterResponse, error)
	LoginUser(context.Context, *LoginRequest) (*LoginResponse, error)
	RefreshToken(context.Context, *RefreshTokenRequest) (*RefreshTokenResponse, error)
	UploadPublicKeys(context.Context, *PublicKeyUploadRequest) (*PublicKeyUploadResponse, error)
	GetPublicKeyBundle(context.Context, *PublicKeyBundleRequest) (*PublicKeyBundleResponse, error)
	// contains filtered or unexported methods
}

AuthServiceServer is the server API for AuthService service. All implementations must embed UnimplementedAuthServiceServer for forward compatibility.

Define the authentication service.

type LoginRequest

type LoginRequest struct {
	Username string `protobuf:"bytes,1,opt,name=username,proto3" json:"username,omitempty"`
	Password string `protobuf:"bytes,2,opt,name=password,proto3" json:"password,omitempty"`
	// contains filtered or unexported fields
}

Define the request and response messages for login.

func (*LoginRequest) Descriptor deprecated

func (*LoginRequest) Descriptor() ([]byte, []int)

Deprecated: Use LoginRequest.ProtoReflect.Descriptor instead.

func (*LoginRequest) GetPassword

func (x *LoginRequest) GetPassword() string

func (*LoginRequest) GetUsername

func (x *LoginRequest) GetUsername() string

func (*LoginRequest) ProtoMessage

func (*LoginRequest) ProtoMessage()

func (*LoginRequest) ProtoReflect

func (x *LoginRequest) ProtoReflect() protoreflect.Message

func (*LoginRequest) Reset

func (x *LoginRequest) Reset()

func (*LoginRequest) String

func (x *LoginRequest) String() string

type LoginResponse

type LoginResponse struct {
	Success      bool   `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"`
	UserId       uint32 `protobuf:"varint,2,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` // The unique ID of the user
	Message      string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"`
	AccessToken  string `protobuf:"bytes,4,opt,name=access_token,json=accessToken,proto3" json:"access_token,omitempty"`
	RefreshToken string `protobuf:"bytes,5,opt,name=refresh_token,json=refreshToken,proto3" json:"refresh_token,omitempty"`
	// contains filtered or unexported fields
}

func (*LoginResponse) Descriptor deprecated

func (*LoginResponse) Descriptor() ([]byte, []int)

Deprecated: Use LoginResponse.ProtoReflect.Descriptor instead.

func (*LoginResponse) GetAccessToken

func (x *LoginResponse) GetAccessToken() string

func (*LoginResponse) GetMessage

func (x *LoginResponse) GetMessage() string

func (*LoginResponse) GetRefreshToken

func (x *LoginResponse) GetRefreshToken() string

func (*LoginResponse) GetSuccess

func (x *LoginResponse) GetSuccess() bool

func (*LoginResponse) GetUserId

func (x *LoginResponse) GetUserId() uint32

func (*LoginResponse) ProtoMessage

func (*LoginResponse) ProtoMessage()

func (*LoginResponse) ProtoReflect

func (x *LoginResponse) ProtoReflect() protoreflect.Message

func (*LoginResponse) Reset

func (x *LoginResponse) Reset()

func (*LoginResponse) String

func (x *LoginResponse) String() string

type OneTimePreKey

type OneTimePreKey struct {
	PreKeyId uint32 `protobuf:"varint,1,opt,name=pre_key_id,json=preKeyId,proto3" json:"pre_key_id,omitempty"` // Unique ID for each One-Time PreKey
	PreKey   []byte `protobuf:"bytes,2,opt,name=pre_key,json=preKey,proto3" json:"pre_key,omitempty"`          // The public part of the One-Time PreKey
	// contains filtered or unexported fields
}

func (*OneTimePreKey) Descriptor deprecated

func (*OneTimePreKey) Descriptor() ([]byte, []int)

Deprecated: Use OneTimePreKey.ProtoReflect.Descriptor instead.

func (*OneTimePreKey) GetPreKey

func (x *OneTimePreKey) GetPreKey() []byte

func (*OneTimePreKey) GetPreKeyId

func (x *OneTimePreKey) GetPreKeyId() uint32

func (*OneTimePreKey) ProtoMessage

func (*OneTimePreKey) ProtoMessage()

func (*OneTimePreKey) ProtoReflect

func (x *OneTimePreKey) ProtoReflect() protoreflect.Message

func (*OneTimePreKey) Reset

func (x *OneTimePreKey) Reset()

func (*OneTimePreKey) String

func (x *OneTimePreKey) String() string

type PublicKeyBundleRequest

type PublicKeyBundleRequest struct {
	UserId   uint32 `protobuf:"varint,1,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"`       // The ID of the user whose public keys you want to retrieve
	DeviceId uint32 `protobuf:"varint,2,opt,name=device_id,json=deviceId,proto3" json:"device_id,omitempty"` // The device ID of the target user (optional)
	// contains filtered or unexported fields
}

Request message for fetching the public key bundle

func (*PublicKeyBundleRequest) Descriptor deprecated

func (*PublicKeyBundleRequest) Descriptor() ([]byte, []int)

Deprecated: Use PublicKeyBundleRequest.ProtoReflect.Descriptor instead.

func (*PublicKeyBundleRequest) GetDeviceId

func (x *PublicKeyBundleRequest) GetDeviceId() uint32

func (*PublicKeyBundleRequest) GetUserId

func (x *PublicKeyBundleRequest) GetUserId() uint32

func (*PublicKeyBundleRequest) ProtoMessage

func (*PublicKeyBundleRequest) ProtoMessage()

func (*PublicKeyBundleRequest) ProtoReflect

func (x *PublicKeyBundleRequest) ProtoReflect() protoreflect.Message

func (*PublicKeyBundleRequest) Reset

func (x *PublicKeyBundleRequest) Reset()

func (*PublicKeyBundleRequest) String

func (x *PublicKeyBundleRequest) String() string

type PublicKeyBundleResponse

type PublicKeyBundleResponse struct {
	Id                    uint32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`                                                   // Unique ID of the key bundle (used for internal purposes)
	UserId                uint32 `protobuf:"varint,2,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"`                             // The unique user ID
	RegistrationId        uint32 `protobuf:"varint,3,opt,name=registration_id,json=registrationId,proto3" json:"registration_id,omitempty"`     // The registration ID associated with the user
	DeviceId              uint32 `protobuf:"varint,4,opt,name=device_id,json=deviceId,proto3" json:"device_id,omitempty"`                       // The device ID associated with the user
	IdentityKey           []byte `protobuf:"bytes,5,opt,name=identity_key,json=identityKey,proto3" json:"identity_key,omitempty"`               // The public identity key for the device
	PreKeyId              uint32 `protobuf:"varint,6,opt,name=pre_key_id,json=preKeyId,proto3" json:"pre_key_id,omitempty"`                     // The ID of the regular pre-key
	PreKey                []byte `protobuf:"bytes,7,opt,name=pre_key,json=preKey,proto3" json:"pre_key,omitempty"`                              // The public pre-key (regular)
	SignedPreKeyId        uint32 `protobuf:"varint,8,opt,name=signed_pre_key_id,json=signedPreKeyId,proto3" json:"signed_pre_key_id,omitempty"` // The ID of the signed pre-key
	SignedPreKey          []byte `protobuf:"bytes,9,opt,name=signed_pre_key,json=signedPreKey,proto3" json:"signed_pre_key,omitempty"`          // The public signed pre-key
	SignedPreKeySignature []byte ``                                                                                                             // Signature of the signed pre-key
	/* 129-byte string literal not displayed */
	OneTimePreKeys []*OneTimePreKey `protobuf:"bytes,11,rep,name=one_time_pre_keys,json=oneTimePreKeys,proto3" json:"one_time_pre_keys,omitempty"` // Optional batch of one-time prekeys
	// contains filtered or unexported fields
}

Response message for fetching the public key bundle

func (*PublicKeyBundleResponse) Descriptor deprecated

func (*PublicKeyBundleResponse) Descriptor() ([]byte, []int)

Deprecated: Use PublicKeyBundleResponse.ProtoReflect.Descriptor instead.

func (*PublicKeyBundleResponse) GetDeviceId

func (x *PublicKeyBundleResponse) GetDeviceId() uint32

func (*PublicKeyBundleResponse) GetId

func (x *PublicKeyBundleResponse) GetId() uint32

func (*PublicKeyBundleResponse) GetIdentityKey

func (x *PublicKeyBundleResponse) GetIdentityKey() []byte

func (*PublicKeyBundleResponse) GetOneTimePreKeys

func (x *PublicKeyBundleResponse) GetOneTimePreKeys() []*OneTimePreKey

func (*PublicKeyBundleResponse) GetPreKey

func (x *PublicKeyBundleResponse) GetPreKey() []byte

func (*PublicKeyBundleResponse) GetPreKeyId

func (x *PublicKeyBundleResponse) GetPreKeyId() uint32

func (*PublicKeyBundleResponse) GetRegistrationId

func (x *PublicKeyBundleResponse) GetRegistrationId() uint32

func (*PublicKeyBundleResponse) GetSignedPreKey

func (x *PublicKeyBundleResponse) GetSignedPreKey() []byte

func (*PublicKeyBundleResponse) GetSignedPreKeyId

func (x *PublicKeyBundleResponse) GetSignedPreKeyId() uint32

func (*PublicKeyBundleResponse) GetSignedPreKeySignature

func (x *PublicKeyBundleResponse) GetSignedPreKeySignature() []byte

func (*PublicKeyBundleResponse) GetUserId

func (x *PublicKeyBundleResponse) GetUserId() uint32

func (*PublicKeyBundleResponse) ProtoMessage

func (*PublicKeyBundleResponse) ProtoMessage()

func (*PublicKeyBundleResponse) ProtoReflect

func (x *PublicKeyBundleResponse) ProtoReflect() protoreflect.Message

func (*PublicKeyBundleResponse) Reset

func (x *PublicKeyBundleResponse) Reset()

func (*PublicKeyBundleResponse) String

func (x *PublicKeyBundleResponse) String() string

type PublicKeyUploadRequest

type PublicKeyUploadRequest struct {
	IdentityKey           []byte `protobuf:"bytes,1,opt,name=identity_key,json=identityKey,proto3" json:"identity_key,omitempty"`               // The public identity key for the device
	PreKeyId              uint32 `protobuf:"varint,2,opt,name=pre_key_id,json=preKeyId,proto3" json:"pre_key_id,omitempty"`                     // The ID of the regular or one-time pre-key
	PreKey                []byte `protobuf:"bytes,3,opt,name=pre_key,json=preKey,proto3" json:"pre_key,omitempty"`                              // The public pre-key (could be one-time or regular)
	SignedPreKeyId        uint32 `protobuf:"varint,4,opt,name=signed_pre_key_id,json=signedPreKeyId,proto3" json:"signed_pre_key_id,omitempty"` // The ID of the signed pre-key
	SignedPreKey          []byte `protobuf:"bytes,5,opt,name=signed_pre_key,json=signedPreKey,proto3" json:"signed_pre_key,omitempty"`          // The public signed pre-key
	SignedPreKeySignature []byte ``                                                                                                             // Signature of the signed pre-key
	/* 128-byte string literal not displayed */
	RegistrationId uint32           `protobuf:"varint,7,opt,name=registration_id,json=registrationId,proto3" json:"registration_id,omitempty"`    // User's registration ID
	DeviceId       uint32           `protobuf:"varint,8,opt,name=device_id,json=deviceId,proto3" json:"device_id,omitempty"`                      // Device ID to distinguish between user's devices
	OneTimePreKeys []*OneTimePreKey `protobuf:"bytes,9,rep,name=one_time_pre_keys,json=oneTimePreKeys,proto3" json:"one_time_pre_keys,omitempty"` // Batch of One-Time PreKeys
	// contains filtered or unexported fields
}

func (*PublicKeyUploadRequest) Descriptor deprecated

func (*PublicKeyUploadRequest) Descriptor() ([]byte, []int)

Deprecated: Use PublicKeyUploadRequest.ProtoReflect.Descriptor instead.

func (*PublicKeyUploadRequest) GetDeviceId

func (x *PublicKeyUploadRequest) GetDeviceId() uint32

func (*PublicKeyUploadRequest) GetIdentityKey

func (x *PublicKeyUploadRequest) GetIdentityKey() []byte

func (*PublicKeyUploadRequest) GetOneTimePreKeys

func (x *PublicKeyUploadRequest) GetOneTimePreKeys() []*OneTimePreKey

func (*PublicKeyUploadRequest) GetPreKey

func (x *PublicKeyUploadRequest) GetPreKey() []byte

func (*PublicKeyUploadRequest) GetPreKeyId

func (x *PublicKeyUploadRequest) GetPreKeyId() uint32

func (*PublicKeyUploadRequest) GetRegistrationId

func (x *PublicKeyUploadRequest) GetRegistrationId() uint32

func (*PublicKeyUploadRequest) GetSignedPreKey

func (x *PublicKeyUploadRequest) GetSignedPreKey() []byte

func (*PublicKeyUploadRequest) GetSignedPreKeyId

func (x *PublicKeyUploadRequest) GetSignedPreKeyId() uint32

func (*PublicKeyUploadRequest) GetSignedPreKeySignature

func (x *PublicKeyUploadRequest) GetSignedPreKeySignature() []byte

func (*PublicKeyUploadRequest) ProtoMessage

func (*PublicKeyUploadRequest) ProtoMessage()

func (*PublicKeyUploadRequest) ProtoReflect

func (x *PublicKeyUploadRequest) ProtoReflect() protoreflect.Message

func (*PublicKeyUploadRequest) Reset

func (x *PublicKeyUploadRequest) Reset()

func (*PublicKeyUploadRequest) String

func (x *PublicKeyUploadRequest) String() string

type PublicKeyUploadResponse

type PublicKeyUploadResponse struct {
	Success bool   `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` // True if the upload was successful
	Message string `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"`  // Optional message in case of failure or additional info
	// contains filtered or unexported fields
}

Response message after uploading public keys

func (*PublicKeyUploadResponse) Descriptor deprecated

func (*PublicKeyUploadResponse) Descriptor() ([]byte, []int)

Deprecated: Use PublicKeyUploadResponse.ProtoReflect.Descriptor instead.

func (*PublicKeyUploadResponse) GetMessage

func (x *PublicKeyUploadResponse) GetMessage() string

func (*PublicKeyUploadResponse) GetSuccess

func (x *PublicKeyUploadResponse) GetSuccess() bool

func (*PublicKeyUploadResponse) ProtoMessage

func (*PublicKeyUploadResponse) ProtoMessage()

func (*PublicKeyUploadResponse) ProtoReflect

func (x *PublicKeyUploadResponse) ProtoReflect() protoreflect.Message

func (*PublicKeyUploadResponse) Reset

func (x *PublicKeyUploadResponse) Reset()

func (*PublicKeyUploadResponse) String

func (x *PublicKeyUploadResponse) String() string

type RefreshTokenRequest

type RefreshTokenRequest struct {
	RefreshToken string `protobuf:"bytes,1,opt,name=refresh_token,json=refreshToken,proto3" json:"refresh_token,omitempty"`
	// contains filtered or unexported fields
}

Define the request and response messages for refreshing the token.

func (*RefreshTokenRequest) Descriptor deprecated

func (*RefreshTokenRequest) Descriptor() ([]byte, []int)

Deprecated: Use RefreshTokenRequest.ProtoReflect.Descriptor instead.

func (*RefreshTokenRequest) GetRefreshToken

func (x *RefreshTokenRequest) GetRefreshToken() string

func (*RefreshTokenRequest) ProtoMessage

func (*RefreshTokenRequest) ProtoMessage()

func (*RefreshTokenRequest) ProtoReflect

func (x *RefreshTokenRequest) ProtoReflect() protoreflect.Message

func (*RefreshTokenRequest) Reset

func (x *RefreshTokenRequest) Reset()

func (*RefreshTokenRequest) String

func (x *RefreshTokenRequest) String() string

type RefreshTokenResponse

type RefreshTokenResponse struct {
	AccessToken string `protobuf:"bytes,1,opt,name=access_token,json=accessToken,proto3" json:"access_token,omitempty"`
	// contains filtered or unexported fields
}

func (*RefreshTokenResponse) Descriptor deprecated

func (*RefreshTokenResponse) Descriptor() ([]byte, []int)

Deprecated: Use RefreshTokenResponse.ProtoReflect.Descriptor instead.

func (*RefreshTokenResponse) GetAccessToken

func (x *RefreshTokenResponse) GetAccessToken() string

func (*RefreshTokenResponse) ProtoMessage

func (*RefreshTokenResponse) ProtoMessage()

func (*RefreshTokenResponse) ProtoReflect

func (x *RefreshTokenResponse) ProtoReflect() protoreflect.Message

func (*RefreshTokenResponse) Reset

func (x *RefreshTokenResponse) Reset()

func (*RefreshTokenResponse) String

func (x *RefreshTokenResponse) String() string

type RegisterRequest

type RegisterRequest struct {
	Username string `protobuf:"bytes,1,opt,name=username,proto3" json:"username,omitempty"`
	Password string `protobuf:"bytes,2,opt,name=password,proto3" json:"password,omitempty"`
	// contains filtered or unexported fields
}

Define the request and response messages for registration.

func (*RegisterRequest) Descriptor deprecated

func (*RegisterRequest) Descriptor() ([]byte, []int)

Deprecated: Use RegisterRequest.ProtoReflect.Descriptor instead.

func (*RegisterRequest) GetPassword

func (x *RegisterRequest) GetPassword() string

func (*RegisterRequest) GetUsername

func (x *RegisterRequest) GetUsername() string

func (*RegisterRequest) ProtoMessage

func (*RegisterRequest) ProtoMessage()

func (*RegisterRequest) ProtoReflect

func (x *RegisterRequest) ProtoReflect() protoreflect.Message

func (*RegisterRequest) Reset

func (x *RegisterRequest) Reset()

func (*RegisterRequest) String

func (x *RegisterRequest) String() string

type RegisterResponse

type RegisterResponse struct {
	Success bool   `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"`
	Message string `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"`
	// contains filtered or unexported fields
}

func (*RegisterResponse) Descriptor deprecated

func (*RegisterResponse) Descriptor() ([]byte, []int)

Deprecated: Use RegisterResponse.ProtoReflect.Descriptor instead.

func (*RegisterResponse) GetMessage

func (x *RegisterResponse) GetMessage() string

func (*RegisterResponse) GetSuccess

func (x *RegisterResponse) GetSuccess() bool

func (*RegisterResponse) ProtoMessage

func (*RegisterResponse) ProtoMessage()

func (*RegisterResponse) ProtoReflect

func (x *RegisterResponse) ProtoReflect() protoreflect.Message

func (*RegisterResponse) Reset

func (x *RegisterResponse) Reset()

func (*RegisterResponse) String

func (x *RegisterResponse) String() string

type UnimplementedAuthServiceServer

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.

func (UnimplementedAuthServiceServer) GetPublicKeyBundle

func (UnimplementedAuthServiceServer) LoginUser

func (UnimplementedAuthServiceServer) RefreshToken

func (UnimplementedAuthServiceServer) RegisterUser

func (UnimplementedAuthServiceServer) UploadPublicKeys

type UnsafeAuthServiceServer

type UnsafeAuthServiceServer interface {
	// contains filtered or unexported methods
}

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 result in compilation errors.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL