// @generated by protobuf-ts 2.11.1 with parameter long_type_string,ts_nocheck
// @generated from protobuf file "runtime/v1/auth.proto" (package "nimi.runtime.v1", syntax proto3)
// tslint:disable
// @ts-nocheck
import { Ack } from "./common.js";
import { ServiceType } from "@protobuf-ts/runtime-rpc";
import { WireType } from "@protobuf-ts/runtime";
import { UnknownFieldHandler } from "@protobuf-ts/runtime";
import { reflectionMergePartial } from "@protobuf-ts/runtime";
import { MessageType } from "@protobuf-ts/runtime";
import { ExternalPrincipalType } from "./common.js";
import { Timestamp } from "../../google/protobuf/timestamp.js";
import { ReasonCode } from "./common.js";
/**
 * @generated from protobuf enum nimi.runtime.v1.ExternalProofType
 */
export var ExternalProofType;
(function (ExternalProofType) {
    /**
     * @generated from protobuf enum value: EXTERNAL_PROOF_TYPE_UNSPECIFIED = 0;
     */
    ExternalProofType[ExternalProofType["UNSPECIFIED"] = 0] = "UNSPECIFIED";
    /**
     * @generated from protobuf enum value: EXTERNAL_PROOF_TYPE_JWT = 1;
     */
    ExternalProofType[ExternalProofType["JWT"] = 1] = "JWT";
})(ExternalProofType || (ExternalProofType = {}));
/**
 * @generated from protobuf enum nimi.runtime.v1.AppMode
 */
export var AppMode;
(function (AppMode) {
    /**
     * @generated from protobuf enum value: APP_MODE_UNSPECIFIED = 0;
     */
    AppMode[AppMode["UNSPECIFIED"] = 0] = "UNSPECIFIED";
    /**
     * @generated from protobuf enum value: APP_MODE_LITE = 1;
     */
    AppMode[AppMode["LITE"] = 1] = "LITE";
    /**
     * @generated from protobuf enum value: APP_MODE_CORE_ONLY = 2;
     */
    AppMode[AppMode["CORE_ONLY"] = 2] = "CORE_ONLY";
    /**
     * @generated from protobuf enum value: APP_MODE_FULL = 3;
     */
    AppMode[AppMode["FULL"] = 3] = "FULL";
})(AppMode || (AppMode = {}));
/**
 * @generated from protobuf enum nimi.runtime.v1.WorldRelation
 */
