implements %dawn boot in %jael, removes %ames boot

This commit is contained in:
Joe Bryan 2018-09-06 21:41:16 -04:00
parent afed20286c
commit ffaf83895c
5 changed files with 184 additions and 105 deletions

29
gen/key.hoon Normal file
View File

@ -0,0 +1,29 @@
:: Create a private key-file
::
/- *sole
::
:- %ask
|= $: {now/@da eny/@uvJ bec/beak}
{{who/ship ~} ~}
==
^- (sole-result (cask cord))
%+ sole-yo leaf+"generating keys for {(scow %p who)} (#{(scow %ud who)})"
%+ sole-lo [%| %pope-pass "passphrase: "]
%+ sole-go (boss 256 (star prn))
|= fra/@t
=/ bur (shaz (add who (shaz fra)))
=/ cub (pit:nu:crub:crypto 512 bur)
::
=/ pub=pass pub:ex:cub
=/ mag=cord (end 3 1 pub)
?> =('b' mag)
=/ bod=@ (rsh 3 1 pub)
=/ cry=@ (rsh 8 1 bod)
=/ sgn=@ (end 8 1 bod)
%+ sole-yo leaf+" authentication: 0x{(render-hex-bytes:ethereum 32 sgn)}"
%+ sole-yo leaf+" networking: 0x{(render-hex-bytes:ethereum 32 cry)}"
%+ sole-yo leaf+"ethereum public keys:"
::
=/ sed=seed:able:jael
[who 1 sec:ex:cub ~]
%- sole-so [%atom (scot %uw (jam sed))]

View File

