package cn.com.qmth.examcloud.tool.utils;

import org.apache.commons.codec.digest.DigestUtils;

public class SignUtils {

    /**
     * 生成 accessToken
     *
     * @param rootOrgId 学校ID
     * @param appId     应用ID
     * @param secretKey 认证Key
     * @param timestamp 当前时间戳
     */
    public static String accessToken(Long rootOrgId, String appId, String secretKey, long timestamp) {
        StringBuilder params = new StringBuilder()
                .append(rootOrgId)
                .append(appId)
                .append(timestamp)
                .append(secretKey);

        return DigestUtils.sha256Hex(params.toString());
    }

}
