Skip to content

Commit ad407ca

Browse files
committed
you can use url-safe base64 encoded keys, close #13
1 parent 4144edf commit ad407ca

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/Encryption.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,16 +33,16 @@ public static function padPayload($payload, $automatic)
3333

3434
/**
3535
* @param string $payload With padding
36-
* @param string $userPublicKey MIME base 64 encoded
37-
* @param string $userAuthToken MIME base 64 encoded
36+
* @param string $userPublicKey Base 64 encoded (MIME or URL-safe)
37+
* @param string $userAuthToken Base 64 encoded (MIME or URL-safe)
3838
* @param bool $nativeEncryption Use OpenSSL (>PHP7.1)
3939
*
4040
* @return array
4141
*/
4242
public static function encrypt($payload, $userPublicKey, $userAuthToken, $nativeEncryption)
4343
{
44-
$userPublicKey = base64_decode($userPublicKey);
45-
$userAuthToken = base64_decode($userAuthToken);
44+
$userPublicKey = Base64Url::decode($userPublicKey);
45+
$userAuthToken = Base64Url::decode($userAuthToken);
4646

4747
// initialize utilities
4848
$math = EccFactory::getAdapter();

0 commit comments

Comments
 (0)