ubl-wasm 0.1.1

UBL Chip execution engine for WebAssembly - BLAKE3 + JSON Atomic + Decision CID
Documentation
# ubl-wasm

UBL Chip execution engine compiled to WebAssembly with true BLAKE3 hashing.

## Build

```bash
wasm-pack build --target web --release
```

## Usage in Browser

```html
<script type="module">
import init, { execute_chip, blake3_hash, canonize_json } from './pkg/ubl_wasm.js';

await init();

const chip = {
  did: "did:ubl:chip:e53148143fba5cbc",
  chip_cid: "e53148143fba5cbc45338ccc980749fa5053b95c6e0e3169fb5ae7d8a70cad2d",
  manifest: {
    author: "dan@ubl",
    canon: "CANON1",
    description: "Check if user is adult",
    version: "1.0.0",
    logic: { field: "user.age", op: ">=", value: 18 }
  }
};

const ctx = { user: { age: 21 } };

const result = JSON.parse(execute_chip(JSON.stringify(chip), JSON.stringify(ctx)));
console.log(result);
// {
//   result: true,
//   reason: "21 >= 18 = true",
//   decision_cid: "f128801ff69fc42510fbae27822ae94ec93aba3e6515d7504e52c703499c30ff",
//   ...
// }
</script>
```

## Exports

| Function | Description |
|----------|-------------|
| `execute_chip(chip_json, ctx_json)` | Execute chip and return full result with Decision CID |
| `blake3_hash(data)` | Compute BLAKE3 hash of string data |
| `canonize_json(json_str)` | Canonize JSON (sorted keys, compact) |
| `compute_decision_cid(did, cid, ctx, result, reason)` | Compute Decision CID directly |
| `version()` | Get version string |

## Decision CID

Same formula as CLI/HTTP/Postgres:

```
BLAKE3(CANON1 \0 did \0 chip_cid \0 canonical(ctx) \0 canonical(output))
```

**Isomorphic execution guaranteed.**

## Size

- `ubl_wasm_bg.wasm`: ~145KB (optimized with wasm-opt)

## Integration with @ubl/sdk

```ts
import init, * as wasm from 'ubl-wasm';
import { registerWasm } from '@ubl/sdk';

await init();
registerWasm(wasm);

// Now <Chip/> uses true BLAKE3 via WASM
```