Skip to content

This site describes solve-engine as it is on main: 2.43.0, which npm does not have yet. npm installs 2.40.0, so a page may show an answer that version does not give yet.

ENCODING_PACKAGE

const ENCODING_PACKAGE: IEnginePackage;

Defined in: packages/engine/src/packages/encoding/EncodingPackage.ts:56

Text encodings for developers: base64, URL and hex bytes, each with an encode (as) and a decode (from) direction (issue #188).

Encoding turns a piece of text into a safe, plain form for somewhere it has to travel, and decoding reads it back. as encodes, from decodes, so a value can be turned into a form on one line and recovered on the next, in the same note as the rest of the working. On by default and removable, like the other developer-facing packages.

hex bytes is spelled as two words on purpose: as hex already means a number shown in base 16, a different thing, so the byte encoding is kept separate and neither reading is ambiguous.

Two developer conveniences read a token apart rather than encode one: jwt(...) (also ... from jwt) decodes a JSON Web Token’s claims, and query(...) (also ... from query) parses a URL query string into JSON. jwt reads what a token says and never checks its signature, since verifying one needs the signing key and a calculator is the wrong place to imply a token is genuine.