Skip to content
Merged
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
34 changes: 0 additions & 34 deletions .eslintrc.json

This file was deleted.

41 changes: 35 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ npm install native-keychain
import * as keychain from 'native-keychain';

keychain.setPassword({
service: 'my-service',
account: 'my-account',
password: 'my-password'
service: 'my-service',
account: 'my-account',
password: 'my-password'
});

const secret = await keychain.getPassword({
service: 'my-service',
account: 'my-account',
requireBiometrics: true
service: 'my-service',
account: 'my-account',
requireBiometrics: true
}); // 'my-password'
```

Expand All @@ -44,6 +44,35 @@ const secret = await keychain.getPassword({
| `isBiometricsSupported` | Check if biometrics is supported. | `boolean` |
| `requestBiometricsVerification` | Request biometrics verification. | `Promise<boolean>` |

## Development

### Running Tests

```bash
npm run test
```

**Note:** The tests require user interaction for biometric authentication. When prompted, please authenticate using Touch ID, Face ID, or your system password to complete the biometric verification tests.

The test suite includes:

- Biometric support verification
- Password storage and retrieval with accounts
- Biometric-protected password operations
- Cleanup and error handling

### Building

```bash
npm run build
```

### Linting

```bash
npm run lint
```

## Maintainer

| [![twitter/mikescops](https://avatars0.githubusercontent.com/u/4266283?s=100&v=4)](https://pixelswap.fr 'Personal Website') |
Expand Down
65 changes: 65 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
import { FlatCompat } from '@eslint/eslintrc';
import js from '@eslint/js';
import typescriptEslint from '@typescript-eslint/eslint-plugin';
import tsParser from '@typescript-eslint/parser';
import prettier from 'eslint-plugin-prettier';
import path from 'node:path';
import { fileURLToPath } from 'node:url';

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all,
});

export default [
{
ignores: ['dist/**/*', 'node_modules/**/*', '.build/**/*'],
},
...compat.extends(
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:@typescript-eslint/recommended-requiring-type-checking',
'prettier',
'plugin:prettier/recommended'
),
{
plugins: {
'@typescript-eslint': typescriptEslint,
prettier,
},

languageOptions: {
parser: tsParser,
ecmaVersion: 2018,
sourceType: 'module',

parserOptions: {
project: 'tsconfig.json',
},
},

settings: {
node: true,
},

rules: {
'require-await': 'error',
'no-return-await': 'error',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-empty-interface': 'off',

'@typescript-eslint/no-unused-vars': [
'error',
{
varsIgnorePattern: '[iI]gnored',
argsIgnorePattern: '^_',
},
],

'object-shorthand': ['error', 'always'],
},
},
];
Loading