From 1a61fe43786e198587f6db9c50968736d75798a1 Mon Sep 17 00:00:00 2001 From: Anton Dyudin Date: Thu, 4 Feb 2016 15:03:51 -0800 Subject: [PATCH] added |init-oauth2 secrets dialog --- ape/hood.hoon | 1 + gen/hood/init-oauth2.hoon | 33 +++++++++++++++++++++++++++++++++ lib/write.hoon | 5 +++++ sec/com/googleapis/www.hoon | 2 +- 4 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 gen/hood/init-oauth2.hoon diff --git a/ape/hood.hoon b/ape/hood.hoon index 33b1a0946..4ab0b47a0 100644 --- a/ape/hood.hoon +++ b/ape/hood.hoon @@ -127,6 +127,7 @@ ++ poke-kiln-overload (wrap poke-overload):from-kiln ++ poke-kiln-unmount (wrap poke-unmount):from-kiln ++ poke-kiln-unsync (wrap poke-unsync):from-kiln +++ poke-write-sec-atom (wrap poke-sec-atom):from-write ++ poke-write-paste (wrap poke-paste):from-write ++ poke-will (wrap poke-will):from-helm ++ quit-drum-phat (wrap quit-phat):from-drum diff --git a/gen/hood/init-oauth2.hoon b/gen/hood/init-oauth2.hoon new file mode 100644 index 000000000..3bf35da84 --- /dev/null +++ b/gen/hood/init-oauth2.hoon @@ -0,0 +1,33 @@ +:: +:::: /hoon/init-oauth2/hood/gen + :: +/? 314 +/- sole +:: +:::: + !: +[sole .] +:- %ask +|= $: [now=@da eny=@uvI bec=beak] + [arg=$|(~ [dom=path ~])] + ~ + == +^- (sole-result ,[%write-sec-atom p=host q=@]) +=- ?~ arg - + (fun.q.q [%& dom.arg]) +%+ sole-lo + [%& %oauth-hostname "api hostname: https://"] +%+ sole-go thos:urlp +|= hot=host +?: ?=(%| -.hot) + ~|(%ips-unsupported !!) +%+ sole-lo + [%& %oauth-client "client id: "] +%+ sole-go (boss 256 (star prn)) +|= cid=@t +%+ sole-lo + [%& %oauth-secret "client secret: "] +%+ sole-go (boss 256 (star prn)) +|= cis=@t +%+ sole-so %write-sec-atom :: XX typed pair +[hot (role cid cis ~)] diff --git a/lib/write.hoon b/lib/write.hoon index e5da87271..14dff0eae 100644 --- a/lib/write.hoon +++ b/lib/write.hoon @@ -37,6 +37,11 @@ |= [typ=?(%hoon %md %txt) txt=@t] ^+ abet (poke--data [`typ /web/paste/(scot %da now)] %mime / (taco txt)) :: +++ poke-sec-atom + |= [hot=host dat=@] + ?> ?=(%& -.hot) + (poke--data [`%atom [%sec p.hot]] %mime / (taco dat)) +:: ++ poke--data |= [[ext=(unit ,@t) pax=path] dat=data] ^+ abet ?~ ext $(ext [~ -.dat]) diff --git a/sec/com/googleapis/www.hoon b/sec/com/googleapis/www.hoon index 37d00b1e1..a9de37985 100644 --- a/sec/com/googleapis/www.hoon +++ b/sec/com/googleapis/www.hoon @@ -17,7 +17,7 @@ =< .(state-usr &) %- oauth2 =- [[`/com/google/accounts /o/oauth2/v2/auth -] /oauth2/v4/token] - :~ login-hint/(crip (rash lon suffix-email)) + :~ login-hint/?~(lon '' (crip (rash lon suffix-email))) access-type/%offline response-type/%code ==