From 4c03646567eec97016ee08426bad7adfb593e288 Mon Sep 17 00:00:00 2001 From: Tony Garnock-Jones Date: Tue, 13 Dec 2022 18:08:34 +1300 Subject: [PATCH 1/7] HTTP --- schemas/http.prs | 51 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 schemas/http.prs diff --git a/schemas/http.prs b/schemas/http.prs new file mode 100644 index 0000000..a9069bc --- /dev/null +++ b/schemas/http.prs @@ -0,0 +1,51 @@ +version 1 . + +; Assertion in driver DS +; Causes creation of server and route +HttpBinding = . + +; Assertion in driver DS +; Describes active server and route +HttpService = . + +; Assertion in driver DS +; Describes active listener +HttpListener = . + +HostPattern = @host string / @any #f . +PathPattern = [PathPatternElement ...] . +PathPatternElement = @label string / @wildcard =_ / @rest =... . + +MethodPattern = @any #f / @specific @"Lowercase" symbol . + +; Assertion in driver DS +HttpRequest = . + +Headers = {@"Lowercase" symbol: string ...:...} . +QueryValue = @string string / . +RequestBody = @present bytes / @absent #f . + +; Assertion to handler entity +HttpContext = . + +@ +; Messages +HttpResponse = +/ +/
+/ +/ +. + +Chunk = @string string / @bytes bytes . + +; e.g. text/plain, text/html, application/json +MimeType = symbol . From aae53b5525a9b7d452577fd91e4bda06106db98c Mon Sep 17 00:00:00 2001 From: Tony Garnock-Jones Date: Mon, 16 Jan 2023 15:51:57 +0100 Subject: [PATCH 2/7] Update precompiled form --- schema-bundle.bin | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/schema-bundle.bin b/schema-bundle.bin index 0f38f12..69d1e4b 100644 --- a/schema-bundle.bin +++ b/schema-bundle.bin @@ -1,5 +1,10 @@ ´³bundle·µ³tcp„´³schema·³version‘³ definitions·³TcpLocal´³rec´³lit³ tcp-local„´³tupleµ´³named³host´³atom³String„„´³named³port´³atom³ SignedInteger„„„„„³ TcpRemote´³rec´³lit³ -tcp-remote„´³tupleµ´³named³host´³atom³String„„´³named³port´³atom³ SignedInteger„„„„„³ TcpPeerInfo´³rec´³lit³tcp-peer„´³tupleµ´³named³handle´³embedded³any„„´³named³local´³refµ„³TcpLocal„„´³named³remote´³refµ„³ TcpRemote„„„„„„³ embeddedType´³refµ³ EntityRef„³Cap„„„µ³timer„´³schema·³version‘³ definitions·³SetTimer´³rec´³lit³ set-timer„´³tupleµ´³named³label³any„´³named³msecs´³atom³Double„„´³named³kind´³refµ„³ TimerKind„„„„„³ LaterThan´³rec´³lit³ +tcp-remote„´³tupleµ´³named³host´³atom³String„„´³named³port´³atom³ SignedInteger„„„„„³ TcpPeerInfo´³rec´³lit³tcp-peer„´³tupleµ´³named³handle´³embedded³any„„´³named³local´³refµ„³TcpLocal„„´³named³remote´³refµ„³ TcpRemote„„„„„„³ embeddedType´³refµ³ EntityRef„³Cap„„„µ³http„´³schema·³version‘³ definitions·³Chunk´³orµµ±string´³atom³String„„µ±bytes´³atom³ +ByteString„„„„³Headers´³dictof´³atom³Symbol„´³atom³String„„³MimeType´³atom³Symbol„³ +QueryValue´³orµµ±string´³atom³String„„µ±file´³rec´³lit³file„´³tupleµ´³named³filename´³atom³String„„´³named³headers´³refµ„³Headers„„´³named³body´³atom³ +ByteString„„„„„„„„³ HostPattern´³orµµ±host´³atom³String„„µ±any´³lit€„„„„³ HttpBinding´³rec´³lit³ http-bind„´³tupleµ´³named³host´³refµ„³ HostPattern„„´³named³port´³atom³ SignedInteger„„´³named³method´³refµ„³ MethodPattern„„´³named³path´³refµ„³ PathPattern„„´³named³handler´³embedded´³refµ„³ HttpRequest„„„„„„³ HttpContext´³rec´³lit³request„´³tupleµ´³named³req´³refµ„³ HttpRequest„„´³named³res´³embedded´³refµ„³ HttpResponse„„„„„„³ HttpRequest´³rec´³lit³ http-request„´³tupleµ´³named³sequenceNumber´³atom³ SignedInteger„„´³named³host´³atom³String„„´³named³port´³atom³ SignedInteger„„´³named³method´³atom³Symbol„„´³named³path´³seqof´³atom³String„„„´³named³headers´³refµ„³Headers„„´³named³query´³dictof´³atom³Symbol„´³seqof´³refµ„³ +QueryValue„„„„´³named³body´³refµ„³ RequestBody„„„„„³ HttpService´³rec´³lit³ http-service„´³tupleµ´³named³host´³refµ„³ HostPattern„„´³named³port´³atom³ SignedInteger„„´³named³method´³refµ„³ MethodPattern„„´³named³path´³refµ„³ PathPattern„„„„„³ PathPattern´³seqof´³refµ„³PathPatternElement„„³ RequestBody´³orµµ±present´³atom³ +ByteString„„µ±absent´³lit€„„„„³ HttpListener´³rec´³lit³ http-listener„´³tupleµ´³named³port´³atom³ SignedInteger„„„„„³ HttpResponse´³orµµ±status´³rec´³lit³status„´³tupleµ´³named³code´³atom³ SignedInteger„„´³named³message´³atom³String„„„„„„µ±header´³rec´³lit³header„´³tupleµ´³named³name´³atom³Symbol„„´³named³value´³atom³String„„„„„„µ±chunk´³rec´³lit³chunk„´³tupleµ´³named³chunk´³refµ„³Chunk„„„„„„µ±done´³rec´³lit³done„´³tupleµ´³named³chunk´³refµ„³Chunk„„„„„„„„³ MethodPattern´³orµµ±any´³lit€„„µ±specific´³atom³Symbol„„„„³PathPatternElement´³orµµ±label´³atom³String„„µ±wildcard´³lit³_„„µ±rest´³lit³...„„„„„³ embeddedType€„„µ³timer„´³schema·³version‘³ definitions·³SetTimer´³rec´³lit³ set-timer„´³tupleµ´³named³label³any„´³named³msecs´³atom³Double„„´³named³kind´³refµ„³ TimerKind„„„„„³ LaterThan´³rec´³lit³ later-than„´³tupleµ´³named³msecs´³atom³Double„„„„„³ TimerKind´³orµµ±relative´³lit³relative„„µ±absolute´³lit³absolute„„µ±clear´³lit³clear„„„„³ TimerExpired´³rec´³lit³ timer-expired„´³tupleµ´³named³label³any„´³named³msecs´³atom³Double„„„„„„³ embeddedType€„„µ³trace„´³schema·³version‘³ definitions·³Oid³any³Name´³orµµ± anonymous´³rec´³lit³ anonymous„´³tupleµ„„„„µ±named´³rec´³lit³named„´³tupleµ´³named³name³any„„„„„„„³Target´³rec´³lit³entity„´³tupleµ´³named³actor´³refµ„³ActorId„„´³named³facet´³refµ„³FacetId„„´³named³oid´³refµ„³Oid„„„„„³TaskId³any³TurnId³any³ActorId³any³FacetId³any³ TurnCause´³orµµ±turn´³rec´³lit³ caused-by„´³tupleµ´³named³id´³refµ„³TurnId„„„„„„µ±cleanup´³rec´³lit³cleanup„´³tupleµ„„„„µ±linkedTaskRelease´³rec´³lit³linked-task-release„´³tupleµ´³named³id´³refµ„³TaskId„„´³named³reason´³refµ„³LinkedTaskReleaseReason„„„„„„µ±periodicActivation´³rec´³lit³periodic-activation„´³tupleµ´³named³period´³atom³Double„„„„„„µ±delay´³rec´³lit³delay„´³tupleµ´³named³ causingTurn´³refµ„³TurnId„„´³named³amount´³atom³Double„„„„„„µ±external´³rec´³lit³external„´³tupleµ´³named³ description³any„„„„„„„³ TurnEvent´³orµµ±assert´³rec´³lit³assert„´³tupleµ´³named³ assertion´³refµ„³AssertionDescription„„´³named³handle´³refµ³protocol„³Handle„„„„„„µ±retract´³rec´³lit³retract„´³tupleµ´³named³handle´³refµ³protocol„³Handle„„„„„„µ±message´³rec´³lit³message„´³tupleµ´³named³body´³refµ„³AssertionDescription„„„„„„µ±sync´³rec´³lit³sync„´³tupleµ´³named³peer´³refµ„³Target„„„„„„µ± breakLink´³rec´³lit³ break-link„´³tupleµ´³named³source´³refµ„³ActorId„„´³named³handle´³refµ³protocol„³Handle„„„„„„„„³ ExitStatus´³orµµ±ok´³lit³ok„„µ±Error´³refµ³protocol„³Error„„„„³ From 0f5e033174fb5369f2c298b228e6ae49e0b1f014 Mon Sep 17 00:00:00 2001 From: Tony Garnock-Jones Date: Mon, 16 Jan 2023 15:52:46 +0100 Subject: [PATCH 3/7] noise --- schema-bundle.bin | 4 +++- schemas/noise.prs | 28 ++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 schemas/noise.prs diff --git a/schema-bundle.bin b/schema-bundle.bin index 69d1e4b..aa7b9ed 100644 --- a/schema-bundle.bin +++ b/schema-bundle.bin @@ -4,7 +4,9 @@ ByteString QueryValue´³orµµ±string´³atom³String„„µ±file´³rec´³lit³file„´³tupleµ´³named³filename´³atom³String„„´³named³headers´³refµ„³Headers„„´³named³body´³atom³ ByteString„„„„„„„„³ HostPattern´³orµµ±host´³atom³String„„µ±any´³lit€„„„„³ HttpBinding´³rec´³lit³ http-bind„´³tupleµ´³named³host´³refµ„³ HostPattern„„´³named³port´³atom³ SignedInteger„„´³named³method´³refµ„³ MethodPattern„„´³named³path´³refµ„³ PathPattern„„´³named³handler´³embedded´³refµ„³ HttpRequest„„„„„„³ HttpContext´³rec´³lit³request„´³tupleµ´³named³req´³refµ„³ HttpRequest„„´³named³res´³embedded´³refµ„³ HttpResponse„„„„„„³ HttpRequest´³rec´³lit³ http-request„´³tupleµ´³named³sequenceNumber´³atom³ SignedInteger„„´³named³host´³atom³String„„´³named³port´³atom³ SignedInteger„„´³named³method´³atom³Symbol„„´³named³path´³seqof´³atom³String„„„´³named³headers´³refµ„³Headers„„´³named³query´³dictof´³atom³Symbol„´³seqof´³refµ„³ QueryValue„„„„´³named³body´³refµ„³ RequestBody„„„„„³ HttpService´³rec´³lit³ http-service„´³tupleµ´³named³host´³refµ„³ HostPattern„„´³named³port´³atom³ SignedInteger„„´³named³method´³refµ„³ MethodPattern„„´³named³path´³refµ„³ PathPattern„„„„„³ PathPattern´³seqof´³refµ„³PathPatternElement„„³ RequestBody´³orµµ±present´³atom³ -ByteString„„µ±absent´³lit€„„„„³ HttpListener´³rec´³lit³ http-listener„´³tupleµ´³named³port´³atom³ SignedInteger„„„„„³ HttpResponse´³orµµ±status´³rec´³lit³status„´³tupleµ´³named³code´³atom³ SignedInteger„„´³named³message´³atom³String„„„„„„µ±header´³rec´³lit³header„´³tupleµ´³named³name´³atom³Symbol„„´³named³value´³atom³String„„„„„„µ±chunk´³rec´³lit³chunk„´³tupleµ´³named³chunk´³refµ„³Chunk„„„„„„µ±done´³rec´³lit³done„´³tupleµ´³named³chunk´³refµ„³Chunk„„„„„„„„³ MethodPattern´³orµµ±any´³lit€„„µ±specific´³atom³Symbol„„„„³PathPatternElement´³orµµ±label´³atom³String„„µ±wildcard´³lit³_„„µ±rest´³lit³...„„„„„³ embeddedType€„„µ³timer„´³schema·³version‘³ definitions·³SetTimer´³rec´³lit³ set-timer„´³tupleµ´³named³label³any„´³named³msecs´³atom³Double„„´³named³kind´³refµ„³ TimerKind„„„„„³ LaterThan´³rec´³lit³ +ByteString„„µ±absent´³lit€„„„„³ HttpListener´³rec´³lit³ http-listener„´³tupleµ´³named³port´³atom³ SignedInteger„„„„„³ HttpResponse´³orµµ±status´³rec´³lit³status„´³tupleµ´³named³code´³atom³ SignedInteger„„´³named³message´³atom³String„„„„„„µ±header´³rec´³lit³header„´³tupleµ´³named³name´³atom³Symbol„„´³named³value´³atom³String„„„„„„µ±chunk´³rec´³lit³chunk„´³tupleµ´³named³chunk´³refµ„³Chunk„„„„„„µ±done´³rec´³lit³done„´³tupleµ´³named³chunk´³refµ„³Chunk„„„„„„„„³ MethodPattern´³orµµ±any´³lit€„„µ±specific´³atom³Symbol„„„„³PathPatternElement´³orµµ±label´³atom³String„„µ±wildcard´³lit³_„„µ±rest´³lit³...„„„„„³ embeddedType€„„µ³noise„´³schema·³version‘³ definitions·³Accept´³rec´³lit³accept„´³tupleµ´³named³ handshake´³atom³ +ByteString„„´³named³responderSession´³embedded³any„„„„„³Connect´³rec´³lit³connect„´³tupleµ´³named³ handshake´³atom³ +ByteString„„´³named³initiatorSession´³embedded³any„„„„„„³ embeddedType€„„µ³timer„´³schema·³version‘³ definitions·³SetTimer´³rec´³lit³ set-timer„´³tupleµ´³named³label³any„´³named³msecs´³atom³Double„„´³named³kind´³refµ„³ TimerKind„„„„„³ LaterThan´³rec´³lit³ later-than„´³tupleµ´³named³msecs´³atom³Double„„„„„³ TimerKind´³orµµ±relative´³lit³relative„„µ±absolute´³lit³absolute„„µ±clear´³lit³clear„„„„³ TimerExpired´³rec´³lit³ timer-expired„´³tupleµ´³named³label³any„´³named³msecs´³atom³Double„„„„„„³ embeddedType€„„µ³trace„´³schema·³version‘³ definitions·³Oid³any³Name´³orµµ± anonymous´³rec´³lit³ anonymous„´³tupleµ„„„„µ±named´³rec´³lit³named„´³tupleµ´³named³name³any„„„„„„„³Target´³rec´³lit³entity„´³tupleµ´³named³actor´³refµ„³ActorId„„´³named³facet´³refµ„³FacetId„„´³named³oid´³refµ„³Oid„„„„„³TaskId³any³TurnId³any³ActorId³any³FacetId³any³ TurnCause´³orµµ±turn´³rec´³lit³ caused-by„´³tupleµ´³named³id´³refµ„³TurnId„„„„„„µ±cleanup´³rec´³lit³cleanup„´³tupleµ„„„„µ±linkedTaskRelease´³rec´³lit³linked-task-release„´³tupleµ´³named³id´³refµ„³TaskId„„´³named³reason´³refµ„³LinkedTaskReleaseReason„„„„„„µ±periodicActivation´³rec´³lit³periodic-activation„´³tupleµ´³named³period´³atom³Double„„„„„„µ±delay´³rec´³lit³delay„´³tupleµ´³named³ causingTurn´³refµ„³TurnId„„´³named³amount´³atom³Double„„„„„„µ±external´³rec´³lit³external„´³tupleµ´³named³ description³any„„„„„„„³ TurnEvent´³orµµ±assert´³rec´³lit³assert„´³tupleµ´³named³ assertion´³refµ„³AssertionDescription„„´³named³handle´³refµ³protocol„³Handle„„„„„„µ±retract´³rec´³lit³retract„´³tupleµ´³named³handle´³refµ³protocol„³Handle„„„„„„µ±message´³rec´³lit³message„´³tupleµ´³named³body´³refµ„³AssertionDescription„„„„„„µ±sync´³rec´³lit³sync„´³tupleµ´³named³peer´³refµ„³Target„„„„„„µ± breakLink´³rec´³lit³ break-link„´³tupleµ´³named³source´³refµ„³ActorId„„´³named³handle´³refµ³protocol„³Handle„„„„„„„„³ ExitStatus´³orµµ±ok´³lit³ok„„µ±Error´³refµ³protocol„³Error„„„„³ diff --git a/schemas/noise.prs b/schemas/noise.prs new file mode 100644 index 0000000..94eb6dd --- /dev/null +++ b/schemas/noise.prs @@ -0,0 +1,28 @@ +version 1 . + +; Noise_IK_25519_XSalsa20Poly1305_SHA512 +; Noise_NK_25519_XSalsa20Poly1305_SHA512 +; +; Most noise instantiations use ChaChaPoly (or AESGCM) but because e.g. tweetnacl offers +; XSalsa20 instead of ChaCha, I think I'll go with that. + +; IK: +; <- s (for us, the object's static key is in the cap ref) +; ... +; -> e, es, s, ss +; <- e, ee, se +; +; NK: +; <- s (for us, the object's static key is in the cap ref) +; ... +; -> e, es +; <- e, ee +; +; NKpsk2, IKpsk2 + +; Assertion. Handshake is an ephemeral public key followed by either an encrypted public-key +; (IK) or an encrypted empty payload (NK). +Connect = . + +; Assertion (to initiatorSession). Handshake is an encrypted ephemeral public key. +Accept = . From 40b4681a6ecb142a09fea84809be5b1bdef65617 Mon Sep 17 00:00:00 2001 From: Tony Garnock-Jones Date: Mon, 16 Jan 2023 16:21:12 +0100 Subject: [PATCH 4/7] Ugh, xsalsa20poly1305 as an AEAD isn't a thing --- schemas/noise.prs | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/schemas/noise.prs b/schemas/noise.prs index 94eb6dd..16b384b 100644 --- a/schemas/noise.prs +++ b/schemas/noise.prs @@ -1,28 +1,28 @@ version 1 . -; Noise_IK_25519_XSalsa20Poly1305_SHA512 -; Noise_NK_25519_XSalsa20Poly1305_SHA512 -; -; Most noise instantiations use ChaChaPoly (or AESGCM) but because e.g. tweetnacl offers -; XSalsa20 instead of ChaCha, I think I'll go with that. +; Noise_IKpsk2_25519_ChaChaPoly_BLAKE2s, just like Wireguard +; Noise_NKpsk2_25519_ChaChaPoly_BLAKE2s -; IK: +; - ephemeral public keys are 32 bytes +; - pre-shared-keys (PSKs) are 32 bytes +; - authentication tags (on each AEAD encrypted payload) are 16 bytes each + +; IKpsk2: ; <- s (for us, the object's static key is in the cap ref) ; ... ; -> e, es, s, ss -; <- e, ee, se +; <- e, ee, se, psk ; -; NK: +; NKpsk2: ; <- s (for us, the object's static key is in the cap ref) ; ... ; -> e, es -; <- e, ee -; -; NKpsk2, IKpsk2 +; <- e, ee, psk ; Assertion. Handshake is an ephemeral public key followed by either an encrypted public-key ; (IK) or an encrypted empty payload (NK). Connect = . -; Assertion (to initiatorSession). Handshake is an encrypted ephemeral public key. +; Assertion (to initiatorSession). Handshake is an encrypted ephemeral public key followed by a +; (differently-)encrypted PSK (which may be all zeros when no PSK is relevant). Accept = . From e8881f59806fdc145ee4556dee77455b26c1666c Mon Sep 17 00:00:00 2001 From: Tony Garnock-Jones Date: Thu, 19 Jan 2023 12:18:58 +0100 Subject: [PATCH 5/7] Now I have actually implemented Noise, revise the schema --- schema-bundle.bin | 11 +++++--- schemas/noise.prs | 69 ++++++++++++++++++++++++++++++++--------------- 2 files changed, 56 insertions(+), 24 deletions(-) diff --git a/schema-bundle.bin b/schema-bundle.bin index aa7b9ed..f638d10 100644 --- a/schema-bundle.bin +++ b/schema-bundle.bin @@ -4,9 +4,14 @@ ByteString QueryValue´³orµµ±string´³atom³String„„µ±file´³rec´³lit³file„´³tupleµ´³named³filename´³atom³String„„´³named³headers´³refµ„³Headers„„´³named³body´³atom³ ByteString„„„„„„„„³ HostPattern´³orµµ±host´³atom³String„„µ±any´³lit€„„„„³ HttpBinding´³rec´³lit³ http-bind„´³tupleµ´³named³host´³refµ„³ HostPattern„„´³named³port´³atom³ SignedInteger„„´³named³method´³refµ„³ MethodPattern„„´³named³path´³refµ„³ PathPattern„„´³named³handler´³embedded´³refµ„³ HttpRequest„„„„„„³ HttpContext´³rec´³lit³request„´³tupleµ´³named³req´³refµ„³ HttpRequest„„´³named³res´³embedded´³refµ„³ HttpResponse„„„„„„³ HttpRequest´³rec´³lit³ http-request„´³tupleµ´³named³sequenceNumber´³atom³ SignedInteger„„´³named³host´³atom³String„„´³named³port´³atom³ SignedInteger„„´³named³method´³atom³Symbol„„´³named³path´³seqof´³atom³String„„„´³named³headers´³refµ„³Headers„„´³named³query´³dictof´³atom³Symbol„´³seqof´³refµ„³ QueryValue„„„„´³named³body´³refµ„³ RequestBody„„„„„³ HttpService´³rec´³lit³ http-service„´³tupleµ´³named³host´³refµ„³ HostPattern„„´³named³port´³atom³ SignedInteger„„´³named³method´³refµ„³ MethodPattern„„´³named³path´³refµ„³ PathPattern„„„„„³ PathPattern´³seqof´³refµ„³PathPatternElement„„³ RequestBody´³orµµ±present´³atom³ -ByteString„„µ±absent´³lit€„„„„³ HttpListener´³rec´³lit³ http-listener„´³tupleµ´³named³port´³atom³ SignedInteger„„„„„³ HttpResponse´³orµµ±status´³rec´³lit³status„´³tupleµ´³named³code´³atom³ SignedInteger„„´³named³message´³atom³String„„„„„„µ±header´³rec´³lit³header„´³tupleµ´³named³name´³atom³Symbol„„´³named³value´³atom³String„„„„„„µ±chunk´³rec´³lit³chunk„´³tupleµ´³named³chunk´³refµ„³Chunk„„„„„„µ±done´³rec´³lit³done„´³tupleµ´³named³chunk´³refµ„³Chunk„„„„„„„„³ MethodPattern´³orµµ±any´³lit€„„µ±specific´³atom³Symbol„„„„³PathPatternElement´³orµµ±label´³atom³String„„µ±wildcard´³lit³_„„µ±rest´³lit³...„„„„„³ embeddedType€„„µ³noise„´³schema·³version‘³ definitions·³Accept´³rec´³lit³accept„´³tupleµ´³named³ handshake´³atom³ -ByteString„„´³named³responderSession´³embedded³any„„„„„³Connect´³rec´³lit³connect„´³tupleµ´³named³ handshake´³atom³ -ByteString„„´³named³initiatorSession´³embedded³any„„„„„„³ embeddedType€„„µ³timer„´³schema·³version‘³ definitions·³SetTimer´³rec´³lit³ set-timer„´³tupleµ´³named³label³any„´³named³msecs´³atom³Double„„´³named³kind´³refµ„³ TimerKind„„„„„³ LaterThan´³rec´³lit³ +ByteString„„µ±absent´³lit€„„„„³ HttpListener´³rec´³lit³ http-listener„´³tupleµ´³named³port´³atom³ SignedInteger„„„„„³ HttpResponse´³orµµ±status´³rec´³lit³status„´³tupleµ´³named³code´³atom³ SignedInteger„„´³named³message´³atom³String„„„„„„µ±header´³rec´³lit³header„´³tupleµ´³named³name´³atom³Symbol„„´³named³value´³atom³String„„„„„„µ±chunk´³rec´³lit³chunk„´³tupleµ´³named³chunk´³refµ„³Chunk„„„„„„µ±done´³rec´³lit³done„´³tupleµ´³named³chunk´³refµ„³Chunk„„„„„„„„³ MethodPattern´³orµµ±any´³lit€„„µ±specific´³atom³Symbol„„„„³PathPatternElement´³orµµ±label´³atom³String„„µ±wildcard´³lit³_„„µ±rest´³lit³...„„„„„³ embeddedType€„„µ³noise„´³schema·³version‘³ definitions·³Accept´³rec´³lit³accept„´³tupleµ´³named³responderSession´³embedded³any„„„„„³Packet´³orµµ±complete´³atom³ +ByteString„„µ± +fragmented´³seqof´³atom³ +ByteString„„„„„³Connect´³rec´³lit³connect„´³tupleµ´³named³serviceSelector³any„´³named³initiatorSession´³embedded³any„„„„„³Endpoint´³rec´³lit³noise„´³tupleµ´³named³spec´³refµ„³ EndpointSpec„„„„„³ EndpointRef´³orµµ±present´³dict·³ref´³named³ref´³refµ³sturdy„³ SturdyRef„„„„„µ±invalid´³dict·³ref´³named³ref³any„„„„µ±absent´³dict·„„„„„³ EndpointSpec´³andµ´³dict·³key´³named³key´³atom³ +ByteString„„³ +transports´³named³ +transports´³seqof³any„„„„´³named³protocol´³refµ„³EndpointProtocol„„´³named³ref´³refµ„³ EndpointRef„„´³named³ preSharedKeys´³refµ„³EndpointPreSharedKeys„„„„³DefaultProtocol´³lit±!Noise_NK_25519_ChaChaPoly_BLAKE2s„³EndpointProtocol´³orµµ±present´³dict·³protocol´³named³protocol´³atom³String„„„„„µ±invalid´³dict·³protocol´³named³protocol³any„„„„µ±absent´³dict·„„„„„³EndpointPreSharedKeys´³orµµ±present´³dict·³ preSharedKeys´³named³ preSharedKeys´³seqof´³atom³ +ByteString„„„„„„µ±invalid´³dict·³ preSharedKeys´³named³ preSharedKeys³any„„„„µ±absent´³dict·„„„„„„³ embeddedType€„„µ³timer„´³schema·³version‘³ definitions·³SetTimer´³rec´³lit³ set-timer„´³tupleµ´³named³label³any„´³named³msecs´³atom³Double„„´³named³kind´³refµ„³ TimerKind„„„„„³ LaterThan´³rec´³lit³ later-than„´³tupleµ´³named³msecs´³atom³Double„„„„„³ TimerKind´³orµµ±relative´³lit³relative„„µ±absolute´³lit³absolute„„µ±clear´³lit³clear„„„„³ TimerExpired´³rec´³lit³ timer-expired„´³tupleµ´³named³label³any„´³named³msecs´³atom³Double„„„„„„³ embeddedType€„„µ³trace„´³schema·³version‘³ definitions·³Oid³any³Name´³orµµ± anonymous´³rec´³lit³ anonymous„´³tupleµ„„„„µ±named´³rec´³lit³named„´³tupleµ´³named³name³any„„„„„„„³Target´³rec´³lit³entity„´³tupleµ´³named³actor´³refµ„³ActorId„„´³named³facet´³refµ„³FacetId„„´³named³oid´³refµ„³Oid„„„„„³TaskId³any³TurnId³any³ActorId³any³FacetId³any³ TurnCause´³orµµ±turn´³rec´³lit³ caused-by„´³tupleµ´³named³id´³refµ„³TurnId„„„„„„µ±cleanup´³rec´³lit³cleanup„´³tupleµ„„„„µ±linkedTaskRelease´³rec´³lit³linked-task-release„´³tupleµ´³named³id´³refµ„³TaskId„„´³named³reason´³refµ„³LinkedTaskReleaseReason„„„„„„µ±periodicActivation´³rec´³lit³periodic-activation„´³tupleµ´³named³period´³atom³Double„„„„„„µ±delay´³rec´³lit³delay„´³tupleµ´³named³ causingTurn´³refµ„³TurnId„„´³named³amount´³atom³Double„„„„„„µ±external´³rec´³lit³external„´³tupleµ´³named³ description³any„„„„„„„³ TurnEvent´³orµµ±assert´³rec´³lit³assert„´³tupleµ´³named³ assertion´³refµ„³AssertionDescription„„´³named³handle´³refµ³protocol„³Handle„„„„„„µ±retract´³rec´³lit³retract„´³tupleµ´³named³handle´³refµ³protocol„³Handle„„„„„„µ±message´³rec´³lit³message„´³tupleµ´³named³body´³refµ„³AssertionDescription„„„„„„µ±sync´³rec´³lit³sync„´³tupleµ´³named³peer´³refµ„³Target„„„„„„µ± breakLink´³rec´³lit³ break-link„´³tupleµ´³named³source´³refµ„³ActorId„„´³named³handle´³refµ³protocol„³Handle„„„„„„„„³ ExitStatus´³orµµ±ok´³lit³ok„„µ±Error´³refµ³protocol„³Error„„„„³ diff --git a/schemas/noise.prs b/schemas/noise.prs index 16b384b..2fc6cd9 100644 --- a/schemas/noise.prs +++ b/schemas/noise.prs @@ -1,28 +1,55 @@ version 1 . -; Noise_IKpsk2_25519_ChaChaPoly_BLAKE2s, just like Wireguard -; Noise_NKpsk2_25519_ChaChaPoly_BLAKE2s +; https://noiseprotocol.org/ -; - ephemeral public keys are 32 bytes -; - pre-shared-keys (PSKs) are 32 bytes -; - authentication tags (on each AEAD encrypted payload) are 16 bytes each +; Assertion. +Connect = . -; IKpsk2: -; <- s (for us, the object's static key is in the cap ref) -; ... -; -> e, es, s, ss -; <- e, ee, se, psk +; Assertion (to initiatorSession). +Accept = . + +; Sessions proceed by sending Packets to the initiatorSession and responderSession according to +; the Noise protocol definition. Each Packet represents a complete logical unit of +; communication; for example, a complete Turn when layering the Syndicate protocol over Noise. +; Note well the restriction on Noise messages: no individual complete packet or packet fragment +; may exceed 65535 bytes (N.B. not 65536!). When `fragmented`, each portion of a Packet is a +; complete Noise "transport message"; when `complete`, the whole thing is likewise a complete +; "transport message". +Packet = @complete bytes / @fragmented [bytes ...] . + +; When layering Syndicate protocol over noise, ; -; NKpsk2: -; <- s (for us, the object's static key is in the cap ref) -; ... -; -> e, es -; <- e, ee, psk +; - protocol.Packets MUST be encoded using the machine-oriented Preserves syntax +; - zero or more Turns are permitted per noise.Packet +; - each Turn must fit inside a single noise.Packet (fragment if needed) +; - payloads inside a noise.Packet may be padded at the end with byte 0x80 (128), which +; encodes `#f` in the machine-oriented Preserves syntax. +; +; In summary, each noise.Packet, once (reassembled and) decrypted, will be a sequence of zero +; or more machine-encoded protocol.Packets, followed by zero or more 0x80 bytes. -; Assertion. Handshake is an ephemeral public key followed by either an encrypted public-key -; (IK) or an encrypted empty payload (NK). -Connect = . +Endpoint = . +EndpointSpec = { + ; Possible transports, in preference order. Could contain e.g. transportAddress.Tcp values or + ; similar. These are just suggestions; it's quite possible the endpoint is reachable by some + ; means not listed. + transports: [any ...] + ; The responder's static public key. If not required (uncommon!), supply the empty ByteString. + key: bytes +} +& @protocol EndpointProtocol +& @ref EndpointRef +& @preSharedKeys EndpointPreSharedKeys +. -; Assertion (to initiatorSession). Handshake is an encrypted ephemeral public key followed by a -; (differently-)encrypted PSK (which may be all zeros when no PSK is relevant). -Accept = . +; If absent, a default of DefaultProtocol is used. Most endpoints will speak the default. +EndpointProtocol = @present { protocol: string } / @invalid { protocol: any } / @absent {} . +DefaultProtocol = "Noise_NK_25519_ChaChaPoly_BLAKE2s" . + +; If present, OID 0 at the responder end is a Gatekeeper, and the named ref should be resolvable. +; If absent, OID 0 at the responder directly denotes the entity of interest. +EndpointRef = @present { ref: sturdy.SturdyRef } / @invalid { ref: any } / @absent {} . + +; If present, Noise pre-shared-keys (PSKs) are drawn from the sequence as required; if the +; sequence is exhausted or not supplied, an all-zeros key is used each time a PSK is needed. +EndpointPreSharedKeys = @present { preSharedKeys: [bytes ...] } / @invalid { preSharedKeys: any } / @absent {} . From 5983cd01f1d0122a34212959f9539e6230380e48 Mon Sep 17 00:00:00 2001 From: Tony Garnock-Jones Date: Mon, 23 Jan 2023 13:08:12 +0100 Subject: [PATCH 6/7] Another note re noise --- schemas/noise.prs | 1 + 1 file changed, 1 insertion(+) diff --git a/schemas/noise.prs b/schemas/noise.prs index 2fc6cd9..17c7328 100644 --- a/schemas/noise.prs +++ b/schemas/noise.prs @@ -19,6 +19,7 @@ Packet = @complete bytes / @fragmented [bytes ...] . ; When layering Syndicate protocol over noise, ; +; - the canonical encoding of the serviceSelector is the prologue ; - protocol.Packets MUST be encoded using the machine-oriented Preserves syntax ; - zero or more Turns are permitted per noise.Packet ; - each Turn must fit inside a single noise.Packet (fragment if needed) From fff84d4c2af08dde67e760bc33d31816d6b44f4a Mon Sep 17 00:00:00 2001 From: Tony Garnock-Jones Date: Fri, 27 Jan 2023 12:45:02 +0100 Subject: [PATCH 7/7] Update noise mapping --- schema-bundle.bin | Bin 17451 -> 17808 bytes schemas/noise.prs | 44 +++++++++++++++++++++++++++----------------- 2 files changed, 27 insertions(+), 17 deletions(-) diff --git a/schema-bundle.bin b/schema-bundle.bin index f638d10898a9850ec8e35773832a8da02f33ac16..cfe864b81c7d7eec6f0510fe7ef38116f8fb1941 100644 GIT binary patch literal 17808 zcmeHP+jAV{mG72W%)-lN^UR+hsy0=5*hgbKivt+1q--9k*32h+qEYvxyT@ksDF#V1 zy7?*_V{EXo_|(W;!kqx-7GiTV1`C@fkJKwpV^POhCDF^FexhnjNMi<7jQJI!%D_)sz%A~YOj07uAEKJL?7^;Mov=W8M ziqVA$IZ&!y5tV}KALd78EJ{1^r&>uT>DAsU-8eNrF4KCgDvoD2;b$0(i1L`+6ea2Q z`7s%!(MVJFr*S3Rcx!&U7RBjaeS4eiuWSrOd0m)_jUt|=B{v8WuM3AFe_AcOLoGYO z%hqu73$yCS*6WSGm}J5AH$rVA1b;C6WB4ubg37=ZGOzyy$m#JVxJ;wI-8Vh!?cn%`oz$vTpiR} zabrgb6dM?|L(sR#^vfw^>Fx!`Rim9Kb-B)T5}1@$?Fu{ z!K^tq*hod&l2oH$~;^4YFV2{ zU{r26DxsNvDWL80?)i%CwCA(zbM_QLT2DM36}BnSAdsX4eg$i@yq|UDU5d)0iy*8E zZ-IwN5^NL>6PY<5VNJyq?`_^t$*!ru&zd!#aKjKqBL@}B;3)zcU@kGo4lVD>#l5(pFfaI&LuTbsti?1Zd70~PRJ`OBZ6Y0 zBS5}0Egknt4u{R{fDz7a_x9SV7!hGw1Ut!Ooycy0K2(E2QFTdRP1y_jwp6O+QV^HD z2_@WX<<+wgdkin_O)1c*yyTKgTI|vy1fU$!+vZMIPS?NwNkzyBe zm40{`Le#LURMc){!iOd@a>n(z+?Yi6O@EOn?v{*iLoE6?1+ge!E*gpd3#E(q zWUo7NJc&GyQn_C(Y?F{}{`h@{nH}&0fU}tusm+tXTnXW9D`oF~jropF%!Gl()Pb3~ zIh*UyghsFx2=sOo)BJsEC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Znw4uKjD&n$=B7|O5Fk@I_PZ0nwM@h?K|LdW?T9?4u*v+{{`yY^p zZVUqGPWKKIx6id3gl*gVNKw7F?cS~9%bn%8kk)cV7K!VAUD@JZHvuEE9m!>56na(y z(d)-<@t9D(UVTeR*G??@=vQ`QT;;%xayh`>Av28MwethtI}k(@Hr@!koBdX$*fD4i z*dxM?S^f)zWVsA|JfB0%6&8K84BW$)kpbEI>1ek$`X!$>k%cFJ$g|JELdhDCh+Om( zR&uSYkO>E>u6b4jNKlsn)MBA&qd%Io0i3vF3>^n#} zIeqh#J}$GzDfKwNrG_IB1Kv+}_T)~C@&giK8Yo^{`XjB-HF%MC(8j!yHl~b7Qe5G#}x}b5qNaE*%NXgR#~{9jlbRAm5=BDJ4aMX`W<`{WXBcN zLE`E08(fcHmj-veUCrTMO&w zOw1U<;xyHdMXY@!6(F%CKV3`cBP;B0ESY=)%g!a`q(FqHbM08iFPnk;zDlg`KuZ-` z0nI%xfX2!q-r*-}m6EiM<9S*6A2Q|m3||BQM>^C6@y(K%$>+yb7TZ^}LfTOyX)2n~lmzUGjAs*$3a> zZK5YN1W;1P(_%tK9|b-+COAW|<|vjFsUg@kZF7 PNPZUWA3jMUU%vb=`OA7& diff --git a/schemas/noise.prs b/schemas/noise.prs index 17c7328..f14031e 100644 --- a/schemas/noise.prs +++ b/schemas/noise.prs @@ -29,28 +29,38 @@ Packet = @complete bytes / @fragmented [bytes ...] . ; In summary, each noise.Packet, once (reassembled and) decrypted, will be a sequence of zero ; or more machine-encoded protocol.Packets, followed by zero or more 0x80 bytes. -Endpoint = . -EndpointSpec = { - ; Possible transports, in preference order. Could contain e.g. transportAddress.Tcp values or - ; similar. These are just suggestions; it's quite possible the endpoint is reachable by some - ; means not listed. - transports: [any ...] +; A `Route` describes a network path that can be followed to reach some target entity. +; +; It starts with zero or more possible non-Syndicate `transports`, in preference order. These +; could be `transportAddress.Tcp` values or similar. They are just suggestions; it's quite +; possible the endpoint is reachable by some means not listed. The network outside Syndicate +; is, after all, pretty diverse! In particular, *zero* `transports` may be provided, in which +; case some out-of-band means has to be used to make that first connection. +; +; The `transports` give instructions for contacting the first entity in the `Route` path. Often +; this will be a `gatekeeper`, or a `noise` protocol endpoint, or both. Occasionally, it may +; even be the desired target entity. Subsequent `steps` describe how to proceed from the +; initial entity to the target. +Route = . +RouteStep = NoiseStep / GatekeeperStep . + +GatekeeperStep = sturdy.SturdyRef . + +NoiseStep = . +NoiseSpec = { + ; The `serviceSelector` to use in a `Connect`. + service: any, ; The responder's static public key. If not required (uncommon!), supply the empty ByteString. - key: bytes + key: bytes, } -& @protocol EndpointProtocol -& @ref EndpointRef -& @preSharedKeys EndpointPreSharedKeys +& @protocol NoiseProtocol +& @preSharedKeys NoisePreSharedKeys . -; If absent, a default of DefaultProtocol is used. Most endpoints will speak the default. -EndpointProtocol = @present { protocol: string } / @invalid { protocol: any } / @absent {} . +; If absent, a default of DefaultProtocol is used. Most services will speak the default. +NoiseProtocol = @present { protocol: string } / @invalid { protocol: any } / @absent {} . DefaultProtocol = "Noise_NK_25519_ChaChaPoly_BLAKE2s" . -; If present, OID 0 at the responder end is a Gatekeeper, and the named ref should be resolvable. -; If absent, OID 0 at the responder directly denotes the entity of interest. -EndpointRef = @present { ref: sturdy.SturdyRef } / @invalid { ref: any } / @absent {} . - ; If present, Noise pre-shared-keys (PSKs) are drawn from the sequence as required; if the ; sequence is exhausted or not supplied, an all-zeros key is used each time a PSK is needed. -EndpointPreSharedKeys = @present { preSharedKeys: [bytes ...] } / @invalid { preSharedKeys: any } / @absent {} . +NoisePreSharedKeys = @present { preSharedKeys: [bytes ...] } / @invalid { preSharedKeys: any } / @absent {} .