Search…
Twitter Verifier
Verifier is a contract which verifies a user based on specific conditions either on chain or off chain and provide an interface to check if a specific user is verified by a verifier

Purpose

Twitter verifier allows users to verify their twitter identities onchain though a series of onchain and offchain processes.

Roles

Owner

Assignment
  • by initializing the contract
  • gaining ownership from previous owner
Permissions
  • can unregister any user
  • can update verification contract address
  • can update signer address
  • can update sign validity

Signer

Assignment
  • by initializing the contract
  • can be set by Owner
Permissions
  • verify a user by providing signature

User

Assignment
  • by registering self with signature from signer
Permissions
  • Anyone can check if the user address is verified by the verifier

Functionality

Register self

Registering user is the onchain component by which anyone can check that the user is verified by verifier. User has to send a signer message from signer with user address, Twitter id of the user, Tweet id using which user was verified by verifier bot and timestamp at which data was signed.
function registerSelf(
bool _isMasterLinked,
uint8 _v,
bytes32 _r,
bytes32 _s,
string memory _twitterId,
string memory _tweetId,
uint256 _timestamp
) external
Restrictions
  • Address of user for which message was signed should submit the signature
  • Twitter id should not be already verified
  • signature should not be too old
  • signature is not reused
Arguments
  • _isMasterLinked: Flag representing if Master address of the user should be linked to itself for verification
  • _v, _r, _s: Components of signature provided by signer
  • twitterId: Twitter Id is user as verified by verifier bot
  • _tweetId: Tweet Id in which twitterId is verified by verifier bot
  • _timestamp: Timestamp at which signature was made
  • msg.sender: sender is the address of user used to make signature

Unregister Self

User who is already registered with verifier after verification can unregister themselves at any time
function unregisterSelf() external
Restrictions
  • Address should be already registered
Arguments
  • msg.sender: sender is the address of user who is unregistering

Unregister User

Owner can unregister any user at their discretion in case of any malicious behaviour
function unregisterUser(address _user) external onlyOwner
Restrictions
  • Only owner can call the function to unregister any user
  • Address of user should be already registered
Arguments
  • _user: Address of user who is to be unregistered
  • msg.sender: Owner should be sender of the tx

Flow

The typical flow of a user who registers with verifier is as follows
  • User logs into twitter and submits a message signed with user address and posts it on twitter
  • Verifier bot reads the twitter post based on the twitter id and verifies the signature of the user
  • Verifier bot uses the signer address to create a signature on data containing twitterId, tweetId, userAddress, current timestamp
  • The signed message is returned to the user by Verifier bot
  • User can user their address to submit the signature along with relevant data to the verifier contract
  • Verifier contract can be user to check that the user is verified as soon as the tx is confirmed.

Error Codes

Error Code
Error Message
Function name
RS1
User already verified
registerSelf
RS2
Twitter Id already used
registerSelf
RS3
Signature expired
registerSelf
RS4
Signature already used
registerSelf
RS5
Incorrect Signer
registerSelf
URS1
User not verified
unregisterSelf
UU1
User not verified
unregisterSelf
Copy link
On this page
Purpose
Roles
Owner
Signer
User
Functionality
Register self
Unregister Self
Unregister User
Flow
Error Codes