Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/Envoy-VC/noir_social_verify
https://github.com/Envoy-VC/noir_social_verify
Last synced: 16 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/Envoy-VC/noir_social_verify
- Owner: Envoy-VC
- License: mit
- Created: 2024-10-22T03:36:41.000Z (22 days ago)
- Default Branch: main
- Last Pushed: 2024-10-22T04:28:11.000Z (22 days ago)
- Last Synced: 2024-10-23T05:38:06.158Z (21 days ago)
- Language: TypeScript
- Size: 118 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-noir - Noir Social Verify - Wrapper around zkemailnr to verify social accounts and extract details like X username, and emails. (Get Coding / Libraries)
README
# Noir Social Verify
Noir Social Verify is a library that provides a simple way to verify social accounts by proving the password reset email (or) OAuth Login Emails. This library is built using the [zkemail.nr](https://github.com/zkemail/zkemail.nr). Currently the library provides verification for the following social accounts:
- [x] Google: OAuth Login Email
- [x] X: Password Reset Email with username validation
- [x] GitHub: Password Reset Email
- [x] LinkedIn: Password Reset Email## Installation
In your `Nargo.toml` file, add the version of this library you would like to install under dependency:
```toml
[dependencies]
noir_social_verify = { tag = "v0.0.1", git = "https://github.com/Envoy-VC/noir_social_verify", directory = "lib" }
```## Usage
To generate inputs for the verification functions, `@zk-email/zkemail-nr` npm package. Install it by using the following command:
```bash
npm install @zk-email/zkemail-nr
```Generating Inputs:
```ts
import { generateEmailVerifierInputs } from '@zk-email/zkemail-nr';const zkEmailInputs = await generateEmailVerifierInputs(emailContent, {
maxBodyLength: 16384,
maxHeadersLength: 576,
extractFrom: true,
});
```Here are the Input Arguments for all services:
```ts
const inputParams = {
x: { maxHeadersLength: 576, maxBodyLength: 16384, extractFrom: true },
google: {
maxHeadersLength: 576,
maxBodyLength: 16384,
extractFrom: true,
extractTo: true,
},
linkedin: {
maxHeadersLength: 768,
maxBodyLength: 49152,
extractFrom: true,
extractTo: true,
},
github: {
maxHeadersLength: 576,
maxBodyLength: 49152,
extractFrom: true,
extractTo: true,
},
};
```Testing emails can be found in [js/data](./js/data/) directory, along with unit tests.
---
## Google Verification
```noir
use noir_social_verify::google::verify_google;
use noir_social_verify::zkemail::{KEY_LIMBS_2048, dkim::RSAPubkey, Sequence};pub global MAX_EMAIL_HEADER_LENGTH: u32 = 576;
fn main(
header: BoundedVec,
pubkey: RSAPubkey,
signature: [Field; KEY_LIMBS_2048],
from_header_sequence: Sequence,
from_address_sequence: Sequence,
to_header_sequence: Sequence,
to_address_sequence: Sequence
) -> pub BoundedVec {
let email = verify_google(
header,
pubkey,
signature,
from_header_sequence,
from_address_sequence,
to_header_sequence,
to_address_sequence
);
}```
---
## X Verification
```noir
use noir_social_verify::x::verify_x;
use noir_social_verify::zkemail::{KEY_LIMBS_2048, dkim::RSAPubkey, Sequence};pub global MAX_EMAIL_HEADER_LENGTH: u32 = 576;
pub global MAX_EMAIL_BODY_LENGTH: u32 = 16384;
pub global MAX_USERNAME_LENGTH: u32 = 64;fn main(
header: BoundedVec,
body: BoundedVec,
pubkey: RSAPubkey,
signature: [Field; KEY_LIMBS_2048],
body_hash_index: u32,
dkim_header_sequence: Sequence,
from_header_sequence: Sequence,
from_address_sequence: Sequence,
username: BoundedVec
) -> pub BoundedVec {
let extracted_username = verify_x(
header,
body,
pubkey,
signature,
body_hash_index,
dkim_header_sequence,
from_header_sequence,
from_address_sequence,
username
);
extracted_username
}
```---
## GitHub Verification
```noir
use noir_social_verify::github::verify_github;
use noir_social_verify::zkemail::{KEY_LIMBS_1024, dkim::RSAPubkey, Sequence};pub global MAX_EMAIL_HEADER_LENGTH: u32 = 576;
fn main(
header: BoundedVec,
pubkey: RSAPubkey,
signature: [Field; KEY_LIMBS_1024],
from_header_sequence: Sequence,
from_address_sequence: Sequence,
to_header_sequence: Sequence,
to_address_sequence: Sequence
) -> pub BoundedVec {
let email = verify_github(
header,
pubkey,
signature,
from_header_sequence,
from_address_sequence,
to_header_sequence,
to_address_sequence
);
}
```> **Note**: Github Verification uses KEY_LIMBS_1024 for RSA Public Key.
---
## LinkedIn Verification
```noir
use noir_social_verify::linkedin::verify_linkedin;
use noir_social_verify::zkemail::{KEY_LIMBS_2048, dkim::RSAPubkey, Sequence};pub global MAX_EMAIL_HEADER_LENGTH: u32 = 768;
fn main(
header: BoundedVec,
pubkey: RSAPubkey,
signature: [Field; KEY_LIMBS_2048],
from_header_sequence: Sequence,
from_address_sequence: Sequence,
to_header_sequence: Sequence,
to_address_sequence: Sequence
) -> pub BoundedVec {
let res = verify_linkedin(
header,
pubkey,
signature,
from_header_sequence,
from_address_sequence,
to_header_sequence,
to_address_sequence
);
res
}
```---
## Getting Started
To get started with the project, clone the repository and install the dependencies:
```bash
git clone https://github.com/Envoy-VC/noir_social_verify.git
```Compile all the circuits by running the following command:
```bash
bash ./scripts/compile.sh
```To run the tests, use the following command:
```bash
cd ./js && bun test
```---