public function authenticateResponseWithSharedKey(
        ResponseInterface $response,
        SharedAuthenticationKey $key
    ): ResponseInterface {
        $mac = \ParagonIE_Sodium_Compat::crypto_auth(
            (string) $response->getBody(),
            $key->getString(true)
        );
        return $response->withAddedHeader(
            self::HEADER_AUTH_NAME,
            Base64UrlSafe::encode($mac)
        );
    }
public function authenticateResponseWithSharedKey(
        ResponseInterface $response,
        SharedAuthenticationKey $key
    ): ResponseInterface {
        $mac = \ParagonIE_Sodium_Compat::crypto_auth(
            (string) $response->getBody(),
            $key->getString(true)
        );
        return $response->withAddedHeader(
            self::HEADER_AUTH_NAME,
            Base64UrlSafe::encode($mac)
        );
    }
public function authenticateResponseWithSharedKey ( ResponseInterface $ response , SharedAuthenticationKey $ key ) : ResponseInterface { $ mac = \ ParagonIE_Sodium_Compat :: crypto_auth ( ( string ) $ response -> getBody ( ) , $ key -> getString ( true ) ) ; return $ response -> withAddedHeader ( self :: HEADER_AUTH_NAME , Base64UrlSafe :: encode ( $ mac ) ) ; }
Authenticate an HTTP response with a pre-shared key.

@param ResponseInterface $response
@param SharedAuthenticationKey $key
@return ResponseInterface
Authenticate an HTTP response with a pre - shared key .