First stage in abstracting GXS identities usage cases (half done)

This commit is contained in:
csoler 2017-01-02 15:58:37 +01:00
parent f8ac391a28
commit 17fc89e3c0
7 changed files with 54 additions and 21 deletions

View file

@ -212,6 +212,34 @@ class RsIdentityParameters
RsGxsImage mImage ;
};
class RsIdentityUsage
{
public:
enum UsageCode { UNKNOWN_USAGE = 0x00,
GROUP_ADMIN_SIGNATURE_CREATION = 0x01, // These 2 are normally not normal GXS identities, but nothing prevents it to happen either.
GROUP_ADMIN_SIGNATURE_VALIDATION = 0x02,
GROUP_AUTHOR_SIGNATURE_CREATION = 0x03, // not typically used, since most services do not require group author signatures
GROUP_AUTHOR_SIGNATURE_VALIDATION = 0x04,
MESSAGE_AUTHOR_SIGNATURE_CREATION = 0x05, // most common use case. Messages are signed by authors in e.g. forums.
MESSAGE_AUTHOR_SIGNATURE_VALIDATION = 0x06,
GROUP_AUTHOR_KEEP_ALIVE = 0x07, // Identities are stamped regularly by crawlign the set of messages for all groups. That helps keepign the useful identities in hand.
MESSAGE_AUTHOR_KEEP_ALIVE = 0x08, // Identities are stamped regularly by crawlign the set of messages for all groups. That helps keepign the useful identities in hand.
CHAT_LOBBY_MSG_VALIDATION = 0x09 // Chat lobby msgs are signed, so each time one comes, or a chat lobby event comes, a signature verificaiton happens.
} ;
RsIdentityUsage(uint16_t service,const RsIdentityUsage::UsageCode& code,const RsGxsGroupId& gid,const RsGxsMessageId& mid=RsGxsMessageId(),uint64_t additional_id=0,const std::string& comment = std::string())
: mServiceId(service), mUsageCode(code), mGrpId(gid), mMsgId(mid),mAdditionalId(additional_id),mComment(comment) {}
uint16_t mServiceId; // Id of the service using that identity
UsageCode mUsageCode; // Specific code to use. Will allow forming the correct translated message in the GUI if necessary.
RsGxsGroupId mGrpId; // Group ID using the identity
RsGxsMessageId mMsgId; // Message ID using the identity
uint64_t mAdditionalId; // Some additional ID. Can be used for e.g. chat lobbies.
std::string mComment ; // additional comment to be used mainly for debugging, but not GUI display
};
class RsIdentity: public RsGxsIfaceHelper
{