Add a passphrase-locked vault
CI / test (push) Successful in 2m2s
Release / release (push) Successful in 2m52s

A second notebook whose pages are encrypted with a key made from a passphrase plus the server key. It is unlocked into memory only (15 minutes idle, Lock, or sign-out), is not in search, lists or downloads of the ordinary notebook, and limits wrong guesses.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
VeillaxandClaude Sonnet 5.5 committed 2026-11-01 01:40:35 -07:00
1 parent 7ff424fa55
commit c08a8b8718
12 files changed
+706 -28

No files matched your search

+9
View File
@@ -8,8 +8,10 @@ import (
"crypto/aes"
"crypto/cipher"
"crypto/hkdf"
"crypto/pbkdf2"
"crypto/rand"
"crypto/sha256"
"encoding/hex"
"errors"
"fmt"
)
@@ -50,6 +52,13 @@ func New(master, issuer, sub string) (*Cipher, error) {
return &Cipher{aead}, nil
}
// Passphrase stretches a passphrase into key material (hex) with PBKDF2-HMAC-SHA256, which is slow on
// purpose so that guessing passphrases is expensive.
func Passphrase(pass string, salt []byte, iterations int) (string, error) {
k, err := pbkdf2.Key(sha256.New, pass, salt, iterations, 32)
return hex.EncodeToString(k), err
}
// IsSealed says whether data is an encrypted file.
func IsSealed(data []byte) bool { return bytes.HasPrefix(data, magic) }