PageRenderTime 3999ms CodeModel.GetById 31ms RepoModel.GetById 8ms app.codeStats 0ms

/internal/domain/fingerprint.go

https://bitbucket.org/kamilsk/passport
Go | 18 lines | 12 code | 4 blank | 2 comment | 2 complexity | 15f7a1d71ebe7a2da72d3dc0d595ed49 MD5 | raw file
Possible License(s): BSD-2-Clause, MIT, JSON, 0BSD, BSD-3-Clause, Apache-2.0, MPL-2.0-no-copyleft-exception
  1. package domain
  2. import "regexp"
  3. var fingerprint = regexp.MustCompile(`(?i:^[0-9A-F]{32,64}$)`)
  4. // Fingerprint represents a fingerprint of a user.
  5. type Fingerprint struct {
  6. ID int64
  7. Session UUID
  8. Marker string
  9. CreatedAt string
  10. }
  11. // IsValid returns true if the Fingerprint contains valid value.
  12. func (f Fingerprint) IsValid() bool {
  13. return f.Marker != "" && fingerprint.MatchString(f.Marker)
  14. }