Skip to content

Getting Started with Secureify

Installation

1. Include the SDK

Add the Secureify SDK to your HTML file:

<script src="https://api.secureify.xyz/static/fingerprint-sdk.js"></script>

2. Initialize the SDK

const fp = new FingerprintSDK('your-api-key', {
    endpoint: 'https://api.secureify.xyz',  // Optional: defaults to https://api.secureify.xyz
    autoRefresh: true,                      // Optional: automatically refresh device ID
    refreshInterval: 300000,                // Optional: refresh every 5 minutes
    debug: false                            // Optional: enable debug logging
});

Basic Usage

Generate Device ID

try {
    const deviceId = await fp.generateDeviceId();
    console.log('Device ID:', deviceId);
} catch (error) {
    console.error('Error generating device ID:', error);
}

Get Device Parameters

try {
    const parameters = await fp.getParameters();
    console.log('Device Parameters:', parameters);
} catch (error) {
    console.error('Error getting parameters:', error);
}

Listen for Device ID Changes

const unsubscribe = fp.onDeviceIdChange((newDeviceId) => {
    console.log('Device ID changed:', newDeviceId);
});

// Later, when you want to stop listening:
unsubscribe();

Advanced Configuration

Update Configuration

fp.configure({
    autoRefresh: false,
    refreshInterval: 600000, // 10 minutes
    debug: true
});

Cleanup

// Call this when you're done using the SDK
fp.destroy();

Available Methods

generateDeviceId()

Generates a unique device identifier based on device characteristics. - Returns: Promise - Example Response:

{
   "deviceId": "SEC1_223fce73b659e214"
}

getParameters()

Collects comprehensive device information including: - Screen properties (width, height, color depth) - Browser information (user agent, language) - Hardware details (platform, memory) - Canvas fingerprint - WebGL information - Audio capabilities - Font detection - Browser features - Returns: Promise - Example Response:

{
   "screen": {
   "width": 1920,
   "height": 1080,
   "colorDepth": 24
   },
   "browser": {
   "userAgent": "Mozilla/5.0...",
   "language": "en-US"
   },
   "timezone": {
   "offset": -120,
   "timezone": "America/New_York"
   }
}

onDeviceIdChange(callback)

Subscribe to device ID changes. - Parameters: callback(deviceId: string) - Returns: Function (unsubscribe) - Usage:

const unsubscribe = fp.onDeviceIdChange((deviceId) => {
   console.log('New device ID:', deviceId);
});

configure(options)

Update SDK configuration. - Parameters: options object - Available options: - endpoint: API endpoint URL - autoRefresh: boolean - refreshInterval: number (milliseconds) - debug: boolean

destroy()

Cleanup SDK resources and stop auto-refresh.

Error Handling

try {
    const deviceId = await fp.generateDeviceId();
} catch (error) {
    if (error.message === 'API key is required') {
        console.error('Please provide a valid API key');
    } else {
        console.error('Failed to generate device ID:', error);
    }
}

Best Practices

  1. API Key Security
  2. Never expose your API key in client-side code
  3. Use environment variables and server-side proxies when possible
  4. Rotate API keys periodically

  5. Error Handling

  6. Always implement proper error handling for SDK method calls
  7. Log errors appropriately for debugging
  8. Provide user-friendly error messages in production

  9. Resource Management

  10. Call destroy() when you're done using the SDK
  11. Clean up event listeners and callbacks
  12. Monitor memory usage when handling large amounts of data

  13. Performance Optimization

  14. Choose appropriate refresh intervals based on your use case
  15. Cache device parameters when appropriate
  16. Implement rate limiting for API calls

  17. Security Considerations

  18. Use HTTPS endpoints only
  19. Validate all server responses
  20. Implement proper access controls
  21. Monitor for suspicious patterns

Troubleshooting

Common Issues and Solutions

  1. API Key Invalid
  2. Verify your API key is correct
  3. Check if the API key has necessary permissions
  4. Ensure the key hasn't expired

  5. Network Errors

  6. Check your internet connection
  7. Verify the endpoint URL is correct
  8. Check for CORS issues
  9. Ensure your firewall isn't blocking requests

  10. Parameter Collection Fails

  11. Check browser permissions
  12. Verify required APIs are available
  13. Enable debug mode for detailed logging