diff --git a/.eslintrc.js b/.eslintrc.js
deleted file mode 100644
index 45cf2c1..0000000
--- a/.eslintrc.js
+++ /dev/null
@@ -1,5 +0,0 @@
-module.exports = {
- root: true,
- extends: ['universe/native', 'universe/web'],
- ignorePatterns: ['build'],
-};
diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml
index 5e6a32b..80e1549 100644
--- a/.github/workflows/ci.yaml
+++ b/.github/workflows/ci.yaml
@@ -35,9 +35,15 @@ jobs:
- name: Install dependencies
run: pnpm install
+ - name: Style
+ run: pnpm style:check
+
- name: Build
run: pnpm build
+ - name: Check types
+ run: pnpm types:check
+
continuous-deployment:
if: github.event_name == 'workflow_dispatch'
diff --git a/.release-it.json b/.release-it.json
index da9bcc6..de3f599 100644
--- a/.release-it.json
+++ b/.release-it.json
@@ -4,6 +4,7 @@
},
"npm": {
"skipChecks": true,
+ "ignoreVersion": true,
"tag": "latest"
},
"git": {
diff --git a/biome.json b/biome.json
new file mode 100644
index 0000000..27e72e9
--- /dev/null
+++ b/biome.json
@@ -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
+ }
+}
diff --git a/example/App.tsx b/example/App.tsx
index 5fca13c..d241eee 100644
--- a/example/App.tsx
+++ b/example/App.tsx
@@ -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 (
- );
+ )
}
const styles = StyleSheet.create({
container: {
flex: 1,
- backgroundColor: "#fff",
- alignItems: "center",
- justifyContent: "center",
+ backgroundColor: '#fff',
+ alignItems: 'center',
+ justifyContent: 'center',
},
-});
+})
diff --git a/example/app.json b/example/app.json
index 3e884f8..59c7d7a 100644
--- a/example/app.json
+++ b/example/app.json
@@ -13,7 +13,10 @@
},
"ios": {
"supportsTablet": true,
- "bundleIdentifier": "id.animo.secure.environment.example"
+ "bundleIdentifier": "id.animo.secure.environment.example",
+ "infoPlist": {
+ "NSFaceIDUsageDescription": "FaceID is used to securely sign data"
+ }
},
"android": {
"adaptiveIcon": {
diff --git a/example/babel.config.js b/example/babel.config.js
index 9d89e13..9f057ea 100644
--- a/example/babel.config.js
+++ b/example/babel.config.js
@@ -1,6 +1,6 @@
-module.exports = function (api) {
- api.cache(true);
+module.exports = (api) => {
+ api.cache(true)
return {
presets: ['babel-preset-expo'],
- };
-};
+ }
+}
diff --git a/example/index.js b/example/index.js
index e5802d2..9f60ac4 100644
--- a/example/index.js
+++ b/example/index.js
@@ -1,5 +1,5 @@
-import { registerRootComponent } from "expo";
+import { registerRootComponent } from 'expo'
-import App from "./App";
+import App from './App'
-registerRootComponent(App);
+registerRootComponent(App)
diff --git a/example/metro.config.js b/example/metro.config.js
index 0b2f15f..1e35e87 100644
--- a/example/metro.config.js
+++ b/example/metro.config.js
@@ -1,8 +1,8 @@
// Learn more https://docs.expo.io/guides/customizing-metro
-const { getDefaultConfig } = require('expo/metro-config');
-const path = require('path');
+const { getDefaultConfig } = require('expo/metro-config')
+const path = require('node:path')
-const config = getDefaultConfig(__dirname);
+const config = getDefaultConfig(__dirname)
// npm v7+ will install ../node_modules/react and ../node_modules/react-native because of peerDependencies.
// To prevent the incompatible react-native between ./node_modules/react-native and ../node_modules/react-native,
@@ -11,24 +11,24 @@ config.resolver.blockList = [
...Array.from(config.resolver.blockList ?? []),
new RegExp(path.resolve('..', 'node_modules', 'react')),
new RegExp(path.resolve('..', 'node_modules', 'react-native')),
-];
+]
config.resolver.nodeModulesPaths = [
path.resolve(__dirname, './node_modules'),
path.resolve(__dirname, '../node_modules'),
-];
+]
config.resolver.extraNodeModules = {
- 'expo-secure-environment': '..',
-};
+ '@animo-id/expo-secure-environment': '..',
+}
-config.watchFolders = [path.resolve(__dirname, '..')];
+config.watchFolders = [path.resolve(__dirname, '..')]
config.transformer.getTransformOptions = async () => ({
transform: {
experimentalImportSupport: false,
inlineRequires: true,
},
-});
+})
-module.exports = config;
+module.exports = config
diff --git a/example/package.json b/example/package.json
index c1b242b..0181526 100644
--- a/example/package.json
+++ b/example/package.json
@@ -6,18 +6,16 @@
"start": "expo start",
"android": "expo run:android",
"ios": "expo run:ios",
- "web": "expo start --web"
+ "prebuild": "expo prebuild --no-install"
},
"dependencies": {
"@babel/runtime": "^7.24.8",
"@hyperledger/aries-askar-react-native": "^0.2.3",
- "@react-native/assets-registry": "^0.74.85",
"expo": "~51.0.22",
"react": "18.2.0",
"react-native": "0.74.3"
},
"devDependencies": {
- "@babel/core": "^7.20.0",
"@types/react": "~18.2.45",
"typescript": "^5.1.3"
},
diff --git a/example/pnpm-lock.yaml b/example/pnpm-lock.yaml
index 9071c50..3b63ec0 100644
--- a/example/pnpm-lock.yaml
+++ b/example/pnpm-lock.yaml
@@ -14,9 +14,6 @@ importers:
'@hyperledger/aries-askar-react-native':
specifier: ^0.2.3
version: 0.2.3(react-native@0.74.3(@babel/core@7.24.9)(@babel/preset-env@7.24.8(@babel/core@7.24.9))(@types/react@18.2.79)(react@18.2.0))(react@18.2.0)
- '@react-native/assets-registry':
- specifier: ^0.74.85
- version: 0.74.85
expo:
specifier: ~51.0.22
version: 51.0.22(@babel/core@7.24.9)(@babel/preset-env@7.24.8(@babel/core@7.24.9))
@@ -27,9 +24,6 @@ importers:
specifier: 0.74.3
version: 0.74.3(@babel/core@7.24.9)(@babel/preset-env@7.24.8(@babel/core@7.24.9))(@types/react@18.2.79)(react@18.2.0)
devDependencies:
- '@babel/core':
- specifier: ^7.20.0
- version: 7.24.9
'@types/react':
specifier: ~18.2.45
version: 18.2.79
diff --git a/example/tsconfig.json b/example/tsconfig.json
index e7ad035..55f7e88 100644
--- a/example/tsconfig.json
+++ b/example/tsconfig.json
@@ -3,8 +3,7 @@
"compilerOptions": {
"strict": true,
"paths": {
- "expo-secure-environment": ["../src/index"],
- "expo-secure-environment/*": ["../src/*"]
+ "@animo-id/expo-secure-environment": ["../src/index"]
}
}
}
diff --git a/ios/SecureEnvironment.swift b/ios/SecureEnvironment.swift
index b577504..ed13b27 100644
--- a/ios/SecureEnvironment.swift
+++ b/ios/SecureEnvironment.swift
@@ -15,18 +15,19 @@ struct SecureEnvironment {
kSecAttrApplicationTag as String: Bundle.main.bundleIdentifier.unsafelyUnwrapped,
],
]
-
+
+ var flags: SecAccessControlCreateFlags = [.privateKeyUsage]
if biometricsBacked {
- let accessControl = SecAccessControlCreateWithFlags(
- kCFAllocatorDefault,
- kSecAttrAccessibleWhenUnlockedThisDeviceOnly,
- [.privateKeyUsage, .biometryCurrentSet],
- nil
- )
-
- attributes[kSecAttrAccessControl as String] = accessControl
+ flags.insert(.biometryCurrentSet)
}
+ attributes[kSecAttrAccessControl as String] = SecAccessControlCreateWithFlags(
+ kCFAllocatorDefault,
+ kSecAttrAccessibleWhenUnlockedThisDeviceOnly,
+ flags,
+ nil
+ )
+
var error: Unmanaged?
guard SecKeyCreateRandomKey(attributes as CFDictionary, &error) != nil else {
throw error!.takeRetainedValue() as Error
diff --git a/package.json b/package.json
index a4efab1..ccf191b 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "@animo-id/expo-secure-environment",
- "version": "0.1.0-alpha.3",
+ "version": "0.0.0",
"description": "Expo Secure Environment",
"main": "build/index.js",
"types": "build/index.d.ts",
@@ -9,17 +9,15 @@
},
"scripts": {
"build": "EXPO_NONINTERACTIVE=1 expo-module build",
+ "style:check": "biome check --unsafe",
+ "style:fix": "biome check --write --unsafe",
+ "types:check": "EXPO_NONINTERACTIVE=1 expo-module typecheck",
"expo-module": "expo-module",
"open:ios": "xed example/ios",
"open:android": "open -a \"Android Studio\" example/android",
"release": "release-it"
},
- "keywords": [
- "react-native",
- "expo",
- "expo-secure-environment",
- "ExpoSecureEnvironment"
- ],
+ "keywords": ["react-native", "expo", "expo-secure-environment", "ExpoSecureEnvironment"],
"repository": "https://github.com/animo/expo-secure-environment",
"bugs": {
"url": "https://github.com/animo/expo-secure-environment/issues"
@@ -33,10 +31,12 @@
"@peculiar/asn1-x509": "^2.3.8"
},
"devDependencies": {
+ "@biomejs/biome": "^1.8.3",
"@types/react": "^18.0.25",
"expo-module-scripts": "^3.5.2",
"expo-modules-core": "^1.12.19",
- "release-it": "^17.4.1"
+ "release-it": "^17.4.1",
+ "typescript": "^5.5.4"
},
"peerDependencies": {
"expo": "*",
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 6824083..258ad9c 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -27,6 +27,9 @@ importers:
specifier: '*'
version: 0.74.3(@babel/core@7.24.9)(@babel/preset-env@7.24.8(@babel/core@7.24.9))(@types/react@18.3.3)(react@18.3.1)
devDependencies:
+ '@biomejs/biome':
+ specifier: ^1.8.3
+ version: 1.8.3
'@types/react':
specifier: ^18.0.25
version: 18.3.3
@@ -39,6 +42,9 @@ importers:
release-it:
specifier: ^17.4.1
version: 17.6.0(typescript@5.5.4)
+ typescript:
+ specifier: ^5.5.4
+ version: 5.5.4
packages:
@@ -819,6 +825,59 @@ packages:
'@bcoe/v8-coverage@0.2.3':
resolution: {integrity: sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==}
+ '@biomejs/biome@1.8.3':
+ resolution: {integrity: sha512-/uUV3MV+vyAczO+vKrPdOW0Iaet7UnJMU4bNMinggGJTAnBPjCoLEYcyYtYHNnUNYlv4xZMH6hVIQCAozq8d5w==}
+ engines: {node: '>=14.21.3'}
+ hasBin: true
+
+ '@biomejs/cli-darwin-arm64@1.8.3':
+ resolution: {integrity: sha512-9DYOjclFpKrH/m1Oz75SSExR8VKvNSSsLnVIqdnKexj6NwmiMlKk94Wa1kZEdv6MCOHGHgyyoV57Cw8WzL5n3A==}
+ engines: {node: '>=14.21.3'}
+ cpu: [arm64]
+ os: [darwin]
+
+ '@biomejs/cli-darwin-x64@1.8.3':
+ resolution: {integrity: sha512-UeW44L/AtbmOF7KXLCoM+9PSgPo0IDcyEUfIoOXYeANaNXXf9mLUwV1GeF2OWjyic5zj6CnAJ9uzk2LT3v/wAw==}
+ engines: {node: '>=14.21.3'}
+ cpu: [x64]
+ os: [darwin]
+
+ '@biomejs/cli-linux-arm64-musl@1.8.3':
+ resolution: {integrity: sha512-9yjUfOFN7wrYsXt/T/gEWfvVxKlnh3yBpnScw98IF+oOeCYb5/b/+K7YNqKROV2i1DlMjg9g/EcN9wvj+NkMuQ==}
+ engines: {node: '>=14.21.3'}
+ cpu: [arm64]
+ os: [linux]
+
+ '@biomejs/cli-linux-arm64@1.8.3':
+ resolution: {integrity: sha512-fed2ji8s+I/m8upWpTJGanqiJ0rnlHOK3DdxsyVLZQ8ClY6qLuPc9uehCREBifRJLl/iJyQpHIRufLDeotsPtw==}
+ engines: {node: '>=14.21.3'}
+ cpu: [arm64]
+ os: [linux]
+
+ '@biomejs/cli-linux-x64-musl@1.8.3':
+ resolution: {integrity: sha512-UHrGJX7PrKMKzPGoEsooKC9jXJMa28TUSMjcIlbDnIO4EAavCoVmNQaIuUSH0Ls2mpGMwUIf+aZJv657zfWWjA==}
+ engines: {node: '>=14.21.3'}
+ cpu: [x64]
+ os: [linux]
+
+ '@biomejs/cli-linux-x64@1.8.3':
+ resolution: {integrity: sha512-I8G2QmuE1teISyT8ie1HXsjFRz9L1m5n83U1O6m30Kw+kPMPSKjag6QGUn+sXT8V+XWIZxFFBoTDEDZW2KPDDw==}
+ engines: {node: '>=14.21.3'}
+ cpu: [x64]
+ os: [linux]
+
+ '@biomejs/cli-win32-arm64@1.8.3':
+ resolution: {integrity: sha512-J+Hu9WvrBevfy06eU1Na0lpc7uR9tibm9maHynLIoAjLZpQU3IW+OKHUtyL8p6/3pT2Ju5t5emReeIS2SAxhkQ==}
+ engines: {node: '>=14.21.3'}
+ cpu: [arm64]
+ os: [win32]
+
+ '@biomejs/cli-win32-x64@1.8.3':
+ resolution: {integrity: sha512-/PJ59vA1pnQeKahemaQf4Nyj7IKUvGQSc3Ze1uIGi+Wvr1xF7rGobSrAAG01T/gUDG21vkDsZYM03NAmPiVkqg==}
+ engines: {node: '>=14.21.3'}
+ cpu: [x64]
+ os: [win32]
+
'@eslint-community/eslint-utils@4.4.0':
resolution: {integrity: sha512-1/sA4dwrzBAyeUoQ6oxahHKmrZvsnLCg4RfxW3ZFGGmQkSNQPFNLV9CUEFQP1x9EYXHTo5p6xdhZM1Ne9p/AfA==}
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
@@ -6689,6 +6748,41 @@ snapshots:
'@bcoe/v8-coverage@0.2.3': {}
+ '@biomejs/biome@1.8.3':
+ optionalDependencies:
+ '@biomejs/cli-darwin-arm64': 1.8.3
+ '@biomejs/cli-darwin-x64': 1.8.3
+ '@biomejs/cli-linux-arm64': 1.8.3
+ '@biomejs/cli-linux-arm64-musl': 1.8.3
+ '@biomejs/cli-linux-x64': 1.8.3
+ '@biomejs/cli-linux-x64-musl': 1.8.3
+ '@biomejs/cli-win32-arm64': 1.8.3
+ '@biomejs/cli-win32-x64': 1.8.3
+
+ '@biomejs/cli-darwin-arm64@1.8.3':
+ optional: true
+
+ '@biomejs/cli-darwin-x64@1.8.3':
+ optional: true
+
+ '@biomejs/cli-linux-arm64-musl@1.8.3':
+ optional: true
+
+ '@biomejs/cli-linux-arm64@1.8.3':
+ optional: true
+
+ '@biomejs/cli-linux-x64-musl@1.8.3':
+ optional: true
+
+ '@biomejs/cli-linux-x64@1.8.3':
+ optional: true
+
+ '@biomejs/cli-win32-arm64@1.8.3':
+ optional: true
+
+ '@biomejs/cli-win32-x64@1.8.3':
+ optional: true
+
'@eslint-community/eslint-utils@4.4.0(eslint@8.57.0)':
dependencies:
eslint: 8.57.0
diff --git a/src/ExpoSecureEnvironmentModule.ts b/src/ExpoSecureEnvironmentModule.ts
index d08a0a3..4987687 100644
--- a/src/ExpoSecureEnvironmentModule.ts
+++ b/src/ExpoSecureEnvironmentModule.ts
@@ -1,3 +1,3 @@
-import { requireNativeModule } from "expo-modules-core";
+import { requireNativeModule } from 'expo-modules-core'
-export default requireNativeModule("ExpoSecureEnvironment");
+export default requireNativeModule('ExpoSecureEnvironment')
diff --git a/src/index.ts b/src/index.ts
index cf7ffa6..d903119 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -1,57 +1,49 @@
-import { Platform } from "expo-modules-core";
-import ExpoSecureEnvironmentModule from "./ExpoSecureEnvironmentModule";
-import { AsnParser } from "@peculiar/asn1-schema";
-import { ECDSASigValue } from "@peculiar/asn1-ecc";
-import { SubjectPublicKeyInfo } from "@peculiar/asn1-x509";
-
-export function generateKeypair(id: string, biometricsBacked: boolean = true) {
- ExpoSecureEnvironmentModule.generateKeypair(id, biometricsBacked);
+import { ECDSASigValue } from '@peculiar/asn1-ecc'
+import { AsnParser } from '@peculiar/asn1-schema'
+import { SubjectPublicKeyInfo } from '@peculiar/asn1-x509'
+import { Platform } from 'expo-modules-core'
+import ExpoSecureEnvironmentModule from './ExpoSecureEnvironmentModule'
+
+export function generateKeypair(id: string, biometricsBacked = true) {
+ ExpoSecureEnvironmentModule.generateKeypair(id, biometricsBacked)
}
export function getPublicBytesForKeyId(keyId: string): Uint8Array {
- const publicBytes = ExpoSecureEnvironmentModule.getPublicBytesForKeyId(keyId);
+ const publicBytes = ExpoSecureEnvironmentModule.getPublicBytesForKeyId(keyId)
- if (Platform.OS === "android") {
- let spki = AsnParser.parse(publicBytes, SubjectPublicKeyInfo);
- const uncompressedKey = new Uint8Array(spki.subjectPublicKey);
+ if (Platform.OS === 'android') {
+ const spki = AsnParser.parse(publicBytes, SubjectPublicKeyInfo)
+ const uncompressedKey = new Uint8Array(spki.subjectPublicKey)
if (uncompressedKey.length !== 65 || uncompressedKey[0] !== 0x04) {
- throw new Error("Invalid uncompressed key format");
+ throw new Error('Invalid uncompressed key format')
}
// Extract the X and Y coordinates
- const x = uncompressedKey.slice(1, 33); // bytes 1 to 32 (X coordinate)
- const y = uncompressedKey.slice(33, 65); // bytes 33 to 64 (Y coordinate)
+ const x = uncompressedKey.slice(1, 33) // bytes 1 to 32 (X coordinate)
+ const y = uncompressedKey.slice(33, 65) // bytes 33 to 64 (Y coordinate)
// Determine the parity of the Y coordinate
- const prefix = y[y.length - 1] % 2 === 0 ? 0x02 : 0x03;
+ const prefix = y[y.length - 1] % 2 === 0 ? 0x02 : 0x03
// Return the compressed key (prefix + X coordinate)
- const compressedKey = new Uint8Array(33);
- compressedKey[0] = prefix;
- compressedKey.set(x, 1);
+ const compressedKey = new Uint8Array(33)
+ compressedKey[0] = prefix
+ compressedKey.set(x, 1)
- return compressedKey;
+ return compressedKey
}
- return publicBytes;
+ return publicBytes
}
-export async function sign(
- keyId: string,
- message: Uint8Array,
- biometricsBacked: boolean = true
-): Promise {
+export async function sign(keyId: string, message: Uint8Array, biometricsBacked = true): Promise {
const signature =
- Platform.OS === "ios"
+ Platform.OS === 'ios'
? await ExpoSecureEnvironmentModule.sign(keyId, message)
- : await ExpoSecureEnvironmentModule.sign(
- keyId,
- message,
- biometricsBacked
- );
-
- const { r, s } = AsnParser.parse(signature, ECDSASigValue);
- const newR = new Uint8Array(r.byteLength === 33 ? r.slice(1) : r);
- const newS = new Uint8Array(s.byteLength === 33 ? s.slice(1) : s);
- return new Uint8Array([...newR, ...newS]);
+ : await ExpoSecureEnvironmentModule.sign(keyId, message, biometricsBacked)
+
+ const { r, s } = AsnParser.parse(signature, ECDSASigValue)
+ const newR = new Uint8Array(r.byteLength === 33 ? r.slice(1) : r)
+ const newS = new Uint8Array(s.byteLength === 33 ? s.slice(1) : s)
+ return new Uint8Array([...newR, ...newS])
}