gosn

package module
v0.0.0-...-faf8740 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2023 License: MIT Imports: 32 Imported by: 0

README

gosn-v2

Build Status CircleCI GoDoc Go Report Card

This release adds support for version 004 of encryption (introduced Nov 2020) and removes support for 003.

Note: This is an early release with significant changes. Please take a backup before using with any real data and report any issues you find.

about

Standard Notes is a service and application for the secure management and storage of notes.

gosn-v2 is a library to help develop your own application to manage notes on the official, or your self-hosted, Standard Notes server.

documentation

basic usage

The following example shows how to use this library to interact with the SN API directly. To prevent a full download of all items on every sync, use the provided cache package to persist an encrypted copy to disk, only syncing deltas on subsequent calls.

installation

GO111MODULE=on go get -u github.com/meramsey/gosn-v2

importing

import "github.com/meramsey/gosn-v2"

basic usage

authenticating

Sign-in to obtain your session

sio, _ := gosn.SignIn(gosn.SignInInput{
    Email:    "user@example.com",
    Password: "topsecret",
})
initial sync

An initial sync is required to retrieve your items, as well as your Items Keys that are then added to your session

so, _ := gosn.Sync(gosn.SyncInput{
    Session: &sio.Session,
})
decrypt and parse items
items, _ := so.Items.DecryptAndParse(&sio.Session)

Documentation

Index

Constants

View Source
const (
	// KeySize is the size of the key used by this AEAD, in bytes.
	KeySize = 32

	// NonceSizeX is the size of the nonce used with the XChaCha20-Poly1305
	// variant of this AEAD, in bytes.
	NonceSizeX = 24

	SaltSize = 16
)
View Source
const (

	// PageSize is the maximum number of items to return with each call.
	PageSize = 150

	// LOGGING.
	LibName = "gosn-v2" // name of library used in logging

)
View Source
const (
	SNServerURL              = "https://api.standardnotes.com"
	KeyringApplicationName   = "Session"
	KeyringService           = "StandardNotesCLI"
	MsgSessionRemovalSuccess = "session removed successfully"
	MsgSessionRemovalFailure = "failed to remove session"
)

Variables

This section is empty.

Functions

func AddSession

func AddSession(snServer, inKey string, k keyring.Keyring, debug bool) (res string, err error)

func Decrypt

func Decrypt(key []byte, cryptoText string) (pt string, err error)

Decrypt from base64 to decrypted string.

func DecryptCipherText

func DecryptCipherText(cipherText, rawKey, nonce, rawAuthenticatedData string) (result []byte, err error)

func DeleteContent

func DeleteContent(session *Session, everything bool) (deleted int, err error)

DeleteContent will remove all Notes, Tags, and Components from SN.

func Encrypt

func Encrypt(key []byte, text string) string

Encrypt string to base64 crypto using AES.

func GenUUID

func GenUUID() string

GenUUID generates a unique identifier required when creating a new item.

func GetCredentials

func GetCredentials(inServer string) (email, password, apiServer, errMsg string)

func GetSessionFromKeyring

func GetSessionFromKeyring(k keyring.Keyring) (s string, err error)

func IsEncryptedType

func IsEncryptedType(ct string) bool

func RemoveSession

func RemoveSession(k keyring.Keyring) string

RemoveSession removes the SN Session from the keyring.

func SessionExists

func SessionExists(k keyring.Keyring) error

func SessionStatus

func SessionStatus(sKey string, k keyring.Keyring) (msg string, err error)

Types

type AppDataContent

type AppDataContent struct {
	OrgStandardNotesSN           OrgStandardNotesSNDetail           `json:"org.standardnotes.sn"`
	OrgStandardNotesSNComponents OrgStandardNotesSNComponentsDetail `json:"org.standardnotes.sn.components,omitempty"`
}

type AppTagConfig

type AppTagConfig struct {
	Email    string
	Token    string
	FindText string
	FindTag  string
	NewTags  []string
	Debug    bool
}

AppTagConfig defines expected configuration structure for making Tag related operations.

type AuthData

type AuthData struct {
	Kp struct {
		Identifier  string `json:"identifier"`
		PwNonce     string `json:"pw_nonce"`
		Version     string `json:"version"`
		Origination string `json:"origination"`
		Created     string `json:"created"`
	} `json:"kp"`

	U string `json:"u"`
	V string `json:"v"`
}

type CompareEncryptedItemsInput

type CompareEncryptedItemsInput struct {
	Session        *Session
	FirstItem      EncryptedItem
	FirstItemsKey  ItemsKey
	SecondItem     EncryptedItem
	SecondItemsKey ItemsKey
}

type CompareItemsInput

type CompareItemsInput struct {
	Session    *Session
	FirstItem  Item
	SecondItem Item
}

type Component

type Component struct {
	ItemCommon
	Content ComponentContent
}

func NewComponent

func NewComponent() Component

NewComponent returns an Item of type Component without content.

func (Component) GetContent

func (c Component) GetContent() Content

func (Component) GetContentSize

func (c Component) GetContentSize() int

func (Component) GetContentType

func (c Component) GetContentType() string

func (Component) GetCreatedAt

func (c Component) GetCreatedAt() string

func (Component) GetCreatedAtTimestamp

func (c Component) GetCreatedAtTimestamp() int64

func (Component) GetItemsKeyID

func (c Component) GetItemsKeyID() string

func (Component) GetUUID

func (c Component) GetUUID() string

func (Component) GetUpdatedAt

func (c Component) GetUpdatedAt() string

func (Component) GetUpdatedAtTimestamp

func (c Component) GetUpdatedAtTimestamp() int64

func (Component) IsDefault

func (c Component) IsDefault() bool

func (Component) IsDeleted

func (c Component) IsDeleted() bool

func (*Component) SetContent

func (c *Component) SetContent(cc Content)

func (*Component) SetContentSize

func (c *Component) SetContentSize(s int)

func (*Component) SetContentType

func (c *Component) SetContentType(ct string)

func (*Component) SetCreatedAt

func (c *Component) SetCreatedAt(ca string)

func (*Component) SetCreatedAtTimestamp

func (c *Component) SetCreatedAtTimestamp(ca int64)

func (*Component) SetDeleted

func (c *Component) SetDeleted(d bool)

func (*Component) SetUUID

func (c *Component) SetUUID(u string)

func (*Component) SetUpdatedAt

func (c *Component) SetUpdatedAt(ca string)

func (*Component) SetUpdatedAtTimestamp

func (c *Component) SetUpdatedAtTimestamp(ca int64)

type ComponentContent

type ComponentContent struct {
	Identifier         string         `json:"identifier"`
	LegacyURL          string         `json:"legacy_url"`
	HostedURL          string         `json:"hosted_url"`
	LocalURL           string         `json:"local_url"`
	URL                string         `json:"url"`
	ValidUntil         string         `json:"valid_until"`
	OfflineOnly        bool           `json:"offlineOnly"`
	Name               string         `json:"name"`
	Area               string         `json:"area"`
	PackageInfo        interface{}    `json:"package_info"`
	Permissions        interface{}    `json:"permissions"`
	Active             interface{}    `json:"active"`
	AutoUpdateDisabled string         `json:"autoupdateDisabled"`
	ComponentData      interface{}    `json:"componentData"`
	DissociatedItemIds []string       `json:"disassociatedItemIds"`
	AssociatedItemIds  []string       `json:"associatedItemIds"`
	ItemReferences     ItemReferences `json:"references"`
	AppData            AppDataContent `json:"appData"`
}

func NewComponentContent

func NewComponentContent() *ComponentContent

NewComponentContent returns an empty Tag content instance.

func (*ComponentContent) AssociateItems

func (cc *ComponentContent) AssociateItems(newItems []string)

func (*ComponentContent) DisassociateItems

func (cc *ComponentContent) DisassociateItems(itemsToRemove []string)

func (*ComponentContent) GetActive

func (cc *ComponentContent) GetActive() bool

func (*ComponentContent) GetAppData

func (cc *ComponentContent) GetAppData() AppDataContent

func (*ComponentContent) GetItemAssociations

func (cc *ComponentContent) GetItemAssociations() []string

func (*ComponentContent) GetItemDisassociations

func (cc *ComponentContent) GetItemDisassociations() []string

func (*ComponentContent) GetName

func (cc *ComponentContent) GetName() string

func (ComponentContent) GetTitle

func (cc ComponentContent) GetTitle() string

func (*ComponentContent) GetUpdateTime

func (cc *ComponentContent) GetUpdateTime() (time.Time, error)

func (ComponentContent) References

func (cc ComponentContent) References() ItemReferences

func (*ComponentContent) SetAppData

func (cc *ComponentContent) SetAppData(data AppDataContent)

func (*ComponentContent) SetReferences

func (cc *ComponentContent) SetReferences(input ItemReferences)

func (*ComponentContent) SetTitle

func (cc *ComponentContent) SetTitle(title string)

func (*ComponentContent) SetUpdateTime

func (cc *ComponentContent) SetUpdateTime(uTime time.Time)

func (*ComponentContent) UpsertReferences

func (cc *ComponentContent) UpsertReferences(input ItemReferences)

type Components

type Components []Component

func (*Components) DeDupe

func (c *Components) DeDupe()

func (Components) Validate

func (c Components) Validate() error

type ConflictedItem

type ConflictedItem struct {
	ServerItem  EncryptedItem `json:"server_item"`
	UnsavedItem EncryptedItem `json:"unsaved_item"`
	Type        string
}

type ConflictedItems

type ConflictedItems []ConflictedItem

func (*ConflictedItems) DeDupe

func (cis *ConflictedItems) DeDupe()

func (ConflictedItems) Validate

func (cis ConflictedItems) Validate(debug bool) error

type Content

type Content interface {
	References() ItemReferences
	SetReferences(ItemReferences)
}

type DecryptedItem

type DecryptedItem struct {
	UUID               string `json:"uuid"`
	ItemsKeyID         string `json:"items_key_id,omitempty"`
	Content            string `json:"content"`
	ContentType        string `json:"content_type"`
	Deleted            bool   `json:"deleted"`
	Default            bool   `json:"isDefault"`
	CreatedAt          string `json:"created_at"`
	UpdatedAt          string `json:"updated_at"`
	CreatedAtTimestamp int64  `json:"created_at_timestamp"`
	UpdatedAtTimestamp int64  `json:"updated_at_timestamp"`
}

func DecryptItem

func DecryptItem(e EncryptedItem, s *Session, iks ItemsKeys) (o DecryptedItem, err error)

func (DecryptedItem) Encrypt

func (di DecryptedItem) Encrypt(ik ItemsKey, session *Session) (encryptedItem EncryptedItem, err error)

type DecryptedItems

type DecryptedItems []DecryptedItem

func DecryptItems

func DecryptItems(s *Session, ei EncryptedItems, iks ItemsKeys) (o DecryptedItems, err error)

DecryptItems.

func (*DecryptedItems) Parse

func (di *DecryptedItems) Parse() (p Items, err error)

func (*DecryptedItems) RemoveDeleted

func (di *DecryptedItems) RemoveDeleted()

type EIT

