Jael and womb.

This commit is contained in:
C. Guy Yarvin 2016-04-08 10:08:05 -07:00
parent a1df9b2a59
commit c04a34de62
2 changed files with 249 additions and 0 deletions

90
arvo/jael.hoon Normal file
View File

@ -0,0 +1,90 @@
:: %jael, secret
::
:::: /hoon/jael
::
!? 164
::::
|= pit=vase
=> =~
:: private structures :: ::
:::: :: ::
:: :: ::
|% ::
++ bitx $~ :: any crypto wallet
++ prof :: per service profile
$: oat/(map user (safe @)) :: auth tokens
pax/(unit @t) :: actual password
== ::
++ safe |*(gate {exp/@da nub/+<}) :: secret w/expiration
++ tlsy $~ :: HTTPS secrets
++ whom @t :: foreign identity
++ wapi :: per api service
$: app/(map @tas (safe @)) :: per appname
use/(map whom prof) :: user secrets
== ::
++ land :: urbit secrets
$: lyf/@ud :: life number
sym/(map @p (map @uvH (safe @uvI))) :: shared keys
own/(map @ud (safe ring)) :: private key per life
== ::
++ user @ta :: user id per service
++ visa (map ship will) :: meta-will
--
:: system structures
|%
++ axle :: %jael state
$: $0 :: %jael version
pri/land :: local crypto state
pub/(map @p will) :: will system
api/(map @tas wapi) :: web services
tix/(map @pG @p) :: old style tickets
tls/tlsy :: tls keys
val/(map @tas bitx) :: bitcoin etc
sub/(map path (set duct)) :: subscribers
== ::
++ gift :: out result <-$
$% {$dead p/path} :: key expired
{$save p/(each * *)} :: backup
== ::
++ kiss :: in request ->$
$% {$kill p/path} :: cancel path
{$know p/visa} :: learn will (new pki)
{$knew p/ship q/will} :: learn will (old pki)
{$next p/ring} :: update private key
{$tell p/path q/@da r/@} :: save atomic secret
{$tick p/@pG q/@p} :: save old ticket
==
--
|% ::
++ call :: request
|= {hen/duct hic/(hypo (hobo kiss))}
^- [p=(list move) q=_..^$]
!!
::
++ doze
|= [now=@da hen=duct]
^- (unit @da)
~
::
++ load :: highly forgiving
|= old=*
=+ lox=((soft axle) old)
^+ ..^$
?~ lox
~& %jael-reset
..^$
..^$(+>- u.lox)
::
++ scry
|= {fur/(unit (set monk)) ren/@tas who/ship syd/desk lot/coin tyl/path}
^- (unit (unit (pair mark *)))
:: actually scry
~
::
++ stay :: save w/o cache
`axle`+>-.$
::
++ take :: response
|= {tea/wire hen/duct hin/(hypo noun)}
!!
--

159
lib/womb.hoon Normal file
View File

@ -0,0 +1,159 @@
:: :: ::
:::: /hoon/womb/lib :: ::
:: :: ::
/? 310 :: version
/+ talk
:: :: ::
:::: :: ::
:: :: ::
|%
++ foil :: allocation map
|* mold :: entry mold
$: min/@ud :: minimum entry
ctr/@ud :: next allocated
und/(set @ud) :: free under counter
ove/(set @ud) :: free over counter
max/@ud :: maximum entry
box/(map @ud +<) :: entries
== ::
-- ::
|% ::
++ managed :: managed plot
|* mold ::
%- unit :: virgin
%+ each +< :: subdivided
mail :: delivered
:: ::
++ planet :: subdivided planet
(managed (lone (foil moon))) ::
:: ::
++ star :: subdivided star
(managed (pair (foil moon) (foil planet))) ::
:: ::
++ galaxy :: subdivided galaxy
(managed (trel (foil moon) (foil planet) (foil star)))::
:: ::
++ passcode @pG :: 64-bit passcode
++ mail @ta :: email address
++ balance :: invitation balance
$: planets/@ud :: planet count
stars/@ud :: star count
owner/mail :: owner's email
history/(list mail) :: transfer history
== ::
++ client :: per email
$: sta/@ud :: unused star refs
has/(set @p) :: planets owned
== ::
++ property :: subdivided plot
$% {$galaxy galaxy} :: galaxy
{$star star} :: star
{$planet planet} :: planet
== ::
++ invite ::
$: who/mail :: who to send to
pla/@ud :: planets to send
sta/@ud :: stars to send
wel/welcome :: welcome message
== ::
++ welcome :: welcome message
$: intro/tape :: in invite email
hello/tape :: as talk message
== ::
++ reference :: affiliate credit
(unit (each @p mail)) :: ship or email
-- ::
:: :: ::
:::: :: ::
:: :: ::
|%
++ womb-part {$womb $0 womb-pith} :: womb state
++ womb-pith :: womb content
$: boss/(unit @p) :: outside master
bureau/(map passcode balance) :: active invitations
office/(map @p property) :: properties managed
hotel/(map mail client) :: everyone we know
== ::
-- ::
:: :: ::
:::: :: ::
:: :: ::
|% :: arvo structures
++ card ::
$% {$flog wire flog} ::
== ::
++ move (pair bone card) :: user-level move
--
:: :: ::
:::: :: ::
!: :: ::
|= {bowl womb-part} :: main womb work
|_ moz/(list move)
++ abet :: resolve
[(flop moz) +>+>+<+]
::
++ emit |=(card %_(+> moz [[ost +<] moz])) :: return card
++ emil :: return cards
|= (list card)
^+ +>
?~(+< +> $(+< t.+<, +> (emit i.+<)))
::
++ peek
|= {ren/@tas tyl/path}
^- (unit (unit (pair mark *)))
::
:: /shop/planets/@ud (list @p) up to 3 planets
:: /shop/stars/@ud (list @p) up to 3 stars
:: /shop/galaxies/@ud (list @p) up to 3 galaxies
:: /stats general stats dump
:: /stats/@p what we know about @p
:: /invite/passcode invitation status
::
~
::
++ poke-invite :: create invitation
|= {ref/reference inv/invite}
=< abet
?> |(=(our src) =([~ src] boss)) :: me or boss
.
::
++ poke-obey :: set/reset boss
|= who/(unit @p)
=< abet
?> =(our src) :: me only
.
::
++ poke-rekey :: extend will
|= ~
=< abet
?> |(=(our src) =([~ src] boss)) :: privileged
.
::
++ poke-report :: report will
|= {her/@p wyl/will} ::
=< abet
?> =(src src) :: self-authenticated
.
::
++ poke-claim :: claim plot, send ticket
|= {aut/@uvH her/@p} ::
=< abet
?> |=(src src)
.
::
++ poke-
::
++ poke-release :: release to subdivide
|= {gal/@ud sta/@ud} ::
=< abet
?> =(our src) :: privileged
.
::
++ poke-reinvite :: split invitation
|= $: aut/@uvH :: hash w/passcode
inv/invite :: further invite
==
?> =(src src) ::
=< abet
.
--