Skip to content

Commit fb20935

Browse files
save file
1 parent e179b16 commit fb20935

1 file changed

Lines changed: 14 additions & 2 deletions

File tree

  • blog/26-04-26/x509-certificates-in-js---encrypt-decrypt-data/ex

blog/26-04-26/x509-certificates-in-js---encrypt-decrypt-data/ex/x509-browser.js

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,10 +162,22 @@
162162
}//b64_uint8
163163

164164

165+
async function blob_uint8(blob){
166+
167+
var buf = await blob.arrayBuffer();
168+
var uint8 = new Uint8Array(buf);
169+
return uint8;
170+
171+
}//blob_uint8
172+
173+
165174
async function blob_b64(blob){
166175

167-
var buf = await blob.arrayBuffer();
168-
return btoa(String.fromCharCode(...new Uint8Array(buf)));
176+
var buf = await blob.arrayBuffer();
177+
var uint8 = new Uint8Array(buf);
178+
var bin = String.fromCharCode(...uint8)
179+
var b64 = btoa(bin);
180+
return b64;
169181

170182
}//blob_b64
171183

0 commit comments

Comments
 (0)