type EIT struct {
	Kp struct {
		Identifier  string `json:"identifier"`
		PwNonce     string `json:"pw_nonce"`
		Version     string `json:"version"`
		Origination string `json:"origination"`
		Created     string `json:"created"`
	} `json:"kp"`
	U string `json:"u"`
	V string `json:"v"`
}

type EncItemKey

type EncItemKey struct {
	ProtocolVersion string
	EncryptionNonce string
	CipherText      string
	AuthData        AuthData
}

type EncryptedItem

type EncryptedItem struct {
	UUID        string  `json:"uuid"`
	ItemsKeyID  *string `json:"items_key_id,omitempty"`
	Content     string  `json:"content"`
	ContentType string  `json:"content_type"`
	EncItemKey  string  `json:"enc_item_key"`
	Deleted     bool    `json:"deleted"`
	// Default            bool    `json:"isDefault"`
	CreatedAt          string  `json:"created_at"`
	UpdatedAt          string  `json:"updated_at"`
	CreatedAtTimestamp int64   `json:"created_at_timestamp"`
	UpdatedAtTimestamp int64   `json:"updated_at_timestamp"`
	DuplicateOf        *string `json:"duplicate_of,omitempty"`
}

func EncryptItem

func EncryptItem(item Item, ik ItemsKey, session *Session) (encryptedItem EncryptedItem, err error)

func EncryptItemsKey

func EncryptItemsKey(ik ItemsKey, s *Session, new bool) (encryptedItem EncryptedItem, err error)

func ReEncryptItem

func ReEncryptItem(ei EncryptedItem, decryptionItemsKey ItemsKey, newItemsKey ItemsKey, newMasterKey string, s *Session) (o EncryptedItem, err error)

func (*EncryptedItem) Decrypt

func (ei *EncryptedItem) Decrypt(mk string) (ik ItemsKey, err error)

func (EncryptedItem) DecryptItemOnly

func (ei EncryptedItem) DecryptItemOnly(key string) (content []byte, err error)

func (EncryptedItem) GetItemsKeyID

func (ei EncryptedItem) GetItemsKeyID() string

func (EncryptedItem) IsDeleted

func (ei EncryptedItem) IsDeleted() bool

type EncryptedItemExport

type EncryptedItemExport struct {
	UUID        string  `json:"uuid"`
	ItemsKeyID  *string `json:"items_key_id,omitempty"`
	Content     string  `json:"content"`
	ContentType string  `json:"content_type"`
	// Deleted            bool    `json:"deleted"`
	EncItemKey         string  `json:"enc_item_key"`
	CreatedAt          string  `json:"created_at"`
	UpdatedAt          string  `json:"updated_at"`
	CreatedAtTimestamp int64   `json:"created_at_timestamp"`
	UpdatedAtTimestamp int64   `json:"updated_at_timestamp"`
	DuplicateOf        *string `json:"duplicate_of"`
}

type EncryptedItems

type EncryptedItems []EncryptedItem

func (*EncryptedItems) DeDupe

func (ei *EncryptedItems) DeDupe()

func (EncryptedItems) DecryptAndParse

func (ei EncryptedItems) DecryptAndParse(s *Session) (o Items, err error)

func (EncryptedItems) DecryptAndParseItemsKeys

func (ei EncryptedItems) DecryptAndParseItemsKeys(mk string, debug bool) (o []ItemsKey, err error)

func (EncryptedItems) ReEncrypt

func (ei EncryptedItems) ReEncrypt(s *Session, decryptionItemsKey ItemsKey, newItemsKey ItemsKey, newMasterKey string) (o EncryptedItems, err error)

func (*EncryptedItems) RemoveDeleted

func (ei *EncryptedItems) RemoveDeleted()

func (*EncryptedItems) RemoveUnsupported

func (ei *EncryptedItems) RemoveUnsupported()

func (*EncryptedItems) Validate

func (ei *EncryptedItems) Validate() error

type EncryptedItemsFile

type EncryptedItemsFile struct {
	Items     EncryptedItems `json:"items"`
	KeyParams KeyParams      `json:"keyParams"`
}

type Extension

type Extension struct {
	ItemCommon
	Content ExtensionContent
}

func NewExtension

func NewExtension() Extension

NewExtension returns an Item of type Extension without content.

func (Extension) GetContent

func (c Extension) GetContent() Content

func (Extension) GetContentSize

func (c Extension) GetContentSize() int

func (Extension) GetContentType

func (c Extension) GetContentType() string

func (Extension) GetCreatedAt

func (c Extension) GetCreatedAt() string

func (Extension) GetCreatedAtTimestamp

func (c Extension) GetCreatedAtTimestamp() int64

func (Extension) GetItemsKeyID

func (c Extension) GetItemsKeyID() string

func (Extension) GetUUID

func (c Extension) GetUUID() string

func (Extension) GetUpdatedAt

func (c Extension) GetUpdatedAt() string

func (Extension) GetUpdatedAtTimestamp

func (c Extension) GetUpdatedAtTimestamp() int64

func (Extension) IsDefault

func (c Extension) IsDefault() bool

func (Extension) IsDeleted

func (c Extension) IsDeleted() bool

func (*Extension) SetContent

func (c *Extension) SetContent(cc Content)

func (*Extension) SetContentSize

func (c *Extension) SetContentSize(s int)

func (*Extension) SetContentType

func (c *Extension) SetContentType(ct string)

func (*Extension) SetCreatedAt

func (c *Extension) SetCreatedAt(ca string)

func (*Extension) SetCreatedAtTimestamp

func (c *Extension) SetCreatedAtTimestamp(ca int64)

func (*Extension) SetDeleted

func (c *Extension) SetDeleted(d bool)

func (*Extension) SetUUID

func (c *Extension) SetUUID(u string)

func (*Extension) SetUpdatedAt

func (c *Extension) SetUpdatedAt(ca string)

func (*Extension) SetUpdatedAtTimestamp

func (c *Extension) SetUpdatedAtTimestamp(ca int64)

type ExtensionContent

type ExtensionContent struct {
	ItemReferences     ItemReferences `json:"references"`
	AppData            AppDataContent `json:"appData"`
	Name               string         `json:"name"`
	DissociatedItemIds []string       `json:"disassociatedItemIds"`
	AssociatedItemIds  []string       `json:"associatedItemIds"`
	Active             interface{}    `json:"active"`
}

func NewExtensionContent

func NewExtensionContent() *ExtensionContent

NewExtensionContent returns an empty Tag content instance.

func (*ExtensionContent) AssociateItems

func (cc *ExtensionContent) AssociateItems(newItems []string)

func (*ExtensionContent) DisassociateItems

func (cc *ExtensionContent) DisassociateItems(itemsToRemove []string)

func (*ExtensionContent) GetActive

func (cc *ExtensionContent) GetActive() bool

func (*ExtensionContent) GetAppData

func (cc *ExtensionContent) GetAppData() AppDataContent

func (*ExtensionContent) GetItemAssociations

func (cc *ExtensionContent) GetItemAssociations() []string

func (*ExtensionContent) GetItemDisassociations

func (cc *ExtensionContent) GetItemDisassociations() []string

func (*ExtensionContent) GetName

func (cc *ExtensionContent) GetName() string

func (ExtensionContent) GetTitle

func (cc ExtensionContent) GetTitle() string

func (*ExtensionContent) GetUpdateTime

func (cc *ExtensionContent) GetUpdateTime() (time.Time, error)

func (ExtensionContent) References

func (cc ExtensionContent) References() ItemReferences

func (*ExtensionContent) SetAppData

func (cc *ExtensionContent) SetAppData(data AppDataContent)

func (*ExtensionContent) SetReferences

func (cc *ExtensionContent) SetReferences(input ItemReferences)

func (*ExtensionContent) SetTitle

func (cc *ExtensionContent) SetTitle(title string)

func (*ExtensionContent) SetUpdateTime

func (cc *ExtensionContent) SetUpdateTime(uTime time.Time)

func (*ExtensionContent) UpsertReferences

func (cc *ExtensionContent) UpsertReferences(input ItemReferences)

type ExtensionRepo

type ExtensionRepo struct {
	ItemCommon
	Content ExtensionRepoContent
}

func NewExtensionRepo

func NewExtensionRepo() ExtensionRepo

NewExtensionRepo returns an Item of type ExtensionRepo without content.

func (ExtensionRepo) GetContent

func (c ExtensionRepo) GetContent() Content

func (ExtensionRepo) GetContentSize

func (c ExtensionRepo) GetContentSize() int

func (ExtensionRepo) GetContentType

func (c ExtensionRepo) GetContentType() string

func (ExtensionRepo) GetCreatedAt

func (c ExtensionRepo) GetCreatedAt() string

func (ExtensionRepo) GetCreatedAtTimestamp

func (c ExtensionRepo) GetCreatedAtTimestamp() int64

func (ExtensionRepo) GetItemsKeyID

func (c ExtensionRepo) GetItemsKeyID() string

func (ExtensionRepo) GetUUID

func (c ExtensionRepo) GetUUID() string

func (ExtensionRepo) GetUpdatedAt

func (c ExtensionRepo) GetUpdatedAt() string

func (ExtensionRepo) GetUpdatedAtTimestamp

func (c ExtensionRepo) GetUpdatedAtTimestamp() int64

func (ExtensionRepo) IsDefault

func (c ExtensionRepo) IsDefault() bool

func (ExtensionRepo) IsDeleted

func (c ExtensionRepo) IsDeleted() bool

func (*ExtensionRepo) SetContent

func (c *ExtensionRepo) SetContent(cc Content)

func (*ExtensionRepo) SetContentSize

func (c *ExtensionRepo) SetContentSize(s int)

func (*ExtensionRepo) SetContentType

func (c *ExtensionRepo) SetContentType(ct string)

func (*ExtensionRepo) SetCreatedAt

func (c *ExtensionRepo) SetCreatedAt(ca string)

func (*ExtensionRepo) SetCreatedAtTimestamp

func (c *ExtensionRepo) SetCreatedAtTimestamp(ca int64)

func (*ExtensionRepo) SetDeleted

func (c *ExtensionRepo) SetDeleted(d bool)

func (*ExtensionRepo) SetUUID

func (c *ExtensionRepo) SetUUID(u string)

func (*ExtensionRepo) SetUpdatedAt

func (c *ExtensionRepo) SetUpdatedAt(ca string)

func (*ExtensionRepo) SetUpdatedAtTimestamp

func (c *ExtensionRepo) SetUpdatedAtTimestamp(ca int64)

type ExtensionRepoContent

type ExtensionRepoContent struct {
	ItemReferences     ItemReferences `json:"references"`
	AppData            AppDataContent `json:"appData"`
	Name               string         `json:"name"`
	DissociatedItemIds []string       `json:"disassociatedItemIds"`
	AssociatedItemIds  []string       `json:"associatedItemIds"`
	Active             interface{}    `json:"active"`
}

func NewExtensionRepoContent

func NewExtensionRepoContent() *ExtensionRepoContent

NewExtensionRepoContent returns an empty Tag content instance.

func (*ExtensionRepoContent) AssociateItems

func (cc *ExtensionRepoContent) AssociateItems(newItems []string)

func (*ExtensionRepoContent) DisassociateItems

func (cc *ExtensionRepoContent) DisassociateItems(itemsToRemove []string)

func (*ExtensionRepoContent) GetActive

