emvco-qr-sdk
Version:
A robust TypeScript SDK for decoding, validating, and processing EMVCo-compliant QR codes used in digital payment systems.
35 lines (34 loc) • 1.29 kB
TypeScript
/**
* Represents a single TLV (Tag-Length-Value) structure used in QR codes or similar encoding formats.
*
* This entity encapsulates the fundamental components of a TLV:
* - A tag (identifier)
* - A value
* - Its corresponding length (in characters)
*
* Optionally, a TLV may contain nested sub-tags (subTags), allowing for hierarchical data structures.
*/
export declare class TlvEntity {
/** The tag identifier (2-digit or more hexadecimal string). */
readonly tag: string;
/** The length of the value in characters. */
readonly length: number;
/** The raw value associated with the tag. */
readonly value: string;
/** Optional nested TLVs contained within this TLV's value (for composite TLVs). */
readonly subTags?: TlvEntity[];
/**
* Creates a new TLV entity.
*
* @param tag - The tag that identifies the data field.
* @param value - The raw value associated with the tag.
* @param subTags - (Optional) Nested TLV entities parsed from the value.
*/
constructor(tag: string, value: string, subTags?: TlvEntity[]);
/**
* Serializes the TLV entity back into its string representation.
*
* @returns A string in the format: TAG + LENGTH (2 digits) + VALUE.
*/
toString(): string;
}