export var WorldRelation;
(function (WorldRelation) {
    /**
     * @generated from protobuf enum value: WORLD_RELATION_UNSPECIFIED = 0;
     */
    WorldRelation[WorldRelation["UNSPECIFIED"] = 0] = "UNSPECIFIED";
    /**
     * @generated from protobuf enum value: WORLD_RELATION_NONE = 1;
     */
    WorldRelation[WorldRelation["NONE"] = 1] = "NONE";
    /**
     * @generated from protobuf enum value: WORLD_RELATION_RENDER = 2;
     */
    WorldRelation[WorldRelation["RENDER"] = 2] = "RENDER";
    /**
     * @generated from protobuf enum value: WORLD_RELATION_EXTENSION = 3;
     */
    WorldRelation[WorldRelation["EXTENSION"] = 3] = "EXTENSION";
})(WorldRelation || (WorldRelation = {}));
// @generated message type with reflection information, may provide speed optimized methods
class AppModeManifest$Type extends MessageType {
    constructor() {
        super("nimi.runtime.v1.AppModeManifest", [
            { no: 1, name: "app_mode", kind: "enum", T: () => ["nimi.runtime.v1.AppMode", AppMode, "APP_MODE_"] },
            { no: 2, name: "runtime_required", kind: "scalar", T: 8 /*ScalarType.BOOL*/ },
            { no: 3, name: "realm_required", kind: "scalar", T: 8 /*ScalarType.BOOL*/ },
            { no: 4, name: "world_relation", kind: "enum", T: () => ["nimi.runtime.v1.WorldRelation", WorldRelation, "WORLD_RELATION_"] }
        ]);
    }
    create(value) {
        const message = globalThis.Object.create((this.messagePrototype));
        message.appMode = 0;
        message.runtimeRequired = false;
        message.realmRequired = false;
        message.worldRelation = 0;
        if (value !== undefined)
            reflectionMergePartial(this, message, value);
        return message;
    }
    internalBinaryRead(reader, length, options, target) {
        let message = target ?? this.create(), end = reader.pos + length;
        while (reader.pos < end) {
            let [fieldNo, wireType] = reader.tag();
            switch (fieldNo) {
                case /* nimi.runtime.v1.AppMode app_mode */ 1:
                    message.appMode = reader.int32();
                    break;
                case /* bool runtime_required */ 2:
                    message.runtimeRequired = reader.bool();
                    break;
                case /* bool realm_required */ 3:
                    message.realmRequired = reader.bool();
                    break;
                case /* nimi.runtime.v1.WorldRelation world_relation */ 4:
                    message.worldRelation = reader.int32();
                    break;
                default:
                    let u = options.readUnknownField;
                    if (u === "throw")
                        throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
                    let d = reader.skip(wireType);
                    if (u !== false)
                        (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
            }
        }
        return message;
    }
    internalBinaryWrite(message, writer, options) {
        /* nimi.runtime.v1.AppMode app_mode = 1; */
        if (message.appMode !== 0)
            writer.tag(1, WireType.Varint).int32(message.appMode);
        /* bool runtime_required = 2; */
        if (message.runtimeRequired !== false)
            writer.tag(2, WireType.Varint).bool(message.runtimeRequired);
        /* bool realm_required = 3; */
        if (message.realmRequired !== false)
            writer.tag(3, WireType.Varint).bool(message.realmRequired);
        /* nimi.runtime.v1.WorldRelation world_relation = 4; */
        if (message.worldRelation !== 0)
            writer.tag(4, WireType.Varint).int32(message.worldRelation);
        let u = options.writeUnknownFields;
        if (u !== false)
            (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
        return writer;
    }
}
/**
 * @generated MessageType for protobuf message nimi.runtime.v1.AppModeManifest
 */
export const AppModeManifest = new AppModeManifest$Type();
// @generated message type with reflection information, may provide speed optimized methods
class RegisterAppRequest$Type extends MessageType {
    constructor() {
        super("nimi.runtime.v1.RegisterAppRequest", [
            { no: 1, name: "app_id", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 2, name: "app_instance_id", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 3, name: "device_id", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 4, name: "app_version", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 5, name: "capabilities", kind: "scalar", repeat: 2 /*RepeatType.UNPACKED*/, T: 9 /*ScalarType.STRING*/ },
            { no: 6, name: "mode_manifest", kind: "message", T: () => AppModeManifest }
        ]);
    }
    create(value) {
        const message = globalThis.Object.create((this.messagePrototype));
        message.appId = "";
        message.appInstanceId = "";
        message.deviceId = "";
        message.appVersion = "";
        message.capabilities = [];
        if (value !== undefined)
            reflectionMergePartial(this, message, value);
        return message;
    }
    internalBinaryRead(reader, length, options, target) {
        let message = target ?? this.create(), end = reader.pos + length;
        while (reader.pos < end) {
            let [fieldNo, wireType] = reader.tag();
            switch (fieldNo) {
                case /* string app_id */ 1:
                    message.appId = reader.string();
                    break;
                case /* string app_instance_id */ 2:
                    message.appInstanceId = reader.string();
                    break;
                case /* string device_id */ 3:
                    message.deviceId = reader.string();
                    break;
                case /* string app_version */ 4:
                    message.appVersion = reader.string();
                    break;
                case /* repeated string capabilities */ 5:
                    message.capabilities.push(reader.string());
                    break;
                case /* nimi.runtime.v1.AppModeManifest mode_manifest */ 6:
                    message.modeManifest = AppModeManifest.internalBinaryRead(reader, reader.uint32(), options, message.modeManifest);
                    break;
                default:
                    let u = options.readUnknownField;
                    if (u === "throw")
                        throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
                    let d = reader.skip(wireType);
                    if (u !== false)
                        (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
            }
        }
        return message;
    }
    internalBinaryWrite(message, writer, options) {
        /* string app_id = 1; */
        if (message.appId !== "")
            writer.tag(1, WireType.LengthDelimited).string(message.appId);
        /* string app_instance_id = 2; */
        if (message.appInstanceId !== "")
            writer.tag(2, WireType.LengthDelimited).string(message.appInstanceId);
        /* string device_id = 3; */
        if (message.deviceId !== "")
            writer.tag(3, WireType.LengthDelimited).string(message.deviceId);
        /* string app_version = 4; */
        if (message.appVersion !== "")
            writer.tag(4, WireType.LengthDelimited).string(message.appVersion);
        /* repeated string capabilities = 5; */
        for (let i = 0; i < message.capabilities.length; i++)
            writer.tag(5, WireType.LengthDelimited).string(message.capabilities[i]);
        /* nimi.runtime.v1.AppModeManifest mode_manifest = 6; */
        if (message.modeManifest)
            AppModeManifest.internalBinaryWrite(message.modeManifest, writer.tag(6, WireType.LengthDelimited).fork(), options).join();
        let u = options.writeUnknownFields;
        if (u !== false)
            (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
        return writer;
    }
}
/**
 * @generated MessageType for protobuf message nimi.runtime.v1.RegisterAppRequest
 */
export const RegisterAppRequest = new RegisterAppRequest$Type();
// @generated message type with reflection information, may provide speed optimized methods
class RegisterAppResponse$Type extends MessageType {
    constructor() {
        super("nimi.runtime.v1.RegisterAppResponse", [
            { no: 1, name: "app_instance_id", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 2, name: "accepted", kind: "scalar", T: 8 /*ScalarType.BOOL*/ },
            { no: 3, name: "reason_code", kind: "enum", T: () => ["nimi.runtime.v1.ReasonCode", ReasonCode] }
        ]);
    }
    create(value) {
        const message = globalThis.Object.create((this.messagePrototype));
        message.appInstanceId = "";
        message.accepted = false;
        message.reasonCode = 0;
        if (value !== undefined)
            reflectionMergePartial(this, message, value);
        return message;
    }
    internalBinaryRead(reader, length, options, target) {
        let message = target ?? this.create(), end = reader.pos + length;
        while (reader.pos < end) {
            let [fieldNo, wireType] = reader.tag();
            switch (fieldNo) {
                case /* string app_instance_id */ 1:
                    message.appInstanceId = reader.string();
                    break;
                case /* bool accepted */ 2:
                    message.accepted = reader.bool();
                    break;
                case /* nimi.runtime.v1.ReasonCode reason_code */ 3:
                    message.reasonCode = reader.int32();
                    break;
                default:
                    let u = options.readUnknownField;
                    if (u === "throw")
                        throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
                    let d = reader.skip(wireType);
                    if (u !== false)
                        (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
            }
        }
        return message;
    }
    internalBinaryWrite(message, writer, options) {
        /* string app_instance_id = 1; */
        if (message.appInstanceId !== "")
            writer.tag(1, WireType.LengthDelimited).string(message.appInstanceId);
        /* bool accepted = 2; */
        if (message.accepted !== false)
            writer.tag(2, WireType.Varint).bool(message.accepted);
        /* nimi.runtime.v1.ReasonCode reason_code = 3; */
        if (message.reasonCode !== 0)
            writer.tag(3, WireType.Varint).int32(message.reasonCode);
        let u = options.writeUnknownFields;
        if (u !== false)
            (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
        return writer;
    }
}
/**
 * @generated MessageType for protobuf message nimi.runtime.v1.RegisterAppResponse
 */
export const RegisterAppResponse = new RegisterAppResponse$Type();
// @generated message type with reflection information, may provide speed optimized methods
class OpenSessionRequest$Type extends MessageType {
    constructor() {
        super("nimi.runtime.v1.OpenSessionRequest", [
            { no: 1, name: "app_id", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 2, name: "app_instance_id", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 3, name: "device_id", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 4, name: "subject_user_id", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 5, name: "ttl_seconds", kind: "scalar", T: 5 /*ScalarType.INT32*/ }
        ]);
    }
    create(value) {
        const message = globalThis.Object.create((this.messagePrototype));
        message.appId = "";
        message.appInstanceId = "";
        message.deviceId = "";
        message.subjectUserId = "";
        message.ttlSeconds = 0;
        if (value !== undefined)
            reflectionMergePartial(this, message, value);
        return message;
    }
    internalBinaryRead(reader, length, options, target) {
        let message = target ?? this.create(), end = reader.pos + length;
        while (reader.pos < end) {
            let [fieldNo, wireType] = reader.tag();
            switch (fieldNo) {
                case /* string app_id */ 1:
                    message.appId = reader.string();
                    break;
                case /* string app_instance_id */ 2:
                    message.appInstanceId = reader.string();
                    break;
                case /* string device_id */ 3:
                    message.deviceId = reader.string();
                    break;
                case /* string subject_user_id */ 4:
                    message.subjectUserId = reader.string();
                    break;
                case /* int32 ttl_seconds */ 5:
                    message.ttlSeconds = reader.int32();
                    break;
                default:
                    let u = options.readUnknownField;
                    if (u === "throw")
                        throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
                    let d = reader.skip(wireType);
                    if (u !== false)
                        (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
            }
        }
        return message;
    }
    internalBinaryWrite(message, writer, options) {
        /* string app_id = 1; */
        if (message.appId !== "")
            writer.tag(1, WireType.LengthDelimited).string(message.appId);
        /* string app_instance_id = 2; */
        if (message.appInstanceId !== "")
            writer.tag(2, WireType.LengthDelimited).string(message.appInstanceId);
        /* string device_id = 3; */
        if (message.deviceId !== "")
            writer.tag(3, WireType.LengthDelimited).string(message.deviceId);
        /* string subject_user_id = 4; */
        if (message.subjectUserId !== "")
            writer.tag(4, WireType.LengthDelimited).string(message.subjectUserId);
        /* int32 ttl_seconds = 5; */
        if (message.ttlSeconds !== 0)
            writer.tag(5, WireType.Varint).int32(message.ttlSeconds);
        let u = options.writeUnknownFields;
        if (u !== false)
            (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
        return writer;
    }
}
/**
 * @generated MessageType for protobuf message nimi.runtime.v1.OpenSessionRequest
 */
export const OpenSessionRequest = new OpenSessionRequest$Type();
// @generated message type with reflection information, may provide speed optimized methods
class OpenSessionResponse$Type extends MessageType {
    constructor() {
        super("nimi.runtime.v1.OpenSessionResponse", [
            { no: 1, name: "session_id", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 2, name: "issued_at", kind: "message", T: () => Timestamp },
            { no: 3, name: "expires_at", kind: "message", T: () => Timestamp },
            { no: 4, name: "session_token", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 5, name: "reason_code", kind: "enum", T: () => ["nimi.runtime.v1.ReasonCode", ReasonCode] }
        ]);
    }
    create(value) {
        const message = globalThis.Object.create((this.messagePrototype));
        message.sessionId = "";
        message.sessionToken = "";
        message.reasonCode = 0;
        if (value !== undefined)
            reflectionMergePartial(this, message, value);
        return message;
    }
    internalBinaryRead(reader, length, options, target) {
        let message = target ?? this.create(), end = reader.pos + length;
        while (reader.pos < end) {
            let [fieldNo, wireType] = reader.tag();
            switch (fieldNo) {
                case /* string session_id */ 1:
                    message.sessionId = reader.string();
                    break;
                case /* google.protobuf.Timestamp issued_at */ 2:
                    message.issuedAt = Timestamp.internalBinaryRead(reader, reader.uint32(), options, message.issuedAt);
                    break;
                case /* google.protobuf.Timestamp expires_at */ 3:
                    message.expiresAt = Timestamp.internalBinaryRead(reader, reader.uint32(), options, message.expiresAt);
                    break;
                case /* string session_token */ 4:
                    message.sessionToken = reader.string();
                    break;
                case /* nimi.runtime.v1.ReasonCode reason_code */ 5:
                    message.reasonCode = reader.int32();
                    break;
                default:
                    let u = options.readUnknownField;
                    if (u === "throw")
                        throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
                    let d = reader.skip(wireType);
                    if (u !== false)
                        (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
            }
        }
        return message;
    }
    internalBinaryWrite(message, writer, options) {
        /* string session_id = 1; */
        if (message.sessionId !== "")
            writer.tag(1, WireType.LengthDelimited).string(message.sessionId);
        /* google.protobuf.Timestamp issued_at = 2; */
        if (message.issuedAt)
            Timestamp.internalBinaryWrite(message.issuedAt, writer.tag(2, WireType.LengthDelimited).fork(), options).join();
        /* google.protobuf.Timestamp expires_at = 3; */
        if (message.expiresAt)
            Timestamp.internalBinaryWrite(message.expiresAt, writer.tag(3, WireType.LengthDelimited).fork(), options).join();
        /* string session_token = 4; */
        if (message.sessionToken !== "")
            writer.tag(4, WireType.LengthDelimited).string(message.sessionToken);
        /* nimi.runtime.v1.ReasonCode reason_code = 5; */
        if (message.reasonCode !== 0)
            writer.tag(5, WireType.Varint).int32(message.reasonCode);
        let u = options.writeUnknownFields;
        if (u !== false)
            (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
        return writer;
    }
}
/**
 * @generated MessageType for protobuf message nimi.runtime.v1.OpenSessionResponse
 */
export const OpenSessionResponse = new OpenSessionResponse$Type();
// @generated message type with reflection information, may provide speed optimized methods
class RefreshSessionRequest$Type extends MessageType {
    constructor() {
        super("nimi.runtime.v1.RefreshSessionRequest", [
            { no: 1, name: "session_id", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 2, name: "ttl_seconds", kind: "scalar", T: 5 /*ScalarType.INT32*/ }
        ]);
    }
    create(value) {
        const message = globalThis.Object.create((this.messagePrototype));
        message.sessionId = "";
        message.ttlSeconds = 0;
        if (value !== undefined)
            reflectionMergePartial(this, message, value);
        return message;
    }
    internalBinaryRead(reader, length, options, target) {
        let message = target ?? this.create(), end = reader.pos + length;
        while (reader.pos < end) {
            let [fieldNo, wireType] = reader.tag();
            switch (fieldNo) {
                case /* string session_id */ 1:
                    message.sessionId = reader.string();
                    break;
                case /* int32 ttl_seconds */ 2:
                    message.ttlSeconds = reader.int32();
                    break;
                default:
                    let u = options.readUnknownField;
                    if (u === "throw")
                        throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
                    let d = reader.skip(wireType);
                    if (u !== false)
                        (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
            }
        }
        return message;
    }
    internalBinaryWrite(message, writer, options) {
        /* string session_id = 1; */
        if (message.sessionId !== "")
            writer.tag(1, WireType.LengthDelimited).string(message.sessionId);
        /* int32 ttl_seconds = 2; */
        if (message.ttlSeconds !== 0)
            writer.tag(2, WireType.Varint).int32(message.ttlSeconds);
        let u = options.writeUnknownFields;
        if (u !== false)
            (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
        return writer;
    }
}
/**
 * @generated MessageType for protobuf message nimi.runtime.v1.RefreshSessionRequest
 */
export const RefreshSessionRequest = new RefreshSessionRequest$Type();
// @generated message type with reflection information, may provide speed optimized methods
class RefreshSessionResponse$Type extends MessageType {
    constructor() {
        super("nimi.runtime.v1.RefreshSessionResponse", [
            { no: 1, name: "session_id", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 2, name: "expires_at", kind: "message", T: () => Timestamp },
            { no: 3, name: "session_token", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 4, name: "reason_code", kind: "enum", T: () => ["nimi.runtime.v1.ReasonCode", ReasonCode] }
        ]);
    }
    create(value) {
        const message = globalThis.Object.create((this.messagePrototype));
        message.sessionId = "";
        message.sessionToken = "";
        message.reasonCode = 0;
        if (value !== undefined)
            reflectionMergePartial(this, message, value);
        return message;
    }
    internalBinaryRead(reader, length, options, target) {
        let message = target ?? this.create(), end = reader.pos + length;
        while (reader.pos < end) {
            let [fieldNo, wireType] = reader.tag();
            switch (fieldNo) {
                case /* string session_id */ 1:
                    message.sessionId = reader.string();
                    break;
                case /* google.protobuf.Timestamp expires_at */ 2:
                    message.expiresAt = Timestamp.internalBinaryRead(reader, reader.uint32(), options, message.expiresAt);
                    break;
                case /* string session_token */ 3:
                    message.sessionToken = reader.string();
                    break;
                case /* nimi.runtime.v1.ReasonCode reason_code */ 4:
                    message.reasonCode = reader.int32();
                    break;
                default:
                    let u = options.readUnknownField;
                    if (u === "throw")
                        throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
                    let d = reader.skip(wireType);
                    if (u !== false)
                        (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
            }
        }
        return message;
    }
    internalBinaryWrite(message, writer, options) {
        /* string session_id = 1; */
        if (message.sessionId !== "")
            writer.tag(1, WireType.LengthDelimited).string(message.sessionId);
        /* google.protobuf.Timestamp expires_at = 2; */
        if (message.expiresAt)
            Timestamp.internalBinaryWrite(message.expiresAt, writer.tag(2, WireType.LengthDelimited).fork(), options).join();
        /* string session_token = 3; */
        if (message.sessionToken !== "")
            writer.tag(3, WireType.LengthDelimited).string(message.sessionToken);
        /* nimi.runtime.v1.ReasonCode reason_code = 4; */
        if (message.reasonCode !== 0)
            writer.tag(4, WireType.Varint).int32(message.reasonCode);
        let u = options.writeUnknownFields;
        if (u !== false)
            (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
        return writer;
    }
}
/**
 * @generated MessageType for protobuf message nimi.runtime.v1.RefreshSessionResponse
 */
export const RefreshSessionResponse = new RefreshSessionResponse$Type();
// @generated message type with reflection information, may provide speed optimized methods
class RevokeSessionRequest$Type extends MessageType {
    constructor() {
        super("nimi.runtime.v1.RevokeSessionRequest", [
            { no: 1, name: "session_id", kind: "scalar", T: 9 /*ScalarType.STRING*/ }
        ]);
    }
    create(value) {
        const message = globalThis.Object.create((this.messagePrototype));
        message.sessionId = "";
        if (value !== undefined)
            reflectionMergePartial(this, message, value);
        return message;
    }
    internalBinaryRead(reader, length, options, target) {
        let message = target ?? this.create(), end = reader.pos + length;
        while (reader.pos < end) {
            let [fieldNo, wireType] = reader.tag();
            switch (fieldNo) {
                case /* string session_id */ 1:
                    message.sessionId = reader.string();
                    break;
                default:
                    let u = options.readUnknownField;
                    if (u === "throw")
                        throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
                    let d = reader.skip(wireType);
                    if (u !== false)
                        (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
            }
        }
        return message;
    }
    internalBinaryWrite(message, writer, options) {
        /* string session_id = 1; */
        if (message.sessionId !== "")
            writer.tag(1, WireType.LengthDelimited).string(message.sessionId);
        let u = options.writeUnknownFields;
        if (u !== false)
            (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
        return writer;
    }
}
/**
 * @generated MessageType for protobuf message nimi.runtime.v1.RevokeSessionRequest
 */
export const RevokeSessionRequest = new RevokeSessionRequest$Type();
// @generated message type with reflection information, may provide speed optimized methods
class RegisterExternalPrincipalRequest$Type extends MessageType {
    constructor() {
        super("nimi.runtime.v1.RegisterExternalPrincipalRequest", [
            { no: 1, name: "app_id", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 2, name: "external_principal_id", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 3, name: "external_principal_type", kind: "enum", T: () => ["nimi.runtime.v1.ExternalPrincipalType", ExternalPrincipalType, "EXTERNAL_PRINCIPAL_TYPE_"] },
            { no: 4, name: "issuer", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 5, name: "client_id", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 6, name: "signature_key_id", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 7, name: "proof_type", kind: "enum", T: () => ["nimi.runtime.v1.ExternalProofType", ExternalProofType, "EXTERNAL_PROOF_TYPE_"] }
        ]);
    }
    create(value) {
        const message = globalThis.Object.create((this.messagePrototype));
        message.appId = "";
        message.externalPrincipalId = "";
        message.externalPrincipalType = 0;
        message.issuer = "";
        message.clientId = "";
        message.signatureKeyId = "";
        message.proofType = 0;
        if (value !== undefined)
            reflectionMergePartial(this, message, value);
        return message;
    }
    internalBinaryRead(reader, length, options, target) {
        let message = target ?? this.create(), end = reader.pos + length;
        while (reader.pos < end) {
            let [fieldNo, wireType] = reader.tag();
            switch (fieldNo) {
                case /* string app_id */ 1:
                    message.appId = reader.string();
                    break;
                case /* string external_principal_id */ 2:
                    message.externalPrincipalId = reader.string();
                    break;
                case /* nimi.runtime.v1.ExternalPrincipalType external_principal_type */ 3:
                    message.externalPrincipalType = reader.int32();
                    break;
                case /* string issuer */ 4:
                    message.issuer = reader.string();
                    break;
                case /* string client_id */ 5:
                    message.clientId = reader.string();
                    break;
                case /* string signature_key_id */ 6:
                    message.signatureKeyId = reader.string();
                    break;
                case /* nimi.runtime.v1.ExternalProofType proof_type */ 7:
                    message.proofType = reader.int32();
                    break;
                default:
                    let u = options.readUnknownField;
                    if (u === "throw")
                        throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
                    let d = reader.skip(wireType);
                    if (u !== false)
                        (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
            }
        }
        return message;
    }
    internalBinaryWrite(message, writer, options) {
        /* string app_id = 1; */
        if (message.appId !== "")
            writer.tag(1, WireType.LengthDelimited).string(message.appId);
        /* string external_principal_id = 2; */
        if (message.externalPrincipalId !== "")
            writer.tag(2, WireType.LengthDelimited).string(message.externalPrincipalId);
        /* nimi.runtime.v1.ExternalPrincipalType external_principal_type = 3; */
        if (message.externalPrincipalType !== 0)
            writer.tag(3, WireType.Varint).int32(message.externalPrincipalType);
        /* string issuer = 4; */
        if (message.issuer !== "")
            writer.tag(4, WireType.LengthDelimited).string(message.issuer);
        /* string client_id = 5; */
        if (message.clientId !== "")
            writer.tag(5, WireType.LengthDelimited).string(message.clientId);
        /* string signature_key_id = 6; */
        if (message.signatureKeyId !== "")
            writer.tag(6, WireType.LengthDelimited).string(message.signatureKeyId);
        /* nimi.runtime.v1.ExternalProofType proof_type = 7; */
        if (message.proofType !== 0)
            writer.tag(7, WireType.Varint).int32(message.proofType);
        let u = options.writeUnknownFields;
        if (u !== false)
            (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
        return writer;
    }
}
/**
 * @generated MessageType for protobuf message nimi.runtime.v1.RegisterExternalPrincipalRequest
 */
export const RegisterExternalPrincipalRequest = new RegisterExternalPrincipalRequest$Type();
// @generated message type with reflection information, may provide speed optimized methods
class RegisterExternalPrincipalResponse$Type extends MessageType {
    constructor() {
        super("nimi.runtime.v1.RegisterExternalPrincipalResponse", [
            { no: 1, name: "accepted", kind: "scalar", T: 8 /*ScalarType.BOOL*/ },
            { no: 2, name: "reason_code", kind: "enum", T: () => ["nimi.runtime.v1.ReasonCode", ReasonCode] }
        ]);
    }
    create(value) {
        const message = globalThis.Object.create((this.messagePrototype));
        message.accepted = false;
        message.reasonCode = 0;
        if (value !== undefined)
            reflectionMergePartial(this, message, value);
        return message;
    }
    internalBinaryRead(reader, length, options, target) {
        let message = target ?? this.create(), end = reader.pos + length;
        while (reader.pos < end) {
            let [fieldNo, wireType] = reader.tag();
            switch (fieldNo) {
                case /* bool accepted */ 1:
                    message.accepted = reader.bool();
                    break;
                case /* nimi.runtime.v1.ReasonCode reason_code */ 2:
                    message.reasonCode = reader.int32();
                    break;
                default:
                    let u = options.readUnknownField;
                    if (u === "throw")
                        throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
                    let d = reader.skip(wireType);
                    if (u !== false)
                        (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
            }
        }
        return message;
    }
    internalBinaryWrite(message, writer, options) {
        /* bool accepted = 1; */
        if (message.accepted !== false)
            writer.tag(1, WireType.Varint).bool(message.accepted);
        /* nimi.runtime.v1.ReasonCode reason_code = 2; */
        if (message.reasonCode !== 0)
            writer.tag(2, WireType.Varint).int32(message.reasonCode);
        let u = options.writeUnknownFields;
        if (u !== false)
            (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
        return writer;
    }
}
/**
 * @generated MessageType for protobuf message nimi.runtime.v1.RegisterExternalPrincipalResponse
 */
export const RegisterExternalPrincipalResponse = new RegisterExternalPrincipalResponse$Type();
// @generated message type with reflection information, may provide speed optimized methods
class OpenExternalPrincipalSessionRequest$Type extends MessageType {
    constructor() {
        super("nimi.runtime.v1.OpenExternalPrincipalSessionRequest", [
            { no: 1, name: "app_id", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 2, name: "external_principal_id", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 3, name: "proof", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 4, name: "ttl_seconds", kind: "scalar", T: 5 /*ScalarType.INT32*/ }
        ]);
    }
    create(value) {
        const message = globalThis.Object.create((this.messagePrototype));
        message.appId = "";
        message.externalPrincipalId = "";
        message.proof = "";
        message.ttlSeconds = 0;
        if (value !== undefined)
            reflectionMergePartial(this, message, value);
        return message;
    }
    internalBinaryRead(reader, length, options, target) {
        let message = target ?? this.create(), end = reader.pos + length;
        while (reader.pos < end) {
            let [fieldNo, wireType] = reader.tag();
            switch (fieldNo) {
                case /* string app_id */ 1:
                    message.appId = reader.string();
                    break;
                case /* string external_principal_id */ 2:
                    message.externalPrincipalId = reader.string();
                    break;
                case /* string proof */ 3:
                    message.proof = reader.string();
                    break;
                case /* int32 ttl_seconds */ 4:
                    message.ttlSeconds = reader.int32();
                    break;
                default:
                    let u = options.readUnknownField;
                    if (u === "throw")
                        throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
                    let d = reader.skip(wireType);
                    if (u !== false)
                        (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
            }
        }
        return message;
    }
    internalBinaryWrite(message, writer, options) {
        /* string app_id = 1; */
        if (message.appId !== "")
            writer.tag(1, WireType.LengthDelimited).string(message.appId);
        /* string external_principal_id = 2; */
        if (message.externalPrincipalId !== "")
            writer.tag(2, WireType.LengthDelimited).string(message.externalPrincipalId);
        /* string proof = 3; */
        if (message.proof !== "")
            writer.tag(3, WireType.LengthDelimited).string(message.proof);
        /* int32 ttl_seconds = 4; */
        if (message.ttlSeconds !== 0)
            writer.tag(4, WireType.Varint).int32(message.ttlSeconds);
        let u = options.writeUnknownFields;
        if (u !== false)
            (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
        return writer;
    }
}
/**
 * @generated MessageType for protobuf message nimi.runtime.v1.OpenExternalPrincipalSessionRequest
 */
export const OpenExternalPrincipalSessionRequest = new OpenExternalPrincipalSessionRequest$Type();
// @generated message type with reflection information, may provide speed optimized methods
class OpenExternalPrincipalSessionResponse$Type extends MessageType {
    constructor() {
        super("nimi.runtime.v1.OpenExternalPrincipalSessionResponse", [
            { no: 1, name: "external_session_id", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 2, name: "expires_at", kind: "message", T: () => Timestamp },
            { no: 3, name: "session_token", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 4, name: "reason_code", kind: "enum", T: () => ["nimi.runtime.v1.ReasonCode", ReasonCode] }
        ]);
    }
    create(value) {
        const message = globalThis.Object.create((this.messagePrototype));
        message.externalSessionId = "";
        message.sessionToken = "";
        message.reasonCode = 0;
        if (value !== undefined)
            reflectionMergePartial(this, message, value);
        return message;
    }
    internalBinaryRead(reader, length, options, target) {
        let message = target ?? this.create(), end = reader.pos + length;
        while (reader.pos < end) {
            let [fieldNo, wireType] = reader.tag();
            switch (fieldNo) {
                case /* string external_session_id */ 1:
                    message.externalSessionId = reader.string();
                    break;
                case /* google.protobuf.Timestamp expires_at */ 2:
                    message.expiresAt = Timestamp.internalBinaryRead(reader, reader.uint32(), options, message.expiresAt);
                    break;
                case /* string session_token */ 3:
                    message.sessionToken = reader.string();
                    break;
                case /* nimi.runtime.v1.ReasonCode reason_code */ 4:
                    message.reasonCode = reader.int32();
                    break;
                default:
                    let u = options.readUnknownField;
                    if (u === "throw")
                        throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
                    let d = reader.skip(wireType);
                    if (u !== false)
                        (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
            }
        }
        return message;
    }
    internalBinaryWrite(message, writer, options) {
        /* string external_session_id = 1; */
        if (message.externalSessionId !== "")
            writer.tag(1, WireType.LengthDelimited).string(message.externalSessionId);
        /* google.protobuf.Timestamp expires_at = 2; */
        if (message.expiresAt)
            Timestamp.internalBinaryWrite(message.expiresAt, writer.tag(2, WireType.LengthDelimited).fork(), options).join();
        /* string session_token = 3; */
        if (message.sessionToken !== "")
            writer.tag(3, WireType.LengthDelimited).string(message.sessionToken);
        /* nimi.runtime.v1.ReasonCode reason_code = 4; */
        if (message.reasonCode !== 0)
            writer.tag(4, WireType.Varint).int32(message.reasonCode);
        let u = options.writeUnknownFields;
        if (u !== false)
            (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
        return writer;
    }
}
/**
 * @generated MessageType for protobuf message nimi.runtime.v1.OpenExternalPrincipalSessionResponse
 */
export const OpenExternalPrincipalSessionResponse = new OpenExternalPrincipalSessionResponse$Type();
// @generated message type with reflection information, may provide speed optimized methods
class RevokeExternalPrincipalSessionRequest$Type extends MessageType {
    constructor() {
        super("nimi.runtime.v1.RevokeExternalPrincipalSessionRequest", [
            { no: 1, name: "external_session_id", kind: "scalar", T: 9 /*ScalarType.STRING*/ }
        ]);
    }
    create(value) {
        const message = globalThis.Object.create((this.messagePrototype));
        message.externalSessionId = "";
        if (value !== undefined)
            reflectionMergePartial(this, message, value);
        return message;
    }
    internalBinaryRead(reader, length, options, target) {
        let message = target ?? this.create(), end = reader.pos + length;
        while (reader.pos < end) {
            let [fieldNo, wireType] = reader.tag();
            switch (fieldNo) {
                case /* string external_session_id */ 1:
                    message.externalSessionId = reader.string();
                    break;
                default:
                    let u = options.readUnknownField;
                    if (u === "throw")
                        throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
                    let d = reader.skip(wireType);
                    if (u !== false)
                        (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
            }
        }
        return message;
    }
    internalBinaryWrite(message, writer, options) {
        /* string external_session_id = 1; */
        if (message.externalSessionId !== "")
            writer.tag(1, WireType.LengthDelimited).string(message.externalSessionId);
        let u = options.writeUnknownFields;
        if (u !== false)
            (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
        return writer;
    }
}
/**
 * @generated MessageType for protobuf message nimi.runtime.v1.RevokeExternalPrincipalSessionRequest
 */
export const RevokeExternalPrincipalSessionRequest = new RevokeExternalPrincipalSessionRequest$Type();
/**
 * @generated ServiceType for protobuf service nimi.runtime.v1.RuntimeAuthService
 */
export const RuntimeAuthService = new ServiceType("nimi.runtime.v1.RuntimeAuthService", [
    { name: "RegisterApp", options: {}, I: RegisterAppRequest, O: RegisterAppResponse },
    { name: "OpenSession", options: {}, I: OpenSessionRequest, O: OpenSessionResponse },
    { name: "RefreshSession", options: {}, I: RefreshSessionRequest, O: RefreshSessionResponse },
    { name: "RevokeSession", options: {}, I: RevokeSessionRequest, O: Ack },
    { name: "RegisterExternalPrincipal", options: {}, I: RegisterExternalPrincipalRequest, O: RegisterExternalPrincipalResponse },
    { name: "OpenExternalPrincipalSession", options: {}, I: OpenExternalPrincipalSessionRequest, O: OpenExternalPrincipalSessionResponse },
    { name: "RevokeExternalPrincipalSession", options: {}, I: RevokeExternalPrincipalSessionRequest, O: Ack }
]);
//# sourceMappingURL=auth.js.map