Encoder.js is a text encoder for encrypting data. Encoder.js encodes text into a string that can contain only URL-safe characters (A-Za-z0-9 and -_().~). Encoder.js is designed for browsers (client-side, JavaScript) and server-side (JavaScript or TypeScript), but Encoder.js is incompatible with Node.js, React.js, Next.js, etc.
How to use
Import encode and decode functions:
1
import { encode, decode } from "https://encoder.js.is-a.dev/encoder.js@1.0.1.js";
A function for encoding text. Required input data: text - the text to be encoded, type: string. Optional input data: key - encryption key, type: string; compress - whether to compress text (if possible), type: boolean. Output data type: string.
Important: Encoding without a key or encoding with a key that looks like text or contains parts of text is not a good idea.
decode()
A function for decoding text. Required input data: text - the text to be decoded, type: string. Optional input data: key - encryption key, type: string. Output data type: string.
This function may throw an error if text in the input data is encoded incorrectly, or if it was encoded in a different Encoder.js version that is incompatible with the Encoder.js version you are using.