code: public function createSignedRequest(
          string $method,
          string $uri,
          string $body,
          SigningSecretKey $key,
          array $headers = []
      ): RequestInterface {
          $signature = \ParagonIE_Sodium_Compat::crypto_sign_detached(
              $body,
              $key->getString(true)
          );
          if (isset($headers[Sapient::HEADER_SIGNATURE_NAME])) {
              $headers[Sapient::HEADER_SIGNATURE_NAME][] = Base64UrlSafe::encode($signature);
          } else {
              $headers[Sapient::HEADER_SIGNATURE_NAME] = Base64UrlSafe::encode($signature);
          }
          return new Request(
              $method,
              Uri::createFromString($uri),
              new Headers($headers),
              [],
              [],
              $this->stringToStream($body),
              []
          );
      }
docs: Ed25519-sign a request body.
  
  This adds an HTTP header (Body-Signature-Ed25519) which is the base64url
  encoded Ed25519 signature of the HTTP request body.
  
  @param string $method
  @param string $uri
  @param string $body
  @param SigningSecretKey $key
  @param array $headers
  @return RequestInterface