Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: initial 0.5.0 support #87

Merged
merged 11 commits into from
Mar 19, 2024
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
8 changes: 0 additions & 8 deletions .github/workflows/continuous-integration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,6 @@ on:
branches:
- main

# Cancel multiple runs for the same PR or branch
TimoGlastra marked this conversation as resolved.
Show resolved Hide resolved
concurrency:
group: aries-framework-${{ github.ref }}-${{ github.repository }}-${{ github.event_name }}
cancel-in-progress: true

jobs:
validate:
runs-on: ubuntu-22.04
Expand Down Expand Up @@ -41,6 +36,3 @@ jobs:

- name: Check Types
run: yarn check-types

- name: Unit Tests
run: yarn test:unit

This file was deleted.

1 change: 1 addition & 0 deletions apps/expo/app.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ const config = {
updates: {
fallbackToCacheTimeout: 0,
},
plugins: ['expo-font', 'expo-secure-store'],
assetBundlePatterns: ['**/*'],
ios: {
supportsTablet: false,
Expand Down
4 changes: 3 additions & 1 deletion apps/expo/app/_layout.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// eslint-disable-next-line import/order
import type { AppAgent } from '@internal/agent'

import {
Expand All @@ -15,7 +16,8 @@ import { Provider } from 'app/provider'
import { NoInternetToastProvider } from 'app/provider/NoInternetToastProvider'
import { isAndroid } from 'app/utils/platform'
import { useFonts } from 'expo-font'
import { SplashScreen, Stack } from 'expo-router'
import { Stack } from 'expo-router'
import * as SplashScreen from 'expo-splash-screen'
import { useEffect, useState } from 'react'
import { useSafeAreaInsets } from 'react-native-safe-area-context'

Expand Down
1 change: 1 addition & 0 deletions apps/expo/app/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export default function Screen() {
<Stack.Screen
options={{
headerShown: true,
title: 'Home',
header: () => {
return <XStack h={top} bg="$grey-200" />
},
Expand Down
21 changes: 5 additions & 16 deletions apps/expo/babel.config.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
/* eslint-disable */

module.exports = function (api) {
api.cache(true)
api.cache(false)
return {
presets: [['babel-preset-expo', { jsxRuntime: 'automatic' }]],
plugins: [
require.resolve('expo-router/babel'),
[
require.resolve('babel-plugin-module-resolver'),
{
Expand All @@ -16,28 +15,18 @@ module.exports = function (api) {
'@internal/ui': '../../packages/ui',
'@internal/agent': '../../packages/agent',
'@internal/utils': '../../packages/utils',
'@internal/openid4vc-client': '../../packages/openid4vc-client',
},
extensions: ['.js', '.jsx', '.tsx', '.ios.js', '.android.js'],
},
],
// if you want reanimated support
// 'react-native-reanimated/plugin',
...(process.env.EAS_BUILD_PLATFORM === 'android'
? []
: [
[
'@tamagui/babel-plugin',
{
components: ['@internal/ui', 'tamagui'],
config: './tamagui.config.ts',
},
],
]),
[
'transform-inline-environment-variables',
'@tamagui/babel-plugin',
{
include: 'TAMAGUI_TARGET',
components: ['@internal/ui', 'tamagui'],
config: './tamagui.config.ts',
disableExtraction: process.env.NODE_ENV === 'development',
},
],
],
Expand Down
5 changes: 0 additions & 5 deletions apps/expo/eas.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,12 @@
"image": "latest"
},
"env": {
"TAMAGUI_TARGET": "native",
"APP_VARIANT": "development"
}
},
"preview": {
"distribution": "internal",
"env": {
"TAMAGUI_TARGET": "native",
"APP_VARIANT": "preview"
}
},
Expand All @@ -27,9 +25,6 @@
"distribution": "store",
"android": {
"buildType": "app-bundle"
},
"env": {
"TAMAGUI_TARGET": "native"
}
}
},
Expand Down
7 changes: 0 additions & 7 deletions apps/expo/index.js

This file was deleted.

7 changes: 2 additions & 5 deletions apps/expo/metro.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const { getDefaultConfig } = require('@expo/metro-config')
const path = require('path')

const projectRoot = __dirname
const workspaceRoot = path.resolve(__dirname, '../..')
const workspaceRoot = path.resolve(projectRoot, '../..')

const config = getDefaultConfig(projectRoot)

Expand All @@ -16,9 +16,6 @@ config.resolver.nodeModulesPaths = [
path.resolve(projectRoot, 'node_modules'),
path.resolve(workspaceRoot, 'node_modules'),
]
config.resolver.sourceExts = ['js', 'json', 'ts', 'tsx', 'cjs']

config.transformer = { ...config.transformer, unstable_allowRequireContext: true }
config.transformer.minifierPath = require.resolve('metro-minify-terser')
config.resolver.sourceExts = ['js', 'json', 'ts', 'tsx', 'cjs', 'mjs']

module.exports = config
71 changes: 34 additions & 37 deletions apps/expo/package.json
Original file line number Diff line number Diff line change
@@ -1,60 +1,57 @@
{
"name": "expo-app",
"version": "1.1.6",
"main": "index.js",
"version": "1.2.0",
"main": "expo-router/entry",
"private": true,
"scripts": {
"start": "TAMAGUI_TARGET=native APP_VARIANT=development expo start -c --dev-client",
"android": "TAMAGUI_TARGET=native APP_VARIANT=development yarn expo run:android",
"ios": "TAMAGUI_TARGET=native APP_VARIANT=development yarn expo run:ios",
"prebuild": "TAMAGUI_TARGET=native APP_VARIANT=development expo prebuild --no-install"
"start": "APP_VARIANT=development expo start -c --dev-client",
"android": "APP_VARIANT=development yarn expo run:android",
"ios": "APP_VARIANT=development yarn expo run:ios",
"prebuild": "APP_VARIANT=development expo prebuild --no-install"
},
"dependencies": {
"@babel/runtime": "^7.18.9",
"@hyperledger/anoncreds-react-native": "^0.1.0",
"@hyperledger/aries-askar-react-native": "0.1.0",
"@hyperledger/indy-vdr-react-native": "^0.1.0",
"@hyperledger/anoncreds-react-native": "^0.2.1",
"@hyperledger/aries-askar-react-native": "^0.2.0",
"@hyperledger/indy-vdr-react-native": "^0.2.0",
"@internal/agent": "*",
"@internal/ui": "*",
"@react-native-community/blur": "^4.3.2",
"@react-native-community/netinfo": "^9.3.10",
"@react-native-masked-view/masked-view": "^0.2.9",
"@react-native-community/netinfo": "11.1.0",
"@react-native-masked-view/masked-view": "0.3.0",
"@react-navigation/native": "^6.1.6",
"app": "*",
"babel-plugin-module-resolver": "^4.1.0",
"burnt": "^0.12.1",
"expo": "^49.0.0",
"expo-barcode-scanner": "~12.5.3",
"expo-constants": "~14.4.2",
"expo-dev-client": "~2.4.11",
"expo-font": "~11.4.0",
"expo-haptics": "~12.4.0",
"expo-image": "~1.3.3",
"expo-linear-gradient": "~12.3.0",
"expo-linking": "~5.0.2",
"expo-navigation-bar": "~2.3.0",
"expo-router": "^2.0.0",
"expo-secure-store": "~12.3.1",
"expo-splash-screen": "~0.20.5",
"expo-status-bar": "~1.6.0",
"expo-system-ui": "~2.4.0",
"expo-updates": "~0.18.13",
"expo": "^50.0.0",
"expo-barcode-scanner": "~12.9.3",
"expo-constants": "~15.4.5",
"expo-dev-client": "~3.3.10",
"expo-font": "~11.10.3",
"expo-haptics": "~12.8.1",
"expo-image": "~1.10.6",
"expo-linear-gradient": "~12.7.2",
"expo-linking": "~6.2.2",
"expo-navigation-bar": "~2.8.1",
"expo-router": "~3.4.8",
"expo-secure-store": "~12.8.1",
"expo-splash-screen": "~0.26.4",
"expo-status-bar": "~1.11.1",
"expo-system-ui": "~2.9.3",
"expo-updates": "~0.24.12",
"react": "18.2.0",
"react-dom": "^18.2.0",
"react-native": "0.72.5",
"react-native": "0.73.5",
"react-native-fs": "^2.20.0",
"react-native-gesture-handler": "~2.12.0",
"react-native-get-random-values": "~1.9.0",
"react-native-safe-area-context": "4.6.3",
"react-native-screens": "~3.22.0",
"react-native-svg": "13.9.0"
"react-native-gesture-handler": "~2.14.0",
"react-native-get-random-values": "~1.8.0",
"react-native-safe-area-context": "4.8.2",
"react-native-screens": "~3.29.0",
"react-native-svg": "14.1.0"
},
"devDependencies": {
"@babel/core": "^7.17.9",
"@expo/metro-config": "~0.10.0",
"@tamagui/babel-plugin": "latest",
"babel-plugin-transform-inline-environment-variables": "^0.4.4",
"metro-minify-terser": "^0.74.1",
"@tamagui/babel-plugin": "1.91.4",
"typescript": "^4.7.4"
}
}
27 changes: 19 additions & 8 deletions apps/expo/utils/walletKeyStore.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,32 @@
import { uuid } from '@aries-framework/core/build/utils/uuid'
import { ariesAskar } from '@hyperledger/aries-askar-react-native'
import * as SecureStore from 'expo-secure-store'

const STORE_KEY = 'wallet-key' as const
const STORE_KEY_LEGACY = 'wallet-key' as const
const STORE_KEY_RAW = 'paradym-wallet-key-raw' as const

const generateNewWalletKey = (): string => {
return uuid()
const generateNewWalletKey = (): { walletKey: string; keyDerivation: 'raw' } => {
return { walletKey: ariesAskar.storeGenerateRawKey({}), keyDerivation: 'raw' }
}

export const getSecureWalletKey = async (): Promise<string> => {
export const getSecureWalletKey = async (): Promise<{
walletKey: string
keyDerivation: 'raw' | 'derive'
}> => {
const secureStoreAvailable = await SecureStore.isAvailableAsync()
if (!secureStoreAvailable) throw new Error('SecureStore is not available on this device.')

const walletKey = await SecureStore.getItemAsync(STORE_KEY)
if (walletKey) return walletKey
// New method: raw wallet key
let walletKey = await SecureStore.getItemAsync(STORE_KEY_RAW)
if (walletKey) return { walletKey, keyDerivation: 'raw' }

// TODO: rotate the old wallet key to a new raw key
// Old method: derived wallet key
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you checked the TODOs? Is this for now or later?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a new todo for later. I discovered we are using uuids as the wallet key, while it's more secure and faster to generate a RAW wallet key if we're storing them in the secure enclave anyway.

However migrating old wallets to this new method is more work, so I stopped on it as I was getting distracted with the main purpose of this PR.
Should be a ticket though

walletKey = await SecureStore.getItemAsync(STORE_KEY_LEGACY)
if (walletKey) return { walletKey, keyDerivation: 'derive' }

// No wallet key found, generate new method: raw wallet key
const newWalletKey = generateNewWalletKey()
await SecureStore.setItemAsync(STORE_KEY, newWalletKey)
await SecureStore.setItemAsync(STORE_KEY_RAW, newWalletKey.keyDerivation)

return newWalletKey
}
Empty file added noop/index.js
Empty file.
5 changes: 1 addition & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,14 @@
"resolutions": {
"@unimodules/react-native-adapter": "./noop",
"@unimodules/core": "./noop",
"ref-napi": "npm:@2060.io/[email protected]",
"@cosmjs/amino": "npm:@cosmjs-rn/amino@^0.27.1",
"@cosmjs/encoding": "npm:@cosmjs-rn/encoding@^0.27.1",
"@cosmjs/math": "npm:@cosmjs-rn/math@^0.27.1",
"@cosmjs/stargate": "npm:@cosmjs-rn/stargate@^0.27.1",
"@cosmjs/tendermint-rpc": "npm:@cosmjs-rn/tendermint-rpc@^0.27.1",
"@cosmjs/utils": "npm:@cosmjs-rn/utils@^0.27.1",
"@cosmjs/proto-signing": "npm:@cosmjs-rn/proto-signing@^0.27.1",
"@cosmjs/crypto": "npm:@cosmjs-rn/crypto@^0.27.1",
"@sphereon/[email protected]": "patch:@sphereon/did-auth-siop@npm%3A0.3.2-unstable.0#./.yarn/patches/@sphereon-did-auth-siop-npm-0.3.2-unstable.0-6a34120d09.patch"
"@cosmjs/crypto": "npm:@cosmjs-rn/crypto@^0.27.1"
},
"dependencies": {
"@babel/runtime": "^7.18.9",
Expand All @@ -54,7 +52,6 @@
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-react": "^7.32.2",
"expo-linking": "~5.0.2",
"node-gyp": "^9.3.1",
"prettier": "^2.7.1",
"turbo": "^1.8.3",
Expand Down
29 changes: 12 additions & 17 deletions packages/agent/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,23 @@
"private": true,
"main": "src/index.ts",
"dependencies": {
"@aries-framework/anoncreds": "0.4.2",
"@aries-framework/anoncreds-rs": "0.4.2",
"@aries-framework/askar": "0.4.2",
"@aries-framework/cheqd": "0.4.2",
"@aries-framework/core": "0.4.2",
"@aries-framework/indy-vdr": "0.4.2",
"@aries-framework/react-hooks": "0.4.2",
"@aries-framework/react-native": "0.4.2",
"@internal/openid4vc-client": "*",
"@credo-ts/anoncreds": "0.5.1-alpha.0",
TimoGlastra marked this conversation as resolved.
Show resolved Hide resolved
"@credo-ts/askar": "0.5.1-alpha.0",
"@credo-ts/cheqd": "0.5.1-alpha.0",
"@credo-ts/core": "0.5.1-alpha.0",
"@credo-ts/indy-vdr": "0.5.1-alpha.0",
"@credo-ts/openid4vc": "0.5.1-alpha.0",
"@credo-ts/question-answer": "0.5.1-alpha.0",
"@credo-ts/react-hooks": "^0.6.1",
"@credo-ts/react-native": "0.5.1-alpha.0",
"@internal/utils": "*",
"@tanstack/react-query": "^4.33.0",
"query-string": "^8.1.0",
"rxjs": "^7.8.1"
},
"peerDependencies": {
"@hyperledger/anoncreds-react-native": "^0.1.0",
"@hyperledger/aries-askar-react-native": "0.1.0",
"@hyperledger/indy-vdr-react-native": "^0.1.0"
},
"devDependencies": {
"@hyperledger/anoncreds-react-native": "^0.1.0",
"@hyperledger/aries-askar-react-native": "0.1.0",
"@hyperledger/indy-vdr-react-native": "^0.1.0"
"@hyperledger/anoncreds-react-native": "*",
"@hyperledger/aries-askar-react-native": "*",
"@hyperledger/indy-vdr-react-native": "*"
}
}
Loading
Loading