Skip to content

cyberconnecthq/social-verifier

Repository files navigation

social-verifier

Social Verifier helps user to implement social verify process easily. (Twitter and Github supported).

You can check the list of verified mappings by using our CyberConnect API.

Getting started

Installation

npm install @cyberlab/social-verifier
or
yarn add @cyberlab/social-verifier

Use the Verifier


Twitter:

Twitter Verifier uses a 3 step process for linking an Ethereum address to a Twitter account.

  1. Users use their Ethereum private key to sign a message with their Twitter handle to get a message which contains the generated signature.
  2. Users post a tweet with this message so others can view.
  3. Users send a verify request to our server with their wallet address. Our server will recover the signer address from the signature found in the tweet and save the verified inforamtion if the signer address is the same as the address in the request.

Signing Data

Using twitterAuthorize to get signature message.

import { twitterAuthorize } from "@cyberlab/social-verifier";

const sig = twitterAuthorize(provider, address, handle);
  • provider - An ETH provider which should implement one of the following methods: send, sendAsync, request.
  • address - The Ethereum address that you want to link with your Twitter account.
  • handle - The handle of your Twitter account.

Posting message

You can customize your tweet text, but the text should include the signature message from the Signing Data step.

const text = `Verifying my Web3 identity on @cyberconnecthq: %23LetsCyberConnect %0A ${sig}`;

window.open(`https://twitter.com/intent/tweet?text=${text}`, "_blank");

Verifying

After posting the tweet, you can call twitterVerify to link your address with your Twitter account. You can check the verified information by using CyberConnect API.

import { twitterVerify } from "@cyberlab/social-verifier";

try {
  await twitterVerify(address, handle, namespace);
  console.log("Verify Success!");
} catch (e) {
  console.log("Error: ", e.message);
}
  • address - The Ethereum address that you want to link with your Twitter account.
  • handle - The handle of your Twitter account.
  • namespace - (optional) Your applciation name.

Github:

Github Verifier uses a 3 step process for linking an Ethereum address to a Github account.

  1. Users use their Ethereum private key to sign a message with their Github username to get a message which contains the generated signature.
  2. Users create a Github gist with this message.
  3. Users send a verify request to our server with their wallet address and the gist id. Our server will recover the signer address from the signature found in the gist and save the verified inforamtion if the signer address is the same as the address in the request.

Signing Data

Using githubAuthorize to get signature message.

import { githubAuthorize } from "@cyberlab/social-verifier";

const sig = githubAuthorize(provider, address, username);
  • provider - An ETH provider which should implement one of the following methods: send, sendAsync, request.
  • address - The Ethereum address that you want to link with your Github account.
  • username - The username of your Github account.

Posting message

You need to create a gist in your Github. You can customize your gist text, but the text should include the signature message from the Signing Data step

Verifying

After posting the gist, you can call githubVerify to link your address with your Github account. You can check the verified information by using CyberConnect API.

import { githubVerify } from "@cyberlab/social-verifier";

try {
  await githubVerify(address, gistId, namespace);
  console.log("Verify Success!");
} catch (e) {
  console.log("Error: ", e.message);
}
  • address - The Ethereum address that you want to link with your Github account.
  • gistId - The id of your Github gist. It's the last part of your gist url.
  • namespace - (optional) Your applciation name.

Contributing

We are happy to accept any contributions, feel free to make a suggestion or submit a pull request.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published