Skip to content

Commit 4b00256

Browse files
committed
docs: WIP PROTOCOL.md
1 parent cad0e8d commit 4b00256

File tree

1 file changed

+164
-0
lines changed

1 file changed

+164
-0
lines changed

PROTOCOL.md

Lines changed: 164 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,164 @@
1+
COLDWIRE PROTOCOL
2+
3+
Version: Draft 1.0 (Work in Progress)
4+
Author: ChadSec (Freedom Club)
5+
6+
INTRODUCTION
7+
8+
ColdWire is a post-quantum secure communication protocol focused on:
9+
10+
Minimal metadata leakage
11+
12+
Server as a dumb relay (no trust in server)
13+
14+
Per-contact cryptographic verification
15+
16+
No persistent contact lists or user directories on the server
17+
18+
No concept of friend requests server-side
19+
20+
Server only relays encrypted messages between clients, deleting data after delivery.
21+
22+
CRYPTOGRAPHIC PRIMITIVES
23+
24+
Authentication:
25+
26+
Long-term Identity Key: ML-DSA-87 (Dilithium5) signature key pair
27+
28+
Per-contact Verification Keys: ML-DSA-87 key pair generated for each contact
29+
30+
Identity Verification: Socialist Millionaire Problem (SMP) variant
31+
32+
Key Derivation & Proofs:
33+
34+
Hash: SHA3-512
35+
36+
Password-based KDF: Argon2id
37+
38+
MAC: HMAC-SHA3-512
39+
40+
AUTHENTICATION FLOW
41+
42+
Identity Key Generation
43+
44+
Client generates ML-DSA-87 key pair locally.
45+
46+
Public key and user ID used for authentication; private key stored securely on disk.
47+
48+
Registration / Login
49+
50+
Client sends POST /authentication/init with public key (and user_id if re-authenticating).
51+
52+
Server responds with a base64-encoded random challenge.
53+
54+
Client decodes challenge, signs it with Dilithium private key.
55+
56+
Client sends signature to POST /authentication/verify.
57+
58+
Server verifies signature:
59+
60+
If valid & key exists: returns JSON Web Token (JWT) with existing user_id.
61+
62+
If valid & key new: generates new 16-byte random numeric user_id, returns JWT.
63+
64+
Client must include JWT in Authorization header for all subsequent requests.
65+
66+
TERMS
67+
68+
Alice: User initiating verification (User 1)
69+
70+
Bob: Contact being verified (User 2)
71+
72+
Client: The Coldwire client software (context-dependent, could refer to user or app)
73+
74+
User: The human end-user (not the software)
75+
76+
CONTACT VERIFICATION (SMP VARIANT)
77+
78+
ColdWire uses a human-language variant of Socialist Millionaire Problem (SMP) to verify per-contact keys.
79+
Server does not store any contact relationships; all verification state is local to the clients.
80+
81+
Assumptions:
82+
83+
Alice wants to add Bob as a contact and verify authenticity of Bob's per-contact key.
84+
85+
5.1 SMP INITIATION (Alice → Bob)
86+
87+
Alice generates per-contact ML-DSA-87 key pair (PK_A, SK_A). Stores SK_A locally.
88+
89+
Alice composes human-language question & normalized answer.
90+
91+
Alice sends:
92+
93+
POST /smp/initiate
94+
{
95+
"question" : "What cafe did we meet at last time?",
96+
"nonce" : base64(32 random bytes) # rA
97+
"public_key" : base64(PK_A)
98+
"recipient_id": Bob's user_id
99+
}
100+
101+
5.2 SMP STEP 2 (Bob → Alice)
102+
103+
Bob generates per-contact ML-DSA-87 key pair (PK_B, SK_B).
104+
105+
Bob reads question, inputs answer.
106+
107+
Computes shared secret:
108+
109+
fpA = sha3_512(PK_A)
110+
rA = Alice's nonce (decoded from base64)
111+
rB = random_bytes(32)
112+
secret = normalize(answer)
113+
secret = argon2id(secret, sha3_512(rA + rB))
114+
message = rA + rB + fpA
115+
proof_1 = HMAC(secret, message, sha3_512)
116+
117+
Bob sends:
118+
119+
POST /smp/step_2
120+
{
121+
"proof" : hex(proof_1),
122+
"nonce" : base64(rB),
123+
"public_key" : base64(PK_B),
124+
"recipient_id": Alice's user_id
125+
}
126+
127+
5.3 SMP STEP 3 (Alice → Bob)
128+
129+
Alice computes expected proof_1 from Bob and verifies.
130+
131+
If valid, computes proof for Bob's key:
132+
133+
fpB = sha3_512(PK_B)
134+
message = rB + rA + fpB
135+
proof_2 = HMAC(secret, message, sha3_512)
136+
137+
Alice sends:
138+
139+
POST /smp/step_3
140+
{
141+
"proof" : hex(proof_2),
142+
"recipient_id": Bob's user_id
143+
}
144+
145+
5.4 SMP COMPLETION (Bob verifies Alice)
146+
147+
Bob computes expected proof_2 and verifies.
148+
149+
If valid: mutual key verification established.
150+
151+
Both clients mark contact as verified locally.
152+
153+
SECURITY NOTES
154+
155+
Per-contact keypairs ensure compartmentalization of trust.
156+
157+
Verification security depends on entropy of shared answer.
158+
159+
SMP interaction must occur within short timeframe to avoid brute-force feasibility.
160+
161+
Server remains unaware of trust relationships; verification is end-to-end.
162+
163+
164+

0 commit comments

Comments
 (0)