Commit 5dd3d637 authored by Éloïs's avatar Éloïs

[ref] create types PubkeyBox & SigBox

parent 69eb9671
......@@ -150,26 +150,32 @@ Blockstamp : BlockNumber(u32) + BlockHash([u8; 32]).
| Ed25519 | 0x01 |
| Schnorr | 0x02 |
##### Pubkey
##### PubkeyBox
Signatory's public key
Contains the signatory's public key.
| data name | size in bytes | data type |
|:----------------:|--------------:|-------------------:|
| pubkey_size | 2 | u16 |
| algorithm_id | 1 | algorithm |
| pubkey_content | pubkey_size | [u8; pubkey_size] |
| data | size in bytes | data type |
|:-------:|--------------:|-------------------:|
| size | 2 | u16 |
| algo | 1 | algorithm |
| content | size - 1 | ?* |
pubkey_size := field size `pubkey_content` in bytes.
size := Size of the whole PubkeyBox (size field excluded).
##### Signature
_*The type of field `content` depends on the algorithm. In the case of Ed25519, `content` is a 32-byte array containing the public key._
| data name | size in bytes | data type |
|:----------------:|--------------:|----------------:|
| sig_size | 2 | u16 |
| sig_content | sig_size | [u8; sig_size] |
##### SigBox
sig_size := field size `sig_content` in bytes.
Contains the cryptographic signature of a document.
| data name | size in bytes | data type |
|:---------:|--------------:|----------------:|
| size | 2 | u16 |
| content | sig_size | ?* |
size := Size of the whole SigBox (size field excluded).
_*The type of field `content` depends on the algorithm. In the case of Ed25519, `content` is a 64-byte array containing the signature._
#### Endianness
......@@ -184,13 +190,13 @@ All binary WS2P v2 messages are encapsulated in the following format :
| currency_code | 2 | u16 |
| ws2p_version | 2 | u16 |
| issuer_node_id | 4 | u32 |
| issuer_pubkey | ? | Pubkey |
| issuer_pubkey | ? | PubkeyBox |
| message_type | 2 | specific |
| elements_count | 2 | u16 |
| payload_size | 4 | u32 |
| payload | payload_size | ?* |
| message_hash | 32 | [u8; 32] |
| signature | ? | Signature |
| signature | ? | SigBox |
_* 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.
| endpoints_count | 1 | u8 |
| currency_code | 2 | u16 |
| node_id | 4 | u32 |
| issuer_public_key | 32 | Pubkey |
| issuer_public_key | 32 | PubkeyBox |
| blockstamp | 36 | Blockstamp |
| endpoints_datas | calculate* | [(u16, endpoint); endpoints_count] |
| signature | 64 | Signature |
| signature | 64 | SigBox |
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
| 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.
challenge_sig := Signature of the challenge given by the other node.
challenge_sig := SigBox of the challenge given by the other node.
### FLAGS message
......@@ -502,8 +508,8 @@ challenge_sig := Signature of the challenge given by the other node.
|:-------------:|---------------|-----------------|
| flags_size | 1 | u8 |
| flags | flags_size | WS2PSecretFlags |
| member_proof | ? | Signature |
| member_pubkey | ? | Pubkey |
| member_proof | ? | SigBox |
| member_pubkey | ? | PubkeyBox |
#### WS2PSecretFlags type definition
......@@ -525,7 +531,7 @@ If this boolean is true, the "member_proof" must contain a signature must sign t
| flags | 2 | b16 |
| prefix | 2 | u16 |
| issuer_node_id | 4 | u32 |
| m_pubkey | 32 | Pubkey |
| m_pubkey | 32 | PubkeyBox |
| challenge* | 32 | [u8; 32] |
_*This is the remote challenge for the signatory, and the local challenge for the verifier._
......@@ -664,7 +670,7 @@ CompactPoolIntCert type description :
| issuer* | 4 | u32 |
| target* | 4 | u32 |
| 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._
......@@ -688,7 +694,7 @@ IdentityDocument type description :
| uid | uid_size | utf8 |
| blockstamp | 36 | Blockstamp |
| pubkey | 32 | [u8;32] |
| signature | ? | Signature |
| signature | ? | SigBox |
uid_size := `uid` field size in bytes.
......@@ -697,7 +703,7 @@ CompactPoolMembership type description :
| data name | size in bytes | data type |
|:-------------:|---------------|---------------------|
| blockstamp | 36 | Blockstamp |
| signature | ? | Signature |
| signature | ? | SigBox |
CompactPoolExtCert type description :
......@@ -705,7 +711,7 @@ CompactPoolExtCert type description :
|:-----------------:|---------------|---------------------|
| issuer | 4 | u32 |
| blockstamp | 36 | Blockstamp |
| signature | ? | Signature |
| signature | ? | SigBox |
### HEADS v2
......@@ -727,11 +733,11 @@ CompactPoolExtCert type description :
| free_mirror_rooms | 1 | u8 |
| low_priority_rooms | 1 | u8 |
| node_id | 4 | u32 |
| pubkey | ? | Pubkey |
| pubkey | ? | PubkeyBox |
| blockstamp | 36 | Blockstamp |
| software_name | software_size | utf8 |
| soft_version | soft_version_size | utf8 |
| signature | ? | Signature |
| signature | ? | SigBox |
head_size := Total size of object `HEADv3` in bytes.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment