tornote

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

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

Go to latest
Published: Mar 24, 2021 License: AGPL-3.0 Imports: 12 Imported by: 0

README

Tornote

Build Status Test Status Docker Image Go Doc

Self-destructing notes written on Go with Stanford JS Crypto Library for client-side encryption/decryption.

Latest stable version deployed on https://tornote.herokuapp.com/

Security aspects

  • AES-256 encryption used with 27 bytes secret key (randomly generated on client).

  • All private data including secret not leaving a web-browser without encryption.

  • Server stored only anonymous encrypted data (without any reference to author or reader).

  • Note decrypted on the client-side via the SJCL and immediately deleted on server after reading.

If you have ideas to improve the our safety/security so far as possible please post the issue.

Settings

Configuration settings can be set with .env file or environment.

DATABASE_URL - Data source name (DSN) for PostgreSQL database.

SECRET_KEY - Server secret used for CSRF protection.

HTTPS_ONLY - HTTPS only traffic allowed (disabled by default).

Getting started

Deploy to Heroku cloud:

Deploy to Heroku

Build and run locally with Docker:

git clone https://github.com/osminogin/tornote
docker build -t tornote .
docker run -p 8000:8000 -e DATABASE_URL=... -e SECRET_KEY=... tornote

ChangeLog

CHANGELOG.md

License

See COPYING

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateNoteHandler

func CreateNoteHandler(s *Server) http.Handler

CreateNoteHandler save secret note to persistent datastore and return note ID.

func HealthStatusHandler

func HealthStatusHandler(w http.ResponseWriter, r *http.Request)

Return status for health checks.

func MainFormHandler

func MainFormHandler(s *Server) http.Handler

MainFormHandler renders main form.

func PublicFileHandler

func PublicFileHandler(w http.ResponseWriter, r *http.Request)

PublicFileHandler get file from bindata or return not found error.

func ReadNoteHandler

func ReadNoteHandler(s *Server) http.Handler

ReadNoteHandler print encrypted data for client-side decrypt and destroy note.

func ReadRawNoteHandler

func ReadRawNoteHandler(s *Server) http.Handler

ReadRawNoteHandler print encrypted data for client-side decrypt and destroy note.

func RedirectToHTTPSMiddleware

func RedirectToHTTPSMiddleware(next http.Handler) http.Handler

Types

type Note

type Note struct {
	UUID uuid.UUID `json:"-" pg:",pk,type:uuid"`
	Data []byte    `json:"data"`
}

func (*Note) String

func (n *Note) String() string

type Server

type Server struct {
	// contains filtered or unexported fields
}

func NewServer

func NewServer(opts ServerOpts) *Server

Constructor for new Server.

func (*Server) Init

func (s *Server) Init()

Initialize server.

func (*Server) Listen

func (s *Server) Listen() error

Listen server on specified port with opened database connection.

type ServerOpts

type ServerOpts struct {
	// Listen port
	Port uint64
	// Data source name
	DSN string
	// HTTPS only traffic allowed
	HTTPSOnly bool
	// Server Secret key
	Secret string
}

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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