import{ax as c,a7 as m}from"./index.17037962789732.js";import"./index.170379627897338.js";import"./index.1703796278973300.js";import"./index.170379627897315.js";import"./index.170379627897317.js";import"./index.1703796278973301.js";import"./index.1703796278973302.js";import"./index.170379627897332.js";import"./index.1703796278973303.js";import"./index.170379627897339.js";import"./index.170379627897316.js";import"./index.170379627897314.js";import"./index.1703796278973304.js";import"./index.1703796278973305.js";import"./index.1703796278973306.js";import{a as _}from"./comm.1703796278973.js";import{d as h,o as u,x as g,z as e,b as s,u as f,an as y,G as x,H as b}from"./vue.1703796278973.js";import{_ as S}from"./_plugin-vue_export-helper.1703796278973.js";import"./index.17037962789733.js";import"./dayjs.min.1703796278973.js";import"./isArray.1703796278973.js";import"./editor.api.1703796278973.js";import"./preload-helper.1703796278973.js";import"./monaco.contribution.1703796278973.js";const t=i=>(x("data-v-d580bf32"),i=i(),b(),i),I={class:"home"},k=t(()=>e("h1",null,"第三方接入说明",-1)),j=t(()=>e("div",{style:{color:"#666666"}}," 第三方平台接口请求基于数据签名调用方式，使用签名来校验客户端请求的完整性以及合法性，您可以参看如下文档，来构造 HTTP 接口以调用对应的第三方平台接口 。 ",-1)),T=t(()=>e("h2",null,"签名示例说明",-1)),C=t(()=>e("div",{class:"h2-text"},"1. 签名方式,支持MD5和Sha256两种方式.",-1)),H=t(()=>e("div",{class:"h2-text"}," 2. 发起请求的签名信息都需要放到请求头中,而不是请求体. ",-1)),P={style:{display:"flex",border:"1px solid #e6e6e6",padding:"15","justify-content":"space-between"}},K=y('<div data-v-d580bf32><h3 data-v-d580bf32>签名规则</h3><p data-v-d580bf32> 注意：签名时间戳与服务器时间不能相差五分钟以上，否则服务器将拒绝本次请求 </p><div class="div-border" data-v-d580bf32><div class="h3-text" data-v-d580bf32> 将参数key按ascii排序得到: pageIndex=0&amp;pageSize=20 </div><div class="h3-text" data-v-d580bf32> 使用拼接时间戳以及密钥得到: pageIndex=0&amp;pageSize=201574993804802testSecure </div><div class="h3-text" data-v-d580bf32> 使用md5(pageIndex=0&amp;pageSize=201574993804802testSecure)得到837fe7fa29e7a5e4852d447578269523 </div></div><h3 data-v-d580bf32>请求头示例</h3><div class="div-border" data-v-d580bf32><div class="h3-text" data-v-d580bf32> GET /api/device?pageIndex=0&amp;pageSize=20 </div><div class="h3-text" data-v-d580bf32>X-Client-Id: testId</div><div class="h3-text" data-v-d580bf32>X-Timestamp: 1574993804802</div><div class="h3-text" data-v-d580bf32> X-Sign: 837fe7fa29e7a5e4852d447578269523 </div></div><h3 data-v-d580bf32>响应结果示例</h3><div class="div-border" data-v-d580bf32><div class="h3-text" data-v-d580bf32>xxx</div><div class="h3-text" data-v-d580bf32>HTTP/1.1 200 OK</div><div class="h3-text" data-v-d580bf32>X-Timestamp: 1574994269075</div><div class="h3-text" data-v-d580bf32> X-Sign: c23faa3c46784ada64423a8bba433f25 </div><div class="h3-text" data-v-d580bf32>status:200,result:[ ]</div></div></div>',1),D={style:{width:"50%"}},w=t(()=>e("h3",null,"示例数据",-1)),V={style:{display:"flex",border:"1px solid #e6e6e6",padding:15,justifyContent:"space-between",marginTop:20}},U=t(()=>e("h3",null,"服务器验签流程",-1)),q=["src"],z={style:{width:"505px"}},A=t(()=>e("h3",null,"验签说明",-1)),X=t(()=>e("p",null,"使用和签名相同的算法(不需要对响应结果排序)",-1)),B=t(()=>e("h2",null,"java SDK接入说明",-1)),E=t(()=>e("div",{class:"div-border"},[e("div",{class:"h3-text"}," JetLinks平台java SDK基于java 8版本开发。 ")],-1)),R=t(()=>e("h3",null,"添加 SDK 依赖",-1)),W=t(()=>e("div",{class:"h3-text"},"将以下Maven依赖加入到pom.xml文件中",-1)),G=t(()=>e("h3",null,"SDK 客户端的初始化和请求方式",-1)),J=h({__name:"HomePage",setup(i){const p=[{key:"1",type:"clientId",data:"testId"},{key:"2",type:"secureKey",data:"testSecure"},{key:"3",type:"请求URI",data:"/api/v1/device/dev0001/log/_query"},{key:"4",type:"请求方式",data:"GET"},{key:"5",type:"请求参数",data:"pageSize=20&pageIndex=0"},{key:"6",type:"签名方式",data:"MD5"},{key:"7",type:"签名示例时间戳",data:"1574993804802 "}],n=`String secureKey = ...; //密钥\r
String responseBody = ...;//服务端响应结果\r
String timestampHeader = ...;//响应头: X-Timestamp\r
String signHeader = ...; //响应头: X-Sign\r
\r
String sign = DigestUtils.md5Hex(responseBody+timestampHeader+secureKey);\r
if(sign.equalsIgnoreCase(signHeader)){\r
 //验签通过\r
}`,r=`<dependency>\r
    <groupId>org.jetlinks.sdk</groupId>\r
    <artifactId>api-sdk</artifactId>\r
    <version>1.0.0</version>\r
</dependency>`,l=`\r
        //服务器的baseUrl\r
        String baseUrl = "http://localhost:9000/jetlinks";\r
  //客户端Id\r
        String clientId = "aSoq98aAxzP";\r
  //访问秘钥\r
        String secureKey = "DaYsxpiWSfdTAPJyKW8rP2WAGyWErnsR";\r
\r
        ClientConfig clientConfig = new ClientConfig(baseUrl, clientId, secureKey);\r
\r
        ApiClient client = new WebApiClient(clientConfig);\r
\r
ApiResponse < PagerResult < DeviceInfo >> response = client\r
    .request(QueryDeviceRequest\r
        .of(query -> query\r
            .where("productId", "demo-device")\r
            .doPaging(0, 100)));`;return(M,a)=>{const v=c,o=m;return u(),g("div",I,[k,j,T,C,H,e("div",P,[K,e("div",D,[w,e("div",null,[s(v,{dataSource:p,model:"TABLE",noPagination:"",columns:[{title:"示例数据类型",dataIndex:"type"},{title:"示例数据",dataIndex:"data"}]})])])]),e("div",V,[e("div",null,[U,e("div",null,[e("img",{src:f(_)("/apiHome.png"),style:{width:"80%"}},null,8,q)])]),e("div",z,[A,e("div",null,[X,e("div",null,[s(o,{language:"java",style:{height:"370px"},theme:"vs-dark",modelValue:n,"onUpdate:modelValue":a[0]||(a[0]=d=>n=d)})])])])]),e("div",null,[B,E,R,W,e("div",null,[s(o,{language:"java",style:{height:"370px"},theme:"vs-dark",modelValue:r,"onUpdate:modelValue":a[1]||(a[1]=d=>r=d)})]),G,e("div",null,[s(o,{language:"java",style:{height:"370px"},theme:"vs-dark",modelValue:l,"onUpdate:modelValue":a[2]||(a[2]=d=>l=d)})])])])}}});const ue=S(J,[["__scopeId","data-v-d580bf32"]]);export{ue as default};
