Skip to content

Commit a0a2d2a

Browse files
committed
refactor: Clean up nonce comments and improve key generation clarity in createSession function
1 parent 9fcdd93 commit a0a2d2a

1 file changed

Lines changed: 1 addition & 3 deletions

File tree

lib/data/node/sessions/create_session.dart

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ Future<bool> createSession(String nodeUrl, String recipientUserId) async {
133133
final hkdf = Hkdf(hmac: Hmac.sha256(), outputLength: 32);
134134
final rootKey = await hkdf.deriveKey(
135135
secretKey: SecretKeyData(combined),
136-
nonce: utf8.encode('HushNet-Salt'), // facultatif mais conseillé
136+
nonce: utf8.encode('HushNet-Salt'),
137137
info: utf8.encode('X3DH Root Key'),
138138
);
139139
final sendChainKey = await hkdf.deriveKey(
@@ -148,13 +148,11 @@ Future<bool> createSession(String nodeUrl, String recipientUserId) async {
148148
info: utf8.encode('HushNet-Recv-Chain'),
149149
);
150150

151-
// 🧩 Génère ton propre ratchet keypair (X25519)
152151
final ratchetAlgo = X25519();
153152
final ratchetPair = await ratchetAlgo.newKeyPair();
154153
final ratchetPub = await ratchetPair.extractPublicKey();
155154
final ratchetPriv = await ratchetPair.extractPrivateKeyBytes();
156155

157-
// 🗄️ Sauvegarde dans SecureStorage
158156
final rootB64 = base64Encode(await rootKey.extractBytes());
159157
final sendB64 = base64Encode(await sendChainKey.extractBytes());
160158
final recvB64 = base64Encode(await recvChainKey.extractBytes());

0 commit comments

Comments
 (0)