Packages

A browser-native atproto OAuth + XRPC client for Gleam: WebCrypto DPoP, PKCE, and async transport, for building a public-client SPA with no server-side session custody.

Current section

Files

Jump to
atproto_browser src atproto browser digest_ffi.mjs
Raw

src/atproto/browser/digest_ffi.mjs

// WebCrypto SHA-256, shared by pkce.gleam (S256 challenge) and
// oauth/resource.gleam (the DPoP `ath` claim).
import { BitArray } from "../../gleam.mjs";
export async function sha256(bits) {
const digest = await crypto.subtle.digest("SHA-256", bits.rawBuffer);
return new BitArray(new Uint8Array(digest));
}