uses :hall as the notification channel for :acme
-/- asn1
+/- asn1, hall
/+ base64, der, primitive-rsa, *pkcs, *jose
=, eyre
=* rsa primitive-rsa
:: +card: output effect payload
::
+$ card
- $% [%flog wire flog:dill]
- [%hiss wire ~ %httr %hiss hiss:eyre]
+ $% [%hiss wire ~ %httr %hiss hiss:eyre]
+ [%poke wire dock poke]
[%rule wire %cert (unit [wain wain])]
[%wait wire @da]
[%well wire path (unit mime)]
==
+:: +poke: outgoing app pokes
+::
++$ poke
+ $% [%hall-action %phrase audience:hall (list speech:hall)]
+ ==
:: +nonce-next: next effect to emit upon receiving nonce
::
+$ nonce-next
%+ add
(mul ~s1 (bex (dec try)))
(mul ~s0..0001 (~(rad og eny.bow) 1.000))
+:: +notify: send :hall notification
+::
+++ notify
+ |= [=cord =tang]
+ ^- card
+ =/ msg=speech:hall
+ :+ %app dap.bow
+ =/ line [%lin & cord]
+ ?~(tang line [%fat [%tank tang] line])
+ =/ act
+ [%phrase (sy [our.bow %inbox] ~) [msg ~]]
+ [%poke / [our.bow %hall] %hall-action act]
:: +request: unauthenticated http request
::
++ request
:: XX remove next-order, cancel pending requests
:: XX more detailed error message
::
- =/ msg=tape
- "unable to reach {(trip (join '.' turf.i.item))}"
- (emit [%flog / %text msg])
+ =/ msg=cord
+ %+ rap 3
+ :~ 'unable to reach ' (scot %p our.bow)
+ ' via http at ' (join '.' turf.i.item) ':80'
+ ==
+ (emit (notify msg ~))
?: ?=(~ (skip ~(tap by u.next-order) |=([* * valid=? *] valid)))
new-order:effect
(validate-domain:effect +(idx))
:: archive live config
::
=? fig.hit ?=(^ liv) [u.liv fig.hit]
+ :: save new live config, clear active order
::
- =/ msg=tape
- =- "received https certificate for {(trip -)}"
- (join ', ' (turn ~(tap in dom.u.rod) |=(a=turf (join '.' a))))
- %. [%flog / %text msg]
- =< emit
- :: set live config, install certificate, set renewal timer
+ => .(liv (some fig), rod ~)
+ ?> ?=(^ liv)
+ :: notify :hall
+ ::
+ => =/ msg=cord
+ %+ rap 3
+ :~ 'received https certificate for '
+ (join ', ' (turn ~(tap in dom.u.liv) |=(a=turf (join '.' a))))
+ ==
+ (emit (notify msg ~))
+ :: set renewal timer, install certificate in %eyre
::
=< install:effect
- (retry:effect(liv `fig, rod ~) /renew ~d60)
+ (retry:effect /renew ~d60)
:: +get-authz: accept ACME service authorization object
::
++ get-authz
this
=. ..this (queue-next-order | dom)
=. ..this cancel-current-order
- =/ msg=tape
- =- "requesting an https certificate for {(trip -)}"
+ :: notify :hall
+ ::
+ =. ..this
+ =/ msg=cord
+ %+ rap 3
+ :~ 'requesting an https certificate for '
(join ', ' (turn ~(tap in dom) |=(a=turf (join '.' a))))
- %. [%flog / %text msg]
- =< emit
+ ==
+ (emit (notify msg ~))
:: if registered, create order
::
?^ reg.act
