Skip to content

Commit 92b0403

Browse files
authored
Merge pull request #10 from dasgarner/master
Nonce: add a meta property which can be used to store adhoc data.
2 parents 776ba99 + 0c8d022 commit 92b0403

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/Xibo/Support/Nonce/Nonce.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ class Nonce implements \JsonSerializable
1818
public $action;
1919
public $expires;
2020
public $lookup;
21+
public $meta;
2122

2223
/**
2324
* A hashed version of the nonce to be persisted
@@ -109,7 +110,8 @@ public function jsonSerialize()
109110
'hashed' => $this->hashed,
110111
'lookup' => $this->lookup,
111112
'action' => $this->action,
112-
'expires' => $this->expires
113+
'expires' => $this->expires,
114+
'meta' => $this->meta
113115
];
114116
}
115117
}

src/Xibo/Support/Nonce/NonceService.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ public final function create($entityId, $action, $timeOut, $nonceLength = 20, $l
2121
$nonce->entityId = $entityId;
2222
$nonce->action = $action;
2323
$nonce->expires = time() + $timeOut;
24+
$nonce->meta = [];
2425
return $nonce;
2526
}
2627

@@ -38,6 +39,7 @@ public final function hydrate($json)
3839
$nonce->lookup = $json['lookup'];
3940
$nonce->action = $json['action'];
4041
$nonce->expires = $json['expires'];
42+
$nonce->meta = $json['meta'] ?? [];
4143
$nonce->setHashed($json['hashed']);
4244
}
4345

0 commit comments

Comments
 (0)