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