func (cc *ExtensionRepoContent) GetActive() bool

func (*ExtensionRepoContent) GetAppData

func (cc *ExtensionRepoContent) GetAppData() AppDataContent

func (*ExtensionRepoContent) GetItemAssociations

func (cc *ExtensionRepoContent) GetItemAssociations() []string

func (*ExtensionRepoContent) GetItemDisassociations

func (cc *ExtensionRepoContent) GetItemDisassociations() []string

func (*ExtensionRepoContent) GetName

func (cc *ExtensionRepoContent) GetName() string

func (ExtensionRepoContent) GetTitle

func (cc ExtensionRepoContent) GetTitle() string

func (*ExtensionRepoContent) GetUpdateTime

func (cc *ExtensionRepoContent) GetUpdateTime() (time.Time, error)

func (ExtensionRepoContent) References

func (cc ExtensionRepoContent) References() ItemReferences

func (*ExtensionRepoContent) SetAppData

func (cc *ExtensionRepoContent) SetAppData(data AppDataContent)

func (*ExtensionRepoContent) SetReferences

func (cc *ExtensionRepoContent) SetReferences(input ItemReferences)

func (*ExtensionRepoContent) SetTitle

func (cc *ExtensionRepoContent) SetTitle(title string)

func (*ExtensionRepoContent) SetUpdateTime

func (cc *ExtensionRepoContent) SetUpdateTime(uTime time.Time)

func (*ExtensionRepoContent) UpsertReferences

func (cc *ExtensionRepoContent) UpsertReferences(input ItemReferences)

type ExtensionRepos

type ExtensionRepos []ExtensionRepo

func (*ExtensionRepos) DeDupe

func (c *ExtensionRepos) DeDupe()

func (ExtensionRepos) Validate

func (c ExtensionRepos) Validate() error

type Extensions

type Extensions []Extension

func (*Extensions) DeDupe

func (c *Extensions) DeDupe()

func (Extensions) Validate

func (c Extensions) Validate() error

type FileSafeCredentials

type FileSafeCredentials struct {
	ItemCommon
	Content FileSafeCredentialsContent
}

func NewFileSafeCredentials

func NewFileSafeCredentials() FileSafeCredentials

NewFileSafeCredentials returns an Item of type FileSafeCredentials without content.

func (FileSafeCredentials) GetContent

func (c FileSafeCredentials) GetContent() Content

func (FileSafeCredentials) GetContentSize

func (c FileSafeCredentials) GetContentSize() int

func (FileSafeCredentials) GetContentType

func (c FileSafeCredentials) GetContentType() string

func (FileSafeCredentials) GetCreatedAt

func (c FileSafeCredentials) GetCreatedAt() string

func (FileSafeCredentials) GetCreatedAtTimestamp

func (c FileSafeCredentials) GetCreatedAtTimestamp() int64

func (FileSafeCredentials) GetItemsKeyID

func (c FileSafeCredentials) GetItemsKeyID() string

func (FileSafeCredentials) GetUUID

func (c FileSafeCredentials) GetUUID() string

func (FileSafeCredentials) GetUpdatedAt

func (c FileSafeCredentials) GetUpdatedAt() string

func (FileSafeCredentials) GetUpdatedAtTimestamp

func (c FileSafeCredentials) GetUpdatedAtTimestamp() int64

func (FileSafeCredentials) IsDefault

func (c FileSafeCredentials) IsDefault() bool

func (FileSafeCredentials) IsDeleted

func (c FileSafeCredentials) IsDeleted() bool

func (*FileSafeCredentials) SetContent

func (c *FileSafeCredentials) SetContent(cc Content)

func (*FileSafeCredentials) SetContentSize

func (c *FileSafeCredentials) SetContentSize(s int)

func (*FileSafeCredentials) SetContentType

func (c *FileSafeCredentials) SetContentType(ct string)

func (*FileSafeCredentials) SetCreatedAt

func (c *FileSafeCredentials) SetCreatedAt(ca string)

func (*FileSafeCredentials) SetCreatedAtTimestamp

func (c *FileSafeCredentials) SetCreatedAtTimestamp(ca int64)

func (*FileSafeCredentials) SetDeleted

func (c *FileSafeCredentials) SetDeleted(d bool)

func (*FileSafeCredentials) SetUUID

func (c *FileSafeCredentials) SetUUID(u string)

func (*FileSafeCredentials) SetUpdatedAt

func (c *FileSafeCredentials) SetUpdatedAt(ca string)

func (*FileSafeCredentials) SetUpdatedAtTimestamp

func (c *FileSafeCredentials) SetUpdatedAtTimestamp(ca int64)

type FileSafeCredentialsContent

type FileSafeCredentialsContent struct {
	Keys               json.RawMessage `json:"keys"`
	AuthParams         json.RawMessage `json:"authParams"`
	IsDefault          json.RawMessage `json:"isDefault"`
	ItemReferences     ItemReferences  `json:"references"`
	AppData            AppDataContent  `json:"appData"`
	Name               string          `json:"name"`
	DissociatedItemIds []string        `json:"disassociatedItemIds"`
	AssociatedItemIds  []string        `json:"associatedItemIds"`
	Active             interface{}     `json:"active"`
}

func NewFileSafeCredentialsContent

func NewFileSafeCredentialsContent() *FileSafeCredentialsContent

NewTagContent returns an empty Tag content instance.

func (*FileSafeCredentialsContent) AssociateItems

func (cc *FileSafeCredentialsContent) AssociateItems(newItems []string)

func (*FileSafeCredentialsContent) DisassociateItems

func (cc *FileSafeCredentialsContent) DisassociateItems(itemsToRemove []string)

func (*FileSafeCredentialsContent) GetActive

func (cc *FileSafeCredentialsContent) GetActive() bool

func (*FileSafeCredentialsContent) GetAppData

func (cc *FileSafeCredentialsContent) GetAppData() AppDataContent

func (*FileSafeCredentialsContent) GetItemAssociations

func (cc *FileSafeCredentialsContent) GetItemAssociations() []string

func (*FileSafeCredentialsContent) GetItemDisassociations

func (cc *FileSafeCredentialsContent) GetItemDisassociations() []string

func (*FileSafeCredentialsContent) GetName

func (cc *FileSafeCredentialsContent) GetName() string

func (FileSafeCredentialsContent) GetTitle

func (cc FileSafeCredentialsContent) GetTitle() string

func (*FileSafeCredentialsContent) GetUpdateTime

func (cc *FileSafeCredentialsContent) GetUpdateTime() (time.Time, error)

func (FileSafeCredentialsContent) References

func (*FileSafeCredentialsContent) SetAppData

func (cc *FileSafeCredentialsContent) SetAppData(data AppDataContent)

func (*FileSafeCredentialsContent) SetReferences

func (cc *FileSafeCredentialsContent) SetReferences(input ItemReferences)

func (*FileSafeCredentialsContent) SetTitle

func (cc *FileSafeCredentialsContent) SetTitle(title string)

func (*FileSafeCredentialsContent) SetUpdateTime

func (cc *FileSafeCredentialsContent) SetUpdateTime(uTime time.Time)

func (*FileSafeCredentialsContent) UpsertReferences

func (cc *FileSafeCredentialsContent) UpsertReferences(input ItemReferences)

type FileSafeCredentialss

type FileSafeCredentialss []FileSafeCredentials

func (*FileSafeCredentialss) DeDupe

func (c *FileSafeCredentialss) DeDupe()

func (FileSafeCredentialss) Validate

func (c FileSafeCredentialss) Validate() error

type FileSafeFileMetaData

type FileSafeFileMetaData struct {
	ItemCommon
	Content FileSafeFileMetaDataContent
}

func NewFileSafeFileMetaData

func NewFileSafeFileMetaData() FileSafeFileMetaData

NewFileSafeFileMetaData returns an Item of type FileSafeFileMetaData without content.

func (FileSafeFileMetaData) GetContent

func (c FileSafeFileMetaData) GetContent() Content

func (FileSafeFileMetaData) GetContentSize

func (c FileSafeFileMetaData) GetContentSize() int

func (FileSafeFileMetaData) GetContentType

func (c FileSafeFileMetaData) GetContentType() string

func (FileSafeFileMetaData) GetCreatedAt

func (c FileSafeFileMetaData) GetCreatedAt() string

func (FileSafeFileMetaData) GetCreatedAtTimestamp

func (c FileSafeFileMetaData) GetCreatedAtTimestamp() int64

func (FileSafeFileMetaData) GetItemsKeyID

func (c FileSafeFileMetaData) GetItemsKeyID() string

func (FileSafeFileMetaData) GetUUID

func (c FileSafeFileMetaData) GetUUID() string

func (FileSafeFileMetaData) GetUpdatedAt

func (c FileSafeFileMetaData) GetUpdatedAt() string

func (FileSafeFileMetaData) GetUpdatedAtTimestamp

func (c FileSafeFileMetaData) GetUpdatedAtTimestamp() int64

func (FileSafeFileMetaData) IsDefault

func (c FileSafeFileMetaData) IsDefault() bool

func (FileSafeFileMetaData) IsDeleted

func (c FileSafeFileMetaData) IsDeleted() bool

func (*FileSafeFileMetaData) SetContent

func (c *FileSafeFileMetaData) SetContent(cc Content)

func (*FileSafeFileMetaData) SetContentSize

func (c *FileSafeFileMetaData) SetContentSize(s int)

func (*FileSafeFileMetaData) SetContentType

func (c *FileSafeFileMetaData) SetContentType(ct string)

func (*FileSafeFileMetaData) SetCreatedAt

func (c *FileSafeFileMetaData) SetCreatedAt(ca string)

func (*FileSafeFileMetaData) SetCreatedAtTimestamp

func (c *FileSafeFileMetaData) SetCreatedAtTimestamp(ca int64)

func (*FileSafeFileMetaData) SetDeleted

func (c *FileSafeFileMetaData) SetDeleted(d bool)

func (*FileSafeFileMetaData) SetUUID

func (c *FileSafeFileMetaData) SetUUID(u string)

func (*FileSafeFileMetaData) SetUpdatedAt

func (c *FileSafeFileMetaData) SetUpdatedAt(ca string)

func (*FileSafeFileMetaData) SetUpdatedAtTimestamp

func (c *FileSafeFileMetaData) SetUpdatedAtTimestamp(ca int64)

type FileSafeFileMetaDataContent

type FileSafeFileMetaDataContent struct {
	ServerMetadata     json.RawMessage `json:"serverMetadata"`
	ItemReferences     ItemReferences  `json:"references"`
	AppData            AppDataContent  `json:"appData"`
	Name               string          `json:"name"`
	DissociatedItemIds []string        `json:"disassociatedItemIds"`
	AssociatedItemIds  []string        `json:"associatedItemIds"`
	Active             interface{}     `json:"active"`
}

func NewFileSafeFileMetaDataContent

func NewFileSafeFileMetaDataContent() *FileSafeFileMetaDataContent

NewTagContent returns an empty Tag content instance.

func (*FileSafeFileMetaDataContent) AssociateItems

func (cc *FileSafeFileMetaDataContent) AssociateItems(newItems []string)

func (*FileSafeFileMetaDataContent) DisassociateItems

