Documentation
¶
Index ¶
- Constants
- Variables
- func NewDelegationExchangeMiddleware(s *Server, next echo.HandlerFunc) echo.HandlerFunc
- func NewOAuthOnlyMiddleware(s *Server, next echo.HandlerFunc) echo.HandlerFunc
- func NewOAuthOrSpaceCredentialMiddleware(s *Server, next echo.HandlerFunc) echo.HandlerFunc
- func NewServiceAuthOnlyMiddleware(s *Server, next echo.HandlerFunc) echo.HandlerFunc
- func NewSpaceCredentialOnlyMiddleware(s *Server, next echo.HandlerFunc) echo.HandlerFunc
- func ParseSpaceNotificationHash(raw string) ([]byte, error)
- func SetPrincipal(e echo.Context, principal Principal)
- type AccountRevokeInput
- type AccountSwitchRequest
- type ApplyWriteResult
- type Args
- type AuthPolicy
- type AuthPrincipal
- type BlobDeletionS3Client
- type BlobDeletionWorker
- func (w *BlobDeletionWorker) ProcessOnce(ctx context.Context, limit int) (int, error)
- func (w *BlobDeletionWorker) PruneDeleted(ctx context.Context) (int64, error)
- func (w *BlobDeletionWorker) RunOnce(ctx context.Context, limit int) (int, error)
- func (w *BlobDeletionWorker) SetClock(clock func() time.Time)
- func (w *BlobDeletionWorker) SetOptions(options BlobDeletionWorkerOptions)
- func (w *BlobDeletionWorker) SetS3Client(client BlobDeletionS3Client)
- type BlobDeletionWorkerOptions
- type BlockstoreVariant
- type ComAtprotoIdentityUpdateHandleRequest
- type ComAtprotoLabelQueryLabelsResponse
- type ComAtprotoRepoApplyWritesInput
- type ComAtprotoRepoApplyWritesItem
- type ComAtprotoRepoApplyWritesOutput
- type ComAtprotoRepoCreateRecordInput
- type ComAtprotoRepoDeleteRecordInput
- type ComAtprotoRepoDescribeRepoResponse
- type ComAtprotoRepoGetRecordResponse
- type ComAtprotoRepoListMissingBlobsRecordBlob
- type ComAtprotoRepoListMissingBlobsResponse
- type ComAtprotoRepoListRecordsRecordItem
- type ComAtprotoRepoListRecordsRequest
- type ComAtprotoRepoListRecordsResponse
- type ComAtprotoRepoPutRecordInput
- type ComAtprotoRepoUploadBlobResponse
- type ComAtprotoRequestEmailUpdateResponse
- type ComAtprotoServerActivateAccountRequest
- type ComAtprotoServerCheckAccountStatusResponse
- type ComAtprotoServerConfirmEmailRequest
- type ComAtprotoServerCreateAccountRequest
- type ComAtprotoServerCreateAccountResponse
- type ComAtprotoServerCreateInviteCodeRequest
- type ComAtprotoServerCreateInviteCodeResponse
- type ComAtprotoServerCreateInviteCodesItem
- type ComAtprotoServerCreateInviteCodesRequest
- type ComAtprotoServerCreateInviteCodesResponse
- type ComAtprotoServerCreateSessionRequest
- type ComAtprotoServerCreateSessionResponse
- type ComAtprotoServerDeactivateAccountRequest
- type ComAtprotoServerDeleteAccountRequest
- type ComAtprotoServerDescribeServerResponse
- type ComAtprotoServerDescribeServerResponseContact
- type ComAtprotoServerDescribeServerResponseLinks
- type ComAtprotoServerGetSessionResponse
- type ComAtprotoServerRefreshSessionResponse
- type ComAtprotoServerRequestPasswordResetRequest
- type ComAtprotoServerResetPasswordRequest
- type ComAtprotoServerUpdateEmailRequest
- type ComAtprotoSignPlcOperationRequest
- type ComAtprotoSignPlcOperationResponse
- type ComAtprotoSimpleSpaceCreateSpaceInput
- type ComAtprotoSimpleSpaceCreateSpaceOutput
- type ComAtprotoSimpleSpaceDeleteSpaceInput
- type ComAtprotoSimpleSpaceGetSpaceOutput
- type ComAtprotoSimpleSpaceListMembersOutput
- type ComAtprotoSimpleSpaceMember
- type ComAtprotoSimpleSpaceMemberInput
- type ComAtprotoSimpleSpaceUpdateSpaceInput
- type ComAtprotoSpaceApplyWritesElement
- type ComAtprotoSpaceApplyWritesInput
- type ComAtprotoSpaceApplyWritesOutput
- type ComAtprotoSpaceApplyWritesResult
- type ComAtprotoSpaceCreateRecordInput
- type ComAtprotoSpaceDeleteRecordInput
- type ComAtprotoSpaceGetDelegationTokenOutput
- type ComAtprotoSpaceGetLatestCommitResponse
- type ComAtprotoSpaceGetRecordResponse
- type ComAtprotoSpaceGetSpaceCredentialInput
- type ComAtprotoSpaceGetSpaceCredentialOutput
- type ComAtprotoSpaceListBlobsResponse
- type ComAtprotoSpaceListRecordsRecord
- type ComAtprotoSpaceListRecordsResponse
- type ComAtprotoSpaceListRepoOpsResponse
- type ComAtprotoSpaceListReposRepoRef
- type ComAtprotoSpaceListReposResponse
- type ComAtprotoSpaceListSpacesOutput
- type ComAtprotoSpaceListSpacesSpaceView
- type ComAtprotoSpaceNotifySpaceDeletedInput
- type ComAtprotoSpaceNotifyWriteInput
- type ComAtprotoSpacePutRecordInput
- type ComAtprotoSpaceRecordWriteOutput
- type ComAtprotoSpaceRegisterNotifyInput
- type ComAtprotoSpaceRegisterNotifyOutput
- type ComAtprotoSpaceRepoOp
- type ComAtprotoSpaceUnregisterNotifyInput
- type ComAtprotoSubmitPlcOperationRequest
- type ComAtprotoSyncGetBlocksRequest
- type ComAtprotoSyncGetLatestCommitResponse
- type ComAtprotoSyncGetRepoStatusResponse
- type ComAtprotoSyncListBlobsResponse
- type ComAtprotoSyncListReposRepoItem
- type ComAtprotoSyncListReposResponse
- type CustomValidator
- type DIDDocumentFetcher
- type DIDSpaceAuthorityKeyResolver
- type DbPersister
- func (p *DbPersister) Flush(ctx context.Context) error
- func (p *DbPersister) Persist(ctx context.Context, e *events.XRPCStreamEvent) error
- func (p *DbPersister) Playback(ctx context.Context, since int64, cb func(*events.XRPCStreamEvent) error) error
- func (p *DbPersister) SetEventBroadcaster(brc func(*events.XRPCStreamEvent))
- func (p *DbPersister) Shutdown(ctx context.Context) error
- func (p *DbPersister) TakeDownRepo(ctx context.Context, uid indigomodels.Uid) error
- type DelegationPrincipal
- type ES256KSigningMethod
- type FirehoseOp
- type HandleOauthAuthorizeGetInput
- type Label
- type MarshalableMap
- type OAuthPrincipal
- type OauthAuthorizationMetadata
- type OauthAuthorizePostRequest
- type OauthJwksResponse
- type OauthParResponse
- type OauthRevokeRequest
- type OauthSigninInput
- type OauthTokenRequest
- type OauthTokenResponse
- type Op
- type OpType
- type PassportSpaceAuthorityKeyResolver
- type Principal
- type PrincipalType
- type RecommitOptions
- type RecommitResult
- type RepoCommit
- type RepoMan
- type RequestPrincipal
- type S3Config
- type Server
- func (s *Server) AuthDispatcher(policy AuthPolicy, next echo.HandlerFunc) echo.HandlerFunc
- func (s *Server) DelegationExchange(next echo.HandlerFunc) echo.HandlerFunc
- func (s *Server) OAuthOnly(next echo.HandlerFunc) echo.HandlerFunc
- func (s *Server) OAuthOrSpaceCredential(next echo.HandlerFunc) echo.HandlerFunc
- func (s *Server) QueueSpaceDeletedNotifications(ctx context.Context, spaceRef, source string) error
- func (s *Server) RecordSpaceNotifySpaceDeleted(ctx context.Context, uri, source string, queueForwarding bool) error
- func (s *Server) RecordSpaceNotifyWrite(ctx context.Context, uri, author, rev string, hash []byte, source string) error
- func (s *Server) Serve(ctx context.Context) error
- func (s *Server) ServiceAuthOnly(next echo.HandlerFunc) echo.HandlerFunc
- func (s *Server) SetBlobDeletionS3Client(client BlobDeletionS3Client)
- func (s *Server) SetManagingAppAuthorizer(a SimpleSpaceManagingAppAuthorizer)
- func (s *Server) SetPassport(passport DIDDocumentFetcher)
- func (s *Server) SetSimpleSpaceManagingAppAuthorizer(a SimpleSpaceManagingAppAuthorizer)
- func (s *Server) SetSpaceAuthorityKeyResolver(resolver SpaceAuthorityKeyResolver)
- func (s *Server) SetSpaceNotificationClock(now func() time.Time)
- func (s *Server) SetSpaceNotificationResolver(r SpaceNotificationResolver)
- func (s *Server) SetSpaceNotificationSender(sender SpaceNotificationSender)
- func (s *Server) SetSpaceReplayStore(store space.ReplayStore)
- func (s *Server) SetSpaceTypeResolver(resolver scopes.SpaceTypeResolver)
- func (s *Server) SpaceCredentialOnly(next echo.HandlerFunc) echo.HandlerFunc
- func (s *Server) UpdateRepo(ctx context.Context, did string, root cid.Cid, rev string) error
- type ServerGetServiceAuthRequest
- type ServerReserveSigningKeyRequest
- type ServerReserveSigningKeyResponse
- type ServiceAuthPrincipal
- type Session
- type SimpleSpaceManagingAppAuthorizer
- type SimpleSpaceManagingAppAuthorizerFunc
- type SpaceAuthorityKeyResolver
- type SpaceAuthorityKeyResolverFunc
- type SpaceAuthorityKeySource
- type SpaceAuthorityKeySourceFunc
- type SpaceCredentialPrincipal
- type SpaceNotificationRepoSnapshot
- type SpaceNotificationResolver
- type SpaceNotificationResolverFunc
- type SpaceNotificationSender
- type SpaceNotificationSenderFunc
- type SpaceNotificationTargetResolver
- type SpaceNotificationTargetResolverFunc
- type SpaceNotificationWorker
- func NewSpaceNotificationWorker(s *Server, sender SpaceNotificationSender, ...) *SpaceNotificationWorker
- func NewSpaceNotificationWorkerForDB(database *db.DB, sender SpaceNotificationSender, clock func() time.Time, ...) *SpaceNotificationWorker
- func NewSpaceNotificationWorkerWithOptions(s *Server, sender SpaceNotificationSender, ...) *SpaceNotificationWorker
- func (w *SpaceNotificationWorker) ProcessOnce(ctx context.Context, limit int) (int, error)
- func (w *SpaceNotificationWorker) ReconcileNotifyWriters(ctx context.Context, spaceRef string, ...) (int, error)
- func (w *SpaceNotificationWorker) ReconcileSpaceWriters(ctx context.Context, spaceRef string, ...) (int, error)
- func (w *SpaceNotificationWorker) RunOnce(ctx context.Context, limit int) (int, error)
- func (w *SpaceNotificationWorker) SetClock(clock func() time.Time)
- func (w *SpaceNotificationWorker) SetOptions(options SpaceNotificationWorkerOptions)
- func (w *SpaceNotificationWorker) SetResolver(resolver SpaceNotificationResolver)
- func (w *SpaceNotificationWorker) SetSender(sender SpaceNotificationSender)
- type SpaceNotificationWorkerOptions
- type SpaceRepoAction
- type SpaceRepoActionAuthorizer
- type SpaceRepoAllowedActions
- type SpaceRepoBatch
- type SpaceRepoChange
- type SpaceRepoFailureHook
- type SpaceRepoFailureStage
- type SpaceRepoInsufficientScopeError
- type SpaceRepoMan
- func (m *SpaceRepoMan) Apply(ctx context.Context, spaceRef, author string, operations []SpaceRepoOperation) (SpaceRepoBatch, error)
- func (m *SpaceRepoMan) ApplyWithAuthorization(ctx context.Context, spaceRef, author string, operations []SpaceRepoOperation, ...) (SpaceRepoBatch, error)
- func (m *SpaceRepoMan) ApplyWrites(ctx context.Context, spaceRef, author string, operations []SpaceRepoOperation) (SpaceRepoBatch, error)
- func (m *SpaceRepoMan) DeleteRecord(ctx context.Context, spaceRef, author, collection, rkey string) (SpaceRepoBatch, error)
- func (m *SpaceRepoMan) GetRecord(ctx context.Context, spaceRef, author, collection, rkey string) (*models.SpaceRecord, error)
- func (m *SpaceRepoMan) GetRepo(ctx context.Context, spaceRef, author string) (models.SpaceRepo, error)
- func (m *SpaceRepoMan) ListCurrentRecords(ctx context.Context, spaceRef, author, cursor string, limit int) ([]models.SpaceRecord, string, error)
- func (m *SpaceRepoMan) ListOperations(ctx context.Context, spaceRef, author, cursor string, limit int) ([]models.SpaceRepoOp, string, error)
- func (m *SpaceRepoMan) ListOps(ctx context.Context, spaceRef, author, cursor string, limit int) ([]models.SpaceRepoOp, string, error)
- func (m *SpaceRepoMan) ListRecords(ctx context.Context, spaceRef, author, cursor string, limit int) ([]models.SpaceRecord, string, error)
- func (m *SpaceRepoMan) PutRecord(ctx context.Context, spaceRef, author, collection, rkey string, record any) (SpaceRepoBatch, error)
- func (m *SpaceRepoMan) PutRecordWithAuthorization(ctx context.Context, spaceRef, author, collection, rkey string, record any, ...) (SpaceRepoBatch, error)
- func (m *SpaceRepoMan) SetFailureHook(hook SpaceRepoFailureHook) func()
- func (m *SpaceRepoMan) SetFailureStage(stage SpaceRepoFailureStage) func()
- type SpaceRepoOpType
- type SpaceRepoOperation
- type SpaceRepoWrite
- type TemplateRenderer
- type ValidationError
Constants ¶
const ( PrincipalOAuth PrincipalType = "oauth" PrincipalSpaceCredential PrincipalType = "space_credential" PrincipalDelegation PrincipalType = "space_delegation" PrincipalServiceAuth PrincipalType = "service_auth" // Verbose aliases are useful to callers that prefer type-prefixed names. PrincipalTypeOAuth = PrincipalOAuth PrincipalTypeSpaceCredential = PrincipalSpaceCredential PrincipalTypeDelegation = PrincipalDelegation PrincipalTypeServiceAuth = PrincipalServiceAuth )
const ( OAuthOnlyPolicy = PolicyOAuthOnly OAuthOrSpaceCredentialPolicy = PolicyOAuthOrSpace DelegationExchangePolicy = PolicyDelegationExchange SpaceCredentialOnlyPolicy = PolicySpaceCredentialOnly ServiceAuthOnlyPolicy = PolicyServiceAuthOnly )
Aliases use the names from the endpoint policy design.
const ( BlobDeletionPending = "pending" BlobDeletionRetry = "retry" BlobDeletionDeleted = "deleted" BlobDeletionFailed = "failed" )
const ( SpaceNotifyWriteLXM = "com.atproto.space.notifyWrite" SpaceNotifySpaceDeletedLXM = "com.atproto.space.notifySpaceDeleted" SpaceNotifyRegistrationTTL = 24 * time.Hour SpaceNotifyDeliveryTTL = 7 * 24 * time.Hour )
const ( SpaceNotifyDeliveryPending = "pending" SpaceNotifyDeliveryRetry = "retry" SpaceNotifyDeliveryDelivered = "delivered" SpaceNotifyDeliveryExpired = "expired" SpaceNotifyDeliveryFailed = "failed" )
const ( SpaceRepoOpCreate SpaceRepoOpType = "create" SpaceRepoOpUpdate SpaceRepoOpType = "update" SpaceRepoOpDelete SpaceRepoOpType = "delete" SpaceRepoOpPut SpaceRepoOpType = "put" // Short aliases make callers that model applyWrites operations concise. SpaceRepoCreate = SpaceRepoOpCreate SpaceRepoUpdate = SpaceRepoOpUpdate SpaceRepoDelete = SpaceRepoOpDelete SpaceRepoPut = SpaceRepoOpPut )
const ( SpaceRepoFailureAfterRepoCreation SpaceRepoFailureStage = "after-repo-creation" SpaceRepoFailureAfterRecordMutation SpaceRepoFailureStage = "after-record-mutation" SpaceRepoFailureAfterBlobMutation SpaceRepoFailureStage = "after-blob-mutation" SpaceRepoFailureAfterOplogInsertion SpaceRepoFailureStage = "after-oplog-insertion" SpaceRepoFailureAfterHeadUpdate SpaceRepoFailureStage = "after-head-update" // Short names are useful in table-driven tests. FailureAfterRepoCreation = SpaceRepoFailureAfterRepoCreation FailureAfterRecordMutation = SpaceRepoFailureAfterRecordMutation FailureAfterBlobMutation = SpaceRepoFailureAfterBlobMutation FailureAfterOplogInsertion = SpaceRepoFailureAfterOplogInsertion FailureAfterHeadUpdate = SpaceRepoFailureAfterHeadUpdate )
const (
AccountSessionMaxAge = 30 * 24 * time.Hour // one week
)
const ( // BlobDeletionRetention is the documented minimum time successful deletion // rows remain available for audit/replay inspection. BlobDeletionRetention = 7 * 24 * time.Hour )
const (
BlockstoreVariantSqlite = iota
)
Variables ¶
var ( OpTypeCreate = OpType("com.atproto.repo.applyWrites#create") OpTypeUpdate = OpType("com.atproto.repo.applyWrites#update") OpTypeDelete = OpType("com.atproto.repo.applyWrites#delete") )
var (
CocoonSupportedScopes = []string{
"atproto",
"transition:email",
"transition:generic",
"transition:chat.bsky",
}
)
var ErrSessionUnauthenticated = errors.New("session is unauthenticated")
var ErrSpaceNotifyRevisionConflict = errors.New("space notification revision has conflicting hash")
ErrSpaceNotifyRevisionConflict indicates that a notification reused an existing revision with a different hash. The conflicting snapshot is never persisted or forwarded.
Functions ¶
func NewDelegationExchangeMiddleware ¶ added in v0.11.1
func NewDelegationExchangeMiddleware(s *Server, next echo.HandlerFunc) echo.HandlerFunc
func NewOAuthOnlyMiddleware ¶ added in v0.11.1
func NewOAuthOnlyMiddleware(s *Server, next echo.HandlerFunc) echo.HandlerFunc
Constructor-function spellings make policy selection explicit at call sites that prefer package-level middleware constructors.
func NewOAuthOrSpaceCredentialMiddleware ¶ added in v0.11.1
func NewOAuthOrSpaceCredentialMiddleware(s *Server, next echo.HandlerFunc) echo.HandlerFunc
func NewServiceAuthOnlyMiddleware ¶ added in v0.11.1
func NewServiceAuthOnlyMiddleware(s *Server, next echo.HandlerFunc) echo.HandlerFunc
func NewSpaceCredentialOnlyMiddleware ¶ added in v0.11.1
func NewSpaceCredentialOnlyMiddleware(s *Server, next echo.HandlerFunc) echo.HandlerFunc
func ParseSpaceNotificationHash ¶ added in v0.11.1
func SetPrincipal ¶ added in v0.11.1
SetPrincipal installs the typed principal and a compatibility alias in an Echo context. The alias is intentionally not used for authorization.
Types ¶
type AccountRevokeInput ¶ added in v0.7.2
type AccountRevokeInput struct {
Token string `form:"token"`
}
type AccountSwitchRequest ¶ added in v0.11.0
type ApplyWriteResult ¶
type ApplyWriteResult struct {
Type *string `json:"$type,omitempty"`
Uri *string `json:"uri,omitempty"`
Cid *string `json:"cid,omitempty"`
Commit *RepoCommit `json:"commit,omitempty"`
ValidationStatus *string `json:"validationStatus,omitempty"`
}
type Args ¶
type Args struct {
Logger *slog.Logger
LogLevel slog.Level
Addr string
DbName string
DbType string
DatabaseURL string
Version string
Did string
Hostname string
RotationKeyPath string
JwkPath string
ContactEmail string
Relays []string
AdminPassword string
RequireInvite bool
SpacesEnabled bool
SmtpUser string
SmtpPass string
SmtpHost string
SmtpPort string
SmtpEmail string
SmtpName string
S3Config *S3Config
SessionSecret string
SessionCookieKey string
BlockstoreVariant BlockstoreVariant
FallbackProxy string
}
type AuthPolicy ¶ added in v0.11.1
type AuthPolicy string
Policy names are intentionally explicit. A route should select one policy rather than composing the old legacy and OAuth middlewares by accident.
const ( PolicyOAuthOnly AuthPolicy = "oauth_only" PolicyOAuthOrSpace AuthPolicy = "oauth_or_space_credential" PolicyDelegationExchange AuthPolicy = "delegation_exchange" PolicySpaceCredentialOnly AuthPolicy = "space_credential_only" PolicyServiceAuthOnly AuthPolicy = "service_auth_only" )
type AuthPrincipal ¶ added in v0.11.1
type AuthPrincipal = Principal
type BlobDeletionS3Client ¶ added in v0.11.1
type BlobDeletionS3Client interface {
DeleteObject(*s3.DeleteObjectInput) (*s3.DeleteObjectOutput, error)
}
BlobDeletionS3Client is the small part of the AWS client needed by the durable deletion worker. Keeping this interface narrow makes tests safe and prevents the worker from depending on provider-specific client state.
type BlobDeletionWorker ¶ added in v0.11.1
type BlobDeletionWorker struct {
// contains filtered or unexported fields
}
BlobDeletionWorker processes only rows visible through the root database connection. Consequently rows written by an account-delete transaction are not eligible until that transaction commits.
func NewBlobDeletionWorker ¶ added in v0.11.1
func NewBlobDeletionWorker(s *Server) *BlobDeletionWorker
func NewBlobDeletionWorkerForDB ¶ added in v0.11.1
func NewBlobDeletionWorkerForDB(database *db.DB, client BlobDeletionS3Client, clock func() time.Time) *BlobDeletionWorker
func (*BlobDeletionWorker) ProcessOnce ¶ added in v0.11.1
func (*BlobDeletionWorker) PruneDeleted ¶ added in v0.11.1
func (w *BlobDeletionWorker) PruneDeleted(ctx context.Context) (int64, error)
PruneDeleted removes only successful deletion rows older than the configured retention interval. Pending/retry/failed rows are never pruned.
func (*BlobDeletionWorker) RunOnce ¶ added in v0.11.1
RunOnce processes at most limit eligible rows. Network I/O happens before the terminal DB update, never inside an account transaction. DeleteObject is idempotent; a provider's not-found response is therefore success.
func (*BlobDeletionWorker) SetClock ¶ added in v0.11.1
func (w *BlobDeletionWorker) SetClock(clock func() time.Time)
func (*BlobDeletionWorker) SetOptions ¶ added in v0.11.1
func (w *BlobDeletionWorker) SetOptions(options BlobDeletionWorkerOptions)
func (*BlobDeletionWorker) SetS3Client ¶ added in v0.11.1
func (w *BlobDeletionWorker) SetS3Client(client BlobDeletionS3Client)
type BlobDeletionWorkerOptions ¶ added in v0.11.1
type BlockstoreVariant ¶
type BlockstoreVariant int
func MustReturnBlockstoreVariant ¶
func MustReturnBlockstoreVariant(maybeBsv string) BlockstoreVariant
type ComAtprotoIdentityUpdateHandleRequest ¶
type ComAtprotoIdentityUpdateHandleRequest struct {
Handle string `json:"handle" validate:"atproto-handle"`
}
type ComAtprotoLabelQueryLabelsResponse ¶ added in v0.7.1
type ComAtprotoRepoApplyWritesInput ¶ added in v0.7.2
type ComAtprotoRepoApplyWritesInput struct {
Repo string `json:"repo" validate:"required,atproto-did"`
Validate *bool `json:"bool,omitempty"`
Writes []ComAtprotoRepoApplyWritesItem `json:"writes"`
SwapCommit *string `json:"swapCommit"`
}
type ComAtprotoRepoApplyWritesItem ¶
type ComAtprotoRepoApplyWritesItem struct {
Type string `json:"$type"`
Collection string `json:"collection"`
Rkey string `json:"rkey"`
Value *MarshalableMap `json:"value,omitempty"`
}
type ComAtprotoRepoApplyWritesOutput ¶ added in v0.7.2
type ComAtprotoRepoApplyWritesOutput struct {
Commit RepoCommit `json:"commit"`
Results []ApplyWriteResult `json:"results"`
}
type ComAtprotoRepoCreateRecordInput ¶ added in v0.7.2
type ComAtprotoRepoCreateRecordInput struct {
Repo string `json:"repo" validate:"required,atproto-did"`
Collection string `json:"collection" validate:"required,atproto-nsid"`
Rkey *string `json:"rkey,omitempty"`
Validate *bool `json:"bool,omitempty"`
Record MarshalableMap `json:"record" validate:"required"`
SwapRecord *string `json:"swapRecord"`
SwapCommit *string `json:"swapCommit"`
}
type ComAtprotoRepoDeleteRecordInput ¶ added in v0.7.2
type ComAtprotoRepoDeleteRecordInput struct {
Repo string `json:"repo" validate:"required,atproto-did"`
Collection string `json:"collection" validate:"required,atproto-nsid"`
Rkey string `json:"rkey" validate:"required,atproto-rkey"`
SwapRecord *string `json:"swapRecord"`
SwapCommit *string `json:"swapCommit"`
}
type ComAtprotoRepoListMissingBlobsRecordBlob ¶ added in v0.6.0
type ComAtprotoRepoListMissingBlobsResponse ¶ added in v0.6.0
type ComAtprotoRepoListMissingBlobsResponse struct {
Cursor *string `json:"cursor,omitempty"`
Blobs []ComAtprotoRepoListMissingBlobsRecordBlob `json:"blobs"`
}
type ComAtprotoRepoListRecordsResponse ¶
type ComAtprotoRepoListRecordsResponse struct {
Cursor *string `json:"cursor,omitempty"`
Records []ComAtprotoRepoListRecordsRecordItem `json:"records"`
}
type ComAtprotoRepoPutRecordInput ¶ added in v0.7.2
type ComAtprotoRepoPutRecordInput struct {
Repo string `json:"repo" validate:"required,atproto-did"`
Collection string `json:"collection" validate:"required,atproto-nsid"`
Rkey string `json:"rkey" validate:"required,atproto-rkey"`
Validate *bool `json:"bool,omitempty"`
Record MarshalableMap `json:"record" validate:"required"`
SwapRecord *string `json:"swapRecord"`
SwapCommit *string `json:"swapCommit"`
}
type ComAtprotoRequestEmailUpdateResponse ¶
type ComAtprotoRequestEmailUpdateResponse struct {
TokenRequired bool `json:"tokenRequired"`
}
type ComAtprotoServerCheckAccountStatusResponse ¶
type ComAtprotoServerCheckAccountStatusResponse struct {
Activated bool `json:"activated"`
ValidDid bool `json:"validDid"`
RepoCommit string `json:"repoCommit"`
RepoRev string `json:"repoRev"`
RepoBlocks int64 `json:"repoBlocks"`
IndexedRecords int64 `json:"indexedRecords"`
PrivateStateValues int64 `json:"privateStateValues"`
ExpectedBlobs int64 `json:"expectedBlobs"`
ImportedBlobs int64 `json:"importedBlobs"`
}
type ComAtprotoServerCreateAccountRequest ¶
type ComAtprotoServerCreateAccountRequest struct {
Email string `json:"email" validate:"required,email"`
Handle string `json:"handle" validate:"required,atproto-handle"`
Did *string `json:"did" validate:"atproto-did"`
Password string `json:"password" validate:"required"`
InviteCode string `json:"inviteCode" validate:"omitempty"`
}
type ComAtprotoServerCreateInviteCodeResponse ¶
type ComAtprotoServerCreateInviteCodeResponse struct {
Code string `json:"code"`
}
type ComAtprotoServerCreateInviteCodesResponse ¶
type ComAtprotoServerCreateInviteCodesResponse []ComAtprotoServerCreateInviteCodesItem
type ComAtprotoServerCreateSessionResponse ¶
type ComAtprotoServerCreateSessionResponse struct {
AccessJwt string `json:"accessJwt"`
RefreshJwt string `json:"refreshJwt"`
Handle string `json:"handle"`
Did string `json:"did"`
Email string `json:"email"`
EmailConfirmed bool `json:"emailConfirmed"`
EmailAuthFactor bool `json:"emailAuthFactor"`
Active bool `json:"active"`
Status *string `json:"status,omitempty"`
}
type ComAtprotoServerDeleteAccountRequest ¶ added in v0.7.0
type ComAtprotoServerDescribeServerResponse ¶
type ComAtprotoServerDescribeServerResponse struct {
InviteCodeRequired bool `json:"inviteCodeRequired"`
PhoneVerificationRequired bool `json:"phoneVerificationRequired"`
AvailableUserDomains []string `json:"availableUserDomains"`
Links ComAtprotoServerDescribeServerResponseLinks `json:"links"`
Contact ComAtprotoServerDescribeServerResponseContact `json:"contact"`
Did string `json:"did"`
}
type ComAtprotoServerDescribeServerResponseContact ¶
type ComAtprotoServerDescribeServerResponseContact struct {
Email string `json:"email"`
}
type ComAtprotoServerRequestPasswordResetRequest ¶
type ComAtprotoServerRequestPasswordResetRequest struct {
Email string `json:"email" validate:"required"`
}
type ComAtprotoSimpleSpaceCreateSpaceInput ¶ added in v0.11.1
type ComAtprotoSimpleSpaceCreateSpaceInput struct {
Type string `json:"type"`
SKey *string `json:"skey,omitempty"`
Policy json.RawMessage `json:"policy"`
AppAccess json.RawMessage `json:"appAccess"`
}
type ComAtprotoSimpleSpaceCreateSpaceOutput ¶ added in v0.11.1
type ComAtprotoSimpleSpaceCreateSpaceOutput struct {
URI string `json:"uri"`
}
type ComAtprotoSimpleSpaceDeleteSpaceInput ¶ added in v0.11.1
type ComAtprotoSimpleSpaceDeleteSpaceInput struct {
Space string `json:"space"`
}
type ComAtprotoSimpleSpaceGetSpaceOutput ¶ added in v0.11.1
type ComAtprotoSimpleSpaceGetSpaceOutput struct {
URI string `json:"uri"`
Policy json.RawMessage `json:"policy"`
AppAccess json.RawMessage `json:"appAccess"`
}
type ComAtprotoSimpleSpaceListMembersOutput ¶ added in v0.11.1
type ComAtprotoSimpleSpaceListMembersOutput struct {
Cursor *string `json:"cursor,omitempty"`
Members []ComAtprotoSimpleSpaceMember `json:"members"`
}
type ComAtprotoSimpleSpaceMember ¶ added in v0.11.1
type ComAtprotoSimpleSpaceMember struct {
DID string `json:"did"`
}
type ComAtprotoSimpleSpaceMemberInput ¶ added in v0.11.1
type ComAtprotoSimpleSpaceUpdateSpaceInput ¶ added in v0.11.1
type ComAtprotoSimpleSpaceUpdateSpaceInput struct {
Space string `json:"space"`
Policy json.RawMessage `json:"policy,omitempty"`
AppAccess json.RawMessage `json:"appAccess,omitempty"`
}
type ComAtprotoSpaceApplyWritesElement ¶ added in v0.11.1
type ComAtprotoSpaceApplyWritesElement struct {
Type string `json:"$type"`
Collection string `json:"collection"`
Rkey *string `json:"rkey,omitempty"`
Value MarshalableMap `json:"value,omitempty"`
}
ComAtprotoSpaceApplyWritesElement is the closed union element. Type is one of com.atproto.space.applyWrites#{create,update,delete}.
type ComAtprotoSpaceApplyWritesInput ¶ added in v0.11.1
type ComAtprotoSpaceApplyWritesInput struct {
Space string `json:"space"`
Repo string `json:"repo"`
Validate *bool `json:"validate,omitempty"`
Writes []ComAtprotoSpaceApplyWritesElement `json:"writes"`
}
ComAtprotoSpaceApplyWritesInput is the pinned input shape for com.atproto.space.applyWrites.
type ComAtprotoSpaceApplyWritesOutput ¶ added in v0.11.1
type ComAtprotoSpaceApplyWritesOutput struct {
Results []ComAtprotoSpaceApplyWritesResult `json:"results"`
}
ComAtprotoSpaceApplyWritesOutput is the pinned applyWrites output shape.
type ComAtprotoSpaceApplyWritesResult ¶ added in v0.11.1
type ComAtprotoSpaceApplyWritesResult struct {
Type string `json:"$type"`
URI string `json:"uri,omitempty"`
CID string `json:"cid,omitempty"`
ValidationStatus *string `json:"validationStatus,omitempty"`
}
ComAtprotoSpaceApplyWritesResult is the closed result union. The $type tag is required on the wire even though it is implicit in the lexicon union.
type ComAtprotoSpaceCreateRecordInput ¶ added in v0.11.1
type ComAtprotoSpaceCreateRecordInput struct {
Space string `json:"space"`
Repo string `json:"repo"`
Collection string `json:"collection"`
Rkey *string `json:"rkey,omitempty"`
Validate *bool `json:"validate,omitempty"`
Record MarshalableMap `json:"record"`
}
ComAtprotoSpaceCreateRecordInput is the pinned input shape for com.atproto.space.createRecord.
type ComAtprotoSpaceDeleteRecordInput ¶ added in v0.11.1
type ComAtprotoSpaceDeleteRecordInput struct {
Space string `json:"space"`
Repo string `json:"repo"`
Collection string `json:"collection"`
Rkey string `json:"rkey"`
}
ComAtprotoSpaceDeleteRecordInput is the pinned input shape for com.atproto.space.deleteRecord.
type ComAtprotoSpaceGetDelegationTokenOutput ¶ added in v0.11.1
type ComAtprotoSpaceGetDelegationTokenOutput struct {
Token string `json:"token"`
}
ComAtprotoSpaceGetDelegationTokenOutput is the pinned delegation output.
type ComAtprotoSpaceGetLatestCommitResponse ¶ added in v0.11.1
type ComAtprotoSpaceGetLatestCommitResponse struct {
Commit space.SignedCommit `json:"commit"`
}
type ComAtprotoSpaceGetRecordResponse ¶ added in v0.11.1
type ComAtprotoSpaceGetSpaceCredentialInput ¶ added in v0.11.1
type ComAtprotoSpaceGetSpaceCredentialOutput ¶ added in v0.11.1
type ComAtprotoSpaceGetSpaceCredentialOutput struct {
Credential string `json:"credential"`
}
type ComAtprotoSpaceListBlobsResponse ¶ added in v0.11.1
type ComAtprotoSpaceListRecordsRecord ¶ added in v0.11.1
type ComAtprotoSpaceListRecordsResponse ¶ added in v0.11.1
type ComAtprotoSpaceListRecordsResponse struct {
Cursor *string `json:"cursor,omitempty"`
Records []ComAtprotoSpaceListRecordsRecord `json:"records"`
}
type ComAtprotoSpaceListRepoOpsResponse ¶ added in v0.11.1
type ComAtprotoSpaceListRepoOpsResponse struct {
Cursor *string `json:"cursor,omitempty"`
Ops []ComAtprotoSpaceRepoOp `json:"ops"`
Commit *space.SignedCommit `json:"commit,omitempty"`
}
type ComAtprotoSpaceListReposRepoRef ¶ added in v0.11.1
type ComAtprotoSpaceListReposRepoRef struct {
DID string `json:"did"`
Rev string `json:"rev"`
Hash string `json:"hash"`
}
func (ComAtprotoSpaceListReposRepoRef) MarshalJSON ¶ added in v0.11.1
func (r ComAtprotoSpaceListReposRepoRef) MarshalJSON() ([]byte, error)
func (*ComAtprotoSpaceListReposRepoRef) UnmarshalJSON ¶ added in v0.11.1
func (r *ComAtprotoSpaceListReposRepoRef) UnmarshalJSON(data []byte) error
type ComAtprotoSpaceListReposResponse ¶ added in v0.11.1
type ComAtprotoSpaceListReposResponse struct {
Cursor *string `json:"cursor,omitempty"`
Repos []ComAtprotoSpaceListReposRepoRef `json:"repos"`
}
type ComAtprotoSpaceListSpacesOutput ¶ added in v0.11.1
type ComAtprotoSpaceListSpacesOutput struct {
Cursor *string `json:"cursor,omitempty"`
Spaces []ComAtprotoSpaceListSpacesSpaceView `json:"spaces"`
}
ComAtprotoSpaceListSpacesOutput is the pinned listSpaces output shape.
type ComAtprotoSpaceListSpacesSpaceView ¶ added in v0.11.1
type ComAtprotoSpaceListSpacesSpaceView struct {
URI string `json:"uri"`
}
ComAtprotoSpaceListSpacesSpaceView is the pinned listSpaces spaceView.
type ComAtprotoSpaceNotifySpaceDeletedInput ¶ added in v0.11.1
type ComAtprotoSpaceNotifySpaceDeletedInput struct {
Space string `json:"space"`
}
type ComAtprotoSpaceNotifyWriteInput ¶ added in v0.11.1
type ComAtprotoSpaceNotifyWriteInput struct {
Space string `json:"space"`
Repo string `json:"repo"`
Rev string `json:"rev"`
Hash string `json:"hash"`
}
ComAtprotoSpaceNotifyWriteInput is deliberately metadata-only. Hash is the JSON bytes string from the pinned Lexicon; no record or blob fields are accepted or persisted.
type ComAtprotoSpacePutRecordInput ¶ added in v0.11.1
type ComAtprotoSpacePutRecordInput struct {
Space string `json:"space"`
Repo string `json:"repo"`
Collection string `json:"collection"`
Rkey string `json:"rkey"`
Validate *bool `json:"validate,omitempty"`
Record MarshalableMap `json:"record"`
}
ComAtprotoSpacePutRecordInput is the pinned input shape for com.atproto.space.putRecord.
type ComAtprotoSpaceRecordWriteOutput ¶ added in v0.11.1
type ComAtprotoSpaceRecordWriteOutput struct {
URI string `json:"uri"`
CID string `json:"cid"`
ValidationStatus *string `json:"validationStatus,omitempty"`
}
ComAtprotoSpaceRecordWriteOutput is shared by createRecord and putRecord.
type ComAtprotoSpaceRegisterNotifyInput ¶ added in v0.11.1
type ComAtprotoSpaceRegisterNotifyInput struct {
Space string `json:"space"`
Service string `json:"service"`
}
ComAtprotoSpaceRegisterNotifyInput is the pinned registerNotify body.
type ComAtprotoSpaceRegisterNotifyOutput ¶ added in v0.11.1
type ComAtprotoSpaceRepoOp ¶ added in v0.11.1
type ComAtprotoSpaceUnregisterNotifyInput ¶ added in v0.11.1
type ComAtprotoSpaceUnregisterNotifyInput struct {
Space string `json:"space"`
Service string `json:"service"`
}
ComAtprotoSpaceUnregisterNotifyInput is the pinned unregisterNotify body.
type ComAtprotoSyncListReposResponse ¶
type ComAtprotoSyncListReposResponse struct {
Cursor *string `json:"cursor,omitempty"`
Repos []ComAtprotoSyncListReposRepoItem `json:"repos"`
}
type CustomValidator ¶
type CustomValidator struct {
// contains filtered or unexported fields
}
func (*CustomValidator) Validate ¶
func (cv *CustomValidator) Validate(i any) error
type DIDDocumentFetcher ¶ added in v0.11.1
type DIDDocumentFetcher interface {
FetchDoc(context.Context, string) (*cocoon_identity.DidDoc, error)
ResolveHandle(context.Context, string) (string, error)
BustDoc(context.Context, string) error
BustDid(context.Context, string) error
}
DIDDocumentFetcher is the small Passport contract needed by Space auth. It keeps production backed by the server's Passport while allowing hermetic tests to provide a fake document source.
type DIDSpaceAuthorityKeyResolver ¶ added in v0.11.1
type DIDSpaceAuthorityKeyResolver struct{ Source SpaceAuthorityKeySource }
DIDSpaceAuthorityKeyResolver adapts a DID key source and retries a #atproto_space lookup with the legacy #atproto key id. This is the explicit fallback contract; it does not itself perform network resolution.
func NewDIDSpaceAuthorityKeyResolver ¶ added in v0.11.1
func NewDIDSpaceAuthorityKeyResolver(source SpaceAuthorityKeySource) *DIDSpaceAuthorityKeyResolver
func (*DIDSpaceAuthorityKeyResolver) ResolveSigningKey ¶ added in v0.11.1
func (r *DIDSpaceAuthorityKeyResolver) ResolveSigningKey(ctx context.Context, req space.KeyResolutionRequest) (space.Verifier, error)
type DbPersister ¶ added in v0.8.4
type DbPersister struct {
Db *gorm.DB
Lk sync.Mutex
Seq int64
Broadcast func(*events.XRPCStreamEvent)
// how long do we actually want to keep these things around
Retention time.Duration
}
func NewDbPersister ¶ added in v0.8.4
func (*DbPersister) Persist ¶ added in v0.8.4
func (p *DbPersister) Persist(ctx context.Context, e *events.XRPCStreamEvent) error
func (*DbPersister) Playback ¶ added in v0.8.4
func (p *DbPersister) Playback(ctx context.Context, since int64, cb func(*events.XRPCStreamEvent) error) error
func (*DbPersister) SetEventBroadcaster ¶ added in v0.8.4
func (p *DbPersister) SetEventBroadcaster(brc func(*events.XRPCStreamEvent))
func (*DbPersister) Shutdown ¶ added in v0.8.4
func (p *DbPersister) Shutdown(ctx context.Context) error
func (*DbPersister) TakeDownRepo ¶ added in v0.8.4
func (p *DbPersister) TakeDownRepo(ctx context.Context, uid indigomodels.Uid) error
type DelegationPrincipal ¶ added in v0.11.1
type DelegationPrincipal struct {
SpaceURI string
AuthorityDID string
Token string
Claims space.SpaceTokenClaims
DPoPJKT string
DPoPJTI string
DPoPIssuedAt time.Time
}
DelegationPrincipal is installed by DelegationExchange after both the delegation token and issuance DPoP proof have been verified.
func (*DelegationPrincipal) PrincipalType ¶ added in v0.11.1
func (p *DelegationPrincipal) PrincipalType() PrincipalType
type ES256KSigningMethod ¶
type ES256KSigningMethod struct {
// contains filtered or unexported fields
}
func (*ES256KSigningMethod) Alg ¶
func (m *ES256KSigningMethod) Alg() string
type HandleOauthAuthorizeGetInput ¶ added in v0.8.1
type HandleOauthAuthorizeGetInput struct {
RequestUri string `query:"request_uri"`
}
type MarshalableMap ¶
func (*MarshalableMap) MarshalCBOR ¶
func (mm *MarshalableMap) MarshalCBOR(w io.Writer) error
type OAuthPrincipal ¶ added in v0.11.1
type OAuthPrincipal struct {
Subject string
ClientID string
Scopes []string
DPoPJKT string
Token string
Repo *models.RepoActor
// Legacy marks a password/session access token. Reference atproto permits
// these tokens on authorization routes and bypasses granular OAuth scopes.
Legacy bool
}
OAuthPrincipal describes an OAuth access token that passed token and (when applicable) DPoP/token-database validation.
func (*OAuthPrincipal) GetClientID ¶ added in v0.11.1
func (p *OAuthPrincipal) GetClientID() string
func (*OAuthPrincipal) GetScopes ¶ added in v0.11.1
func (p *OAuthPrincipal) GetScopes() []string
func (*OAuthPrincipal) GetSubject ¶ added in v0.11.1
func (p *OAuthPrincipal) GetSubject() string
func (*OAuthPrincipal) PrincipalType ¶ added in v0.11.1
func (p *OAuthPrincipal) PrincipalType() PrincipalType
type OauthAuthorizationMetadata ¶
type OauthAuthorizationMetadata struct {
Issuer string `json:"issuer"`
RequestParameterSupported bool `json:"request_parameter_supported"`
RequestUriParameterSupported bool `json:"request_uri_parameter_supported"`
RequireRequestUriRegistration *bool `json:"require_request_uri_registration,omitempty"`
ScopesSupported []string `json:"scopes_supported"`
SubjectTypesSupported []string `json:"subject_types_supported"`
ResponseTypesSupported []string `json:"response_types_supported"`
ResponseModesSupported []string `json:"response_modes_supported"`
GrantTypesSupported []string `json:"grant_types_supported"`
CodeChallengeMethodsSupported []string `json:"code_challenge_methods_supported"`
UILocalesSupported []string `json:"ui_locales_supported"`
DisplayValuesSupported []string `json:"display_values_supported"`
RequestObjectSigningAlgValuesSupported []string `json:"request_object_signing_alg_values_supported"`
AuthorizationResponseISSParameterSupported bool `json:"authorization_response_iss_parameter_supported"`
RequestObjectEncryptionAlgValuesSupported []string `json:"request_object_encryption_alg_values_supported"`
RequestObjectEncryptionEncValuesSupported []string `json:"request_object_encryption_enc_values_supported"`
JwksUri string `json:"jwks_uri"`
AuthorizationEndpoint string `json:"authorization_endpoint"`
TokenEndpoint string `json:"token_endpoint"`
TokenEndpointAuthMethodsSupported []string `json:"token_endpoint_auth_methods_supported"`
TokenEndpointAuthSigningAlgValuesSupported []string `json:"token_endpoint_auth_signing_alg_values_supported"`
RevocationEndpoint string `json:"revocation_endpoint"`
IntrospectionEndpoint string `json:"introspection_endpoint"`
PushedAuthorizationRequestEndpoint string `json:"pushed_authorization_request_endpoint"`
RequirePushedAuthorizationRequests bool `json:"require_pushed_authorization_requests"`
DpopSigningAlgValuesSupported []string `json:"dpop_signing_alg_values_supported"`
ProtectedResources []string `json:"protected_resources"`
ClientIDMetadataDocumentSupported bool `json:"client_id_metadata_document_supported"`
}
type OauthJwksResponse ¶
type OauthJwksResponse struct {
Keys []any `json:"keys"`
}
type OauthParResponse ¶
type OauthRevokeRequest ¶ added in v0.11.0
type OauthRevokeRequest struct {
provider.AuthenticateClientRequestBase
Token string `form:"token" json:"token"`
TokenTypeHint *string `form:"token_type_hint" json:"token_type_hint,omitempty"`
}
type OauthSigninInput ¶ added in v0.7.2
type OauthTokenRequest ¶
type OauthTokenRequest struct {
provider.AuthenticateClientRequestBase
GrantType string `form:"grant_type" json:"grant_type"`
Code *string `form:"code" json:"code,omitempty"`
CodeVerifier *string `form:"code_verifier" json:"code_verifier,omitempty"`
RedirectURI *string `form:"redirect_uri" json:"redirect_uri,omitempty"`
RefreshToken *string `form:"refresh_token" json:"refresh_token,omitempty"`
}
type OauthTokenResponse ¶
type PassportSpaceAuthorityKeyResolver ¶ added in v0.11.1
type PassportSpaceAuthorityKeyResolver struct{ Passport DIDDocumentFetcher }
PassportSpaceAuthorityKeyResolver is the production DID-backed resolver for Space credentials and delegation tokens.
func NewPassportSpaceAuthorityKeyResolver ¶ added in v0.11.1
func NewPassportSpaceAuthorityKeyResolver(passport DIDDocumentFetcher) *PassportSpaceAuthorityKeyResolver
func (*PassportSpaceAuthorityKeyResolver) ResolveSigningKey ¶ added in v0.11.1
func (r *PassportSpaceAuthorityKeyResolver) ResolveSigningKey(ctx context.Context, req space.KeyResolutionRequest) (space.Verifier, error)
type Principal ¶ added in v0.11.1
type Principal interface {
PrincipalType() PrincipalType
}
Principal is the common request-context authentication contract. Concrete principals deliberately retain protocol-specific claims for handlers that need them, while new handlers can make authorization decisions without reading legacy context keys.
func GetPrincipal ¶ added in v0.11.1
GetPrincipal is a compatibility accessor for new handlers.
func PrincipalFromContext ¶ added in v0.11.1
PrincipalFromContext returns the verified request principal, if any.
type PrincipalType ¶ added in v0.11.1
type PrincipalType string
PrincipalType identifies the authenticated protocol principal installed on a request. A principal is installed only after its protocol-specific verifier has completed successfully.
type RecommitOptions ¶ added in v0.11.0
type RecommitOptions struct {
// Dids is the set of repos to process.
Dids []string
// DryRun reports planned actions without mutating repos or emitting events.
DryRun bool
// BlockstoreVariant selects the block store (mirrors the server flag).
BlockstoreVariant string
Logger *slog.Logger
}
RecommitOptions configures RunRecommitMigration.
type RecommitResult ¶ added in v0.11.0
type RecommitResult struct {
Did string
OldRev string
NewRev string
OldHead string
NewHead string
Recommitted bool
Err error
}
RecommitResult is the per-repo outcome of the migration.
func RunRecommitMigration ¶ added in v0.11.0
func RunRecommitMigration(ctx context.Context, gdb *gorm.DB, opts RecommitOptions) ([]RecommitResult, error)
RunRecommitMigration re-mints valid revs for repos whose stored rev is not a valid TID, and announces each repo's current head to the firehose.
For every did it re-commits when the rev is invalid (a fresh signed commit with a current 13-char TID rev and new head), then emits #sync (head announcement), #identity (handle refresh), and #account (active) so relays observe the repo's authoritative state. Re-committing is silent on the commit stream; #sync is the spec's frame for out-of-band state changes.
IMPORTANT: events carry an in-memory sequence number, so this must run with the PDS stopped to avoid colliding with the live server's sequence.
type RepoCommit ¶
type RequestPrincipal ¶ added in v0.11.1
type RequestPrincipal = Principal
RequestPrincipal and AuthPrincipal are compatibility spellings for Principal.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
func (*Server) AuthDispatcher ¶ added in v0.11.1
func (s *Server) AuthDispatcher(policy AuthPolicy, next echo.HandlerFunc) echo.HandlerFunc
AuthDispatcher is the one entry point for route-specific authentication. It never calls legacy middleware for Space token types.
func (*Server) DelegationExchange ¶ added in v0.11.1
func (s *Server) DelegationExchange(next echo.HandlerFunc) echo.HandlerFunc
func (*Server) OAuthOnly ¶ added in v0.11.1
func (s *Server) OAuthOnly(next echo.HandlerFunc) echo.HandlerFunc
Explicit policy constructors. These methods are suitable as Echo route middleware and do not need to be combined with legacy middleware.
func (*Server) OAuthOrSpaceCredential ¶ added in v0.11.1
func (s *Server) OAuthOrSpaceCredential(next echo.HandlerFunc) echo.HandlerFunc
func (*Server) QueueSpaceDeletedNotifications ¶ added in v0.11.1
QueueSpaceDeletedNotifications records the tombstone and fans out durable deletion deliveries; it performs no network I/O.
func (*Server) RecordSpaceNotifySpaceDeleted ¶ added in v0.11.1
func (*Server) RecordSpaceNotifyWrite ¶ added in v0.11.1
func (*Server) ServiceAuthOnly ¶ added in v0.11.1
func (s *Server) ServiceAuthOnly(next echo.HandlerFunc) echo.HandlerFunc
func (*Server) SetBlobDeletionS3Client ¶ added in v0.11.1
func (s *Server) SetBlobDeletionS3Client(client BlobDeletionS3Client)
func (*Server) SetManagingAppAuthorizer ¶ added in v0.11.1
func (s *Server) SetManagingAppAuthorizer(a SimpleSpaceManagingAppAuthorizer)
SetManagingAppAuthorizer is a concise compatibility spelling for integration.
func (*Server) SetPassport ¶ added in v0.11.1
func (s *Server) SetPassport(passport DIDDocumentFetcher)
SetPassport injects the Passport-compatible identity source used by service-auth and production Space authority key resolution. It is primarily useful for hermetic tests and hosts with a custom identity cache.
func (*Server) SetSimpleSpaceManagingAppAuthorizer ¶ added in v0.11.1
func (s *Server) SetSimpleSpaceManagingAppAuthorizer(a SimpleSpaceManagingAppAuthorizer)
SetSimpleSpaceManagingAppAuthorizer installs the managing-app checker. A nil checker intentionally leaves the policy fail-closed.
func (*Server) SetSpaceAuthorityKeyResolver ¶ added in v0.11.1
func (s *Server) SetSpaceAuthorityKeyResolver(resolver SpaceAuthorityKeyResolver)
SetSpaceAuthorityKeyResolver injects the DID/JWKS resolver used by Space credential and delegation verification. It is primarily useful for tests and for hosts with an identity cache.
func (*Server) SetSpaceNotificationClock ¶ added in v0.11.1
func (*Server) SetSpaceNotificationResolver ¶ added in v0.11.1
func (s *Server) SetSpaceNotificationResolver(r SpaceNotificationResolver)
func (*Server) SetSpaceNotificationSender ¶ added in v0.11.1
func (s *Server) SetSpaceNotificationSender(sender SpaceNotificationSender)
func (*Server) SetSpaceReplayStore ¶ added in v0.11.1
func (s *Server) SetSpaceReplayStore(store space.ReplayStore)
SetSpaceReplayStore injects a replay store. Production New configures a durable GORM store; tests may use space.MemoryReplayStore.
func (*Server) SetSpaceTypeResolver ¶ added in v0.11.1
func (s *Server) SetSpaceTypeResolver(resolver scopes.SpaceTypeResolver)
SetSpaceTypeResolver injects the local, typed space declaration resolver used for omitted-collection OAuth grants. It never performs network resolution.
func (*Server) SpaceCredentialOnly ¶ added in v0.11.1
func (s *Server) SpaceCredentialOnly(next echo.HandlerFunc) echo.HandlerFunc
type ServerReserveSigningKeyRequest ¶ added in v0.7.0
type ServerReserveSigningKeyRequest struct {
Did *string `json:"did"`
}
type ServerReserveSigningKeyResponse ¶ added in v0.7.0
type ServerReserveSigningKeyResponse struct {
SigningKey string `json:"signingKey"`
}
type ServiceAuthPrincipal ¶ added in v0.11.1
type ServiceAuthPrincipal struct {
Issuer string
Audience string
LXM string
Token string
Repo *models.RepoActor
}
ServiceAuthPrincipal describes a verified atproto service-auth token.
func (*ServiceAuthPrincipal) GetAudience ¶ added in v0.11.1
func (p *ServiceAuthPrincipal) GetAudience() string
func (*ServiceAuthPrincipal) GetIssuer ¶ added in v0.11.1
func (p *ServiceAuthPrincipal) GetIssuer() string
func (*ServiceAuthPrincipal) GetLXM ¶ added in v0.11.1
func (p *ServiceAuthPrincipal) GetLXM() string
func (*ServiceAuthPrincipal) PrincipalType ¶ added in v0.11.1
func (p *ServiceAuthPrincipal) PrincipalType() PrincipalType
type SimpleSpaceManagingAppAuthorizer ¶ added in v0.11.1
type SimpleSpaceManagingAppAuthorizer interface {
CheckUserAccess(context.Context, string, string, string, string) (bool, error)
}
SimpleSpaceManagingAppAuthorizer is the narrow host integration used for the pinned managing-app policy. The implementation must perform the outbound checkUserAccess request as the authority; this package deliberately has no inbound checkUserAccess route.
type SimpleSpaceManagingAppAuthorizerFunc ¶ added in v0.11.1
type SimpleSpaceManagingAppAuthorizerFunc func(context.Context, string, string, string, string) (bool, error)
SimpleSpaceManagingAppAuthorizerFunc adapts a function to the interface.
func (SimpleSpaceManagingAppAuthorizerFunc) CheckUserAccess ¶ added in v0.11.1
type SpaceAuthorityKeyResolver ¶ added in v0.11.1
type SpaceAuthorityKeyResolver interface {
ResolveSigningKey(context.Context, space.KeyResolutionRequest) (space.Verifier, error)
}
SpaceAuthorityKeyResolver resolves a Space authority verification key. The request's kid is untrusted until VerifySpaceToken verifies the signature; a resolver must therefore use it only as a key selection hint.
type SpaceAuthorityKeyResolverFunc ¶ added in v0.11.1
type SpaceAuthorityKeyResolverFunc func(context.Context, space.KeyResolutionRequest) (space.Verifier, error)
SpaceAuthorityKeyResolverFunc adapts a function to SpaceAuthorityKeyResolver.
func (SpaceAuthorityKeyResolverFunc) ResolveSigningKey ¶ added in v0.11.1
func (f SpaceAuthorityKeyResolverFunc) ResolveSigningKey(ctx context.Context, req space.KeyResolutionRequest) (space.Verifier, error)
type SpaceAuthorityKeySource ¶ added in v0.11.1
type SpaceAuthorityKeySource interface {
ResolveSpaceKey(context.Context, string, string, string) (space.Verifier, error)
}
SpaceAuthorityKeySource is the adapter contract for test/local key lookups. Production uses PassportSpaceAuthorityKeyResolver above.
type SpaceAuthorityKeySourceFunc ¶ added in v0.11.1
type SpaceAuthorityKeySourceFunc func(context.Context, string, string, string) (space.Verifier, error)
SpaceAuthorityKeySourceFunc adapts a DID/key lookup function.
func (SpaceAuthorityKeySourceFunc) ResolveSpaceKey ¶ added in v0.11.1
type SpaceCredentialPrincipal ¶ added in v0.11.1
type SpaceCredentialPrincipal struct {
SpaceURI string
AuthorityDID string
DPoPJKT string
Token string
Claims space.SpaceTokenClaims
TokenClaims space.SpaceTokenClaims
Repo *models.RepoActor
}
SpaceCredentialPrincipal describes a verified, DPoP-bound Space credential.
func (*SpaceCredentialPrincipal) GetAuthorityDID ¶ added in v0.11.1
func (p *SpaceCredentialPrincipal) GetAuthorityDID() string
func (*SpaceCredentialPrincipal) GetDPoPJKT ¶ added in v0.11.1
func (p *SpaceCredentialPrincipal) GetDPoPJKT() string
func (*SpaceCredentialPrincipal) GetSpaceURI ¶ added in v0.11.1
func (p *SpaceCredentialPrincipal) GetSpaceURI() string
func (*SpaceCredentialPrincipal) PrincipalType ¶ added in v0.11.1
func (p *SpaceCredentialPrincipal) PrincipalType() PrincipalType
type SpaceNotificationRepoSnapshot ¶ added in v0.11.1
SpaceNotificationRepoSnapshot is the bounded listRepos metadata used by reconciliation. A partial page never causes absent writers to be deleted.
type SpaceNotificationResolver ¶ added in v0.11.1
SpaceNotificationResolver is optional: registration can persist a service identifier without doing network I/O, while hosts that have a resolver may reject an unresolvable service eagerly.
type SpaceNotificationResolverFunc ¶ added in v0.11.1
type SpaceNotificationSender ¶ added in v0.11.1
type SpaceNotificationSenderFunc ¶ added in v0.11.1
func (SpaceNotificationSenderFunc) Send ¶ added in v0.11.1
func (f SpaceNotificationSenderFunc) Send(ctx context.Context, target string, d models.SpaceNotifyDelivery) error
type SpaceNotificationTargetResolver ¶ added in v0.11.1
type SpaceNotificationTargetResolver = SpaceNotificationResolver
SpaceNotificationSender is the only network-facing dependency of the durable worker. Send must make the supplied delivery idempotent using its IdempotencyKey; a process crash after Send and before the DB update is safe. Descriptive aliases retain the existing resolver names while making the injection contract discoverable to lifecycle owners.
type SpaceNotificationTargetResolverFunc ¶ added in v0.11.1
type SpaceNotificationTargetResolverFunc = SpaceNotificationResolverFunc
type SpaceNotificationWorker ¶ added in v0.11.1
type SpaceNotificationWorker struct {
// contains filtered or unexported fields
}
SpaceNotificationWorker is intentionally pull-based. It starts no goroutine; the lifecycle owner calls RunOnce after commit and on its desired schedule.
func NewSpaceNotificationWorker ¶ added in v0.11.1
func NewSpaceNotificationWorker(s *Server, sender SpaceNotificationSender, resolver ...SpaceNotificationResolver) *SpaceNotificationWorker
func NewSpaceNotificationWorkerForDB ¶ added in v0.11.1
func NewSpaceNotificationWorkerForDB(database *db.DB, sender SpaceNotificationSender, clock func() time.Time, resolver SpaceNotificationResolver) *SpaceNotificationWorker
func NewSpaceNotificationWorkerWithOptions ¶ added in v0.11.1
func NewSpaceNotificationWorkerWithOptions(s *Server, sender SpaceNotificationSender, options SpaceNotificationWorkerOptions, resolver ...SpaceNotificationResolver) *SpaceNotificationWorker
func (*SpaceNotificationWorker) ProcessOnce ¶ added in v0.11.1
func (*SpaceNotificationWorker) ReconcileNotifyWriters ¶ added in v0.11.1
func (w *SpaceNotificationWorker) ReconcileNotifyWriters(ctx context.Context, spaceRef string, snapshots []SpaceNotificationRepoSnapshot, limit int) (int, error)
func (*SpaceNotificationWorker) ReconcileSpaceWriters ¶ added in v0.11.1
func (w *SpaceNotificationWorker) ReconcileSpaceWriters(ctx context.Context, spaceRef string, snapshots []SpaceNotificationRepoSnapshot, limit int) (int, error)
func (*SpaceNotificationWorker) RunOnce ¶ added in v0.11.1
RunOnce selects durable pending/retry rows in ID order. It deliberately does not use a process-local claim: duplicate workers and crash redelivery are handled by the sender's deterministic idempotency key.
func (*SpaceNotificationWorker) SetClock ¶ added in v0.11.1
func (w *SpaceNotificationWorker) SetClock(clock func() time.Time)
func (*SpaceNotificationWorker) SetOptions ¶ added in v0.11.1
func (w *SpaceNotificationWorker) SetOptions(options SpaceNotificationWorkerOptions)
func (*SpaceNotificationWorker) SetResolver ¶ added in v0.11.1
func (w *SpaceNotificationWorker) SetResolver(resolver SpaceNotificationResolver)
func (*SpaceNotificationWorker) SetSender ¶ added in v0.11.1
func (w *SpaceNotificationWorker) SetSender(sender SpaceNotificationSender)
type SpaceNotificationWorkerOptions ¶ added in v0.11.1
type SpaceRepoAction ¶ added in v0.11.1
type SpaceRepoAction struct {
Type SpaceRepoOpType
Collection string
Rkey string
}
SpaceRepoAction is the concrete mutation selected after resolving an operation against the current repository state. In particular, a put is reported as create or update, never as put.
type SpaceRepoActionAuthorizer ¶ added in v0.11.1
type SpaceRepoActionAuthorizer func(SpaceRepoAction) error
SpaceRepoActionAuthorizer authorizes the concrete action selected inside the serialized Apply transaction. It must return nil to permit the mutation.
type SpaceRepoAllowedActions ¶ added in v0.11.1
type SpaceRepoAllowedActions map[SpaceRepoOpType]bool
SpaceRepoAllowedActions is a small authorization contract for callers that already have a set of permitted concrete actions.
func (SpaceRepoAllowedActions) Authorize ¶ added in v0.11.1
func (a SpaceRepoAllowedActions) Authorize(action SpaceRepoAction) error
type SpaceRepoBatch ¶ added in v0.11.1
type SpaceRepoBatch struct {
Space string
Author string
Rev string
LtHash []byte
Changes []SpaceRepoChange
}
SpaceRepoBatch is the result of one atomic batch. All changes use Rev.
type SpaceRepoChange ¶ added in v0.11.1
type SpaceRepoChange struct {
Type SpaceRepoOpType
Collection string
Rkey string
CID string
PreviousCID string
URI string
}
SpaceRepoChange describes one operation's resulting CID and prior CID.
type SpaceRepoFailureHook ¶ added in v0.11.1
type SpaceRepoFailureHook func(SpaceRepoFailureStage) error
SpaceRepoFailureHook is called inside the transaction at a named stage.
type SpaceRepoFailureStage ¶ added in v0.11.1
type SpaceRepoFailureStage string
SpaceRepoFailureStage names points at which tests may force a transaction to fail. The hook is intentionally not used by production code unless a caller installs one explicitly.
type SpaceRepoInsufficientScopeError ¶ added in v0.11.1
type SpaceRepoInsufficientScopeError struct {
Action SpaceRepoAction
}
SpaceRepoInsufficientScopeError identifies a concrete action rejected by an action authorizer. Callers can map it to their protocol's scope response.
func (*SpaceRepoInsufficientScopeError) Error ¶ added in v0.11.1
func (e *SpaceRepoInsufficientScopeError) Error() string
type SpaceRepoMan ¶ added in v0.11.1
type SpaceRepoMan struct {
// contains filtered or unexported fields
}
SpaceRepoMan owns permissioned-space repo persistence. It deliberately does not expose XRPC/auth behavior: callers provide the already-authorized author.
func NewSpaceRepoMan ¶ added in v0.11.1
func NewSpaceRepoMan(s *Server) *SpaceRepoMan
NewSpaceRepoMan constructs the persistence manager for a server.
func NewSpaceRepoManager ¶ added in v0.11.1
func NewSpaceRepoManager(s *Server) *SpaceRepoMan
NewSpaceRepoManager is an alias for callers using the longer name.
func (*SpaceRepoMan) Apply ¶ added in v0.11.1
func (m *SpaceRepoMan) Apply(ctx context.Context, spaceRef, author string, operations []SpaceRepoOperation) (SpaceRepoBatch, error)
Apply atomically applies operations to one author's repo in one space.
func (*SpaceRepoMan) ApplyWithAuthorization ¶ added in v0.11.1
func (m *SpaceRepoMan) ApplyWithAuthorization(ctx context.Context, spaceRef, author string, operations []SpaceRepoOperation, authorize SpaceRepoActionAuthorizer) (SpaceRepoBatch, error)
ApplyWithAuthorization atomically applies operations and invokes authorize after each operation's concrete create/update/delete action is resolved from current state, while the repository lock and transaction are held.
func (*SpaceRepoMan) ApplyWrites ¶ added in v0.11.1
func (m *SpaceRepoMan) ApplyWrites(ctx context.Context, spaceRef, author string, operations []SpaceRepoOperation) (SpaceRepoBatch, error)
ApplyWrites is an alias matching the atproto operation name.
func (*SpaceRepoMan) DeleteRecord ¶ added in v0.11.1
func (m *SpaceRepoMan) DeleteRecord(ctx context.Context, spaceRef, author, collection, rkey string) (SpaceRepoBatch, error)
DeleteRecord applies a strict delete. Missing records are errors; an endpoint needing idempotent deletion should check GetRecord before calling this method.
func (*SpaceRepoMan) GetRecord ¶ added in v0.11.1
func (m *SpaceRepoMan) GetRecord(ctx context.Context, spaceRef, author, collection, rkey string) (*models.SpaceRecord, error)
GetRecord returns one current record.
func (*SpaceRepoMan) GetRepo ¶ added in v0.11.1
func (m *SpaceRepoMan) GetRepo(ctx context.Context, spaceRef, author string) (models.SpaceRepo, error)
GetRepo returns the current head for a space/author pair.
func (*SpaceRepoMan) ListCurrentRecords ¶ added in v0.11.1
func (m *SpaceRepoMan) ListCurrentRecords(ctx context.Context, spaceRef, author, cursor string, limit int) ([]models.SpaceRecord, string, error)
ListCurrentRecords is an explicit alias for ListRecords.
func (*SpaceRepoMan) ListOperations ¶ added in v0.11.1
func (m *SpaceRepoMan) ListOperations(ctx context.Context, spaceRef, author, cursor string, limit int) ([]models.SpaceRepoOp, string, error)
ListOperations is an alias for ListOps.
func (*SpaceRepoMan) ListOps ¶ added in v0.11.1
func (m *SpaceRepoMan) ListOps(ctx context.Context, spaceRef, author, cursor string, limit int) ([]models.SpaceRepoOp, string, error)
ListOps lists the append-only operation log in revision/index order. Cursor is encoded as revision + ":" + decimal index.
func (*SpaceRepoMan) ListRecords ¶ added in v0.11.1
func (m *SpaceRepoMan) ListRecords(ctx context.Context, spaceRef, author, cursor string, limit int) ([]models.SpaceRecord, string, error)
ListRecords lists current records in canonical path order. Cursor is the previous collection/rkey path (or empty for the first page).
func (*SpaceRepoMan) PutRecord ¶ added in v0.11.1
func (m *SpaceRepoMan) PutRecord(ctx context.Context, spaceRef, author, collection, rkey string, record any) (SpaceRepoBatch, error)
PutRecord applies an upsert operation. A blank rkey generates one when the record does not already exist (a nonblank rkey is always used as supplied).
func (*SpaceRepoMan) PutRecordWithAuthorization ¶ added in v0.11.1
func (m *SpaceRepoMan) PutRecordWithAuthorization(ctx context.Context, spaceRef, author, collection, rkey string, record any, authorize SpaceRepoActionAuthorizer) (SpaceRepoBatch, error)
PutRecordWithAuthorization applies an upsert while authorizing its concrete create/update action inside the serialized transaction.
func (*SpaceRepoMan) SetFailureHook ¶ added in v0.11.1
func (m *SpaceRepoMan) SetFailureHook(hook SpaceRepoFailureHook) func()
SetFailureHook installs a test-only transaction failure hook and returns a restore function. A nil hook disables injection.
func (*SpaceRepoMan) SetFailureStage ¶ added in v0.11.1
func (m *SpaceRepoMan) SetFailureStage(stage SpaceRepoFailureStage) func()
SetFailureStage is a convenience test hook that fails once at stage.
type SpaceRepoOpType ¶ added in v0.11.1
type SpaceRepoOpType string
SpaceRepoOpType is the operation applied to one current record.
type SpaceRepoOperation ¶ added in v0.11.1
type SpaceRepoOperation struct {
Type SpaceRepoOpType
Collection string
Rkey string
Record any
}
SpaceRepoOperation is a validated mutation in an Apply batch. Rkey may be empty only for create/put operations; create then receives a generated TID.
type SpaceRepoWrite ¶ added in v0.11.1
type SpaceRepoWrite = SpaceRepoOperation
SpaceRepoWrite is a compatibility spelling for SpaceRepoOperation.
type TemplateRenderer ¶
type TemplateRenderer struct {
// contains filtered or unexported fields
}
type ValidationError ¶
Source Files
¶
- account_sessions.go
- auth_principal.go
- blob_deletion_worker.go
- blockstore_variant.go
- common.go
- handle_account.go
- handle_account_revoke.go
- handle_account_signin.go
- handle_account_signout.go
- handle_account_switch.go
- handle_actor_get_preferences.go
- handle_actor_put_preferences.go
- handle_age_assurance.go
- handle_health.go
- handle_identity_get_recommended_did_credentials.go
- handle_identity_request_plc_operation.go
- handle_identity_sign_plc_operation.go
- handle_identity_submit_plc_operation.go
- handle_identity_update_handle.go
- handle_import_repo.go
- handle_label_query_labels.go
- handle_oauth_authorize.go
- handle_oauth_jwks.go
- handle_oauth_par.go
- handle_oauth_revoke.go
- handle_oauth_token.go
- handle_proxy.go
- handle_proxy_get_feed.go
- handle_repo_apply_writes.go
- handle_repo_create_record.go
- handle_repo_delete_record.go
- handle_repo_describe_repo.go
- handle_repo_get_record.go
- handle_repo_list_missing_blobs.go
- handle_repo_list_records.go
- handle_repo_list_repos.go
- handle_repo_put_record.go
- handle_repo_upload_blob.go
- handle_robots.go
- handle_root.go
- handle_server_activate_account.go
- handle_server_check_account_status.go
- handle_server_confirm_email.go
- handle_server_create_account.go
- handle_server_create_invite_code.go
- handle_server_create_invite_codes.go
- handle_server_create_session.go
- handle_server_deactivate_account.go
- handle_server_delete_account.go
- handle_server_delete_session.go
- handle_server_describe_server.go
- handle_server_get_service_auth.go
- handle_server_get_session.go
- handle_server_refresh_session.go
- handle_server_request_account_delete.go
- handle_server_request_email_confirmation.go
- handle_server_request_email_update.go
- handle_server_request_password_reset.go
- handle_server_reserve_signing_key.go
- handle_server_reset_password.go
- handle_server_resolve_handle.go
- handle_server_update_email.go
- handle_simple_space.go
- handle_simple_space_credential.go
- handle_space_blobs.go
- handle_space_list_repos.go
- handle_space_notifications.go
- handle_space_repo_reads.go
- handle_sync_get_blob.go
- handle_sync_get_blocks.go
- handle_sync_get_latest_commit.go
- handle_sync_get_record.go
- handle_sync_get_repo.go
- handle_sync_get_repo_status.go
- handle_sync_list_blobs.go
- handle_sync_subscribe_repos.go
- handle_well_known.go
- mail.go
- middleware.go
- oauth_space_discovery_delegation.go
- oauth_space_writes.go
- persist.go
- recommit.go
- repo.go
- repo_sync.go
- s3_client.go
- scope_enforcement.go
- scope_validation.go
- server.go
- service_auth.go
- session.go
- session_options.go
- space_notification_worker.go
- space_notification_worker_delivery.go
- space_repo.go