EdgeRuntimeImplementation
@atiproto/edge-oauth-client
Implements the RuntimeImplementation interface required by EdgeOAuthClient using Web Platform APIs (WebCrypto, Fetch). Works in any edge runtime that exposes the standard crypto global — Cloudflare Workers, Deno, and modern Node.js (v18+).
Constructor
typescript
new EdgeRuntimeImplementation()
No constructor parameters. All methods delegate to Web Platform globals.
Methods
| Method | Returns | Description |
|---|---|---|
| createKey(algs) | Promise<Key> | Generates a DPoP key pair using crypto.subtle.generateKey. Selects the first supported algorithm from algs. |
| getRandomValues(len) | Uint8Array | Returns cryptographically random bytes via crypto.getRandomValues. |
| digest(alg, data) | Promise<Uint8Array> | Hashes data using crypto.subtle.digest. |
| requestLock(name, fn) | Promise<T> | Acquires a named lock via the Web Locks API (navigator.locks.request) before invoking fn. Falls back to a no-op lock if the API is unavailable. |
Usage
Passed automatically by EdgeOAuthClient. You only need to instantiate it directly if you are constructing an OAuthClient from the base package:
typescript
import { EdgeRuntimeImplementation } from "@atiproto/edge-oauth-client";const runtime = new EdgeRuntimeImplementation();// runtime satisfies RuntimeImplementation
Related
- patchGlobalRequestObject — companion utility required in some edge runtimes