Skip to content

Commit 62ec6fb

Browse files
author
Greg Bowler
committed
feature: switch to json serialisation for language interoperability
1 parent a19260d commit 62ec6fb

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/Authenticator.php

+5-5
Original file line numberDiff line numberDiff line change
@@ -137,12 +137,12 @@ private function completeAuth():void {
137137
$secretSessionIv = $token->getSecretIv();
138138
$encrypted = new EncryptedMessage($queryData, $secretSessionIv);
139139
$key = new Key($this->clientKey);
140-
$decrypt = $encrypted->decrypt($key);
141-
parse_str($decrypt, $data);
140+
$decrypted = $encrypted->decrypt($key);
141+
$data = json_decode($decrypted);
142142
$userData = new UserResponseData(
143-
$data["id"],
144-
$data["email"],
145-
$data["kvp"] ?? [],
143+
$data->{"id"},
144+
$data->{"email"},
145+
$data->{"kvp"} ?? [],
146146
);
147147

148148
$this->session->set(

test/phpunit/AuthenticatorTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ public function testCompleteAuthNotLoggedIn() {
200200
public function testCompleteAuth() {
201201
$keyBytes = str_repeat("0", SODIUM_CRYPTO_SECRETBOX_KEYBYTES);
202202
$ivBytes = str_repeat("1", SODIUM_CRYPTO_SECRETBOX_NONCEBYTES);
203-
$plainTextMessage = http_build_query([
203+
$plainTextMessage = json_encode([
204204
"id" => 123,
205205
"email" => "[email protected]",
206206
]);

0 commit comments

Comments
 (0)