Skip to content

Commit

Permalink
fix: unlock with bizcd (#1686)
Browse files Browse the repository at this point in the history
Signed-off-by: Jason C. Leach <[email protected]>
  • Loading branch information
jleach authored Dec 21, 2023
1 parent 1a1acc3 commit 7e1beb8
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
4 changes: 2 additions & 2 deletions app/src/components/AddCredentialSlider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import Icon from 'react-native-vector-icons/MaterialCommunityIcons'

import { hitSlop } from '../constants'
import { BCWalletEventTypes } from '../events/eventTypes'
import { showBCIDSelector } from '../helpers/BCIDHelper'
import { showPersonCredentialSelector } from '../helpers/BCIDHelper'

export default function AddCredentialSlider() {
const { ColorPallet, TextTheme } = useTheme()
Expand Down Expand Up @@ -91,7 +91,7 @@ export default function AddCredentialSlider() {
(c) => c.metadata.data[AnonCredsCredentialMetadataKey].credentialDefinitionId as string
)

setShowGetFoundationCredential(showBCIDSelector(credentialDefinitionIDs, true))
setShowGetFoundationCredential(showPersonCredentialSelector(credentialDefinitionIDs))
}, [credentials])

useEffect(() => {
Expand Down
8 changes: 5 additions & 3 deletions app/src/helpers/BCIDHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,10 @@ export interface WellKnownAgentDetails {
invitationId?: string
}

export const showPersonCredentialSelector = (credentialDefinitionIDs: string[], canUseLSBCredential: boolean = true): boolean => {
export const showPersonCredentialSelector = (
credentialDefinitionIDs: string[],
canUseLSBCredential: boolean = true
): boolean => {
// If we already have a trusted foundation credential do nothing.
if (credentialDefinitionIDs.some((i) => trustedFoundationCredentialIssuerRe.test(i))) {
return false
Expand All @@ -51,8 +54,7 @@ export const showPersonCredentialSelector = (credentialDefinitionIDs: string[],
const unlockedByTrustedIssuer =
credentialDefinitionIDs.some((i) => trustedInvitationIssuerRe.test(i)) ||
credentialDefinitionIDs.some((i) => trustedBusinessCardCredentialIssuerRe.test(i)) ||
(credentialDefinitionIDs.some((i) => trustedLSBCCredentialIssuerRe.test(i)) && canUseLSBCredential)

(credentialDefinitionIDs.some((i) => trustedLSBCCredentialIssuerRe.test(i)) && canUseLSBCredential)

// We have a trusted credential and can use the LSB credential
if (unlockedByTrustedIssuer) {
Expand Down
1 change: 0 additions & 1 deletion app/src/hooks/notifications.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ export const useNotifications = (): Notifications => {
(c) => c.metadata.data[AnonCredsCredentialMetadataKey].credentialDefinitionId as string
)
const invitationDate = getUnlockCredentialDate(credentials)
console.log('invitationDate', invitationDate)
const custom: CustomNotification[] =
showPersonCredentialSelector(credentialDefinitionIDs) &&
invitationDate &&
Expand Down

0 comments on commit 7e1beb8

Please sign in to comment.