up readme

main
syui 2 months ago
parent b892dcaa02
commit 469f9e17d3
Signed by: syui
GPG Key ID: 67AC97A939D3EA19

1
.gitignore vendored

@ -1,2 +1,3 @@
.env
fly.toml
*.json

@ -48,3 +48,84 @@ $ fly pg attach -a $app ${app}-db
$ fly deploy
```
### SERVER_DID
ref : https://github.com/KingYoSun/atproto-aws/tree/main
> pacakges/dev-env/src/index.ts
```js
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')}`,
)
```
```sh
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
```
### session
```sh
# 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
```
### profile
```sh
$ 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
```sh
# 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
```

Loading…
Cancel
Save