interface_store.go 798 B

1234567891011121314151617181920
  1. package base64Captcha
  2. // Store An object implementing Store interface can be registered with SetCustomStore
  3. // function to handle storage and retrieval of captcha ids and solutions for
  4. // them, replacing the default memory store.
  5. //
  6. // It is the responsibility of an object to delete expired and used captchas
  7. // when necessary (for example, the default memory store collects them in Set
  8. // method after the certain amount of captchas has been stored.)
  9. type Store interface {
  10. // Set sets the digits for the captcha id.
  11. Set(id string, value string) error
  12. // Get returns stored digits for the captcha id. Clear indicates
  13. // whether the captcha must be deleted from the store.
  14. Get(id string, clear bool) string
  15. //Verify captcha's answer directly
  16. Verify(id, answer string, clear bool) bool
  17. }