Skip to content

Commit

Permalink
Merge pull request #1296 from jolocom/release/v1.4.1
Browse files Browse the repository at this point in the history
Release/v1.4.1
  • Loading branch information
Exulansis authored May 8, 2019
2 parents 5bca962 + 6898470 commit 37ad630
Show file tree
Hide file tree
Showing 26 changed files with 127 additions and 135 deletions.
4 changes: 2 additions & 2 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,8 @@ android {
applicationId "com.jolocomwallet"
minSdkVersion 16
targetSdkVersion 26
versionCode 14
versionName "1.4.0"
versionCode 15
versionName "1.4.1"
ndk {
abiFilters "armeabi-v7a", "x86"
}
Expand Down
2 changes: 1 addition & 1 deletion ios/smartwallet/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.4.0</string>
<string>1.4.1</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleURLTypes</key>
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "jolocomwallet",
"version": "1.4.0",
"version": "1.4.1",
"private": true,
"devDependencies": {
"@types/enzyme": "^3.1.9",
Expand Down
7 changes: 6 additions & 1 deletion src/NavigatorContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { RootState } from 'src/reducers/'
import { navigationActions, accountActions } from 'src/actions/'
import { BottomActionBar } from './ui/generic/'
import { routeList } from './routeList'
import { LoadingSpinner } from 'src/ui/generic/loadingSpinner'

const {
createReduxBoundAddListener,
Expand All @@ -29,7 +30,9 @@ interface OwnProps {
dispatch: (action: AnyAction) => void
}

interface Props extends ConnectProps, OwnProps {}
interface Props extends ConnectProps, OwnProps {
deepLinkLoading: boolean
}

export class NavigatorContainer extends React.Component<Props> {
private addListener: (
Expand Down Expand Up @@ -102,6 +105,7 @@ export class NavigatorContainer extends React.Component<Props> {
addListener: this.addListener,
})}
/>,
this.props.deepLinkLoading && <LoadingSpinner />,
currentRoute === routeList.Home && (
<BottomActionBar openScanner={this.props.openScanner} />
),
Expand All @@ -111,6 +115,7 @@ export class NavigatorContainer extends React.Component<Props> {

const mapStateToProps = (state: RootState) => ({
navigation: state.navigation,
deepLinkLoading: state.sso.deepLinkLoading,
})

const mapDispatchToProps = (dispatch: Function) => ({
Expand Down
2 changes: 2 additions & 0 deletions src/actions/navigation/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { ssoActions } from 'src/actions/'
import { setDid, toggleLoading } from '../account'
import { BackendMiddleware } from 'src/backendMiddleware'
import { instantiateIdentityWallet } from 'src/lib/util'
import { setDeepLinkLoading } from '../sso'

export const navigate = (options: NavigationNavigateActionPayload) =>
NavigationActions.navigate(options)
Expand Down Expand Up @@ -39,6 +40,7 @@ export const handleDeepLink = (url: string) => async (
routeName === 'payment' ||
routeName === 'authenticate'
) {
dispatch(setDeepLinkLoading(true))
const personas = await backendMiddleware.storageLib.get.persona()

if (!personas.length) {
Expand Down
7 changes: 3 additions & 4 deletions src/actions/registration/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ export const createIdentity = (encodedEntropy: string) => async (
backendMiddleware: BackendMiddleware,
) => {
const {
ethereumLib,
encryptionLib,
keyChainLib,
storageLib,
Expand All @@ -82,13 +81,13 @@ export const createIdentity = (encodedEntropy: string) => async (

dispatch(setLoadingMsg(loading.loadingStages[1]))

const ethAddr = ethereumLib.privKeyToEthAddress(
userVault.getPrivateKey({
await JolocomLib.util.fuelKeyWithEther(
userVault.getPublicKey({
encryptionPass: password,
derivationPath: JolocomLib.KeyTypes.ethereumKey,
}),
)
await ethereumLib.requestEther(ethAddr)

dispatch(setLoadingMsg(loading.loadingStages[2]))
const identityWallet = await registry.create(userVault, password)

Expand Down
4 changes: 3 additions & 1 deletion src/actions/sso/authenticationRequest.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { JSONWebToken } from 'jolocom-lib/js/interactionTokens/JSONWebToken'
import { Dispatch, AnyAction } from 'redux'
import { BackendMiddleware } from 'src/backendMiddleware'
import { navigationActions } from 'src/actions'
import { navigationActions, ssoActions } from 'src/actions'
import { showErrorScreen } from 'src/actions/generic'
import { Authentication } from 'jolocom-lib/js/interactionTokens/authentication'
import { StateAuthenticationRequestSummary } from 'src/reducers/sso'
Expand Down Expand Up @@ -39,8 +39,10 @@ export const consumeAuthenticationRequest = (
routeName: routeList.AuthenticationConsent,
}),
)
dispatch(ssoActions.setDeepLinkLoading(false))
} catch (err) {
dispatch(showErrorScreen(new Error('Authentication request failed.')))
dispatch(ssoActions.setDeepLinkLoading(false))
}
}

Expand Down
30 changes: 18 additions & 12 deletions src/actions/sso/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ export const setReceivingCredential = (external: SignedCredential[]) => ({
external,
})

export const setDeepLinkLoading = (value: boolean) => ({
type: 'SET_DEEP_LINK_LOADING',
value,
})

export const parseJWT = (encodedJwt: string) => async (
dispatch: Dispatch<AnyAction>,
) => {
Expand Down Expand Up @@ -87,6 +92,7 @@ export const parseJWT = (encodedJwt: string) => async (
} catch (err) {
console.log('error: ', err)
dispatch(accountActions.toggleLoading(false))
dispatch(setDeepLinkLoading(false))
dispatch(showErrorScreen(err))
}
}
Expand All @@ -101,11 +107,7 @@ export const consumeCredentialOfferRequest = (
const { keyChainLib, identityWallet, registry } = backendMiddleware

try {
await identityWallet.validateJWT(
credOfferRequest,
undefined,
registry,
)
await identityWallet.validateJWT(credOfferRequest, undefined, registry)

const password = await keyChainLib.getPassword()
const credOfferResponse = await identityWallet.create.interactionTokens.response.offer(
Expand All @@ -127,6 +129,7 @@ export const consumeCredentialOfferRequest = (
dispatch(parseJWT(res.token))
} catch (err) {
dispatch(accountActions.toggleLoading(false))
dispatch(setDeepLinkLoading(false))
dispatch(showErrorScreen(new Error('JWT Token parse failed')))
}
}
Expand All @@ -141,11 +144,7 @@ export const receiveExternalCredential = (
const { identityWallet, registry } = backendMiddleware

try {
await identityWallet.validateJWT(
credReceive,
undefined,
registry,
)
await identityWallet.validateJWT(credReceive, undefined, registry)
} catch (error) {
console.log(error)
dispatch(
Expand All @@ -172,7 +171,9 @@ export const receiveExternalCredential = (
dispatch(setReceivingCredential(providedCredentials))
dispatch(accountActions.toggleLoading(false))
dispatch(
navigationActions.navigate({ routeName: routeList.CredentialDialog }),
navigationActions.navigatorReset({
routeName: routeList.CredentialDialog,
}),
)
} else {
dispatch(accountActions.toggleLoading(false))
Expand Down Expand Up @@ -266,9 +267,11 @@ export const consumeCredentialRequest = (

dispatch(setCredentialRequest(summary))
dispatch(accountActions.toggleLoading(false))
dispatch(navigationActions.navigate({ routeName: routeList.Consent }))
dispatch(navigationActions.navigatorReset({ routeName: routeList.Consent }))
dispatch(setDeepLinkLoading(false))
} catch (error) {
console.log(error)
dispatch(accountActions.toggleLoading(false))
dispatch(
showErrorScreen(new Error('Consumption of credential request failed')),
)
Expand Down Expand Up @@ -336,6 +339,8 @@ export const sendCredentialResponse = (
dispatch(cancelSSO())
} catch (error) {
// TODO: better error message
console.log(error)
dispatch(accountActions.toggleLoading(false))
dispatch(
showErrorScreen(
new Error('The credential response could not be created'),
Expand All @@ -346,6 +351,7 @@ export const sendCredentialResponse = (

export const cancelSSO = () => (dispatch: Dispatch<AnyAction>) => {
dispatch(clearInteractionRequest())
dispatch(accountActions.toggleLoading(false))
dispatch(navigationActions.navigatorReset({ routeName: routeList.Home }))
}

Expand Down
6 changes: 4 additions & 2 deletions src/actions/sso/paymentRequest.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { JSONWebToken } from 'jolocom-lib/js/interactionTokens/JSONWebToken'
import { Dispatch, AnyAction } from 'redux'
import { BackendMiddleware } from 'src/backendMiddleware'
import { navigationActions } from 'src/actions'
import { navigationActions, ssoActions } from 'src/actions'
import { routeList } from 'src/routeList'
import { PaymentRequest } from 'jolocom-lib/js/interactionTokens/paymentRequest'
import { StatePaymentRequestSummary } from 'src/reducers/sso'
Expand Down Expand Up @@ -45,9 +45,11 @@ export const consumePaymentRequest = (
}
dispatch(setPaymentRequest(paymentDetails))
dispatch(
navigationActions.navigate({ routeName: routeList.PaymentConsent }),
navigationActions.navigatorReset({ routeName: routeList.PaymentConsent }),
)
dispatch(ssoActions.setDeepLinkLoading(false))
} catch (err) {
dispatch(ssoActions.setDeepLinkLoading(false))
dispatch(showErrorScreen(new Error('Consuming payment request failed.')))
}
}
Expand Down
3 changes: 0 additions & 3 deletions src/backendMiddleware.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { JolocomLib } from 'jolocom-lib'
import { IdentityWallet } from 'jolocom-lib/js/identityWallet/identityWallet'
import { EthereumLib, EthereumLibInterface } from 'src/lib/ethereum'
import { EncryptionLib, EncryptionLibInterface } from 'src/lib/crypto'
import { Storage } from 'src/lib/storage/storage'
import { KeyChain, KeyChainInterface } from 'src/lib/keychain'
Expand All @@ -15,7 +14,6 @@ import {jolocomContractsGateway} from 'jolocom-lib/js/contracts/contractsGateway

export class BackendMiddleware {
identityWallet!: IdentityWallet
ethereumLib: EthereumLibInterface
storageLib: Storage
encryptionLib: EncryptionLibInterface
keyChainLib: KeyChainInterface
Expand All @@ -25,7 +23,6 @@ export class BackendMiddleware {
fuelingEndpoint: string
typeOrmConfig: ConnectionOptions
}) {
this.ethereumLib = new EthereumLib(config.fuelingEndpoint)
this.storageLib = new Storage(config.typeOrmConfig)
this.encryptionLib = new EncryptionLib()
this.keyChainLib = new KeyChain()
Expand Down
51 changes: 0 additions & 51 deletions src/lib/ethereum.ts

This file was deleted.

2 changes: 2 additions & 0 deletions src/reducers/account/claims.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ const categorizedClaims: CategorizedClaims = {
id: '',
issuer: '',
subject: '',
keyboardType: 'email-address',
},
{
credentialType: 'Mobile Phone',
Expand All @@ -37,6 +38,7 @@ const categorizedClaims: CategorizedClaims = {
id: '',
issuer: '',
subject: '',
keyboardType: 'phone-pad',
},
{
credentialType: 'Postal Address',
Expand Down
7 changes: 7 additions & 0 deletions src/reducers/account/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,13 @@ export interface DecoratedClaims {
issuer: string
subject: string
expires?: Date
keyboardType?:
| 'default'
| 'number-pad'
| 'decimal-pad'
| 'numeric'
| 'email-address'
| 'phone-pad'
}

export interface CategorizedClaims {
Expand Down
4 changes: 4 additions & 0 deletions src/reducers/sso/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ export interface SsoState {
activeCredentialRequest: StateCredentialRequestSummary
activePaymentRequest: StatePaymentRequestSummary
activeAuthenticationRequest: StateAuthenticationRequestSummary
deepLinkLoading: boolean
}

const initialState: SsoState = {
Expand All @@ -68,6 +69,7 @@ const initialState: SsoState = {
description: '',
requestJWT: '',
},
deepLinkLoading: false,
}

export const ssoReducer = (
Expand All @@ -81,6 +83,8 @@ export const ssoReducer = (
return { ...state, activePaymentRequest: action.value }
case 'SET_AUTHENTICATION_REQUEST':
return { ...state, activeAuthenticationRequest: action.value }
case 'SET_DEEP_LINK_LOADING':
return { ...state, deepLinkLoading: action.value }
case 'CLEAR_INTERACTION_REQUEST':
return initialState
default:
Expand Down
2 changes: 1 addition & 1 deletion src/ui/authentication/components/AuthenticationConsent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,11 @@ export class AuthenticationConsentComponent extends React.Component<
return (
<ButtonSection
disabled={this.state.pending}
denyDisabled={this.state.pending}
confirmText={I18n.t('Authorize')}
denyText={I18n.t('Deny')}
handleConfirm={this.handleConfirm}
handleDeny={() => this.props.cancelAuthenticationRequest()}
resetDeny
verticalPadding={10}
/>
)
Expand Down
Loading

0 comments on commit 37ad630

Please sign in to comment.