Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrInvalidNote is returned when the note is invalid. // This is usually because the note has been destroyed or // does not exist. ErrInvalidNote = errors.New("note is invalid") // ErrEmptyNoteID is returned when the note ID is empty. ErrEmptyNoteID = errors.New("note ID cannot be empty") // ErrInvalidPassword is returned when the password is invalid. ErrInvalidPassword = errors.New("note password is invalid") )
View Source
var Headers = http.Header{
"accept": {"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8"},
"accept-encoding": {""},
"accept-language": {"en-US,en;q=0.5"},
"referer": {"https://privnote.com/"},
"origin": {"https://privnote.com"},
"sec-fetch-dest": {"empty"},
"sec-fetch-mode": {"cors"},
"sec-fetch-site": {"same-origin"},
"user-agent": {"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36"},
"x-requested-with": {"XMLHttpRequest"},
}
Headers are the default headers used by the Privnote client.
View Source
var TLSClientOptions = []tls_client.HttpClientOption{ tls_client.WithTimeoutSeconds(20), tls_client.WithClientProfile(profiles.Chrome_117), tls_client.WithCookieJar(tls_client.NewCookieJar()), tls_client.WithRandomTLSExtensionOrder(), }
TLSClientOptions are the default TLS client options used by the Privnote client.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct { // BaseURL is the base URL for the Privnote API. // Defaults to "https://privnote.com". BaseURL string // HTTPClient is the client used to make HTTP requests to the Privnote API. HTTPClient tls_client.HttpClient }
Client is a Privnote client for creating and opening notes.
func NewClient ¶
func NewClient() *Client
NewClient creates a new Privnote client for creating and opening notes.
func (*Client) CreateNote ¶
func (c *Client) CreateNote(noteData CreateNoteData) (string, error)
CreateNote creates a new note and returns the URL.
func (*Client) ReadNoteFromID ¶
ReadNoteFromID opens and decrypts a note from its ID and password.
type CreateNoteData ¶
type CreateNoteData struct { // Data is the content of the note. Data string // Password is the password for the note. Will be generated if empty. Password string // Duration is the time until the note expires. Defaults to 24 hours. // Maximum duration is 30 days or 720 hours. Duration time.Duration // NoConfirmation determines whether the user should be asked for confirmation // before destroying the note. NoConfirmation bool // NotifyEmail is the email address to notify when the note is read. NotifyEmail string // EmailRefName is a reference name of the note to include in the email. EmailRefName string }
CreateNoteData is the data required for creating a note.
type Note ¶
type Note struct { // Data is the encrypted content of the note. Data string `json:"data"` // HasManualPass is whether the note has a manual password. HasManualPass bool `json:"has_manual_pass"` // NoteLink is the URL of the note. NoteLink string `json:"note_link"` // DontAsk is whether the user should be asked for confirmation before // destroying the note. DontAsk bool `json:"dont_ask"` // Unknown fields Policy int `json:"policy"` ExpiresJS string `json:"expires_js"` }
Note is how a private note is represented in the Privnote API.
func (*Note) UnmarshalJSON ¶
Click to show internal directories.
Click to hide internal directories.