+1
-1
.env.example
+1
-1
.env.example
+1
-3
.github/workflows/docker-image.yml
+1
-3
.github/workflows/docker-image.yml
-10
Caddyfile
-10
Caddyfile
+1
-132
README.md
+1
-132
README.md
···-I migrated and have been running my main account on this PDS for months now without issue, however, I am still not responsible if things go awry, particularly during account migration. Please use caution.+You should not use this PDS. You should not rely on this code as a reference for a PDS implementation. You should not trust this code. Using this PDS implementation may result in data loss, corruption, etc.Cocoon is a PDS implementation in Go. It is highly experimental, and is not ready for any production use.-- **init-keys**: Automatically generates cryptographic keys (rotation key and JWK) on first run-- **create-invite**: Automatically creates an initial invite code after Cocoon starts (first run only)
+39
-26
cmd/cocoon/main.go
+39
-26
cmd/cocoon/main.go
···
-56
create-initial-invite.sh
-56
create-initial-invite.sh
···-echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"-echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
-125
docker-compose.yaml
-125
docker-compose.yaml
···
+1
-1
identity/types.go
+1
-1
identity/types.go
···
-34
init-keys.sh
-34
init-keys.sh
···
-6
internal/db/db.go
-6
internal/db/db.go
···
-16
internal/helpers/helpers.go
-16
internal/helpers/helpers.go
···
+1
-1
models/models.go
+1
-1
models/models.go
···
+28
-44
oauth/client/manager.go
+28
-44
oauth/client/manager.go
······jwksCache := cache.NewCache[string, jwk.Key]().WithLRU().WithMaxKeys(500).WithTTL(5 * time.Minute)-metadataCache := cache.NewCache[string, *Metadata]().WithLRU().WithMaxKeys(500).WithTTL(5 * time.Minute)+metadataCache := cache.NewCache[string, Metadata]().WithLRU().WithMaxKeys(500).WithTTL(5 * time.Minute)···-// TODO: this is kinda bad but whatever for now. there could obviously be more than one jwk, and we need to+// TODO: this is kinda bad but whatever for now. there could obviously be more than one jwk, and we need to···func (cm *Manager) getClientMetadata(ctx context.Context, clientId string) (*Metadata, error) {·········
+15
-31
plc/client.go
+15
-31
plc/client.go
···func (c *Client) CreateDID(sigkey *atcrypto.PrivateKeyK256, recovery string, handle string) (string, *Operation, error) {-func (c *Client) CreateDidCredentials(sigkey *atcrypto.PrivateKeyK256, recovery string, handle string) (*DidCredentials, error) {······
-8
plc/types.go
-8
plc/types.go
···
-24
server/handle_identity_get_recommended_did_credentials.go
-24
server/handle_identity_get_recommended_did_credentials.go
···
-87
server/handle_identity_submit_plc_operation.go
-87
server/handle_identity_submit_plc_operation.go
···
+1
-1
server/handle_import_repo.go
+1
-1
server/handle_import_repo.go
+35
-45
server/handle_server_create_account.go
+35
-45
server/handle_server_create_account.go
······s.logger.Error("error receiving request", "endpoint", "com.atproto.server.createAccount", "error", err)···-token := strings.TrimSpace(strings.Replace(e.Request().Header.Get("authorization"), "Bearer ", "", 1))-authDid, err := s.validateServiceAuth(e.Request().Context(), token, "com.atproto.server.createAccount")-s.logger.Warn("error validating authorization token", "endpoint", "com.atproto.server.createAccount", "error", err)s.logger.Error("error looking up handle in db", "endpoint", "com.atproto.server.createAccount", "error", err)-if did, err := s.passport.ResolveHandle(e.Request().Context(), request.Handle); err == nil && did != signupDid {+if did, err := s.passport.ResolveHandle(e.Request().Context(), request.Handle); err == nil && did != "" {···s.logger.Error("error looking up email in db", "endpoint", "com.atproto.server.createAccount", "error", err)···
+1
-6
server/handle_sync_get_blob.go
+1
-6
server/handle_sync_get_blob.go
···
+11
-31
server/handle_sync_subscribe_repos.go
+11
-31
server/handle_sync_subscribe_repos.go
······conn, err := websocket.Upgrade(e.Response().Writer, e.Request(), e.Response().Header(), 1<<10, 1<<10)······
+6
-38
server/server.go
+6
-38
server/server.go
·········s.echo.GET("/xrpc/com.atproto.server.getSession", s.handleGetSession, s.handleLegacySessionMiddleware, s.handleOauthSessionMiddleware)s.echo.POST("/xrpc/com.atproto.server.refreshSession", s.handleRefreshSession, s.handleLegacySessionMiddleware, s.handleOauthSessionMiddleware)s.echo.POST("/xrpc/com.atproto.server.deleteSession", s.handleDeleteSession, s.handleLegacySessionMiddleware, s.handleOauthSessionMiddleware)-s.echo.GET("/xrpc/com.atproto.identity.getRecommendedDidCredentials", s.handleGetRecommendedDidCredentials, s.handleLegacySessionMiddleware, s.handleOauthSessionMiddleware)s.echo.POST("/xrpc/com.atproto.identity.updateHandle", s.handleIdentityUpdateHandle, s.handleLegacySessionMiddleware, s.handleOauthSessionMiddleware)-s.echo.POST("/xrpc/com.atproto.identity.submitPlcOperation", s.handleSubmitPlcOperation, s.handleLegacySessionMiddleware, s.handleOauthSessionMiddleware)s.echo.POST("/xrpc/com.atproto.server.confirmEmail", s.handleServerConfirmEmail, s.handleLegacySessionMiddleware, s.handleOauthSessionMiddleware)s.echo.POST("/xrpc/com.atproto.server.requestEmailConfirmation", s.handleServerRequestEmailConfirmation, s.handleLegacySessionMiddleware, s.handleOauthSessionMiddleware)s.echo.POST("/xrpc/com.atproto.server.requestPasswordReset", s.handleServerRequestPasswordReset) // AUTH NOT REQUIRED FOR THIS ONE···
-91
server/service_auth.go
-91
server/service_auth.go
···-func (m *ES256KSigningMethod) Verify(signingString string, signature string, key interface{}) error {-func (s *Server) validateServiceAuth(ctx context.Context, rawToken string, nsid string) (string, error) {-parsedToken, err := jwt.ParseWithClaims(token, jwt.MapClaims{}, func(token *jwt.Token) (interface{}, error) {-verificationMethods := make([]atproto_identity.DocVerificationMethod, len(didDoc.VerificationMethods))