Add ExportedSession and improve RPC client handling.

This commit is contained in:
netkas 2024-12-19 12:54:15 -05:00
parent 0b51b47859
commit 42ba7013f7
6 changed files with 469 additions and 236 deletions

View file

@ -11,7 +11,6 @@
{
print("Getting random encryption record\n");
$encryptionRecord = EncryptionRecordsManager::getRandomRecord();
var_dump($encryptionRecord);
print("Securing password\n");
$securedPassword = SecuredPassword::securePassword('123-123-123', 'password!', $encryptionRecord);

View file

@ -1,24 +1,21 @@
<?php
use Socialbox\Classes\SecuredPassword;
use Socialbox\Managers\EncryptionRecordsManager;
require 'ncc';
import('net.nosial.socialbox');
print("Getting random encryption record\n");
$encryptionRecord = EncryptionRecordsManager::getRandomRecord();
var_dump($encryptionRecord);
$client = new \Socialbox\Classes\RpcClient(generateRandomPeer());
var_dump($client->exportSession());
print("Securing password\n");
$securedPassword = SecuredPassword::securePassword('123-123-123', 'password!', $encryptionRecord);
function generateRandomPeer()
{
$characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
$charactersLength = strlen($characters);
$randomString = '';
print("Verifying password\n");
if(SecuredPassword::verifyPassword('password!', $securedPassword, EncryptionRecordsManager::getAllRecords()))
{
print("Password verified\n");
}
else
{
print("Password not verified\n");
for ($i = 0; $i < 16; $i++)
{
$randomString .= $characters[rand(0, $charactersLength - 1)];
}
return 'userTest' . $randomString . '@intvo.id';
}