Skip to content

Encoding (Advanced)

Encoding is useful to prevent extension blockers from blocking your requests. It’s useless for network filters when making an interception proxy, since you intercept the requests and responses on the client and not the server, however extension filters can block your requests before they reach the SW.

The advantage of XOR encoding is that you can cypher. See this site for an explanation.

Base64 is simple and you can use native APIs.

  1. Add encode and decode methods to your configuration.
  2. Have these stringified when sent to the SW via your Controller APIs, as we discussed in Getting Started.
  3. Have your codebase use these methods defined on the config. Remember to eval the stringified version on the SW with new Function(), for when decoding in the SW, and then stringify it again for the injects.