package io.geekidea.springbootplus.test;

import cn.hutool.crypto.digest.MD5;

import java.util.Date;

/**
 * 生成测试appkey与appSecret对,并存入数据库
 */
//@RunWith(SpringJUnit4ClassRunner.class)
//@SpringBootTest
public class SignTest {

//    @Autowired
//    private ImClientService imClientService;

    /**
     * 获取sign,客户端sdk得到sign之后就可以进行登录 和开启websocket
     * <p>
     * sign = MD5{ clientId + AppKey + appSecret}
     *
     * @param AppKey
     * @param appSecret
     */
    private static void getSign(String timestemp, String clientId, String AppKey, String appSecret) {

        String sign = new MD5().digestHex(timestemp + clientId + AppKey + appSecret);

        System.out.println("timestemp:" + timestemp);
        System.out.println("sign:" + sign);

    }


    public static void main(String[] args) {
        String clientId = "c1";
        String appKey = "elLwpel1gWCHDqZy";
        String appSecret = "68809bb5a9077a83631aeb0b17b5965d6b2302faf2ab3737";
        String timestemp = String.valueOf(new Date().getTime());
        getSign(timestemp, clientId, appKey, appSecret);
    }

}
