/** * @import {PayloadSpec} from './types.js' */ /** * Create the signature payload for a given envelope * * @param {import('./types.js').DecodedEnvelope} envelope * @returns */ export function signaturePayload(envelope: import("./types.js").DecodedEnvelope): { [x: string]: import("./types.js").InvocationPayload | import("./types.js").DelegationPayload | Uint8Array; h: Uint8Array; }; export function nowInSeconds(): number; /** * * @param {import('./types.js').DecodedEnvelope} envelope */ export function cid(envelope: import("./types.js").DecodedEnvelope): Promise>; /** * Check if a DID and signature type are compatible * * @param {import('iso-did/types').VerifiableDID} did * @param {import('iso-signatures/types').SignatureType} sigType */ export function isSigAndDidCompatible(did: import("iso-did/types").VerifiableDID, sigType: import("iso-signatures/types").SignatureType): boolean; /** * Validate the expiration of a UCAN * * @param {number | null} exp * @param {number} [now] */ export function assertExpiration(exp: number | null, now?: number): void; /** * Validate the not before time of a UCAN * * @param {number} [nbf] * @param {number} [now] */ export function assertNotBefore(nbf?: number, now?: number): void; /** * Validate the issuer and signature of a UCAN * * @param {import('./types.js').DecodedEnvelope} envelope * @param {import('iso-did').Resolver} [didResolver] */ export function validateIssuerAndSignature(envelope: import("./types.js").DecodedEnvelope, didResolver?: import("iso-did").Resolver): Promise; /** * Verify the signature of a UCAN and that issuer is compatible with the signature * * @param {import('./types.js').DecodedEnvelope} envelope * @param {import('iso-signatures/verifiers/resolver.js').Resolver} signatureVerifierResolver * @param {import('iso-did').Resolver} [didResolver] */ export function verifySignature(envelope: import("./types.js").DecodedEnvelope, signatureVerifierResolver: import("iso-signatures/verifiers/resolver.js").Resolver, didResolver?: import("iso-did").Resolver): 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 "//"). * * @param {string} command The command string to validate. * @throws {Error} If the command is syntactically invalid. * @returns {void} Does not return a value on success. */ export function assertIsValidCommand(command: string): void; /** * Assert that the input is a Uint8Array. * * @param {unknown} nonce The value to check. * @throws {Error} If nonce is not a Uint8Array. * @returns {void} * * @example * ```ts twoslash * import { assertNonce } from 'iso-ucan/utils' * assertNonce(new Uint8Array([1,2,3])) // ok * assertNonce('foo') // throws * ``` */ export function assertNonce(nonce: unknown): void; /** * Assert that args is a CBOR serializable object. * * @param {unknown} args */ export function assertArgs(args: unknown): void; /** * Assert that the input is a Record. * * @param {unknown} meta - The value to check. * @throws {Error} If meta is not a Record. * @returns {void} */ export function assertMeta(meta: unknown): void; /** * Assert that the input is not revoked. * * @param {import('multiformats/cid').CID} cid * @param {(cid: CID) => Promise} [isRevokedFn] */ export function assertNotRevoked(cid: import("multiformats/cid").CID, isRevokedFn?: (cid: CID) => Promise): Promise; /** * Expiration or TTL (default 300 seconds) * * @param {object} options * @param {number | null} [options.exp] * @param {number} [options.ttl] */ export function expOrTtl({ exp, ttl }: { exp?: number | null | undefined; ttl?: number | undefined; }): number | null; /** * @param {unknown} policy */ export function assertPolicy(policy: unknown): void; /** * A type guard for Record. * * @param {unknown} value - The value to check. * @returns {value is Record} Whether the specified value has a runtime type of `object` and is * neither `null` nor an `Array`. */ export function isObject(value: unknown): value is Record; export const cborValue: z.ZodLazy>>; export const cborObject: z.ZodRecord>>>; export const selector: z.ZodUnion, z.ZodTemplateLiteral<`.${string}`>]>; /** * @typedef {z.infer} Selector */ /** * Statement */ export const statement: z.ZodLazy, any, z.core.$ZodTypeInternals, any>>>; export const policySchema: z.ZodArray, any, z.core.$ZodTypeInternals, any>>>>; export type Selector = z.infer; import type { PayloadSpec } from './types.js'; import { CID } from 'multiformats/cid'; import { DID } from 'iso-did'; import { z } from 'zod/v4'; //# sourceMappingURL=utils.d.ts.map