deploy bluesky-social/atproto
You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
syui 9a16564a38
fix
2 months ago
.env.example fix 2 months ago
.gitignore up readme 2 months ago
Dockerfile first commit 2 months ago
fly.toml.example first commit 2 months ago
readme.md fix 2 months ago

readme.md

at protocol on fly.io

url

https://plc.directory/export

https://plc.directory/did:plc:schldsdljwxcdtslnbqaoifh

https://syui.ai/xrpc/com.atproto.repo.describe?user=syui.syui.ai

build

# m1-mac
$ node -v
v18.14.1
$ npm -v
9.6.1

$ git clone https://github.com/syui/atproto
$ cd !$:t
$ npm config edit
python=/usr/bin/python3

$ npm i node-gyp npm lerna
$ npm i better-sqlite3
$ npm i

$ make build
# linux
$ nvm use 18
$ npm i

$ make build

.env

$ cp .env.example pacakges/pds/.env

fly.io

$ app=test

$ fly create $app
$ fly vol create --region nrt --size 1 ${app}_data -a $app
$ fly pg create -n ${app}-db
$ fly pg attach -a $app ${app}-db

# fly scale memory 512

$ fly deploy

SERVER_DID

ref : https://github.com/KingYoSun/atproto-aws/tree/main

pacakges/dev-env/src/index.ts

import * as cbor from '@ipld/dag-cbor'
import * as uint8arrays from 'uint8arrays'

console.log(`signingKey=${keypair.did()}`)
console.log(`recoveryKey=${keypair.did()}`)
const obj = {
  type: 'create',
  signingKey: keypair.did(),
  recoveryKey: keypair.did(),
  handle: '${ADMIN_USER_NAME}.${DOMAIN}',
  service: 'https://${DOMAIN}',
  prev: null,
}
const data = new Uint8Array(cbor.encode(obj))
console.log(
  `sig=${uint8arrays.toString(await keypair.sign(data), 'base64url')}`,
)
make build
make run-dev-env

handle=admin.example.com
service=https://example.com
url=https://plc.directory/did:plc:q4ugjxbx2mp6rmnnljjystesttesttest

json="{
  \"type\": \"create\",
  \"signingKey\": \"${signingKey}\",
  \"recoveryKey\": \"${recoveryKey}\",
  \"handle\": \"${handle}\",
  \"service\": \"${service}\",
  \"prev\": null,
  \"sig\": \"${sig}\"
}"

curl -X POST -H "Content-Type: application/json" -d "$json" $url
Hash of genesis operation does not match DID identifier: xxx

url=did:plc:xxx
curl -X POST -H "Content-Type: application/json" -d "$json" $url
Ok

api

packages/api/src/client/lexicons.ts

session

# com.atproto.session.create
$ host=bsky.social
$ user=syui
$ pass=xxx
$ curl -X POST -H "Content-Type: application/json" -d "{\"handle\":\"$user.$host\",\"password\":\"$pass\"}" https://$host/xrpc/com.atproto.session.create

account profile

$ url="https://$host/xrpc/app.bsky.actor.getProfile?actor=syui.syui.ai"
$ token=`cat token.json| jq -r .accessJwt`
$ curl -X GET -H "Content-Type: application/json" -H "Authorization: Bearer $token" $url

invite code

packages/pds/src/api/com/atproto/account/createInviteCode.ts

# com.atproto.server.createInviteCode
$ url=https://$host/xrpc/com.atproto.account.createInviteCode
$ json="{\"useCount\":5}"
$ curl -X POST -u admin:${admin_password} -H "Content-Type: application/json" -d "$json" $url 

handle too short

change : 3 -> 1

pakcages/identifier/src/handle.ts

if (front.length < 1) {
  throw new InvalidHandleError('Handle too short')
}

mail send

mailgun

SMTP_HOST="smtp.mailgun.org"
SMTP_USERNAME=""
SMTP_PASSWORD=""
#EMAIL_SMTP_URL=""
EMAIL_NO_REPLY_ADDRESS=""

update_atp_pds

ref : https://github.com/bluesky-social/did-method-plc

packages/repo/tests/mst.test.ts

pacakges/dev-env/src/index.ts

import { CID } from 'multiformats'
console.log(`cid=${cid}`)
const obj = {
type: 'update_atp_pds',
      handle: '$handle',
      service: '$service',
      prev: cid,
}
const data = new Uint8Array(cbor.encode(obj))
console.log( `sig=${uint8arrays.toString(await keypair.sign(data), 'base64url')}`,)
make build
make run-dev-env

type=update_atp_pds
handle=syui.syui.ai
service=https://bsky.syui.ai
# syui.syui.ai
url=https://plc.directory/did:plc:schldsdljwxcdtslnbqaoifh 
# bsky.syui.ai
url=https://plc.directory/did:plc:dpuhx6nycijhm5yd6erou2wl6ohxockj2fgvzz62x2fopz2xo5tq
# syui.ai
url=https://plc.directory/did:plc:q4ugjxbx2mp6rmnnljjys67zv3nnccvm2ecb5wdqzwka7w7iua6q

json="{
  \"type\": \"${type}\",
  \"service\": \"${service}\",
  \"prev\": ${cid},
  \"sig\": \"${sig}\"
}"

curl -X POST -H "Content-Type: application/json" -d "$json" $url