Update sequence diagrams

- Use PlantUML
- Update README
This commit is contained in:
wpetit 2020-01-06 11:07:33 +01:00
parent e6643cba6b
commit 3c44e82b65
14 changed files with 56 additions and 121 deletions

3
.gitignore vendored
View File

@ -2,4 +2,5 @@
/vendor
/bin
/testdata
/release
/release
/out

View File

@ -8,17 +8,15 @@ Librairie implémentant un protocole d'authentification par "appairage" d'un ser
### Annonce du client
![advertise](./doc/sequence-diagram/advertise.svg)
![advertise](./doc/sequence-diagram/advertise.png)
### Mise à jour des attributs
![update](./doc/sequence-diagram/update.svg)
![update](./doc/sequence-diagram/update.png)
### Ping
![ping](./doc/sequence-diagram/ping.svg)
**Statut** Instable
![ping](./doc/sequence-diagram/ping.png)
## Licence

View File

@ -0,0 +1,15 @@
@startuml
Client -> Server: POST /advertise\nX-Server-Token: <JWT_TOKEN>\n\n{"Attributes": <PEER_ATTRIBUTES>, "PublicKey": <PUBLIC_KEY> }
Server -> Server: Validate server token
alt Success
Server -> Server: Create peer with public key and attributes
Server -> Server: Update last contact for peer ID
Server -> Client: 201 Created
else Invalid server token
Server -> Client: 401 Unauthorized
else Malformed advertising request
Server -> Client: 400 Bad request
else Unexpected error
Server -> Client: 500 Server error
end
@enduml

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

View File

@ -1,2 +0,0 @@
Client -> Server: POST /advertise\nX-Server-Token: <JWT_TOKEN>\n\n{"Attributes": <PEER_ATTRIBUTES>, "PublicKey": <PUBLIC_KEY> }
Server -> Client: 201 Created

View File

