UNPKG

everything-dev

Version:

A consolidated product package for building Module Federation apps with oRPC APIs.

67 lines • 3.23 kB
import { ZodType } from "zod"; import { Context, Effect, Layer } from "effect"; //#region src/services/verify/engine.d.ts declare const IntegrityMismatch_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & { readonly _tag: "IntegrityMismatch"; } & Readonly<A>; declare class IntegrityMismatch extends IntegrityMismatch_base<{ readonly url: string; readonly expected: string; readonly actual: string; }> {} declare const ProvenanceUnknown_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & { readonly _tag: "ProvenanceUnknown"; } & Readonly<A>; declare class ProvenanceUnknown extends ProvenanceUnknown_base<{ readonly url: string; readonly cause: unknown; readonly status?: number; }> {} declare const SignatureInvalid_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & { readonly _tag: "SignatureInvalid"; } & Readonly<A>; declare class SignatureInvalid extends SignatureInvalid_base<{ readonly url: string; readonly reason: string; }> {} type VerifyError = IntegrityMismatch | ProvenanceUnknown | SignatureInvalid; declare const isVerifyError: (error: unknown) => error is VerifyError; declare const verified: unique symbol; type Verified<T> = T & { readonly [verified]: true; }; declare const mark: <T>(value: T) => Verified<T>; type Digest = `sha384-${string}`; declare const asDigest: (sri: string) => Digest; type VerifiedBytes = Verified<Uint8Array>; interface VerifyCallOptions { readonly fetchImpl?: typeof fetch; readonly cache?: boolean; } interface VerifierShape { readonly fetchVerified: (url: string, expected: Digest, options?: VerifyCallOptions) => Effect.Effect<VerifiedBytes, VerifyError>; readonly verifyDocument: <T>(url: string, expected: Digest, schema: ZodType<T>, options?: VerifyCallOptions) => Effect.Effect<Verified<T>, VerifyError>; readonly clear: () => void; } declare const clearVerifiedCache: () => void; declare const computeSri: (content: string | Uint8Array) => Digest; declare const Verifier_base: Context.ServiceClass<Verifier, "everything-dev/verify/Verifier", VerifierShape>; declare class Verifier extends Verifier_base { static readonly layer: Layer.Layer<Verifier>; } declare const fetchVerified: (input: { url: string; expected: Digest; fetchImpl?: typeof fetch; cache?: boolean; }) => Promise<VerifiedBytes>; declare const verifyDocument: <T>(input: { url: string; expected: Digest; schema: ZodType<T>; fetchImpl?: typeof fetch; cache?: boolean; }) => Promise<Verified<T>>; //#endregion export { Digest, IntegrityMismatch, ProvenanceUnknown, SignatureInvalid, Verified, VerifiedBytes, Verifier, VerifierShape, VerifyCallOptions, VerifyError, asDigest, clearVerifiedCache, computeSri, fetchVerified, isVerifyError, mark, verified, verifyDocument }; //# sourceMappingURL=engine.d.cts.map