@vercel/stega
A simple steganography library for adding hidden JSON data to strings.
Usage
This package exports a few methods for encoding and decoding data. All of these methods have TypeScript type definitions and JSDoc comments explaining their parameters and return values.
vercelStegaCombine(string, json, skip = 'auto')
This method combines a string with some JSON data and returns the result. The json can be any value that can be JSON stringified.
When the skip property is true, the original string will be returned without combining the json. It supports boolean values and 'auto'. The default is 'auto', which will only skip encoding when the string is an ISO date string or a URL.
vercelStegaCombine('Hello world', { foo: 'bar' });
vercelStegaEncode(json)
This method encodes JSON data as a hidden string and returns the result. The json can be any value that can be JSON stringified.
vercelStegaEncode({ foo: 'bar' });
vercelStegaSplit(string)
This method splits out the original string (cleaned) and the encoded portion of the string.
vercelStegaSplit('Hello world');
vercelStegaClean(json)
This method strips all encoded stega data from the value and returns the cleaned value. It accepts any JSON value.
vercelStegaClean('Hello world');
vercelStegaClean({
nested: {
value: 'Hello world',
},
});
vercelStegaDecode(string)
This method attempts to extract encoded JSON data from a string.
vercelStegaDecode('Hello world');