UNPKG

@ragnaraven/zitadel-node-dual

Version:

Library for API access to ZITADEL with modern ES import syntax. Works everywhere - NestJS, Node.js, any TypeScript environment. No more require()!

1,586 lines 72.8 kB
"use strict"; var __create = Object.create; var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __getProtoOf = Object.getPrototypeOf; var __hasOwnProp = Object.prototype.hasOwnProperty; var __export = (target, all) => { for (var name in all) __defProp(target, name, { get: all[name], enumerable: true }); }; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); } return to; }; var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( // If the importer is in node compatibility mode or this is not an ESM // file that has been converted to a CommonJS file using a Babel- // compatible transform (i.e. "__esModule" has not been set), then set // "default" to the CommonJS "module.exports" for node compatibility. isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod )); var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); var authenticator_exports = {}; __export(authenticator_exports, { AuthNKeyType: () => AuthNKeyType, AuthenticationKey: () => AuthenticationKey, AuthenticatorRegistrationCode: () => AuthenticatorRegistrationCode, Authenticators: () => Authenticators, IDPAuthenticator: () => IDPAuthenticator, IDPInformation: () => IDPInformation, IDPLDAPAccessInformation: () => IDPLDAPAccessInformation, IDPOAuthAccessInformation: () => IDPOAuthAccessInformation, IDPSAMLAccessInformation: () => IDPSAMLAccessInformation, IdentityProvider: () => IdentityProvider, IdentityProviderIntent: () => IdentityProviderIntent, LDAPCredentials: () => LDAPCredentials, OTPEmail: () => OTPEmail, OTPSMS: () => OTPSMS, Password: () => Password, RedirectURLs: () => RedirectURLs, ReturnPasswordResetCode: () => ReturnPasswordResetCode, ReturnWebAuthNRegistrationCode: () => ReturnWebAuthNRegistrationCode, SendPasswordResetEmail: () => SendPasswordResetEmail, SendPasswordResetSMS: () => SendPasswordResetSMS, SendWebAuthNRegistrationLink: () => SendWebAuthNRegistrationLink, SetAuthenticators: () => SetAuthenticators, SetPassword: () => SetPassword, SetUsername: () => SetUsername, StartWebAuthNRegistration: () => StartWebAuthNRegistration, TOTP: () => TOTP, Username: () => Username, VerifyWebAuthNRegistration: () => VerifyWebAuthNRegistration, WebAuthN: () => WebAuthN, WebAuthNAuthenticatorType: () => WebAuthNAuthenticatorType, authNKeyTypeFromJSON: () => authNKeyTypeFromJSON, authNKeyTypeToJSON: () => authNKeyTypeToJSON, protobufPackage: () => protobufPackage, webAuthNAuthenticatorTypeFromJSON: () => webAuthNAuthenticatorTypeFromJSON, webAuthNAuthenticatorTypeToJSON: () => webAuthNAuthenticatorTypeToJSON }); module.exports = __toCommonJS(authenticator_exports); var import_wire = require("@bufbuild/protobuf/wire"); var import_long = __toESM(require("long")); var import_struct = require("../../../../google/protobuf/struct.js"); var import_timestamp = require("../../../../google/protobuf/timestamp.js"); var import_object = require("../../object/v3alpha/object.js"); const protobufPackage = "zitadel.resources.user.v3alpha"; var AuthNKeyType = /* @__PURE__ */ ((AuthNKeyType2) => { AuthNKeyType2[AuthNKeyType2["AUTHN_KEY_TYPE_UNSPECIFIED"] = 0] = "AUTHN_KEY_TYPE_UNSPECIFIED"; AuthNKeyType2[AuthNKeyType2["AUTHN_KEY_TYPE_JSON"] = 1] = "AUTHN_KEY_TYPE_JSON"; AuthNKeyType2[AuthNKeyType2["UNRECOGNIZED"] = -1] = "UNRECOGNIZED"; return AuthNKeyType2; })(AuthNKeyType || {}); function authNKeyTypeFromJSON(object) { switch (object) { case 0: case "AUTHN_KEY_TYPE_UNSPECIFIED": return 0 /* AUTHN_KEY_TYPE_UNSPECIFIED */; case 1: case "AUTHN_KEY_TYPE_JSON": return 1 /* AUTHN_KEY_TYPE_JSON */; case -1: case "UNRECOGNIZED": default: return -1 /* UNRECOGNIZED */; } } function authNKeyTypeToJSON(object) { switch (object) { case 0 /* AUTHN_KEY_TYPE_UNSPECIFIED */: return "AUTHN_KEY_TYPE_UNSPECIFIED"; case 1 /* AUTHN_KEY_TYPE_JSON */: return "AUTHN_KEY_TYPE_JSON"; case -1 /* UNRECOGNIZED */: default: return "UNRECOGNIZED"; } } var WebAuthNAuthenticatorType = /* @__PURE__ */ ((WebAuthNAuthenticatorType2) => { WebAuthNAuthenticatorType2[WebAuthNAuthenticatorType2["WEB_AUTH_N_AUTHENTICATOR_UNSPECIFIED"] = 0] = "WEB_AUTH_N_AUTHENTICATOR_UNSPECIFIED"; WebAuthNAuthenticatorType2[WebAuthNAuthenticatorType2["WEB_AUTH_N_AUTHENTICATOR_PLATFORM"] = 1] = "WEB_AUTH_N_AUTHENTICATOR_PLATFORM"; WebAuthNAuthenticatorType2[WebAuthNAuthenticatorType2["WEB_AUTH_N_AUTHENTICATOR_CROSS_PLATFORM"] = 2] = "WEB_AUTH_N_AUTHENTICATOR_CROSS_PLATFORM"; WebAuthNAuthenticatorType2[WebAuthNAuthenticatorType2["UNRECOGNIZED"] = -1] = "UNRECOGNIZED"; return WebAuthNAuthenticatorType2; })(WebAuthNAuthenticatorType || {}); function webAuthNAuthenticatorTypeFromJSON(object) { switch (object) { case 0: case "WEB_AUTH_N_AUTHENTICATOR_UNSPECIFIED": return 0 /* WEB_AUTH_N_AUTHENTICATOR_UNSPECIFIED */; case 1: case "WEB_AUTH_N_AUTHENTICATOR_PLATFORM": return 1 /* WEB_AUTH_N_AUTHENTICATOR_PLATFORM */; case 2: case "WEB_AUTH_N_AUTHENTICATOR_CROSS_PLATFORM": return 2 /* WEB_AUTH_N_AUTHENTICATOR_CROSS_PLATFORM */; case -1: case "UNRECOGNIZED": default: return -1 /* UNRECOGNIZED */; } } function webAuthNAuthenticatorTypeToJSON(object) { switch (object) { case 0 /* WEB_AUTH_N_AUTHENTICATOR_UNSPECIFIED */: return "WEB_AUTH_N_AUTHENTICATOR_UNSPECIFIED"; case 1 /* WEB_AUTH_N_AUTHENTICATOR_PLATFORM */: return "WEB_AUTH_N_AUTHENTICATOR_PLATFORM"; case 2 /* WEB_AUTH_N_AUTHENTICATOR_CROSS_PLATFORM */: return "WEB_AUTH_N_AUTHENTICATOR_CROSS_PLATFORM"; case -1 /* UNRECOGNIZED */: default: return "UNRECOGNIZED"; } } function createBaseAuthenticators() { return { usernames: [], password: void 0, webAuthN: [], totps: [], otpSms: [], otpEmail: [], authenticationKeys: [], identityProviders: [] }; } const Authenticators = { encode(message, writer = new import_wire.BinaryWriter()) { for (const v of message.usernames) { Username.encode(v, writer.uint32(10).fork()).join(); } if (message.password !== void 0) { 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 import_wire.BinaryReader ? input : new import_wire.BinaryReader(input); const end = length === void 0 ? 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) : void 0, 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 !== void 0) { 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 !== void 0 && object.password !== null ? Password.fromPartial(object.password) : void 0; 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 }; } const Username = { encode(message, writer = new import_wire.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 import_wire.BinaryReader ? input : new import_wire.BinaryReader(input); const end = length === void 0 ? 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 }; } const SetUsername = { encode(message, writer = new import_wire.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 import_wire.BinaryReader ? input : new import_wire.BinaryReader(input); const end = length === void 0 ? 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: void 0 }; } const Password = { encode(message, writer = new import_wire.BinaryWriter()) { if (message.lastChanged !== void 0) { import_timestamp.Timestamp.encode(toTimestamp(message.lastChanged), writer.uint32(10).fork()).join(); } return writer; }, decode(input, length) { const reader = input instanceof import_wire.BinaryReader ? input : new import_wire.BinaryReader(input); const end = length === void 0 ? 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(import_timestamp.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) : void 0 }; }, toJSON(message) { const obj = {}; if (message.lastChanged !== void 0) { obj.lastChanged = message.lastChanged.toISOString(); } return obj; }, create(base) { return Password.fromPartial(base ?? {}); }, fromPartial(object) { const message = createBasePassword(); message.lastChanged = object.lastChanged ?? void 0; return message; } }; function createBaseWebAuthN() { return { webAuthNId: "", name: "", isVerified: false, userVerified: false }; } const WebAuthN = { encode(message, writer = new import_wire.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 import_wire.BinaryReader ? input : new import_wire.BinaryReader(input); const end = length === void 0 ? 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: void 0 }; } const StartWebAuthNRegistration = { encode(message, writer = new import_wire.BinaryWriter()) { if (message.domain !== "") { writer.uint32(10).string(message.domain); } if (message.authenticatorType !== 0) { writer.uint32(16).int32(message.authenticatorType); } if (message.code !== void 0) { AuthenticatorRegistrationCode.encode(message.code, writer.uint32(26).fork()).join(); } return writer; }, decode(input, length) { const reader = input instanceof import_wire.BinaryReader ? input : new import_wire.BinaryReader(input); const end = length === void 0 ? 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) : void 0 }; }, toJSON(message) { const obj = {}; if (message.domain !== "") { obj.domain = message.domain; } if (message.authenticatorType !== 0) { obj.authenticatorType = webAuthNAuthenticatorTypeToJSON(message.authenticatorType); } if (message.code !== void 0) { 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 !== void 0 && object.code !== null ? AuthenticatorRegistrationCode.fromPartial(object.code) : void 0; return message; } }; function createBaseVerifyWebAuthNRegistration() { return { publicKeyCredential: void 0, webAuthNName: "" }; } const VerifyWebAuthNRegistration = { encode(message, writer = new import_wire.BinaryWriter()) { if (message.publicKeyCredential !== void 0) { import_struct.Struct.encode(import_struct.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 import_wire.BinaryReader ? input : new import_wire.BinaryReader(input); const end = length === void 0 ? 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 = import_struct.Struct.unwrap(import_struct.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 : void 0, webAuthNName: isSet(object.webAuthNName) ? globalThis.String(object.webAuthNName) : "" }; }, toJSON(message) { const obj = {}; if (message.publicKeyCredential !== void 0) { 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 ?? void 0; message.webAuthNName = object.webAuthNName ?? ""; return message; } }; function createBaseOTPSMS() { return { otpSmsId: "", phone: "", isVerified: false }; } const OTPSMS = { encode(message, writer = new import_wire.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 import_wire.BinaryReader ? input : new import_wire.BinaryReader(input); const end = length === void 0 ? 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 }; } const OTPEmail = { encode(message, writer = new import_wire.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 import_wire.BinaryReader ? input : new import_wire.BinaryReader(input); const end = length === void 0 ? 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 }; } const TOTP = { encode(message, writer = new import_wire.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 import_wire.BinaryReader ? input : new import_wire.BinaryReader(input); const end = length === void 0 ? 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: void 0, type: 0, expirationDate: void 0 }; } const AuthenticationKey = { encode(message, writer = new import_wire.BinaryWriter()) { if (message.authenticationKeyId !== "") { writer.uint32(10).string(message.authenticationKeyId); } if (message.details !== void 0) { import_object.Details.encode(message.details, writer.uint32(18).fork()).join(); } if (message.type !== 0) { writer.uint32(24).int32(message.type); } if (message.expirationDate !== void 0) { import_timestamp.Timestamp.encode(toTimestamp(message.expirationDate), writer.uint32(34).fork()).join(); } return writer; }, decode(input, length) { const reader = input instanceof import_wire.BinaryReader ? input : new import_wire.BinaryReader(input); const end = length === void 0 ? 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 = import_object.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(import_timestamp.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) ? import_object.Details.fromJSON(object.details) : void 0, type: isSet(object.type) ? authNKeyTypeFromJSON(object.type) : 0, expirationDate: isSet(object.expirationDate) ? fromJsonTimestamp(object.expirationDate) : void 0 }; }, toJSON(message) { const obj = {}; if (message.authenticationKeyId !== "") { obj.authenticationKeyId = message.authenticationKeyId; } if (message.details !== void 0) { obj.details = import_object.Details.toJSON(message.details); } if (message.type !== 0) { obj.type = authNKeyTypeToJSON(message.type); } if (message.expirationDate !== void 0) { 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 !== void 0 && object.details !== null ? import_object.Details.fromPartial(object.details) : void 0; message.type = object.type ?? 0; message.expirationDate = object.expirationDate ?? void 0; return message; } }; function createBaseIdentityProvider() { return { idpId: "", idpName: "", userId: "", username: "" }; } const IdentityProvider = { encode(message, writer = new import_wire.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 import_wire.BinaryReader ? input : new import_wire.BinaryReader(input); const end = length === void 0 ? 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: void 0 }; } const SetAuthenticators = { encode(message, writer = new import_wire.BinaryWriter()) { for (const v of message.usernames) { SetUsername.encode(v, writer.uint32(10).fork()).join(); } if (message.password !== void 0) { SetPassword.encode(message.password, writer.uint32(18).fork()).join(); } return writer; }, decode(input, length) { const reader = input instanceof import_wire.BinaryReader ? input : new import_wire.BinaryReader(input); const end = length === void 0 ? 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) : void 0 }; }, toJSON(message) { const obj = {}; if (message.usernames?.length) { obj.usernames = message.usernames.map((e) => SetUsername.toJSON(e)); } if (message.password !== void 0) { 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 !== void 0 && object.password !== null ? SetPassword.fromPartial(object.password) : void 0; return message; } }; function createBaseSetPassword() { return { password: void 0, hash: void 0, changeRequired: false, currentPassword: void 0, verificationCode: void 0 }; } const SetPassword = { encode(message, writer = new import_wire.BinaryWriter()) { if (message.password !== void 0) { writer.uint32(10).string(message.password); } if (message.hash !== void 0) { writer.uint32(18).string(message.hash); } if (message.changeRequired !== false) { writer.uint32(24).bool(message.changeRequired); } if (message.currentPassword !== void 0) { writer.uint32(34).string(message.currentPassword); } if (message.verificationCode !== void 0) { writer.uint32(42).string(message.verificationCode); } return writer; }, decode(input, length) { const reader = input instanceof import_wire.BinaryReader ? input : new import_wire.BinaryReader(input); const end = length === void 0 ? 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) : void 0, hash: isSet(object.hash) ? globalThis.String(object.hash) : void 0, changeRequired: isSet(object.changeRequired) ? globalThis.Boolean(object.changeRequired) : false, currentPassword: isSet(object.currentPassword) ? globalThis.String(object.currentPassword) : void 0, verificationCode: isSet(object.verificationCode) ? globalThis.String(object.verificationCode) : void 0 }; }, toJSON(message) { const obj = {}; if (message.password !== void 0) { obj.password = message.password; } if (message.hash !== void 0) { obj.hash = message.hash; } if (message.changeRequired !== false) { obj.changeRequired = message.changeRequired; } if (message.currentPassword !== void 0) { obj.currentPassword = message.currentPassword; } if (message.verificationCode !== void 0) { obj.verificationCode = message.verificationCode; } return obj; }, create(base) { return SetPassword.fromPartial(base ?? {}); }, fromPartial(object) { const message = createBaseSetPassword(); message.password = object.password ?? void 0; message.hash = object.hash ?? void 0; message.changeRequired = object.changeRequired ?? false; message.currentPassword = object.currentPassword ?? void 0; message.verificationCode = object.verificationCode ?? void 0; return message; } }; function createBaseSendPasswordResetEmail() { return { urlTemplate: void 0 }; } const SendPasswordResetEmail = { encode(message, writer = new import_wire.BinaryWriter()) { if (message.urlTemplate !== void 0) { writer.uint32(18).string(message.urlTemplate); } return writer; }, decode(input, length) { const reader = input instanceof import_wire.BinaryReader ? input : new import_wire.BinaryReader(input); const end = length === void 0 ? 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; }, fromJSON(object) { return { urlTemplate: isSet(object.urlTemplate) ? globalThis.String(object.urlTemplate) : void 0 }; }, toJSON(message) { const obj = {}; if (message.urlTemplate !== void 0) { obj.urlTemplate = message.urlTemplate; } return obj; }, create(base) { return SendPasswordResetEmail.fromPartial(base ?? {}); }, fromPartial(object) { const message = createBaseSendPasswordResetEmail(); message.urlTemplate = object.urlTemplate ?? void 0; return message; } }; function createBaseSendPasswordResetSMS() { return {}; } const SendPasswordResetSMS = { encode(_, writer = new import_wire.BinaryWriter()) { return writer; }, decode(input, length) { const reader = input instanceof import_wire.BinaryReader ? input : new import_wire.BinaryReader(input); const end = length === void 0 ? reader.len : reader.pos + length; const message = createBaseSendPasswordResetSMS(); 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(_) { return {}; }, toJSON(_) { const obj = {}; return obj; }, create(base) { return SendPasswordResetSMS.fromPartial(base ?? {}); }, fromPartial(_) { const message = createBaseSendPasswordResetSMS(); return message; } }; function createBaseReturnPasswordResetCode() { return {}; } const ReturnPasswordResetCode = { encode(_, writer = new import_wire.BinaryWriter()) { return writer; }, decode(input, length) { const reader = input instanceof import_wire.BinaryReader ? input : new import_wire.BinaryReader(input); const end = length === void 0 ? reader.len : reader.pos + length; const message = createBaseReturnPasswordResetCode(); 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(_) { return {}; }, toJSON(_) { const obj = {}; return obj; }, create(base) { return ReturnPasswordResetCode.fromPartial(base ?? {}); }, fromPartial(_) { const message = createBaseReturnPasswordResetCode(); return message; } }; function createBaseAuthenticatorRegistrationCode() { return { id: "", code: "" }; } const AuthenticatorRegistrationCode = { encode(message, writer = new import_wire.BinaryWriter()) { if (message.id !== "") { writer.uint32(10).string(message.id); } if (message.code !== "") { writer.uint32(18).string(message.code); } return writer; }, decode(input, length) { const reader = input instanceof import_wire.BinaryReader ? input : new import_wire.BinaryReader(input); const end = length === void 0 ? reader.len : reader.pos + length; const message = createBaseAuthenticatorRegistrationCode(); 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; } } if ((tag & 7) === 4 || tag === 0) { break; } reader.skip(tag & 7); } return message; }, fromJSON(object) { return { id: isSet(object.id) ? globalThis.String(object.id) : "", code: isSet(object.code) ? globalThis.String(object.code) : "" }; }, toJSON(message) { const obj = {}; if (message.id !== "") { obj.id = message.id; } if (message.code !== "") { obj.code = message.code; } return obj; }, create(base) { return AuthenticatorRegistrationCode.fromPartial(base ?? {}); }, fromPartial(object) { const message = createBaseAuthenticatorRegistrationCode(); message.id = object.id ?? ""; message.code = object.code ?? ""; return message; } }; function createBaseSendWebAuthNRegistrationLink() { return { urlTemplate: vo