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

@param RequestInterface $request
@param SharedAuthenticationKey $key
@return RequestInterface
Authenticate an HTTP request with a pre - shared key .