MCPcopy Index your code
hub / github.com/silenceper/wechat / CheckEncryptedDataContext

Method CheckEncryptedDataContext

miniprogram/auth/auth.go:126–143  ·  view source on GitHub ↗

CheckEncryptedDataContext .检查加密信息是否由微信生成(当前只支持手机号加密数据),只能检测最近3天生成的加密数据

(ctx context2.Context, encryptedMsgHash string)

Source from the content-addressed store, hash-verified

124
125// CheckEncryptedDataContext .检查加密信息是否由微信生成(当前只支持手机号加密数据),只能检测最近3天生成的加密数据
126func (auth *Auth) CheckEncryptedDataContext(ctx context2.Context, encryptedMsgHash string) (result RspCheckEncryptedData, err error) {
127 var response []byte
128 var (
129 at string
130 )
131 if at, err = auth.GetAccessTokenContext(ctx); err != nil {
132 return
133 }
134
135 // 由于GetPhoneNumberContext需要传入JSON,所以HTTPPostContext入参改为[]byte
136 if response, err = util.HTTPPostContext(ctx, fmt.Sprintf(checkEncryptedDataURL, at), []byte("encrypted_msg_hash="+encryptedMsgHash), nil); err != nil {
137 return
138 }
139 if err = util.DecodeWithError(response, &result, "CheckEncryptedDataAuth"); err != nil {
140 return
141 }
142 return
143}
144
145// GetPhoneNumberResponse 新版获取用户手机号响应结构体
146type GetPhoneNumberResponse struct {

Callers 1

CheckEncryptedDataMethod · 0.95

Calls 3

HTTPPostContextFunction · 0.92
DecodeWithErrorFunction · 0.92
GetAccessTokenContextMethod · 0.65

Tested by

no test coverage detected