This string has no description

5.6 kB 160 lines Created 3d ago
Markdown

goat spaces support #

The bnewbold/spaces branch of goat includes early atproto spaces support. Here are the rough commands I'm thinking of:

goat space record ...
   get       fetch space record from the network
   ls, list  list all records for a space repo
   create    create record from JSON
   update    replace existing record from JSON
   delete    delete an existing record

goat space repo ...
   list    list all space repos for the current account
   export  download space repo STAR file
   import  upload space repo STAR file (eg, for migration)
   latest  print commit metadata for space repo
   oplog   print space repo operations (ops)
   verify  check integrity (but not authenticity) of space repo STAR file

goat space blob ...
   download  download a single space blob
   upload    upload a file (blob) to PDS

goat space writer ...
   list  list all space repos for given space

goat space manage ...
   list, ls  list all spaces for current account
   policy    show the policy object for a space
   create    create spaces of different policy types
   delete    remove a space
   member    manage memberspace rosters
   export    export space meta STAR file (not space repo)
   import    upload space meta STAR file (eg, for migration)

This all currently uses full password auth, which grants full access to all space data for the current account. It uses a basic space client SDK from my cobalt go repo, which is still a work-in-progress.

Currently all space access requires a logged-in account, but the plan is to support "public spaces" (which don't require a delegation token).

One of the challenges is to maintain the distinction between a space repo and an overall space, especially when they are both current account. For example, maybe it should be goat space manage export-meta <space> to differentiate from repo export better.

Another challenge is where to put policy-specific configuration commands, like configuring "memberspace" members separately from atmospheric group (atgrp.org) members.

Some bits I haven't worked in yet:

  • bulk exporting all space data (repos and blobs), either for current account or a given space
  • #atproto_kem key support
  • automated account migration (goat account migrate)

Workings with Spaces #

This flow will demonstrate:

  • creating a new "memberspace" space
  • managing members
  • creating space records, including blobs
  • exporting and inspecting space repo and meta as STAR files

Create a new memberspace, which is publicly readable::

$ goat space manage create member dev.atbin.space --skey one --public-read

List spaces under current account:

$ goat space manage ls
at:space/did:plc:735r43lcgemuv2woqpvx3lso/dev.atbin.space/one

Add a member to the space:

$ goat space manage member add at:space/did:plc:735r43lcgemuv2woqpvx3lso/dev.atbin.space/one did:web:account.example.com

List members, showing read and write access as booleans. Note that current account is implicitly included, but not in the list:

$ goat space manage member list at:space/did:plc:735r43lcgemuv2woqpvx3lso/dev.atbin.space/one
did:web:account.example.com	true	true

Now create a record in the space, under the current account's repository:

$ goat space record create at:space/did:plc:735r43lcgemuv2woqpvx3lso/dev.atbin.space/one - <<EOF
{
  "\$type": "dev.atbin.record",
  "integer": 123,
  "string": "hello world"
}
EOF

Upload a blob and reference it from a space record:

$ goat blob upload example.jpeg
{
  "$type": "blob",
  "ref": {
    "$link": "bafkreieyuv4bu5pnutmjpgho6mwm4cvcn46g5dp6zmtielgxt2loziiauy"
  },
  "mimeType": "image/jpeg",
  "size": 192463
}

$ goat space record create at:space/did:plc:735r43lcgemuv2woqpvx3lso/dev.atbin.space/one - <<EOF
{
  "\$type": "dev.atbin.record",
  "integer": 456,
  "blob": {
    "\$type": "blob",
    "ref": {
      "\$link": "bafkreieyuv4bu5pnutmjpgho6mwm4cvcn46g5dp6zmtielgxt2loziiauy"
    },
    "mimeType": "image/jpeg",
    "size": 192463
  }
}
EOF

List the writers of the space, printing the repo account DID, space rev, repo rev, and repo data version (hash):

$ goat space writer ls at:space/did:plc:735r43lcgemuv2woqpvx3lso/dev.atbin.space/one
did:plc:735r43lcgemuv2woqpvx3lso	3n3j6jts4ib2i	3n3j6jsytvb2i	3ca6591db5c01a6fbebb4bb4901e6e590b0a2f2c1e9545081e240e5b00dbf3a6

Export the space repo (containing records) as a STAR file, and then dump the records to stdout:

$ goat space repo export at:space/did:plc:735r43lcgemuv2woqpvx3lso/dev.atbin.space/one did:plc:735r43lcgemuv2woqpvx3lso -o repo.star

$ goat star cat repo.star
[...]

Similarly, export the overall space configuration as a STAR "meta" file:

$ goat space manage export at:space/did:plc:735r43lcgemuv2woqpvx3lso/dev.atbin.space/one -o meta.star

$ goat star meta meta.star
{
  "$type": "atproto-space-meta",
  "space": "at:space/did:plc:735r43lcgemuv2woqpvx3lso/dev.atbin.space/one",
  "ver": 1
}

$ goat star cat meta.star
{"$type":"atproto-space-meta","space":"at:space/did:plc:735r43lcgemuv2woqpvx3lso/dev.atbin.space/one","ver":1}
{"key":"policy","value":{"$type":"com.atproto.memberspace.policy","publicRead":true,"publicWrite":false,"publishMembers":false,"publishPolicy":false}}
{"key":"com.atproto.memberspace.member/did:web:account.example.com","value":{"$type":"com.atproto.memberspace.member","read":true,"write":true}}
{"key":"writer/did:plc:735r43lcgemuv2woqpvx3lso","value":{"data":"PKZZHbXAGm++u0u0kB5uWQsKLywelUUIHiQOWwDb86Y=","repoRev":"3n3j6jsytvb2i","spaceRev":"3n3j6jts4ib2i"}}
Sign up or Sign in to add to the discussion.