File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -109,14 +109,21 @@ const decryptFromBytes = async (encryptedBytes: Uint8Array) => {
109109 domain : 'localhost' ,
110110 uri : 'http://localhost:3000' ,
111111 } ;
112- const authProvider = new EIP4361AuthProvider (
113- provider ,
114- consumerSigner ,
115- siweParams ,
116- ) ;
117112 const conditionContext =
118113 conditions . context . ConditionContext . fromMessageKit ( messageKit ) ;
119- conditionContext . addAuthProvider ( USER_ADDRESS_PARAM_DEFAULT , authProvider ) ;
114+
115+ // illustrative optional example of checking what context parameters are required
116+ // unnecessary if you already know what the condition contains
117+ if (
118+ conditionContext . requestedContextParameters . has ( USER_ADDRESS_PARAM_DEFAULT )
119+ ) {
120+ const authProvider = new EIP4361AuthProvider (
121+ provider ,
122+ consumerSigner ,
123+ siweParams ,
124+ ) ;
125+ conditionContext . addAuthProvider ( USER_ADDRESS_PARAM_DEFAULT , authProvider ) ;
126+ }
120127 return decrypt ( provider , domain , messageKit , conditionContext ) ;
121128} ;
122129
You can’t perform that action at this time.
0 commit comments