mirror of
https://gitlab.com/signalytic/client-external/streamline/streamline-emr.git
synced 2026-09-13 11:41:31 +00:00
The official image from streamline does not currently work for the arm64 platform. As a temporary measure, the source code and docker build scripts have been lifted from the official images and are used to build locally. Some additional modifications are made to reduce overall image size, these are documented in docker/README.md
54 lines
1.0 KiB
PHP
54 lines
1.0 KiB
PHP
<?php
|
|
|
|
namespace Laravel\SerializableClosure\Signers;
|
|
|
|
use Laravel\SerializableClosure\Contracts\Signer;
|
|
|
|
class Hmac implements Signer
|
|
{
|
|
/**
|
|
* The secret key.
|
|
*
|
|
* @var string
|
|
*/
|
|
protected $secret;
|
|
|
|
/**
|
|
* Creates a new signer instance.
|
|
*
|
|
* @param string $secret
|
|
* @return void
|
|
*/
|
|
public function __construct($secret)
|
|
{
|
|
$this->secret = $secret;
|
|
}
|
|
|
|
/**
|
|
* Sign the given serializable.
|
|
*
|
|
* @param string $serialized
|
|
* @return array
|
|
*/
|
|
public function sign($serialized)
|
|
{
|
|
return [
|
|
'serializable' => $serialized,
|
|
'hash' => base64_encode(hash_hmac('sha256', $serialized, $this->secret, true)),
|
|
];
|
|
}
|
|
|
|
/**
|
|
* Verify the given signature.
|
|
*
|
|
* @param array $signature
|
|
* @return bool
|
|
*/
|
|
public function verify($signature)
|
|
{
|
|
return hash_equals(base64_encode(
|
|
hash_hmac('sha256', $signature['serializable'], $this->secret, true)
|
|
), $signature['hash']);
|
|
}
|
|
}
|