// tslint:disable-next-line:no-unsafe-any
return decodeURIComponent(Array.prototype.map.call(base64decode(str.replace(/-/g, '+').replace(/_/g, '/')), (c: string) => {
return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2);
}).join(''));
Originally posted by @IvanPizhenko in FlowCrypt/flowcrypt-android#1057 (comment)