Skip to content
This repository was archived by the owner on Dec 16, 2020. It is now read-only.

Commit 212043f

Browse files
committed
Fixes #141
1 parent 2ccff72 commit 212043f

1 file changed

Lines changed: 18 additions & 1 deletion

File tree

src/snapchat.php

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,7 @@ public function login($password, $force = FALSE)
365365
return $auth;
366366
}
367367
parent::setGAuth($auth);
368-
$attestation = $this->getAttestation($password, $timestamp);
368+
$attestation = $this->getAttestation($password, $timestamp);
369369

370370
$result = parent::post(
371371
'/loq/login',
@@ -477,13 +477,30 @@ public function logout()
477477
public function register($username, $password, $email, $birthday, $phone_verification = FALSE, $phone_number = NULL)
478478
{
479479
$timestamp = parent::timestamp();
480+
481+
$dtoken = $this->getDeviceToken();
482+
483+
if($dtoken['error'] == 1)
484+
{
485+
$return['message'] = "Failed to get new Device token set.";
486+
return $return;
487+
}
488+
489+
$attestation = $this->getAttestation($password, $timestamp);
490+
491+
$birthDate = explode("-", $birthday);
492+
$age = (date("md", date("U", mktime(0, 0, 0, $birthDate[0], $birthDate[1], $birthDate[2]))) > date("md") ? ((date("Y") - $birthDate[2]) - 1) : (date("Y") - $birthDate[2]));
480493
$result = parent::post(
481494
'/loq/register',
482495
array(
496+
'age' => $age,
497+
'dsig' => substr(hash_hmac('sha256', $string, $dtoken['data']->dtoken1v), 0, 20),
498+
'dtoken1i' => $dtoken['data']->dtoken1i,
483499
'birthday' => $birthday,
484500
'password' => $password,
485501
'email' => $email,
486502
'timestamp' => $timestamp,
503+
'attestation' => $attestation
487504
),
488505
array(
489506
parent::STATIC_TOKEN,

0 commit comments

Comments
 (0)