From 703dd2f76662d57d791cfe559269e804c28a3339 Mon Sep 17 00:00:00 2001 From: Mark Nadal Date: Fri, 29 Jun 2018 17:40:15 -0700 Subject: [PATCH] unbuild sea --- sea/decrypt.js | 2 +- sea/encrypt.js | 2 +- sea/pair.js | 2 +- sea/secret.js | 2 +- sea/sign.js | 4 ++-- sea/verify.js | 4 ++-- sea/work.js | 4 ++-- 7 files changed, 10 insertions(+), 10 deletions(-) diff --git a/sea/decrypt.js b/sea/decrypt.js index 8b77f71b..2625eccd 100644 --- a/sea/decrypt.js +++ b/sea/decrypt.js @@ -15,7 +15,7 @@ }, aes, new Uint8Array(shim.Buffer.from(json.ct, 'utf8')))) const r = parse(new shim.TextDecoder('utf8').decode(ct)) - if(cb){ cb(r) } + if(cb){ try{ cb(r) }catch(e){console.log(e)} } return r; } catch(e) { SEA.err = e; diff --git a/sea/encrypt.js b/sea/encrypt.js index ffaa9c3d..c83cd339 100644 --- a/sea/encrypt.js +++ b/sea/encrypt.js @@ -19,7 +19,7 @@ s: rand.s.toString('utf8') }); - if(cb){ cb(r) } + if(cb){ try{ cb(r) }catch(e){console.log(e)} } return r; } catch(e) { SEA.err = e; diff --git a/sea/pair.js b/sea/pair.js index 11bc8988..793083eb 100644 --- a/sea/pair.js +++ b/sea/pair.js @@ -49,7 +49,7 @@ } dh = dh || {}; const r = { pub: sa.pub, priv: sa.priv, /* pubId, */ epub: dh.epub, epriv: dh.epriv } - if(cb){ cb(r) } + if(cb){ try{ cb(r) }catch(e){console.log(e)} } return r; } catch(e) { SEA.err = e; diff --git a/sea/secret.js b/sea/secret.js index 567910aa..915965da 100644 --- a/sea/secret.js +++ b/sea/secret.js @@ -21,7 +21,7 @@ return ecdhSubtle.exportKey('jwk', derivedKey).then(({ k }) => k) }) const r = derived; - if(cb){ cb(r) } + if(cb){ try{ cb(r) }catch(e){console.log(e)} } return r; } catch(e) { SEA.err = e; diff --git a/sea/sign.js b/sea/sign.js index 4044b3e8..fe4ed994 100644 --- a/sea/sign.js +++ b/sea/sign.js @@ -11,7 +11,7 @@ // TODO: This would prevent pair2 signing pair1's signature. // So we may want to change this in the future. // but for now, we want to prevent duplicate double signature. - if(cb){ cb(data) } + if(cb){ try{ cb(data) }catch(e){console.log(e)} } return data; } const pub = pair.pub @@ -23,7 +23,7 @@ .then((key) => shim.subtle.sign(S.ecdsa.sign, key, new Uint8Array(hash))) // privateKey scope doesn't leak out from here! const r = 'SEA'+JSON.stringify({m: msg, s: shim.Buffer.from(sig, 'binary').toString('utf8')}); - if(cb){ cb(r) } + if(cb){ try{ cb(r) }catch(e){console.log(e)} } return r; } catch(e) { SEA.err = e; diff --git a/sea/verify.js b/sea/verify.js index c60cc79a..1ce4347a 100644 --- a/sea/verify.js +++ b/sea/verify.js @@ -12,7 +12,7 @@ const raw = (json !== data)? (json.s && json.m)? parse(json.m) : data : json; - if(cb){ cb(raw) } + if(cb){ try{ cb(raw) }catch(e){console.log(e)} } return raw; } const pub = pair.pub || pair @@ -24,7 +24,7 @@ if(!check){ throw "Signature did not match." } const r = check? parse(json.m) : u; - if(cb){ cb(r) } + if(cb){ try{ cb(r) }catch(e){console.log(e)} } return r; } catch(e) { SEA.err = e; diff --git a/sea/work.js b/sea/work.js index 328fbc12..f4e436c9 100644 --- a/sea/work.js +++ b/sea/work.js @@ -24,7 +24,7 @@ }, key, S.pbkdf2.ks * 8) data = shim.random(data.length) // Erase data in case of passphrase const r = shim.Buffer.from(result, 'binary').toString('utf8') - if(cb){ cb(r) } + if(cb){ try{ cb(r) }catch(e){console.log(e)} } return r; } // For NodeJS crypto.pkdf2 rocks @@ -38,7 +38,7 @@ ) data = shim.random(data.length) // Erase passphrase for app const r = hash && hash.toString('utf8') - if(cb){ cb(r) } + if(cb){ try{ cb(r) }catch(e){console.log(e)} } return r; } catch(e) { SEA.err = e;