This guide explains how Mau uses PGP for identity, authentication, and encryption.
Mau uses OpenPGP as the foundation for all authentication and encryption. Unlike traditional social networks that use username/password, Mau identifies users by their PGP key fingerprints.
| Concept | Description |
|---|---|
| Public Key | Your identity - shared openly with peers |
| Private Key | Your secret - never leaves your device |
| Fingerprint | Short hash of public key (e.g., A1B2C3D4...) |
| Signature | Proof that content came from a specific key |
| Encryption | Scrambling data so only recipients can read it |
When you first run mau init, a new PGP key pair is generated:
1mau init myaccount
2
3# Creates:
4# - ~/.mau/myaccount/account.pgp (encrypted private key)
5# - Public key extracted automatically
Default Key Type (as of v0.2.0):
Legacy RSA Support:
~/.mau/myaccount/
├── account.pgp # Your encrypted private key
├── <fingerprint>/ # Your content directory
│ └── posts/
│ └── *.json # Your encrypted posts
├── <friend-fpr1>.pgp # Friend's public key
├── <friend-fpr1>/ # Friend's synced content
└── sync_state.json # Last sync timestamps
To share your identity with others:
1# Export in armored (text) format
2mau export-key > my-public-key.asc
3
4# Share this file with friends via:
5# - Email attachment
6# - QR code (for mobile)
7# - Paste into chat
8# - Upload to keyserver
Example Public Key:
-----BEGIN PGP PUBLIC KEY BLOCK-----
mDMEZ0pqXBYJKwYBBAHaRw8BAQdA7f9wNZ0hGz5pqX3...
tCNBbGljZSA8YWxpY2VAbWF1Lm5ldHdvcms+iJAEExYIA...
...
-----END PGP PUBLIC KEY BLOCK-----
1# From file
2mau add-friend alice.asc
3
4# From stdin (paste in terminal)
5mau add-friend
6# (paste key, then Ctrl+D)
7
8# Mau extracts:
9# - Name: "Alice"
10# - Email: "alice@mau.network"
11# - Fingerprint: A1B2C3D4E5F6...
Every post, file, and message in Mau is digitally signed with your private key.
Every file created in Mau is automatically signed and encrypted. This process does not embed a signature field inside the content (e.g., a JSON file). Instead, it wraps the content in a standard OpenPGP message format.
openpgp.Sign and openpgp.Encrypt functions to create a PGP message. This message bundles:
.pgp: The final output is saved as a binary .pgp file.When a peer receives your .pgp file:
.pgp file.This process ensures both confidentiality (encryption) and authenticity (signing) without modifying the original content’s structure.
Mau encrypts all content by default to protect privacy.
This is called hybrid encryption - combines speed of symmetric encryption with security of public-key encryption.
-----BEGIN PGP MESSAGE-----
hQIMA3sK9F8HvF0QAQP+Nk7fz... ← Encrypted for recipient 1
hQIMA7x8qR3pZ2gfAQP9Hw2q... ← Encrypted for recipient 2
...
wV4DuB3Kz8xN2YASA/9JKg... ← Encrypted content
-----END PGP MESSAGE-----
By default, posts are encrypted for:
1// Publishing a post encrypts for self + friends
2client.SavePost("hello.json", post)
3
4// Encrypts for:
5// - Your fingerprint
6// - All friends' fingerprints
When you open a friend’s post:
If you’re not in the recipient list, decryption fails (you can’t read it).
Your friend’s public keys are stored locally:
1~/.mau/myaccount/
2├── <friend-fpr1>.pgp
3├── <friend-fpr2>.pgp
4└── <friend-fpr3>.pgp
When you connect to a new peer:
GET https://peer-ip:port/.mau/<fingerprint>.pgp
The Distributed Hash Table stores peer locations:
Fingerprint → [IP addresses]
When you want to sync with a friend:
Mau uses a web of trust model:
Planned feature: trust friends-of-friends at lower confidence levels
You → Alice (100% trust)
Alice → Bob (100% trust)
You → Bob (50% transitive trust)
If a key is compromised:
1# Generate revocation certificate
2gpg --output revoke.asc --gen-revoke your@email.com
3
4# Import revocation (marks key as invalid)
5gpg --import revoke.asc
6
7# Generate new key
8mau init myaccount-new
Always verify fingerprints through a second channel:
1# Your fingerprint
2mau whoami
3
4# Friend's fingerprint (after importing)
5mau list-friends
6
7# Compare with what friend tells you via:
8# - Phone call
9# - In person
10# - Secure messaging app
11# - QR code scan
Rotate keys periodically (e.g., every 2 years):
Use a strong passphrase for your private key:
1# Good: Long, memorable sentence
2"The quick brown fox jumps over 13 lazy dogs near the river!"
3
4# Bad: Short, common phrase
5"password123"
Passphrase Entropy:
Using the same Mau identity across multiple devices requires securely transferring your private key. Since Mau does not have a built-in sync service for private keys, this must be done manually.
The Recommended Method: Secure Manual Transfer
mau export-account command. This will create an encrypted archive of your private key.
1# on Device A
2mau export-account > my-account-backup.mau
.mau file to your second device using a secure method (e.g., a USB drive, scp, or an end-to-end encrypted messaging service). Do not email it or upload it to an insecure cloud service.1# on Device B
2mau import-account my-account-backup.mau
You will be prompted for the passphrase you used on your primary device. Once complete, both devices will have the same identity. Any content you create on one device will need to be synced to the other via the standard Mau peer-to-peer sync process.
Important Considerations:
gpg, it falls outside the standard Mau workflow.Mau’s security assumes:
Protected Against:
Not Protected Against:
1package main
2
3import (
4 "github.com/mau-network/mau"
5 "log"
6)
7
8func main() {
9 client, _ := mau.NewClient("~/.mau/myaccount")
10
11 // Create post
12 post := map[string]interface{}{
13 "@type": "SocialMediaPosting",
14 "headline": "This will be signed",
15 }
16
17 // Sign and save (signature added automatically)
18 err := client.SavePost("signed-post.json", post)
19 if err != nil {
20 log.Fatal(err)
21 }
22
23 log.Println("Post signed and saved")
24}
1// Load and verify friend's post
2friend := client.GetFriend(fingerprint)
3file, _ := client.ListFiles(friend.Fingerprint(), 1)
4post, err := client.LoadPost(file[0])
5
6if err != nil {
7 log.Fatal("Signature verification failed!")
8}
9
10log.Println("Signature valid - post is authentic")
1// Encrypt for specific friends only
2recipients := []string{
3 "A1B2C3D4E5F6...", // Friend 1 fingerprint
4 "F6E5D4C3B2A1...", // Friend 2 fingerprint
5}
6
7err := client.SavePostForRecipients("private.json", post, recipients)
Q: Can I use my existing GPG key?
A: Yes! Run mau init --import ~/.gnupg/secring.gpg
Q: What if I lose my private key?
A: Your identity is lost. Always keep encrypted backups offline.
Q: Can others fake my identity?
A: Only if they steal your private key + passphrase. Use strong passphrases!
Q: Does Mau use key servers?
A: No. Keys are fetched directly from peers via HTTP.
Q: Are key sizes configurable?
A: Ed25519 is default (fixed size). RSA can be 2048-4096 bits (legacy).
Q: What happens if a friend changes their key?
A: You must re-import their new public key. Old content stays encrypted with old key.
This documentation is for developers building on Mau. For protocol details, see the specification.