Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/animo/expo-secure-environment
https://github.com/animo/expo-secure-environment
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/animo/expo-secure-environment
- Owner: animo
- License: apache-2.0
- Created: 2024-07-25T10:45:30.000Z (4 months ago)
- Default Branch: main
- Last Pushed: 2024-08-25T11:12:57.000Z (3 months ago)
- Last Synced: 2024-10-01T16:54:45.023Z (about 2 months ago)
- Language: Kotlin
- Size: 1.67 MB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# expo-secure-environment
Cryptographic operations using the devices Secure Environment (HSM,SE,etc.) locked behind biometric authentication
Currently Android API 30+ is supported and the minimum supported version of iOS for Expo.
## Supported cryptographic algorithms
**key algorithm**: Secp256r1
**signature algorithm**: ECDSA with SHA256
## Create a key pair
```typescript
import { generateKeypair } from "@animo-id/expo-secure-environment";const myId = "keypair-id";
// Make sure it is backed by biometrics
generateKeypair(myId, true);
```## Get the public bytes by the id
Returns the compressed form of a P-256 public key (and not the DER-encoded SubjectPublicKeyInfo)
```typescript
import {
generateKeypair,
getPublicBytesForKeyId,
} from "@animo-id/expo-secure-environment";const myId = "keypair-id";
// Make sure it is backed by biometrics
generateKeypair(myId, true);const publicBytes: Uint8Array = getPublicBytesForKeyId(myId);
```## Sign data
Returns the raw signature (and not a DER-Encoded ECDA-Sig-Value)
```typescript
import {
generateKeypair,
sign
} from "@animo-id/expo-secure-environment";const myId = "keypair-id";
// Make sure it is backed by biometrics
generateKeypair(myId, true);// Make sure that when we sign we pass the third argument as true to indicate we would like to use biometrics
const signature = sign(myId, new Uint8Array(10).fill(7), true);
```