Skip to content

Commit

Permalink
add compatability: browser can decode base64encoded magic link
Browse files Browse the repository at this point in the history
  • Loading branch information
oleggrib authored and Weiwu Zhang committed Jan 6, 2021
1 parent 517e0d4 commit 79cc879
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/main/javascript/SignedDevonTicket.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,13 @@ export class SignedDevconTicket {
.split('-').join('/')
.split('.').join('=');

source = Uint8Array.from(Buffer.from(base64str, 'base64')).buffer;
// source = Uint8Array.from(Buffer.from(base64str, 'base64')).buffer;
if (typeof Buffer !== 'undefined') {
source = Uint8Array.from(Buffer.from(base64str, 'base64')).buffer;
} else {
source = Uint8Array.from(atob(base64str), c => c.charCodeAt(0)).buffer;
}

}
if (source instanceof ArrayBuffer) {
const asn1 = fromBER(source);
Expand Down

0 comments on commit 79cc879

Please sign in to comment.