commit dae39e984fae47b7a8c949c5c9c6be7c9835826f Author: Michael Netshipise Date: Wed Jun 10 14:45:00 2026 +0200 first commit Polyglot client for st-peter (aura-users) — Rust / Go / TypeScript, one vendored auth proto, versioned in lockstep with the st-peter server (v0.2.0). Mirrors waymaker-client's layout: proto/ + scripts/ + per-language packages. Co-Authored-By: Claude Fable 5 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..16df59f --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +/target +Cargo.lock +ts/node_modules/ +ts/dist/ +.DS_Store diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..f5c91f7 --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,6 @@ +# Root workspace so the Rust crate in rust/ is discoverable when this repo is +# consumed as a Cargo git dependency, and so `cargo` works from the repo root. +# The go/ and ts/ clients are independent toolchains and ignored by Cargo. +[workspace] +resolver = "2" +members = ["rust"] diff --git a/README.md b/README.md new file mode 100644 index 0000000..db3fc29 --- /dev/null +++ b/README.md @@ -0,0 +1,88 @@ +# st-peter-client + +Official client libraries for [st-peter](https://git.awesomike.com/dev/st-peter-lib) +(deployed as **aura-users**) — the central authentication service — over gRPC. + +Three clients, one wire contract, **versioned in lockstep with the st-peter +server**: + +| Language | Path | Package | +|------------|---------|---------| +| Rust | `rust/` | `st-peter-client` (crate) | +| Go | `go/` | `git.awesomike.com/pub/st-peter-client/go` (module) | +| TypeScript | `ts/` | `@st-peter/client` (npm) | + +The `.proto` file in `proto/` is a **vendored copy**; the st-peter server repo +is the source of truth. `scripts/sync-protos.sh` refreshes it and keeps +`VERSION` aligned with the server. Only the **auth** surface is vendored — +services authenticate users; they do not administer st-peter. + +## Versioning + +Every release is tagged at the **same version as the st-peter server** it +targets (see `VERSION`). A client tagged `v0.2.0` speaks the wire contract of +st-peter `v0.2.0`. The gRPC wire format is backward-compatible across patch +releases (field numbers and enum integer values are stable), so a client one +patch behind a server generally interoperates — but match versions for new +surface. + +## Design: authentication central, authorization local + +st-peter answers *who is this token?* — every client returns the verified +identity plus the user's **platform** roles, with a ~60s token-verify cache. +What that identity may do inside a consuming service (media roles, CMS +roles, …) is that service's own concern: keep a local roles table keyed by +the st-peter `user_id` **by value** (no cross-DB FK) and map permissions +there. These clients deliberately ship no session/permission types. + +The wrapper surface is the same in all three languages: + +- `connect(target)` — lazy dial; failures surface on the first call +- `verify_token(token)` — verified user + platform roles, cached ~60s +- `login(identifier, password)` → `Authenticated | TwoFactor | Failed` +- `verify_two_factor(two_factor_id, code)` — complete an OTP challenge +- `lookup_user(actor_id, actor_token, identifier)` — resolve a user by + email/phone/handle (for local role-grant flows) +- `bearer(...)` helper + the shared `aura_session` cookie name + +## Layout + +``` +proto/ vendored st-peter-auth.proto (source of truth: st-peter repo) +rust/ cargo package; stubs compiled at build time from ../proto +go/ go module; committed stubs in genpb/ (scripts/gen-go.sh) +ts/ npm package; committed stubs in src/genpb (scripts/gen-ts.sh) +scripts/ sync-protos.sh, gen-go.sh, gen-ts.sh +VERSION the st-peter server version this client targets +``` + +## Regenerating after a proto change + +```bash +ST_PETER_REPO=/path/to/st-peter-lib ./scripts/sync-protos.sh +./scripts/gen-go.sh # needs protoc-gen-go{,-grpc} +(cd ts && npm install) && ./scripts/gen-ts.sh +cargo check # rust stubs regenerate via build.rs +``` + +Then tag at `v$(cat VERSION)`. + +## Consuming + +Rust (`Cargo.toml`): + +```toml +st-peter-client = { git = "https://git.awesomike.com/pub/st-peter-client.git", tag = "v0.2.0" } +``` + +Go: + +```bash +go get git.awesomike.com/pub/st-peter-client/go@v0.2.0 +``` + +TypeScript (`package.json`): + +```json +"@st-peter/client": "git+https://git.awesomike.com/pub/st-peter-client.git#v0.2.0" +``` diff --git a/VERSION b/VERSION new file mode 100644 index 0000000..0ea3a94 --- /dev/null +++ b/VERSION @@ -0,0 +1 @@ +0.2.0 diff --git a/go/README.md b/go/README.md new file mode 100644 index 0000000..f7f8778 --- /dev/null +++ b/go/README.md @@ -0,0 +1,13 @@ +# st-peter-client (Go) + +Official Go client for st-peter (aura-users). Generated stubs are committed +under `genpb/` (regenerate with `../scripts/gen-go.sh`); the `stpeter.AuthClient` +wrapper (token-verify cache, login/2FA/lookup) is layered on top. + +```go +auth, err := stpeter.Connect("127.0.0.1:9091") +user, err := auth.VerifyToken(ctx, token) // cached ~60s +``` + +See the repo root README for versioning and the +authentication-central / authorization-local design. diff --git a/go/auth.go b/go/auth.go new file mode 100644 index 0000000..b31c459 --- /dev/null +++ b/go/auth.go @@ -0,0 +1,201 @@ +// Package stpeter is the official Go client for st-peter (aura-users) — +// the central authentication service. +// +// Design: authentication central, authorization local. st-peter answers +// *who is this token?* — it returns the verified identity plus the user's +// platform roles. What that identity may do inside a consuming service is +// that service's own concern: keep a local roles table keyed by the +// st-peter user id by value (no cross-DB FK) and map permissions there. +// This package deliberately ships no session/permission types. +package stpeter + +import ( + "context" + "errors" + "fmt" + "hash/fnv" + "strings" + "sync" + "time" + + pb "git.awesomike.com/pub/st-peter-client/go/genpb/auth" + "google.golang.org/grpc" + "google.golang.org/grpc/credentials/insecure" +) + +// CookieName is the session cookie issued by aura-users on login. Shared +// convention across the aura services so a session works on any of them. +const CookieName = "aura_session" + +// authCacheTTL bounds how long a verified token is served from cache. A +// revoked token stays "valid" for up to this long — logout flows must not +// rely on the cache. +const authCacheTTL = 60 * time.Second + +// ErrUnauthorized is returned when a token fails verification (or the +// response carries no user). +var ErrUnauthorized = errors.New("stpeter: unauthorized") + +type cacheEntry struct { + user *pb.AuthenticatedUser + at time.Time +} + +// AuthClient is a thin client to aura-users' AuthService with a small +// token-verify cache. It is safe for concurrent use; the underlying gRPC +// channel is reference-counted. +type AuthClient struct { + conn *grpc.ClientConn + svc pb.AuthServiceClient + + mu sync.RWMutex + cache map[uint64]cacheEntry +} + +// Connect dials aura-users and returns an AuthClient. The target is a gRPC +// target (e.g. "127.0.0.1:9091" — no scheme). The dial is lazy: Connect +// returns immediately and failures surface on the first call. +func Connect(target string, opts ...grpc.DialOption) (*AuthClient, error) { + defaults := []grpc.DialOption{ + grpc.WithTransportCredentials(insecure.NewCredentials()), + } + opts = append(defaults, opts...) + conn, err := grpc.NewClient(target, opts...) + if err != nil { + return nil, fmt.Errorf("stpeter: dial %q: %w", target, err) + } + return &AuthClient{ + conn: conn, + svc: pb.NewAuthServiceClient(conn), + cache: make(map[uint64]cacheEntry), + }, nil +} + +// Close tears down the underlying gRPC channel. +func (c *AuthClient) Close() error { return c.conn.Close() } + +// VerifyToken verifies a session token, returning the authenticated user +// (+ platform roles). Verifications are cached ~60s to avoid a gRPC +// round-trip per request. Returns ErrUnauthorized on a bad token. +func (c *AuthClient) VerifyToken(ctx context.Context, token string) (*pb.AuthenticatedUser, error) { + key := tokenHash(token) + + c.mu.RLock() + if e, ok := c.cache[key]; ok && time.Since(e.at) < authCacheTTL { + c.mu.RUnlock() + return e.user, nil + } + c.mu.RUnlock() + + resp, err := c.svc.VerifyToken(ctx, &pb.VerifyTokenRequest{ + Token: token, + IncludeUserRoles: true, // platform roles; service roles stay local + }) + if err != nil { + return nil, err + } + // Gate on Success first, then the user. The verified user is carried on + // AuthenticationResponse.authenticated_user. + if !resp.GetSuccess() || resp.GetAuthenticatedUser() == nil { + return nil, ErrUnauthorized + } + user := resp.GetAuthenticatedUser() + + c.mu.Lock() + c.cache[key] = cacheEntry{user: user, at: time.Now()} + c.mu.Unlock() + return user, nil +} + +// LoginOutcome is the result of Login / VerifyTwoFactor. Exactly one of the +// three fields is set. +type LoginOutcome struct { + // Authenticated carries the session (token + user + platform roles) on + // success. A login bridge sets the CookieName cookie from its token. + Authenticated *pb.AuthenticatedUser + // TwoFactorID is non-empty when aura-users issued a one-time passcode + // challenge; collect the code and call VerifyTwoFactor with it. + TwoFactorID string + // FailureMessage is non-empty when the login failed (bad credentials, + // locked out, …) — a display message. + FailureMessage string +} + +// interpretAuthResponse maps an AuthenticationResponse to a LoginOutcome +// (shared by Login and VerifyTwoFactor): 2FA-required first, then success, +// else fail. +func interpretAuthResponse(resp *pb.AuthenticationResponse) LoginOutcome { + if resp.GetPassCodeRequired() { + return LoginOutcome{TwoFactorID: resp.GetTwoFactorId()} + } + if resp.GetSuccess() && resp.GetAuthenticatedUser() != nil { + return LoginOutcome{Authenticated: resp.GetAuthenticatedUser()} + } + msg := resp.GetMessage() + if msg == "" { + msg = "Invalid email or password." + } + return LoginOutcome{FailureMessage: msg} +} + +// Login authenticates by identifier (email/phone) + password. +func (c *AuthClient) Login(ctx context.Context, identifier, password string) (LoginOutcome, error) { + resp, err := c.svc.Login(ctx, &pb.LoginRequest{ + UserIdentifier: identifier, + Password: password, + }) + if err != nil { + return LoginOutcome{}, err + } + return interpretAuthResponse(resp), nil +} + +// VerifyTwoFactor completes a two-factor challenge with the OTP code, +// returning the authenticated session on success. +func (c *AuthClient) VerifyTwoFactor(ctx context.Context, twoFactorID, code string) (LoginOutcome, error) { + resp, err := c.svc.VerifyTwoFactor(ctx, &pb.VerifyTwoFactorRequest{ + TwoFactorId: twoFactorID, + Code: code, + }) + if err != nil { + return LoginOutcome{}, err + } + return interpretAuthResponse(resp), nil +} + +// LookupUser resolves a st-peter user by exact identifier (email / phone / +// handle). LookupUser requires an authenticated actor — pass the acting +// user's own user id + session token. Returns (nil, nil) when not found. +func (c *AuthClient) LookupUser(ctx context.Context, actorUserID, actorToken, identifier string) (*pb.User, error) { + resp, err := c.svc.LookupUser(ctx, &pb.LookupUserRequest{ + UserId: actorUserID, + UserToken: actorToken, + Identifier: identifier, + }) + if err != nil { + return nil, err + } + if !resp.GetSuccess() { + return nil, nil + } + return resp.GetUser(), nil +} + +// Bearer extracts a `Bearer ` from an Authorization header value. +// The shared convention across aura services is: Bearer header first, then +// the CookieName session cookie. +func Bearer(authorization string) (string, bool) { + tok, ok := strings.CutPrefix(authorization, "Bearer ") + if !ok { + return "", false + } + return strings.TrimSpace(tok), true +} + +// tokenHash is a fast (non-cryptographic) hash of the token, used only as +// the cache key. +func tokenHash(token string) uint64 { + h := fnv.New64a() + _, _ = h.Write([]byte(token)) + return h.Sum64() +} diff --git a/go/genpb/auth/st-peter-auth.pb.go b/go/genpb/auth/st-peter-auth.pb.go new file mode 100644 index 0000000..3bef6f0 --- /dev/null +++ b/go/genpb/auth/st-peter-auth.pb.go @@ -0,0 +1,6120 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.11 +// protoc v7.34.1 +// source: st-peter-auth.proto + +package auth_service + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + timestamppb "google.golang.org/protobuf/types/known/timestamppb" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type ResultCode int32 + +const ( + ResultCode_RESULT_CODE_SUCCESS ResultCode = 0 + ResultCode_RESULT_CODE_NOT_FOUND ResultCode = 1 + ResultCode_RESULT_CODE_INTERNAL_SERVER_ERROR ResultCode = 2 + ResultCode_RESULT_CODE_BAD_REQUEST ResultCode = 3 + ResultCode_RESULT_CODE_NOT_AUTHORIZED ResultCode = 4 + ResultCode_RESULT_CODE_FORBIDDEN ResultCode = 5 + ResultCode_RESULT_CODE_VALIDATION_ERRORS ResultCode = 6 + ResultCode_RESULT_CODE_PASSCODE_REQUIRED ResultCode = 7 + ResultCode_RESULT_CODE_TOO_MANY_REQUESTS ResultCode = 9 + ResultCode_RESULT_CODE_INVALID_CREDENTIALS ResultCode = 8 + ResultCode_RESULT_CODE_INACTIVE_USER ResultCode = 10 + ResultCode_RESULT_CODE_IDENTITY_IN_USE ResultCode = 11 + ResultCode_RESULT_CODE_NEXT_STEP ResultCode = 12 +) + +// Enum value maps for ResultCode. +var ( + ResultCode_name = map[int32]string{ + 0: "RESULT_CODE_SUCCESS", + 1: "RESULT_CODE_NOT_FOUND", + 2: "RESULT_CODE_INTERNAL_SERVER_ERROR", + 3: "RESULT_CODE_BAD_REQUEST", + 4: "RESULT_CODE_NOT_AUTHORIZED", + 5: "RESULT_CODE_FORBIDDEN", + 6: "RESULT_CODE_VALIDATION_ERRORS", + 7: "RESULT_CODE_PASSCODE_REQUIRED", + 9: "RESULT_CODE_TOO_MANY_REQUESTS", + 8: "RESULT_CODE_INVALID_CREDENTIALS", + 10: "RESULT_CODE_INACTIVE_USER", + 11: "RESULT_CODE_IDENTITY_IN_USE", + 12: "RESULT_CODE_NEXT_STEP", + } + ResultCode_value = map[string]int32{ + "RESULT_CODE_SUCCESS": 0, + "RESULT_CODE_NOT_FOUND": 1, + "RESULT_CODE_INTERNAL_SERVER_ERROR": 2, + "RESULT_CODE_BAD_REQUEST": 3, + "RESULT_CODE_NOT_AUTHORIZED": 4, + "RESULT_CODE_FORBIDDEN": 5, + "RESULT_CODE_VALIDATION_ERRORS": 6, + "RESULT_CODE_PASSCODE_REQUIRED": 7, + "RESULT_CODE_TOO_MANY_REQUESTS": 9, + "RESULT_CODE_INVALID_CREDENTIALS": 8, + "RESULT_CODE_INACTIVE_USER": 10, + "RESULT_CODE_IDENTITY_IN_USE": 11, + "RESULT_CODE_NEXT_STEP": 12, + } +) + +func (x ResultCode) Enum() *ResultCode { + p := new(ResultCode) + *p = x + return p +} + +func (x ResultCode) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (ResultCode) Descriptor() protoreflect.EnumDescriptor { + return file_st_peter_auth_proto_enumTypes[0].Descriptor() +} + +func (ResultCode) Type() protoreflect.EnumType { + return &file_st_peter_auth_proto_enumTypes[0] +} + +func (x ResultCode) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use ResultCode.Descriptor instead. +func (ResultCode) EnumDescriptor() ([]byte, []int) { + return file_st_peter_auth_proto_rawDescGZIP(), []int{0} +} + +type ChannelType int32 + +const ( + ChannelType_CHANNEL_TYPE_UNSPECIFIED ChannelType = 0 + ChannelType_CHANNEL_TYPE_EMAIL ChannelType = 1 + ChannelType_CHANNEL_TYPE_SMS ChannelType = 2 +) + +// Enum value maps for ChannelType. +var ( + ChannelType_name = map[int32]string{ + 0: "CHANNEL_TYPE_UNSPECIFIED", + 1: "CHANNEL_TYPE_EMAIL", + 2: "CHANNEL_TYPE_SMS", + } + ChannelType_value = map[string]int32{ + "CHANNEL_TYPE_UNSPECIFIED": 0, + "CHANNEL_TYPE_EMAIL": 1, + "CHANNEL_TYPE_SMS": 2, + } +) + +func (x ChannelType) Enum() *ChannelType { + p := new(ChannelType) + *p = x + return p +} + +func (x ChannelType) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (ChannelType) Descriptor() protoreflect.EnumDescriptor { + return file_st_peter_auth_proto_enumTypes[1].Descriptor() +} + +func (ChannelType) Type() protoreflect.EnumType { + return &file_st_peter_auth_proto_enumTypes[1] +} + +func (x ChannelType) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use ChannelType.Descriptor instead. +func (ChannelType) EnumDescriptor() ([]byte, []int) { + return file_st_peter_auth_proto_rawDescGZIP(), []int{1} +} + +type VerificationCodeType int32 + +const ( + VerificationCodeType_VERIFICATION_CODE_TYPE_UNSPECIFIED VerificationCodeType = 0 + VerificationCodeType_VERIFICATION_CODE_TYPE_REGISTER VerificationCodeType = 1 + VerificationCodeType_VERIFICATION_CODE_TYPE_PASSWORD_RESET VerificationCodeType = 2 + VerificationCodeType_VERIFICATION_CODE_TYPE_OTP_LOGIN VerificationCodeType = 3 +) + +// Enum value maps for VerificationCodeType. +var ( + VerificationCodeType_name = map[int32]string{ + 0: "VERIFICATION_CODE_TYPE_UNSPECIFIED", + 1: "VERIFICATION_CODE_TYPE_REGISTER", + 2: "VERIFICATION_CODE_TYPE_PASSWORD_RESET", + 3: "VERIFICATION_CODE_TYPE_OTP_LOGIN", + } + VerificationCodeType_value = map[string]int32{ + "VERIFICATION_CODE_TYPE_UNSPECIFIED": 0, + "VERIFICATION_CODE_TYPE_REGISTER": 1, + "VERIFICATION_CODE_TYPE_PASSWORD_RESET": 2, + "VERIFICATION_CODE_TYPE_OTP_LOGIN": 3, + } +) + +func (x VerificationCodeType) Enum() *VerificationCodeType { + p := new(VerificationCodeType) + *p = x + return p +} + +func (x VerificationCodeType) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (VerificationCodeType) Descriptor() protoreflect.EnumDescriptor { + return file_st_peter_auth_proto_enumTypes[2].Descriptor() +} + +func (VerificationCodeType) Type() protoreflect.EnumType { + return &file_st_peter_auth_proto_enumTypes[2] +} + +func (x VerificationCodeType) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use VerificationCodeType.Descriptor instead. +func (VerificationCodeType) EnumDescriptor() ([]byte, []int) { + return file_st_peter_auth_proto_rawDescGZIP(), []int{2} +} + +// OAuth Provider enumeration +type OAuthProvider int32 + +const ( + OAuthProvider_OAUTH_PROVIDER_UNSPECIFIED OAuthProvider = 0 + OAuthProvider_OAUTH_PROVIDER_GOOGLE OAuthProvider = 1 + OAuthProvider_OAUTH_PROVIDER_APPLE OAuthProvider = 2 + OAuthProvider_OAUTH_PROVIDER_FACEBOOK OAuthProvider = 3 + OAuthProvider_OAUTH_PROVIDER_MICROSOFT OAuthProvider = 4 +) + +// Enum value maps for OAuthProvider. +var ( + OAuthProvider_name = map[int32]string{ + 0: "OAUTH_PROVIDER_UNSPECIFIED", + 1: "OAUTH_PROVIDER_GOOGLE", + 2: "OAUTH_PROVIDER_APPLE", + 3: "OAUTH_PROVIDER_FACEBOOK", + 4: "OAUTH_PROVIDER_MICROSOFT", + } + OAuthProvider_value = map[string]int32{ + "OAUTH_PROVIDER_UNSPECIFIED": 0, + "OAUTH_PROVIDER_GOOGLE": 1, + "OAUTH_PROVIDER_APPLE": 2, + "OAUTH_PROVIDER_FACEBOOK": 3, + "OAUTH_PROVIDER_MICROSOFT": 4, + } +) + +func (x OAuthProvider) Enum() *OAuthProvider { + p := new(OAuthProvider) + *p = x + return p +} + +func (x OAuthProvider) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (OAuthProvider) Descriptor() protoreflect.EnumDescriptor { + return file_st_peter_auth_proto_enumTypes[3].Descriptor() +} + +func (OAuthProvider) Type() protoreflect.EnumType { + return &file_st_peter_auth_proto_enumTypes[3] +} + +func (x OAuthProvider) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use OAuthProvider.Descriptor instead. +func (OAuthProvider) EnumDescriptor() ([]byte, []int) { + return file_st_peter_auth_proto_rawDescGZIP(), []int{3} +} + +type IdentityField int32 + +const ( + IdentityField_IDENTITY_FIELD_UNSPECIFIED IdentityField = 0 + IdentityField_IDENTITY_FIELD_EMAIL IdentityField = 1 + IdentityField_IDENTITY_FIELD_phone IdentityField = 2 + IdentityField_IDENTITY_FIELD_PASSWORD IdentityField = 3 + IdentityField_IDENTITY_FIELD_HANDLE IdentityField = 4 +) + +// Enum value maps for IdentityField. +var ( + IdentityField_name = map[int32]string{ + 0: "IDENTITY_FIELD_UNSPECIFIED", + 1: "IDENTITY_FIELD_EMAIL", + 2: "IDENTITY_FIELD_phone", + 3: "IDENTITY_FIELD_PASSWORD", + 4: "IDENTITY_FIELD_HANDLE", + } + IdentityField_value = map[string]int32{ + "IDENTITY_FIELD_UNSPECIFIED": 0, + "IDENTITY_FIELD_EMAIL": 1, + "IDENTITY_FIELD_phone": 2, + "IDENTITY_FIELD_PASSWORD": 3, + "IDENTITY_FIELD_HANDLE": 4, + } +) + +func (x IdentityField) Enum() *IdentityField { + p := new(IdentityField) + *p = x + return p +} + +func (x IdentityField) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (IdentityField) Descriptor() protoreflect.EnumDescriptor { + return file_st_peter_auth_proto_enumTypes[4].Descriptor() +} + +func (IdentityField) Type() protoreflect.EnumType { + return &file_st_peter_auth_proto_enumTypes[4] +} + +func (x IdentityField) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use IdentityField.Descriptor instead. +func (IdentityField) EnumDescriptor() ([]byte, []int) { + return file_st_peter_auth_proto_rawDescGZIP(), []int{4} +} + +type Date struct { + state protoimpl.MessageState `protogen:"open.v1"` + Year int32 `protobuf:"varint,1,opt,name=year,proto3" json:"year,omitempty"` + Month uint32 `protobuf:"varint,2,opt,name=month,proto3" json:"month,omitempty"` + Day uint32 `protobuf:"varint,3,opt,name=day,proto3" json:"day,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Date) Reset() { + *x = Date{} + mi := &file_st_peter_auth_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Date) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Date) ProtoMessage() {} + +func (x *Date) ProtoReflect() protoreflect.Message { + mi := &file_st_peter_auth_proto_msgTypes[0] + 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 Date.ProtoReflect.Descriptor instead. +func (*Date) Descriptor() ([]byte, []int) { + return file_st_peter_auth_proto_rawDescGZIP(), []int{0} +} + +func (x *Date) GetYear() int32 { + if x != nil { + return x.Year + } + return 0 +} + +func (x *Date) GetMonth() uint32 { + if x != nil { + return x.Month + } + return 0 +} + +func (x *Date) GetDay() uint32 { + if x != nil { + return x.Day + } + return 0 +} + +type User struct { + state protoimpl.MessageState `protogen:"open.v1"` + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Email string `protobuf:"bytes,2,opt,name=email,proto3" json:"email,omitempty"` + Phone string `protobuf:"bytes,3,opt,name=phone,proto3" json:"phone,omitempty"` + FirstNames string `protobuf:"bytes,4,opt,name=first_names,json=firstNames,proto3" json:"first_names,omitempty"` + LastName string `protobuf:"bytes,5,opt,name=last_name,json=lastName,proto3" json:"last_name,omitempty"` + ProfilePictureUrl string `protobuf:"bytes,6,opt,name=profile_picture_url,json=profilePictureUrl,proto3" json:"profile_picture_url,omitempty"` + Handle *string `protobuf:"bytes,7,opt,name=handle,proto3,oneof" json:"handle,omitempty"` + CreatedAt *timestamppb.Timestamp `protobuf:"bytes,10,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"` + UpdatedAt *timestamppb.Timestamp `protobuf:"bytes,11,opt,name=updated_at,json=updatedAt,proto3" json:"updated_at,omitempty"` + DeletedAt *timestamppb.Timestamp `protobuf:"bytes,12,opt,name=deleted_at,json=deletedAt,proto3" json:"deleted_at,omitempty"` + LastLogin *timestamppb.Timestamp `protobuf:"bytes,13,opt,name=last_login,json=lastLogin,proto3" json:"last_login,omitempty"` + IsActive bool `protobuf:"varint,20,opt,name=is_active,json=isActive,proto3" json:"is_active,omitempty"` + IsEmailVerified bool `protobuf:"varint,21,opt,name=is_email_verified,json=isEmailVerified,proto3" json:"is_email_verified,omitempty"` + IsPhoneVerified bool `protobuf:"varint,22,opt,name=is_phone_verified,json=isPhoneVerified,proto3" json:"is_phone_verified,omitempty"` + DateOfBirth *Date `protobuf:"bytes,23,opt,name=date_of_birth,json=dateOfBirth,proto3" json:"date_of_birth,omitempty"` + Version int64 `protobuf:"varint,24,opt,name=version,proto3" json:"version,omitempty"` + SocialAccounts []*SocialAccount `protobuf:"bytes,30,rep,name=social_accounts,json=socialAccounts,proto3" json:"social_accounts,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *User) Reset() { + *x = User{} + mi := &file_st_peter_auth_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *User) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*User) ProtoMessage() {} + +func (x *User) ProtoReflect() protoreflect.Message { + mi := &file_st_peter_auth_proto_msgTypes[1] + 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 User.ProtoReflect.Descriptor instead. +func (*User) Descriptor() ([]byte, []int) { + return file_st_peter_auth_proto_rawDescGZIP(), []int{1} +} + +func (x *User) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *User) GetEmail() string { + if x != nil { + return x.Email + } + return "" +} + +func (x *User) GetPhone() string { + if x != nil { + return x.Phone + } + return "" +} + +func (x *User) GetFirstNames() string { + if x != nil { + return x.FirstNames + } + return "" +} + +func (x *User) GetLastName() string { + if x != nil { + return x.LastName + } + return "" +} + +func (x *User) GetProfilePictureUrl() string { + if x != nil { + return x.ProfilePictureUrl + } + return "" +} + +func (x *User) GetHandle() string { + if x != nil && x.Handle != nil { + return *x.Handle + } + return "" +} + +func (x *User) GetCreatedAt() *timestamppb.Timestamp { + if x != nil { + return x.CreatedAt + } + return nil +} + +func (x *User) GetUpdatedAt() *timestamppb.Timestamp { + if x != nil { + return x.UpdatedAt + } + return nil +} + +func (x *User) GetDeletedAt() *timestamppb.Timestamp { + if x != nil { + return x.DeletedAt + } + return nil +} + +func (x *User) GetLastLogin() *timestamppb.Timestamp { + if x != nil { + return x.LastLogin + } + return nil +} + +func (x *User) GetIsActive() bool { + if x != nil { + return x.IsActive + } + return false +} + +func (x *User) GetIsEmailVerified() bool { + if x != nil { + return x.IsEmailVerified + } + return false +} + +func (x *User) GetIsPhoneVerified() bool { + if x != nil { + return x.IsPhoneVerified + } + return false +} + +func (x *User) GetDateOfBirth() *Date { + if x != nil { + return x.DateOfBirth + } + return nil +} + +func (x *User) GetVersion() int64 { + if x != nil { + return x.Version + } + return 0 +} + +func (x *User) GetSocialAccounts() []*SocialAccount { + if x != nil { + return x.SocialAccounts + } + return nil +} + +type UserPreference struct { + state protoimpl.MessageState `protogen:"open.v1"` + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + UserId string `protobuf:"bytes,2,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` + PreferenceCode string `protobuf:"bytes,3,opt,name=preference_code,json=preferenceCode,proto3" json:"preference_code,omitempty"` + PreferenceValueType string `protobuf:"bytes,4,opt,name=preference_value_type,json=preferenceValueType,proto3" json:"preference_value_type,omitempty"` + PreferenceValue string `protobuf:"bytes,5,opt,name=preference_value,json=preferenceValue,proto3" json:"preference_value,omitempty"` + CreatedAt *timestamppb.Timestamp `protobuf:"bytes,10,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"` + UpdatedAt *timestamppb.Timestamp `protobuf:"bytes,11,opt,name=updated_at,json=updatedAt,proto3" json:"updated_at,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *UserPreference) Reset() { + *x = UserPreference{} + mi := &file_st_peter_auth_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *UserPreference) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UserPreference) ProtoMessage() {} + +func (x *UserPreference) ProtoReflect() protoreflect.Message { + mi := &file_st_peter_auth_proto_msgTypes[2] + 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 UserPreference.ProtoReflect.Descriptor instead. +func (*UserPreference) Descriptor() ([]byte, []int) { + return file_st_peter_auth_proto_rawDescGZIP(), []int{2} +} + +func (x *UserPreference) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *UserPreference) GetUserId() string { + if x != nil { + return x.UserId + } + return "" +} + +func (x *UserPreference) GetPreferenceCode() string { + if x != nil { + return x.PreferenceCode + } + return "" +} + +func (x *UserPreference) GetPreferenceValueType() string { + if x != nil { + return x.PreferenceValueType + } + return "" +} + +func (x *UserPreference) GetPreferenceValue() string { + if x != nil { + return x.PreferenceValue + } + return "" +} + +func (x *UserPreference) GetCreatedAt() *timestamppb.Timestamp { + if x != nil { + return x.CreatedAt + } + return nil +} + +func (x *UserPreference) GetUpdatedAt() *timestamppb.Timestamp { + if x != nil { + return x.UpdatedAt + } + return nil +} + +type Role struct { + state protoimpl.MessageState `protogen:"open.v1"` + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Code string `protobuf:"bytes,2,opt,name=code,proto3" json:"code,omitempty"` + Description string `protobuf:"bytes,3,opt,name=description,proto3" json:"description,omitempty"` + CreatedAt *timestamppb.Timestamp `protobuf:"bytes,4,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"` + UpdatedAt *timestamppb.Timestamp `protobuf:"bytes,5,opt,name=updated_at,json=updatedAt,proto3" json:"updated_at,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Role) Reset() { + *x = Role{} + mi := &file_st_peter_auth_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Role) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Role) ProtoMessage() {} + +func (x *Role) ProtoReflect() protoreflect.Message { + mi := &file_st_peter_auth_proto_msgTypes[3] + 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 Role.ProtoReflect.Descriptor instead. +func (*Role) Descriptor() ([]byte, []int) { + return file_st_peter_auth_proto_rawDescGZIP(), []int{3} +} + +func (x *Role) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *Role) GetCode() string { + if x != nil { + return x.Code + } + return "" +} + +func (x *Role) GetDescription() string { + if x != nil { + return x.Description + } + return "" +} + +func (x *Role) GetCreatedAt() *timestamppb.Timestamp { + if x != nil { + return x.CreatedAt + } + return nil +} + +func (x *Role) GetUpdatedAt() *timestamppb.Timestamp { + if x != nil { + return x.UpdatedAt + } + return nil +} + +type SocialAccount struct { + state protoimpl.MessageState `protogen:"open.v1"` + Provider string `protobuf:"bytes,1,opt,name=provider,proto3" json:"provider,omitempty"` + ProviderUserId string `protobuf:"bytes,2,opt,name=provider_user_id,json=providerUserId,proto3" json:"provider_user_id,omitempty"` + AccessToken string `protobuf:"bytes,3,opt,name=access_token,json=accessToken,proto3" json:"access_token,omitempty"` + ExpiresAt *timestamppb.Timestamp `protobuf:"bytes,4,opt,name=expires_at,json=expiresAt,proto3" json:"expires_at,omitempty"` + Email string `protobuf:"bytes,5,opt,name=email,proto3" json:"email,omitempty"` + Name string `protobuf:"bytes,6,opt,name=name,proto3" json:"name,omitempty"` + ProfilePictureUrl string `protobuf:"bytes,7,opt,name=profile_picture_url,json=profilePictureUrl,proto3" json:"profile_picture_url,omitempty"` + EmailVerified bool `protobuf:"varint,8,opt,name=email_verified,json=emailVerified,proto3" json:"email_verified,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SocialAccount) Reset() { + *x = SocialAccount{} + mi := &file_st_peter_auth_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SocialAccount) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SocialAccount) ProtoMessage() {} + +func (x *SocialAccount) ProtoReflect() protoreflect.Message { + mi := &file_st_peter_auth_proto_msgTypes[4] + 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 SocialAccount.ProtoReflect.Descriptor instead. +func (*SocialAccount) Descriptor() ([]byte, []int) { + return file_st_peter_auth_proto_rawDescGZIP(), []int{4} +} + +func (x *SocialAccount) GetProvider() string { + if x != nil { + return x.Provider + } + return "" +} + +func (x *SocialAccount) GetProviderUserId() string { + if x != nil { + return x.ProviderUserId + } + return "" +} + +func (x *SocialAccount) GetAccessToken() string { + if x != nil { + return x.AccessToken + } + return "" +} + +func (x *SocialAccount) GetExpiresAt() *timestamppb.Timestamp { + if x != nil { + return x.ExpiresAt + } + return nil +} + +func (x *SocialAccount) GetEmail() string { + if x != nil { + return x.Email + } + return "" +} + +func (x *SocialAccount) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *SocialAccount) GetProfilePictureUrl() string { + if x != nil { + return x.ProfilePictureUrl + } + return "" +} + +func (x *SocialAccount) GetEmailVerified() bool { + if x != nil { + return x.EmailVerified + } + return false +} + +// Mobile flow - validate ID token from native SDK +type SocialLoginRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Provider OAuthProvider `protobuf:"varint,1,opt,name=provider,proto3,enum=st_peter.auth.OAuthProvider" json:"provider,omitempty"` + IdToken string `protobuf:"bytes,2,opt,name=id_token,json=idToken,proto3" json:"id_token,omitempty"` // JWT from Google/Apple SDK + AccessToken string `protobuf:"bytes,3,opt,name=access_token,json=accessToken,proto3" json:"access_token,omitempty"` // For Facebook + DeviceInfo *DeviceInfo `protobuf:"bytes,4,opt,name=device_info,json=deviceInfo,proto3" json:"device_info,omitempty"` + Nonce string `protobuf:"bytes,5,opt,name=nonce,proto3" json:"nonce,omitempty"` // For Apple Sign-In security + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SocialLoginRequest) Reset() { + *x = SocialLoginRequest{} + mi := &file_st_peter_auth_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SocialLoginRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SocialLoginRequest) ProtoMessage() {} + +func (x *SocialLoginRequest) ProtoReflect() protoreflect.Message { + mi := &file_st_peter_auth_proto_msgTypes[5] + 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 SocialLoginRequest.ProtoReflect.Descriptor instead. +func (*SocialLoginRequest) Descriptor() ([]byte, []int) { + return file_st_peter_auth_proto_rawDescGZIP(), []int{5} +} + +func (x *SocialLoginRequest) GetProvider() OAuthProvider { + if x != nil { + return x.Provider + } + return OAuthProvider_OAUTH_PROVIDER_UNSPECIFIED +} + +func (x *SocialLoginRequest) GetIdToken() string { + if x != nil { + return x.IdToken + } + return "" +} + +func (x *SocialLoginRequest) GetAccessToken() string { + if x != nil { + return x.AccessToken + } + return "" +} + +func (x *SocialLoginRequest) GetDeviceInfo() *DeviceInfo { + if x != nil { + return x.DeviceInfo + } + return nil +} + +func (x *SocialLoginRequest) GetNonce() string { + if x != nil { + return x.Nonce + } + return "" +} + +type SocialLoginResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + ResultCode ResultCode `protobuf:"varint,2,opt,name=result_code,json=resultCode,proto3,enum=st_peter.auth.ResultCode" json:"result_code,omitempty"` + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` + AuthenticatedUser *AuthenticatedUser `protobuf:"bytes,4,opt,name=authenticated_user,json=authenticatedUser,proto3" json:"authenticated_user,omitempty"` + IsNewUser bool `protobuf:"varint,5,opt,name=is_new_user,json=isNewUser,proto3" json:"is_new_user,omitempty"` + WasAutoLinked bool `protobuf:"varint,6,opt,name=was_auto_linked,json=wasAutoLinked,proto3" json:"was_auto_linked,omitempty"` + ValidationErrors []*ValidationError `protobuf:"bytes,7,rep,name=validation_errors,json=validationErrors,proto3" json:"validation_errors,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SocialLoginResponse) Reset() { + *x = SocialLoginResponse{} + mi := &file_st_peter_auth_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SocialLoginResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SocialLoginResponse) ProtoMessage() {} + +func (x *SocialLoginResponse) ProtoReflect() protoreflect.Message { + mi := &file_st_peter_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 SocialLoginResponse.ProtoReflect.Descriptor instead. +func (*SocialLoginResponse) Descriptor() ([]byte, []int) { + return file_st_peter_auth_proto_rawDescGZIP(), []int{6} +} + +func (x *SocialLoginResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *SocialLoginResponse) GetResultCode() ResultCode { + if x != nil { + return x.ResultCode + } + return ResultCode_RESULT_CODE_SUCCESS +} + +func (x *SocialLoginResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +func (x *SocialLoginResponse) GetAuthenticatedUser() *AuthenticatedUser { + if x != nil { + return x.AuthenticatedUser + } + return nil +} + +func (x *SocialLoginResponse) GetIsNewUser() bool { + if x != nil { + return x.IsNewUser + } + return false +} + +func (x *SocialLoginResponse) GetWasAutoLinked() bool { + if x != nil { + return x.WasAutoLinked + } + return false +} + +func (x *SocialLoginResponse) GetValidationErrors() []*ValidationError { + if x != nil { + return x.ValidationErrors + } + return nil +} + +// Web flow - initiate OAuth redirect +type InitiateOAuthRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Provider OAuthProvider `protobuf:"varint,1,opt,name=provider,proto3,enum=st_peter.auth.OAuthProvider" json:"provider,omitempty"` + RedirectUri string `protobuf:"bytes,2,opt,name=redirect_uri,json=redirectUri,proto3" json:"redirect_uri,omitempty"` + State string `protobuf:"bytes,3,opt,name=state,proto3" json:"state,omitempty"` // Client-provided state for additional verification + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *InitiateOAuthRequest) Reset() { + *x = InitiateOAuthRequest{} + mi := &file_st_peter_auth_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *InitiateOAuthRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*InitiateOAuthRequest) ProtoMessage() {} + +func (x *InitiateOAuthRequest) ProtoReflect() protoreflect.Message { + mi := &file_st_peter_auth_proto_msgTypes[7] + 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 InitiateOAuthRequest.ProtoReflect.Descriptor instead. +func (*InitiateOAuthRequest) Descriptor() ([]byte, []int) { + return file_st_peter_auth_proto_rawDescGZIP(), []int{7} +} + +func (x *InitiateOAuthRequest) GetProvider() OAuthProvider { + if x != nil { + return x.Provider + } + return OAuthProvider_OAUTH_PROVIDER_UNSPECIFIED +} + +func (x *InitiateOAuthRequest) GetRedirectUri() string { + if x != nil { + return x.RedirectUri + } + return "" +} + +func (x *InitiateOAuthRequest) GetState() string { + if x != nil { + return x.State + } + return "" +} + +type InitiateOAuthResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + ResultCode ResultCode `protobuf:"varint,2,opt,name=result_code,json=resultCode,proto3,enum=st_peter.auth.ResultCode" json:"result_code,omitempty"` + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` + AuthorizationUrl string `protobuf:"bytes,4,opt,name=authorization_url,json=authorizationUrl,proto3" json:"authorization_url,omitempty"` + State string `protobuf:"bytes,5,opt,name=state,proto3" json:"state,omitempty"` // Server-generated state token + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *InitiateOAuthResponse) Reset() { + *x = InitiateOAuthResponse{} + mi := &file_st_peter_auth_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *InitiateOAuthResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*InitiateOAuthResponse) ProtoMessage() {} + +func (x *InitiateOAuthResponse) ProtoReflect() protoreflect.Message { + mi := &file_st_peter_auth_proto_msgTypes[8] + 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 InitiateOAuthResponse.ProtoReflect.Descriptor instead. +func (*InitiateOAuthResponse) Descriptor() ([]byte, []int) { + return file_st_peter_auth_proto_rawDescGZIP(), []int{8} +} + +func (x *InitiateOAuthResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *InitiateOAuthResponse) GetResultCode() ResultCode { + if x != nil { + return x.ResultCode + } + return ResultCode_RESULT_CODE_SUCCESS +} + +func (x *InitiateOAuthResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +func (x *InitiateOAuthResponse) GetAuthorizationUrl() string { + if x != nil { + return x.AuthorizationUrl + } + return "" +} + +func (x *InitiateOAuthResponse) GetState() string { + if x != nil { + return x.State + } + return "" +} + +// Web flow - handle callback +type OAuthCallbackRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Provider OAuthProvider `protobuf:"varint,1,opt,name=provider,proto3,enum=st_peter.auth.OAuthProvider" json:"provider,omitempty"` + Code string `protobuf:"bytes,2,opt,name=code,proto3" json:"code,omitempty"` + State string `protobuf:"bytes,3,opt,name=state,proto3" json:"state,omitempty"` + DeviceInfo *DeviceInfo `protobuf:"bytes,4,opt,name=device_info,json=deviceInfo,proto3" json:"device_info,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *OAuthCallbackRequest) Reset() { + *x = OAuthCallbackRequest{} + mi := &file_st_peter_auth_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *OAuthCallbackRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*OAuthCallbackRequest) ProtoMessage() {} + +func (x *OAuthCallbackRequest) ProtoReflect() protoreflect.Message { + mi := &file_st_peter_auth_proto_msgTypes[9] + 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 OAuthCallbackRequest.ProtoReflect.Descriptor instead. +func (*OAuthCallbackRequest) Descriptor() ([]byte, []int) { + return file_st_peter_auth_proto_rawDescGZIP(), []int{9} +} + +func (x *OAuthCallbackRequest) GetProvider() OAuthProvider { + if x != nil { + return x.Provider + } + return OAuthProvider_OAUTH_PROVIDER_UNSPECIFIED +} + +func (x *OAuthCallbackRequest) GetCode() string { + if x != nil { + return x.Code + } + return "" +} + +func (x *OAuthCallbackRequest) GetState() string { + if x != nil { + return x.State + } + return "" +} + +func (x *OAuthCallbackRequest) GetDeviceInfo() *DeviceInfo { + if x != nil { + return x.DeviceInfo + } + return nil +} + +// Account linking +type LinkSocialAccountRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + ActorId string `protobuf:"bytes,1,opt,name=actor_id,json=actorId,proto3" json:"actor_id,omitempty"` + ActorToken string `protobuf:"bytes,2,opt,name=actor_token,json=actorToken,proto3" json:"actor_token,omitempty"` + Provider OAuthProvider `protobuf:"varint,3,opt,name=provider,proto3,enum=st_peter.auth.OAuthProvider" json:"provider,omitempty"` + IdToken string `protobuf:"bytes,4,opt,name=id_token,json=idToken,proto3" json:"id_token,omitempty"` + AccessToken string `protobuf:"bytes,5,opt,name=access_token,json=accessToken,proto3" json:"access_token,omitempty"` + Nonce string `protobuf:"bytes,6,opt,name=nonce,proto3" json:"nonce,omitempty"` // For Apple Sign-In + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *LinkSocialAccountRequest) Reset() { + *x = LinkSocialAccountRequest{} + mi := &file_st_peter_auth_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *LinkSocialAccountRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*LinkSocialAccountRequest) ProtoMessage() {} + +func (x *LinkSocialAccountRequest) ProtoReflect() protoreflect.Message { + mi := &file_st_peter_auth_proto_msgTypes[10] + 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 LinkSocialAccountRequest.ProtoReflect.Descriptor instead. +func (*LinkSocialAccountRequest) Descriptor() ([]byte, []int) { + return file_st_peter_auth_proto_rawDescGZIP(), []int{10} +} + +func (x *LinkSocialAccountRequest) GetActorId() string { + if x != nil { + return x.ActorId + } + return "" +} + +func (x *LinkSocialAccountRequest) GetActorToken() string { + if x != nil { + return x.ActorToken + } + return "" +} + +func (x *LinkSocialAccountRequest) GetProvider() OAuthProvider { + if x != nil { + return x.Provider + } + return OAuthProvider_OAUTH_PROVIDER_UNSPECIFIED +} + +func (x *LinkSocialAccountRequest) GetIdToken() string { + if x != nil { + return x.IdToken + } + return "" +} + +func (x *LinkSocialAccountRequest) GetAccessToken() string { + if x != nil { + return x.AccessToken + } + return "" +} + +func (x *LinkSocialAccountRequest) GetNonce() string { + if x != nil { + return x.Nonce + } + return "" +} + +type UnlinkSocialAccountRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + ActorId string `protobuf:"bytes,1,opt,name=actor_id,json=actorId,proto3" json:"actor_id,omitempty"` + ActorToken string `protobuf:"bytes,2,opt,name=actor_token,json=actorToken,proto3" json:"actor_token,omitempty"` + Provider OAuthProvider `protobuf:"varint,3,opt,name=provider,proto3,enum=st_peter.auth.OAuthProvider" json:"provider,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *UnlinkSocialAccountRequest) Reset() { + *x = UnlinkSocialAccountRequest{} + mi := &file_st_peter_auth_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *UnlinkSocialAccountRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UnlinkSocialAccountRequest) ProtoMessage() {} + +func (x *UnlinkSocialAccountRequest) ProtoReflect() protoreflect.Message { + mi := &file_st_peter_auth_proto_msgTypes[11] + 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 UnlinkSocialAccountRequest.ProtoReflect.Descriptor instead. +func (*UnlinkSocialAccountRequest) Descriptor() ([]byte, []int) { + return file_st_peter_auth_proto_rawDescGZIP(), []int{11} +} + +func (x *UnlinkSocialAccountRequest) GetActorId() string { + if x != nil { + return x.ActorId + } + return "" +} + +func (x *UnlinkSocialAccountRequest) GetActorToken() string { + if x != nil { + return x.ActorToken + } + return "" +} + +func (x *UnlinkSocialAccountRequest) GetProvider() OAuthProvider { + if x != nil { + return x.Provider + } + return OAuthProvider_OAUTH_PROVIDER_UNSPECIFIED +} + +type GetLinkedAccountsRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + ActorId string `protobuf:"bytes,1,opt,name=actor_id,json=actorId,proto3" json:"actor_id,omitempty"` + ActorToken string `protobuf:"bytes,2,opt,name=actor_token,json=actorToken,proto3" json:"actor_token,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetLinkedAccountsRequest) Reset() { + *x = GetLinkedAccountsRequest{} + mi := &file_st_peter_auth_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetLinkedAccountsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetLinkedAccountsRequest) ProtoMessage() {} + +func (x *GetLinkedAccountsRequest) ProtoReflect() protoreflect.Message { + mi := &file_st_peter_auth_proto_msgTypes[12] + 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 GetLinkedAccountsRequest.ProtoReflect.Descriptor instead. +func (*GetLinkedAccountsRequest) Descriptor() ([]byte, []int) { + return file_st_peter_auth_proto_rawDescGZIP(), []int{12} +} + +func (x *GetLinkedAccountsRequest) GetActorId() string { + if x != nil { + return x.ActorId + } + return "" +} + +func (x *GetLinkedAccountsRequest) GetActorToken() string { + if x != nil { + return x.ActorToken + } + return "" +} + +type GetLinkedAccountsResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + ResultCode ResultCode `protobuf:"varint,2,opt,name=result_code,json=resultCode,proto3,enum=st_peter.auth.ResultCode" json:"result_code,omitempty"` + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` + Accounts []*SocialAccount `protobuf:"bytes,4,rep,name=accounts,proto3" json:"accounts,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetLinkedAccountsResponse) Reset() { + *x = GetLinkedAccountsResponse{} + mi := &file_st_peter_auth_proto_msgTypes[13] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetLinkedAccountsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetLinkedAccountsResponse) ProtoMessage() {} + +func (x *GetLinkedAccountsResponse) ProtoReflect() protoreflect.Message { + mi := &file_st_peter_auth_proto_msgTypes[13] + 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 GetLinkedAccountsResponse.ProtoReflect.Descriptor instead. +func (*GetLinkedAccountsResponse) Descriptor() ([]byte, []int) { + return file_st_peter_auth_proto_rawDescGZIP(), []int{13} +} + +func (x *GetLinkedAccountsResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *GetLinkedAccountsResponse) GetResultCode() ResultCode { + if x != nil { + return x.ResultCode + } + return ResultCode_RESULT_CODE_SUCCESS +} + +func (x *GetLinkedAccountsResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +func (x *GetLinkedAccountsResponse) GetAccounts() []*SocialAccount { + if x != nil { + return x.Accounts + } + return nil +} + +type RegisterUserRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + UserIdentifier string `protobuf:"bytes,1,opt,name=user_identifier,json=userIdentifier,proto3" json:"user_identifier,omitempty"` + Password string `protobuf:"bytes,2,opt,name=password,proto3" json:"password,omitempty"` + FirstNames string `protobuf:"bytes,4,opt,name=first_names,json=firstNames,proto3" json:"first_names,omitempty"` + LastName string `protobuf:"bytes,5,opt,name=last_name,json=lastName,proto3" json:"last_name,omitempty"` + AppHash string `protobuf:"bytes,6,opt,name=app_hash,json=appHash,proto3" json:"app_hash,omitempty"` + DeviceInfo *DeviceInfo `protobuf:"bytes,7,opt,name=device_info,json=deviceInfo,proto3" json:"device_info,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *RegisterUserRequest) Reset() { + *x = RegisterUserRequest{} + mi := &file_st_peter_auth_proto_msgTypes[14] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *RegisterUserRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RegisterUserRequest) ProtoMessage() {} + +func (x *RegisterUserRequest) ProtoReflect() protoreflect.Message { + mi := &file_st_peter_auth_proto_msgTypes[14] + 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 RegisterUserRequest.ProtoReflect.Descriptor instead. +func (*RegisterUserRequest) Descriptor() ([]byte, []int) { + return file_st_peter_auth_proto_rawDescGZIP(), []int{14} +} + +func (x *RegisterUserRequest) GetUserIdentifier() string { + if x != nil { + return x.UserIdentifier + } + return "" +} + +func (x *RegisterUserRequest) GetPassword() string { + if x != nil { + return x.Password + } + return "" +} + +func (x *RegisterUserRequest) GetFirstNames() string { + if x != nil { + return x.FirstNames + } + return "" +} + +func (x *RegisterUserRequest) GetLastName() string { + if x != nil { + return x.LastName + } + return "" +} + +func (x *RegisterUserRequest) GetAppHash() string { + if x != nil { + return x.AppHash + } + return "" +} + +func (x *RegisterUserRequest) GetDeviceInfo() *DeviceInfo { + if x != nil { + return x.DeviceInfo + } + return nil +} + +type RegisterUserResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + ResultCode ResultCode `protobuf:"varint,2,opt,name=result_code,json=resultCode,proto3,enum=st_peter.auth.ResultCode" json:"result_code,omitempty"` + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` + RegistrationId string `protobuf:"bytes,4,opt,name=registration_id,json=registrationId,proto3" json:"registration_id,omitempty"` + ValidationErrors []*ValidationError `protobuf:"bytes,5,rep,name=validation_errors,json=validationErrors,proto3" json:"validation_errors,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *RegisterUserResponse) Reset() { + *x = RegisterUserResponse{} + mi := &file_st_peter_auth_proto_msgTypes[15] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *RegisterUserResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RegisterUserResponse) ProtoMessage() {} + +func (x *RegisterUserResponse) ProtoReflect() protoreflect.Message { + mi := &file_st_peter_auth_proto_msgTypes[15] + 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 RegisterUserResponse.ProtoReflect.Descriptor instead. +func (*RegisterUserResponse) Descriptor() ([]byte, []int) { + return file_st_peter_auth_proto_rawDescGZIP(), []int{15} +} + +func (x *RegisterUserResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *RegisterUserResponse) GetResultCode() ResultCode { + if x != nil { + return x.ResultCode + } + return ResultCode_RESULT_CODE_SUCCESS +} + +func (x *RegisterUserResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +func (x *RegisterUserResponse) GetRegistrationId() string { + if x != nil { + return x.RegistrationId + } + return "" +} + +func (x *RegisterUserResponse) GetValidationErrors() []*ValidationError { + if x != nil { + return x.ValidationErrors + } + return nil +} + +type VerifyRegisterUserRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + UserIdentifier string `protobuf:"bytes,1,opt,name=user_identifier,json=userIdentifier,proto3" json:"user_identifier,omitempty"` // Can be either email or phone + RegistrationId string `protobuf:"bytes,2,opt,name=registration_id,json=registrationId,proto3" json:"registration_id,omitempty"` + Token string `protobuf:"bytes,3,opt,name=token,proto3" json:"token,omitempty"` //Token has a redirect to encoded in it. + DeviceInfo *DeviceInfo `protobuf:"bytes,4,opt,name=device_info,json=deviceInfo,proto3" json:"device_info,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *VerifyRegisterUserRequest) Reset() { + *x = VerifyRegisterUserRequest{} + mi := &file_st_peter_auth_proto_msgTypes[16] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *VerifyRegisterUserRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*VerifyRegisterUserRequest) ProtoMessage() {} + +func (x *VerifyRegisterUserRequest) ProtoReflect() protoreflect.Message { + mi := &file_st_peter_auth_proto_msgTypes[16] + 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 VerifyRegisterUserRequest.ProtoReflect.Descriptor instead. +func (*VerifyRegisterUserRequest) Descriptor() ([]byte, []int) { + return file_st_peter_auth_proto_rawDescGZIP(), []int{16} +} + +func (x *VerifyRegisterUserRequest) GetUserIdentifier() string { + if x != nil { + return x.UserIdentifier + } + return "" +} + +func (x *VerifyRegisterUserRequest) GetRegistrationId() string { + if x != nil { + return x.RegistrationId + } + return "" +} + +func (x *VerifyRegisterUserRequest) GetToken() string { + if x != nil { + return x.Token + } + return "" +} + +func (x *VerifyRegisterUserRequest) GetDeviceInfo() *DeviceInfo { + if x != nil { + return x.DeviceInfo + } + return nil +} + +type UserResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + ResultCode ResultCode `protobuf:"varint,2,opt,name=result_code,json=resultCode,proto3,enum=st_peter.auth.ResultCode" json:"result_code,omitempty"` + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` + User *User `protobuf:"bytes,4,opt,name=user,proto3" json:"user,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *UserResponse) Reset() { + *x = UserResponse{} + mi := &file_st_peter_auth_proto_msgTypes[17] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *UserResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UserResponse) ProtoMessage() {} + +func (x *UserResponse) ProtoReflect() protoreflect.Message { + mi := &file_st_peter_auth_proto_msgTypes[17] + 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 UserResponse.ProtoReflect.Descriptor instead. +func (*UserResponse) Descriptor() ([]byte, []int) { + return file_st_peter_auth_proto_rawDescGZIP(), []int{17} +} + +func (x *UserResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *UserResponse) GetResultCode() ResultCode { + if x != nil { + return x.ResultCode + } + return ResultCode_RESULT_CODE_SUCCESS +} + +func (x *UserResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +func (x *UserResponse) GetUser() *User { + if x != nil { + return x.User + } + return nil +} + +type DeviceInfo struct { + state protoimpl.MessageState `protogen:"open.v1"` + ApplicationName string `protobuf:"bytes,1,opt,name=application_name,json=applicationName,proto3" json:"application_name,omitempty"` // e.g., 'web', 'mobile' + ApplicationVersion string `protobuf:"bytes,2,opt,name=application_version,json=applicationVersion,proto3" json:"application_version,omitempty"` //e.g., '1.0.0' + DeviceName string `protobuf:"bytes,3,opt,name=device_name,json=deviceName,proto3" json:"device_name,omitempty"` // e.g., 'iPhone X', 'Pixel 2' + DeviceType string `protobuf:"bytes,4,opt,name=device_type,json=deviceType,proto3" json:"device_type,omitempty"` // -- e.g., 'desktop', 'mobile' + DeviceOs string `protobuf:"bytes,5,opt,name=device_os,json=deviceOs,proto3" json:"device_os,omitempty"` // e. g., 'iOS', 'Android', 'Windows' + DeviceOsVersion string `protobuf:"bytes,6,opt,name=device_os_version,json=deviceOsVersion,proto3" json:"device_os_version,omitempty"` // e.g., '10', '11.4.1' + DeviceId string `protobuf:"bytes,7,opt,name=device_id,json=deviceId,proto3" json:"device_id,omitempty"` // e.g., 'imei:1234567890', 'serial:1234567890' + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *DeviceInfo) Reset() { + *x = DeviceInfo{} + mi := &file_st_peter_auth_proto_msgTypes[18] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DeviceInfo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeviceInfo) ProtoMessage() {} + +func (x *DeviceInfo) ProtoReflect() protoreflect.Message { + mi := &file_st_peter_auth_proto_msgTypes[18] + 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 DeviceInfo.ProtoReflect.Descriptor instead. +func (*DeviceInfo) Descriptor() ([]byte, []int) { + return file_st_peter_auth_proto_rawDescGZIP(), []int{18} +} + +func (x *DeviceInfo) GetApplicationName() string { + if x != nil { + return x.ApplicationName + } + return "" +} + +func (x *DeviceInfo) GetApplicationVersion() string { + if x != nil { + return x.ApplicationVersion + } + return "" +} + +func (x *DeviceInfo) GetDeviceName() string { + if x != nil { + return x.DeviceName + } + return "" +} + +func (x *DeviceInfo) GetDeviceType() string { + if x != nil { + return x.DeviceType + } + return "" +} + +func (x *DeviceInfo) GetDeviceOs() string { + if x != nil { + return x.DeviceOs + } + return "" +} + +func (x *DeviceInfo) GetDeviceOsVersion() string { + if x != nil { + return x.DeviceOsVersion + } + return "" +} + +func (x *DeviceInfo) GetDeviceId() string { + if x != nil { + return x.DeviceId + } + return "" +} + +type LoginRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + UserIdentifier string `protobuf:"bytes,1,opt,name=user_identifier,json=userIdentifier,proto3" json:"user_identifier,omitempty"` // Can be either email or phone + Password string `protobuf:"bytes,2,opt,name=password,proto3" json:"password,omitempty"` + AppHash string `protobuf:"bytes,3,opt,name=app_hash,json=appHash,proto3" json:"app_hash,omitempty"` + DeviceInfo *DeviceInfo `protobuf:"bytes,4,opt,name=device_info,json=deviceInfo,proto3" json:"device_info,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *LoginRequest) Reset() { + *x = LoginRequest{} + mi := &file_st_peter_auth_proto_msgTypes[19] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *LoginRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*LoginRequest) ProtoMessage() {} + +func (x *LoginRequest) ProtoReflect() protoreflect.Message { + mi := &file_st_peter_auth_proto_msgTypes[19] + 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 LoginRequest.ProtoReflect.Descriptor instead. +func (*LoginRequest) Descriptor() ([]byte, []int) { + return file_st_peter_auth_proto_rawDescGZIP(), []int{19} +} + +func (x *LoginRequest) GetUserIdentifier() string { + if x != nil { + return x.UserIdentifier + } + return "" +} + +func (x *LoginRequest) GetPassword() string { + if x != nil { + return x.Password + } + return "" +} + +func (x *LoginRequest) GetAppHash() string { + if x != nil { + return x.AppHash + } + return "" +} + +func (x *LoginRequest) GetDeviceInfo() *DeviceInfo { + if x != nil { + return x.DeviceInfo + } + return nil +} + +type AuthenticationResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + PassCodeRequired bool `protobuf:"varint,2,opt,name=pass_code_required,json=passCodeRequired,proto3" json:"pass_code_required,omitempty"` + TwoFactorId string `protobuf:"bytes,3,opt,name=two_factor_id,json=twoFactorId,proto3" json:"two_factor_id,omitempty"` + ResultCode ResultCode `protobuf:"varint,8,opt,name=result_code,json=resultCode,proto3,enum=st_peter.auth.ResultCode" json:"result_code,omitempty"` + Message string `protobuf:"bytes,9,opt,name=message,proto3" json:"message,omitempty"` + AuthenticatedUser *AuthenticatedUser `protobuf:"bytes,10,opt,name=authenticated_user,json=authenticatedUser,proto3" json:"authenticated_user,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *AuthenticationResponse) Reset() { + *x = AuthenticationResponse{} + mi := &file_st_peter_auth_proto_msgTypes[20] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *AuthenticationResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AuthenticationResponse) ProtoMessage() {} + +func (x *AuthenticationResponse) ProtoReflect() protoreflect.Message { + mi := &file_st_peter_auth_proto_msgTypes[20] + 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 AuthenticationResponse.ProtoReflect.Descriptor instead. +func (*AuthenticationResponse) Descriptor() ([]byte, []int) { + return file_st_peter_auth_proto_rawDescGZIP(), []int{20} +} + +func (x *AuthenticationResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *AuthenticationResponse) GetPassCodeRequired() bool { + if x != nil { + return x.PassCodeRequired + } + return false +} + +func (x *AuthenticationResponse) GetTwoFactorId() string { + if x != nil { + return x.TwoFactorId + } + return "" +} + +func (x *AuthenticationResponse) GetResultCode() ResultCode { + if x != nil { + return x.ResultCode + } + return ResultCode_RESULT_CODE_SUCCESS +} + +func (x *AuthenticationResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +func (x *AuthenticationResponse) GetAuthenticatedUser() *AuthenticatedUser { + if x != nil { + return x.AuthenticatedUser + } + return nil +} + +type AuthenticatedUser struct { + state protoimpl.MessageState `protogen:"open.v1"` + User *User `protobuf:"bytes,1,opt,name=user,proto3" json:"user,omitempty"` + Token string `protobuf:"bytes,2,opt,name=token,proto3" json:"token,omitempty"` + SessionId string `protobuf:"bytes,3,opt,name=session_id,json=sessionId,proto3" json:"session_id,omitempty"` + ExpiresAt *timestamppb.Timestamp `protobuf:"bytes,4,opt,name=expires_at,json=expiresAt,proto3" json:"expires_at,omitempty"` + UserPreferences []*UserPreference `protobuf:"bytes,5,rep,name=user_preferences,json=userPreferences,proto3" json:"user_preferences,omitempty"` + UserRoles []*AssignedUserRole `protobuf:"bytes,11,rep,name=user_roles,json=userRoles,proto3" json:"user_roles,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *AuthenticatedUser) Reset() { + *x = AuthenticatedUser{} + mi := &file_st_peter_auth_proto_msgTypes[21] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *AuthenticatedUser) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AuthenticatedUser) ProtoMessage() {} + +func (x *AuthenticatedUser) ProtoReflect() protoreflect.Message { + mi := &file_st_peter_auth_proto_msgTypes[21] + 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 AuthenticatedUser.ProtoReflect.Descriptor instead. +func (*AuthenticatedUser) Descriptor() ([]byte, []int) { + return file_st_peter_auth_proto_rawDescGZIP(), []int{21} +} + +func (x *AuthenticatedUser) GetUser() *User { + if x != nil { + return x.User + } + return nil +} + +func (x *AuthenticatedUser) GetToken() string { + if x != nil { + return x.Token + } + return "" +} + +func (x *AuthenticatedUser) GetSessionId() string { + if x != nil { + return x.SessionId + } + return "" +} + +func (x *AuthenticatedUser) GetExpiresAt() *timestamppb.Timestamp { + if x != nil { + return x.ExpiresAt + } + return nil +} + +func (x *AuthenticatedUser) GetUserPreferences() []*UserPreference { + if x != nil { + return x.UserPreferences + } + return nil +} + +func (x *AuthenticatedUser) GetUserRoles() []*AssignedUserRole { + if x != nil { + return x.UserRoles + } + return nil +} + +type AssignedUserRole struct { + state protoimpl.MessageState `protogen:"open.v1"` + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + UserId string `protobuf:"bytes,2,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` + RoleId string `protobuf:"bytes,3,opt,name=role_id,json=roleId,proto3" json:"role_id,omitempty"` + RoleName string `protobuf:"bytes,4,opt,name=role_name,json=roleName,proto3" json:"role_name,omitempty"` + ScopeCode string `protobuf:"bytes,5,opt,name=scope_code,json=scopeCode,proto3" json:"scope_code,omitempty"` + TargetId string `protobuf:"bytes,6,opt,name=target_id,json=targetId,proto3" json:"target_id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *AssignedUserRole) Reset() { + *x = AssignedUserRole{} + mi := &file_st_peter_auth_proto_msgTypes[22] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *AssignedUserRole) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AssignedUserRole) ProtoMessage() {} + +func (x *AssignedUserRole) ProtoReflect() protoreflect.Message { + mi := &file_st_peter_auth_proto_msgTypes[22] + 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 AssignedUserRole.ProtoReflect.Descriptor instead. +func (*AssignedUserRole) Descriptor() ([]byte, []int) { + return file_st_peter_auth_proto_rawDescGZIP(), []int{22} +} + +func (x *AssignedUserRole) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *AssignedUserRole) GetUserId() string { + if x != nil { + return x.UserId + } + return "" +} + +func (x *AssignedUserRole) GetRoleId() string { + if x != nil { + return x.RoleId + } + return "" +} + +func (x *AssignedUserRole) GetRoleName() string { + if x != nil { + return x.RoleName + } + return "" +} + +func (x *AssignedUserRole) GetScopeCode() string { + if x != nil { + return x.ScopeCode + } + return "" +} + +func (x *AssignedUserRole) GetTargetId() string { + if x != nil { + return x.TargetId + } + return "" +} + +type VerifyTokenRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Token string `protobuf:"bytes,1,opt,name=token,proto3" json:"token,omitempty"` + IncludeUserRoles bool `protobuf:"varint,2,opt,name=include_user_roles,json=includeUserRoles,proto3" json:"include_user_roles,omitempty"` + RoleScopes []string `protobuf:"bytes,3,rep,name=role_scopes,json=roleScopes,proto3" json:"role_scopes,omitempty"` + RoleNames []string `protobuf:"bytes,4,rep,name=role_names,json=roleNames,proto3" json:"role_names,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *VerifyTokenRequest) Reset() { + *x = VerifyTokenRequest{} + mi := &file_st_peter_auth_proto_msgTypes[23] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *VerifyTokenRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*VerifyTokenRequest) ProtoMessage() {} + +func (x *VerifyTokenRequest) ProtoReflect() protoreflect.Message { + mi := &file_st_peter_auth_proto_msgTypes[23] + 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 VerifyTokenRequest.ProtoReflect.Descriptor instead. +func (*VerifyTokenRequest) Descriptor() ([]byte, []int) { + return file_st_peter_auth_proto_rawDescGZIP(), []int{23} +} + +func (x *VerifyTokenRequest) GetToken() string { + if x != nil { + return x.Token + } + return "" +} + +func (x *VerifyTokenRequest) GetIncludeUserRoles() bool { + if x != nil { + return x.IncludeUserRoles + } + return false +} + +func (x *VerifyTokenRequest) GetRoleScopes() []string { + if x != nil { + return x.RoleScopes + } + return nil +} + +func (x *VerifyTokenRequest) GetRoleNames() []string { + if x != nil { + return x.RoleNames + } + return nil +} + +type VerifyAuthClaimTokenRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Claim string `protobuf:"bytes,2,opt,name=claim,proto3" json:"claim,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *VerifyAuthClaimTokenRequest) Reset() { + *x = VerifyAuthClaimTokenRequest{} + mi := &file_st_peter_auth_proto_msgTypes[24] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *VerifyAuthClaimTokenRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*VerifyAuthClaimTokenRequest) ProtoMessage() {} + +func (x *VerifyAuthClaimTokenRequest) ProtoReflect() protoreflect.Message { + mi := &file_st_peter_auth_proto_msgTypes[24] + 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 VerifyAuthClaimTokenRequest.ProtoReflect.Descriptor instead. +func (*VerifyAuthClaimTokenRequest) Descriptor() ([]byte, []int) { + return file_st_peter_auth_proto_rawDescGZIP(), []int{24} +} + +func (x *VerifyAuthClaimTokenRequest) GetClaim() string { + if x != nil { + return x.Claim + } + return "" +} + +type InitiateTwoFactorResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + ResultCode ResultCode `protobuf:"varint,2,opt,name=result_code,json=resultCode,proto3,enum=st_peter.auth.ResultCode" json:"result_code,omitempty"` + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` + TwoFactorId string `protobuf:"bytes,4,opt,name=two_factor_id,json=twoFactorId,proto3" json:"two_factor_id,omitempty"` + Channel ChannelType `protobuf:"varint,5,opt,name=channel,proto3,enum=st_peter.auth.ChannelType" json:"channel,omitempty"` + UserId string `protobuf:"bytes,7,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` + ValidationErrors []*ValidationError `protobuf:"bytes,6,rep,name=validation_errors,json=validationErrors,proto3" json:"validation_errors,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *InitiateTwoFactorResponse) Reset() { + *x = InitiateTwoFactorResponse{} + mi := &file_st_peter_auth_proto_msgTypes[25] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *InitiateTwoFactorResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*InitiateTwoFactorResponse) ProtoMessage() {} + +func (x *InitiateTwoFactorResponse) ProtoReflect() protoreflect.Message { + mi := &file_st_peter_auth_proto_msgTypes[25] + 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 InitiateTwoFactorResponse.ProtoReflect.Descriptor instead. +func (*InitiateTwoFactorResponse) Descriptor() ([]byte, []int) { + return file_st_peter_auth_proto_rawDescGZIP(), []int{25} +} + +func (x *InitiateTwoFactorResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *InitiateTwoFactorResponse) GetResultCode() ResultCode { + if x != nil { + return x.ResultCode + } + return ResultCode_RESULT_CODE_SUCCESS +} + +func (x *InitiateTwoFactorResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +func (x *InitiateTwoFactorResponse) GetTwoFactorId() string { + if x != nil { + return x.TwoFactorId + } + return "" +} + +func (x *InitiateTwoFactorResponse) GetChannel() ChannelType { + if x != nil { + return x.Channel + } + return ChannelType_CHANNEL_TYPE_UNSPECIFIED +} + +func (x *InitiateTwoFactorResponse) GetUserId() string { + if x != nil { + return x.UserId + } + return "" +} + +func (x *InitiateTwoFactorResponse) GetValidationErrors() []*ValidationError { + if x != nil { + return x.ValidationErrors + } + return nil +} + +type VerifyTwoFactorResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + ResultCode ResultCode `protobuf:"varint,2,opt,name=result_code,json=resultCode,proto3,enum=st_peter.auth.ResultCode" json:"result_code,omitempty"` + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` + ValidationErrors []*ValidationError `protobuf:"bytes,4,rep,name=validation_errors,json=validationErrors,proto3" json:"validation_errors,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *VerifyTwoFactorResponse) Reset() { + *x = VerifyTwoFactorResponse{} + mi := &file_st_peter_auth_proto_msgTypes[26] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *VerifyTwoFactorResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*VerifyTwoFactorResponse) ProtoMessage() {} + +func (x *VerifyTwoFactorResponse) ProtoReflect() protoreflect.Message { + mi := &file_st_peter_auth_proto_msgTypes[26] + 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 VerifyTwoFactorResponse.ProtoReflect.Descriptor instead. +func (*VerifyTwoFactorResponse) Descriptor() ([]byte, []int) { + return file_st_peter_auth_proto_rawDescGZIP(), []int{26} +} + +func (x *VerifyTwoFactorResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *VerifyTwoFactorResponse) GetResultCode() ResultCode { + if x != nil { + return x.ResultCode + } + return ResultCode_RESULT_CODE_SUCCESS +} + +func (x *VerifyTwoFactorResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +func (x *VerifyTwoFactorResponse) GetValidationErrors() []*ValidationError { + if x != nil { + return x.ValidationErrors + } + return nil +} + +type InitiateTwoFactorRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + UserId *string `protobuf:"bytes,1,opt,name=user_id,json=userId,proto3,oneof" json:"user_id,omitempty"` + UserIdentifier *string `protobuf:"bytes,5,opt,name=user_identifier,json=userIdentifier,proto3,oneof" json:"user_identifier,omitempty"` // Can be either email or phone + Channel ChannelType `protobuf:"varint,2,opt,name=channel,proto3,enum=st_peter.auth.ChannelType" json:"channel,omitempty"` + AppHash string `protobuf:"bytes,3,opt,name=app_hash,json=appHash,proto3" json:"app_hash,omitempty"` + DeviceInfo *DeviceInfo `protobuf:"bytes,4,opt,name=device_info,json=deviceInfo,proto3" json:"device_info,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *InitiateTwoFactorRequest) Reset() { + *x = InitiateTwoFactorRequest{} + mi := &file_st_peter_auth_proto_msgTypes[27] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *InitiateTwoFactorRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*InitiateTwoFactorRequest) ProtoMessage() {} + +func (x *InitiateTwoFactorRequest) ProtoReflect() protoreflect.Message { + mi := &file_st_peter_auth_proto_msgTypes[27] + 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 InitiateTwoFactorRequest.ProtoReflect.Descriptor instead. +func (*InitiateTwoFactorRequest) Descriptor() ([]byte, []int) { + return file_st_peter_auth_proto_rawDescGZIP(), []int{27} +} + +func (x *InitiateTwoFactorRequest) GetUserId() string { + if x != nil && x.UserId != nil { + return *x.UserId + } + return "" +} + +func (x *InitiateTwoFactorRequest) GetUserIdentifier() string { + if x != nil && x.UserIdentifier != nil { + return *x.UserIdentifier + } + return "" +} + +func (x *InitiateTwoFactorRequest) GetChannel() ChannelType { + if x != nil { + return x.Channel + } + return ChannelType_CHANNEL_TYPE_UNSPECIFIED +} + +func (x *InitiateTwoFactorRequest) GetAppHash() string { + if x != nil { + return x.AppHash + } + return "" +} + +func (x *InitiateTwoFactorRequest) GetDeviceInfo() *DeviceInfo { + if x != nil { + return x.DeviceInfo + } + return nil +} + +type VerifyTwoFactorRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + TwoFactorId string `protobuf:"bytes,1,opt,name=two_factor_id,json=twoFactorId,proto3" json:"two_factor_id,omitempty"` + Code string `protobuf:"bytes,2,opt,name=code,proto3" json:"code,omitempty"` + DeviceInfo *DeviceInfo `protobuf:"bytes,3,opt,name=device_info,json=deviceInfo,proto3" json:"device_info,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *VerifyTwoFactorRequest) Reset() { + *x = VerifyTwoFactorRequest{} + mi := &file_st_peter_auth_proto_msgTypes[28] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *VerifyTwoFactorRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*VerifyTwoFactorRequest) ProtoMessage() {} + +func (x *VerifyTwoFactorRequest) ProtoReflect() protoreflect.Message { + mi := &file_st_peter_auth_proto_msgTypes[28] + 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 VerifyTwoFactorRequest.ProtoReflect.Descriptor instead. +func (*VerifyTwoFactorRequest) Descriptor() ([]byte, []int) { + return file_st_peter_auth_proto_rawDescGZIP(), []int{28} +} + +func (x *VerifyTwoFactorRequest) GetTwoFactorId() string { + if x != nil { + return x.TwoFactorId + } + return "" +} + +func (x *VerifyTwoFactorRequest) GetCode() string { + if x != nil { + return x.Code + } + return "" +} + +func (x *VerifyTwoFactorRequest) GetDeviceInfo() *DeviceInfo { + if x != nil { + return x.DeviceInfo + } + return nil +} + +type InitiatePasswordResetRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + UserIdentifier string `protobuf:"bytes,1,opt,name=user_identifier,json=userIdentifier,proto3" json:"user_identifier,omitempty"` // Can be either email or phone + AppHash string `protobuf:"bytes,2,opt,name=app_hash,json=appHash,proto3" json:"app_hash,omitempty"` + DeviceInfo *DeviceInfo `protobuf:"bytes,4,opt,name=device_info,json=deviceInfo,proto3" json:"device_info,omitempty"` + NewPassword string `protobuf:"bytes,5,opt,name=new_password,json=newPassword,proto3" json:"new_password,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *InitiatePasswordResetRequest) Reset() { + *x = InitiatePasswordResetRequest{} + mi := &file_st_peter_auth_proto_msgTypes[29] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *InitiatePasswordResetRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*InitiatePasswordResetRequest) ProtoMessage() {} + +func (x *InitiatePasswordResetRequest) ProtoReflect() protoreflect.Message { + mi := &file_st_peter_auth_proto_msgTypes[29] + 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 InitiatePasswordResetRequest.ProtoReflect.Descriptor instead. +func (*InitiatePasswordResetRequest) Descriptor() ([]byte, []int) { + return file_st_peter_auth_proto_rawDescGZIP(), []int{29} +} + +func (x *InitiatePasswordResetRequest) GetUserIdentifier() string { + if x != nil { + return x.UserIdentifier + } + return "" +} + +func (x *InitiatePasswordResetRequest) GetAppHash() string { + if x != nil { + return x.AppHash + } + return "" +} + +func (x *InitiatePasswordResetRequest) GetDeviceInfo() *DeviceInfo { + if x != nil { + return x.DeviceInfo + } + return nil +} + +func (x *InitiatePasswordResetRequest) GetNewPassword() string { + if x != nil { + return x.NewPassword + } + return "" +} + +type OperationResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + ResultCode ResultCode `protobuf:"varint,2,opt,name=result_code,json=resultCode,proto3,enum=st_peter.auth.ResultCode" json:"result_code,omitempty"` + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *OperationResponse) Reset() { + *x = OperationResponse{} + mi := &file_st_peter_auth_proto_msgTypes[30] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *OperationResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*OperationResponse) ProtoMessage() {} + +func (x *OperationResponse) ProtoReflect() protoreflect.Message { + mi := &file_st_peter_auth_proto_msgTypes[30] + 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 OperationResponse.ProtoReflect.Descriptor instead. +func (*OperationResponse) Descriptor() ([]byte, []int) { + return file_st_peter_auth_proto_rawDescGZIP(), []int{30} +} + +func (x *OperationResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *OperationResponse) GetResultCode() ResultCode { + if x != nil { + return x.ResultCode + } + return ResultCode_RESULT_CODE_SUCCESS +} + +func (x *OperationResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +type VerifyPasswordResetTokenRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + UserId string `protobuf:"bytes,1,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` + PasswordResetId string `protobuf:"bytes,2,opt,name=password_reset_id,json=passwordResetId,proto3" json:"password_reset_id,omitempty"` + Passcode string `protobuf:"bytes,3,opt,name=passcode,proto3" json:"passcode,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *VerifyPasswordResetTokenRequest) Reset() { + *x = VerifyPasswordResetTokenRequest{} + mi := &file_st_peter_auth_proto_msgTypes[31] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *VerifyPasswordResetTokenRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*VerifyPasswordResetTokenRequest) ProtoMessage() {} + +func (x *VerifyPasswordResetTokenRequest) ProtoReflect() protoreflect.Message { + mi := &file_st_peter_auth_proto_msgTypes[31] + 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 VerifyPasswordResetTokenRequest.ProtoReflect.Descriptor instead. +func (*VerifyPasswordResetTokenRequest) Descriptor() ([]byte, []int) { + return file_st_peter_auth_proto_rawDescGZIP(), []int{31} +} + +func (x *VerifyPasswordResetTokenRequest) GetUserId() string { + if x != nil { + return x.UserId + } + return "" +} + +func (x *VerifyPasswordResetTokenRequest) GetPasswordResetId() string { + if x != nil { + return x.PasswordResetId + } + return "" +} + +func (x *VerifyPasswordResetTokenRequest) GetPasscode() string { + if x != nil { + return x.Passcode + } + return "" +} + +type PasswordResetTokenResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + ResultCode ResultCode `protobuf:"varint,2,opt,name=result_code,json=resultCode,proto3,enum=st_peter.auth.ResultCode" json:"result_code,omitempty"` + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` + PasswordResetId string `protobuf:"bytes,4,opt,name=password_reset_id,json=passwordResetId,proto3" json:"password_reset_id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *PasswordResetTokenResponse) Reset() { + *x = PasswordResetTokenResponse{} + mi := &file_st_peter_auth_proto_msgTypes[32] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *PasswordResetTokenResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PasswordResetTokenResponse) ProtoMessage() {} + +func (x *PasswordResetTokenResponse) ProtoReflect() protoreflect.Message { + mi := &file_st_peter_auth_proto_msgTypes[32] + 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 PasswordResetTokenResponse.ProtoReflect.Descriptor instead. +func (*PasswordResetTokenResponse) Descriptor() ([]byte, []int) { + return file_st_peter_auth_proto_rawDescGZIP(), []int{32} +} + +func (x *PasswordResetTokenResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *PasswordResetTokenResponse) GetResultCode() ResultCode { + if x != nil { + return x.ResultCode + } + return ResultCode_RESULT_CODE_SUCCESS +} + +func (x *PasswordResetTokenResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +func (x *PasswordResetTokenResponse) GetPasswordResetId() string { + if x != nil { + return x.PasswordResetId + } + return "" +} + +type ResetPasswordRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + UserId string `protobuf:"bytes,1,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` + PasswordResetId string `protobuf:"bytes,2,opt,name=password_reset_id,json=passwordResetId,proto3" json:"password_reset_id,omitempty"` + Passcode string `protobuf:"bytes,3,opt,name=passcode,proto3" json:"passcode,omitempty"` + DeviceInfo *DeviceInfo `protobuf:"bytes,4,opt,name=device_info,json=deviceInfo,proto3" json:"device_info,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ResetPasswordRequest) Reset() { + *x = ResetPasswordRequest{} + mi := &file_st_peter_auth_proto_msgTypes[33] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ResetPasswordRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ResetPasswordRequest) ProtoMessage() {} + +func (x *ResetPasswordRequest) ProtoReflect() protoreflect.Message { + mi := &file_st_peter_auth_proto_msgTypes[33] + 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 ResetPasswordRequest.ProtoReflect.Descriptor instead. +func (*ResetPasswordRequest) Descriptor() ([]byte, []int) { + return file_st_peter_auth_proto_rawDescGZIP(), []int{33} +} + +func (x *ResetPasswordRequest) GetUserId() string { + if x != nil { + return x.UserId + } + return "" +} + +func (x *ResetPasswordRequest) GetPasswordResetId() string { + if x != nil { + return x.PasswordResetId + } + return "" +} + +func (x *ResetPasswordRequest) GetPasscode() string { + if x != nil { + return x.Passcode + } + return "" +} + +func (x *ResetPasswordRequest) GetDeviceInfo() *DeviceInfo { + if x != nil { + return x.DeviceInfo + } + return nil +} + +type ChangeIdentityFieldRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + UserId string `protobuf:"bytes,1,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` + UserToken string `protobuf:"bytes,2,opt,name=user_token,json=userToken,proto3" json:"user_token,omitempty"` + Channel ChannelType `protobuf:"varint,3,opt,name=channel,proto3,enum=st_peter.auth.ChannelType" json:"channel,omitempty"` + NewValue string `protobuf:"bytes,4,opt,name=new_value,json=newValue,proto3" json:"new_value,omitempty"` + FieldType IdentityField `protobuf:"varint,5,opt,name=field_type,json=fieldType,proto3,enum=st_peter.auth.IdentityField" json:"field_type,omitempty"` + AppHash string `protobuf:"bytes,6,opt,name=app_hash,json=appHash,proto3" json:"app_hash,omitempty"` + DeviceInfo *DeviceInfo `protobuf:"bytes,7,opt,name=device_info,json=deviceInfo,proto3" json:"device_info,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ChangeIdentityFieldRequest) Reset() { + *x = ChangeIdentityFieldRequest{} + mi := &file_st_peter_auth_proto_msgTypes[34] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ChangeIdentityFieldRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ChangeIdentityFieldRequest) ProtoMessage() {} + +func (x *ChangeIdentityFieldRequest) ProtoReflect() protoreflect.Message { + mi := &file_st_peter_auth_proto_msgTypes[34] + 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 ChangeIdentityFieldRequest.ProtoReflect.Descriptor instead. +func (*ChangeIdentityFieldRequest) Descriptor() ([]byte, []int) { + return file_st_peter_auth_proto_rawDescGZIP(), []int{34} +} + +func (x *ChangeIdentityFieldRequest) GetUserId() string { + if x != nil { + return x.UserId + } + return "" +} + +func (x *ChangeIdentityFieldRequest) GetUserToken() string { + if x != nil { + return x.UserToken + } + return "" +} + +func (x *ChangeIdentityFieldRequest) GetChannel() ChannelType { + if x != nil { + return x.Channel + } + return ChannelType_CHANNEL_TYPE_UNSPECIFIED +} + +func (x *ChangeIdentityFieldRequest) GetNewValue() string { + if x != nil { + return x.NewValue + } + return "" +} + +func (x *ChangeIdentityFieldRequest) GetFieldType() IdentityField { + if x != nil { + return x.FieldType + } + return IdentityField_IDENTITY_FIELD_UNSPECIFIED +} + +func (x *ChangeIdentityFieldRequest) GetAppHash() string { + if x != nil { + return x.AppHash + } + return "" +} + +func (x *ChangeIdentityFieldRequest) GetDeviceInfo() *DeviceInfo { + if x != nil { + return x.DeviceInfo + } + return nil +} + +type ChangeIdentityFieldResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + ResultCode ResultCode `protobuf:"varint,2,opt,name=result_code,json=resultCode,proto3,enum=st_peter.auth.ResultCode" json:"result_code,omitempty"` + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` + ChallengeId string `protobuf:"bytes,4,opt,name=challenge_id,json=challengeId,proto3" json:"challenge_id,omitempty"` + PasscodeSize int32 `protobuf:"varint,5,opt,name=passcode_size,json=passcodeSize,proto3" json:"passcode_size,omitempty"` + UserIdentifier string `protobuf:"bytes,6,opt,name=user_identifier,json=userIdentifier,proto3" json:"user_identifier,omitempty"` + Channel ChannelType `protobuf:"varint,7,opt,name=channel,proto3,enum=st_peter.auth.ChannelType" json:"channel,omitempty"` + ValidationErrors []*ValidationError `protobuf:"bytes,8,rep,name=validation_errors,json=validationErrors,proto3" json:"validation_errors,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ChangeIdentityFieldResponse) Reset() { + *x = ChangeIdentityFieldResponse{} + mi := &file_st_peter_auth_proto_msgTypes[35] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ChangeIdentityFieldResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ChangeIdentityFieldResponse) ProtoMessage() {} + +func (x *ChangeIdentityFieldResponse) ProtoReflect() protoreflect.Message { + mi := &file_st_peter_auth_proto_msgTypes[35] + 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 ChangeIdentityFieldResponse.ProtoReflect.Descriptor instead. +func (*ChangeIdentityFieldResponse) Descriptor() ([]byte, []int) { + return file_st_peter_auth_proto_rawDescGZIP(), []int{35} +} + +func (x *ChangeIdentityFieldResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *ChangeIdentityFieldResponse) GetResultCode() ResultCode { + if x != nil { + return x.ResultCode + } + return ResultCode_RESULT_CODE_SUCCESS +} + +func (x *ChangeIdentityFieldResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +func (x *ChangeIdentityFieldResponse) GetChallengeId() string { + if x != nil { + return x.ChallengeId + } + return "" +} + +func (x *ChangeIdentityFieldResponse) GetPasscodeSize() int32 { + if x != nil { + return x.PasscodeSize + } + return 0 +} + +func (x *ChangeIdentityFieldResponse) GetUserIdentifier() string { + if x != nil { + return x.UserIdentifier + } + return "" +} + +func (x *ChangeIdentityFieldResponse) GetChannel() ChannelType { + if x != nil { + return x.Channel + } + return ChannelType_CHANNEL_TYPE_UNSPECIFIED +} + +func (x *ChangeIdentityFieldResponse) GetValidationErrors() []*ValidationError { + if x != nil { + return x.ValidationErrors + } + return nil +} + +type VerifyIdentityFieldRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + UserId string `protobuf:"bytes,1,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` + UserToken string `protobuf:"bytes,2,opt,name=user_token,json=userToken,proto3" json:"user_token,omitempty"` + ChallengeId string `protobuf:"bytes,4,opt,name=challenge_id,json=challengeId,proto3" json:"challenge_id,omitempty"` + VerificationCode string `protobuf:"bytes,5,opt,name=verification_code,json=verificationCode,proto3" json:"verification_code,omitempty"` + AppHash string `protobuf:"bytes,6,opt,name=app_hash,json=appHash,proto3" json:"app_hash,omitempty"` + DeviceInfo *DeviceInfo `protobuf:"bytes,7,opt,name=device_info,json=deviceInfo,proto3" json:"device_info,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *VerifyIdentityFieldRequest) Reset() { + *x = VerifyIdentityFieldRequest{} + mi := &file_st_peter_auth_proto_msgTypes[36] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *VerifyIdentityFieldRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*VerifyIdentityFieldRequest) ProtoMessage() {} + +func (x *VerifyIdentityFieldRequest) ProtoReflect() protoreflect.Message { + mi := &file_st_peter_auth_proto_msgTypes[36] + 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 VerifyIdentityFieldRequest.ProtoReflect.Descriptor instead. +func (*VerifyIdentityFieldRequest) Descriptor() ([]byte, []int) { + return file_st_peter_auth_proto_rawDescGZIP(), []int{36} +} + +func (x *VerifyIdentityFieldRequest) GetUserId() string { + if x != nil { + return x.UserId + } + return "" +} + +func (x *VerifyIdentityFieldRequest) GetUserToken() string { + if x != nil { + return x.UserToken + } + return "" +} + +func (x *VerifyIdentityFieldRequest) GetChallengeId() string { + if x != nil { + return x.ChallengeId + } + return "" +} + +func (x *VerifyIdentityFieldRequest) GetVerificationCode() string { + if x != nil { + return x.VerificationCode + } + return "" +} + +func (x *VerifyIdentityFieldRequest) GetAppHash() string { + if x != nil { + return x.AppHash + } + return "" +} + +func (x *VerifyIdentityFieldRequest) GetDeviceInfo() *DeviceInfo { + if x != nil { + return x.DeviceInfo + } + return nil +} + +type ResendIdentityFieldRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + UserId string `protobuf:"bytes,1,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` + UserToken string `protobuf:"bytes,2,opt,name=user_token,json=userToken,proto3" json:"user_token,omitempty"` + ChallengeId string `protobuf:"bytes,4,opt,name=challenge_id,json=challengeId,proto3" json:"challenge_id,omitempty"` + AppHash string `protobuf:"bytes,6,opt,name=app_hash,json=appHash,proto3" json:"app_hash,omitempty"` + DeviceInfo *DeviceInfo `protobuf:"bytes,7,opt,name=device_info,json=deviceInfo,proto3" json:"device_info,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ResendIdentityFieldRequest) Reset() { + *x = ResendIdentityFieldRequest{} + mi := &file_st_peter_auth_proto_msgTypes[37] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ResendIdentityFieldRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ResendIdentityFieldRequest) ProtoMessage() {} + +func (x *ResendIdentityFieldRequest) ProtoReflect() protoreflect.Message { + mi := &file_st_peter_auth_proto_msgTypes[37] + 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 ResendIdentityFieldRequest.ProtoReflect.Descriptor instead. +func (*ResendIdentityFieldRequest) Descriptor() ([]byte, []int) { + return file_st_peter_auth_proto_rawDescGZIP(), []int{37} +} + +func (x *ResendIdentityFieldRequest) GetUserId() string { + if x != nil { + return x.UserId + } + return "" +} + +func (x *ResendIdentityFieldRequest) GetUserToken() string { + if x != nil { + return x.UserToken + } + return "" +} + +func (x *ResendIdentityFieldRequest) GetChallengeId() string { + if x != nil { + return x.ChallengeId + } + return "" +} + +func (x *ResendIdentityFieldRequest) GetAppHash() string { + if x != nil { + return x.AppHash + } + return "" +} + +func (x *ResendIdentityFieldRequest) GetDeviceInfo() *DeviceInfo { + if x != nil { + return x.DeviceInfo + } + return nil +} + +type VerifyIdentityFieldResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + ResultCode ResultCode `protobuf:"varint,2,opt,name=result_code,json=resultCode,proto3,enum=st_peter.auth.ResultCode" json:"result_code,omitempty"` + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` + RequiresVerification bool `protobuf:"varint,8,opt,name=requires_verification,json=requiresVerification,proto3" json:"requires_verification,omitempty"` + ChallengeId string `protobuf:"bytes,4,opt,name=challenge_id,json=challengeId,proto3" json:"challenge_id,omitempty"` + PasscodeSize int32 `protobuf:"varint,5,opt,name=passcode_size,json=passcodeSize,proto3" json:"passcode_size,omitempty"` + UserIdentifier string `protobuf:"bytes,6,opt,name=user_identifier,json=userIdentifier,proto3" json:"user_identifier,omitempty"` + Channel ChannelType `protobuf:"varint,7,opt,name=channel,proto3,enum=st_peter.auth.ChannelType" json:"channel,omitempty"` + ValidationErrors []*ValidationError `protobuf:"bytes,9,rep,name=validation_errors,json=validationErrors,proto3" json:"validation_errors,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *VerifyIdentityFieldResponse) Reset() { + *x = VerifyIdentityFieldResponse{} + mi := &file_st_peter_auth_proto_msgTypes[38] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *VerifyIdentityFieldResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*VerifyIdentityFieldResponse) ProtoMessage() {} + +func (x *VerifyIdentityFieldResponse) ProtoReflect() protoreflect.Message { + mi := &file_st_peter_auth_proto_msgTypes[38] + 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 VerifyIdentityFieldResponse.ProtoReflect.Descriptor instead. +func (*VerifyIdentityFieldResponse) Descriptor() ([]byte, []int) { + return file_st_peter_auth_proto_rawDescGZIP(), []int{38} +} + +func (x *VerifyIdentityFieldResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *VerifyIdentityFieldResponse) GetResultCode() ResultCode { + if x != nil { + return x.ResultCode + } + return ResultCode_RESULT_CODE_SUCCESS +} + +func (x *VerifyIdentityFieldResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +func (x *VerifyIdentityFieldResponse) GetRequiresVerification() bool { + if x != nil { + return x.RequiresVerification + } + return false +} + +func (x *VerifyIdentityFieldResponse) GetChallengeId() string { + if x != nil { + return x.ChallengeId + } + return "" +} + +func (x *VerifyIdentityFieldResponse) GetPasscodeSize() int32 { + if x != nil { + return x.PasscodeSize + } + return 0 +} + +func (x *VerifyIdentityFieldResponse) GetUserIdentifier() string { + if x != nil { + return x.UserIdentifier + } + return "" +} + +func (x *VerifyIdentityFieldResponse) GetChannel() ChannelType { + if x != nil { + return x.Channel + } + return ChannelType_CHANNEL_TYPE_UNSPECIFIED +} + +func (x *VerifyIdentityFieldResponse) GetValidationErrors() []*ValidationError { + if x != nil { + return x.ValidationErrors + } + return nil +} + +type UpdateUserInfoRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + UserId string `protobuf:"bytes,1,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` + UserToken string `protobuf:"bytes,2,opt,name=user_token,json=userToken,proto3" json:"user_token,omitempty"` + FirstNames *string `protobuf:"bytes,3,opt,name=first_names,json=firstNames,proto3,oneof" json:"first_names,omitempty"` + LastName *string `protobuf:"bytes,4,opt,name=last_name,json=lastName,proto3,oneof" json:"last_name,omitempty"` + ProfilePictureId *string `protobuf:"bytes,6,opt,name=profile_picture_id,json=profilePictureId,proto3,oneof" json:"profile_picture_id,omitempty"` + DateOfBirth *Date `protobuf:"bytes,5,opt,name=date_of_birth,json=dateOfBirth,proto3" json:"date_of_birth,omitempty"` + Handle *string `protobuf:"bytes,7,opt,name=handle,proto3,oneof" json:"handle,omitempty"` // Optional unique handle (e.g., @username) + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *UpdateUserInfoRequest) Reset() { + *x = UpdateUserInfoRequest{} + mi := &file_st_peter_auth_proto_msgTypes[39] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *UpdateUserInfoRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateUserInfoRequest) ProtoMessage() {} + +func (x *UpdateUserInfoRequest) ProtoReflect() protoreflect.Message { + mi := &file_st_peter_auth_proto_msgTypes[39] + 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 UpdateUserInfoRequest.ProtoReflect.Descriptor instead. +func (*UpdateUserInfoRequest) Descriptor() ([]byte, []int) { + return file_st_peter_auth_proto_rawDescGZIP(), []int{39} +} + +func (x *UpdateUserInfoRequest) GetUserId() string { + if x != nil { + return x.UserId + } + return "" +} + +func (x *UpdateUserInfoRequest) GetUserToken() string { + if x != nil { + return x.UserToken + } + return "" +} + +func (x *UpdateUserInfoRequest) GetFirstNames() string { + if x != nil && x.FirstNames != nil { + return *x.FirstNames + } + return "" +} + +func (x *UpdateUserInfoRequest) GetLastName() string { + if x != nil && x.LastName != nil { + return *x.LastName + } + return "" +} + +func (x *UpdateUserInfoRequest) GetProfilePictureId() string { + if x != nil && x.ProfilePictureId != nil { + return *x.ProfilePictureId + } + return "" +} + +func (x *UpdateUserInfoRequest) GetDateOfBirth() *Date { + if x != nil { + return x.DateOfBirth + } + return nil +} + +func (x *UpdateUserInfoRequest) GetHandle() string { + if x != nil && x.Handle != nil { + return *x.Handle + } + return "" +} + +type UpdateUserInfoResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + ResultCode ResultCode `protobuf:"varint,2,opt,name=result_code,json=resultCode,proto3,enum=st_peter.auth.ResultCode" json:"result_code,omitempty"` + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` + User *User `protobuf:"bytes,4,opt,name=user,proto3" json:"user,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *UpdateUserInfoResponse) Reset() { + *x = UpdateUserInfoResponse{} + mi := &file_st_peter_auth_proto_msgTypes[40] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *UpdateUserInfoResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateUserInfoResponse) ProtoMessage() {} + +func (x *UpdateUserInfoResponse) ProtoReflect() protoreflect.Message { + mi := &file_st_peter_auth_proto_msgTypes[40] + 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 UpdateUserInfoResponse.ProtoReflect.Descriptor instead. +func (*UpdateUserInfoResponse) Descriptor() ([]byte, []int) { + return file_st_peter_auth_proto_rawDescGZIP(), []int{40} +} + +func (x *UpdateUserInfoResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *UpdateUserInfoResponse) GetResultCode() ResultCode { + if x != nil { + return x.ResultCode + } + return ResultCode_RESULT_CODE_SUCCESS +} + +func (x *UpdateUserInfoResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +func (x *UpdateUserInfoResponse) GetUser() *User { + if x != nil { + return x.User + } + return nil +} + +type LogoutRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Token string `protobuf:"bytes,1,opt,name=token,proto3" json:"token,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *LogoutRequest) Reset() { + *x = LogoutRequest{} + mi := &file_st_peter_auth_proto_msgTypes[41] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *LogoutRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*LogoutRequest) ProtoMessage() {} + +func (x *LogoutRequest) ProtoReflect() protoreflect.Message { + mi := &file_st_peter_auth_proto_msgTypes[41] + 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 LogoutRequest.ProtoReflect.Descriptor instead. +func (*LogoutRequest) Descriptor() ([]byte, []int) { + return file_st_peter_auth_proto_rawDescGZIP(), []int{41} +} + +func (x *LogoutRequest) GetToken() string { + if x != nil { + return x.Token + } + return "" +} + +type LogoutResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + ResultCode ResultCode `protobuf:"varint,2,opt,name=result_code,json=resultCode,proto3,enum=st_peter.auth.ResultCode" json:"result_code,omitempty"` + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *LogoutResponse) Reset() { + *x = LogoutResponse{} + mi := &file_st_peter_auth_proto_msgTypes[42] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *LogoutResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*LogoutResponse) ProtoMessage() {} + +func (x *LogoutResponse) ProtoReflect() protoreflect.Message { + mi := &file_st_peter_auth_proto_msgTypes[42] + 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 LogoutResponse.ProtoReflect.Descriptor instead. +func (*LogoutResponse) Descriptor() ([]byte, []int) { + return file_st_peter_auth_proto_rawDescGZIP(), []int{42} +} + +func (x *LogoutResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *LogoutResponse) GetResultCode() ResultCode { + if x != nil { + return x.ResultCode + } + return ResultCode_RESULT_CODE_SUCCESS +} + +func (x *LogoutResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +type ValidationError struct { + state protoimpl.MessageState `protogen:"open.v1"` + Field string `protobuf:"bytes,1,opt,name=field,proto3" json:"field,omitempty"` + Message string `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ValidationError) Reset() { + *x = ValidationError{} + mi := &file_st_peter_auth_proto_msgTypes[43] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ValidationError) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ValidationError) ProtoMessage() {} + +func (x *ValidationError) ProtoReflect() protoreflect.Message { + mi := &file_st_peter_auth_proto_msgTypes[43] + 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 ValidationError.ProtoReflect.Descriptor instead. +func (*ValidationError) Descriptor() ([]byte, []int) { + return file_st_peter_auth_proto_rawDescGZIP(), []int{43} +} + +func (x *ValidationError) GetField() string { + if x != nil { + return x.Field + } + return "" +} + +func (x *ValidationError) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +type Scope struct { + state protoimpl.MessageState `protogen:"open.v1"` + Code string `protobuf:"bytes,1,opt,name=code,proto3" json:"code,omitempty"` + Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` + ParentCode *string `protobuf:"bytes,3,opt,name=parent_code,json=parentCode,proto3,oneof" json:"parent_code,omitempty"` + IsActive bool `protobuf:"varint,4,opt,name=is_active,json=isActive,proto3" json:"is_active,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Scope) Reset() { + *x = Scope{} + mi := &file_st_peter_auth_proto_msgTypes[44] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Scope) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Scope) ProtoMessage() {} + +func (x *Scope) ProtoReflect() protoreflect.Message { + mi := &file_st_peter_auth_proto_msgTypes[44] + 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 Scope.ProtoReflect.Descriptor instead. +func (*Scope) Descriptor() ([]byte, []int) { + return file_st_peter_auth_proto_rawDescGZIP(), []int{44} +} + +func (x *Scope) GetCode() string { + if x != nil { + return x.Code + } + return "" +} + +func (x *Scope) GetDescription() string { + if x != nil { + return x.Description + } + return "" +} + +func (x *Scope) GetParentCode() string { + if x != nil && x.ParentCode != nil { + return *x.ParentCode + } + return "" +} + +func (x *Scope) GetIsActive() bool { + if x != nil { + return x.IsActive + } + return false +} + +type UpdateUserPreferenceRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + ActorId string `protobuf:"bytes,1,opt,name=actor_id,json=actorId,proto3" json:"actor_id,omitempty"` + ActorToken string `protobuf:"bytes,2,opt,name=actor_token,json=actorToken,proto3" json:"actor_token,omitempty"` + PreferenceKey string `protobuf:"bytes,3,opt,name=preference_key,json=preferenceKey,proto3" json:"preference_key,omitempty"` + PreferenceValue string `protobuf:"bytes,4,opt,name=preference_value,json=preferenceValue,proto3" json:"preference_value,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *UpdateUserPreferenceRequest) Reset() { + *x = UpdateUserPreferenceRequest{} + mi := &file_st_peter_auth_proto_msgTypes[45] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *UpdateUserPreferenceRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateUserPreferenceRequest) ProtoMessage() {} + +func (x *UpdateUserPreferenceRequest) ProtoReflect() protoreflect.Message { + mi := &file_st_peter_auth_proto_msgTypes[45] + 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 UpdateUserPreferenceRequest.ProtoReflect.Descriptor instead. +func (*UpdateUserPreferenceRequest) Descriptor() ([]byte, []int) { + return file_st_peter_auth_proto_rawDescGZIP(), []int{45} +} + +func (x *UpdateUserPreferenceRequest) GetActorId() string { + if x != nil { + return x.ActorId + } + return "" +} + +func (x *UpdateUserPreferenceRequest) GetActorToken() string { + if x != nil { + return x.ActorToken + } + return "" +} + +func (x *UpdateUserPreferenceRequest) GetPreferenceKey() string { + if x != nil { + return x.PreferenceKey + } + return "" +} + +func (x *UpdateUserPreferenceRequest) GetPreferenceValue() string { + if x != nil { + return x.PreferenceValue + } + return "" +} + +type GetUserPreferenceByCodeRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + ActorId string `protobuf:"bytes,1,opt,name=actor_id,json=actorId,proto3" json:"actor_id,omitempty"` + ActorToken string `protobuf:"bytes,2,opt,name=actor_token,json=actorToken,proto3" json:"actor_token,omitempty"` + PreferenceCode string `protobuf:"bytes,3,opt,name=preference_code,json=preferenceCode,proto3" json:"preference_code,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetUserPreferenceByCodeRequest) Reset() { + *x = GetUserPreferenceByCodeRequest{} + mi := &file_st_peter_auth_proto_msgTypes[46] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetUserPreferenceByCodeRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetUserPreferenceByCodeRequest) ProtoMessage() {} + +func (x *GetUserPreferenceByCodeRequest) ProtoReflect() protoreflect.Message { + mi := &file_st_peter_auth_proto_msgTypes[46] + 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 GetUserPreferenceByCodeRequest.ProtoReflect.Descriptor instead. +func (*GetUserPreferenceByCodeRequest) Descriptor() ([]byte, []int) { + return file_st_peter_auth_proto_rawDescGZIP(), []int{46} +} + +func (x *GetUserPreferenceByCodeRequest) GetActorId() string { + if x != nil { + return x.ActorId + } + return "" +} + +func (x *GetUserPreferenceByCodeRequest) GetActorToken() string { + if x != nil { + return x.ActorToken + } + return "" +} + +func (x *GetUserPreferenceByCodeRequest) GetPreferenceCode() string { + if x != nil { + return x.PreferenceCode + } + return "" +} + +type GetUserPreferenceByCodeResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + ResultCode ResultCode `protobuf:"varint,2,opt,name=result_code,json=resultCode,proto3,enum=st_peter.auth.ResultCode" json:"result_code,omitempty"` + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` + Value string `protobuf:"bytes,4,opt,name=value,proto3" json:"value,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetUserPreferenceByCodeResponse) Reset() { + *x = GetUserPreferenceByCodeResponse{} + mi := &file_st_peter_auth_proto_msgTypes[47] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetUserPreferenceByCodeResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetUserPreferenceByCodeResponse) ProtoMessage() {} + +func (x *GetUserPreferenceByCodeResponse) ProtoReflect() protoreflect.Message { + mi := &file_st_peter_auth_proto_msgTypes[47] + 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 GetUserPreferenceByCodeResponse.ProtoReflect.Descriptor instead. +func (*GetUserPreferenceByCodeResponse) Descriptor() ([]byte, []int) { + return file_st_peter_auth_proto_rawDescGZIP(), []int{47} +} + +func (x *GetUserPreferenceByCodeResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *GetUserPreferenceByCodeResponse) GetResultCode() ResultCode { + if x != nil { + return x.ResultCode + } + return ResultCode_RESULT_CODE_SUCCESS +} + +func (x *GetUserPreferenceByCodeResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +func (x *GetUserPreferenceByCodeResponse) GetValue() string { + if x != nil { + return x.Value + } + return "" +} + +type ResendVerificationRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + UserIdentifier string `protobuf:"bytes,1,opt,name=user_identifier,json=userIdentifier,proto3" json:"user_identifier,omitempty"` + VerificationCodeType VerificationCodeType `protobuf:"varint,2,opt,name=verification_code_type,json=verificationCodeType,proto3,enum=st_peter.auth.VerificationCodeType" json:"verification_code_type,omitempty"` + AppHash string `protobuf:"bytes,3,opt,name=app_hash,json=appHash,proto3" json:"app_hash,omitempty"` + VerificationCodeId string `protobuf:"bytes,4,opt,name=verification_code_id,json=verificationCodeId,proto3" json:"verification_code_id,omitempty"` + DeviceInfo *DeviceInfo `protobuf:"bytes,19,opt,name=device_info,json=deviceInfo,proto3" json:"device_info,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ResendVerificationRequest) Reset() { + *x = ResendVerificationRequest{} + mi := &file_st_peter_auth_proto_msgTypes[48] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ResendVerificationRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ResendVerificationRequest) ProtoMessage() {} + +func (x *ResendVerificationRequest) ProtoReflect() protoreflect.Message { + mi := &file_st_peter_auth_proto_msgTypes[48] + 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 ResendVerificationRequest.ProtoReflect.Descriptor instead. +func (*ResendVerificationRequest) Descriptor() ([]byte, []int) { + return file_st_peter_auth_proto_rawDescGZIP(), []int{48} +} + +func (x *ResendVerificationRequest) GetUserIdentifier() string { + if x != nil { + return x.UserIdentifier + } + return "" +} + +func (x *ResendVerificationRequest) GetVerificationCodeType() VerificationCodeType { + if x != nil { + return x.VerificationCodeType + } + return VerificationCodeType_VERIFICATION_CODE_TYPE_UNSPECIFIED +} + +func (x *ResendVerificationRequest) GetAppHash() string { + if x != nil { + return x.AppHash + } + return "" +} + +func (x *ResendVerificationRequest) GetVerificationCodeId() string { + if x != nil { + return x.VerificationCodeId + } + return "" +} + +func (x *ResendVerificationRequest) GetDeviceInfo() *DeviceInfo { + if x != nil { + return x.DeviceInfo + } + return nil +} + +type ResendVerificationResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + ResultCode ResultCode `protobuf:"varint,2,opt,name=result_code,json=resultCode,proto3,enum=st_peter.auth.ResultCode" json:"result_code,omitempty"` + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` + VerificationCodeId string `protobuf:"bytes,4,opt,name=verification_code_id,json=verificationCodeId,proto3" json:"verification_code_id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ResendVerificationResponse) Reset() { + *x = ResendVerificationResponse{} + mi := &file_st_peter_auth_proto_msgTypes[49] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ResendVerificationResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ResendVerificationResponse) ProtoMessage() {} + +func (x *ResendVerificationResponse) ProtoReflect() protoreflect.Message { + mi := &file_st_peter_auth_proto_msgTypes[49] + 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 ResendVerificationResponse.ProtoReflect.Descriptor instead. +func (*ResendVerificationResponse) Descriptor() ([]byte, []int) { + return file_st_peter_auth_proto_rawDescGZIP(), []int{49} +} + +func (x *ResendVerificationResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *ResendVerificationResponse) GetResultCode() ResultCode { + if x != nil { + return x.ResultCode + } + return ResultCode_RESULT_CODE_SUCCESS +} + +func (x *ResendVerificationResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +func (x *ResendVerificationResponse) GetVerificationCodeId() string { + if x != nil { + return x.VerificationCodeId + } + return "" +} + +type UserSession struct { + state protoimpl.MessageState `protogen:"open.v1"` + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + UserId string `protobuf:"bytes,2,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` + DeviceInfo *DeviceInfo `protobuf:"bytes,3,opt,name=device_info,json=deviceInfo,proto3" json:"device_info,omitempty"` + CreatedAt *timestamppb.Timestamp `protobuf:"bytes,4,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"` + ExpiresAt *timestamppb.Timestamp `protobuf:"bytes,5,opt,name=expires_at,json=expiresAt,proto3" json:"expires_at,omitempty"` + LastActivity *timestamppb.Timestamp `protobuf:"bytes,6,opt,name=last_activity,json=lastActivity,proto3" json:"last_activity,omitempty"` + IsActive bool `protobuf:"varint,7,opt,name=is_active,json=isActive,proto3" json:"is_active,omitempty"` + IpAddress string `protobuf:"bytes,8,opt,name=ip_address,json=ipAddress,proto3" json:"ip_address,omitempty"` + UserAgent string `protobuf:"bytes,9,opt,name=user_agent,json=userAgent,proto3" json:"user_agent,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *UserSession) Reset() { + *x = UserSession{} + mi := &file_st_peter_auth_proto_msgTypes[50] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *UserSession) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UserSession) ProtoMessage() {} + +func (x *UserSession) ProtoReflect() protoreflect.Message { + mi := &file_st_peter_auth_proto_msgTypes[50] + 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 UserSession.ProtoReflect.Descriptor instead. +func (*UserSession) Descriptor() ([]byte, []int) { + return file_st_peter_auth_proto_rawDescGZIP(), []int{50} +} + +func (x *UserSession) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *UserSession) GetUserId() string { + if x != nil { + return x.UserId + } + return "" +} + +func (x *UserSession) GetDeviceInfo() *DeviceInfo { + if x != nil { + return x.DeviceInfo + } + return nil +} + +func (x *UserSession) GetCreatedAt() *timestamppb.Timestamp { + if x != nil { + return x.CreatedAt + } + return nil +} + +func (x *UserSession) GetExpiresAt() *timestamppb.Timestamp { + if x != nil { + return x.ExpiresAt + } + return nil +} + +func (x *UserSession) GetLastActivity() *timestamppb.Timestamp { + if x != nil { + return x.LastActivity + } + return nil +} + +func (x *UserSession) GetIsActive() bool { + if x != nil { + return x.IsActive + } + return false +} + +func (x *UserSession) GetIpAddress() string { + if x != nil { + return x.IpAddress + } + return "" +} + +func (x *UserSession) GetUserAgent() string { + if x != nil { + return x.UserAgent + } + return "" +} + +type GetUserSessionsRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + ActorId string `protobuf:"bytes,1,opt,name=actor_id,json=actorId,proto3" json:"actor_id,omitempty"` + ActorToken string `protobuf:"bytes,2,opt,name=actor_token,json=actorToken,proto3" json:"actor_token,omitempty"` + Page int32 `protobuf:"varint,3,opt,name=page,proto3" json:"page,omitempty"` + Size int32 `protobuf:"varint,4,opt,name=size,proto3" json:"size,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetUserSessionsRequest) Reset() { + *x = GetUserSessionsRequest{} + mi := &file_st_peter_auth_proto_msgTypes[51] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetUserSessionsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetUserSessionsRequest) ProtoMessage() {} + +func (x *GetUserSessionsRequest) ProtoReflect() protoreflect.Message { + mi := &file_st_peter_auth_proto_msgTypes[51] + 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 GetUserSessionsRequest.ProtoReflect.Descriptor instead. +func (*GetUserSessionsRequest) Descriptor() ([]byte, []int) { + return file_st_peter_auth_proto_rawDescGZIP(), []int{51} +} + +func (x *GetUserSessionsRequest) GetActorId() string { + if x != nil { + return x.ActorId + } + return "" +} + +func (x *GetUserSessionsRequest) GetActorToken() string { + if x != nil { + return x.ActorToken + } + return "" +} + +func (x *GetUserSessionsRequest) GetPage() int32 { + if x != nil { + return x.Page + } + return 0 +} + +func (x *GetUserSessionsRequest) GetSize() int32 { + if x != nil { + return x.Size + } + return 0 +} + +type GetUserSessionsResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + ResultCode ResultCode `protobuf:"varint,2,opt,name=result_code,json=resultCode,proto3,enum=st_peter.auth.ResultCode" json:"result_code,omitempty"` + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` + Sessions []*UserSession `protobuf:"bytes,4,rep,name=sessions,proto3" json:"sessions,omitempty"` + Total int32 `protobuf:"varint,5,opt,name=total,proto3" json:"total,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetUserSessionsResponse) Reset() { + *x = GetUserSessionsResponse{} + mi := &file_st_peter_auth_proto_msgTypes[52] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetUserSessionsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetUserSessionsResponse) ProtoMessage() {} + +func (x *GetUserSessionsResponse) ProtoReflect() protoreflect.Message { + mi := &file_st_peter_auth_proto_msgTypes[52] + 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 GetUserSessionsResponse.ProtoReflect.Descriptor instead. +func (*GetUserSessionsResponse) Descriptor() ([]byte, []int) { + return file_st_peter_auth_proto_rawDescGZIP(), []int{52} +} + +func (x *GetUserSessionsResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *GetUserSessionsResponse) GetResultCode() ResultCode { + if x != nil { + return x.ResultCode + } + return ResultCode_RESULT_CODE_SUCCESS +} + +func (x *GetUserSessionsResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +func (x *GetUserSessionsResponse) GetSessions() []*UserSession { + if x != nil { + return x.Sessions + } + return nil +} + +func (x *GetUserSessionsResponse) GetTotal() int32 { + if x != nil { + return x.Total + } + return 0 +} + +type ClearUserSessionsRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + ActorId string `protobuf:"bytes,1,opt,name=actor_id,json=actorId,proto3" json:"actor_id,omitempty"` + ActorToken string `protobuf:"bytes,2,opt,name=actor_token,json=actorToken,proto3" json:"actor_token,omitempty"` + SessionIds []string `protobuf:"bytes,3,rep,name=session_ids,json=sessionIds,proto3" json:"session_ids,omitempty"` // If empty, clears all sessions except current + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ClearUserSessionsRequest) Reset() { + *x = ClearUserSessionsRequest{} + mi := &file_st_peter_auth_proto_msgTypes[53] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ClearUserSessionsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ClearUserSessionsRequest) ProtoMessage() {} + +func (x *ClearUserSessionsRequest) ProtoReflect() protoreflect.Message { + mi := &file_st_peter_auth_proto_msgTypes[53] + 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 ClearUserSessionsRequest.ProtoReflect.Descriptor instead. +func (*ClearUserSessionsRequest) Descriptor() ([]byte, []int) { + return file_st_peter_auth_proto_rawDescGZIP(), []int{53} +} + +func (x *ClearUserSessionsRequest) GetActorId() string { + if x != nil { + return x.ActorId + } + return "" +} + +func (x *ClearUserSessionsRequest) GetActorToken() string { + if x != nil { + return x.ActorToken + } + return "" +} + +func (x *ClearUserSessionsRequest) GetSessionIds() []string { + if x != nil { + return x.SessionIds + } + return nil +} + +type ClearUserSessionsResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + ResultCode ResultCode `protobuf:"varint,2,opt,name=result_code,json=resultCode,proto3,enum=st_peter.auth.ResultCode" json:"result_code,omitempty"` + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` + ClearedCount int32 `protobuf:"varint,4,opt,name=cleared_count,json=clearedCount,proto3" json:"cleared_count,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ClearUserSessionsResponse) Reset() { + *x = ClearUserSessionsResponse{} + mi := &file_st_peter_auth_proto_msgTypes[54] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ClearUserSessionsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ClearUserSessionsResponse) ProtoMessage() {} + +func (x *ClearUserSessionsResponse) ProtoReflect() protoreflect.Message { + mi := &file_st_peter_auth_proto_msgTypes[54] + 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 ClearUserSessionsResponse.ProtoReflect.Descriptor instead. +func (*ClearUserSessionsResponse) Descriptor() ([]byte, []int) { + return file_st_peter_auth_proto_rawDescGZIP(), []int{54} +} + +func (x *ClearUserSessionsResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *ClearUserSessionsResponse) GetResultCode() ResultCode { + if x != nil { + return x.ResultCode + } + return ResultCode_RESULT_CODE_SUCCESS +} + +func (x *ClearUserSessionsResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +func (x *ClearUserSessionsResponse) GetClearedCount() int32 { + if x != nil { + return x.ClearedCount + } + return 0 +} + +// Metrics +type GetMetricsRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + BearerToken string `protobuf:"bytes,1,opt,name=bearer_token,json=bearerToken,proto3" json:"bearer_token,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetMetricsRequest) Reset() { + *x = GetMetricsRequest{} + mi := &file_st_peter_auth_proto_msgTypes[55] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetMetricsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetMetricsRequest) ProtoMessage() {} + +func (x *GetMetricsRequest) ProtoReflect() protoreflect.Message { + mi := &file_st_peter_auth_proto_msgTypes[55] + 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 GetMetricsRequest.ProtoReflect.Descriptor instead. +func (*GetMetricsRequest) Descriptor() ([]byte, []int) { + return file_st_peter_auth_proto_rawDescGZIP(), []int{55} +} + +func (x *GetMetricsRequest) GetBearerToken() string { + if x != nil { + return x.BearerToken + } + return "" +} + +type GetMetricsResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + ResultCode ResultCode `protobuf:"varint,2,opt,name=result_code,json=resultCode,proto3,enum=st_peter.auth.ResultCode" json:"result_code,omitempty"` + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` + Metrics string `protobuf:"bytes,4,opt,name=metrics,proto3" json:"metrics,omitempty"` // Prometheus text format + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetMetricsResponse) Reset() { + *x = GetMetricsResponse{} + mi := &file_st_peter_auth_proto_msgTypes[56] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetMetricsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetMetricsResponse) ProtoMessage() {} + +func (x *GetMetricsResponse) ProtoReflect() protoreflect.Message { + mi := &file_st_peter_auth_proto_msgTypes[56] + 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 GetMetricsResponse.ProtoReflect.Descriptor instead. +func (*GetMetricsResponse) Descriptor() ([]byte, []int) { + return file_st_peter_auth_proto_rawDescGZIP(), []int{56} +} + +func (x *GetMetricsResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *GetMetricsResponse) GetResultCode() ResultCode { + if x != nil { + return x.ResultCode + } + return ResultCode_RESULT_CODE_SUCCESS +} + +func (x *GetMetricsResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +func (x *GetMetricsResponse) GetMetrics() string { + if x != nil { + return x.Metrics + } + return "" +} + +// API Key messages +type CreateApiKeyRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Token string `protobuf:"bytes,1,opt,name=token,proto3" json:"token,omitempty"` // existing session token for auth + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + Scopes []string `protobuf:"bytes,3,rep,name=scopes,proto3" json:"scopes,omitempty"` + ExpiresAt int64 `protobuf:"varint,4,opt,name=expires_at,json=expiresAt,proto3" json:"expires_at,omitempty"` // 0 = never + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CreateApiKeyRequest) Reset() { + *x = CreateApiKeyRequest{} + mi := &file_st_peter_auth_proto_msgTypes[57] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CreateApiKeyRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateApiKeyRequest) ProtoMessage() {} + +func (x *CreateApiKeyRequest) ProtoReflect() protoreflect.Message { + mi := &file_st_peter_auth_proto_msgTypes[57] + 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 CreateApiKeyRequest.ProtoReflect.Descriptor instead. +func (*CreateApiKeyRequest) Descriptor() ([]byte, []int) { + return file_st_peter_auth_proto_rawDescGZIP(), []int{57} +} + +func (x *CreateApiKeyRequest) GetToken() string { + if x != nil { + return x.Token + } + return "" +} + +func (x *CreateApiKeyRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *CreateApiKeyRequest) GetScopes() []string { + if x != nil { + return x.Scopes + } + return nil +} + +func (x *CreateApiKeyRequest) GetExpiresAt() int64 { + if x != nil { + return x.ExpiresAt + } + return 0 +} + +type CreateApiKeyResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + ResultCode ResultCode `protobuf:"varint,2,opt,name=result_code,json=resultCode,proto3,enum=st_peter.auth.ResultCode" json:"result_code,omitempty"` + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` + ApiKey string `protobuf:"bytes,4,opt,name=api_key,json=apiKey,proto3" json:"api_key,omitempty"` // full key, shown ONCE + KeyId string `protobuf:"bytes,5,opt,name=key_id,json=keyId,proto3" json:"key_id,omitempty"` + KeyPrefix string `protobuf:"bytes,6,opt,name=key_prefix,json=keyPrefix,proto3" json:"key_prefix,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CreateApiKeyResponse) Reset() { + *x = CreateApiKeyResponse{} + mi := &file_st_peter_auth_proto_msgTypes[58] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CreateApiKeyResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateApiKeyResponse) ProtoMessage() {} + +func (x *CreateApiKeyResponse) ProtoReflect() protoreflect.Message { + mi := &file_st_peter_auth_proto_msgTypes[58] + 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 CreateApiKeyResponse.ProtoReflect.Descriptor instead. +func (*CreateApiKeyResponse) Descriptor() ([]byte, []int) { + return file_st_peter_auth_proto_rawDescGZIP(), []int{58} +} + +func (x *CreateApiKeyResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *CreateApiKeyResponse) GetResultCode() ResultCode { + if x != nil { + return x.ResultCode + } + return ResultCode_RESULT_CODE_SUCCESS +} + +func (x *CreateApiKeyResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +func (x *CreateApiKeyResponse) GetApiKey() string { + if x != nil { + return x.ApiKey + } + return "" +} + +func (x *CreateApiKeyResponse) GetKeyId() string { + if x != nil { + return x.KeyId + } + return "" +} + +func (x *CreateApiKeyResponse) GetKeyPrefix() string { + if x != nil { + return x.KeyPrefix + } + return "" +} + +type ListApiKeysRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Token string `protobuf:"bytes,1,opt,name=token,proto3" json:"token,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ListApiKeysRequest) Reset() { + *x = ListApiKeysRequest{} + mi := &file_st_peter_auth_proto_msgTypes[59] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ListApiKeysRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListApiKeysRequest) ProtoMessage() {} + +func (x *ListApiKeysRequest) ProtoReflect() protoreflect.Message { + mi := &file_st_peter_auth_proto_msgTypes[59] + 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 ListApiKeysRequest.ProtoReflect.Descriptor instead. +func (*ListApiKeysRequest) Descriptor() ([]byte, []int) { + return file_st_peter_auth_proto_rawDescGZIP(), []int{59} +} + +func (x *ListApiKeysRequest) GetToken() string { + if x != nil { + return x.Token + } + return "" +} + +type ListApiKeysResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + ResultCode ResultCode `protobuf:"varint,2,opt,name=result_code,json=resultCode,proto3,enum=st_peter.auth.ResultCode" json:"result_code,omitempty"` + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` + Keys []*ApiKeyInfo `protobuf:"bytes,4,rep,name=keys,proto3" json:"keys,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ListApiKeysResponse) Reset() { + *x = ListApiKeysResponse{} + mi := &file_st_peter_auth_proto_msgTypes[60] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ListApiKeysResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListApiKeysResponse) ProtoMessage() {} + +func (x *ListApiKeysResponse) ProtoReflect() protoreflect.Message { + mi := &file_st_peter_auth_proto_msgTypes[60] + 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 ListApiKeysResponse.ProtoReflect.Descriptor instead. +func (*ListApiKeysResponse) Descriptor() ([]byte, []int) { + return file_st_peter_auth_proto_rawDescGZIP(), []int{60} +} + +func (x *ListApiKeysResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *ListApiKeysResponse) GetResultCode() ResultCode { + if x != nil { + return x.ResultCode + } + return ResultCode_RESULT_CODE_SUCCESS +} + +func (x *ListApiKeysResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +func (x *ListApiKeysResponse) GetKeys() []*ApiKeyInfo { + if x != nil { + return x.Keys + } + return nil +} + +type ApiKeyInfo struct { + state protoimpl.MessageState `protogen:"open.v1"` + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + KeyPrefix string `protobuf:"bytes,3,opt,name=key_prefix,json=keyPrefix,proto3" json:"key_prefix,omitempty"` + Scopes []string `protobuf:"bytes,4,rep,name=scopes,proto3" json:"scopes,omitempty"` + LastUsedAt int64 `protobuf:"varint,5,opt,name=last_used_at,json=lastUsedAt,proto3" json:"last_used_at,omitempty"` + ExpiresAt int64 `protobuf:"varint,6,opt,name=expires_at,json=expiresAt,proto3" json:"expires_at,omitempty"` + CreatedAt int64 `protobuf:"varint,7,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"` + IsActive bool `protobuf:"varint,8,opt,name=is_active,json=isActive,proto3" json:"is_active,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ApiKeyInfo) Reset() { + *x = ApiKeyInfo{} + mi := &file_st_peter_auth_proto_msgTypes[61] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ApiKeyInfo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ApiKeyInfo) ProtoMessage() {} + +func (x *ApiKeyInfo) ProtoReflect() protoreflect.Message { + mi := &file_st_peter_auth_proto_msgTypes[61] + 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 ApiKeyInfo.ProtoReflect.Descriptor instead. +func (*ApiKeyInfo) Descriptor() ([]byte, []int) { + return file_st_peter_auth_proto_rawDescGZIP(), []int{61} +} + +func (x *ApiKeyInfo) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *ApiKeyInfo) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *ApiKeyInfo) GetKeyPrefix() string { + if x != nil { + return x.KeyPrefix + } + return "" +} + +func (x *ApiKeyInfo) GetScopes() []string { + if x != nil { + return x.Scopes + } + return nil +} + +func (x *ApiKeyInfo) GetLastUsedAt() int64 { + if x != nil { + return x.LastUsedAt + } + return 0 +} + +func (x *ApiKeyInfo) GetExpiresAt() int64 { + if x != nil { + return x.ExpiresAt + } + return 0 +} + +func (x *ApiKeyInfo) GetCreatedAt() int64 { + if x != nil { + return x.CreatedAt + } + return 0 +} + +func (x *ApiKeyInfo) GetIsActive() bool { + if x != nil { + return x.IsActive + } + return false +} + +type RevokeApiKeyRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Token string `protobuf:"bytes,1,opt,name=token,proto3" json:"token,omitempty"` + KeyId string `protobuf:"bytes,2,opt,name=key_id,json=keyId,proto3" json:"key_id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *RevokeApiKeyRequest) Reset() { + *x = RevokeApiKeyRequest{} + mi := &file_st_peter_auth_proto_msgTypes[62] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *RevokeApiKeyRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RevokeApiKeyRequest) ProtoMessage() {} + +func (x *RevokeApiKeyRequest) ProtoReflect() protoreflect.Message { + mi := &file_st_peter_auth_proto_msgTypes[62] + 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 RevokeApiKeyRequest.ProtoReflect.Descriptor instead. +func (*RevokeApiKeyRequest) Descriptor() ([]byte, []int) { + return file_st_peter_auth_proto_rawDescGZIP(), []int{62} +} + +func (x *RevokeApiKeyRequest) GetToken() string { + if x != nil { + return x.Token + } + return "" +} + +func (x *RevokeApiKeyRequest) GetKeyId() string { + if x != nil { + return x.KeyId + } + return "" +} + +type VerifyApiKeyRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + ApiKey string `protobuf:"bytes,1,opt,name=api_key,json=apiKey,proto3" json:"api_key,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *VerifyApiKeyRequest) Reset() { + *x = VerifyApiKeyRequest{} + mi := &file_st_peter_auth_proto_msgTypes[63] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *VerifyApiKeyRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*VerifyApiKeyRequest) ProtoMessage() {} + +func (x *VerifyApiKeyRequest) ProtoReflect() protoreflect.Message { + mi := &file_st_peter_auth_proto_msgTypes[63] + 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 VerifyApiKeyRequest.ProtoReflect.Descriptor instead. +func (*VerifyApiKeyRequest) Descriptor() ([]byte, []int) { + return file_st_peter_auth_proto_rawDescGZIP(), []int{63} +} + +func (x *VerifyApiKeyRequest) GetApiKey() string { + if x != nil { + return x.ApiKey + } + return "" +} + +// Password policy +type GetPasswordPolicyRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetPasswordPolicyRequest) Reset() { + *x = GetPasswordPolicyRequest{} + mi := &file_st_peter_auth_proto_msgTypes[64] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetPasswordPolicyRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetPasswordPolicyRequest) ProtoMessage() {} + +func (x *GetPasswordPolicyRequest) ProtoReflect() protoreflect.Message { + mi := &file_st_peter_auth_proto_msgTypes[64] + 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 GetPasswordPolicyRequest.ProtoReflect.Descriptor instead. +func (*GetPasswordPolicyRequest) Descriptor() ([]byte, []int) { + return file_st_peter_auth_proto_rawDescGZIP(), []int{64} +} + +type GetPasswordPolicyResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + ResultCode ResultCode `protobuf:"varint,2,opt,name=result_code,json=resultCode,proto3,enum=st_peter.auth.ResultCode" json:"result_code,omitempty"` + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` + MinLength uint32 `protobuf:"varint,4,opt,name=min_length,json=minLength,proto3" json:"min_length,omitempty"` + RequiresUppercase bool `protobuf:"varint,5,opt,name=requires_uppercase,json=requiresUppercase,proto3" json:"requires_uppercase,omitempty"` + RequiresSpecialCharacter bool `protobuf:"varint,6,opt,name=requires_special_character,json=requiresSpecialCharacter,proto3" json:"requires_special_character,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetPasswordPolicyResponse) Reset() { + *x = GetPasswordPolicyResponse{} + mi := &file_st_peter_auth_proto_msgTypes[65] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetPasswordPolicyResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetPasswordPolicyResponse) ProtoMessage() {} + +func (x *GetPasswordPolicyResponse) ProtoReflect() protoreflect.Message { + mi := &file_st_peter_auth_proto_msgTypes[65] + 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 GetPasswordPolicyResponse.ProtoReflect.Descriptor instead. +func (*GetPasswordPolicyResponse) Descriptor() ([]byte, []int) { + return file_st_peter_auth_proto_rawDescGZIP(), []int{65} +} + +func (x *GetPasswordPolicyResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *GetPasswordPolicyResponse) GetResultCode() ResultCode { + if x != nil { + return x.ResultCode + } + return ResultCode_RESULT_CODE_SUCCESS +} + +func (x *GetPasswordPolicyResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +func (x *GetPasswordPolicyResponse) GetMinLength() uint32 { + if x != nil { + return x.MinLength + } + return 0 +} + +func (x *GetPasswordPolicyResponse) GetRequiresUppercase() bool { + if x != nil { + return x.RequiresUppercase + } + return false +} + +func (x *GetPasswordPolicyResponse) GetRequiresSpecialCharacter() bool { + if x != nil { + return x.RequiresSpecialCharacter + } + return false +} + +// Lookup user by exact identifier (email, phone number, or handle) +type LookupUserRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + UserId string `protobuf:"bytes,1,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` + UserToken string `protobuf:"bytes,2,opt,name=user_token,json=userToken,proto3" json:"user_token,omitempty"` + Identifier string `protobuf:"bytes,3,opt,name=identifier,proto3" json:"identifier,omitempty"` // email, phone number, or handle + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *LookupUserRequest) Reset() { + *x = LookupUserRequest{} + mi := &file_st_peter_auth_proto_msgTypes[66] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *LookupUserRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*LookupUserRequest) ProtoMessage() {} + +func (x *LookupUserRequest) ProtoReflect() protoreflect.Message { + mi := &file_st_peter_auth_proto_msgTypes[66] + 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 LookupUserRequest.ProtoReflect.Descriptor instead. +func (*LookupUserRequest) Descriptor() ([]byte, []int) { + return file_st_peter_auth_proto_rawDescGZIP(), []int{66} +} + +func (x *LookupUserRequest) GetUserId() string { + if x != nil { + return x.UserId + } + return "" +} + +func (x *LookupUserRequest) GetUserToken() string { + if x != nil { + return x.UserToken + } + return "" +} + +func (x *LookupUserRequest) GetIdentifier() string { + if x != nil { + return x.Identifier + } + return "" +} + +type LookupUserResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + ResultCode ResultCode `protobuf:"varint,2,opt,name=result_code,json=resultCode,proto3,enum=st_peter.auth.ResultCode" json:"result_code,omitempty"` + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` + User *User `protobuf:"bytes,4,opt,name=user,proto3,oneof" json:"user,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *LookupUserResponse) Reset() { + *x = LookupUserResponse{} + mi := &file_st_peter_auth_proto_msgTypes[67] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *LookupUserResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*LookupUserResponse) ProtoMessage() {} + +func (x *LookupUserResponse) ProtoReflect() protoreflect.Message { + mi := &file_st_peter_auth_proto_msgTypes[67] + 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 LookupUserResponse.ProtoReflect.Descriptor instead. +func (*LookupUserResponse) Descriptor() ([]byte, []int) { + return file_st_peter_auth_proto_rawDescGZIP(), []int{67} +} + +func (x *LookupUserResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *LookupUserResponse) GetResultCode() ResultCode { + if x != nil { + return x.ResultCode + } + return ResultCode_RESULT_CODE_SUCCESS +} + +func (x *LookupUserResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +func (x *LookupUserResponse) GetUser() *User { + if x != nil { + return x.User + } + return nil +} + +var File_st_peter_auth_proto protoreflect.FileDescriptor + +const file_st_peter_auth_proto_rawDesc = "" + + "\n" + + "\x13st-peter-auth.proto\x12\rst_peter.auth\x1a\x1fgoogle/protobuf/timestamp.proto\"B\n" + + "\x04Date\x12\x12\n" + + "\x04year\x18\x01 \x01(\x05R\x04year\x12\x14\n" + + "\x05month\x18\x02 \x01(\rR\x05month\x12\x10\n" + + "\x03day\x18\x03 \x01(\rR\x03day\"\xd3\x05\n" + + "\x04User\x12\x0e\n" + + "\x02id\x18\x01 \x01(\tR\x02id\x12\x14\n" + + "\x05email\x18\x02 \x01(\tR\x05email\x12\x14\n" + + "\x05phone\x18\x03 \x01(\tR\x05phone\x12\x1f\n" + + "\vfirst_names\x18\x04 \x01(\tR\n" + + "firstNames\x12\x1b\n" + + "\tlast_name\x18\x05 \x01(\tR\blastName\x12.\n" + + "\x13profile_picture_url\x18\x06 \x01(\tR\x11profilePictureUrl\x12\x1b\n" + + "\x06handle\x18\a \x01(\tH\x00R\x06handle\x88\x01\x01\x129\n" + + "\n" + + "created_at\x18\n" + + " \x01(\v2\x1a.google.protobuf.TimestampR\tcreatedAt\x129\n" + + "\n" + + "updated_at\x18\v \x01(\v2\x1a.google.protobuf.TimestampR\tupdatedAt\x129\n" + + "\n" + + "deleted_at\x18\f \x01(\v2\x1a.google.protobuf.TimestampR\tdeletedAt\x129\n" + + "\n" + + "last_login\x18\r \x01(\v2\x1a.google.protobuf.TimestampR\tlastLogin\x12\x1b\n" + + "\tis_active\x18\x14 \x01(\bR\bisActive\x12*\n" + + "\x11is_email_verified\x18\x15 \x01(\bR\x0fisEmailVerified\x12*\n" + + "\x11is_phone_verified\x18\x16 \x01(\bR\x0fisPhoneVerified\x127\n" + + "\rdate_of_birth\x18\x17 \x01(\v2\x13.st_peter.auth.DateR\vdateOfBirth\x12\x18\n" + + "\aversion\x18\x18 \x01(\x03R\aversion\x12E\n" + + "\x0fsocial_accounts\x18\x1e \x03(\v2\x1c.st_peter.auth.SocialAccountR\x0esocialAccountsB\t\n" + + "\a_handle\"\xb7\x02\n" + + "\x0eUserPreference\x12\x0e\n" + + "\x02id\x18\x01 \x01(\tR\x02id\x12\x17\n" + + "\auser_id\x18\x02 \x01(\tR\x06userId\x12'\n" + + "\x0fpreference_code\x18\x03 \x01(\tR\x0epreferenceCode\x122\n" + + "\x15preference_value_type\x18\x04 \x01(\tR\x13preferenceValueType\x12)\n" + + "\x10preference_value\x18\x05 \x01(\tR\x0fpreferenceValue\x129\n" + + "\n" + + "created_at\x18\n" + + " \x01(\v2\x1a.google.protobuf.TimestampR\tcreatedAt\x129\n" + + "\n" + + "updated_at\x18\v \x01(\v2\x1a.google.protobuf.TimestampR\tupdatedAt\"\xc2\x01\n" + + "\x04Role\x12\x0e\n" + + "\x02id\x18\x01 \x01(\tR\x02id\x12\x12\n" + + "\x04code\x18\x02 \x01(\tR\x04code\x12 \n" + + "\vdescription\x18\x03 \x01(\tR\vdescription\x129\n" + + "\n" + + "created_at\x18\x04 \x01(\v2\x1a.google.protobuf.TimestampR\tcreatedAt\x129\n" + + "\n" + + "updated_at\x18\x05 \x01(\v2\x1a.google.protobuf.TimestampR\tupdatedAt\"\xb4\x02\n" + + "\rSocialAccount\x12\x1a\n" + + "\bprovider\x18\x01 \x01(\tR\bprovider\x12(\n" + + "\x10provider_user_id\x18\x02 \x01(\tR\x0eproviderUserId\x12!\n" + + "\faccess_token\x18\x03 \x01(\tR\vaccessToken\x129\n" + + "\n" + + "expires_at\x18\x04 \x01(\v2\x1a.google.protobuf.TimestampR\texpiresAt\x12\x14\n" + + "\x05email\x18\x05 \x01(\tR\x05email\x12\x12\n" + + "\x04name\x18\x06 \x01(\tR\x04name\x12.\n" + + "\x13profile_picture_url\x18\a \x01(\tR\x11profilePictureUrl\x12%\n" + + "\x0eemail_verified\x18\b \x01(\bR\remailVerified\"\xde\x01\n" + + "\x12SocialLoginRequest\x128\n" + + "\bprovider\x18\x01 \x01(\x0e2\x1c.st_peter.auth.OAuthProviderR\bprovider\x12\x19\n" + + "\bid_token\x18\x02 \x01(\tR\aidToken\x12!\n" + + "\faccess_token\x18\x03 \x01(\tR\vaccessToken\x12:\n" + + "\vdevice_info\x18\x04 \x01(\v2\x19.st_peter.auth.DeviceInfoR\n" + + "deviceInfo\x12\x14\n" + + "\x05nonce\x18\x05 \x01(\tR\x05nonce\"\xeb\x02\n" + + "\x13SocialLoginResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12:\n" + + "\vresult_code\x18\x02 \x01(\x0e2\x19.st_peter.auth.ResultCodeR\n" + + "resultCode\x12\x18\n" + + "\amessage\x18\x03 \x01(\tR\amessage\x12O\n" + + "\x12authenticated_user\x18\x04 \x01(\v2 .st_peter.auth.AuthenticatedUserR\x11authenticatedUser\x12\x1e\n" + + "\vis_new_user\x18\x05 \x01(\bR\tisNewUser\x12&\n" + + "\x0fwas_auto_linked\x18\x06 \x01(\bR\rwasAutoLinked\x12K\n" + + "\x11validation_errors\x18\a \x03(\v2\x1e.st_peter.auth.ValidationErrorR\x10validationErrors\"\x89\x01\n" + + "\x14InitiateOAuthRequest\x128\n" + + "\bprovider\x18\x01 \x01(\x0e2\x1c.st_peter.auth.OAuthProviderR\bprovider\x12!\n" + + "\fredirect_uri\x18\x02 \x01(\tR\vredirectUri\x12\x14\n" + + "\x05state\x18\x03 \x01(\tR\x05state\"\xca\x01\n" + + "\x15InitiateOAuthResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12:\n" + + "\vresult_code\x18\x02 \x01(\x0e2\x19.st_peter.auth.ResultCodeR\n" + + "resultCode\x12\x18\n" + + "\amessage\x18\x03 \x01(\tR\amessage\x12+\n" + + "\x11authorization_url\x18\x04 \x01(\tR\x10authorizationUrl\x12\x14\n" + + "\x05state\x18\x05 \x01(\tR\x05state\"\xb6\x01\n" + + "\x14OAuthCallbackRequest\x128\n" + + "\bprovider\x18\x01 \x01(\x0e2\x1c.st_peter.auth.OAuthProviderR\bprovider\x12\x12\n" + + "\x04code\x18\x02 \x01(\tR\x04code\x12\x14\n" + + "\x05state\x18\x03 \x01(\tR\x05state\x12:\n" + + "\vdevice_info\x18\x04 \x01(\v2\x19.st_peter.auth.DeviceInfoR\n" + + "deviceInfo\"\xe4\x01\n" + + "\x18LinkSocialAccountRequest\x12\x19\n" + + "\bactor_id\x18\x01 \x01(\tR\aactorId\x12\x1f\n" + + "\vactor_token\x18\x02 \x01(\tR\n" + + "actorToken\x128\n" + + "\bprovider\x18\x03 \x01(\x0e2\x1c.st_peter.auth.OAuthProviderR\bprovider\x12\x19\n" + + "\bid_token\x18\x04 \x01(\tR\aidToken\x12!\n" + + "\faccess_token\x18\x05 \x01(\tR\vaccessToken\x12\x14\n" + + "\x05nonce\x18\x06 \x01(\tR\x05nonce\"\x92\x01\n" + + "\x1aUnlinkSocialAccountRequest\x12\x19\n" + + "\bactor_id\x18\x01 \x01(\tR\aactorId\x12\x1f\n" + + "\vactor_token\x18\x02 \x01(\tR\n" + + "actorToken\x128\n" + + "\bprovider\x18\x03 \x01(\x0e2\x1c.st_peter.auth.OAuthProviderR\bprovider\"V\n" + + "\x18GetLinkedAccountsRequest\x12\x19\n" + + "\bactor_id\x18\x01 \x01(\tR\aactorId\x12\x1f\n" + + "\vactor_token\x18\x02 \x01(\tR\n" + + "actorToken\"\xc5\x01\n" + + "\x19GetLinkedAccountsResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12:\n" + + "\vresult_code\x18\x02 \x01(\x0e2\x19.st_peter.auth.ResultCodeR\n" + + "resultCode\x12\x18\n" + + "\amessage\x18\x03 \x01(\tR\amessage\x128\n" + + "\baccounts\x18\x04 \x03(\v2\x1c.st_peter.auth.SocialAccountR\baccounts\"\xef\x01\n" + + "\x13RegisterUserRequest\x12'\n" + + "\x0fuser_identifier\x18\x01 \x01(\tR\x0euserIdentifier\x12\x1a\n" + + "\bpassword\x18\x02 \x01(\tR\bpassword\x12\x1f\n" + + "\vfirst_names\x18\x04 \x01(\tR\n" + + "firstNames\x12\x1b\n" + + "\tlast_name\x18\x05 \x01(\tR\blastName\x12\x19\n" + + "\bapp_hash\x18\x06 \x01(\tR\aappHash\x12:\n" + + "\vdevice_info\x18\a \x01(\v2\x19.st_peter.auth.DeviceInfoR\n" + + "deviceInfo\"\xfc\x01\n" + + "\x14RegisterUserResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12:\n" + + "\vresult_code\x18\x02 \x01(\x0e2\x19.st_peter.auth.ResultCodeR\n" + + "resultCode\x12\x18\n" + + "\amessage\x18\x03 \x01(\tR\amessage\x12'\n" + + "\x0fregistration_id\x18\x04 \x01(\tR\x0eregistrationId\x12K\n" + + "\x11validation_errors\x18\x05 \x03(\v2\x1e.st_peter.auth.ValidationErrorR\x10validationErrors\"\xbf\x01\n" + + "\x19VerifyRegisterUserRequest\x12'\n" + + "\x0fuser_identifier\x18\x01 \x01(\tR\x0euserIdentifier\x12'\n" + + "\x0fregistration_id\x18\x02 \x01(\tR\x0eregistrationId\x12\x14\n" + + "\x05token\x18\x03 \x01(\tR\x05token\x12:\n" + + "\vdevice_info\x18\x04 \x01(\v2\x19.st_peter.auth.DeviceInfoR\n" + + "deviceInfo\"\xa7\x01\n" + + "\fUserResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12:\n" + + "\vresult_code\x18\x02 \x01(\x0e2\x19.st_peter.auth.ResultCodeR\n" + + "resultCode\x12\x18\n" + + "\amessage\x18\x03 \x01(\tR\amessage\x12'\n" + + "\x04user\x18\x04 \x01(\v2\x13.st_peter.auth.UserR\x04user\"\x90\x02\n" + + "\n" + + "DeviceInfo\x12)\n" + + "\x10application_name\x18\x01 \x01(\tR\x0fapplicationName\x12/\n" + + "\x13application_version\x18\x02 \x01(\tR\x12applicationVersion\x12\x1f\n" + + "\vdevice_name\x18\x03 \x01(\tR\n" + + "deviceName\x12\x1f\n" + + "\vdevice_type\x18\x04 \x01(\tR\n" + + "deviceType\x12\x1b\n" + + "\tdevice_os\x18\x05 \x01(\tR\bdeviceOs\x12*\n" + + "\x11device_os_version\x18\x06 \x01(\tR\x0fdeviceOsVersion\x12\x1b\n" + + "\tdevice_id\x18\a \x01(\tR\bdeviceId\"\xaa\x01\n" + + "\fLoginRequest\x12'\n" + + "\x0fuser_identifier\x18\x01 \x01(\tR\x0euserIdentifier\x12\x1a\n" + + "\bpassword\x18\x02 \x01(\tR\bpassword\x12\x19\n" + + "\bapp_hash\x18\x03 \x01(\tR\aappHash\x12:\n" + + "\vdevice_info\x18\x04 \x01(\v2\x19.st_peter.auth.DeviceInfoR\n" + + "deviceInfo\"\xab\x02\n" + + "\x16AuthenticationResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12,\n" + + "\x12pass_code_required\x18\x02 \x01(\bR\x10passCodeRequired\x12\"\n" + + "\rtwo_factor_id\x18\x03 \x01(\tR\vtwoFactorId\x12:\n" + + "\vresult_code\x18\b \x01(\x0e2\x19.st_peter.auth.ResultCodeR\n" + + "resultCode\x12\x18\n" + + "\amessage\x18\t \x01(\tR\amessage\x12O\n" + + "\x12authenticated_user\x18\n" + + " \x01(\v2 .st_peter.auth.AuthenticatedUserR\x11authenticatedUser\"\xb6\x02\n" + + "\x11AuthenticatedUser\x12'\n" + + "\x04user\x18\x01 \x01(\v2\x13.st_peter.auth.UserR\x04user\x12\x14\n" + + "\x05token\x18\x02 \x01(\tR\x05token\x12\x1d\n" + + "\n" + + "session_id\x18\x03 \x01(\tR\tsessionId\x129\n" + + "\n" + + "expires_at\x18\x04 \x01(\v2\x1a.google.protobuf.TimestampR\texpiresAt\x12H\n" + + "\x10user_preferences\x18\x05 \x03(\v2\x1d.st_peter.auth.UserPreferenceR\x0fuserPreferences\x12>\n" + + "\n" + + "user_roles\x18\v \x03(\v2\x1f.st_peter.auth.AssignedUserRoleR\tuserRoles\"\xad\x01\n" + + "\x10AssignedUserRole\x12\x0e\n" + + "\x02id\x18\x01 \x01(\tR\x02id\x12\x17\n" + + "\auser_id\x18\x02 \x01(\tR\x06userId\x12\x17\n" + + "\arole_id\x18\x03 \x01(\tR\x06roleId\x12\x1b\n" + + "\trole_name\x18\x04 \x01(\tR\broleName\x12\x1d\n" + + "\n" + + "scope_code\x18\x05 \x01(\tR\tscopeCode\x12\x1b\n" + + "\ttarget_id\x18\x06 \x01(\tR\btargetId\"\x98\x01\n" + + "\x12VerifyTokenRequest\x12\x14\n" + + "\x05token\x18\x01 \x01(\tR\x05token\x12,\n" + + "\x12include_user_roles\x18\x02 \x01(\bR\x10includeUserRoles\x12\x1f\n" + + "\vrole_scopes\x18\x03 \x03(\tR\n" + + "roleScopes\x12\x1d\n" + + "\n" + + "role_names\x18\x04 \x03(\tR\troleNames\"3\n" + + "\x1bVerifyAuthClaimTokenRequest\x12\x14\n" + + "\x05claim\x18\x02 \x01(\tR\x05claim\"\xcb\x02\n" + + "\x19InitiateTwoFactorResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12:\n" + + "\vresult_code\x18\x02 \x01(\x0e2\x19.st_peter.auth.ResultCodeR\n" + + "resultCode\x12\x18\n" + + "\amessage\x18\x03 \x01(\tR\amessage\x12\"\n" + + "\rtwo_factor_id\x18\x04 \x01(\tR\vtwoFactorId\x124\n" + + "\achannel\x18\x05 \x01(\x0e2\x1a.st_peter.auth.ChannelTypeR\achannel\x12\x17\n" + + "\auser_id\x18\a \x01(\tR\x06userId\x12K\n" + + "\x11validation_errors\x18\x06 \x03(\v2\x1e.st_peter.auth.ValidationErrorR\x10validationErrors\"\xd6\x01\n" + + "\x17VerifyTwoFactorResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12:\n" + + "\vresult_code\x18\x02 \x01(\x0e2\x19.st_peter.auth.ResultCodeR\n" + + "resultCode\x12\x18\n" + + "\amessage\x18\x03 \x01(\tR\amessage\x12K\n" + + "\x11validation_errors\x18\x04 \x03(\v2\x1e.st_peter.auth.ValidationErrorR\x10validationErrors\"\x93\x02\n" + + "\x18InitiateTwoFactorRequest\x12\x1c\n" + + "\auser_id\x18\x01 \x01(\tH\x00R\x06userId\x88\x01\x01\x12,\n" + + "\x0fuser_identifier\x18\x05 \x01(\tH\x01R\x0euserIdentifier\x88\x01\x01\x124\n" + + "\achannel\x18\x02 \x01(\x0e2\x1a.st_peter.auth.ChannelTypeR\achannel\x12\x19\n" + + "\bapp_hash\x18\x03 \x01(\tR\aappHash\x12:\n" + + "\vdevice_info\x18\x04 \x01(\v2\x19.st_peter.auth.DeviceInfoR\n" + + "deviceInfoB\n" + + "\n" + + "\b_user_idB\x12\n" + + "\x10_user_identifier\"\x8c\x01\n" + + "\x16VerifyTwoFactorRequest\x12\"\n" + + "\rtwo_factor_id\x18\x01 \x01(\tR\vtwoFactorId\x12\x12\n" + + "\x04code\x18\x02 \x01(\tR\x04code\x12:\n" + + "\vdevice_info\x18\x03 \x01(\v2\x19.st_peter.auth.DeviceInfoR\n" + + "deviceInfo\"\xc1\x01\n" + + "\x1cInitiatePasswordResetRequest\x12'\n" + + "\x0fuser_identifier\x18\x01 \x01(\tR\x0euserIdentifier\x12\x19\n" + + "\bapp_hash\x18\x02 \x01(\tR\aappHash\x12:\n" + + "\vdevice_info\x18\x04 \x01(\v2\x19.st_peter.auth.DeviceInfoR\n" + + "deviceInfo\x12!\n" + + "\fnew_password\x18\x05 \x01(\tR\vnewPassword\"\x83\x01\n" + + "\x11OperationResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12:\n" + + "\vresult_code\x18\x02 \x01(\x0e2\x19.st_peter.auth.ResultCodeR\n" + + "resultCode\x12\x18\n" + + "\amessage\x18\x03 \x01(\tR\amessage\"\x82\x01\n" + + "\x1fVerifyPasswordResetTokenRequest\x12\x17\n" + + "\auser_id\x18\x01 \x01(\tR\x06userId\x12*\n" + + "\x11password_reset_id\x18\x02 \x01(\tR\x0fpasswordResetId\x12\x1a\n" + + "\bpasscode\x18\x03 \x01(\tR\bpasscode\"\xb8\x01\n" + + "\x1aPasswordResetTokenResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12:\n" + + "\vresult_code\x18\x02 \x01(\x0e2\x19.st_peter.auth.ResultCodeR\n" + + "resultCode\x12\x18\n" + + "\amessage\x18\x03 \x01(\tR\amessage\x12*\n" + + "\x11password_reset_id\x18\x04 \x01(\tR\x0fpasswordResetId\"\xb3\x01\n" + + "\x14ResetPasswordRequest\x12\x17\n" + + "\auser_id\x18\x01 \x01(\tR\x06userId\x12*\n" + + "\x11password_reset_id\x18\x02 \x01(\tR\x0fpasswordResetId\x12\x1a\n" + + "\bpasscode\x18\x03 \x01(\tR\bpasscode\x12:\n" + + "\vdevice_info\x18\x04 \x01(\v2\x19.st_peter.auth.DeviceInfoR\n" + + "deviceInfo\"\xbb\x02\n" + + "\x1aChangeIdentityFieldRequest\x12\x17\n" + + "\auser_id\x18\x01 \x01(\tR\x06userId\x12\x1d\n" + + "\n" + + "user_token\x18\x02 \x01(\tR\tuserToken\x124\n" + + "\achannel\x18\x03 \x01(\x0e2\x1a.st_peter.auth.ChannelTypeR\achannel\x12\x1b\n" + + "\tnew_value\x18\x04 \x01(\tR\bnewValue\x12;\n" + + "\n" + + "field_type\x18\x05 \x01(\x0e2\x1c.st_peter.auth.IdentityFieldR\tfieldType\x12\x19\n" + + "\bapp_hash\x18\x06 \x01(\tR\aappHash\x12:\n" + + "\vdevice_info\x18\a \x01(\v2\x19.st_peter.auth.DeviceInfoR\n" + + "deviceInfo\"\x81\x03\n" + + "\x1bChangeIdentityFieldResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12:\n" + + "\vresult_code\x18\x02 \x01(\x0e2\x19.st_peter.auth.ResultCodeR\n" + + "resultCode\x12\x18\n" + + "\amessage\x18\x03 \x01(\tR\amessage\x12!\n" + + "\fchallenge_id\x18\x04 \x01(\tR\vchallengeId\x12#\n" + + "\rpasscode_size\x18\x05 \x01(\x05R\fpasscodeSize\x12'\n" + + "\x0fuser_identifier\x18\x06 \x01(\tR\x0euserIdentifier\x124\n" + + "\achannel\x18\a \x01(\x0e2\x1a.st_peter.auth.ChannelTypeR\achannel\x12K\n" + + "\x11validation_errors\x18\b \x03(\v2\x1e.st_peter.auth.ValidationErrorR\x10validationErrors\"\xfb\x01\n" + + "\x1aVerifyIdentityFieldRequest\x12\x17\n" + + "\auser_id\x18\x01 \x01(\tR\x06userId\x12\x1d\n" + + "\n" + + "user_token\x18\x02 \x01(\tR\tuserToken\x12!\n" + + "\fchallenge_id\x18\x04 \x01(\tR\vchallengeId\x12+\n" + + "\x11verification_code\x18\x05 \x01(\tR\x10verificationCode\x12\x19\n" + + "\bapp_hash\x18\x06 \x01(\tR\aappHash\x12:\n" + + "\vdevice_info\x18\a \x01(\v2\x19.st_peter.auth.DeviceInfoR\n" + + "deviceInfo\"\xce\x01\n" + + "\x1aResendIdentityFieldRequest\x12\x17\n" + + "\auser_id\x18\x01 \x01(\tR\x06userId\x12\x1d\n" + + "\n" + + "user_token\x18\x02 \x01(\tR\tuserToken\x12!\n" + + "\fchallenge_id\x18\x04 \x01(\tR\vchallengeId\x12\x19\n" + + "\bapp_hash\x18\x06 \x01(\tR\aappHash\x12:\n" + + "\vdevice_info\x18\a \x01(\v2\x19.st_peter.auth.DeviceInfoR\n" + + "deviceInfo\"\xb6\x03\n" + + "\x1bVerifyIdentityFieldResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12:\n" + + "\vresult_code\x18\x02 \x01(\x0e2\x19.st_peter.auth.ResultCodeR\n" + + "resultCode\x12\x18\n" + + "\amessage\x18\x03 \x01(\tR\amessage\x123\n" + + "\x15requires_verification\x18\b \x01(\bR\x14requiresVerification\x12!\n" + + "\fchallenge_id\x18\x04 \x01(\tR\vchallengeId\x12#\n" + + "\rpasscode_size\x18\x05 \x01(\x05R\fpasscodeSize\x12'\n" + + "\x0fuser_identifier\x18\x06 \x01(\tR\x0euserIdentifier\x124\n" + + "\achannel\x18\a \x01(\x0e2\x1a.st_peter.auth.ChannelTypeR\achannel\x12K\n" + + "\x11validation_errors\x18\t \x03(\v2\x1e.st_peter.auth.ValidationErrorR\x10validationErrors\"\xe0\x02\n" + + "\x15UpdateUserInfoRequest\x12\x17\n" + + "\auser_id\x18\x01 \x01(\tR\x06userId\x12\x1d\n" + + "\n" + + "user_token\x18\x02 \x01(\tR\tuserToken\x12$\n" + + "\vfirst_names\x18\x03 \x01(\tH\x00R\n" + + "firstNames\x88\x01\x01\x12 \n" + + "\tlast_name\x18\x04 \x01(\tH\x01R\blastName\x88\x01\x01\x121\n" + + "\x12profile_picture_id\x18\x06 \x01(\tH\x02R\x10profilePictureId\x88\x01\x01\x127\n" + + "\rdate_of_birth\x18\x05 \x01(\v2\x13.st_peter.auth.DateR\vdateOfBirth\x12\x1b\n" + + "\x06handle\x18\a \x01(\tH\x03R\x06handle\x88\x01\x01B\x0e\n" + + "\f_first_namesB\f\n" + + "\n" + + "_last_nameB\x15\n" + + "\x13_profile_picture_idB\t\n" + + "\a_handle\"\xb1\x01\n" + + "\x16UpdateUserInfoResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12:\n" + + "\vresult_code\x18\x02 \x01(\x0e2\x19.st_peter.auth.ResultCodeR\n" + + "resultCode\x12\x18\n" + + "\amessage\x18\x03 \x01(\tR\amessage\x12'\n" + + "\x04user\x18\x04 \x01(\v2\x13.st_peter.auth.UserR\x04user\"%\n" + + "\rLogoutRequest\x12\x14\n" + + "\x05token\x18\x01 \x01(\tR\x05token\"\x80\x01\n" + + "\x0eLogoutResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12:\n" + + "\vresult_code\x18\x02 \x01(\x0e2\x19.st_peter.auth.ResultCodeR\n" + + "resultCode\x12\x18\n" + + "\amessage\x18\x03 \x01(\tR\amessage\"A\n" + + "\x0fValidationError\x12\x14\n" + + "\x05field\x18\x01 \x01(\tR\x05field\x12\x18\n" + + "\amessage\x18\x02 \x01(\tR\amessage\"\x90\x01\n" + + "\x05Scope\x12\x12\n" + + "\x04code\x18\x01 \x01(\tR\x04code\x12 \n" + + "\vdescription\x18\x02 \x01(\tR\vdescription\x12$\n" + + "\vparent_code\x18\x03 \x01(\tH\x00R\n" + + "parentCode\x88\x01\x01\x12\x1b\n" + + "\tis_active\x18\x04 \x01(\bR\bisActiveB\x0e\n" + + "\f_parent_code\"\xab\x01\n" + + "\x1bUpdateUserPreferenceRequest\x12\x19\n" + + "\bactor_id\x18\x01 \x01(\tR\aactorId\x12\x1f\n" + + "\vactor_token\x18\x02 \x01(\tR\n" + + "actorToken\x12%\n" + + "\x0epreference_key\x18\x03 \x01(\tR\rpreferenceKey\x12)\n" + + "\x10preference_value\x18\x04 \x01(\tR\x0fpreferenceValue\"\x85\x01\n" + + "\x1eGetUserPreferenceByCodeRequest\x12\x19\n" + + "\bactor_id\x18\x01 \x01(\tR\aactorId\x12\x1f\n" + + "\vactor_token\x18\x02 \x01(\tR\n" + + "actorToken\x12'\n" + + "\x0fpreference_code\x18\x03 \x01(\tR\x0epreferenceCode\"\xa7\x01\n" + + "\x1fGetUserPreferenceByCodeResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12:\n" + + "\vresult_code\x18\x02 \x01(\x0e2\x19.st_peter.auth.ResultCodeR\n" + + "resultCode\x12\x18\n" + + "\amessage\x18\x03 \x01(\tR\amessage\x12\x14\n" + + "\x05value\x18\x04 \x01(\tR\x05value\"\xa8\x02\n" + + "\x19ResendVerificationRequest\x12'\n" + + "\x0fuser_identifier\x18\x01 \x01(\tR\x0euserIdentifier\x12Y\n" + + "\x16verification_code_type\x18\x02 \x01(\x0e2#.st_peter.auth.VerificationCodeTypeR\x14verificationCodeType\x12\x19\n" + + "\bapp_hash\x18\x03 \x01(\tR\aappHash\x120\n" + + "\x14verification_code_id\x18\x04 \x01(\tR\x12verificationCodeId\x12:\n" + + "\vdevice_info\x18\x13 \x01(\v2\x19.st_peter.auth.DeviceInfoR\n" + + "deviceInfo\"\xbe\x01\n" + + "\x1aResendVerificationResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12:\n" + + "\vresult_code\x18\x02 \x01(\x0e2\x19.st_peter.auth.ResultCodeR\n" + + "resultCode\x12\x18\n" + + "\amessage\x18\x03 \x01(\tR\amessage\x120\n" + + "\x14verification_code_id\x18\x04 \x01(\tR\x12verificationCodeId\"\x84\x03\n" + + "\vUserSession\x12\x0e\n" + + "\x02id\x18\x01 \x01(\tR\x02id\x12\x17\n" + + "\auser_id\x18\x02 \x01(\tR\x06userId\x12:\n" + + "\vdevice_info\x18\x03 \x01(\v2\x19.st_peter.auth.DeviceInfoR\n" + + "deviceInfo\x129\n" + + "\n" + + "created_at\x18\x04 \x01(\v2\x1a.google.protobuf.TimestampR\tcreatedAt\x129\n" + + "\n" + + "expires_at\x18\x05 \x01(\v2\x1a.google.protobuf.TimestampR\texpiresAt\x12?\n" + + "\rlast_activity\x18\x06 \x01(\v2\x1a.google.protobuf.TimestampR\flastActivity\x12\x1b\n" + + "\tis_active\x18\a \x01(\bR\bisActive\x12\x1d\n" + + "\n" + + "ip_address\x18\b \x01(\tR\tipAddress\x12\x1d\n" + + "\n" + + "user_agent\x18\t \x01(\tR\tuserAgent\"|\n" + + "\x16GetUserSessionsRequest\x12\x19\n" + + "\bactor_id\x18\x01 \x01(\tR\aactorId\x12\x1f\n" + + "\vactor_token\x18\x02 \x01(\tR\n" + + "actorToken\x12\x12\n" + + "\x04page\x18\x03 \x01(\x05R\x04page\x12\x12\n" + + "\x04size\x18\x04 \x01(\x05R\x04size\"\xd7\x01\n" + + "\x17GetUserSessionsResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12:\n" + + "\vresult_code\x18\x02 \x01(\x0e2\x19.st_peter.auth.ResultCodeR\n" + + "resultCode\x12\x18\n" + + "\amessage\x18\x03 \x01(\tR\amessage\x126\n" + + "\bsessions\x18\x04 \x03(\v2\x1a.st_peter.auth.UserSessionR\bsessions\x12\x14\n" + + "\x05total\x18\x05 \x01(\x05R\x05total\"w\n" + + "\x18ClearUserSessionsRequest\x12\x19\n" + + "\bactor_id\x18\x01 \x01(\tR\aactorId\x12\x1f\n" + + "\vactor_token\x18\x02 \x01(\tR\n" + + "actorToken\x12\x1f\n" + + "\vsession_ids\x18\x03 \x03(\tR\n" + + "sessionIds\"\xb0\x01\n" + + "\x19ClearUserSessionsResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12:\n" + + "\vresult_code\x18\x02 \x01(\x0e2\x19.st_peter.auth.ResultCodeR\n" + + "resultCode\x12\x18\n" + + "\amessage\x18\x03 \x01(\tR\amessage\x12#\n" + + "\rcleared_count\x18\x04 \x01(\x05R\fclearedCount\"6\n" + + "\x11GetMetricsRequest\x12!\n" + + "\fbearer_token\x18\x01 \x01(\tR\vbearerToken\"\x9e\x01\n" + + "\x12GetMetricsResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12:\n" + + "\vresult_code\x18\x02 \x01(\x0e2\x19.st_peter.auth.ResultCodeR\n" + + "resultCode\x12\x18\n" + + "\amessage\x18\x03 \x01(\tR\amessage\x12\x18\n" + + "\ametrics\x18\x04 \x01(\tR\ametrics\"v\n" + + "\x13CreateApiKeyRequest\x12\x14\n" + + "\x05token\x18\x01 \x01(\tR\x05token\x12\x12\n" + + "\x04name\x18\x02 \x01(\tR\x04name\x12\x16\n" + + "\x06scopes\x18\x03 \x03(\tR\x06scopes\x12\x1d\n" + + "\n" + + "expires_at\x18\x04 \x01(\x03R\texpiresAt\"\xd5\x01\n" + + "\x14CreateApiKeyResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12:\n" + + "\vresult_code\x18\x02 \x01(\x0e2\x19.st_peter.auth.ResultCodeR\n" + + "resultCode\x12\x18\n" + + "\amessage\x18\x03 \x01(\tR\amessage\x12\x17\n" + + "\aapi_key\x18\x04 \x01(\tR\x06apiKey\x12\x15\n" + + "\x06key_id\x18\x05 \x01(\tR\x05keyId\x12\x1d\n" + + "\n" + + "key_prefix\x18\x06 \x01(\tR\tkeyPrefix\"*\n" + + "\x12ListApiKeysRequest\x12\x14\n" + + "\x05token\x18\x01 \x01(\tR\x05token\"\xb4\x01\n" + + "\x13ListApiKeysResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12:\n" + + "\vresult_code\x18\x02 \x01(\x0e2\x19.st_peter.auth.ResultCodeR\n" + + "resultCode\x12\x18\n" + + "\amessage\x18\x03 \x01(\tR\amessage\x12-\n" + + "\x04keys\x18\x04 \x03(\v2\x19.st_peter.auth.ApiKeyInfoR\x04keys\"\xe4\x01\n" + + "\n" + + "ApiKeyInfo\x12\x0e\n" + + "\x02id\x18\x01 \x01(\tR\x02id\x12\x12\n" + + "\x04name\x18\x02 \x01(\tR\x04name\x12\x1d\n" + + "\n" + + "key_prefix\x18\x03 \x01(\tR\tkeyPrefix\x12\x16\n" + + "\x06scopes\x18\x04 \x03(\tR\x06scopes\x12 \n" + + "\flast_used_at\x18\x05 \x01(\x03R\n" + + "lastUsedAt\x12\x1d\n" + + "\n" + + "expires_at\x18\x06 \x01(\x03R\texpiresAt\x12\x1d\n" + + "\n" + + "created_at\x18\a \x01(\x03R\tcreatedAt\x12\x1b\n" + + "\tis_active\x18\b \x01(\bR\bisActive\"B\n" + + "\x13RevokeApiKeyRequest\x12\x14\n" + + "\x05token\x18\x01 \x01(\tR\x05token\x12\x15\n" + + "\x06key_id\x18\x02 \x01(\tR\x05keyId\".\n" + + "\x13VerifyApiKeyRequest\x12\x17\n" + + "\aapi_key\x18\x01 \x01(\tR\x06apiKey\"\x1a\n" + + "\x18GetPasswordPolicyRequest\"\x97\x02\n" + + "\x19GetPasswordPolicyResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12:\n" + + "\vresult_code\x18\x02 \x01(\x0e2\x19.st_peter.auth.ResultCodeR\n" + + "resultCode\x12\x18\n" + + "\amessage\x18\x03 \x01(\tR\amessage\x12\x1d\n" + + "\n" + + "min_length\x18\x04 \x01(\rR\tminLength\x12-\n" + + "\x12requires_uppercase\x18\x05 \x01(\bR\x11requiresUppercase\x12<\n" + + "\x1arequires_special_character\x18\x06 \x01(\bR\x18requiresSpecialCharacter\"k\n" + + "\x11LookupUserRequest\x12\x17\n" + + "\auser_id\x18\x01 \x01(\tR\x06userId\x12\x1d\n" + + "\n" + + "user_token\x18\x02 \x01(\tR\tuserToken\x12\x1e\n" + + "\n" + + "identifier\x18\x03 \x01(\tR\n" + + "identifier\"\xbb\x01\n" + + "\x12LookupUserResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12:\n" + + "\vresult_code\x18\x02 \x01(\x0e2\x19.st_peter.auth.ResultCodeR\n" + + "resultCode\x12\x18\n" + + "\amessage\x18\x03 \x01(\tR\amessage\x12,\n" + + "\x04user\x18\x04 \x01(\v2\x13.st_peter.auth.UserH\x00R\x04user\x88\x01\x01B\a\n" + + "\x05_user*\xa8\x03\n" + + "\n" + + "ResultCode\x12\x17\n" + + "\x13RESULT_CODE_SUCCESS\x10\x00\x12\x19\n" + + "\x15RESULT_CODE_NOT_FOUND\x10\x01\x12%\n" + + "!RESULT_CODE_INTERNAL_SERVER_ERROR\x10\x02\x12\x1b\n" + + "\x17RESULT_CODE_BAD_REQUEST\x10\x03\x12\x1e\n" + + "\x1aRESULT_CODE_NOT_AUTHORIZED\x10\x04\x12\x19\n" + + "\x15RESULT_CODE_FORBIDDEN\x10\x05\x12!\n" + + "\x1dRESULT_CODE_VALIDATION_ERRORS\x10\x06\x12!\n" + + "\x1dRESULT_CODE_PASSCODE_REQUIRED\x10\a\x12!\n" + + "\x1dRESULT_CODE_TOO_MANY_REQUESTS\x10\t\x12#\n" + + "\x1fRESULT_CODE_INVALID_CREDENTIALS\x10\b\x12\x1d\n" + + "\x19RESULT_CODE_INACTIVE_USER\x10\n" + + "\x12\x1f\n" + + "\x1bRESULT_CODE_IDENTITY_IN_USE\x10\v\x12\x19\n" + + "\x15RESULT_CODE_NEXT_STEP\x10\f*Y\n" + + "\vChannelType\x12\x1c\n" + + "\x18CHANNEL_TYPE_UNSPECIFIED\x10\x00\x12\x16\n" + + "\x12CHANNEL_TYPE_EMAIL\x10\x01\x12\x14\n" + + "\x10CHANNEL_TYPE_SMS\x10\x02*\xb4\x01\n" + + "\x14VerificationCodeType\x12&\n" + + "\"VERIFICATION_CODE_TYPE_UNSPECIFIED\x10\x00\x12#\n" + + "\x1fVERIFICATION_CODE_TYPE_REGISTER\x10\x01\x12)\n" + + "%VERIFICATION_CODE_TYPE_PASSWORD_RESET\x10\x02\x12$\n" + + " VERIFICATION_CODE_TYPE_OTP_LOGIN\x10\x03*\x9f\x01\n" + + "\rOAuthProvider\x12\x1e\n" + + "\x1aOAUTH_PROVIDER_UNSPECIFIED\x10\x00\x12\x19\n" + + "\x15OAUTH_PROVIDER_GOOGLE\x10\x01\x12\x18\n" + + "\x14OAUTH_PROVIDER_APPLE\x10\x02\x12\x1b\n" + + "\x17OAUTH_PROVIDER_FACEBOOK\x10\x03\x12\x1c\n" + + "\x18OAUTH_PROVIDER_MICROSOFT\x10\x04*\x9b\x01\n" + + "\rIdentityField\x12\x1e\n" + + "\x1aIDENTITY_FIELD_UNSPECIFIED\x10\x00\x12\x18\n" + + "\x14IDENTITY_FIELD_EMAIL\x10\x01\x12\x18\n" + + "\x14IDENTITY_FIELD_phone\x10\x02\x12\x1b\n" + + "\x17IDENTITY_FIELD_PASSWORD\x10\x03\x12\x19\n" + + "\x15IDENTITY_FIELD_HANDLE\x10\x042\xa2\x19\n" + + "\vAuthService\x12W\n" + + "\fRegisterUser\x12\".st_peter.auth.RegisterUserRequest\x1a#.st_peter.auth.RegisterUserResponse\x12e\n" + + "\x12VerifyRegisterUser\x12(.st_peter.auth.VerifyRegisterUserRequest\x1a%.st_peter.auth.AuthenticationResponse\x12K\n" + + "\x05Login\x12\x1b.st_peter.auth.LoginRequest\x1a%.st_peter.auth.AuthenticationResponse\x12E\n" + + "\x06Logout\x12\x1c.st_peter.auth.LogoutRequest\x1a\x1d.st_peter.auth.LogoutResponse\x12W\n" + + "\vVerifyToken\x12!.st_peter.auth.VerifyTokenRequest\x1a%.st_peter.auth.AuthenticationResponse\x12i\n" + + "\x14VerifyAuthClaimToken\x12*.st_peter.auth.VerifyAuthClaimTokenRequest\x1a%.st_peter.auth.AuthenticationResponse\x12f\n" + + "\x11InitiateTwoFactor\x12'.st_peter.auth.InitiateTwoFactorRequest\x1a(.st_peter.auth.InitiateTwoFactorResponse\x12_\n" + + "\x0fVerifyTwoFactor\x12%.st_peter.auth.VerifyTwoFactorRequest\x1a%.st_peter.auth.AuthenticationResponse\x12o\n" + + "\x15InitiatePasswordReset\x12+.st_peter.auth.InitiatePasswordResetRequest\x1a).st_peter.auth.PasswordResetTokenResponse\x12u\n" + + "\x18VerifyPasswordResetToken\x12..st_peter.auth.VerifyPasswordResetTokenRequest\x1a).st_peter.auth.PasswordResetTokenResponse\x12[\n" + + "\rResetPassword\x12#.st_peter.auth.ResetPasswordRequest\x1a%.st_peter.auth.AuthenticationResponse\x12m\n" + + "\x16ResendVerificationCode\x12(.st_peter.auth.ResendVerificationRequest\x1a).st_peter.auth.ResendVerificationResponse\x12]\n" + + "\x0eUpdateUserInfo\x12$.st_peter.auth.UpdateUserInfoRequest\x1a%.st_peter.auth.UpdateUserInfoResponse\x12l\n" + + "\x13ChangeIdentityField\x12).st_peter.auth.ChangeIdentityFieldRequest\x1a*.st_peter.auth.ChangeIdentityFieldResponse\x12l\n" + + "\x13VerifyIdentityField\x12).st_peter.auth.VerifyIdentityFieldRequest\x1a*.st_peter.auth.VerifyIdentityFieldResponse\x12s\n" + + "\x1aResendIdentifierChangeCode\x12).st_peter.auth.ResendIdentityFieldRequest\x1a*.st_peter.auth.ChangeIdentityFieldResponse\x12d\n" + + "\x14UpdateUserPreference\x12*.st_peter.auth.UpdateUserPreferenceRequest\x1a .st_peter.auth.OperationResponse\x12x\n" + + "\x17GetUserPreferenceByCode\x12-.st_peter.auth.GetUserPreferenceByCodeRequest\x1a..st_peter.auth.GetUserPreferenceByCodeResponse\x12`\n" + + "\x0fGetUserSessions\x12%.st_peter.auth.GetUserSessionsRequest\x1a&.st_peter.auth.GetUserSessionsResponse\x12f\n" + + "\x11ClearUserSessions\x12'.st_peter.auth.ClearUserSessionsRequest\x1a(.st_peter.auth.ClearUserSessionsResponse\x12T\n" + + "\vSocialLogin\x12!.st_peter.auth.SocialLoginRequest\x1a\".st_peter.auth.SocialLoginResponse\x12Z\n" + + "\rInitiateOAuth\x12#.st_peter.auth.InitiateOAuthRequest\x1a$.st_peter.auth.InitiateOAuthResponse\x12X\n" + + "\rCompleteOAuth\x12#.st_peter.auth.OAuthCallbackRequest\x1a\".st_peter.auth.SocialLoginResponse\x12^\n" + + "\x11LinkSocialAccount\x12'.st_peter.auth.LinkSocialAccountRequest\x1a .st_peter.auth.OperationResponse\x12b\n" + + "\x13UnlinkSocialAccount\x12).st_peter.auth.UnlinkSocialAccountRequest\x1a .st_peter.auth.OperationResponse\x12f\n" + + "\x11GetLinkedAccounts\x12'.st_peter.auth.GetLinkedAccountsRequest\x1a(.st_peter.auth.GetLinkedAccountsResponse\x12W\n" + + "\fCreateApiKey\x12\".st_peter.auth.CreateApiKeyRequest\x1a#.st_peter.auth.CreateApiKeyResponse\x12T\n" + + "\vListApiKeys\x12!.st_peter.auth.ListApiKeysRequest\x1a\".st_peter.auth.ListApiKeysResponse\x12T\n" + + "\fRevokeApiKey\x12\".st_peter.auth.RevokeApiKeyRequest\x1a .st_peter.auth.OperationResponse\x12Y\n" + + "\fVerifyApiKey\x12\".st_peter.auth.VerifyApiKeyRequest\x1a%.st_peter.auth.AuthenticationResponse\x12f\n" + + "\x11GetPasswordPolicy\x12'.st_peter.auth.GetPasswordPolicyRequest\x1a(.st_peter.auth.GetPasswordPolicyResponse\x12Q\n" + + "\n" + + "GetMetrics\x12 .st_peter.auth.GetMetricsRequest\x1a!.st_peter.auth.GetMetricsResponse\x12Q\n" + + "\n" + + "LookupUser\x12 .st_peter.auth.LookupUserRequest\x1a!.st_peter.auth.LookupUserResponseB\x1eZ\x1cnandie.com/pkg/;auth_serviceb\x06proto3" + +var ( + file_st_peter_auth_proto_rawDescOnce sync.Once + file_st_peter_auth_proto_rawDescData []byte +) + +func file_st_peter_auth_proto_rawDescGZIP() []byte { + file_st_peter_auth_proto_rawDescOnce.Do(func() { + file_st_peter_auth_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_st_peter_auth_proto_rawDesc), len(file_st_peter_auth_proto_rawDesc))) + }) + return file_st_peter_auth_proto_rawDescData +} + +var file_st_peter_auth_proto_enumTypes = make([]protoimpl.EnumInfo, 5) +var file_st_peter_auth_proto_msgTypes = make([]protoimpl.MessageInfo, 68) +var file_st_peter_auth_proto_goTypes = []any{ + (ResultCode)(0), // 0: st_peter.auth.ResultCode + (ChannelType)(0), // 1: st_peter.auth.ChannelType + (VerificationCodeType)(0), // 2: st_peter.auth.VerificationCodeType + (OAuthProvider)(0), // 3: st_peter.auth.OAuthProvider + (IdentityField)(0), // 4: st_peter.auth.IdentityField + (*Date)(nil), // 5: st_peter.auth.Date + (*User)(nil), // 6: st_peter.auth.User + (*UserPreference)(nil), // 7: st_peter.auth.UserPreference + (*Role)(nil), // 8: st_peter.auth.Role + (*SocialAccount)(nil), // 9: st_peter.auth.SocialAccount + (*SocialLoginRequest)(nil), // 10: st_peter.auth.SocialLoginRequest + (*SocialLoginResponse)(nil), // 11: st_peter.auth.SocialLoginResponse + (*InitiateOAuthRequest)(nil), // 12: st_peter.auth.InitiateOAuthRequest + (*InitiateOAuthResponse)(nil), // 13: st_peter.auth.InitiateOAuthResponse + (*OAuthCallbackRequest)(nil), // 14: st_peter.auth.OAuthCallbackRequest + (*LinkSocialAccountRequest)(nil), // 15: st_peter.auth.LinkSocialAccountRequest + (*UnlinkSocialAccountRequest)(nil), // 16: st_peter.auth.UnlinkSocialAccountRequest + (*GetLinkedAccountsRequest)(nil), // 17: st_peter.auth.GetLinkedAccountsRequest + (*GetLinkedAccountsResponse)(nil), // 18: st_peter.auth.GetLinkedAccountsResponse + (*RegisterUserRequest)(nil), // 19: st_peter.auth.RegisterUserRequest + (*RegisterUserResponse)(nil), // 20: st_peter.auth.RegisterUserResponse + (*VerifyRegisterUserRequest)(nil), // 21: st_peter.auth.VerifyRegisterUserRequest + (*UserResponse)(nil), // 22: st_peter.auth.UserResponse + (*DeviceInfo)(nil), // 23: st_peter.auth.DeviceInfo + (*LoginRequest)(nil), // 24: st_peter.auth.LoginRequest + (*AuthenticationResponse)(nil), // 25: st_peter.auth.AuthenticationResponse + (*AuthenticatedUser)(nil), // 26: st_peter.auth.AuthenticatedUser + (*AssignedUserRole)(nil), // 27: st_peter.auth.AssignedUserRole + (*VerifyTokenRequest)(nil), // 28: st_peter.auth.VerifyTokenRequest + (*VerifyAuthClaimTokenRequest)(nil), // 29: st_peter.auth.VerifyAuthClaimTokenRequest + (*InitiateTwoFactorResponse)(nil), // 30: st_peter.auth.InitiateTwoFactorResponse + (*VerifyTwoFactorResponse)(nil), // 31: st_peter.auth.VerifyTwoFactorResponse + (*InitiateTwoFactorRequest)(nil), // 32: st_peter.auth.InitiateTwoFactorRequest + (*VerifyTwoFactorRequest)(nil), // 33: st_peter.auth.VerifyTwoFactorRequest + (*InitiatePasswordResetRequest)(nil), // 34: st_peter.auth.InitiatePasswordResetRequest + (*OperationResponse)(nil), // 35: st_peter.auth.OperationResponse + (*VerifyPasswordResetTokenRequest)(nil), // 36: st_peter.auth.VerifyPasswordResetTokenRequest + (*PasswordResetTokenResponse)(nil), // 37: st_peter.auth.PasswordResetTokenResponse + (*ResetPasswordRequest)(nil), // 38: st_peter.auth.ResetPasswordRequest + (*ChangeIdentityFieldRequest)(nil), // 39: st_peter.auth.ChangeIdentityFieldRequest + (*ChangeIdentityFieldResponse)(nil), // 40: st_peter.auth.ChangeIdentityFieldResponse + (*VerifyIdentityFieldRequest)(nil), // 41: st_peter.auth.VerifyIdentityFieldRequest + (*ResendIdentityFieldRequest)(nil), // 42: st_peter.auth.ResendIdentityFieldRequest + (*VerifyIdentityFieldResponse)(nil), // 43: st_peter.auth.VerifyIdentityFieldResponse + (*UpdateUserInfoRequest)(nil), // 44: st_peter.auth.UpdateUserInfoRequest + (*UpdateUserInfoResponse)(nil), // 45: st_peter.auth.UpdateUserInfoResponse + (*LogoutRequest)(nil), // 46: st_peter.auth.LogoutRequest + (*LogoutResponse)(nil), // 47: st_peter.auth.LogoutResponse + (*ValidationError)(nil), // 48: st_peter.auth.ValidationError + (*Scope)(nil), // 49: st_peter.auth.Scope + (*UpdateUserPreferenceRequest)(nil), // 50: st_peter.auth.UpdateUserPreferenceRequest + (*GetUserPreferenceByCodeRequest)(nil), // 51: st_peter.auth.GetUserPreferenceByCodeRequest + (*GetUserPreferenceByCodeResponse)(nil), // 52: st_peter.auth.GetUserPreferenceByCodeResponse + (*ResendVerificationRequest)(nil), // 53: st_peter.auth.ResendVerificationRequest + (*ResendVerificationResponse)(nil), // 54: st_peter.auth.ResendVerificationResponse + (*UserSession)(nil), // 55: st_peter.auth.UserSession + (*GetUserSessionsRequest)(nil), // 56: st_peter.auth.GetUserSessionsRequest + (*GetUserSessionsResponse)(nil), // 57: st_peter.auth.GetUserSessionsResponse + (*ClearUserSessionsRequest)(nil), // 58: st_peter.auth.ClearUserSessionsRequest + (*ClearUserSessionsResponse)(nil), // 59: st_peter.auth.ClearUserSessionsResponse + (*GetMetricsRequest)(nil), // 60: st_peter.auth.GetMetricsRequest + (*GetMetricsResponse)(nil), // 61: st_peter.auth.GetMetricsResponse + (*CreateApiKeyRequest)(nil), // 62: st_peter.auth.CreateApiKeyRequest + (*CreateApiKeyResponse)(nil), // 63: st_peter.auth.CreateApiKeyResponse + (*ListApiKeysRequest)(nil), // 64: st_peter.auth.ListApiKeysRequest + (*ListApiKeysResponse)(nil), // 65: st_peter.auth.ListApiKeysResponse + (*ApiKeyInfo)(nil), // 66: st_peter.auth.ApiKeyInfo + (*RevokeApiKeyRequest)(nil), // 67: st_peter.auth.RevokeApiKeyRequest + (*VerifyApiKeyRequest)(nil), // 68: st_peter.auth.VerifyApiKeyRequest + (*GetPasswordPolicyRequest)(nil), // 69: st_peter.auth.GetPasswordPolicyRequest + (*GetPasswordPolicyResponse)(nil), // 70: st_peter.auth.GetPasswordPolicyResponse + (*LookupUserRequest)(nil), // 71: st_peter.auth.LookupUserRequest + (*LookupUserResponse)(nil), // 72: st_peter.auth.LookupUserResponse + (*timestamppb.Timestamp)(nil), // 73: google.protobuf.Timestamp +} +var file_st_peter_auth_proto_depIdxs = []int32{ + 73, // 0: st_peter.auth.User.created_at:type_name -> google.protobuf.Timestamp + 73, // 1: st_peter.auth.User.updated_at:type_name -> google.protobuf.Timestamp + 73, // 2: st_peter.auth.User.deleted_at:type_name -> google.protobuf.Timestamp + 73, // 3: st_peter.auth.User.last_login:type_name -> google.protobuf.Timestamp + 5, // 4: st_peter.auth.User.date_of_birth:type_name -> st_peter.auth.Date + 9, // 5: st_peter.auth.User.social_accounts:type_name -> st_peter.auth.SocialAccount + 73, // 6: st_peter.auth.UserPreference.created_at:type_name -> google.protobuf.Timestamp + 73, // 7: st_peter.auth.UserPreference.updated_at:type_name -> google.protobuf.Timestamp + 73, // 8: st_peter.auth.Role.created_at:type_name -> google.protobuf.Timestamp + 73, // 9: st_peter.auth.Role.updated_at:type_name -> google.protobuf.Timestamp + 73, // 10: st_peter.auth.SocialAccount.expires_at:type_name -> google.protobuf.Timestamp + 3, // 11: st_peter.auth.SocialLoginRequest.provider:type_name -> st_peter.auth.OAuthProvider + 23, // 12: st_peter.auth.SocialLoginRequest.device_info:type_name -> st_peter.auth.DeviceInfo + 0, // 13: st_peter.auth.SocialLoginResponse.result_code:type_name -> st_peter.auth.ResultCode + 26, // 14: st_peter.auth.SocialLoginResponse.authenticated_user:type_name -> st_peter.auth.AuthenticatedUser + 48, // 15: st_peter.auth.SocialLoginResponse.validation_errors:type_name -> st_peter.auth.ValidationError + 3, // 16: st_peter.auth.InitiateOAuthRequest.provider:type_name -> st_peter.auth.OAuthProvider + 0, // 17: st_peter.auth.InitiateOAuthResponse.result_code:type_name -> st_peter.auth.ResultCode + 3, // 18: st_peter.auth.OAuthCallbackRequest.provider:type_name -> st_peter.auth.OAuthProvider + 23, // 19: st_peter.auth.OAuthCallbackRequest.device_info:type_name -> st_peter.auth.DeviceInfo + 3, // 20: st_peter.auth.LinkSocialAccountRequest.provider:type_name -> st_peter.auth.OAuthProvider + 3, // 21: st_peter.auth.UnlinkSocialAccountRequest.provider:type_name -> st_peter.auth.OAuthProvider + 0, // 22: st_peter.auth.GetLinkedAccountsResponse.result_code:type_name -> st_peter.auth.ResultCode + 9, // 23: st_peter.auth.GetLinkedAccountsResponse.accounts:type_name -> st_peter.auth.SocialAccount + 23, // 24: st_peter.auth.RegisterUserRequest.device_info:type_name -> st_peter.auth.DeviceInfo + 0, // 25: st_peter.auth.RegisterUserResponse.result_code:type_name -> st_peter.auth.ResultCode + 48, // 26: st_peter.auth.RegisterUserResponse.validation_errors:type_name -> st_peter.auth.ValidationError + 23, // 27: st_peter.auth.VerifyRegisterUserRequest.device_info:type_name -> st_peter.auth.DeviceInfo + 0, // 28: st_peter.auth.UserResponse.result_code:type_name -> st_peter.auth.ResultCode + 6, // 29: st_peter.auth.UserResponse.user:type_name -> st_peter.auth.User + 23, // 30: st_peter.auth.LoginRequest.device_info:type_name -> st_peter.auth.DeviceInfo + 0, // 31: st_peter.auth.AuthenticationResponse.result_code:type_name -> st_peter.auth.ResultCode + 26, // 32: st_peter.auth.AuthenticationResponse.authenticated_user:type_name -> st_peter.auth.AuthenticatedUser + 6, // 33: st_peter.auth.AuthenticatedUser.user:type_name -> st_peter.auth.User + 73, // 34: st_peter.auth.AuthenticatedUser.expires_at:type_name -> google.protobuf.Timestamp + 7, // 35: st_peter.auth.AuthenticatedUser.user_preferences:type_name -> st_peter.auth.UserPreference + 27, // 36: st_peter.auth.AuthenticatedUser.user_roles:type_name -> st_peter.auth.AssignedUserRole + 0, // 37: st_peter.auth.InitiateTwoFactorResponse.result_code:type_name -> st_peter.auth.ResultCode + 1, // 38: st_peter.auth.InitiateTwoFactorResponse.channel:type_name -> st_peter.auth.ChannelType + 48, // 39: st_peter.auth.InitiateTwoFactorResponse.validation_errors:type_name -> st_peter.auth.ValidationError + 0, // 40: st_peter.auth.VerifyTwoFactorResponse.result_code:type_name -> st_peter.auth.ResultCode + 48, // 41: st_peter.auth.VerifyTwoFactorResponse.validation_errors:type_name -> st_peter.auth.ValidationError + 1, // 42: st_peter.auth.InitiateTwoFactorRequest.channel:type_name -> st_peter.auth.ChannelType + 23, // 43: st_peter.auth.InitiateTwoFactorRequest.device_info:type_name -> st_peter.auth.DeviceInfo + 23, // 44: st_peter.auth.VerifyTwoFactorRequest.device_info:type_name -> st_peter.auth.DeviceInfo + 23, // 45: st_peter.auth.InitiatePasswordResetRequest.device_info:type_name -> st_peter.auth.DeviceInfo + 0, // 46: st_peter.auth.OperationResponse.result_code:type_name -> st_peter.auth.ResultCode + 0, // 47: st_peter.auth.PasswordResetTokenResponse.result_code:type_name -> st_peter.auth.ResultCode + 23, // 48: st_peter.auth.ResetPasswordRequest.device_info:type_name -> st_peter.auth.DeviceInfo + 1, // 49: st_peter.auth.ChangeIdentityFieldRequest.channel:type_name -> st_peter.auth.ChannelType + 4, // 50: st_peter.auth.ChangeIdentityFieldRequest.field_type:type_name -> st_peter.auth.IdentityField + 23, // 51: st_peter.auth.ChangeIdentityFieldRequest.device_info:type_name -> st_peter.auth.DeviceInfo + 0, // 52: st_peter.auth.ChangeIdentityFieldResponse.result_code:type_name -> st_peter.auth.ResultCode + 1, // 53: st_peter.auth.ChangeIdentityFieldResponse.channel:type_name -> st_peter.auth.ChannelType + 48, // 54: st_peter.auth.ChangeIdentityFieldResponse.validation_errors:type_name -> st_peter.auth.ValidationError + 23, // 55: st_peter.auth.VerifyIdentityFieldRequest.device_info:type_name -> st_peter.auth.DeviceInfo + 23, // 56: st_peter.auth.ResendIdentityFieldRequest.device_info:type_name -> st_peter.auth.DeviceInfo + 0, // 57: st_peter.auth.VerifyIdentityFieldResponse.result_code:type_name -> st_peter.auth.ResultCode + 1, // 58: st_peter.auth.VerifyIdentityFieldResponse.channel:type_name -> st_peter.auth.ChannelType + 48, // 59: st_peter.auth.VerifyIdentityFieldResponse.validation_errors:type_name -> st_peter.auth.ValidationError + 5, // 60: st_peter.auth.UpdateUserInfoRequest.date_of_birth:type_name -> st_peter.auth.Date + 0, // 61: st_peter.auth.UpdateUserInfoResponse.result_code:type_name -> st_peter.auth.ResultCode + 6, // 62: st_peter.auth.UpdateUserInfoResponse.user:type_name -> st_peter.auth.User + 0, // 63: st_peter.auth.LogoutResponse.result_code:type_name -> st_peter.auth.ResultCode + 0, // 64: st_peter.auth.GetUserPreferenceByCodeResponse.result_code:type_name -> st_peter.auth.ResultCode + 2, // 65: st_peter.auth.ResendVerificationRequest.verification_code_type:type_name -> st_peter.auth.VerificationCodeType + 23, // 66: st_peter.auth.ResendVerificationRequest.device_info:type_name -> st_peter.auth.DeviceInfo + 0, // 67: st_peter.auth.ResendVerificationResponse.result_code:type_name -> st_peter.auth.ResultCode + 23, // 68: st_peter.auth.UserSession.device_info:type_name -> st_peter.auth.DeviceInfo + 73, // 69: st_peter.auth.UserSession.created_at:type_name -> google.protobuf.Timestamp + 73, // 70: st_peter.auth.UserSession.expires_at:type_name -> google.protobuf.Timestamp + 73, // 71: st_peter.auth.UserSession.last_activity:type_name -> google.protobuf.Timestamp + 0, // 72: st_peter.auth.GetUserSessionsResponse.result_code:type_name -> st_peter.auth.ResultCode + 55, // 73: st_peter.auth.GetUserSessionsResponse.sessions:type_name -> st_peter.auth.UserSession + 0, // 74: st_peter.auth.ClearUserSessionsResponse.result_code:type_name -> st_peter.auth.ResultCode + 0, // 75: st_peter.auth.GetMetricsResponse.result_code:type_name -> st_peter.auth.ResultCode + 0, // 76: st_peter.auth.CreateApiKeyResponse.result_code:type_name -> st_peter.auth.ResultCode + 0, // 77: st_peter.auth.ListApiKeysResponse.result_code:type_name -> st_peter.auth.ResultCode + 66, // 78: st_peter.auth.ListApiKeysResponse.keys:type_name -> st_peter.auth.ApiKeyInfo + 0, // 79: st_peter.auth.GetPasswordPolicyResponse.result_code:type_name -> st_peter.auth.ResultCode + 0, // 80: st_peter.auth.LookupUserResponse.result_code:type_name -> st_peter.auth.ResultCode + 6, // 81: st_peter.auth.LookupUserResponse.user:type_name -> st_peter.auth.User + 19, // 82: st_peter.auth.AuthService.RegisterUser:input_type -> st_peter.auth.RegisterUserRequest + 21, // 83: st_peter.auth.AuthService.VerifyRegisterUser:input_type -> st_peter.auth.VerifyRegisterUserRequest + 24, // 84: st_peter.auth.AuthService.Login:input_type -> st_peter.auth.LoginRequest + 46, // 85: st_peter.auth.AuthService.Logout:input_type -> st_peter.auth.LogoutRequest + 28, // 86: st_peter.auth.AuthService.VerifyToken:input_type -> st_peter.auth.VerifyTokenRequest + 29, // 87: st_peter.auth.AuthService.VerifyAuthClaimToken:input_type -> st_peter.auth.VerifyAuthClaimTokenRequest + 32, // 88: st_peter.auth.AuthService.InitiateTwoFactor:input_type -> st_peter.auth.InitiateTwoFactorRequest + 33, // 89: st_peter.auth.AuthService.VerifyTwoFactor:input_type -> st_peter.auth.VerifyTwoFactorRequest + 34, // 90: st_peter.auth.AuthService.InitiatePasswordReset:input_type -> st_peter.auth.InitiatePasswordResetRequest + 36, // 91: st_peter.auth.AuthService.VerifyPasswordResetToken:input_type -> st_peter.auth.VerifyPasswordResetTokenRequest + 38, // 92: st_peter.auth.AuthService.ResetPassword:input_type -> st_peter.auth.ResetPasswordRequest + 53, // 93: st_peter.auth.AuthService.ResendVerificationCode:input_type -> st_peter.auth.ResendVerificationRequest + 44, // 94: st_peter.auth.AuthService.UpdateUserInfo:input_type -> st_peter.auth.UpdateUserInfoRequest + 39, // 95: st_peter.auth.AuthService.ChangeIdentityField:input_type -> st_peter.auth.ChangeIdentityFieldRequest + 41, // 96: st_peter.auth.AuthService.VerifyIdentityField:input_type -> st_peter.auth.VerifyIdentityFieldRequest + 42, // 97: st_peter.auth.AuthService.ResendIdentifierChangeCode:input_type -> st_peter.auth.ResendIdentityFieldRequest + 50, // 98: st_peter.auth.AuthService.UpdateUserPreference:input_type -> st_peter.auth.UpdateUserPreferenceRequest + 51, // 99: st_peter.auth.AuthService.GetUserPreferenceByCode:input_type -> st_peter.auth.GetUserPreferenceByCodeRequest + 56, // 100: st_peter.auth.AuthService.GetUserSessions:input_type -> st_peter.auth.GetUserSessionsRequest + 58, // 101: st_peter.auth.AuthService.ClearUserSessions:input_type -> st_peter.auth.ClearUserSessionsRequest + 10, // 102: st_peter.auth.AuthService.SocialLogin:input_type -> st_peter.auth.SocialLoginRequest + 12, // 103: st_peter.auth.AuthService.InitiateOAuth:input_type -> st_peter.auth.InitiateOAuthRequest + 14, // 104: st_peter.auth.AuthService.CompleteOAuth:input_type -> st_peter.auth.OAuthCallbackRequest + 15, // 105: st_peter.auth.AuthService.LinkSocialAccount:input_type -> st_peter.auth.LinkSocialAccountRequest + 16, // 106: st_peter.auth.AuthService.UnlinkSocialAccount:input_type -> st_peter.auth.UnlinkSocialAccountRequest + 17, // 107: st_peter.auth.AuthService.GetLinkedAccounts:input_type -> st_peter.auth.GetLinkedAccountsRequest + 62, // 108: st_peter.auth.AuthService.CreateApiKey:input_type -> st_peter.auth.CreateApiKeyRequest + 64, // 109: st_peter.auth.AuthService.ListApiKeys:input_type -> st_peter.auth.ListApiKeysRequest + 67, // 110: st_peter.auth.AuthService.RevokeApiKey:input_type -> st_peter.auth.RevokeApiKeyRequest + 68, // 111: st_peter.auth.AuthService.VerifyApiKey:input_type -> st_peter.auth.VerifyApiKeyRequest + 69, // 112: st_peter.auth.AuthService.GetPasswordPolicy:input_type -> st_peter.auth.GetPasswordPolicyRequest + 60, // 113: st_peter.auth.AuthService.GetMetrics:input_type -> st_peter.auth.GetMetricsRequest + 71, // 114: st_peter.auth.AuthService.LookupUser:input_type -> st_peter.auth.LookupUserRequest + 20, // 115: st_peter.auth.AuthService.RegisterUser:output_type -> st_peter.auth.RegisterUserResponse + 25, // 116: st_peter.auth.AuthService.VerifyRegisterUser:output_type -> st_peter.auth.AuthenticationResponse + 25, // 117: st_peter.auth.AuthService.Login:output_type -> st_peter.auth.AuthenticationResponse + 47, // 118: st_peter.auth.AuthService.Logout:output_type -> st_peter.auth.LogoutResponse + 25, // 119: st_peter.auth.AuthService.VerifyToken:output_type -> st_peter.auth.AuthenticationResponse + 25, // 120: st_peter.auth.AuthService.VerifyAuthClaimToken:output_type -> st_peter.auth.AuthenticationResponse + 30, // 121: st_peter.auth.AuthService.InitiateTwoFactor:output_type -> st_peter.auth.InitiateTwoFactorResponse + 25, // 122: st_peter.auth.AuthService.VerifyTwoFactor:output_type -> st_peter.auth.AuthenticationResponse + 37, // 123: st_peter.auth.AuthService.InitiatePasswordReset:output_type -> st_peter.auth.PasswordResetTokenResponse + 37, // 124: st_peter.auth.AuthService.VerifyPasswordResetToken:output_type -> st_peter.auth.PasswordResetTokenResponse + 25, // 125: st_peter.auth.AuthService.ResetPassword:output_type -> st_peter.auth.AuthenticationResponse + 54, // 126: st_peter.auth.AuthService.ResendVerificationCode:output_type -> st_peter.auth.ResendVerificationResponse + 45, // 127: st_peter.auth.AuthService.UpdateUserInfo:output_type -> st_peter.auth.UpdateUserInfoResponse + 40, // 128: st_peter.auth.AuthService.ChangeIdentityField:output_type -> st_peter.auth.ChangeIdentityFieldResponse + 43, // 129: st_peter.auth.AuthService.VerifyIdentityField:output_type -> st_peter.auth.VerifyIdentityFieldResponse + 40, // 130: st_peter.auth.AuthService.ResendIdentifierChangeCode:output_type -> st_peter.auth.ChangeIdentityFieldResponse + 35, // 131: st_peter.auth.AuthService.UpdateUserPreference:output_type -> st_peter.auth.OperationResponse + 52, // 132: st_peter.auth.AuthService.GetUserPreferenceByCode:output_type -> st_peter.auth.GetUserPreferenceByCodeResponse + 57, // 133: st_peter.auth.AuthService.GetUserSessions:output_type -> st_peter.auth.GetUserSessionsResponse + 59, // 134: st_peter.auth.AuthService.ClearUserSessions:output_type -> st_peter.auth.ClearUserSessionsResponse + 11, // 135: st_peter.auth.AuthService.SocialLogin:output_type -> st_peter.auth.SocialLoginResponse + 13, // 136: st_peter.auth.AuthService.InitiateOAuth:output_type -> st_peter.auth.InitiateOAuthResponse + 11, // 137: st_peter.auth.AuthService.CompleteOAuth:output_type -> st_peter.auth.SocialLoginResponse + 35, // 138: st_peter.auth.AuthService.LinkSocialAccount:output_type -> st_peter.auth.OperationResponse + 35, // 139: st_peter.auth.AuthService.UnlinkSocialAccount:output_type -> st_peter.auth.OperationResponse + 18, // 140: st_peter.auth.AuthService.GetLinkedAccounts:output_type -> st_peter.auth.GetLinkedAccountsResponse + 63, // 141: st_peter.auth.AuthService.CreateApiKey:output_type -> st_peter.auth.CreateApiKeyResponse + 65, // 142: st_peter.auth.AuthService.ListApiKeys:output_type -> st_peter.auth.ListApiKeysResponse + 35, // 143: st_peter.auth.AuthService.RevokeApiKey:output_type -> st_peter.auth.OperationResponse + 25, // 144: st_peter.auth.AuthService.VerifyApiKey:output_type -> st_peter.auth.AuthenticationResponse + 70, // 145: st_peter.auth.AuthService.GetPasswordPolicy:output_type -> st_peter.auth.GetPasswordPolicyResponse + 61, // 146: st_peter.auth.AuthService.GetMetrics:output_type -> st_peter.auth.GetMetricsResponse + 72, // 147: st_peter.auth.AuthService.LookupUser:output_type -> st_peter.auth.LookupUserResponse + 115, // [115:148] is the sub-list for method output_type + 82, // [82:115] is the sub-list for method input_type + 82, // [82:82] is the sub-list for extension type_name + 82, // [82:82] is the sub-list for extension extendee + 0, // [0:82] is the sub-list for field type_name +} + +func init() { file_st_peter_auth_proto_init() } +func file_st_peter_auth_proto_init() { + if File_st_peter_auth_proto != nil { + return + } + file_st_peter_auth_proto_msgTypes[1].OneofWrappers = []any{} + file_st_peter_auth_proto_msgTypes[27].OneofWrappers = []any{} + file_st_peter_auth_proto_msgTypes[39].OneofWrappers = []any{} + file_st_peter_auth_proto_msgTypes[44].OneofWrappers = []any{} + file_st_peter_auth_proto_msgTypes[67].OneofWrappers = []any{} + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_st_peter_auth_proto_rawDesc), len(file_st_peter_auth_proto_rawDesc)), + NumEnums: 5, + NumMessages: 68, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_st_peter_auth_proto_goTypes, + DependencyIndexes: file_st_peter_auth_proto_depIdxs, + EnumInfos: file_st_peter_auth_proto_enumTypes, + MessageInfos: file_st_peter_auth_proto_msgTypes, + }.Build() + File_st_peter_auth_proto = out.File + file_st_peter_auth_proto_goTypes = nil + file_st_peter_auth_proto_depIdxs = nil +} diff --git a/go/genpb/auth/st-peter-auth_grpc.pb.go b/go/genpb/auth/st-peter-auth_grpc.pb.go new file mode 100644 index 0000000..d8d0251 --- /dev/null +++ b/go/genpb/auth/st-peter-auth_grpc.pb.go @@ -0,0 +1,1351 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.6.2 +// - protoc v7.34.1 +// source: st-peter-auth.proto + +package auth_service + +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 ( + AuthService_RegisterUser_FullMethodName = "/st_peter.auth.AuthService/RegisterUser" + AuthService_VerifyRegisterUser_FullMethodName = "/st_peter.auth.AuthService/VerifyRegisterUser" + AuthService_Login_FullMethodName = "/st_peter.auth.AuthService/Login" + AuthService_Logout_FullMethodName = "/st_peter.auth.AuthService/Logout" + AuthService_VerifyToken_FullMethodName = "/st_peter.auth.AuthService/VerifyToken" + AuthService_VerifyAuthClaimToken_FullMethodName = "/st_peter.auth.AuthService/VerifyAuthClaimToken" + AuthService_InitiateTwoFactor_FullMethodName = "/st_peter.auth.AuthService/InitiateTwoFactor" + AuthService_VerifyTwoFactor_FullMethodName = "/st_peter.auth.AuthService/VerifyTwoFactor" + AuthService_InitiatePasswordReset_FullMethodName = "/st_peter.auth.AuthService/InitiatePasswordReset" + AuthService_VerifyPasswordResetToken_FullMethodName = "/st_peter.auth.AuthService/VerifyPasswordResetToken" + AuthService_ResetPassword_FullMethodName = "/st_peter.auth.AuthService/ResetPassword" + AuthService_ResendVerificationCode_FullMethodName = "/st_peter.auth.AuthService/ResendVerificationCode" + AuthService_UpdateUserInfo_FullMethodName = "/st_peter.auth.AuthService/UpdateUserInfo" + AuthService_ChangeIdentityField_FullMethodName = "/st_peter.auth.AuthService/ChangeIdentityField" + AuthService_VerifyIdentityField_FullMethodName = "/st_peter.auth.AuthService/VerifyIdentityField" + AuthService_ResendIdentifierChangeCode_FullMethodName = "/st_peter.auth.AuthService/ResendIdentifierChangeCode" + AuthService_UpdateUserPreference_FullMethodName = "/st_peter.auth.AuthService/UpdateUserPreference" + AuthService_GetUserPreferenceByCode_FullMethodName = "/st_peter.auth.AuthService/GetUserPreferenceByCode" + AuthService_GetUserSessions_FullMethodName = "/st_peter.auth.AuthService/GetUserSessions" + AuthService_ClearUserSessions_FullMethodName = "/st_peter.auth.AuthService/ClearUserSessions" + AuthService_SocialLogin_FullMethodName = "/st_peter.auth.AuthService/SocialLogin" + AuthService_InitiateOAuth_FullMethodName = "/st_peter.auth.AuthService/InitiateOAuth" + AuthService_CompleteOAuth_FullMethodName = "/st_peter.auth.AuthService/CompleteOAuth" + AuthService_LinkSocialAccount_FullMethodName = "/st_peter.auth.AuthService/LinkSocialAccount" + AuthService_UnlinkSocialAccount_FullMethodName = "/st_peter.auth.AuthService/UnlinkSocialAccount" + AuthService_GetLinkedAccounts_FullMethodName = "/st_peter.auth.AuthService/GetLinkedAccounts" + AuthService_CreateApiKey_FullMethodName = "/st_peter.auth.AuthService/CreateApiKey" + AuthService_ListApiKeys_FullMethodName = "/st_peter.auth.AuthService/ListApiKeys" + AuthService_RevokeApiKey_FullMethodName = "/st_peter.auth.AuthService/RevokeApiKey" + AuthService_VerifyApiKey_FullMethodName = "/st_peter.auth.AuthService/VerifyApiKey" + AuthService_GetPasswordPolicy_FullMethodName = "/st_peter.auth.AuthService/GetPasswordPolicy" + AuthService_GetMetrics_FullMethodName = "/st_peter.auth.AuthService/GetMetrics" + AuthService_LookupUser_FullMethodName = "/st_peter.auth.AuthService/LookupUser" +) + +// 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. +type AuthServiceClient interface { + RegisterUser(ctx context.Context, in *RegisterUserRequest, opts ...grpc.CallOption) (*RegisterUserResponse, error) + VerifyRegisterUser(ctx context.Context, in *VerifyRegisterUserRequest, opts ...grpc.CallOption) (*AuthenticationResponse, error) + Login(ctx context.Context, in *LoginRequest, opts ...grpc.CallOption) (*AuthenticationResponse, error) + Logout(ctx context.Context, in *LogoutRequest, opts ...grpc.CallOption) (*LogoutResponse, error) + VerifyToken(ctx context.Context, in *VerifyTokenRequest, opts ...grpc.CallOption) (*AuthenticationResponse, error) + VerifyAuthClaimToken(ctx context.Context, in *VerifyAuthClaimTokenRequest, opts ...grpc.CallOption) (*AuthenticationResponse, error) + InitiateTwoFactor(ctx context.Context, in *InitiateTwoFactorRequest, opts ...grpc.CallOption) (*InitiateTwoFactorResponse, error) + VerifyTwoFactor(ctx context.Context, in *VerifyTwoFactorRequest, opts ...grpc.CallOption) (*AuthenticationResponse, error) + InitiatePasswordReset(ctx context.Context, in *InitiatePasswordResetRequest, opts ...grpc.CallOption) (*PasswordResetTokenResponse, error) + VerifyPasswordResetToken(ctx context.Context, in *VerifyPasswordResetTokenRequest, opts ...grpc.CallOption) (*PasswordResetTokenResponse, error) + ResetPassword(ctx context.Context, in *ResetPasswordRequest, opts ...grpc.CallOption) (*AuthenticationResponse, error) + ResendVerificationCode(ctx context.Context, in *ResendVerificationRequest, opts ...grpc.CallOption) (*ResendVerificationResponse, error) + UpdateUserInfo(ctx context.Context, in *UpdateUserInfoRequest, opts ...grpc.CallOption) (*UpdateUserInfoResponse, error) + ChangeIdentityField(ctx context.Context, in *ChangeIdentityFieldRequest, opts ...grpc.CallOption) (*ChangeIdentityFieldResponse, error) + VerifyIdentityField(ctx context.Context, in *VerifyIdentityFieldRequest, opts ...grpc.CallOption) (*VerifyIdentityFieldResponse, error) + ResendIdentifierChangeCode(ctx context.Context, in *ResendIdentityFieldRequest, opts ...grpc.CallOption) (*ChangeIdentityFieldResponse, error) + UpdateUserPreference(ctx context.Context, in *UpdateUserPreferenceRequest, opts ...grpc.CallOption) (*OperationResponse, error) + GetUserPreferenceByCode(ctx context.Context, in *GetUserPreferenceByCodeRequest, opts ...grpc.CallOption) (*GetUserPreferenceByCodeResponse, error) + GetUserSessions(ctx context.Context, in *GetUserSessionsRequest, opts ...grpc.CallOption) (*GetUserSessionsResponse, error) + ClearUserSessions(ctx context.Context, in *ClearUserSessionsRequest, opts ...grpc.CallOption) (*ClearUserSessionsResponse, error) + // Social login - Mobile flow (validates ID token from native SDK) + SocialLogin(ctx context.Context, in *SocialLoginRequest, opts ...grpc.CallOption) (*SocialLoginResponse, error) + // Social login - Web OAuth flow + InitiateOAuth(ctx context.Context, in *InitiateOAuthRequest, opts ...grpc.CallOption) (*InitiateOAuthResponse, error) + CompleteOAuth(ctx context.Context, in *OAuthCallbackRequest, opts ...grpc.CallOption) (*SocialLoginResponse, error) + // Account linking + LinkSocialAccount(ctx context.Context, in *LinkSocialAccountRequest, opts ...grpc.CallOption) (*OperationResponse, error) + UnlinkSocialAccount(ctx context.Context, in *UnlinkSocialAccountRequest, opts ...grpc.CallOption) (*OperationResponse, error) + GetLinkedAccounts(ctx context.Context, in *GetLinkedAccountsRequest, opts ...grpc.CallOption) (*GetLinkedAccountsResponse, error) + // API Keys + CreateApiKey(ctx context.Context, in *CreateApiKeyRequest, opts ...grpc.CallOption) (*CreateApiKeyResponse, error) + ListApiKeys(ctx context.Context, in *ListApiKeysRequest, opts ...grpc.CallOption) (*ListApiKeysResponse, error) + RevokeApiKey(ctx context.Context, in *RevokeApiKeyRequest, opts ...grpc.CallOption) (*OperationResponse, error) + VerifyApiKey(ctx context.Context, in *VerifyApiKeyRequest, opts ...grpc.CallOption) (*AuthenticationResponse, error) + // Password policy (public, no auth required) + GetPasswordPolicy(ctx context.Context, in *GetPasswordPolicyRequest, opts ...grpc.CallOption) (*GetPasswordPolicyResponse, error) + // Metrics + GetMetrics(ctx context.Context, in *GetMetricsRequest, opts ...grpc.CallOption) (*GetMetricsResponse, error) + // User lookup by identifier (email, phone, or handle) — any authenticated user + LookupUser(ctx context.Context, in *LookupUserRequest, opts ...grpc.CallOption) (*LookupUserResponse, error) +} + +type authServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewAuthServiceClient(cc grpc.ClientConnInterface) AuthServiceClient { + return &authServiceClient{cc} +} + +func (c *authServiceClient) RegisterUser(ctx context.Context, in *RegisterUserRequest, opts ...grpc.CallOption) (*RegisterUserResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(RegisterUserResponse) + err := c.cc.Invoke(ctx, AuthService_RegisterUser_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *authServiceClient) VerifyRegisterUser(ctx context.Context, in *VerifyRegisterUserRequest, opts ...grpc.CallOption) (*AuthenticationResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(AuthenticationResponse) + err := c.cc.Invoke(ctx, AuthService_VerifyRegisterUser_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *authServiceClient) Login(ctx context.Context, in *LoginRequest, opts ...grpc.CallOption) (*AuthenticationResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(AuthenticationResponse) + err := c.cc.Invoke(ctx, AuthService_Login_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *authServiceClient) 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, AuthService_Logout_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *authServiceClient) VerifyToken(ctx context.Context, in *VerifyTokenRequest, opts ...grpc.CallOption) (*AuthenticationResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(AuthenticationResponse) + err := c.cc.Invoke(ctx, AuthService_VerifyToken_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *authServiceClient) VerifyAuthClaimToken(ctx context.Context, in *VerifyAuthClaimTokenRequest, opts ...grpc.CallOption) (*AuthenticationResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(AuthenticationResponse) + err := c.cc.Invoke(ctx, AuthService_VerifyAuthClaimToken_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *authServiceClient) InitiateTwoFactor(ctx context.Context, in *InitiateTwoFactorRequest, opts ...grpc.CallOption) (*InitiateTwoFactorResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(InitiateTwoFactorResponse) + err := c.cc.Invoke(ctx, AuthService_InitiateTwoFactor_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *authServiceClient) VerifyTwoFactor(ctx context.Context, in *VerifyTwoFactorRequest, opts ...grpc.CallOption) (*AuthenticationResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(AuthenticationResponse) + err := c.cc.Invoke(ctx, AuthService_VerifyTwoFactor_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *authServiceClient) InitiatePasswordReset(ctx context.Context, in *InitiatePasswordResetRequest, opts ...grpc.CallOption) (*PasswordResetTokenResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(PasswordResetTokenResponse) + err := c.cc.Invoke(ctx, AuthService_InitiatePasswordReset_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *authServiceClient) VerifyPasswordResetToken(ctx context.Context, in *VerifyPasswordResetTokenRequest, opts ...grpc.CallOption) (*PasswordResetTokenResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(PasswordResetTokenResponse) + err := c.cc.Invoke(ctx, AuthService_VerifyPasswordResetToken_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *authServiceClient) ResetPassword(ctx context.Context, in *ResetPasswordRequest, opts ...grpc.CallOption) (*AuthenticationResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(AuthenticationResponse) + err := c.cc.Invoke(ctx, AuthService_ResetPassword_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *authServiceClient) ResendVerificationCode(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, AuthService_ResendVerificationCode_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *authServiceClient) UpdateUserInfo(ctx context.Context, in *UpdateUserInfoRequest, opts ...grpc.CallOption) (*UpdateUserInfoResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(UpdateUserInfoResponse) + err := c.cc.Invoke(ctx, AuthService_UpdateUserInfo_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *authServiceClient) ChangeIdentityField(ctx context.Context, in *ChangeIdentityFieldRequest, opts ...grpc.CallOption) (*ChangeIdentityFieldResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(ChangeIdentityFieldResponse) + err := c.cc.Invoke(ctx, AuthService_ChangeIdentityField_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *authServiceClient) VerifyIdentityField(ctx context.Context, in *VerifyIdentityFieldRequest, opts ...grpc.CallOption) (*VerifyIdentityFieldResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(VerifyIdentityFieldResponse) + err := c.cc.Invoke(ctx, AuthService_VerifyIdentityField_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *authServiceClient) ResendIdentifierChangeCode(ctx context.Context, in *ResendIdentityFieldRequest, opts ...grpc.CallOption) (*ChangeIdentityFieldResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(ChangeIdentityFieldResponse) + err := c.cc.Invoke(ctx, AuthService_ResendIdentifierChangeCode_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *authServiceClient) UpdateUserPreference(ctx context.Context, in *UpdateUserPreferenceRequest, opts ...grpc.CallOption) (*OperationResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(OperationResponse) + err := c.cc.Invoke(ctx, AuthService_UpdateUserPreference_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *authServiceClient) GetUserPreferenceByCode(ctx context.Context, in *GetUserPreferenceByCodeRequest, opts ...grpc.CallOption) (*GetUserPreferenceByCodeResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(GetUserPreferenceByCodeResponse) + err := c.cc.Invoke(ctx, AuthService_GetUserPreferenceByCode_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *authServiceClient) GetUserSessions(ctx context.Context, in *GetUserSessionsRequest, opts ...grpc.CallOption) (*GetUserSessionsResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(GetUserSessionsResponse) + err := c.cc.Invoke(ctx, AuthService_GetUserSessions_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *authServiceClient) ClearUserSessions(ctx context.Context, in *ClearUserSessionsRequest, opts ...grpc.CallOption) (*ClearUserSessionsResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(ClearUserSessionsResponse) + err := c.cc.Invoke(ctx, AuthService_ClearUserSessions_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *authServiceClient) SocialLogin(ctx context.Context, in *SocialLoginRequest, opts ...grpc.CallOption) (*SocialLoginResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(SocialLoginResponse) + err := c.cc.Invoke(ctx, AuthService_SocialLogin_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *authServiceClient) InitiateOAuth(ctx context.Context, in *InitiateOAuthRequest, opts ...grpc.CallOption) (*InitiateOAuthResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(InitiateOAuthResponse) + err := c.cc.Invoke(ctx, AuthService_InitiateOAuth_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *authServiceClient) CompleteOAuth(ctx context.Context, in *OAuthCallbackRequest, opts ...grpc.CallOption) (*SocialLoginResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(SocialLoginResponse) + err := c.cc.Invoke(ctx, AuthService_CompleteOAuth_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *authServiceClient) LinkSocialAccount(ctx context.Context, in *LinkSocialAccountRequest, opts ...grpc.CallOption) (*OperationResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(OperationResponse) + err := c.cc.Invoke(ctx, AuthService_LinkSocialAccount_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *authServiceClient) UnlinkSocialAccount(ctx context.Context, in *UnlinkSocialAccountRequest, opts ...grpc.CallOption) (*OperationResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(OperationResponse) + err := c.cc.Invoke(ctx, AuthService_UnlinkSocialAccount_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *authServiceClient) GetLinkedAccounts(ctx context.Context, in *GetLinkedAccountsRequest, opts ...grpc.CallOption) (*GetLinkedAccountsResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(GetLinkedAccountsResponse) + err := c.cc.Invoke(ctx, AuthService_GetLinkedAccounts_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *authServiceClient) CreateApiKey(ctx context.Context, in *CreateApiKeyRequest, opts ...grpc.CallOption) (*CreateApiKeyResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(CreateApiKeyResponse) + err := c.cc.Invoke(ctx, AuthService_CreateApiKey_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *authServiceClient) ListApiKeys(ctx context.Context, in *ListApiKeysRequest, opts ...grpc.CallOption) (*ListApiKeysResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(ListApiKeysResponse) + err := c.cc.Invoke(ctx, AuthService_ListApiKeys_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *authServiceClient) RevokeApiKey(ctx context.Context, in *RevokeApiKeyRequest, opts ...grpc.CallOption) (*OperationResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(OperationResponse) + err := c.cc.Invoke(ctx, AuthService_RevokeApiKey_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *authServiceClient) VerifyApiKey(ctx context.Context, in *VerifyApiKeyRequest, opts ...grpc.CallOption) (*AuthenticationResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(AuthenticationResponse) + err := c.cc.Invoke(ctx, AuthService_VerifyApiKey_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *authServiceClient) GetPasswordPolicy(ctx context.Context, in *GetPasswordPolicyRequest, opts ...grpc.CallOption) (*GetPasswordPolicyResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(GetPasswordPolicyResponse) + err := c.cc.Invoke(ctx, AuthService_GetPasswordPolicy_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *authServiceClient) GetMetrics(ctx context.Context, in *GetMetricsRequest, opts ...grpc.CallOption) (*GetMetricsResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(GetMetricsResponse) + err := c.cc.Invoke(ctx, AuthService_GetMetrics_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *authServiceClient) LookupUser(ctx context.Context, in *LookupUserRequest, opts ...grpc.CallOption) (*LookupUserResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(LookupUserResponse) + err := c.cc.Invoke(ctx, AuthService_LookupUser_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +// AuthServiceServer is the server API for AuthService service. +// All implementations must embed UnimplementedAuthServiceServer +// for forward compatibility. +type AuthServiceServer interface { + RegisterUser(context.Context, *RegisterUserRequest) (*RegisterUserResponse, error) + VerifyRegisterUser(context.Context, *VerifyRegisterUserRequest) (*AuthenticationResponse, error) + Login(context.Context, *LoginRequest) (*AuthenticationResponse, error) + Logout(context.Context, *LogoutRequest) (*LogoutResponse, error) + VerifyToken(context.Context, *VerifyTokenRequest) (*AuthenticationResponse, error) + VerifyAuthClaimToken(context.Context, *VerifyAuthClaimTokenRequest) (*AuthenticationResponse, error) + InitiateTwoFactor(context.Context, *InitiateTwoFactorRequest) (*InitiateTwoFactorResponse, error) + VerifyTwoFactor(context.Context, *VerifyTwoFactorRequest) (*AuthenticationResponse, error) + InitiatePasswordReset(context.Context, *InitiatePasswordResetRequest) (*PasswordResetTokenResponse, error) + VerifyPasswordResetToken(context.Context, *VerifyPasswordResetTokenRequest) (*PasswordResetTokenResponse, error) + ResetPassword(context.Context, *ResetPasswordRequest) (*AuthenticationResponse, error) + ResendVerificationCode(context.Context, *ResendVerificationRequest) (*ResendVerificationResponse, error) + UpdateUserInfo(context.Context, *UpdateUserInfoRequest) (*UpdateUserInfoResponse, error) + ChangeIdentityField(context.Context, *ChangeIdentityFieldRequest) (*ChangeIdentityFieldResponse, error) + VerifyIdentityField(context.Context, *VerifyIdentityFieldRequest) (*VerifyIdentityFieldResponse, error) + ResendIdentifierChangeCode(context.Context, *ResendIdentityFieldRequest) (*ChangeIdentityFieldResponse, error) + UpdateUserPreference(context.Context, *UpdateUserPreferenceRequest) (*OperationResponse, error) + GetUserPreferenceByCode(context.Context, *GetUserPreferenceByCodeRequest) (*GetUserPreferenceByCodeResponse, error) + GetUserSessions(context.Context, *GetUserSessionsRequest) (*GetUserSessionsResponse, error) + ClearUserSessions(context.Context, *ClearUserSessionsRequest) (*ClearUserSessionsResponse, error) + // Social login - Mobile flow (validates ID token from native SDK) + SocialLogin(context.Context, *SocialLoginRequest) (*SocialLoginResponse, error) + // Social login - Web OAuth flow + InitiateOAuth(context.Context, *InitiateOAuthRequest) (*InitiateOAuthResponse, error) + CompleteOAuth(context.Context, *OAuthCallbackRequest) (*SocialLoginResponse, error) + // Account linking + LinkSocialAccount(context.Context, *LinkSocialAccountRequest) (*OperationResponse, error) + UnlinkSocialAccount(context.Context, *UnlinkSocialAccountRequest) (*OperationResponse, error) + GetLinkedAccounts(context.Context, *GetLinkedAccountsRequest) (*GetLinkedAccountsResponse, error) + // API Keys + CreateApiKey(context.Context, *CreateApiKeyRequest) (*CreateApiKeyResponse, error) + ListApiKeys(context.Context, *ListApiKeysRequest) (*ListApiKeysResponse, error) + RevokeApiKey(context.Context, *RevokeApiKeyRequest) (*OperationResponse, error) + VerifyApiKey(context.Context, *VerifyApiKeyRequest) (*AuthenticationResponse, error) + // Password policy (public, no auth required) + GetPasswordPolicy(context.Context, *GetPasswordPolicyRequest) (*GetPasswordPolicyResponse, error) + // Metrics + GetMetrics(context.Context, *GetMetricsRequest) (*GetMetricsResponse, error) + // User lookup by identifier (email, phone, or handle) — any authenticated user + LookupUser(context.Context, *LookupUserRequest) (*LookupUserResponse, error) + mustEmbedUnimplementedAuthServiceServer() +} + +// 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) RegisterUser(context.Context, *RegisterUserRequest) (*RegisterUserResponse, error) { + return nil, status.Error(codes.Unimplemented, "method RegisterUser not implemented") +} +func (UnimplementedAuthServiceServer) VerifyRegisterUser(context.Context, *VerifyRegisterUserRequest) (*AuthenticationResponse, error) { + return nil, status.Error(codes.Unimplemented, "method VerifyRegisterUser not implemented") +} +func (UnimplementedAuthServiceServer) Login(context.Context, *LoginRequest) (*AuthenticationResponse, error) { + return nil, status.Error(codes.Unimplemented, "method Login not implemented") +} +func (UnimplementedAuthServiceServer) Logout(context.Context, *LogoutRequest) (*LogoutResponse, error) { + return nil, status.Error(codes.Unimplemented, "method Logout not implemented") +} +func (UnimplementedAuthServiceServer) VerifyToken(context.Context, *VerifyTokenRequest) (*AuthenticationResponse, error) { + return nil, status.Error(codes.Unimplemented, "method VerifyToken not implemented") +} +func (UnimplementedAuthServiceServer) VerifyAuthClaimToken(context.Context, *VerifyAuthClaimTokenRequest) (*AuthenticationResponse, error) { + return nil, status.Error(codes.Unimplemented, "method VerifyAuthClaimToken not implemented") +} +func (UnimplementedAuthServiceServer) InitiateTwoFactor(context.Context, *InitiateTwoFactorRequest) (*InitiateTwoFactorResponse, error) { + return nil, status.Error(codes.Unimplemented, "method InitiateTwoFactor not implemented") +} +func (UnimplementedAuthServiceServer) VerifyTwoFactor(context.Context, *VerifyTwoFactorRequest) (*AuthenticationResponse, error) { + return nil, status.Error(codes.Unimplemented, "method VerifyTwoFactor not implemented") +} +func (UnimplementedAuthServiceServer) InitiatePasswordReset(context.Context, *InitiatePasswordResetRequest) (*PasswordResetTokenResponse, error) { + return nil, status.Error(codes.Unimplemented, "method InitiatePasswordReset not implemented") +} +func (UnimplementedAuthServiceServer) VerifyPasswordResetToken(context.Context, *VerifyPasswordResetTokenRequest) (*PasswordResetTokenResponse, error) { + return nil, status.Error(codes.Unimplemented, "method VerifyPasswordResetToken not implemented") +} +func (UnimplementedAuthServiceServer) ResetPassword(context.Context, *ResetPasswordRequest) (*AuthenticationResponse, error) { + return nil, status.Error(codes.Unimplemented, "method ResetPassword not implemented") +} +func (UnimplementedAuthServiceServer) ResendVerificationCode(context.Context, *ResendVerificationRequest) (*ResendVerificationResponse, error) { + return nil, status.Error(codes.Unimplemented, "method ResendVerificationCode not implemented") +} +func (UnimplementedAuthServiceServer) UpdateUserInfo(context.Context, *UpdateUserInfoRequest) (*UpdateUserInfoResponse, error) { + return nil, status.Error(codes.Unimplemented, "method UpdateUserInfo not implemented") +} +func (UnimplementedAuthServiceServer) ChangeIdentityField(context.Context, *ChangeIdentityFieldRequest) (*ChangeIdentityFieldResponse, error) { + return nil, status.Error(codes.Unimplemented, "method ChangeIdentityField not implemented") +} +func (UnimplementedAuthServiceServer) VerifyIdentityField(context.Context, *VerifyIdentityFieldRequest) (*VerifyIdentityFieldResponse, error) { + return nil, status.Error(codes.Unimplemented, "method VerifyIdentityField not implemented") +} +func (UnimplementedAuthServiceServer) ResendIdentifierChangeCode(context.Context, *ResendIdentityFieldRequest) (*ChangeIdentityFieldResponse, error) { + return nil, status.Error(codes.Unimplemented, "method ResendIdentifierChangeCode not implemented") +} +func (UnimplementedAuthServiceServer) UpdateUserPreference(context.Context, *UpdateUserPreferenceRequest) (*OperationResponse, error) { + return nil, status.Error(codes.Unimplemented, "method UpdateUserPreference not implemented") +} +func (UnimplementedAuthServiceServer) GetUserPreferenceByCode(context.Context, *GetUserPreferenceByCodeRequest) (*GetUserPreferenceByCodeResponse, error) { + return nil, status.Error(codes.Unimplemented, "method GetUserPreferenceByCode not implemented") +} +func (UnimplementedAuthServiceServer) GetUserSessions(context.Context, *GetUserSessionsRequest) (*GetUserSessionsResponse, error) { + return nil, status.Error(codes.Unimplemented, "method GetUserSessions not implemented") +} +func (UnimplementedAuthServiceServer) ClearUserSessions(context.Context, *ClearUserSessionsRequest) (*ClearUserSessionsResponse, error) { + return nil, status.Error(codes.Unimplemented, "method ClearUserSessions not implemented") +} +func (UnimplementedAuthServiceServer) SocialLogin(context.Context, *SocialLoginRequest) (*SocialLoginResponse, error) { + return nil, status.Error(codes.Unimplemented, "method SocialLogin not implemented") +} +func (UnimplementedAuthServiceServer) InitiateOAuth(context.Context, *InitiateOAuthRequest) (*InitiateOAuthResponse, error) { + return nil, status.Error(codes.Unimplemented, "method InitiateOAuth not implemented") +} +func (UnimplementedAuthServiceServer) CompleteOAuth(context.Context, *OAuthCallbackRequest) (*SocialLoginResponse, error) { + return nil, status.Error(codes.Unimplemented, "method CompleteOAuth not implemented") +} +func (UnimplementedAuthServiceServer) LinkSocialAccount(context.Context, *LinkSocialAccountRequest) (*OperationResponse, error) { + return nil, status.Error(codes.Unimplemented, "method LinkSocialAccount not implemented") +} +func (UnimplementedAuthServiceServer) UnlinkSocialAccount(context.Context, *UnlinkSocialAccountRequest) (*OperationResponse, error) { + return nil, status.Error(codes.Unimplemented, "method UnlinkSocialAccount not implemented") +} +func (UnimplementedAuthServiceServer) GetLinkedAccounts(context.Context, *GetLinkedAccountsRequest) (*GetLinkedAccountsResponse, error) { + return nil, status.Error(codes.Unimplemented, "method GetLinkedAccounts not implemented") +} +func (UnimplementedAuthServiceServer) CreateApiKey(context.Context, *CreateApiKeyRequest) (*CreateApiKeyResponse, error) { + return nil, status.Error(codes.Unimplemented, "method CreateApiKey not implemented") +} +func (UnimplementedAuthServiceServer) ListApiKeys(context.Context, *ListApiKeysRequest) (*ListApiKeysResponse, error) { + return nil, status.Error(codes.Unimplemented, "method ListApiKeys not implemented") +} +func (UnimplementedAuthServiceServer) RevokeApiKey(context.Context, *RevokeApiKeyRequest) (*OperationResponse, error) { + return nil, status.Error(codes.Unimplemented, "method RevokeApiKey not implemented") +} +func (UnimplementedAuthServiceServer) VerifyApiKey(context.Context, *VerifyApiKeyRequest) (*AuthenticationResponse, error) { + return nil, status.Error(codes.Unimplemented, "method VerifyApiKey not implemented") +} +func (UnimplementedAuthServiceServer) GetPasswordPolicy(context.Context, *GetPasswordPolicyRequest) (*GetPasswordPolicyResponse, error) { + return nil, status.Error(codes.Unimplemented, "method GetPasswordPolicy not implemented") +} +func (UnimplementedAuthServiceServer) GetMetrics(context.Context, *GetMetricsRequest) (*GetMetricsResponse, error) { + return nil, status.Error(codes.Unimplemented, "method GetMetrics not implemented") +} +func (UnimplementedAuthServiceServer) LookupUser(context.Context, *LookupUserRequest) (*LookupUserResponse, error) { + return nil, status.Error(codes.Unimplemented, "method LookupUser 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 +// result in compilation errors. +type UnsafeAuthServiceServer interface { + mustEmbedUnimplementedAuthServiceServer() +} + +func RegisterAuthServiceServer(s grpc.ServiceRegistrar, srv AuthServiceServer) { + // If the following call panics, 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) +} + +func _AuthService_RegisterUser_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(RegisterUserRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AuthServiceServer).RegisterUser(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: AuthService_RegisterUser_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AuthServiceServer).RegisterUser(ctx, req.(*RegisterUserRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _AuthService_VerifyRegisterUser_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(VerifyRegisterUserRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AuthServiceServer).VerifyRegisterUser(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: AuthService_VerifyRegisterUser_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AuthServiceServer).VerifyRegisterUser(ctx, req.(*VerifyRegisterUserRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _AuthService_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.(AuthServiceServer).Login(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: AuthService_Login_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AuthServiceServer).Login(ctx, req.(*LoginRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _AuthService_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.(AuthServiceServer).Logout(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: AuthService_Logout_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AuthServiceServer).Logout(ctx, req.(*LogoutRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _AuthService_VerifyToken_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(VerifyTokenRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AuthServiceServer).VerifyToken(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: AuthService_VerifyToken_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AuthServiceServer).VerifyToken(ctx, req.(*VerifyTokenRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _AuthService_VerifyAuthClaimToken_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(VerifyAuthClaimTokenRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AuthServiceServer).VerifyAuthClaimToken(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: AuthService_VerifyAuthClaimToken_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AuthServiceServer).VerifyAuthClaimToken(ctx, req.(*VerifyAuthClaimTokenRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _AuthService_InitiateTwoFactor_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(InitiateTwoFactorRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AuthServiceServer).InitiateTwoFactor(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: AuthService_InitiateTwoFactor_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AuthServiceServer).InitiateTwoFactor(ctx, req.(*InitiateTwoFactorRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _AuthService_VerifyTwoFactor_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(VerifyTwoFactorRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AuthServiceServer).VerifyTwoFactor(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: AuthService_VerifyTwoFactor_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AuthServiceServer).VerifyTwoFactor(ctx, req.(*VerifyTwoFactorRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _AuthService_InitiatePasswordReset_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(InitiatePasswordResetRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AuthServiceServer).InitiatePasswordReset(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: AuthService_InitiatePasswordReset_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AuthServiceServer).InitiatePasswordReset(ctx, req.(*InitiatePasswordResetRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _AuthService_VerifyPasswordResetToken_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(VerifyPasswordResetTokenRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AuthServiceServer).VerifyPasswordResetToken(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: AuthService_VerifyPasswordResetToken_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AuthServiceServer).VerifyPasswordResetToken(ctx, req.(*VerifyPasswordResetTokenRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _AuthService_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.(AuthServiceServer).ResetPassword(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: AuthService_ResetPassword_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AuthServiceServer).ResetPassword(ctx, req.(*ResetPasswordRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _AuthService_ResendVerificationCode_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.(AuthServiceServer).ResendVerificationCode(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: AuthService_ResendVerificationCode_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AuthServiceServer).ResendVerificationCode(ctx, req.(*ResendVerificationRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _AuthService_UpdateUserInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UpdateUserInfoRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AuthServiceServer).UpdateUserInfo(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: AuthService_UpdateUserInfo_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AuthServiceServer).UpdateUserInfo(ctx, req.(*UpdateUserInfoRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _AuthService_ChangeIdentityField_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ChangeIdentityFieldRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AuthServiceServer).ChangeIdentityField(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: AuthService_ChangeIdentityField_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AuthServiceServer).ChangeIdentityField(ctx, req.(*ChangeIdentityFieldRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _AuthService_VerifyIdentityField_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(VerifyIdentityFieldRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AuthServiceServer).VerifyIdentityField(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: AuthService_VerifyIdentityField_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AuthServiceServer).VerifyIdentityField(ctx, req.(*VerifyIdentityFieldRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _AuthService_ResendIdentifierChangeCode_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ResendIdentityFieldRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AuthServiceServer).ResendIdentifierChangeCode(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: AuthService_ResendIdentifierChangeCode_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AuthServiceServer).ResendIdentifierChangeCode(ctx, req.(*ResendIdentityFieldRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _AuthService_UpdateUserPreference_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UpdateUserPreferenceRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AuthServiceServer).UpdateUserPreference(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: AuthService_UpdateUserPreference_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AuthServiceServer).UpdateUserPreference(ctx, req.(*UpdateUserPreferenceRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _AuthService_GetUserPreferenceByCode_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetUserPreferenceByCodeRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AuthServiceServer).GetUserPreferenceByCode(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: AuthService_GetUserPreferenceByCode_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AuthServiceServer).GetUserPreferenceByCode(ctx, req.(*GetUserPreferenceByCodeRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _AuthService_GetUserSessions_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetUserSessionsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AuthServiceServer).GetUserSessions(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: AuthService_GetUserSessions_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AuthServiceServer).GetUserSessions(ctx, req.(*GetUserSessionsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _AuthService_ClearUserSessions_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ClearUserSessionsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AuthServiceServer).ClearUserSessions(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: AuthService_ClearUserSessions_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AuthServiceServer).ClearUserSessions(ctx, req.(*ClearUserSessionsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _AuthService_SocialLogin_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(SocialLoginRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AuthServiceServer).SocialLogin(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: AuthService_SocialLogin_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AuthServiceServer).SocialLogin(ctx, req.(*SocialLoginRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _AuthService_InitiateOAuth_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(InitiateOAuthRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AuthServiceServer).InitiateOAuth(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: AuthService_InitiateOAuth_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AuthServiceServer).InitiateOAuth(ctx, req.(*InitiateOAuthRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _AuthService_CompleteOAuth_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(OAuthCallbackRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AuthServiceServer).CompleteOAuth(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: AuthService_CompleteOAuth_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AuthServiceServer).CompleteOAuth(ctx, req.(*OAuthCallbackRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _AuthService_LinkSocialAccount_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(LinkSocialAccountRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AuthServiceServer).LinkSocialAccount(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: AuthService_LinkSocialAccount_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AuthServiceServer).LinkSocialAccount(ctx, req.(*LinkSocialAccountRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _AuthService_UnlinkSocialAccount_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UnlinkSocialAccountRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AuthServiceServer).UnlinkSocialAccount(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: AuthService_UnlinkSocialAccount_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AuthServiceServer).UnlinkSocialAccount(ctx, req.(*UnlinkSocialAccountRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _AuthService_GetLinkedAccounts_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetLinkedAccountsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AuthServiceServer).GetLinkedAccounts(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: AuthService_GetLinkedAccounts_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AuthServiceServer).GetLinkedAccounts(ctx, req.(*GetLinkedAccountsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _AuthService_CreateApiKey_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CreateApiKeyRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AuthServiceServer).CreateApiKey(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: AuthService_CreateApiKey_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AuthServiceServer).CreateApiKey(ctx, req.(*CreateApiKeyRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _AuthService_ListApiKeys_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ListApiKeysRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AuthServiceServer).ListApiKeys(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: AuthService_ListApiKeys_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AuthServiceServer).ListApiKeys(ctx, req.(*ListApiKeysRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _AuthService_RevokeApiKey_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(RevokeApiKeyRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AuthServiceServer).RevokeApiKey(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: AuthService_RevokeApiKey_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AuthServiceServer).RevokeApiKey(ctx, req.(*RevokeApiKeyRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _AuthService_VerifyApiKey_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(VerifyApiKeyRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AuthServiceServer).VerifyApiKey(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: AuthService_VerifyApiKey_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AuthServiceServer).VerifyApiKey(ctx, req.(*VerifyApiKeyRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _AuthService_GetPasswordPolicy_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetPasswordPolicyRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AuthServiceServer).GetPasswordPolicy(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: AuthService_GetPasswordPolicy_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AuthServiceServer).GetPasswordPolicy(ctx, req.(*GetPasswordPolicyRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _AuthService_GetMetrics_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetMetricsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AuthServiceServer).GetMetrics(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: AuthService_GetMetrics_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AuthServiceServer).GetMetrics(ctx, req.(*GetMetricsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _AuthService_LookupUser_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(LookupUserRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AuthServiceServer).LookupUser(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: AuthService_LookupUser_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AuthServiceServer).LookupUser(ctx, req.(*LookupUserRequest)) + } + 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) +var AuthService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "st_peter.auth.AuthService", + HandlerType: (*AuthServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "RegisterUser", + Handler: _AuthService_RegisterUser_Handler, + }, + { + MethodName: "VerifyRegisterUser", + Handler: _AuthService_VerifyRegisterUser_Handler, + }, + { + MethodName: "Login", + Handler: _AuthService_Login_Handler, + }, + { + MethodName: "Logout", + Handler: _AuthService_Logout_Handler, + }, + { + MethodName: "VerifyToken", + Handler: _AuthService_VerifyToken_Handler, + }, + { + MethodName: "VerifyAuthClaimToken", + Handler: _AuthService_VerifyAuthClaimToken_Handler, + }, + { + MethodName: "InitiateTwoFactor", + Handler: _AuthService_InitiateTwoFactor_Handler, + }, + { + MethodName: "VerifyTwoFactor", + Handler: _AuthService_VerifyTwoFactor_Handler, + }, + { + MethodName: "InitiatePasswordReset", + Handler: _AuthService_InitiatePasswordReset_Handler, + }, + { + MethodName: "VerifyPasswordResetToken", + Handler: _AuthService_VerifyPasswordResetToken_Handler, + }, + { + MethodName: "ResetPassword", + Handler: _AuthService_ResetPassword_Handler, + }, + { + MethodName: "ResendVerificationCode", + Handler: _AuthService_ResendVerificationCode_Handler, + }, + { + MethodName: "UpdateUserInfo", + Handler: _AuthService_UpdateUserInfo_Handler, + }, + { + MethodName: "ChangeIdentityField", + Handler: _AuthService_ChangeIdentityField_Handler, + }, + { + MethodName: "VerifyIdentityField", + Handler: _AuthService_VerifyIdentityField_Handler, + }, + { + MethodName: "ResendIdentifierChangeCode", + Handler: _AuthService_ResendIdentifierChangeCode_Handler, + }, + { + MethodName: "UpdateUserPreference", + Handler: _AuthService_UpdateUserPreference_Handler, + }, + { + MethodName: "GetUserPreferenceByCode", + Handler: _AuthService_GetUserPreferenceByCode_Handler, + }, + { + MethodName: "GetUserSessions", + Handler: _AuthService_GetUserSessions_Handler, + }, + { + MethodName: "ClearUserSessions", + Handler: _AuthService_ClearUserSessions_Handler, + }, + { + MethodName: "SocialLogin", + Handler: _AuthService_SocialLogin_Handler, + }, + { + MethodName: "InitiateOAuth", + Handler: _AuthService_InitiateOAuth_Handler, + }, + { + MethodName: "CompleteOAuth", + Handler: _AuthService_CompleteOAuth_Handler, + }, + { + MethodName: "LinkSocialAccount", + Handler: _AuthService_LinkSocialAccount_Handler, + }, + { + MethodName: "UnlinkSocialAccount", + Handler: _AuthService_UnlinkSocialAccount_Handler, + }, + { + MethodName: "GetLinkedAccounts", + Handler: _AuthService_GetLinkedAccounts_Handler, + }, + { + MethodName: "CreateApiKey", + Handler: _AuthService_CreateApiKey_Handler, + }, + { + MethodName: "ListApiKeys", + Handler: _AuthService_ListApiKeys_Handler, + }, + { + MethodName: "RevokeApiKey", + Handler: _AuthService_RevokeApiKey_Handler, + }, + { + MethodName: "VerifyApiKey", + Handler: _AuthService_VerifyApiKey_Handler, + }, + { + MethodName: "GetPasswordPolicy", + Handler: _AuthService_GetPasswordPolicy_Handler, + }, + { + MethodName: "GetMetrics", + Handler: _AuthService_GetMetrics_Handler, + }, + { + MethodName: "LookupUser", + Handler: _AuthService_LookupUser_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "st-peter-auth.proto", +} diff --git a/go/go.mod b/go/go.mod new file mode 100644 index 0000000..7b23fba --- /dev/null +++ b/go/go.mod @@ -0,0 +1,15 @@ +module git.awesomike.com/pub/st-peter-client/go + +go 1.26.2 + +require ( + google.golang.org/grpc v1.81.1 + google.golang.org/protobuf v1.36.11 +) + +require ( + golang.org/x/net v0.51.0 // indirect + golang.org/x/sys v0.42.0 // indirect + golang.org/x/text v0.34.0 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20260226221140-a57be14db171 // indirect +) diff --git a/go/go.sum b/go/go.sum new file mode 100644 index 0000000..44c671d --- /dev/null +++ b/go/go.sum @@ -0,0 +1,38 @@ +github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= +github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/go-logr/logr v1.4.3 h1:CjnDlHq8ikf6E492q6eKboGOC0T8CDaOvkHCIg8idEI= +github.com/go-logr/logr v1.4.3/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= +github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= +github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= +github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= +github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= +github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= +github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= +github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +go.opentelemetry.io/auto/sdk v1.2.1 h1:jXsnJ4Lmnqd11kwkBV2LgLoFMZKizbCi5fNZ/ipaZ64= +go.opentelemetry.io/auto/sdk v1.2.1/go.mod h1:KRTj+aOaElaLi+wW1kO/DZRXwkF4C5xPbEe3ZiIhN7Y= +go.opentelemetry.io/otel v1.43.0 h1:mYIM03dnh5zfN7HautFE4ieIig9amkNANT+xcVxAj9I= +go.opentelemetry.io/otel v1.43.0/go.mod h1:JuG+u74mvjvcm8vj8pI5XiHy1zDeoCS2LB1spIq7Ay0= +go.opentelemetry.io/otel/metric v1.43.0 h1:d7638QeInOnuwOONPp4JAOGfbCEpYb+K6DVWvdxGzgM= +go.opentelemetry.io/otel/metric v1.43.0/go.mod h1:RDnPtIxvqlgO8GRW18W6Z/4P462ldprJtfxHxyKd2PY= +go.opentelemetry.io/otel/sdk v1.43.0 h1:pi5mE86i5rTeLXqoF/hhiBtUNcrAGHLKQdhg4h4V9Dg= +go.opentelemetry.io/otel/sdk v1.43.0/go.mod h1:P+IkVU3iWukmiit/Yf9AWvpyRDlUeBaRg6Y+C58QHzg= +go.opentelemetry.io/otel/sdk/metric v1.43.0 h1:S88dyqXjJkuBNLeMcVPRFXpRw2fuwdvfCGLEo89fDkw= +go.opentelemetry.io/otel/sdk/metric v1.43.0/go.mod h1:C/RJtwSEJ5hzTiUz5pXF1kILHStzb9zFlIEe85bhj6A= +go.opentelemetry.io/otel/trace v1.43.0 h1:BkNrHpup+4k4w+ZZ86CZoHHEkohws8AY+WTX09nk+3A= +go.opentelemetry.io/otel/trace v1.43.0/go.mod h1:/QJhyVBUUswCphDVxq+8mld+AvhXZLhe+8WVFxiFff0= +golang.org/x/net v0.51.0 h1:94R/GTO7mt3/4wIKpcR5gkGmRLOuE/2hNGeWq/GBIFo= +golang.org/x/net v0.51.0/go.mod h1:aamm+2QF5ogm02fjy5Bb7CQ0WMt1/WVM7FtyaTLlA9Y= +golang.org/x/sys v0.42.0 h1:omrd2nAlyT5ESRdCLYdm3+fMfNFE/+Rf4bDIQImRJeo= +golang.org/x/sys v0.42.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw= +golang.org/x/text v0.34.0 h1:oL/Qq0Kdaqxa1KbNeMKwQq0reLCCaFtqu2eNuSeNHbk= +golang.org/x/text v0.34.0/go.mod h1:homfLqTYRFyVYemLBFl5GgL/DWEiH5wcsQ5gSh1yziA= +gonum.org/v1/gonum v0.17.0 h1:VbpOemQlsSMrYmn7T2OUvQ4dqxQXU+ouZFQsZOx50z4= +gonum.org/v1/gonum v0.17.0/go.mod h1:El3tOrEuMpv2UdMrbNlKEh9vd86bmQ6vqIcDwxEOc1E= +google.golang.org/genproto/googleapis/rpc v0.0.0-20260226221140-a57be14db171 h1:ggcbiqK8WWh6l1dnltU4BgWGIGo+EVYxCaAPih/zQXQ= +google.golang.org/genproto/googleapis/rpc v0.0.0-20260226221140-a57be14db171/go.mod h1:4Hqkh8ycfw05ld/3BWL7rJOSfebL2Q+DVDeRgYgxUU8= +google.golang.org/grpc v1.81.1 h1:VnnIIZ88UzOOKLukQi+ImGz8O1Wdp8nAGGnvOfEIWQQ= +google.golang.org/grpc v1.81.1/go.mod h1:xGH9GfzOyMTGIOXBJmXt+BX/V0kcdQbdcuwQ/zNw42I= +google.golang.org/protobuf v1.36.11 h1:fV6ZwhNocDyBLK0dj+fg8ektcVegBBuEolpbTQyBNVE= +google.golang.org/protobuf v1.36.11/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco= diff --git a/proto/st-peter-auth.proto b/proto/st-peter-auth.proto new file mode 100644 index 0000000..f8026a1 --- /dev/null +++ b/proto/st-peter-auth.proto @@ -0,0 +1,633 @@ +syntax = "proto3"; +package st_peter.auth; +option go_package = "nandie.com/pkg/;auth_service"; +import "google/protobuf/timestamp.proto"; + +service AuthService { + rpc RegisterUser (RegisterUserRequest) returns (RegisterUserResponse); + rpc VerifyRegisterUser (VerifyRegisterUserRequest) returns (AuthenticationResponse); + rpc Login (LoginRequest) returns (AuthenticationResponse); + rpc Logout (LogoutRequest) returns (LogoutResponse); + rpc VerifyToken (VerifyTokenRequest) returns (AuthenticationResponse); + rpc VerifyAuthClaimToken (VerifyAuthClaimTokenRequest) returns (AuthenticationResponse); + rpc InitiateTwoFactor (InitiateTwoFactorRequest) returns (InitiateTwoFactorResponse); + rpc VerifyTwoFactor (VerifyTwoFactorRequest) returns (AuthenticationResponse); + rpc InitiatePasswordReset (InitiatePasswordResetRequest) returns (PasswordResetTokenResponse); + rpc VerifyPasswordResetToken (VerifyPasswordResetTokenRequest) returns (PasswordResetTokenResponse); + rpc ResetPassword (ResetPasswordRequest) returns (AuthenticationResponse); + rpc ResendVerificationCode (ResendVerificationRequest) returns (ResendVerificationResponse); + rpc UpdateUserInfo (UpdateUserInfoRequest) returns (UpdateUserInfoResponse); + rpc ChangeIdentityField (ChangeIdentityFieldRequest) returns (ChangeIdentityFieldResponse); + rpc VerifyIdentityField (VerifyIdentityFieldRequest) returns (VerifyIdentityFieldResponse); + rpc ResendIdentifierChangeCode(ResendIdentityFieldRequest) returns (ChangeIdentityFieldResponse); + rpc UpdateUserPreference (UpdateUserPreferenceRequest) returns (OperationResponse); + rpc GetUserPreferenceByCode (GetUserPreferenceByCodeRequest) returns (GetUserPreferenceByCodeResponse); + rpc GetUserSessions(GetUserSessionsRequest) returns (GetUserSessionsResponse); + rpc ClearUserSessions(ClearUserSessionsRequest) returns (ClearUserSessionsResponse); + + // Social login - Mobile flow (validates ID token from native SDK) + rpc SocialLogin(SocialLoginRequest) returns (SocialLoginResponse); + // Social login - Web OAuth flow + rpc InitiateOAuth(InitiateOAuthRequest) returns (InitiateOAuthResponse); + rpc CompleteOAuth(OAuthCallbackRequest) returns (SocialLoginResponse); + // Account linking + rpc LinkSocialAccount(LinkSocialAccountRequest) returns (OperationResponse); + rpc UnlinkSocialAccount(UnlinkSocialAccountRequest) returns (OperationResponse); + rpc GetLinkedAccounts(GetLinkedAccountsRequest) returns (GetLinkedAccountsResponse); + + // API Keys + rpc CreateApiKey(CreateApiKeyRequest) returns (CreateApiKeyResponse); + rpc ListApiKeys(ListApiKeysRequest) returns (ListApiKeysResponse); + rpc RevokeApiKey(RevokeApiKeyRequest) returns (OperationResponse); + rpc VerifyApiKey(VerifyApiKeyRequest) returns (AuthenticationResponse); + + // Password policy (public, no auth required) + rpc GetPasswordPolicy(GetPasswordPolicyRequest) returns (GetPasswordPolicyResponse); + + // Metrics + rpc GetMetrics(GetMetricsRequest) returns (GetMetricsResponse); + + // User lookup by identifier (email, phone, or handle) — any authenticated user + rpc LookupUser(LookupUserRequest) returns (LookupUserResponse); +} + +message Date { + int32 year = 1; + uint32 month = 2; + uint32 day = 3; +} + +enum ResultCode { + RESULT_CODE_SUCCESS = 0; + RESULT_CODE_NOT_FOUND = 1; + RESULT_CODE_INTERNAL_SERVER_ERROR = 2; + RESULT_CODE_BAD_REQUEST = 3; + RESULT_CODE_NOT_AUTHORIZED = 4; + RESULT_CODE_FORBIDDEN = 5; + RESULT_CODE_VALIDATION_ERRORS = 6; + RESULT_CODE_PASSCODE_REQUIRED = 7; + RESULT_CODE_TOO_MANY_REQUESTS = 9; + RESULT_CODE_INVALID_CREDENTIALS = 8; + RESULT_CODE_INACTIVE_USER = 10; + RESULT_CODE_IDENTITY_IN_USE = 11; + RESULT_CODE_NEXT_STEP = 12; + +} + +enum ChannelType { + CHANNEL_TYPE_UNSPECIFIED = 0; + CHANNEL_TYPE_EMAIL = 1; + CHANNEL_TYPE_SMS = 2; +} + +enum VerificationCodeType { + VERIFICATION_CODE_TYPE_UNSPECIFIED = 0; + VERIFICATION_CODE_TYPE_REGISTER = 1; + VERIFICATION_CODE_TYPE_PASSWORD_RESET = 2; + VERIFICATION_CODE_TYPE_OTP_LOGIN = 3; +} + +message User { + string id = 1; + string email = 2; + string phone = 3; + string first_names = 4; + string last_name = 5; + string profile_picture_url = 6; + optional string handle = 7; + google.protobuf.Timestamp created_at = 10; + google.protobuf.Timestamp updated_at = 11; + google.protobuf.Timestamp deleted_at = 12; + google.protobuf.Timestamp last_login = 13; + bool is_active = 20; + bool is_email_verified = 21; + bool is_phone_verified = 22; + Date date_of_birth = 23; + int64 version = 24; + repeated SocialAccount social_accounts = 30; +} + +message UserPreference { + string id = 1; + string user_id = 2; + string preference_code = 3; + string preference_value_type = 4; + string preference_value = 5; + google.protobuf.Timestamp created_at = 10; + google.protobuf.Timestamp updated_at = 11; + +} + +message Role { + string id = 1; + string code = 2; + string description = 3; + google.protobuf.Timestamp created_at = 4; + google.protobuf.Timestamp updated_at = 5; +} + +message SocialAccount { + string provider = 1; + string provider_user_id = 2; + string access_token = 3; + google.protobuf.Timestamp expires_at = 4; + string email = 5; + string name = 6; + string profile_picture_url = 7; + bool email_verified = 8; +} + +// OAuth Provider enumeration +enum OAuthProvider { + OAUTH_PROVIDER_UNSPECIFIED = 0; + OAUTH_PROVIDER_GOOGLE = 1; + OAUTH_PROVIDER_APPLE = 2; + OAUTH_PROVIDER_FACEBOOK = 3; + OAUTH_PROVIDER_MICROSOFT = 4; +} + +// Mobile flow - validate ID token from native SDK +message SocialLoginRequest { + OAuthProvider provider = 1; + string id_token = 2; // JWT from Google/Apple SDK + string access_token = 3; // For Facebook + DeviceInfo device_info = 4; + string nonce = 5; // For Apple Sign-In security +} + +message SocialLoginResponse { + bool success = 1; + ResultCode result_code = 2; + string message = 3; + AuthenticatedUser authenticated_user = 4; + bool is_new_user = 5; + bool was_auto_linked = 6; + repeated ValidationError validation_errors = 7; +} + +// Web flow - initiate OAuth redirect +message InitiateOAuthRequest { + OAuthProvider provider = 1; + string redirect_uri = 2; + string state = 3; // Client-provided state for additional verification +} + +message InitiateOAuthResponse { + bool success = 1; + ResultCode result_code = 2; + string message = 3; + string authorization_url = 4; + string state = 5; // Server-generated state token +} + +// Web flow - handle callback +message OAuthCallbackRequest { + OAuthProvider provider = 1; + string code = 2; + string state = 3; + DeviceInfo device_info = 4; +} + +// Account linking +message LinkSocialAccountRequest { + string actor_id = 1; + string actor_token = 2; + OAuthProvider provider = 3; + string id_token = 4; + string access_token = 5; + string nonce = 6; // For Apple Sign-In +} + +message UnlinkSocialAccountRequest { + string actor_id = 1; + string actor_token = 2; + OAuthProvider provider = 3; +} + +message GetLinkedAccountsRequest { + string actor_id = 1; + string actor_token = 2; +} + +message GetLinkedAccountsResponse { + bool success = 1; + ResultCode result_code = 2; + string message = 3; + repeated SocialAccount accounts = 4; +} + +message RegisterUserRequest { + string user_identifier = 1; + string password = 2; + string first_names = 4; + string last_name = 5; + string app_hash = 6; + DeviceInfo device_info = 7; +} + +message RegisterUserResponse { + bool success = 1; + ResultCode result_code = 2; + string message = 3; + string registration_id = 4; + repeated ValidationError validation_errors = 5; +} + + +message VerifyRegisterUserRequest { + string user_identifier = 1; // Can be either email or phone + string registration_id = 2; + string token = 3; //Token has a redirect to encoded in it. + DeviceInfo device_info = 4; +} + +message UserResponse { + bool success = 1; + ResultCode result_code = 2; + string message = 3; + User user = 4; +} + +message DeviceInfo { + string application_name = 1; // e.g., 'web', 'mobile' + string application_version = 2; //e.g., '1.0.0' + string device_name = 3; // e.g., 'iPhone X', 'Pixel 2' + string device_type = 4; // -- e.g., 'desktop', 'mobile' + string device_os = 5; // e. g., 'iOS', 'Android', 'Windows' + string device_os_version = 6; // e.g., '10', '11.4.1' + string device_id = 7; // e.g., 'imei:1234567890', 'serial:1234567890' +} + +message LoginRequest { + string user_identifier = 1; // Can be either email or phone + string password = 2; + string app_hash = 3; + DeviceInfo device_info = 4; +} + +message AuthenticationResponse { + bool success = 1; + bool pass_code_required = 2; + string two_factor_id = 3; + ResultCode result_code = 8; + string message = 9; + AuthenticatedUser authenticated_user = 10; +} + +message AuthenticatedUser { + User user = 1; + string token = 2; + string session_id = 3; + google.protobuf.Timestamp expires_at = 4; + repeated UserPreference user_preferences = 5; + repeated AssignedUserRole user_roles = 11; +} + +message AssignedUserRole { + string id = 1; + string user_id = 2; + string role_id = 3; + string role_name = 4; + string scope_code = 5; + string target_id = 6; +} + +message VerifyTokenRequest { + string token = 1; + bool include_user_roles = 2; + repeated string role_scopes = 3; + repeated string role_names = 4; +} + +message VerifyAuthClaimTokenRequest { + string claim = 2; +} + +message InitiateTwoFactorResponse { + bool success = 1; + ResultCode result_code = 2; + string message = 3; + string two_factor_id = 4; + ChannelType channel = 5; + string user_id = 7; + repeated ValidationError validation_errors = 6; +} + +message VerifyTwoFactorResponse { + bool success = 1; + ResultCode result_code = 2; + string message = 3; + repeated ValidationError validation_errors = 4; +} + +message InitiateTwoFactorRequest { + optional string user_id = 1; + optional string user_identifier = 5; // Can be either email or phone + ChannelType channel = 2; + string app_hash = 3; + DeviceInfo device_info = 4; +} + +message VerifyTwoFactorRequest { + string two_factor_id = 1; + string code = 2; + DeviceInfo device_info = 3; +} + +message InitiatePasswordResetRequest { + string user_identifier = 1; // Can be either email or phone + string app_hash = 2; + DeviceInfo device_info = 4; + string new_password = 5; +} + +message OperationResponse { + bool success = 1; + ResultCode result_code = 2; + string message = 3; +} + +message VerifyPasswordResetTokenRequest { + string user_id = 1; + string password_reset_id = 2; + string passcode = 3; +} + +message PasswordResetTokenResponse { + bool success = 1; + ResultCode result_code = 2; + string message = 3; + string password_reset_id = 4; +} + +message ResetPasswordRequest { + string user_id = 1; + string password_reset_id = 2; + string passcode = 3; + DeviceInfo device_info = 4; +} + +enum IdentityField { + IDENTITY_FIELD_UNSPECIFIED = 0; + IDENTITY_FIELD_EMAIL = 1; + IDENTITY_FIELD_phone = 2; + IDENTITY_FIELD_PASSWORD = 3; + IDENTITY_FIELD_HANDLE = 4; +} + +message ChangeIdentityFieldRequest { + string user_id = 1; + string user_token = 2; + ChannelType channel = 3; + string new_value = 4; + IdentityField field_type = 5; + string app_hash = 6; + DeviceInfo device_info = 7; +} + +message ChangeIdentityFieldResponse { + bool success = 1; + ResultCode result_code = 2; + string message = 3; + + string challenge_id = 4; + int32 passcode_size = 5; + string user_identifier = 6; + ChannelType channel = 7; + repeated ValidationError validation_errors = 8; +} + +message VerifyIdentityFieldRequest { + string user_id = 1; + string user_token = 2; + string challenge_id = 4; + string verification_code = 5; + + string app_hash = 6; + DeviceInfo device_info = 7; +} + +message ResendIdentityFieldRequest { + string user_id = 1; + string user_token = 2; + string challenge_id = 4; + + string app_hash = 6; + DeviceInfo device_info = 7; +} + + +message VerifyIdentityFieldResponse { + bool success = 1; + ResultCode result_code = 2; + string message = 3; + + bool requires_verification = 8; + string challenge_id = 4; + int32 passcode_size = 5; + string user_identifier = 6; + ChannelType channel = 7; + + repeated ValidationError validation_errors = 9; +} + +message UpdateUserInfoRequest { + string user_id = 1; + string user_token = 2; + optional string first_names = 3; + optional string last_name = 4; + optional string profile_picture_id = 6; + Date date_of_birth = 5; + optional string handle = 7; // Optional unique handle (e.g., @username) +} + +message UpdateUserInfoResponse { + bool success = 1; + ResultCode result_code = 2; + string message = 3; + + User user = 4; +} + +message LogoutRequest { + string token = 1; +} + +message LogoutResponse { + bool success = 1; + ResultCode result_code = 2; + string message = 3; +} + +message ValidationError { + string field = 1; + string message = 2; +} + +message Scope { + string code = 1; + string description = 2; + optional string parent_code = 3; + bool is_active = 4; +} + +message UpdateUserPreferenceRequest { + string actor_id = 1; + string actor_token = 2; + string preference_key = 3; + string preference_value = 4; +} + +message GetUserPreferenceByCodeRequest { + string actor_id = 1; + string actor_token = 2; + string preference_code = 3; +} + +message GetUserPreferenceByCodeResponse { + bool success = 1; + ResultCode result_code = 2; + string message = 3; + string value = 4; +} + +message ResendVerificationRequest { + string user_identifier = 1; + VerificationCodeType verification_code_type = 2; + string app_hash = 3; + string verification_code_id = 4; + DeviceInfo device_info = 19; +} + +message ResendVerificationResponse { + bool success = 1; + ResultCode result_code = 2; + string message = 3; + string verification_code_id = 4; +} + +message UserSession { + string id = 1; + string user_id = 2; + DeviceInfo device_info = 3; + google.protobuf.Timestamp created_at = 4; + google.protobuf.Timestamp expires_at = 5; + google.protobuf.Timestamp last_activity = 6; + bool is_active = 7; + string ip_address = 8; + string user_agent = 9; +} + +message GetUserSessionsRequest { + string actor_id = 1; + string actor_token = 2; + int32 page = 3; + int32 size = 4; +} + +message GetUserSessionsResponse { + bool success = 1; + ResultCode result_code = 2; + string message = 3; + repeated UserSession sessions = 4; + int32 total = 5; +} + +message ClearUserSessionsRequest { + string actor_id = 1; + string actor_token = 2; + repeated string session_ids = 3; // If empty, clears all sessions except current +} + +message ClearUserSessionsResponse { + bool success = 1; + ResultCode result_code = 2; + string message = 3; + int32 cleared_count = 4; +} + +// Metrics +message GetMetricsRequest { + string bearer_token = 1; +} + +message GetMetricsResponse { + bool success = 1; + ResultCode result_code = 2; + string message = 3; + string metrics = 4; // Prometheus text format +} + +// API Key messages +message CreateApiKeyRequest { + string token = 1; // existing session token for auth + string name = 2; + repeated string scopes = 3; + int64 expires_at = 4; // 0 = never +} + +message CreateApiKeyResponse { + bool success = 1; + ResultCode result_code = 2; + string message = 3; + string api_key = 4; // full key, shown ONCE + string key_id = 5; + string key_prefix = 6; +} + +message ListApiKeysRequest { + string token = 1; +} + +message ListApiKeysResponse { + bool success = 1; + ResultCode result_code = 2; + string message = 3; + repeated ApiKeyInfo keys = 4; +} + +message ApiKeyInfo { + string id = 1; + string name = 2; + string key_prefix = 3; + repeated string scopes = 4; + int64 last_used_at = 5; + int64 expires_at = 6; + int64 created_at = 7; + bool is_active = 8; +} + +message RevokeApiKeyRequest { + string token = 1; + string key_id = 2; +} + +message VerifyApiKeyRequest { + string api_key = 1; +} + +// Password policy +message GetPasswordPolicyRequest {} + +message GetPasswordPolicyResponse { + bool success = 1; + ResultCode result_code = 2; + string message = 3; + uint32 min_length = 4; + bool requires_uppercase = 5; + bool requires_special_character = 6; +} + +// Lookup user by exact identifier (email, phone number, or handle) +message LookupUserRequest { + string user_id = 1; + string user_token = 2; + string identifier = 3; // email, phone number, or handle +} + +message LookupUserResponse { + bool success = 1; + ResultCode result_code = 2; + string message = 3; + optional User user = 4; +} \ No newline at end of file diff --git a/rust/Cargo.toml b/rust/Cargo.toml new file mode 100644 index 0000000..e403c0f --- /dev/null +++ b/rust/Cargo.toml @@ -0,0 +1,30 @@ +[package] +name = "st-peter-client" +version = "0.2.0" +edition = "2021" +description = "Official Rust client for st-peter (aura-users) — authentication over gRPC with a token-verify cache" +repository = "https://git.awesomike.com/pub/st-peter-client" +license = "MIT OR Apache-2.0" + +[lib] +name = "st_peter_client" +path = "src/lib.rs" + +[dependencies] +# Async runtime. `sync` for the token-verify cache RwLock; nothing else. +tokio = { version = "1", default-features = false, features = ["sync", "time"] } +thiserror = "2" + +# gRPC client. tls-ring lets the client talk to a TLS-protected aura-users +# without dragging in any server-side TLS termination code. +tonic = { version = "0.14", features = ["codegen", "tls-ring"] } +tonic-prost = "0.14" +prost = "0.14" +prost-types = "0.14" + +# `bearer()` header extraction (the same `http` major tonic uses). +http = "1" + +[build-dependencies] +# Compiles the vendored proto in ../proto into client stubs at build time. +tonic-prost-build = "0.14" diff --git a/rust/README.md b/rust/README.md new file mode 100644 index 0000000..3c9559e --- /dev/null +++ b/rust/README.md @@ -0,0 +1,14 @@ +# st-peter-client (Rust) + +Official Rust client for st-peter (aura-users). Stubs are generated at build +time from `../proto/st-peter-auth.proto`; the ergonomic [`AuthClient`] wrapper +(token-verify cache, login/2FA/lookup) is layered on top, with the raw wire +surface available under `st_peter_client::authpb`. + +```rust +let auth = st_peter_client::AuthClient::connect("http://127.0.0.1:9091").await?; +let user = auth.verify_token(&token).await?; // cached ~60s +``` + +See the repo root README for versioning and the +authentication-central / authorization-local design. diff --git a/rust/build.rs b/rust/build.rs new file mode 100644 index 0000000..36fa35b --- /dev/null +++ b/rust/build.rs @@ -0,0 +1,12 @@ +// Compile the vendored proto (../proto, synced from the st-peter server repo) +// into client stubs. Client-only: no server traits are generated. +fn main() { + let protos = ["../proto/st-peter-auth.proto"]; + tonic_prost_build::configure() + .build_server(false) + .compile_protos(&protos, &["../proto"]) + .expect("failed to compile st-peter protos"); + for p in protos { + println!("cargo:rerun-if-changed={p}"); + } +} diff --git a/rust/src/lib.rs b/rust/src/lib.rs new file mode 100644 index 0000000..3772591 --- /dev/null +++ b/rust/src/lib.rs @@ -0,0 +1,261 @@ +//! Official Rust client for st-peter (aura-users) — the central +//! authentication service. +//! +//! The proto stubs are generated at build time from the vendored +//! `.proto` file in this repo's `proto/` directory (the st-peter +//! server repo is the source of truth — see `scripts/sync-protos.sh`). +//! The raw wire surface lives under [`authpb`]; [`AuthClient`] is the +//! ergonomic wrapper layered on top. +//! +//! ## Design: authentication central, authorization local +//! +//! st-peter answers *who is this token?* — it returns the verified +//! identity plus the user's **platform** roles. What that identity may +//! do inside a consuming service (media roles, CMS roles, …) is that +//! service's own concern: keep a local roles table keyed by the +//! st-peter `user_id` **by value** (no cross-DB FK) and map permissions +//! there. This crate deliberately ships no session/permission types. +//! +//! ## Usage +//! +//! ```ignore +//! let auth = st_peter_client::AuthClient::connect("http://127.0.0.1:9091").await?; +//! +//! // per-request: verify a session token (cached ~60s) +//! let user = auth.verify_token(&token).await?; +//! +//! // login bridge +//! match auth.login(&identifier, &password).await? { +//! LoginOutcome::Authenticated(user) => { /* set session cookie from user.token */ } +//! LoginOutcome::TwoFactor { two_factor_id } => { /* collect OTP, verify_two_factor */ } +//! LoginOutcome::Failed(msg) => { /* show msg */ } +//! } +//! ``` + +use std::collections::HashMap; +use std::sync::Arc; +use tokio::sync::RwLock; +use tonic::transport::Channel; + +/// Auth proto stubs (`AuthService` — the external client surface). +/// Generated from `proto/st-peter-auth.proto` (package `st_peter.auth`). +pub mod authpb { + tonic::include_proto!("st_peter.auth"); +} + +use authpb::auth_service_client::AuthServiceClient; +use authpb::{ + AuthenticatedUser, AuthenticationResponse, LoginRequest, LookupUserRequest, User, + VerifyTokenRequest, VerifyTwoFactorRequest, +}; + +pub type Result = std::result::Result; + +#[derive(Debug, thiserror::Error)] +pub enum Error { + /// The token failed verification (or the response carried no user). + #[error("unauthorized")] + Unauthorized, + /// RPC-level failure talking to aura-users. + #[error(transparent)] + Rpc(#[from] tonic::Status), + /// The endpoint URL failed to parse (it must carry an `http://` or + /// `https://` scheme — a bare `host:port` does not). + #[error("invalid aura-users endpoint: {0}")] + InvalidUri(#[from] http::uri::InvalidUri), +} + +/// TTL for cached token verifications (seconds). A revoked token stays +/// "valid" for up to this long — logout flows must not rely on the cache. +const AUTH_CACHE_TTL_SECS: u64 = 60; + +/// Session cookie name issued by aura-users on login. Shared convention +/// across the aura services so a session works on any of them. +pub const COOKIE_NAME: &str = "aura_session"; + +/// Outcome of a `Login` (or `VerifyTwoFactor`) call against aura-users. +pub enum LoginOutcome { + /// Authenticated — carries the session (token + user + platform roles). + /// A login bridge sets the [`COOKIE_NAME`] cookie from `user.token`. + Authenticated(Box), + /// aura-users issued a one-time passcode challenge (emailed/SMS'd). The + /// caller collects the code and calls + /// [`AuthClient::verify_two_factor`] with this `two_factor_id`. + TwoFactor { two_factor_id: String }, + /// Login failed (bad credentials, locked out, …) — carries a display message. + Failed(String), +} + +/// Map a st-peter `AuthenticationResponse` to a [`LoginOutcome`] (shared by +/// `login` and `verify_two_factor`): 2FA-required first, then success, else fail. +fn interpret_auth_response(resp: AuthenticationResponse) -> LoginOutcome { + if resp.pass_code_required { + return LoginOutcome::TwoFactor { + two_factor_id: resp.two_factor_id, + }; + } + if resp.success { + if let Some(user) = resp.authenticated_user { + return LoginOutcome::Authenticated(Box::new(user)); + } + } + LoginOutcome::Failed(if resp.message.is_empty() { + "Invalid email or password.".to_string() + } else { + resp.message + }) +} + +/// Thin client to aura-users' `AuthService`, with a small token-verify cache. +/// +/// `AuthServiceClient` is cheap to `clone` (a `Channel` is an +/// `Arc`'d connection handle), so we keep one and `.clone()` it per call +/// instead of locking a `&mut` client across an `.await`. `AuthClient` +/// itself is `Clone` and safe to share across tasks. +#[derive(Clone)] +pub struct AuthClient { + inner: AuthServiceClient, + cache: Arc>>, +} + +impl AuthClient { + /// Connect to aura-users gRPC (internal address, e.g. `http://127.0.0.1:9091`). + /// + /// The URL must carry an `http://`/`https://` scheme — a bare `host:port` + /// fails to parse. The dial is lazy with explicit timeouts, so a + /// slow/absent aura-users at boot doesn't block a consumer's startup; + /// failures surface on the first call instead. + pub async fn connect(grpc_url: &str) -> Result { + let channel = Channel::from_shared(grpc_url.to_string())? + .connect_timeout(std::time::Duration::from_secs(5)) + .timeout(std::time::Duration::from_secs(10)) + .connect_lazy(); + let inner = AuthServiceClient::new(channel); + Ok(Self { + inner, + cache: Arc::new(RwLock::new(HashMap::new())), + }) + } + + /// Verify a session token, returning the authenticated user (+ platform + /// roles). Cached ~60s to avoid a gRPC round-trip per request. + pub async fn verify_token(&self, token: &str) -> Result { + let key = token_hash(token); + let ttl = std::time::Duration::from_secs(AUTH_CACHE_TTL_SECS); + + // Read under the lock, clone out, and drop the guard before any `.await`. + if let Some(u) = { + let cache = self.cache.read().await; + cache + .get(&key) + .and_then(|(u, at)| (at.elapsed() < ttl).then(|| u.clone())) + } { + return Ok(u); + } + + let mut client = self.inner.clone(); + let resp = client + .verify_token(VerifyTokenRequest { + token: token.to_string(), + include_user_roles: true, // platform roles; service roles stay local + role_scopes: vec![], + role_names: vec![], + }) + .await? + .into_inner(); + + // Gate on `success` first, then unwrap the option. The verified user + // is carried on `AuthenticationResponse.authenticated_user`. + if !resp.success { + return Err(Error::Unauthorized); + } + let user = resp.authenticated_user.ok_or(Error::Unauthorized)?; + + self.cache + .write() + .await + .insert(key, (user.clone(), std::time::Instant::now())); + Ok(user) + } + + /// Authenticate by identifier (email/phone) + password (`Login` RPC). + /// Returns `TwoFactor` when aura-users requires an OTP step, + /// `Authenticated` (with a session token) on success, or `Failed`. + pub async fn login(&self, identifier: &str, password: &str) -> Result { + let mut client = self.inner.clone(); + let resp = client + .login(LoginRequest { + user_identifier: identifier.to_string(), + password: password.to_string(), + app_hash: String::new(), + device_info: None, + }) + .await? + .into_inner(); + Ok(interpret_auth_response(resp)) + } + + /// Complete a two-factor challenge with the OTP code (`VerifyTwoFactor` + /// RPC), returning the authenticated session on success. + pub async fn verify_two_factor(&self, two_factor_id: &str, code: &str) -> Result { + let mut client = self.inner.clone(); + let resp = client + .verify_two_factor(VerifyTwoFactorRequest { + two_factor_id: two_factor_id.to_string(), + code: code.to_string(), + device_info: None, + }) + .await? + .into_inner(); + Ok(interpret_auth_response(resp)) + } + + /// Resolve a st-peter user by exact identifier (email / phone / handle). + /// + /// Typical use: a service-admin role-grant page — resolve a colleague's + /// email to a st-peter `user_id`, then store a local role row referencing + /// that id by value. + /// + /// `LookupUser` requires an authenticated actor — pass the acting user's + /// own `user_id` + session `token`. Returns `None` when not found. + pub async fn lookup_user( + &self, + actor_user_id: &str, + actor_token: &str, + identifier: &str, + ) -> Result> { + let mut client = self.inner.clone(); + let resp = client + .lookup_user(LookupUserRequest { + user_id: actor_user_id.to_string(), + user_token: actor_token.to_string(), + identifier: identifier.to_string(), + }) + .await? + .into_inner(); + if !resp.success { + return Ok(None); + } + Ok(resp.user) + } +} + +/// Extract a `Bearer ` from an `Authorization` header map. The shared +/// convention across aura services is: Bearer header first, then the +/// [`COOKIE_NAME`] session cookie. +pub fn bearer(headers: &http::HeaderMap) -> Option { + headers + .get(http::header::AUTHORIZATION)? + .to_str() + .ok()? + .strip_prefix("Bearer ") + .map(|s| s.trim().to_string()) +} + +/// Fast (non-cryptographic) hash of the token, used only as the cache key. +fn token_hash(token: &str) -> u64 { + use std::hash::{Hash, Hasher}; + let mut h = std::collections::hash_map::DefaultHasher::new(); + token.hash(&mut h); + h.finish() +} diff --git a/scripts/gen-go.sh b/scripts/gen-go.sh new file mode 100755 index 0000000..12ac127 --- /dev/null +++ b/scripts/gen-go.sh @@ -0,0 +1,32 @@ +#!/usr/bin/env bash +# Generate Go gRPC stubs from the vendored proto into go/genpb/auth. +# The proto's in-file `option go_package` targets the server's module; the +# M-flag mapping here overrides it for this client module. +set -euo pipefail + +here="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" +cd "$here/go" +export PATH="$(go env GOPATH)/bin:$PATH" +MOD=git.awesomike.com/pub/st-peter-client/go + +# proto filename (relative to ../proto) -> Go package dir under the module +protos=( + st-peter-auth.proto:genpb/auth +) + +files=() +mflags=() +for entry in "${protos[@]}"; do + f="${entry%%:*}"; pkg="${entry##*:}" + files+=("$f") + mflags+=("--go_opt=M$f=$MOD/$pkg" "--go-grpc_opt=M$f=$MOD/$pkg") +done + +rm -rf genpb +protoc -I ../proto \ + --go_out=. --go_opt=module="$MOD" \ + --go-grpc_out=. --go-grpc_opt=module="$MOD" \ + "${mflags[@]}" \ + "${files[@]}" + +echo "Generated Go stubs under go/genpb/" diff --git a/scripts/gen-ts.sh b/scripts/gen-ts.sh new file mode 100755 index 0000000..3a3e2e7 --- /dev/null +++ b/scripts/gen-ts.sh @@ -0,0 +1,24 @@ +#!/usr/bin/env bash +# Generate TypeScript gRPC stubs from the vendored proto into ts/src/genpb, +# using ts-proto with @grpc/grpc-js service output. +set -euo pipefail + +here="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" +cd "$here/ts" + +plugin="node_modules/.bin/protoc-gen-ts_proto" +if [[ ! -x "$plugin" ]]; then + echo "ts-proto not installed; run 'npm install' in ts/ first" >&2 + exit 1 +fi + +out="src/genpb" +rm -rf "$out"; mkdir -p "$out" + +protoc -I ../proto \ + --plugin=protoc-gen-ts_proto="$plugin" \ + --ts_proto_out="$out" \ + --ts_proto_opt=outputServices=grpc-js,esModuleInterop=true,env=node,useExactTypes=false,unrecognizedEnum=false \ + st-peter-auth.proto + +echo "Generated TypeScript stubs under ts/src/genpb/" diff --git a/scripts/sync-protos.sh b/scripts/sync-protos.sh new file mode 100755 index 0000000..36d1a5b --- /dev/null +++ b/scripts/sync-protos.sh @@ -0,0 +1,51 @@ +#!/usr/bin/env bash +# +# Sync the canonical .proto files from the st-peter server repo into this +# client repo's proto/ directory. +# +# The st-peter server repo is the SOURCE OF TRUTH for the wire contract. +# This repo vendors copies so the Go / TS / Rust clients can each generate +# stubs without depending on the server's Cargo workspace. Run this whenever +# the server's protos change, then re-run codegen and tag at the SAME version +# as the st-peter release (see VERSION). +# +# Usage: +# ST_PETER_REPO=/path/to/st-peter-lib ./scripts/sync-protos.sh +# Defaults to ../st-peter-lib relative to this repo. + +set -euo pipefail + +here="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" +ST_PETER_REPO="${ST_PETER_REPO:-$here/../st-peter-lib}" + +if [[ ! -f "$ST_PETER_REPO/Cargo.toml" ]]; then + echo "ERROR: st-peter repo not found at '$ST_PETER_REPO'." >&2 + echo " Set ST_PETER_REPO=/path/to/st-peter-lib and re-run." >&2 + exit 1 +fi + +# canonical path in st-peter-lib -> filename in proto/ +# NOTE: st-peter-admin.proto (the admin surface) and health.proto are +# intentionally NOT vendored — services authenticate users; they do not +# administer st-peter. +protos=( + "proto/st-peter-auth.proto" +) + +dest="$here/proto" +mkdir -p "$dest" +for rel in "${protos[@]}"; do + src="$ST_PETER_REPO/$rel" + [[ -f "$src" ]] || { echo "ERROR: missing $src" >&2; exit 1; } + cp "$src" "$dest/$(basename "$rel")" + echo "synced $(basename "$rel")" +done + +# Keep VERSION in lockstep with the st-peter workspace version. +sp_version="$(grep -m1 '^version' "$ST_PETER_REPO/Cargo.toml" | sed -E 's/.*"([^"]+)".*/\1/')" +if [[ -n "$sp_version" ]]; then + echo "$sp_version" > "$here/VERSION" + echo "VERSION -> $sp_version (matched st-peter workspace)" +fi + +echo "Done. Re-run codegen (scripts/gen-*.sh) and tag at v$(cat "$here/VERSION")." diff --git a/ts/README.md b/ts/README.md new file mode 100644 index 0000000..649679b --- /dev/null +++ b/ts/README.md @@ -0,0 +1,14 @@ +# @st-peter/client (TypeScript) + +Official TypeScript client for st-peter (aura-users). Generated stubs are +committed under `src/genpb/` (regenerate with `npm run gen`); the +`StPeterAuthClient` wrapper (token-verify cache, login/2FA/lookup) is layered +on top, with the raw wire surface re-exported as `authpb`. + +```ts +const auth = StPeterAuthClient.connect("127.0.0.1:9091"); +const user = await auth.verifyToken(token); // cached ~60s +``` + +See the repo root README for versioning and the +authentication-central / authorization-local design. diff --git a/ts/package-lock.json b/ts/package-lock.json new file mode 100644 index 0000000..47fe871 --- /dev/null +++ b/ts/package-lock.json @@ -0,0 +1,447 @@ +{ + "name": "@st-peter/client", + "version": "0.2.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "@st-peter/client", + "version": "0.2.0", + "license": "MIT OR Apache-2.0", + "dependencies": { + "@grpc/grpc-js": "^1.12.0", + "long": "^5.2.3" + }, + "devDependencies": { + "@types/node": "^22.0.0", + "ts-proto": "^2.6.0", + "typescript": "^5.6.0" + } + }, + "node_modules/@bufbuild/protobuf": { + "version": "2.12.0", + "resolved": "https://registry.npmjs.org/@bufbuild/protobuf/-/protobuf-2.12.0.tgz", + "integrity": "sha512-B/XlCaFIP8LOwzo+bz5uFzATYokcwCKQcghqnlfwSmM5eX/qTkvDBnDPs+gXtX/RyjxJ4DRikECcPJbyALA8FA==", + "dev": true, + "license": "(Apache-2.0 AND BSD-3-Clause)" + }, + "node_modules/@grpc/grpc-js": { + "version": "1.14.4", + "resolved": "https://registry.npmjs.org/@grpc/grpc-js/-/grpc-js-1.14.4.tgz", + "integrity": "sha512-k9Dj3DV/itK9D06Y8f190Qgop7/Ui+D0njFV3LHMPwPT75DpXLQohE9Wmz0QElrJnzsjB7KPWiKJbOl7IPDArQ==", + "license": "Apache-2.0", + "dependencies": { + "@grpc/proto-loader": "^0.8.0", + "@js-sdsl/ordered-map": "^4.4.2" + }, + "engines": { + "node": ">=12.10.0" + } + }, + "node_modules/@grpc/proto-loader": { + "version": "0.8.1", + "resolved": "https://registry.npmjs.org/@grpc/proto-loader/-/proto-loader-0.8.1.tgz", + "integrity": "sha512-wtF6h+DY6M3YaDBPAmvuuA6jV8Sif9MjtOI5euKFWRgCDl5PeDpPsHR9u2l6St5ceY8AZgoNDww5+HvEsXFsGg==", + "license": "Apache-2.0", + "dependencies": { + "lodash.camelcase": "^4.3.0", + "long": "^5.0.0", + "protobufjs": "^7.5.5", + "yargs": "^17.7.2" + }, + "bin": { + "proto-loader-gen-types": "build/bin/proto-loader-gen-types.js" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/@js-sdsl/ordered-map": { + "version": "4.4.2", + "resolved": "https://registry.npmjs.org/@js-sdsl/ordered-map/-/ordered-map-4.4.2.tgz", + "integrity": "sha512-iUKgm52T8HOE/makSxjqoWhe95ZJA1/G1sYsGev2JDKUSS14KAgg1LHb+Ba+IPow0xflbnSkOsZcO08C7w1gYw==", + "license": "MIT", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/js-sdsl" + } + }, + "node_modules/@protobufjs/aspromise": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@protobufjs/aspromise/-/aspromise-1.1.2.tgz", + "integrity": "sha512-j+gKExEuLmKwvz3OgROXtrJ2UG2x8Ch2YZUxahh+s1F2HZ+wAceUNLkvy6zKCPVRkU++ZWQrdxsUeQXmcg4uoQ==", + "license": "BSD-3-Clause" + }, + "node_modules/@protobufjs/base64": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@protobufjs/base64/-/base64-1.1.2.tgz", + "integrity": "sha512-AZkcAA5vnN/v4PDqKyMR5lx7hZttPDgClv83E//FMNhR2TMcLUhfRUBHCmSl0oi9zMgDDqRUJkSxO3wm85+XLg==", + "license": "BSD-3-Clause" + }, + "node_modules/@protobufjs/codegen": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@protobufjs/codegen/-/codegen-2.0.5.tgz", + "integrity": "sha512-zgXFLzW3Ap33e6d0Wlj4MGIm6Ce8O89n/apUaGNB/jx+hw+ruWEp7EwGUshdLKVRCxZW12fp9r40E1mQrf/34g==", + "license": "BSD-3-Clause" + }, + "node_modules/@protobufjs/eventemitter": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@protobufjs/eventemitter/-/eventemitter-1.1.1.tgz", + "integrity": "sha512-vW1GmwMZNnL+gMRaovlh9yZX74kc+TTU3FObkkurpMaRtBfLP3ldjS9KQWlwZgraRE0+dheEEoAxdzcJQ8eXZg==", + "license": "BSD-3-Clause" + }, + "node_modules/@protobufjs/fetch": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@protobufjs/fetch/-/fetch-1.1.1.tgz", + "integrity": "sha512-GpptLrs57adMSuHi3VNj0mAF8dwh36LMaYF6XyJ6JMWlVsc+t42tm1HSEDmOs3A8fC9yyeisgLhsTVQokOZ0zw==", + "license": "BSD-3-Clause", + "dependencies": { + "@protobufjs/aspromise": "^1.1.1" + } + }, + "node_modules/@protobufjs/float": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/@protobufjs/float/-/float-1.0.2.tgz", + "integrity": "sha512-Ddb+kVXlXst9d+R9PfTIxh1EdNkgoRe5tOX6t01f1lYWOvJnSPDBlG241QLzcyPdoNTsblLUdujGSE4RzrTZGQ==", + "license": "BSD-3-Clause" + }, + "node_modules/@protobufjs/inquire": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@protobufjs/inquire/-/inquire-1.1.2.tgz", + "integrity": "sha512-pa0vFRuws4wkvaXKK1uXZMAwAX4/t8ANaJo45iw/oQHNQ9q5xUzwgFmVJGXiga2BeN+zpX7Vf9vmsiIa2J+MUw==", + "license": "BSD-3-Clause" + }, + "node_modules/@protobufjs/path": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@protobufjs/path/-/path-1.1.2.tgz", + "integrity": "sha512-6JOcJ5Tm08dOHAbdR3GrvP+yUUfkjG5ePsHYczMFLq3ZmMkAD98cDgcT2iA1lJ9NVwFd4tH/iSSoe44YWkltEA==", + "license": "BSD-3-Clause" + }, + "node_modules/@protobufjs/pool": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@protobufjs/pool/-/pool-1.1.0.tgz", + "integrity": "sha512-0kELaGSIDBKvcgS4zkjz1PeddatrjYcmMWOlAuAPwAeccUrPHdUqo/J6LiymHHEiJT5NrF1UVwxY14f+fy4WQw==", + "license": "BSD-3-Clause" + }, + "node_modules/@protobufjs/utf8": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@protobufjs/utf8/-/utf8-1.1.1.tgz", + "integrity": "sha512-oOAWABowe8EAbMyWKM0tYDKi8Yaox52D+HWZhAIJqQXbqe0xI/GV7FhLWqlEKreMkfDjshR5FKgi3mnle0h6Eg==", + "license": "BSD-3-Clause" + }, + "node_modules/@types/node": { + "version": "22.19.20", + "resolved": "https://registry.npmjs.org/@types/node/-/node-22.19.20.tgz", + "integrity": "sha512-6tELRwSDYWW9EdZhbeZmYGZ1/7Djkt+Ah3/ScEYT9cDord7UJzasR/4D3VONg9tQI5CDp+/CZC1AXj2pCFOvpw==", + "license": "MIT", + "dependencies": { + "undici-types": "~6.21.0" + } + }, + "node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "license": "MIT", + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/case-anything": { + "version": "2.1.13", + "resolved": "https://registry.npmjs.org/case-anything/-/case-anything-2.1.13.tgz", + "integrity": "sha512-zlOQ80VrQ2Ue+ymH5OuM/DlDq64mEm+B9UTdHULv5osUMD6HalNTblf2b1u/m6QecjsnOkBpqVZ+XPwIVsy7Ng==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12.13" + }, + "funding": { + "url": "https://github.com/sponsors/mesqueeb" + } + }, + "node_modules/cliui": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz", + "integrity": "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==", + "license": "ISC", + "dependencies": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.1", + "wrap-ansi": "^7.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "license": "MIT", + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "license": "MIT" + }, + "node_modules/detect-libc": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-1.0.3.tgz", + "integrity": "sha512-pGjwhsmsp4kL2RTz08wcOlGN83otlqHeD/Z5T8GXZB+/YcpQ/dgo+lbU8ZsGxV0HIvqqxo9l7mqYwyYMD9bKDg==", + "dev": true, + "license": "Apache-2.0", + "bin": { + "detect-libc": "bin/detect-libc.js" + }, + "engines": { + "node": ">=0.10" + } + }, + "node_modules/dprint-node": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/dprint-node/-/dprint-node-1.0.8.tgz", + "integrity": "sha512-iVKnUtYfGrYcW1ZAlfR/F59cUVL8QIhWoBJoSjkkdua/dkWIgjZfiLMeTjiB06X0ZLkQ0M2C1VbUj/CxkIf1zg==", + "dev": true, + "license": "MIT", + "dependencies": { + "detect-libc": "^1.0.3" + } + }, + "node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "license": "MIT" + }, + "node_modules/escalade": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz", + "integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==", + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/get-caller-file": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", + "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", + "license": "ISC", + "engines": { + "node": "6.* || 8.* || >= 10.*" + } + }, + "node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/lodash.camelcase": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/lodash.camelcase/-/lodash.camelcase-4.3.0.tgz", + "integrity": "sha512-TwuEnCnxbc3rAvhf/LbG7tJUDzhqXyFnv3dtzLOPgCG/hODL7WFnsbwktkD7yUV0RrreP/l1PALq/YSg6VvjlA==", + "license": "MIT" + }, + "node_modules/long": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/long/-/long-5.3.2.tgz", + "integrity": "sha512-mNAgZ1GmyNhD7AuqnTG3/VQ26o760+ZYBPKjPvugO8+nLbYfX6TVpJPseBvopbdY+qpZ/lKUnmEc1LeZYS3QAA==", + "license": "Apache-2.0" + }, + "node_modules/protobufjs": { + "version": "7.6.3", + "resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-7.6.3.tgz", + "integrity": "sha512-+k0vdJKNdW+Vu+dYe8tZA/VvQb6XKNWexC6URwBFXxNnjLJz9nQJCemGyNgRAWD+B7+nGNc9qMPGwcD7s4nzUw==", + "hasInstallScript": true, + "license": "BSD-3-Clause", + "dependencies": { + "@protobufjs/aspromise": "^1.1.2", + "@protobufjs/base64": "^1.1.2", + "@protobufjs/codegen": "^2.0.5", + "@protobufjs/eventemitter": "^1.1.1", + "@protobufjs/fetch": "^1.1.1", + "@protobufjs/float": "^1.0.2", + "@protobufjs/inquire": "^1.1.2", + "@protobufjs/path": "^1.1.2", + "@protobufjs/pool": "^1.1.0", + "@protobufjs/utf8": "^1.1.1", + "@types/node": ">=13.7.0", + "long": "^5.3.2" + }, + "engines": { + "node": ">=12.0.0" + } + }, + "node_modules/require-directory": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", + "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "license": "MIT", + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "license": "MIT", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/ts-poet": { + "version": "6.12.0", + "resolved": "https://registry.npmjs.org/ts-poet/-/ts-poet-6.12.0.tgz", + "integrity": "sha512-xo+iRNMWqyvXpFTaOAvLPA5QAWO6TZrSUs5s4Odaya3epqofBu/fMLHEWl8jPmjhA0s9sgj9sNvF1BmaQlmQkA==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "dprint-node": "^1.0.8" + } + }, + "node_modules/ts-proto": { + "version": "2.11.8", + "resolved": "https://registry.npmjs.org/ts-proto/-/ts-proto-2.11.8.tgz", + "integrity": "sha512-+5hzECnyVB33jxjG1BIdzAHcRBm7hjnm8womdJVp2A7xJWihP0drHHVsXYTr9i/LpWNGfh80I+AVVNzFM5AwJw==", + "dev": true, + "license": "ISC", + "dependencies": { + "@bufbuild/protobuf": "^2.10.2", + "case-anything": "^2.1.13", + "ts-poet": "^6.12.0", + "ts-proto-descriptors": "2.1.0" + }, + "bin": { + "protoc-gen-ts_proto": "protoc-gen-ts_proto" + } + }, + "node_modules/ts-proto-descriptors": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/ts-proto-descriptors/-/ts-proto-descriptors-2.1.0.tgz", + "integrity": "sha512-S5EZYEQ6L9KLFfjSRpZWDIXDV/W7tAj8uW7pLsihIxyr62EAVSiKuVPwE8iWnr849Bqa53enex1jhDUcpgquzA==", + "dev": true, + "license": "ISC", + "dependencies": { + "@bufbuild/protobuf": "^2.0.0" + } + }, + "node_modules/typescript": { + "version": "5.9.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz", + "integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==", + "dev": true, + "license": "Apache-2.0", + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } + }, + "node_modules/undici-types": { + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.21.0.tgz", + "integrity": "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==", + "license": "MIT" + }, + "node_modules/wrap-ansi": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "node_modules/y18n": { + "version": "5.0.8", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", + "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", + "license": "ISC", + "engines": { + "node": ">=10" + } + }, + "node_modules/yargs": { + "version": "17.7.2", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz", + "integrity": "sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==", + "license": "MIT", + "dependencies": { + "cliui": "^8.0.1", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "require-directory": "^2.1.1", + "string-width": "^4.2.3", + "y18n": "^5.0.5", + "yargs-parser": "^21.1.1" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/yargs-parser": { + "version": "21.1.1", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz", + "integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==", + "license": "ISC", + "engines": { + "node": ">=12" + } + } + } +} diff --git a/ts/package.json b/ts/package.json new file mode 100644 index 0000000..2962ec1 --- /dev/null +++ b/ts/package.json @@ -0,0 +1,25 @@ +{ + "name": "@st-peter/client", + "version": "0.2.0", + "description": "Official TypeScript client for st-peter (aura-users) — authentication over gRPC with a token-verify cache", + "repository": "https://git.awesomike.com/pub/st-peter-client", + "license": "MIT OR Apache-2.0", + "type": "commonjs", + "main": "dist/index.js", + "types": "dist/index.d.ts", + "files": ["dist", "src"], + "scripts": { + "gen": "../scripts/gen-ts.sh", + "build": "tsc -p tsconfig.json", + "prepublishOnly": "npm run build" + }, + "dependencies": { + "@grpc/grpc-js": "^1.12.0", + "long": "^5.2.3" + }, + "devDependencies": { + "ts-proto": "^2.6.0", + "typescript": "^5.6.0", + "@types/node": "^22.0.0" + } +} diff --git a/ts/src/auth.ts b/ts/src/auth.ts new file mode 100644 index 0000000..8c4e42e --- /dev/null +++ b/ts/src/auth.ts @@ -0,0 +1,202 @@ +/** + * Official TypeScript client for st-peter (aura-users) — the central + * authentication service. + * + * Design: authentication central, authorization local. st-peter answers + * *who is this token?* — it returns the verified identity plus the user's + * platform roles. What that identity may do inside a consuming service is + * that service's own concern: keep a local roles table keyed by the + * st-peter user id by value (no cross-DB FK) and map permissions there. + * This package deliberately ships no session/permission types. + * + * ```ts + * const auth = StPeterAuthClient.connect("127.0.0.1:9091"); + * const user = await auth.verifyToken(token); // cached ~60s + * ``` + */ + +import * as grpc from "@grpc/grpc-js"; +import { + AuthServiceClient, + AuthenticatedUser, + AuthenticationResponse, + LoginRequest, + LookupUserRequest, + LookupUserResponse, + User, + VerifyTokenRequest, + VerifyTwoFactorRequest, +} from "./genpb/st-peter-auth"; + +/** + * Session cookie name issued by aura-users on login. Shared convention + * across the aura services so a session works on any of them. + */ +export const COOKIE_NAME = "aura_session"; + +/** + * TTL for cached token verifications. A revoked token stays "valid" for up + * to this long — logout flows must not rely on the cache. + */ +const AUTH_CACHE_TTL_MS = 60_000; + +/** Thrown when a token fails verification (or the response carries no user). */ +export class UnauthorizedError extends Error { + constructor() { + super("unauthorized"); + this.name = "UnauthorizedError"; + } +} + +/** Outcome of a `login` (or `verifyTwoFactor`) call against aura-users. */ +export type LoginOutcome = + /** Authenticated — a login bridge sets the COOKIE_NAME cookie from `user.token`. */ + | { kind: "authenticated"; user: AuthenticatedUser } + /** aura-users issued an OTP challenge; collect the code, call `verifyTwoFactor`. */ + | { kind: "two_factor"; twoFactorId: string } + /** Login failed (bad credentials, locked out, …) — carries a display message. */ + | { kind: "failed"; message: string }; + +/** + * Map a st-peter AuthenticationResponse to a LoginOutcome (shared by + * `login` and `verifyTwoFactor`): 2FA-required first, then success, else fail. + */ +function interpretAuthResponse(resp: AuthenticationResponse): LoginOutcome { + if (resp.passCodeRequired) { + return { kind: "two_factor", twoFactorId: resp.twoFactorId }; + } + if (resp.success && resp.authenticatedUser) { + return { kind: "authenticated", user: resp.authenticatedUser }; + } + return { + kind: "failed", + message: resp.message || "Invalid email or password.", + }; +} + +/** Options for `StPeterAuthClient.connect`. */ +export interface ConnectOptions { + /** Channel credentials. Defaults to `grpc.credentials.createInsecure()`. */ + credentials?: grpc.ChannelCredentials; + /** Extra gRPC channel options. */ + channelOptions?: grpc.ChannelOptions; +} + +/** Promisify a unary grpc-js call. */ +function call( + fn: (req: Req, cb: (err: grpc.ServiceError | null, res: Res) => void) => unknown, + req: Req +): Promise { + return new Promise((resolve, reject) => + fn(req, (err, res) => (err ? reject(err) : resolve(res))) + ); +} + +/** + * Thin client to aura-users' AuthService with a small token-verify cache. + * Safe to share across async tasks — the underlying grpc-js channel is + * reference-counted. + */ +export class StPeterAuthClient { + private readonly svc: AuthServiceClient; + private readonly cache = new Map(); + + private constructor(svc: AuthServiceClient) { + this.svc = svc; + } + + /** + * Connect to aura-users gRPC (internal address, e.g. `127.0.0.1:9091` — + * grpc-js targets carry no scheme). The dial is lazy: failures surface on + * the first call, not at connect time. + */ + static connect(target: string, opts: ConnectOptions = {}): StPeterAuthClient { + const creds = opts.credentials ?? grpc.credentials.createInsecure(); + return new StPeterAuthClient(new AuthServiceClient(target, creds, opts.channelOptions)); + } + + /** Tear down the underlying gRPC channel. */ + close(): void { + this.svc.close(); + } + + /** + * Verify a session token, returning the authenticated user (+ platform + * roles). Cached ~60s to avoid a gRPC round-trip per request. Throws + * `UnauthorizedError` on a bad token. + */ + async verifyToken(token: string): Promise { + const hit = this.cache.get(token); + if (hit && Date.now() - hit.at < AUTH_CACHE_TTL_MS) { + return hit.user; + } + + const resp = await call( + this.svc.verifyToken.bind(this.svc), + VerifyTokenRequest.fromPartial({ + token, + includeUserRoles: true, // platform roles; service roles stay local + }) + ); + + // Gate on `success` first, then the user. The verified user is carried + // on AuthenticationResponse.authenticated_user. + if (!resp.success || !resp.authenticatedUser) { + throw new UnauthorizedError(); + } + this.cache.set(token, { user: resp.authenticatedUser, at: Date.now() }); + return resp.authenticatedUser; + } + + /** Authenticate by identifier (email/phone) + password (`Login` RPC). */ + async login(identifier: string, password: string): Promise { + const resp = await call( + this.svc.login.bind(this.svc), + LoginRequest.fromPartial({ userIdentifier: identifier, password }) + ); + return interpretAuthResponse(resp); + } + + /** + * Complete a two-factor challenge with the OTP code, returning the + * authenticated session on success. + */ + async verifyTwoFactor(twoFactorId: string, code: string): Promise { + const resp = await call( + this.svc.verifyTwoFactor.bind(this.svc), + VerifyTwoFactorRequest.fromPartial({ twoFactorId, code }) + ); + return interpretAuthResponse(resp); + } + + /** + * Resolve a st-peter user by exact identifier (email / phone / handle). + * Requires an authenticated actor — pass the acting user's own user id + + * session token. Returns `undefined` when not found. + */ + async lookupUser( + actorUserId: string, + actorToken: string, + identifier: string + ): Promise { + const resp = await call( + this.svc.lookupUser.bind(this.svc), + LookupUserRequest.fromPartial({ + userId: actorUserId, + userToken: actorToken, + identifier, + }) + ); + return resp.success ? resp.user : undefined; + } +} + +/** + * Extract a `Bearer ` from an Authorization header value. The shared + * convention across aura services is: Bearer header first, then the + * COOKIE_NAME session cookie. + */ +export function bearer(authorization: string | undefined): string | undefined { + if (!authorization?.startsWith("Bearer ")) return undefined; + return authorization.slice("Bearer ".length).trim(); +} diff --git a/ts/src/genpb/google/protobuf/timestamp.ts b/ts/src/genpb/google/protobuf/timestamp.ts new file mode 100644 index 0000000..91e816a --- /dev/null +++ b/ts/src/genpb/google/protobuf/timestamp.ts @@ -0,0 +1,226 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.11.8 +// protoc v7.34.1 +// source: google/protobuf/timestamp.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "google.protobuf"; + +/** + * A Timestamp represents a point in time independent of any time zone or local + * calendar, encoded as a count of seconds and fractions of seconds at + * nanosecond resolution. The count is relative to an epoch at UTC midnight on + * January 1, 1970, in the proleptic Gregorian calendar which extends the + * Gregorian calendar backwards to year one. + * + * All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap + * second table is needed for interpretation, using a [24-hour linear + * smear](https://developers.google.com/time/smear). + * + * The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By + * restricting to that range, we ensure that we can convert to and from [RFC + * 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings. + * + * # Examples + * + * Example 1: Compute Timestamp from POSIX `time()`. + * + * Timestamp timestamp; + * timestamp.set_seconds(time(NULL)); + * timestamp.set_nanos(0); + * + * Example 2: Compute Timestamp from POSIX `gettimeofday()`. + * + * struct timeval tv; + * gettimeofday(&tv, NULL); + * + * Timestamp timestamp; + * timestamp.set_seconds(tv.tv_sec); + * timestamp.set_nanos(tv.tv_usec * 1000); + * + * Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`. + * + * FILETIME ft; + * GetSystemTimeAsFileTime(&ft); + * UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime; + * + * // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z + * // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z. + * Timestamp timestamp; + * timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL)); + * timestamp.set_nanos((INT32) ((ticks % 10000000) * 100)); + * + * Example 4: Compute Timestamp from Java `System.currentTimeMillis()`. + * + * long millis = System.currentTimeMillis(); + * + * Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000) + * .setNanos((int) ((millis % 1000) * 1000000)).build(); + * + * Example 5: Compute Timestamp from Java `Instant.now()`. + * + * Instant now = Instant.now(); + * + * Timestamp timestamp = + * Timestamp.newBuilder().setSeconds(now.getEpochSecond()) + * .setNanos(now.getNano()).build(); + * + * Example 6: Compute Timestamp from current time in Python. + * + * timestamp = Timestamp() + * timestamp.GetCurrentTime() + * + * # JSON Mapping + * + * In JSON format, the Timestamp type is encoded as a string in the + * [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the + * format is "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z" + * where {year} is always expressed using four digits while {month}, {day}, + * {hour}, {min}, and {sec} are zero-padded to two digits each. The fractional + * seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution), + * are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone + * is required. A ProtoJSON serializer should always use UTC (as indicated by + * "Z") when printing the Timestamp type and a ProtoJSON parser should be + * able to accept both UTC and other timezones (as indicated by an offset). + * + * For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past + * 01:30 UTC on January 15, 2017. + * + * In JavaScript, one can convert a Date object to this format using the + * standard + * [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString) + * method. In Python, a standard `datetime.datetime` object can be converted + * to this format using + * [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with + * the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use + * the Joda Time's [`ISODateTimeFormat.dateTime()`]( + * http://joda-time.sourceforge.net/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime() + * ) to obtain a formatter capable of generating timestamps in this format. + */ +export interface Timestamp { + /** + * Represents seconds of UTC time since Unix epoch 1970-01-01T00:00:00Z. Must + * be between -62135596800 and 253402300799 inclusive (which corresponds to + * 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z). + */ + seconds: number; + /** + * Non-negative fractions of a second at nanosecond resolution. This field is + * the nanosecond portion of the duration, not an alternative to seconds. + * Negative second values with fractions must still have non-negative nanos + * values that count forward in time. Must be between 0 and 999,999,999 + * inclusive. + */ + nanos: number; +} + +function createBaseTimestamp(): Timestamp { + return { seconds: 0, nanos: 0 }; +} + +export const Timestamp: MessageFns = { + encode(message: Timestamp, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.seconds !== 0) { + writer.uint32(8).int64(message.seconds); + } + if (message.nanos !== 0) { + writer.uint32(16).int32(message.nanos); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Timestamp { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTimestamp(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.seconds = longToNumber(reader.int64()); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.nanos = reader.int32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Timestamp { + return { + seconds: isSet(object.seconds) ? globalThis.Number(object.seconds) : 0, + nanos: isSet(object.nanos) ? globalThis.Number(object.nanos) : 0, + }; + }, + + toJSON(message: Timestamp): unknown { + const obj: any = {}; + if (message.seconds !== 0) { + obj.seconds = Math.round(message.seconds); + } + if (message.nanos !== 0) { + obj.nanos = Math.round(message.nanos); + } + return obj; + }, + + create(base?: DeepPartial): Timestamp { + return Timestamp.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): Timestamp { + const message = createBaseTimestamp(); + message.seconds = object.seconds ?? 0; + message.nanos = object.nanos ?? 0; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create(base?: DeepPartial): T; + fromPartial(object: DeepPartial): T; +} diff --git a/ts/src/genpb/st-peter-auth.ts b/ts/src/genpb/st-peter-auth.ts new file mode 100644 index 0000000..56cdac9 --- /dev/null +++ b/ts/src/genpb/st-peter-auth.ts @@ -0,0 +1,10756 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.11.8 +// protoc v7.34.1 +// source: st-peter-auth.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { + type CallOptions, + type ChannelCredentials, + Client, + type ClientOptions, + type ClientUnaryCall, + type handleUnaryCall, + makeGenericClientConstructor, + type Metadata, + type ServiceError, + type UntypedServiceImplementation, +} from "@grpc/grpc-js"; +import { Timestamp } from "./google/protobuf/timestamp"; + +export const protobufPackage = "st_peter.auth"; + +export enum ResultCode { + RESULT_CODE_SUCCESS = 0, + RESULT_CODE_NOT_FOUND = 1, + RESULT_CODE_INTERNAL_SERVER_ERROR = 2, + RESULT_CODE_BAD_REQUEST = 3, + RESULT_CODE_NOT_AUTHORIZED = 4, + RESULT_CODE_FORBIDDEN = 5, + RESULT_CODE_VALIDATION_ERRORS = 6, + RESULT_CODE_PASSCODE_REQUIRED = 7, + RESULT_CODE_TOO_MANY_REQUESTS = 9, + RESULT_CODE_INVALID_CREDENTIALS = 8, + RESULT_CODE_INACTIVE_USER = 10, + RESULT_CODE_IDENTITY_IN_USE = 11, + RESULT_CODE_NEXT_STEP = 12, +} + +export function resultCodeFromJSON(object: any): ResultCode { + switch (object) { + case 0: + case "RESULT_CODE_SUCCESS": + return ResultCode.RESULT_CODE_SUCCESS; + case 1: + case "RESULT_CODE_NOT_FOUND": + return ResultCode.RESULT_CODE_NOT_FOUND; + case 2: + case "RESULT_CODE_INTERNAL_SERVER_ERROR": + return ResultCode.RESULT_CODE_INTERNAL_SERVER_ERROR; + case 3: + case "RESULT_CODE_BAD_REQUEST": + return ResultCode.RESULT_CODE_BAD_REQUEST; + case 4: + case "RESULT_CODE_NOT_AUTHORIZED": + return ResultCode.RESULT_CODE_NOT_AUTHORIZED; + case 5: + case "RESULT_CODE_FORBIDDEN": + return ResultCode.RESULT_CODE_FORBIDDEN; + case 6: + case "RESULT_CODE_VALIDATION_ERRORS": + return ResultCode.RESULT_CODE_VALIDATION_ERRORS; + case 7: + case "RESULT_CODE_PASSCODE_REQUIRED": + return ResultCode.RESULT_CODE_PASSCODE_REQUIRED; + case 9: + case "RESULT_CODE_TOO_MANY_REQUESTS": + return ResultCode.RESULT_CODE_TOO_MANY_REQUESTS; + case 8: + case "RESULT_CODE_INVALID_CREDENTIALS": + return ResultCode.RESULT_CODE_INVALID_CREDENTIALS; + case 10: + case "RESULT_CODE_INACTIVE_USER": + return ResultCode.RESULT_CODE_INACTIVE_USER; + case 11: + case "RESULT_CODE_IDENTITY_IN_USE": + return ResultCode.RESULT_CODE_IDENTITY_IN_USE; + case 12: + case "RESULT_CODE_NEXT_STEP": + return ResultCode.RESULT_CODE_NEXT_STEP; + default: + throw new globalThis.Error("Unrecognized enum value " + object + " for enum ResultCode"); + } +} + +export function resultCodeToJSON(object: ResultCode): string { + switch (object) { + case ResultCode.RESULT_CODE_SUCCESS: + return "RESULT_CODE_SUCCESS"; + case ResultCode.RESULT_CODE_NOT_FOUND: + return "RESULT_CODE_NOT_FOUND"; + case ResultCode.RESULT_CODE_INTERNAL_SERVER_ERROR: + return "RESULT_CODE_INTERNAL_SERVER_ERROR"; + case ResultCode.RESULT_CODE_BAD_REQUEST: + return "RESULT_CODE_BAD_REQUEST"; + case ResultCode.RESULT_CODE_NOT_AUTHORIZED: + return "RESULT_CODE_NOT_AUTHORIZED"; + case ResultCode.RESULT_CODE_FORBIDDEN: + return "RESULT_CODE_FORBIDDEN"; + case ResultCode.RESULT_CODE_VALIDATION_ERRORS: + return "RESULT_CODE_VALIDATION_ERRORS"; + case ResultCode.RESULT_CODE_PASSCODE_REQUIRED: + return "RESULT_CODE_PASSCODE_REQUIRED"; + case ResultCode.RESULT_CODE_TOO_MANY_REQUESTS: + return "RESULT_CODE_TOO_MANY_REQUESTS"; + case ResultCode.RESULT_CODE_INVALID_CREDENTIALS: + return "RESULT_CODE_INVALID_CREDENTIALS"; + case ResultCode.RESULT_CODE_INACTIVE_USER: + return "RESULT_CODE_INACTIVE_USER"; + case ResultCode.RESULT_CODE_IDENTITY_IN_USE: + return "RESULT_CODE_IDENTITY_IN_USE"; + case ResultCode.RESULT_CODE_NEXT_STEP: + return "RESULT_CODE_NEXT_STEP"; + default: + throw new globalThis.Error("Unrecognized enum value " + object + " for enum ResultCode"); + } +} + +export enum ChannelType { + CHANNEL_TYPE_UNSPECIFIED = 0, + CHANNEL_TYPE_EMAIL = 1, + CHANNEL_TYPE_SMS = 2, +} + +export function channelTypeFromJSON(object: any): ChannelType { + switch (object) { + case 0: + case "CHANNEL_TYPE_UNSPECIFIED": + return ChannelType.CHANNEL_TYPE_UNSPECIFIED; + case 1: + case "CHANNEL_TYPE_EMAIL": + return ChannelType.CHANNEL_TYPE_EMAIL; + case 2: + case "CHANNEL_TYPE_SMS": + return ChannelType.CHANNEL_TYPE_SMS; + default: + throw new globalThis.Error("Unrecognized enum value " + object + " for enum ChannelType"); + } +} + +export function channelTypeToJSON(object: ChannelType): string { + switch (object) { + case ChannelType.CHANNEL_TYPE_UNSPECIFIED: + return "CHANNEL_TYPE_UNSPECIFIED"; + case ChannelType.CHANNEL_TYPE_EMAIL: + return "CHANNEL_TYPE_EMAIL"; + case ChannelType.CHANNEL_TYPE_SMS: + return "CHANNEL_TYPE_SMS"; + default: + throw new globalThis.Error("Unrecognized enum value " + object + " for enum ChannelType"); + } +} + +export enum VerificationCodeType { + VERIFICATION_CODE_TYPE_UNSPECIFIED = 0, + VERIFICATION_CODE_TYPE_REGISTER = 1, + VERIFICATION_CODE_TYPE_PASSWORD_RESET = 2, + VERIFICATION_CODE_TYPE_OTP_LOGIN = 3, +} + +export function verificationCodeTypeFromJSON(object: any): VerificationCodeType { + switch (object) { + case 0: + case "VERIFICATION_CODE_TYPE_UNSPECIFIED": + return VerificationCodeType.VERIFICATION_CODE_TYPE_UNSPECIFIED; + case 1: + case "VERIFICATION_CODE_TYPE_REGISTER": + return VerificationCodeType.VERIFICATION_CODE_TYPE_REGISTER; + case 2: + case "VERIFICATION_CODE_TYPE_PASSWORD_RESET": + return VerificationCodeType.VERIFICATION_CODE_TYPE_PASSWORD_RESET; + case 3: + case "VERIFICATION_CODE_TYPE_OTP_LOGIN": + return VerificationCodeType.VERIFICATION_CODE_TYPE_OTP_LOGIN; + default: + throw new globalThis.Error("Unrecognized enum value " + object + " for enum VerificationCodeType"); + } +} + +export function verificationCodeTypeToJSON(object: VerificationCodeType): string { + switch (object) { + case VerificationCodeType.VERIFICATION_CODE_TYPE_UNSPECIFIED: + return "VERIFICATION_CODE_TYPE_UNSPECIFIED"; + case VerificationCodeType.VERIFICATION_CODE_TYPE_REGISTER: + return "VERIFICATION_CODE_TYPE_REGISTER"; + case VerificationCodeType.VERIFICATION_CODE_TYPE_PASSWORD_RESET: + return "VERIFICATION_CODE_TYPE_PASSWORD_RESET"; + case VerificationCodeType.VERIFICATION_CODE_TYPE_OTP_LOGIN: + return "VERIFICATION_CODE_TYPE_OTP_LOGIN"; + default: + throw new globalThis.Error("Unrecognized enum value " + object + " for enum VerificationCodeType"); + } +} + +/** OAuth Provider enumeration */ +export enum OAuthProvider { + OAUTH_PROVIDER_UNSPECIFIED = 0, + OAUTH_PROVIDER_GOOGLE = 1, + OAUTH_PROVIDER_APPLE = 2, + OAUTH_PROVIDER_FACEBOOK = 3, + OAUTH_PROVIDER_MICROSOFT = 4, +} + +export function oAuthProviderFromJSON(object: any): OAuthProvider { + switch (object) { + case 0: + case "OAUTH_PROVIDER_UNSPECIFIED": + return OAuthProvider.OAUTH_PROVIDER_UNSPECIFIED; + case 1: + case "OAUTH_PROVIDER_GOOGLE": + return OAuthProvider.OAUTH_PROVIDER_GOOGLE; + case 2: + case "OAUTH_PROVIDER_APPLE": + return OAuthProvider.OAUTH_PROVIDER_APPLE; + case 3: + case "OAUTH_PROVIDER_FACEBOOK": + return OAuthProvider.OAUTH_PROVIDER_FACEBOOK; + case 4: + case "OAUTH_PROVIDER_MICROSOFT": + return OAuthProvider.OAUTH_PROVIDER_MICROSOFT; + default: + throw new globalThis.Error("Unrecognized enum value " + object + " for enum OAuthProvider"); + } +} + +export function oAuthProviderToJSON(object: OAuthProvider): string { + switch (object) { + case OAuthProvider.OAUTH_PROVIDER_UNSPECIFIED: + return "OAUTH_PROVIDER_UNSPECIFIED"; + case OAuthProvider.OAUTH_PROVIDER_GOOGLE: + return "OAUTH_PROVIDER_GOOGLE"; + case OAuthProvider.OAUTH_PROVIDER_APPLE: + return "OAUTH_PROVIDER_APPLE"; + case OAuthProvider.OAUTH_PROVIDER_FACEBOOK: + return "OAUTH_PROVIDER_FACEBOOK"; + case OAuthProvider.OAUTH_PROVIDER_MICROSOFT: + return "OAUTH_PROVIDER_MICROSOFT"; + default: + throw new globalThis.Error("Unrecognized enum value " + object + " for enum OAuthProvider"); + } +} + +export enum IdentityField { + IDENTITY_FIELD_UNSPECIFIED = 0, + IDENTITY_FIELD_EMAIL = 1, + IDENTITY_FIELD_phone = 2, + IDENTITY_FIELD_PASSWORD = 3, + IDENTITY_FIELD_HANDLE = 4, +} + +export function identityFieldFromJSON(object: any): IdentityField { + switch (object) { + case 0: + case "IDENTITY_FIELD_UNSPECIFIED": + return IdentityField.IDENTITY_FIELD_UNSPECIFIED; + case 1: + case "IDENTITY_FIELD_EMAIL": + return IdentityField.IDENTITY_FIELD_EMAIL; + case 2: + case "IDENTITY_FIELD_phone": + return IdentityField.IDENTITY_FIELD_phone; + case 3: + case "IDENTITY_FIELD_PASSWORD": + return IdentityField.IDENTITY_FIELD_PASSWORD; + case 4: + case "IDENTITY_FIELD_HANDLE": + return IdentityField.IDENTITY_FIELD_HANDLE; + default: + throw new globalThis.Error("Unrecognized enum value " + object + " for enum IdentityField"); + } +} + +export function identityFieldToJSON(object: IdentityField): string { + switch (object) { + case IdentityField.IDENTITY_FIELD_UNSPECIFIED: + return "IDENTITY_FIELD_UNSPECIFIED"; + case IdentityField.IDENTITY_FIELD_EMAIL: + return "IDENTITY_FIELD_EMAIL"; + case IdentityField.IDENTITY_FIELD_phone: + return "IDENTITY_FIELD_phone"; + case IdentityField.IDENTITY_FIELD_PASSWORD: + return "IDENTITY_FIELD_PASSWORD"; + case IdentityField.IDENTITY_FIELD_HANDLE: + return "IDENTITY_FIELD_HANDLE"; + default: + throw new globalThis.Error("Unrecognized enum value " + object + " for enum IdentityField"); + } +} + +export interface DateMessage { + year: number; + month: number; + day: number; +} + +export interface User { + id: string; + email: string; + phone: string; + firstNames: string; + lastName: string; + profilePictureUrl: string; + handle?: string | undefined; + createdAt: Date | undefined; + updatedAt: Date | undefined; + deletedAt: Date | undefined; + lastLogin: Date | undefined; + isActive: boolean; + isEmailVerified: boolean; + isPhoneVerified: boolean; + dateOfBirth: DateMessage | undefined; + version: number; + socialAccounts: SocialAccount[]; +} + +export interface UserPreference { + id: string; + userId: string; + preferenceCode: string; + preferenceValueType: string; + preferenceValue: string; + createdAt: Date | undefined; + updatedAt: Date | undefined; +} + +export interface Role { + id: string; + code: string; + description: string; + createdAt: Date | undefined; + updatedAt: Date | undefined; +} + +export interface SocialAccount { + provider: string; + providerUserId: string; + accessToken: string; + expiresAt: Date | undefined; + email: string; + name: string; + profilePictureUrl: string; + emailVerified: boolean; +} + +/** Mobile flow - validate ID token from native SDK */ +export interface SocialLoginRequest { + provider: OAuthProvider; + /** JWT from Google/Apple SDK */ + idToken: string; + /** For Facebook */ + accessToken: string; + deviceInfo: + | DeviceInfo + | undefined; + /** For Apple Sign-In security */ + nonce: string; +} + +export interface SocialLoginResponse { + success: boolean; + resultCode: ResultCode; + message: string; + authenticatedUser: AuthenticatedUser | undefined; + isNewUser: boolean; + wasAutoLinked: boolean; + validationErrors: ValidationError[]; +} + +/** Web flow - initiate OAuth redirect */ +export interface InitiateOAuthRequest { + provider: OAuthProvider; + redirectUri: string; + /** Client-provided state for additional verification */ + state: string; +} + +export interface InitiateOAuthResponse { + success: boolean; + resultCode: ResultCode; + message: string; + authorizationUrl: string; + /** Server-generated state token */ + state: string; +} + +/** Web flow - handle callback */ +export interface OAuthCallbackRequest { + provider: OAuthProvider; + code: string; + state: string; + deviceInfo: DeviceInfo | undefined; +} + +/** Account linking */ +export interface LinkSocialAccountRequest { + actorId: string; + actorToken: string; + provider: OAuthProvider; + idToken: string; + accessToken: string; + /** For Apple Sign-In */ + nonce: string; +} + +export interface UnlinkSocialAccountRequest { + actorId: string; + actorToken: string; + provider: OAuthProvider; +} + +export interface GetLinkedAccountsRequest { + actorId: string; + actorToken: string; +} + +export interface GetLinkedAccountsResponse { + success: boolean; + resultCode: ResultCode; + message: string; + accounts: SocialAccount[]; +} + +export interface RegisterUserRequest { + userIdentifier: string; + password: string; + firstNames: string; + lastName: string; + appHash: string; + deviceInfo: DeviceInfo | undefined; +} + +export interface RegisterUserResponse { + success: boolean; + resultCode: ResultCode; + message: string; + registrationId: string; + validationErrors: ValidationError[]; +} + +export interface VerifyRegisterUserRequest { + /** Can be either email or phone */ + userIdentifier: string; + registrationId: string; + /** Token has a redirect to encoded in it. */ + token: string; + deviceInfo: DeviceInfo | undefined; +} + +export interface UserResponse { + success: boolean; + resultCode: ResultCode; + message: string; + user: User | undefined; +} + +export interface DeviceInfo { + /** e.g., 'web', 'mobile' */ + applicationName: string; + /** e.g., '1.0.0' */ + applicationVersion: string; + /** e.g., 'iPhone X', 'Pixel 2' */ + deviceName: string; + /** -- e.g., 'desktop', 'mobile' */ + deviceType: string; + /** e. g., 'iOS', 'Android', 'Windows' */ + deviceOs: string; + /** e.g., '10', '11.4.1' */ + deviceOsVersion: string; + /** e.g., 'imei:1234567890', 'serial:1234567890' */ + deviceId: string; +} + +export interface LoginRequest { + /** Can be either email or phone */ + userIdentifier: string; + password: string; + appHash: string; + deviceInfo: DeviceInfo | undefined; +} + +export interface AuthenticationResponse { + success: boolean; + passCodeRequired: boolean; + twoFactorId: string; + resultCode: ResultCode; + message: string; + authenticatedUser: AuthenticatedUser | undefined; +} + +export interface AuthenticatedUser { + user: User | undefined; + token: string; + sessionId: string; + expiresAt: Date | undefined; + userPreferences: UserPreference[]; + userRoles: AssignedUserRole[]; +} + +export interface AssignedUserRole { + id: string; + userId: string; + roleId: string; + roleName: string; + scopeCode: string; + targetId: string; +} + +export interface VerifyTokenRequest { + token: string; + includeUserRoles: boolean; + roleScopes: string[]; + roleNames: string[]; +} + +export interface VerifyAuthClaimTokenRequest { + claim: string; +} + +export interface InitiateTwoFactorResponse { + success: boolean; + resultCode: ResultCode; + message: string; + twoFactorId: string; + channel: ChannelType; + userId: string; + validationErrors: ValidationError[]; +} + +export interface VerifyTwoFactorResponse { + success: boolean; + resultCode: ResultCode; + message: string; + validationErrors: ValidationError[]; +} + +export interface InitiateTwoFactorRequest { + userId?: + | string + | undefined; + /** Can be either email or phone */ + userIdentifier?: string | undefined; + channel: ChannelType; + appHash: string; + deviceInfo: DeviceInfo | undefined; +} + +export interface VerifyTwoFactorRequest { + twoFactorId: string; + code: string; + deviceInfo: DeviceInfo | undefined; +} + +export interface InitiatePasswordResetRequest { + /** Can be either email or phone */ + userIdentifier: string; + appHash: string; + deviceInfo: DeviceInfo | undefined; + newPassword: string; +} + +export interface OperationResponse { + success: boolean; + resultCode: ResultCode; + message: string; +} + +export interface VerifyPasswordResetTokenRequest { + userId: string; + passwordResetId: string; + passcode: string; +} + +export interface PasswordResetTokenResponse { + success: boolean; + resultCode: ResultCode; + message: string; + passwordResetId: string; +} + +export interface ResetPasswordRequest { + userId: string; + passwordResetId: string; + passcode: string; + deviceInfo: DeviceInfo | undefined; +} + +export interface ChangeIdentityFieldRequest { + userId: string; + userToken: string; + channel: ChannelType; + newValue: string; + fieldType: IdentityField; + appHash: string; + deviceInfo: DeviceInfo | undefined; +} + +export interface ChangeIdentityFieldResponse { + success: boolean; + resultCode: ResultCode; + message: string; + challengeId: string; + passcodeSize: number; + userIdentifier: string; + channel: ChannelType; + validationErrors: ValidationError[]; +} + +export interface VerifyIdentityFieldRequest { + userId: string; + userToken: string; + challengeId: string; + verificationCode: string; + appHash: string; + deviceInfo: DeviceInfo | undefined; +} + +export interface ResendIdentityFieldRequest { + userId: string; + userToken: string; + challengeId: string; + appHash: string; + deviceInfo: DeviceInfo | undefined; +} + +export interface VerifyIdentityFieldResponse { + success: boolean; + resultCode: ResultCode; + message: string; + requiresVerification: boolean; + challengeId: string; + passcodeSize: number; + userIdentifier: string; + channel: ChannelType; + validationErrors: ValidationError[]; +} + +export interface UpdateUserInfoRequest { + userId: string; + userToken: string; + firstNames?: string | undefined; + lastName?: string | undefined; + profilePictureId?: string | undefined; + dateOfBirth: + | DateMessage + | undefined; + /** Optional unique handle (e.g., @username) */ + handle?: string | undefined; +} + +export interface UpdateUserInfoResponse { + success: boolean; + resultCode: ResultCode; + message: string; + user: User | undefined; +} + +export interface LogoutRequest { + token: string; +} + +export interface LogoutResponse { + success: boolean; + resultCode: ResultCode; + message: string; +} + +export interface ValidationError { + field: string; + message: string; +} + +export interface Scope { + code: string; + description: string; + parentCode?: string | undefined; + isActive: boolean; +} + +export interface UpdateUserPreferenceRequest { + actorId: string; + actorToken: string; + preferenceKey: string; + preferenceValue: string; +} + +export interface GetUserPreferenceByCodeRequest { + actorId: string; + actorToken: string; + preferenceCode: string; +} + +export interface GetUserPreferenceByCodeResponse { + success: boolean; + resultCode: ResultCode; + message: string; + value: string; +} + +export interface ResendVerificationRequest { + userIdentifier: string; + verificationCodeType: VerificationCodeType; + appHash: string; + verificationCodeId: string; + deviceInfo: DeviceInfo | undefined; +} + +export interface ResendVerificationResponse { + success: boolean; + resultCode: ResultCode; + message: string; + verificationCodeId: string; +} + +export interface UserSession { + id: string; + userId: string; + deviceInfo: DeviceInfo | undefined; + createdAt: Date | undefined; + expiresAt: Date | undefined; + lastActivity: Date | undefined; + isActive: boolean; + ipAddress: string; + userAgent: string; +} + +export interface GetUserSessionsRequest { + actorId: string; + actorToken: string; + page: number; + size: number; +} + +export interface GetUserSessionsResponse { + success: boolean; + resultCode: ResultCode; + message: string; + sessions: UserSession[]; + total: number; +} + +export interface ClearUserSessionsRequest { + actorId: string; + actorToken: string; + /** If empty, clears all sessions except current */ + sessionIds: string[]; +} + +export interface ClearUserSessionsResponse { + success: boolean; + resultCode: ResultCode; + message: string; + clearedCount: number; +} + +/** Metrics */ +export interface GetMetricsRequest { + bearerToken: string; +} + +export interface GetMetricsResponse { + success: boolean; + resultCode: ResultCode; + message: string; + /** Prometheus text format */ + metrics: string; +} + +/** API Key messages */ +export interface CreateApiKeyRequest { + /** existing session token for auth */ + token: string; + name: string; + scopes: string[]; + /** 0 = never */ + expiresAt: number; +} + +export interface CreateApiKeyResponse { + success: boolean; + resultCode: ResultCode; + message: string; + /** full key, shown ONCE */ + apiKey: string; + keyId: string; + keyPrefix: string; +} + +export interface ListApiKeysRequest { + token: string; +} + +export interface ListApiKeysResponse { + success: boolean; + resultCode: ResultCode; + message: string; + keys: ApiKeyInfo[]; +} + +export interface ApiKeyInfo { + id: string; + name: string; + keyPrefix: string; + scopes: string[]; + lastUsedAt: number; + expiresAt: number; + createdAt: number; + isActive: boolean; +} + +export interface RevokeApiKeyRequest { + token: string; + keyId: string; +} + +export interface VerifyApiKeyRequest { + apiKey: string; +} + +/** Password policy */ +export interface GetPasswordPolicyRequest { +} + +export interface GetPasswordPolicyResponse { + success: boolean; + resultCode: ResultCode; + message: string; + minLength: number; + requiresUppercase: boolean; + requiresSpecialCharacter: boolean; +} + +/** Lookup user by exact identifier (email, phone number, or handle) */ +export interface LookupUserRequest { + userId: string; + userToken: string; + /** email, phone number, or handle */ + identifier: string; +} + +export interface LookupUserResponse { + success: boolean; + resultCode: ResultCode; + message: string; + user?: User | undefined; +} + +function createBaseDateMessage(): DateMessage { + return { year: 0, month: 0, day: 0 }; +} + +export const DateMessage: MessageFns = { + encode(message: DateMessage, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.year !== 0) { + writer.uint32(8).int32(message.year); + } + if (message.month !== 0) { + writer.uint32(16).uint32(message.month); + } + if (message.day !== 0) { + writer.uint32(24).uint32(message.day); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DateMessage { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDateMessage(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.year = reader.int32(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.month = reader.uint32(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.day = reader.uint32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DateMessage { + return { + year: isSet(object.year) ? globalThis.Number(object.year) : 0, + month: isSet(object.month) ? globalThis.Number(object.month) : 0, + day: isSet(object.day) ? globalThis.Number(object.day) : 0, + }; + }, + + toJSON(message: DateMessage): unknown { + const obj: any = {}; + if (message.year !== 0) { + obj.year = Math.round(message.year); + } + if (message.month !== 0) { + obj.month = Math.round(message.month); + } + if (message.day !== 0) { + obj.day = Math.round(message.day); + } + return obj; + }, + + create(base?: DeepPartial): DateMessage { + return DateMessage.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): DateMessage { + const message = createBaseDateMessage(); + message.year = object.year ?? 0; + message.month = object.month ?? 0; + message.day = object.day ?? 0; + return message; + }, +}; + +function createBaseUser(): User { + return { + id: "", + email: "", + phone: "", + firstNames: "", + lastName: "", + profilePictureUrl: "", + handle: undefined, + createdAt: undefined, + updatedAt: undefined, + deletedAt: undefined, + lastLogin: undefined, + isActive: false, + isEmailVerified: false, + isPhoneVerified: false, + dateOfBirth: undefined, + version: 0, + socialAccounts: [], + }; +} + +export const User: MessageFns = { + encode(message: User, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.id !== "") { + writer.uint32(10).string(message.id); + } + if (message.email !== "") { + writer.uint32(18).string(message.email); + } + if (message.phone !== "") { + writer.uint32(26).string(message.phone); + } + if (message.firstNames !== "") { + writer.uint32(34).string(message.firstNames); + } + if (message.lastName !== "") { + writer.uint32(42).string(message.lastName); + } + if (message.profilePictureUrl !== "") { + writer.uint32(50).string(message.profilePictureUrl); + } + if (message.handle !== undefined) { + writer.uint32(58).string(message.handle); + } + if (message.createdAt !== undefined) { + Timestamp.encode(toTimestamp(message.createdAt), writer.uint32(82).fork()).join(); + } + if (message.updatedAt !== undefined) { + Timestamp.encode(toTimestamp(message.updatedAt), writer.uint32(90).fork()).join(); + } + if (message.deletedAt !== undefined) { + Timestamp.encode(toTimestamp(message.deletedAt), writer.uint32(98).fork()).join(); + } + if (message.lastLogin !== undefined) { + Timestamp.encode(toTimestamp(message.lastLogin), writer.uint32(106).fork()).join(); + } + if (message.isActive !== false) { + writer.uint32(160).bool(message.isActive); + } + if (message.isEmailVerified !== false) { + writer.uint32(168).bool(message.isEmailVerified); + } + if (message.isPhoneVerified !== false) { + writer.uint32(176).bool(message.isPhoneVerified); + } + if (message.dateOfBirth !== undefined) { + DateMessage.encode(message.dateOfBirth, writer.uint32(186).fork()).join(); + } + if (message.version !== 0) { + writer.uint32(192).int64(message.version); + } + for (const v of message.socialAccounts) { + SocialAccount.encode(v!, writer.uint32(242).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): User { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseUser(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.id = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.email = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.phone = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.firstNames = reader.string(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + message.lastName = reader.string(); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + + message.profilePictureUrl = reader.string(); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + + message.handle = reader.string(); + continue; + } + case 10: { + if (tag !== 82) { + break; + } + + message.createdAt = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + } + case 11: { + if (tag !== 90) { + break; + } + + message.updatedAt = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + } + case 12: { + if (tag !== 98) { + break; + } + + message.deletedAt = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + } + case 13: { + if (tag !== 106) { + break; + } + + message.lastLogin = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + } + case 20: { + if (tag !== 160) { + break; + } + + message.isActive = reader.bool(); + continue; + } + case 21: { + if (tag !== 168) { + break; + } + + message.isEmailVerified = reader.bool(); + continue; + } + case 22: { + if (tag !== 176) { + break; + } + + message.isPhoneVerified = reader.bool(); + continue; + } + case 23: { + if (tag !== 186) { + break; + } + + message.dateOfBirth = DateMessage.decode(reader, reader.uint32()); + continue; + } + case 24: { + if (tag !== 192) { + break; + } + + message.version = longToNumber(reader.int64()); + continue; + } + case 30: { + if (tag !== 242) { + break; + } + + message.socialAccounts.push(SocialAccount.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): User { + return { + id: isSet(object.id) ? globalThis.String(object.id) : "", + email: isSet(object.email) ? globalThis.String(object.email) : "", + phone: isSet(object.phone) ? globalThis.String(object.phone) : "", + firstNames: isSet(object.firstNames) + ? globalThis.String(object.firstNames) + : isSet(object.first_names) + ? globalThis.String(object.first_names) + : "", + lastName: isSet(object.lastName) + ? globalThis.String(object.lastName) + : isSet(object.last_name) + ? globalThis.String(object.last_name) + : "", + profilePictureUrl: isSet(object.profilePictureUrl) + ? globalThis.String(object.profilePictureUrl) + : isSet(object.profile_picture_url) + ? globalThis.String(object.profile_picture_url) + : "", + handle: isSet(object.handle) ? globalThis.String(object.handle) : undefined, + createdAt: isSet(object.createdAt) + ? fromJsonTimestamp(object.createdAt) + : isSet(object.created_at) + ? fromJsonTimestamp(object.created_at) + : undefined, + updatedAt: isSet(object.updatedAt) + ? fromJsonTimestamp(object.updatedAt) + : isSet(object.updated_at) + ? fromJsonTimestamp(object.updated_at) + : undefined, + deletedAt: isSet(object.deletedAt) + ? fromJsonTimestamp(object.deletedAt) + : isSet(object.deleted_at) + ? fromJsonTimestamp(object.deleted_at) + : undefined, + lastLogin: isSet(object.lastLogin) + ? fromJsonTimestamp(object.lastLogin) + : isSet(object.last_login) + ? fromJsonTimestamp(object.last_login) + : undefined, + isActive: isSet(object.isActive) + ? globalThis.Boolean(object.isActive) + : isSet(object.is_active) + ? globalThis.Boolean(object.is_active) + : false, + isEmailVerified: isSet(object.isEmailVerified) + ? globalThis.Boolean(object.isEmailVerified) + : isSet(object.is_email_verified) + ? globalThis.Boolean(object.is_email_verified) + : false, + isPhoneVerified: isSet(object.isPhoneVerified) + ? globalThis.Boolean(object.isPhoneVerified) + : isSet(object.is_phone_verified) + ? globalThis.Boolean(object.is_phone_verified) + : false, + dateOfBirth: isSet(object.dateOfBirth) + ? DateMessage.fromJSON(object.dateOfBirth) + : isSet(object.date_of_birth) + ? DateMessage.fromJSON(object.date_of_birth) + : undefined, + version: isSet(object.version) ? globalThis.Number(object.version) : 0, + socialAccounts: globalThis.Array.isArray(object?.socialAccounts) + ? object.socialAccounts.map((e: any) => SocialAccount.fromJSON(e)) + : globalThis.Array.isArray(object?.social_accounts) + ? object.social_accounts.map((e: any) => SocialAccount.fromJSON(e)) + : [], + }; + }, + + toJSON(message: User): unknown { + const obj: any = {}; + if (message.id !== "") { + obj.id = message.id; + } + if (message.email !== "") { + obj.email = message.email; + } + if (message.phone !== "") { + obj.phone = message.phone; + } + if (message.firstNames !== "") { + obj.firstNames = message.firstNames; + } + if (message.lastName !== "") { + obj.lastName = message.lastName; + } + if (message.profilePictureUrl !== "") { + obj.profilePictureUrl = message.profilePictureUrl; + } + if (message.handle !== undefined) { + obj.handle = message.handle; + } + if (message.createdAt !== undefined) { + obj.createdAt = message.createdAt.toISOString(); + } + if (message.updatedAt !== undefined) { + obj.updatedAt = message.updatedAt.toISOString(); + } + if (message.deletedAt !== undefined) { + obj.deletedAt = message.deletedAt.toISOString(); + } + if (message.lastLogin !== undefined) { + obj.lastLogin = message.lastLogin.toISOString(); + } + if (message.isActive !== false) { + obj.isActive = message.isActive; + } + if (message.isEmailVerified !== false) { + obj.isEmailVerified = message.isEmailVerified; + } + if (message.isPhoneVerified !== false) { + obj.isPhoneVerified = message.isPhoneVerified; + } + if (message.dateOfBirth !== undefined) { + obj.dateOfBirth = DateMessage.toJSON(message.dateOfBirth); + } + if (message.version !== 0) { + obj.version = Math.round(message.version); + } + if (message.socialAccounts?.length) { + obj.socialAccounts = message.socialAccounts.map((e) => SocialAccount.toJSON(e)); + } + return obj; + }, + + create(base?: DeepPartial): User { + return User.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): User { + const message = createBaseUser(); + message.id = object.id ?? ""; + message.email = object.email ?? ""; + message.phone = object.phone ?? ""; + message.firstNames = object.firstNames ?? ""; + message.lastName = object.lastName ?? ""; + message.profilePictureUrl = object.profilePictureUrl ?? ""; + message.handle = object.handle ?? undefined; + message.createdAt = object.createdAt ?? undefined; + message.updatedAt = object.updatedAt ?? undefined; + message.deletedAt = object.deletedAt ?? undefined; + message.lastLogin = object.lastLogin ?? undefined; + message.isActive = object.isActive ?? false; + message.isEmailVerified = object.isEmailVerified ?? false; + message.isPhoneVerified = object.isPhoneVerified ?? false; + message.dateOfBirth = (object.dateOfBirth !== undefined && object.dateOfBirth !== null) + ? DateMessage.fromPartial(object.dateOfBirth) + : undefined; + message.version = object.version ?? 0; + message.socialAccounts = object.socialAccounts?.map((e) => SocialAccount.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseUserPreference(): UserPreference { + return { + id: "", + userId: "", + preferenceCode: "", + preferenceValueType: "", + preferenceValue: "", + createdAt: undefined, + updatedAt: undefined, + }; +} + +export const UserPreference: MessageFns = { + encode(message: UserPreference, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.id !== "") { + writer.uint32(10).string(message.id); + } + if (message.userId !== "") { + writer.uint32(18).string(message.userId); + } + if (message.preferenceCode !== "") { + writer.uint32(26).string(message.preferenceCode); + } + if (message.preferenceValueType !== "") { + writer.uint32(34).string(message.preferenceValueType); + } + if (message.preferenceValue !== "") { + writer.uint32(42).string(message.preferenceValue); + } + if (message.createdAt !== undefined) { + Timestamp.encode(toTimestamp(message.createdAt), writer.uint32(82).fork()).join(); + } + if (message.updatedAt !== undefined) { + Timestamp.encode(toTimestamp(message.updatedAt), writer.uint32(90).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): UserPreference { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseUserPreference(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.id = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.userId = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.preferenceCode = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.preferenceValueType = reader.string(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + message.preferenceValue = reader.string(); + continue; + } + case 10: { + if (tag !== 82) { + break; + } + + message.createdAt = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + } + case 11: { + if (tag !== 90) { + break; + } + + message.updatedAt = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): UserPreference { + return { + id: isSet(object.id) ? globalThis.String(object.id) : "", + userId: isSet(object.userId) + ? globalThis.String(object.userId) + : isSet(object.user_id) + ? globalThis.String(object.user_id) + : "", + preferenceCode: isSet(object.preferenceCode) + ? globalThis.String(object.preferenceCode) + : isSet(object.preference_code) + ? globalThis.String(object.preference_code) + : "", + preferenceValueType: isSet(object.preferenceValueType) + ? globalThis.String(object.preferenceValueType) + : isSet(object.preference_value_type) + ? globalThis.String(object.preference_value_type) + : "", + preferenceValue: isSet(object.preferenceValue) + ? globalThis.String(object.preferenceValue) + : isSet(object.preference_value) + ? globalThis.String(object.preference_value) + : "", + createdAt: isSet(object.createdAt) + ? fromJsonTimestamp(object.createdAt) + : isSet(object.created_at) + ? fromJsonTimestamp(object.created_at) + : undefined, + updatedAt: isSet(object.updatedAt) + ? fromJsonTimestamp(object.updatedAt) + : isSet(object.updated_at) + ? fromJsonTimestamp(object.updated_at) + : undefined, + }; + }, + + toJSON(message: UserPreference): unknown { + const obj: any = {}; + if (message.id !== "") { + obj.id = message.id; + } + if (message.userId !== "") { + obj.userId = message.userId; + } + if (message.preferenceCode !== "") { + obj.preferenceCode = message.preferenceCode; + } + if (message.preferenceValueType !== "") { + obj.preferenceValueType = message.preferenceValueType; + } + if (message.preferenceValue !== "") { + obj.preferenceValue = message.preferenceValue; + } + if (message.createdAt !== undefined) { + obj.createdAt = message.createdAt.toISOString(); + } + if (message.updatedAt !== undefined) { + obj.updatedAt = message.updatedAt.toISOString(); + } + return obj; + }, + + create(base?: DeepPartial): UserPreference { + return UserPreference.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): UserPreference { + const message = createBaseUserPreference(); + message.id = object.id ?? ""; + message.userId = object.userId ?? ""; + message.preferenceCode = object.preferenceCode ?? ""; + message.preferenceValueType = object.preferenceValueType ?? ""; + message.preferenceValue = object.preferenceValue ?? ""; + message.createdAt = object.createdAt ?? undefined; + message.updatedAt = object.updatedAt ?? undefined; + return message; + }, +}; + +function createBaseRole(): Role { + return { id: "", code: "", description: "", createdAt: undefined, updatedAt: undefined }; +} + +export const Role: MessageFns = { + encode(message: Role, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.id !== "") { + writer.uint32(10).string(message.id); + } + if (message.code !== "") { + writer.uint32(18).string(message.code); + } + if (message.description !== "") { + writer.uint32(26).string(message.description); + } + if (message.createdAt !== undefined) { + Timestamp.encode(toTimestamp(message.createdAt), writer.uint32(34).fork()).join(); + } + if (message.updatedAt !== undefined) { + Timestamp.encode(toTimestamp(message.updatedAt), writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Role { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRole(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.id = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.code = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.description = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.createdAt = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + message.updatedAt = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Role { + return { + id: isSet(object.id) ? globalThis.String(object.id) : "", + code: isSet(object.code) ? globalThis.String(object.code) : "", + description: isSet(object.description) ? globalThis.String(object.description) : "", + createdAt: isSet(object.createdAt) + ? fromJsonTimestamp(object.createdAt) + : isSet(object.created_at) + ? fromJsonTimestamp(object.created_at) + : undefined, + updatedAt: isSet(object.updatedAt) + ? fromJsonTimestamp(object.updatedAt) + : isSet(object.updated_at) + ? fromJsonTimestamp(object.updated_at) + : undefined, + }; + }, + + toJSON(message: Role): unknown { + const obj: any = {}; + if (message.id !== "") { + obj.id = message.id; + } + if (message.code !== "") { + obj.code = message.code; + } + if (message.description !== "") { + obj.description = message.description; + } + if (message.createdAt !== undefined) { + obj.createdAt = message.createdAt.toISOString(); + } + if (message.updatedAt !== undefined) { + obj.updatedAt = message.updatedAt.toISOString(); + } + return obj; + }, + + create(base?: DeepPartial): Role { + return Role.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): Role { + const message = createBaseRole(); + message.id = object.id ?? ""; + message.code = object.code ?? ""; + message.description = object.description ?? ""; + message.createdAt = object.createdAt ?? undefined; + message.updatedAt = object.updatedAt ?? undefined; + return message; + }, +}; + +function createBaseSocialAccount(): SocialAccount { + return { + provider: "", + providerUserId: "", + accessToken: "", + expiresAt: undefined, + email: "", + name: "", + profilePictureUrl: "", + emailVerified: false, + }; +} + +export const SocialAccount: MessageFns = { + encode(message: SocialAccount, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.provider !== "") { + writer.uint32(10).string(message.provider); + } + if (message.providerUserId !== "") { + writer.uint32(18).string(message.providerUserId); + } + if (message.accessToken !== "") { + writer.uint32(26).string(message.accessToken); + } + if (message.expiresAt !== undefined) { + Timestamp.encode(toTimestamp(message.expiresAt), writer.uint32(34).fork()).join(); + } + if (message.email !== "") { + writer.uint32(42).string(message.email); + } + if (message.name !== "") { + writer.uint32(50).string(message.name); + } + if (message.profilePictureUrl !== "") { + writer.uint32(58).string(message.profilePictureUrl); + } + if (message.emailVerified !== false) { + writer.uint32(64).bool(message.emailVerified); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SocialAccount { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSocialAccount(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.provider = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.providerUserId = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.accessToken = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.expiresAt = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + message.email = reader.string(); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + + message.name = reader.string(); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + + message.profilePictureUrl = reader.string(); + continue; + } + case 8: { + if (tag !== 64) { + break; + } + + message.emailVerified = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SocialAccount { + return { + provider: isSet(object.provider) ? globalThis.String(object.provider) : "", + providerUserId: isSet(object.providerUserId) + ? globalThis.String(object.providerUserId) + : isSet(object.provider_user_id) + ? globalThis.String(object.provider_user_id) + : "", + accessToken: isSet(object.accessToken) + ? globalThis.String(object.accessToken) + : isSet(object.access_token) + ? globalThis.String(object.access_token) + : "", + expiresAt: isSet(object.expiresAt) + ? fromJsonTimestamp(object.expiresAt) + : isSet(object.expires_at) + ? fromJsonTimestamp(object.expires_at) + : undefined, + email: isSet(object.email) ? globalThis.String(object.email) : "", + name: isSet(object.name) ? globalThis.String(object.name) : "", + profilePictureUrl: isSet(object.profilePictureUrl) + ? globalThis.String(object.profilePictureUrl) + : isSet(object.profile_picture_url) + ? globalThis.String(object.profile_picture_url) + : "", + emailVerified: isSet(object.emailVerified) + ? globalThis.Boolean(object.emailVerified) + : isSet(object.email_verified) + ? globalThis.Boolean(object.email_verified) + : false, + }; + }, + + toJSON(message: SocialAccount): unknown { + const obj: any = {}; + if (message.provider !== "") { + obj.provider = message.provider; + } + if (message.providerUserId !== "") { + obj.providerUserId = message.providerUserId; + } + if (message.accessToken !== "") { + obj.accessToken = message.accessToken; + } + if (message.expiresAt !== undefined) { + obj.expiresAt = message.expiresAt.toISOString(); + } + if (message.email !== "") { + obj.email = message.email; + } + if (message.name !== "") { + obj.name = message.name; + } + if (message.profilePictureUrl !== "") { + obj.profilePictureUrl = message.profilePictureUrl; + } + if (message.emailVerified !== false) { + obj.emailVerified = message.emailVerified; + } + return obj; + }, + + create(base?: DeepPartial): SocialAccount { + return SocialAccount.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): SocialAccount { + const message = createBaseSocialAccount(); + message.provider = object.provider ?? ""; + message.providerUserId = object.providerUserId ?? ""; + message.accessToken = object.accessToken ?? ""; + message.expiresAt = object.expiresAt ?? undefined; + message.email = object.email ?? ""; + message.name = object.name ?? ""; + message.profilePictureUrl = object.profilePictureUrl ?? ""; + message.emailVerified = object.emailVerified ?? false; + return message; + }, +}; + +function createBaseSocialLoginRequest(): SocialLoginRequest { + return { provider: 0, idToken: "", accessToken: "", deviceInfo: undefined, nonce: "" }; +} + +export const SocialLoginRequest: MessageFns = { + encode(message: SocialLoginRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.provider !== 0) { + writer.uint32(8).int32(message.provider); + } + if (message.idToken !== "") { + writer.uint32(18).string(message.idToken); + } + if (message.accessToken !== "") { + writer.uint32(26).string(message.accessToken); + } + if (message.deviceInfo !== undefined) { + DeviceInfo.encode(message.deviceInfo, writer.uint32(34).fork()).join(); + } + if (message.nonce !== "") { + writer.uint32(42).string(message.nonce); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SocialLoginRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSocialLoginRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.provider = reader.int32() as any; + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.idToken = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.accessToken = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.deviceInfo = DeviceInfo.decode(reader, reader.uint32()); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + message.nonce = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SocialLoginRequest { + return { + provider: isSet(object.provider) ? oAuthProviderFromJSON(object.provider) : 0, + idToken: isSet(object.idToken) + ? globalThis.String(object.idToken) + : isSet(object.id_token) + ? globalThis.String(object.id_token) + : "", + accessToken: isSet(object.accessToken) + ? globalThis.String(object.accessToken) + : isSet(object.access_token) + ? globalThis.String(object.access_token) + : "", + deviceInfo: isSet(object.deviceInfo) + ? DeviceInfo.fromJSON(object.deviceInfo) + : isSet(object.device_info) + ? DeviceInfo.fromJSON(object.device_info) + : undefined, + nonce: isSet(object.nonce) ? globalThis.String(object.nonce) : "", + }; + }, + + toJSON(message: SocialLoginRequest): unknown { + const obj: any = {}; + if (message.provider !== 0) { + obj.provider = oAuthProviderToJSON(message.provider); + } + if (message.idToken !== "") { + obj.idToken = message.idToken; + } + if (message.accessToken !== "") { + obj.accessToken = message.accessToken; + } + if (message.deviceInfo !== undefined) { + obj.deviceInfo = DeviceInfo.toJSON(message.deviceInfo); + } + if (message.nonce !== "") { + obj.nonce = message.nonce; + } + return obj; + }, + + create(base?: DeepPartial): SocialLoginRequest { + return SocialLoginRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): SocialLoginRequest { + const message = createBaseSocialLoginRequest(); + message.provider = object.provider ?? 0; + message.idToken = object.idToken ?? ""; + message.accessToken = object.accessToken ?? ""; + message.deviceInfo = (object.deviceInfo !== undefined && object.deviceInfo !== null) + ? DeviceInfo.fromPartial(object.deviceInfo) + : undefined; + message.nonce = object.nonce ?? ""; + return message; + }, +}; + +function createBaseSocialLoginResponse(): SocialLoginResponse { + return { + success: false, + resultCode: 0, + message: "", + authenticatedUser: undefined, + isNewUser: false, + wasAutoLinked: false, + validationErrors: [], + }; +} + +export const SocialLoginResponse: MessageFns = { + encode(message: SocialLoginResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + if (message.resultCode !== 0) { + writer.uint32(16).int32(message.resultCode); + } + if (message.message !== "") { + writer.uint32(26).string(message.message); + } + if (message.authenticatedUser !== undefined) { + AuthenticatedUser.encode(message.authenticatedUser, writer.uint32(34).fork()).join(); + } + if (message.isNewUser !== false) { + writer.uint32(40).bool(message.isNewUser); + } + if (message.wasAutoLinked !== false) { + writer.uint32(48).bool(message.wasAutoLinked); + } + for (const v of message.validationErrors) { + ValidationError.encode(v!, writer.uint32(58).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SocialLoginResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSocialLoginResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.resultCode = reader.int32() as any; + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.message = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.authenticatedUser = AuthenticatedUser.decode(reader, reader.uint32()); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + + message.isNewUser = reader.bool(); + continue; + } + case 6: { + if (tag !== 48) { + break; + } + + message.wasAutoLinked = reader.bool(); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + + message.validationErrors.push(ValidationError.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SocialLoginResponse { + return { + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + resultCode: isSet(object.resultCode) + ? resultCodeFromJSON(object.resultCode) + : isSet(object.result_code) + ? resultCodeFromJSON(object.result_code) + : 0, + message: isSet(object.message) ? globalThis.String(object.message) : "", + authenticatedUser: isSet(object.authenticatedUser) + ? AuthenticatedUser.fromJSON(object.authenticatedUser) + : isSet(object.authenticated_user) + ? AuthenticatedUser.fromJSON(object.authenticated_user) + : undefined, + isNewUser: isSet(object.isNewUser) + ? globalThis.Boolean(object.isNewUser) + : isSet(object.is_new_user) + ? globalThis.Boolean(object.is_new_user) + : false, + wasAutoLinked: isSet(object.wasAutoLinked) + ? globalThis.Boolean(object.wasAutoLinked) + : isSet(object.was_auto_linked) + ? globalThis.Boolean(object.was_auto_linked) + : false, + validationErrors: globalThis.Array.isArray(object?.validationErrors) + ? object.validationErrors.map((e: any) => ValidationError.fromJSON(e)) + : globalThis.Array.isArray(object?.validation_errors) + ? object.validation_errors.map((e: any) => ValidationError.fromJSON(e)) + : [], + }; + }, + + toJSON(message: SocialLoginResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + if (message.resultCode !== 0) { + obj.resultCode = resultCodeToJSON(message.resultCode); + } + if (message.message !== "") { + obj.message = message.message; + } + if (message.authenticatedUser !== undefined) { + obj.authenticatedUser = AuthenticatedUser.toJSON(message.authenticatedUser); + } + if (message.isNewUser !== false) { + obj.isNewUser = message.isNewUser; + } + if (message.wasAutoLinked !== false) { + obj.wasAutoLinked = message.wasAutoLinked; + } + if (message.validationErrors?.length) { + obj.validationErrors = message.validationErrors.map((e) => ValidationError.toJSON(e)); + } + return obj; + }, + + create(base?: DeepPartial): SocialLoginResponse { + return SocialLoginResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): SocialLoginResponse { + const message = createBaseSocialLoginResponse(); + message.success = object.success ?? false; + message.resultCode = object.resultCode ?? 0; + message.message = object.message ?? ""; + message.authenticatedUser = (object.authenticatedUser !== undefined && object.authenticatedUser !== null) + ? AuthenticatedUser.fromPartial(object.authenticatedUser) + : undefined; + message.isNewUser = object.isNewUser ?? false; + message.wasAutoLinked = object.wasAutoLinked ?? false; + message.validationErrors = object.validationErrors?.map((e) => ValidationError.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseInitiateOAuthRequest(): InitiateOAuthRequest { + return { provider: 0, redirectUri: "", state: "" }; +} + +export const InitiateOAuthRequest: MessageFns = { + encode(message: InitiateOAuthRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.provider !== 0) { + writer.uint32(8).int32(message.provider); + } + if (message.redirectUri !== "") { + writer.uint32(18).string(message.redirectUri); + } + if (message.state !== "") { + writer.uint32(26).string(message.state); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): InitiateOAuthRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseInitiateOAuthRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.provider = reader.int32() as any; + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.redirectUri = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.state = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): InitiateOAuthRequest { + return { + provider: isSet(object.provider) ? oAuthProviderFromJSON(object.provider) : 0, + redirectUri: isSet(object.redirectUri) + ? globalThis.String(object.redirectUri) + : isSet(object.redirect_uri) + ? globalThis.String(object.redirect_uri) + : "", + state: isSet(object.state) ? globalThis.String(object.state) : "", + }; + }, + + toJSON(message: InitiateOAuthRequest): unknown { + const obj: any = {}; + if (message.provider !== 0) { + obj.provider = oAuthProviderToJSON(message.provider); + } + if (message.redirectUri !== "") { + obj.redirectUri = message.redirectUri; + } + if (message.state !== "") { + obj.state = message.state; + } + return obj; + }, + + create(base?: DeepPartial): InitiateOAuthRequest { + return InitiateOAuthRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): InitiateOAuthRequest { + const message = createBaseInitiateOAuthRequest(); + message.provider = object.provider ?? 0; + message.redirectUri = object.redirectUri ?? ""; + message.state = object.state ?? ""; + return message; + }, +}; + +function createBaseInitiateOAuthResponse(): InitiateOAuthResponse { + return { success: false, resultCode: 0, message: "", authorizationUrl: "", state: "" }; +} + +export const InitiateOAuthResponse: MessageFns = { + encode(message: InitiateOAuthResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + if (message.resultCode !== 0) { + writer.uint32(16).int32(message.resultCode); + } + if (message.message !== "") { + writer.uint32(26).string(message.message); + } + if (message.authorizationUrl !== "") { + writer.uint32(34).string(message.authorizationUrl); + } + if (message.state !== "") { + writer.uint32(42).string(message.state); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): InitiateOAuthResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseInitiateOAuthResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.resultCode = reader.int32() as any; + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.message = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.authorizationUrl = reader.string(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + message.state = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): InitiateOAuthResponse { + return { + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + resultCode: isSet(object.resultCode) + ? resultCodeFromJSON(object.resultCode) + : isSet(object.result_code) + ? resultCodeFromJSON(object.result_code) + : 0, + message: isSet(object.message) ? globalThis.String(object.message) : "", + authorizationUrl: isSet(object.authorizationUrl) + ? globalThis.String(object.authorizationUrl) + : isSet(object.authorization_url) + ? globalThis.String(object.authorization_url) + : "", + state: isSet(object.state) ? globalThis.String(object.state) : "", + }; + }, + + toJSON(message: InitiateOAuthResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + if (message.resultCode !== 0) { + obj.resultCode = resultCodeToJSON(message.resultCode); + } + if (message.message !== "") { + obj.message = message.message; + } + if (message.authorizationUrl !== "") { + obj.authorizationUrl = message.authorizationUrl; + } + if (message.state !== "") { + obj.state = message.state; + } + return obj; + }, + + create(base?: DeepPartial): InitiateOAuthResponse { + return InitiateOAuthResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): InitiateOAuthResponse { + const message = createBaseInitiateOAuthResponse(); + message.success = object.success ?? false; + message.resultCode = object.resultCode ?? 0; + message.message = object.message ?? ""; + message.authorizationUrl = object.authorizationUrl ?? ""; + message.state = object.state ?? ""; + return message; + }, +}; + +function createBaseOAuthCallbackRequest(): OAuthCallbackRequest { + return { provider: 0, code: "", state: "", deviceInfo: undefined }; +} + +export const OAuthCallbackRequest: MessageFns = { + encode(message: OAuthCallbackRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.provider !== 0) { + writer.uint32(8).int32(message.provider); + } + if (message.code !== "") { + writer.uint32(18).string(message.code); + } + if (message.state !== "") { + writer.uint32(26).string(message.state); + } + if (message.deviceInfo !== undefined) { + DeviceInfo.encode(message.deviceInfo, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): OAuthCallbackRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseOAuthCallbackRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.provider = reader.int32() as any; + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.code = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.state = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.deviceInfo = DeviceInfo.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): OAuthCallbackRequest { + return { + provider: isSet(object.provider) ? oAuthProviderFromJSON(object.provider) : 0, + code: isSet(object.code) ? globalThis.String(object.code) : "", + state: isSet(object.state) ? globalThis.String(object.state) : "", + deviceInfo: isSet(object.deviceInfo) + ? DeviceInfo.fromJSON(object.deviceInfo) + : isSet(object.device_info) + ? DeviceInfo.fromJSON(object.device_info) + : undefined, + }; + }, + + toJSON(message: OAuthCallbackRequest): unknown { + const obj: any = {}; + if (message.provider !== 0) { + obj.provider = oAuthProviderToJSON(message.provider); + } + if (message.code !== "") { + obj.code = message.code; + } + if (message.state !== "") { + obj.state = message.state; + } + if (message.deviceInfo !== undefined) { + obj.deviceInfo = DeviceInfo.toJSON(message.deviceInfo); + } + return obj; + }, + + create(base?: DeepPartial): OAuthCallbackRequest { + return OAuthCallbackRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): OAuthCallbackRequest { + const message = createBaseOAuthCallbackRequest(); + message.provider = object.provider ?? 0; + message.code = object.code ?? ""; + message.state = object.state ?? ""; + message.deviceInfo = (object.deviceInfo !== undefined && object.deviceInfo !== null) + ? DeviceInfo.fromPartial(object.deviceInfo) + : undefined; + return message; + }, +}; + +function createBaseLinkSocialAccountRequest(): LinkSocialAccountRequest { + return { actorId: "", actorToken: "", provider: 0, idToken: "", accessToken: "", nonce: "" }; +} + +export const LinkSocialAccountRequest: MessageFns = { + encode(message: LinkSocialAccountRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.actorId !== "") { + writer.uint32(10).string(message.actorId); + } + if (message.actorToken !== "") { + writer.uint32(18).string(message.actorToken); + } + if (message.provider !== 0) { + writer.uint32(24).int32(message.provider); + } + if (message.idToken !== "") { + writer.uint32(34).string(message.idToken); + } + if (message.accessToken !== "") { + writer.uint32(42).string(message.accessToken); + } + if (message.nonce !== "") { + writer.uint32(50).string(message.nonce); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): LinkSocialAccountRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseLinkSocialAccountRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.actorId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.actorToken = reader.string(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.provider = reader.int32() as any; + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.idToken = reader.string(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + message.accessToken = reader.string(); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + + message.nonce = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): LinkSocialAccountRequest { + return { + actorId: isSet(object.actorId) + ? globalThis.String(object.actorId) + : isSet(object.actor_id) + ? globalThis.String(object.actor_id) + : "", + actorToken: isSet(object.actorToken) + ? globalThis.String(object.actorToken) + : isSet(object.actor_token) + ? globalThis.String(object.actor_token) + : "", + provider: isSet(object.provider) ? oAuthProviderFromJSON(object.provider) : 0, + idToken: isSet(object.idToken) + ? globalThis.String(object.idToken) + : isSet(object.id_token) + ? globalThis.String(object.id_token) + : "", + accessToken: isSet(object.accessToken) + ? globalThis.String(object.accessToken) + : isSet(object.access_token) + ? globalThis.String(object.access_token) + : "", + nonce: isSet(object.nonce) ? globalThis.String(object.nonce) : "", + }; + }, + + toJSON(message: LinkSocialAccountRequest): unknown { + const obj: any = {}; + if (message.actorId !== "") { + obj.actorId = message.actorId; + } + if (message.actorToken !== "") { + obj.actorToken = message.actorToken; + } + if (message.provider !== 0) { + obj.provider = oAuthProviderToJSON(message.provider); + } + if (message.idToken !== "") { + obj.idToken = message.idToken; + } + if (message.accessToken !== "") { + obj.accessToken = message.accessToken; + } + if (message.nonce !== "") { + obj.nonce = message.nonce; + } + return obj; + }, + + create(base?: DeepPartial): LinkSocialAccountRequest { + return LinkSocialAccountRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): LinkSocialAccountRequest { + const message = createBaseLinkSocialAccountRequest(); + message.actorId = object.actorId ?? ""; + message.actorToken = object.actorToken ?? ""; + message.provider = object.provider ?? 0; + message.idToken = object.idToken ?? ""; + message.accessToken = object.accessToken ?? ""; + message.nonce = object.nonce ?? ""; + return message; + }, +}; + +function createBaseUnlinkSocialAccountRequest(): UnlinkSocialAccountRequest { + return { actorId: "", actorToken: "", provider: 0 }; +} + +export const UnlinkSocialAccountRequest: MessageFns = { + encode(message: UnlinkSocialAccountRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.actorId !== "") { + writer.uint32(10).string(message.actorId); + } + if (message.actorToken !== "") { + writer.uint32(18).string(message.actorToken); + } + if (message.provider !== 0) { + writer.uint32(24).int32(message.provider); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): UnlinkSocialAccountRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseUnlinkSocialAccountRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.actorId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.actorToken = reader.string(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.provider = reader.int32() as any; + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): UnlinkSocialAccountRequest { + return { + actorId: isSet(object.actorId) + ? globalThis.String(object.actorId) + : isSet(object.actor_id) + ? globalThis.String(object.actor_id) + : "", + actorToken: isSet(object.actorToken) + ? globalThis.String(object.actorToken) + : isSet(object.actor_token) + ? globalThis.String(object.actor_token) + : "", + provider: isSet(object.provider) ? oAuthProviderFromJSON(object.provider) : 0, + }; + }, + + toJSON(message: UnlinkSocialAccountRequest): unknown { + const obj: any = {}; + if (message.actorId !== "") { + obj.actorId = message.actorId; + } + if (message.actorToken !== "") { + obj.actorToken = message.actorToken; + } + if (message.provider !== 0) { + obj.provider = oAuthProviderToJSON(message.provider); + } + return obj; + }, + + create(base?: DeepPartial): UnlinkSocialAccountRequest { + return UnlinkSocialAccountRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): UnlinkSocialAccountRequest { + const message = createBaseUnlinkSocialAccountRequest(); + message.actorId = object.actorId ?? ""; + message.actorToken = object.actorToken ?? ""; + message.provider = object.provider ?? 0; + return message; + }, +}; + +function createBaseGetLinkedAccountsRequest(): GetLinkedAccountsRequest { + return { actorId: "", actorToken: "" }; +} + +export const GetLinkedAccountsRequest: MessageFns = { + encode(message: GetLinkedAccountsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.actorId !== "") { + writer.uint32(10).string(message.actorId); + } + if (message.actorToken !== "") { + writer.uint32(18).string(message.actorToken); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetLinkedAccountsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetLinkedAccountsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.actorId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.actorToken = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetLinkedAccountsRequest { + return { + actorId: isSet(object.actorId) + ? globalThis.String(object.actorId) + : isSet(object.actor_id) + ? globalThis.String(object.actor_id) + : "", + actorToken: isSet(object.actorToken) + ? globalThis.String(object.actorToken) + : isSet(object.actor_token) + ? globalThis.String(object.actor_token) + : "", + }; + }, + + toJSON(message: GetLinkedAccountsRequest): unknown { + const obj: any = {}; + if (message.actorId !== "") { + obj.actorId = message.actorId; + } + if (message.actorToken !== "") { + obj.actorToken = message.actorToken; + } + return obj; + }, + + create(base?: DeepPartial): GetLinkedAccountsRequest { + return GetLinkedAccountsRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): GetLinkedAccountsRequest { + const message = createBaseGetLinkedAccountsRequest(); + message.actorId = object.actorId ?? ""; + message.actorToken = object.actorToken ?? ""; + return message; + }, +}; + +function createBaseGetLinkedAccountsResponse(): GetLinkedAccountsResponse { + return { success: false, resultCode: 0, message: "", accounts: [] }; +} + +export const GetLinkedAccountsResponse: MessageFns = { + encode(message: GetLinkedAccountsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + if (message.resultCode !== 0) { + writer.uint32(16).int32(message.resultCode); + } + if (message.message !== "") { + writer.uint32(26).string(message.message); + } + for (const v of message.accounts) { + SocialAccount.encode(v!, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetLinkedAccountsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetLinkedAccountsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.resultCode = reader.int32() as any; + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.message = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.accounts.push(SocialAccount.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetLinkedAccountsResponse { + return { + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + resultCode: isSet(object.resultCode) + ? resultCodeFromJSON(object.resultCode) + : isSet(object.result_code) + ? resultCodeFromJSON(object.result_code) + : 0, + message: isSet(object.message) ? globalThis.String(object.message) : "", + accounts: globalThis.Array.isArray(object?.accounts) + ? object.accounts.map((e: any) => SocialAccount.fromJSON(e)) + : [], + }; + }, + + toJSON(message: GetLinkedAccountsResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + if (message.resultCode !== 0) { + obj.resultCode = resultCodeToJSON(message.resultCode); + } + if (message.message !== "") { + obj.message = message.message; + } + if (message.accounts?.length) { + obj.accounts = message.accounts.map((e) => SocialAccount.toJSON(e)); + } + return obj; + }, + + create(base?: DeepPartial): GetLinkedAccountsResponse { + return GetLinkedAccountsResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): GetLinkedAccountsResponse { + const message = createBaseGetLinkedAccountsResponse(); + message.success = object.success ?? false; + message.resultCode = object.resultCode ?? 0; + message.message = object.message ?? ""; + message.accounts = object.accounts?.map((e) => SocialAccount.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseRegisterUserRequest(): RegisterUserRequest { + return { userIdentifier: "", password: "", firstNames: "", lastName: "", appHash: "", deviceInfo: undefined }; +} + +export const RegisterUserRequest: MessageFns = { + encode(message: RegisterUserRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.userIdentifier !== "") { + writer.uint32(10).string(message.userIdentifier); + } + if (message.password !== "") { + writer.uint32(18).string(message.password); + } + if (message.firstNames !== "") { + writer.uint32(34).string(message.firstNames); + } + if (message.lastName !== "") { + writer.uint32(42).string(message.lastName); + } + if (message.appHash !== "") { + writer.uint32(50).string(message.appHash); + } + if (message.deviceInfo !== undefined) { + DeviceInfo.encode(message.deviceInfo, writer.uint32(58).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RegisterUserRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRegisterUserRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.userIdentifier = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.password = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.firstNames = reader.string(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + message.lastName = reader.string(); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + + message.appHash = reader.string(); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + + message.deviceInfo = DeviceInfo.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RegisterUserRequest { + return { + userIdentifier: isSet(object.userIdentifier) + ? globalThis.String(object.userIdentifier) + : isSet(object.user_identifier) + ? globalThis.String(object.user_identifier) + : "", + password: isSet(object.password) ? globalThis.String(object.password) : "", + firstNames: isSet(object.firstNames) + ? globalThis.String(object.firstNames) + : isSet(object.first_names) + ? globalThis.String(object.first_names) + : "", + lastName: isSet(object.lastName) + ? globalThis.String(object.lastName) + : isSet(object.last_name) + ? globalThis.String(object.last_name) + : "", + appHash: isSet(object.appHash) + ? globalThis.String(object.appHash) + : isSet(object.app_hash) + ? globalThis.String(object.app_hash) + : "", + deviceInfo: isSet(object.deviceInfo) + ? DeviceInfo.fromJSON(object.deviceInfo) + : isSet(object.device_info) + ? DeviceInfo.fromJSON(object.device_info) + : undefined, + }; + }, + + toJSON(message: RegisterUserRequest): unknown { + const obj: any = {}; + if (message.userIdentifier !== "") { + obj.userIdentifier = message.userIdentifier; + } + if (message.password !== "") { + obj.password = message.password; + } + if (message.firstNames !== "") { + obj.firstNames = message.firstNames; + } + if (message.lastName !== "") { + obj.lastName = message.lastName; + } + if (message.appHash !== "") { + obj.appHash = message.appHash; + } + if (message.deviceInfo !== undefined) { + obj.deviceInfo = DeviceInfo.toJSON(message.deviceInfo); + } + return obj; + }, + + create(base?: DeepPartial): RegisterUserRequest { + return RegisterUserRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): RegisterUserRequest { + const message = createBaseRegisterUserRequest(); + message.userIdentifier = object.userIdentifier ?? ""; + message.password = object.password ?? ""; + message.firstNames = object.firstNames ?? ""; + message.lastName = object.lastName ?? ""; + message.appHash = object.appHash ?? ""; + message.deviceInfo = (object.deviceInfo !== undefined && object.deviceInfo !== null) + ? DeviceInfo.fromPartial(object.deviceInfo) + : undefined; + return message; + }, +}; + +function createBaseRegisterUserResponse(): RegisterUserResponse { + return { success: false, resultCode: 0, message: "", registrationId: "", validationErrors: [] }; +} + +export const RegisterUserResponse: MessageFns = { + encode(message: RegisterUserResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + if (message.resultCode !== 0) { + writer.uint32(16).int32(message.resultCode); + } + if (message.message !== "") { + writer.uint32(26).string(message.message); + } + if (message.registrationId !== "") { + writer.uint32(34).string(message.registrationId); + } + for (const v of message.validationErrors) { + ValidationError.encode(v!, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RegisterUserResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRegisterUserResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.resultCode = reader.int32() as any; + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.message = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.registrationId = reader.string(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + message.validationErrors.push(ValidationError.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RegisterUserResponse { + return { + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + resultCode: isSet(object.resultCode) + ? resultCodeFromJSON(object.resultCode) + : isSet(object.result_code) + ? resultCodeFromJSON(object.result_code) + : 0, + message: isSet(object.message) ? globalThis.String(object.message) : "", + registrationId: isSet(object.registrationId) + ? globalThis.String(object.registrationId) + : isSet(object.registration_id) + ? globalThis.String(object.registration_id) + : "", + validationErrors: globalThis.Array.isArray(object?.validationErrors) + ? object.validationErrors.map((e: any) => ValidationError.fromJSON(e)) + : globalThis.Array.isArray(object?.validation_errors) + ? object.validation_errors.map((e: any) => ValidationError.fromJSON(e)) + : [], + }; + }, + + toJSON(message: RegisterUserResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + if (message.resultCode !== 0) { + obj.resultCode = resultCodeToJSON(message.resultCode); + } + if (message.message !== "") { + obj.message = message.message; + } + if (message.registrationId !== "") { + obj.registrationId = message.registrationId; + } + if (message.validationErrors?.length) { + obj.validationErrors = message.validationErrors.map((e) => ValidationError.toJSON(e)); + } + return obj; + }, + + create(base?: DeepPartial): RegisterUserResponse { + return RegisterUserResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): RegisterUserResponse { + const message = createBaseRegisterUserResponse(); + message.success = object.success ?? false; + message.resultCode = object.resultCode ?? 0; + message.message = object.message ?? ""; + message.registrationId = object.registrationId ?? ""; + message.validationErrors = object.validationErrors?.map((e) => ValidationError.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseVerifyRegisterUserRequest(): VerifyRegisterUserRequest { + return { userIdentifier: "", registrationId: "", token: "", deviceInfo: undefined }; +} + +export const VerifyRegisterUserRequest: MessageFns = { + encode(message: VerifyRegisterUserRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.userIdentifier !== "") { + writer.uint32(10).string(message.userIdentifier); + } + if (message.registrationId !== "") { + writer.uint32(18).string(message.registrationId); + } + if (message.token !== "") { + writer.uint32(26).string(message.token); + } + if (message.deviceInfo !== undefined) { + DeviceInfo.encode(message.deviceInfo, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): VerifyRegisterUserRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseVerifyRegisterUserRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.userIdentifier = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.registrationId = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.token = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.deviceInfo = DeviceInfo.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): VerifyRegisterUserRequest { + return { + userIdentifier: isSet(object.userIdentifier) + ? globalThis.String(object.userIdentifier) + : isSet(object.user_identifier) + ? globalThis.String(object.user_identifier) + : "", + registrationId: isSet(object.registrationId) + ? globalThis.String(object.registrationId) + : isSet(object.registration_id) + ? globalThis.String(object.registration_id) + : "", + token: isSet(object.token) ? globalThis.String(object.token) : "", + deviceInfo: isSet(object.deviceInfo) + ? DeviceInfo.fromJSON(object.deviceInfo) + : isSet(object.device_info) + ? DeviceInfo.fromJSON(object.device_info) + : undefined, + }; + }, + + toJSON(message: VerifyRegisterUserRequest): unknown { + const obj: any = {}; + if (message.userIdentifier !== "") { + obj.userIdentifier = message.userIdentifier; + } + if (message.registrationId !== "") { + obj.registrationId = message.registrationId; + } + if (message.token !== "") { + obj.token = message.token; + } + if (message.deviceInfo !== undefined) { + obj.deviceInfo = DeviceInfo.toJSON(message.deviceInfo); + } + return obj; + }, + + create(base?: DeepPartial): VerifyRegisterUserRequest { + return VerifyRegisterUserRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): VerifyRegisterUserRequest { + const message = createBaseVerifyRegisterUserRequest(); + message.userIdentifier = object.userIdentifier ?? ""; + message.registrationId = object.registrationId ?? ""; + message.token = object.token ?? ""; + message.deviceInfo = (object.deviceInfo !== undefined && object.deviceInfo !== null) + ? DeviceInfo.fromPartial(object.deviceInfo) + : undefined; + return message; + }, +}; + +function createBaseUserResponse(): UserResponse { + return { success: false, resultCode: 0, message: "", user: undefined }; +} + +export const UserResponse: MessageFns = { + encode(message: UserResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + if (message.resultCode !== 0) { + writer.uint32(16).int32(message.resultCode); + } + if (message.message !== "") { + writer.uint32(26).string(message.message); + } + if (message.user !== undefined) { + User.encode(message.user, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): UserResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseUserResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.resultCode = reader.int32() as any; + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.message = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.user = User.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): UserResponse { + return { + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + resultCode: isSet(object.resultCode) + ? resultCodeFromJSON(object.resultCode) + : isSet(object.result_code) + ? resultCodeFromJSON(object.result_code) + : 0, + message: isSet(object.message) ? globalThis.String(object.message) : "", + user: isSet(object.user) ? User.fromJSON(object.user) : undefined, + }; + }, + + toJSON(message: UserResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + if (message.resultCode !== 0) { + obj.resultCode = resultCodeToJSON(message.resultCode); + } + if (message.message !== "") { + obj.message = message.message; + } + if (message.user !== undefined) { + obj.user = User.toJSON(message.user); + } + return obj; + }, + + create(base?: DeepPartial): UserResponse { + return UserResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): UserResponse { + const message = createBaseUserResponse(); + message.success = object.success ?? false; + message.resultCode = object.resultCode ?? 0; + message.message = object.message ?? ""; + message.user = (object.user !== undefined && object.user !== null) ? User.fromPartial(object.user) : undefined; + return message; + }, +}; + +function createBaseDeviceInfo(): DeviceInfo { + return { + applicationName: "", + applicationVersion: "", + deviceName: "", + deviceType: "", + deviceOs: "", + deviceOsVersion: "", + deviceId: "", + }; +} + +export const DeviceInfo: MessageFns = { + encode(message: DeviceInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.applicationName !== "") { + writer.uint32(10).string(message.applicationName); + } + if (message.applicationVersion !== "") { + writer.uint32(18).string(message.applicationVersion); + } + if (message.deviceName !== "") { + writer.uint32(26).string(message.deviceName); + } + if (message.deviceType !== "") { + writer.uint32(34).string(message.deviceType); + } + if (message.deviceOs !== "") { + writer.uint32(42).string(message.deviceOs); + } + if (message.deviceOsVersion !== "") { + writer.uint32(50).string(message.deviceOsVersion); + } + if (message.deviceId !== "") { + writer.uint32(58).string(message.deviceId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DeviceInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDeviceInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.applicationName = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.applicationVersion = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.deviceName = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.deviceType = reader.string(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + message.deviceOs = reader.string(); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + + message.deviceOsVersion = reader.string(); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + + message.deviceId = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DeviceInfo { + return { + applicationName: isSet(object.applicationName) + ? globalThis.String(object.applicationName) + : isSet(object.application_name) + ? globalThis.String(object.application_name) + : "", + applicationVersion: isSet(object.applicationVersion) + ? globalThis.String(object.applicationVersion) + : isSet(object.application_version) + ? globalThis.String(object.application_version) + : "", + deviceName: isSet(object.deviceName) + ? globalThis.String(object.deviceName) + : isSet(object.device_name) + ? globalThis.String(object.device_name) + : "", + deviceType: isSet(object.deviceType) + ? globalThis.String(object.deviceType) + : isSet(object.device_type) + ? globalThis.String(object.device_type) + : "", + deviceOs: isSet(object.deviceOs) + ? globalThis.String(object.deviceOs) + : isSet(object.device_os) + ? globalThis.String(object.device_os) + : "", + deviceOsVersion: isSet(object.deviceOsVersion) + ? globalThis.String(object.deviceOsVersion) + : isSet(object.device_os_version) + ? globalThis.String(object.device_os_version) + : "", + deviceId: isSet(object.deviceId) + ? globalThis.String(object.deviceId) + : isSet(object.device_id) + ? globalThis.String(object.device_id) + : "", + }; + }, + + toJSON(message: DeviceInfo): unknown { + const obj: any = {}; + if (message.applicationName !== "") { + obj.applicationName = message.applicationName; + } + if (message.applicationVersion !== "") { + obj.applicationVersion = message.applicationVersion; + } + if (message.deviceName !== "") { + obj.deviceName = message.deviceName; + } + if (message.deviceType !== "") { + obj.deviceType = message.deviceType; + } + if (message.deviceOs !== "") { + obj.deviceOs = message.deviceOs; + } + if (message.deviceOsVersion !== "") { + obj.deviceOsVersion = message.deviceOsVersion; + } + if (message.deviceId !== "") { + obj.deviceId = message.deviceId; + } + return obj; + }, + + create(base?: DeepPartial): DeviceInfo { + return DeviceInfo.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): DeviceInfo { + const message = createBaseDeviceInfo(); + message.applicationName = object.applicationName ?? ""; + message.applicationVersion = object.applicationVersion ?? ""; + message.deviceName = object.deviceName ?? ""; + message.deviceType = object.deviceType ?? ""; + message.deviceOs = object.deviceOs ?? ""; + message.deviceOsVersion = object.deviceOsVersion ?? ""; + message.deviceId = object.deviceId ?? ""; + return message; + }, +}; + +function createBaseLoginRequest(): LoginRequest { + return { userIdentifier: "", password: "", appHash: "", deviceInfo: undefined }; +} + +export const LoginRequest: MessageFns = { + encode(message: LoginRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.userIdentifier !== "") { + writer.uint32(10).string(message.userIdentifier); + } + if (message.password !== "") { + writer.uint32(18).string(message.password); + } + if (message.appHash !== "") { + writer.uint32(26).string(message.appHash); + } + if (message.deviceInfo !== undefined) { + DeviceInfo.encode(message.deviceInfo, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): LoginRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseLoginRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.userIdentifier = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.password = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.appHash = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.deviceInfo = DeviceInfo.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): LoginRequest { + return { + userIdentifier: isSet(object.userIdentifier) + ? globalThis.String(object.userIdentifier) + : isSet(object.user_identifier) + ? globalThis.String(object.user_identifier) + : "", + password: isSet(object.password) ? globalThis.String(object.password) : "", + appHash: isSet(object.appHash) + ? globalThis.String(object.appHash) + : isSet(object.app_hash) + ? globalThis.String(object.app_hash) + : "", + deviceInfo: isSet(object.deviceInfo) + ? DeviceInfo.fromJSON(object.deviceInfo) + : isSet(object.device_info) + ? DeviceInfo.fromJSON(object.device_info) + : undefined, + }; + }, + + toJSON(message: LoginRequest): unknown { + const obj: any = {}; + if (message.userIdentifier !== "") { + obj.userIdentifier = message.userIdentifier; + } + if (message.password !== "") { + obj.password = message.password; + } + if (message.appHash !== "") { + obj.appHash = message.appHash; + } + if (message.deviceInfo !== undefined) { + obj.deviceInfo = DeviceInfo.toJSON(message.deviceInfo); + } + return obj; + }, + + create(base?: DeepPartial): LoginRequest { + return LoginRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): LoginRequest { + const message = createBaseLoginRequest(); + message.userIdentifier = object.userIdentifier ?? ""; + message.password = object.password ?? ""; + message.appHash = object.appHash ?? ""; + message.deviceInfo = (object.deviceInfo !== undefined && object.deviceInfo !== null) + ? DeviceInfo.fromPartial(object.deviceInfo) + : undefined; + return message; + }, +}; + +function createBaseAuthenticationResponse(): AuthenticationResponse { + return { + success: false, + passCodeRequired: false, + twoFactorId: "", + resultCode: 0, + message: "", + authenticatedUser: undefined, + }; +} + +export const AuthenticationResponse: MessageFns = { + encode(message: AuthenticationResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + if (message.passCodeRequired !== false) { + writer.uint32(16).bool(message.passCodeRequired); + } + if (message.twoFactorId !== "") { + writer.uint32(26).string(message.twoFactorId); + } + if (message.resultCode !== 0) { + writer.uint32(64).int32(message.resultCode); + } + if (message.message !== "") { + writer.uint32(74).string(message.message); + } + if (message.authenticatedUser !== undefined) { + AuthenticatedUser.encode(message.authenticatedUser, writer.uint32(82).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): AuthenticationResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAuthenticationResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.passCodeRequired = reader.bool(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.twoFactorId = reader.string(); + continue; + } + case 8: { + if (tag !== 64) { + break; + } + + message.resultCode = reader.int32() as any; + continue; + } + case 9: { + if (tag !== 74) { + break; + } + + message.message = reader.string(); + continue; + } + case 10: { + if (tag !== 82) { + break; + } + + message.authenticatedUser = AuthenticatedUser.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): AuthenticationResponse { + return { + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + passCodeRequired: isSet(object.passCodeRequired) + ? globalThis.Boolean(object.passCodeRequired) + : isSet(object.pass_code_required) + ? globalThis.Boolean(object.pass_code_required) + : false, + twoFactorId: isSet(object.twoFactorId) + ? globalThis.String(object.twoFactorId) + : isSet(object.two_factor_id) + ? globalThis.String(object.two_factor_id) + : "", + resultCode: isSet(object.resultCode) + ? resultCodeFromJSON(object.resultCode) + : isSet(object.result_code) + ? resultCodeFromJSON(object.result_code) + : 0, + message: isSet(object.message) ? globalThis.String(object.message) : "", + authenticatedUser: isSet(object.authenticatedUser) + ? AuthenticatedUser.fromJSON(object.authenticatedUser) + : isSet(object.authenticated_user) + ? AuthenticatedUser.fromJSON(object.authenticated_user) + : undefined, + }; + }, + + toJSON(message: AuthenticationResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + if (message.passCodeRequired !== false) { + obj.passCodeRequired = message.passCodeRequired; + } + if (message.twoFactorId !== "") { + obj.twoFactorId = message.twoFactorId; + } + if (message.resultCode !== 0) { + obj.resultCode = resultCodeToJSON(message.resultCode); + } + if (message.message !== "") { + obj.message = message.message; + } + if (message.authenticatedUser !== undefined) { + obj.authenticatedUser = AuthenticatedUser.toJSON(message.authenticatedUser); + } + return obj; + }, + + create(base?: DeepPartial): AuthenticationResponse { + return AuthenticationResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): AuthenticationResponse { + const message = createBaseAuthenticationResponse(); + message.success = object.success ?? false; + message.passCodeRequired = object.passCodeRequired ?? false; + message.twoFactorId = object.twoFactorId ?? ""; + message.resultCode = object.resultCode ?? 0; + message.message = object.message ?? ""; + message.authenticatedUser = (object.authenticatedUser !== undefined && object.authenticatedUser !== null) + ? AuthenticatedUser.fromPartial(object.authenticatedUser) + : undefined; + return message; + }, +}; + +function createBaseAuthenticatedUser(): AuthenticatedUser { + return { user: undefined, token: "", sessionId: "", expiresAt: undefined, userPreferences: [], userRoles: [] }; +} + +export const AuthenticatedUser: MessageFns = { + encode(message: AuthenticatedUser, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.user !== undefined) { + User.encode(message.user, writer.uint32(10).fork()).join(); + } + if (message.token !== "") { + writer.uint32(18).string(message.token); + } + if (message.sessionId !== "") { + writer.uint32(26).string(message.sessionId); + } + if (message.expiresAt !== undefined) { + Timestamp.encode(toTimestamp(message.expiresAt), writer.uint32(34).fork()).join(); + } + for (const v of message.userPreferences) { + UserPreference.encode(v!, writer.uint32(42).fork()).join(); + } + for (const v of message.userRoles) { + AssignedUserRole.encode(v!, writer.uint32(90).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): AuthenticatedUser { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAuthenticatedUser(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.user = User.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.token = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.sessionId = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.expiresAt = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + message.userPreferences.push(UserPreference.decode(reader, reader.uint32())); + continue; + } + case 11: { + if (tag !== 90) { + break; + } + + message.userRoles.push(AssignedUserRole.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): AuthenticatedUser { + return { + user: isSet(object.user) ? User.fromJSON(object.user) : undefined, + token: isSet(object.token) ? globalThis.String(object.token) : "", + sessionId: isSet(object.sessionId) + ? globalThis.String(object.sessionId) + : isSet(object.session_id) + ? globalThis.String(object.session_id) + : "", + expiresAt: isSet(object.expiresAt) + ? fromJsonTimestamp(object.expiresAt) + : isSet(object.expires_at) + ? fromJsonTimestamp(object.expires_at) + : undefined, + userPreferences: globalThis.Array.isArray(object?.userPreferences) + ? object.userPreferences.map((e: any) => UserPreference.fromJSON(e)) + : globalThis.Array.isArray(object?.user_preferences) + ? object.user_preferences.map((e: any) => UserPreference.fromJSON(e)) + : [], + userRoles: globalThis.Array.isArray(object?.userRoles) + ? object.userRoles.map((e: any) => AssignedUserRole.fromJSON(e)) + : globalThis.Array.isArray(object?.user_roles) + ? object.user_roles.map((e: any) => AssignedUserRole.fromJSON(e)) + : [], + }; + }, + + toJSON(message: AuthenticatedUser): unknown { + const obj: any = {}; + if (message.user !== undefined) { + obj.user = User.toJSON(message.user); + } + if (message.token !== "") { + obj.token = message.token; + } + if (message.sessionId !== "") { + obj.sessionId = message.sessionId; + } + if (message.expiresAt !== undefined) { + obj.expiresAt = message.expiresAt.toISOString(); + } + if (message.userPreferences?.length) { + obj.userPreferences = message.userPreferences.map((e) => UserPreference.toJSON(e)); + } + if (message.userRoles?.length) { + obj.userRoles = message.userRoles.map((e) => AssignedUserRole.toJSON(e)); + } + return obj; + }, + + create(base?: DeepPartial): AuthenticatedUser { + return AuthenticatedUser.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): AuthenticatedUser { + const message = createBaseAuthenticatedUser(); + message.user = (object.user !== undefined && object.user !== null) ? User.fromPartial(object.user) : undefined; + message.token = object.token ?? ""; + message.sessionId = object.sessionId ?? ""; + message.expiresAt = object.expiresAt ?? undefined; + message.userPreferences = object.userPreferences?.map((e) => UserPreference.fromPartial(e)) || []; + message.userRoles = object.userRoles?.map((e) => AssignedUserRole.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseAssignedUserRole(): AssignedUserRole { + return { id: "", userId: "", roleId: "", roleName: "", scopeCode: "", targetId: "" }; +} + +export const AssignedUserRole: MessageFns = { + encode(message: AssignedUserRole, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.id !== "") { + writer.uint32(10).string(message.id); + } + if (message.userId !== "") { + writer.uint32(18).string(message.userId); + } + if (message.roleId !== "") { + writer.uint32(26).string(message.roleId); + } + if (message.roleName !== "") { + writer.uint32(34).string(message.roleName); + } + if (message.scopeCode !== "") { + writer.uint32(42).string(message.scopeCode); + } + if (message.targetId !== "") { + writer.uint32(50).string(message.targetId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): AssignedUserRole { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAssignedUserRole(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.id = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.userId = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.roleId = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.roleName = reader.string(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + message.scopeCode = reader.string(); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + + message.targetId = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): AssignedUserRole { + return { + id: isSet(object.id) ? globalThis.String(object.id) : "", + userId: isSet(object.userId) + ? globalThis.String(object.userId) + : isSet(object.user_id) + ? globalThis.String(object.user_id) + : "", + roleId: isSet(object.roleId) + ? globalThis.String(object.roleId) + : isSet(object.role_id) + ? globalThis.String(object.role_id) + : "", + roleName: isSet(object.roleName) + ? globalThis.String(object.roleName) + : isSet(object.role_name) + ? globalThis.String(object.role_name) + : "", + scopeCode: isSet(object.scopeCode) + ? globalThis.String(object.scopeCode) + : isSet(object.scope_code) + ? globalThis.String(object.scope_code) + : "", + targetId: isSet(object.targetId) + ? globalThis.String(object.targetId) + : isSet(object.target_id) + ? globalThis.String(object.target_id) + : "", + }; + }, + + toJSON(message: AssignedUserRole): unknown { + const obj: any = {}; + if (message.id !== "") { + obj.id = message.id; + } + if (message.userId !== "") { + obj.userId = message.userId; + } + if (message.roleId !== "") { + obj.roleId = message.roleId; + } + if (message.roleName !== "") { + obj.roleName = message.roleName; + } + if (message.scopeCode !== "") { + obj.scopeCode = message.scopeCode; + } + if (message.targetId !== "") { + obj.targetId = message.targetId; + } + return obj; + }, + + create(base?: DeepPartial): AssignedUserRole { + return AssignedUserRole.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): AssignedUserRole { + const message = createBaseAssignedUserRole(); + message.id = object.id ?? ""; + message.userId = object.userId ?? ""; + message.roleId = object.roleId ?? ""; + message.roleName = object.roleName ?? ""; + message.scopeCode = object.scopeCode ?? ""; + message.targetId = object.targetId ?? ""; + return message; + }, +}; + +function createBaseVerifyTokenRequest(): VerifyTokenRequest { + return { token: "", includeUserRoles: false, roleScopes: [], roleNames: [] }; +} + +export const VerifyTokenRequest: MessageFns = { + encode(message: VerifyTokenRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.token !== "") { + writer.uint32(10).string(message.token); + } + if (message.includeUserRoles !== false) { + writer.uint32(16).bool(message.includeUserRoles); + } + for (const v of message.roleScopes) { + writer.uint32(26).string(v!); + } + for (const v of message.roleNames) { + writer.uint32(34).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): VerifyTokenRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseVerifyTokenRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.token = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.includeUserRoles = reader.bool(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.roleScopes.push(reader.string()); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.roleNames.push(reader.string()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): VerifyTokenRequest { + return { + token: isSet(object.token) ? globalThis.String(object.token) : "", + includeUserRoles: isSet(object.includeUserRoles) + ? globalThis.Boolean(object.includeUserRoles) + : isSet(object.include_user_roles) + ? globalThis.Boolean(object.include_user_roles) + : false, + roleScopes: globalThis.Array.isArray(object?.roleScopes) + ? object.roleScopes.map((e: any) => globalThis.String(e)) + : globalThis.Array.isArray(object?.role_scopes) + ? object.role_scopes.map((e: any) => globalThis.String(e)) + : [], + roleNames: globalThis.Array.isArray(object?.roleNames) + ? object.roleNames.map((e: any) => globalThis.String(e)) + : globalThis.Array.isArray(object?.role_names) + ? object.role_names.map((e: any) => globalThis.String(e)) + : [], + }; + }, + + toJSON(message: VerifyTokenRequest): unknown { + const obj: any = {}; + if (message.token !== "") { + obj.token = message.token; + } + if (message.includeUserRoles !== false) { + obj.includeUserRoles = message.includeUserRoles; + } + if (message.roleScopes?.length) { + obj.roleScopes = message.roleScopes; + } + if (message.roleNames?.length) { + obj.roleNames = message.roleNames; + } + return obj; + }, + + create(base?: DeepPartial): VerifyTokenRequest { + return VerifyTokenRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): VerifyTokenRequest { + const message = createBaseVerifyTokenRequest(); + message.token = object.token ?? ""; + message.includeUserRoles = object.includeUserRoles ?? false; + message.roleScopes = object.roleScopes?.map((e) => e) || []; + message.roleNames = object.roleNames?.map((e) => e) || []; + return message; + }, +}; + +function createBaseVerifyAuthClaimTokenRequest(): VerifyAuthClaimTokenRequest { + return { claim: "" }; +} + +export const VerifyAuthClaimTokenRequest: MessageFns = { + encode(message: VerifyAuthClaimTokenRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.claim !== "") { + writer.uint32(18).string(message.claim); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): VerifyAuthClaimTokenRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseVerifyAuthClaimTokenRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 2: { + if (tag !== 18) { + break; + } + + message.claim = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): VerifyAuthClaimTokenRequest { + return { claim: isSet(object.claim) ? globalThis.String(object.claim) : "" }; + }, + + toJSON(message: VerifyAuthClaimTokenRequest): unknown { + const obj: any = {}; + if (message.claim !== "") { + obj.claim = message.claim; + } + return obj; + }, + + create(base?: DeepPartial): VerifyAuthClaimTokenRequest { + return VerifyAuthClaimTokenRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): VerifyAuthClaimTokenRequest { + const message = createBaseVerifyAuthClaimTokenRequest(); + message.claim = object.claim ?? ""; + return message; + }, +}; + +function createBaseInitiateTwoFactorResponse(): InitiateTwoFactorResponse { + return { success: false, resultCode: 0, message: "", twoFactorId: "", channel: 0, userId: "", validationErrors: [] }; +} + +export const InitiateTwoFactorResponse: MessageFns = { + encode(message: InitiateTwoFactorResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + if (message.resultCode !== 0) { + writer.uint32(16).int32(message.resultCode); + } + if (message.message !== "") { + writer.uint32(26).string(message.message); + } + if (message.twoFactorId !== "") { + writer.uint32(34).string(message.twoFactorId); + } + if (message.channel !== 0) { + writer.uint32(40).int32(message.channel); + } + if (message.userId !== "") { + writer.uint32(58).string(message.userId); + } + for (const v of message.validationErrors) { + ValidationError.encode(v!, writer.uint32(50).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): InitiateTwoFactorResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseInitiateTwoFactorResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.resultCode = reader.int32() as any; + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.message = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.twoFactorId = reader.string(); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + + message.channel = reader.int32() as any; + continue; + } + case 7: { + if (tag !== 58) { + break; + } + + message.userId = reader.string(); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + + message.validationErrors.push(ValidationError.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): InitiateTwoFactorResponse { + return { + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + resultCode: isSet(object.resultCode) + ? resultCodeFromJSON(object.resultCode) + : isSet(object.result_code) + ? resultCodeFromJSON(object.result_code) + : 0, + message: isSet(object.message) ? globalThis.String(object.message) : "", + twoFactorId: isSet(object.twoFactorId) + ? globalThis.String(object.twoFactorId) + : isSet(object.two_factor_id) + ? globalThis.String(object.two_factor_id) + : "", + channel: isSet(object.channel) ? channelTypeFromJSON(object.channel) : 0, + userId: isSet(object.userId) + ? globalThis.String(object.userId) + : isSet(object.user_id) + ? globalThis.String(object.user_id) + : "", + validationErrors: globalThis.Array.isArray(object?.validationErrors) + ? object.validationErrors.map((e: any) => ValidationError.fromJSON(e)) + : globalThis.Array.isArray(object?.validation_errors) + ? object.validation_errors.map((e: any) => ValidationError.fromJSON(e)) + : [], + }; + }, + + toJSON(message: InitiateTwoFactorResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + if (message.resultCode !== 0) { + obj.resultCode = resultCodeToJSON(message.resultCode); + } + if (message.message !== "") { + obj.message = message.message; + } + if (message.twoFactorId !== "") { + obj.twoFactorId = message.twoFactorId; + } + if (message.channel !== 0) { + obj.channel = channelTypeToJSON(message.channel); + } + if (message.userId !== "") { + obj.userId = message.userId; + } + if (message.validationErrors?.length) { + obj.validationErrors = message.validationErrors.map((e) => ValidationError.toJSON(e)); + } + return obj; + }, + + create(base?: DeepPartial): InitiateTwoFactorResponse { + return InitiateTwoFactorResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): InitiateTwoFactorResponse { + const message = createBaseInitiateTwoFactorResponse(); + message.success = object.success ?? false; + message.resultCode = object.resultCode ?? 0; + message.message = object.message ?? ""; + message.twoFactorId = object.twoFactorId ?? ""; + message.channel = object.channel ?? 0; + message.userId = object.userId ?? ""; + message.validationErrors = object.validationErrors?.map((e) => ValidationError.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseVerifyTwoFactorResponse(): VerifyTwoFactorResponse { + return { success: false, resultCode: 0, message: "", validationErrors: [] }; +} + +export const VerifyTwoFactorResponse: MessageFns = { + encode(message: VerifyTwoFactorResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + if (message.resultCode !== 0) { + writer.uint32(16).int32(message.resultCode); + } + if (message.message !== "") { + writer.uint32(26).string(message.message); + } + for (const v of message.validationErrors) { + ValidationError.encode(v!, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): VerifyTwoFactorResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseVerifyTwoFactorResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.resultCode = reader.int32() as any; + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.message = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.validationErrors.push(ValidationError.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): VerifyTwoFactorResponse { + return { + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + resultCode: isSet(object.resultCode) + ? resultCodeFromJSON(object.resultCode) + : isSet(object.result_code) + ? resultCodeFromJSON(object.result_code) + : 0, + message: isSet(object.message) ? globalThis.String(object.message) : "", + validationErrors: globalThis.Array.isArray(object?.validationErrors) + ? object.validationErrors.map((e: any) => ValidationError.fromJSON(e)) + : globalThis.Array.isArray(object?.validation_errors) + ? object.validation_errors.map((e: any) => ValidationError.fromJSON(e)) + : [], + }; + }, + + toJSON(message: VerifyTwoFactorResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + if (message.resultCode !== 0) { + obj.resultCode = resultCodeToJSON(message.resultCode); + } + if (message.message !== "") { + obj.message = message.message; + } + if (message.validationErrors?.length) { + obj.validationErrors = message.validationErrors.map((e) => ValidationError.toJSON(e)); + } + return obj; + }, + + create(base?: DeepPartial): VerifyTwoFactorResponse { + return VerifyTwoFactorResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): VerifyTwoFactorResponse { + const message = createBaseVerifyTwoFactorResponse(); + message.success = object.success ?? false; + message.resultCode = object.resultCode ?? 0; + message.message = object.message ?? ""; + message.validationErrors = object.validationErrors?.map((e) => ValidationError.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseInitiateTwoFactorRequest(): InitiateTwoFactorRequest { + return { userId: undefined, userIdentifier: undefined, channel: 0, appHash: "", deviceInfo: undefined }; +} + +export const InitiateTwoFactorRequest: MessageFns = { + encode(message: InitiateTwoFactorRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.userId !== undefined) { + writer.uint32(10).string(message.userId); + } + if (message.userIdentifier !== undefined) { + writer.uint32(42).string(message.userIdentifier); + } + if (message.channel !== 0) { + writer.uint32(16).int32(message.channel); + } + if (message.appHash !== "") { + writer.uint32(26).string(message.appHash); + } + if (message.deviceInfo !== undefined) { + DeviceInfo.encode(message.deviceInfo, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): InitiateTwoFactorRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseInitiateTwoFactorRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.userId = reader.string(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + message.userIdentifier = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.channel = reader.int32() as any; + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.appHash = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.deviceInfo = DeviceInfo.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): InitiateTwoFactorRequest { + return { + userId: isSet(object.userId) + ? globalThis.String(object.userId) + : isSet(object.user_id) + ? globalThis.String(object.user_id) + : undefined, + userIdentifier: isSet(object.userIdentifier) + ? globalThis.String(object.userIdentifier) + : isSet(object.user_identifier) + ? globalThis.String(object.user_identifier) + : undefined, + channel: isSet(object.channel) ? channelTypeFromJSON(object.channel) : 0, + appHash: isSet(object.appHash) + ? globalThis.String(object.appHash) + : isSet(object.app_hash) + ? globalThis.String(object.app_hash) + : "", + deviceInfo: isSet(object.deviceInfo) + ? DeviceInfo.fromJSON(object.deviceInfo) + : isSet(object.device_info) + ? DeviceInfo.fromJSON(object.device_info) + : undefined, + }; + }, + + toJSON(message: InitiateTwoFactorRequest): unknown { + const obj: any = {}; + if (message.userId !== undefined) { + obj.userId = message.userId; + } + if (message.userIdentifier !== undefined) { + obj.userIdentifier = message.userIdentifier; + } + if (message.channel !== 0) { + obj.channel = channelTypeToJSON(message.channel); + } + if (message.appHash !== "") { + obj.appHash = message.appHash; + } + if (message.deviceInfo !== undefined) { + obj.deviceInfo = DeviceInfo.toJSON(message.deviceInfo); + } + return obj; + }, + + create(base?: DeepPartial): InitiateTwoFactorRequest { + return InitiateTwoFactorRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): InitiateTwoFactorRequest { + const message = createBaseInitiateTwoFactorRequest(); + message.userId = object.userId ?? undefined; + message.userIdentifier = object.userIdentifier ?? undefined; + message.channel = object.channel ?? 0; + message.appHash = object.appHash ?? ""; + message.deviceInfo = (object.deviceInfo !== undefined && object.deviceInfo !== null) + ? DeviceInfo.fromPartial(object.deviceInfo) + : undefined; + return message; + }, +}; + +function createBaseVerifyTwoFactorRequest(): VerifyTwoFactorRequest { + return { twoFactorId: "", code: "", deviceInfo: undefined }; +} + +export const VerifyTwoFactorRequest: MessageFns = { + encode(message: VerifyTwoFactorRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.twoFactorId !== "") { + writer.uint32(10).string(message.twoFactorId); + } + if (message.code !== "") { + writer.uint32(18).string(message.code); + } + if (message.deviceInfo !== undefined) { + DeviceInfo.encode(message.deviceInfo, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): VerifyTwoFactorRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseVerifyTwoFactorRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.twoFactorId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.code = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.deviceInfo = DeviceInfo.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): VerifyTwoFactorRequest { + return { + twoFactorId: isSet(object.twoFactorId) + ? globalThis.String(object.twoFactorId) + : isSet(object.two_factor_id) + ? globalThis.String(object.two_factor_id) + : "", + code: isSet(object.code) ? globalThis.String(object.code) : "", + deviceInfo: isSet(object.deviceInfo) + ? DeviceInfo.fromJSON(object.deviceInfo) + : isSet(object.device_info) + ? DeviceInfo.fromJSON(object.device_info) + : undefined, + }; + }, + + toJSON(message: VerifyTwoFactorRequest): unknown { + const obj: any = {}; + if (message.twoFactorId !== "") { + obj.twoFactorId = message.twoFactorId; + } + if (message.code !== "") { + obj.code = message.code; + } + if (message.deviceInfo !== undefined) { + obj.deviceInfo = DeviceInfo.toJSON(message.deviceInfo); + } + return obj; + }, + + create(base?: DeepPartial): VerifyTwoFactorRequest { + return VerifyTwoFactorRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): VerifyTwoFactorRequest { + const message = createBaseVerifyTwoFactorRequest(); + message.twoFactorId = object.twoFactorId ?? ""; + message.code = object.code ?? ""; + message.deviceInfo = (object.deviceInfo !== undefined && object.deviceInfo !== null) + ? DeviceInfo.fromPartial(object.deviceInfo) + : undefined; + return message; + }, +}; + +function createBaseInitiatePasswordResetRequest(): InitiatePasswordResetRequest { + return { userIdentifier: "", appHash: "", deviceInfo: undefined, newPassword: "" }; +} + +export const InitiatePasswordResetRequest: MessageFns = { + encode(message: InitiatePasswordResetRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.userIdentifier !== "") { + writer.uint32(10).string(message.userIdentifier); + } + if (message.appHash !== "") { + writer.uint32(18).string(message.appHash); + } + if (message.deviceInfo !== undefined) { + DeviceInfo.encode(message.deviceInfo, writer.uint32(34).fork()).join(); + } + if (message.newPassword !== "") { + writer.uint32(42).string(message.newPassword); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): InitiatePasswordResetRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseInitiatePasswordResetRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.userIdentifier = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.appHash = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.deviceInfo = DeviceInfo.decode(reader, reader.uint32()); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + message.newPassword = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): InitiatePasswordResetRequest { + return { + userIdentifier: isSet(object.userIdentifier) + ? globalThis.String(object.userIdentifier) + : isSet(object.user_identifier) + ? globalThis.String(object.user_identifier) + : "", + appHash: isSet(object.appHash) + ? globalThis.String(object.appHash) + : isSet(object.app_hash) + ? globalThis.String(object.app_hash) + : "", + deviceInfo: isSet(object.deviceInfo) + ? DeviceInfo.fromJSON(object.deviceInfo) + : isSet(object.device_info) + ? DeviceInfo.fromJSON(object.device_info) + : undefined, + newPassword: isSet(object.newPassword) + ? globalThis.String(object.newPassword) + : isSet(object.new_password) + ? globalThis.String(object.new_password) + : "", + }; + }, + + toJSON(message: InitiatePasswordResetRequest): unknown { + const obj: any = {}; + if (message.userIdentifier !== "") { + obj.userIdentifier = message.userIdentifier; + } + if (message.appHash !== "") { + obj.appHash = message.appHash; + } + if (message.deviceInfo !== undefined) { + obj.deviceInfo = DeviceInfo.toJSON(message.deviceInfo); + } + if (message.newPassword !== "") { + obj.newPassword = message.newPassword; + } + return obj; + }, + + create(base?: DeepPartial): InitiatePasswordResetRequest { + return InitiatePasswordResetRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): InitiatePasswordResetRequest { + const message = createBaseInitiatePasswordResetRequest(); + message.userIdentifier = object.userIdentifier ?? ""; + message.appHash = object.appHash ?? ""; + message.deviceInfo = (object.deviceInfo !== undefined && object.deviceInfo !== null) + ? DeviceInfo.fromPartial(object.deviceInfo) + : undefined; + message.newPassword = object.newPassword ?? ""; + return message; + }, +}; + +function createBaseOperationResponse(): OperationResponse { + return { success: false, resultCode: 0, message: "" }; +} + +export const OperationResponse: MessageFns = { + encode(message: OperationResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + if (message.resultCode !== 0) { + writer.uint32(16).int32(message.resultCode); + } + if (message.message !== "") { + writer.uint32(26).string(message.message); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): OperationResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseOperationResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.resultCode = reader.int32() as any; + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.message = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): OperationResponse { + return { + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + resultCode: isSet(object.resultCode) + ? resultCodeFromJSON(object.resultCode) + : isSet(object.result_code) + ? resultCodeFromJSON(object.result_code) + : 0, + message: isSet(object.message) ? globalThis.String(object.message) : "", + }; + }, + + toJSON(message: OperationResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + if (message.resultCode !== 0) { + obj.resultCode = resultCodeToJSON(message.resultCode); + } + if (message.message !== "") { + obj.message = message.message; + } + return obj; + }, + + create(base?: DeepPartial): OperationResponse { + return OperationResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): OperationResponse { + const message = createBaseOperationResponse(); + message.success = object.success ?? false; + message.resultCode = object.resultCode ?? 0; + message.message = object.message ?? ""; + return message; + }, +}; + +function createBaseVerifyPasswordResetTokenRequest(): VerifyPasswordResetTokenRequest { + return { userId: "", passwordResetId: "", passcode: "" }; +} + +export const VerifyPasswordResetTokenRequest: MessageFns = { + encode(message: VerifyPasswordResetTokenRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.userId !== "") { + writer.uint32(10).string(message.userId); + } + if (message.passwordResetId !== "") { + writer.uint32(18).string(message.passwordResetId); + } + if (message.passcode !== "") { + writer.uint32(26).string(message.passcode); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): VerifyPasswordResetTokenRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseVerifyPasswordResetTokenRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.userId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.passwordResetId = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.passcode = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): VerifyPasswordResetTokenRequest { + return { + userId: isSet(object.userId) + ? globalThis.String(object.userId) + : isSet(object.user_id) + ? globalThis.String(object.user_id) + : "", + passwordResetId: isSet(object.passwordResetId) + ? globalThis.String(object.passwordResetId) + : isSet(object.password_reset_id) + ? globalThis.String(object.password_reset_id) + : "", + passcode: isSet(object.passcode) ? globalThis.String(object.passcode) : "", + }; + }, + + toJSON(message: VerifyPasswordResetTokenRequest): unknown { + const obj: any = {}; + if (message.userId !== "") { + obj.userId = message.userId; + } + if (message.passwordResetId !== "") { + obj.passwordResetId = message.passwordResetId; + } + if (message.passcode !== "") { + obj.passcode = message.passcode; + } + return obj; + }, + + create(base?: DeepPartial): VerifyPasswordResetTokenRequest { + return VerifyPasswordResetTokenRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): VerifyPasswordResetTokenRequest { + const message = createBaseVerifyPasswordResetTokenRequest(); + message.userId = object.userId ?? ""; + message.passwordResetId = object.passwordResetId ?? ""; + message.passcode = object.passcode ?? ""; + return message; + }, +}; + +function createBasePasswordResetTokenResponse(): PasswordResetTokenResponse { + return { success: false, resultCode: 0, message: "", passwordResetId: "" }; +} + +export const PasswordResetTokenResponse: MessageFns = { + encode(message: PasswordResetTokenResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + if (message.resultCode !== 0) { + writer.uint32(16).int32(message.resultCode); + } + if (message.message !== "") { + writer.uint32(26).string(message.message); + } + if (message.passwordResetId !== "") { + writer.uint32(34).string(message.passwordResetId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PasswordResetTokenResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePasswordResetTokenResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.resultCode = reader.int32() as any; + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.message = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.passwordResetId = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PasswordResetTokenResponse { + return { + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + resultCode: isSet(object.resultCode) + ? resultCodeFromJSON(object.resultCode) + : isSet(object.result_code) + ? resultCodeFromJSON(object.result_code) + : 0, + message: isSet(object.message) ? globalThis.String(object.message) : "", + passwordResetId: isSet(object.passwordResetId) + ? globalThis.String(object.passwordResetId) + : isSet(object.password_reset_id) + ? globalThis.String(object.password_reset_id) + : "", + }; + }, + + toJSON(message: PasswordResetTokenResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + if (message.resultCode !== 0) { + obj.resultCode = resultCodeToJSON(message.resultCode); + } + if (message.message !== "") { + obj.message = message.message; + } + if (message.passwordResetId !== "") { + obj.passwordResetId = message.passwordResetId; + } + return obj; + }, + + create(base?: DeepPartial): PasswordResetTokenResponse { + return PasswordResetTokenResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): PasswordResetTokenResponse { + const message = createBasePasswordResetTokenResponse(); + message.success = object.success ?? false; + message.resultCode = object.resultCode ?? 0; + message.message = object.message ?? ""; + message.passwordResetId = object.passwordResetId ?? ""; + return message; + }, +}; + +function createBaseResetPasswordRequest(): ResetPasswordRequest { + return { userId: "", passwordResetId: "", passcode: "", deviceInfo: undefined }; +} + +export const ResetPasswordRequest: MessageFns = { + encode(message: ResetPasswordRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.userId !== "") { + writer.uint32(10).string(message.userId); + } + if (message.passwordResetId !== "") { + writer.uint32(18).string(message.passwordResetId); + } + if (message.passcode !== "") { + writer.uint32(26).string(message.passcode); + } + if (message.deviceInfo !== undefined) { + DeviceInfo.encode(message.deviceInfo, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ResetPasswordRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResetPasswordRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.userId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.passwordResetId = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.passcode = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.deviceInfo = DeviceInfo.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ResetPasswordRequest { + return { + userId: isSet(object.userId) + ? globalThis.String(object.userId) + : isSet(object.user_id) + ? globalThis.String(object.user_id) + : "", + passwordResetId: isSet(object.passwordResetId) + ? globalThis.String(object.passwordResetId) + : isSet(object.password_reset_id) + ? globalThis.String(object.password_reset_id) + : "", + passcode: isSet(object.passcode) ? globalThis.String(object.passcode) : "", + deviceInfo: isSet(object.deviceInfo) + ? DeviceInfo.fromJSON(object.deviceInfo) + : isSet(object.device_info) + ? DeviceInfo.fromJSON(object.device_info) + : undefined, + }; + }, + + toJSON(message: ResetPasswordRequest): unknown { + const obj: any = {}; + if (message.userId !== "") { + obj.userId = message.userId; + } + if (message.passwordResetId !== "") { + obj.passwordResetId = message.passwordResetId; + } + if (message.passcode !== "") { + obj.passcode = message.passcode; + } + if (message.deviceInfo !== undefined) { + obj.deviceInfo = DeviceInfo.toJSON(message.deviceInfo); + } + return obj; + }, + + create(base?: DeepPartial): ResetPasswordRequest { + return ResetPasswordRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): ResetPasswordRequest { + const message = createBaseResetPasswordRequest(); + message.userId = object.userId ?? ""; + message.passwordResetId = object.passwordResetId ?? ""; + message.passcode = object.passcode ?? ""; + message.deviceInfo = (object.deviceInfo !== undefined && object.deviceInfo !== null) + ? DeviceInfo.fromPartial(object.deviceInfo) + : undefined; + return message; + }, +}; + +function createBaseChangeIdentityFieldRequest(): ChangeIdentityFieldRequest { + return { userId: "", userToken: "", channel: 0, newValue: "", fieldType: 0, appHash: "", deviceInfo: undefined }; +} + +export const ChangeIdentityFieldRequest: MessageFns = { + encode(message: ChangeIdentityFieldRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.userId !== "") { + writer.uint32(10).string(message.userId); + } + if (message.userToken !== "") { + writer.uint32(18).string(message.userToken); + } + if (message.channel !== 0) { + writer.uint32(24).int32(message.channel); + } + if (message.newValue !== "") { + writer.uint32(34).string(message.newValue); + } + if (message.fieldType !== 0) { + writer.uint32(40).int32(message.fieldType); + } + if (message.appHash !== "") { + writer.uint32(50).string(message.appHash); + } + if (message.deviceInfo !== undefined) { + DeviceInfo.encode(message.deviceInfo, writer.uint32(58).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ChangeIdentityFieldRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseChangeIdentityFieldRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.userId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.userToken = reader.string(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.channel = reader.int32() as any; + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.newValue = reader.string(); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + + message.fieldType = reader.int32() as any; + continue; + } + case 6: { + if (tag !== 50) { + break; + } + + message.appHash = reader.string(); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + + message.deviceInfo = DeviceInfo.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ChangeIdentityFieldRequest { + return { + userId: isSet(object.userId) + ? globalThis.String(object.userId) + : isSet(object.user_id) + ? globalThis.String(object.user_id) + : "", + userToken: isSet(object.userToken) + ? globalThis.String(object.userToken) + : isSet(object.user_token) + ? globalThis.String(object.user_token) + : "", + channel: isSet(object.channel) ? channelTypeFromJSON(object.channel) : 0, + newValue: isSet(object.newValue) + ? globalThis.String(object.newValue) + : isSet(object.new_value) + ? globalThis.String(object.new_value) + : "", + fieldType: isSet(object.fieldType) + ? identityFieldFromJSON(object.fieldType) + : isSet(object.field_type) + ? identityFieldFromJSON(object.field_type) + : 0, + appHash: isSet(object.appHash) + ? globalThis.String(object.appHash) + : isSet(object.app_hash) + ? globalThis.String(object.app_hash) + : "", + deviceInfo: isSet(object.deviceInfo) + ? DeviceInfo.fromJSON(object.deviceInfo) + : isSet(object.device_info) + ? DeviceInfo.fromJSON(object.device_info) + : undefined, + }; + }, + + toJSON(message: ChangeIdentityFieldRequest): unknown { + const obj: any = {}; + if (message.userId !== "") { + obj.userId = message.userId; + } + if (message.userToken !== "") { + obj.userToken = message.userToken; + } + if (message.channel !== 0) { + obj.channel = channelTypeToJSON(message.channel); + } + if (message.newValue !== "") { + obj.newValue = message.newValue; + } + if (message.fieldType !== 0) { + obj.fieldType = identityFieldToJSON(message.fieldType); + } + if (message.appHash !== "") { + obj.appHash = message.appHash; + } + if (message.deviceInfo !== undefined) { + obj.deviceInfo = DeviceInfo.toJSON(message.deviceInfo); + } + return obj; + }, + + create(base?: DeepPartial): ChangeIdentityFieldRequest { + return ChangeIdentityFieldRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): ChangeIdentityFieldRequest { + const message = createBaseChangeIdentityFieldRequest(); + message.userId = object.userId ?? ""; + message.userToken = object.userToken ?? ""; + message.channel = object.channel ?? 0; + message.newValue = object.newValue ?? ""; + message.fieldType = object.fieldType ?? 0; + message.appHash = object.appHash ?? ""; + message.deviceInfo = (object.deviceInfo !== undefined && object.deviceInfo !== null) + ? DeviceInfo.fromPartial(object.deviceInfo) + : undefined; + return message; + }, +}; + +function createBaseChangeIdentityFieldResponse(): ChangeIdentityFieldResponse { + return { + success: false, + resultCode: 0, + message: "", + challengeId: "", + passcodeSize: 0, + userIdentifier: "", + channel: 0, + validationErrors: [], + }; +} + +export const ChangeIdentityFieldResponse: MessageFns = { + encode(message: ChangeIdentityFieldResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + if (message.resultCode !== 0) { + writer.uint32(16).int32(message.resultCode); + } + if (message.message !== "") { + writer.uint32(26).string(message.message); + } + if (message.challengeId !== "") { + writer.uint32(34).string(message.challengeId); + } + if (message.passcodeSize !== 0) { + writer.uint32(40).int32(message.passcodeSize); + } + if (message.userIdentifier !== "") { + writer.uint32(50).string(message.userIdentifier); + } + if (message.channel !== 0) { + writer.uint32(56).int32(message.channel); + } + for (const v of message.validationErrors) { + ValidationError.encode(v!, writer.uint32(66).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ChangeIdentityFieldResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseChangeIdentityFieldResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.resultCode = reader.int32() as any; + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.message = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.challengeId = reader.string(); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + + message.passcodeSize = reader.int32(); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + + message.userIdentifier = reader.string(); + continue; + } + case 7: { + if (tag !== 56) { + break; + } + + message.channel = reader.int32() as any; + continue; + } + case 8: { + if (tag !== 66) { + break; + } + + message.validationErrors.push(ValidationError.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ChangeIdentityFieldResponse { + return { + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + resultCode: isSet(object.resultCode) + ? resultCodeFromJSON(object.resultCode) + : isSet(object.result_code) + ? resultCodeFromJSON(object.result_code) + : 0, + message: isSet(object.message) ? globalThis.String(object.message) : "", + challengeId: isSet(object.challengeId) + ? globalThis.String(object.challengeId) + : isSet(object.challenge_id) + ? globalThis.String(object.challenge_id) + : "", + passcodeSize: isSet(object.passcodeSize) + ? globalThis.Number(object.passcodeSize) + : isSet(object.passcode_size) + ? globalThis.Number(object.passcode_size) + : 0, + userIdentifier: isSet(object.userIdentifier) + ? globalThis.String(object.userIdentifier) + : isSet(object.user_identifier) + ? globalThis.String(object.user_identifier) + : "", + channel: isSet(object.channel) ? channelTypeFromJSON(object.channel) : 0, + validationErrors: globalThis.Array.isArray(object?.validationErrors) + ? object.validationErrors.map((e: any) => ValidationError.fromJSON(e)) + : globalThis.Array.isArray(object?.validation_errors) + ? object.validation_errors.map((e: any) => ValidationError.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ChangeIdentityFieldResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + if (message.resultCode !== 0) { + obj.resultCode = resultCodeToJSON(message.resultCode); + } + if (message.message !== "") { + obj.message = message.message; + } + if (message.challengeId !== "") { + obj.challengeId = message.challengeId; + } + if (message.passcodeSize !== 0) { + obj.passcodeSize = Math.round(message.passcodeSize); + } + if (message.userIdentifier !== "") { + obj.userIdentifier = message.userIdentifier; + } + if (message.channel !== 0) { + obj.channel = channelTypeToJSON(message.channel); + } + if (message.validationErrors?.length) { + obj.validationErrors = message.validationErrors.map((e) => ValidationError.toJSON(e)); + } + return obj; + }, + + create(base?: DeepPartial): ChangeIdentityFieldResponse { + return ChangeIdentityFieldResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): ChangeIdentityFieldResponse { + const message = createBaseChangeIdentityFieldResponse(); + message.success = object.success ?? false; + message.resultCode = object.resultCode ?? 0; + message.message = object.message ?? ""; + message.challengeId = object.challengeId ?? ""; + message.passcodeSize = object.passcodeSize ?? 0; + message.userIdentifier = object.userIdentifier ?? ""; + message.channel = object.channel ?? 0; + message.validationErrors = object.validationErrors?.map((e) => ValidationError.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseVerifyIdentityFieldRequest(): VerifyIdentityFieldRequest { + return { userId: "", userToken: "", challengeId: "", verificationCode: "", appHash: "", deviceInfo: undefined }; +} + +export const VerifyIdentityFieldRequest: MessageFns = { + encode(message: VerifyIdentityFieldRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.userId !== "") { + writer.uint32(10).string(message.userId); + } + if (message.userToken !== "") { + writer.uint32(18).string(message.userToken); + } + if (message.challengeId !== "") { + writer.uint32(34).string(message.challengeId); + } + if (message.verificationCode !== "") { + writer.uint32(42).string(message.verificationCode); + } + if (message.appHash !== "") { + writer.uint32(50).string(message.appHash); + } + if (message.deviceInfo !== undefined) { + DeviceInfo.encode(message.deviceInfo, writer.uint32(58).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): VerifyIdentityFieldRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseVerifyIdentityFieldRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.userId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.userToken = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.challengeId = reader.string(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + message.verificationCode = reader.string(); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + + message.appHash = reader.string(); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + + message.deviceInfo = DeviceInfo.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): VerifyIdentityFieldRequest { + return { + userId: isSet(object.userId) + ? globalThis.String(object.userId) + : isSet(object.user_id) + ? globalThis.String(object.user_id) + : "", + userToken: isSet(object.userToken) + ? globalThis.String(object.userToken) + : isSet(object.user_token) + ? globalThis.String(object.user_token) + : "", + challengeId: isSet(object.challengeId) + ? globalThis.String(object.challengeId) + : isSet(object.challenge_id) + ? globalThis.String(object.challenge_id) + : "", + verificationCode: isSet(object.verificationCode) + ? globalThis.String(object.verificationCode) + : isSet(object.verification_code) + ? globalThis.String(object.verification_code) + : "", + appHash: isSet(object.appHash) + ? globalThis.String(object.appHash) + : isSet(object.app_hash) + ? globalThis.String(object.app_hash) + : "", + deviceInfo: isSet(object.deviceInfo) + ? DeviceInfo.fromJSON(object.deviceInfo) + : isSet(object.device_info) + ? DeviceInfo.fromJSON(object.device_info) + : undefined, + }; + }, + + toJSON(message: VerifyIdentityFieldRequest): unknown { + const obj: any = {}; + if (message.userId !== "") { + obj.userId = message.userId; + } + if (message.userToken !== "") { + obj.userToken = message.userToken; + } + if (message.challengeId !== "") { + obj.challengeId = message.challengeId; + } + if (message.verificationCode !== "") { + obj.verificationCode = message.verificationCode; + } + if (message.appHash !== "") { + obj.appHash = message.appHash; + } + if (message.deviceInfo !== undefined) { + obj.deviceInfo = DeviceInfo.toJSON(message.deviceInfo); + } + return obj; + }, + + create(base?: DeepPartial): VerifyIdentityFieldRequest { + return VerifyIdentityFieldRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): VerifyIdentityFieldRequest { + const message = createBaseVerifyIdentityFieldRequest(); + message.userId = object.userId ?? ""; + message.userToken = object.userToken ?? ""; + message.challengeId = object.challengeId ?? ""; + message.verificationCode = object.verificationCode ?? ""; + message.appHash = object.appHash ?? ""; + message.deviceInfo = (object.deviceInfo !== undefined && object.deviceInfo !== null) + ? DeviceInfo.fromPartial(object.deviceInfo) + : undefined; + return message; + }, +}; + +function createBaseResendIdentityFieldRequest(): ResendIdentityFieldRequest { + return { userId: "", userToken: "", challengeId: "", appHash: "", deviceInfo: undefined }; +} + +export const ResendIdentityFieldRequest: MessageFns = { + encode(message: ResendIdentityFieldRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.userId !== "") { + writer.uint32(10).string(message.userId); + } + if (message.userToken !== "") { + writer.uint32(18).string(message.userToken); + } + if (message.challengeId !== "") { + writer.uint32(34).string(message.challengeId); + } + if (message.appHash !== "") { + writer.uint32(50).string(message.appHash); + } + if (message.deviceInfo !== undefined) { + DeviceInfo.encode(message.deviceInfo, writer.uint32(58).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ResendIdentityFieldRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResendIdentityFieldRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.userId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.userToken = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.challengeId = reader.string(); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + + message.appHash = reader.string(); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + + message.deviceInfo = DeviceInfo.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ResendIdentityFieldRequest { + return { + userId: isSet(object.userId) + ? globalThis.String(object.userId) + : isSet(object.user_id) + ? globalThis.String(object.user_id) + : "", + userToken: isSet(object.userToken) + ? globalThis.String(object.userToken) + : isSet(object.user_token) + ? globalThis.String(object.user_token) + : "", + challengeId: isSet(object.challengeId) + ? globalThis.String(object.challengeId) + : isSet(object.challenge_id) + ? globalThis.String(object.challenge_id) + : "", + appHash: isSet(object.appHash) + ? globalThis.String(object.appHash) + : isSet(object.app_hash) + ? globalThis.String(object.app_hash) + : "", + deviceInfo: isSet(object.deviceInfo) + ? DeviceInfo.fromJSON(object.deviceInfo) + : isSet(object.device_info) + ? DeviceInfo.fromJSON(object.device_info) + : undefined, + }; + }, + + toJSON(message: ResendIdentityFieldRequest): unknown { + const obj: any = {}; + if (message.userId !== "") { + obj.userId = message.userId; + } + if (message.userToken !== "") { + obj.userToken = message.userToken; + } + if (message.challengeId !== "") { + obj.challengeId = message.challengeId; + } + if (message.appHash !== "") { + obj.appHash = message.appHash; + } + if (message.deviceInfo !== undefined) { + obj.deviceInfo = DeviceInfo.toJSON(message.deviceInfo); + } + return obj; + }, + + create(base?: DeepPartial): ResendIdentityFieldRequest { + return ResendIdentityFieldRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): ResendIdentityFieldRequest { + const message = createBaseResendIdentityFieldRequest(); + message.userId = object.userId ?? ""; + message.userToken = object.userToken ?? ""; + message.challengeId = object.challengeId ?? ""; + message.appHash = object.appHash ?? ""; + message.deviceInfo = (object.deviceInfo !== undefined && object.deviceInfo !== null) + ? DeviceInfo.fromPartial(object.deviceInfo) + : undefined; + return message; + }, +}; + +function createBaseVerifyIdentityFieldResponse(): VerifyIdentityFieldResponse { + return { + success: false, + resultCode: 0, + message: "", + requiresVerification: false, + challengeId: "", + passcodeSize: 0, + userIdentifier: "", + channel: 0, + validationErrors: [], + }; +} + +export const VerifyIdentityFieldResponse: MessageFns = { + encode(message: VerifyIdentityFieldResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + if (message.resultCode !== 0) { + writer.uint32(16).int32(message.resultCode); + } + if (message.message !== "") { + writer.uint32(26).string(message.message); + } + if (message.requiresVerification !== false) { + writer.uint32(64).bool(message.requiresVerification); + } + if (message.challengeId !== "") { + writer.uint32(34).string(message.challengeId); + } + if (message.passcodeSize !== 0) { + writer.uint32(40).int32(message.passcodeSize); + } + if (message.userIdentifier !== "") { + writer.uint32(50).string(message.userIdentifier); + } + if (message.channel !== 0) { + writer.uint32(56).int32(message.channel); + } + for (const v of message.validationErrors) { + ValidationError.encode(v!, writer.uint32(74).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): VerifyIdentityFieldResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseVerifyIdentityFieldResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.resultCode = reader.int32() as any; + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.message = reader.string(); + continue; + } + case 8: { + if (tag !== 64) { + break; + } + + message.requiresVerification = reader.bool(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.challengeId = reader.string(); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + + message.passcodeSize = reader.int32(); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + + message.userIdentifier = reader.string(); + continue; + } + case 7: { + if (tag !== 56) { + break; + } + + message.channel = reader.int32() as any; + continue; + } + case 9: { + if (tag !== 74) { + break; + } + + message.validationErrors.push(ValidationError.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): VerifyIdentityFieldResponse { + return { + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + resultCode: isSet(object.resultCode) + ? resultCodeFromJSON(object.resultCode) + : isSet(object.result_code) + ? resultCodeFromJSON(object.result_code) + : 0, + message: isSet(object.message) ? globalThis.String(object.message) : "", + requiresVerification: isSet(object.requiresVerification) + ? globalThis.Boolean(object.requiresVerification) + : isSet(object.requires_verification) + ? globalThis.Boolean(object.requires_verification) + : false, + challengeId: isSet(object.challengeId) + ? globalThis.String(object.challengeId) + : isSet(object.challenge_id) + ? globalThis.String(object.challenge_id) + : "", + passcodeSize: isSet(object.passcodeSize) + ? globalThis.Number(object.passcodeSize) + : isSet(object.passcode_size) + ? globalThis.Number(object.passcode_size) + : 0, + userIdentifier: isSet(object.userIdentifier) + ? globalThis.String(object.userIdentifier) + : isSet(object.user_identifier) + ? globalThis.String(object.user_identifier) + : "", + channel: isSet(object.channel) ? channelTypeFromJSON(object.channel) : 0, + validationErrors: globalThis.Array.isArray(object?.validationErrors) + ? object.validationErrors.map((e: any) => ValidationError.fromJSON(e)) + : globalThis.Array.isArray(object?.validation_errors) + ? object.validation_errors.map((e: any) => ValidationError.fromJSON(e)) + : [], + }; + }, + + toJSON(message: VerifyIdentityFieldResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + if (message.resultCode !== 0) { + obj.resultCode = resultCodeToJSON(message.resultCode); + } + if (message.message !== "") { + obj.message = message.message; + } + if (message.requiresVerification !== false) { + obj.requiresVerification = message.requiresVerification; + } + if (message.challengeId !== "") { + obj.challengeId = message.challengeId; + } + if (message.passcodeSize !== 0) { + obj.passcodeSize = Math.round(message.passcodeSize); + } + if (message.userIdentifier !== "") { + obj.userIdentifier = message.userIdentifier; + } + if (message.channel !== 0) { + obj.channel = channelTypeToJSON(message.channel); + } + if (message.validationErrors?.length) { + obj.validationErrors = message.validationErrors.map((e) => ValidationError.toJSON(e)); + } + return obj; + }, + + create(base?: DeepPartial): VerifyIdentityFieldResponse { + return VerifyIdentityFieldResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): VerifyIdentityFieldResponse { + const message = createBaseVerifyIdentityFieldResponse(); + message.success = object.success ?? false; + message.resultCode = object.resultCode ?? 0; + message.message = object.message ?? ""; + message.requiresVerification = object.requiresVerification ?? false; + message.challengeId = object.challengeId ?? ""; + message.passcodeSize = object.passcodeSize ?? 0; + message.userIdentifier = object.userIdentifier ?? ""; + message.channel = object.channel ?? 0; + message.validationErrors = object.validationErrors?.map((e) => ValidationError.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseUpdateUserInfoRequest(): UpdateUserInfoRequest { + return { + userId: "", + userToken: "", + firstNames: undefined, + lastName: undefined, + profilePictureId: undefined, + dateOfBirth: undefined, + handle: undefined, + }; +} + +export const UpdateUserInfoRequest: MessageFns = { + encode(message: UpdateUserInfoRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.userId !== "") { + writer.uint32(10).string(message.userId); + } + if (message.userToken !== "") { + writer.uint32(18).string(message.userToken); + } + if (message.firstNames !== undefined) { + writer.uint32(26).string(message.firstNames); + } + if (message.lastName !== undefined) { + writer.uint32(34).string(message.lastName); + } + if (message.profilePictureId !== undefined) { + writer.uint32(50).string(message.profilePictureId); + } + if (message.dateOfBirth !== undefined) { + DateMessage.encode(message.dateOfBirth, writer.uint32(42).fork()).join(); + } + if (message.handle !== undefined) { + writer.uint32(58).string(message.handle); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): UpdateUserInfoRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseUpdateUserInfoRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.userId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.userToken = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.firstNames = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.lastName = reader.string(); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + + message.profilePictureId = reader.string(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + message.dateOfBirth = DateMessage.decode(reader, reader.uint32()); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + + message.handle = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): UpdateUserInfoRequest { + return { + userId: isSet(object.userId) + ? globalThis.String(object.userId) + : isSet(object.user_id) + ? globalThis.String(object.user_id) + : "", + userToken: isSet(object.userToken) + ? globalThis.String(object.userToken) + : isSet(object.user_token) + ? globalThis.String(object.user_token) + : "", + firstNames: isSet(object.firstNames) + ? globalThis.String(object.firstNames) + : isSet(object.first_names) + ? globalThis.String(object.first_names) + : undefined, + lastName: isSet(object.lastName) + ? globalThis.String(object.lastName) + : isSet(object.last_name) + ? globalThis.String(object.last_name) + : undefined, + profilePictureId: isSet(object.profilePictureId) + ? globalThis.String(object.profilePictureId) + : isSet(object.profile_picture_id) + ? globalThis.String(object.profile_picture_id) + : undefined, + dateOfBirth: isSet(object.dateOfBirth) + ? DateMessage.fromJSON(object.dateOfBirth) + : isSet(object.date_of_birth) + ? DateMessage.fromJSON(object.date_of_birth) + : undefined, + handle: isSet(object.handle) ? globalThis.String(object.handle) : undefined, + }; + }, + + toJSON(message: UpdateUserInfoRequest): unknown { + const obj: any = {}; + if (message.userId !== "") { + obj.userId = message.userId; + } + if (message.userToken !== "") { + obj.userToken = message.userToken; + } + if (message.firstNames !== undefined) { + obj.firstNames = message.firstNames; + } + if (message.lastName !== undefined) { + obj.lastName = message.lastName; + } + if (message.profilePictureId !== undefined) { + obj.profilePictureId = message.profilePictureId; + } + if (message.dateOfBirth !== undefined) { + obj.dateOfBirth = DateMessage.toJSON(message.dateOfBirth); + } + if (message.handle !== undefined) { + obj.handle = message.handle; + } + return obj; + }, + + create(base?: DeepPartial): UpdateUserInfoRequest { + return UpdateUserInfoRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): UpdateUserInfoRequest { + const message = createBaseUpdateUserInfoRequest(); + message.userId = object.userId ?? ""; + message.userToken = object.userToken ?? ""; + message.firstNames = object.firstNames ?? undefined; + message.lastName = object.lastName ?? undefined; + message.profilePictureId = object.profilePictureId ?? undefined; + message.dateOfBirth = (object.dateOfBirth !== undefined && object.dateOfBirth !== null) + ? DateMessage.fromPartial(object.dateOfBirth) + : undefined; + message.handle = object.handle ?? undefined; + return message; + }, +}; + +function createBaseUpdateUserInfoResponse(): UpdateUserInfoResponse { + return { success: false, resultCode: 0, message: "", user: undefined }; +} + +export const UpdateUserInfoResponse: MessageFns = { + encode(message: UpdateUserInfoResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + if (message.resultCode !== 0) { + writer.uint32(16).int32(message.resultCode); + } + if (message.message !== "") { + writer.uint32(26).string(message.message); + } + if (message.user !== undefined) { + User.encode(message.user, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): UpdateUserInfoResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseUpdateUserInfoResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.resultCode = reader.int32() as any; + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.message = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.user = User.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): UpdateUserInfoResponse { + return { + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + resultCode: isSet(object.resultCode) + ? resultCodeFromJSON(object.resultCode) + : isSet(object.result_code) + ? resultCodeFromJSON(object.result_code) + : 0, + message: isSet(object.message) ? globalThis.String(object.message) : "", + user: isSet(object.user) ? User.fromJSON(object.user) : undefined, + }; + }, + + toJSON(message: UpdateUserInfoResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + if (message.resultCode !== 0) { + obj.resultCode = resultCodeToJSON(message.resultCode); + } + if (message.message !== "") { + obj.message = message.message; + } + if (message.user !== undefined) { + obj.user = User.toJSON(message.user); + } + return obj; + }, + + create(base?: DeepPartial): UpdateUserInfoResponse { + return UpdateUserInfoResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): UpdateUserInfoResponse { + const message = createBaseUpdateUserInfoResponse(); + message.success = object.success ?? false; + message.resultCode = object.resultCode ?? 0; + message.message = object.message ?? ""; + message.user = (object.user !== undefined && object.user !== null) ? User.fromPartial(object.user) : undefined; + return message; + }, +}; + +function createBaseLogoutRequest(): LogoutRequest { + return { token: "" }; +} + +export const LogoutRequest: MessageFns = { + encode(message: LogoutRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.token !== "") { + writer.uint32(10).string(message.token); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): LogoutRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseLogoutRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.token = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): LogoutRequest { + return { token: isSet(object.token) ? globalThis.String(object.token) : "" }; + }, + + toJSON(message: LogoutRequest): unknown { + const obj: any = {}; + if (message.token !== "") { + obj.token = message.token; + } + return obj; + }, + + create(base?: DeepPartial): LogoutRequest { + return LogoutRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): LogoutRequest { + const message = createBaseLogoutRequest(); + message.token = object.token ?? ""; + return message; + }, +}; + +function createBaseLogoutResponse(): LogoutResponse { + return { success: false, resultCode: 0, message: "" }; +} + +export const LogoutResponse: MessageFns = { + encode(message: LogoutResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + if (message.resultCode !== 0) { + writer.uint32(16).int32(message.resultCode); + } + if (message.message !== "") { + writer.uint32(26).string(message.message); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): LogoutResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseLogoutResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.resultCode = reader.int32() as any; + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.message = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): LogoutResponse { + return { + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + resultCode: isSet(object.resultCode) + ? resultCodeFromJSON(object.resultCode) + : isSet(object.result_code) + ? resultCodeFromJSON(object.result_code) + : 0, + message: isSet(object.message) ? globalThis.String(object.message) : "", + }; + }, + + toJSON(message: LogoutResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + if (message.resultCode !== 0) { + obj.resultCode = resultCodeToJSON(message.resultCode); + } + if (message.message !== "") { + obj.message = message.message; + } + return obj; + }, + + create(base?: DeepPartial): LogoutResponse { + return LogoutResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): LogoutResponse { + const message = createBaseLogoutResponse(); + message.success = object.success ?? false; + message.resultCode = object.resultCode ?? 0; + message.message = object.message ?? ""; + return message; + }, +}; + +function createBaseValidationError(): ValidationError { + return { field: "", message: "" }; +} + +export const ValidationError: MessageFns = { + encode(message: ValidationError, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.field !== "") { + writer.uint32(10).string(message.field); + } + if (message.message !== "") { + writer.uint32(18).string(message.message); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidationError { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidationError(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.field = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.message = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidationError { + return { + field: isSet(object.field) ? globalThis.String(object.field) : "", + message: isSet(object.message) ? globalThis.String(object.message) : "", + }; + }, + + toJSON(message: ValidationError): unknown { + const obj: any = {}; + if (message.field !== "") { + obj.field = message.field; + } + if (message.message !== "") { + obj.message = message.message; + } + return obj; + }, + + create(base?: DeepPartial): ValidationError { + return ValidationError.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): ValidationError { + const message = createBaseValidationError(); + message.field = object.field ?? ""; + message.message = object.message ?? ""; + return message; + }, +}; + +function createBaseScope(): Scope { + return { code: "", description: "", parentCode: undefined, isActive: false }; +} + +export const Scope: MessageFns = { + encode(message: Scope, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.code !== "") { + writer.uint32(10).string(message.code); + } + if (message.description !== "") { + writer.uint32(18).string(message.description); + } + if (message.parentCode !== undefined) { + writer.uint32(26).string(message.parentCode); + } + if (message.isActive !== false) { + writer.uint32(32).bool(message.isActive); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Scope { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseScope(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.code = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.description = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.parentCode = reader.string(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + + message.isActive = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Scope { + return { + code: isSet(object.code) ? globalThis.String(object.code) : "", + description: isSet(object.description) ? globalThis.String(object.description) : "", + parentCode: isSet(object.parentCode) + ? globalThis.String(object.parentCode) + : isSet(object.parent_code) + ? globalThis.String(object.parent_code) + : undefined, + isActive: isSet(object.isActive) + ? globalThis.Boolean(object.isActive) + : isSet(object.is_active) + ? globalThis.Boolean(object.is_active) + : false, + }; + }, + + toJSON(message: Scope): unknown { + const obj: any = {}; + if (message.code !== "") { + obj.code = message.code; + } + if (message.description !== "") { + obj.description = message.description; + } + if (message.parentCode !== undefined) { + obj.parentCode = message.parentCode; + } + if (message.isActive !== false) { + obj.isActive = message.isActive; + } + return obj; + }, + + create(base?: DeepPartial): Scope { + return Scope.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): Scope { + const message = createBaseScope(); + message.code = object.code ?? ""; + message.description = object.description ?? ""; + message.parentCode = object.parentCode ?? undefined; + message.isActive = object.isActive ?? false; + return message; + }, +}; + +function createBaseUpdateUserPreferenceRequest(): UpdateUserPreferenceRequest { + return { actorId: "", actorToken: "", preferenceKey: "", preferenceValue: "" }; +} + +export const UpdateUserPreferenceRequest: MessageFns = { + encode(message: UpdateUserPreferenceRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.actorId !== "") { + writer.uint32(10).string(message.actorId); + } + if (message.actorToken !== "") { + writer.uint32(18).string(message.actorToken); + } + if (message.preferenceKey !== "") { + writer.uint32(26).string(message.preferenceKey); + } + if (message.preferenceValue !== "") { + writer.uint32(34).string(message.preferenceValue); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): UpdateUserPreferenceRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseUpdateUserPreferenceRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.actorId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.actorToken = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.preferenceKey = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.preferenceValue = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): UpdateUserPreferenceRequest { + return { + actorId: isSet(object.actorId) + ? globalThis.String(object.actorId) + : isSet(object.actor_id) + ? globalThis.String(object.actor_id) + : "", + actorToken: isSet(object.actorToken) + ? globalThis.String(object.actorToken) + : isSet(object.actor_token) + ? globalThis.String(object.actor_token) + : "", + preferenceKey: isSet(object.preferenceKey) + ? globalThis.String(object.preferenceKey) + : isSet(object.preference_key) + ? globalThis.String(object.preference_key) + : "", + preferenceValue: isSet(object.preferenceValue) + ? globalThis.String(object.preferenceValue) + : isSet(object.preference_value) + ? globalThis.String(object.preference_value) + : "", + }; + }, + + toJSON(message: UpdateUserPreferenceRequest): unknown { + const obj: any = {}; + if (message.actorId !== "") { + obj.actorId = message.actorId; + } + if (message.actorToken !== "") { + obj.actorToken = message.actorToken; + } + if (message.preferenceKey !== "") { + obj.preferenceKey = message.preferenceKey; + } + if (message.preferenceValue !== "") { + obj.preferenceValue = message.preferenceValue; + } + return obj; + }, + + create(base?: DeepPartial): UpdateUserPreferenceRequest { + return UpdateUserPreferenceRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): UpdateUserPreferenceRequest { + const message = createBaseUpdateUserPreferenceRequest(); + message.actorId = object.actorId ?? ""; + message.actorToken = object.actorToken ?? ""; + message.preferenceKey = object.preferenceKey ?? ""; + message.preferenceValue = object.preferenceValue ?? ""; + return message; + }, +}; + +function createBaseGetUserPreferenceByCodeRequest(): GetUserPreferenceByCodeRequest { + return { actorId: "", actorToken: "", preferenceCode: "" }; +} + +export const GetUserPreferenceByCodeRequest: MessageFns = { + encode(message: GetUserPreferenceByCodeRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.actorId !== "") { + writer.uint32(10).string(message.actorId); + } + if (message.actorToken !== "") { + writer.uint32(18).string(message.actorToken); + } + if (message.preferenceCode !== "") { + writer.uint32(26).string(message.preferenceCode); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetUserPreferenceByCodeRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetUserPreferenceByCodeRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.actorId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.actorToken = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.preferenceCode = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetUserPreferenceByCodeRequest { + return { + actorId: isSet(object.actorId) + ? globalThis.String(object.actorId) + : isSet(object.actor_id) + ? globalThis.String(object.actor_id) + : "", + actorToken: isSet(object.actorToken) + ? globalThis.String(object.actorToken) + : isSet(object.actor_token) + ? globalThis.String(object.actor_token) + : "", + preferenceCode: isSet(object.preferenceCode) + ? globalThis.String(object.preferenceCode) + : isSet(object.preference_code) + ? globalThis.String(object.preference_code) + : "", + }; + }, + + toJSON(message: GetUserPreferenceByCodeRequest): unknown { + const obj: any = {}; + if (message.actorId !== "") { + obj.actorId = message.actorId; + } + if (message.actorToken !== "") { + obj.actorToken = message.actorToken; + } + if (message.preferenceCode !== "") { + obj.preferenceCode = message.preferenceCode; + } + return obj; + }, + + create(base?: DeepPartial): GetUserPreferenceByCodeRequest { + return GetUserPreferenceByCodeRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): GetUserPreferenceByCodeRequest { + const message = createBaseGetUserPreferenceByCodeRequest(); + message.actorId = object.actorId ?? ""; + message.actorToken = object.actorToken ?? ""; + message.preferenceCode = object.preferenceCode ?? ""; + return message; + }, +}; + +function createBaseGetUserPreferenceByCodeResponse(): GetUserPreferenceByCodeResponse { + return { success: false, resultCode: 0, message: "", value: "" }; +} + +export const GetUserPreferenceByCodeResponse: MessageFns = { + encode(message: GetUserPreferenceByCodeResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + if (message.resultCode !== 0) { + writer.uint32(16).int32(message.resultCode); + } + if (message.message !== "") { + writer.uint32(26).string(message.message); + } + if (message.value !== "") { + writer.uint32(34).string(message.value); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetUserPreferenceByCodeResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetUserPreferenceByCodeResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.resultCode = reader.int32() as any; + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.message = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.value = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetUserPreferenceByCodeResponse { + return { + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + resultCode: isSet(object.resultCode) + ? resultCodeFromJSON(object.resultCode) + : isSet(object.result_code) + ? resultCodeFromJSON(object.result_code) + : 0, + message: isSet(object.message) ? globalThis.String(object.message) : "", + value: isSet(object.value) ? globalThis.String(object.value) : "", + }; + }, + + toJSON(message: GetUserPreferenceByCodeResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + if (message.resultCode !== 0) { + obj.resultCode = resultCodeToJSON(message.resultCode); + } + if (message.message !== "") { + obj.message = message.message; + } + if (message.value !== "") { + obj.value = message.value; + } + return obj; + }, + + create(base?: DeepPartial): GetUserPreferenceByCodeResponse { + return GetUserPreferenceByCodeResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): GetUserPreferenceByCodeResponse { + const message = createBaseGetUserPreferenceByCodeResponse(); + message.success = object.success ?? false; + message.resultCode = object.resultCode ?? 0; + message.message = object.message ?? ""; + message.value = object.value ?? ""; + return message; + }, +}; + +function createBaseResendVerificationRequest(): ResendVerificationRequest { + return { userIdentifier: "", verificationCodeType: 0, appHash: "", verificationCodeId: "", deviceInfo: undefined }; +} + +export const ResendVerificationRequest: MessageFns = { + encode(message: ResendVerificationRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.userIdentifier !== "") { + writer.uint32(10).string(message.userIdentifier); + } + if (message.verificationCodeType !== 0) { + writer.uint32(16).int32(message.verificationCodeType); + } + if (message.appHash !== "") { + writer.uint32(26).string(message.appHash); + } + if (message.verificationCodeId !== "") { + writer.uint32(34).string(message.verificationCodeId); + } + if (message.deviceInfo !== undefined) { + DeviceInfo.encode(message.deviceInfo, writer.uint32(154).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ResendVerificationRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResendVerificationRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.userIdentifier = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.verificationCodeType = reader.int32() as any; + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.appHash = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.verificationCodeId = reader.string(); + continue; + } + case 19: { + if (tag !== 154) { + break; + } + + message.deviceInfo = DeviceInfo.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ResendVerificationRequest { + return { + userIdentifier: isSet(object.userIdentifier) + ? globalThis.String(object.userIdentifier) + : isSet(object.user_identifier) + ? globalThis.String(object.user_identifier) + : "", + verificationCodeType: isSet(object.verificationCodeType) + ? verificationCodeTypeFromJSON(object.verificationCodeType) + : isSet(object.verification_code_type) + ? verificationCodeTypeFromJSON(object.verification_code_type) + : 0, + appHash: isSet(object.appHash) + ? globalThis.String(object.appHash) + : isSet(object.app_hash) + ? globalThis.String(object.app_hash) + : "", + verificationCodeId: isSet(object.verificationCodeId) + ? globalThis.String(object.verificationCodeId) + : isSet(object.verification_code_id) + ? globalThis.String(object.verification_code_id) + : "", + deviceInfo: isSet(object.deviceInfo) + ? DeviceInfo.fromJSON(object.deviceInfo) + : isSet(object.device_info) + ? DeviceInfo.fromJSON(object.device_info) + : undefined, + }; + }, + + toJSON(message: ResendVerificationRequest): unknown { + const obj: any = {}; + if (message.userIdentifier !== "") { + obj.userIdentifier = message.userIdentifier; + } + if (message.verificationCodeType !== 0) { + obj.verificationCodeType = verificationCodeTypeToJSON(message.verificationCodeType); + } + if (message.appHash !== "") { + obj.appHash = message.appHash; + } + if (message.verificationCodeId !== "") { + obj.verificationCodeId = message.verificationCodeId; + } + if (message.deviceInfo !== undefined) { + obj.deviceInfo = DeviceInfo.toJSON(message.deviceInfo); + } + return obj; + }, + + create(base?: DeepPartial): ResendVerificationRequest { + return ResendVerificationRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): ResendVerificationRequest { + const message = createBaseResendVerificationRequest(); + message.userIdentifier = object.userIdentifier ?? ""; + message.verificationCodeType = object.verificationCodeType ?? 0; + message.appHash = object.appHash ?? ""; + message.verificationCodeId = object.verificationCodeId ?? ""; + message.deviceInfo = (object.deviceInfo !== undefined && object.deviceInfo !== null) + ? DeviceInfo.fromPartial(object.deviceInfo) + : undefined; + return message; + }, +}; + +function createBaseResendVerificationResponse(): ResendVerificationResponse { + return { success: false, resultCode: 0, message: "", verificationCodeId: "" }; +} + +export const ResendVerificationResponse: MessageFns = { + encode(message: ResendVerificationResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + if (message.resultCode !== 0) { + writer.uint32(16).int32(message.resultCode); + } + if (message.message !== "") { + writer.uint32(26).string(message.message); + } + if (message.verificationCodeId !== "") { + writer.uint32(34).string(message.verificationCodeId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ResendVerificationResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResendVerificationResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.resultCode = reader.int32() as any; + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.message = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.verificationCodeId = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ResendVerificationResponse { + return { + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + resultCode: isSet(object.resultCode) + ? resultCodeFromJSON(object.resultCode) + : isSet(object.result_code) + ? resultCodeFromJSON(object.result_code) + : 0, + message: isSet(object.message) ? globalThis.String(object.message) : "", + verificationCodeId: isSet(object.verificationCodeId) + ? globalThis.String(object.verificationCodeId) + : isSet(object.verification_code_id) + ? globalThis.String(object.verification_code_id) + : "", + }; + }, + + toJSON(message: ResendVerificationResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + if (message.resultCode !== 0) { + obj.resultCode = resultCodeToJSON(message.resultCode); + } + if (message.message !== "") { + obj.message = message.message; + } + if (message.verificationCodeId !== "") { + obj.verificationCodeId = message.verificationCodeId; + } + return obj; + }, + + create(base?: DeepPartial): ResendVerificationResponse { + return ResendVerificationResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): ResendVerificationResponse { + const message = createBaseResendVerificationResponse(); + message.success = object.success ?? false; + message.resultCode = object.resultCode ?? 0; + message.message = object.message ?? ""; + message.verificationCodeId = object.verificationCodeId ?? ""; + return message; + }, +}; + +function createBaseUserSession(): UserSession { + return { + id: "", + userId: "", + deviceInfo: undefined, + createdAt: undefined, + expiresAt: undefined, + lastActivity: undefined, + isActive: false, + ipAddress: "", + userAgent: "", + }; +} + +export const UserSession: MessageFns = { + encode(message: UserSession, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.id !== "") { + writer.uint32(10).string(message.id); + } + if (message.userId !== "") { + writer.uint32(18).string(message.userId); + } + if (message.deviceInfo !== undefined) { + DeviceInfo.encode(message.deviceInfo, writer.uint32(26).fork()).join(); + } + if (message.createdAt !== undefined) { + Timestamp.encode(toTimestamp(message.createdAt), writer.uint32(34).fork()).join(); + } + if (message.expiresAt !== undefined) { + Timestamp.encode(toTimestamp(message.expiresAt), writer.uint32(42).fork()).join(); + } + if (message.lastActivity !== undefined) { + Timestamp.encode(toTimestamp(message.lastActivity), writer.uint32(50).fork()).join(); + } + if (message.isActive !== false) { + writer.uint32(56).bool(message.isActive); + } + if (message.ipAddress !== "") { + writer.uint32(66).string(message.ipAddress); + } + if (message.userAgent !== "") { + writer.uint32(74).string(message.userAgent); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): UserSession { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseUserSession(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.id = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.userId = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.deviceInfo = DeviceInfo.decode(reader, reader.uint32()); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.createdAt = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + message.expiresAt = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + + message.lastActivity = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + } + case 7: { + if (tag !== 56) { + break; + } + + message.isActive = reader.bool(); + continue; + } + case 8: { + if (tag !== 66) { + break; + } + + message.ipAddress = reader.string(); + continue; + } + case 9: { + if (tag !== 74) { + break; + } + + message.userAgent = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): UserSession { + return { + id: isSet(object.id) ? globalThis.String(object.id) : "", + userId: isSet(object.userId) + ? globalThis.String(object.userId) + : isSet(object.user_id) + ? globalThis.String(object.user_id) + : "", + deviceInfo: isSet(object.deviceInfo) + ? DeviceInfo.fromJSON(object.deviceInfo) + : isSet(object.device_info) + ? DeviceInfo.fromJSON(object.device_info) + : undefined, + createdAt: isSet(object.createdAt) + ? fromJsonTimestamp(object.createdAt) + : isSet(object.created_at) + ? fromJsonTimestamp(object.created_at) + : undefined, + expiresAt: isSet(object.expiresAt) + ? fromJsonTimestamp(object.expiresAt) + : isSet(object.expires_at) + ? fromJsonTimestamp(object.expires_at) + : undefined, + lastActivity: isSet(object.lastActivity) + ? fromJsonTimestamp(object.lastActivity) + : isSet(object.last_activity) + ? fromJsonTimestamp(object.last_activity) + : undefined, + isActive: isSet(object.isActive) + ? globalThis.Boolean(object.isActive) + : isSet(object.is_active) + ? globalThis.Boolean(object.is_active) + : false, + ipAddress: isSet(object.ipAddress) + ? globalThis.String(object.ipAddress) + : isSet(object.ip_address) + ? globalThis.String(object.ip_address) + : "", + userAgent: isSet(object.userAgent) + ? globalThis.String(object.userAgent) + : isSet(object.user_agent) + ? globalThis.String(object.user_agent) + : "", + }; + }, + + toJSON(message: UserSession): unknown { + const obj: any = {}; + if (message.id !== "") { + obj.id = message.id; + } + if (message.userId !== "") { + obj.userId = message.userId; + } + if (message.deviceInfo !== undefined) { + obj.deviceInfo = DeviceInfo.toJSON(message.deviceInfo); + } + if (message.createdAt !== undefined) { + obj.createdAt = message.createdAt.toISOString(); + } + if (message.expiresAt !== undefined) { + obj.expiresAt = message.expiresAt.toISOString(); + } + if (message.lastActivity !== undefined) { + obj.lastActivity = message.lastActivity.toISOString(); + } + if (message.isActive !== false) { + obj.isActive = message.isActive; + } + if (message.ipAddress !== "") { + obj.ipAddress = message.ipAddress; + } + if (message.userAgent !== "") { + obj.userAgent = message.userAgent; + } + return obj; + }, + + create(base?: DeepPartial): UserSession { + return UserSession.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): UserSession { + const message = createBaseUserSession(); + message.id = object.id ?? ""; + message.userId = object.userId ?? ""; + message.deviceInfo = (object.deviceInfo !== undefined && object.deviceInfo !== null) + ? DeviceInfo.fromPartial(object.deviceInfo) + : undefined; + message.createdAt = object.createdAt ?? undefined; + message.expiresAt = object.expiresAt ?? undefined; + message.lastActivity = object.lastActivity ?? undefined; + message.isActive = object.isActive ?? false; + message.ipAddress = object.ipAddress ?? ""; + message.userAgent = object.userAgent ?? ""; + return message; + }, +}; + +function createBaseGetUserSessionsRequest(): GetUserSessionsRequest { + return { actorId: "", actorToken: "", page: 0, size: 0 }; +} + +export const GetUserSessionsRequest: MessageFns = { + encode(message: GetUserSessionsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.actorId !== "") { + writer.uint32(10).string(message.actorId); + } + if (message.actorToken !== "") { + writer.uint32(18).string(message.actorToken); + } + if (message.page !== 0) { + writer.uint32(24).int32(message.page); + } + if (message.size !== 0) { + writer.uint32(32).int32(message.size); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetUserSessionsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetUserSessionsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.actorId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.actorToken = reader.string(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.page = reader.int32(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + + message.size = reader.int32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetUserSessionsRequest { + return { + actorId: isSet(object.actorId) + ? globalThis.String(object.actorId) + : isSet(object.actor_id) + ? globalThis.String(object.actor_id) + : "", + actorToken: isSet(object.actorToken) + ? globalThis.String(object.actorToken) + : isSet(object.actor_token) + ? globalThis.String(object.actor_token) + : "", + page: isSet(object.page) ? globalThis.Number(object.page) : 0, + size: isSet(object.size) ? globalThis.Number(object.size) : 0, + }; + }, + + toJSON(message: GetUserSessionsRequest): unknown { + const obj: any = {}; + if (message.actorId !== "") { + obj.actorId = message.actorId; + } + if (message.actorToken !== "") { + obj.actorToken = message.actorToken; + } + if (message.page !== 0) { + obj.page = Math.round(message.page); + } + if (message.size !== 0) { + obj.size = Math.round(message.size); + } + return obj; + }, + + create(base?: DeepPartial): GetUserSessionsRequest { + return GetUserSessionsRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): GetUserSessionsRequest { + const message = createBaseGetUserSessionsRequest(); + message.actorId = object.actorId ?? ""; + message.actorToken = object.actorToken ?? ""; + message.page = object.page ?? 0; + message.size = object.size ?? 0; + return message; + }, +}; + +function createBaseGetUserSessionsResponse(): GetUserSessionsResponse { + return { success: false, resultCode: 0, message: "", sessions: [], total: 0 }; +} + +export const GetUserSessionsResponse: MessageFns = { + encode(message: GetUserSessionsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + if (message.resultCode !== 0) { + writer.uint32(16).int32(message.resultCode); + } + if (message.message !== "") { + writer.uint32(26).string(message.message); + } + for (const v of message.sessions) { + UserSession.encode(v!, writer.uint32(34).fork()).join(); + } + if (message.total !== 0) { + writer.uint32(40).int32(message.total); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetUserSessionsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetUserSessionsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.resultCode = reader.int32() as any; + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.message = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.sessions.push(UserSession.decode(reader, reader.uint32())); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + + message.total = reader.int32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetUserSessionsResponse { + return { + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + resultCode: isSet(object.resultCode) + ? resultCodeFromJSON(object.resultCode) + : isSet(object.result_code) + ? resultCodeFromJSON(object.result_code) + : 0, + message: isSet(object.message) ? globalThis.String(object.message) : "", + sessions: globalThis.Array.isArray(object?.sessions) + ? object.sessions.map((e: any) => UserSession.fromJSON(e)) + : [], + total: isSet(object.total) ? globalThis.Number(object.total) : 0, + }; + }, + + toJSON(message: GetUserSessionsResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + if (message.resultCode !== 0) { + obj.resultCode = resultCodeToJSON(message.resultCode); + } + if (message.message !== "") { + obj.message = message.message; + } + if (message.sessions?.length) { + obj.sessions = message.sessions.map((e) => UserSession.toJSON(e)); + } + if (message.total !== 0) { + obj.total = Math.round(message.total); + } + return obj; + }, + + create(base?: DeepPartial): GetUserSessionsResponse { + return GetUserSessionsResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): GetUserSessionsResponse { + const message = createBaseGetUserSessionsResponse(); + message.success = object.success ?? false; + message.resultCode = object.resultCode ?? 0; + message.message = object.message ?? ""; + message.sessions = object.sessions?.map((e) => UserSession.fromPartial(e)) || []; + message.total = object.total ?? 0; + return message; + }, +}; + +function createBaseClearUserSessionsRequest(): ClearUserSessionsRequest { + return { actorId: "", actorToken: "", sessionIds: [] }; +} + +export const ClearUserSessionsRequest: MessageFns = { + encode(message: ClearUserSessionsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.actorId !== "") { + writer.uint32(10).string(message.actorId); + } + if (message.actorToken !== "") { + writer.uint32(18).string(message.actorToken); + } + for (const v of message.sessionIds) { + writer.uint32(26).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ClearUserSessionsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseClearUserSessionsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.actorId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.actorToken = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.sessionIds.push(reader.string()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ClearUserSessionsRequest { + return { + actorId: isSet(object.actorId) + ? globalThis.String(object.actorId) + : isSet(object.actor_id) + ? globalThis.String(object.actor_id) + : "", + actorToken: isSet(object.actorToken) + ? globalThis.String(object.actorToken) + : isSet(object.actor_token) + ? globalThis.String(object.actor_token) + : "", + sessionIds: globalThis.Array.isArray(object?.sessionIds) + ? object.sessionIds.map((e: any) => globalThis.String(e)) + : globalThis.Array.isArray(object?.session_ids) + ? object.session_ids.map((e: any) => globalThis.String(e)) + : [], + }; + }, + + toJSON(message: ClearUserSessionsRequest): unknown { + const obj: any = {}; + if (message.actorId !== "") { + obj.actorId = message.actorId; + } + if (message.actorToken !== "") { + obj.actorToken = message.actorToken; + } + if (message.sessionIds?.length) { + obj.sessionIds = message.sessionIds; + } + return obj; + }, + + create(base?: DeepPartial): ClearUserSessionsRequest { + return ClearUserSessionsRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): ClearUserSessionsRequest { + const message = createBaseClearUserSessionsRequest(); + message.actorId = object.actorId ?? ""; + message.actorToken = object.actorToken ?? ""; + message.sessionIds = object.sessionIds?.map((e) => e) || []; + return message; + }, +}; + +function createBaseClearUserSessionsResponse(): ClearUserSessionsResponse { + return { success: false, resultCode: 0, message: "", clearedCount: 0 }; +} + +export const ClearUserSessionsResponse: MessageFns = { + encode(message: ClearUserSessionsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + if (message.resultCode !== 0) { + writer.uint32(16).int32(message.resultCode); + } + if (message.message !== "") { + writer.uint32(26).string(message.message); + } + if (message.clearedCount !== 0) { + writer.uint32(32).int32(message.clearedCount); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ClearUserSessionsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseClearUserSessionsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.resultCode = reader.int32() as any; + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.message = reader.string(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + + message.clearedCount = reader.int32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ClearUserSessionsResponse { + return { + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + resultCode: isSet(object.resultCode) + ? resultCodeFromJSON(object.resultCode) + : isSet(object.result_code) + ? resultCodeFromJSON(object.result_code) + : 0, + message: isSet(object.message) ? globalThis.String(object.message) : "", + clearedCount: isSet(object.clearedCount) + ? globalThis.Number(object.clearedCount) + : isSet(object.cleared_count) + ? globalThis.Number(object.cleared_count) + : 0, + }; + }, + + toJSON(message: ClearUserSessionsResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + if (message.resultCode !== 0) { + obj.resultCode = resultCodeToJSON(message.resultCode); + } + if (message.message !== "") { + obj.message = message.message; + } + if (message.clearedCount !== 0) { + obj.clearedCount = Math.round(message.clearedCount); + } + return obj; + }, + + create(base?: DeepPartial): ClearUserSessionsResponse { + return ClearUserSessionsResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): ClearUserSessionsResponse { + const message = createBaseClearUserSessionsResponse(); + message.success = object.success ?? false; + message.resultCode = object.resultCode ?? 0; + message.message = object.message ?? ""; + message.clearedCount = object.clearedCount ?? 0; + return message; + }, +}; + +function createBaseGetMetricsRequest(): GetMetricsRequest { + return { bearerToken: "" }; +} + +export const GetMetricsRequest: MessageFns = { + encode(message: GetMetricsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.bearerToken !== "") { + writer.uint32(10).string(message.bearerToken); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetMetricsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetMetricsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.bearerToken = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetMetricsRequest { + return { + bearerToken: isSet(object.bearerToken) + ? globalThis.String(object.bearerToken) + : isSet(object.bearer_token) + ? globalThis.String(object.bearer_token) + : "", + }; + }, + + toJSON(message: GetMetricsRequest): unknown { + const obj: any = {}; + if (message.bearerToken !== "") { + obj.bearerToken = message.bearerToken; + } + return obj; + }, + + create(base?: DeepPartial): GetMetricsRequest { + return GetMetricsRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): GetMetricsRequest { + const message = createBaseGetMetricsRequest(); + message.bearerToken = object.bearerToken ?? ""; + return message; + }, +}; + +function createBaseGetMetricsResponse(): GetMetricsResponse { + return { success: false, resultCode: 0, message: "", metrics: "" }; +} + +export const GetMetricsResponse: MessageFns = { + encode(message: GetMetricsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + if (message.resultCode !== 0) { + writer.uint32(16).int32(message.resultCode); + } + if (message.message !== "") { + writer.uint32(26).string(message.message); + } + if (message.metrics !== "") { + writer.uint32(34).string(message.metrics); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetMetricsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetMetricsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.resultCode = reader.int32() as any; + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.message = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.metrics = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetMetricsResponse { + return { + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + resultCode: isSet(object.resultCode) + ? resultCodeFromJSON(object.resultCode) + : isSet(object.result_code) + ? resultCodeFromJSON(object.result_code) + : 0, + message: isSet(object.message) ? globalThis.String(object.message) : "", + metrics: isSet(object.metrics) ? globalThis.String(object.metrics) : "", + }; + }, + + toJSON(message: GetMetricsResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + if (message.resultCode !== 0) { + obj.resultCode = resultCodeToJSON(message.resultCode); + } + if (message.message !== "") { + obj.message = message.message; + } + if (message.metrics !== "") { + obj.metrics = message.metrics; + } + return obj; + }, + + create(base?: DeepPartial): GetMetricsResponse { + return GetMetricsResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): GetMetricsResponse { + const message = createBaseGetMetricsResponse(); + message.success = object.success ?? false; + message.resultCode = object.resultCode ?? 0; + message.message = object.message ?? ""; + message.metrics = object.metrics ?? ""; + return message; + }, +}; + +function createBaseCreateApiKeyRequest(): CreateApiKeyRequest { + return { token: "", name: "", scopes: [], expiresAt: 0 }; +} + +export const CreateApiKeyRequest: MessageFns = { + encode(message: CreateApiKeyRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.token !== "") { + writer.uint32(10).string(message.token); + } + if (message.name !== "") { + writer.uint32(18).string(message.name); + } + for (const v of message.scopes) { + writer.uint32(26).string(v!); + } + if (message.expiresAt !== 0) { + writer.uint32(32).int64(message.expiresAt); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CreateApiKeyRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCreateApiKeyRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.token = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.name = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.scopes.push(reader.string()); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + + message.expiresAt = longToNumber(reader.int64()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): CreateApiKeyRequest { + return { + token: isSet(object.token) ? globalThis.String(object.token) : "", + name: isSet(object.name) ? globalThis.String(object.name) : "", + scopes: globalThis.Array.isArray(object?.scopes) ? object.scopes.map((e: any) => globalThis.String(e)) : [], + expiresAt: isSet(object.expiresAt) + ? globalThis.Number(object.expiresAt) + : isSet(object.expires_at) + ? globalThis.Number(object.expires_at) + : 0, + }; + }, + + toJSON(message: CreateApiKeyRequest): unknown { + const obj: any = {}; + if (message.token !== "") { + obj.token = message.token; + } + if (message.name !== "") { + obj.name = message.name; + } + if (message.scopes?.length) { + obj.scopes = message.scopes; + } + if (message.expiresAt !== 0) { + obj.expiresAt = Math.round(message.expiresAt); + } + return obj; + }, + + create(base?: DeepPartial): CreateApiKeyRequest { + return CreateApiKeyRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): CreateApiKeyRequest { + const message = createBaseCreateApiKeyRequest(); + message.token = object.token ?? ""; + message.name = object.name ?? ""; + message.scopes = object.scopes?.map((e) => e) || []; + message.expiresAt = object.expiresAt ?? 0; + return message; + }, +}; + +function createBaseCreateApiKeyResponse(): CreateApiKeyResponse { + return { success: false, resultCode: 0, message: "", apiKey: "", keyId: "", keyPrefix: "" }; +} + +export const CreateApiKeyResponse: MessageFns = { + encode(message: CreateApiKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + if (message.resultCode !== 0) { + writer.uint32(16).int32(message.resultCode); + } + if (message.message !== "") { + writer.uint32(26).string(message.message); + } + if (message.apiKey !== "") { + writer.uint32(34).string(message.apiKey); + } + if (message.keyId !== "") { + writer.uint32(42).string(message.keyId); + } + if (message.keyPrefix !== "") { + writer.uint32(50).string(message.keyPrefix); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CreateApiKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCreateApiKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.resultCode = reader.int32() as any; + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.message = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.apiKey = reader.string(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + message.keyId = reader.string(); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + + message.keyPrefix = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): CreateApiKeyResponse { + return { + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + resultCode: isSet(object.resultCode) + ? resultCodeFromJSON(object.resultCode) + : isSet(object.result_code) + ? resultCodeFromJSON(object.result_code) + : 0, + message: isSet(object.message) ? globalThis.String(object.message) : "", + apiKey: isSet(object.apiKey) + ? globalThis.String(object.apiKey) + : isSet(object.api_key) + ? globalThis.String(object.api_key) + : "", + keyId: isSet(object.keyId) + ? globalThis.String(object.keyId) + : isSet(object.key_id) + ? globalThis.String(object.key_id) + : "", + keyPrefix: isSet(object.keyPrefix) + ? globalThis.String(object.keyPrefix) + : isSet(object.key_prefix) + ? globalThis.String(object.key_prefix) + : "", + }; + }, + + toJSON(message: CreateApiKeyResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + if (message.resultCode !== 0) { + obj.resultCode = resultCodeToJSON(message.resultCode); + } + if (message.message !== "") { + obj.message = message.message; + } + if (message.apiKey !== "") { + obj.apiKey = message.apiKey; + } + if (message.keyId !== "") { + obj.keyId = message.keyId; + } + if (message.keyPrefix !== "") { + obj.keyPrefix = message.keyPrefix; + } + return obj; + }, + + create(base?: DeepPartial): CreateApiKeyResponse { + return CreateApiKeyResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): CreateApiKeyResponse { + const message = createBaseCreateApiKeyResponse(); + message.success = object.success ?? false; + message.resultCode = object.resultCode ?? 0; + message.message = object.message ?? ""; + message.apiKey = object.apiKey ?? ""; + message.keyId = object.keyId ?? ""; + message.keyPrefix = object.keyPrefix ?? ""; + return message; + }, +}; + +function createBaseListApiKeysRequest(): ListApiKeysRequest { + return { token: "" }; +} + +export const ListApiKeysRequest: MessageFns = { + encode(message: ListApiKeysRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.token !== "") { + writer.uint32(10).string(message.token); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ListApiKeysRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseListApiKeysRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.token = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ListApiKeysRequest { + return { token: isSet(object.token) ? globalThis.String(object.token) : "" }; + }, + + toJSON(message: ListApiKeysRequest): unknown { + const obj: any = {}; + if (message.token !== "") { + obj.token = message.token; + } + return obj; + }, + + create(base?: DeepPartial): ListApiKeysRequest { + return ListApiKeysRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): ListApiKeysRequest { + const message = createBaseListApiKeysRequest(); + message.token = object.token ?? ""; + return message; + }, +}; + +function createBaseListApiKeysResponse(): ListApiKeysResponse { + return { success: false, resultCode: 0, message: "", keys: [] }; +} + +export const ListApiKeysResponse: MessageFns = { + encode(message: ListApiKeysResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + if (message.resultCode !== 0) { + writer.uint32(16).int32(message.resultCode); + } + if (message.message !== "") { + writer.uint32(26).string(message.message); + } + for (const v of message.keys) { + ApiKeyInfo.encode(v!, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ListApiKeysResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseListApiKeysResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.resultCode = reader.int32() as any; + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.message = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.keys.push(ApiKeyInfo.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ListApiKeysResponse { + return { + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + resultCode: isSet(object.resultCode) + ? resultCodeFromJSON(object.resultCode) + : isSet(object.result_code) + ? resultCodeFromJSON(object.result_code) + : 0, + message: isSet(object.message) ? globalThis.String(object.message) : "", + keys: globalThis.Array.isArray(object?.keys) ? object.keys.map((e: any) => ApiKeyInfo.fromJSON(e)) : [], + }; + }, + + toJSON(message: ListApiKeysResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + if (message.resultCode !== 0) { + obj.resultCode = resultCodeToJSON(message.resultCode); + } + if (message.message !== "") { + obj.message = message.message; + } + if (message.keys?.length) { + obj.keys = message.keys.map((e) => ApiKeyInfo.toJSON(e)); + } + return obj; + }, + + create(base?: DeepPartial): ListApiKeysResponse { + return ListApiKeysResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): ListApiKeysResponse { + const message = createBaseListApiKeysResponse(); + message.success = object.success ?? false; + message.resultCode = object.resultCode ?? 0; + message.message = object.message ?? ""; + message.keys = object.keys?.map((e) => ApiKeyInfo.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseApiKeyInfo(): ApiKeyInfo { + return { id: "", name: "", keyPrefix: "", scopes: [], lastUsedAt: 0, expiresAt: 0, createdAt: 0, isActive: false }; +} + +export const ApiKeyInfo: MessageFns = { + encode(message: ApiKeyInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.id !== "") { + writer.uint32(10).string(message.id); + } + if (message.name !== "") { + writer.uint32(18).string(message.name); + } + if (message.keyPrefix !== "") { + writer.uint32(26).string(message.keyPrefix); + } + for (const v of message.scopes) { + writer.uint32(34).string(v!); + } + if (message.lastUsedAt !== 0) { + writer.uint32(40).int64(message.lastUsedAt); + } + if (message.expiresAt !== 0) { + writer.uint32(48).int64(message.expiresAt); + } + if (message.createdAt !== 0) { + writer.uint32(56).int64(message.createdAt); + } + if (message.isActive !== false) { + writer.uint32(64).bool(message.isActive); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ApiKeyInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseApiKeyInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.id = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.name = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.keyPrefix = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.scopes.push(reader.string()); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + + message.lastUsedAt = longToNumber(reader.int64()); + continue; + } + case 6: { + if (tag !== 48) { + break; + } + + message.expiresAt = longToNumber(reader.int64()); + continue; + } + case 7: { + if (tag !== 56) { + break; + } + + message.createdAt = longToNumber(reader.int64()); + continue; + } + case 8: { + if (tag !== 64) { + break; + } + + message.isActive = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ApiKeyInfo { + return { + id: isSet(object.id) ? globalThis.String(object.id) : "", + name: isSet(object.name) ? globalThis.String(object.name) : "", + keyPrefix: isSet(object.keyPrefix) + ? globalThis.String(object.keyPrefix) + : isSet(object.key_prefix) + ? globalThis.String(object.key_prefix) + : "", + scopes: globalThis.Array.isArray(object?.scopes) ? object.scopes.map((e: any) => globalThis.String(e)) : [], + lastUsedAt: isSet(object.lastUsedAt) + ? globalThis.Number(object.lastUsedAt) + : isSet(object.last_used_at) + ? globalThis.Number(object.last_used_at) + : 0, + expiresAt: isSet(object.expiresAt) + ? globalThis.Number(object.expiresAt) + : isSet(object.expires_at) + ? globalThis.Number(object.expires_at) + : 0, + createdAt: isSet(object.createdAt) + ? globalThis.Number(object.createdAt) + : isSet(object.created_at) + ? globalThis.Number(object.created_at) + : 0, + isActive: isSet(object.isActive) + ? globalThis.Boolean(object.isActive) + : isSet(object.is_active) + ? globalThis.Boolean(object.is_active) + : false, + }; + }, + + toJSON(message: ApiKeyInfo): unknown { + const obj: any = {}; + if (message.id !== "") { + obj.id = message.id; + } + if (message.name !== "") { + obj.name = message.name; + } + if (message.keyPrefix !== "") { + obj.keyPrefix = message.keyPrefix; + } + if (message.scopes?.length) { + obj.scopes = message.scopes; + } + if (message.lastUsedAt !== 0) { + obj.lastUsedAt = Math.round(message.lastUsedAt); + } + if (message.expiresAt !== 0) { + obj.expiresAt = Math.round(message.expiresAt); + } + if (message.createdAt !== 0) { + obj.createdAt = Math.round(message.createdAt); + } + if (message.isActive !== false) { + obj.isActive = message.isActive; + } + return obj; + }, + + create(base?: DeepPartial): ApiKeyInfo { + return ApiKeyInfo.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): ApiKeyInfo { + const message = createBaseApiKeyInfo(); + message.id = object.id ?? ""; + message.name = object.name ?? ""; + message.keyPrefix = object.keyPrefix ?? ""; + message.scopes = object.scopes?.map((e) => e) || []; + message.lastUsedAt = object.lastUsedAt ?? 0; + message.expiresAt = object.expiresAt ?? 0; + message.createdAt = object.createdAt ?? 0; + message.isActive = object.isActive ?? false; + return message; + }, +}; + +function createBaseRevokeApiKeyRequest(): RevokeApiKeyRequest { + return { token: "", keyId: "" }; +} + +export const RevokeApiKeyRequest: MessageFns = { + encode(message: RevokeApiKeyRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.token !== "") { + writer.uint32(10).string(message.token); + } + if (message.keyId !== "") { + writer.uint32(18).string(message.keyId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RevokeApiKeyRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRevokeApiKeyRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.token = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.keyId = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RevokeApiKeyRequest { + return { + token: isSet(object.token) ? globalThis.String(object.token) : "", + keyId: isSet(object.keyId) + ? globalThis.String(object.keyId) + : isSet(object.key_id) + ? globalThis.String(object.key_id) + : "", + }; + }, + + toJSON(message: RevokeApiKeyRequest): unknown { + const obj: any = {}; + if (message.token !== "") { + obj.token = message.token; + } + if (message.keyId !== "") { + obj.keyId = message.keyId; + } + return obj; + }, + + create(base?: DeepPartial): RevokeApiKeyRequest { + return RevokeApiKeyRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): RevokeApiKeyRequest { + const message = createBaseRevokeApiKeyRequest(); + message.token = object.token ?? ""; + message.keyId = object.keyId ?? ""; + return message; + }, +}; + +function createBaseVerifyApiKeyRequest(): VerifyApiKeyRequest { + return { apiKey: "" }; +} + +export const VerifyApiKeyRequest: MessageFns = { + encode(message: VerifyApiKeyRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.apiKey !== "") { + writer.uint32(10).string(message.apiKey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): VerifyApiKeyRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseVerifyApiKeyRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.apiKey = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): VerifyApiKeyRequest { + return { + apiKey: isSet(object.apiKey) + ? globalThis.String(object.apiKey) + : isSet(object.api_key) + ? globalThis.String(object.api_key) + : "", + }; + }, + + toJSON(message: VerifyApiKeyRequest): unknown { + const obj: any = {}; + if (message.apiKey !== "") { + obj.apiKey = message.apiKey; + } + return obj; + }, + + create(base?: DeepPartial): VerifyApiKeyRequest { + return VerifyApiKeyRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): VerifyApiKeyRequest { + const message = createBaseVerifyApiKeyRequest(); + message.apiKey = object.apiKey ?? ""; + return message; + }, +}; + +function createBaseGetPasswordPolicyRequest(): GetPasswordPolicyRequest { + return {}; +} + +export const GetPasswordPolicyRequest: MessageFns = { + encode(_: GetPasswordPolicyRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetPasswordPolicyRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetPasswordPolicyRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): GetPasswordPolicyRequest { + return {}; + }, + + toJSON(_: GetPasswordPolicyRequest): unknown { + const obj: any = {}; + return obj; + }, + + create(base?: DeepPartial): GetPasswordPolicyRequest { + return GetPasswordPolicyRequest.fromPartial(base ?? {}); + }, + fromPartial(_: DeepPartial): GetPasswordPolicyRequest { + const message = createBaseGetPasswordPolicyRequest(); + return message; + }, +}; + +function createBaseGetPasswordPolicyResponse(): GetPasswordPolicyResponse { + return { + success: false, + resultCode: 0, + message: "", + minLength: 0, + requiresUppercase: false, + requiresSpecialCharacter: false, + }; +} + +export const GetPasswordPolicyResponse: MessageFns = { + encode(message: GetPasswordPolicyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + if (message.resultCode !== 0) { + writer.uint32(16).int32(message.resultCode); + } + if (message.message !== "") { + writer.uint32(26).string(message.message); + } + if (message.minLength !== 0) { + writer.uint32(32).uint32(message.minLength); + } + if (message.requiresUppercase !== false) { + writer.uint32(40).bool(message.requiresUppercase); + } + if (message.requiresSpecialCharacter !== false) { + writer.uint32(48).bool(message.requiresSpecialCharacter); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetPasswordPolicyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetPasswordPolicyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.resultCode = reader.int32() as any; + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.message = reader.string(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + + message.minLength = reader.uint32(); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + + message.requiresUppercase = reader.bool(); + continue; + } + case 6: { + if (tag !== 48) { + break; + } + + message.requiresSpecialCharacter = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetPasswordPolicyResponse { + return { + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + resultCode: isSet(object.resultCode) + ? resultCodeFromJSON(object.resultCode) + : isSet(object.result_code) + ? resultCodeFromJSON(object.result_code) + : 0, + message: isSet(object.message) ? globalThis.String(object.message) : "", + minLength: isSet(object.minLength) + ? globalThis.Number(object.minLength) + : isSet(object.min_length) + ? globalThis.Number(object.min_length) + : 0, + requiresUppercase: isSet(object.requiresUppercase) + ? globalThis.Boolean(object.requiresUppercase) + : isSet(object.requires_uppercase) + ? globalThis.Boolean(object.requires_uppercase) + : false, + requiresSpecialCharacter: isSet(object.requiresSpecialCharacter) + ? globalThis.Boolean(object.requiresSpecialCharacter) + : isSet(object.requires_special_character) + ? globalThis.Boolean(object.requires_special_character) + : false, + }; + }, + + toJSON(message: GetPasswordPolicyResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + if (message.resultCode !== 0) { + obj.resultCode = resultCodeToJSON(message.resultCode); + } + if (message.message !== "") { + obj.message = message.message; + } + if (message.minLength !== 0) { + obj.minLength = Math.round(message.minLength); + } + if (message.requiresUppercase !== false) { + obj.requiresUppercase = message.requiresUppercase; + } + if (message.requiresSpecialCharacter !== false) { + obj.requiresSpecialCharacter = message.requiresSpecialCharacter; + } + return obj; + }, + + create(base?: DeepPartial): GetPasswordPolicyResponse { + return GetPasswordPolicyResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): GetPasswordPolicyResponse { + const message = createBaseGetPasswordPolicyResponse(); + message.success = object.success ?? false; + message.resultCode = object.resultCode ?? 0; + message.message = object.message ?? ""; + message.minLength = object.minLength ?? 0; + message.requiresUppercase = object.requiresUppercase ?? false; + message.requiresSpecialCharacter = object.requiresSpecialCharacter ?? false; + return message; + }, +}; + +function createBaseLookupUserRequest(): LookupUserRequest { + return { userId: "", userToken: "", identifier: "" }; +} + +export const LookupUserRequest: MessageFns = { + encode(message: LookupUserRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.userId !== "") { + writer.uint32(10).string(message.userId); + } + if (message.userToken !== "") { + writer.uint32(18).string(message.userToken); + } + if (message.identifier !== "") { + writer.uint32(26).string(message.identifier); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): LookupUserRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseLookupUserRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.userId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.userToken = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.identifier = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): LookupUserRequest { + return { + userId: isSet(object.userId) + ? globalThis.String(object.userId) + : isSet(object.user_id) + ? globalThis.String(object.user_id) + : "", + userToken: isSet(object.userToken) + ? globalThis.String(object.userToken) + : isSet(object.user_token) + ? globalThis.String(object.user_token) + : "", + identifier: isSet(object.identifier) ? globalThis.String(object.identifier) : "", + }; + }, + + toJSON(message: LookupUserRequest): unknown { + const obj: any = {}; + if (message.userId !== "") { + obj.userId = message.userId; + } + if (message.userToken !== "") { + obj.userToken = message.userToken; + } + if (message.identifier !== "") { + obj.identifier = message.identifier; + } + return obj; + }, + + create(base?: DeepPartial): LookupUserRequest { + return LookupUserRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): LookupUserRequest { + const message = createBaseLookupUserRequest(); + message.userId = object.userId ?? ""; + message.userToken = object.userToken ?? ""; + message.identifier = object.identifier ?? ""; + return message; + }, +}; + +function createBaseLookupUserResponse(): LookupUserResponse { + return { success: false, resultCode: 0, message: "", user: undefined }; +} + +export const LookupUserResponse: MessageFns = { + encode(message: LookupUserResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + if (message.resultCode !== 0) { + writer.uint32(16).int32(message.resultCode); + } + if (message.message !== "") { + writer.uint32(26).string(message.message); + } + if (message.user !== undefined) { + User.encode(message.user, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): LookupUserResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseLookupUserResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.resultCode = reader.int32() as any; + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.message = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.user = User.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): LookupUserResponse { + return { + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + resultCode: isSet(object.resultCode) + ? resultCodeFromJSON(object.resultCode) + : isSet(object.result_code) + ? resultCodeFromJSON(object.result_code) + : 0, + message: isSet(object.message) ? globalThis.String(object.message) : "", + user: isSet(object.user) ? User.fromJSON(object.user) : undefined, + }; + }, + + toJSON(message: LookupUserResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + if (message.resultCode !== 0) { + obj.resultCode = resultCodeToJSON(message.resultCode); + } + if (message.message !== "") { + obj.message = message.message; + } + if (message.user !== undefined) { + obj.user = User.toJSON(message.user); + } + return obj; + }, + + create(base?: DeepPartial): LookupUserResponse { + return LookupUserResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): LookupUserResponse { + const message = createBaseLookupUserResponse(); + message.success = object.success ?? false; + message.resultCode = object.resultCode ?? 0; + message.message = object.message ?? ""; + message.user = (object.user !== undefined && object.user !== null) ? User.fromPartial(object.user) : undefined; + return message; + }, +}; + +export type AuthServiceService = typeof AuthServiceService; +export const AuthServiceService = { + registerUser: { + path: "/st_peter.auth.AuthService/RegisterUser" as const, + requestStream: false as const, + responseStream: false as const, + requestSerialize: (value: RegisterUserRequest): Buffer => Buffer.from(RegisterUserRequest.encode(value).finish()), + requestDeserialize: (value: Buffer): RegisterUserRequest => RegisterUserRequest.decode(value), + responseSerialize: (value: RegisterUserResponse): Buffer => + Buffer.from(RegisterUserResponse.encode(value).finish()), + responseDeserialize: (value: Buffer): RegisterUserResponse => RegisterUserResponse.decode(value), + }, + verifyRegisterUser: { + path: "/st_peter.auth.AuthService/VerifyRegisterUser" as const, + requestStream: false as const, + responseStream: false as const, + requestSerialize: (value: VerifyRegisterUserRequest): Buffer => + Buffer.from(VerifyRegisterUserRequest.encode(value).finish()), + requestDeserialize: (value: Buffer): VerifyRegisterUserRequest => VerifyRegisterUserRequest.decode(value), + responseSerialize: (value: AuthenticationResponse): Buffer => + Buffer.from(AuthenticationResponse.encode(value).finish()), + responseDeserialize: (value: Buffer): AuthenticationResponse => AuthenticationResponse.decode(value), + }, + login: { + path: "/st_peter.auth.AuthService/Login" as const, + requestStream: false as const, + responseStream: false as const, + requestSerialize: (value: LoginRequest): Buffer => Buffer.from(LoginRequest.encode(value).finish()), + requestDeserialize: (value: Buffer): LoginRequest => LoginRequest.decode(value), + responseSerialize: (value: AuthenticationResponse): Buffer => + Buffer.from(AuthenticationResponse.encode(value).finish()), + responseDeserialize: (value: Buffer): AuthenticationResponse => AuthenticationResponse.decode(value), + }, + logout: { + path: "/st_peter.auth.AuthService/Logout" as const, + requestStream: false as const, + responseStream: false as const, + requestSerialize: (value: LogoutRequest): Buffer => Buffer.from(LogoutRequest.encode(value).finish()), + requestDeserialize: (value: Buffer): LogoutRequest => LogoutRequest.decode(value), + responseSerialize: (value: LogoutResponse): Buffer => Buffer.from(LogoutResponse.encode(value).finish()), + responseDeserialize: (value: Buffer): LogoutResponse => LogoutResponse.decode(value), + }, + verifyToken: { + path: "/st_peter.auth.AuthService/VerifyToken" as const, + requestStream: false as const, + responseStream: false as const, + requestSerialize: (value: VerifyTokenRequest): Buffer => Buffer.from(VerifyTokenRequest.encode(value).finish()), + requestDeserialize: (value: Buffer): VerifyTokenRequest => VerifyTokenRequest.decode(value), + responseSerialize: (value: AuthenticationResponse): Buffer => + Buffer.from(AuthenticationResponse.encode(value).finish()), + responseDeserialize: (value: Buffer): AuthenticationResponse => AuthenticationResponse.decode(value), + }, + verifyAuthClaimToken: { + path: "/st_peter.auth.AuthService/VerifyAuthClaimToken" as const, + requestStream: false as const, + responseStream: false as const, + requestSerialize: (value: VerifyAuthClaimTokenRequest): Buffer => + Buffer.from(VerifyAuthClaimTokenRequest.encode(value).finish()), + requestDeserialize: (value: Buffer): VerifyAuthClaimTokenRequest => VerifyAuthClaimTokenRequest.decode(value), + responseSerialize: (value: AuthenticationResponse): Buffer => + Buffer.from(AuthenticationResponse.encode(value).finish()), + responseDeserialize: (value: Buffer): AuthenticationResponse => AuthenticationResponse.decode(value), + }, + initiateTwoFactor: { + path: "/st_peter.auth.AuthService/InitiateTwoFactor" as const, + requestStream: false as const, + responseStream: false as const, + requestSerialize: (value: InitiateTwoFactorRequest): Buffer => + Buffer.from(InitiateTwoFactorRequest.encode(value).finish()), + requestDeserialize: (value: Buffer): InitiateTwoFactorRequest => InitiateTwoFactorRequest.decode(value), + responseSerialize: (value: InitiateTwoFactorResponse): Buffer => + Buffer.from(InitiateTwoFactorResponse.encode(value).finish()), + responseDeserialize: (value: Buffer): InitiateTwoFactorResponse => InitiateTwoFactorResponse.decode(value), + }, + verifyTwoFactor: { + path: "/st_peter.auth.AuthService/VerifyTwoFactor" as const, + requestStream: false as const, + responseStream: false as const, + requestSerialize: (value: VerifyTwoFactorRequest): Buffer => + Buffer.from(VerifyTwoFactorRequest.encode(value).finish()), + requestDeserialize: (value: Buffer): VerifyTwoFactorRequest => VerifyTwoFactorRequest.decode(value), + responseSerialize: (value: AuthenticationResponse): Buffer => + Buffer.from(AuthenticationResponse.encode(value).finish()), + responseDeserialize: (value: Buffer): AuthenticationResponse => AuthenticationResponse.decode(value), + }, + initiatePasswordReset: { + path: "/st_peter.auth.AuthService/InitiatePasswordReset" as const, + requestStream: false as const, + responseStream: false as const, + requestSerialize: (value: InitiatePasswordResetRequest): Buffer => + Buffer.from(InitiatePasswordResetRequest.encode(value).finish()), + requestDeserialize: (value: Buffer): InitiatePasswordResetRequest => InitiatePasswordResetRequest.decode(value), + responseSerialize: (value: PasswordResetTokenResponse): Buffer => + Buffer.from(PasswordResetTokenResponse.encode(value).finish()), + responseDeserialize: (value: Buffer): PasswordResetTokenResponse => PasswordResetTokenResponse.decode(value), + }, + verifyPasswordResetToken: { + path: "/st_peter.auth.AuthService/VerifyPasswordResetToken" as const, + requestStream: false as const, + responseStream: false as const, + requestSerialize: (value: VerifyPasswordResetTokenRequest): Buffer => + Buffer.from(VerifyPasswordResetTokenRequest.encode(value).finish()), + requestDeserialize: (value: Buffer): VerifyPasswordResetTokenRequest => + VerifyPasswordResetTokenRequest.decode(value), + responseSerialize: (value: PasswordResetTokenResponse): Buffer => + Buffer.from(PasswordResetTokenResponse.encode(value).finish()), + responseDeserialize: (value: Buffer): PasswordResetTokenResponse => PasswordResetTokenResponse.decode(value), + }, + resetPassword: { + path: "/st_peter.auth.AuthService/ResetPassword" as const, + requestStream: false as const, + responseStream: false as const, + requestSerialize: (value: ResetPasswordRequest): Buffer => Buffer.from(ResetPasswordRequest.encode(value).finish()), + requestDeserialize: (value: Buffer): ResetPasswordRequest => ResetPasswordRequest.decode(value), + responseSerialize: (value: AuthenticationResponse): Buffer => + Buffer.from(AuthenticationResponse.encode(value).finish()), + responseDeserialize: (value: Buffer): AuthenticationResponse => AuthenticationResponse.decode(value), + }, + resendVerificationCode: { + path: "/st_peter.auth.AuthService/ResendVerificationCode" as const, + requestStream: false as const, + responseStream: false as const, + requestSerialize: (value: ResendVerificationRequest): Buffer => + Buffer.from(ResendVerificationRequest.encode(value).finish()), + requestDeserialize: (value: Buffer): ResendVerificationRequest => ResendVerificationRequest.decode(value), + responseSerialize: (value: ResendVerificationResponse): Buffer => + Buffer.from(ResendVerificationResponse.encode(value).finish()), + responseDeserialize: (value: Buffer): ResendVerificationResponse => ResendVerificationResponse.decode(value), + }, + updateUserInfo: { + path: "/st_peter.auth.AuthService/UpdateUserInfo" as const, + requestStream: false as const, + responseStream: false as const, + requestSerialize: (value: UpdateUserInfoRequest): Buffer => + Buffer.from(UpdateUserInfoRequest.encode(value).finish()), + requestDeserialize: (value: Buffer): UpdateUserInfoRequest => UpdateUserInfoRequest.decode(value), + responseSerialize: (value: UpdateUserInfoResponse): Buffer => + Buffer.from(UpdateUserInfoResponse.encode(value).finish()), + responseDeserialize: (value: Buffer): UpdateUserInfoResponse => UpdateUserInfoResponse.decode(value), + }, + changeIdentityField: { + path: "/st_peter.auth.AuthService/ChangeIdentityField" as const, + requestStream: false as const, + responseStream: false as const, + requestSerialize: (value: ChangeIdentityFieldRequest): Buffer => + Buffer.from(ChangeIdentityFieldRequest.encode(value).finish()), + requestDeserialize: (value: Buffer): ChangeIdentityFieldRequest => ChangeIdentityFieldRequest.decode(value), + responseSerialize: (value: ChangeIdentityFieldResponse): Buffer => + Buffer.from(ChangeIdentityFieldResponse.encode(value).finish()), + responseDeserialize: (value: Buffer): ChangeIdentityFieldResponse => ChangeIdentityFieldResponse.decode(value), + }, + verifyIdentityField: { + path: "/st_peter.auth.AuthService/VerifyIdentityField" as const, + requestStream: false as const, + responseStream: false as const, + requestSerialize: (value: VerifyIdentityFieldRequest): Buffer => + Buffer.from(VerifyIdentityFieldRequest.encode(value).finish()), + requestDeserialize: (value: Buffer): VerifyIdentityFieldRequest => VerifyIdentityFieldRequest.decode(value), + responseSerialize: (value: VerifyIdentityFieldResponse): Buffer => + Buffer.from(VerifyIdentityFieldResponse.encode(value).finish()), + responseDeserialize: (value: Buffer): VerifyIdentityFieldResponse => VerifyIdentityFieldResponse.decode(value), + }, + resendIdentifierChangeCode: { + path: "/st_peter.auth.AuthService/ResendIdentifierChangeCode" as const, + requestStream: false as const, + responseStream: false as const, + requestSerialize: (value: ResendIdentityFieldRequest): Buffer => + Buffer.from(ResendIdentityFieldRequest.encode(value).finish()), + requestDeserialize: (value: Buffer): ResendIdentityFieldRequest => ResendIdentityFieldRequest.decode(value), + responseSerialize: (value: ChangeIdentityFieldResponse): Buffer => + Buffer.from(ChangeIdentityFieldResponse.encode(value).finish()), + responseDeserialize: (value: Buffer): ChangeIdentityFieldResponse => ChangeIdentityFieldResponse.decode(value), + }, + updateUserPreference: { + path: "/st_peter.auth.AuthService/UpdateUserPreference" as const, + requestStream: false as const, + responseStream: false as const, + requestSerialize: (value: UpdateUserPreferenceRequest): Buffer => + Buffer.from(UpdateUserPreferenceRequest.encode(value).finish()), + requestDeserialize: (value: Buffer): UpdateUserPreferenceRequest => UpdateUserPreferenceRequest.decode(value), + responseSerialize: (value: OperationResponse): Buffer => Buffer.from(OperationResponse.encode(value).finish()), + responseDeserialize: (value: Buffer): OperationResponse => OperationResponse.decode(value), + }, + getUserPreferenceByCode: { + path: "/st_peter.auth.AuthService/GetUserPreferenceByCode" as const, + requestStream: false as const, + responseStream: false as const, + requestSerialize: (value: GetUserPreferenceByCodeRequest): Buffer => + Buffer.from(GetUserPreferenceByCodeRequest.encode(value).finish()), + requestDeserialize: (value: Buffer): GetUserPreferenceByCodeRequest => GetUserPreferenceByCodeRequest.decode(value), + responseSerialize: (value: GetUserPreferenceByCodeResponse): Buffer => + Buffer.from(GetUserPreferenceByCodeResponse.encode(value).finish()), + responseDeserialize: (value: Buffer): GetUserPreferenceByCodeResponse => + GetUserPreferenceByCodeResponse.decode(value), + }, + getUserSessions: { + path: "/st_peter.auth.AuthService/GetUserSessions" as const, + requestStream: false as const, + responseStream: false as const, + requestSerialize: (value: GetUserSessionsRequest): Buffer => + Buffer.from(GetUserSessionsRequest.encode(value).finish()), + requestDeserialize: (value: Buffer): GetUserSessionsRequest => GetUserSessionsRequest.decode(value), + responseSerialize: (value: GetUserSessionsResponse): Buffer => + Buffer.from(GetUserSessionsResponse.encode(value).finish()), + responseDeserialize: (value: Buffer): GetUserSessionsResponse => GetUserSessionsResponse.decode(value), + }, + clearUserSessions: { + path: "/st_peter.auth.AuthService/ClearUserSessions" as const, + requestStream: false as const, + responseStream: false as const, + requestSerialize: (value: ClearUserSessionsRequest): Buffer => + Buffer.from(ClearUserSessionsRequest.encode(value).finish()), + requestDeserialize: (value: Buffer): ClearUserSessionsRequest => ClearUserSessionsRequest.decode(value), + responseSerialize: (value: ClearUserSessionsResponse): Buffer => + Buffer.from(ClearUserSessionsResponse.encode(value).finish()), + responseDeserialize: (value: Buffer): ClearUserSessionsResponse => ClearUserSessionsResponse.decode(value), + }, + /** Social login - Mobile flow (validates ID token from native SDK) */ + socialLogin: { + path: "/st_peter.auth.AuthService/SocialLogin" as const, + requestStream: false as const, + responseStream: false as const, + requestSerialize: (value: SocialLoginRequest): Buffer => Buffer.from(SocialLoginRequest.encode(value).finish()), + requestDeserialize: (value: Buffer): SocialLoginRequest => SocialLoginRequest.decode(value), + responseSerialize: (value: SocialLoginResponse): Buffer => Buffer.from(SocialLoginResponse.encode(value).finish()), + responseDeserialize: (value: Buffer): SocialLoginResponse => SocialLoginResponse.decode(value), + }, + /** Social login - Web OAuth flow */ + initiateOAuth: { + path: "/st_peter.auth.AuthService/InitiateOAuth" as const, + requestStream: false as const, + responseStream: false as const, + requestSerialize: (value: InitiateOAuthRequest): Buffer => Buffer.from(InitiateOAuthRequest.encode(value).finish()), + requestDeserialize: (value: Buffer): InitiateOAuthRequest => InitiateOAuthRequest.decode(value), + responseSerialize: (value: InitiateOAuthResponse): Buffer => + Buffer.from(InitiateOAuthResponse.encode(value).finish()), + responseDeserialize: (value: Buffer): InitiateOAuthResponse => InitiateOAuthResponse.decode(value), + }, + completeOAuth: { + path: "/st_peter.auth.AuthService/CompleteOAuth" as const, + requestStream: false as const, + responseStream: false as const, + requestSerialize: (value: OAuthCallbackRequest): Buffer => Buffer.from(OAuthCallbackRequest.encode(value).finish()), + requestDeserialize: (value: Buffer): OAuthCallbackRequest => OAuthCallbackRequest.decode(value), + responseSerialize: (value: SocialLoginResponse): Buffer => Buffer.from(SocialLoginResponse.encode(value).finish()), + responseDeserialize: (value: Buffer): SocialLoginResponse => SocialLoginResponse.decode(value), + }, + /** Account linking */ + linkSocialAccount: { + path: "/st_peter.auth.AuthService/LinkSocialAccount" as const, + requestStream: false as const, + responseStream: false as const, + requestSerialize: (value: LinkSocialAccountRequest): Buffer => + Buffer.from(LinkSocialAccountRequest.encode(value).finish()), + requestDeserialize: (value: Buffer): LinkSocialAccountRequest => LinkSocialAccountRequest.decode(value), + responseSerialize: (value: OperationResponse): Buffer => Buffer.from(OperationResponse.encode(value).finish()), + responseDeserialize: (value: Buffer): OperationResponse => OperationResponse.decode(value), + }, + unlinkSocialAccount: { + path: "/st_peter.auth.AuthService/UnlinkSocialAccount" as const, + requestStream: false as const, + responseStream: false as const, + requestSerialize: (value: UnlinkSocialAccountRequest): Buffer => + Buffer.from(UnlinkSocialAccountRequest.encode(value).finish()), + requestDeserialize: (value: Buffer): UnlinkSocialAccountRequest => UnlinkSocialAccountRequest.decode(value), + responseSerialize: (value: OperationResponse): Buffer => Buffer.from(OperationResponse.encode(value).finish()), + responseDeserialize: (value: Buffer): OperationResponse => OperationResponse.decode(value), + }, + getLinkedAccounts: { + path: "/st_peter.auth.AuthService/GetLinkedAccounts" as const, + requestStream: false as const, + responseStream: false as const, + requestSerialize: (value: GetLinkedAccountsRequest): Buffer => + Buffer.from(GetLinkedAccountsRequest.encode(value).finish()), + requestDeserialize: (value: Buffer): GetLinkedAccountsRequest => GetLinkedAccountsRequest.decode(value), + responseSerialize: (value: GetLinkedAccountsResponse): Buffer => + Buffer.from(GetLinkedAccountsResponse.encode(value).finish()), + responseDeserialize: (value: Buffer): GetLinkedAccountsResponse => GetLinkedAccountsResponse.decode(value), + }, + /** API Keys */ + createApiKey: { + path: "/st_peter.auth.AuthService/CreateApiKey" as const, + requestStream: false as const, + responseStream: false as const, + requestSerialize: (value: CreateApiKeyRequest): Buffer => Buffer.from(CreateApiKeyRequest.encode(value).finish()), + requestDeserialize: (value: Buffer): CreateApiKeyRequest => CreateApiKeyRequest.decode(value), + responseSerialize: (value: CreateApiKeyResponse): Buffer => + Buffer.from(CreateApiKeyResponse.encode(value).finish()), + responseDeserialize: (value: Buffer): CreateApiKeyResponse => CreateApiKeyResponse.decode(value), + }, + listApiKeys: { + path: "/st_peter.auth.AuthService/ListApiKeys" as const, + requestStream: false as const, + responseStream: false as const, + requestSerialize: (value: ListApiKeysRequest): Buffer => Buffer.from(ListApiKeysRequest.encode(value).finish()), + requestDeserialize: (value: Buffer): ListApiKeysRequest => ListApiKeysRequest.decode(value), + responseSerialize: (value: ListApiKeysResponse): Buffer => Buffer.from(ListApiKeysResponse.encode(value).finish()), + responseDeserialize: (value: Buffer): ListApiKeysResponse => ListApiKeysResponse.decode(value), + }, + revokeApiKey: { + path: "/st_peter.auth.AuthService/RevokeApiKey" as const, + requestStream: false as const, + responseStream: false as const, + requestSerialize: (value: RevokeApiKeyRequest): Buffer => Buffer.from(RevokeApiKeyRequest.encode(value).finish()), + requestDeserialize: (value: Buffer): RevokeApiKeyRequest => RevokeApiKeyRequest.decode(value), + responseSerialize: (value: OperationResponse): Buffer => Buffer.from(OperationResponse.encode(value).finish()), + responseDeserialize: (value: Buffer): OperationResponse => OperationResponse.decode(value), + }, + verifyApiKey: { + path: "/st_peter.auth.AuthService/VerifyApiKey" as const, + requestStream: false as const, + responseStream: false as const, + requestSerialize: (value: VerifyApiKeyRequest): Buffer => Buffer.from(VerifyApiKeyRequest.encode(value).finish()), + requestDeserialize: (value: Buffer): VerifyApiKeyRequest => VerifyApiKeyRequest.decode(value), + responseSerialize: (value: AuthenticationResponse): Buffer => + Buffer.from(AuthenticationResponse.encode(value).finish()), + responseDeserialize: (value: Buffer): AuthenticationResponse => AuthenticationResponse.decode(value), + }, + /** Password policy (public, no auth required) */ + getPasswordPolicy: { + path: "/st_peter.auth.AuthService/GetPasswordPolicy" as const, + requestStream: false as const, + responseStream: false as const, + requestSerialize: (value: GetPasswordPolicyRequest): Buffer => + Buffer.from(GetPasswordPolicyRequest.encode(value).finish()), + requestDeserialize: (value: Buffer): GetPasswordPolicyRequest => GetPasswordPolicyRequest.decode(value), + responseSerialize: (value: GetPasswordPolicyResponse): Buffer => + Buffer.from(GetPasswordPolicyResponse.encode(value).finish()), + responseDeserialize: (value: Buffer): GetPasswordPolicyResponse => GetPasswordPolicyResponse.decode(value), + }, + /** Metrics */ + getMetrics: { + path: "/st_peter.auth.AuthService/GetMetrics" as const, + requestStream: false as const, + responseStream: false as const, + requestSerialize: (value: GetMetricsRequest): Buffer => Buffer.from(GetMetricsRequest.encode(value).finish()), + requestDeserialize: (value: Buffer): GetMetricsRequest => GetMetricsRequest.decode(value), + responseSerialize: (value: GetMetricsResponse): Buffer => Buffer.from(GetMetricsResponse.encode(value).finish()), + responseDeserialize: (value: Buffer): GetMetricsResponse => GetMetricsResponse.decode(value), + }, + /** User lookup by identifier (email, phone, or handle) — any authenticated user */ + lookupUser: { + path: "/st_peter.auth.AuthService/LookupUser" as const, + requestStream: false as const, + responseStream: false as const, + requestSerialize: (value: LookupUserRequest): Buffer => Buffer.from(LookupUserRequest.encode(value).finish()), + requestDeserialize: (value: Buffer): LookupUserRequest => LookupUserRequest.decode(value), + responseSerialize: (value: LookupUserResponse): Buffer => Buffer.from(LookupUserResponse.encode(value).finish()), + responseDeserialize: (value: Buffer): LookupUserResponse => LookupUserResponse.decode(value), + }, +} as const; + +export interface AuthServiceServer extends UntypedServiceImplementation { + registerUser: handleUnaryCall; + verifyRegisterUser: handleUnaryCall; + login: handleUnaryCall; + logout: handleUnaryCall; + verifyToken: handleUnaryCall; + verifyAuthClaimToken: handleUnaryCall; + initiateTwoFactor: handleUnaryCall; + verifyTwoFactor: handleUnaryCall; + initiatePasswordReset: handleUnaryCall; + verifyPasswordResetToken: handleUnaryCall; + resetPassword: handleUnaryCall; + resendVerificationCode: handleUnaryCall; + updateUserInfo: handleUnaryCall; + changeIdentityField: handleUnaryCall; + verifyIdentityField: handleUnaryCall; + resendIdentifierChangeCode: handleUnaryCall; + updateUserPreference: handleUnaryCall; + getUserPreferenceByCode: handleUnaryCall; + getUserSessions: handleUnaryCall; + clearUserSessions: handleUnaryCall; + /** Social login - Mobile flow (validates ID token from native SDK) */ + socialLogin: handleUnaryCall; + /** Social login - Web OAuth flow */ + initiateOAuth: handleUnaryCall; + completeOAuth: handleUnaryCall; + /** Account linking */ + linkSocialAccount: handleUnaryCall; + unlinkSocialAccount: handleUnaryCall; + getLinkedAccounts: handleUnaryCall; + /** API Keys */ + createApiKey: handleUnaryCall; + listApiKeys: handleUnaryCall; + revokeApiKey: handleUnaryCall; + verifyApiKey: handleUnaryCall; + /** Password policy (public, no auth required) */ + getPasswordPolicy: handleUnaryCall; + /** Metrics */ + getMetrics: handleUnaryCall; + /** User lookup by identifier (email, phone, or handle) — any authenticated user */ + lookupUser: handleUnaryCall; +} + +export interface AuthServiceClient extends Client { + registerUser( + request: RegisterUserRequest, + callback: (error: ServiceError | null, response: RegisterUserResponse) => void, + ): ClientUnaryCall; + registerUser( + request: RegisterUserRequest, + metadata: Metadata, + callback: (error: ServiceError | null, response: RegisterUserResponse) => void, + ): ClientUnaryCall; + registerUser( + request: RegisterUserRequest, + metadata: Metadata, + options: Partial, + callback: (error: ServiceError | null, response: RegisterUserResponse) => void, + ): ClientUnaryCall; + verifyRegisterUser( + request: VerifyRegisterUserRequest, + callback: (error: ServiceError | null, response: AuthenticationResponse) => void, + ): ClientUnaryCall; + verifyRegisterUser( + request: VerifyRegisterUserRequest, + metadata: Metadata, + callback: (error: ServiceError | null, response: AuthenticationResponse) => void, + ): ClientUnaryCall; + verifyRegisterUser( + request: VerifyRegisterUserRequest, + metadata: Metadata, + options: Partial, + callback: (error: ServiceError | null, response: AuthenticationResponse) => void, + ): ClientUnaryCall; + login( + request: LoginRequest, + callback: (error: ServiceError | null, response: AuthenticationResponse) => void, + ): ClientUnaryCall; + login( + request: LoginRequest, + metadata: Metadata, + callback: (error: ServiceError | null, response: AuthenticationResponse) => void, + ): ClientUnaryCall; + login( + request: LoginRequest, + metadata: Metadata, + options: Partial, + callback: (error: ServiceError | null, response: AuthenticationResponse) => void, + ): ClientUnaryCall; + logout( + request: LogoutRequest, + callback: (error: ServiceError | null, response: LogoutResponse) => void, + ): ClientUnaryCall; + logout( + request: LogoutRequest, + metadata: Metadata, + callback: (error: ServiceError | null, response: LogoutResponse) => void, + ): ClientUnaryCall; + logout( + request: LogoutRequest, + metadata: Metadata, + options: Partial, + callback: (error: ServiceError | null, response: LogoutResponse) => void, + ): ClientUnaryCall; + verifyToken( + request: VerifyTokenRequest, + callback: (error: ServiceError | null, response: AuthenticationResponse) => void, + ): ClientUnaryCall; + verifyToken( + request: VerifyTokenRequest, + metadata: Metadata, + callback: (error: ServiceError | null, response: AuthenticationResponse) => void, + ): ClientUnaryCall; + verifyToken( + request: VerifyTokenRequest, + metadata: Metadata, + options: Partial, + callback: (error: ServiceError | null, response: AuthenticationResponse) => void, + ): ClientUnaryCall; + verifyAuthClaimToken( + request: VerifyAuthClaimTokenRequest, + callback: (error: ServiceError | null, response: AuthenticationResponse) => void, + ): ClientUnaryCall; + verifyAuthClaimToken( + request: VerifyAuthClaimTokenRequest, + metadata: Metadata, + callback: (error: ServiceError | null, response: AuthenticationResponse) => void, + ): ClientUnaryCall; + verifyAuthClaimToken( + request: VerifyAuthClaimTokenRequest, + metadata: Metadata, + options: Partial, + callback: (error: ServiceError | null, response: AuthenticationResponse) => void, + ): ClientUnaryCall; + initiateTwoFactor( + request: InitiateTwoFactorRequest, + callback: (error: ServiceError | null, response: InitiateTwoFactorResponse) => void, + ): ClientUnaryCall; + initiateTwoFactor( + request: InitiateTwoFactorRequest, + metadata: Metadata, + callback: (error: ServiceError | null, response: InitiateTwoFactorResponse) => void, + ): ClientUnaryCall; + initiateTwoFactor( + request: InitiateTwoFactorRequest, + metadata: Metadata, + options: Partial, + callback: (error: ServiceError | null, response: InitiateTwoFactorResponse) => void, + ): ClientUnaryCall; + verifyTwoFactor( + request: VerifyTwoFactorRequest, + callback: (error: ServiceError | null, response: AuthenticationResponse) => void, + ): ClientUnaryCall; + verifyTwoFactor( + request: VerifyTwoFactorRequest, + metadata: Metadata, + callback: (error: ServiceError | null, response: AuthenticationResponse) => void, + ): ClientUnaryCall; + verifyTwoFactor( + request: VerifyTwoFactorRequest, + metadata: Metadata, + options: Partial, + callback: (error: ServiceError | null, response: AuthenticationResponse) => void, + ): ClientUnaryCall; + initiatePasswordReset( + request: InitiatePasswordResetRequest, + callback: (error: ServiceError | null, response: PasswordResetTokenResponse) => void, + ): ClientUnaryCall; + initiatePasswordReset( + request: InitiatePasswordResetRequest, + metadata: Metadata, + callback: (error: ServiceError | null, response: PasswordResetTokenResponse) => void, + ): ClientUnaryCall; + initiatePasswordReset( + request: InitiatePasswordResetRequest, + metadata: Metadata, + options: Partial, + callback: (error: ServiceError | null, response: PasswordResetTokenResponse) => void, + ): ClientUnaryCall; + verifyPasswordResetToken( + request: VerifyPasswordResetTokenRequest, + callback: (error: ServiceError | null, response: PasswordResetTokenResponse) => void, + ): ClientUnaryCall; + verifyPasswordResetToken( + request: VerifyPasswordResetTokenRequest, + metadata: Metadata, + callback: (error: ServiceError | null, response: PasswordResetTokenResponse) => void, + ): ClientUnaryCall; + verifyPasswordResetToken( + request: VerifyPasswordResetTokenRequest, + metadata: Metadata, + options: Partial, + callback: (error: ServiceError | null, response: PasswordResetTokenResponse) => void, + ): ClientUnaryCall; + resetPassword( + request: ResetPasswordRequest, + callback: (error: ServiceError | null, response: AuthenticationResponse) => void, + ): ClientUnaryCall; + resetPassword( + request: ResetPasswordRequest, + metadata: Metadata, + callback: (error: ServiceError | null, response: AuthenticationResponse) => void, + ): ClientUnaryCall; + resetPassword( + request: ResetPasswordRequest, + metadata: Metadata, + options: Partial, + callback: (error: ServiceError | null, response: AuthenticationResponse) => void, + ): ClientUnaryCall; + resendVerificationCode( + request: ResendVerificationRequest, + callback: (error: ServiceError | null, response: ResendVerificationResponse) => void, + ): ClientUnaryCall; + resendVerificationCode( + request: ResendVerificationRequest, + metadata: Metadata, + callback: (error: ServiceError | null, response: ResendVerificationResponse) => void, + ): ClientUnaryCall; + resendVerificationCode( + request: ResendVerificationRequest, + metadata: Metadata, + options: Partial, + callback: (error: ServiceError | null, response: ResendVerificationResponse) => void, + ): ClientUnaryCall; + updateUserInfo( + request: UpdateUserInfoRequest, + callback: (error: ServiceError | null, response: UpdateUserInfoResponse) => void, + ): ClientUnaryCall; + updateUserInfo( + request: UpdateUserInfoRequest, + metadata: Metadata, + callback: (error: ServiceError | null, response: UpdateUserInfoResponse) => void, + ): ClientUnaryCall; + updateUserInfo( + request: UpdateUserInfoRequest, + metadata: Metadata, + options: Partial, + callback: (error: ServiceError | null, response: UpdateUserInfoResponse) => void, + ): ClientUnaryCall; + changeIdentityField( + request: ChangeIdentityFieldRequest, + callback: (error: ServiceError | null, response: ChangeIdentityFieldResponse) => void, + ): ClientUnaryCall; + changeIdentityField( + request: ChangeIdentityFieldRequest, + metadata: Metadata, + callback: (error: ServiceError | null, response: ChangeIdentityFieldResponse) => void, + ): ClientUnaryCall; + changeIdentityField( + request: ChangeIdentityFieldRequest, + metadata: Metadata, + options: Partial, + callback: (error: ServiceError | null, response: ChangeIdentityFieldResponse) => void, + ): ClientUnaryCall; + verifyIdentityField( + request: VerifyIdentityFieldRequest, + callback: (error: ServiceError | null, response: VerifyIdentityFieldResponse) => void, + ): ClientUnaryCall; + verifyIdentityField( + request: VerifyIdentityFieldRequest, + metadata: Metadata, + callback: (error: ServiceError | null, response: VerifyIdentityFieldResponse) => void, + ): ClientUnaryCall; + verifyIdentityField( + request: VerifyIdentityFieldRequest, + metadata: Metadata, + options: Partial, + callback: (error: ServiceError | null, response: VerifyIdentityFieldResponse) => void, + ): ClientUnaryCall; + resendIdentifierChangeCode( + request: ResendIdentityFieldRequest, + callback: (error: ServiceError | null, response: ChangeIdentityFieldResponse) => void, + ): ClientUnaryCall; + resendIdentifierChangeCode( + request: ResendIdentityFieldRequest, + metadata: Metadata, + callback: (error: ServiceError | null, response: ChangeIdentityFieldResponse) => void, + ): ClientUnaryCall; + resendIdentifierChangeCode( + request: ResendIdentityFieldRequest, + metadata: Metadata, + options: Partial, + callback: (error: ServiceError | null, response: ChangeIdentityFieldResponse) => void, + ): ClientUnaryCall; + updateUserPreference( + request: UpdateUserPreferenceRequest, + callback: (error: ServiceError | null, response: OperationResponse) => void, + ): ClientUnaryCall; + updateUserPreference( + request: UpdateUserPreferenceRequest, + metadata: Metadata, + callback: (error: ServiceError | null, response: OperationResponse) => void, + ): ClientUnaryCall; + updateUserPreference( + request: UpdateUserPreferenceRequest, + metadata: Metadata, + options: Partial, + callback: (error: ServiceError | null, response: OperationResponse) => void, + ): ClientUnaryCall; + getUserPreferenceByCode( + request: GetUserPreferenceByCodeRequest, + callback: (error: ServiceError | null, response: GetUserPreferenceByCodeResponse) => void, + ): ClientUnaryCall; + getUserPreferenceByCode( + request: GetUserPreferenceByCodeRequest, + metadata: Metadata, + callback: (error: ServiceError | null, response: GetUserPreferenceByCodeResponse) => void, + ): ClientUnaryCall; + getUserPreferenceByCode( + request: GetUserPreferenceByCodeRequest, + metadata: Metadata, + options: Partial, + callback: (error: ServiceError | null, response: GetUserPreferenceByCodeResponse) => void, + ): ClientUnaryCall; + getUserSessions( + request: GetUserSessionsRequest, + callback: (error: ServiceError | null, response: GetUserSessionsResponse) => void, + ): ClientUnaryCall; + getUserSessions( + request: GetUserSessionsRequest, + metadata: Metadata, + callback: (error: ServiceError | null, response: GetUserSessionsResponse) => void, + ): ClientUnaryCall; + getUserSessions( + request: GetUserSessionsRequest, + metadata: Metadata, + options: Partial, + callback: (error: ServiceError | null, response: GetUserSessionsResponse) => void, + ): ClientUnaryCall; + clearUserSessions( + request: ClearUserSessionsRequest, + callback: (error: ServiceError | null, response: ClearUserSessionsResponse) => void, + ): ClientUnaryCall; + clearUserSessions( + request: ClearUserSessionsRequest, + metadata: Metadata, + callback: (error: ServiceError | null, response: ClearUserSessionsResponse) => void, + ): ClientUnaryCall; + clearUserSessions( + request: ClearUserSessionsRequest, + metadata: Metadata, + options: Partial, + callback: (error: ServiceError | null, response: ClearUserSessionsResponse) => void, + ): ClientUnaryCall; + /** Social login - Mobile flow (validates ID token from native SDK) */ + socialLogin( + request: SocialLoginRequest, + callback: (error: ServiceError | null, response: SocialLoginResponse) => void, + ): ClientUnaryCall; + socialLogin( + request: SocialLoginRequest, + metadata: Metadata, + callback: (error: ServiceError | null, response: SocialLoginResponse) => void, + ): ClientUnaryCall; + socialLogin( + request: SocialLoginRequest, + metadata: Metadata, + options: Partial, + callback: (error: ServiceError | null, response: SocialLoginResponse) => void, + ): ClientUnaryCall; + /** Social login - Web OAuth flow */ + initiateOAuth( + request: InitiateOAuthRequest, + callback: (error: ServiceError | null, response: InitiateOAuthResponse) => void, + ): ClientUnaryCall; + initiateOAuth( + request: InitiateOAuthRequest, + metadata: Metadata, + callback: (error: ServiceError | null, response: InitiateOAuthResponse) => void, + ): ClientUnaryCall; + initiateOAuth( + request: InitiateOAuthRequest, + metadata: Metadata, + options: Partial, + callback: (error: ServiceError | null, response: InitiateOAuthResponse) => void, + ): ClientUnaryCall; + completeOAuth( + request: OAuthCallbackRequest, + callback: (error: ServiceError | null, response: SocialLoginResponse) => void, + ): ClientUnaryCall; + completeOAuth( + request: OAuthCallbackRequest, + metadata: Metadata, + callback: (error: ServiceError | null, response: SocialLoginResponse) => void, + ): ClientUnaryCall; + completeOAuth( + request: OAuthCallbackRequest, + metadata: Metadata, + options: Partial, + callback: (error: ServiceError | null, response: SocialLoginResponse) => void, + ): ClientUnaryCall; + /** Account linking */ + linkSocialAccount( + request: LinkSocialAccountRequest, + callback: (error: ServiceError | null, response: OperationResponse) => void, + ): ClientUnaryCall; + linkSocialAccount( + request: LinkSocialAccountRequest, + metadata: Metadata, + callback: (error: ServiceError | null, response: OperationResponse) => void, + ): ClientUnaryCall; + linkSocialAccount( + request: LinkSocialAccountRequest, + metadata: Metadata, + options: Partial, + callback: (error: ServiceError | null, response: OperationResponse) => void, + ): ClientUnaryCall; + unlinkSocialAccount( + request: UnlinkSocialAccountRequest, + callback: (error: ServiceError | null, response: OperationResponse) => void, + ): ClientUnaryCall; + unlinkSocialAccount( + request: UnlinkSocialAccountRequest, + metadata: Metadata, + callback: (error: ServiceError | null, response: OperationResponse) => void, + ): ClientUnaryCall; + unlinkSocialAccount( + request: UnlinkSocialAccountRequest, + metadata: Metadata, + options: Partial, + callback: (error: ServiceError | null, response: OperationResponse) => void, + ): ClientUnaryCall; + getLinkedAccounts( + request: GetLinkedAccountsRequest, + callback: (error: ServiceError | null, response: GetLinkedAccountsResponse) => void, + ): ClientUnaryCall; + getLinkedAccounts( + request: GetLinkedAccountsRequest, + metadata: Metadata, + callback: (error: ServiceError | null, response: GetLinkedAccountsResponse) => void, + ): ClientUnaryCall; + getLinkedAccounts( + request: GetLinkedAccountsRequest, + metadata: Metadata, + options: Partial, + callback: (error: ServiceError | null, response: GetLinkedAccountsResponse) => void, + ): ClientUnaryCall; + /** API Keys */ + createApiKey( + request: CreateApiKeyRequest, + callback: (error: ServiceError | null, response: CreateApiKeyResponse) => void, + ): ClientUnaryCall; + createApiKey( + request: CreateApiKeyRequest, + metadata: Metadata, + callback: (error: ServiceError | null, response: CreateApiKeyResponse) => void, + ): ClientUnaryCall; + createApiKey( + request: CreateApiKeyRequest, + metadata: Metadata, + options: Partial, + callback: (error: ServiceError | null, response: CreateApiKeyResponse) => void, + ): ClientUnaryCall; + listApiKeys( + request: ListApiKeysRequest, + callback: (error: ServiceError | null, response: ListApiKeysResponse) => void, + ): ClientUnaryCall; + listApiKeys( + request: ListApiKeysRequest, + metadata: Metadata, + callback: (error: ServiceError | null, response: ListApiKeysResponse) => void, + ): ClientUnaryCall; + listApiKeys( + request: ListApiKeysRequest, + metadata: Metadata, + options: Partial, + callback: (error: ServiceError | null, response: ListApiKeysResponse) => void, + ): ClientUnaryCall; + revokeApiKey( + request: RevokeApiKeyRequest, + callback: (error: ServiceError | null, response: OperationResponse) => void, + ): ClientUnaryCall; + revokeApiKey( + request: RevokeApiKeyRequest, + metadata: Metadata, + callback: (error: ServiceError | null, response: OperationResponse) => void, + ): ClientUnaryCall; + revokeApiKey( + request: RevokeApiKeyRequest, + metadata: Metadata, + options: Partial, + callback: (error: ServiceError | null, response: OperationResponse) => void, + ): ClientUnaryCall; + verifyApiKey( + request: VerifyApiKeyRequest, + callback: (error: ServiceError | null, response: AuthenticationResponse) => void, + ): ClientUnaryCall; + verifyApiKey( + request: VerifyApiKeyRequest, + metadata: Metadata, + callback: (error: ServiceError | null, response: AuthenticationResponse) => void, + ): ClientUnaryCall; + verifyApiKey( + request: VerifyApiKeyRequest, + metadata: Metadata, + options: Partial, + callback: (error: ServiceError | null, response: AuthenticationResponse) => void, + ): ClientUnaryCall; + /** Password policy (public, no auth required) */ + getPasswordPolicy( + request: GetPasswordPolicyRequest, + callback: (error: ServiceError | null, response: GetPasswordPolicyResponse) => void, + ): ClientUnaryCall; + getPasswordPolicy( + request: GetPasswordPolicyRequest, + metadata: Metadata, + callback: (error: ServiceError | null, response: GetPasswordPolicyResponse) => void, + ): ClientUnaryCall; + getPasswordPolicy( + request: GetPasswordPolicyRequest, + metadata: Metadata, + options: Partial, + callback: (error: ServiceError | null, response: GetPasswordPolicyResponse) => void, + ): ClientUnaryCall; + /** Metrics */ + getMetrics( + request: GetMetricsRequest, + callback: (error: ServiceError | null, response: GetMetricsResponse) => void, + ): ClientUnaryCall; + getMetrics( + request: GetMetricsRequest, + metadata: Metadata, + callback: (error: ServiceError | null, response: GetMetricsResponse) => void, + ): ClientUnaryCall; + getMetrics( + request: GetMetricsRequest, + metadata: Metadata, + options: Partial, + callback: (error: ServiceError | null, response: GetMetricsResponse) => void, + ): ClientUnaryCall; + /** User lookup by identifier (email, phone, or handle) — any authenticated user */ + lookupUser( + request: LookupUserRequest, + callback: (error: ServiceError | null, response: LookupUserResponse) => void, + ): ClientUnaryCall; + lookupUser( + request: LookupUserRequest, + metadata: Metadata, + callback: (error: ServiceError | null, response: LookupUserResponse) => void, + ): ClientUnaryCall; + lookupUser( + request: LookupUserRequest, + metadata: Metadata, + options: Partial, + callback: (error: ServiceError | null, response: LookupUserResponse) => void, + ): ClientUnaryCall; +} + +export const AuthServiceClient = makeGenericClientConstructor( + AuthServiceService, + "st_peter.auth.AuthService", +) as unknown as { + new (address: string, credentials: ChannelCredentials, options?: Partial): AuthServiceClient; + service: typeof AuthServiceService; + serviceName: string; +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +function toTimestamp(date: Date): Timestamp { + const seconds = Math.trunc(date.getTime() / 1_000); + const nanos = (date.getTime() % 1_000) * 1_000_000; + return { seconds, nanos }; +} + +function fromTimestamp(t: Timestamp): Date { + let millis = (t.seconds || 0) * 1_000; + millis += (t.nanos || 0) / 1_000_000; + return new globalThis.Date(millis); +} + +function fromJsonTimestamp(o: any): Date { + if (o instanceof globalThis.Date) { + return o; + } else if (typeof o === "string") { + return new globalThis.Date(o); + } else { + return fromTimestamp(Timestamp.fromJSON(o)); + } +} + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create(base?: DeepPartial): T; + fromPartial(object: DeepPartial): T; +} diff --git a/ts/src/index.ts b/ts/src/index.ts new file mode 100644 index 0000000..687768d --- /dev/null +++ b/ts/src/index.ts @@ -0,0 +1,10 @@ +export { + StPeterAuthClient, + UnauthorizedError, + COOKIE_NAME, + bearer, +} from "./auth"; +export type { LoginOutcome, ConnectOptions } from "./auth"; + +// Raw wire surface for callers that need it. +export * as authpb from "./genpb/st-peter-auth"; diff --git a/ts/tsconfig.json b/ts/tsconfig.json new file mode 100644 index 0000000..5505f49 --- /dev/null +++ b/ts/tsconfig.json @@ -0,0 +1,18 @@ +{ + "compilerOptions": { + "target": "ES2020", + "module": "commonjs", + "moduleResolution": "node", + "lib": ["ES2020"], + "declaration": true, + "outDir": "dist", + "rootDir": "src", + "strict": true, + "esModuleInterop": true, + "skipLibCheck": true, + "forceConsistentCasingInFileNames": true, + "resolveJsonModule": true + }, + "include": ["src/**/*.ts"], + "exclude": ["node_modules", "dist"] +}