@ -1,36 +0,0 @@
<?xml version="1.0"?>
<!-- Generated by SVGo -->
<svg width="589" height="212"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink">
<defs>
<style>
@font-face {
font-family: 'DejaVuSans';
src: url('https://fontlibrary.org/assets/fonts/dejavu-sans/f5ec8426554a3a67ebcdd39f9c3fee83/49c0f03ec2fa354df7002bcb6331e106/DejaVuSansBook.ttf') format('truetype');
font-weight: normal;
font-style: normal;
}
</style>
</defs>
<line x1="45" y1="24" x2="45" y2="188" style="stroke-dasharray:8,8;stroke-width:2px;stroke:black;" />
<rect x="8" y="8" width="75" height="32" style="fill:white;stroke-width:2px;stroke:black;" />
<text x="24" y="29" style="fill:black;font-family:DejaVuSans,sans-serif;font-size:16px;" >Client</text>
<rect x="8" y="172" width="75" height="32" style="fill:white;stroke-width:2px;stroke:black;" />
<text x="24" y="193" style="fill:black;font-family:DejaVuSans,sans-serif;font-size:16px;" >Client</text>
<line x1="539" y1="24" x2="539" y2="188" style="stroke-dasharray:8,8;stroke-width:2px;stroke:black;" />
<rect x="497" y="8" width="84" height="32" style="fill:white;stroke-width:2px;stroke:black;" />
<text x="513" y="29" style="fill:black;font-family:DejaVuSans,sans-serif;font-size:16px;" >Server</text>
<rect x="497" y="172" width="84" height="32" style="fill:white;stroke-width:2px;stroke:black;" />
<text x="513" y="193" style="fill:black;font-family:DejaVuSans,sans-serif;font-size:16px;" >Server</text>
<rect x="61" y="56" width="462" height="62" style="fill:white;stroke:white;" />
<text x="237" y="68" style="font-family:DejaVuSans,sans-serif;font-size:14px;" >POST /advertise</text>
<text x="184" y="84" style="font-family:DejaVuSans,sans-serif;font-size:14px;" >X-Server-Token: &lt;JWT_TOKEN&gt;</text>
<text x="61" y="116" style="font-family:DejaVuSans,sans-serif;font-size:14px;" >{&#34;Attributes&#34;: &lt;PEER_ATTRIBUTES&gt;, &#34;PublicKey&#34;: &lt;PUBLIC_KEY&gt; }</text>
<line x1="45" y1="122" x2="539" y2="122" style="stroke:black;stroke-width:2px;" />
<polyline points="530,117 539,122 530,127" style="fill:black;stroke-width:2px;stroke:black;" />
<rect x="249" y="138" width="87" height="14" style="fill:white;stroke:white;" />
<text x="249" y="150" style="font-family:DejaVuSans,sans-serif;font-size:14px;" >201 Created</text>
<line x1="539" y1="156" x2="45" y2="156" style="stroke:black;stroke-width:2px;" />
<polyline points="54,151 45,156 54,161" style="fill:black;stroke-width:2px;stroke:black;" />
</svg>

Before

Width:  |  Height:  |  Size: 2.4 KiB

View File

@ -0,0 +1,17 @@
@startuml
Client -> Server: POST /ping\nX-Server-Token: <JWT_TOKEN>\nX-Client-Token: <JWT_TOKEN>
Server -> Server: Validate client/server tokens
alt Success
Server -> Server: Update last contact for peer ID
Server -> Client: 204 No Content
else Invalid client or server token
Server -> Client: 400 Bad request
else Peer not found
Server -> Client: 401 Unauthorized
else Peer rejected
Server -> Client: 403 Forbidden
else Unexpected error
Server -> Client: 500 Server error
end
@enduml

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

View File

@ -1,2 +0,0 @@
Client -> Server: POST /ping\nX-Server-Token: <JWT_TOKEN>\nX-Client-Token: <JWT_TOKEN>
Server -> Client: 204 No Content

View File

@ -1,36 +0,0 @@
<?xml version="1.0"?>
<!-- Generated by SVGo -->
<svg width="343" height="196"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink">
<defs>
<style>
@font-face {
font-family: 'DejaVuSans';
src: url('https://fontlibrary.org/assets/fonts/dejavu-sans/f5ec8426554a3a67ebcdd39f9c3fee83/49c0f03ec2fa354df7002bcb6331e106/DejaVuSansBook.ttf') format('truetype');
font-weight: normal;
font-style: normal;
}
</style>
</defs>
<line x1="45" y1="24" x2="45" y2="172" style="stroke-dasharray:8,8;stroke-width:2px;stroke:black;" />
<rect x="8" y="8" width="75" height="32" style="fill:white;stroke-width:2px;stroke:black;" />
<text x="24" y="29" style="fill:black;font-family:DejaVuSans,sans-serif;font-size:16px;" >Client</text>
<rect x="8" y="156" width="75" height="32" style="fill:white;stroke-width:2px;stroke:black;" />
<text x="24" y="177" style="fill:black;font-family:DejaVuSans,sans-serif;font-size:16px;" >Client</text>
<line x1="293" y1="24" x2="293" y2="172" style="stroke-dasharray:8,8;stroke-width:2px;stroke:black;" />
<rect x="251" y="8" width="84" height="32" style="fill:white;stroke-width:2px;stroke:black;" />
<text x="267" y="29" style="fill:black;font-family:DejaVuSans,sans-serif;font-size:16px;" >Server</text>
<rect x="251" y="156" width="84" height="32" style="fill:white;stroke-width:2px;stroke:black;" />
<text x="267" y="177" style="fill:black;font-family:DejaVuSans,sans-serif;font-size:16px;" >Server</text>
<rect x="61" y="56" width="216" height="46" style="fill:white;stroke:white;" />
<text x="130" y="68" style="font-family:DejaVuSans,sans-serif;font-size:14px;" >POST /ping</text>
<text x="61" y="84" style="font-family:DejaVuSans,sans-serif;font-size:14px;" >X-Server-Token: &lt;JWT_TOKEN&gt;</text>
<text x="63" y="100" style="font-family:DejaVuSans,sans-serif;font-size:14px;" >X-Client-Token: &lt;JWT_TOKEN&gt;</text>
<line x1="45" y1="106" x2="293" y2="106" style="stroke:black;stroke-width:2px;" />
<polyline points="284,101 293,106 284,111" style="fill:black;stroke-width:2px;stroke:black;" />
<rect x="114" y="122" width="111" height="14" style="fill:white;stroke:white;" />
<text x="114" y="134" style="font-family:DejaVuSans,sans-serif;font-size:14px;" >204 No Content</text>
<line x1="293" y1="140" x2="45" y2="140" style="stroke:black;stroke-width:2px;" />
<polyline points="54,135 45,140 54,145" style="fill:black;stroke-width:2px;stroke:black;" />
</svg>

Before

Width:  |  Height:  |  Size: 2.4 KiB

View File

@ -0,0 +1,19 @@
@startuml
Client -> Server: POST /update\nX-Server-Token: <JWT_TOKEN>\nX-Client-Token: <JWT_TOKEN>\n\n{"Attributes": <PEER_ATTRIBUTES>}
Server -> Server: Validate client/server tokens
alt Success
Server -> Server: Save attributes
Server -> Server: Update last contact for peer ID
Server -> Client: 204 No Content
else Invalid client or server token
Server -> Client: 400 Bad request
else Malformed update request
Server -> Client: 400 Bad request
else Peer not found
Server -> Client: 401 Unauthorized
else Peer rejected
Server -> Client: 403 Forbidden
else Unexpected error
Server -> Client: 500 Server error
end
@enduml

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

View File

@ -1,2 +0,0 @@
Client -> Server: POST /update\nX-Server-Token: <JWT_TOKEN>\nX-Client-Token: <JWT_TOKEN>\n\n{"Attributes": <PEER_ATTRIBUTES>}
Server -> Client: 204 No Content

View File

@ -1,37 +0,0 @@
<?xml version="1.0"?>
<!-- Generated by SVGo -->
<svg width="386" height="228"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink">
<defs>
<style>
@font-face {
font-family: 'DejaVuSans';
src: url('https://fontlibrary.org/assets/fonts/dejavu-sans/f5ec8426554a3a67ebcdd39f9c3fee83/49c0f03ec2fa354df7002bcb6331e106/DejaVuSansBook.ttf') format('truetype');
font-weight: normal;
font-style: normal;
}
</style>
</defs>
<line x1="45" y1="24" x2="45" y2="204" style="stroke-dasharray:8,8;stroke-width:2px;stroke:black;" />
<rect x="8" y="8" width="75" height="32" style="fill:white;stroke-width:2px;stroke:black;" />
<text x="24" y="29" style="fill:black;font-family:DejaVuSans,sans-serif;font-size:16px;" >Client</text>
<rect x="8" y="188" width="75" height="32" style="fill:white;stroke-width:2px;stroke:black;" />
<text x="24" y="209" style="fill:black;font-family:DejaVuSans,sans-serif;font-size:16px;" >Client</text>
<line x1="336" y1="24" x2="336" y2="204" style="stroke-dasharray:8,8;stroke-width:2px;stroke:black;" />
<rect x="294" y="8" width="84" height="32" style="fill:white;stroke-width:2px;stroke:black;" />
<text x="310" y="29" style="fill:black;font-family:DejaVuSans,sans-serif;font-size:16px;" >Server</text>
<rect x="294" y="188" width="84" height="32" style="fill:white;stroke-width:2px;stroke:black;" />
<text x="310" y="209" style="fill:black;font-family:DejaVuSans,sans-serif;font-size:16px;" >Server</text>
<rect x="61" y="56" width="259" height="78" style="fill:white;stroke:white;" />
<text x="142" y="68" style="font-family:DejaVuSans,sans-serif;font-size:14px;" >POST /update</text>
<text x="82" y="84" style="font-family:DejaVuSans,sans-serif;font-size:14px;" >X-Server-Token: &lt;JWT_TOKEN&gt;</text>
<text x="84" y="100" style="font-family:DejaVuSans,sans-serif;font-size:14px;" >X-Client-Token: &lt;JWT_TOKEN&gt;</text>
<text x="61" y="132" style="font-family:DejaVuSans,sans-serif;font-size:14px;" >{&#34;Attributes&#34;: &lt;PEER_ATTRIBUTES&gt;}</text>
<line x1="45" y1="138" x2="336" y2="138" style="stroke:black;stroke-width:2px;" />
<polyline points="327,133 336,138 327,143" style="fill:black;stroke-width:2px;stroke:black;" />
<rect x="136" y="154" width="111" height="14" style="fill:white;stroke:white;" />
<text x="136" y="166" style="font-family:DejaVuSans,sans-serif;font-size:14px;" >204 No Content</text>
<line x1="336" y1="172" x2="45" y2="172" style="stroke:black;stroke-width:2px;" />
<polyline points="54,167 45,172 54,177" style="fill:black;stroke-width:2px;stroke:black;" />
</svg>

Before

Width:  |  Height:  |  Size: 2.5 KiB