···11-// MIT License
22-//
33-// Copyright (c) 2025 Anirudh Oppiliappan, Akshay Oppiliappan and
44-// contributors.
55-//
66-// Permission is hereby granted, free of charge, to any person obtaining a copy
77-// of this software and associated documentation files (the "Software"), to deal
88-// in the Software without restriction, including without limitation the rights
99-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
1010-// copies of the Software, and to permit persons to whom the Software is
1111-// furnished to do so, subject to the following conditions:
1212-//
1313-// The above copyright notice and this permission notice shall be included in all
1414-// copies or substantial portions of the Software.
1515-//
1616-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1717-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1818-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1919-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
2020-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2121-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2222-// SOFTWARE.
2323-2424-package main
2525-2626-import (
2727- "crypto/ecdsa"
2828- "crypto/elliptic"
2929- "crypto/rand"
3030- "encoding/json"
3131- "fmt"
3232- "time"
3333-3434- "github.com/lestrrat-go/jwx/v2/jwk"
3535-)
3636-3737-func main() {
3838- privKey, err := ecdsa.GenerateKey(elliptic.P256(), rand.Reader)
3939- if err != nil {
4040- panic(err)
4141- }
4242-4343- key, err := jwk.FromRaw(privKey)
4444- if err != nil {
4545- panic(err)
4646- }
4747-4848- kid := fmt.Sprintf("%d", time.Now().Unix())
4949-5050- if err := key.Set(jwk.KeyIDKey, kid); err != nil {
5151- panic(err)
5252- }
5353-5454- if err := key.Set("use", "sig"); err != nil {
5555- panic(err)
5656- }
5757-5858- b, err := json.Marshal(key)
5959- if err != nil {
6060- panic(err)
6161- }
6262-6363- fmt.Println(string(b))
6464-}
···10101111To authenticate, you will need OAUTH JWKs to be setup:
1212```bash
1313-go build -o genjwks.out ./cmd/genjwks
1414-export YOTEN_OAUTH_JWKS="$(./genjwks.out)"
1313+export SHELF_OAUTH_CLIENT_KID="$(date +%s)"
1414+export SHELF_OAUTH_CLIENT_SECRET="$(goat key generate -t P-256 | grep -A1 "Secret Key" | tail -n1 | awk '{print $1}')"
1515```
16161717You will need to fetch a series of static assets yōten depends on:
+3-3
generate-lexicons.sh
···66 --build-file lexicon-build-config.json \
77 lexicons/
8899-find ./api/yoten -type f -exec sed -i.bak 's/\tutil/\/\/\tutil/' {} +
1010-find ./api/yoten -type f -exec sed -i.bak -E 's/^(.+)github(.+)//' {} +
1111-go run ./cmd/gen.go
99+find ./api/shelf -type f -exec sed -i.bak 's/\lexutil/\/\/\lexutil/' {} +
1010+find ./api/shelf -type f -exec sed -i.bak -E 's/^(.+)github(.+)//' {} +
1111+go run ./cmd/cborgen.go
12121313go run github.com/bluesky-social/indigo/cmd/lexgen \
1414 --package yoten \