atproto_space

Alpha, pre-release. Pre-1.0, evolving alongside at-record; expect breaking changes between 0.x releases.

Sans-io building blocks for atproto Spaces: at:space/ URIs, OAuth space: scopes, policies, and com.atproto.space.* codecs and XRPC builders. Runs on Erlang and JavaScript with no FFI; the caller owns all IO.

import atproto_space
import atproto_space/scope
import atproto_space/uri
import gleam/option.{Some}

let assert Ok(space) =
  uri.parse("at:space/did:plc:z72i7hdynmk6r22z27h6tvur/com.example.shelf/self")

let assert Ok(shelf) = scope.space("com.example.shelf")
let assert Ok(shelf) = scope.with_skey(shelf, scope.ExactSkey("self"))
let oauth_scope =
  scope.join_with_atproto([
    shelf
    |> scope.with_authority(scope.SelfAuthority)
    |> scope.with_actions([scope.Read, scope.Create, scope.Update, scope.Delete]),
  ])

let url = atproto_space.create_space_url("https://pds.example")
let body =
  atproto_space.create_space_body(
    "com.example.shelf",
    Some("self"),
    atproto_space.PersonalSpace,
  )
ModuleWhat it does
atproto_spacePolicy, SpaceInfo, CreatedRecord, DelegationToken, codecs, XRPC URL/bodies.
atproto_space/uriParse, validate, format, and decode SpaceUri (at:space/...) and SpaceRecordUri.
atproto_space/scopeBuild, parse, and format validated OAuth space:* and space:<ref> scopes.
✨ Search Document