func (cc *FileSafeFileMetaDataContent) DisassociateItems(itemsToRemove []string)

func (*FileSafeFileMetaDataContent) GetActive

func (cc *FileSafeFileMetaDataContent) GetActive() bool

func (*FileSafeFileMetaDataContent) GetAppData

func (*FileSafeFileMetaDataContent) GetItemAssociations

func (cc *FileSafeFileMetaDataContent) GetItemAssociations() []string

func (*FileSafeFileMetaDataContent) GetItemDisassociations

func (cc *FileSafeFileMetaDataContent) GetItemDisassociations() []string

func (*FileSafeFileMetaDataContent) GetName

func (cc *FileSafeFileMetaDataContent) GetName() string

func (FileSafeFileMetaDataContent) GetTitle

func (cc FileSafeFileMetaDataContent) GetTitle() string

func (*FileSafeFileMetaDataContent) GetUpdateTime

func (cc *FileSafeFileMetaDataContent) GetUpdateTime() (time.Time, error)

func (FileSafeFileMetaDataContent) References

func (*FileSafeFileMetaDataContent) SetAppData

func (cc *FileSafeFileMetaDataContent) SetAppData(data AppDataContent)

func (*FileSafeFileMetaDataContent) SetReferences

func (cc *FileSafeFileMetaDataContent) SetReferences(input ItemReferences)

func (*FileSafeFileMetaDataContent) SetTitle

func (cc *FileSafeFileMetaDataContent) SetTitle(title string)

func (*FileSafeFileMetaDataContent) SetUpdateTime

func (cc *FileSafeFileMetaDataContent) SetUpdateTime(uTime time.Time)

func (*FileSafeFileMetaDataContent) UpsertReferences

func (cc *FileSafeFileMetaDataContent) UpsertReferences(input ItemReferences)

type FileSafeFileMetaDatas

type FileSafeFileMetaDatas []FileSafeFileMetaData

func (*FileSafeFileMetaDatas) DeDupe

func (c *FileSafeFileMetaDatas) DeDupe()

func (FileSafeFileMetaDatas) Validate

func (c FileSafeFileMetaDatas) Validate() error

type FileSafeIntegration

type FileSafeIntegration struct {
	ItemCommon
	Content FileSafeIntegrationContent
}

func NewFileSafeIntegration

func NewFileSafeIntegration() FileSafeIntegration

NewFileSafeIntegration returns an Item of type FileSafeIntegration without content.

func (FileSafeIntegration) GetContent

func (c FileSafeIntegration) GetContent() Content

func (FileSafeIntegration) GetContentSize

func (c FileSafeIntegration) GetContentSize() int

func (FileSafeIntegration) GetContentType

func (c FileSafeIntegration) GetContentType() string

func (FileSafeIntegration) GetCreatedAt

func (c FileSafeIntegration) GetCreatedAt() string

func (FileSafeIntegration) GetCreatedAtTimestamp

func (c FileSafeIntegration) GetCreatedAtTimestamp() int64

func (FileSafeIntegration) GetItemsKeyID

func (c FileSafeIntegration) GetItemsKeyID() string

func (FileSafeIntegration) GetUUID

func (c FileSafeIntegration) GetUUID() string

func (FileSafeIntegration) GetUpdatedAt

func (c FileSafeIntegration) GetUpdatedAt() string

func (FileSafeIntegration) GetUpdatedAtTimestamp

func (c FileSafeIntegration) GetUpdatedAtTimestamp() int64

func (FileSafeIntegration) IsDefault

func (c FileSafeIntegration) IsDefault() bool

func (FileSafeIntegration) IsDeleted

func (c FileSafeIntegration) IsDeleted() bool

func (*FileSafeIntegration) SetContent

func (c *FileSafeIntegration) SetContent(cc Content)

func (*FileSafeIntegration) SetContentSize

func (c *FileSafeIntegration) SetContentSize(s int)

func (*FileSafeIntegration) SetContentType

func (c *FileSafeIntegration) SetContentType(ct string)

func (*FileSafeIntegration) SetCreatedAt

func (c *FileSafeIntegration) SetCreatedAt(ca string)

func (*FileSafeIntegration) SetCreatedAtTimestamp

func (c *FileSafeIntegration) SetCreatedAtTimestamp(ca int64)

func (*FileSafeIntegration) SetDeleted

func (c *FileSafeIntegration) SetDeleted(d bool)

func (*FileSafeIntegration) SetUUID

func (c *FileSafeIntegration) SetUUID(u string)

func (*FileSafeIntegration) SetUpdatedAt

func (c *FileSafeIntegration) SetUpdatedAt(ca string)

func (*FileSafeIntegration) SetUpdatedAtTimestamp

func (c *FileSafeIntegration) SetUpdatedAtTimestamp(ca int64)

type FileSafeIntegrationContent

type FileSafeIntegrationContent struct {
	Source                string         `json:"source"`
	Authorization         string         `json:"authorization"`
	RelayURL              string         `json:"relayUrl"`
	RawCode               string         `json:"rawCode"`
	IsDefaultUploadSource bool           `json:"isDefaultUploadSource"`
	ItemReferences        ItemReferences `json:"references"`
	AppData               AppDataContent `json:"appData"`
	Name                  string         `json:"name"`
	DissociatedItemIds    []string       `json:"disassociatedItemIds"`
	AssociatedItemIds     []string       `json:"associatedItemIds"`
	Active                interface{}    `json:"active"`
}

func NewFileSafeIntegrationContent

func NewFileSafeIntegrationContent() *FileSafeIntegrationContent

NewTagContent returns an empty Tag content instance.

func (*FileSafeIntegrationContent) AssociateItems

func (cc *FileSafeIntegrationContent) AssociateItems(newItems []string)

func (*FileSafeIntegrationContent) DisassociateItems

func (cc *FileSafeIntegrationContent) DisassociateItems(itemsToRemove []string)

func (*FileSafeIntegrationContent) GetActive

func (cc *FileSafeIntegrationContent) GetActive() bool

func (*FileSafeIntegrationContent) GetAppData

func (cc *FileSafeIntegrationContent) GetAppData() AppDataContent

func (*FileSafeIntegrationContent) GetItemAssociations

func (cc *FileSafeIntegrationContent) GetItemAssociations() []string

func (*FileSafeIntegrationContent) GetItemDisassociations

func (cc *FileSafeIntegrationContent) GetItemDisassociations() []string

func (*FileSafeIntegrationContent) GetName

func (cc *FileSafeIntegrationContent) GetName() string

func (FileSafeIntegrationContent) GetTitle

func (cc FileSafeIntegrationContent) GetTitle() string

func (*FileSafeIntegrationContent) GetUpdateTime

func (cc *FileSafeIntegrationContent) GetUpdateTime() (time.Time, error)

func (FileSafeIntegrationContent) References

func (*FileSafeIntegrationContent) SetAppData

func (cc *FileSafeIntegrationContent) SetAppData(data AppDataContent)

func (*FileSafeIntegrationContent) SetReferences

func (cc *FileSafeIntegrationContent) SetReferences(input ItemReferences)

func (*FileSafeIntegrationContent) SetTitle

func (cc *FileSafeIntegrationContent) SetTitle(title string)

func (*FileSafeIntegrationContent) SetUpdateTime

func (cc *FileSafeIntegrationContent) SetUpdateTime(uTime time.Time)

func (*FileSafeIntegrationContent) UpsertReferences

func (cc *FileSafeIntegrationContent) UpsertReferences(input ItemReferences)

type FileSafeIntegrations

type FileSafeIntegrations []FileSafeIntegration

func (*FileSafeIntegrations) DeDupe

func (c *FileSafeIntegrations) DeDupe()

func (FileSafeIntegrations) Validate

func (c FileSafeIntegrations) Validate() error

type Filter

type Filter struct {
	Type       string
	Key        string
	Comparison string
	Value      string
}

type Item

type Item interface {
	GetItemsKeyID() string
	GetUUID() string
	SetUUID(string)
	GetContentSize() int
	SetContentSize(int)
	GetContentType() string
	SetContentType(string)
	IsDeleted() bool
	SetDeleted(bool)
	GetCreatedAt() string
	SetCreatedAt(string)
	SetUpdatedAt(string)
	GetUpdatedAt() string
	GetCreatedAtTimestamp() int64
	SetCreatedAtTimestamp(int64)
	SetUpdatedAtTimestamp(int64)
	GetUpdatedAtTimestamp() int64
	GetContent() Content
	SetContent(Content)
	IsDefault() bool
}

Item defines all types of SN item, e.g. Note, Tag, and Component.

func DecryptAndParseItem

func DecryptAndParseItem(ei EncryptedItem, s *Session) (o Item, err error)

func ParseItem

func ParseItem(di DecryptedItem) (p Item, err error)

type ItemCommon

type ItemCommon struct {
	UUID               string
	ItemsKeyID         string
	EncryptedItemKey   string
	ContentType        string
	Deleted            bool
	CreatedAt          string
	UpdatedAt          string
	CreatedAtTimestamp int64
	UpdatedAtTimestamp int64
	ContentSize        int
}

ItemCommon contains the fields common to all SN Items.

type ItemFilters

type ItemFilters struct {
	MatchAny bool
	Filters  []Filter
}

type ItemReference

type ItemReference struct {
	// unique identifier of the item being referenced
	UUID string `json:"uuid"`
	// type of item being referenced
	ContentType string `json:"content_type"`
}

ItemReference defines a reference from one item to another.

type ItemReferences

type ItemReferences []ItemReference

func UpsertReferences

func UpsertReferences(existing, new ItemReferences) ItemReferences

type Items

type Items []Item

func DecryptAndParseItems

func DecryptAndParseItems(ei EncryptedItems, s *Session) (o Items, err error)

func (*Items) Append

func (i *Items) Append(x []interface{})

func (Items) Components

func (i Items) Components() (c Components)

func (*Items) DeDupe

func (i *Items) DeDupe()

func (*Items) Encrypt

func (i *Items) Encrypt(s *Session, ik ItemsKey) (e EncryptedItems, err error)

func (Items) Extension

func (i Items) Extension() (c Extensions)

func (Items) ExtensionRepo

func (i Items) ExtensionRepo() (c ExtensionRepos)

func (Items) FileSafeCredentials

func (i Items) FileSafeCredentials() (c FileSafeCredentialss)

func (Items) FileSafeFileMetaData

func (i Items) FileSafeFileMetaData() (c FileSafeFileMetaDatas)

func (Items) FileSafeIntegration

func (i Items) FileSafeIntegration() (c FileSafeIntegrations)

func (*Items) Filter

func (i *Items) Filter(f ItemFilters)

func (Items) Notes

func (i Items) Notes() (n Notes)

func (Items) Privileges

func (i Items) Privileges() (c PrivilegesN)

func (*Items) RemoveDeleted

func (i *Items) RemoveDeleted()

func (Items) SFExtension

func (i Items) SFExtension() (c SFExtensions)

func (Items) SFMFA

func (i Items) SFMFA() (c SFMFAs)

func (Items) SmartTag

func (i Items) SmartTag() (c SmartTags)

func (Items) Tags

func (i Items) Tags() (t Tags)

func (Items) Themes

func (i Items) Themes() (c Themes)

