1.0.0 Alpha Release #59
3 changed files with 7 additions and 8 deletions
|
@ -96,8 +96,7 @@
|
|||
}
|
||||
|
||||
$VaultArray = ZiProto::decode(IO::fread($this->CredentialsPath));
|
||||
$VaultObject = new Vault();
|
||||
$VaultObject->fromArray($VaultArray);
|
||||
$VaultObject = Vault::fromArray($VaultArray);
|
||||
|
||||
if($VaultObject->Version !== Versions::CredentialsStoreVersion)
|
||||
throw new RuntimeException('Credentials store version mismatch');
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
namespace ncc\Objects;
|
||||
|
||||
use ncc\Abstracts\AuthenticationType;
|
||||
use ncc\Abstracts\Versions;
|
||||
use ncc\Exceptions\RuntimeException;
|
||||
use ncc\Interfaces\PasswordInterface;
|
||||
use ncc\Objects\Vault\Entry;
|
||||
|
@ -31,6 +32,7 @@
|
|||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->Version = Versions::CredentialsStoreVersion;
|
||||
$this->Entries = [];
|
||||
}
|
||||
|
||||
|
@ -180,12 +182,10 @@
|
|||
$vault = new Vault();
|
||||
$vault->Version = Functions::array_bc($array, 'version');
|
||||
$entries = Functions::array_bc($array, 'entries');
|
||||
$vault->Entries = [];
|
||||
|
||||
foreach($entries as $entry)
|
||||
{
|
||||
$entry = Entry::fromArray($entry);
|
||||
$vault->Entries[] = $entry;
|
||||
}
|
||||
$vault->Entries[] = Entry::fromArray($entry);
|
||||
|
||||
return $vault;
|
||||
}
|
||||
|
|
|
@ -261,8 +261,8 @@
|
|||
|
||||
$self->Name = Functions::array_bc($data, 'name');
|
||||
$self->Encrypted = Functions::array_bc($data, 'encrypted');
|
||||
|
||||
$password = Functions::array_bc($data, 'password');
|
||||
|
||||
if($password !== null)
|
||||
{
|
||||
if($self->Encrypted)
|
||||
|
@ -272,7 +272,7 @@
|
|||
}
|
||||
elseif(gettype($password) == 'array')
|
||||
{
|
||||
$self->Password = match (Functions::array_bc($data, 'authentication_type'))
|
||||
$self->Password = match (Functions::array_bc($password, 'authentication_type'))
|
||||
{
|
||||
AuthenticationType::UsernamePassword => UsernamePassword::fromArray($password),
|
||||
AuthenticationType::AccessToken => AccessToken::fromArray($password)
|
||||
|
|
Loading…
Add table
Reference in a new issue