mirror of
https://github.com/amark/gun.git
synced 2025-03-30 15:08:33 +00:00

later with @bmatusiak check sea.then for '../gun.js' vs '../' vs ... note: src/index -> core.js TODO: something about WebRTC candidates hitting ack decrement limits?
10 lines
309 B
JavaScript
10 lines
309 B
JavaScript
;(function(){
|
|
|
|
var shim = require('./shim');
|
|
module.exports = async function(d, o){
|
|
var t = (typeof d == 'string')? d : await shim.stringify(d);
|
|
var hash = await shim.subtle.digest({name: o||'SHA-256'}, new shim.TextEncoder().encode(t));
|
|
return shim.Buffer.from(hash);
|
|
}
|
|
|
|
}()); |