@@ -202,7 +202,11 @@ function base64urlToUint8array(base64Bytes) {
202
202
return base64js.toByteArray((base64Bytes + padding).replace(/\//g, "_").replace(/\+/g, "-"));
203
203
}
204
204
function uint8arrayToBase64url(bytes) {
205
- return base64js.fromByteArray(bytes).replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, "");
205
+ if (bytes instanceof Uint8Array) {
206
+ return base64js.fromByteArray(bytes).replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, "");
207
+ } else {
208
+ return uint8arrayToBase64url(new Uint8Array(bytes));
209
+ }
206
210
}
207
211
208
212
fetch(/* ... */) // Make the call that returns the credentialCreateJson above
@@ -314,7 +318,11 @@ function base64urlToUint8array(base64Bytes) {
314
318
return base64js.toByteArray((base64Bytes + padding).replace(/\//g, "_").replace(/\+/g, "-"));
315
319
}
316
320
function uint8arrayToBase64url(bytes) {
317
- return base64js.fromByteArray(bytes).replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, "");
321
+ if (bytes instanceof Uint8Array) {
322
+ return base64js.fromByteArray(bytes).replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, "");
323
+ } else {
324
+ return uint8arrayToBase64url(new Uint8Array(bytes));
325
+ }
318
326
}
319
327
320
328
fetch(/* ... */) // Make the call that returns the credentialGetJson above
0 commit comments