Documentation
¶
Index ¶
- Constants
- Variables
- type AccountRevokeInput
- type AccountSwitchRequest
- type ApplyWriteResult
- type Args
- 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 ComAtprotoSubmitPlcOperationRequest
- type ComAtprotoSyncGetBlocksRequest
- type ComAtprotoSyncGetLatestCommitResponse
- type ComAtprotoSyncGetRepoStatusResponse
- type ComAtprotoSyncListBlobsResponse
- type ComAtprotoSyncListReposRepoItem
- type ComAtprotoSyncListReposResponse
- type CustomValidator
- type DbPersister
- func (p *DbPersister) EventSeqRange(ctx context.Context) (oldest, newest int64, ok bool, err error)
- 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 ES256KSigningMethod
- type FirehoseOp
- type HandleOauthAuthorizeGetInput
- type Label
- type MarshalableMap
- type OauthAuthorizationMetadata
- type OauthAuthorizePostRequest
- type OauthJwksResponse
- type OauthParResponse
- type OauthRevokeRequest
- type OauthSigninInput
- type OauthTokenRequest
- type OauthTokenResponse
- type Op
- type OpType
- type RecommitOptions
- type RecommitResult
- type RepoCommit
- type RepoGcOptions
- type RepoGcResult
- type RepoMan
- type S3Config
- type Server
- type ServerGetServiceAuthRequest
- type ServerReserveSigningKeyRequest
- type ServerReserveSigningKeyResponse
- type Session
- type TemplateRenderer
- type ValidationError
Constants ¶
const (
AccountSessionMaxAge = 30 * 24 * time.Hour // one week
)
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")
Functions ¶
This section is empty.
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
SmtpUser string
SmtpPass string
SmtpHost string
SmtpPort string
SmtpEmail string
SmtpName string
S3Config *S3Config
SessionSecret string
SessionCookieKey string
BlockstoreVariant BlockstoreVariant
FallbackProxy string
}
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 ComAtprotoServerGetSessionResponse ¶
type ComAtprotoServerGetSessionResponse struct {
Handle string `json:"handle"`
Did string `json:"did"`
Email *string `json:"email,omitempty"`
EmailConfirmed *bool `json:"emailConfirmed,omitempty"`
EmailAuthFactor *bool `json:"emailAuthFactor,omitempty"`
Active bool `json:"active"`
Status *string `json:"status,omitempty"`
}
type ComAtprotoServerRequestPasswordResetRequest ¶
type ComAtprotoServerRequestPasswordResetRequest struct {
Email string `json:"email" validate:"required"`
}
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 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) EventSeqRange ¶ added in v0.11.3
EventSeqRange reports the oldest and newest seq this host still retains.
The pair describes the only range that can be served: pruning removes whole seqs from the bottom, so a cursor below the oldest retained seq names events that no longer exist. ok is false when the store holds no events at all, which is not the same as an empty range.
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 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 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 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 RepoGcOptions ¶ added in v0.11.2
type RepoGcOptions struct {
// Dids is the set of repos to process.
Dids []string
// DryRun reports planned deletions without removing any blocks.
DryRun bool
// BlockstoreVariant selects the block store (mirrors the server flag).
BlockstoreVariant string
Logger *slog.Logger
}
RepoGcOptions configures RunRepoGcMigration.
type RepoGcResult ¶ added in v0.11.2
type RepoGcResult struct {
Did string
Head string
TotalBlocks int64
LiveBlocks int64
RemovedBlocks int64
Err error
}
RepoGcResult is the per-repo outcome of the migration.
func RunRepoGcMigration ¶ added in v0.11.2
func RunRepoGcMigration(ctx context.Context, gdb *gorm.DB, opts RepoGcOptions) ([]RepoGcResult, error)
RunRepoGcMigration removes blocks that are unreachable from a repo's current head commit: superseded MST nodes, blocks of deleted or overwritten records, and historical commit objects — the strata accumulated before commits started deleting their removedCids.
For each did it walks the MST at the current root, collecting every reachable block CID (the commit block, all MST nodes, all record blocks), then deletes every other block row for that did.
The repo itself is never mutated: no new commit, no re-signing, no firehose events. It is still safest to run with the PDS stopped (a concurrent write would race this pass), and a VACUUM may be needed afterwards to return SQLite file space to the OS.
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 TemplateRenderer ¶
type TemplateRenderer struct {
// contains filtered or unexported fields
}
type ValidationError ¶
Source Files
¶
- account_sessions.go
- blockstore_variant.go
- common.go
- endpoint_authorization.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_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
- persist.go
- recommit.go
- repo.go
- repo_gc.go
- repo_sync.go
- scope_enforcement.go
- scope_validation.go
- server.go
- service_auth.go
- session.go
- session_options.go