Documentation
¶
Index ¶
- Variables
- func SpaceModels() []any
- type Actor
- type Blob
- type BlobPart
- type Block
- type EventRecord
- type InviteCode
- type Record
- type RefreshToken
- type Repo
- type RepoActor
- type ReservedKey
- type RevokedSpaceCredential
- type SimplespaceConfig
- type SimplespaceMember
- type Space
- type SpaceCredentialRecipient
- type SpaceDeletedNotificationRetry
- type SpaceNotificationRetry
- type SpaceRecord
- type SpaceRecordBlob
- type SpaceRecordOplog
- type SpaceRepo
- type SpaceUsedJti
- type SpaceWriter
- type Token
- type TwoFactorBackupCode
- type TwoFactorCredential
- type TwoFactorCredentialType
- type TwoFactorType
Constants ¶
This section is empty.
Variables ¶
var ( TwoFactorTypeNone = TwoFactorType("none") TwoFactorTypeEmail = TwoFactorType("email") )
var ( TwoFactorCredentialTOTP = TwoFactorCredentialType("totp") TwoFactorCredentialYubicoOTP = TwoFactorCredentialType("yubico_otp") )
Functions ¶
func SpaceModels ¶ added in v0.11.1
func SpaceModels() []any
SpaceModels lists the space tables for migration.
Types ¶
type EventRecord ¶ added in v0.8.4
type InviteCode ¶
type RefreshToken ¶
type Repo ¶
type Repo struct {
Did string `gorm:"primaryKey"`
CreatedAt time.Time
Email string `gorm:"uniqueIndex"`
EmailConfirmedAt *time.Time
EmailVerificationCode *string
EmailVerificationCodeExpiresAt *time.Time
EmailUpdateCode *string
EmailUpdateCodeExpiresAt *time.Time
PasswordResetCode *string `gorm:"index"`
PasswordResetCodeExpiresAt *time.Time
PlcOperationCode *string
PlcOperationCodeExpiresAt *time.Time
AccountDeleteCode *string
AccountDeleteCodeExpiresAt *time.Time
Password string
SessionVersion int64 `gorm:"not null;default:0"`
SigningKey []byte
// KemKey is the account's #atproto_kem P-256 private key, with which it
// establishes shared secrets for space repo MACs. Nil until created.
KemKey []byte
Rev string
Root []byte
Preferences []byte
Deactivated bool
// TakedownRef marks an account taken down. Space data of a taken-down
// account is neither served nor written.
TakedownRef *string
TwoFactorCode *string
TwoFactorCodeExpiresAt *time.Time
TwoFactorType TwoFactorType `gorm:"default:none"`
// Failed second-factor attempts since the last success, and the time
// until which further attempts are refused once too many have failed.
TwoFactorFailedAttempts int `gorm:"not null;default:0"`
TwoFactorLockedUntil *time.Time
}
type ReservedKey ¶ added in v0.7.0
type RevokedSpaceCredential ¶ added in v0.13.1
type RevokedSpaceCredential struct {
Space string `gorm:"primaryKey"`
Jti string `gorm:"primaryKey"`
ExpiresAt string `gorm:"not null;index"`
}
RevokedSpaceCredential is a space credential revoked by its authority, kept until it would have expired.
type SimplespaceConfig ¶ added in v0.13.1
type SimplespaceConfig struct {
Did string `gorm:"primaryKey"`
Uri string `gorm:"primaryKey"`
ReadPolicy string `gorm:"not null"`
ReadManagingApp *string
WritePolicy string `gorm:"not null"`
WriteManagingApp *string
AppAccessType string `gorm:"not null"`
AppAllowed string `gorm:"not null"` // JSON array of client IDs
}
SimplespaceConfig is the governance config of a space this account is the authority for.
type SimplespaceMember ¶ added in v0.13.1
type SimplespaceMember struct {
Did string `gorm:"primaryKey"`
Space string `gorm:"primaryKey"`
MemberDid string `gorm:"primaryKey"`
Read bool `gorm:"not null"`
Write bool `gorm:"not null"`
}
SimplespaceMember is a member of a governed space.
type Space ¶ added in v0.13.1
type Space struct {
Did string `gorm:"primaryKey"`
Uri string `gorm:"primaryKey"`
Authority string `gorm:"not null;index"`
Type string `gorm:"not null"`
CreatedAt string `gorm:"not null"`
DeletedAt *string
}
Space is a space this account holds a repo in, or governs. DeletedAt marks a deleted space whose row survives as a tombstone.
type SpaceCredentialRecipient ¶ added in v0.13.1
type SpaceCredentialRecipient struct {
Did string `gorm:"primaryKey"`
Space string `gorm:"primaryKey"`
ServiceDid string `gorm:"primaryKey"`
ServiceEndpoint string `gorm:"not null"`
ExpiresAt string `gorm:"not null"`
}
SpaceCredentialRecipient is a service registered (registerNotify) to receive a governed space's write notifications.
type SpaceDeletedNotificationRetry ¶ added in v0.14.1
type SpaceDeletedNotificationRetry struct {
Space string `gorm:"primaryKey"`
Service string `gorm:"primaryKey"`
Attempts int `gorm:"not null"`
RetryAt int64 `gorm:"not null;index"`
ExpiresAt int64 `gorm:"not null"`
}
SpaceDeletedNotificationRetry is a notifySpaceDeleted to a registered service that failed and waits to be resent, until it succeeds or the service's registration expires.
type SpaceNotificationRetry ¶ added in v0.13.1
type SpaceNotificationRetry struct {
Repo string `gorm:"primaryKey"`
Space string `gorm:"primaryKey"`
RepoRev string `gorm:"not null"`
// Data is the commit data to notify. The column keeps its name from
// before the protocol renamed the field from hash.
Data []byte `gorm:"column:hash;not null"`
Attempts int `gorm:"not null"`
RetryAt int64 `gorm:"not null;index"`
ExpiresAt int64 `gorm:"not null"`
}
SpaceNotificationRetry is a writer's notifyWrite that failed and waits to be resent to the authority, one per repo and space.
type SpaceRecord ¶ added in v0.11.1
type SpaceRecord struct {
Uri string `gorm:"primaryKey"`
Did string `gorm:"not null;uniqueIndex:idx_space_record_path,priority:1;index:idx_space_record_rev,priority:1"`
Space string `gorm:"not null;uniqueIndex:idx_space_record_path,priority:2;index:idx_space_record_rev,priority:2"`
Collection string `gorm:"not null;uniqueIndex:idx_space_record_path,priority:3"`
Rkey string `gorm:"not null;uniqueIndex:idx_space_record_path,priority:4"`
Cid string `gorm:"not null"`
Value []byte `gorm:"not null"`
RepoRev string `gorm:"not null;index:idx_space_record_rev,priority:3"`
IndexedAt string `gorm:"not null"`
}
SpaceRecord is a record in this account's repo for a space. Uri is globally unique since it names the author.
type SpaceRecordBlob ¶ added in v0.13.1
type SpaceRecordBlob struct {
Did string `gorm:"not null;index"`
BlobCid string `gorm:"primaryKey"`
RecordUri string `gorm:"primaryKey;index"`
}
SpaceRecordBlob ties a blob to a space record that references it.
type SpaceRecordOplog ¶ added in v0.13.1
type SpaceRecordOplog struct {
Did string `gorm:"primaryKey"`
Space string `gorm:"primaryKey"`
Rev string `gorm:"primaryKey"`
Idx int `gorm:"primaryKey;autoIncrement:false"`
Action string `gorm:"not null"`
Uri string `gorm:"not null"`
Collection string `gorm:"not null"`
Rkey string `gorm:"not null"`
Cid *string
Prev *string
}
SpaceRecordOplog is one op of a space repo commit.
type SpaceRepo ¶ added in v0.11.1
type SpaceRepo struct {
Did string `gorm:"primaryKey"`
Space string `gorm:"primaryKey"`
SetHash []byte
Rev *string
}
SpaceRepo is this account's repo state in a space: the set hash state and the latest rev. Both are nil until the first write.
type SpaceUsedJti ¶ added in v0.13.1
type SpaceUsedJti struct {
Namespace string `gorm:"primaryKey"`
Jti string `gorm:"primaryKey"`
ExpiresAt int64 `gorm:"not null;index"`
}
SpaceUsedJti records a single-use token (delegation token, client attestation) until it expires, so it can't be replayed.
type SpaceWriter ¶ added in v0.11.1
type SpaceWriter struct {
Did string `gorm:"primaryKey"`
Space string `gorm:"primaryKey;index:idx_space_writer_space_rev,priority:1"`
WriterDid string `gorm:"primaryKey"`
RepoRev string `gorm:"not null"`
SpaceRev string `gorm:"not null;index:idx_space_writer_space_rev,priority:2"`
// Data is the commit data (the set hash digest) last reported. The column
// keeps its name from before the protocol renamed the field from hash.
Data []byte `gorm:"column:hash;not null"`
}
SpaceWriter is, on the authority, the latest known state of a writer's repo in a governed space, sequenced by SpaceRev.
type TwoFactorBackupCode ¶ added in v0.13.1
type TwoFactorBackupCode struct {
ID uint `gorm:"primaryKey"`
Did string `gorm:"index;not null"`
CodeHash []byte
CreatedAt time.Time
UsedAt *time.Time
}
TwoFactorBackupCode is a single-use recovery code, stored as a SHA-256 hash. Backup codes are only accepted when the account has at least one TwoFactorCredential.
type TwoFactorCredential ¶ added in v0.13.1
type TwoFactorCredential struct {
ID uint `gorm:"primaryKey"`
Did string `gorm:"index;not null"`
Type TwoFactorCredentialType
Name string
CreatedAt time.Time
// TOTP shared secret, or the YubiKey slot's AES-128 key. Empty for a
// YubiKey registered as it came from the factory, whose OTPs are checked
// with Yubico's YubiCloud service instead (see UsesYubiCloud).
Secret []byte
// Yubico OTP only: the modhex public identity typed before each OTP, and
// the 6-byte private identity found inside the encrypted block.
PublicID string `gorm:"index"`
PrivateID []byte
// Replay protection. TOTP stores the last accepted time step; Yubico OTP
// stores the last accepted (session counter, session use) pair.
LastStep int64 `gorm:"not null;default:0"`
LastCounter int `gorm:"not null;default:0"`
LastUse int `gorm:"not null;default:0"`
LastUsedAt *time.Time
}
TwoFactorCredential is an authenticator app (TOTP) or a YubiKey slot programmed for Yubico OTP. When an account has any of these, they replace emailed sign-in codes entirely.
func (*TwoFactorCredential) UsesYubiCloud ¶ added in v0.13.1
func (c *TwoFactorCredential) UsesYubiCloud() bool
UsesYubiCloud reports whether this YubiKey's OTPs are checked by YubiCloud rather than decrypted locally with a stored AES key.
type TwoFactorCredentialType ¶ added in v0.13.1
type TwoFactorCredentialType string
type TwoFactorType ¶ added in v0.8.0
type TwoFactorType string