This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns indirect-spec-gen | |
(:require [clojure.spec.alpha :as s] | |
[clojure.spec.gen.alpha :as gen] | |
[clojure.test :refer (deftest is)])) | |
(def extension-length 16) | |
;; Need a byte array with 16 members | |
(s/def ::extension (s/and bytes? | |
#(= (count %) extension-length))) | |
;; Need to track one for the client, another for the server |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Verifying my Blockstack ID is secured with the address 153ChCc5kEhHGgJ6YB7FSPTPAx8rfJneUo https://explorer.blockstack.org/address/153ChCc5kEhHGgJ6YB7FSPTPAx8rfJneUo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn version-contract | |
"Declaration of the handshake to allow client and server to agree on handling the next pieces" | |
[] | |
[{::direction ::client->server | |
::initial-step true | |
::spec #(= % ::ohai) | |
::client-gen (fn [_] ::ohai) | |
::problem "Illegal greeting"} | |
{::direction ::server->client | |
::spec (s/and keyword? #(= % ::orly?)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defnk $chsk$GET | |
{:responses {200 {:what? s/Int}}} | |
;; Note the way to just access the full request | |
[request | |
[:resources [:web-sock-handler ch-sock]]] | |
(let [handler (:ring-ajax-get-or-ws-handshake ch-sock) | |
response (handler request)] | |
response)) | |
(defnk $chsk$POST |