Skip to content

huongcodecb1992/wasm-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MBBank WASM + OCR API

Micro service mã hoá WASM + nhận diện captcha cho MBBank PHP SDK. Deploy miễn phí trên Render/Railway.

Yêu cầu

  • Node.js >= 18
  • File model.onnx (47MB) — copy từ resources/model.onnx

Deploy

Render.com (Free)

  1. Push wasm-api/ + model.onnx lên GitHub
  2. render.com → New Web Service
  3. Settings:
    • Start Command: node index.js
    • Instance Type: Free (512MB RAM)
    • Env: API_KEY=your-secret-key
  4. Deploy → Lấy URL

Tự host

cd wasm-api/
npm install
cp ../resources/model.onnx .
API_KEY=secret PORT=3000 node index.js

Cấu hình PHP (Shared Hosting)

use MBBank\MBBank;
use MBBank\CaptchaOCRApi;
use MBBank\WasmHelper\WasmEncrypt;

$apiUrl = 'https://your-wasm-api.onrender.com';
$apiKey = 'your-secret-key';

WasmEncrypt::setApiUrl($apiUrl);
WasmEncrypt::setApiKey($apiKey);

$mb = new MBBank([
    'username' => 'YOUR_USERNAME',
    'password' => 'YOUR_PASSWORD',
    'captcha_ocr' => new CaptchaOCRApi($apiUrl, $apiKey),
]);

API Endpoints

Method Path Body Response
POST /encrypt {data:{...}, apiKey:"..."} {encrypted:"..."}
POST /ocr {imageBase64:"...", apiKey:"..."} {text:"abc123"}
GET /health {status,wasmReady,ocrReady}

Bảo mật

  • Luôn set API_KEY trong production
  • HTTPS tự động bởi Render/Railway

About

wasm for MBBank

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors