-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Timo Glastra <[email protected]>
- Loading branch information
1 parent
6e2bc33
commit a787653
Showing
17 changed files
with
258 additions
and
144 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ | |
}, | ||
"npm": { | ||
"skipChecks": true, | ||
"ignoreVersion": true, | ||
"tag": "latest" | ||
}, | ||
"git": { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
{ | ||
"$schema": "https://biomejs.dev/schemas/1.8.1/schema.json", | ||
"formatter": { | ||
"lineWidth": 120, | ||
"indentStyle": "space" | ||
}, | ||
"javascript": { | ||
"parser": { | ||
"unsafeParameterDecoratorsEnabled": true | ||
}, | ||
"formatter": { | ||
"semicolons": "asNeeded", | ||
"quoteStyle": "single", | ||
"trailingCommas": "es5", | ||
"lineWidth": 120, | ||
"indentStyle": "space" | ||
} | ||
}, | ||
"json": { | ||
"parser": { | ||
"allowComments": true | ||
} | ||
}, | ||
"organizeImports": { | ||
"enabled": true | ||
}, | ||
"linter": { | ||
"enabled": true | ||
}, | ||
"vcs": { | ||
"useIgnoreFile": true, | ||
"clientKind": "git", | ||
"enabled": true | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,74 +1,70 @@ | ||
import { | ||
ariesAskar, | ||
KeyAlgs, | ||
LocalKeyHandle, | ||
} from "@hyperledger/aries-askar-react-native"; | ||
import { | ||
sign, | ||
generateKeypair, | ||
getPublicBytesForKeyId, | ||
} from "expo-secure-environment"; | ||
import { Button } from "react-native"; | ||
import { StyleSheet, View } from "react-native"; | ||
import { generateKeypair, getPublicBytesForKeyId, sign } from '@animo-id/expo-secure-environment' | ||
import { KeyAlgs, LocalKeyHandle, ariesAskar } from '@hyperledger/aries-askar-react-native' | ||
import { Button } from 'react-native' | ||
import { StyleSheet, View } from 'react-native' | ||
|
||
export default function App() { | ||
const testBiometrics = async () => { | ||
try{ | ||
const id = new Date().toString(); | ||
generateKeypair(id, true); | ||
const publicKey = getPublicBytesForKeyId(id); | ||
const key = ariesAskar.keyFromPublicBytes({ | ||
algorithm: KeyAlgs.EcSecp256r1, | ||
publicKey, | ||
}); | ||
const kHandle = new LocalKeyHandle(key.handle); | ||
const message = new Uint8Array(10).fill(10); | ||
const signature = await sign(id, new Uint8Array(message), true); | ||
const isValid = ariesAskar.keyVerifySignature({ | ||
message, | ||
signature, | ||
localKeyHandle: kHandle, | ||
}); | ||
try { | ||
const id = new Date().toString() | ||
generateKeypair(id, true) | ||
const publicKey = getPublicBytesForKeyId(id) | ||
const key = ariesAskar.keyFromPublicBytes({ | ||
algorithm: KeyAlgs.EcSecp256r1, | ||
publicKey, | ||
}) | ||
const kHandle = new LocalKeyHandle(key.handle) | ||
const message = new Uint8Array(10).fill(10) | ||
const signature = await sign(id, new Uint8Array(message), true) | ||
const isValid = ariesAskar.keyVerifySignature({ | ||
message, | ||
signature, | ||
localKeyHandle: kHandle, | ||
}) | ||
|
||
console.log(isValid); | ||
}catch(e) { | ||
console.error('ERRRRRR', e) | ||
console.log('Signing with biometrics enabled isValid: ', isValid) | ||
} catch (e) { | ||
console.error('Error signing with biometrics enabled', e) | ||
} | ||
}; | ||
} | ||
|
||
const testNoBiometrics = async () => { | ||
const id = new Date().toString(); | ||
generateKeypair(id, false); | ||
const publicKey = getPublicBytesForKeyId(id); | ||
const key = ariesAskar.keyFromPublicBytes({ | ||
algorithm: KeyAlgs.EcSecp256r1, | ||
publicKey, | ||
}); | ||
const kHandle = new LocalKeyHandle(key.handle); | ||
const message = new Uint8Array(10).fill(10); | ||
const signature = await sign(id, new Uint8Array(message), false); | ||
const isValid = ariesAskar.keyVerifySignature({ | ||
message, | ||
signature, | ||
localKeyHandle: kHandle, | ||
}); | ||
try { | ||
const id = new Date().toString() | ||
generateKeypair(id, false) | ||
const publicKey = getPublicBytesForKeyId(id) | ||
const key = ariesAskar.keyFromPublicBytes({ | ||
algorithm: KeyAlgs.EcSecp256r1, | ||
publicKey, | ||
}) | ||
const kHandle = new LocalKeyHandle(key.handle) | ||
const message = new Uint8Array(10).fill(10) | ||
const signature = await sign(id, new Uint8Array(message), false) | ||
const isValid = ariesAskar.keyVerifySignature({ | ||
message, | ||
signature, | ||
localKeyHandle: kHandle, | ||
}) | ||
|
||
console.log(isValid); | ||
}; | ||
console.log('Signing with biometrics disabled isValid: ', isValid) | ||
} catch (e) { | ||
console.error('Error signing with biometrics disabled', e) | ||
} | ||
} | ||
|
||
return ( | ||
<View style={styles.container}> | ||
<Button title="test biometrics" onPress={testBiometrics} /> | ||
<Button title="test without biometrics" onPress={testNoBiometrics} /> | ||
</View> | ||
); | ||
) | ||
} | ||
|
||
const styles = StyleSheet.create({ | ||
container: { | ||
flex: 1, | ||
backgroundColor: "#fff", | ||
alignItems: "center", | ||
justifyContent: "center", | ||
backgroundColor: '#fff', | ||
alignItems: 'center', | ||
justifyContent: 'center', | ||
}, | ||
}); | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
module.exports = function (api) { | ||
api.cache(true); | ||
module.exports = (api) => { | ||
api.cache(true) | ||
return { | ||
presets: ['babel-preset-expo'], | ||
}; | ||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
import { registerRootComponent } from "expo"; | ||
import { registerRootComponent } from 'expo' | ||
|
||
import App from "./App"; | ||
import App from './App' | ||
|
||
registerRootComponent(App); | ||
registerRootComponent(App) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.