Files
enkly-ai/gen/iam/v1/iam_grpc.pb.go
enkly 79ce8dc4c0
Some checks failed
Go CI Pipeline / build_and_test (push) Failing after 22m0s
Init Project
2026-10-30 18:06:55 +01:00

524 lines
22 KiB
Go

// Package iam is the Identity & Access bounded context: accounts,
// sessions, email verification and password reset. It is the system of
// record for `users`, `sessions`, `email_verification_codes` and
// `password_reset_tokens` (see services/iam/migrations/0001_init.sql) —
// no other service may read or write those tables directly.
//
// Mirrors the monolith's internal/handlers/auth.go + internal/db/users.go
// + internal/auth/*.go one-for-one; see each rpc's comment for the
// handler function it replaces.
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.5.1
// - protoc v3.21.12
// source: iam/v1/iam.proto
package iamv1
import (
context "context"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
)
// 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.64.0 or later.
const _ = grpc.SupportPackageIsVersion9
const (
IAMService_SignUp_FullMethodName = "/enkly.iam.v1.IAMService/SignUp"
IAMService_ResendVerification_FullMethodName = "/enkly.iam.v1.IAMService/ResendVerification"
IAMService_VerifyEmail_FullMethodName = "/enkly.iam.v1.IAMService/VerifyEmail"
IAMService_Login_FullMethodName = "/enkly.iam.v1.IAMService/Login"
IAMService_Logout_FullMethodName = "/enkly.iam.v1.IAMService/Logout"
IAMService_ValidateSession_FullMethodName = "/enkly.iam.v1.IAMService/ValidateSession"
IAMService_ForgotPassword_FullMethodName = "/enkly.iam.v1.IAMService/ForgotPassword"
IAMService_CheckPasswordResetToken_FullMethodName = "/enkly.iam.v1.IAMService/CheckPasswordResetToken"
IAMService_ResetPassword_FullMethodName = "/enkly.iam.v1.IAMService/ResetPassword"
IAMService_GetUser_FullMethodName = "/enkly.iam.v1.IAMService/GetUser"
)
// IAMServiceClient is the client API for IAMService service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
type IAMServiceClient interface {
// SignUp replaces Handlers.Signup. Validates and normalizes the email,
// hashes the password (PBKDF2, see internal/auth/password.go), creates
// the account (or silently reuses an existing unverified one — same
// anti-enumeration behavior as the monolith), issues a verification
// code and publishes an iam.verification_code.issued event for the
// notification service to deliver it. Never returns whether the email
// already existed.
SignUp(ctx context.Context, in *SignUpRequest, opts ...grpc.CallOption) (*SignUpResponse, error)
// ResendVerification replaces Handlers.ResendVerification.
ResendVerification(ctx context.Context, in *ResendVerificationRequest, opts ...grpc.CallOption) (*ResendVerificationResponse, error)
// VerifyEmail replaces Handlers.VerifyEmail.
VerifyEmail(ctx context.Context, in *VerifyEmailRequest, opts ...grpc.CallOption) (*VerifyEmailResponse, error)
// Login replaces Handlers.Login: verifies credentials (constant-time
// against a dummy hash for unknown emails) and, on success, mints a
// session and returns its raw token for the gateway to set as a
// cookie. Never persists the raw token — only its SHA-256 hash.
Login(ctx context.Context, in *LoginRequest, opts ...grpc.CallOption) (*LoginResponse, error)
// Logout replaces Handlers.Logout: deletes the session row for the
// given raw session token.
Logout(ctx context.Context, in *LogoutRequest, opts ...grpc.CallOption) (*LogoutResponse, error)
// ValidateSession replaces the session half of Handlers.RequireAuth /
// db.GetSessionUser. Called by the gateway on every authenticated
// request.
ValidateSession(ctx context.Context, in *ValidateSessionRequest, opts ...grpc.CallOption) (*ValidateSessionResponse, error)
// ForgotPassword replaces Handlers.ForgotPassword.
ForgotPassword(ctx context.Context, in *ForgotPasswordRequest, opts ...grpc.CallOption) (*ForgotPasswordResponse, error)
// CheckPasswordResetToken replaces the GET-time validity check in
// Handlers.ResetPasswordPage (db.PasswordResetTokenValid).
CheckPasswordResetToken(ctx context.Context, in *CheckPasswordResetTokenRequest, opts ...grpc.CallOption) (*CheckPasswordResetTokenResponse, error)
// ResetPassword replaces Handlers.ResetPassword. Also revokes every
// session for the account (db.UpdatePassword's cascade delete).
ResetPassword(ctx context.Context, in *ResetPasswordRequest, opts ...grpc.CallOption) (*ResetPasswordResponse, error)
// GetUser is used by other services (e.g. billing, when it only has a
// user_id) to resolve an email address. Never returns PasswordHash.
GetUser(ctx context.Context, in *GetUserRequest, opts ...grpc.CallOption) (*User, error)
}
type iAMServiceClient struct {
cc grpc.ClientConnInterface
}
func NewIAMServiceClient(cc grpc.ClientConnInterface) IAMServiceClient {
return &iAMServiceClient{cc}
}
func (c *iAMServiceClient) SignUp(ctx context.Context, in *SignUpRequest, opts ...grpc.CallOption) (*SignUpResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(SignUpResponse)
err := c.cc.Invoke(ctx, IAMService_SignUp_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *iAMServiceClient) ResendVerification(ctx context.Context, in *ResendVerificationRequest, opts ...grpc.CallOption) (*ResendVerificationResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(ResendVerificationResponse)
err := c.cc.Invoke(ctx, IAMService_ResendVerification_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *iAMServiceClient) VerifyEmail(ctx context.Context, in *VerifyEmailRequest, opts ...grpc.CallOption) (*VerifyEmailResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(VerifyEmailResponse)
err := c.cc.Invoke(ctx, IAMService_VerifyEmail_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *iAMServiceClient) Login(ctx context.Context, in *LoginRequest, opts ...grpc.CallOption) (*LoginResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(LoginResponse)
err := c.cc.Invoke(ctx, IAMService_Login_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *iAMServiceClient) Logout(ctx context.Context, in *LogoutRequest, opts ...grpc.CallOption) (*LogoutResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(LogoutResponse)
err := c.cc.Invoke(ctx, IAMService_Logout_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *iAMServiceClient) ValidateSession(ctx context.Context, in *ValidateSessionRequest, opts ...grpc.CallOption) (*ValidateSessionResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(ValidateSessionResponse)
err := c.cc.Invoke(ctx, IAMService_ValidateSession_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *iAMServiceClient) ForgotPassword(ctx context.Context, in *ForgotPasswordRequest, opts ...grpc.CallOption) (*ForgotPasswordResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(ForgotPasswordResponse)
err := c.cc.Invoke(ctx, IAMService_ForgotPassword_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *iAMServiceClient) CheckPasswordResetToken(ctx context.Context, in *CheckPasswordResetTokenRequest, opts ...grpc.CallOption) (*CheckPasswordResetTokenResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(CheckPasswordResetTokenResponse)
err := c.cc.Invoke(ctx, IAMService_CheckPasswordResetToken_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *iAMServiceClient) ResetPassword(ctx context.Context, in *ResetPasswordRequest, opts ...grpc.CallOption) (*ResetPasswordResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(ResetPasswordResponse)
err := c.cc.Invoke(ctx, IAMService_ResetPassword_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *iAMServiceClient) GetUser(ctx context.Context, in *GetUserRequest, opts ...grpc.CallOption) (*User, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(User)
err := c.cc.Invoke(ctx, IAMService_GetUser_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
// IAMServiceServer is the server API for IAMService service.
// All implementations must embed UnimplementedIAMServiceServer
// for forward compatibility.
type IAMServiceServer interface {
// SignUp replaces Handlers.Signup. Validates and normalizes the email,
// hashes the password (PBKDF2, see internal/auth/password.go), creates
// the account (or silently reuses an existing unverified one — same
// anti-enumeration behavior as the monolith), issues a verification
// code and publishes an iam.verification_code.issued event for the
// notification service to deliver it. Never returns whether the email
// already existed.
SignUp(context.Context, *SignUpRequest) (*SignUpResponse, error)
// ResendVerification replaces Handlers.ResendVerification.
ResendVerification(context.Context, *ResendVerificationRequest) (*ResendVerificationResponse, error)
// VerifyEmail replaces Handlers.VerifyEmail.
VerifyEmail(context.Context, *VerifyEmailRequest) (*VerifyEmailResponse, error)
// Login replaces Handlers.Login: verifies credentials (constant-time
// against a dummy hash for unknown emails) and, on success, mints a
// session and returns its raw token for the gateway to set as a
// cookie. Never persists the raw token — only its SHA-256 hash.
Login(context.Context, *LoginRequest) (*LoginResponse, error)
// Logout replaces Handlers.Logout: deletes the session row for the
// given raw session token.
Logout(context.Context, *LogoutRequest) (*LogoutResponse, error)
// ValidateSession replaces the session half of Handlers.RequireAuth /
// db.GetSessionUser. Called by the gateway on every authenticated
// request.
ValidateSession(context.Context, *ValidateSessionRequest) (*ValidateSessionResponse, error)
// ForgotPassword replaces Handlers.ForgotPassword.
ForgotPassword(context.Context, *ForgotPasswordRequest) (*ForgotPasswordResponse, error)
// CheckPasswordResetToken replaces the GET-time validity check in
// Handlers.ResetPasswordPage (db.PasswordResetTokenValid).
CheckPasswordResetToken(context.Context, *CheckPasswordResetTokenRequest) (*CheckPasswordResetTokenResponse, error)
// ResetPassword replaces Handlers.ResetPassword. Also revokes every
// session for the account (db.UpdatePassword's cascade delete).
ResetPassword(context.Context, *ResetPasswordRequest) (*ResetPasswordResponse, error)
// GetUser is used by other services (e.g. billing, when it only has a
// user_id) to resolve an email address. Never returns PasswordHash.
GetUser(context.Context, *GetUserRequest) (*User, error)
mustEmbedUnimplementedIAMServiceServer()
}
// UnimplementedIAMServiceServer 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 UnimplementedIAMServiceServer struct{}
func (UnimplementedIAMServiceServer) SignUp(context.Context, *SignUpRequest) (*SignUpResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method SignUp not implemented")
}
func (UnimplementedIAMServiceServer) ResendVerification(context.Context, *ResendVerificationRequest) (*ResendVerificationResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method ResendVerification not implemented")
}
func (UnimplementedIAMServiceServer) VerifyEmail(context.Context, *VerifyEmailRequest) (*VerifyEmailResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method VerifyEmail not implemented")
}
func (UnimplementedIAMServiceServer) Login(context.Context, *LoginRequest) (*LoginResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method Login not implemented")
}
func (UnimplementedIAMServiceServer) Logout(context.Context, *LogoutRequest) (*LogoutResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method Logout not implemented")
}
func (UnimplementedIAMServiceServer) ValidateSession(context.Context, *ValidateSessionRequest) (*ValidateSessionResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method ValidateSession not implemented")
}
func (UnimplementedIAMServiceServer) ForgotPassword(context.Context, *ForgotPasswordRequest) (*ForgotPasswordResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method ForgotPassword not implemented")
}
func (UnimplementedIAMServiceServer) CheckPasswordResetToken(context.Context, *CheckPasswordResetTokenRequest) (*CheckPasswordResetTokenResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method CheckPasswordResetToken not implemented")
}
func (UnimplementedIAMServiceServer) ResetPassword(context.Context, *ResetPasswordRequest) (*ResetPasswordResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method ResetPassword not implemented")
}
func (UnimplementedIAMServiceServer) GetUser(context.Context, *GetUserRequest) (*User, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetUser not implemented")
}
func (UnimplementedIAMServiceServer) mustEmbedUnimplementedIAMServiceServer() {}
func (UnimplementedIAMServiceServer) testEmbeddedByValue() {}
// UnsafeIAMServiceServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to IAMServiceServer will
// result in compilation errors.
type UnsafeIAMServiceServer interface {
mustEmbedUnimplementedIAMServiceServer()
}
func RegisterIAMServiceServer(s grpc.ServiceRegistrar, srv IAMServiceServer) {
// If the following call pancis, it indicates UnimplementedIAMServiceServer 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(&IAMService_ServiceDesc, srv)
}
func _IAMService_SignUp_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(SignUpRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(IAMServiceServer).SignUp(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: IAMService_SignUp_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(IAMServiceServer).SignUp(ctx, req.(*SignUpRequest))
}
return interceptor(ctx, in, info, handler)
}
func _IAMService_ResendVerification_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ResendVerificationRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(IAMServiceServer).ResendVerification(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: IAMService_ResendVerification_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(IAMServiceServer).ResendVerification(ctx, req.(*ResendVerificationRequest))
}
return interceptor(ctx, in, info, handler)
}
func _IAMService_VerifyEmail_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(VerifyEmailRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(IAMServiceServer).VerifyEmail(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: IAMService_VerifyEmail_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(IAMServiceServer).VerifyEmail(ctx, req.(*VerifyEmailRequest))
}
return interceptor(ctx, in, info, handler)
}
func _IAMService_Login_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(LoginRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(IAMServiceServer).Login(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: IAMService_Login_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(IAMServiceServer).Login(ctx, req.(*LoginRequest))
}
return interceptor(ctx, in, info, handler)
}
func _IAMService_Logout_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(LogoutRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(IAMServiceServer).Logout(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: IAMService_Logout_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(IAMServiceServer).Logout(ctx, req.(*LogoutRequest))
}
return interceptor(ctx, in, info, handler)
}
func _IAMService_ValidateSession_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ValidateSessionRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(IAMServiceServer).ValidateSession(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: IAMService_ValidateSession_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(IAMServiceServer).ValidateSession(ctx, req.(*ValidateSessionRequest))
}
return interceptor(ctx, in, info, handler)
}
func _IAMService_ForgotPassword_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ForgotPasswordRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(IAMServiceServer).ForgotPassword(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: IAMService_ForgotPassword_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(IAMServiceServer).ForgotPassword(ctx, req.(*ForgotPasswordRequest))
}
return interceptor(ctx, in, info, handler)
}
func _IAMService_CheckPasswordResetToken_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(CheckPasswordResetTokenRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(IAMServiceServer).CheckPasswordResetToken(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: IAMService_CheckPasswordResetToken_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(IAMServiceServer).CheckPasswordResetToken(ctx, req.(*CheckPasswordResetTokenRequest))
}
return interceptor(ctx, in, info, handler)
}
func _IAMService_ResetPassword_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ResetPasswordRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(IAMServiceServer).ResetPassword(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: IAMService_ResetPassword_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(IAMServiceServer).ResetPassword(ctx, req.(*ResetPasswordRequest))
}
return interceptor(ctx, in, info, handler)
}
func _IAMService_GetUser_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GetUserRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(IAMServiceServer).GetUser(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: IAMService_GetUser_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(IAMServiceServer).GetUser(ctx, req.(*GetUserRequest))
}
return interceptor(ctx, in, info, handler)
}
// IAMService_ServiceDesc is the grpc.ServiceDesc for IAMService service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var IAMService_ServiceDesc = grpc.ServiceDesc{
ServiceName: "enkly.iam.v1.IAMService",
HandlerType: (*IAMServiceServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "SignUp",
Handler: _IAMService_SignUp_Handler,
},
{
MethodName: "ResendVerification",
Handler: _IAMService_ResendVerification_Handler,
},
{
MethodName: "VerifyEmail",
Handler: _IAMService_VerifyEmail_Handler,
},
{
MethodName: "Login",
Handler: _IAMService_Login_Handler,
},
{
MethodName: "Logout",
Handler: _IAMService_Logout_Handler,
},
{
MethodName: "ValidateSession",
Handler: _IAMService_ValidateSession_Handler,
},
{
MethodName: "ForgotPassword",
Handler: _IAMService_ForgotPassword_Handler,
},
{
MethodName: "CheckPasswordResetToken",
Handler: _IAMService_CheckPasswordResetToken_Handler,
},
{
MethodName: "ResetPassword",
Handler: _IAMService_ResetPassword_Handler,
},
{
MethodName: "GetUser",
Handler: _IAMService_GetUser_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "iam/v1/iam.proto",
}