@zitadel/node
Version:
Library for API access to ZITADEL. Provides compiled gRPC service clients and helpers for applications and service accounts.
1,383 lines • 80.2 kB
JavaScript
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
// versions:
// protoc-gen-ts_proto v2.7.5
// protoc unknown
// source: zitadel/resources/user/v3alpha/authenticator.proto
/* eslint-disable */
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
import Long from "long";
import { Struct } from "../../../../google/protobuf/struct.js";
import { Timestamp } from "../../../../google/protobuf/timestamp.js";
import { Details } from "../../object/v3alpha/object.js";
export const protobufPackage = "zitadel.resources.user.v3alpha";
export var AuthNKeyType;
(function (AuthNKeyType) {
AuthNKeyType[AuthNKeyType["AUTHN_KEY_TYPE_UNSPECIFIED"] = 0] = "AUTHN_KEY_TYPE_UNSPECIFIED";
AuthNKeyType[AuthNKeyType["AUTHN_KEY_TYPE_JSON"] = 1] = "AUTHN_KEY_TYPE_JSON";
AuthNKeyType[AuthNKeyType["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
})(AuthNKeyType || (AuthNKeyType = {}));
export function authNKeyTypeFromJSON(object) {
switch (object) {
case 0:
case "AUTHN_KEY_TYPE_UNSPECIFIED":
return AuthNKeyType.AUTHN_KEY_TYPE_UNSPECIFIED;
case 1:
case "AUTHN_KEY_TYPE_JSON":
return AuthNKeyType.AUTHN_KEY_TYPE_JSON;
case -1:
case "UNRECOGNIZED":
default:
return AuthNKeyType.UNRECOGNIZED;
}
}
export function authNKeyTypeToJSON(object) {
switch (object) {
case AuthNKeyType.AUTHN_KEY_TYPE_UNSPECIFIED:
return "AUTHN_KEY_TYPE_UNSPECIFIED";
case AuthNKeyType.AUTHN_KEY_TYPE_JSON:
return "AUTHN_KEY_TYPE_JSON";
case AuthNKeyType.UNRECOGNIZED:
default:
return "UNRECOGNIZED";
}
}
export var WebAuthNAuthenticatorType;
(function (WebAuthNAuthenticatorType) {
WebAuthNAuthenticatorType[WebAuthNAuthenticatorType["WEB_AUTH_N_AUTHENTICATOR_UNSPECIFIED"] = 0] = "WEB_AUTH_N_AUTHENTICATOR_UNSPECIFIED";
WebAuthNAuthenticatorType[WebAuthNAuthenticatorType["WEB_AUTH_N_AUTHENTICATOR_PLATFORM"] = 1] = "WEB_AUTH_N_AUTHENTICATOR_PLATFORM";
WebAuthNAuthenticatorType[WebAuthNAuthenticatorType["WEB_AUTH_N_AUTHENTICATOR_CROSS_PLATFORM"] = 2] = "WEB_AUTH_N_AUTHENTICATOR_CROSS_PLATFORM";
WebAuthNAuthenticatorType[WebAuthNAuthenticatorType["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
})(WebAuthNAuthenticatorType || (WebAuthNAuthenticatorType = {}));
export function webAuthNAuthenticatorTypeFromJSON(object) {
switch (object) {
case 0:
case "WEB_AUTH_N_AUTHENTICATOR_UNSPECIFIED":
return WebAuthNAuthenticatorType.WEB_AUTH_N_AUTHENTICATOR_UNSPECIFIED;
case 1:
case "WEB_AUTH_N_AUTHENTICATOR_PLATFORM":
return WebAuthNAuthenticatorType.WEB_AUTH_N_AUTHENTICATOR_PLATFORM;
case 2:
case "WEB_AUTH_N_AUTHENTICATOR_CROSS_PLATFORM":
return WebAuthNAuthenticatorType.WEB_AUTH_N_AUTHENTICATOR_CROSS_PLATFORM;
case -1:
case "UNRECOGNIZED":
default:
return WebAuthNAuthenticatorType.UNRECOGNIZED;
}
}
export function webAuthNAuthenticatorTypeToJSON(object) {
switch (object) {
case WebAuthNAuthenticatorType.WEB_AUTH_N_AUTHENTICATOR_UNSPECIFIED:
return "WEB_AUTH_N_AUTHENTICATOR_UNSPECIFIED";
case WebAuthNAuthenticatorType.WEB_AUTH_N_AUTHENTICATOR_PLATFORM:
return "WEB_AUTH_N_AUTHENTICATOR_PLATFORM";
case WebAuthNAuthenticatorType.WEB_AUTH_N_AUTHENTICATOR_CROSS_PLATFORM:
return "WEB_AUTH_N_AUTHENTICATOR_CROSS_PLATFORM";
case WebAuthNAuthenticatorType.UNRECOGNIZED:
default:
return "UNRECOGNIZED";
}
}
function createBaseAuthenticators() {
return {
usernames: [],
password: undefined,
webAuthN: [],
totps: [],
otpSms: [],
otpEmail: [],
authenticationKeys: [],
identityProviders: [],
};
}
export const Authenticators = {
encode(message, writer = new BinaryWriter()) {
for (const v of message.usernames) {
Username.encode(v, writer.uint32(10).fork()).join();
}
if (message.password !== undefined) {
Password.encode(message.password, writer.uint32(18).fork()).join();
}
for (const v of message.webAuthN) {
WebAuthN.encode(v, writer.uint32(26).fork()).join();
}
for (const v of message.totps) {
TOTP.encode(v, writer.uint32(34).fork()).join();
}
for (const v of message.otpSms) {
OTPSMS.encode(v, writer.uint32(42).fork()).join();
}
for (const v of message.otpEmail) {
OTPEmail.encode(v, writer.uint32(50).fork()).join();
}
for (const v of message.authenticationKeys) {
AuthenticationKey.encode(v, writer.uint32(58).fork()).join();
}
for (const v of message.identityProviders) {
IdentityProvider.encode(v, writer.uint32(66).fork()).join();
}
return writer;
},
decode(input, length) {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
const end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseAuthenticators();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.usernames.push(Username.decode(reader, reader.uint32()));
continue;
}
case 2: {
if (tag !== 18) {
break;
}
message.password = Password.decode(reader, reader.uint32());
continue;
}
case 3: {
if (tag !== 26) {
break;
}
message.webAuthN.push(WebAuthN.decode(reader, reader.uint32()));
continue;
}
case 4: {
if (tag !== 34) {
break;
}
message.totps.push(TOTP.decode(reader, reader.uint32()));
continue;
}
case 5: {
if (tag !== 42) {
break;
}
message.otpSms.push(OTPSMS.decode(reader, reader.uint32()));
continue;
}
case 6: {
if (tag !== 50) {
break;
}
message.otpEmail.push(OTPEmail.decode(reader, reader.uint32()));
continue;
}
case 7: {
if (tag !== 58) {
break;
}
message.authenticationKeys.push(AuthenticationKey.decode(reader, reader.uint32()));
continue;
}
case 8: {
if (tag !== 66) {
break;
}
message.identityProviders.push(IdentityProvider.decode(reader, reader.uint32()));
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object) {
return {
usernames: globalThis.Array.isArray(object?.usernames)
? object.usernames.map((e) => Username.fromJSON(e))
: [],
password: isSet(object.password) ? Password.fromJSON(object.password) : undefined,
webAuthN: globalThis.Array.isArray(object?.webAuthN) ? object.webAuthN.map((e) => WebAuthN.fromJSON(e)) : [],
totps: globalThis.Array.isArray(object?.totps) ? object.totps.map((e) => TOTP.fromJSON(e)) : [],
otpSms: globalThis.Array.isArray(object?.otpSms) ? object.otpSms.map((e) => OTPSMS.fromJSON(e)) : [],
otpEmail: globalThis.Array.isArray(object?.otpEmail) ? object.otpEmail.map((e) => OTPEmail.fromJSON(e)) : [],
authenticationKeys: globalThis.Array.isArray(object?.authenticationKeys)
? object.authenticationKeys.map((e) => AuthenticationKey.fromJSON(e))
: [],
identityProviders: globalThis.Array.isArray(object?.identityProviders)
? object.identityProviders.map((e) => IdentityProvider.fromJSON(e))
: [],
};
},
toJSON(message) {
const obj = {};
if (message.usernames?.length) {
obj.usernames = message.usernames.map((e) => Username.toJSON(e));
}
if (message.password !== undefined) {
obj.password = Password.toJSON(message.password);
}
if (message.webAuthN?.length) {
obj.webAuthN = message.webAuthN.map((e) => WebAuthN.toJSON(e));
}
if (message.totps?.length) {
obj.totps = message.totps.map((e) => TOTP.toJSON(e));
}
if (message.otpSms?.length) {
obj.otpSms = message.otpSms.map((e) => OTPSMS.toJSON(e));
}
if (message.otpEmail?.length) {
obj.otpEmail = message.otpEmail.map((e) => OTPEmail.toJSON(e));
}
if (message.authenticationKeys?.length) {
obj.authenticationKeys = message.authenticationKeys.map((e) => AuthenticationKey.toJSON(e));
}
if (message.identityProviders?.length) {
obj.identityProviders = message.identityProviders.map((e) => IdentityProvider.toJSON(e));
}
return obj;
},
create(base) {
return Authenticators.fromPartial(base ?? {});
},
fromPartial(object) {
const message = createBaseAuthenticators();
message.usernames = object.usernames?.map((e) => Username.fromPartial(e)) || [];
message.password = (object.password !== undefined && object.password !== null)
? Password.fromPartial(object.password)
: undefined;
message.webAuthN = object.webAuthN?.map((e) => WebAuthN.fromPartial(e)) || [];
message.totps = object.totps?.map((e) => TOTP.fromPartial(e)) || [];
message.otpSms = object.otpSms?.map((e) => OTPSMS.fromPartial(e)) || [];
message.otpEmail = object.otpEmail?.map((e) => OTPEmail.fromPartial(e)) || [];
message.authenticationKeys = object.authenticationKeys?.map((e) => AuthenticationKey.fromPartial(e)) || [];
message.identityProviders = object.identityProviders?.map((e) => IdentityProvider.fromPartial(e)) || [];
return message;
},
};
function createBaseUsername() {
return { usernameId: "", username: "", isOrganizationSpecific: false };
}
export const Username = {
encode(message, writer = new BinaryWriter()) {
if (message.usernameId !== "") {
writer.uint32(10).string(message.usernameId);
}
if (message.username !== "") {
writer.uint32(18).string(message.username);
}
if (message.isOrganizationSpecific !== false) {
writer.uint32(24).bool(message.isOrganizationSpecific);
}
return writer;
},
decode(input, length) {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
const end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseUsername();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.usernameId = reader.string();
continue;
}
case 2: {
if (tag !== 18) {
break;
}
message.username = reader.string();
continue;
}
case 3: {
if (tag !== 24) {
break;
}
message.isOrganizationSpecific = reader.bool();
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object) {
return {
usernameId: isSet(object.usernameId) ? globalThis.String(object.usernameId) : "",
username: isSet(object.username) ? globalThis.String(object.username) : "",
isOrganizationSpecific: isSet(object.isOrganizationSpecific)
? globalThis.Boolean(object.isOrganizationSpecific)
: false,
};
},
toJSON(message) {
const obj = {};
if (message.usernameId !== "") {
obj.usernameId = message.usernameId;
}
if (message.username !== "") {
obj.username = message.username;
}
if (message.isOrganizationSpecific !== false) {
obj.isOrganizationSpecific = message.isOrganizationSpecific;
}
return obj;
},
create(base) {
return Username.fromPartial(base ?? {});
},
fromPartial(object) {
const message = createBaseUsername();
message.usernameId = object.usernameId ?? "";
message.username = object.username ?? "";
message.isOrganizationSpecific = object.isOrganizationSpecific ?? false;
return message;
},
};
function createBaseSetUsername() {
return { username: "", isOrganizationSpecific: false };
}
export const SetUsername = {
encode(message, writer = new BinaryWriter()) {
if (message.username !== "") {
writer.uint32(10).string(message.username);
}
if (message.isOrganizationSpecific !== false) {
writer.uint32(16).bool(message.isOrganizationSpecific);
}
return writer;
},
decode(input, length) {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
const end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseSetUsername();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.username = reader.string();
continue;
}
case 2: {
if (tag !== 16) {
break;
}
message.isOrganizationSpecific = reader.bool();
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object) {
return {
username: isSet(object.username) ? globalThis.String(object.username) : "",
isOrganizationSpecific: isSet(object.isOrganizationSpecific)
? globalThis.Boolean(object.isOrganizationSpecific)
: false,
};
},
toJSON(message) {
const obj = {};
if (message.username !== "") {
obj.username = message.username;
}
if (message.isOrganizationSpecific !== false) {
obj.isOrganizationSpecific = message.isOrganizationSpecific;
}
return obj;
},
create(base) {
return SetUsername.fromPartial(base ?? {});
},
fromPartial(object) {
const message = createBaseSetUsername();
message.username = object.username ?? "";
message.isOrganizationSpecific = object.isOrganizationSpecific ?? false;
return message;
},
};
function createBasePassword() {
return { lastChanged: undefined };
}
export const Password = {
encode(message, writer = new BinaryWriter()) {
if (message.lastChanged !== undefined) {
Timestamp.encode(toTimestamp(message.lastChanged), writer.uint32(10).fork()).join();
}
return writer;
},
decode(input, length) {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
const end = length === undefined ? reader.len : reader.pos + length;
const message = createBasePassword();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.lastChanged = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object) {
return { lastChanged: isSet(object.lastChanged) ? fromJsonTimestamp(object.lastChanged) : undefined };
},
toJSON(message) {
const obj = {};
if (message.lastChanged !== undefined) {
obj.lastChanged = message.lastChanged.toISOString();
}
return obj;
},
create(base) {
return Password.fromPartial(base ?? {});
},
fromPartial(object) {
const message = createBasePassword();
message.lastChanged = object.lastChanged ?? undefined;
return message;
},
};
function createBaseWebAuthN() {
return { webAuthNId: "", name: "", isVerified: false, userVerified: false };
}
export const WebAuthN = {
encode(message, writer = new BinaryWriter()) {
if (message.webAuthNId !== "") {
writer.uint32(10).string(message.webAuthNId);
}
if (message.name !== "") {
writer.uint32(18).string(message.name);
}
if (message.isVerified !== false) {
writer.uint32(24).bool(message.isVerified);
}
if (message.userVerified !== false) {
writer.uint32(32).bool(message.userVerified);
}
return writer;
},
decode(input, length) {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
const end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseWebAuthN();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.webAuthNId = reader.string();
continue;
}
case 2: {
if (tag !== 18) {
break;
}
message.name = reader.string();
continue;
}
case 3: {
if (tag !== 24) {
break;
}
message.isVerified = reader.bool();
continue;
}
case 4: {
if (tag !== 32) {
break;
}
message.userVerified = reader.bool();
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object) {
return {
webAuthNId: isSet(object.webAuthNId) ? globalThis.String(object.webAuthNId) : "",
name: isSet(object.name) ? globalThis.String(object.name) : "",
isVerified: isSet(object.isVerified) ? globalThis.Boolean(object.isVerified) : false,
userVerified: isSet(object.userVerified) ? globalThis.Boolean(object.userVerified) : false,
};
},
toJSON(message) {
const obj = {};
if (message.webAuthNId !== "") {
obj.webAuthNId = message.webAuthNId;
}
if (message.name !== "") {
obj.name = message.name;
}
if (message.isVerified !== false) {
obj.isVerified = message.isVerified;
}
if (message.userVerified !== false) {
obj.userVerified = message.userVerified;
}
return obj;
},
create(base) {
return WebAuthN.fromPartial(base ?? {});
},
fromPartial(object) {
const message = createBaseWebAuthN();
message.webAuthNId = object.webAuthNId ?? "";
message.name = object.name ?? "";
message.isVerified = object.isVerified ?? false;
message.userVerified = object.userVerified ?? false;
return message;
},
};
function createBaseStartWebAuthNRegistration() {
return { domain: "", authenticatorType: 0, code: undefined };
}
export const StartWebAuthNRegistration = {
encode(message, writer = new BinaryWriter()) {
if (message.domain !== "") {
writer.uint32(10).string(message.domain);
}
if (message.authenticatorType !== 0) {
writer.uint32(16).int32(message.authenticatorType);
}
if (message.code !== undefined) {
AuthenticatorRegistrationCode.encode(message.code, writer.uint32(26).fork()).join();
}
return writer;
},
decode(input, length) {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
const end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseStartWebAuthNRegistration();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.domain = reader.string();
continue;
}
case 2: {
if (tag !== 16) {
break;
}
message.authenticatorType = reader.int32();
continue;
}
case 3: {
if (tag !== 26) {
break;
}
message.code = AuthenticatorRegistrationCode.decode(reader, reader.uint32());
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object) {
return {
domain: isSet(object.domain) ? globalThis.String(object.domain) : "",
authenticatorType: isSet(object.authenticatorType)
? webAuthNAuthenticatorTypeFromJSON(object.authenticatorType)
: 0,
code: isSet(object.code) ? AuthenticatorRegistrationCode.fromJSON(object.code) : undefined,
};
},
toJSON(message) {
const obj = {};
if (message.domain !== "") {
obj.domain = message.domain;
}
if (message.authenticatorType !== 0) {
obj.authenticatorType = webAuthNAuthenticatorTypeToJSON(message.authenticatorType);
}
if (message.code !== undefined) {
obj.code = AuthenticatorRegistrationCode.toJSON(message.code);
}
return obj;
},
create(base) {
return StartWebAuthNRegistration.fromPartial(base ?? {});
},
fromPartial(object) {
const message = createBaseStartWebAuthNRegistration();
message.domain = object.domain ?? "";
message.authenticatorType = object.authenticatorType ?? 0;
message.code = (object.code !== undefined && object.code !== null)
? AuthenticatorRegistrationCode.fromPartial(object.code)
: undefined;
return message;
},
};
function createBaseVerifyWebAuthNRegistration() {
return { publicKeyCredential: undefined, webAuthNName: "" };
}
export const VerifyWebAuthNRegistration = {
encode(message, writer = new BinaryWriter()) {
if (message.publicKeyCredential !== undefined) {
Struct.encode(Struct.wrap(message.publicKeyCredential), writer.uint32(10).fork()).join();
}
if (message.webAuthNName !== "") {
writer.uint32(18).string(message.webAuthNName);
}
return writer;
},
decode(input, length) {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
const end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseVerifyWebAuthNRegistration();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.publicKeyCredential = Struct.unwrap(Struct.decode(reader, reader.uint32()));
continue;
}
case 2: {
if (tag !== 18) {
break;
}
message.webAuthNName = reader.string();
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object) {
return {
publicKeyCredential: isObject(object.publicKeyCredential) ? object.publicKeyCredential : undefined,
webAuthNName: isSet(object.webAuthNName) ? globalThis.String(object.webAuthNName) : "",
};
},
toJSON(message) {
const obj = {};
if (message.publicKeyCredential !== undefined) {
obj.publicKeyCredential = message.publicKeyCredential;
}
if (message.webAuthNName !== "") {
obj.webAuthNName = message.webAuthNName;
}
return obj;
},
create(base) {
return VerifyWebAuthNRegistration.fromPartial(base ?? {});
},
fromPartial(object) {
const message = createBaseVerifyWebAuthNRegistration();
message.publicKeyCredential = object.publicKeyCredential ?? undefined;
message.webAuthNName = object.webAuthNName ?? "";
return message;
},
};
function createBaseOTPSMS() {
return { otpSmsId: "", phone: "", isVerified: false };
}
export const OTPSMS = {
encode(message, writer = new BinaryWriter()) {
if (message.otpSmsId !== "") {
writer.uint32(10).string(message.otpSmsId);
}
if (message.phone !== "") {
writer.uint32(18).string(message.phone);
}
if (message.isVerified !== false) {
writer.uint32(24).bool(message.isVerified);
}
return writer;
},
decode(input, length) {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
const end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseOTPSMS();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.otpSmsId = reader.string();
continue;
}
case 2: {
if (tag !== 18) {
break;
}
message.phone = reader.string();
continue;
}
case 3: {
if (tag !== 24) {
break;
}
message.isVerified = reader.bool();
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object) {
return {
otpSmsId: isSet(object.otpSmsId) ? globalThis.String(object.otpSmsId) : "",
phone: isSet(object.phone) ? globalThis.String(object.phone) : "",
isVerified: isSet(object.isVerified) ? globalThis.Boolean(object.isVerified) : false,
};
},
toJSON(message) {
const obj = {};
if (message.otpSmsId !== "") {
obj.otpSmsId = message.otpSmsId;
}
if (message.phone !== "") {
obj.phone = message.phone;
}
if (message.isVerified !== false) {
obj.isVerified = message.isVerified;
}
return obj;
},
create(base) {
return OTPSMS.fromPartial(base ?? {});
},
fromPartial(object) {
const message = createBaseOTPSMS();
message.otpSmsId = object.otpSmsId ?? "";
message.phone = object.phone ?? "";
message.isVerified = object.isVerified ?? false;
return message;
},
};
function createBaseOTPEmail() {
return { otpEmailId: "", address: "", isVerified: false };
}
export const OTPEmail = {
encode(message, writer = new BinaryWriter()) {
if (message.otpEmailId !== "") {
writer.uint32(10).string(message.otpEmailId);
}
if (message.address !== "") {
writer.uint32(18).string(message.address);
}
if (message.isVerified !== false) {
writer.uint32(24).bool(message.isVerified);
}
return writer;
},
decode(input, length) {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
const end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseOTPEmail();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.otpEmailId = reader.string();
continue;
}
case 2: {
if (tag !== 18) {
break;
}
message.address = reader.string();
continue;
}
case 3: {
if (tag !== 24) {
break;
}
message.isVerified = reader.bool();
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object) {
return {
otpEmailId: isSet(object.otpEmailId) ? globalThis.String(object.otpEmailId) : "",
address: isSet(object.address) ? globalThis.String(object.address) : "",
isVerified: isSet(object.isVerified) ? globalThis.Boolean(object.isVerified) : false,
};
},
toJSON(message) {
const obj = {};
if (message.otpEmailId !== "") {
obj.otpEmailId = message.otpEmailId;
}
if (message.address !== "") {
obj.address = message.address;
}
if (message.isVerified !== false) {
obj.isVerified = message.isVerified;
}
return obj;
},
create(base) {
return OTPEmail.fromPartial(base ?? {});
},
fromPartial(object) {
const message = createBaseOTPEmail();
message.otpEmailId = object.otpEmailId ?? "";
message.address = object.address ?? "";
message.isVerified = object.isVerified ?? false;
return message;
},
};
function createBaseTOTP() {
return { totpId: "", name: "", isVerified: false };
}
export const TOTP = {
encode(message, writer = new BinaryWriter()) {
if (message.totpId !== "") {
writer.uint32(10).string(message.totpId);
}
if (message.name !== "") {
writer.uint32(18).string(message.name);
}
if (message.isVerified !== false) {
writer.uint32(24).bool(message.isVerified);
}
return writer;
},
decode(input, length) {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
const end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseTOTP();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.totpId = reader.string();
continue;
}
case 2: {
if (tag !== 18) {
break;
}
message.name = reader.string();
continue;
}
case 3: {
if (tag !== 24) {
break;
}
message.isVerified = reader.bool();
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object) {
return {
totpId: isSet(object.totpId) ? globalThis.String(object.totpId) : "",
name: isSet(object.name) ? globalThis.String(object.name) : "",
isVerified: isSet(object.isVerified) ? globalThis.Boolean(object.isVerified) : false,
};
},
toJSON(message) {
const obj = {};
if (message.totpId !== "") {
obj.totpId = message.totpId;
}
if (message.name !== "") {
obj.name = message.name;
}
if (message.isVerified !== false) {
obj.isVerified = message.isVerified;
}
return obj;
},
create(base) {
return TOTP.fromPartial(base ?? {});
},
fromPartial(object) {
const message = createBaseTOTP();
message.totpId = object.totpId ?? "";
message.name = object.name ?? "";
message.isVerified = object.isVerified ?? false;
return message;
},
};
function createBaseAuthenticationKey() {
return { authenticationKeyId: "", details: undefined, type: 0, expirationDate: undefined };
}
export const AuthenticationKey = {
encode(message, writer = new BinaryWriter()) {
if (message.authenticationKeyId !== "") {
writer.uint32(10).string(message.authenticationKeyId);
}
if (message.details !== undefined) {
Details.encode(message.details, writer.uint32(18).fork()).join();
}
if (message.type !== 0) {
writer.uint32(24).int32(message.type);
}
if (message.expirationDate !== undefined) {
Timestamp.encode(toTimestamp(message.expirationDate), writer.uint32(34).fork()).join();
}
return writer;
},
decode(input, length) {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
const end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseAuthenticationKey();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.authenticationKeyId = reader.string();
continue;
}
case 2: {
if (tag !== 18) {
break;
}
message.details = Details.decode(reader, reader.uint32());
continue;
}
case 3: {
if (tag !== 24) {
break;
}
message.type = reader.int32();
continue;
}
case 4: {
if (tag !== 34) {
break;
}
message.expirationDate = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object) {
return {
authenticationKeyId: isSet(object.authenticationKeyId) ? globalThis.String(object.authenticationKeyId) : "",
details: isSet(object.details) ? Details.fromJSON(object.details) : undefined,
type: isSet(object.type) ? authNKeyTypeFromJSON(object.type) : 0,
expirationDate: isSet(object.expirationDate) ? fromJsonTimestamp(object.expirationDate) : undefined,
};
},
toJSON(message) {
const obj = {};
if (message.authenticationKeyId !== "") {
obj.authenticationKeyId = message.authenticationKeyId;
}
if (message.details !== undefined) {
obj.details = Details.toJSON(message.details);
}
if (message.type !== 0) {
obj.type = authNKeyTypeToJSON(message.type);
}
if (message.expirationDate !== undefined) {
obj.expirationDate = message.expirationDate.toISOString();
}
return obj;
},
create(base) {
return AuthenticationKey.fromPartial(base ?? {});
},
fromPartial(object) {
const message = createBaseAuthenticationKey();
message.authenticationKeyId = object.authenticationKeyId ?? "";
message.details = (object.details !== undefined && object.details !== null)
? Details.fromPartial(object.details)
: undefined;
message.type = object.type ?? 0;
message.expirationDate = object.expirationDate ?? undefined;
return message;
},
};
function createBaseIdentityProvider() {
return { idpId: "", idpName: "", userId: "", username: "" };
}
export const IdentityProvider = {
encode(message, writer = new BinaryWriter()) {
if (message.idpId !== "") {
writer.uint32(10).string(message.idpId);
}
if (message.idpName !== "") {
writer.uint32(26).string(message.idpName);
}
if (message.userId !== "") {
writer.uint32(34).string(message.userId);
}
if (message.username !== "") {
writer.uint32(42).string(message.username);
}
return writer;
},
decode(input, length) {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
const end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseIdentityProvider();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.idpId = reader.string();
continue;
}
case 3: {
if (tag !== 26) {
break;
}
message.idpName = reader.string();
continue;
}
case 4: {
if (tag !== 34) {
break;
}
message.userId = reader.string();
continue;
}
case 5: {
if (tag !== 42) {
break;
}
message.username = reader.string();
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object) {
return {
idpId: isSet(object.idpId) ? globalThis.String(object.idpId) : "",
idpName: isSet(object.idpName) ? globalThis.String(object.idpName) : "",
userId: isSet(object.userId) ? globalThis.String(object.userId) : "",
username: isSet(object.username) ? globalThis.String(object.username) : "",
};
},
toJSON(message) {
const obj = {};
if (message.idpId !== "") {
obj.idpId = message.idpId;
}
if (message.idpName !== "") {
obj.idpName = message.idpName;
}
if (message.userId !== "") {
obj.userId = message.userId;
}
if (message.username !== "") {
obj.username = message.username;
}
return obj;
},
create(base) {
return IdentityProvider.fromPartial(base ?? {});
},
fromPartial(object) {
const message = createBaseIdentityProvider();
message.idpId = object.idpId ?? "";
message.idpName = object.idpName ?? "";
message.userId = object.userId ?? "";
message.username = object.username ?? "";
return message;
},
};
function createBaseSetAuthenticators() {
return { usernames: [], password: undefined };
}
export const SetAuthenticators = {
encode(message, writer = new BinaryWriter()) {
for (const v of message.usernames) {
SetUsername.encode(v, writer.uint32(10).fork()).join();
}
if (message.password !== undefined) {
SetPassword.encode(message.password, writer.uint32(18).fork()).join();
}
return writer;
},
decode(input, length) {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
const end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseSetAuthenticators();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.usernames.push(SetUsername.decode(reader, reader.uint32()));
continue;
}
case 2: {
if (tag !== 18) {
break;
}
message.password = SetPassword.decode(reader, reader.uint32());
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object) {
return {
usernames: globalThis.Array.isArray(object?.usernames)
? object.usernames.map((e) => SetUsername.fromJSON(e))
: [],
password: isSet(object.password) ? SetPassword.fromJSON(object.password) : undefined,
};
},
toJSON(message) {
const obj = {};
if (message.usernames?.length) {
obj.usernames = message.usernames.map((e) => SetUsername.toJSON(e));
}
if (message.password !== undefined) {
obj.password = SetPassword.toJSON(message.password);
}
return obj;
},
create(base) {
return SetAuthenticators.fromPartial(base ?? {});
},
fromPartial(object) {
const message = createBaseSetAuthenticators();
message.usernames = object.usernames?.map((e) => SetUsername.fromPartial(e)) || [];
message.password = (object.password !== undefined && object.password !== null)
? SetPassword.fromPartial(object.password)
: undefined;
return message;
},
};
function createBaseSetPassword() {
return {
password: undefined,
hash: undefined,
changeRequired: false,
currentPassword: undefined,
verificationCode: undefined,
};
}
export const SetPassword = {
encode(message, writer = new BinaryWriter()) {
if (message.password !== undefined) {
writer.uint32(10).string(message.password);
}
if (message.hash !== undefined) {
writer.uint32(18).string(message.hash);
}
if (message.changeRequired !== false) {
writer.uint32(24).bool(message.changeRequired);
}
if (message.currentPassword !== undefined) {
writer.uint32(34).string(message.currentPassword);
}
if (message.verificationCode !== undefined) {
writer.uint32(42).string(message.verificationCode);
}
return writer;
},
decode(input, length) {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
const end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseSetPassword();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.password = reader.string();
continue;
}
case 2: {
if (tag !== 18) {
break;
}
message.hash = reader.string();
continue;
}
case 3: {
if (tag !== 24) {
break;
}
message.changeRequired = reader.bool();
continue;
}
case 4: {
if (tag !== 34) {
break;
}
message.currentPassword = reader.string();
continue;
}
case 5: {
if (tag !== 42) {
break;
}
message.verificationCode = reader.string();
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object) {
return {
password: isSet(object.password) ? globalThis.String(object.password) : undefined,
hash: isSet(object.hash) ? globalThis.String(object.hash) : undefined,
changeRequired: isSet(object.changeRequired) ? globalThis.Boolean(object.changeRequired) : false,
currentPassword: isSet(object.currentPassword) ? globalThis.String(object.currentPassword) : undefined,
verificationCode: isSet(object.verificationCode) ? globalThis.String(object.verificationCode) : undefined,
};
},
toJSON(message) {
const obj = {};
if (message.password !== undefined) {
obj.password = message.password;
}
if (message.hash !== undefined) {
obj.hash = message.hash;
}
if (message.changeRequired !== false) {
obj.changeRequired = message.changeRequired;
}
if (message.currentPassword !== undefined) {
obj.currentPassword = message.currentPassword;
}
if (message.verificationCode !== undefined) {
obj.verificationCode = message.verificationCode;
}
return obj;
},
create(base) {
return SetPassword.fromPartial(base ?? {});
},
fromPartial(object) {
const message = createBaseSetPassword();
message.password = object.password ?? undefined;
message.hash = object.hash ?? undefined;
message.changeRequired = object.changeRequired ?? false;
message.currentPassword = object.currentPassword ?? undefined;
message.verificationCode = object.verificationCode ?? undefined;
return message;
},
};
function createBaseSendPasswordResetEmail() {
return { urlTemplate: undefined };
}
export const SendPasswordResetEmail = {
encode(message, writer = new BinaryWriter()) {
if (message.urlTemplate !== undefined) {
writer.uint32(18).string(message.urlTemplate);
}
return writer;
},
decode(input, length) {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
const end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseSendPasswordResetEmail();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 2: {
if (tag !== 18) {
break;
}
message.urlTemplate = reader.string();
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;