1
0
mirror of https://github.com/kamyu1537/eamuse-card-wasm.git synced 2024-11-13 15:20:46 +01:00

🔥 이전 js 코드 삭제

This commit is contained in:
Byeon Seongun 2020-05-06 16:17:18 +09:00
parent d140a3424a
commit b3ed9cff83
No known key found for this signature in database
GPG Key ID: DA5BD8E6CBC00CC3

View File

@ -1,30 +0,0 @@
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();
const path = require('path').join(__dirname, 'konami-card.wasm');
const bytes = require('fs').readFileSync(path);
const wasmModule = new WebAssembly.Module(bytes);
const wasmInstance = new WebAssembly.Instance(wasmModule, go.importObject);
go.run(wasmInstance).then();
module.exports.encode = function (nfcId) {
return new Promise((resolve) => {
KONAMI_CARD_ENCODE(nfcId, function (result) {
resolve(result);
});
});
};
module.exports.decode = function (cardId) {
return new Promise((resolve) => {
KONAMI_CARD_DECODE(cardId, function (result) {
resolve(result);
});
});
};