You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
433 B
Go
35 lines
433 B
Go
package main
|
|
|
|
import (
|
|
"crypto/rand"
|
|
)
|
|
|
|
type GetNoteRequest int
|
|
|
|
func (g GetNoteRequest) Kind() string {
|
|
return "get-note"
|
|
}
|
|
|
|
type Note struct {
|
|
Title string
|
|
Body []byte
|
|
}
|
|
|
|
type EncryptedNote struct {
|
|
Key []byte
|
|
Body []byte
|
|
}
|
|
|
|
func (n EncryptedNote) Kind() string {
|
|
return "note"
|
|
}
|
|
|
|
func randslice(n int) ([]byte, error) {
|
|
b := make([]byte, n)
|
|
_, err := rand.Read(b)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return b, nil
|
|
}
|