func (Items) UserPreferences

func (i Items) UserPreferences() (c UserPreferencess)

func (Items) Validate

func (i Items) Validate() error

type ItemsKey

type ItemsKey struct {
	// Following attributes set from:
	// - unmarshalling of the EncryptedItem
	UUID               string `json:"uuid"`
	EncryptedItemKey   EIT    `json:"enc_item_key"`
	ContentType        string `json:"content_type"`
	Deleted            bool   `json:"deleted"`
	CreatedAt          string `json:"created_at"`
	UpdatedAt          string `json:"updated_at"`
	CreatedAtTimestamp int64  `json:"created_at_timestamp"`
	UpdatedAtTimestamp int64  `json:"updated_at_timestamp"`
	// Following attributes set from:
	// - the unmarshalled content, post decryption
	// - creation of a new ItemsKey
	ItemsKey       string         `json:"itemsKey"`
	Version        string         `json:"version"`
	ItemReferences ItemReferences `json:"references"`
	AppData        AppDataContent `json:"appData"`
	Default        bool           `json:"isDefault"`
	// Following attibute set only for the purpose of marshaling a new ItemsKey when encrypting
	Content     ItemsKeyContent `json:"content"`
	ContentSize int
}

func DecryptAndParseItemKeys

func DecryptAndParseItemKeys(mk string, eiks EncryptedItems) (iks []ItemsKey, err error)

DecryptAndParseItemKeys takes the master key and a list of EncryptedItemKeys and returns a list of items keys.

func NewItemsKey

func NewItemsKey() ItemsKey

NewItemsKey returns an Item of type ItemsKey without content.

type ItemsKeyContent

type ItemsKeyContent struct {
	ItemsKey       string         `json:"itemsKey"`
	Version        string         `json:"version"`
	ItemReferences ItemReferences `json:"references"`
	AppData        AppDataContent `json:"appData"`
	Default        bool           `json:"isDefault"`
}

func NewItemsKeyContent

func NewItemsKeyContent() *ItemsKeyContent

NewItemsKeyContent returns an empty ItemsKey content instance.

func (ItemsKeyContent) AuthData

func (i ItemsKeyContent) AuthData() AppDataContent

func (ItemsKeyContent) MarshalJSON

func (i ItemsKeyContent) MarshalJSON() ([]byte, error)

func (ItemsKeyContent) References

func (i ItemsKeyContent) References() ItemReferences

type ItemsKeyEncKey

type ItemsKeyEncKey struct {
	Version         string `json:"version"`
	Protocol        string `json:"protocol"`
	EncryptionNonce string `json:"encryption_nonce"`
}

type ItemsKeys

type ItemsKeys []ItemsKey

func (ItemsKeys) Latest

func (iks ItemsKeys) Latest() ItemsKey

func (ItemsKeys) Valid

func (iks ItemsKeys) Valid() bool

type KeyParams

type KeyParams struct {
	Created     string `json:"created"`
	Identifier  string `json:"identifier"`
	Origination string `json:"origination"`
	PwNonce     string `json:"pw_nonce"`
	Version     string `json:"version"`
}

type MinimalSession

type MinimalSession struct {
	Server            string
	Token             string
	MasterKey         string
	KeyParams         KeyParams `json:"keyParams"`
	AccessToken       string    `json:"access_token"`
	RefreshToken      string    `json:"refresh_token"`
	AccessExpiration  int64     `json:"access_expiration"`
	RefreshExpiration int64     `json:"refresh_expiration"`
}

type Note

type Note struct {
	ItemCommon
	Content NoteContent
}

func NewNote

func NewNote(title string, text string, references ItemReferences) (note Note, err error)

NewNote returns an Item of type Note.

func (Note) Copy

func (n Note) Copy() Note

func (Note) Equals

func (n Note) Equals(e Note) bool

func (Note) GetContent

func (n Note) GetContent() Content

func (Note) GetContentSize

func (n Note) GetContentSize() int

func (Note) GetContentType

func (n Note) GetContentType() string

func (Note) GetCreatedAt

func (n Note) GetCreatedAt() string

func (Note) GetCreatedAtTimestamp

func (n Note) GetCreatedAtTimestamp() int64

func (Note) GetItemsKeyID

func (n Note) GetItemsKeyID() string

func (Note) GetUUID

func (n Note) GetUUID() string

func (Note) GetUpdatedAt

func (n Note) GetUpdatedAt() string

func (Note) GetUpdatedAtTimestamp

func (n Note) GetUpdatedAtTimestamp() int64

func (Note) IsDefault

func (n Note) IsDefault() bool

func (Note) IsDeleted

func (n Note) IsDeleted() bool

func (*Note) SetContent

func (n *Note) SetContent(c Content)

func (*Note) SetContentSize

func (n *Note) SetContentSize(s int)

func (*Note) SetContentType

func (n *Note) SetContentType(ct string)

func (*Note) SetCreatedAt

func (n *Note) SetCreatedAt(ca string)

func (*Note) SetCreatedAtTimestamp

func (n *Note) SetCreatedAtTimestamp(ca int64)

func (*Note) SetDeleted

func (n *Note) SetDeleted(d bool)

func (*Note) SetUUID

func (n *Note) SetUUID(u string)

func (*Note) SetUpdatedAt

func (n *Note) SetUpdatedAt(ca string)

func (*Note) SetUpdatedAtTimestamp

func (n *Note) SetUpdatedAtTimestamp(ca int64)

type NoteAppDataContent

type NoteAppDataContent struct {
	OrgStandardNotesSN           OrgStandardNotesSNDetail           `json:"org.standardnotes.sn"`
	OrgStandardNotesSNComponents OrgStandardNotesSNComponentsDetail `json:"org.standardnotes.sn.components,omitempty"`
}

type NoteContent

type NoteContent struct {
	Title          string             `json:"title"`
	Text           string             `json:"text"`
	ItemReferences ItemReferences     `json:"references"`
	AppData        NoteAppDataContent `json:"appData"`
	PreviewPlain   string             `json:"preview_plain"`
	Spellcheck     bool               `json:"spellcheck"`
	PreviewHtml    string             `json:"preview_html"`
	Trashed        *bool              `json:"trashed,omitempty"`
}

func NewNoteContent

func NewNoteContent() *NoteContent

NewNoteContent returns an empty Note content instance.

func (*NoteContent) AddItemAssociations

func (noteContent *NoteContent) AddItemAssociations() string

func (*NoteContent) AssociateItems

func (noteContent *NoteContent) AssociateItems(newItems []string)

func (NoteContent) Copy

func (noteContent NoteContent) Copy() NoteContent

func (*NoteContent) DisassociateItems

func (noteContent *NoteContent) DisassociateItems(newItems []string)

func (*NoteContent) GetActive

func (noteContent *NoteContent) GetActive() bool

func (*NoteContent) GetAppData

func (noteContent *NoteContent) GetAppData() NoteAppDataContent

func (*NoteContent) GetItemAssociations

func (noteContent *NoteContent) GetItemAssociations() []string

func (*NoteContent) GetItemDisassociations

func (noteContent *NoteContent) GetItemDisassociations() []string

func (*NoteContent) GetName

func (noteContent *NoteContent) GetName() string

func (NoteContent) GetPrefersPlainEditor

func (noteContent NoteContent) GetPrefersPlainEditor() bool

func (NoteContent) GetText

func (noteContent NoteContent) GetText() string

func (NoteContent) GetTitle

func (noteContent NoteContent) GetTitle() string

func (*NoteContent) GetTrashed

func (noteContent *NoteContent) GetTrashed() bool

func (*NoteContent) GetUpdateTime

func (noteContent *NoteContent) GetUpdateTime() (time.Time, error)

func (NoteContent) MarshalJSON

func (noteContent NoteContent) MarshalJSON() ([]byte, error)

func (NoteContent) References

func (noteContent NoteContent) References() ItemReferences

func (*NoteContent) SetAppData

func (noteContent *NoteContent) SetAppData(data NoteAppDataContent)

func (*NoteContent) SetPrefersPlainEditor

func (noteContent *NoteContent) SetPrefersPlainEditor(p bool)

func (*NoteContent) SetReferences

func (noteContent *NoteContent) SetReferences(newRefs ItemReferences)

func (*NoteContent) SetText

func (noteContent *NoteContent) SetText(text string)

func (*NoteContent) SetTitle

func (noteContent *NoteContent) SetTitle(title string)

func (*NoteContent) SetTrashed

func (noteContent *NoteContent) SetTrashed(t bool)

func (*NoteContent) SetUpdateTime

func (noteContent *NoteContent) SetUpdateTime(uTime time.Time)

func (*NoteContent) UpsertReferences

func (noteContent *NoteContent) UpsertReferences(newRefs ItemReferences)

type Notes

type Notes []Note

func (*Notes) DeDupe

func (n *Notes) DeDupe()

func (*Notes) Encrypt

func (n *Notes) Encrypt(s Session) (e EncryptedItems, err error)

func (*Notes) RemoveDeleted

func (n *Notes) RemoveDeleted()

func (Notes) Validate

func (n Notes) Validate() error

type OrgStandardNotesSNComponentsDetail

type OrgStandardNotesSNComponentsDetail map[string]interface{}

type OrgStandardNotesSNDetail

type OrgStandardNotesSNDetail struct {
	ClientUpdatedAt    string `json:"client_updated_at"`
	PrefersPlainEditor bool   `json:"prefersPlainEditor"`
	Pinned             bool   `json:"pinned"`
}

type Privileges

type Privileges struct {
	ItemCommon
	Content PrivilegesContent
}

func NewPrivileges

func NewPrivileges() Privileges

NewPrivileges returns an Item of type Privileges without content.

func (Privileges) GetContent

func (c Privileges) GetContent() Content

func (Privileges) GetContentSize

func (c Privileges) GetContentSize() int

func (Privileges) GetContentType

func (c Privileges) GetContentType() string

func (Privileges) GetCreatedAt

func (c Privileges) GetCreatedAt() string

func (Privileges) GetCreatedAtTimestamp

func (c Privileges) GetCreatedAtTimestamp() int64

func (Privileges) GetItemsKeyID

func (c Privileges) GetItemsKeyID() string

func (Privileges) GetUUID

func (c Privileges) GetUUID() string

func (Privileges) GetUpdatedAt

func (c Privileges) GetUpdatedAt() string

func (Privileges) GetUpdatedAtTimestamp

func (c Privileges) GetUpdatedAtTimestamp() int64

func (Privileges) IsDefault

func (c Privileges) IsDefault() bool

func (Privileges) IsDeleted

func (c Privileges) IsDeleted() bool

func (*Privileges) SetContent

func (c *Privileges) SetContent(cc Content)

func (*Privileges) SetContentSize

func (c *Privileges) SetContentSize(s int)

func (*Privileges) SetContentType

func (c *Privileges) SetContentType(ct string)

func (*Privileges) SetCreatedAt

func (c *Privileges) SetCreatedAt(ca string)

func (*Privileges) SetCreatedAtTimestamp

func (c *Privileges) SetCreatedAtTimestamp(ca int64)

func (*Privileges) SetDeleted

func (c *Privileges) SetDeleted(d bool)

func (*Privileges) SetUUID

func (c *Privileges) SetUUID(u string)

