Documentation
¶
Index ¶
- func CreateModifyRegisteredPushNotifications(t NotificationTokens) error
- func DeleteToken(did string, tokenUUID string) error
- func DeleteTokenViaBasic(username string, password string) error
- func DeleteeeeeeeeeeeeRegistrationForPushNotifications(token NotificationTokens) error
- func DeleteeeeeeeeeeeeRegistrationForPushNotificationsWithDid(did string) error
- func DeleteeeeeeeeeeeeRegistrationForPushNotificationsWithRoutingInfo(routing_key []byte, routing_server_address string) error
- func GetOriginalURL(shortCode string) (string, error)
- func GetToken(did string, tokenUUID string, encryptionKey string, tokenVersion int) (*string, *string, *float64, *float64, *string, error)
- func GetTokenViaBasic(username string, password string) (*string, *string, *float64, *float64, *string, *string, *string, *string, ...)
- func GetTwitterIDFromDatabase(twitterID *int64) (*string, *time.Time, *string, error)
- func InitDB(_cfg config.Config)
- func SaveRegistrationForPushNotifications(token NotificationTokens) error
- func StartPeriodicAnalyticsWriter(interval time.Duration)
- func StoreAnalyticData(data AnalyticData)
- func StoreShortLink(shortCode string, originalURL string) error
- func StoreToken(did string, pds string, accessToken string, refreshToken string, ...) (*string, error)
- func StoreTokenBasic(did string, pds string, accessToken string, refreshToken string, ...) (*string, error)
- func StoreTwitterIdInDatabase(twitterID *int64, blueskyId string, dateCreated *time.Time, ...) error
- func UpdateToken(uuid string, did string, pds string, accessToken string, refreshToken string, ...) (*string, error)
- func UpdateTokenBasic(did string, pds string, accessToken string, refreshToken string, ...) (*string, error)
- func WriteAnalyticsToDB()
- type AnalyticData
- type MessageContext
- type NotificationTokens
- type ShortLink
- type Token
- type TwitterIDs
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateModifyRegisteredPushNotifications ¶
func CreateModifyRegisteredPushNotifications(t NotificationTokens) error
func DeleteToken ¶
DeleteToken deletes a token using did and uuid
func DeleteTokenViaBasic ¶
DeleteTokenViaBasic deletes a token using the username and password
func DeleteeeeeeeeeeeeRegistrationForPushNotifications ¶
func DeleteeeeeeeeeeeeRegistrationForPushNotifications(token NotificationTokens) error
vs code decided to freeze at this point, and i think its funny so im keeping it.
func DeleteeeeeeeeeeeeRegistrationForPushNotificationsWithDid ¶
this should not be did but i am lazy
func DeleteeeeeeeeeeeeRegistrationForPushNotificationsWithRoutingInfo ¶
func DeleteeeeeeeeeeeeRegistrationForPushNotificationsWithRoutingInfo(routing_key []byte, routing_server_address string) error
this should not be did but i am lazy
func GetOriginalURL ¶
GetOriginalURL retrieves the original URL from the database using the short code
func GetTokenViaBasic ¶
func GetTokenViaBasic(username string, password string) (*string, *string, *float64, *float64, *string, *string, *string, *string, *string, error)
GetTokenViaBasic retrieves a token using only the password @results: accessToken, refreshToken, accessExpiry, refreshExpiry, pds, did, hash, salt, uuid, error
func GetTwitterIDFromDatabase ¶
Gets a twitter id from the database @params: twitterID @results: blueskyID, dateCreated, reposterDid, error
func SaveRegistrationForPushNotifications ¶
func SaveRegistrationForPushNotifications(token NotificationTokens) error
func StoreAnalyticData ¶
func StoreAnalyticData(data AnalyticData)
Stores analytic data (if enabled) -- TYPES -- 1. "login" 2. "tweets viewed" 3. "tweets posted"
func StoreShortLink ¶
StoreShortLink stores a short link in the database with optimized collision handling
func StoreToken ¶
func StoreToken(did string, pds string, accessToken string, refreshToken string, encryptionKey string, accessExpiry float64, refreshExpiry float64) (*string, error)
StoreToken stores an encrypted access token and refresh token in the database. It returns the UUID of the stored token or an error if the operation fails.
Parameters: - did: The decentralized identifier of the user. - accessToken: The access token to be encrypted and stored. - refreshToken: The refresh token to be encrypted and stored. - encryptionKey: The key used to encrypt the tokens. - accessExpiry: The expiry time of the access token. - refreshExpiry: The expiry time of the refresh token.
Returns: - The UUID of the stored token. - An error if the operation fails.
func StoreTokenBasic ¶
func StoreTokenBasic(did string, pds string, accessToken string, refreshToken string, username string, password string, accessExpiry float64, refreshExpiry float64) (*string, error)
StoreTokenBasic stores a token using basic auth (password)
func StoreTwitterIdInDatabase ¶
func StoreTwitterIdInDatabase(twitterID *int64, blueskyId string, dateCreated *time.Time, reposterDid *string) error
Stores ID data in the database. @params: twitterID, blueskyID, dateCreated, reposterDid @results: error
func UpdateToken ¶
func UpdateTokenBasic ¶
func UpdateTokenBasic(did string, pds string, accessToken string, refreshToken string, accessExpiry float64, refreshExpiry float64, username string, password string, passwordHash string, passwordSalt string, uuid string) (*string, error)
UpdateTokenBasic updates or creates a token entry using basic auth
func WriteAnalyticsToDB ¶
func WriteAnalyticsToDB()
Types ¶
type AnalyticData ¶
type AnalyticData struct {
DataType string `gorm:"type:string;not null"`
IPAddress string `gorm:"type:string;"`
Language string `gorm:"type:string;"`
UserAgent string `gorm:"type:string;"`
TwitterClient string `gorm:"type:string"`
TwitterClientVersion string `gorm:"type:string"`
Timestamp time.Time `gorm:"type:timestamp"`
}
type MessageContext ¶
type NotificationTokens ¶
type NotificationTokens struct {
DeviceToken []byte
RoutingKey []byte
ServerAddress string
UserDID string `gorm:"column:user_did;primaryKey"`
EnabledFor int
LastUpdated time.Time
}
func GetAllActivePushNotifications ¶
func GetAllActivePushNotifications() ([]NotificationTokens, error)
func GetPushTokensForDID ¶
func GetPushTokensForDID(did string) ([]NotificationTokens, error)
type ShortLink ¶
type ShortLink struct {
ShortCode string `gorm:"type:string;primaryKey;not null"`
OriginalURL string `gorm:"type:string;not null"`
}
ShortLink represents the schema for the short_links table
type Token ¶
type Token struct {
BasicAuthHash string `gorm:"type:string;"` // I am not a fan that i have to store this for basic authentication
BasicAuthUsername string `gorm:"type:string;index"` // Add this field with an index
UserDid string `gorm:"type:string;index;not null"`
UserPDS string `gorm:"type:string;not null"`
TokenUUID string `gorm:"type:string;primaryKey"`
EncryptedAccessToken string `gorm:"type:string;not null"`
EncryptedRefreshToken string `gorm:"type:string;not null"`
AccessExpiry float64 `gorm:"type:float;not null"`
RefreshExpiry float64 `gorm:"type:float;not null"`
BasicAuthSalt string `gorm:"type:string"`
TokenVersion int `gorm:"type:int;default:1"`
}
Token represents the schema for the tokens table