UNPKG

cesr

Version:

[![NPM Version](https://img.shields.io/npm/v/cesr.svg?style=flat)](https://www.npmjs.com/package/cesr) [![NPM License](https://img.shields.io/npm/l/cesr.svg?style=flat)](https://github.com/lenkan/cesr-js/blob/main/LICENSE) [![CI](https://github.com/lenkan

61 lines (60 loc) 2.09 kB
import { type Frame, type FrameSize, type ReadResult } from "./frame.ts"; export interface IndexerInit { code: string; raw: Uint8Array; index: number; ondex?: number; } type IndexCodeTableEntry = FrameSize & { os: number; }; export declare class Indexer implements IndexerInit, Frame { readonly code: string; readonly index: number; readonly ondex?: number; readonly raw: Uint8Array; constructor(init: IndexerInit); get quadlets(): number; get soft(): number; get size(): IndexCodeTableEntry; text(): string; binary(): Uint8Array; static readonly Code: { Ed25519_Sig: string; Ed25519_Crt_Sig: string; ECDSA_256k1_Sig: string; ECDSA_256k1_Crt_Sig: string; ECDSA_256r1_Sig: string; ECDSA_256r1_Crt_Sig: string; Ed448_Sig: string; Ed448_Crt_Sig: string; Ed25519_Big_Sig: string; Ed25519_Big_Crt_Sig: string; ECDSA_256k1_Big_Sig: string; ECDSA_256k1_Big_Crt_Sig: string; ECDSA_256r1_Big_Sig: string; ECDSA_256r1_Big_Crt_Sig: string; Ed448_Big_Sig: string; Ed448_Big_Crt_Sig: string; }; static peek(input: Uint8Array): ReadResult<Indexer>; static parse(input: string | Uint8Array): Indexer; /** * Create a new Indexer frame. * * Note: It is recommended to use the helper methods in `Indexer.crypto` instead to ensure * the correct code is used for the signature type. * * @param code The Indexer code, see {@link Indexer.Code} * @param raw The raw signature bytes * @param index The main index of the signature * @param ondex The optional secondary index of the signature */ static from(code: string, raw: Uint8Array, index: number, ondex?: number): Indexer; static readonly crypto: { ed25519_sig(raw: Uint8Array, index: number, ondex?: number): Indexer; ed448_sig(raw: Uint8Array, index: number, ondex?: number): Indexer; ecdsa_256k1_sig(raw: Uint8Array, index: number): Indexer; }; } export {};