types

package
v0.0.0-...-24d5ccf Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 26, 2023 License: BSD-3-Clause Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Attachment          = "attachment"
	EncryptedAttachment = "encrypted_attachment"
	EncryptedBody       = "encrypted_body"
)
View Source
const (
	ClientVersion    = "0.3.3"
	ClientMinVersion = "0.3.0"
	ServerVersion    = "0.3.2"
)
View Source
const (
	SaltString = "cbbc"
)

Variables

This section is empty.

Functions

func DecryptSymmetric

func DecryptSymmetric(encdata, key []byte) ([]byte, error)

func DeriveSymmetricKey

func DeriveSymmetricKey(key string) ([]byte, error)

func EncryptSymmetric

func EncryptSymmetric(body, key []byte) ([]byte, error)

func IsVersionLess

func IsVersionLess(resp *VersionResponse) bool

func IsVersionMin

func IsVersionMin(resp *VersionResponse) bool

func SanitizePostId

func SanitizePostId(title string) string

func ValidateCustomPostId

func ValidateCustomPostId(postId string) bool

Types

type AdminRequest

type AdminRequest struct {
	AdminPassword string `json:"admin_password"`
}

type AdminResponse

type AdminResponse struct {
	NumUsers  int            `json:"num_users"`
	SomeUsers []UserResponse `json:"some_users"`
}

type AttachmentType

type AttachmentType string

type AuthTokens

type AuthTokens struct {
	AccessToken  string `json:"access"`
	RefreshToken string `json:"refresh"`
}

type BasicAuthCredentials

type BasicAuthCredentials struct {
	UserEmail    string `json:"email"`
	UserPassword string `json:"password"`
	DisplayName  string `json:"display_name,omitempty"`
}

type Blob

type Blob struct {
	Id             string                 `json:"id"`
	Title          string                 `json:"title"`
	Type           string                 `json:"type"`
	Data           string                 `json:"data"`
	RawData        []BlobBinaryAttachment `json:"raw_data"`
	Importance     int                    `json:"importance"`
	Tags           []string               `json:"tags"`
	Deleted        bool                   `json:"deleted"`
	ChildIds       []string               `json:"child_ids,omitempty"`
	Children       []*Blob                `json:"children,omitempty"`
	OwnerId        string                 `json:"owner_id,omitempty"`
	ParentId       string                 `json:"parent_id,omitempty"`
	ExpireTime     *time.Time             `json:"expire_time,omitempty"`
	VersionHistory []*BlobHistoryItem     `json:"version_history,omitempty"`
}

func (*Blob) Clone

func (b *Blob) Clone() *Blob

func (*Blob) EncryptedBody

func (blob *Blob) EncryptedBody() *BlobBinaryAttachment

func (*Blob) GetAttachment

func (blob *Blob) GetAttachment(desc string) ([]byte, bool)

func (*Blob) IsEncryptedAndEmpty

func (blob *Blob) IsEncryptedAndEmpty() bool

func (*Blob) Matches

func (b *Blob) Matches(searchString string) bool

func (*Blob) Size

func (blob *Blob) Size() uint64

type BlobBinaryAttachment

type BlobBinaryAttachment struct {
	Description string         `json:"description"`
	Data        []byte         `json:"data"`
	Type        AttachmentType `json:"type"`
}

type BlobHistoryItem

type BlobHistoryItem struct {
	AsOf      time.Time `json:"history_time"`
	BlobValue *Blob     `json:"blob_value"`
}

type BlobList

type BlobList struct {
	RootBlobs []*BlobSkeleton `json:"root_blobs"`
}

type BlobResponse

type BlobResponse struct {
	Blobs []*Blob `json:"blobs"`
}

type BlobSkeleton

type BlobSkeleton struct {
	Id         string          `json:"id"`
	Title      string          `json:"title"`
	Type       string          `json:"type"`
	Importance int             `json:"importance"`
	Tags       []string        `json:"tags"`
	Deleted    bool            `json:"deleted"`
	Children   []*BlobSkeleton `json:"children,omitempty"`
	OwnerId    string          `json:"owner_id,omitempty"`
	ParentId   string          `json:"parent_id,omitempty"`
}

type ContentType

type ContentType struct {
	FileExtension string
	LongName      string
}

func ResolveContentType

func ResolveContentType(userType string) *ContentType

type Post

type Post struct {
	Id            string              `json:"post_id"`
	OwnerId       string              `json:"owner_id"`
	Visibility    []VisibilitySetting `json:"visibility"`
	BlobId        string              `json:"blob_id"`
	PublicationId string              `json:"publication_id"`
}

func (*Post) HasPermission

func (p *Post) HasPermission(userId string) bool

type PostResponse

type PostResponse struct {
	Posts         []*Post `json:"posts"`
	Blobs         []*Blob `json:"blobs,omitempty"`
	Body          string  `json:"body,omitempty"`
	EncryptedBody []byte  `json:"encrypted_body,omitempty"`
}

func (*PostResponse) Render

func (b *PostResponse) Render(w http.ResponseWriter, r *http.Request) error

type UserResponse

type UserResponse struct {
	Id          string `json:"user_id"`
	Email       string `json:"user_email"`
	DisplayName string `json:"display_name"`
}

type VersionResponse

type VersionResponse struct {
	LatestClientVersion string `json:"latest_client_version"`
	ServerVersion       string `json:"server_version"`
	MinClientVersion    string `json:"min_client_version"`
	UpgradeScriptUrl    string `json:"upgrade_script"`
}

type VisibilitySetting

type VisibilitySetting struct {
	Type     VisibilityType `json:"type"`
	Audience string         `json:"audience"`
}

type VisibilityType

type VisibilityType string
const (
	Public     VisibilityType = "public"
	SingleUser VisibilityType = "user"
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL