import * as HttpClient from "@effect/platform/HttpClient";
import * as KeyValueStore from "@effect/platform/KeyValueStore";
import * as Effect from "effect/Effect";
import * as Option from "effect/Option";
import * as Redacted from "effect/Redacted";
import * as Schema from "effect/Schema";
import * as Model from "./Model.ts";
export declare const AUTH_PLATFORM_URL: URL;
export declare const AccessTokenDuration: Schema.Union<[typeof Schema.Number, typeof Schema.DateFromSelf, Schema.filter<typeof Schema.String>]>;
declare const GenerateAccessTokenRequest_base: Schema.Class<GenerateAccessTokenRequest, {
    duration: Schema.optionalWith<Schema.Union<[typeof Schema.Number, typeof Schema.DateFromSelf, Schema.filter<typeof Schema.String>]>, {
        nullable: true;
    }>;
    audience: Schema.optionalWith<Schema.Array$<typeof Schema.String>, {
        nullable: true;
    }>;
}, Schema.Struct.Encoded<{
    duration: Schema.optionalWith<Schema.Union<[typeof Schema.Number, typeof Schema.DateFromSelf, Schema.filter<typeof Schema.String>]>, {
        nullable: true;
    }>;
    audience: Schema.optionalWith<Schema.Array$<typeof Schema.String>, {
        nullable: true;
    }>;
}>, never, {
    readonly duration?: string | number | Date | undefined;
} & {
    readonly audience?: readonly string[] | undefined;
}, {}, {}>;
export declare class GenerateAccessTokenRequest extends GenerateAccessTokenRequest_base {
}
declare const GenerateAccessTokenResponse_base: Schema.Class<GenerateAccessTokenResponse, {
    token: typeof Schema.NonEmptyTrimmedString;
    token_type: Schema.Literal<["Bearer"]>;
    exp: Schema.filter<typeof Schema.Int>;
    sub: typeof Schema.NonEmptyTrimmedString;
    iss: typeof Schema.String;
}, Schema.Struct.Encoded<{
    token: typeof Schema.NonEmptyTrimmedString;
    token_type: Schema.Literal<["Bearer"]>;
    exp: Schema.filter<typeof Schema.Int>;
    sub: typeof Schema.NonEmptyTrimmedString;
    iss: typeof Schema.String;
}>, never, {
    readonly token: string;
} & {
    readonly sub: string;
} & {
    readonly iss: string;
} & {
    readonly token_type: "Bearer";
} & {
    readonly exp: number;
}, {}, {}>;
export declare class GenerateAccessTokenResponse extends GenerateAccessTokenResponse_base {
}
declare const GenerateAccessTokenError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }) => import("effect/Cause").YieldableError & {
    readonly _tag: "Amp/errors/auth/GenerateAccessTokenError";
} & Readonly<A>;
export declare class GenerateAccessTokenError extends GenerateAccessTokenError_base<{
    readonly error: string;
    readonly error_description: string;
    readonly status: number;
}> {
}
declare const RefreshTokenRequest_base: Schema.Class<RefreshTokenRequest, {
    refresh_token: Schema.brand<typeof Schema.NonEmptyTrimmedString, "RefreshToken">;
    user_id: Schema.filter<typeof Schema.NonEmptyTrimmedString>;
}, Schema.Struct.Encoded<{
    refresh_token: Schema.brand<typeof Schema.NonEmptyTrimmedString, "RefreshToken">;
    user_id: Schema.filter<typeof Schema.NonEmptyTrimmedString>;
}>, never, {
    readonly refresh_token: string & import("effect/Brand").Brand<"RefreshToken">;
} & {
    readonly user_id: string;
}, {}, {}>;
export declare class RefreshTokenRequest extends RefreshTokenRequest_base {
    static fromCache(cache: AuthStorageSchema): RefreshTokenRequest;
}
declare const RefreshTokenResponse_base: Schema.Class<RefreshTokenResponse, {
    token: Schema.refine<string, typeof Schema.Trimmed>;
    refresh_token: Schema.NullOr<typeof Schema.String>;
    session_update_action: typeof Schema.String;
    expires_in: Schema.refine<number, typeof Schema.Int>;
    user: Schema.Struct<{
        id: Schema.filter<typeof Schema.NonEmptyTrimmedString>;
        accounts: Schema.Array$<Schema.Union<[typeof Schema.NonEmptyTrimmedString, Schema.refine<`0x${string}`, Schema.Schema<string, string, never>>]>>;
    }>;
}, Schema.Struct.Encoded<{
    token: Schema.refine<string, typeof Schema.Trimmed>;
    refresh_token: Schema.NullOr<typeof Schema.String>;
    session_update_action: typeof Schema.String;
    expires_in: Schema.refine<number, typeof Schema.Int>;
    user: Schema.Struct<{
        id: Schema.filter<typeof Schema.NonEmptyTrimmedString>;
        accounts: Schema.Array$<Schema.Union<[typeof Schema.NonEmptyTrimmedString, Schema.refine<`0x${string}`, Schema.Schema<string, string, never>>]>>;
    }>;
}>, never, {
    readonly token: string;
} & {
    readonly refresh_token: string | null;
} & {
    readonly session_update_action: string;
} & {
    readonly expires_in: number;
} & {
    readonly user: {
        readonly id: string;
        readonly accounts: readonly string[];
    };
}, {}, {}>;
export declare class RefreshTokenResponse extends RefreshTokenResponse_base {
}
declare const AuthStorageSchema_base: Schema.Class<AuthStorageSchema, {
    accessToken: Schema.brand<typeof Schema.NonEmptyTrimmedString, "AccessToken">;
    refreshToken: Schema.brand<typeof Schema.NonEmptyTrimmedString, "RefreshToken">;
    userId: Schema.filter<typeof Schema.NonEmptyTrimmedString>;
    accounts: Schema.optional<Schema.Array$<Schema.Union<[typeof Schema.NonEmptyTrimmedString, Schema.refine<`0x${string}`, Schema.Schema<string, string, never>>]>>>;
    expiry: Schema.optional<Schema.filter<typeof Schema.Int>>;
}, Schema.Struct.Encoded<{
    accessToken: Schema.brand<typeof Schema.NonEmptyTrimmedString, "AccessToken">;
    refreshToken: Schema.brand<typeof Schema.NonEmptyTrimmedString, "RefreshToken">;
    userId: Schema.filter<typeof Schema.NonEmptyTrimmedString>;
    accounts: Schema.optional<Schema.Array$<Schema.Union<[typeof Schema.NonEmptyTrimmedString, Schema.refine<`0x${string}`, Schema.Schema<string, string, never>>]>>>;
    expiry: Schema.optional<Schema.filter<typeof Schema.Int>>;
}>, never, {
    readonly accessToken: string & import("effect/Brand").Brand<"AccessToken">;
} & {
    readonly refreshToken: string & import("effect/Brand").Brand<"RefreshToken">;
} & {
    readonly userId: string;
} & {
    readonly accounts?: readonly string[] | undefined;
} & {
    readonly expiry?: number | undefined;
}, {}, {}>;
export declare class AuthStorageSchema extends AuthStorageSchema_base {
}
declare const AuthTokenExpiredError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }) => import("effect/Cause").YieldableError & {
    readonly _tag: "Amp/errors/auth/AuthTokenExpiredError";
} & Readonly<A>;
export declare class AuthTokenExpiredError extends AuthTokenExpiredError_base {
}
declare const AuthRateLimitError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }) => import("effect/Cause").YieldableError & {
    readonly _tag: "Amp/errors/auth/AuthRateLimitError";
} & Readonly<A>;
export declare class AuthRateLimitError extends AuthRateLimitError_base<{
    readonly retryAfter: number;
    readonly message: string;
}> {
}
declare const AuthRefreshError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }) => import("effect/Cause").YieldableError & {
    readonly _tag: "Amp/errors/auth/AuthRefreshError";
} & Readonly<A>;
export declare class AuthRefreshError extends AuthRefreshError_base<{
    readonly status: number;
    readonly message: string;
}> {
}
declare const AuthUserMismatchError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }) => import("effect/Cause").YieldableError & {
    readonly _tag: "Amp/errors/auth/AuthUserMismatchError";
} & Readonly<A>;
export declare class AuthUserMismatchError extends AuthUserMismatchError_base<{
    readonly expected: string;
    readonly received: string;
}> {
}
declare const VerifySignedAccessTokenError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }) => import("effect/Cause").YieldableError & {
    readonly _tag: "Amp/errors/auth/VerifySignedAccessTokenError";
} & Readonly<A>;
export declare class VerifySignedAccessTokenError extends VerifySignedAccessTokenError_base<{
    readonly cause: unknown;
}> {
}
declare const AuthService_base: Effect.Service.Class<AuthService, "Amp/AuthService", {
    readonly dependencies: readonly [import("effect/Layer").Layer<KeyValueStore.KeyValueStore, import("@effect/platform/Error").PlatformError, import("@effect/platform/Path").Path | import("@effect/platform/FileSystem").FileSystem>, import("effect/Layer").Layer<HttpClient.HttpClient, never, never>];
    readonly effect: Effect.Effect<{
        readonly generateAccessToken: (args: {
            readonly storedAuth: AuthStorageSchema;
            readonly exp: Model.GenrateTokenDuration | undefined;
            readonly audience: ReadonlyArray<string> | null | undefined;
        }) => Effect.Effect<GenerateAccessTokenResponse, GenerateAccessTokenError | import("@effect/platform/HttpClientError").HttpClientError | import("effect/ParseResult").ParseError, never>;
        readonly refreshAccessToken: (cache: AuthStorageSchema) => Effect.Effect<AuthStorageSchema, import("@effect/platform/Error").PlatformError | AuthTokenExpiredError | AuthRateLimitError | AuthRefreshError | AuthUserMismatchError | import("@effect/platform/HttpClientError").HttpClientError | import("effect/ParseResult").ParseError | import("effect/Cause").TimeoutException, never>;
        readonly verifySignedAccessToken: (token: Redacted.Redacted<string>, issuer: string) => Effect.Effect<string, VerifySignedAccessTokenError, never>;
        readonly getCache: () => Effect.Effect<Option.Option<AuthStorageSchema>, never, never>;
        readonly setCache: (cache: AuthStorageSchema) => Effect.Effect<void, import("@effect/platform/Error").PlatformError | import("effect/ParseResult").ParseError, never>;
        readonly clearCache: Effect.Effect<void, import("@effect/platform/Error").PlatformError, never>;
    }, never, KeyValueStore.KeyValueStore | HttpClient.HttpClient>;
}>;
export declare class AuthService extends AuthService_base {
}
export declare const layer: import("effect/Layer").Layer<AuthService, import("@effect/platform/Error").PlatformError, import("@effect/platform/Path").Path | import("@effect/platform/FileSystem").FileSystem>;
export {};
//# sourceMappingURL=Auth.d.ts.map