import type { CBORSchemaType, ExtendableMapSchema, FieldDefinition, MapSchemaType } from "./type.js"; /** * Creates a schema for CBOR maps that decode to TypeScript objects * * @template Fields Array of field definitions * @param fields Array of field definitions describing the map structure * * @example * ```typescript * import { cs } from "../cbor_schema.ts"; * const cwtSchema = cs.map([ * cs.numberField(1, "iss", cs.string), // issuer * cs.numberField(4, "exp", cs.integer), // expiration time * cs.numberField(7, "cti", cs.bytes), // CWT ID * cs.field("cty", cs.optional(cs.string)) // content type (string key) * ]); * * const claims = { * iss: "example-issuer", * exp: 1_725_000_000, * cti: new Uint8Array([0x01, 0x02, 0x03]) * }; * * const encoded = cs.toCBOR(cwtSchema, claims); * const decoded = cs.fromCBOR(cwtSchema, encoded); * ``` */ export declare function map[]>(fields: Fields): ExtendableMapSchema>; /** * Creates a field definition for use in map schemas with a string key * * @template T The type of the field value * @template K The literal string type for the JavaScript property name * @param key The CBOR key as a string * @param schema Schema for the field value * * @example * ```typescript * import { cs } from "../cbor_schema.ts"; * const contentTypeField = cs.field("cty", cs.string); * const kidHeaderField = cs.field("kid", cs.optional(cs.bytes)); * ``` */ export declare function field(key: K, schema: CBORSchemaType): FieldDefinition; /** * Creates a field definition for use in map schemas with a numeric key * * @template T The type of the field value * @template K The literal string type for the JavaScript property name * @param key The CBOR key as a number * @param jsKey The JavaScript property name to use * @param schema Schema for the field value * * @example * ```typescript * import { cs } from "../cbor_schema.ts"; * const ktyField = cs.numberField(1, "kty", cs.integer); * const algField = cs.numberField(3, "alg", cs.integer); * ``` */ export declare function numberField(key: number, jsKey: K, schema: CBORSchemaType): FieldDefinition; //# sourceMappingURL=map.d.ts.map