Skip to content

Commit aaede5f

Browse files
committed
Optimization code
1 parent 9a429ea commit aaede5f

File tree

3 files changed

+2
-10
lines changed

3 files changed

+2
-10
lines changed

rtc/example/example.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
$resp=$client->listRooms("dgbfvvzid", 'lfx', null, null);
3636
print_r($resp);exit;
3737
//鉴权的有效时间: 1个小时.
38-
$resp = $client->appToken("dgd3fky76", "lfxl", '1111', (time()+3600), 'user');
38+
$resp = $client->appToken("dgd4vecde", "lfxl", '1111', (time()+3600), 'user');
3939
print_r($resp);exit;
4040
} catch (\Exception $e) {
4141
echo "Error:", $e, "\n";

src/Qiniu/Auth.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,6 @@ public function getAccessKey()
1919
return $this->accessKey;
2020
}
2121

22-
public function getSecretKey()
23-
{
24-
return $this->secretKey;
25-
}
26-
2722
public function sign($data)
2823
{
2924
$hmac = hash_hmac('sha1', $data, $this->secretKey, true);

src/Qiniu/Rtc/AppClient.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -163,10 +163,7 @@ public function appToken($appId, $roomName, $userId, $expireAt, $permission)
163163
$params['permission'] = $permission;
164164
$params['expireAt'] = $expireAt;
165165
$appAccessString = json_encode($params);
166-
$encodedappAccess = \Qiniu\base64_urlSafeEncode($appAccessString);
167-
$sign = hash_hmac('sha1', $encodedappAccess, $this->auth->getSecretKey(), true);
168-
$encodedSign = \Qiniu\base64_urlSafeEncode($sign);
169-
return $this->auth->getAccessKey() . ":" . $encodedSign . ":" . $encodedappAccess;
166+
return $this->auth->signWithData($appAccessString);
170167
}
171168

172169
private function get($url, $cType = null)

0 commit comments

Comments
 (0)