MCPcopy Create free account
hub / github.com/chanify/chanify / verifyDevice

Function verifyDevice

core/utils.go:52–59  ·  view source on GitHub ↗
(ctx *gin.Context, key string)

Source from the content-addressed store, hash-verified

50}
51
52func verifyDevice(ctx *gin.Context, key string) bool {
53 sign, err := crypto.Base64Encode.DecodeString(ctx.GetHeader("CHDevSign"))
54 if err != nil {
55 return false
56 }
57 data, _ := ctx.Get(gin.BodyBytesKey)
58 return verifySign(key, sign, data.([]byte))
59}
60
61func verifySign(key string, sign []byte, data []byte) bool {
62 kd, err := crypto.Base64Encode.DecodeString(key)

Callers 3

TestVerifyDeviceFunction · 0.85
handleUpdatePushTokenMethod · 0.85
handleBindUserMethod · 0.85

Calls 1

verifySignFunction · 0.85

Tested by 1

TestVerifyDeviceFunction · 0.68