Files
motr-enclave/README.md

78 lines
1.6 KiB
Markdown
Raw Normal View History

# Motr Enclave
Extism WASM plugin providing encrypted key storage for Nebula wallet. Built with Go 1.25+ for `wasip1`.
## Quick Start
```bash
make start
```
This single command:
1. Installs dependencies (Go, Bun)
2. Builds the WASM plugin
3. Builds the TypeScript SDK
4. Starts the dev server at http://localhost:8080
## Manual Setup
```bash
make deps # Install tooling
make build # Build WASM plugin
make sdk # Build TypeScript SDK
make dev # Start dev server
```
## Usage
### TypeScript/ESM
```typescript
import { createEnclave } from '@sonr/motr-enclave';
const enclave = await createEnclave('/enclave.wasm');
const { did, database } = await enclave.generate(credential);
await enclave.load(database);
const accounts = await enclave.exec('resource:accounts action:list');
const didDoc = await enclave.query();
```
### CLI
```bash
make test-plugin
```
## Plugin Functions
| Function | Input | Output |
|----------|-------|--------|
| `generate` | WebAuthn credential (base64) | DID + database buffer |
| `load` | Database buffer | Success status |
| `exec` | Filter string + optional UCAN | Action result |
| `query` | DID (optional) | DID document |
## Project Structure
```
motr-enclave/
├── main.go # Go plugin source
├── src/ # TypeScript SDK
├── dist/ # Built SDK
├── example/ # Browser test app
├── db/ # SQLite schema
└── Makefile
```
## Development
```bash
make test # Run Go tests
make lint # Run linter
make clean # Remove build artifacts
```