package Ġme . uport . sdk . jwt Ċ Ċ import Ġassert k . assertThat Ċ import Ġassert k . assertions .* Ċ import Ġio . mock k . co Every Ċ import Ġio . mock k . mock k Object Ċ import Ġio . mock k . spy k Ċ import Ġkotlinx . coroutines . run Blocking Ċ import Ġme . uport . sdk . eth rd id . E thr DID Document Ċ import Ġme . uport . sdk . eth rd id . E thr DID Network Ċ import Ġme . uport . sdk . eth rd id . E thr DID Resolver Ċ import Ġme . uport . sdk . jsonrpc . Json RPC Ċ import Ġme . uport . sdk . jwt . JWT Utils . Companion . normalize Known DID Ċ import Ġme . uport . sdk . jwt . model . Jwt Payload Ċ import Ġme . uport . sdk . jwt . test . E thr DID Test Helpers Ċ import Ġme . uport . sdk . signer . KP Signer Ċ import Ġme . uport . sdk . test helpers . Test Time Provider Ċ import Ġme . uport . sdk . test helpers . co Assert Ċ import Ġme . uport . sdk . universal did . Universal DID Ċ import Ġme . uport . sdk . uport did . U port DID Document Ċ import Ġorg . junit . Test Ċ Ċ class ĠJWT Tools JVM Test Ġ{ ĊĊĠĠĠ Ġprivate Ġval Ġtokens Ġ= ĠlistOf ( ĊĠĠĠĠĠĠĠ Ġ" ey J 0 e X Ai OiJ KV 1 Qi LCJ hb G ci OiJ FU z I 1 Nk st Ui J 9 . ey Jp YX Qi Oj E 1 Mz Uw M TY 3 MD IsIm V 4 c CI 6 MT Uz N TE w Mz Ew Mi wi YX Vk Ijoi Z Gl k Om V 0 a HI 6 MH hh O WU z Mj My Yj Yx Ym Ri Nj cy Nz Ey Y jl h Z TM z MT k 1 MD Y 5 ZD hk Nj Ux Yz Fh Iiw id H lw Z SI 6 In No YX Jl U mV zc C IsIm 5 h ZCI 6 Ij Jv ZH pq V GF p OF Jv NF Yz S 3 hr b T NT bl pp d jl X U 1 l 1 Tm 9 a NE Fo Iiw ib 3 du I jp 7 Im 5 hb W Ui OiJ 1 UG 9 yd CB Vc 2 Vy In 0 s In J lc SI 6 Im V 5 S j Bl WE F pT 2 l KS 1 Yx U Wl MQ 0 po Y kd ja U 9 p Sk ZV ek kx T mt zd F Vp S j ku ZX l Kc Fl Y U Wl P ak Ux TX pV d 0 1 U WT J PREV z SW 1 WN G ND ST Z NV FV 6 Tl R Be E 5 6 STR NU 3 dp Y 2 1 We GR XV np k R 1 Zr SW pw Y k lt N Wh i V 1 V pT EN Kd 2 F HO X Va U 0 lz SW 1 O dm RX NT B jb m tp W FN 3 a WN HV n li V 2 x 6 Yz J sd mJ u TW l Pb HN p Ym 0 5 MG FX Wn BZ Mk Y wY Vc 5 d WN 5 Sm RM Q 0 pq WV d 4 c 1 lt R mp he Uk 2 SW 1 o MGR IQ np Pa Th 2 WT Jo a GM z Rj Fh Uz Ux Y 0 c 5 e WR DN XR a Uz lo Y 0 dr dm Rq RX Zk R zl 3 Y Vd Nd mJ VV Xp Tb Vp X ZW x OM FN u Un Fh bn Bv WW p SY VR FR nh ke U lz SW 1 G am RD ST Z Jb XR s Z Vh Ca GF Y SW l MQ 0 ow Z Vh Cb El qb 2 lj Mm ho Y 2 1 WU 1 p Y RW l MQ 0 pw Yz NN a U 9 p Sm th V 1 E 2 W lh Sb 2 N qb 3 dl R 0 U 1 Wl R Ne U 1 6 S ml O ak Zp W kd J Mk 5 6 ST NN VE pp T 1 dG b E 1 6 TX h PV FV 3 Tmp sa 0 9 H UT JO VE Zq TV d F aW Z RL n V Sc U dG d 0 1 XN np W SD R 4 O WF m TD At S 2 9 q SE Yw VF 9 Gb W 9 Q Wn R 6 OG 5 u S j R FX zh NY 2 c xe j BB Z 2 1 a Mn pl OE 5 i S 0 5 w V UN n R HR w TU 9 R Nz V GS j U 4 Wm hz b W Fx QU x BR S IsIm N hc GF ia Wx pd G ll cy I 6 Wy J le U ow Z Vh Ba U 9 p S kt WM VF pT EN Ka GJ HY 2 l Pa Up GV Xp J MU 5 rc 3 RV a Uo 5 L mV 5 Sn B ZW FF pT 2 p FM U 1 6 V Xd NV F kz TUR Fc 0 lt Vj R jQ 0 k 2 T VR V ek 5 q TX h Nam N 3 TV N 3 a Vl Y V mt J am 9 p W kd sa 0 9 t Vj Bh SE k 2 TU ho a E 9 X VX p N ak 1 5 WW p Ze Fl t U ml O am N 5 T np Fe Vl qb G ha VE 1 6 T VR r MU 1 E WT Va RG hr Tmp Ve Fl 6 R mh Ja X dp ZE h sd 1 pT ST Z Jb TV 2 Z Ed sb W FX T mh k R 2 x 2 Ym 5 Na Ux DS j J ZV 3 gx Wl NJ Nk lt Rn li an Bo ZD NN Nm My NX pP bl Z 6 TF h kb GM z UX RN am 9 4 T VR Ne E 9 U WX l NV Fk x Tl Rn N lp XN W tj Rz lw Ym 5 R dl Iw Tk 5 MM 1 Z RY j N KM Ex 6 UX p NR G sx TW p Z Mk x US mh PR 1 F 0 TT JF MF p TM W la RF V 3 T FR ka 0 1 US m 1 Z VE 0 0 TW p R NF lp S XN Jb Wx 6 Y 3 l JN k lt Un Ba R HB s ZE doe U 9 q Qj RN VE E 0 TW p B NV pq UX l OR GR pT j J ab E 5 q WX d OV 0 l 3 W mp V NF p qa 3 h OR FZ s WX p Ne U 5 qb Gt N RE Ux Tk NK OS 5 Lc 0 F 6 T mV De H FD a F 9 r M kt 4 a TY t WH F ve FN X Zj B CL W FF R 0 x X di 1 ld HV XQ l F 2 QU 5 ne DF TM G 5 o Z 0 pp Rk ll Un RX ak w 4 ek dn VV V 3 MU ls SW Jt Y U Zr OE o 5 aG d hd 0 Ui X Sw i Ym 9 4 UH Vi Ijoi Y 2 g 3 a GI 2 S 3 hs ak J 2 b Xh 5 UD JX Z EN W TF NT Lz Q 2 S 1 h C cmd k WG 1 M cm 0 3 VE p IST 0 i LCJ pc 3 Mi OiJ ka WQ 6 Z XR oc j owe DE w O DI w OW Y 0 Mj Q 3 Yj dm Z TY 2 MD Vi M GY 1 OG Y 5 MT Q 1 Z WM z Mj Y 5 ZD Ax NT Q if Q . N cf 8 B _ y 0 Ha 8 g da Yy Ca L 5 j LX 2 Rs K TM wx TQ 8 K lyb XF y gs x K UU Qm 9 OX o 4 l U 6 5 f du Ia Fv Vy POP 6 Oe 2 ad ar 8 m 0 m 2 ai w A ", ĊĠĠĠĠĠĠĠ Ġ" ey J 0 e X Ai OiJ KV 1 Qi LCJ hb G ci OiJ FU z I 1 Nk st Ui J 9 . ey Jp YX Qi Oj E 1 Mz Uw M TY 1 OT cs Im V 4 c CI 6 MT Uz N TE w M jk 5 Ny wi YX Vk Ijoi Z Gl k Om V 0 a HI 6 MH hh O WU z Mj My Yj Yx Ym Ri Nj cy Nz Ey Y jl h Z TM z MT k 1 MD Y 5 ZD hk Nj Ux Yz Fh Iiw id H lw Z SI 6 In No YX Jl U mV zc C IsIm 5 h ZCI 6 Ij J vd 2 h Gd GR tc 0 VV NV V WM V NC b ld 0 Rn ZZ c Hl U cj Nq N Hd 5 Tm R 2 Iiw ib 3 du I jp 7 Im 5 hb W Ui OiJ 1 UG 9 yd CB Vc 2 Vy In 0 s In J lc SI 6 Im V 5 S j Bl WE F pT 2 l KS 1 Yx U Wl MQ 0 po Y kd ja U 9 p Sk ZV ek kx T mt zd F Vp S j ku ZX l Kc Fl Y U Wl P ak Ux TX pV d 0 1 U W TF PR G dz SW 1 WN G ND ST Z NV FV 6 Tl R Be E 5 6 R TR PQ 3 dp Y 2 1 We GR XV np k R 1 Zr SW pw Y k lt N Wh i V 1 V pT EN Kd 2 F HO X Va U 0 lz SW 1 O dm RX NT B jb m tp W FN 3 a WN HV n li V 2 x 6 Yz J sd mJ u TW l Pb HN p Ym 0 5 MG FX Wn BZ Mk Y wY Vc 5 d WN 5 Sm RM Q 0 pq WV d 4 c 1 lt R mp he Uk 2 SW 1 o MGR IQ np Pa Th 2 WT Jo a GM z Rj Fh Uz Ux Y 0 c 5 e WR DN XR a Uz lo Y 0 dr dm Rq RX Zk R zl 3 Y Vd Nd ld t MX NO a 2 xu U Ws x Y U 9 X UX h Wb G gw V 0 Zs Y VJ UT l B ke U lz SW 1 G am RD ST Z Jb XR s Z Vh Ca GF Y SW l MQ 0 ow Z Vh Cb El qb 2 lj Mm ho Y 2 1 WU 1 p Y RW l MQ 0 pw Yz NN a U 9 p Sm th V 1 E 2 W lh Sb 2 N qb 3 dl R 0 U 1 Wl R Ne U 1 6 S ml O ak Zp W kd J Mk 5 6 ST NN VE pp T 1 dG b E 1 6 TX h PV FV 3 Tmp sa 0 9 H UT JO VE Zq TV d F aW Z RL n R Nb Wh 6 cj F kb ER 0 Y Uh Ue WU t VD Ax OG p 2 N 0 NU Yl Rh V WY 4 Z zl hb HN x V WJ 6 VG p GU k F sb V 9 q Z 2 Ra R 3 pV VE V ze Gt BY 0 Zm Vy 1 ZS mp IV G tw S mt j N FN W RE c 3 RE JB QS Is I ml z cy I 6 Im Rp ZD pld G hy Oj B 4 Z Th j OT Fi Z GU 3 Nj I 1 Y WI y Yz Bl ZD lm Mj E 0 ZGV i M zk 0 N DB k YT dl MD Nj NC J 9 .- 0 4 Z _ m 2 kg FB w F 1 El h 3 j mv 1 _ 4 4 jd Gj E cz f 4 x 3 c 5 Z 4 Tx wi MP 8 n XZ s ID Vg sp 3 PS 3 4 D PG fp R 4 Ok Z 6 L Bo z BB ER 3 TAB AA " ĊĠĠĠ Ġ) ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` ver ifies Ġsimple Ġtokens `() Ġ= Ġrun Blocking Ġ{ ĊĠĠĠĠĠĠĠ Ġmock k Object ( Universal DID ) ĊĊĠĠĠĠĠĠĠ Ġco Every Ġ{ ĠUniversal DID . resolve (" did : eth r : 0 x 1 0 8 2 0 9 f 4 2 4 7 b 7 fe 6 6 0 5 b 0 f 5 8 f 9 1 4 5 ec 3 2 6 9 d 0 1 5 4 ") Ġ}. returns ( ĊĠĠĠĠĠĠĠĠĠĠĠ ĠE thr DID Document . fromJson ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ""" {" id ":" did : eth r : 0 x 1 0 8 2 0 9 f 4 2 4 7 b 7 fe 6 6 0 5 b 0 f 5 8 f 9 1 4 5 ec 3 2 6 9 d 0 1 5 4 "," publicKey ":[{" id ":" did : eth r : 0 x 1 0 8 2 0 9 f 4 2 4 7 b 7 fe 6 6 0 5 b 0 f 5 8 f 9 1 4 5 ec 3 2 6 9 d 0 1 5 4 # owner "," type ":" Sec p 2 5 6 k 1 Verification Key 2 0 1 8 "," owner ":" did : eth r : 0 x 1 0 8 2 0 9 f 4 2 4 7 b 7 fe 6 6 0 5 b 0 f 5 8 f 9 1 4 5 ec 3 2 6 9 d 0 1 5 4 "," ethereum Address ":" 0 x 1 0 8 2 0 9 f 4 2 4 7 b 7 fe 6 6 0 5 b 0 f 5 8 f 9 1 4 5 ec 3 2 6 9 d 0 1 5 4 "," publicKey Hex ": null ," publicKey Base 6 4 ": null ," publicKey Base 5 8 ": null ," value ": null }], " authentication ":[{" type ":" Sec p 2 5 6 k 1 Signature Authentication 2 0 1 8 "," publicKey ":" did : eth r : 0 x 1 0 8 2 0 9 f 4 2 4 7 b 7 fe 6 6 0 5 b 0 f 5 8 f 9 1 4 5 ec 3 2 6 9 d 0 1 5 4 # owner "}], " service ":[ ]," @ context ":" https :// w 3 id . org / did / v 1 "} """ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠ Ġco Every Ġ{ ĠUniversal DID . resolve (" did : eth r : 0 xe 8 c 9 1 bde 7 6 2 5 ab 2 c 0 ed 9 f 2 1 4 deb 3 9 4 4 0 da 7 e 0 3 c 4 ") Ġ}. returns ( ĊĠĠĠĠĠĠĠĠĠĠĠ ĠE thr DID Document . fromJson ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ""" {" id ":" did : eth r : 0 xe 8 c 9 1 bde 7 6 2 5 ab 2 c 0 ed 9 f 2 1 4 deb 3 9 4 4 0 da 7 e 0 3 c 4 "," publicKey ":[{" id ":" did : eth r : 0 xe 8 c 9 1 bde 7 6 2 5 ab 2 c 0 ed 9 f 2 1 4 deb 3 9 4 4 0 da 7 e 0 3 c 4 # owner "," type ":" Sec p 2 5 6 k 1 Verification Key 2 0 1 8 "," owner ":" did : eth r : 0 xe 8 c 9 1 bde 7 6 2 5 ab 2 c 0 ed 9 f 2 1 4 deb 3 9 4 4 0 da 7 e 0 3 c 4 "," ethereum Address ":" 0 xe 8 c 9 1 bde 7 6 2 5 ab 2 c 0 ed 9 f 2 1 4 deb 3 9 4 4 0 da 7 e 0 3 c 4 "," publicKey Hex ": null ," publicKey Base 6 4 ": null ," publicKey Base 5 8 ": null ," value ": null }], " authentication ":[{" type ":" Sec p 2 5 6 k 1 Signature Authentication 2 0 1 8 "," publicKey ":" did : eth r : 0 xe 8 c 9 1 bde 7 6 2 5 ab 2 c 0 ed 9 f 2 1 4 deb 3 9 4 4 0 da 7 e 0 3 c 4 # owner "}], " service ":[ ]," @ context ":" https :// w 3 id . org / did / v 1 "} """ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠ Ġ) ĊĊĠĠĠĠĠĠĠ Ġtokens . forEach Ġ{ Ġtoken Ġ-> ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġpayload Ġ= ĠJWT Tools ( Test Time Provider ( 1 5 3 5 1 0 2 5 0 0 0 0 0 L )). verify ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġtoken Ġ= Ġtoken , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġaudience Ġ= Ġ" did : eth r : 0 xa 9 e 3 2 3 2 b 6 1 bdb 6 7 2 7 1 2 b 9 ae 3 3 1 9 5 0 6 9 d 8 d 6 5 1 c 1 a " ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠĠĠĠĠ ĠassertThat ( payload ). isNotNull () ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġval Ġvalid Share Req Token 1 Ġ= ĊĠĠĠĠĠĠĠ Ġ" ey J 0 e X Ai OiJ KV 1 Qi LCJ hb G ci OiJ FU z I 1 N ks if Q . ey J pc 3 Mi Oi I yb 2 VY d WZ IR 0 Rw VT Ux Ym ZL Qn Na R GR 1 N 0 pl OX dl S j Ny N 3 N WR y Is I ml hd CI 6 MT Uy MD M 2 Nj Q zM iw ic mV xd WV zd G Vk Ij pb Im 5 hb W Ui LCJ wa G 9 uZ S IsIm N vd W 5 0 cn ki LCJ h dm F 0 YX Ii X Sw ic GV yb Wl zc 2 lv bn Mi O ls ibm 9 0 aW Zp Y 2 F 0 aW 9 uc y Jd LCJ j YW xs Y mF jay I 6 Im h 0 d HB z Oi 8 vY 2 hh c 3 F 1 a S 5 1 c G 9 yd C 5 t ZS 9 hc G kv dj E vd G 9 wa WM v WG 5 IZ n ll dj U xe HN ka 0 R 0 d S IsIm 5 ld CI 6 Ij B 4 NC IsIm V 4 c CI 6 MT Uy MD M 2 Nz Az M iw id H lw Z SI 6 In No YX Jl U mV x In 0 . C 8 m PCC t Wl Y An ro du q ys XY Rl 5 x vr O dx 1 r 4 iq 3 A 3 Sm GD GZ u 4 7 U GT n ji Z CO r OQ 8 A 5 l Z 0 M 9 Jf Dp Z DET CK Gd J 7 KU eW Q " ĊĠĠĠ Ġprivate Ġval Ġexpected Share Req Payload 1 Ġ= ĠJwt Payload ( ĊĠĠĠĠĠĠĠ Ġiss Ġ= Ġ" 2 oe X uf H GD p U 5 1 bf KB s ZD du 7 Je 9 we J 3 r 7 s VG ", ĊĠĠĠĠĠĠĠ Ġi at Ġ= Ġ 1 5 2 0 3 6 6 4 3 2 , ĊĠĠĠĠĠĠĠ Ġsub Ġ= Ġnull , ĊĠĠĠĠĠĠĠ Ġaud Ġ= Ġnull , ĊĠĠĠĠĠĠĠ Ġexp Ġ= Ġ 1 5 2 0 3 6 7 0 3 2 , ĊĠĠĠĠĠĠĠ Ġcallback Ġ= Ġ" https :// ch as qui . uport . me / api / v 1 / topic / Xn H fy ev 5 1 x sdk D tu ", ĊĠĠĠĠĠĠĠ Ġtype Ġ= Ġ" share Req ", ĊĠĠĠĠĠĠĠ Ġnet Ġ= Ġ" 0 x 4 ", ĊĠĠĠĠĠĠĠ Ġact Ġ= Ġnull , ĊĠĠĠĠĠĠĠ Ġrequested Ġ= ĠlistOf (" name ", Ġ" phone ", Ġ" country ", Ġ" avatar "), ĊĠĠĠĠĠĠĠ Ġverified Ġ= Ġnull , ĊĠĠĠĠĠĠĠ Ġpermissions Ġ= ĠlistOf (" notifications "), ĊĠĠĠĠĠĠĠ Ġreq Ġ= Ġnull , ĊĠĠĠĠĠĠĠ Ġn ad Ġ= Ġnull , ĊĠĠĠĠĠĠĠ Ġd ad Ġ= Ġnull , ĊĠĠĠĠĠĠĠ Ġown Ġ= Ġnull , ĊĠĠĠĠĠĠĠ Ġcapabilities Ġ= Ġnull , ĊĠĠĠĠĠĠĠ Ġclaims Ġ= Ġnull , ĊĠĠĠĠĠĠĠ Ġctl Ġ= Ġnull , ĊĠĠĠĠĠĠĠ Ġreg Ġ= Ġnull , ĊĠĠĠĠĠĠĠ Ġrel Ġ= Ġnull , ĊĠĠĠĠĠĠĠ Ġf ct Ġ= Ġnull , ĊĠĠĠĠĠĠĠ Ġacc Ġ= Ġnull ĊĠĠĠ Ġ) ĊĊĠĠĠ Ġprivate Ġval Ġincoming Jwt Ġ= ĊĠĠĠĠĠĠĠ Ġ" ey J 0 e X Ai OiJ KV 1 Qi LCJ hb G ci OiJ FU z I 1 N ks if Q . ey J pc 3 Mi Oi I yb 2 1 SS lp MM j Na Q 1 ln Yz Fy Wn J GV n BG WE pw V 2 9 h R UV 1 Sl Vj Zi Is I ml hd CI 6 MT Ux OT M 1 M DI 1 N iw ic GV yb Wl zc 2 lv bn Mi O ls ibm 9 0 aW Zp Y 2 F 0 aW 9 uc y Jd LCJ j YW xs Y mF jay I 6 Im h 0 d HB z Oi 8 v YX Bp Ln V wb 3 J 0 Ln N wY WN l L 2 9 sb 3 J 1 bi 9 j cm V hd GV J ZGV ud Gl 0 e S IsIm 5 ld CI 6 Ij B 4 Mz Az OS IsIm F jd CI 6 Im R ld ml j ZW tle S IsIm V 4 c CI 6 MT Uy Mj U 0 MD gw MC wid H lw Z SI 6 In No YX Jl U mV x In 0 . Ek q NU yr Z hc Db TQ l 7 3 Xp L 2 tp 4 7 0 l Co 2 sa MX zu O Z 9 1 UI 2 y - Xz pc BM zh h Se U OR no J XJ h H nk GG p sh Zl ES WU gr bui VQ " ĊĠĠĠ Ġprivate Ġval Ġexpected Jwt Payload Ġ= ĠJwt Payload ( ĊĠĠĠĠĠĠĠ Ġiss Ġ= Ġ" 2 om R J ZL 2 3 Z CY gc 1 r Zr F Vp FX Jp W oa EE u JU cf ", ĊĠĠĠĠĠĠĠ Ġi at Ġ= Ġ 1 5 1 9 3 5 0 2 5 6 , ĊĠĠĠĠĠĠĠ Ġsub Ġ= Ġnull , ĊĠĠĠĠĠĠĠ Ġaud Ġ= Ġnull , ĊĠĠĠĠĠĠĠ Ġexp Ġ= Ġ 1 5 2 2 5 4 0 8 0 0 , ĊĠĠĠĠĠĠĠ Ġcallback Ġ= Ġ" https :// api . uport . space / ol or un / create Identity ", ĊĠĠĠĠĠĠĠ Ġtype Ġ= Ġ" share Req ", ĊĠĠĠĠĠĠĠ Ġnet Ġ= Ġ" 0 x 3 0 3 9 ", ĊĠĠĠĠĠĠĠ Ġact Ġ= Ġ" device key ", ĊĠĠĠĠĠĠĠ Ġrequested Ġ= Ġnull , ĊĠĠĠĠĠĠĠ Ġverified Ġ= Ġnull , ĊĠĠĠĠĠĠĠ Ġpermissions Ġ= ĠlistOf (" notifications "), ĊĠĠĠĠĠĠĠ Ġreq Ġ= Ġnull , ĊĠĠĠĠĠĠĠ Ġn ad Ġ= Ġnull , ĊĠĠĠĠĠĠĠ Ġd ad Ġ= Ġnull , ĊĠĠĠĠĠĠĠ Ġown Ġ= Ġnull , ĊĠĠĠĠĠĠĠ Ġcapabilities Ġ= Ġnull , ĊĠĠĠĠĠĠĠ Ġclaims Ġ= Ġnull , ĊĠĠĠĠĠĠĠ Ġctl Ġ= Ġnull , ĊĠĠĠĠĠĠĠ Ġreg Ġ= Ġnull , ĊĠĠĠĠĠĠĠ Ġrel Ġ= Ġnull , ĊĠĠĠĠĠĠĠ Ġf ct Ġ= Ġnull , ĊĠĠĠĠĠĠĠ Ġacc Ġ= Ġnull ĊĠĠĠ Ġ) ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` returns Ġcorrect Ġpayload Ġafter Ġsuccessful Ġverification `() Ġ= Ġrun Blocking Ġ{ ĊĠĠĠĠĠĠĠ Ġmock k Object ( Universal DID ) ĊĊĠĠĠĠĠĠĠ Ġco Every Ġ{ ĠUniversal DID . resolve (" 2 oe X uf H GD p U 5 1 bf KB s ZD du 7 Je 9 we J 3 r 7 s VG ") Ġ}. returns ( U port DID Document . fromJson (""" {" id ":" did : uport : 2 oe X uf H GD p U 5 1 bf KB s ZD du 7 Je 9 we J 3 r 7 s VG "," publicKey ":[{" id ":" did : uport : 2 oe X uf H GD p U 5 1 bf KB s ZD du 7 Je 9 we J 3 r 7 s VG # keys - 1 "," type ":" Sec p 2 5 6 k 1 Verification Key 2 0 1 8 "," owner ":" did : uport : 2 oe X uf H GD p U 5 1 bf KB s ZD du 7 Je 9 we J 3 r 7 s VG "," publicKey Hex ":" 0 4 1 7 1 fcc 7 6 5 4 cad 1 4 7 4 5 b 9 8 3 5 bc 5 3 4 d 8 e 5 9 0 3 8 ae 6 9 2 9 c 7 9 3 d 7 f 8 dd 2 c 9 3 4 5 8 0 ca 3 9 ff 1 e 2 de 3 d 7 ef 6 9 a 8 d aba 5 e 5 5 9 0 d 3 ec 8 0 4 8 6 a 2 7 3 cbe 2 bd 1 b 7 6 ebd 0 1 f 9 4 9 b 4 1 4 6 3 "}], " authentication ":[{" type ":" Sec p 2 5 6 k 1 Signature Authentication 2 0 1 8 "," publicKey ":" did : uport : 2 oe X uf H GD p U 5 1 bf KB s ZD du 7 Je 9 we J 3 r 7 s VG # keys - 1 "}], " service ":[ ]," @ context ":" https :// w 3 id . org / did / v 1 "," uport Profile ":{" @ type ":" App "," image ":{" @ type ":" Image Object "," name ":" avatar "," content Url ":"/ ipfs / Q mez 4 bd F mx Pk nb Ao Gz H mp jp Lj Q F Ch q 3 9 h 5 UMP G iw UH gt 8 f "}," name ":" u Port ĠDemo "," description ":" Demo ĠApp "}} "" ")) ĊĠĠĠĠĠĠĠ Ġco Every Ġ{ ĠUniversal DID . resolve (" 2 om R J ZL 2 3 Z CY gc 1 r Zr F Vp FX Jp W oa EE u JU cf ") Ġ}. returns ( U port DID Document . fromJson (""" {" id ":" did : uport : 2 om R J ZL 2 3 Z CY gc 1 r Zr F Vp FX Jp W oa EE u JU cf "," publicKey ":[{" id ":" did : uport : 2 om R J ZL 2 3 Z CY gc 1 r Zr F Vp FX Jp W oa EE u JU cf # keys - 1 "," type ":" Sec p 2 5 6 k 1 Verification Key 2 0 1 8 "," owner ":" did : uport : 2 om R J ZL 2 3 Z CY gc 1 r Zr F Vp FX Jp W oa EE u JU cf "," publicKey Hex ":" 0 4 2 2 d 2 ed ad 3 0 d 8 5 8 8 c 0 6 6 1 e 0 3 2 f 3 7 af 8 1 7 7 cfa 0 a 0 5 6 ee 9 b 8 ca 9 5 3 b 0 7 c 6 6 0 0 a 6 3 7 c 0 0 2 ed 2 2 fe 6 6 1 2 e 2 8 e 5 5 8 aee 1 3 0 d 3 9 9 ba 9 7 f 8 9 e 2 5 c 1 6 6 6 1 a 9 9 c 8 af 8 c 8 3 2 b 8 8 5 6 8 "}], " authentication ":[{" type ":" Sec p 2 5 6 k 1 Signature Authentication 2 0 1 8 "," publicKey ":" did : uport : 2 om R J ZL 2 3 Z CY gc 1 r Zr F Vp FX Jp W oa EE u JU cf # keys - 1 "}], " service ":[ ]," @ context ":" https :// w 3 id . org / did / v 1 "," uport Profile ":{" @ type ":" App "," image ":{" @ type ":" Image Object "," name ":" avatar "," content Url ":"/ ipfs / Q md zn Po NS nc 6 Raw S zz v N FX 5 Her F 6 2 Vu 7 sb P 3 v Sur 9 g DF Gb "}," name ":" O lor un "," description ":" Private Ġnetwork Ġconfiguration Ġservice "}} "" ")) ĊĊĠĠĠĠĠĠĠ Ġval Ġshare Req Payload Ġ= ĠJWT Tools ( Test Time Provider ( 1 5 2 0 3 6 6 6 6 6 0 0 0 L )). verify ( valid Share Req Token 1 ) ĊĠĠĠĠĠĠĠ ĠassertThat ( share Req Payload ). isEqualTo ( expected Share Req Payload 1 ) ĊĊĠĠĠĠĠĠĠ Ġval Ġincoming Jwt Payload Ġ= ĠJWT Tools ( Test Time Provider ( 1 5 2 2 5 4 0 3 0 0 0 0 0 L )). verify ( incoming Jwt ) ĊĠĠĠĠĠĠĠ ĠassertThat ( incoming Jwt Payload ). isEqualTo ( expected Jwt Payload ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` throws Ġwhen Ġgiven Ġan Ġunknown Ġalgorithm Ġto Ġcreate Ġtokens `() Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġtested Ġ= ĠJWT Tools () ĊĊĠĠĠĠĠĠĠ Ġval Ġpayload Ġ= Ġempty Map < String , ĠAny >() ĊĠĠĠĠĠĠĠ Ġval Ġsigner Ġ= ĠK P Signer (" 0 x 1 2 3 4 ") ĊĠĠĠĠĠĠĠ Ġval Ġissuer DID Ġ= Ġ" did : eth r :${ signer . getAddress () }" ĊĊĠĠĠĠĠĠĠ Ġco Assert Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġtested . create JWT ( payload , Ġissuer DID , Ġsigner , Ġalgorithm Ġ= Ġ" some Ġfancy Ġbut Ġunknown Ġalgorithm ") ĊĠĠĠĠĠĠĠ Ġ}. throw n Error Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġis InstanceOf ( JWT EncodingException :: class ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` throws Ġerror Ġwhen Ġaud Ġis Ġnot Ġavailable `() Ġ= Ġrun Blocking Ġ{ ĊĠĠĠĠĠĠĠ Ġmock k Object ( Universal DID ) ĊĊĠĠĠĠĠĠĠ Ġval Ġtoken Ġ= ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ" ey J 0 e X Ai OiJ KV 1 Qi LCJ hb G ci OiJ FU z I 1 Nk st Ui J 9 . ey Jp YX Qi Oj E 1 Mz Uw M TY 3 MD IsIm V 4 c CI 6 MT Uz N TE w Mz Ew Mi wi YX Vk Ijoi Z Gl k Om V 0 a HI 6 MH hh O WU z Mj My Yj Yx Ym Ri Nj cy Nz Ey Y jl h Z TM z MT k 1 MD Y 5 ZD hk Nj Ux Yz Fh Iiw id H lw Z SI 6 In No YX Jl U mV zc C IsIm 5 h ZCI 6 Ij Jv ZH pq V GF p OF Jv NF Yz S 3 hr b T NT bl pp d jl X U 1 l 1 Tm 9 a NE Fo Iiw ib 3 du I jp 7 Im 5 hb W Ui OiJ 1 UG 9 yd CB Vc 2 Vy In 0 s In J lc SI 6 Im V 5 S j Bl WE F pT 2 l KS 1 Yx U Wl MQ 0 po Y kd ja U 9 p Sk ZV ek kx T mt zd F Vp S j ku ZX l Kc Fl Y U Wl P ak Ux TX pV d 0 1 U WT J PREV z SW 1 WN G ND ST Z NV FV 6 Tl R Be E 5 6 STR NU 3 dp Y 2 1 We GR XV np k R 1 Zr SW pw Y k lt N Wh i V 1 V pT EN Kd 2 F HO X Va U 0 lz SW 1 O dm RX NT B jb m tp W FN 3 a WN HV n li V 2 x 6 Yz J sd mJ u TW l Pb HN p Ym 0 5 MG FX Wn BZ Mk Y wY Vc 5 d WN 5 Sm RM Q 0 pq WV d 4 c 1 lt R mp he Uk 2 SW 1 o MGR IQ np Pa Th 2 WT Jo a GM z Rj Fh Uz Ux Y 0 c 5 e WR DN XR a Uz lo Y 0 dr dm Rq RX Zk R zl 3 Y Vd Nd mJ VV Xp Tb Vp X ZW x OM FN u Un Fh bn Bv WW p SY VR FR nh ke U lz SW 1 G am RD ST Z Jb XR s Z Vh Ca GF Y SW l MQ 0 ow Z Vh Cb El qb 2 lj Mm ho Y 2 1 WU 1 p Y RW l MQ 0 pw Yz NN a U 9 p Sm th V 1 E 2 W lh Sb 2 N qb 3 dl R 0 U 1 Wl R Ne U 1 6 S ml O ak Zp W kd J Mk 5 6 ST NN VE pp T 1 dG b E 1 6 TX h PV FV 3 Tmp sa 0 9 H UT JO VE Zq TV d F aW Z RL n V Sc U dG d 0 1 XN np W SD R 4 O WF m TD At S 2 9 q SE Yw VF 9 Gb W 9 Q Wn R 6 OG 5 u S j R FX zh NY 2 c xe j BB Z 2 1 a Mn pl OE 5 i S 0 5 w V UN n R HR w TU 9 R Nz V GS j U 4 Wm hz b W Fx QU x BR S IsIm N hc GF ia Wx pd G ll cy I 6 Wy J le U ow Z Vh Ba U 9 p S kt WM VF pT EN Ka GJ HY 2 l Pa Up GV Xp J MU 5 rc 3 RV a Uo 5 L mV 5 Sn B ZW FF pT 2 p FM U 1 6 V Xd NV F kz TUR Fc 0 lt Vj R jQ 0 k 2 T VR V ek 5 q TX h Nam N 3 TV N 3 a Vl Y V mt J am 9 p W kd sa 0 9 t Vj Bh SE k 2 TU ho a E 9 X VX p N ak 1 5 WW p Ze Fl t U ml O am N 5 T np Fe Vl qb G ha VE 1 6 T VR r MU 1 E WT Va RG hr Tmp Ve Fl 6 R mh Ja X dp ZE h sd 1 pT ST Z Jb TV 2 Z Ed sb W FX T mh k R 2 x 2 Ym 5 Na Ux DS j J ZV 3 gx Wl NJ Nk lt Rn li an Bo ZD NN Nm My NX pP bl Z 6 TF h kb GM z UX RN am 9 4 T VR Ne E 9 U WX l NV Fk x Tl Rn N lp XN W tj Rz lw Ym 5 R dl Iw Tk 5 MM 1 Z RY j N KM Ex 6 UX p NR G sx TW p Z Mk x US mh PR 1 F 0 TT JF MF p TM W la RF V 3 T FR ka 0 1 US m 1 Z VE 0 0 TW p R NF lp S XN Jb Wx 6 Y 3 l JN k lt Un Ba R HB s ZE doe U 9 q Qj RN VE E 0 TW p B NV pq UX l OR GR pT j J ab E 5 q WX d OV 0 l 3 W mp V NF p qa 3 h OR FZ s WX p Ne U 5 qb Gt N RE Ux Tk NK OS 5 Lc 0 F 6 T mV De H FD a F 9 r M kt 4 a TY t WH F ve FN X Zj B CL W FF R 0 x X di 1 ld HV XQ l F 2 QU 5 ne DF TM G 5 o Z 0 pp Rk ll Un RX ak w 4 ek dn VV V 3 MU ls SW Jt Y U Zr OE o 5 aG d hd 0 Ui X Sw i Ym 9 4 UH Vi Ijoi Y 2 g 3 a GI 2 S 3 hs ak J 2 b Xh 5 UD JX Z EN W TF NT Lz Q 2 S 1 h C cmd k WG 1 M cm 0 3 VE p IST 0 i LCJ pc 3 Mi OiJ ka WQ 6 Z XR oc j owe DE w O DI w OW Y 0 Mj Q 3 Yj dm Z TY 2 MD Vi M GY 1 OG Y 5 MT Q 1 Z WM z Mj Y 5 ZD Ax NT Q if Q . N cf 8 B _ y 0 Ha 8 g da Yy Ca L 5 j LX 2 Rs K TM wx TQ 8 K lyb XF y gs x K UU Qm 9 OX o 4 l U 6 5 f du Ia Fv Vy POP 6 Oe 2 ad ar 8 m 0 m 2 ai w A " ĊĊĠĠĠĠĠĠĠ Ġco Every Ġ{ ĠUniversal DID . resolve (" did : eth r : 0 x 1 0 8 2 0 9 f 4 2 4 7 b 7 fe 6 6 0 5 b 0 f 5 8 f 9 1 4 5 ec 3 2 6 9 d 0 1 5 4 ") Ġ}. returns ( ĊĠĠĠĠĠĠĠĠĠĠĠ ĠE thr DID Document . fromJson ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ""" {" id ":" did : eth r : 0 x 1 0 8 2 0 9 f 4 2 4 7 b 7 fe 6 6 0 5 b 0 f 5 8 f 9 1 4 5 ec 3 2 6 9 d 0 1 5 4 "," publicKey ":[{" id ":" did : eth r : 0 x 1 0 8 2 0 9 f 4 2 4 7 b 7 fe 6 6 0 5 b 0 f 5 8 f 9 1 4 5 ec 3 2 6 9 d 0 1 5 4 # owner "," type ":" Sec p 2 5 6 k 1 Verification Key 2 0 1 8 "," owner ":" did : eth r : 0 x 1 0 8 2 0 9 f 4 2 4 7 b 7 fe 6 6 0 5 b 0 f 5 8 f 9 1 4 5 ec 3 2 6 9 d 0 1 5 4 "," ethereum Address ":" 0 x 1 0 8 2 0 9 f 4 2 4 7 b 7 fe 6 6 0 5 b 0 f 5 8 f 9 1 4 5 ec 3 2 6 9 d 0 1 5 4 "," publicKey Hex ": null ," publicKey Base 6 4 ": null ," publicKey Base 5 8 ": null ," value ": null }], " authentication ":[{" type ":" Sec p 2 5 6 k 1 Signature Authentication 2 0 1 8 "," publicKey ":" did : eth r : 0 x 1 0 8 2 0 9 f 4 2 4 7 b 7 fe 6 6 0 5 b 0 f 5 8 f 9 1 4 5 ec 3 2 6 9 d 0 1 5 4 # owner "}], " service ":[ ]," @ context ":" https :// w 3 id . org / did / v 1 "} """ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠ Ġ) ĊĊĠĠĠĠĠĠĠ Ġco Assert Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ ĠJWT Tools ( Test Time Provider ( 1 5 3 5 1 0 2 5 0 0 0 0 0 L )). verify ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġtoken Ġ= Ġtoken ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠ Ġ}. throw n Error Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġis InstanceOf ( Invalid JWT Exception :: class ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` throws Ġerror Ġwhen Ġaud Ġand Ġpayload Ġaud Ġdo Ġnot Ġmatch `() Ġ= Ġrun Blocking Ġ{ ĊĠĠĠĠĠĠĠ Ġmock k Object ( Universal DID ) ĊĊĠĠĠĠĠĠĠ Ġval Ġtoken Ġ= ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ" ey J 0 e X Ai OiJ KV 1 Qi LCJ hb G ci OiJ FU z I 1 Nk st Ui J 9 . ey Jp YX Qi Oj E 1 Mz Uw M TY 3 MD IsIm V 4 c CI 6 MT Uz N TE w Mz Ew Mi wi YX Vk Ijoi Z Gl k Om V 0 a HI 6 MH hh O WU z Mj My Yj Yx Ym Ri Nj cy Nz Ey Y jl h Z TM z MT k 1 MD Y 5 ZD hk Nj Ux Yz Fh Iiw id H lw Z SI 6 In No YX Jl U mV zc C IsIm 5 h ZCI 6 Ij Jv ZH pq V GF p OF Jv NF Yz S 3 hr b T NT bl pp d jl X U 1 l 1 Tm 9 a NE Fo Iiw ib 3 du I jp 7 Im 5 hb W Ui OiJ 1 UG 9 yd CB Vc 2 Vy In 0 s In J lc SI 6 Im V 5 S j Bl WE F pT 2 l KS 1 Yx U Wl MQ 0 po Y kd ja U 9 p Sk ZV ek kx T mt zd F Vp S j ku ZX l Kc Fl Y U Wl P ak Ux TX pV d 0 1 U WT J PREV z SW 1 WN G ND ST Z NV FV 6 Tl R Be E 5 6 STR NU 3 dp Y 2 1 We GR XV np k R 1 Zr SW pw Y k lt N Wh i V 1 V pT EN Kd 2 F HO X Va U 0 lz SW 1 O dm RX NT B jb m tp W FN 3 a WN HV n li V 2 x 6 Yz J sd mJ u TW l Pb HN p Ym 0 5 MG FX Wn BZ Mk Y wY Vc 5 d WN 5 Sm RM Q 0 pq WV d 4 c 1 lt R mp he Uk 2 SW 1 o MGR IQ np Pa Th 2 WT Jo a GM z Rj Fh Uz Ux Y 0 c 5 e WR DN XR a Uz lo Y 0 dr dm Rq RX Zk R zl 3 Y Vd Nd mJ VV Xp Tb Vp X ZW x OM FN u Un Fh bn Bv WW p SY VR FR nh ke U lz SW 1 G am RD ST Z Jb XR s Z Vh Ca GF Y SW l MQ 0 ow Z Vh Cb El qb 2 lj Mm ho Y 2 1 WU 1 p Y RW l MQ 0 pw Yz NN a U 9 p Sm th V 1 E 2 W lh Sb 2 N qb 3 dl R 0 U 1 Wl R Ne U 1 6 S ml O ak Zp W kd J Mk 5 6 ST NN VE pp T 1 dG b E 1 6 TX h PV FV 3 Tmp sa 0 9 H UT JO VE Zq TV d F aW Z RL n V Sc U dG d 0 1 XN np W SD R 4 O WF m TD At S 2 9 q SE Yw VF 9 Gb W 9 Q Wn R 6 OG 5 u S j R FX zh NY 2 c xe j BB Z 2 1 a Mn pl OE 5 i S 0 5 w V UN n R HR w TU 9 R Nz V GS j U 4 Wm hz b W Fx QU x BR S IsIm N hc GF ia Wx pd G ll cy I 6 Wy J le U ow Z Vh Ba U 9 p S kt WM VF pT EN Ka GJ HY 2 l Pa Up GV Xp J MU 5 rc 3 RV a Uo 5 L mV 5 Sn B ZW FF pT 2 p FM U 1 6 V Xd NV F kz TUR Fc 0 lt Vj R jQ 0 k 2 T VR V ek 5 q TX h Nam N 3 TV N 3 a Vl Y V mt J am 9 p W kd sa 0 9 t Vj Bh SE k 2 TU ho a E 9 X VX p N ak 1 5 WW p Ze Fl t U ml O am N 5 T np Fe Vl qb G ha VE 1 6 T VR r MU 1 E WT Va RG hr Tmp Ve Fl 6 R mh Ja X dp ZE h sd 1 pT ST Z Jb TV 2 Z Ed sb W FX T mh k R 2 x 2 Ym 5 Na Ux DS j J ZV 3 gx Wl NJ Nk lt Rn li an Bo ZD NN Nm My NX pP bl Z 6 TF h kb GM z UX RN am 9 4 T VR Ne E 9 U WX l NV Fk x Tl Rn N lp XN W tj Rz lw Ym 5 R dl Iw Tk 5 MM 1 Z RY j N KM Ex 6 UX p NR G sx TW p Z Mk x US mh PR 1 F 0 TT JF MF p TM W la RF V 3 T FR ka 0 1 US m 1 Z VE 0 0 TW p R NF lp S XN Jb Wx 6 Y 3 l JN k lt Un Ba R HB s ZE doe U 9 q Qj RN VE E 0 TW p B NV pq UX l OR GR pT j J ab E 5 q WX d OV 0 l 3 W mp V NF p qa 3 h OR FZ s WX p Ne U 5 qb Gt N RE Ux Tk NK OS 5 Lc 0 F 6 T mV De H FD a F 9 r M kt 4 a TY t WH F ve FN X Zj B CL W FF R 0 x X di 1 ld HV XQ l F 2 QU 5 ne DF TM G 5 o Z 0 pp Rk ll Un RX ak w 4 ek dn VV V 3 MU ls SW Jt Y U Zr OE o 5 aG d hd 0 Ui X Sw i Ym 9 4 UH Vi Ijoi Y 2 g 3 a GI 2 S 3 hs ak J 2 b Xh 5 UD JX Z EN W TF NT Lz Q 2 S 1 h C cmd k WG 1 M cm 0 3 VE p IST 0 i LCJ pc 3 Mi OiJ ka WQ 6 Z XR oc j owe DE w O DI w OW Y 0 Mj Q 3 Yj dm Z TY 2 MD Vi M GY 1 OG Y 5 MT Q 1 Z WM z Mj Y 5 ZD Ax NT Q if Q . N cf 8 B _ y 0 Ha 8 g da Yy Ca L 5 j LX 2 Rs K TM wx TQ 8 K lyb XF y gs x K UU Qm 9 OX o 4 l U 6 5 f du Ia Fv Vy POP 6 Oe 2 ad ar 8 m 0 m 2 ai w A " ĊĊĠĠĠĠĠĠĠ Ġco Every Ġ{ ĠUniversal DID . resolve (" did : eth r : 0 x 1 0 8 2 0 9 f 4 2 4 7 b 7 fe 6 6 0 5 b 0 f 5 8 f 9 1 4 5 ec 3 2 6 9 d 0 1 5 4 ") Ġ}. returns ( ĊĠĠĠĠĠĠĠĠĠĠĠ ĠE thr DID Document . fromJson ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ""" {" id ":" did : eth r : 0 x 1 0 8 2 0 9 f 4 2 4 7 b 7 fe 6 6 0 5 b 0 f 5 8 f 9 1 4 5 ec 3 2 6 9 d 0 1 5 4 "," publicKey ":[{" id ":" did : eth r : 0 x 1 0 8 2 0 9 f 4 2 4 7 b 7 fe 6 6 0 5 b 0 f 5 8 f 9 1 4 5 ec 3 2 6 9 d 0 1 5 4 # owner "," type ":" Sec p 2 5 6 k 1 Verification Key 2 0 1 8 "," owner ":" did : eth r : 0 x 1 0 8 2 0 9 f 4 2 4 7 b 7 fe 6 6 0 5 b 0 f 5 8 f 9 1 4 5 ec 3 2 6 9 d 0 1 5 4 "," ethereum Address ":" 0 x 1 0 8 2 0 9 f 4 2 4 7 b 7 fe 6 6 0 5 b 0 f 5 8 f 9 1 4 5 ec 3 2 6 9 d 0 1 5 4 "," publicKey Hex ": null ," publicKey Base 6 4 ": null ," publicKey Base 5 8 ": null ," value ": null }], " authentication ":[{" type ":" Sec p 2 5 6 k 1 Signature Authentication 2 0 1 8 "," publicKey ":" did : eth r : 0 x 1 0 8 2 0 9 f 4 2 4 7 b 7 fe 6 6 0 5 b 0 f 5 8 f 9 1 4 5 ec 3 2 6 9 d 0 1 5 4 # owner "}], " service ":[ ]," @ context ":" https :// w 3 id . org / did / v 1 "} """ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠ Ġ) ĊĊĠĠĠĠĠĠĠ Ġco Assert Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ ĠJWT Tools ( Test Time Provider ( 1 5 3 5 1 0 2 5 0 0 0 0 0 L )). verify ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġtoken Ġ= Ġtoken , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġaudience Ġ= Ġ" did : eth r : 0 x 1 0 8 2 0 9 f 4 2 4 7 b 7 fe 6 6 0 5 b 0 f 5 8 f 9 1 4 5 ec 3 2 6 9 d 0 1 5 4 " ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠ Ġ}. throw n Error Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġis InstanceOf ( Invalid JWT Exception :: class ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` throws Ġwhen Ġa Ġtoken Ġis Ġissued Ġin Ġthe Ġfuture `() Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġtoken Ġ= ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ" ey J 0 e X Ai OiJ KV 1 Qi LCJ hb G ci OiJ I Uz I 1 Ni J 9 . ey J pc 3 Mi OiJ ka WQ 6 Z XR oc j owe GE 5 ZT My Mz Ji Nj Fi Z GI 2 Nz I 3 MT Ji OW Fl Mz Mx OT Uw N jl k OG Q 2 NT Fj M WE i LCJ p YX Qi Oj E 1 ND U 1 N jk 1 N DE s Im V 4 c CI 6 MT U 0 Nj A 4 N zk 0 MS wi YX Vk Ijoi Z Gl k Om V 0 a HI 6 MH gx MD gy MD lm N DI 0 N 2 I 3 Zm U 2 Nj A 1 Yj Bm N Th m OTE 0 N WV j Mz I 2 OW Qw MT U 0 Iiw ic 3 Vi Ijoi In 0 . Bt 9 F rc 1 Q ab J fp XY Bo U 4 sns 8 W Pe RL d KU 8 7 F nc g MF q 1 l Y " ĊĊĠĠĠĠĠĠĠ Ġco Assert Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ ĠJWT Tools ( Test Time Provider ( 9 7 7 3 1 7 6 9 2 0 0 0 L )). verify ( token ) ĊĠĠĠĠĠĠĠ Ġ}. throw n Error Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġis InstanceOf ( Invalid JWT Exception :: class ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` throws Ġwhen Ġa Ġtoken Ġis Ġexpired `() Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġtoken Ġ= ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ" ey J 0 e X Ai OiJ KV 1 Qi LCJ hb G ci OiJ I Uz I 1 Ni J 9 . ey J pc 3 Mi OiJ ka WQ 6 Z XR oc j owe GE 5 ZT My Mz Ji Nj Fi Z GI 2 Nz I 3 MT Ji OW Fl Mz Mx OT Uw N jl k OG Q 2 NT Fj M WE i LCJ p YX Qi Oj E 1 ND U 1 N jk 1 N DE s Im V 4 c CI 6 MT U 0 Nj A 4 N zk 0 MS wi YX Vk Ijoi Z Gl k Om V 0 a HI 6 MH gx MD gy MD lm N DI 0 N 2 I 3 Zm U 2 Nj A 1 Yj Bm N Th m OTE 0 N WV j Mz I 2 OW Qw MT U 0 Iiw ic 3 Vi Ijoi In 0 . Bt 9 F rc 1 Q ab J fp XY Bo U 4 sns 8 W Pe RL d KU 8 7 F nc g MF q 1 l Y " ĊĊĠĠĠĠĠĠĠ Ġco Assert Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ ĠJWT Tools ( Test Time Provider ( 1 5 7 6 8 4 7 2 9 2 0 0 0 L )). verify ( token ) ĊĠĠĠĠĠĠĠ Ġ}. throw n Error Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġis InstanceOf ( Invalid JWT Exception :: class ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` throws Ġwhen Ġthe Ġsignature Ġdoes Ġnot Ġmatch Ġany Ġpublic Ġkeys Ġbelong ing Ġto Ġthe Ġissuer `() Ġ{ ĊĊĠĠĠĠĠĠĠ Ġmock k Object ( Universal DID ) ĊĠĠĠĠĠĠĠ Ġco Every Ġ{ ĠUniversal DID . resolve (" did : eth r : 0 x 6 9 8 5 a 1 1 0 df 3 7 5 5 5 2 3 5 d 7 d 0 de 0 a 0 fb 2 8 c 9 8 4 8 dfa 9 ") Ġ}. returns ( ĊĠĠĠĠĠĠĠĠĠĠĠ ĠE thr DID Document . fromJson ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ""" {" id ":" did : eth r : 0 x 6 9 8 5 a 1 1 0 df 3 7 5 5 5 2 3 5 d 7 d 0 de 0 a 0 fb 2 8 c 9 8 4 8 dfa 9 "," publicKey ":[{" id ":" did : eth r : 0 x 6 9 8 5 a 1 1 0 df 3 7 5 5 5 2 3 5 d 7 d 0 de 0 a 0 fb 2 8 c 9 8 4 8 dfa 9 # owner "," type ":" Sec p 2 5 6 k 1 Verification Key 2 0 1 8 "," owner ":" did : eth r : 0 x 6 9 8 5 a 1 1 0 df 3 7 5 5 5 2 3 5 d 7 d 0 de 0 a 0 fb 2 8 c 9 8 4 8 dfa 9 "," ethereum Address ":" 0 x 6 9 8 5 a 1 1 0 df 3 7 5 5 5 2 3 5 d 7 d 0 de 0 a 0 fb 2 8 c 9 8 4 8 dfa 9 "," publicKey Hex ": null ," publicKey Base 6 4 ": null ," publicKey Base 5 8 ": null ," value ": null }], " authentication ":[{" type ":" Sec p 2 5 6 k 1 Signature Authentication 2 0 1 8 "," publicKey ":" did : eth r : 0 x 6 9 8 5 a 1 1 0 df 3 7 5 5 5 2 3 5 d 7 d 0 de 0 a 0 fb 2 8 c 9 8 4 8 dfa 9 # owner "}], " service ":[ ]," @ context ":" https :// w 3 id . org / did / v 1 "} """ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠ Ġ) ĊĊĠĠĠĠĠĠĠ Ġ// ĠJWT Ġtoken Ġwith Ġa ĠSign er Ġthat Ġdoesn 't Ġhave Ġanything Ġto Ġdo Ġwith Ġthe Ġissuer DID . ĊĠĠĠĠĠĠĠ Ġval Ġtoken Ġ= ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ" ey J 0 e X Ai OiJ KV 1 Qi LCJ hb G ci OiJ FU z I 1 Nk st Ui J 9 . ey Jp YX Qi Oj E 1 ND Y 4 NT kx NT ks Im V 4 c CI 6 MT g 2 Mj Ix OTE 1 OS w ia XN z Ijoi Z Gl k Om V 0 a HI 6 MH g 2 OT g 1 YT Ex MGR m Mz c 1 NT Uy Mz Vk N 2 Qw Z GU wY TB m Yj I 4 Y zk 4 ND hk Zm E 5 In 0 . fe 1 rv AH so Js J zw S FA mV FT z 9 ux h nc NY 6 5 jp bb 2 c S 9 jc Y 0 8 x php U 3 r Oy 1 N 8 5 _ Ib E jh IZ w - Fr Pe F gx J Lo DL w 6 it cg E " ĊĊĠĠĠĠĠĠĠ Ġco Assert Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ ĠJWT Tools ( Test Time Provider ( 1 5 4 7 8 1 8 6 3 0 0 0 0 L )). verify ( token ) ĊĠĠĠĠĠĠĠ Ġ}. throw n Error Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġis InstanceOf ( Invalid JWT Exception :: class ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` find s Ġpublic Ġkey `() Ġ= Ġrun Blocking Ġ{ ĊĊĠĠĠĠĠĠĠ Ġval Ġalg Ġ= Ġ" ES 2 5 6 K " ĊĠĠĠĠĠĠĠ Ġval Ġissuer Ġ= Ġ" did : eth r : 0 xe 8 c 9 1 bde 7 6 2 5 ab 2 c 0 ed 9 f 2 1 4 deb 3 9 4 4 0 da 7 e 0 3 c 4 " ĊĠĠĠĠĠĠĠ Ġval Ġauth Ġ= Ġfalse ĊĠĠĠĠĠĠĠ Ġval Ġdoc Ġ= ĠE thr DID Document . fromJson ( ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ""" ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ" id ": Ġ" did : eth r : 0 xe 8 c 9 1 bde 7 6 2 5 ab 2 c 0 ed 9 f 2 1 4 deb 3 9 4 4 0 da 7 e 0 3 c 4 ", ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ" publicKey ": Ġ[{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ" id ": Ġ" did : eth r : 0 xe 8 c 9 1 bde 7 6 2 5 ab 2 c 0 ed 9 f 2 1 4 deb 3 9 4 4 0 da 7 e 0 3 c 4 # keys - 1 ", ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ" type ": Ġ" Sec p 2 5 6 k 1 Verification Key 2 0 1 8 ", ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ" owner ": Ġ" did : eth r : 0 xe 8 c 9 1 bde 7 6 2 5 ab 2 c 0 ed 9 f 2 1 4 deb 3 9 4 4 0 da 7 e 0 3 c 4 ", ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ" publicKey Hex ": Ġ" 0 4 6 1 3 bb 3 a 4 8 7 4 d 2 7 0 3 2 6 1 8 f 0 2 0 6 1 4 c 2 1 cbe 4 c 4 e 4 7 8 1 6 8 7 5 2 5 f 6 6 7 4 0 8 9 f 9 bd 3 d 6 c 7 f 6 eb 1 3 5 6 9 0 5 3 d 3 1 7 1 5 a 3 ba 3 2 e 0 b 7 9 1 b 9 7 9 2 2 af 6 3 8 7 f 0 8 7 d 6 b 5 5 4 8 c 0 6 9 4 4 ab 0 6 1 " ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ}], ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ" authentication ": Ġ[], ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ" service ": Ġ[], ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ"@ context ": Ġ" https :// w 3 id . org / did / v 1 " ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ""" ĊĠĠĠĠĠĠĠ Ġ) ĊĊĠĠĠĠĠĠĠ Ġmock k Object ( Universal DID ) ĊĊĠĠĠĠĠĠĠ Ġco Every Ġ{ ĠUniversal DID . resolve ( issuer ) Ġ}. returns ( doc ) ĊĊĠĠĠĠĠĠĠ Ġval Ġauthentic ators Ġ= ĠJWT Tools (). resolve Authenticator ( alg , Ġissuer , Ġauth ) ĊĠĠĠĠĠĠĠ ĠassertThat ( auth entic ators ). isEqualTo ( doc . publicKey ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` only Ġlist Ġauthentic ators Ġable Ġto Ġauthenticate Ġa Ġuser `() Ġ= Ġrun Blocking Ġ{ ĊĊĠĠĠĠĠĠĠ Ġval Ġalg Ġ= Ġ" ES 2 5 6 K " ĊĠĠĠĠĠĠĠ Ġval Ġissuer Ġ= Ġ" did : eth r : 0 xe 8 c 9 1 bde 7 6 2 5 ab 2 c 0 ed 9 f 2 1 4 deb 3 9 4 4 0 da 7 e 0 3 c 4 " ĊĠĠĠĠĠĠĠ Ġval Ġauth Ġ= Ġtrue ĊĠĠĠĠĠĠĠ Ġval Ġdoc Ġ= ĠE thr DID Document . fromJson ( ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ""" ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ" id ": Ġ" did : eth r : 0 xe 8 c 9 1 bde 7 6 2 5 ab 2 c 0 ed 9 f 2 1 4 deb 3 9 4 4 0 da 7 e 0 3 c 4 ", ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ" publicKey ": Ġ[{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ" id ": Ġ" did : eth r : 0 xe 8 c 9 1 bde 7 6 2 5 ab 2 c 0 ed 9 f 2 1 4 deb 3 9 4 4 0 da 7 e 0 3 c 4 # keys - 1 ", ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ" type ": Ġ" Sec p 2 5 6 k 1 Verification Key 2 0 1 8 ", ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ" owner ": Ġ" did : eth r : 0 xe 8 c 9 1 bde 7 6 2 5 ab 2 c 0 ed 9 f 2 1 4 deb 3 9 4 4 0 da 7 e 0 3 c 4 ", ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ" publicKey Hex ": Ġ" 0 4 6 1 3 bb 3 a 4 8 7 4 d 2 7 0 3 2 6 1 8 f 0 2 0 6 1 4 c 2 1 cbe 4 c 4 e 4 7 8 1 6 8 7 5 2 5 f 6 6 7 4 0 8 9 f 9 bd 3 d 6 c 7 f 6 eb 1 3 5 6 9 0 5 3 d 3 1 7 1 5 a 3 ba 3 2 e 0 b 7 9 1 b 9 7 9 2 2 af 6 3 8 7 f 0 8 7 d 6 b 5 5 4 8 c 0 6 9 4 4 ab 0 6 1 " ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ}, Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ" id ": Ġ" did : eth r : 0 xe 8 c 9 1 bde 7 6 2 5 ab 2 c 0 ed 9 f 2 1 4 deb 3 9 4 4 0 da 7 e 0 3 c 4 # keys - 2 ", ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ" type ": Ġ" Sec p 2 5 6 k 1 Signature Verification Key 2 0 1 8 ", ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ" owner ": Ġ" did : eth r : 0 xe 8 c 9 1 bde 7 6 2 5 ab 2 c 0 ed 9 f 2 1 4 deb 3 9 4 4 0 da 7 e 0 3 c 4 ", ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ" publicKey Hex ": Ġ" 0 4 6 1 3 bb 3 a 4 8 7 4 d 2 7 0 3 2 6 1 8 f 0 2 0 6 1 4 c 2 1 cbe 4 c 4 e 4 7 8 1 6 8 7 5 2 5 f 6 6 7 4 0 8 9 f 9 bd 3 d 6 c 7 f 6 eb 1 3 5 6 9 0 5 3 d 3 1 7 1 5 a 3 ba 3 2 e 0 b 7 9 1 b 9 7 9 2 2 af 6 3 8 7 f 0 8 7 d 6 b 5 5 4 8 c 0 6 9 4 4 ab 0 6 1 " ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ}, Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ" id ": Ġ" did : eth r : 0 xe 8 c 9 1 bde 7 6 2 5 ab 2 c 0 ed 9 f 2 1 4 deb 3 9 4 4 0 da 7 e 0 3 c 4 # keys - 3 ", ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ" type ": Ġ" Sec p 2 5 6 k 1 Signature Authentication 2 0 1 8 ", ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ" owner ": Ġ" did : eth r : 0 xe 8 c 9 1 bde 7 6 2 5 ab 2 c 0 ed 9 f 2 1 4 deb 3 9 4 4 0 da 7 e 0 3 c 4 ", ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ" publicKey Hex ": Ġ" 0 4 6 1 3 bb 3 a 4 8 7 4 d 2 7 0 3 2 6 1 8 f 0 2 0 6 1 4 c 2 1 cbe 4 c 4 e 4 7 8 1 6 8 7 5 2 5 f 6 6 7 4 0 8 9 f 9 bd 3 d 6 c 7 f 6 eb 1 3 5 6 9 0 5 3 d 3 1 7 1 5 a 3 ba 3 2 e 0 b 7 9 1 b 9 7 9 2 2 af 6 3 8 7 f 0 8 7 d 6 b 5 5 4 8 c 0 6 9 4 4 ab 0 6 1 " ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ}, Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ" id ": Ġ" did : eth r : 0 xe 8 c 9 1 bde 7 6 2 5 ab 2 c 0 ed 9 f 2 1 4 deb 3 9 4 4 0 da 7 e 0 3 c 4 # keys - 3 ", ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ" type ": Ġ" Curve 2 5 5 1 9 Encryption PublicKey ", ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ" owner ": Ġ" did : eth r : 0 xe 8 c 9 1 bde 7 6 2 5 ab 2 c 0 ed 9 f 2 1 4 deb 3 9 4 4 0 da 7 e 0 3 c 4 ", ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ" publicKey Hex ": Ġ" 0 4 6 1 3 bb 3 a 4 8 7 4 d 2 7 0 3 2 6 1 8 f 0 2 0 6 1 4 c 2 1 cbe 4 c 4 e 4 7 8 1 6 8 7 5 2 5 f 6 6 7 4 0 8 9 f 9 bd 3 d 6 c 7 f 6 eb 1 3 5 6 9 0 5 3 d 3 1 7 1 5 a 3 ba 3 2 e 0 b 7 9 1 b 9 7 9 2 2 af 6 3 8 7 f 0 8 7 d 6 b 5 5 4 8 c 0 6 9 4 4 ab 0 6 1 " ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ}], ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ" authentication ": Ġ[{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ" type ": Ġ" Sec p 2 5 6 k 1 Verification Key 2 0 1 8 ", ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ" publicKey ": Ġ" did : eth r : 0 xe 8 c 9 1 bde 7 6 2 5 ab 2 c 0 ed 9 f 2 1 4 deb 3 9 4 4 0 da 7 e 0 3 c 4 # keys - 1 " ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ}, Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ" type ": Ġ" Sec p 2 5 6 k 1 Signature Verification Key 2 0 1 8 ", ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ" publicKey ": Ġ" did : eth r : 0 xe 8 c 9 1 bde 7 6 2 5 ab 2 c 0 ed 9 f 2 1 4 deb 3 9 4 4 0 da 7 e 0 3 c 4 # keys - 2 " ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ}], ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ" service ": Ġ[], ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ"@ context ": Ġ" https :// w 3 id . org / did / v 1 " ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ""" ĊĠĠĠĠĠĠĠ Ġ) ĊĊĠĠĠĠĠĠĠ Ġmock k Object ( Universal DID ) ĊĊĠĠĠĠĠĠĠ Ġco Every Ġ{ ĠUniversal DID . resolve ( issuer ) Ġ}. returns ( doc ) ĊĊĠĠĠĠĠĠĠ Ġval Ġauthentic ators Ġ= ĠJWT Tools (). resolve Authenticator ( alg , Ġissuer , Ġauth ) ĊĊĠĠĠĠĠĠĠ ĠassertThat ( auth entic ators ). isEqualTo ( listOf ( doc . publicKey [ 0 ], Ġdoc . publicKey [ 1 ])) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` errors Ġif Ġno Ġsuitable Ġpublic Ġkeys Ġexist Ġfor Ġauthentication `() Ġ= Ġrun Blocking Ġ{ ĊĊĠĠĠĠĠĠĠ Ġval Ġalg Ġ= Ġ" ES 2 5 6 K " ĊĠĠĠĠĠĠĠ Ġval Ġissuer Ġ= Ġ" did : eth r : 0 xe 8 c 9 1 bde 7 6 2 5 ab 2 c 0 ed 9 f 2 1 4 deb 3 9 4 4 0 da 7 e 0 3 c 4 " ĊĠĠĠĠĠĠĠ Ġval Ġauth Ġ= Ġtrue ĊĠĠĠĠĠĠĠ Ġval Ġdoc Ġ= ĠE thr DID Document . fromJson ( ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ""" ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ" id ": Ġ" did : eth r : 0 xe 8 c 9 1 bde 7 6 2 5 ab 2 c 0 ed 9 f 2 1 4 deb 3 9 4 4 0 da 7 e 0 3 c 4 ", ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ" publicKey ": Ġ[{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ" id ": Ġ" did : eth r : 0 xe 8 c 9 1 bde 7 6 2 5 ab 2 c 0 ed 9 f 2 1 4 deb 3 9 4 4 0 da 7 e 0 3 c 4 # keys - 1 ", ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ" type ": Ġ" Sec p 2 5 6 k 1 Verification Key 2 0 1 8 ", ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ" owner ": Ġ" did : eth r : 0 xe 8 c 9 1 bde 7 6 2 5 ab 2 c 0 ed 9 f 2 1 4 deb 3 9 4 4 0 da 7 e 0 3 c 4 ", ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ" publicKey Hex ": Ġ" 0 4 6 1 3 bb 3 a 4 8 7 4 d 2 7 0 3 2 6 1 8 f 0 2 0 6 1 4 c 2 1 cbe 4 c 4 e 4 7 8 1 6 8 7 5 2 5 f 6 6 7 4 0 8 9 f 9 bd 3 d 6 c 7 f 6 eb 1 3 5 6 9 0 5 3 d 3 1 7 1 5 a 3 ba 3 2 e 0 b 7 9 1 b 9 7 9 2 2 af 6 3 8 7 f 0 8 7 d 6 b 5 5 4 8 c 0 6 9 4 4 ab 0 6 1 " ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ}], ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ" authentication ": Ġ[], ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ" service ": Ġ[], ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ"@ context ": Ġ" https :// w 3 id . org / did / v 1 " ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ""" ĊĠĠĠĠĠĠĠ Ġ) ĊĊĠĠĠĠĠĠĠ Ġmock k Object ( Universal DID ) ĊĊĠĠĠĠĠĠĠ Ġco Every Ġ{ ĠUniversal DID . resolve ( issuer ) Ġ}. returns ( doc ) ĊĊĠĠĠĠĠĠĠ Ġco Assert Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ ĠJWT Tools (). resolve Authenticator ( alg , Ġissuer , Ġauth ) ĊĠĠĠĠĠĠĠ Ġ}. throw n Error Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġis InstanceOf ( Invalid JWT Exception :: class ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` errors Ġif Ġno Ġpublic Ġkeys Ġexist `() Ġ= Ġrun Blocking Ġ{ ĊĊĠĠĠĠĠĠĠ Ġval Ġalg Ġ= Ġ" ES 2 5 6 K " ĊĠĠĠĠĠĠĠ Ġval Ġissuer Ġ= Ġ" did : eth r : 0 xe 8 c 9 1 bde 7 6 2 5 ab 2 c 0 ed 9 f 2 1 4 deb 3 9 4 4 0 da 7 e 0 3 c 4 " ĊĠĠĠĠĠĠĠ Ġval Ġauth Ġ= Ġfalse ĊĠĠĠĠĠĠĠ Ġval Ġdoc Ġ= ĠE thr DID Document . fromJson ( ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ""" ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ" id ": Ġ" did : eth r : 0 xe 8 c 9 1 bde 7 6 2 5 ab 2 c 0 ed 9 f 2 1 4 deb 3 9 4 4 0 da 7 e 0 3 c 4 ", ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ" publicKey ": Ġ[], ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ" authentication ": Ġ[], ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ" service ": Ġ[], ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ"@ context ": Ġ" https :// w 3 id . org / did / v 1 " ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ""" ĊĠĠĠĠĠĠĠ Ġ) ĊĊĠĠĠĠĠĠĠ Ġmock k Object ( Universal DID ) ĊĊĠĠĠĠĠĠĠ Ġco Every Ġ{ ĠUniversal DID . resolve ( issuer ) Ġ}. returns ( doc ) ĊĊĠĠĠĠĠĠĠ Ġco Assert Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ ĠJWT Tools (). resolve Authenticator ( alg , Ġissuer , Ġauth ) ĊĠĠĠĠĠĠĠ Ġ}. throw n Error Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġis InstanceOf ( Invalid JWT Exception :: class ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` errors Ġif Ġno Ġsupported Ġsignature Ġtypes Ġexist `() Ġ= Ġrun Blocking Ġ{ ĊĊĠĠĠĠĠĠĠ Ġval Ġalg Ġ= Ġ" ES BAD " ĊĠĠĠĠĠĠĠ Ġval Ġissuer Ġ= Ġ" did : eth r : 0 xe 8 c 9 1 bde 7 6 2 5 ab 2 c 0 ed 9 f 2 1 4 deb 3 9 4 4 0 da 7 e 0 3 c 4 " ĊĠĠĠĠĠĠĠ Ġval Ġauth Ġ= Ġfalse ĊĠĠĠĠĠĠĠ Ġval Ġdoc Ġ= ĠE thr DID Document . fromJson ( ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ""" ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ" id ": Ġ" did : eth r : 0 xe 8 c 9 1 bde 7 6 2 5 ab 2 c 0 ed 9 f 2 1 4 deb 3 9 4 4 0 da 7 e 0 3 c 4 ", ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ" publicKey ": Ġ[], ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ" authentication ": Ġ[], ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ" service ": Ġ[], ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ"@ context ": Ġ" https :// w 3 id . org / did / v 1 " ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ""" ĊĠĠĠĠĠĠĠ Ġ) ĊĊĠĠĠĠĠĠĠ Ġmock k Object ( Universal DID ) ĊĊĠĠĠĠĠĠĠ Ġco Every Ġ{ ĠUniversal DID . resolve ( issuer ) Ġ}. returns ( doc ) ĊĊĠĠĠĠĠĠĠ Ġco Assert Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ ĠJWT Tools (). resolve Authenticator ( alg , Ġissuer , Ġauth ) ĊĠĠĠĠĠĠĠ Ġ}. throw n Error Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġis InstanceOf ( JWT EncodingException :: class ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` can Ġverify Ġa Ġfresh ly Ġmint ed Ġtoken `() Ġ= Ġrun Blocking Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġsigner Ġ= ĠK P Signer (" 0 x 1 2 3 4 ") ĊĠĠĠĠĠĠĠ Ġval Ġdid Ġ= Ġ" did : eth r :${ signer . getAddress () }" ĊĊĠĠĠĠĠĠĠ Ġval Ġresolver Ġ= Ġspy k ( ĊĠĠĠĠĠĠĠĠĠĠĠ ĠE thr DID Resolver . Builder () ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. add Network ( E thr DID Network ("", Ġ" 0 x registry ", ĠJson RPC (" "))) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. build () ĊĠĠĠĠĠĠĠ Ġ) ĊĊĠĠĠĠĠĠĠ Ġco Every Ġ{ Ġresolver . resolve ( eq ( did )) Ġ} Ġreturns ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠE thr DID Test Helpers . mock Doc For Address ( signer . getAddress ()) ĊĊĠĠĠĠĠĠĠ ĠUniversal DID . register Resolver ( resolver ) ĊĊĠĠĠĠĠĠĠ Ġval Ġtoken Ġ= ĠJWT Tools (). create JWT ( empty Map (), Ġdid , Ġsigner ) ĊĠĠĠĠĠĠĠ Ġval Ġpayload Ġ= ĠJWT Tools (). verify ( token ) ĊĠĠĠĠĠĠĠ ĠassertThat ( payload ). isNotNull () ĊĠĠĠĠĠĠĠ ĠUnit ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` can Ġverify Ġa ĠES 2 5 6 K Ġsignature Ġwith Ġonly Ġe thereum Address Ġin Ġthe ĠD ID Ġdoc `() Ġ= Ġrun Blocking Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġaddress Ġ= Ġ" 0 xcf 0 3 dd 0 a 8 9 4 ef 7 9 cb 5 b 6 0 1 a 4 3 c 4 b 2 5 e 3 ae 4 c 6 7 ed " ĊĊĠĠĠĠĠĠĠ Ġval Ġresolver Ġ= Ġspy k ( ĊĠĠĠĠĠĠĠĠĠĠĠ ĠE thr DID Resolver . Builder () ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. add Network ( E thr DID Network ("", Ġ" 0 x registry ", ĠJson RPC (" "))) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. build () ĊĠĠĠĠĠĠĠ Ġ) ĊĊĠĠĠĠĠĠĠ Ġco Every Ġ{ Ġresolver . resolve ( eq (" did : eth r :$ address ")) Ġ} Ġreturns ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠE thr DID Test Helpers . mock Doc For Address ( address ) ĊĊĠĠĠĠĠĠĠ ĠUniversal DID . register Resolver ( resolver ) ĊĊĠĠĠĠĠĠĠ Ġval Ġtoken Ġ= ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ" ey J 0 e X Ai OiJ KV 1 Qi LCJ hb G ci OiJ FU z I 1 N ks if Q . ey Jo ZW xs by I 6 Ind v cm xk Iiw ia WF 0 Ij ox N TY x OT cx M TE 5 LCJ pc 3 Mi OiJ ka WQ 6 Z XR oc j owe GN m MD Nk Z DB h OD k 0 ZW Y 3 OWN i N WI 2 M DF h ND Nj NG Iy N WU z YW U 0 Yz Y 3 ZW Q if Q . t 5 o 1 vz Z Ex A rl rr TV H mw tti 7 fn ic X qv Wr X 6 SS 3 F - Lu 3 bud H 7 p 6 z Q Hj G 8 X 7 Ev UT RU xh vr - e ENC b X ete SE 4 rg F 7 MA " ĊĠĠĠĠĠĠĠ Ġval Ġpayload Ġ= ĠJWT Tools (). verify ( token ) ĊĠĠĠĠĠĠĠ ĠassertThat ( payload . iss ). isEqualTo (" did : eth r :$ address ") ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` can Ġcreate Ġtoken Ġfrom Ġmap Ġof Ġclaims `() Ġ= Ġrun Blocking Ġ{ ĊĊĠĠĠĠĠĠĠ Ġval Ġtested Ġ= ĠJWT Tools ( Test Time Provider ( 1 2 3 4 5 6 7 8 0 0 0 L )) ĊĊĠĠĠĠĠĠĠ Ġval Ġpayload Ġ= Ġmap Of ( ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ" claims " Ġto Ġmap Of (" name " Ġto Ġ" R ĠD ane el ĠO liv aw ") ĊĠĠĠĠĠĠĠ Ġ) ĊĊĠĠĠĠĠĠĠ Ġval Ġsigner Ġ= ĠK P Signer (" 0 x 5 4 ece 2 1 4 d 3 8 fe 6 b 4 6 1 1 0 a 2 1 c 6 9 fd 5 5 2 3 0 f 0 9 6 8 8 bf 8 5 b 9 5 fc 7 c 1 e 4 e 1 6 0 4 4 1 ece 1 ") ĊĠĠĠĠĠĠĠ Ġval Ġissuer DID Ġ= Ġ" did : eth r :${ signer . getAddress () }" ĊĊĠĠĠĠĠĠĠ Ġval Ġjwt Ġ= Ġtested . create JWT ( payload , Ġissuer DID , Ġsigner ) ĊĠĠĠĠĠĠĠ ĠassertThat ( jwt ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. isEqualTo (" ey J 0 e X Ai OiJ KV 1 Qi LCJ hb G ci OiJ FU z I 1 Nk st Ui J 9 . ey J jb GF pb X Mi On s ibm Ft Z SI 6 Il Ig R GF u ZW Vs IE 9 sa X Zh dy J 9 LCJ p YX Qi Oj Ey Mz Q 1 N jc 4 LCJ le HA i Oj Ey Mz Q 1 OT c 4 LCJ pc 3 Mi OiJ ka WQ 6 Z XR oc j owe DQ x Mj Nj Ym Qx ND Ni NT Vj MD Zl ND Ux Zm Yy NT Nh Zj A 5 Mj g 2 Yj Y 4 N 2 E 5 NT A if Q . o 6 e DK Yj HJ nak 1 yl k pe 9 g 8 k rx v K 9 UE h Kf - 1 T 0 EY h H 8 p G yb 8 Mj OE ep R Ji 8 DY l V En Z no 0 Dk V YX Q Cf 3 u 1 i _ H Th BK t AA ") ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` can Ġnormalize Ġd ids `() Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġup ort DID Ġ= Ġ" did : uport : 2 oe X uf H GD p U 5 1 bf KB s ZD du 7 Je 9 we J 3 r 7 s VG " ĊĠĠĠĠĠĠĠ Ġval Ġmn id Ġ= Ġ" 2 oe X uf H GD p U 5 1 bf KB s ZD du 7 Je 9 we J 3 r 7 s VG " ĊĠĠĠĠĠĠĠ Ġval Ġeth r DID Ġ= Ġ" did : eth r : 0 xe 8 c 9 1 bde 7 6 2 5 ab 2 c 0 ed 9 f 2 1 4 deb 3 9 4 4 0 da 7 e 0 3 c 4 " ĊĠĠĠĠĠĠĠ Ġval Ġeth r Address Ġ= Ġ" 0 xe 8 c 9 1 bde 7 6 2 5 ab 2 c 0 ed 9 f 2 1 4 deb 3 9 4 4 0 da 7 e 0 3 c 4 " ĊĠĠĠĠĠĠĠ Ġval Ġinvalid DID Ġ= Ġ" ey J 0 e X Ai OiJ KV 1 Qi LCJ hb G ci OiJ FU z I 1 Nk st Ui J 9 " ĊĊĠĠĠĠĠĠĠ ĠassertThat ( normalize Known DID ( uport DID )). isEqualTo ( uport DID ) ĊĠĠĠĠĠĠĠ ĠassertThat ( normalize Known DID ( mn id )). isEqualTo ( uport DID ) ĊĠĠĠĠĠĠĠ ĠassertThat ( normalize Known DID ( eth r DID )). isEqualTo ( eth r DID ) ĊĠĠĠĠĠĠĠ ĠassertThat ( normalize Known DID ( eth r Address )). isEqualTo ( eth r DID ) ĊĠĠĠĠĠĠĠ ĠassertThat ( normalize Known DID ( invalid DID )). isEqualTo ( invalid DID ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` ign ores Ġexpired InSeconds Ġparam Ġwhen Ġexp Ġis Ġalready Ġset Ġin Ġpayload `() Ġ= Ġrun Blocking Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġtested Ġ= ĠJWT Tools () ĊĊĠĠĠĠĠĠĠ Ġval Ġpayload Ġ= Ġmap Of (" exp " Ġto Ġ 4 3 2 1 0 1 2 3 4 L ) ĊĠĠĠĠĠĠĠ Ġval Ġsigner Ġ= ĠK P Signer (" 0 x 1 2 3 4 ") ĊĠĠĠĠĠĠĠ Ġval Ġissuer DID Ġ= Ġ" did : eth r :${ signer . getAddress () }" ĊĊĠĠĠĠĠĠĠ Ġval Ġjwt Ġ= Ġtested . create JWT ( payload , Ġissuer DID , Ġsigner , Ġexpires InSeconds Ġ= Ġ 1 2 3 4 L ) ĊĊĠĠĠĠĠĠĠ Ġval Ġ(_, Ġdec , Ġ_) Ġ= Ġtested . decode ( jwt ) ĊĠĠĠĠĠĠĠ ĠassertThat ( dec . exp ). isEqualTo ( 4 3 2 1 0 1 2 3 4 L ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` sets Ġexp Ġbased Ġon Ġexpires InSeconds `() Ġ= Ġrun Blocking Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġtested Ġ= ĠJWT Tools ( Test Time Provider ( 1 1 1 1 0 0 0 L )) ĊĊĠĠĠĠĠĠĠ Ġval Ġpayload Ġ= Ġmap Of (" hello " Ġto Ġ" world ") ĊĠĠĠĠĠĠĠ Ġval Ġsigner Ġ= ĠK P Signer (" 0 x 1 2 3 4 ") ĊĠĠĠĠĠĠĠ Ġval Ġissuer DID Ġ= Ġ" did : eth r :${ signer . getAddress () }" ĊĊĠĠĠĠĠĠĠ Ġval Ġjwt Ġ= Ġtested . create JWT ( payload , Ġissuer DID , Ġsigner , Ġexpires InSeconds Ġ= Ġ 4 2 L ) ĊĊĠĠĠĠĠĠĠ Ġval Ġ(_, Ġdec , Ġ_) Ġ= Ġtested . decode ( jwt ) ĊĠĠĠĠĠĠĠ ĠassertThat ( dec . exp ). isEqualTo ( 1 1 5 3 L ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` re moves Ġexp Ġwhen Ġpayload Ġsets Ġit Ġto Ġnull `() Ġ= Ġrun Blocking Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġtested Ġ= ĠJWT Tools () ĊĊĠĠĠĠĠĠĠ Ġval Ġpayload Ġ= Ġmap Of (" exp " Ġto Ġnull ) ĊĠĠĠĠĠĠĠ Ġval Ġsigner Ġ= ĠK P Signer (" 0 x 1 2 3 4 ") ĊĠĠĠĠĠĠĠ Ġval Ġissuer DID Ġ= Ġ" did : eth r :${ signer . getAddress () }" ĊĊĠĠĠĠĠĠĠ Ġval Ġjwt Ġ= Ġtested . create JWT ( payload , Ġissuer DID , Ġsigner ) ĊĊĠĠĠĠĠĠĠ Ġval Ġ(_, Ġdecoded , Ġ_) Ġ= Ġtested . decode Raw ( jwt ) ĊĠĠĠĠĠĠĠ ĠassertThat ( decoded . containsKey (" exp ")). isFalse () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` re moves Ġexp Ġwhen Ġexpiry Ġinterval Ġis Ġnegative `() Ġ= Ġrun Blocking Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġtested Ġ= ĠJWT Tools () ĊĊĠĠĠĠĠĠĠ Ġval Ġpayload Ġ= Ġmap Of (" exp " Ġto Ġ 1 2 3 4 ) ĊĠĠĠĠĠĠĠ Ġval Ġsigner Ġ= ĠK P Signer (" 0 x 1 2 3 4 ") ĊĠĠĠĠĠĠĠ Ġval Ġissuer DID Ġ= Ġ" did : eth r :${ signer . getAddress () }" ĊĊĠĠĠĠĠĠĠ Ġval Ġjwt Ġ= Ġtested . create JWT ( payload , Ġissuer DID , Ġsigner , Ġexpires InSeconds Ġ= Ġ- 1 ) ĊĊĠĠĠĠĠĠĠ Ġval Ġ(_, Ġdecoded , Ġ_) Ġ= Ġtested . decode Raw ( jwt ) ĊĠĠĠĠĠĠĠ ĠassertThat ( decoded . containsKey (" exp ")). isFalse () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` re moves Ġi at Ġwhen Ġexplicitly Ġset Ġas Ġnull `() Ġ= Ġrun Blocking Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġtested Ġ= ĠJWT Tools () ĊĊĠĠĠĠĠĠĠ Ġval Ġpayload Ġ= Ġmap Of (" iat " Ġto Ġnull ) ĊĊĠĠĠĠĠĠĠ Ġval Ġjwt Ġ= Ġtested . create JWT ( payload , Ġ" did : ex : ex ", ĠK P Signer (" 0 x 1 2 3 4 ")) ĊĊĠĠĠĠĠĠĠ Ġval Ġ(_, Ġdecoded , Ġ_) Ġ= Ġtested . decode Raw ( jwt ) ĊĠĠĠĠĠĠĠ ĠassertThat ( decoded . containsKey (" iat ")). isFalse () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` iat Ġset Ġby Ġdefault Ġwhen Ġnot Ġspecified `() Ġ= Ġrun Blocking Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġtested Ġ= ĠJWT Tools () ĊĊĠĠĠĠĠĠĠ Ġval Ġjwt Ġ= Ġtested . create JWT ( empty Map (), Ġ" did : ex : ex ", ĠK P Signer (" 0 x 1 2 3 4 ")) ĊĊĠĠĠĠĠĠĠ Ġval Ġ(_, Ġdecoded , Ġ_) Ġ= Ġtested . decode Raw ( jwt ) ĊĠĠĠĠĠĠĠ ĠassertThat ( decoded . containsKey (" iat ")). isTrue () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` default Ġi at Ġis Ġoverridden Ġby Ġpayload `() Ġ= Ġrun Blocking Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġtested Ġ= ĠJWT Tools () ĊĊĠĠĠĠĠĠĠ Ġval Ġpayload Ġ= Ġmap Of (" iat " Ġto Ġ 5 6 7 8 L ) ĊĠĠĠĠĠĠĠ Ġval Ġjwt Ġ= Ġtested . create JWT ( payload , Ġ" did : ex : ex ", ĠK P Signer (" 0 x 1 2 3 4 ")) ĊĊĠĠĠĠĠĠĠ Ġval Ġ(_, Ġdecoded , Ġ_) Ġ= Ġtested . decode Raw ( jwt ) ĊĠĠĠĠĠĠĠ ĠassertThat ( decoded [" iat "]). isEqualTo ( 5 6 7 8 L ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` default Ġiss Ġis Ġoverridden Ġby Ġpayload `() Ġ= Ġrun Blocking Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġtested Ġ= ĠJWT Tools () ĊĊĠĠĠĠĠĠĠ Ġval Ġpayload Ġ= Ġmap Of (" iss " Ġto Ġ" example . issuer ") ĊĠĠĠĠĠĠĠ Ġval Ġjwt Ġ= Ġtested . create JWT ( payload , Ġ" did : ex : ex ", ĠK P Signer (" 0 x 1 2 3 4 ")) ĊĊĠĠĠĠĠĠĠ Ġval Ġ(_, Ġdecoded , Ġ_) Ġ= Ġtested . decode Raw ( jwt ) ĊĠĠĠĠĠĠĠ ĠassertThat ( decoded [" iss "]). isEqualTo (" example . issuer ") ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` default Ġiss Ġis Ġremoved Ġby Ġpayload `() Ġ= Ġrun Blocking Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġtested Ġ= ĠJWT Tools () ĊĊĠĠĠĠĠĠĠ Ġval Ġpayload Ġ= Ġmap Of (" iss " Ġto Ġnull ) ĊĠĠĠĠĠĠĠ Ġval Ġjwt Ġ= Ġtested . create JWT ( payload , Ġ" did : ex : ex ", ĠK P Signer (" 0 x 1 2 3 4 ")) ĊĊĠĠĠĠĠĠĠ Ġval Ġ(_, Ġdecoded , Ġ_) Ġ= Ġtested . decode Raw ( jwt ) ĊĠĠĠĠĠĠĠ ĠassertThat ( decoded . containsKey (" iss ")). isFalse () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` iss Ġis Ġset Ġby Ġdefault `() Ġ= Ġrun Blocking Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġtested Ġ= ĠJWT Tools () ĊĊĠĠĠĠĠĠĠ Ġval Ġjwt Ġ= Ġtested . create JWT ( empty Map (), Ġ" did : ex : ex ", ĠK P Signer (" 0 x 1 2 3 4 ")) ĊĊĠĠĠĠĠĠĠ Ġval Ġ(_, Ġdecoded , Ġ_) Ġ= Ġtested . decode Raw ( jwt ) ĊĠĠĠĠĠĠĠ ĠassertThat ( decoded [" iss "]). isEqualTo (" did : ex : ex ") ĊĠĠĠ Ġ} Ċ } ĊĊĊ