typo in ldsigs
This commit is contained in:
parent
471449f539
commit
d4e53bb86f
@ -13,7 +13,9 @@ class ActivityStreams {
|
|||||||
public $tgt = null;
|
public $tgt = null;
|
||||||
public $origin = null;
|
public $origin = null;
|
||||||
public $owner = null;
|
public $owner = null;
|
||||||
|
public $signer = null;
|
||||||
|
public $ldsig = null;
|
||||||
|
public $sigok = false;
|
||||||
public $recips = null;
|
public $recips = null;
|
||||||
|
|
||||||
function __construct($string) {
|
function __construct($string) {
|
||||||
@ -32,6 +34,14 @@ class ActivityStreams {
|
|||||||
$this->origin = $this->get_compound_property('origin');
|
$this->origin = $this->get_compound_property('origin');
|
||||||
$this->recips = $this->collect_recips();
|
$this->recips = $this->collect_recips();
|
||||||
|
|
||||||
|
$this->ldsig = $this->get_compound_property('signature');
|
||||||
|
if($this->ldsig) {
|
||||||
|
$this->signer = $this->get_compound_property('creator',$this->ldsig);
|
||||||
|
if($this->signer && $this->signer['publicKey'] && $this->signer['publicKey']['publicKeyPem']) {
|
||||||
|
$this->sigok = \Zotlabs\Lib\LDSignatures::verify($this->data,$this->signer['publicKey']['publicKeyPem']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(($this->type === 'Note') && (! $this->obj)) {
|
if(($this->type === 'Note') && (! $this->obj)) {
|
||||||
$this->obj = $this->data;
|
$this->obj = $this->data;
|
||||||
$this->type = 'Create';
|
$this->type = 'Create';
|
||||||
|
@ -21,6 +21,7 @@ class LDSignatures {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static function sign($data,$channel) {
|
static function sign($data,$channel) {
|
||||||
|
|
||||||
$options = [
|
$options = [
|
||||||
'type' => 'RsaSignature2017',
|
'type' => 'RsaSignature2017',
|
||||||
'nonce' => random_string(64),
|
'nonce' => random_string(64),
|
||||||
@ -46,7 +47,7 @@ class LDSignatures {
|
|||||||
if($data) {
|
if($data) {
|
||||||
foreach($data as $k => $v) {
|
foreach($data as $k => $v) {
|
||||||
if(! in_array($k,[ 'signature' ])) {
|
if(! in_array($k,[ 'signature' ])) {
|
||||||
$newopts[$k] = $v;
|
$newdata[$k] = $v;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -68,6 +69,7 @@ class LDSignatures {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static function hash($obj) {
|
static function hash($obj) {
|
||||||
|
|
||||||
return hash('sha256',self::normalise($obj));
|
return hash('sha256',self::normalise($obj));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user