@cyberlab/social-verifier
TypeScript icon, indicating that this package has built-in type declarations

2.0.1 • Public • Published

social-verifier

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

You can check the list of verified mappings in Connect List repo.

Also, you can use our CyberConnect API to check an identity Twitter account.

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 write the verified inforamtion into Connect List 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 list of verified mappings in Connect List repo.

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 write the verified inforamtion into Connect List 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 list of verified mappings in Connect List repo.

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.

Package Sidebar

Install

npm i @cyberlab/social-verifier

Weekly Downloads

35

Version

2.0.1

License

ISC

Unpacked Size

32.9 kB

Total Files

29

Last publish

Collaborators

  • akasuv