Skip to content

Commit

Permalink
Use btoa inside worker. Keep using Buffer inside sandbox.
Browse files Browse the repository at this point in the history
  • Loading branch information
dompuiu committed Aug 28, 2023
1 parent 211e383 commit 5950f9e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion extension.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"name": "twitter-connector-edge",
"iconPath": "resources/icons/twitter-logo.svg",
"platform": "edge",
"version": "1.0.0",
"version": "1.0.1",
"description": "Forward data to Twitter by using the Twitter Ads API.",
"author": {
"name": "Adobe",
Expand Down
6 changes: 4 additions & 2 deletions src/lib/actions/helpers/getAuthorizationToken.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,10 @@ const generateSignature = async (signKey, signatureBaseString) => {
// than String.fromCharCode.
// const digest = new TextDecoder().decode(new Uint8Array(signature));
const digest = String.fromCharCode(...new Uint8Array(signature));

return encodeURIComponent(Buffer.from(digest, 'binary').toString('base64'));
const base64Digest = btoa
? btoa(digest)
: Buffer.from(digest, 'binary').toString('base64');
return encodeURIComponent(base64Digest);
};

module.exports = async (
Expand Down

0 comments on commit 5950f9e

Please sign in to comment.