public function createSymmetricAuthenticatedResponse(
        int $status,
        string $body,
        SharedAuthenticationKey $key,
        array $headers = [],
        string $version = '1.1'
    ): ResponseInterface {
        /** @var array<string, array> $headers */
        $mac = \ParagonIE_Sodium_Compat::crypto_auth($body, $key->getString(true));
        if (isset($headers[Sapient::HEADER_SIGNATURE_NAME])) {
            $headers[Sapient::HEADER_AUTH_NAME][] = Base64UrlSafe::encode($mac);
        } else {
            $headers[Sapient::HEADER_AUTH_NAME] = Base64UrlSafe::encode($mac);
        }
        return new Response(
            $status,
            $headers,
            $body,
            $version
        );
    }
public function createSymmetricAuthenticatedResponse(
        int $status,
        string $body,
        SharedAuthenticationKey $key,
        array $headers = [],
        string $version = '1.1'
    ): ResponseInterface {
        /** @var array<string, array> $headers */
        $mac = \ParagonIE_Sodium_Compat::crypto_auth($body, $key->getString(true));
        if (isset($headers[Sapient::HEADER_SIGNATURE_NAME])) {
            $headers[Sapient::HEADER_AUTH_NAME][] = Base64UrlSafe::encode($mac);
        } else {
            $headers[Sapient::HEADER_AUTH_NAME] = Base64UrlSafe::encode($mac);
        }
        return new Response(
            $status,
            $headers,
            $body,
            $version
        );
    }
public function createSymmetricAuthenticatedResponse ( int $ status , string $ body , SharedAuthenticationKey $ key , array $ headers = [ ] , string $ version = '1.1' ) : ResponseInterface { /** @var array<string, array> $headers */ $ mac = \ ParagonIE_Sodium_Compat :: crypto_auth ( $ body , $ key -> getString ( true ) ) ; if ( isset ( $ headers [ Sapient :: HEADER_SIGNATURE_NAME ] ) ) { $ headers [ Sapient :: HEADER_AUTH_NAME ] [ ] = Base64UrlSafe :: encode ( $ mac ) ; } else { $ headers [ Sapient :: HEADER_AUTH_NAME ] = Base64UrlSafe :: encode ( $ mac ) ; } return new Response ( $ status , $ headers , $ body , $ version ) ; }
Authenticate your HTTP response with a pre-shared key.

@param int $status
@param string $body
@param SharedAuthenticationKey $key
@param array $headers
@param string $version
@return ResponseInterface
Authenticate your HTTP response with a pre - shared key .