All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.aiwiown.face.request.AppVerifyRequest Maven / Gradle / Ivy

There is a newer version: 3.0.9
Show newest version
package com.aiwiown.face.request;

import com.aiwiown.face.ApiMethod;
import com.aiwiown.face.ApiObject;
import com.aiwiown.face.ApiRequest;
import com.aiwiown.face.internal.safe.HmacSha1Sign;
import com.aiwiown.face.internal.util.RequestParamUtils;
import com.aiwiown.face.response.AppVerifyResponse;

import java.util.Map;

/**
 * 描述
 * 此接口用于将FaceID MegLiveStill SDK 所获得的数据进行上传,并获取活体验证、人脸比对、攻击防范等结果信息。
 *
 * 注意:本接口仅支持FaceID MegLiveStill SDK 3.0及以上版本的数据,FaceID MegLive SDK 3.0以下版本请使用“人脸验证API”中的“Verify 2.0.6”下的文档。
 * https://faceid.com/pages/documents/37662519
 * @ClassName : AppVerifyRequest
 * @Description :
 * @Author : dbin0123
 * @Date: 2020-03-15 18:47
 */
public class AppVerifyRequest implements ApiRequest {

    private String apiVersion = "v3";
    private static String apiUrl = "/sdk/verify";

    private static final String SIGN_TYPE = "hmac_sha1";
    private static final long EXPIRED = 60L;
    private String bizContent;
    private ApiObject bizModel = null;

    @Override
    public ApiMethod getApiMethod() {
        return ApiMethod.POST;
    }

    @Override
    public String getApiUrl() {
        return "/" + this.apiVersion + apiUrl;
    }

    @Override
    public Map getTextParams() throws IllegalAccessException {
        return RequestParamUtils.getTextParams(this.bizModel);
    }

    @Override
    public Map getByteArrayParams() throws IllegalAccessException {
        return RequestParamUtils.getByteArrayParams(this.bizModel);
    }

    @Override
    public Class getResponseClass() {
        return AppVerifyResponse.class;
    }

    @Override
    public String getApiVersion() {
        return this.apiVersion;
    }

    @Override
    public String getBizContent() {
        return this.bizContent;
    }

    public void setBizModel(ApiObject bizModel) {
        this.bizModel = bizModel;
    }

    @Override
    public String signVersion() {
        return SIGN_TYPE;
    }

    @Override
    public String getSignInfo(String apiKey, String secretKey) throws Exception {
        return HmacSha1Sign.genSign(apiKey, secretKey, EXPIRED);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy