- Created .gitignore to exclude sensitive files and directories. - Added API documentation in API_DOCUMENTATION.md. - Included deployment instructions in DEPLOYMENT.md. - Established project structure documentation in PROJECT_STRUCTURE.md. - Updated README.md with project status and team information. - Added recommendations and status tracking documents. - Introduced testing guidelines in TESTING.md. - Set up CI workflow in .github/workflows/ci.yml. - Created Dockerfile for backend and frontend setups. - Added various service and utility files for backend functionality. - Implemented frontend components and pages for user interface. - Included mobile app structure and services. - Established scripts for deployment across multiple chains.
36 lines
949 B
TypeScript
36 lines
949 B
TypeScript
import ReactNativeBiometrics from 'react-native-biometrics';
|
|
|
|
export class BiometricService {
|
|
private static rnBiometrics = new ReactNativeBiometrics();
|
|
|
|
static async isAvailable(): Promise<boolean> {
|
|
try {
|
|
const { available } = await this.rnBiometrics.isSensorAvailable();
|
|
return available;
|
|
} catch (error) {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
static async authenticate(reason: string = 'Authenticate to access ASLE'): Promise<boolean> {
|
|
try {
|
|
const { success } = await this.rnBiometrics.simplePrompt({
|
|
promptMessage: reason,
|
|
});
|
|
return success;
|
|
} catch (error) {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
static async createKeys(): Promise<{ publicKey: string; privateKey: string } | null> {
|
|
try {
|
|
const { publicKey } = await this.rnBiometrics.createKeys();
|
|
return { publicKey, privateKey: '' }; // Private key is stored securely
|
|
} catch (error) {
|
|
return null;
|
|
}
|
|
}
|
|
}
|
|
|