MCPcopy Create free account
hub / github.com/NextDotID/proof_server / validateText

Method validateText

validator/telegram/telegram.go:209–226  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

207}
208
209func (telegram *Telegram) validateText() (err error) {
210 scanner := bufio.NewScanner(strings.NewReader(telegram.Text))
211 for scanner.Scan() {
212 matched := re.FindStringSubmatch(scanner.Text())
213 if len(matched) < 2 {
214 continue // Search for next line
215 }
216
217 sigBase64 := matched[1]
218 sigBytes, err := util.DecodeString(sigBase64)
219 if err != nil {
220 return xerrors.Errorf("Error when decoding signature %s: %s", sigBase64, err.Error())
221 }
222 telegram.Signature = sigBytes
223 return mycrypto.ValidatePersonalSignature(telegram.SignaturePayload, sigBytes, telegram.Pubkey)
224 }
225 return xerrors.Errorf("Signature not found in the telegram message.")
226}
227
228func initClient() {
229 if client != nil {

Callers 1

ValidateMethod · 0.95

Calls 1

DecodeStringFunction · 0.92

Tested by

no test coverage detected