save binary credential data as compact base64 string
This commit is contained in:
parent
521d8e9e6a
commit
f62c542d10
@ -54,13 +54,13 @@ class PublicKeyCredential extends BaseModel
|
|||||||
public function setCredentialId($credentialId)
|
public function setCredentialId($credentialId)
|
||||||
{
|
{
|
||||||
$this->assign([
|
$this->assign([
|
||||||
'credentialid' => bin2hex($credentialId)
|
'credentialid' => base64_encode($credentialId)
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getCredentialId()
|
public function getCredentialId()
|
||||||
{
|
{
|
||||||
return hex2bin($this->__get($this->_getFieldLongName('credentialid'))->rawValue);
|
return base64_decode($this->__get($this->_getFieldLongName('credentialid'))->rawValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setUserId($userId)
|
public function setUserId($userId)
|
||||||
@ -78,13 +78,13 @@ class PublicKeyCredential extends BaseModel
|
|||||||
public function setCredential($credential)
|
public function setCredential($credential)
|
||||||
{
|
{
|
||||||
$this->assign([
|
$this->assign([
|
||||||
'credential' => bin2hex(serialize($credential))
|
'credential' => base64_encode(serialize($credential))
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getCredential()
|
public function getCredential()
|
||||||
{
|
{
|
||||||
return unserialize(hex2bin($this->__get($this->_getFieldLongName('credential'))->rawValue));
|
return unserialize(base64_decode($this->__get($this->_getFieldLongName('credential'))->rawValue));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -134,7 +134,7 @@ class PublicKeyCredential extends BaseModel
|
|||||||
$qb->expr()->and(
|
$qb->expr()->and(
|
||||||
$qb->expr()->eq(
|
$qb->expr()->eq(
|
||||||
'credentialid',
|
'credentialid',
|
||||||
$qb->createNamedParameter(bin2hex($publicKeyCredentialId))
|
$qb->createNamedParameter(base64_encode($publicKeyCredentialId))
|
||||||
),
|
),
|
||||||
$qb->expr()->eq(
|
$qb->expr()->eq(
|
||||||
'oxshopid',
|
'oxshopid',
|
||||||
|
@ -58,7 +58,7 @@ class PublicKeyCredentialList extends ListModel implements PublicKeyCredentialSo
|
|||||||
$qb->expr()->and(
|
$qb->expr()->and(
|
||||||
$qb->expr()->eq(
|
$qb->expr()->eq(
|
||||||
'credentialid',
|
'credentialid',
|
||||||
$qb->createNamedParameter(bin2hex($publicKeyCredentialId))
|
$qb->createNamedParameter(base64_encode($publicKeyCredentialId))
|
||||||
),
|
),
|
||||||
$qb->expr()->eq(
|
$qb->expr()->eq(
|
||||||
'oxshopid',
|
'oxshopid',
|
||||||
@ -72,7 +72,7 @@ class PublicKeyCredentialList extends ListModel implements PublicKeyCredentialSo
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
$credential = unserialize(hex2bin($credential));
|
$credential = unserialize(base64_decode($credential));
|
||||||
|
|
||||||
return $credential instanceof PublicKeyCredentialSource ? $credential : null;
|
return $credential instanceof PublicKeyCredentialSource ? $credential : null;
|
||||||
}
|
}
|
||||||
@ -106,7 +106,7 @@ class PublicKeyCredentialList extends ListModel implements PublicKeyCredentialSo
|
|||||||
|
|
||||||
// generate decoded credentials list
|
// generate decoded credentials list
|
||||||
return array_map(function (array $fields) {
|
return array_map(function (array $fields) {
|
||||||
return unserialize(hex2bin($fields['credential']));
|
return unserialize(base64_decode($fields['credential']));
|
||||||
}, $qb->execute()->fetchAllAssociative());
|
}, $qb->execute()->fetchAllAssociative());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ class Events
|
|||||||
`OXUSERID` char(32) NOT NULL,
|
`OXUSERID` char(32) NOT NULL,
|
||||||
`OXSHOPID` int(11) NOT NULL,
|
`OXSHOPID` int(11) NOT NULL,
|
||||||
`NAME` varchar(100) NOT NULL,
|
`NAME` varchar(100) NOT NULL,
|
||||||
`CREDENTIALID` char(200) NOT NULL,
|
`CREDENTIALID` char(100) NOT NULL,
|
||||||
`CREDENTIAL` varchar(2000) NOT NULL,
|
`CREDENTIAL` varchar(2000) NOT NULL,
|
||||||
`OXTIMESTAMP` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
|
`OXTIMESTAMP` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
|
||||||
PRIMARY KEY (`OXID`),
|
PRIMARY KEY (`OXID`),
|
||||||
|
Loading…
Reference in New Issue
Block a user