An unofficial terminal client for Tangled, optimized for humans and agents. tgcli.wisp.place
cli atproto go tangled
Something went wrong. Try again.
1234567891011121314151617181920212223242526272829303132333435package app
import ( "context" "fmt" "time"
"github.com/alyraffauf/tg/atproto" currentlex "github.com/alyraffauf/tg/internal/tangledlex" "github.com/bluesky-social/indigo/atproto/syntax")
// AddSSHKey writes a new org.tangled.key.sshKey record.func (s *Service) AddSSHKey(ctx context.Context, name, key string) (*SSHKeyAddResult, error) { atClient, did, err := s.authenticatedPDS(ctx) if err != nil { return nil, err } uri, _, err := atClient.PutRecord(ctx, atproto.PutRecordInput{ Repo: did, Collection: sshKeyCollection, Rkey: string(syntax.NewTIDNow(0)), Record: currentlex.KeySshKey{ LexiconTypeID: sshKeyCollection, PublicKey: key, Name: name, CreatedAt: time.Now().UTC().Format(time.RFC3339), }, }) if err != nil { return nil, fmt.Errorf("add SSH key: %w", err) } return &SSHKeyAddResult{Name: name, URI: uri}, nil}