try without encoding maybe?

This commit is contained in:
Roberto Hidalgo 2023-01-04 16:07:10 -06:00
parent f558a35d3d
commit e57ebc7108
1 changed files with 1 additions and 1 deletions

View File

@ -3,7 +3,7 @@
import * as webauthnJSON from 'https://unpkg.com/@github/webauthn-json@2.0.2/dist/esm/webauthn-json.browser-ponyfill.js'
const charsToEncode = /[\u007f-\uffff]/g;
function JSONtob64(data) {
return btoa(encodeURIComponent(JSON.stringify(data).replace(charsToEncode, (c) => '\\u'+('000'+c.charCodeAt(0).toString(16)).slice(-4))))
return btoa(JSON.stringify(data).replace(charsToEncode, (c) => '\\u'+('000'+c.charCodeAt(0).toString(16)).slice(-4)))
}
function b64ToJSON(encoded) {