~ knotless Search/
↑↓ move↵ open⇧↵ all results

johnandersen777.bsky.social/atlibs

0
0
main
40 lines · 1.4 KB Raw History
# @publicdomainrelay/atlibs

atlibs runs WebAssembly modules published as atproto records, in a browser page or a Node server. A
module plans XRPC calls; the host makes them with the user's session. ESM, no build step, no
dependencies. Docs, the Rust host and the `atlibs` CLI: https://knotless.dev/johnandersen777.bsky.social/atlibs

```bash
npm i @publicdomainrelay/atlibs
```

```js
import { localModule, runModule } from '@publicdomainrelay/atlibs/run-module/index.js'
```

A page maps the same paths through its import map:

```html
<script type="importmap">
{
	"imports": {
		"@atproto/oauth-client-browser": "https://esm.sh/@atproto/oauth-client-browser@0.5.14",
		"atlibs/": "https://cdn.jsdelivr.net/npm/@publicdomainrelay/atlibs@0.5.0/src/"
	}
}
</script>
```

## Entry points

Every `src/<name>/index.js` is `@publicdomainrelay/atlibs/<name>/index.js`.

- Browser and Node: `run-module`, `compose`, `mcp`, `oauth`, `attest`, `didkey`, `encoding`,
  `cubit`, `component`, `plugin-context`
- Node only: `server` (`node:sqlite`, `node:fs`, `node:worker_threads`; its CLI is `server/cli.mjs`),
  `oauth-server` (needs the optional peers `@atproto/oauth-client-node` and `@atproto/jwk-jose`),
  `serviceauth` (`node:crypto`)

Node 25 or later (`Uint8Array.prototype.toBase64`); browsers: Chrome 140, Firefox 133, Safari 18.2.

Public domain ([Unlicense](https://unlicense.org)).