on master help sign in
minor copyediting
commit3d454fe5e0a65f050ecf0edd37ccf9ed23442160 authorGalen Wolfe-Pauly <root@office-for.com> dateTue 19 Apr 2016, 09:42 (11 years ago) parent262c9d8
2 files changed+21−20
docs/programming/arvo/system/api.md+7−7 docs/programming/arvo/system/security-driver.md+14−13
docs/programming/arvo/system/api.md+7−7
@@ -23,7 +23,7 @@ app accomplishes both for Github.
2323After starting `%gh` (`|start %gh`), let's look at the root of
2424the tree that `%gh` exposes:
2525
26− ~sampel-sipnym:dojo> .^(arch %gy /=gh=)
26+ ~your-urbit:dojo> .^(arch %gy /=gh=)
2727 [fil=~ dir={[p=~.issues q=~]}]
2828
2929`%gh` is currently a skeleton -- it contains examples of all the
@@ -31,7 +31,7 @@ functionality necessary for a connector, but many endpoints
3131aren't implemented. As we can see here, only issues are
3232implemented. We can explore this tree:
3333
34− ~sampel-sipnym:dojo> .^(arch %gy /=gh=/issues)
34+ ~your-urbit:dojo> .^(arch %gy /=gh=/issues)
3535 [fil=~ dir={[p=~.by-repo q=~] [p=~.mine q=~]}]
3636
3737And eventually:
@@ -49,9 +49,9 @@ the `:pipe` app:
4949 :pipe|connect %gh /listen/philipcmonktest/testing/issues/'issue_comment' %public
5050
5151Now creating an issue results in the following message in your
52−`%public` channel:
52+`%public` `:talk` channel:
5353
54− ~sampel-sipnym[philipcmonktest@github]: opened issue #11: i found a bug!
54+ ~your-urbit[philipcmonktest@github]: opened issue #11: i found a bug!
5555
5656You'll also get notifications of issue status changes and
5757comments.
@@ -78,7 +78,7 @@ Unix `ls`.
7878> "should" produce a list of all Github users, but we don't do
7979> that because it's too long. Instead, we just produce our own
8080> username (from the `web.plan` file). You can still access
81−> repos from other uesrs, you just don't see them in the
81+> repos from other users, you just don't see them in the
8282> directory listing.
8383
8484The usual flow for implementing this tree of data makes heavy use
@@ -100,7 +100,7 @@ list of all the places we can request. A place consists of:
100100 to match `/issues/<user>/<repo>` use `{$issues @t @t $~}`.
101101
102102- `read-x`, called when someone tries to read the place with
103− care `%x`. Should produce a single move, usually either a
103+ `care` `%x`. Should produce a single move, usually either a
104104 `%diff` response if we can immediately answer or a `%hiss`
105105 http request if we need to make a request to the api. See the
106106 `++read-*` functions in `++helpers` for some common handlers.
@@ -175,7 +175,7 @@ up-to-date.
175175Flow of control starts in `++peer-listen`, where we just call
176176`++listen`. In `++listen`, for each event in the list of events,
177177we check to see if we have that hook set up (by checking whether
178−it exists in `hook`). If so, we call `++update-hook` to add th
178+it exists in `hook`). If so, we call `++update-hook` to add the
179179current bone to the set of listeners. Otherwise, we call
180180`++create-hook`, which sends a request to Github to set up the
181181new webhook. We also create an entry in `hook` with the current
docs/programming/arvo/system/security-driver.md+14−13
@@ -29,15 +29,15 @@ models.
2929Still, it's worth seeing one or two built from the ground up.
3030Here, we'll build a connector for the Github API v3. The
3131simplest way to interact with the Github API is to just fetch
32−https://api.github.com.
32+https://api.github.com from the dojo:
3333
34− +https://api.github.com
34+ ~your-urbit:dojo> +https://api.github.com
3535
3636Github exposes a few endpoints to the general web, and the root
3737endpoint is one of them. This gives you a textual representation
3838of a JSON object that contains a bunch of urls to other parts of
3939Github's API. This is exactly the same response you would get
40−from just running `curl` on UNIX.
40+from just running `curl https://api.github.com` on UNIX.
4141
4242If we don't have a security driver for Github yet, many of the
4343endpoints won't be accessible, or they will only have publicly
@@ -70,7 +70,7 @@ To try this out, we first have to initialize our credentials with
7070`|init-auth-basic`, which prompts for the url of the service
7171(api.github.com), username, and password. It stores this
7272information in a manner that `%eyre` knows how to decode and send
73−put into your bale. Note that `|init-auth-basic` is standard for
73+put into your `bale`. Note that `|init-auth-basic` is standard for
7474basic auth, but other auth schemes (like OAuth) are initialized
7575in other ways.
7676
@@ -80,8 +80,7 @@ you're logged in as.
8080
8181You can similarly POST:
8282
83− +https://api.github.com/gists &json _(cork poja need)
84− '{"files":{"file1.txt":{"content":"can\'t stop the signal"}}}'
83+ ~your-urbit:dojo> +https://api.github.com/gists &json _(cork poja need) '{"files":{"file1.txt":{"content":"can\'t stop the signal"}}}'
8584
8685This creates a gist, go to `https://gist.github.com/<username>` to
8786see it.
@@ -93,22 +92,24 @@ can send data of any mark as long as it has a conversion path to
9392`%mime`.
9493
9594Let's take a look at the code and see if we can figure out what's
96−happening here.
95+happening here:
96+
97+ /+ basic-auth
9798
9899First, we load a library called `basic-auth`. This library
99100exposes two items. `keys` is the type of the basic auth key,
100101which is essentially a base64'd username and password.
101−`standard` accepts a bale and produces a core with everything
102+`standard` accepts a `bale` and produces a core with everything
102103we'll need to implement basic auth.
103104
104105Every security driver needs some amount of state, which is stored
105−in the bale. The bale contains:
106+in `bale`. `bale` contains:
106107
107108- `our`, our urbit name
108109- `now`, the current time
109110- `eny`, 256 bits of entropy
110−- `byk`, the urbit, desk, and case which the security driver is
111− running off
111+- `byk`, the urbit, desk and case which the security driver is
112+ running from
112113- `usr`, the particular identity we're logging in with
113114- `dom`, the site we're accessing
114115- `key`, the secrets required to authenticate requests. The type
@@ -130,7 +131,7 @@ one of:
130131 asking the user to visit the given url to continue the
131132 authentication process.
132133
133−Every request to a Github url will be filtered through
134+Every request to a GitHub url will be filtered through
134135`++filter-request`, and we want to add the authentication header
135136to it. Our `++aut` core contains a function
136137`++out-addding-header`, which does exactly what we want.
@@ -141,7 +142,7 @@ service url, username, and password, and it stores them next to
141142the driver. In our case, that's
142143`/=home=/sec/com/gitub/api/atom`. These keys are stored
143144encrypted, and you don't want to edit them directly. `%eyre`
144−loads them directly into your bale.
145+loads them directly into your `bale`.
145146
146147# OAuth2
147148