remove browser dependency on "buffer"

This commit is contained in:
Danny Coates
2020-07-27 19:23:03 -07:00
parent 72d2d6ef31
commit 7130c2e7b0
8 changed files with 304 additions and 65 deletions

View File

@@ -1,5 +1,5 @@
/* global AUTH_CONFIG */
import { arrayToB64, b64ToArray } from './utils';
import { arrayToB64, b64ToArray, concat } from './utils';
const encoder = new TextEncoder();
const decoder = new TextDecoder();
@@ -23,13 +23,6 @@ function getOtherInfo(enc) {
return result;
}
function concat(b1, b2) {
const result = new Uint8Array(b1.length + b2.length);
result.set(b1, 0);
result.set(b2, b1.length);
return result;
}
async function concatKdf(key, enc) {
if (key.length !== 32) {
throw new Error('unsupported key length');