base64url encoding for IIIF Content State

This demo shows the proposed mechanism for encoding a content state when sent as a request parameter. But can it be simpler? Shorter? Safer? What have we missed? Are there better ways?
Try out some strings below to experiment.

What is IIIF Content State? | Content State Specification | Source code for this experiment on GitHub



(Content State 0.9)
(Content State 0.9)

Client plaintext

Client encoded

Server plaintext

Server encoded