-
Notifications
You must be signed in to change notification settings - Fork 26
/
doc.go
56 lines (56 loc) · 2.43 KB
/
doc.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
// Package handshake implements a capability-based handshake.
//
// Handshake Sequence Diagram:
// ---------------------------
// Handshake vastely inspired by Scuttlebutt's Capability-based Handshake
// https://scuttlebot.io/more/protocols/shs.pdf
//
// - a, b are ephemeral key pairs generated by respectively Requester and
// Responder. Ephemeral keys are used for one handshake only and then
// discarded. They guarantee the freshness of the messages and avoid
// replay attacks.
// - A, B are the Account IDs of respectively Requester and Responder.
// - a.b denotes a secret derived from the two keys a and b.
// - | is the concatenation operator.
// - box[a.b](content) denotes the encryption of content using Nacl box
// with a.b as key.
// - sig[A](content) denotes the signature of content verified by A.
//
//
// +-----------+ +-----------+
// | Requester | | Responder |
// +-----------+ +-----------+
// | ---------------------\ |
// |-| 1. Requester Hello | |
// | |--------------------| |
// | |
// | a |
// |---------------------------------->|
// | ---------------------\ |
// | | 2. Responder Hello |-|
// | |--------------------| |
// | |
// | b |
// |<----------------------------------|
// | ----------------------------\ |
// |-| 3. Requester Authenticate | |
// | |---------------------------| |
// | |
// | box[a.b|a.B](A,sig[A](a.b)) |
// |---------------------------------->|
// | ----------------------\ |
// | | 4. Responder Accept |-|
// | |---------------------| |
// | |
// | box[a.b|A.B](sig[B](a.b)) |
// |<----------------------------------|
// | ---------------------------\ |
// |-| 5. Requester Acknowledge | |
// | |--------------------------| |
// | |
// | ok |
// |---------------------------------->|
// | |
//
// See the documentation at https://berty.tech/protocol for more information.
package handshake