Documentation ¶
Index ¶
- func Fingerprint(rawPubKey string) (string, error)
- func GenerateDeterministicUUID(key, title, namespace string) (string, error)
- func ParseExpiration(expirationRequest string) *time.Time
- func ValidateSignature(rawPubKey string, base64EncodedSignature string, message string) error
- type CustomValidator
- type DB
- func (d DB) DeleteExpiredPosts() (int64, error)
- func (d DB) DeletePost(postDeleteRequest model.PostDeleteRequest) error
- func (d DB) GetPost(postUUID string) (*model.Post, error)
- func (d DB) GetPostContent(postUUID string) (*model.PostContent, error)
- func (d DB) GetUserPosts(fingerprint string) ([]model.FullPost, error)
- func (d DB) PersistPost(postUUID string, request model.PostRequest, html string, expiration *time.Time) error
- type PostManager
- func (pm PostManager) CreatePost(request model.PostRequest) (string, error)
- func (pm PostManager) FetchPostContent(postUUID string) (*model.PostContent, error)
- func (pm PostManager) GetAllUserPosts(fingerprint string) (string, error)
- func (pm PostManager) HasPosts(fingerprint string) (bool, error)
- func (pm PostManager) IsDuplicate(request model.PostRequest) (bool, error)
- func (pm PostManager) RemovePost(request model.PostDeleteRequest) error
- type Router
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Fingerprint ¶
Fingerprint will attempt to generate a fingerprint from the provided rawPubKey The fingerprint is simply the URL safe, Base64 encoded sha256 hash of the public key
func GenerateDeterministicUUID ¶
GenerateDeterministicUUID creates a deterministic (version 5) uuid from the provided key and title
func ParseExpiration ¶
ParseExpiration converts common expiration times used on our frontend into actual time periods our post reaper will leverage to expire posts.
Types ¶
type CustomValidator ¶
type CustomValidator struct {
// contains filtered or unexported fields
}
func (*CustomValidator) Validate ¶
func (cv *CustomValidator) Validate(i interface{}) error
type DB ¶
type DB struct {
// contains filtered or unexported fields
}
func (DB) DeleteExpiredPosts ¶
func (DB) DeletePost ¶
func (d DB) DeletePost(postDeleteRequest model.PostDeleteRequest) error
DeletePost drops from the db the model.Post and model.PostContent associated with the postDeleteRequest
func (DB) GetPostContent ¶
func (d DB) GetPostContent(postUUID string) (*model.PostContent, error)
func (DB) GetUserPosts ¶
GetUserPosts returns all known posts published by the provided fingerprint
func (DB) PersistPost ¶
func (d DB) PersistPost(postUUID string, request model.PostRequest, html string, expiration *time.Time) error
PersistPost derives a model.Post and model.PostContent from the provided request and persists them to the db
type PostManager ¶
type PostManager struct {
// contains filtered or unexported fields
}
func NewPostManager ¶
func NewPostManager(db DB, cache gcache.Cache) PostManager
func (PostManager) CreatePost ¶
func (pm PostManager) CreatePost(request model.PostRequest) (string, error)
func (PostManager) FetchPostContent ¶
func (pm PostManager) FetchPostContent(postUUID string) (*model.PostContent, error)
func (PostManager) GetAllUserPosts ¶
func (pm PostManager) GetAllUserPosts(fingerprint string) (string, error)
func (PostManager) IsDuplicate ¶
func (pm PostManager) IsDuplicate(request model.PostRequest) (bool, error)
func (PostManager) RemovePost ¶
func (pm PostManager) RemovePost(request model.PostDeleteRequest) error
RemovePost will use the stored public key and post message to delete a post from the provided request iff the signatures can be verified using the stored key/message.