File tree 1 file changed +6
-4
lines changed
1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -12,19 +12,21 @@ class EncryptedUri {
12
12
13
13
public function __construct (
14
14
string |UriInterface $ uri ,
15
+ string $ cipherQueryStringParameter = "cipher " ,
16
+ string $ initVectorStringParameter = "iv " ,
15
17
) {
16
18
if (!$ uri instanceof UriInterface) {
17
19
$ uri = new Uri ($ uri );
18
20
}
19
21
20
22
parse_str ($ uri ->getQuery (), $ queryParams );
21
- $ cipher = $ queryParams [" cipher " ] ?? null ;
22
- $ iv = $ queryParams [" iv " ] ?? null ;
23
+ $ cipher = $ queryParams [$ cipherQueryStringParameter ] ?? null ;
24
+ $ iv = $ queryParams [$ initVectorStringParameter ] ?? null ;
23
25
if (!$ cipher || !is_string ($ cipher )) {
24
- throw new MissingQueryStringException (" cipher " );
26
+ throw new MissingQueryStringException ($ cipherQueryStringParameter );
25
27
}
26
28
if (!$ iv || !is_string ($ iv )) {
27
- throw new MissingQueryStringException (" iv " );
29
+ throw new MissingQueryStringException ($ initVectorStringParameter );
28
30
}
29
31
30
32
$ this ->encryptedBytes = base64_decode (str_replace (" " , "+ " , $ cipher ));
You can’t perform that action at this time.
0 commit comments