wxbizdatacrypt
v1.0.2
WeChat Mini 프로그램 개발 공식 문서 - 서명 암호화 문서 링크
1. 가장 오래된 문서 링크(만료됨)
http://mp.weixin.qq.com/debug/wxadoc/dev/api/signature.html?t=20161107
2. 이전 문서 링크(만료됨)
https://developers.weixin.qq.com/miniprogram/dev/api/signature.html
3. 최신 문서 링크(현재 최신 공식 문서)
https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/signature.html
사용방법
가서 github.com/xlstudio/wxbizdatacrypt를 받으세요.
방법 소개
import (
"github.com/xlstudio/wxbizdatacrypt"
)
사용예
package main
import (
"fmt"
"github.com/xlstudio/wxbizdatacrypt"
)
func main () {
appId := "wx4f4bc4dec97d474b"
sessionKey := "tiihtNczf5v6AKRyjwEUhQ=="
encryptedData := "CiyLU1Aw2KjvrjMdj8YKliAjtP4gsMZMQmRzooG2xrDcvSnxIMXFufNstNGTyaGS9uT5geRa0W4oTOb1WT7fJlAC+oNPdbB+3hVbJSRgv+4lGOETKUQz6OYStslQ142dNCuabNPGBzlooOmB231qMM85d2/fV6ChevvXvQP8Hkue1poOFtnEtpyxVLW1zAo6/1Xx1COxFvrc2d7UL/lmHInNlxuacJXwu0fjpXfz/YqYzBIBzD6WUfTIF9GRHpOn/Hz7saL8xz+W//FRAUid1OksQaQx4CMs8LOddcQhULW4ucetDf96JcR3g0gfRK4PC7E/r7Z6xNrXd2UIeorGj5Ef7b1pJAYB6Y5anaHqZ9J6nKEBvB4DnNLIVWSgARns/8wR2SiRS7MNACwTyrGvt9ts8p12PKFdlqYTopNHR1Vf7XjfhQlVsAJdNiKdYmYVoKlaRv85IfVunYzO0IKXsyl7JCUjCpoG20f0a04COwfneQAGGwd5oa+T8yO5hzuyDb/XcxxmK01EpqOyuxINew=="
iv := "r7BXXKkLb8qrSNn05n0qiA=="
pc := wxbizdatacrypt. WxBizDataCrypt { AppId : appId , SessionKey : sessionKey }
result , err := pc . Decrypt ( encryptedData , iv , true ) //第三个参数解释: 需要返回 JSON 数据类型时 使用 true, 需要返回 map 数据类型时 使用 false
if err != nil {
fmt . Println ( err )
} else {
fmt . Println ( result )
}
}