From 33b993a45a1cb96cfef651e387afe3d7edf15b51 Mon Sep 17 00:00:00 2001 From: Vitaliy Vlasov Date: Mon, 4 Nov 2019 11:51:56 +0200 Subject: [PATCH] Add web3.keycard.signTypedData --- .../app/src/main/res/drawable-hdpi/nfc.png | Bin 0 -> 1315 bytes .../app/src/main/res/drawable-mdpi/nfc.png | Bin 0 -> 940 bytes .../app/src/main/res/drawable-xhdpi/nfc.png | Bin 0 -> 1713 bytes .../app/src/main/res/drawable-xxhdpi/nfc.png | Bin 0 -> 2531 bytes .../app/src/main/res/drawable-xxxhdpi/nfc.png | Bin 0 -> 3272 bytes externs.js | 2 + .../nfc.imageset/Contents.json | 23 ++++ .../Images.xcassets/nfc.imageset/nfc-1.png | Bin 0 -> 1713 bytes .../Images.xcassets/nfc.imageset/nfc-2.png | Bin 0 -> 2531 bytes .../Images.xcassets/nfc.imageset/nfc.png | Bin 0 -> 940 bytes project.clj | 2 +- src/status_im/browser/core.cljs | 10 +- src/status_im/constants.cljs | 6 +- src/status_im/hardwallet/card.cljs | 16 +++ src/status_im/hardwallet/core.cljs | 72 ++++++---- src/status_im/hardwallet/fx.cljs | 4 + src/status_im/signing/core.cljs | 34 +++-- src/status_im/signing/keycard.cljs | 22 +-- src/status_im/subs.cljs | 16 ++- src/status_im/ui/components/button.cljs | 22 +-- src/status_im/ui/screens/popover/views.cljs | 4 + src/status_im/ui/screens/routing/screens.cljs | 1 + src/status_im/ui/screens/signing/styles.cljs | 19 +++ src/status_im/ui/screens/signing/views.cljs | 130 ++++++++++++++++-- translations/en.json | 9 ++ 25 files changed, 319 insertions(+), 73 deletions(-) create mode 100644 android/app/src/main/res/drawable-hdpi/nfc.png create mode 100644 android/app/src/main/res/drawable-mdpi/nfc.png create mode 100644 android/app/src/main/res/drawable-xhdpi/nfc.png create mode 100644 android/app/src/main/res/drawable-xxhdpi/nfc.png create mode 100644 android/app/src/main/res/drawable-xxxhdpi/nfc.png create mode 100644 ios/StatusIm/Images.xcassets/nfc.imageset/Contents.json create mode 100644 ios/StatusIm/Images.xcassets/nfc.imageset/nfc-1.png create mode 100644 ios/StatusIm/Images.xcassets/nfc.imageset/nfc-2.png create mode 100644 ios/StatusIm/Images.xcassets/nfc.imageset/nfc.png diff --git a/android/app/src/main/res/drawable-hdpi/nfc.png b/android/app/src/main/res/drawable-hdpi/nfc.png new file mode 100644 index 0000000000000000000000000000000000000000..57429ac2c517ed0b359d4ac3e8b1f51ac9c8e931 GIT binary patch literal 1315 zcmV+;1>E|HP)AJ}YLcbos&Iux&!14*ioWRbyvBR98?z-(0z3H~@s+*AP z9}-fD!4Qn}WI3<@J&N=Y0B3-ikHI*i0FrbWkBAohi0i5(I?1zxd)fo=?L&O~BOWI; z(ex%en1$M#z(BDbD6yiKhN?5#6Y%Xz+$Q`S!I0y0`8L$P*N|~LP%N51p*^9tMyxPo zjA{rvoMWIvG4Opw6kOgN!}}H+15Zh`#-1U^>F+5zoGF8Fd=#`NASUKS)rFLE%)*$7 zlskrSTtqbTmJdd}xy}x*XwSILp7Mm|Ld>yyF55bWpaB~ZyG^Q#56$d64#1SJ;MRo@ zr_#mNhVW`|gYHWnpd>S;M+DP7lsu7gJLzkfz84m=eeD||z$0=@>pLM%x~tL{qOAsy zBj7UnN>EZXm9p;SoA#$nl)e}A6`^HJbyXS$8}kpC>UH-m$HvVUuoP1@=H)r&>(fp4 zZAKe{l^EMu{fvnlqW6fR47xeGBHKuDn;UCU;&!Os(*RzicW*HP3s7^)_v7@BjnfxS zL!j6hUwHoI2jo|w_HC@V3>K03k?&@txD}WxqX2j%YO1EL)O<&qBk4R(kU3mxn_U;R zKgo^prlv^F!abJwHZT@xnkHCu3^YXm!EK^Y_K%X#fzX3ZCtpUCT3~2 z4Z~@h9lKd*RX!{FfvgUhwM3`tR|){DaVkCxVt6{0?U>TPPnREY)wuq8fkad)*tgk* zjth2QD}+`tTuaU_^=^Px5$TFE%?NRpnb?57lx=MQ=Z;#wmq-X5%@eqmT#>ry>pk|3 zAOxsK({@H&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8QruI7MXlP)cH1>!n>p$ol)Cp>YZ7SlXZ1VsfX3_QXI8Qm)WA zbMMlAf)Wi3ja|%eAXINLxns^k_j9B;ia4uL+D+PzjU`-Y90VGaVlwHQNbW?S^3_sv z*_9$#?gLm3RSU6BO$;Mz^t4Y}4GD7Uk}w5cSMh ze9j2-^BI_5xDguU*ZH`QTn-MjhfMjBcDYl&W2+5rzekNuSJopZM!uT^#e#T=+TEmujQaqxNUr-Y9XA*U6+31Nyx!E+v4 z+k+m1z`hmTgsUS$xZ~a4pwUYVYTR)idoZT9f>InyS6;P2=T?C`e!RmGWJv#2fXV4X zNHQOW?i&Z~n=}N0|4i--0;&B}ATD-etS3%68oYM;M9u#K^6icJ57&lS00000NkvXX Hu0mjfm0}+X literal 0 HcmV?d00001 diff --git a/android/app/src/main/res/drawable-xxhdpi/nfc.png b/android/app/src/main/res/drawable-xxhdpi/nfc.png new file mode 100644 index 0000000000000000000000000000000000000000..36535b29a651cebecefb586e332a488f06a2c3e3 GIT binary patch literal 2531 zcmV<92^{u`P)>3$bppec14urBr?KV$yMOQQSvWUrusBF!$w zhUhpVI^jRZ{CHkbdG==V(}V&MQ2-9_f4E0=HCc6xnR1(%lGDJz%t&IQxBN6&ad`52 zvUi^XV5ld$m?7W~{geg>zAn)QNz38vFuMr4?p_Qz%--GYVunM)t0|@7AytlNce0De z)Dzwe5s~F}0 zh@KO$LL727>gO~t@ajLqiK{18qu_uUawq%nu(qzP{yBIRiR()P#GA?96TZS{Ao*A{ zinz%jJ;soO>|It}U-b#*c%m3V{wY68Hb_F#xcybFB2A4MZD zQ$7OZV?=dzG9;!L3~;KmS5sqm^B@|5Z{iU`EAfdIEVnX53^{>zqa<@mHyE#`IlBsS zhhs%bRvL95L(Y11?l&oY3 z-{_1Kh^l%s`SFx?n88DJrERuki6N-%U_7E7mLT>N@w(ciWQidW#j0y&rDJbGJ1jw5 zVT0wnR!YeNL+)6DgmmnrqXVCbo?uc^-M#$31%~jOsOjRJbm+jP#N4|az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 zoihKL5#y7)ttq6H3~_-9nlgXBQ(evMJ(PpXySn{b8|5UDt+AYv*G9oZgzN}`ZZxg! z_-&MfoiA=sPrnV|{f)FI?%N{Jd3LqX)yWVWmtcKRS5bn!YRr{@6OGpOiK%8l?d^5r zUIhWDJf@b005=enfaFl2OJ#_2gCW&LU%m|>p@GAFwGkK`S7+$h9@PErvr#a4&i7qM zIA&xBt?x$D@Hm2`stIqF^P2CwPVkv?oU5%MnU5*F=0iNc4IoViXyiGId+b5}z_-5R z#Sph0#Ziq8FxnQ>p#i!kyG@Ayc8J~+R8mcgKqJpp$btq2Y+I-Pd$#l%X_Ie?sTHP# zG$((}&=arqvyj%I-ZO?Gj$KTNJcebi6I|l8Sbem9X6IM>BWUPTm|~j*Y#U26qrt}i t7V>>d*AY$EjGIj<+`kK1fT7F~{0}Bg^41-jF!}%h002ovPDHLkV1h;=xv&5L literal 0 HcmV?d00001 diff --git a/android/app/src/main/res/drawable-xxxhdpi/nfc.png b/android/app/src/main/res/drawable-xxxhdpi/nfc.png new file mode 100644 index 0000000000000000000000000000000000000000..5dad02d58b8141bac130d8ee0268408a39a77a7b GIT binary patch literal 3272 zcmV;(3^((MP)@~0drDELIAGL9O(c600d`2O+f$vv5yP6ub;r$Cy4z3DN#>g`@FG?eFNnjZwbES zy38dhR~bOMF+-V>Kyv=Zj7UlIRaufPfF^+-Jv}|$JqZP(DF0PtGocA=MVH2<|@L(+nB8-$g@~HeI!$s+E=rp5t z(+9q{6y9;~LlIwyFy4>{Mv20htn8Q+@U*IC2Wd``Yb2Ct zXJ*ACc2H>~YEg(F#ANZ0T9fr7MFwd(4#5wN>Ve_&e%LR68Rf*QMZtm)MdqaA>~yv_ zqsSoEg1#Un38gQ;FV7#45|t?I)bo&ZNL2G7Mb;t@4L|kINXL||%^R)b35!C84XtBI zRuIvba6^QV=!e;SLiCapz@o5z1Wae5Z%?8iF#a*yJJJe6{0n}F3j%>eVTX;JKtvF2 zpg8?~K!m~W=W9~H5AiWNj5v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i;S~ztCVM(IleoW#4ent2zkhKn9>QfTX^6v*|sf781IV0*!@+p<#N;6_)Z! z*4(t0O{X}Ca~xP^uV_NqC||yk0!6`JNOynx>m>w0$x1Yqh!LdpoEA=)DzAUy$*U&D zlb$1gK}$NQ{Cfw&Fyjh!^ur4+3@V5in2}Dna!G3wd@+!Nm~U_>xIzUgCYxIhN}Lgg zcy%R2?4(d<{OoVX?{B#Mm;;|E;5+YxZ-%-8?7UEcekWqEosg-44!A+jn5xtlGf+Ep zqQ;fYQRePCK|+ju{*4onl&dQ}+_s2Hu%2YLM`#A`6sJ0@-Oix{C@LSgJi*BBy}a?Y zb*_32fpFe#!c+z2U3@_)-Lw?Egxc)~VKS6==o4ah!RAWD?arXQOC&4y8QruI7MXlP)cH1>!n>p$ol)Cp>YZ7SlXZ1VsfX3_QXI8Qm)WA zbMMlAf)Wi3ja|%eAXINLxns^k_j9B;ia4uL+D+PzjU`-Y90VGaVlwHQNbW?S^3_sv z*_9$#?gLm3RSU6BO$;Mz^t4Y}4GD7Uk}w5cSMh ze9j2-^BI_5xDguU*ZH`QTn-MjhfMjBcDYl&W2+5rzekNuSJopZM!uT^#e#T=+TEmujQaqxNUr-Y9XA*U6+31Nyx!E+v4 z+k+m1z`hmTgsUS$xZ~a4pwUYVYTR)idoZT9f>InyS6;P2=T?C`e!RmGWJv#2fXV4X zNHQOW?i&Z~n=}N0|4i--0;&B}ATD-etS3%68oYM;M9u#K^6icJ57&lS00000NkvXX Hu0mjfm0}+X literal 0 HcmV?d00001 diff --git a/ios/StatusIm/Images.xcassets/nfc.imageset/nfc-2.png b/ios/StatusIm/Images.xcassets/nfc.imageset/nfc-2.png new file mode 100644 index 0000000000000000000000000000000000000000..36535b29a651cebecefb586e332a488f06a2c3e3 GIT binary patch literal 2531 zcmV<92^{u`P)>3$bppec14urBr?KV$yMOQQSvWUrusBF!$w zhUhpVI^jRZ{CHkbdG==V(}V&MQ2-9_f4E0=HCc6xnR1(%lGDJz%t&IQxBN6&ad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29b{<6muhWNWaUlh{@vWk3rplG9`RWF-Xj z@ApG$0TFmH{K4ODiz#wFBXDewF$rlg;?Z4~QULforvxy6OZ#jUT?d=sk^%t+zOy#n zxp4&jM){;U+Mw+ZvaY6X4PELnczAfm8U^#d1=f)9AwV67!VN5W$KS*);*t%9F z0-G0GPQf^4++N3`Kt=?a>g9ZqZpIMKJH6;Lg4GAI@+7@c+jh>0`+2}O;?_2&sJ^6N zsx$cvV&f{iGes~n&;~)SsxAc13q5j&*@d{A+6~WNPxiL5imx-ILnhKU3;oFVav@K+ zP%(@G=BsyD1lS?7lvY|`hzsCUag9B;th2G#!X+z_ zL}|XtUM?}DvIbT&?t;hLm<7CUKnIiB7XA`LJof4c9%LCBaL=l}pLt~)5V}_f$0ZN9 zoihKL5#y7)ttq6H3~_-9nlgXBQ(evMJ(PpXySn{b8|5UDt+AYv*G9oZgzN}`ZZxg! z_-&MfoiA=sPrnV|{f)FI?%N{Jd3LqX)yWVWmtcKRS5bn!YRr{@6OGpOiK%8l?d^5r zUIhWDJf@b005=enfaFl2OJ#_2gCW&LU%m|>p@GAFwGkK`S7+$h9@PErvr#a4&i7qM zIA&xBt?x$D@Hm2`stIqF^P2CwPVkv?oU5%MnU5*F=0iNc4IoViXyiGId+b5}z_-5R z#Sph0#Ziq8FxnQ>p#i!kyG@Ayc8J~+R8mcgKqJpp$btq2Y+I-Pd$#l%X_Ie?sTHP# zG$((}&=arqvyj%I-ZO?Gj$KTNJcebi6I|l8Sbem9X6IM>BWUPTm|~j*Y#U26qrt}i t7V>>d*AY$EjGIj<+`kK1fT7F~{0}Bg^41-jF!}%h002ovPDHLkV1h;=xv&5L literal 0 HcmV?d00001 diff --git a/ios/StatusIm/Images.xcassets/nfc.imageset/nfc.png b/ios/StatusIm/Images.xcassets/nfc.imageset/nfc.png new file mode 100644 index 0000000000000000000000000000000000000000..685858afa1fb03d95a43222f4c0e6742e296c29b GIT binary patch literal 940 zcmV;d15^BoP)QEvAPHI!Q(J(111&&e^Cc7NtazqS6CBy;M^ zh^m1sBh*Ij7V9xS%LrP+L6Xx2FWJ!Xb=sX)omwME;)V&OZIU3ELp9g%gg?=eNI$tv z@DouRRdvU&G``d0LK@S^51gH}xKMq-STfhScRU4h5K38ztAhxr#+YN0H zqYI)O-fDOHyTjt-Yb-%TvvfBN&G(c1K^QLr>&}^!P{fWQWTA!RO$rnmnz}SG;dvY; zd90vwgId18_9P@DnKvrX%l#xS;IZNptlTb-(1S*9M8Tf|H9W-iabPNAv|d?q#z+Z; zGbDcOsoPkOxyzB&lZJ?FHFkw+7R=aHAZ9!P%vrZb{{(+8JVf}5(Em%@T;Ti`Bhj-i zZ(LBwQqBE!9Re`|$GK+c&S2fC|`>l`z=I$3cg=Uiq2NA&CjNwK&b6kDzN( zqIi4_YarFe3m)QEh;-ON7^WY*>BV36Vcone-9Y3^J~5jS_AM(=&?}ppHG&|2nT1nwb3lnBs9oCMEXq1bfTbm^rBp+>~qEfPI{5xV0DoV!Il0EVET zpgkgLKbN<(4Pv(UWl03po4P@H5-M77vtvsp)1Wd~gTl;bMmAiH@q()WIW=Rj^l4IM zY;MtR9pZyBy)b2CBe&V?>(qyA--Wc&7LWvwwDq}5B3H($Gds2!D&^XMEkz@0TWzEb zB8I7BN6D(6d>cZGpq$i9o=qdJiTKG1pJ;M0xIcjwU{Zy#3j=-5wb3AA$&B#h3ZGIZ z&;kUMq}|Hy=IALSU#8;^psNn3;=t#LMN2;?uv(kqetW{il>rZc6@CHw*FfPR1?y7) O0000map %)]))))) +(defn install-cash-applet [] + (log/debug "[keycard] install-cash-applet") + (when config/hardwallet-enabled? + (.. keycard + installCashApplet + (then #(re-frame/dispatch [:hardwallet.callback/on-install-applet-success %])) + (catch #(re-frame/dispatch [:hardwallet.callback/on-install-applet-error (error-object->map %)]))))) + (defn init-card [pin] (log/debug "[keycard] init-card") (when config/hardwallet-enabled? @@ -207,3 +215,11 @@ (sign pairing pin hash) (then #(re-frame/dispatch [:hardwallet.callback/on-sign-success %])) (catch #(re-frame/dispatch [:hardwallet.callback/on-sign-error (error-object->map %)]))))) + +(defn sign-typed-data + [{:keys [hash]}] + (when hash + (.. keycard + (signPinless hash) + (then #(re-frame/dispatch [:hardwallet.callback/on-sign-success %])) + (catch #(re-frame/dispatch [:hardwallet.callback/on-sign-error (error-object->map %)]))))) diff --git a/src/status_im/hardwallet/core.cljs b/src/status_im/hardwallet/core.cljs index 10e0fc58a83..63b69b1333d 100644 --- a/src/status_im/hardwallet/core.cljs +++ b/src/status_im/hardwallet/core.cljs @@ -1407,6 +1407,28 @@ (when-not keycard-match? (show-wrong-keycard-alert card-connected?)))))) +(fx/defn sign-typed-data + {:events [:hardwallet/sign-typed-data]} + [{:keys [db] :as cofx}] + (let [card-connected? (get-in db [:hardwallet :card-connected?]) + hash (get-in db [:hardwallet :hash])] + (if card-connected? + {:db (-> db + (assoc-in [:hardwallet :card-read-in-progress?] true) + (assoc-in [:signing/sign :keycard-step] :signing)) + :hardwallet/sign-typed-data {:hash (ethereum/naked-address hash)}} + (fx/merge cofx + (set-on-card-connected :hardwallet/sign-typed-data) + {:db (assoc-in db [:signing/sign :keycard-step] :signing)})))) + +(fx/defn store-hash-and-sign-typed + {:events [:hardwallet/store-hash-and-sign-typed]} + [{:keys [db] :as cofx} result] + (let [{:keys [result error]} (types/json->clj result)] + (fx/merge cofx + {:db (assoc-in db [:hardwallet :hash] result)} + sign-typed-data))) + (fx/defn prepare-to-sign {:events [:hardwallet/prepare-to-sign]} [{:keys [db] :as cofx}] @@ -2026,7 +2048,7 @@ (fx/defn on-sign-success {:events [:hardwallet.callback/on-sign-success]} [{:keys [db] :as cofx} signature] - (log/debug "[hardwallet] sign success: " signature) + (log/info "[hardwallet] sign success: " signature) (let [transaction (get-in db [:hardwallet :transaction]) tx-obj (select-keys transaction [:from :to :value :gas :gasPrice])] (fx/merge cofx @@ -2034,7 +2056,8 @@ (assoc-in [:hardwallet :pin :sign] []) (assoc-in [:hardwallet :pin :status] nil) (assoc-in [:hardwallet :hash] nil) - (assoc-in [:hardwallet :transaction] nil))} + (assoc-in [:hardwallet :transaction] nil) + (assoc-in [:signing/sign :keycard-step] :success))} (clear-on-card-connected) (get-application-info (get-pairing db) nil) (if transaction @@ -2046,25 +2069,28 @@ (fx/defn on-sign-error [{:keys [db] :as cofx} error] (log/debug "[hardwallet] sign error: " error) - (let [tag-was-lost? (= "Tag was lost." (:error error))] - (fx/merge cofx - (when tag-was-lost? - (fn [{:keys [db] :as cofx}] - (fx/merge cofx - {:db (-> db - (assoc-in [:hardwallet :pin :status] nil) - (assoc-in [:signing/sign :keycard-step] :connect)) - :utils/show-popup {:title (i18n/label :t/error) - :content (i18n/label :t/cannot-read-card)}} - (set-on-card-connected :hardwallet/prepare-to-sign)))) - (if (re-matches pin-mismatch-error (:error error)) - (fn [{:keys [db] :as cofx}] - (fx/merge cofx - {:db (-> db - (update-in [:hardwallet :pin] merge {:status :error - :sign [] - :error-label :t/pin-mismatch}) - (assoc-in [:signing/sign :keycard-step] :pin))} - (get-application-info (get-pairing db) nil))) - (show-wrong-keycard-alert true))))) + (let [tag-was-lost? (= "Tag was lost." (:error error)) + pinless? (= :pinless (get-in db [:signing/sign :type]))] + (fx/merge + cofx + (when tag-was-lost? + (fn [{:keys [db] :as cofx}] + (fx/merge cofx + {:db (-> db + (assoc-in [:hardwallet :pin :status] nil) + (assoc-in [:signing/sign :keycard-step] (when pinless? :error :connect))) + :utils/show-popup {:title (i18n/label :t/error) + :content (i18n/label :t/cannot-read-card)}} + (set-on-card-connected (if pinless? :hardwallet/sign-typed-data + :hardwallet/prepare-to-sign))))) + (if (re-matches pin-mismatch-error (:error error)) + (fn [{:keys [db] :as cofx}] + (fx/merge cofx + {:db (-> db + (update-in [:hardwallet :pin] merge {:status :error + :sign [] + :error-label :t/pin-mismatch}) + (assoc-in [:signing/sign :keycard-step] :pin))} + (get-application-info (get-pairing db) nil))) + (show-wrong-keycard-alert true))))) diff --git a/src/status_im/hardwallet/fx.cljs b/src/status_im/hardwallet/fx.cljs index 003afc051bc..e361f6927ee 100644 --- a/src/status_im/hardwallet/fx.cljs +++ b/src/status_im/hardwallet/fx.cljs @@ -94,6 +94,10 @@ :hardwallet/sign card/sign) +(re-frame/reg-fx + :hardwallet/sign-typed-data + card/sign-typed-data) + (re-frame/reg-fx :hardwallet/login-with-keycard status/login-with-keycard) diff --git a/src/status_im/signing/core.cljs b/src/status_im/signing/core.cljs index c2267703139..000933d2762 100644 --- a/src/status_im/signing/core.cljs +++ b/src/status_im/signing/core.cljs @@ -3,12 +3,14 @@ [re-frame.core :as re-frame] [status-im.constants :as constants] [status-im.utils.config :as config] + [taoensso.timbre :as log] [status-im.ethereum.abi-spec :as abi-spec] [status-im.ethereum.json-rpc :as json-rpc] [status-im.ethereum.core :as ethereum] [status-im.ethereum.eip55 :as eip55] [status-im.ethereum.tokens :as tokens] [status-im.i18n :as i18n] + [status-im.signing.keycard :as signing.keycard] [status-im.native-module.core :as status] [status-im.utils.fx :as fx] [status-im.utils.hex :as utils.hex] @@ -174,17 +176,24 @@ (fx/defn show-sign [{:keys [db] :as cofx}] (let [{:signing/keys [queue]} db - {{:keys [gas gasPrice] :as tx-obj} :tx-obj {:keys [data typed?] :as message} :message :as tx} (last queue) + {{:keys [gas gasPrice] :as tx-obj} :tx-obj {:keys [data typed? pinless?] :as message} :message :as tx} (last queue) keycard-multiaccount? (boolean (get-in db [:multiaccount :keycard-pairing])) wallet-set-up-passed? (get-in db [:multiaccount :wallet-set-up-passed?]) updated-db (if wallet-set-up-passed? db (assoc db :popover/popover {:view :signing-phrase}))] (if message - {:db (assoc updated-db - :signing/in-progress? true - :signing/queue (drop-last queue) - :signing/tx tx - :signing/sign {:type (if keycard-multiaccount? :keycard :password) - :formatted-data (if typed? (types/json->clj data) (ethereum/hex-to-utf8 data))})} + (fx/merge + cofx + {:db (assoc updated-db + :signing/in-progress? true + :signing/queue (drop-last queue) + :signing/tx tx + :signing/sign {:type (cond pinless? :pinless + keycard-multiaccount? :keycard + :else :password) + :formatted-data (if typed? (types/json->clj data) (ethereum/hex-to-utf8 data)) + :keycard-step (when pinless? :connect)})} + (when pinless? + (signing.keycard/hash-message message :hardwallet/store-hash-and-sign-typed))) (fx/merge cofx {:db @@ -277,6 +286,11 @@ (when on-error {:dispatch (conj on-error message)}))))) +(fx/defn dissoc-signing-db-entries + {:events [:signing/dissoc-entries]} + [{:keys [db] :as cofx}] + {:db (dissoc db :signing/tx :signing/in-progress? :signing/sign)}) + (fx/defn sign-message-completed {:events [:signing/sign-message-completed]} [{:keys [db] :as cofx} result] @@ -285,7 +299,11 @@ (if error {:db (update db :signing/sign assoc :error (i18n/label :t/wrong-password) :in-progress? false)} (fx/merge cofx - {:db (dissoc db :signing/tx :signing/in-progress? :signing/sign)} + (when-not (= (-> db :signing/sign :type) :pinless) + dissoc-signing-db-entries) + #(when (= (-> db :signing/sign :type) :pinless) + {:dispatch-later [{:ms 3000 + :dispatch [:signing/dissoc-entries]}]}) (check-queue) #(if on-result {:dispatch (conj on-result result)}))))) diff --git a/src/status_im/signing/keycard.cljs b/src/status_im/signing/keycard.cljs index 34ad3b5222b..3f6eaa7b33d 100644 --- a/src/status_im/signing/keycard.cljs +++ b/src/status_im/signing/keycard.cljs @@ -35,12 +35,12 @@ (assoc :nonce nonce)))) (fx/defn hash-message - [_ {:keys [data typed?]}] + [_ {:keys [data typed?]} callback-event] (if typed? {::hash-typed-data {:data data - :on-completed #(re-frame/dispatch [:signing.keycard.callback/hash-message-completed %])}} + :on-completed #(re-frame/dispatch [(or callback-event :signing.keycard.callback/hash-message-completed) %])}} {::hash-message {:message (ethereum/naked-address data) - :on-completed #(re-frame/dispatch [:signing.keycard.callback/hash-message-completed %])}})) + :on-completed #(re-frame/dispatch [(or callback-event :signing.keycard.callback/hash-message-completed) %])}})) (fx/defn hash-message-completed {:events [:signing.keycard.callback/hash-message-completed]} @@ -66,11 +66,11 @@ {:events [:signing.ui/sign-with-keycard-pressed]} [{:keys [db] :as cofx}] (let [message (get-in db [:signing/tx :message])] - (fx/merge cofx - {:db (-> db - (assoc-in [:hardwallet :pin :enter-step] :sign) - (assoc-in [:signing/sign :keycard-step] :pin) - (assoc-in [:signing/sign :type] :keycard))} - (if message - (hash-message message) - (hash-transaction))))) + (fx/merge + cofx + {:db (-> db + (assoc-in [:hardwallet :pin :enter-step] :sign) + (assoc-in [:signing/sign :keycard-step] :pin))} + (if message + (hash-message message nil) + (hash-transaction))))) diff --git a/src/status_im/subs.cljs b/src/status_im/subs.cljs index 7734cb04fb7..a9f2f731287 100644 --- a/src/status_im/subs.cljs +++ b/src/status_im/subs.cljs @@ -181,7 +181,6 @@ ;;signing (reg-root-key-sub :signing/tx :signing/tx) -(reg-root-key-sub :signing/sign :signing/sign) (reg-root-key-sub :signing/edit-fee :signing/edit-fee) ;;intro-wizard @@ -2045,6 +2044,21 @@ (fn [{:keys [signing-phrase]}] signing-phrase)) +(re-frame/reg-sub + :signing/sign + (fn [db] + (let [sign (:signing/sign db)] + (if (= :pinless (:type sign)) + (let [message (get-in sign [:formatted-data :message])] + (if (and (:amount message) (:currency message)) + (assoc sign :fiat-amount + (money/fiat-amount-value (:amount message) + (:currency message) + :USD (:prices db)) + :fiat-currency "USD") + sign)) + sign)))) + (defn- too-precise-amount? "Checks if number has any extra digit beyond the allowed number of decimals. It does so by checking the number against its rounded value." diff --git a/src/status_im/ui/components/button.cljs b/src/status_im/ui/components/button.cljs index b7ade915628..1adc1703ea0 100644 --- a/src/status_im/ui/components/button.cljs +++ b/src/status_im/ui/components/button.cljs @@ -51,7 +51,7 @@ Spec: https://www.figma.com/file/cb4p8AxLtTF3q1L6JYDnKN15/Index?node-id=858%3A0" - [{:keys [label type theme disabled? on-press accessibility-label style container-style] :or {type :main theme :blue}}] + [{:keys [label type theme disabled? on-press accessibility-label style label-style container-style] :or {type :main theme :blue}}] (let [label (utils.label/stringify label)] [react/touchable-opacity (cond-> {:on-press on-press :active-opacity 0.5 @@ -66,16 +66,16 @@ (when (= type :previous) [vector-icons/icon :main-icons/back {:container-style {:width 24 :height 24 :margin-right 4} :color (if disabled? colors/gray colors/blue)}]) - [react/text {:style {:color (cond - disabled? - colors/gray - (#{:main :secondary :next :previous} type) - (case theme - :green colors/green - :red colors/red - colors/blue) - :else - "")}} + [react/text {:style (merge {:color (cond + disabled? + colors/gray + (#{:main :secondary :next :previous} type) + (case theme + :green colors/green + :red colors/red + colors/blue) + :else + "")} label-style)} label] (when (= type :next) [vector-icons/icon :main-icons/next {:container-style {:width 24 :height 24 :margin-left 4} diff --git a/src/status_im/ui/screens/popover/views.cljs b/src/status_im/ui/screens/popover/views.cljs index 5cb9a32c8c8..ce7254b1826 100644 --- a/src/status_im/ui/screens/popover/views.cljs +++ b/src/status_im/ui/screens/popover/views.cljs @@ -8,6 +8,7 @@ [status-im.ui.screens.wallet.request.views :as request] [status-im.ui.screens.profile.user.views :as profile.user] [status-im.ui.screens.multiaccounts.recover.views :as multiaccounts.recover] + [status-im.ui.screens.signing.views :as signing] [status-im.ui.screens.biometric.views :as biometric])) (defn hide-panel-anim @@ -112,6 +113,9 @@ (= :disable-password-saving view) [biometric/disable-password-saving-popover] + (= :transaction-data view) + [signing/transaction-data] + :else [view])]]]]])))}))) diff --git a/src/status_im/ui/screens/routing/screens.cljs b/src/status_im/ui/screens/routing/screens.cljs index 9dadd52eaf8..7e66d76f516 100644 --- a/src/status_im/ui/screens/routing/screens.cljs +++ b/src/status_im/ui/screens/routing/screens.cljs @@ -18,6 +18,7 @@ [status-im.ui.screens.privacy-and-security-settings.views :as privacy-and-security] [status-im.ui.screens.language-settings.views :as language-settings] [status-im.ui.screens.notifications-settings.views :as notifications-settings] + [status-im.ui.screens.signing.views :as signing] [status-im.ui.screens.sync-settings.views :as sync-settings] [status-im.ui.screens.advanced-settings.views :as advanced-settings] [status-im.ui.screens.fleet-settings.views :as fleet-settings] diff --git a/src/status_im/ui/screens/signing/styles.cljs b/src/status_im/ui/screens/signing/styles.cljs index 31e7d724b85..f7bc256af59 100644 --- a/src/status_im/ui/screens/signing/styles.cljs +++ b/src/status_im/ui/screens/signing/styles.cljs @@ -58,3 +58,22 @@ :color (if disabled? colors/black colors/white) :padding-horizontal 16 :padding-vertical 10}) + +(defn sheet-title [small-screen?] + {:font-weight "500" + :font-size (if small-screen? 16 19) + :margin-top 16}) + +(defn sheet-subtitle [small-screen?] + {:font-size (if small-screen? 16 19) + :text-align :center + :margin-bottom 12 + :color colors/gray}) + +(defn sheet-icon [bg-color] + {:height 64 + :width 64 + :border-radius 32 + :justify-content :center + :align-items :center + :background-color bg-color}) diff --git a/src/status_im/ui/screens/signing/views.cljs b/src/status_im/ui/screens/signing/views.cljs index 46b74ec8a24..908f9d69275 100644 --- a/src/status_im/ui/screens/signing/views.cljs +++ b/src/status_im/ui/screens/signing/views.cljs @@ -160,6 +160,105 @@ [react/view {:align-items :center :margin-top 16 :margin-bottom 40} [sign-with-keycard-button nil nil]])]) +(defn signature-request [{:keys [error formatted-data + fiat-amount fiat-currency + keycard-step + in-progress? enabled?] :as sign} small-screen?] + (let [message (:message formatted-data) + title (case keycard-step + :connect :t/looking-for-cards + :signing :t/processing + :error :t/lost-connection + :success :t/success) + subtitle (case keycard-step + :connect :t/hold-card + :signing :t/try-keeping-the-card-still + :error :t/tap-card-again + :success :t/transaction-signed)] + [react/view (assoc styles/message :padding-vertical 16 :align-items :center) + [react/view {:style {:align-self :flex-start :padding-left 16 :margin-bottom 24}} + [react/text {:style {:font-size (if small-screen? 15 17) :font-weight "700"}} + (i18n/label :t/confirmation-request)]] + (when (and (:amount message) (:currency message)) + [react/view {:style {:margin-bottom 24 :align-self :stretch}} + [react/nested-text {:style {:font-weight "500" :font-size (if small-screen? 34 44) + :text-align :center}} + (str (:amount message) " ") + [{:style {:color colors/gray}} (:currency message)]] + [react/text {:style {:font-size 19 :text-align :center + :margin-bottom 16}} + (str fiat-amount " " fiat-currency)] + [separator]]) + [react/view {:style (styles/sheet-icon (case keycard-step + (:connect :signing) colors/blue-transparent-10 + :error colors/red-transparent-10 + :success colors/green-transparent-10))} + (case keycard-step + :connect + [icons/icon :main-icons/nfc {:color colors/blue :width 27 :height 21}] + :signing + [react/activity-indicator {:animating true :color colors/blue}] + :error + [icons/icon :main-icons/close {:color colors/red}] + :success + [icons/icon :main-icons/check {:color colors/green}])] + [react/text {:style (styles/sheet-title small-screen?)} (i18n/label title)] + [react/text {:style (styles/sheet-subtitle small-screen?)} (i18n/label subtitle)] + [button/button {:type :main + :disabled? (= keycard-step :success) + :label-style {:font-size (if small-screen? 18 20)} + :style {:align-self :stretch} + :container-style {:height (if small-screen? 52 64)} + :label (i18n/label :t/show-transaction-data) + :on-press #(re-frame/dispatch [:show-popover {:view :transaction-data}])}] + [button/button {:type :main + :theme :red + :disabled? (= keycard-step :success) + :container-style {:margin-top 8 + :height 64 :margin-bottom 16} + :style {:align-self :stretch} + :label-style {:font-size 20} + :label (i18n/label :t/decline) + :on-press #(re-frame/dispatch [:signing.ui/cancel-is-pressed])}]])) + +(defn- transaction-data-item [{:keys [label data]}] + [react/view + [react/text {:style {:font-size 17 + :line-height 20 + :margin-bottom 8 + :color colors/gray}} + label] + [react/text {:style {:font-size 17 + :line-height 20 + :margin-bottom 24}} + data]]) + +(views/defview transaction-data [] + (views/letsubs + [{:keys [formatted-data]} [:signing/sign]] + [react/view {:style {:flex 1}} + [react/view {:style {:margin-horizontal 24 + :margin-top 24}} + [react/text {:style {:font-size 17 + :font-weight "700"}} + (i18n/label :t/transaction-data)]] + [react/scroll-view {:style {:flex 1 + :margin-horizontal 8 + :padding-horizontal 16 + :padding-vertical 10 + :margin-vertical 14}} + [transaction-data-item {:label "Label" + :data formatted-data}]] + [separator] + [react/view {:style {:margin-horizontal 8 + :margin-vertical 16}} + [button/button {:type :main + :label-style {:font-size 20} + :style {:margin-horizontal 0} + :container-style {:height 64} + :label (i18n/label :t/close) + :on-press #(re-frame/dispatch [:hide-popover])}]]])) + (views/defview password-view [{:keys [type error in-progress? enabled?] :as sign}] (views/letsubs [phrase [:signing/phrase]] (case type @@ -187,19 +286,22 @@ [react/view]))) (views/defview message-sheet [] - (views/letsubs [{:keys [formatted-data type] :as sign} [:signing/sign]] - [react/view styles/message - [react/view styles/message-header - [react/text {:style {:typography :title-bold}} (i18n/label :t/signing-a-message)] - [react/touchable-highlight {:on-press #(re-frame/dispatch [:signing.ui/cancel-is-pressed])} - [react/view {:padding 6} - [react/text {:style {:color colors/blue}} (i18n/label :t/cancel)]]]] - [separator] - [react/view {:padding-top 16 :flex 1} - [react/view styles/message-border - [react/scroll-view - [react/text (or formatted-data "")]]] - [password-view sign]]])) + (views/letsubs [{:keys [formatted-data type] :as sign} [:signing/sign] + small-screen? [:dimensions/small-screen?]] + (if (= type :pinless) + [signature-request sign small-screen?] + [react/view styles/message + [react/view styles/message-header + [react/text {:style {:typography :title-bold}} (i18n/label :t/signing-a-message)] + [react/touchable-highlight {:on-press #(re-frame/dispatch [:signing.ui/cancel-is-pressed])} + [react/view {:padding 6} + [react/text {:style {:color colors/blue}} (i18n/label :t/cancel)]]]] + [separator] + [react/view {:padding-top 16 :flex 1} + [react/view styles/message-border + [react/scroll-view + [react/text (or formatted-data "")]]] + [password-view sign]]]))) (defn amount-item [prices wallet-currency amount amount-error display-symbol fee-display-symbol] (let [converted-value (* amount (get-in prices [(keyword display-symbol) (keyword (:code wallet-currency)) :price]))] @@ -302,4 +404,4 @@ (when tx (select-keys tx [:from :contact :amount :token :approve? :message])) #(if (:message %) [message-sheet] - [sheet %])])) \ No newline at end of file + [sheet %])])) diff --git a/translations/en.json b/translations/en.json index 362ce553b97..8886a27ae14 100644 --- a/translations/en.json +++ b/translations/en.json @@ -146,6 +146,7 @@ "clear-history-confirmation": "Clear history?", "clear-history-confirmation-content": "Are you sure you want to clear this chat history?", "clear-history-title": "Clear history?", + "close": "Close", "close-app-button": "Confirm", "close-app-content": "The app will stop and close. When you reopen it, the selected network will be used", "close-app-title": "Warning!", @@ -159,6 +160,7 @@ "completing-card-setup": "Completing card setup", "confirm": "Confirm", "confirm-install": "Confirm Install", + "confirmation-request": "Confirmation request", "confirmations": "Confirmations", "confirmations-helper-text": "When the transaction has 12 confirmations you can consider it settled.", "connect": "Connect", @@ -633,6 +635,8 @@ "logout-app-content": "The account will be logged out. When you unlock it again, the selected network will be used", "logout-are-you-sure": "Are you sure you want\nto log out?", "logout-title": "Log out?", + "looking-for-cards": "Looking for cards...", + "lost-connection": "Lost connection", "mailserver-address": "Mailserver address", "mailserver-automatic": "Automatic selection", "mailserver-connection-error": "Could not connect to mailserver", @@ -954,6 +958,7 @@ "show-less": "Show less", "show-more": "Show more", "show-qr": "Show QR code", + "show-transaction-data": "Show transaction data", "sidechain-text": "You’re on the {{sidechain}} Sidechain.", "sign-and-send": "Sign and send", "sign-in": "Unlock", @@ -1000,6 +1005,7 @@ "sync-synced": "In sync", "syncing-devices": "Syncing...", "tag-was-lost": "Tag was lost", + "tap-card-again": "Tap the card to the back of your phone again", "taking-long-hold-phone-connected": "This will take a few seconds.\n Hold card connected to the phone.", "test-networks": "Test networks", "testnet-text": "You’re on the {{testnet}} Testnet. Do not send real ETH or SNT to your address", @@ -1020,6 +1026,7 @@ "token-details": "Token details", "topic-name-error": "Use only lowercase letters (a to z), numbers & dashes (-). Do not use chat keys", "transaction": "Transaction", + "transaction-data": "Transaction data", "transaction-declined": "Transaction declined", "transaction-description": "Consider it complete after 12 confirmations on the network.", "transaction-details": "Transaction details", @@ -1027,6 +1034,7 @@ "transaction-history": "Transaction history", "transaction-request": "Transaction Request", "transaction-sent": "Transaction sent", + "transaction-signed": "The transaction has been successfully signed", "transactions": "Transactions", "transactions-filter-select-all": "Select all", "transactions-filter-title": "Filter history", @@ -1065,6 +1073,7 @@ "tribute-to-talk-tribute-received2": " are now contacts and can securely chat with each other.", "tribute-to-talk-you-require-snt": "You require SNT for new people to start a chat.", "try-again": "Try again", + "try-keeping-the-card-still": "Try keeping the card still", "turn-nfc-on": "Turn NFC on to continue", "type-a-message": "Type a message...", "ulc-enabled": "ULC enabled",