UNPKG

@zitadel/node

Version:

Library for API access to ZITADEL. Provides compiled gRPC service clients and helpers for applications and service accounts.

2,299 lines 80.2 kB
// 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;
    },
    fromJSON(object) {
        return { urlTemplate: isSet(object.urlTemplate) ? globalThis.String(object.urlTemplate) : undefined };
    },
    toJSON(message) {
        const obj = {};
        if (message.urlTemplate !== undefined) {
            obj.urlTemplate = message.urlTemplate;
        }
        return obj;
    },
    create(base) {
        return SendPasswordResetEmail.fromPartial(base ?? {});
    },
    fromPartial(object) {
        const message = createBaseSendPasswordResetEmail();
        message.urlTemplate = object.urlTemplate ?? undefined;
        return message;
    },
};
function createBaseSendPasswordResetSMS() {
    return {};
}
export const SendPasswordResetSMS = {
    encode(_, writer = new BinaryWriter()) {
        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 = 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 {};
}
export const ReturnPasswordResetCode = {
    encode(_, writer = new BinaryWriter()) {
        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 = 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: "" };
}
export const AuthenticatorRegistrationCode = {
    encode(message, writer = new 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 BinaryReader ? input : new BinaryReader(input);
        const end = length === undefined ? 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: undefined };
}
export const SendWebAuthNRegistrationLink = {
    encode(message, writer = new BinaryWriter()) {
        if (message.urlTemplate !== undefined) {
            writer.uint32(10).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 = createBaseSendWebAuthNRegistrationLink();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1: {
                    if (tag !== 10) {
                        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) : undefined };
    },
    toJSON(message) {
        const obj = {};
        if (message.urlTemplate !== undefined) {
            obj.urlTemplate = message.urlTemplate;
        }
        return obj;
    },
    create(base) {
        return SendWebAuthNRegistrationLink.fromPartial(base ?? {});
    },
    fromPartial(object) {
        const message = createBaseSendWebAuthNRegistrationLink();
        message.urlTemplate = object.urlTemplate ?? undefined;
        return message;
    },
};
function createBaseReturnWebAuthNRegistrationCode() {
    return {};
}
export const ReturnWebAuthNRegistrationCode = {
    encode(_, writer = new BinaryWriter()) {
        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 = createBaseReturnWebAuthNRegistrationCode();
        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 ReturnWebAuthNRegistrationCode.fromPartial(base ?? {});
    },
    fromPartial(_) {
        const message = createBaseReturnWebAuthNRegistrationCode();
        return message;
    },
};
function createBaseRedirectURLs() {
    return { successUrl: "", failureUrl: "" };
}
export const RedirectURLs = {
    encode(message, writer = new BinaryWriter()) {
        if (message.successUrl !== "") {
            writer.uint32(10).string(message.successUrl);
        }
        if (message.failureUrl !== "") {
            writer.uint32(18).string(message.failureUrl);
        }
        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 = createBaseRedirectURLs();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1: {
                    if (tag !== 10) {
                        break;
                    }
                    message.successUrl = reader.string();
                    continue;
                }
                case 2: {
                    if (tag !== 18) {
                        break;
                    }
                    message.failureUrl = reader.string();
                    continue;
                }
            }
            if ((tag & 7) === 4 || tag === 0) {
                break;
            }
            reader.skip(tag & 7);
        }
        return message;
    },
    fromJSON(object) {
        return {
            successUrl: isSet(object.successUrl) ? globalThis.String(object.successUrl) : "",
            failureUrl: isSet(object.failureUrl) ? globalThis.String(object.failureUrl) : "",
        };
    },
    toJSON(message) {
        const obj = {};
        if (message.successUrl !== "") {
            obj.successUrl = message.successUrl;
        }
        if (message.failureUrl !== "") {
            obj.failureUrl = message.failureUrl;
        }
        return obj;
    },
    create(base) {
        return RedirectURLs.fromPartial(base ?? {});
    },
    fromPartial(object) {
        const message = createBaseRedirectURLs();
        message.successUrl = object.successUrl ?? "";
        message.failureUrl = object.failureUrl ?? "";
        return message;
    },
};
function createBaseLDAPCredentials() {
    return { username: "", password: "" };
}
export const LDAPCredentials = {
    encode(message, writer = new BinaryWriter()) {
        if (message.username !== "") {
            writer.uint32(10).string(message.username);
        }
        if (message.password !== "") {
            writer.uint32(18).string(message.password);
        }
        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 = createBaseLDAPCredentials();
        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 !== 18) {
                        break;
                    }
                    message.password = reader.string();
                    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) : "",
            password: isSet(object.password) ? globalThis.String(object.password) : "",
        };
    },
    toJSON(message) {
        const obj = {};
        if (message.username !== "") {
            obj.username = message.username;
        }
        if (message.password !== "") {
            obj.password = message.password;
        }
        return obj;
    },
    create(base) {
        return LDAPCredentials.fromPartial(base ?? {});
    },
    fromPartial(object) {
        const message = createBaseLDAPCredentials();
        message.username = object.username ?? "";
        message.password = object.password ?? "";
        return message;
    },
};
function createBaseIdentityProviderIntent() {
    return { idpIntentId: "", idpIntentToken: "", userId: undefined };
}
export const IdentityProviderIntent = {
    encode(message, writer = new BinaryWriter()) {
        if (message.idpIntentId !== "") {
            writer.uint32(10).string(message.idpIntentId);
        }
        if (message.idpIntentToken !== "") {
            writer.uint32(18).string(message.idpIntentToken);
        }
        if (message.userId !== undefined) {
            writer.uint32(26).string(message.userId);
        }
        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 = createBaseIdentityProviderIntent();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1: {
                    if (tag !== 10) {
                        break;
                    }
                    message.idpIntentId = reader.string();
                    continue;
                }
                case 2: {
                    if (tag !== 18) {
                        break;
                    }
                    message.idpIntentToken = reader.string();
                    continue;
                }
                case 3: {
                    if (tag !== 26) {
                        break;
                    }
                    message.userId = reader.string();
                    continue;
                }
            }
            if ((tag & 7) === 4 || tag === 0) {
                break;
            }
            reader.skip(tag & 7);
        }
        return message;
    },
    fromJSON(object) {
        return {
            idpIntentId: isSet(object.idpIntentId) ? globalThis.String(object.idpIntentId) : "",
            idpIntentToken: isSet(object.idpIntentToken) ? globalThis.String(object.idpIntentToken) : "",
            userId: isSet(object.userId) ? globalThis.String(object.userId) : undefined,
        };
    },
    toJSON(message) {
        const obj = {};
        if (message.idpIntentId !== "") {
            obj.idpIntentId = message.idpIntentId;
        }
        if (message.idpIntentToken !== "") {
            obj.idpIntentToken = message.idpIntentToken;
        }
        if (message.userId !== undefined) {
            obj.userId = message.userId;
        }
        return obj;
    },
    create(base) {
        return IdentityProviderIntent.fromPartial(base ?? {});
    },
    fromPartial(object) {
        const message = createBaseIdentityProviderIntent();
        message.idpIntentId = object.idpIntentId ?? "";
        message.idpIntentToken = object.idpIntentToken ?? "";
        message.userId = object.userId ?? undefined;
        return message;
    },
};
function createBaseIDPInformation() {
    return {
        idpId: "",
        userId: "",
        userName: "",
        rawInformation: undefined,
        oauth: undefined,
        ldap: undefined,
        saml: undefined,
    };
}
export const IDPInformation = {
    encode(message, writer = new BinaryWriter()) {
        if (message.idpId !== "") {
            writer.uint32(10).string(message.idpId);
        }
        if (message.userId !== "") {
            writer.uint32(18).string(message.userId);
        }
        if (message.userName !== "") {
            writer.uint32(26).string(message.userName);
        }
        if (message.rawInformation !== undefined) {
            Struct.encode(Struct.wrap(message.rawInformation), writer.uint32(34).fork()).join();
        }
        if (message.oauth !== undefined) {
            IDPOAuthAccessInformation.encode(message.oauth, writer.uint32(42).fork()).join();
        }
        if (message.ldap !== undefined) {
            IDPLDAPAccessInformation.encode(message.ldap, writer.uint32(50).fork()).join();
        }
        if (message.saml !== undefined) {
            IDPSAMLAccessInformation.encode(message.saml, writer.uint32(58).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 = createBaseIDPInformation();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1: {
                    if (tag !== 10) {
                        break;
                    }
                    message.idpId = reader.string();
                    continue;
                }
                case 2: {
                    if (tag !== 18) {
                        break;
                    }
                    message.userId = reader.string();
                    continue;
                }
                case 3: {
                    if (tag !== 26) {
                        break;
                    }
                    message.userName = reader.string();
                    continue;
                }
                case 4: {
                    if (tag !== 34) {
                        break;
                    }
                    message.rawInformation = Struct.unwrap(Struct.decode(reader, reader.uint32()));
                    continue;
                }
                case 5: {
                    if (tag !== 42) {
                        break;
                    }
                    message.oauth = IDPOAuthAccessInformation.decode(reader, reader.uint32());
                    continue;
                }
                case 6: {
                    if (tag !== 50) {
                        break;
                    }
                    message.ldap = IDPLDAPAccessInformation.decode(reader, reader.uint32());
                    continue;
                }
                case 7: {
                    if (tag !== 58) {
                        break;
                    }
                    message.saml = IDPSAMLAccessInformation.decode(reader, reader.uint32());
                    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) : "",
            userId: isSet(object.userId) ? globalThis.String(object.userId) : "",
            userName: isSet(object.userName) ? globalThis.String(object.userName) : "",
            rawInformation: isObject(object.rawInformation) ? object.rawInformation : undefined,
            oauth: isSet(object.oauth) ? IDPOAuthAccessInformation.fromJSON(object.oauth) : undefined,
            ldap: isSet(object.ldap) ? IDPLDAPAccessInformation.fromJSON(object.ldap) : undefined,
            saml: isSet(object.saml) ? IDPSAMLAccessInformation.fromJSON(object.saml) : undefined,
        };
    },
    toJSON(message) {
        const obj = {};
        if (message.idpId !== "") {
            obj.idpId = message.idpId;
        }
        if (message.userId !== "") {
            obj.userId = message.userId;
        }
        if (message.userName !== "") {
            obj.userName = message.userName;
        }
        if (message.rawInformation !== undefined) {
            obj.rawInformation = message.rawInformation;
        }
        if (message.oauth !== undefined) {
            obj.oauth = IDPOAuthAccessInformation.toJSON(message.oauth);
        }
        if (message.ldap !== undefined) {
            obj.ldap = IDPLDAPAccessInformation.toJSON(message.ldap);
        }
        if (message.saml !== undefined) {
            obj.saml = IDPSAMLAccessInformation.toJSON(message.saml);
        }
        return obj;
    },
    create(base) {
        return IDPInformation.fromPartial(base ?? {});
    },
    fromPartial(object) {
        const message = createBaseIDPInformation();
        message.idpId = object.idpId ?? "";
        message.userId = object.userId ?? "";
        message.userName = object.userName ?? "";
        message.rawInformation = object.rawInformation ?? undefined;
        message.oauth = (object.oauth !== undefined && object.oauth !== null)
            ? IDPOAuthAccessInformation.fromPartial(object.oauth)
            : undefined;
        message.ldap = (object.ldap !== undefined && object.ldap !== null)
            ? IDPLDAPAccessInformation.fromPartial(object.ldap)
            : undefined;
        message.saml = (object.saml !== undefined && object.saml !== null)
            ? IDPSAMLAccessInformation.fromPartial(object.saml)
            : undefined;
        return message;
    },
};
function createBaseIDPOAuthAccessInformation() {
    return { accessToken: "", idToken: undefined };
}
export const IDPOAuthAccessInformation = {
    encode(message, writer = new BinaryWriter()) {
        if (message.accessToken !== "") {
            writer.uint32(10).string(message.accessToken);
        }
        if (message.idToken !== undefined) {
            writer.uint32(18).string(message.idToken);
        }
        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 = createBaseIDPOAuthAccessInformation();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1: {
                    if (tag !== 10) {
                        break;
                    }
                    message.accessToken = reader.string();
                    continue;
                }
                case 2: {
                    if (tag !== 18) {
                        break;
                    }
                    message.idToken = reader.string();
                    continue;
                }
            }
            if ((tag & 7) === 4 || tag === 0) {
                break;
            }
            reader.skip(tag & 7);
        }
        return message;
    },
    fromJSON(object) {
        return {
            accessToken: isSet(object.accessToken) ? globalThis.String(object.accessToken) : "",
            idToken: isSet(object.idToken) ? globalThis.String(object.idToken) : undefined,
        };
    },
    toJSON(message) {
        const obj = {};
        if (message.accessToken !== "") {
            obj.accessToken = message.accessToken;
        }
        if (message.idToken !== undefined) {
            obj.idToken = message.idToken;
        }
        return obj;
    },
    create(base) {
        return IDPOAuthAccessInformation.fromPartial(base ?? {});
    },
    fromPartial(object) {
        const message = createBaseIDPOAuthAccessInformation();
        message.accessToken = object.accessToken ?? "";
        message.idToken = object.idToken ?? undefined;
        return message;
    },
};
function createBaseIDPLDAPAccessInformation() {
    return { attributes: undefined };
}
export const IDPLDAPAccessInformation = {
    encode(message, writer = new BinaryWriter()) {
        if (message.attributes !== undefined) {
            Struct.encode(Struct.wrap(message.attributes), 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 = createBaseIDPLDAPAccessInformation();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1: {
                    if (tag !== 10) {
                        break;
                    }
                    message.attributes = Struct.unwrap(Struct.decode(reader, reader.uint32()));
                    continue;
                }
            }
            if ((tag & 7) === 4 || tag === 0) {
                break;
            }
            reader.skip(tag & 7);
        }
        return message;
    },
    fromJSON(object) {
        return { attributes: isObject(object.attributes) ? object.attributes : undefined };
    },
    toJSON(message) {
        const obj = {};
        if (message.attributes !== undefined) {
            obj.attributes = message.attributes;
        }
        return obj;
    },
    create(base) {
        return IDPLDAPAccessInformation.fromPartial(base ?? {});
    },
    fromPartial(object) {
        const message = createBaseIDPLDAPAccessInformation();
        message.attributes = object.attributes ?? undefined;
        return message;
    },
};
function createBaseIDPSAMLAccessInformation() {
    return { assertion: Buffer.alloc(0) };
}
export const IDPSAMLAccessInformation = {
    encode(message, writer = new BinaryWriter()) {
        if (message.assertion.length !== 0) {
            writer.uint32(10).bytes(message.assertion);
        }
        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 = createBaseIDPSAMLAccessInformation();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1: {
                    if (tag !== 10) {
                        break;
                    }
                    message.assertion = Buffer.from(reader.bytes());
                    continue;
                }
            }
            if ((tag & 7) === 4 || tag === 0) {
                break;
            }
            reader.skip(tag & 7);
        }
        return message;
    },
    fromJSON(object) {
        return { assertion: isSet(object.assertion) ? Buffer.from(bytesFromBase64(object.assertion)) : Buffer.alloc(0) };
    },
    toJSON(message) {
        const obj = {};
        if (message.assertion.length !== 0) {
            obj.assertion = base64FromBytes(message.assertion);
        }
        return obj;
    },
    create(base) {
        return IDPSAMLAccessInformation.fromPartial(base ?? {});
    },
    fromPartial(object) {
        const message = createBaseIDPSAMLAccessInformation();
        message.assertion = object.assertion ?? Buffer.alloc(0);
        return message;
    },
};
function createBaseIDPAuthenticator() {
    return { idpId: "", userId: "", userName: "" };
}
export const IDPAuthenticator = {
    encode(message, writer = new BinaryWriter()) {
        if (message.idpId !== "") {
            writer.uint32(10).string(message.idpId);
        }
        if (message.userId !== "") {
            writer.uint32(18).string(message.userId);
        }
        if (message.userName !== "") {
            writer.uint32(26).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 = createBaseIDPAuthenticator();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1: {
                    if (tag !== 10) {
                        break;
                    }
                    message.idpId = reader.string();
                    continue;
                }
                case 2: {
                    if (tag !== 18) {
                        break;
                    }
                    message.userId = reader.string();
                    continue;
                }
                case 3: {
                    if (tag !== 26) {
                        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) : "",
            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.userId !== "") {
            obj.userId = message.userId;
        }
        if (message.userName !== "") {
            obj.userName = message.userName;
        }
        return obj;
    },
    create(base) {
        return IDPAuthenticator.fromPartial(base ?? {});
    },
    fromPartial(object) {
        const message = createBaseIDPAuthenticator();
        message.idpId = object.idpId ?? "";
        message.userId = object.userId ?? "";
        message.userName = object.userName ?? "";
        return message;
    },
};
function bytesFromBase64(b64) {
    return Uint8Array.from(globalThis.Buffer.from(b64, "base64"));
}
function base64FromBytes(arr) {
    return globalThis.Buffer.from(arr).toString("base64");
}
function toTimestamp(date) {
    const seconds = numberToLong(Math.trunc(date.getTime() / 1_000));
    const nanos = (date.getTime() % 1_000) * 1_000_000;
    return { seconds, nanos };
}
function fromTimestamp(t) {
    let millis = (t.seconds.toNumber() || 0) * 1_000;
    millis += (t.nanos || 0) / 1_000_000;
    return new globalThis.Date(millis);
}
function fromJsonTimestamp(o) {
    if (o instanceof globalThis.Date) {
        return o;
    }
    else if (typeof o === "string") {
        return new globalThis.Date(o);
    }
    else {
        return fromTimestamp(Timestamp.fromJSON(o));
    }
}
function numberToLong(number) {
    return Long.fromNumber(number);
}
function isObject(value) {
    return typeof value === "object" && value !== null;
}
function isSet(value) {
    return value !== null && value !== undefined;
}