mirror of
https://github.com/selfxyz/self.git
synced 2026-01-10 23:27:56 -05:00
docs: update files in rest of the repo for Selfrica attestation type
This commit is contained in:
@@ -20,9 +20,9 @@
|
||||
## Core Components
|
||||
|
||||
1. Identity Verification Hub
|
||||
- Manages multi-step verification process for passports and EU ID cards
|
||||
- Manages multi-step verification process for passports, EU ID cards, Aadhaar, and Selfrica ID cards
|
||||
- Handles document attestation through zero-knowledge proofs
|
||||
- Implements verification paths: E-PASSPORT and EU_ID_CARD
|
||||
- Implements verification paths: E-PASSPORT, EU_ID_CARD, AADHAAR, and SELFRICA_ID_CARD
|
||||
- File: contracts/contracts/IdentityVerificationHubImplV2.sol
|
||||
|
||||
2. Document Verification Processing
|
||||
@@ -40,10 +40,10 @@
|
||||
- Files: noir/crates/dg1/src/ofac/*.nr
|
||||
|
||||
4. Identity Registry Management
|
||||
- Maintains separate registries for passports and ID cards
|
||||
- Maintains separate registries for passports, EU ID cards, Aadhaar, and Selfrica
|
||||
- Handles DSC key commitment registration
|
||||
- Implements nullifier tracking for duplicate prevention
|
||||
- File: contracts/contracts/registry/IdentityRegistryImplV1.sol
|
||||
- Files: contracts/contracts/registry/IdentityRegistryImplV1.sol, IdentityRegistryIdCardImplV1.sol, IdentityRegistryAadhaarImplV1.sol, IdentityRegistrySelfricaImplV1.sol
|
||||
|
||||
## Core Workflows
|
||||
|
||||
|
||||
@@ -43,6 +43,8 @@ export {
|
||||
IDENTITY_TREE_URL_STAGING_ID_CARD,
|
||||
ID_CARD_ATTESTATION_ID,
|
||||
PASSPORT_ATTESTATION_ID,
|
||||
AADHAAR_ATTESTATION_ID,
|
||||
SELFRICA_ATTESTATION_ID,
|
||||
PCR0_MANAGER_ADDRESS,
|
||||
REDIRECT_URL,
|
||||
RPC_URL,
|
||||
|
||||
@@ -3,7 +3,7 @@ export type document_type = 'passport' | 'id_card';
|
||||
export type hashAlgosTypes = 'sha512' | 'sha384' | 'sha256' | 'sha224' | 'sha1';
|
||||
export const AADHAAR_ATTESTATION_ID = '3';
|
||||
export const API_URL = 'https://api.self.xyz';
|
||||
export const KYC_ATTESTATION_ID = '4';
|
||||
export const SELFRICA_ATTESTATION_ID = '4';
|
||||
|
||||
export const API_URL_STAGING = 'https://api.staging.self.xyz';
|
||||
|
||||
|
||||
@@ -4,17 +4,22 @@ pragma solidity 0.8.28;
|
||||
/**
|
||||
* @title AttestationId Library
|
||||
* @notice This library provides attestation identifiers used across contracts.
|
||||
* @dev Currently, it contains the constant E_PASSPORT which represents the identifier
|
||||
* for an E-PASSPORT attestation computed as Poseidon("E-PASSPORT").
|
||||
* @dev Contains constants for all supported attestation types:
|
||||
* - E_PASSPORT (1): Electronic passports with NFC chip
|
||||
* - EU_ID_CARD (2): EU biometric ID cards with NFC chip
|
||||
* - AADHAAR (3): Indian Aadhaar identity documents
|
||||
* - SELFRICA_ID_CARD (4): African identity documents via Selfrica/SmileID
|
||||
*/
|
||||
library AttestationId {
|
||||
/**
|
||||
* @notice Identifier for an E-PASSPORT attestation.
|
||||
* @dev The identifier is computed based on the hash of "E-PASSPORT" using the Poseidon hash function.
|
||||
* Here it is hardcoded as bytes32(uint256(1)) for demonstration purposes.
|
||||
*/
|
||||
/// @notice Identifier for an E-PASSPORT attestation (electronic passports with NFC chip).
|
||||
bytes32 constant E_PASSPORT = bytes32(uint256(1));
|
||||
|
||||
/// @notice Identifier for an EU_ID_CARD attestation (EU biometric ID cards with NFC chip).
|
||||
bytes32 constant EU_ID_CARD = bytes32(uint256(2));
|
||||
|
||||
/// @notice Identifier for an AADHAAR attestation (Indian Aadhaar identity documents).
|
||||
bytes32 constant AADHAAR = bytes32(uint256(3));
|
||||
|
||||
/// @notice Identifier for a SELFRICA_ID_CARD attestation (African identity documents via Selfrica/SmileID).
|
||||
bytes32 constant SELFRICA_ID_CARD = bytes32(uint256(4));
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { ethers } from "hardhat";
|
||||
import { deploySystemFixturesV2 } from "../utils/deploymentV2";
|
||||
import { DeployedActorsV2 } from "../utils/types";
|
||||
import { KYC_ATTESTATION_ID } from "@selfxyz/common/constants/constants";
|
||||
import { generateMockKycRegisterInput, OFAC_DUMMY_INPUT } from '@selfxyz/common';
|
||||
import { SELFRICA_ATTESTATION_ID } from "@selfxyz/common/constants/constants";
|
||||
import { generateMockKycRegisterInput } from '@selfxyz/common/utils/kyc/generateInputs';
|
||||
import { generateRegisterSelfricaProof } from "../utils/generateProof";
|
||||
import { expect } from "chai";
|
||||
|
||||
@@ -38,7 +38,7 @@ describe("Selfrica Registration test", function () {
|
||||
|
||||
before(async () => {
|
||||
deployedActors = await deploySystemFixturesV2();
|
||||
attestationIdBytes32 = ethers.zeroPadValue(ethers.toBeHex(BigInt(KYC_ATTESTATION_ID)), 32);
|
||||
attestationIdBytes32 = ethers.zeroPadValue(ethers.toBeHex(BigInt(SELFRICA_ATTESTATION_ID)), 32);
|
||||
|
||||
console.log("🎉 System deployment and initial setup completed!");
|
||||
});
|
||||
|
||||
@@ -4,6 +4,7 @@ export const ATTESTATION_ID = {
|
||||
PASSPORT: 1,
|
||||
BIOMETRIC_ID_CARD: 2,
|
||||
AADHAAR: 3,
|
||||
SELFRICA_ID_CARD: 4,
|
||||
} as const;
|
||||
|
||||
export const discloseIndices = {
|
||||
@@ -46,6 +47,19 @@ export const discloseIndices = {
|
||||
userIdentifierIndex: 18,
|
||||
passportNoSmtRootIndex: 99,
|
||||
},
|
||||
4: {
|
||||
revealedDataPackedIndex: 1,
|
||||
forbiddenCountriesListPackedIndex: 10,
|
||||
nullifierIndex: 14,
|
||||
attestationIdIndex: 0,
|
||||
merkleRootIndex: 16,
|
||||
currentDateIndex: 20,
|
||||
namedobSmtRootIndex: 17,
|
||||
nameyobSmtRootIndex: 18,
|
||||
scopeIndex: 15,
|
||||
userIdentifierIndex: 19,
|
||||
passportNoSmtRootIndex: 99,
|
||||
},
|
||||
} as const;
|
||||
|
||||
type RevealedDataFields =
|
||||
|
||||
@@ -14,9 +14,10 @@ import (
|
||||
|
||||
// Constants for attestation types
|
||||
const (
|
||||
Passport AttestationId = 1
|
||||
EUCard AttestationId = 2
|
||||
Aadhaar AttestationId = 3
|
||||
Passport AttestationId = 1
|
||||
EUCard AttestationId = 2
|
||||
Aadhaar AttestationId = 3
|
||||
SelfricaIdCard AttestationId = 4
|
||||
)
|
||||
|
||||
// DiscloseIndicesEntry defines the indices for different data fields in the public signals
|
||||
@@ -75,6 +76,19 @@ var DiscloseIndices = map[AttestationId]DiscloseIndicesEntry{
|
||||
UserIdentifierIndex: 18,
|
||||
PassportNoSmtRootIndex: 99,
|
||||
},
|
||||
SelfricaIdCard: {
|
||||
RevealedDataPackedIndex: 1,
|
||||
ForbiddenCountriesListPackedIndex: 10,
|
||||
NullifierIndex: 14,
|
||||
AttestationIdIndex: 0,
|
||||
MerkleRootIndex: 16,
|
||||
CurrentDateIndex: 20,
|
||||
NamedobSmtRootIndex: 17,
|
||||
NameyobSmtRootIndex: 18,
|
||||
ScopeIndex: 15,
|
||||
UserIdentifierIndex: 19,
|
||||
PassportNoSmtRootIndex: 99,
|
||||
},
|
||||
}
|
||||
|
||||
// Field names for revealed data
|
||||
@@ -178,16 +192,18 @@ var RevealedDataIndices = map[AttestationId]RevealedDataIndicesEntry{
|
||||
|
||||
// AllIds contains all valid attestation IDs
|
||||
var AllIds = map[AttestationId]bool{
|
||||
Passport: true,
|
||||
EUCard: true,
|
||||
Aadhaar: true,
|
||||
Passport: true,
|
||||
EUCard: true,
|
||||
Aadhaar: true,
|
||||
SelfricaIdCard: true,
|
||||
}
|
||||
|
||||
// BytesCount maps attestation IDs to their respective byte counts
|
||||
var BytesCount = map[AttestationId][]int{
|
||||
Passport: {31, 31, 31},
|
||||
EUCard: {31, 31, 31, 1},
|
||||
Aadhaar: {31, 31, 31, 26},
|
||||
Passport: {31, 31, 31},
|
||||
EUCard: {31, 31, 31, 1},
|
||||
Aadhaar: {31, 31, 31, 26},
|
||||
SelfricaIdCard: {31, 31, 31, 31, 31, 31, 31, 31, 31},
|
||||
}
|
||||
|
||||
// trimU0000 filters out null characters (\u0000) from a slice of strings
|
||||
@@ -318,6 +334,8 @@ func GetRevealedDataPublicSignalsLength(attestationId AttestationId) (int, error
|
||||
return int(math.Ceil(94.0 / 31.0)), nil
|
||||
case Aadhaar:
|
||||
return int(math.Ceil(119.0 / 31.0)), nil
|
||||
case SelfricaIdCard:
|
||||
return 9, nil
|
||||
default:
|
||||
return 0, fmt.Errorf("invalid attestation ID: %d", attestationId)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user