func (*Privileges) SetUpdatedAt

func (c *Privileges) SetUpdatedAt(ca string)

func (*Privileges) SetUpdatedAtTimestamp

func (c *Privileges) SetUpdatedAtTimestamp(ca int64)

type PrivilegesContent

type PrivilegesContent struct {
	ItemReferences     ItemReferences `json:"references"`
	AppData            AppDataContent `json:"appData"`
	Name               string         `json:"name"`
	DissociatedItemIds []string       `json:"disassociatedItemIds"`
	AssociatedItemIds  []string       `json:"associatedItemIds"`
	Active             interface{}    `json:"active"`
}

func NewPrivilegesContent

func NewPrivilegesContent() *PrivilegesContent

NewTagContent returns an empty Tag content instance.

func (*PrivilegesContent) AssociateItems

func (cc *PrivilegesContent) AssociateItems(newItems []string)

func (*PrivilegesContent) DisassociateItems

func (cc *PrivilegesContent) DisassociateItems(itemsToRemove []string)

func (*PrivilegesContent) GetActive

func (cc *PrivilegesContent) GetActive() bool

func (*PrivilegesContent) GetAppData

func (cc *PrivilegesContent) GetAppData() AppDataContent

func (*PrivilegesContent) GetItemAssociations

func (cc *PrivilegesContent) GetItemAssociations() []string

func (*PrivilegesContent) GetItemDisassociations

func (cc *PrivilegesContent) GetItemDisassociations() []string

func (*PrivilegesContent) GetName

func (cc *PrivilegesContent) GetName() string

func (PrivilegesContent) GetTitle

func (cc PrivilegesContent) GetTitle() string

func (*PrivilegesContent) GetUpdateTime

func (cc *PrivilegesContent) GetUpdateTime() (time.Time, error)

func (PrivilegesContent) References

func (cc PrivilegesContent) References() ItemReferences

func (*PrivilegesContent) SetAppData

func (cc *PrivilegesContent) SetAppData(data AppDataContent)

func (*PrivilegesContent) SetReferences

func (cc *PrivilegesContent) SetReferences(input ItemReferences)

func (*PrivilegesContent) SetTitle

func (cc *PrivilegesContent) SetTitle(title string)

func (*PrivilegesContent) SetUpdateTime

func (cc *PrivilegesContent) SetUpdateTime(uTime time.Time)

func (*PrivilegesContent) UpsertReferences

func (cc *PrivilegesContent) UpsertReferences(input ItemReferences)

type PrivilegesN

type PrivilegesN []Privileges

func (*PrivilegesN) DeDupe

func (c *PrivilegesN) DeDupe()

func (PrivilegesN) Validate

func (c PrivilegesN) Validate() error

type RegisterInput

type RegisterInput struct {
	Password    string
	Email       string
	PWNonce     string
	Version     string
	Origination string
	Created     int64
	APIServer   string
	Debug       bool
}

func (RegisterInput) Register

func (input RegisterInput) Register() (token string, err error)

Register creates a new user token Params: email, password, pw_cost, pw_nonce, version.

type SFExtension

type SFExtension struct {
	ItemCommon
	Content SFExtensionContent
}

func NewSFExtension

func NewSFExtension() SFExtension

NewSFExtension returns an Item of type SFExtension without content.

func (SFExtension) GetContent

func (c SFExtension) GetContent() Content

func (SFExtension) GetContentSize

func (c SFExtension) GetContentSize() int

func (SFExtension) GetContentType

func (c SFExtension) GetContentType() string

func (SFExtension) GetCreatedAt

func (c SFExtension) GetCreatedAt() string

func (SFExtension) GetCreatedAtTimestamp

func (c SFExtension) GetCreatedAtTimestamp() int64

func (SFExtension) GetItemsKeyID

func (c SFExtension) GetItemsKeyID() string

func (SFExtension) GetUUID

func (c SFExtension) GetUUID() string

func (SFExtension) GetUpdatedAt

func (c SFExtension) GetUpdatedAt() string

func (SFExtension) GetUpdatedAtTimestamp

func (c SFExtension) GetUpdatedAtTimestamp() int64

func (SFExtension) IsDefault

func (c SFExtension) IsDefault() bool

func (SFExtension) IsDeleted

func (c SFExtension) IsDeleted() bool

func (*SFExtension) SetContent

func (c *SFExtension) SetContent(cc Content)

func (*SFExtension) SetContentSize

func (c *SFExtension) SetContentSize(s int)

func (*SFExtension) SetContentType

func (c *SFExtension) SetContentType(ct string)

func (*SFExtension) SetCreatedAt

func (c *SFExtension) SetCreatedAt(ca string)

func (*SFExtension) SetCreatedAtTimestamp

func (c *SFExtension) SetCreatedAtTimestamp(ca int64)

func (*SFExtension) SetDeleted

func (c *SFExtension) SetDeleted(d bool)

func (*SFExtension) SetUUID

func (c *SFExtension) SetUUID(u string)

func (*SFExtension) SetUpdatedAt

func (c *SFExtension) SetUpdatedAt(ca string)

func (*SFExtension) SetUpdatedAtTimestamp

func (c *SFExtension) SetUpdatedAtTimestamp(ca int64)

type SFExtensionContent

type SFExtensionContent struct {
	ItemReferences     ItemReferences `json:"references"`
	AppData            AppDataContent `json:"appData"`
	Name               string         `json:"name"`
	DissociatedItemIds []string       `json:"disassociatedItemIds"`
	AssociatedItemIds  []string       `json:"associatedItemIds"`
	Active             interface{}    `json:"active"`
}

func NewSFExtensionContent

func NewSFExtensionContent() *SFExtensionContent

NewSFExtensionContent returns an empty Tag content instance.

func (*SFExtensionContent) AssociateItems

func (cc *SFExtensionContent) AssociateItems(newItems []string)

func (*SFExtensionContent) DisassociateItems

func (cc *SFExtensionContent) DisassociateItems(itemsToRemove []string)

func (*SFExtensionContent) GetActive

func (cc *SFExtensionContent) GetActive() bool

func (*SFExtensionContent) GetAppData

func (cc *SFExtensionContent) GetAppData() AppDataContent

func (*SFExtensionContent) GetItemAssociations

func (cc *SFExtensionContent) GetItemAssociations() []string

func (*SFExtensionContent) GetItemDisassociations

func (cc *SFExtensionContent) GetItemDisassociations() []string

func (*SFExtensionContent) GetName

func (cc *SFExtensionContent) GetName() string

func (SFExtensionContent) GetTitle

func (cc SFExtensionContent) GetTitle() string

func (*SFExtensionContent) GetUpdateTime

func (cc *SFExtensionContent) GetUpdateTime() (time.Time, error)

func (SFExtensionContent) References

func (cc SFExtensionContent) References() ItemReferences

func (*SFExtensionContent) SetAppData

func (cc *SFExtensionContent) SetAppData(data AppDataContent)

func (*SFExtensionContent) SetReferences

func (cc *SFExtensionContent) SetReferences(input ItemReferences)

func (*SFExtensionContent) SetTitle

func (cc *SFExtensionContent) SetTitle(title string)

func (*SFExtensionContent) SetUpdateTime

func (cc *SFExtensionContent) SetUpdateTime(uTime time.Time)

func (*SFExtensionContent) UpsertReferences

func (cc *SFExtensionContent) UpsertReferences(input ItemReferences)

type SFExtensions

type SFExtensions []SFExtension

func (*SFExtensions) DeDupe

func (c *SFExtensions) DeDupe()

func (SFExtensions) Validate

func (c SFExtensions) Validate() error

type SFMFA

type SFMFA struct {
	ItemCommon
	Content SFMFAContent
}

func NewSFMFA

func NewSFMFA() SFMFA

NewSFMFA returns an Item of type SFMFA without content.

func (SFMFA) GetContent

func (c SFMFA) GetContent() Content

func (SFMFA) GetContentSize

func (c SFMFA) GetContentSize() int

func (SFMFA) GetContentType

func (c SFMFA) GetContentType() string

func (SFMFA) GetCreatedAt

func (c SFMFA) GetCreatedAt() string

func (SFMFA) GetCreatedAtTimestamp

func (c SFMFA) GetCreatedAtTimestamp() int64

func (SFMFA) GetItemsKeyID

func (c SFMFA) GetItemsKeyID() string

func (SFMFA) GetUUID

func (c SFMFA) GetUUID() string

func (SFMFA) GetUpdatedAt

func (c SFMFA) GetUpdatedAt() string

func (SFMFA) GetUpdatedAtTimestamp

func (c SFMFA) GetUpdatedAtTimestamp() int64

func (SFMFA) IsDefault

func (c SFMFA) IsDefault() bool

func (SFMFA) IsDeleted

func (c SFMFA) IsDeleted() bool

func (*SFMFA) SetContent

func (c *SFMFA) SetContent(cc Content)

func (*SFMFA) SetContentSize

func (c *SFMFA) SetContentSize(s int)

func (*SFMFA) SetContentType

func (c *SFMFA) SetContentType(ct string)

func (*SFMFA) SetCreatedAt

func (c *SFMFA) SetCreatedAt(ca string)

func (*SFMFA) SetCreatedAtTimestamp

func (c *SFMFA) SetCreatedAtTimestamp(ca int64)

func (*SFMFA) SetDeleted

func (c *SFMFA) SetDeleted(d bool)

func (*SFMFA) SetUUID

func (c *SFMFA) SetUUID(u string)

func (*SFMFA) SetUpdatedAt

func (c *SFMFA) SetUpdatedAt(ca string)

func (*SFMFA) SetUpdatedAtTimestamp

func (c *SFMFA) SetUpdatedAtTimestamp(ca int64)

type SFMFAContent

type SFMFAContent struct {
	ItemReferences     ItemReferences `json:"references"`
	AppData            AppDataContent `json:"appData"`
	Name               string         `json:"name"`
	DissociatedItemIds []string       `json:"disassociatedItemIds"`
	AssociatedItemIds  []string       `json:"associatedItemIds"`
	Active             interface{}    `json:"active"`
}

func NewSFMFAContent

func NewSFMFAContent() *SFMFAContent

NewTagContent returns an empty Tag content instance.

func (*SFMFAContent) AssociateItems

func (cc *SFMFAContent) AssociateItems(newItems []string)

func (*SFMFAContent) DisassociateItems

func (cc *SFMFAContent) DisassociateItems(itemsToRemove []string)

func (*SFMFAContent) GetActive

func (cc *SFMFAContent) GetActive() bool

func (*SFMFAContent) GetAppData

func (cc *SFMFAContent) GetAppData() AppDataContent

func (*SFMFAContent) GetItemAssociations

func (cc *SFMFAContent) GetItemAssociations() []string

func (*SFMFAContent) GetItemDisassociations

func (cc *SFMFAContent) GetItemDisassociations() []string

func (*SFMFAContent) GetName

func (cc *SFMFAContent) GetName() string

func (SFMFAContent) GetTitle

func (cc SFMFAContent) GetTitle() string

func (*SFMFAContent) GetUpdateTime

func (cc *SFMFAContent) GetUpdateTime() (time.Time, error)

func (SFMFAContent) References

func (cc SFMFAContent) References() ItemReferences

