@hpke/ohttp
Version:
Oblivious HTTP (RFC 9458) client and server using HPKE
30 lines • 956 B
TypeScript
/**
* QUIC variable-length integer encoding (RFC 9000 Section 16), used by
* Binary HTTP (RFC 9292) for all length and integer fields.
*
* Values are limited to `Number.MAX_SAFE_INTEGER` since they are handled as
* JavaScript numbers.
*
* @module
*/
/**
* Returns the number of bytes needed to encode `v` as a varint.
*/
export declare function varintLength(v: number): 1 | 2 | 4 | 8;
/**
* Writes `v` as a varint into `buf` at `offset`.
*
* @returns The offset just after the written varint.
*/
export declare function writeVarint(buf: Uint8Array, offset: number, v: number): number;
/**
* Encodes `v` as a varint.
*/
export declare function encodeVarint(v: number): Uint8Array;
/**
* Reads a varint from `buf` at `offset`.
*
* @returns A tuple of the decoded value and the offset just after it.
*/
export declare function readVarint(buf: Uint8Array, offset: number): [value: number, next: number];
//# sourceMappingURL=varint.d.ts.map