Encode

Defined a string as Hello Sphinx!, and we’re going to encode it.

let base64URL = new Sphinx().encrypt('Hello Sphinx!')

Then the base64 url is equal to

data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAMAAAADCAYAAABWKLW/AAAAJklEQVQYV2P0SM35r8K1heE5owcDY2Zexf8dc1Yw/BdjYGBkQAIA+r4JjQKvLx4AAAAASUVORK5CYII=

, the string information has encoded to an image successfully.

As you see, the encode() function returns a base64 url of an image.