import { Address, Hex } from 'viem'; export { e as encodeWebAuthnSignature, q as hashMessage, k as isTestnet, v as verifyMessageHash } from './verify-CEzkfM92.mjs'; export { W as WebAuthnSignature } from './types-BN6cCuAd.mjs'; import '@rhinestone/sdk'; /** * Server-side utilities for JWT sponsorship. * * The recommended entry point is `createSponsorshipSigner`, a * framework-agnostic factory that reads credentials from environment * variables and exposes the two operations each sponsorship endpoint * needs: `accessToken()` and `extensionToken(intentOp)`. * * For custom claims or non-standard flows, `createJwtSigner` is exposed as * an escape hatch. The implementation lives here instead of re-exporting * `@rhinestone/sdk/jwt-server` directly so downstream app builds do not need * to resolve the SDK's optional Express adapter surface. * * @example Next.js App Router * ```ts * // app/api/sponsorship/access-token/route.ts * import { createSponsorshipSigner } from "@rhinestone/1auth/server"; * * const signer = createSponsorshipSigner(); * * export async function GET() { * // Guard with your own session/auth before minting. * return Response.json({ token: await signer.accessToken() }); * } * ``` */ interface JwtCredentials { privateKey: JsonWebKey; integratorId: string; projectId: string; appId: string; keyId: string; audience?: string; } interface SponsorshipFilter { chain?: (chain: { id: number; }) => boolean | Promise; account?: (address: Address) => boolean | Promise; calls?: (calls: { to: Address; value: bigint; data: Hex; }[]) => boolean | Promise; } interface JwtSignerConfig { jwt: JwtCredentials; shouldSponsor?: SponsorshipFilter; } declare class SponsorshipDeniedError extends Error { constructor(); } /** * Sponsorship signer used by the two endpoints the SDK client calls: * * - `accessToken()` — mints the app's identity token; return as * `{ token }` from `GET /sponsorship/access-token`. * - `extensionToken(intentOp)` — mints a per-intent sponsorship grant; * return as `{ token }` from `POST /sponsorship/extension-token`. * Accepts either the JSON-stringified `intentOp` the SDK sends or a * pre-parsed object. */ interface SponsorshipSigner { accessToken(): Promise; extensionToken(intentOp: string | object): Promise; } interface CreateSponsorshipSignerOptions { /** Override all credentials explicitly (skips env lookup). */ credentials?: JwtCredentials; /** Override the env source (defaults to `process.env`). */ env?: NodeJS.ProcessEnv; /** Optional per-intent sponsorship filter (see `@rhinestone/sdk/jwt-server`). */ shouldSponsor?: SponsorshipFilter; } interface VerifyOneAuthAccountOptions { /** 1auth provider origin, for example `https://passkey.1auth.app`. */ providerUrl: string; /** Smart account address returned by a successful 1auth auth result. */ address: Address; /** Optional app client id forwarded to provider APIs that scope by app. */ clientId?: string; /** Injectable fetch implementation for tests and non-standard runtimes. */ fetch?: typeof fetch; } interface VerifiedOneAuthAccount { address: Address; deployed?: boolean; chainId?: number; } /** Error raised when the provider cannot bind an address to a 1auth account. */ declare class OneAuthAccountVerificationError extends Error { constructor(message: string); } /** * Verify that an address belongs to a 1auth account known by the configured * provider. This is intended for server-side app sessions that already have a * fresh challenge signature and need to reject arbitrary ERC-1271 contracts. */ declare function verifyOneAuthAccount(options: VerifyOneAuthAccountOptions): Promise; /** * Create a low-level JWT signer compatible with Rhinestone sponsorship flows. * * This mirrors the upstream SDK behavior while keeping our public server entry * point self-contained for app bundlers. */ declare function createJwtSigner(config: JwtSignerConfig): { accessToken: () => Promise; getIntentExtensionToken: (intentInput: unknown) => Promise; }; declare function createSponsorshipSigner(options?: CreateSponsorshipSignerOptions): SponsorshipSigner; export { type CreateSponsorshipSignerOptions, type JwtCredentials, type JwtSignerConfig, OneAuthAccountVerificationError, SponsorshipDeniedError, type SponsorshipFilter, type SponsorshipSigner, type VerifiedOneAuthAccount, type VerifyOneAuthAccountOptions, createJwtSigner, createSponsorshipSigner, verifyOneAuthAccount };