api.newsroom.sgit.ai v0.2.14

Home / Docs / State, inputs and outputs

Reference

State, inputs and outputs

Where a reader's data lives, what comes in, and every place anything leaves the browser. From the map, which the review checks line by line.

The state, in localStorage under sgit.meter.v1

It belongs to the page's origin (newsroom.sgit.ai), whichever host serves the script. A reader can read it, export it, restore it and edit it; the security model says so.

FieldHolds
v3
createdISO time
balance · spent · declinedpence, to 0.1p
readspages opened
pausedalways false since v1.4.0
log[]≤ 500 entries: id, at, path, title, kind, topics, price, depth, cost, persona, autoKept?, rating{useful,more,detail,at}?, declined{reason,at,refunded}?
topups[]ref (≤ 40 chars), at, credit, source: link | simulated
sessions[]every payment reference credited, unbounded
cart[]the simulated cart (unused with a live link)
activethe active persona's id
personas[]id, preset, name, created, on[], off[], visitor?, list? (a reading list's key), theme?
shares[]≤ 20: at, how, pages

What comes in

InputWhatWhoWhere
Element attributesview · kind · date · topics · title · quiet · count · persona · compactthe page's own markup (trusted: it is this site's build)sg-meter.js
The page's config<script type="application/json" id="sg-meter-config">this site's build, written once per page; every key has a defaultsg-meter-core.js _config()
The address: query?session_id= on account/topped-up.htmlwhoever made the link; any value is credited once (accepted, documented)_toppedUp()
The address: fragment#<persona id> on persona/; #from,to,r,s,f,n,e on for/ and for/make.htmlwhoever made the link; validated field by field, the rest dropped and listed_named(), reading-list.js parse()
The address: pathlocation.pathnamethe charge is keyed on it; the slug is taken from it; the share records itopen(), _page(), _send()
Local storagesgit.meter.v1 (the state), sgit.meter.v1.seen (session: the charge per path)this browser, written by the meter; also by the reader, who may edit it (accepted)_read(), _seen()
A fileRestore from an export…whoever made the file; checked for balance:number and log:array onlyrestore()
Formsthe share form, the subscribe form, the make pagethe reader; email checked by a loose pattern, names by a strict one_send(), subscribe.js, make.js
The wires' vaultsdata/bundle.json (with wire, map or stack when the vault has them), data/deliveries.json, data/releases.json, docs/*.md, decrypted in the browser; one vault per wirewhoever holds the vault's write key (the wire's agents); drawn as text, links only from http(s) values, markdown rendered by an escaping renderer; the vault's own HTML is not usedwire/wire.js
Own-origin dataarticles/graphs.json · articles/ids.json · .well-known/sgit-subscribe.json · sg-meter.tpl · sg-meter.cssthis site's build; the contact file's key is checked against its fingerprintfeed(), openList(), _send()
postMessagereplies from the dev.vault.sgraph.ai framesorigin-checked; drives a status line onlyvault-ui-embed.js

What leaves the browser

ChannelWhatWhenWho sees it
GET, own originevery page, script, style, image and JSONwhenever a page opensGitHub Pages, which sees the request as any host does
POST https://dev.send.sgraph.ai/api/vault/append/write/y9j3nc60{append_token, payload}: an .eml encrypted in the browser to the lane's public keywhen the reader presses Send on the share page or Subscribethe vault host; it sees ciphertext, a size and a time
Navigation to https://buy.stripe.com/…the reader leaves for Stripe's page and returns to /account/topped-up.html?session_id=…when the reader presses Top up / PayStripe (card, email, name, postcode)
GET https://dev.send.sgraph.ai/api/vault/read/u9i9jp0l/…the ciphertext of the wire's vault: its head pointer, commit, tree and the files the page needs, decrypted in the browser with the published read keywhen a wire page opens, and when the reader asks for a new commit; the pointer at most every two minutesthe vault server; it sees the request and nothing of the reader
iframe https://dev.vault.sgraph.ai/?embed=1two frames; the published read key is posted to themon the study page onlythe vault UI host
mailto:Reply to <sender> on a reading list; the subscribe fallbackwhen pressed; the page sends nothingthe reader's mail client
A downloadreading-account.json: the whole state, payment references includedExport as JSONthe reader's disk
The clipboarda link, or the share textCopythe reader's clipboard
postMessage to the parent window{type:'sg-app-ready'} with targetOrigin *when a page is framedwhoever framed it

The accepted gaps and why: the meter's security model.