Send QQ Messages on Go-CQHTTP with QSign API Server

1. What is QSign?

QSign is a signature server for encrypting and decrypting messages and can be used with Go-CQHTTP to provide more secure message transmission.

Some time ago, due to Tencent changing the protocol, frameworks such as Go-CQHTTP failed on a large scale and were subject to risk control, which even caused many robot accounts to be frozen and code:45 errors occurred. The signature server is currently the only solution, and there is no guarantee that it will not be invalid.

2. Construction method

2.1. Docker command line deployment

First, make sure you have Docker installed and able to use docker commands from the command line.

  1. Execute the following command to download the QSign image:

    Text
    1
    docker pull xzhouqd/qsign:core-{version}

    Note that {version} here represents the version number of QSign, such as 1.1.3.

  2. Prepare the txlib file. You need to download or export the txlib file according to the fuqiuluo/unidbg-fetch-qsign tutorial and place it in a directory on the host machine.
  3. Execute the following command to start the QSign container:

    Text
    1
    docker run -d --restart=always --name qsign -p {host_port}:{internal_port} -e BASE_PATH={internal_abs_base_path} -v {host_abs_txlib_path}:{internal_abs_base_path} xzhouqd/qsign:core-{version}

    Parameter analysis:

    • {host_port}: The port accessed from the host side
    • {internal_port}: service port in the container, configured in config.json
    • {internal_abs_base_path}: The absolute path to the specific directory where txlib is located in the container
    • {host_abs_txlib_path}: The absolute path to the directory where txlib is located on the host side
    • {version}: version number of QSign service

    Note that the parameters in the above command are replaced with actual values.

  4. After completing the above steps, the QSign server will run in the Docker container and provide external services through the specified port.

2.2. Docker Compose deployment

First, make sure you have Docker Compose installed and able to use the docker-compose command from the command line.

  1. Create a file named docker-compose.yml in the root directory of the project with the following content:

    Text
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    version: "3.0"
    services:
      qsign:
        image: xzhouqd/qsign:core-{version}
        ports:
          - "{host_port}:{internal_port}"
        volumes:
          - "{host_abs_txlib_path}:{internal_abs_base_path}"
        environment:
          - "BASE_PATH={internal_abs_base_path}/"
        container_name: qsign-core
        restart: always

    Parameter analysis:

    • {host_port}: The port accessed from the host side
    • {internal_port}: service port in the container, configured in config.json
    • {host_abs_txlib_path}: The absolute path to the directory where txlib is located on the host side
    • {internal_abs_base_path}: The absolute path to the specific directory where txlib is located in the container
    • {version}: version number of QSign service

    Note that the parameters in the above command are replaced with actual values.

  2. Execute the following command to start the QSign container:

    Text
    1
    docker-compose up -d

    After completing the above steps, the QSign server will run in the Docker container and provide external services through the specified port.

3. Go-CQHTTP docking method

To use the QSign signature server to connect to Go-CQHTTP, you need to configure it accordingly in the config.yml file.

Add the following content to the Account.SignServer field configuration item in the config.yml file:

yaml
1
2
account:
     sign-server: [http/https]://{server}:{port}

Public signing servers can be used:

https://qsign.loli.vet/
https://qq.avocado.wiki/63/
https://qsign.yubao.moe/
http://qsign.yslsy.top/
https://qqsign.hamusuta.xyz/

But it is strongly recommended to build it yourself.

After the configuration is complete, save the config.yml file and restart the Go-CQHTTP service.

Go-CQHTTP will now use the QSign signature server to encrypt and decrypt messages.

Hope this tutorial can help you! If you have any further questions please feel free to let me know.

Send QQ Messages on Go-CQHTTP with QSign API Server

https://blog.tsinbei.com/en/archives/762/

Author
Hsukqi Lee
Posted on

2023-11-19

Edited on

2023-11-19

Licensed under

CC BY-NC-ND 4.0

Comments

Name
Mail
Site
None yet