Skip to content
Snippets Groups Projects
Commit 5dd3d637 authored by Éloïs's avatar Éloïs
Browse files

[ref] create types PubkeyBox & SigBox

parent 69eb9671
No related branches found
No related tags found
1 merge request!8WIP: WS2P v2
...@@ -150,26 +150,32 @@ Blockstamp : BlockNumber(u32) + BlockHash([u8; 32]). ...@@ -150,26 +150,32 @@ Blockstamp : BlockNumber(u32) + BlockHash([u8; 32]).
| Ed25519 | 0x01 | | Ed25519 | 0x01 |
| Schnorr | 0x02 | | Schnorr | 0x02 |
##### Pubkey ##### PubkeyBox
Signatory's public key Contains the signatory's public key.
| data name | size in bytes | data type | | data | size in bytes | data type |
|:----------------:|--------------:|-------------------:| |:-------:|--------------:|-------------------:|
| pubkey_size | 2 | u16 | | size | 2 | u16 |
| algorithm_id | 1 | algorithm | | algo | 1 | algorithm |
| pubkey_content | pubkey_size | [u8; pubkey_size] | | content | size - 1 | ?* |
size := Size of the whole PubkeyBox (size field excluded).
pubkey_size := field size `pubkey_content` in bytes. _*The type of field `content` depends on the algorithm. In the case of Ed25519, `content` is a 32-byte array containing the public key._
##### Signature ##### SigBox
Contains the cryptographic signature of a document.
| data name | size in bytes | data type | | data name | size in bytes | data type |
|:----------------:|--------------:|----------------:| |:---------:|--------------:|----------------:|
| sig_size | 2 | u16 | | size | 2 | u16 |
| sig_content | sig_size | [u8; sig_size] | | content | sig_size | ?* |
size := Size of the whole SigBox (size field excluded).
sig_size := field size `sig_content` in bytes. _*The type of field `content` depends on the algorithm. In the case of Ed25519, `content` is a 64-byte array containing the signature._
#### Endianness #### Endianness
...@@ -184,13 +190,13 @@ All binary WS2P v2 messages are encapsulated in the following format : ...@@ -184,13 +190,13 @@ All binary WS2P v2 messages are encapsulated in the following format :
| currency_code | 2 | u16 | | currency_code | 2 | u16 |
| ws2p_version | 2 | u16 | | ws2p_version | 2 | u16 |
| issuer_node_id | 4 | u32 | | issuer_node_id | 4 | u32 |
| issuer_pubkey | ? | Pubkey | | issuer_pubkey | ? | PubkeyBox |
| message_type | 2 | specific | | message_type | 2 | specific |
| elements_count | 2 | u16 | | elements_count | 2 | u16 |
| payload_size | 4 | u32 | | payload_size | 4 | u32 |
| payload | payload_size | ?* | | payload | payload_size | ?* |
| message_hash | 32 | [u8; 32] | | message_hash | 32 | [u8; 32] |
| signature | ? | Signature | | signature | ? | SigBox |
_* The type of `payload` is determined by the content of `message_type`._ _* The type of `payload` is determined by the content of `message_type`._
...@@ -348,10 +354,10 @@ Signed document declaring all the endpoints of a peer. ...@@ -348,10 +354,10 @@ Signed document declaring all the endpoints of a peer.
| endpoints_count | 1 | u8 | | endpoints_count | 1 | u8 |
| currency_code | 2 | u16 | | currency_code | 2 | u16 |
| node_id | 4 | u32 | | node_id | 4 | u32 |
| issuer_public_key | 32 | Pubkey | | issuer_public_key | 32 | PubkeyBox |
| blockstamp | 36 | Blockstamp | | blockstamp | 36 | Blockstamp |
| endpoints_datas | calculate* | [(u16, endpoint); endpoints_count] | | endpoints_datas | calculate* | [(u16, endpoint); endpoints_count] |
| signature | 64 | Signature | | signature | 64 | SigBox |
endpoints_datas := table of tuples (endpoint_size, endpoint). endpoints_datas := table of tuples (endpoint_size, endpoint).
...@@ -491,10 +497,10 @@ RES_SYNC_CHUNK := A WS2P Public node that asks to synchronize sends its PeerCard ...@@ -491,10 +497,10 @@ RES_SYNC_CHUNK := A WS2P Public node that asks to synchronize sends its PeerCard
| data name | size in bytes | data type | | data name | size in bytes | data type |
|:-------------:|---------------|-----------| |:-------------:|---------------|-----------|
| challenge_sig | ? | Signature | | challenge_sig | ? | SigBox |
Each node must sign the challenge of the other to prove that it's in possession of the private key corresponding to the public key under which it identifies. Each node must sign the challenge of the other to prove that it's in possession of the private key corresponding to the public key under which it identifies.
challenge_sig := Signature of the challenge given by the other node. challenge_sig := SigBox of the challenge given by the other node.
### FLAGS message ### FLAGS message
...@@ -502,8 +508,8 @@ challenge_sig := Signature of the challenge given by the other node. ...@@ -502,8 +508,8 @@ challenge_sig := Signature of the challenge given by the other node.
|:-------------:|---------------|-----------------| |:-------------:|---------------|-----------------|
| flags_size | 1 | u8 | | flags_size | 1 | u8 |
| flags | flags_size | WS2PSecretFlags | | flags | flags_size | WS2PSecretFlags |
| member_proof | ? | Signature | | member_proof | ? | SigBox |
| member_pubkey | ? | Pubkey | | member_pubkey | ? | PubkeyBox |
#### WS2PSecretFlags type definition #### WS2PSecretFlags type definition
...@@ -525,7 +531,7 @@ If this boolean is true, the "member_proof" must contain a signature must sign t ...@@ -525,7 +531,7 @@ If this boolean is true, the "member_proof" must contain a signature must sign t
| flags | 2 | b16 | | flags | 2 | b16 |
| prefix | 2 | u16 | | prefix | 2 | u16 |
| issuer_node_id | 4 | u32 | | issuer_node_id | 4 | u32 |
| m_pubkey | 32 | Pubkey | | m_pubkey | 32 | PubkeyBox |
| challenge* | 32 | [u8; 32] | | challenge* | 32 | [u8; 32] |
_*This is the remote challenge for the signatory, and the local challenge for the verifier._ _*This is the remote challenge for the signatory, and the local challenge for the verifier._
...@@ -664,7 +670,7 @@ CompactPoolIntCert type description : ...@@ -664,7 +670,7 @@ CompactPoolIntCert type description :
| issuer* | 4 | u32 | | issuer* | 4 | u32 |
| target* | 4 | u32 | | target* | 4 | u32 |
| blockstamp | 36 | Blockstamp | | blockstamp | 36 | Blockstamp |
| signature | ? | Signature | | signature | ? | SigBox |
_*Durs assigns a unique integer to each member according to the order in which the identities are declared in the blocks, so it's guaranteed that all Durs nodes will always assign the same integer to any given member._ _*Durs assigns a unique integer to each member according to the order in which the identities are declared in the blocks, so it's guaranteed that all Durs nodes will always assign the same integer to any given member._
...@@ -688,7 +694,7 @@ IdentityDocument type description : ...@@ -688,7 +694,7 @@ IdentityDocument type description :
| uid | uid_size | utf8 | | uid | uid_size | utf8 |
| blockstamp | 36 | Blockstamp | | blockstamp | 36 | Blockstamp |
| pubkey | 32 | [u8;32] | | pubkey | 32 | [u8;32] |
| signature | ? | Signature | | signature | ? | SigBox |
uid_size := `uid` field size in bytes. uid_size := `uid` field size in bytes.
...@@ -697,7 +703,7 @@ CompactPoolMembership type description : ...@@ -697,7 +703,7 @@ CompactPoolMembership type description :
| data name | size in bytes | data type | | data name | size in bytes | data type |
|:-------------:|---------------|---------------------| |:-------------:|---------------|---------------------|
| blockstamp | 36 | Blockstamp | | blockstamp | 36 | Blockstamp |
| signature | ? | Signature | | signature | ? | SigBox |
CompactPoolExtCert type description : CompactPoolExtCert type description :
...@@ -705,7 +711,7 @@ CompactPoolExtCert type description : ...@@ -705,7 +711,7 @@ CompactPoolExtCert type description :
|:-----------------:|---------------|---------------------| |:-----------------:|---------------|---------------------|
| issuer | 4 | u32 | | issuer | 4 | u32 |
| blockstamp | 36 | Blockstamp | | blockstamp | 36 | Blockstamp |
| signature | ? | Signature | | signature | ? | SigBox |
### HEADS v2 ### HEADS v2
...@@ -727,11 +733,11 @@ CompactPoolExtCert type description : ...@@ -727,11 +733,11 @@ CompactPoolExtCert type description :
| free_mirror_rooms | 1 | u8 | | free_mirror_rooms | 1 | u8 |
| low_priority_rooms | 1 | u8 | | low_priority_rooms | 1 | u8 |
| node_id | 4 | u32 | | node_id | 4 | u32 |
| pubkey | ? | Pubkey | | pubkey | ? | PubkeyBox |
| blockstamp | 36 | Blockstamp | | blockstamp | 36 | Blockstamp |
| software_name | software_size | utf8 | | software_name | software_size | utf8 |
| soft_version | soft_version_size | utf8 | | soft_version | soft_version_size | utf8 |
| signature | ? | Signature | | signature | ? | SigBox |
head_size := Total size of object `HEADv3` in bytes. head_size := Total size of object `HEADv3` in bytes.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment