1 /* 2 * Copyright 2019, Andrew Lindesay <apl@lindesay.co.nz>. 3 * 4 * All rights reserved. Distributed under the terms of the MIT License. 5 */ 6 #ifndef CAPTCHA_H 7 #define CAPTCHA_H 8 9 10 #include <Archivable.h> 11 #include <String.h> 12 13 class BPositionIO; 14 15 /*! When a user has to perform some sensitive operation, it is necessary to make 16 sure that it is not a 'robot' or software system that is acting as if it 17 were a person. It is necessary to know that a real person is acting. In 18 this case a graphical puzzle is presented to the user that presumably only 19 a human operator could solve. This is called a Captcha. 20 */ 21 22 class Captcha : public BArchivable { 23 public: 24 Captcha(BMessage* from); 25 Captcha(); 26 virtual ~Captcha(); 27 28 const BString& Token() const; 29 BPositionIO* PngImageData() const; 30 31 void SetToken(const BString& value); 32 void SetPngImageData(const void* data, size_t len); 33 34 status_t Archive(BMessage* into, bool deep = true) const; 35 private: 36 BString fToken; 37 BMallocIO* fPngImageData; 38 }; 39 40 41 #endif // CAPTCHA_H 42