@ -962,59 +962,6 @@
|%
++ am :: am
|_ [now=@da fox=fort] :: protocol engine
++ boot :: boot:am
^- fort :: restore from noun
%= fox
urb.ton
%- ~(gas by *(map ship sufi))
%+ turn
~(tap by urb.ton.fox)
|= [p=ship q=sufi] ^- [p=ship q=sufi]
:- p
%= q
val
(turn val.q |=([p=life q=ring r=acru] [p q (nol:nu:crub:crypto q)]))
==
==
++ come :: come:am
|= [ges=(unit @t) wid=@ bur=@ fak=?] :: instantiate pawn
^- [p=[p=ship q=@uvG] q=fort]
=+ loy=(pit:nu:crub:crypto wid bur)
=+ rig=sec:ex:loy
=+ our=`@p`fig:ex:loy
=+ syp=[[0 ~ our now] [%en %pawn ges] pub:ex:loy]
:- [our pac:ex:loy]
%_ fox
ton
%^ ~(ha go ton.fox)
our
`mace`[[0 rig] ~]
`wyll`[[(sign:as:loy (shaf %self (sham syp))) syp fak] ~]
fak.ton
fak
==
::
++ czar !: :: czar:am
|= [our=ship ger=@uw fak=?] :: instantiate emperor
^- [p=(list boon) q=fort]
=+ ^= loy
?: fak
:: fake uses carrier number as seed
::
(pit:nu:crub:crypto 512 our)
(pit:nu:crub:crypto 512 ger)
=+ fim==(fig:ex:loy (zeno our))
?: &(!fak !fim) !! :: not fake & bad fig
=+ mac=`mace`[[0 sec:ex:loy] ~]
=+ syp=`step`[`bray`[0 ~ our now] [%en %czar ~] pub:ex:loy]
=+ ded=`deyd`[(sign:as:loy (shaf %self (sham syp))) syp fak]
=+ buq=`buck`[mac [ded ~]]
=: ton.fox (~(ha go ton.fox) our buq)
zac.fox (~(put by zac.fox) our *corn)
fak.ton.fox fak
==
[[[%beer our pac:ex:loy] ~] fox]
::
++ gnaw :: gnaw:am
|= [kay=cape ryn=lane pac=rock] :: process packet
^- [p=(list boon) q=fort]
@ -1046,14 +993,6 @@
=. sox $(wab.q.n.zac.fox r.wab.q.n.zac.fox)
[[p.n.zac.fox p.n.wab.q.n.zac.fox] sox]
::
++ have :: have:am
|= [our=ship buq=buck] :: acquire license
^- [p=(list boon) q=fort]
=: ton.fox (~(ha go ton.fox) our buq)
zac.fox (~(put by zac.fox) our *corn)
==
[[[%beer our pac:ex:q:sen:(need (~(us go ton.fox) our))] ~] fox]
::
++ kick :: kick:am
|= hen=duct :: refresh net
=+ aks=(turn ~(tap by urb.ton.fox) |=([p=ship q=sufi] p))
@ -1438,6 +1377,10 @@
=/ rol=rill (fall (~(get by ryl.bah) cha) *rill)
=/ sex=@ud sed.rol
:: ~& [%tx [our her] cha sex]
:: if we don't have a public key for :her,
:: request keys and proceed (skin will be %open)
::
=? bin =(~ lew.wod.dur.diz) :_(bin [%beer our her])
=. ryl.bah
%+ ~(put by ryl.bah) cha
%= rol
@ -1609,15 +1552,9 @@
^- [(list move) fort]
?- -.bon
%beer
:_ fox(zac (~(put by zac.fox) p.bon `corn`[hen ~ ~ ~]))
:* [hen [%slip %c %init p.bon]]
[hen [%give %init p.bon]]
[hen [%slip %a %kick now]]
[hen [%slip %e %init p.bon]]
[hen [%slip %g %init p.bon]]
[hen [%slip %d %init p.bon]] :: must be after gall
~
==
=/ wir=wire
/our/(scot %p p.p.bon)/her/(scot %p q.p.bon)/now/(scot %da now)
:_ fox [hen [%pass wir %j %pubs p.p.bon q.p.bon]]~
::
%cake
:: ~? ?=(^ r.bon) [%cake-woot-bad hen r.bon]
@ -1634,7 +1571,7 @@
%milk
:: ~& [%milk p.bon q.bon]
?> ?=([@ @ *] q.q.bon)
?> ?=(?(%a %c %e %g) i.q.q.bon)
?> ?=(?(%a %c %e %g %j) i.q.q.bon)
=+ pax=[(scot %p p.p.bon) (scot %p q.p.bon) q.q.bon]
:_ fox [hen %pass pax i.q.q.bon %west p.bon t.q.q.bon r.bon]~
::
@ -1642,6 +1579,11 @@
:: ~& [%send now p.bon `@p`(mug (shaf %flap q.bon))]
:_ fox
[[gad.fox [%give %send p.bon q.bon]] ~]
::
%sake
=/ wir=wire
/our/(scot %p p.bon)/now/(scot %da now)
:_ fox [hen [%pass wir %j %vein p.bon]]~
::
%wine
:_ fox
@ -1662,9 +1604,35 @@
^- [(list move) _+>]
?- +<.sih
%crud [[[hen [%slip %d %flog +.sih]] ~] +>]
::
%mack ?~ +>.sih $(sih [%g %nice ~]) :: XX using old code
$(sih [%g %mean `[%mack +>+.sih]])
::
%pubs
?. ?=([%our @ %her @ %now @ ~] tea)
~& [%strange-pubs tea]
[~ +>]
~& [%hear-pubs tea sih]
=/ our=ship (slav %p i.t.tea)
=/ her=ship (slav %p i.t.t.t.tea)
=/ now=@da (slav %da i.t.t.t.t.t.tea)
:: XX update hoc : urb.ton.fox with public key
::
[~ +>.$]
::
%unto [~ +>]
::
%vein
?. ?=([%our @ %now @ ~] tea)
~& [%strange-vein tea]
[~ +>]
~& [%hear-vein tea sih]
=/ our=ship (slav %p i.t.tea)
=/ now=@da (slav %da i.t.t.t.tea)
:: XX update urb.ton.fox with private key
::
[~ +>.$]
::
%woot [~ +>]
?(%mean %nice) :: XX obsolete
?: ?=([%ye ~] tea)
@ -1714,8 +1682,6 @@
?- -.kyz
%barn
[~ fox(gad hen)]
%cash
(~(have am [now fox]) p.kyz q.kyz)
::
%hear
(~(gnaw am [now fox]) %good p.kyz q.kyz)
@ -1725,19 +1691,21 @@
::
%hole
(~(gnaw am [now fox]) %dead p.kyz q.kyz)
::
%init
~& %ames-init
:: XX initialize corn here, or wait for %vein?
::
:: fox(zac (~(put by zac.fox) p.kyz `corn`[hen ~ ~ ~]))
:_ fox [%sake p.kyz]~
::
:: XX confirm unused, remove
::
%junk
[~ fox(any.ton (shax (mix any.ton.fox p.kyz)))]
::
%kick
(~(kick am [now fox(hop p.kyz)]) hen)
::
%make
=+ vun=(~(come am [now fox]) p.kyz (bex q.kyz) r.kyz s.kyz)
[[[%beer p.vun] ~] q.vun]
::
%sith
(~(czar am [now fox]) p.kyz q.kyz r.kyz)
::
%tend
:: XX exclude comets and moons? and planets?

View File

@ -36,9 +36,7 @@
== ::
++ move {p/duct q/(wind note gift:able)} :: local move
++ note-ames :: weird ames move
$% {$make p/(unit @t) q/@ud r/@ s/?} ::
{$sith p/@p q/@uw r/?} ::
{$wegh $~} ::
$% {$wegh $~} ::
== ::
++ note-behn ::
$% {$wegh $~} ::
@ -70,6 +68,14 @@
{$deal p/sock q/cush:gall} ::
{$wegh $~} ::
== ::
++ note-jael ::
$% $: %dawn :: boot from keys
=seed:able:jael :: identity params
spon=(unit ship) :: sponsor
czar=(map ship [=life =pass]) :: galaxy table
turf=(list (pair @ud (list @ta))) :: domains
:: XX wegh
== == ::
++ note :: out request $->
$% {$a note-ames} ::
{$b note-behn} ::
@ -78,11 +84,11 @@
{$e note-eyre} ::
{$f note-ford} ::
{$g note-gall} ::
{$j note-jael} ::
== ::
++ sign-ames ::
$% {$nice $~} ::
{$send p/lane:ames q/@} ::
{$init p/ship} ::
{$mass p/mass} ::
== ::
++ sign-behn ::
@ -109,6 +115,9 @@
{$unto p/cuft:gall} ::
{$mass p/mass} ::
== ::
++ sign-jael ::
$% [%init p=ship] ::
== ::
++ sign :: in result $<-
$% {$a sign-ames} ::
{$b sign-behn} ::
@ -117,6 +126,7 @@
{$e sign-eyre} ::
{$f sign-ford} ::
{$g sign-gall} ::
{%j sign-jael} ::
==
:::::::: :: dill tiles
--
@ -397,7 +407,7 @@
:: ~& [%take-nice-ames sih]
+>
::
{$a $init *}
[%j %init *]
+>(moz :_(moz [hen %give +.sih]))
::
{$a $send *}
@ -508,24 +518,39 @@
((hard task:able) q.hic)
==
?: ?=($boot -.q.hic)
:_(..^$ [hen %pass ~ (note %a p.q.hic)]~)
?> ?=(%dawn -.p.q.hic)
:: XX clamming - use +hard or something?
:: XX just save default duct here?
::
:_(..^$ [hen %pass / (note %j p.q.hic)]~)
?: ?=($flog -.q.hic)
:: ~& [%dill-flog +.q.hic]
:: XX obsolete, remove (and from helm)
::
?: ?=({$crud $hax-init {$leaf *} ~} p.q.hic)
=+ him=(slav %p (crip p.i.q.p.q.hic))
:_(..^$ ?~(hey.all ~ [u.hey.all %give %init him]~))
:: XX is this just a means to hide %helm from other apps?
::
?: ?=({$crud $hax-heft ~} p.q.hic)
:_(..^$ ?~(hey.all ~ [u.hey.all %slip %d %heft ~]~))
:: XX why send indirect moves to ourself this way?
::
:_(..^$ ?~(hey.all ~ [u.hey.all %slip %d p.q.hic]~))
=. hey.all ?^(hey.all hey.all `hen)
?: ?=($init -.q.hic)
:: ~& [%cnhp-init hen]
?: =(ore.all `p.q.hic)
:: XX duplicate init, remove, negative assert, or ignore?
::
~& [%dill-dupe-init ore.all hen q.hic]
[[hen %give q.hic]~ ..^$]
=: ore.all `p.q.hic
dug.all ~
==
=^ moz all abet:(need (ax (need hey.all) [%flow %hood ~]))
:: XX why %give %init here either way?
::
?: |((lth p.q.hic 256) (gte p.q.hic (bex 64))) [moz ..^$] :: XX HORRIBLE
[:_(moz [(need hey.all) %give %init p.q.hic]) ..^$]
=+ nus=(ax hen q.hic)
@ -562,8 +587,11 @@
|= {tea/wire hen/duct hin/(hypo sign)}
^+ [p=*(list move) q=..^$]
?: =(~ ore.all)
?: ?=({$a $init *} q.hin)
:: ~& [%take-init hen]
:: note: required to establish default duct
::
:: XX dedupe with take:as and +call
::
?: ?=([%j %init *] q.hin)
=. hey.all ?^(hey.all hey.all `hen)
[[[hen %give +.q.hin] ~] ..^$]
:: [~ ..^$]

View File

@ -647,6 +647,43 @@
%+ cure our.tac
abet:abet:(deal:(burb our.tac) p.tac [~ q.tac])
::
:: boot from keys
:: {$dawn =seed spon=(unit ship) czar=(map ship [=life =pass]) turf=(list (pair @ud turf))}
::
%dawn
=* our who.seed.tac
:: our initial private key, as a +tree of +rite
::
=/ rit (sy [%jewel (my [lyf.seed.tac key.seed.tac] ~)] ~)
=. +>.$ $(tac [%mint our our rit])
:: our initial galaxy table as a +map from +life to +public
::
=/ kyz
%- ~(run by czar.tac)
|=([=life =pass] `public`[live=| life (my [life pass] ~)])
=. +>.$
%- curd =< abet
(pubs:~(feel su our urb sub etn) kyz)
:: XX sponsor
:: XX turf
=. moz
%+ weld moz
:: order is crucial!
::
:: %dill must init after %gall (and after %give intended for unix)
:: %jael init must be deferred post %eyre init
::
^- (list move)
:~ [hen %pass /(scot %p our)/init %b %wait +(now.sys)]
[hen %slip %d %init our]
[hen %give %init our]
[hen %slip %g %init our]
[hen %slip %e %init our]
[hen %slip %c %init our]
[hen %slip %a %init our]
==
+>.$
::
:: remote update
:: {$hail p/ship q/remote}
::
@ -798,8 +835,12 @@
(~(sigh et our now.sys etn.lex) wir p.hin)
::
[%b %wake ~]
%+ cute our =< abet
~(wake et our now.sys etn.lex)
%+ cute our
:: XX cleanup
::
?: ?=([%init ~] wir)
abet:(~(init et our now.sys etn.lex) our)
abet:~(wake et our now.sys etn.lex)
::
[%j %vent *]
%+ cute our =< abet

View File

@ -457,17 +457,19 @@
== == ::
$: $a :: to %ames
$% {$kick p/@da} ::
== == ::
$: %j :: to %jael
$% [%pubs our=ship who=ship] :: view public keys
[%vein our=ship] :: view private keys
== == ::
$: $g :: to %gall
$% {$deal p/sock q/cush:gall} ::
== == ::
$: @tas :: to any
$% {$init p/@p} ::
{$west p/sack q/path r/*} ::
$% {$west p/sack q/path r/*} ::
== == == ::
++ gift :: out result <-$
$% {$hear p/lane q/@} :: receive packet
{$init p/@p} :: report install
{$mack p/(unit tang)} ::
{$mass p/mass} :: memory usage
{$rove p/ship q/lane} :: lane change
@ -475,7 +477,11 @@
{$woot p/ship q/coop} :: reaction message
== ::
++ sign :: in result _<-
$% $: $g :: from %gall
$% $: %j :: from %jael
$% [%pubs public:able:jael] :: public keys
[%vein =life vein=(map life ring)] :: private keys
== == ::
$: $g :: from %gall
$% {$unto p/cuft:gall} ::
{$mean p/ares} :: XX old clean up
{$nice ~} ::
@ -488,15 +494,13 @@
++ task :: in request ->$
$% {$barn ~} :: new unix process
{$crud p/@tas q/(list tank)} :: error with trace
{$cash p/@p q/buck} :: civil license
{$hear p/lane q/@} :: receive packet
{$halo p/lane q/@ r/ares} :: hole with trace
{$hole p/lane q/@} :: packet failed
[%init p=ship] :: report install
{$junk p/@} :: entropy
{$kick p/@da} :: wake up
{$nuke p/@p} :: toggle auto-block
{$make p/(unit @t) q/@ud r/@ s/?} :: wild license
{$sith p/@p q/@uw r/?} :: imperial generator
{$tend ~} :: watch lane changes
{$wake ~} :: timer activate
{$wegh ~} :: report memory
@ -537,12 +541,13 @@
ryl/(map path rill) :: statements outbound
== ::
++ boon :: fort output
$% {$beer p/ship q/@uvG} :: gained ownership
$% {$beer p/sock} :: request public keys
{$cake p/sock q/soap r/coop s/duct} :: e2e message result
{$maze p/ship q/lane} :: lane change
{$mead p/lane q/rock} :: accept packet
{$milk p/sock q/soap r/*} :: e2e pass message
{$ouzo p/lane q/rock} :: transmit packet
{$sake p/ship} :: our private keys
{$wine p/sock q/tape} :: notify user
== ::
++ bray {p/life q/(unit life) r/ship s/@da} :: our parent us now
@ -2015,7 +2020,8 @@
del/bump :: change
== == ::
++ gift :: out result <-$
$% [%mack p=(unit tang)] :: message n/ack
$% [%init p=ship] :: report install unix
[%mack p=(unit tang)] :: message n/ack
[%pubs public] :: public keys
{$vest p/tally} :: balance update
[%vein =life vein=(map life ring)] :: private keys
@ -2029,6 +2035,7 @@
[%e %hiss p=(unit user) q=mark r=cage] :: outbound user req
[%a %want p=sock q=path r=*] :: send message
[%j %vent-result p=chain] :: tmp workaround
[@tas %init p=ship] :: report install
== ::
++ public :: public key state
$: live=? :: seen in current era
@ -2038,7 +2045,10 @@
++ remote :: remote notification
%+ each safe :: &/addition
safe :: |/replacement
:: ::
:: +seed: private boot parameters
::
+$ seed [who=ship lyf=life key=ring sig=(unit oath:pki)]
::
++ sign :: in result $<-
$% {$b $wake ~} :: wakeup
[%e %sigh p=cage] :: marked http response
@ -2052,6 +2062,12 @@
+= task :: in request ->$
$% [%burn our=ship p=ship q=safe] :: destroy rights
[%hail our=ship p=ship q=remote] :: remote update
$: %dawn :: boot from keys
=seed:able:jael :: identity params
spon=(unit ship) :: sponsor
czar=(map ship [=life =pass]) :: galaxy table
turf=(list (pair @ud (list @ta))) :: domains
== ::
[%init our=ship] :: initialize urbit
[%look our=ship src=(each ship purl:eyre)] :: set ethereum source
[%mint our=ship p=ship q=safe] :: create rights
@ -7943,9 +7959,6 @@
:: +live: public network state of a ship
::
+$ live (unit [=life breach=?])
:: +seed: private boot parameters
::
+$ seed [who=ship lyf=life key=ring sig=(unit oath:pki:jael)]
--
|%
:: |give:dawn: produce requests for pre-boot validation
@ -8038,8 +8051,8 @@
:: +veri:dawn: validate keys, life, discontinuity, &c
::
++ veri
|= [=seed =hull:constitution:ethe =live]
^- $% [%& ^seed (unit ship)]
|= [=seed:able:jael =hull:constitution:ethe =live]
^- $% [%& seed:able:jael (unit ship)]
[%| rank:ames @tas]
==
=/ rac (clan:title who.seed)