Digital Identity Management
The Dragon Wallets SDK provides advanced digital identity management capabilities, enabling the creation, verification, and management of secure digital identities with blockchain-based verification and multi-dimensional profiles.
Overview
Digital identity is a core component of the Dragon Wallets ecosystem, providing a secure, verifiable, and privacy-preserving foundation for all wallet operations. The identity management system is built on a multi-dimensional approach that transcends traditional authentication methods.
Key Features
- Blockchain-secured identity verification
- Verifiable credentials with selective disclosure
- Multi-dimensional profile management
- Phi-resonant cryptographic security
- Semantic identity with me.profile addressing
- Portable identity across platforms and services
- Privacy-preserving authentication and authorization
Identity Creation
Creating a digital identity is the first step in establishing a secure presence within the DragonFire ecosystem.
import { DragonFireClient } from '@dragonfire/client';
import { WalletClient } from '@dragonfire/wallet-client';
// Initialize the clients
const dragonfire = new DragonFireClient({
apiKey: 'YOUR_API_KEY',
region: 'us-west'
});
await dragonfire.connect();
const wallet = new WalletClient(dragonfire);
// Create a digital identity
const identity = await wallet.createIdentity({
displayName: 'Alice Johnson', // Human-readable name
email: 'alice@example.com', // Primary email (optional)
attributes: { // Custom attributes
country: 'US',
birthYear: 1985,
profession: 'Software Engineer'
},
verificationLevel: 'standard', // Verification level
walletId: 'wallet_123' // Associate with specific wallet
}, {
privacyLevel: 'high', // Privacy protection level
backupIdentity: true, // Create identity backup
allowCredentials: true, // Allow credential attachment
dimensionality: 7 // Profile dimensionality
});
Identity Creation Options
Parameter | Type | Default | Description |
---|---|---|---|
displayName | string | Required | Human-readable identity name |
string | Optional | Primary email address for notifications | |
attributes | object | {} | Custom identity attributes |
verificationLevel | string | 'standard' | Verification level ('minimal', 'standard', 'high', 'maximum') |
walletId | string | Optional | Associated wallet ID |
privacyLevel | string | 'standard' | Privacy protection level ('standard', 'high', 'maximum') |
backupIdentity | boolean | true | Create secure identity backup |
allowCredentials | boolean | true | Allow credential attachment to identity |
dimensionality | number | 7 | Profile dimensionality (3-13) |
Identity Structure
A Dragon Wallets identity consists of several key components:
// Example identity structure
{
"id": "identity_789abc123def456", // Unique identity ID
"displayName": "Alice Johnson", // Human-readable name
"email": "alice@example.com", // Primary email
"createdAt": "2025-04-15T14:32:18Z", // Creation timestamp
"updatedAt": "2025-04-15T14:32:18Z", // Last update timestamp
"status": "active", // Identity status
"verificationLevel": "standard", // Verification level
"walletId": "wallet_123", // Associated wallet
"attributes": { // Custom attributes
"country": "US",
"birthYear": 1985,
"profession": "Software Engineer"
},
"credentials": [], // Attached credentials
"profile": { // Multi-dimensional profile
"dimensions": 7,
"vectors": {
"reputation": [0.92, 0.87, 0.95, 0.91, 0.88, 0.90, 0.93],
"activity": [0.76, 0.82, 0.79, 0.85, 0.80, 0.77, 0.81]
}
},
"privacySettings": { // Privacy settings
"level": "high",
"dataRetention": "minimal",
"sharingPreferences": {
"email": "authorized",
"attributes": "selective",
"credentials": "none"
}
},
"semanticAddress": "alice.profile" // Semantic web address
}
Identity Verification
The SDK provides multiple methods for verifying identity information to establish trust and meet compliance requirements.
// Request identity verification
const verificationRequest = await wallet.requestIdentityVerification({
identityId: 'identity_789abc123def456',
verificationMethod: 'document', // Verification method
documentType: 'passport', // Document type
region: 'US', // Geographic region
callbackUrl: 'https://example.com/verification-callback'
});
// Check verification status
const verificationStatus = await wallet.checkVerificationStatus(
verificationRequest.id
);
// Handle verification result
if (verificationStatus.status === 'completed') {
if (verificationStatus.result === 'approved') {
console.log('Verification approved!');
console.log('New verification level:', verificationStatus.newLevel);
} else {
console.log('Verification rejected:', verificationStatus.rejectionReason);
}
} else {
console.log('Verification in progress:', verificationStatus.status);
console.log('Estimated completion time:', verificationStatus.estimatedCompletion);
}
Verification Methods
Dragon Wallets supports multiple verification methods with varying levels of assurance:
Document Verification
Upload government-issued ID documents like passports or driver's licenses for verification through AI and human review.
Address Verification
Confirm physical addresses through utility bills, bank statements, or postal verification codes.
Biometric Verification
Use facial recognition, fingerprint scanning, or voice verification to confirm identity biometrically.
Cryptographic Verification
Verify identity through cryptographic signatures with existing trusted accounts or credentials.
KYC/AML Verification
Conduct Know Your Customer and Anti-Money Laundering checks through integrated third-party services.
Social Verification
Verify identity through connections with existing social media accounts and reputation systems.
Verification Levels
Identity verification is categorized into multiple levels, each providing different levels of assurance:
Level | Requirements | Use Cases |
---|---|---|
Minimal | Email verification only | Basic platform access, viewing public content |
Standard | Email + phone verification | Low-value transactions, basic wallet operations |
High | Document verification (ID/passport) | Medium-value transactions, credential issuance |
Maximum | Document + biometric + address verification | High-value transactions, restricted service access |
Verifiable Credentials
Dragon Wallets supports the creation, management, and verification of digital credentials that can be attached to identities and securely shared with third parties.
// Issue a credential
const credential = await wallet.issueCredential({
type: 'EmploymentCredential',
subject: 'identity_789abc123def456', // Identity receiving the credential
issuer: {
id: 'organization_123', // Issuing organization
name: 'Acme Corporation'
},
claims: { // Credential claims
position: 'Senior Developer',
department: 'Engineering',
employmentStartDate: '2023-01-15',
clearanceLevel: 'L3'
},
expirationDate: '2026-01-15T00:00:00Z',
revocable: true
});
// Add credential to identity
await wallet.addCredentialToIdentity(
'identity_789abc123def456',
credential.id
);
// Verify a credential
const verificationResult = await wallet.verifyCredential(credential.id);
console.log('Credential valid:', verificationResult.valid);
console.log('Issuer verified:', verificationResult.issuerVerified);
console.log('Not revoked:', verificationResult.notRevoked);
console.log('Not expired:', verificationResult.notExpired);
// Create a presentation with selective disclosure
const presentation = await wallet.createCredentialPresentation({
credentialId: credential.id,
disclosedClaims: ['position', 'department'], // Only disclose specific claims
audience: 'project_partner_456',
purpose: 'project collaboration',
expiresIn: 3600 // Presentation expires in 1 hour
});
Credential Types
Dragon Wallets supports various credential types including:
- IdentityCredential: Basic identity verification
- EmploymentCredential: Employment verification
- EducationCredential: Educational achievements
- MembershipCredential: Organization membership
- LicenseCredential: Professional licenses
- AccessCredential: Service access permissions
- AchievementCredential: Accomplishments and awards
- FinancialCredential: Financial status verification
- CustomCredential: Custom-defined credentials
Selective Disclosure
Dragon Wallets allows credential holders to selectively disclose specific claims from their credentials, maintaining privacy while providing necessary verification.
// Create a minimal disclosure presentation
const minimalPresentation = await wallet.createCredentialPresentation({
credentialId: credential.id,
disclosedClaims: ['position'], // Only disclose position
derivedClaims: [
{
original: 'clearanceLevel',
derived: 'hasSufficientClearance',
derivation: 'greaterThanOrEqual',
threshold: 'L2'
},
{
original: 'employmentStartDate',
derived: 'employmentDuration',
derivation: 'timeElapsed',
unit: 'years'
}
],
audience: 'project_partner_456',
purpose: 'access verification',
expiresIn: 1800 // 30 minutes
});
Credential Verification
Verify credentials issued by third parties or issue credentials to other users:
// Verify a credential presented by another user
const verificationRequest = await wallet.verifyExternalCredential(
externalPresentation,
{
requiredClaims: ['position'],
trustedIssuers: ['organization_123', 'organization_456'],
verificationLevel: 'high'
}
);
// Issue credentials as an organization
const organizationCredential = await wallet.issueOrganizationCredential({
organizationId: 'your_organization_id',
credentialType: 'MembershipCredential',
subject: 'identity_recipient',
claims: {
membershipLevel: 'premium',
joinDate: '2024-01-15',
membershipId: 'MEM12345'
},
expirationDate: '2025-01-15T00:00:00Z'
});
Authentication
Dragon Wallets provides advanced authentication mechanisms for secure identity verification and access control.
// Create an authentication token
const authToken = await wallet.createAuthToken({
identityId: 'identity_789abc123def456',
purpose: 'service_login',
audience: 'app_123',
scope: ['profile:read', 'transactions:read'],
expiresIn: 3600, // 1 hour
rotationEnabled: true
});
// Verify an authentication token
const tokenVerification = await wallet.verifyAuthToken(
receivedToken,
{
expectedAudience: 'app_123',
expectedScope: ['profile:read']
}
);
// Configure multi-factor authentication
await wallet.configureMultiFactorAuth({
identityId: 'identity_789abc123def456',
methods: ['app', 'email', 'sms'],
requiredMethodCount: 2,
highValueThreshold: 1000 // Require MFA for transactions above $1000
});
// Generate a multi-factor authentication challenge
const mfaChallenge = await wallet.generateMFAChallenge({
identityId: 'identity_789abc123def456',
method: 'app', // Use authenticator app
purpose: 'transaction_authorization',
transactionId: 'tx_123456'
});
// Verify a multi-factor authentication response
const mfaVerification = await wallet.verifyMFAResponse({
challengeId: mfaChallenge.id,
response: '123456', // Code from authenticator app
clientInfo: {
ipAddress: clientIp,
userAgent: userAgent,
geoLocation: geoLocation
}
});
Authentication Methods
Dragon Wallets supports multiple authentication methods for enhanced security:
RWT Authentication
Secure token-based authentication using Rotational WebSockets technology with automatic rotation and phi-resonant patterns.
Biometric Authentication
Authenticate using fingerprint, facial recognition, or other biometric factors for high-security operations.
Time-based OTP
Time-based one-time passwords using TOTP standard with authenticator apps for two-factor authentication.
Push Authentication
Approve authentication requests directly through mobile device push notifications for improved security and user experience.
RWT Authentication
Rotational WebSockets (RWT) technology provides a secure foundation for authentication:
// Create an RWT authentication token
const rwtToken = await wallet.createRWTToken({
identityId: 'identity_789abc123def456',
purpose: 'service_authentication',
permissions: ['profile:read', 'credentials:read'],
expiresIn: 3600000, // 1 hour in milliseconds
metadata: {
deviceId: 'device_abc123',
applicationName: 'Example App'
}
}, {
rotationPattern: 'phi', // Use phi-resonant rotation
rotationInterval: 300000, // Rotate every 5 minutes
securityLevel: 'high', // High security level
wrappedToken: true // Create wrapped token
});
// Use token for authentication
const rwtAuthResult = await wallet.authenticateWithRWT(
receivedRwtToken,
{
verifyDevice: true,
requiredPermissions: ['profile:read'],
securityContext: {
ipAddress: clientIp,
userAgent: userAgent,
timestamp: Date.now()
}
}
);
For more details on RWT Authentication, see the RWT Authentication Guide.
Multi-Dimensional Profiles
Dragon Wallets implements multi-dimensional profiles that capture various aspects of identity in a mathematically optimized format.
// Configure identity profile dimensions
await wallet.configureIdentityProfile({
identityId: 'identity_789abc123def456',
dimensions: 7, // 7-dimensional profile
dimensionMapping: {
0: 'reputation', // Reputation dimension
1: 'activity', // Activity dimension
2: 'verification', // Verification dimension
3: 'expertise', // Expertise dimension
4: 'behavior', // Behavior dimension
5: 'reliability', // Reliability dimension
6: 'connections' // Connections dimension
},
optimizationPattern: 'phi', // Phi-resonant optimization
updateFrequency: 'continuous' // Continuous updates
});
// Update a specific profile dimension
await wallet.updateProfileDimension({
identityId: 'identity_789abc123def456',
dimension: 'reputation',
value: 0.92,
context: {
source: 'transaction_feedback',
transactionId: 'tx_123456'
}
});
// Get profile vector
const profileVector = await wallet.getProfileVector({
identityId: 'identity_789abc123def456',
dimensions: ['reputation', 'activity', 'verification']
});
// Calculate profile similarity with another identity
const similarity = await wallet.calculateProfileSimilarity({
sourceIdentityId: 'identity_789abc123def456',
targetIdentityId: 'identity_456abc789def',
dimensions: ['expertise', 'behavior'],
similarityMetric: 'cosine'
});
Profile Dimensions
Multi-dimensional profiles typically include the following dimensions:
- Reputation: Overall trustworthiness based on past interactions
- Activity: Level and pattern of activity within the ecosystem
- Verification: Degree of identity verification
- Expertise: Knowledge and skills in specific domains
- Behavior: Behavioral patterns and predictability
- Reliability: Consistency and dependability of actions
- Connections: Network of relationships and interactions
Profile Mathematics
Multi-dimensional profiles use advanced mathematical concepts for optimal representation:
// Configure advanced profile mathematics
await wallet.configureProfileMathematics({
identityId: 'identity_789abc123def456',
vectorSpace: 'euclidean', // Vector space type
normalization: 'min-max', // Vector normalization method
aggregationMethod: 'weighted', // Dimension aggregation method
dimensionWeights: { // Dimension importance weights
reputation: 0.25,
verification: 0.20,
activity: 0.15,
expertise: 0.15,
behavior: 0.10,
reliability: 0.10,
connections: 0.05
},
transformations: [ // Mathematical transformations
{
type: 'harmonicResonance',
pattern: 'phi',
strength: 0.8
},
{
type: 'dimensionalProjection',
targetDimensions: 3,
preservationMetric: 'variance'
}
]
});
Privacy Controls
Dragon Wallets provides comprehensive privacy controls for managing how identity information is shared and used.
// Configure privacy settings
await wallet.configurePrivacySettings({
identityId: 'identity_789abc123def456',
privacyLevel: 'high', // Privacy protection level
dataRetention: 'minimal', // Data retention policy
sharingPreferences: { // Data sharing preferences
profileInfo: {
displayName: 'public', // Public display name
email: 'authorized', // Email shared with authorized parties
attributes: 'selective' // Selective attribute sharing
},
credentials: {
default: 'none', // No credential sharing by default
exceptions: {
'EmploymentCredential': 'selective' // Selective sharing for employment
}
},
profileDimensions: {
default: 'authorized', // Share dimensions with authorized
exceptions: {
'reputation': 'public' // Public reputation dimension
}
}
},
consentRequirements: { // Consent requirements
requiredForNewSharing: true, // Require consent for new sharing
expirationPeriod: 90, // Consent expires after 90 days
recordConsent: true // Record all consent actions
}
});
// Create a privacy-preserving identity share
const identityShare = await wallet.createIdentityShare({
identityId: 'identity_789abc123def456',
recipient: 'service_123', // Share recipient
purpose: 'service_provision', // Share purpose
expiration: '2026-01-01T00:00:00Z', // Share expiration
attributes: ['displayName', 'country'], // Shared attributes
credentials: [ // Shared credentials
{
id: 'credential_123', // Credential to share
disclosedClaims: ['position'] // Only share position claim
}
],
dimensions: ['reputation'], // Shared profile dimensions
revocable: true // Share can be revoked
});
// Revoke a previous identity share
await wallet.revokeIdentityShare(identityShare.id, {
reason: 'service_termination',
notifyRecipient: true
});
// Get identity data usage audit
const dataUsageAudit = await wallet.getIdentityDataUsage({
identityId: 'identity_789abc123def456',
timeRange: {
start: '2025-01-01T00:00:00Z',
end: '2025-04-01T00:00:00Z'
},
categories: ['sharing', 'authentication', 'updates']
});
Zero-Knowledge Proofs
For maximum privacy, Dragon Wallets supports zero-knowledge proofs for credential verification without revealing the actual data:
// Create a zero-knowledge proof
const zkProof = await wallet.createZeroKnowledgeProof({
credentialId: 'credential_123', // Source credential
proofStatement: 'greaterThan', // Proof statement
attribute: 'clearanceLevel', // Attribute to prove
threshold: 'L2', // Comparison threshold
recipient: 'verifier_456', // Proof recipient
expiresIn: 3600 // Proof expires in 1 hour
});
// Verify a zero-knowledge proof
const zkVerification = await wallet.verifyZeroKnowledgeProof(
receivedZkProof,
{
expectedStatement: 'greaterThan',
expectedAttribute: 'clearanceLevel',
expectedThreshold: 'L2',
trustedIssuers: ['organization_123']
}
);
Semantic Identity
Dragon Wallets enables semantic identity addressing with the me.profile system for intuitive identity resolution in the semantic web.
// Register a semantic identity address
const semanticAddress = await wallet.registerSemanticAddress({
identityId: 'identity_789abc123def456',
addressName: 'alice', // Results in alice.profile
displayName: 'Alice Johnson', // Human-readable display name
description: 'Software Engineer and AI Researcher',
avatarUrl: 'https://example.com/alice.jpg',
publicAccess: true, // Publicly accessible profile
redirectOptions: {
defaultUrl: 'https://alice.example.com', // Default redirect
customDomains: ['alicejohnson.com'] // Custom domain options
}
});
// Resolve a semantic address
const resolution = await wallet.resolveSemanticAddress('alice.profile', {
context: 'social', // Resolution context
includeAlternatives: true // Include alternative resolutions
});
// Configure semantic handlers for specific contexts
await wallet.registerSemanticHandlers([
{
context: 'finance', // Financial context
handler: 'wallet.payments', // Payment handler
priority: 'high' // High priority
},
{
context: 'shopping', // Shopping context
handler: 'wallet.commerce', // Commerce handler
priority: 'medium' // Medium priority
},
{
context: 'identity', // Identity context
handler: 'wallet.credentials', // Credentials handler
priority: 'high' // High priority
}
]);
// Process a semantic navigation request
const navigationResult = await wallet.processSemanticNavigation(
'shopping.alice.profile',
{
context: 'e-commerce', // E-commerce context
intent: 'view-cart', // View cart intent
referrer: 'search' // Referred from search
}
);
Semantic Web Navigation
The semantic identity system enables revolutionary approaches to web navigation:
- Natural Addressing: Replace traditional URLs with intuitive name.profile addresses
- Context-Aware Resolution: Different resolutions based on usage context
- Intent-Based Navigation: Navigation based on user intent rather than explicit URLs
- Seamless Authentication: Identity-based access without traditional login procedures
- Privacy-Preserving Sharing: Selective information disclosure based on context
Code Examples
Complete Identity Management Example
import { DragonFireClient } from '@dragonfire/client';
import { WalletClient } from '@dragonfire/wallet-client';
async function manageIdentity() {
// Initialize the clients
const dragonfire = new DragonFireClient({
apiKey: 'YOUR_API_KEY',
region: 'us-west'
});
await dragonfire.connect();
const wallet = new WalletClient(dragonfire, {
securityLevel: 'high',
vectorDimension: 7
});
try {
// Step 1: Create a wallet if needed
let userWallet;
try {
userWallet = await wallet.loadWallet('existing-wallet-id');
console.log('Loaded existing wallet:', userWallet.id);
} catch (error) {
userWallet = await wallet.createWallet({
name: 'Primary Wallet',
attributes: { purpose: 'identity-example' }
});
console.log('Created new wallet:', userWallet.id);
}
// Step 2: Create an identity
const identity = await wallet.createIdentity({
displayName: 'Alice Johnson',
email: 'alice@example.com',
attributes: {
country: 'US',
birthYear: 1985,
profession: 'Software Engineer'
},
verificationLevel: 'standard',
walletId: userWallet.id
}, {
privacyLevel: 'high',
backupIdentity: true,
allowCredentials: true
});
console.log('Created identity:', identity.id);
// Step 3: Request identity verification
const verificationRequest = await wallet.requestIdentityVerification({
identityId: identity.id,
verificationMethod: 'document',
documentType: 'passport',
region: 'US'
});
console.log('Verification request created:', verificationRequest.id);
console.log('Verification status:', verificationRequest.status);
// Step 4: Configure multi-dimensional profile
await wallet.configureIdentityProfile({
identityId: identity.id,
dimensions: 7,
dimensionMapping: {
0: 'reputation',
1: 'activity',
2: 'verification',
3: 'expertise',
4: 'behavior',
5: 'reliability',
6: 'connections'
},
optimizationPattern: 'phi'
});
console.log('Profile configured with 7 dimensions');
// Step 5: Update profile dimensions
await wallet.updateProfileDimension({
identityId: identity.id,
dimension: 'verification',
value: 0.5, // Standard verification level
context: {
source: 'verification_process',
requestId: verificationRequest.id
}
});
console.log('Updated verification dimension');
// Step 6: Register semantic address
const semanticAddress = await wallet.registerSemanticAddress({
identityId: identity.id,
addressName: 'alice',
displayName: 'Alice Johnson',
description: 'Software Engineer',
publicAccess: true
});
console.log('Registered semantic address:', semanticAddress);
// Step 7: Configure privacy settings
await wallet.configurePrivacySettings({
identityId: identity.id,
privacyLevel: 'high',
dataRetention: 'minimal',
sharingPreferences: {
profileInfo: {
displayName: 'public',
email: 'authorized',
attributes: 'selective'
},
credentials: {
default: 'none'
},
profileDimensions: {
default: 'authorized',
exceptions: {
'reputation': 'public'
}
}
}
});
console.log('Privacy settings configured');
// Step 8: Create auth token for a service
const authToken = await wallet.createAuthToken({
identityId: identity.id,
purpose: 'service_login',
audience: 'example_service',
scope: ['profile:read'],
expiresIn: 3600
});
console.log('Auth token created:', authToken.token);
return {
walletId: userWallet.id,
identityId: identity.id,
semanticAddress: semanticAddress,
authToken: authToken.token
};
} catch (error) {
console.error('Identity management error:', error);
throw error;
} finally {
await dragonfire.disconnect();
}
}
// Execute the identity management process
manageIdentity()
.then(result => console.log('Identity management completed:', result))
.catch(error => console.error('Identity management failed:', error));
Identity Verification and Credential Management
import { DragonFireClient } from '@dragonfire/client';
import { WalletClient } from '@dragonfire/wallet-client';
async function verifyAndIssueCredentials(identityId) {
// Initialize the clients
const dragonfire = new DragonFireClient({
apiKey: 'YOUR_API_KEY',
region: 'us-west'
});
await dragonfire.connect();
const wallet = new WalletClient(dragonfire);
try {
// Step 1: Load identity
const identity = await wallet.getIdentity(identityId);
console.log('Loaded identity:', identity.displayName);
// Step 2: Request document verification
const docVerification = await wallet.requestIdentityVerification({
identityId: identity.id,
verificationMethod: 'document',
documentType: 'passport'
});
console.log('Document verification requested:', docVerification.id);
// Normally you would wait for the verification to complete
// This is just a simulation for this example
console.log('Simulating verification completion...');
// Step 3: Update verification status (in a real scenario, this would happen asynchronously)
await wallet.updateProfileDimension({
identityId: identity.id,
dimension: 'verification',
value: 0.9, // High verification level
context: {
source: 'document_verification',
verificationId: docVerification.id
}
});
// Step 4: Issue identity credential
const identityCredential = await wallet.issueCredential({
type: 'IdentityCredential',
subject: identity.id,
issuer: {
id: 'authority_123',
name: 'Verification Authority'
},
claims: {
fullName: identity.displayName,
country: identity.attributes.country,
verificationLevel: 'high',
verifiedAt: new Date().toISOString()
},
expirationDate: new Date(Date.now() + 365 * 24 * 60 * 60 * 1000).toISOString(), // 1 year
revocable: true
});
console.log('Identity credential issued:', identityCredential.id);
// Step 5: Add credential to identity
await wallet.addCredentialToIdentity(identity.id, identityCredential.id);
// Step 6: Issue employment credential
const employmentCredential = await wallet.issueCredential({
type: 'EmploymentCredential',
subject: identity.id,
issuer: {
id: 'organization_456',
name: 'Acme Corporation'
},
claims: {
position: 'Senior Developer',
department: 'Engineering',
employmentStartDate: '2023-01-15',
clearanceLevel: 'L3'
},
expirationDate: new Date(Date.now() + 365 * 24 * 60 * 60 * 1000).toISOString(), // 1 year
revocable: true
});
console.log('Employment credential issued:', employmentCredential.id);