/** @deprecated Use `asStrictBytes` from `@oh-my-pi/pi-utils`. */ export { asStrictBytes as asStrict } from "@oh-my-pi/pi-utils/bytes"; export interface AwsCredentials { accessKeyId: string; secretAccessKey: string; sessionToken?: string; } export interface SignParams { method: string; /** Hostname only — used to build the `host` header and the canonical request. */ host: string; /** URI path component, e.g. `/model/anthropic.claude/converse-stream`. */ path: string; /** Optional pre-built query string (without leading `?`). */ query?: string; /** Extra headers to sign in addition to `host`/`x-amz-*`. Names are case-insensitive. */ headers?: Record; body: Uint8Array; region: string; service: string; credentials: AwsCredentials; /** Override clock for deterministic tests. */ date?: Date; } export declare function toHex(bytes: Uint8Array): string; export declare function sha256(data: Uint8Array | string): Promise; export declare function sha256Hex(data: Uint8Array | string): Promise; /** * Derive a signing key: HMAC chain `kSecret → kDate → kRegion → kService → kSigning`. */ export declare function getSigningKey(secretAccessKey: string, shortDate: string, region: string, service: string): Promise; /** `YYYYMMDDTHHMMSSZ` + 8-char `YYYYMMDD`. */ export declare function formatAmzDate(d: Date): { longDate: string; shortDate: string; }; /** * AWS's canonical-request spec encodes each name/value first, THEN sorts by * the encoded form ("Sort the encoded parameter names by character code" — * https://docs.aws.amazon.com/IAM/latest/UserGuide/create-canonical-request.html). * Sorting the decoded form instead gives the wrong order whenever encoding * changes a character's relative position — e.g. raw key `%7B` (decodes to * `{`, 0x7B) vs `x` (0x78): decoded, `x` < `{`; encoded, `%` (0x25) < `x`, so * `%7B` sorts first. A gateway that validates SigV4 (or AWS itself) computes * the signature over ITS OWN canonicalization and rejects ours if the two * disagree on order. */ export declare function canonicalQuery(query: string | undefined): string; export interface SignedHeaders { host: string; "x-amz-date": string; "x-amz-content-sha256": string; authorization: string; "x-amz-security-token"?: string; } export declare function signRequest(params: SignParams): Promise;