import type { VerifiableDID } from 'iso-did/types'; import type { SignatureType } from 'iso-signatures/types'; import type { Resolver } from 'iso-signatures/verifiers/resolver.js'; import type { Resolver as DidResolver } from 'iso-did'; import type { CID } from 'multiformats/cid'; import { z } from 'zod/v4'; import type { PayloadSpec, DecodedEnvelope, CborValue, Statement, SignaturePayload } from './types.js'; /** * Create the signature payload for a given envelope */ export declare function signaturePayload(envelope: DecodedEnvelope): SignaturePayload; export declare function nowInSeconds(): number; export declare function cid(envelope: DecodedEnvelope): Promise; /** * Check if a DID and signature type are compatible */ export declare function isSigAndDidCompatible(did: VerifiableDID, sigType: SignatureType): boolean; /** * Validate the expiration of a UCAN */ export declare function assertExpiration(exp: number | null): void; /** * Validate the not before time of a UCAN */ export declare function assertNotBefore(nbf?: number): void; /** * Validate the issuer and signature of a UCAN */ export declare function validateIssuerAndSignature(envelope: DecodedEnvelope, didResolver?: DidResolver): Promise; /** * Verify the signature of a UCAN and that issuer is compatible with the signature */ export declare function verifySignature(envelope: DecodedEnvelope, signatureVerifierResolver: Resolver, didResolver?: DidResolver): Promise; /** * Asserts that a UCAN command string is syntactically valid. * If the command is invalid, it throws a descriptive error. * * Rules: * - Commands MUST begin with a slash (/). * - Commands MUST be lowercase. * - A trailing slash MUST NOT be present, unless the command is exactly "/". * - Segments MUST be separated by a slash (e.g., no empty segments like "//"). * * @throws Error if the command is syntactically invalid. */ export declare function assertIsValidCommand(command: string): void; /** * Assert that the input is a Uint8Array. * * @throws Error if nonce is not a Uint8Array. * * @example * ```ts twoslash * import { assertNonce } from 'iso-ucan/utils' * assertNonce(new Uint8Array([1,2,3])) // ok * assertNonce('foo') // throws * ``` */ export declare function assertNonce(nonce: unknown): void; /** * Assert that args is a CBOR serializable object. */ export declare function assertArgs(args: unknown): void; /** * Assert that the input is a Record. * * @throws Error if meta is not a Record. */ export declare function assertMeta(meta: unknown): void; /** * Assert that the input is not revoked. */ export declare function assertNotRevoked(cid: CID, isRevokedFn?: (cid: CID) => Promise): Promise; /** * Expiration or TTL (default 300 seconds) */ export declare function expOrTtl({ exp, ttl }: { exp?: number | null; ttl?: number; }): number | null; export declare const cborValue: z.ZodType; export declare const cborObject: z.ZodRecord>>; export declare const selector: z.ZodUnion, z.ZodString]>; export type Selector = z.infer; /** * Statement */ export declare const statement: z.ZodType>; export declare const policySchema: z.ZodArray, unknown, z.core.$ZodTypeInternals, unknown>>>; export declare function assertPolicy(policy: unknown): void; /** * A type guard for Record. * * @returns Whether the specified value has a runtime type of `object` and is * neither `null` nor an `Array`. */ export declare function isObject(value: unknown): value is Record; //# sourceMappingURL=util.d.ts.map