View indirect_spec_gen.clj
(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 |
View block-stack-verify.txt
Verifying my Blockstack ID is secured with the address 153ChCc5kEhHGgJ6YB7FSPTPAx8rfJneUo https://explorer.blockstack.org/address/153ChCc5kEhHGgJ6YB7FSPTPAx8rfJneUo |
View sample-comms-protocol.clj
(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?)) |
View sente-fnhouse-handlers.clj
(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 |