UNPKG

@fairfox/zws

Version:

Zero-width steganography utilities for invisibly embedding data in text using Unicode zero-width characters

35 lines (34 loc) 1.24 kB
/** * Zero-Width Steganography Utils * Invisible data embedding using zero-width Unicode characters. * * Embed arbitrary BMP-range string data into visible text using zero-width * Unicode characters. The embedded data is invisible to humans but trivially * recoverable programmatically. */ export type EmbedPosition = 'end' | 'after-first-sentence'; export type EmbedOptions = { position?: EmbedPosition; }; declare function hasEmbeddedData(text: string): boolean; declare function embed(text: string, data: string, options?: EmbedOptions): string; declare function extract(text: string): string; declare function extractAll(text: string): string[]; declare function getCleanText(text: string): string; declare function encodeData(data: string): string; declare function decodeData(encodedBinary: string): string; declare const zws: { START_MARKER: string; ZERO_BIT: string; ONE_BIT: string; MAX_DATA_LENGTH: number; MAX_ENCODED_LENGTH: number; hasEmbeddedData: typeof hasEmbeddedData; embed: typeof embed; extract: typeof extract; extractAll: typeof extractAll; getCleanText: typeof getCleanText; encodeData: typeof encodeData; decodeData: typeof decodeData; }; export default zws;