diff --git a/goblins/ocapn/captp.rkt b/goblins/ocapn/captp.rkt index 2c2312f..19d00e7 100644 --- a/goblins/ocapn/captp.rkt +++ b/goblins/ocapn/captp.rkt @@ -64,6 +64,7 @@ ;; For the handoff stuff: ;; https://dustycloud.org/tmp/captp-handoff-musings.org.txt ;; https://dustycloud.org/misc/3vat-handoff-scaled.jpg +(define captp-version 0.1) (struct captp-session-severed ()) @@ -190,7 +191,8 @@ ;; machinetp operations/descriptions (define-recordable-struct mtp:op:start-session - (handoff-pubkey + (captp-version + handoff-pubkey ;; a sig-envelope signed by handoff-pubkey with a acceptable-location acceptable-location-sig) @@ -1419,9 +1421,15 @@ ;; TODO: Shouldn't the netlayer actually interpret this message ;; before it gets here? Ie, at this stage, we're already ;; "confident" this is from the right location - [(mtp:op:start-session remote-encoded-pubkey + [(mtp:op:start-session remote-captp-version + remote-encoded-pubkey (? ocapn-machine? claimed-remote-location) remote-location-sig) + (unless (= remote-captp-version captp-version) + (error (format "CapTP version is incompatible (our version: ~a, remove version: ~a)" + captp-version + remote-captp-version))) + (define remote-handoff-pubkey (datum->pk-key (gcrypt->racket/public-key remote-encoded-pubkey) 'rkt-public)) ;; TODO: I guess we didn't know by the time this was opened @@ -1512,7 +1520,8 @@ ;; Now we'll need to send our side of the start-session and get the ;; other side... which will be handled by the ^setup-completer above - (send-to-remote (mtp:op:start-session handoff-pubkey + (send-to-remote (mtp:op:start-session captp-version + handoff-pubkey our-location our-location-sig))