func (*SFMFAContent) SetAppData

func (cc *SFMFAContent) SetAppData(data AppDataContent)

func (*SFMFAContent) SetReferences

func (cc *SFMFAContent) SetReferences(input ItemReferences)

func (*SFMFAContent) SetTitle

func (cc *SFMFAContent) SetTitle(title string)

func (*SFMFAContent) SetUpdateTime

func (cc *SFMFAContent) SetUpdateTime(uTime time.Time)

func (*SFMFAContent) UpsertReferences

func (cc *SFMFAContent) UpsertReferences(input ItemReferences)

type SFMFAs

type SFMFAs []SFMFA

func (*SFMFAs) DeDupe

func (c *SFMFAs) DeDupe()

func (SFMFAs) Validate

func (c SFMFAs) Validate() error

type Session

type Session struct {
	Debug     bool
	Server    string
	Token     string
	MasterKey string
	ItemsKeys []ItemsKey
	// ImporterItemsKeys is the key used to encrypt exported items and set during import only
	ImporterItemsKeys ItemsKeys
	DefaultItemsKey   ItemsKey
	KeyParams         KeyParams `json:"keyParams"`
	AccessToken       string    `json:"access_token"`
	RefreshToken      string    `json:"refresh_token"`
	AccessExpiration  int64     `json:"access_expiration"`
	RefreshExpiration int64     `json:"refresh_expiration"`
	PasswordNonce     string
}

Session holds authentication and encryption parameters required to communicate with the API and process transferred data.

func CliSignIn

func CliSignIn(email, password, apiServer string, debug bool) (session Session, err error)

CliSignIn takes the server URL and credentials and sends them to the API to get a response including an authentication token plus the keys required to encrypt and decrypt SN items.

func GetSession

func GetSession(loadSession bool, sessionKey, server string, debug bool) (session Session, email string, err error)

func GetSessionFromUser

func GetSessionFromUser(server string, debug bool) (Session, string, error)

func ParseSessionString

func ParseSessionString(ss string) (sess Session, err error)

func (Session) CreateItemsKey

func (Session) CreateItemsKey() (ItemsKey, error)

func (*Session) Export

func (s *Session) Export(path string) error

func (*Session) Import

func (s *Session) Import(path string, syncToken string, password string) (items EncryptedItems, itemsKey ItemsKey, err error)

Import steps are: - decrypt items in current file (derive master key based on username, password nonce) - create a new items key and reencrypt all items - set items key to be same updatedtimestamp in order to replace existing.

func (*Session) Valid

func (s *Session) Valid() bool

type SignInInput

type SignInInput struct {
	Email     string
	TokenName string
	TokenVal  string
	Password  string
	APIServer string
	Debug     bool
}

type SignInOutput

type SignInOutput struct {
	Session   Session
	KeyParams KeyParams
	User      user
	TokenName string
}

func SignIn

func SignIn(input SignInInput) (output SignInOutput, err error)

SignIn authenticates with the server using credentials and optional MFA in order to obtain the data required to interact with Standard Notes.

type SmartTag

type SmartTag struct {
	ItemCommon
	Content SmartTagContent
}

func NewSmartTag

func NewSmartTag() SmartTag

NewSmartTag returns an Item of type SmartTag without content.

func (SmartTag) GetContent

func (c SmartTag) GetContent() Content

func (SmartTag) GetContentSize

func (c SmartTag) GetContentSize() int

func (SmartTag) GetContentType

func (c SmartTag) GetContentType() string

func (SmartTag) GetCreatedAt

func (c SmartTag) GetCreatedAt() string

func (SmartTag) GetCreatedAtTimestamp

func (c SmartTag) GetCreatedAtTimestamp() int64

func (SmartTag) GetItemsKeyID

func (c SmartTag) GetItemsKeyID() string

func (SmartTag) GetUUID

func (c SmartTag) GetUUID() string

func (SmartTag) GetUpdatedAt

func (c SmartTag) GetUpdatedAt() string

func (SmartTag) GetUpdatedAtTimestamp

func (c SmartTag) GetUpdatedAtTimestamp() int64

func (SmartTag) IsDefault

func (c SmartTag) IsDefault() bool

func (SmartTag) IsDeleted

func (c SmartTag) IsDeleted() bool

func (*SmartTag) SetContent

func (c *SmartTag) SetContent(cc Content)

func (*SmartTag) SetContentSize

func (c *SmartTag) SetContentSize(s int)

func (*SmartTag) SetContentType

func (c *SmartTag) SetContentType(ct string)

func (*SmartTag) SetCreatedAt

func (c *SmartTag) SetCreatedAt(ca string)

func (*SmartTag) SetCreatedAtTimestamp

func (c *SmartTag) SetCreatedAtTimestamp(ca int64)

func (*SmartTag) SetDeleted

func (c *SmartTag) SetDeleted(d bool)

func (*SmartTag) SetUUID

func (c *SmartTag) SetUUID(u string)

func (*SmartTag) SetUpdatedAt

func (c *SmartTag) SetUpdatedAt(ca string)

func (*SmartTag) SetUpdatedAtTimestamp

func (c *SmartTag) SetUpdatedAtTimestamp(ca int64)

type SmartTagContent

type SmartTagContent struct {
	ItemReferences     ItemReferences `json:"references"`
	AppData            AppDataContent `json:"appData"`
	Name               string         `json:"name"`
	DissociatedItemIds []string       `json:"disassociatedItemIds"`
	AssociatedItemIds  []string       `json:"associatedItemIds"`
	Active             interface{}    `json:"active"`
}

func NewSmartTagContent

func NewSmartTagContent() *SmartTagContent

NewTagContent returns an empty Tag content instance.

func (*SmartTagContent) AssociateItems

func (cc *SmartTagContent) AssociateItems(newItems []string)

func (*SmartTagContent) DisassociateItems

func (cc *SmartTagContent) DisassociateItems(itemsToRemove []string)

func (*SmartTagContent) GetActive

func (cc *SmartTagContent) GetActive() bool

func (*SmartTagContent) GetAppData

func (cc *SmartTagContent) GetAppData() AppDataContent

func (*SmartTagContent) GetItemAssociations

func (cc *SmartTagContent) GetItemAssociations() []string

func (*SmartTagContent) GetItemDisassociations

func (cc *SmartTagContent) GetItemDisassociations() []string

func (*SmartTagContent) GetName

func (cc *SmartTagContent) GetName() string

func (SmartTagContent) GetTitle

func (cc SmartTagContent) GetTitle() string

func (*SmartTagContent) GetUpdateTime

func (cc *SmartTagContent) GetUpdateTime() (time.Time, error)

func (SmartTagContent) References

func (cc SmartTagContent) References() ItemReferences

func (*SmartTagContent) SetAppData

func (cc *SmartTagContent) SetAppData(data AppDataContent)

func (*SmartTagContent) SetReferences

func (cc *SmartTagContent) SetReferences(input ItemReferences)

func (*SmartTagContent) SetTitle

func (cc *SmartTagContent) SetTitle(title string)

func (*SmartTagContent) SetUpdateTime

func (cc *SmartTagContent) SetUpdateTime(uTime time.Time)

func (*SmartTagContent) UpsertReferences

func (cc *SmartTagContent) UpsertReferences(input ItemReferences)

type SmartTags

type SmartTags []SmartTag

func (*SmartTags) DeDupe

func (c *SmartTags) DeDupe()

func (SmartTags) Validate

func (c SmartTags) Validate() error

type SyncInput

type SyncInput struct {
	Session              *Session
	SyncToken            string
	CursorToken          string
	Items                EncryptedItems
	NextItem             int // the next item to put
	OutType              string
	PageSize             int   // override default number of items to request with each sync call
	PostSyncRequestDelay int64 // milliseconds to sleep after sync request
}

SyncInput defines the input for retrieving items.

type SyncOutput

type SyncOutput struct {
	Items      EncryptedItems  // items new or modified since last sync
	SavedItems EncryptedItems  // dirty items needing resolution
	Unsaved    EncryptedItems  // items not saved during sync TODO: No longer needed? Replaced by Conflicts?
	Conflicts  ConflictedItems // items not saved during sync due to significant difference in updated_time values. can be triggered by import where the server item has been updated since export.
	SyncToken  string

	Cursor string
}

SyncOutput defines the output from retrieving items It contains slices of items based on their state see: https://standardfile.org/ for state details

func Sync

func Sync(input SyncInput) (output SyncOutput, err error)

Sync retrieves items from the API using optional filters and updates the provided session with the items keys required to encrypt and decrypt items.

type Tag

type Tag struct {
	ItemCommon
	Content TagContent
}

func NewTag

func NewTag(title string, refs ItemReferences) (tag Tag, err error)

NewTag returns an Item of type Tag without content.

func (Tag) Copy

func (t Tag) Copy() Tag

func (Tag) Equals

func (t Tag) Equals(e Tag) bool

func (Tag) GetContent

func (t Tag) GetContent() Content

func (Tag) GetContentSize

func (t Tag) GetContentSize() int

func (Tag) GetContentType

func (t Tag) GetContentType() string

func (Tag) GetCreatedAt

func (t Tag) GetCreatedAt() string

func (Tag) GetCreatedAtTimestamp

func (t Tag) GetCreatedAtTimestamp() int64

func (Tag) GetItemsKeyID

func (t Tag) GetItemsKeyID() string

func (Tag) GetUUID

func (t Tag) GetUUID() string

func (Tag) GetUpdatedAt

func (t Tag) GetUpdatedAt() string

func (Tag) GetUpdatedAtTimestamp

func (t Tag) GetUpdatedAtTimestamp() int64

func (Tag) IsDefault

func (t Tag) IsDefault() bool

func (Tag) IsDeleted

func (t Tag) IsDeleted() bool

func (*Tag) SetContent

func (t *Tag) SetContent(c Content)

func (*Tag) SetContentSize

func (t *Tag) SetContentSize(s int)

func (*Tag) SetContentType

func (t *Tag) SetContentType(ct string)

func (*Tag) SetCreatedAt

func (t *Tag) SetCreatedAt(ca string)

func (*Tag) SetCreatedAtTimestamp

func (t *Tag) SetCreatedAtTimestamp(ca int64)

func (*Tag) SetDeleted

func (t *Tag) SetDeleted(d bool)

func (*Tag) SetUUID

func (t *Tag) SetUUID(u string)

func (*Tag) SetUpdatedAt

func (t *Tag) SetUpdatedAt(ca string)

func (*Tag) SetUpdatedAtTimestamp

func (t *Tag) SetUpdatedAtTimestamp(ca int64)

type TagContent

type TagContent struct {
	Title          string         `json:"title"`
	ItemReferences ItemReferences `json:"references"`
	AppData        AppDataContent `json:"appData"`
}

func NewTagContent

func NewTagContent() *TagContent

NewTagContent returns an empty Tag content instance.

func (*TagContent) AssociateItems

func (tagContent *TagContent) AssociateItems(newItems []string)

func (TagContent) Copy

func (tagContent TagContent) Copy() TagContent

func (*TagContent) DisassociateItems

func (tagContent *TagContent) DisassociateItems(newItems []string)

func (TagContent) Equals

func (tagContent TagContent) Equals(e TagContent) bool

