package Ġorg . did comm x . peer did . core Ċ Ċ import Ġcom . google . gson . Gson Ċ import Ġcom . google . gson . Json Syntax Exception Ċ import Ġorg . did comm x . peer did . Verification Material Peer DID Ċ import Ġorg . did comm x . peer did . Verification MethodType Agreement Ċ import Ġorg . did comm x . peer did . Verification MethodType Authentication Ċ import Ġorg . did comm x . peer did . Verification MethodType Peer DID Ċ Ċ internal Ġfun Ġvalidate Authentication Material Type ( verification Material : ĠVerification Material Peer DID < out ĠVerification MethodType Peer DID >) Ġ{ ĊĠĠĠ Ġif Ġ( verification Material . type Ġ! is ĠVerification MethodType Authentication ) ĊĠĠĠĠĠĠĠ Ġthrow ĠIllegalArgumentException (" Invalid Ġverification Ġmaterial Ġtype : Ġ${ verification Material . type } Ġinstead Ġof ĠVerification Material Authentication ") Ċ } Ċ Ċ internal Ġfun Ġvalidate Agreement Material Type ( verification Material : ĠVerification Material Peer DID < out ĠVerification MethodType Peer DID >) Ġ{ ĊĠĠĠ Ġif Ġ( verification Material . type Ġ! is ĠVerification MethodType Agreement ) ĊĠĠĠĠĠĠĠ Ġthrow ĠIllegalArgumentException (" Invalid Ġverification Ġmaterial Ġtype : Ġ${ verification Material . type } Ġinstead Ġof ĠVerification Material Agreement ") Ċ } Ċ Ċ internal Ġfun Ġvalidate Json ( value : ĠString ) Ġ{ ĊĠĠĠ Ġval Ġgson Ġ= ĠGson () ĊĠĠĠ Ġtry Ġ{ ĊĠĠĠĠĠĠĠ Ġgson . fromJson ( value , ĠAny :: class . java ) ĊĠĠĠ Ġ} Ġcatch Ġ( ex : ĠJson Syntax Exception ) Ġ{ ĊĠĠĠĠĠĠĠ Ġthrow ĠIllegalArgumentException (" Invalid ĠJSON Ġ$ value ", Ġex ) ĊĠĠĠ Ġ} ĊĠĠĠ Ġif Ġ(! value . contains ("{ ")) Ġthrow ĠIllegalArgumentException (" Invalid ĠJSON Ġ$ value ") Ċ } Ċ Ċ internal Ġfun Ġvalidate Raw Key Length ( key : ĠByteArray ) Ġ{ ĊĠĠĠ Ġ// Ġfor Ġall Ġsupported Ġkey Ġtypes Ġnow Ġ( ED 2 5 5 1 9 Ġand ĠX 2 5 5 1 0 ) Ġthe Ġexpected Ġsize Ġis Ġ 3 2 ĊĠĠĠ Ġif Ġ( key . size Ġ!= Ġ 3 2 ) ĊĠĠĠĠĠĠĠ Ġthrow ĠIllegalArgumentException (" Invalid Ġkey Ġ$ key ") Ċ } Ċ