mirror of
https://github.com/kamyu1537/eamuse-card-wasm.git
synced 2024-11-27 21:10:48 +01:00
🐛 crypto.getRandomValues 에서 에러나는 문제 해결
This commit is contained in:
parent
c27f4c75a1
commit
e4b92cfe0e
@ -1,3 +1,9 @@
|
||||
crypto.getRandomValues = (buf) => {
|
||||
buf = Buffer.from(buf);
|
||||
let bytes = crypto.randomBytes(buf.length);
|
||||
buf.set(bytes);
|
||||
return buf;
|
||||
};
|
||||
require('./wasm_exec');
|
||||
|
||||
const go = new Go();
|
||||
@ -8,17 +14,17 @@ const wasmInstance = new WebAssembly.Instance(wasmModule, go.importObject);
|
||||
go.run(wasmInstance).then();
|
||||
|
||||
module.exports.encode = function (nfcId) {
|
||||
return new Promise(resolve => {
|
||||
return new Promise((resolve) => {
|
||||
KONAMI_CARD_ENCODE(nfcId, function (result) {
|
||||
resolve(result)
|
||||
})
|
||||
})
|
||||
resolve(result);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
module.exports.decode = function (cardId) {
|
||||
return new Promise(resolve => {
|
||||
return new Promise((resolve) => {
|
||||
KONAMI_CARD_DECODE(cardId, function (result) {
|
||||
resolve(result)
|
||||
})
|
||||
})
|
||||
resolve(result);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user