func (*TagContent) GetActive

func (tagContent *TagContent) GetActive() bool

func (*TagContent) GetAppData

func (tagContent *TagContent) GetAppData() AppDataContent

func (*TagContent) GetItemAssociations

func (tagContent *TagContent) GetItemAssociations() []string

func (*TagContent) GetItemDisassociations

func (tagContent *TagContent) GetItemDisassociations() []string

func (*TagContent) GetName

func (tagContent *TagContent) GetName() string

func (TagContent) GetText

func (tagContent TagContent) GetText() string

func (TagContent) GetTitle

func (tagContent TagContent) GetTitle() string

func (*TagContent) GetUpdateTime

func (tagContent *TagContent) GetUpdateTime() (time.Time, error)

func (TagContent) MarshalJSON

func (tagContent TagContent) MarshalJSON() ([]byte, error)

func (TagContent) References

func (tagContent TagContent) References() ItemReferences

func (*TagContent) SetAppData

func (tagContent *TagContent) SetAppData(data AppDataContent)

func (*TagContent) SetReferences

func (tagContent *TagContent) SetReferences(newRefs ItemReferences)

func (*TagContent) SetText

func (tagContent *TagContent) SetText(text string)

func (*TagContent) SetTitle

func (tagContent *TagContent) SetTitle(title string)

func (*TagContent) SetUpdateTime

func (tagContent *TagContent) SetUpdateTime(uTime time.Time)

func (*TagContent) TextContains

func (tagContent *TagContent) TextContains(findString string, matchCase bool) bool

func (*TagContent) UpsertReferences

func (tagContent *TagContent) UpsertReferences(newRefs ItemReferences)

type Tags

type Tags []Tag

func (*Tags) DeDupe

func (t *Tags) DeDupe()

func (*Tags) Encrypt

func (t *Tags) Encrypt(s Session) (e EncryptedItems, err error)

func (Tags) Validate

func (t Tags) Validate() error

type Theme

type Theme struct {
	ItemCommon
	Content ThemeContent
}

func NewTheme

func NewTheme() Theme

NewTheme returns an Item of type Theme without content.

func (Theme) GetContent

func (c Theme) GetContent() Content

func (Theme) GetContentSize

func (c Theme) GetContentSize() int

func (Theme) GetContentType

func (c Theme) GetContentType() string

func (Theme) GetCreatedAt

func (c Theme) GetCreatedAt() string

func (Theme) GetCreatedAtTimestamp

func (c Theme) GetCreatedAtTimestamp() int64

func (Theme) GetItemsKeyID

func (c Theme) GetItemsKeyID() string

func (Theme) GetUUID

func (c Theme) GetUUID() string

func (Theme) GetUpdatedAt

func (c Theme) GetUpdatedAt() string

func (Theme) GetUpdatedAtTimestamp

func (c Theme) GetUpdatedAtTimestamp() int64

func (Theme) IsDefault

func (c Theme) IsDefault() bool

func (Theme) IsDeleted

func (c Theme) IsDeleted() bool

func (*Theme) SetContent

func (c *Theme) SetContent(cc Content)

func (*Theme) SetContentSize

func (c *Theme) SetContentSize(s int)

func (*Theme) SetContentType

func (c *Theme) SetContentType(ct string)

func (*Theme) SetCreatedAt

func (c *Theme) SetCreatedAt(ca string)

func (*Theme) SetCreatedAtTimestamp

func (c *Theme) SetCreatedAtTimestamp(ca int64)

func (*Theme) SetDeleted

func (c *Theme) SetDeleted(d bool)

func (*Theme) SetUUID

func (c *Theme) SetUUID(u string)

func (*Theme) SetUpdatedAt

func (c *Theme) SetUpdatedAt(ca string)

func (*Theme) SetUpdatedAtTimestamp

func (c *Theme) SetUpdatedAtTimestamp(ca int64)

type ThemeContent

type ThemeContent struct {
	HostedURL          string          `json:"hosted_url"`
	LocalURL           string          `json:"local_url"`
	PackageInfo        json.RawMessage `json:"package_info"`
	ValidUntil         string          `json:"valid_until"`
	ItemReferences     ItemReferences  `json:"references"`
	AppData            AppDataContent  `json:"appData"`
	Name               string          `json:"name"`
	DissociatedItemIds []string        `json:"disassociatedItemIds"`
	AssociatedItemIds  []string        `json:"associatedItemIds"`
	Active             interface{}     `json:"active"`
}

func NewThemeContent

func NewThemeContent() *ThemeContent

NewTagContent returns an empty Tag content instance.

func (*ThemeContent) AssociateItems

func (cc *ThemeContent) AssociateItems(newItems []string)

func (*ThemeContent) DisassociateItems

func (cc *ThemeContent) DisassociateItems(itemsToRemove []string)

func (*ThemeContent) GetActive

func (cc *ThemeContent) GetActive() bool

func (*ThemeContent) GetAppData

func (cc *ThemeContent) GetAppData() AppDataContent

func (*ThemeContent) GetItemAssociations

func (cc *ThemeContent) GetItemAssociations() []string

func (*ThemeContent) GetItemDisassociations

func (cc *ThemeContent) GetItemDisassociations() []string

func (*ThemeContent) GetName

func (cc *ThemeContent) GetName() string

func (ThemeContent) GetTitle

func (cc ThemeContent) GetTitle() string

func (*ThemeContent) GetUpdateTime

func (cc *ThemeContent) GetUpdateTime() (time.Time, error)

func (ThemeContent) References

func (cc ThemeContent) References() ItemReferences

func (*ThemeContent) SetAppData

func (cc *ThemeContent) SetAppData(data AppDataContent)

func (*ThemeContent) SetReferences

func (cc *ThemeContent) SetReferences(input ItemReferences)

func (*ThemeContent) SetTitle

func (cc *ThemeContent) SetTitle(title string)

func (*ThemeContent) SetUpdateTime

func (cc *ThemeContent) SetUpdateTime(uTime time.Time)

func (*ThemeContent) UpsertReferences

func (cc *ThemeContent) UpsertReferences(input ItemReferences)

type Themes

type Themes []Theme

func (*Themes) DeDupe

func (c *Themes) DeDupe()

func (Themes) Validate

func (c Themes) Validate() error

type UpdateItemRefsInput

type UpdateItemRefsInput struct {
	Items Items // Tags
	ToRef Items // Items To Reference
}

type UpdateItemRefsOutput

type UpdateItemRefsOutput struct {
	Items Items // Tags
}

type UserPreferences

type UserPreferences struct {
	ItemCommon
	Content UserPreferencesContent
}

func NewUserPreferences

func NewUserPreferences() UserPreferences

NewUserPreferences returns an Item of type UserPreferences without content.

func (UserPreferences) GetContent

func (c UserPreferences) GetContent() Content

func (UserPreferences) GetContentSize

func (c UserPreferences) GetContentSize() int

func (UserPreferences) GetContentType

func (c UserPreferences) GetContentType() string

func (UserPreferences) GetCreatedAt

func (c UserPreferences) GetCreatedAt() string

func (UserPreferences) GetCreatedAtTimestamp

func (c UserPreferences) GetCreatedAtTimestamp() int64

func (UserPreferences) GetItemsKeyID

func (c UserPreferences) GetItemsKeyID() string

func (UserPreferences) GetUUID

func (c UserPreferences) GetUUID() string

func (UserPreferences) GetUpdatedAt

func (c UserPreferences) GetUpdatedAt() string

func (UserPreferences) GetUpdatedAtTimestamp

func (c UserPreferences) GetUpdatedAtTimestamp() int64

func (UserPreferences) IsDefault

func (c UserPreferences) IsDefault() bool

func (UserPreferences) IsDeleted

func (c UserPreferences) IsDeleted() bool

func (*UserPreferences) SetContent

func (c *UserPreferences) SetContent(cc Content)

func (*UserPreferences) SetContentSize

func (c *UserPreferences) SetContentSize(s int)

func (*UserPreferences) SetContentType

func (c *UserPreferences) SetContentType(ct string)

func (*UserPreferences) SetCreatedAt

func (c *UserPreferences) SetCreatedAt(ca string)

func (*UserPreferences) SetCreatedAtTimestamp

func (c *UserPreferences) SetCreatedAtTimestamp(ca int64)

func (*UserPreferences) SetDeleted

func (c *UserPreferences) SetDeleted(d bool)

func (*UserPreferences) SetUUID

func (c *UserPreferences) SetUUID(u string)

func (*UserPreferences) SetUpdatedAt

func (c *UserPreferences) SetUpdatedAt(ca string)

func (*UserPreferences) SetUpdatedAtTimestamp

func (c *UserPreferences) SetUpdatedAtTimestamp(ca int64)

type UserPreferencesContent

type UserPreferencesContent struct {
	ItemReferences     ItemReferences `json:"references"`
	AppData            AppDataContent `json:"appData"`
	Name               string         `json:"name"`
	DissociatedItemIds []string       `json:"disassociatedItemIds"`
	AssociatedItemIds  []string       `json:"associatedItemIds"`
	Active             interface{}    `json:"active"`
}

func NewUserPreferencesContent

func NewUserPreferencesContent() *UserPreferencesContent

NewUserPreferencesContent returns an empty Tag content instance.

func (*UserPreferencesContent) AssociateItems

func (cc *UserPreferencesContent) AssociateItems(newItems []string)

func (*UserPreferencesContent) DisassociateItems

func (cc *UserPreferencesContent) DisassociateItems(itemsToRemove []string)

func (*UserPreferencesContent) GetActive

func (cc *UserPreferencesContent) GetActive() bool

func (*UserPreferencesContent) GetAppData

func (cc *UserPreferencesContent) GetAppData() AppDataContent

func (*UserPreferencesContent) GetItemAssociations

func (cc *UserPreferencesContent) GetItemAssociations() []string

func (*UserPreferencesContent) GetItemDisassociations

func (cc *UserPreferencesContent) GetItemDisassociations() []string

func (*UserPreferencesContent) GetName

func (cc *UserPreferencesContent) GetName() string

func (UserPreferencesContent) GetTitle

func (cc UserPreferencesContent) GetTitle() string

func (*UserPreferencesContent) GetUpdateTime

func (cc *UserPreferencesContent) GetUpdateTime() (time.Time, error)

func (UserPreferencesContent) References

func (cc UserPreferencesContent) References() ItemReferences

func (*UserPreferencesContent) SetAppData

func (cc *UserPreferencesContent) SetAppData(data AppDataContent)

func (*UserPreferencesContent) SetReferences

func (cc *UserPreferencesContent) SetReferences(input ItemReferences)

func (*UserPreferencesContent) SetTitle

func (cc *UserPreferencesContent) SetTitle(title string)

func (*UserPreferencesContent) SetUpdateTime

func (cc *UserPreferencesContent) SetUpdateTime(uTime time.Time)

func (*UserPreferencesContent) UpsertReferences

func (cc *UserPreferencesContent) UpsertReferences(input ItemReferences)

type UserPreferencess

type UserPreferencess []UserPreferences

func (*UserPreferencess) DeDupe

func (c *UserPreferencess) DeDupe()

func (UserPreferencess) Validate

func (c UserPreferencess) Validate() error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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