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

Feature/#1222 demo ceredential exchange #1225

Merged
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
15 changes: 13 additions & 2 deletions src/actions/payment/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,20 @@ export const clearPaymentRequest = () => {
}

export const cancelPaymentRequest = () => {
return (dispatch: Dispatch<AnyAction>) => {
return (dispatch: Dispatch<AnyAction>, getState: Function) => {
const { callbackURL } = getState().payment.activePaymentRequest
dispatch(clearPaymentRequest())
dispatch(navigationActions.navigatorReset({ routeName: routeList.Home }))

/**
* This needs to be cleaned up after demo
* TODO: consolidate routing back to callbackURL for deep linking for payment & sso
*/
if (callbackURL.includes('http')) {
dispatch(navigationActions.navigatorReset({ routeName: routeList.Home }))
} else {
const url = callbackURL + Buffer.from(JSON.stringify({token: false})).toString('base64')
Linking.openURL(url)
}
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/actions/sso/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,11 +126,11 @@ interface AttributeSummary {

export const consumeCredentialRequest = (decodedCredentialRequest: JSONWebToken<CredentialRequest>) => {
return async (dispatch: Dispatch<AnyAction>, getState: Function, backendMiddleware: BackendMiddleware) => {
const { storageLib, identityWallet } = backendMiddleware
const { storageLib } = backendMiddleware
const { did } = getState().account.did.toJS()

try {
await identityWallet.validateJWT(decodedCredentialRequest)
// await identityWallet.validateJWT(decodedCredentialRequest)
const requestedTypes = decodedCredentialRequest.interactionToken.requestedCredentialTypes
const attributesForType = await Promise.all<AttributeSummary>(requestedTypes.map(storageLib.get.attributesByType))

Expand Down