Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
TWITTER_ANALYTICS_VIEWS_SECRET=your-twitter-secret
GITHUB_ACCOUNT_VERIFICATION_SECRET=your-github-secret
RECLAIM_GITHUB_TOKEN=your-github-token
hugging_SECRET=your-hugging-secret
74 changes: 0 additions & 74 deletions CRIP/CRIP-1.md

This file was deleted.

52 changes: 52 additions & 0 deletions CRIP/CRIP-HuggingIntegration.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
| proposal | title | description | author | discussions-to | status | type | category | created | requires |
| ----------- | ------------------- | ------------------------------------------- | -------------------------------------------- | -------------- | ------ | ----------- | -------- | ---------- | -------- |
| CRIP-Strava | Hugging Face Integration | Integration with Hugging Face to verify username | Ritik Prajapat <[email protected]> | | Draft | Integration | CRIP | 2024-07-14 | |

## Title

Hugging Face Integration

## Introduction

This proposal outlines the integration of Hugging Face as a data provider for the Catoff-Reclaim integration project. The integration aims to retrieve and process username on Hugging Face that is to be used within the Catoff platform. This will enable users to validate their claim regarding username needed for various challenges and verifications on Catoff.

## Use Cases

1. **User Verification**: Verify the activity of users on Hugging Face by checking their username.
2. **Challenge Participation**: Allow users to participate in challenges that require proof of hugging face username and activity.
3. **Skill Assessment**: Assess users' claim regarding hugging face username.

## Data Provider

- **Name**: Hugging Face username dbg
- **Hash Value**: 0xfce8f4b1a3a162135da558676fec0ac61c0cc05a577af0b9420d3aed3e4c4839

## Code Snippet

Below is a code snippet that demonstrates the key parts of the GitHub integration. The full implementation should follow the service file template.

**`services/githubService.js`**

```javascript
const { ReclaimServiceResponse } = require('../utils/reclaimServiceResponse')

exports.processhuggingData = async (proof, providerName) => {
const extractedParameters = JSON.parse(
proof[0].claimData.context
).extractedParameters

const username = extractedParameters.username

console.log(`Hugging Face user: ${username}`)

const lastUpdateTimeStamp = proof[0].claimData.timestampS

return new ReclaimServiceResponse(
providerName,
lastUpdateTimeStamp,
username,
username,
proof[0]
)
}
```
21 changes: 21 additions & 0 deletions src/services/huggingService.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
const { ReclaimServiceResponse } = require('../utils/reclaimServiceResponse')

exports.processhuggingData = async (proof, providerName) => {
const extractedParameters = JSON.parse(
proof[0].claimData.context
).extractedParameters

const username = extractedParameters.username

console.log(`Hugging Face user: ${username}`)

const lastUpdateTimeStamp = proof[0].claimData.timestampS

return new ReclaimServiceResponse(
providerName,
lastUpdateTimeStamp,
username,
username,
proof[0]
)
}
22 changes: 0 additions & 22 deletions src/services/newIntegrationService.js

This file was deleted.

9 changes: 8 additions & 1 deletion src/services/reclaimService.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
const axios = require('axios')
const dotenv = require('dotenv')
const { Reclaim } = require('@reclaimprotocol/js-sdk')
const { RECLAIM_PROVIDER_ID, RECLAIM_APP_ID } = require('../utils/constants')
const { processTwitterData } = require('./twitterService')
const { processGitHubData } = require('./githubService')
const { processhuggingData } = require('./huggingService')

dotenv.config()

exports.signWithProviderID = async (userId, providerId) => {
console.log(userId, providerId)
const providerName = RECLAIM_PROVIDER_ID[providerId]
const reclaimAppID = RECLAIM_APP_ID[providerName]
const reclaimAppSecret = process.env[`${providerName}_SECRET`]
Expand Down Expand Up @@ -49,6 +53,9 @@ const handleReclaimSession = async (userId, reclaimClient, providerName) => {
case 'GITHUB_ACCOUNT_VERIFICATION':
processedData = await processGitHubData(proof, providerName)
break
case 'hugging':
processedData = await processhuggingData(proof, providerName)
break
default:
throw new Error(`No handler for provider: ${providerName}`)
}
Expand Down
2 changes: 2 additions & 0 deletions src/utils/constants.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
exports.RECLAIM_PROVIDER_ID = {
twitter: 'TWITTER_ANALYTICS_VIEWS',
github: 'GITHUB_ACCOUNT_VERIFICATION',
hugging: 'HUGGING_USERNAME_INTEGRATION',
}

exports.RECLAIM_APP_ID = {
TWITTER_ANALYTICS_VIEWS: 'your-twitter-app-id',
GITHUB_ACCOUNT_VERIFICATION: 'your-github-app-id',
HUGGING_USERNAME_INTEGRATION: 'your-hugging-app-id',
}