@bifold/core 2.0.1 → 2.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/commonjs/components/forms/WalletNameForm.js +152 -0
- package/lib/commonjs/components/forms/WalletNameForm.js.map +1 -0
- package/lib/commonjs/components/inputs/BiometryControl.js.map +1 -1
- package/lib/commonjs/components/misc/CredentialCard.js +3 -2
- package/lib/commonjs/components/misc/CredentialCard.js.map +1 -1
- package/lib/commonjs/components/misc/FauxHeader.js +89 -0
- package/lib/commonjs/components/misc/FauxHeader.js.map +1 -0
- package/lib/commonjs/components/misc/QRScanner.js +2 -2
- package/lib/commonjs/components/misc/QRScanner.js.map +1 -1
- package/lib/commonjs/components/modals/DeveloperModal.js +43 -0
- package/lib/commonjs/components/modals/DeveloperModal.js.map +1 -0
- package/lib/commonjs/components/views/PushNotificationsContent.js.map +1 -1
- package/lib/commonjs/components/views/PushNotificationsDisabledContent.js.map +1 -1
- package/lib/commonjs/contexts/auth.js +24 -3
- package/lib/commonjs/contexts/auth.js.map +1 -1
- package/lib/commonjs/hooks/chat-messages.js +1 -1
- package/lib/commonjs/hooks/chat-messages.js.map +1 -1
- package/lib/commonjs/hooks/developer-mode.js +31 -0
- package/lib/commonjs/hooks/developer-mode.js.map +1 -0
- package/lib/commonjs/hooks/lockout.js +80 -0
- package/lib/commonjs/hooks/lockout.js.map +1 -0
- package/lib/commonjs/hooks/onboarding.js +23 -0
- package/lib/commonjs/hooks/onboarding.js.map +1 -0
- package/lib/commonjs/index.js +24 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/localization/en/index.js +2 -1
- package/lib/commonjs/localization/en/index.js.map +1 -1
- package/lib/commonjs/localization/fr/index.js +2 -1
- package/lib/commonjs/localization/fr/index.js.map +1 -1
- package/lib/commonjs/localization/pt-br/index.js +2 -1
- package/lib/commonjs/localization/pt-br/index.js.map +1 -1
- package/lib/commonjs/modules/openid/components/OpenIDCredentialCard.js +4 -5
- package/lib/commonjs/modules/openid/components/OpenIDCredentialCard.js.map +1 -1
- package/lib/commonjs/modules/openid/display.js +6 -3
- package/lib/commonjs/modules/openid/display.js.map +1 -1
- package/lib/commonjs/modules/openid/metadata.js +2 -1
- package/lib/commonjs/modules/openid/metadata.js.map +1 -1
- package/lib/commonjs/modules/openid/screens/OpenIDProofChangeCredential.js +128 -0
- package/lib/commonjs/modules/openid/screens/OpenIDProofChangeCredential.js.map +1 -0
- package/lib/commonjs/modules/openid/screens/OpenIDProofPresentation.js +99 -44
- package/lib/commonjs/modules/openid/screens/OpenIDProofPresentation.js.map +1 -1
- package/lib/commonjs/modules/openid/types.js.map +1 -1
- package/lib/commonjs/modules/openid/utils/utils.js +0 -14
- package/lib/commonjs/modules/openid/utils/utils.js.map +1 -1
- package/lib/commonjs/navigators/ConnectStack.js +4 -4
- package/lib/commonjs/navigators/ConnectStack.js.map +1 -1
- package/lib/commonjs/navigators/DeliveryStack.js +8 -0
- package/lib/commonjs/navigators/DeliveryStack.js.map +1 -1
- package/lib/commonjs/navigators/OnboardingScreens.js +0 -8
- package/lib/commonjs/navigators/OnboardingScreens.js.map +1 -1
- package/lib/commonjs/navigators/OnboardingStack.js +3 -4
- package/lib/commonjs/navigators/OnboardingStack.js.map +1 -1
- package/lib/commonjs/navigators/SettingStack.js +4 -4
- package/lib/commonjs/navigators/SettingStack.js.map +1 -1
- package/lib/commonjs/navigators/TabStack.js +11 -4
- package/lib/commonjs/navigators/TabStack.js.map +1 -1
- package/lib/commonjs/navigators/defaultStackOptions.js +6 -1
- package/lib/commonjs/navigators/defaultStackOptions.js.map +1 -1
- package/lib/commonjs/screens/Biometry.js.map +1 -1
- package/lib/commonjs/screens/NameWallet.js +3 -149
- package/lib/commonjs/screens/NameWallet.js.map +1 -1
- package/lib/commonjs/screens/OnboardingPages.js +8 -38
- package/lib/commonjs/screens/OnboardingPages.js.map +1 -1
- package/lib/commonjs/screens/PINChange.js +5 -1
- package/lib/commonjs/screens/PINChange.js.map +1 -1
- package/lib/commonjs/screens/PINCreate.js +4 -1
- package/lib/commonjs/screens/PINCreate.js.map +1 -1
- package/lib/commonjs/screens/PINEnter.js +114 -292
- package/lib/commonjs/screens/PINEnter.js.map +1 -1
- package/lib/commonjs/screens/PINVerify.js +181 -0
- package/lib/commonjs/screens/PINVerify.js.map +1 -0
- package/lib/commonjs/screens/ProofRequest.js +9 -9
- package/lib/commonjs/screens/ProofRequest.js.map +1 -1
- package/lib/commonjs/screens/PushNotifications.js.map +1 -1
- package/lib/commonjs/screens/RenameWallet.js +33 -0
- package/lib/commonjs/screens/RenameWallet.js.map +1 -0
- package/lib/commonjs/screens/Settings.js +13 -19
- package/lib/commonjs/screens/Settings.js.map +1 -1
- package/lib/commonjs/screens/ToggleBiometry.js +16 -24
- package/lib/commonjs/screens/ToggleBiometry.js.map +1 -1
- package/lib/commonjs/theme.js +2 -1
- package/lib/commonjs/theme.js.map +1 -1
- package/lib/commonjs/types/navigators.js +2 -0
- package/lib/commonjs/types/navigators.js.map +1 -1
- package/lib/commonjs/utils/oca.js +46 -17
- package/lib/commonjs/utils/oca.js.map +1 -1
- package/lib/module/components/forms/WalletNameForm.js +143 -0
- package/lib/module/components/forms/WalletNameForm.js.map +1 -0
- package/lib/module/components/inputs/BiometryControl.js.map +1 -1
- package/lib/module/components/misc/CredentialCard.js +3 -2
- package/lib/module/components/misc/CredentialCard.js.map +1 -1
- package/lib/module/components/misc/FauxHeader.js +80 -0
- package/lib/module/components/misc/FauxHeader.js.map +1 -0
- package/lib/module/components/misc/QRScanner.js +2 -2
- package/lib/module/components/misc/QRScanner.js.map +1 -1
- package/lib/module/components/modals/DeveloperModal.js +36 -0
- package/lib/module/components/modals/DeveloperModal.js.map +1 -0
- package/lib/module/components/views/PushNotificationsContent.js.map +1 -1
- package/lib/module/components/views/PushNotificationsDisabledContent.js.map +1 -1
- package/lib/module/contexts/auth.js +22 -1
- package/lib/module/contexts/auth.js.map +1 -1
- package/lib/module/hooks/chat-messages.js +1 -1
- package/lib/module/hooks/chat-messages.js.map +1 -1
- package/lib/module/hooks/developer-mode.js +24 -0
- package/lib/module/hooks/developer-mode.js.map +1 -0
- package/lib/module/hooks/lockout.js +70 -0
- package/lib/module/hooks/lockout.js.map +1 -0
- package/lib/module/hooks/onboarding.js +16 -0
- package/lib/module/hooks/onboarding.js.map +1 -0
- package/lib/module/index.js +4 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/localization/en/index.js +2 -1
- package/lib/module/localization/en/index.js.map +1 -1
- package/lib/module/localization/fr/index.js +2 -1
- package/lib/module/localization/fr/index.js.map +1 -1
- package/lib/module/localization/pt-br/index.js +2 -1
- package/lib/module/localization/pt-br/index.js.map +1 -1
- package/lib/module/modules/openid/components/OpenIDCredentialCard.js +4 -4
- package/lib/module/modules/openid/components/OpenIDCredentialCard.js.map +1 -1
- package/lib/module/modules/openid/display.js +6 -3
- package/lib/module/modules/openid/display.js.map +1 -1
- package/lib/module/modules/openid/metadata.js +2 -1
- package/lib/module/modules/openid/metadata.js.map +1 -1
- package/lib/module/modules/openid/screens/OpenIDProofChangeCredential.js +121 -0
- package/lib/module/modules/openid/screens/OpenIDProofChangeCredential.js.map +1 -0
- package/lib/module/modules/openid/screens/OpenIDProofPresentation.js +100 -45
- package/lib/module/modules/openid/screens/OpenIDProofPresentation.js.map +1 -1
- package/lib/module/modules/openid/types.js.map +1 -1
- package/lib/module/modules/openid/utils/utils.js +1 -12
- package/lib/module/modules/openid/utils/utils.js.map +1 -1
- package/lib/module/navigators/ConnectStack.js +4 -4
- package/lib/module/navigators/ConnectStack.js.map +1 -1
- package/lib/module/navigators/DeliveryStack.js +8 -0
- package/lib/module/navigators/DeliveryStack.js.map +1 -1
- package/lib/module/navigators/OnboardingScreens.js +0 -8
- package/lib/module/navigators/OnboardingScreens.js.map +1 -1
- package/lib/module/navigators/OnboardingStack.js +4 -5
- package/lib/module/navigators/OnboardingStack.js.map +1 -1
- package/lib/module/navigators/SettingStack.js +4 -4
- package/lib/module/navigators/SettingStack.js.map +1 -1
- package/lib/module/navigators/TabStack.js +11 -4
- package/lib/module/navigators/TabStack.js.map +1 -1
- package/lib/module/navigators/defaultStackOptions.js +6 -1
- package/lib/module/navigators/defaultStackOptions.js.map +1 -1
- package/lib/module/screens/Biometry.js.map +1 -1
- package/lib/module/screens/NameWallet.js +3 -147
- package/lib/module/screens/NameWallet.js.map +1 -1
- package/lib/module/screens/OnboardingPages.js +8 -38
- package/lib/module/screens/OnboardingPages.js.map +1 -1
- package/lib/module/screens/PINChange.js +5 -1
- package/lib/module/screens/PINChange.js.map +1 -1
- package/lib/module/screens/PINCreate.js +4 -1
- package/lib/module/screens/PINCreate.js.map +1 -1
- package/lib/module/screens/PINEnter.js +116 -294
- package/lib/module/screens/PINEnter.js.map +1 -1
- package/lib/module/screens/PINVerify.js +172 -0
- package/lib/module/screens/PINVerify.js.map +1 -0
- package/lib/module/screens/ProofRequest.js +9 -9
- package/lib/module/screens/ProofRequest.js.map +1 -1
- package/lib/module/screens/PushNotifications.js.map +1 -1
- package/lib/module/screens/RenameWallet.js +24 -0
- package/lib/module/screens/RenameWallet.js.map +1 -0
- package/lib/module/screens/Settings.js +12 -18
- package/lib/module/screens/Settings.js.map +1 -1
- package/lib/module/screens/ToggleBiometry.js +15 -23
- package/lib/module/screens/ToggleBiometry.js.map +1 -1
- package/lib/module/theme.js +2 -1
- package/lib/module/theme.js.map +1 -1
- package/lib/module/types/navigators.js +2 -0
- package/lib/module/types/navigators.js.map +1 -1
- package/lib/module/utils/oca.js +43 -15
- package/lib/module/utils/oca.js.map +1 -1
- package/lib/typescript/src/components/forms/WalletNameForm.d.ts +9 -0
- package/lib/typescript/src/components/forms/WalletNameForm.d.ts.map +1 -0
- package/lib/typescript/src/components/inputs/BiometryControl.d.ts.map +1 -1
- package/lib/typescript/src/components/misc/CredentialCard.d.ts.map +1 -1
- package/lib/typescript/src/components/misc/FauxHeader.d.ts +8 -0
- package/lib/typescript/src/components/misc/FauxHeader.d.ts.map +1 -0
- package/lib/typescript/src/components/modals/DeveloperModal.d.ts +7 -0
- package/lib/typescript/src/components/modals/DeveloperModal.d.ts.map +1 -0
- package/lib/typescript/src/contexts/auth.d.ts +1 -0
- package/lib/typescript/src/contexts/auth.d.ts.map +1 -1
- package/lib/typescript/src/hooks/developer-mode.d.ts +4 -0
- package/lib/typescript/src/hooks/developer-mode.d.ts.map +1 -0
- package/lib/typescript/src/hooks/lockout.d.ts +9 -0
- package/lib/typescript/src/hooks/lockout.d.ts.map +1 -0
- package/lib/typescript/src/hooks/onboarding.d.ts +2 -0
- package/lib/typescript/src/hooks/onboarding.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +5 -2
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/localization/en/index.d.ts +1 -0
- package/lib/typescript/src/localization/en/index.d.ts.map +1 -1
- package/lib/typescript/src/localization/fr/index.d.ts +1 -0
- package/lib/typescript/src/localization/fr/index.d.ts.map +1 -1
- package/lib/typescript/src/localization/pt-br/index.d.ts +1 -0
- package/lib/typescript/src/localization/pt-br/index.d.ts.map +1 -1
- package/lib/typescript/src/modules/openid/components/OpenIDCredentialCard.d.ts.map +1 -1
- package/lib/typescript/src/modules/openid/display.d.ts.map +1 -1
- package/lib/typescript/src/modules/openid/metadata.d.ts +8 -1
- package/lib/typescript/src/modules/openid/metadata.d.ts.map +1 -1
- package/lib/typescript/src/modules/openid/screens/OpenIDProofChangeCredential.d.ts +6 -0
- package/lib/typescript/src/modules/openid/screens/OpenIDProofChangeCredential.d.ts.map +1 -0
- package/lib/typescript/src/modules/openid/screens/OpenIDProofPresentation.d.ts.map +1 -1
- package/lib/typescript/src/modules/openid/types.d.ts +9 -0
- package/lib/typescript/src/modules/openid/types.d.ts.map +1 -1
- package/lib/typescript/src/modules/openid/utils/utils.d.ts +1 -3
- package/lib/typescript/src/modules/openid/utils/utils.d.ts.map +1 -1
- package/lib/typescript/src/navigators/DeliveryStack.d.ts.map +1 -1
- package/lib/typescript/src/navigators/OnboardingScreens.d.ts +0 -1
- package/lib/typescript/src/navigators/OnboardingScreens.d.ts.map +1 -1
- package/lib/typescript/src/navigators/OnboardingStack.d.ts.map +1 -1
- package/lib/typescript/src/navigators/TabStack.d.ts.map +1 -1
- package/lib/typescript/src/navigators/defaultStackOptions.d.ts.map +1 -1
- package/lib/typescript/src/screens/Biometry.d.ts.map +1 -1
- package/lib/typescript/src/screens/NameWallet.d.ts.map +1 -1
- package/lib/typescript/src/screens/OnboardingPages.d.ts +1 -1
- package/lib/typescript/src/screens/OnboardingPages.d.ts.map +1 -1
- package/lib/typescript/src/screens/PINChange.d.ts.map +1 -1
- package/lib/typescript/src/screens/PINCreate.d.ts.map +1 -1
- package/lib/typescript/src/screens/PINEnter.d.ts +0 -7
- package/lib/typescript/src/screens/PINEnter.d.ts.map +1 -1
- package/lib/typescript/src/screens/PINVerify.d.ts +13 -0
- package/lib/typescript/src/screens/PINVerify.d.ts.map +1 -0
- package/lib/typescript/src/screens/RenameWallet.d.ts +4 -0
- package/lib/typescript/src/screens/RenameWallet.d.ts.map +1 -0
- package/lib/typescript/src/screens/Settings.d.ts.map +1 -1
- package/lib/typescript/src/screens/ToggleBiometry.d.ts.map +1 -1
- package/lib/typescript/src/theme.d.ts +10 -25
- package/lib/typescript/src/theme.d.ts.map +1 -1
- package/lib/typescript/src/types/navigators.d.ts +17 -3
- package/lib/typescript/src/types/navigators.d.ts.map +1 -1
- package/lib/typescript/src/utils/oca.d.ts +7 -2
- package/lib/typescript/src/utils/oca.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/components/forms/WalletNameForm.tsx +148 -0
- package/src/components/inputs/BiometryControl.tsx +16 -13
- package/src/components/misc/CredentialCard.tsx +5 -2
- package/src/components/misc/FauxHeader.tsx +75 -0
- package/src/components/misc/QRScanner.tsx +2 -2
- package/src/components/modals/DeveloperModal.tsx +30 -0
- package/src/components/views/PushNotificationsContent.tsx +15 -15
- package/src/components/views/PushNotificationsDisabledContent.tsx +10 -10
- package/src/contexts/auth.tsx +33 -1
- package/src/hooks/chat-messages.tsx +1 -1
- package/src/hooks/developer-mode.ts +25 -0
- package/src/hooks/lockout.ts +77 -0
- package/src/hooks/onboarding.ts +16 -0
- package/src/hooks/usePINValidation.ts +3 -3
- package/src/index.ts +7 -0
- package/src/localization/en/index.ts +1 -0
- package/src/localization/fr/index.ts +1 -0
- package/src/localization/pt-br/index.ts +1 -0
- package/src/modules/openid/components/OpenIDCredentialCard.tsx +3 -4
- package/src/modules/openid/display.tsx +3 -0
- package/src/modules/openid/metadata.tsx +7 -1
- package/src/modules/openid/screens/OpenIDProofChangeCredential.tsx +132 -0
- package/src/modules/openid/screens/OpenIDProofPresentation.tsx +131 -59
- package/src/modules/openid/types.tsx +8 -0
- package/src/modules/openid/utils/utils.tsx +0 -14
- package/src/navigators/ConnectStack.tsx +4 -4
- package/src/navigators/DeliveryStack.tsx +9 -0
- package/src/navigators/OnboardingScreens.ts +0 -10
- package/src/navigators/OnboardingStack.tsx +2 -6
- package/src/navigators/RootStack.tsx +1 -1
- package/src/navigators/SettingStack.tsx +4 -4
- package/src/navigators/TabStack.tsx +3 -2
- package/src/navigators/defaultStackOptions.tsx +5 -0
- package/src/screens/Biometry.tsx +1 -4
- package/src/screens/NameWallet.tsx +3 -152
- package/src/screens/OnboardingPages.tsx +9 -61
- package/src/screens/PINChange.tsx +6 -9
- package/src/screens/PINCreate.tsx +7 -18
- package/src/screens/PINEnter.tsx +114 -361
- package/src/screens/PINVerify.tsx +193 -0
- package/src/screens/ProofRequest.tsx +9 -9
- package/src/screens/PushNotifications.tsx +2 -2
- package/src/screens/RenameWallet.tsx +25 -0
- package/src/screens/Settings.tsx +11 -22
- package/src/screens/ToggleBiometry.tsx +20 -34
- package/src/theme.ts +34 -3
- package/src/types/navigators.ts +21 -3
- package/src/utils/oca.ts +60 -19
|
@@ -21,9 +21,8 @@ import { MdocRecord, SdJwtVcRecord, W3cCredentialRecord } from '@credo-ts/core'
|
|
|
21
21
|
import { getCredentialForDisplay } from '../display'
|
|
22
22
|
import { BifoldError } from '../../../types/error'
|
|
23
23
|
import { EventTypes } from '../../../constants'
|
|
24
|
-
import { getAttributeField } from '../utils/utils'
|
|
25
24
|
import { Attribute } from '@bifold/oca/build/legacy'
|
|
26
|
-
import
|
|
25
|
+
import { getAttributeField } from '../../../utils/oca'
|
|
27
26
|
|
|
28
27
|
interface CredentialCardProps {
|
|
29
28
|
credentialDisplay?: W3cCredentialDisplay
|
|
@@ -66,7 +65,7 @@ const OpenIDCredentialCard: React.FC<CredentialCardProps> = ({
|
|
|
66
65
|
|
|
67
66
|
const overlayAttributeField = useMemo((): Attribute | undefined => {
|
|
68
67
|
if (!display?.primary_overlay_attribute || !credentialDisplay) return undefined
|
|
69
|
-
return getAttributeField(credentialDisplay, display.primary_overlay_attribute)
|
|
68
|
+
return getAttributeField(credentialDisplay, display.primary_overlay_attribute)?.field
|
|
70
69
|
}, [display, credentialDisplay])
|
|
71
70
|
|
|
72
71
|
const { width } = useWindowDimensions()
|
|
@@ -228,7 +227,7 @@ const OpenIDCredentialCard: React.FC<CredentialCardProps> = ({
|
|
|
228
227
|
testID={testIdWithKey('CredentialIssued')}
|
|
229
228
|
maxFontSizeMultiplier={1}
|
|
230
229
|
>
|
|
231
|
-
{overlayAttributeField.label ??
|
|
230
|
+
{overlayAttributeField.label ?? overlayAttributeField.name}: {overlayAttributeField.value}
|
|
232
231
|
</Text>
|
|
233
232
|
</View>
|
|
234
233
|
)
|
|
@@ -351,6 +351,7 @@ export function getCredentialForDisplay(
|
|
|
351
351
|
claimFormat: ClaimFormat.SdJwtVc,
|
|
352
352
|
validUntil: mapped.raw.validUntil,
|
|
353
353
|
validFrom: mapped.raw.validFrom,
|
|
354
|
+
credentialSubject: openId4VcMetadata?.credential.credential_subject,
|
|
354
355
|
}
|
|
355
356
|
}
|
|
356
357
|
|
|
@@ -383,6 +384,7 @@ export function getCredentialForDisplay(
|
|
|
383
384
|
claimFormat: ClaimFormat.MsoMdoc,
|
|
384
385
|
validUntil: mdocInstance.validityInfo.validUntil,
|
|
385
386
|
validFrom: mdocInstance.validityInfo.validFrom,
|
|
387
|
+
credentialSubject: openId4VcMetadata?.credential.credential_subject,
|
|
386
388
|
}
|
|
387
389
|
}
|
|
388
390
|
|
|
@@ -427,6 +429,7 @@ export function getCredentialForDisplay(
|
|
|
427
429
|
validFrom: credentialRecord.credential.issuanceDate
|
|
428
430
|
? new Date(credentialRecord.credential.issuanceDate)
|
|
429
431
|
: undefined,
|
|
432
|
+
credentialSubject: openId4VcMetadata?.credential.credential_subject,
|
|
430
433
|
}
|
|
431
434
|
}
|
|
432
435
|
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import type { W3cCredentialRecord, SdJwtVcRecord, MdocRecord } from '@credo-ts/core'
|
|
2
2
|
import type { OpenId4VciCredentialSupported, OpenId4VciIssuerMetadataDisplay } from '@credo-ts/openid4vc'
|
|
3
3
|
import type { MetadataDisplay } from '@sphereon/oid4vci-common'
|
|
4
|
+
import { CredentialSubjectRecord } from './types'
|
|
4
5
|
|
|
5
6
|
export interface OpenId4VcCredentialMetadata {
|
|
6
7
|
credential: {
|
|
7
8
|
display?: OpenId4VciCredentialSupported['display']
|
|
8
9
|
order?: OpenId4VciCredentialSupported['order']
|
|
10
|
+
credential_subject?: CredentialSubjectRecord
|
|
9
11
|
}
|
|
10
12
|
issuer: {
|
|
11
13
|
display?: OpenId4VciIssuerMetadataDisplay[]
|
|
@@ -13,16 +15,20 @@ export interface OpenId4VcCredentialMetadata {
|
|
|
13
15
|
}
|
|
14
16
|
}
|
|
15
17
|
|
|
18
|
+
export type OpenId4VcCredentialMetadataExtended = Partial<
|
|
19
|
+
OpenId4VciCredentialSupported & { credential_subject: CredentialSubjectRecord }
|
|
20
|
+
>
|
|
16
21
|
const openId4VcCredentialMetadataKey = '_bifold/openId4VcCredentialMetadata'
|
|
17
22
|
|
|
18
23
|
export function extractOpenId4VcCredentialMetadata(
|
|
19
|
-
credentialMetadata: OpenId4VciCredentialSupported
|
|
24
|
+
credentialMetadata: Partial<OpenId4VciCredentialSupported & { credential_subject: CredentialSubjectRecord }>,
|
|
20
25
|
serverMetadata: { display?: MetadataDisplay[]; id: string }
|
|
21
26
|
): OpenId4VcCredentialMetadata {
|
|
22
27
|
return {
|
|
23
28
|
credential: {
|
|
24
29
|
display: credentialMetadata.display,
|
|
25
30
|
order: credentialMetadata.order,
|
|
31
|
+
credential_subject: credentialMetadata.credential_subject,
|
|
26
32
|
},
|
|
27
33
|
issuer: {
|
|
28
34
|
display: serverMetadata.display,
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { StackScreenProps } from '@react-navigation/stack'
|
|
2
|
+
import { DeliveryStackParams, Screens } from '../../../types/navigators'
|
|
3
|
+
import ScreenLayout from '../../../layout/ScreenLayout'
|
|
4
|
+
import { FlatList, StyleSheet, TouchableOpacity, View } from 'react-native'
|
|
5
|
+
import { useTranslation } from 'react-i18next'
|
|
6
|
+
import { useTheme } from '../../../contexts/theme'
|
|
7
|
+
import { useEffect, useState } from 'react'
|
|
8
|
+
import { MdocRecord, SdJwtVcRecord, W3cCredentialRecord } from '@credo-ts/core'
|
|
9
|
+
import { isSdJwtProofRequest, isW3CProofRequest } from '../utils/utils'
|
|
10
|
+
import { useOpenIDCredentials } from '../context/OpenIDCredentialRecordProvider'
|
|
11
|
+
import RecordLoading from '../../../components/animated/RecordLoading'
|
|
12
|
+
import { ThemedText } from '../../../components/texts/ThemedText'
|
|
13
|
+
import { testIdWithKey } from '../../../utils/testable'
|
|
14
|
+
import { CredentialCard } from '../../../components/misc'
|
|
15
|
+
|
|
16
|
+
type Props = StackScreenProps<DeliveryStackParams, Screens.OpenIDProofCredentialSelect>
|
|
17
|
+
type TypedCred = {
|
|
18
|
+
credential: W3cCredentialRecord | SdJwtVcRecord | MdocRecord
|
|
19
|
+
claimFormat: string
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const OpenIDProofCredentialSelect: React.FC<Props> = ({ route, navigation }: Props) => {
|
|
23
|
+
if (!route?.params) {
|
|
24
|
+
throw new Error('Change credential route params were not set properly')
|
|
25
|
+
}
|
|
26
|
+
const selectedCredentialID = route.params.selectedCredID
|
|
27
|
+
const altCredentials = route.params.altCredIDs
|
|
28
|
+
const onCredChange = route.params.onCredChange
|
|
29
|
+
const { ColorPallet, SelectedCredTheme } = useTheme()
|
|
30
|
+
const { getW3CCredentialById, getSdJwtCredentialById } = useOpenIDCredentials()
|
|
31
|
+
|
|
32
|
+
const { t } = useTranslation()
|
|
33
|
+
const [loading, setLoading] = useState(false)
|
|
34
|
+
|
|
35
|
+
const [credentialsRequested, setCredentialsRequested] = useState<Array<TypedCred>>([])
|
|
36
|
+
|
|
37
|
+
useEffect(() => {
|
|
38
|
+
async function fetchCreds() {
|
|
39
|
+
if (!altCredentials) return
|
|
40
|
+
setLoading(true)
|
|
41
|
+
|
|
42
|
+
const creds: TypedCred[] = []
|
|
43
|
+
|
|
44
|
+
for (const { id, claimFormat } of Object.values(altCredentials)) {
|
|
45
|
+
let credential: W3cCredentialRecord | SdJwtVcRecord | MdocRecord | undefined
|
|
46
|
+
if (isW3CProofRequest(claimFormat)) {
|
|
47
|
+
credential = await getW3CCredentialById(id)
|
|
48
|
+
} else if (isSdJwtProofRequest(claimFormat)) {
|
|
49
|
+
credential = await getSdJwtCredentialById(id)
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
if (credential) {
|
|
53
|
+
creds.push({
|
|
54
|
+
credential,
|
|
55
|
+
claimFormat,
|
|
56
|
+
})
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
setCredentialsRequested(creds)
|
|
60
|
+
setLoading(false)
|
|
61
|
+
}
|
|
62
|
+
fetchCreds()
|
|
63
|
+
}, [altCredentials, getW3CCredentialById, getSdJwtCredentialById])
|
|
64
|
+
|
|
65
|
+
const styles = StyleSheet.create({
|
|
66
|
+
pageContainer: {
|
|
67
|
+
flex: 1,
|
|
68
|
+
},
|
|
69
|
+
pageMargin: {
|
|
70
|
+
marginHorizontal: 20,
|
|
71
|
+
},
|
|
72
|
+
cardLoading: {
|
|
73
|
+
backgroundColor: ColorPallet.brand.secondaryBackground,
|
|
74
|
+
flex: 1,
|
|
75
|
+
flexGrow: 1,
|
|
76
|
+
marginVertical: 35,
|
|
77
|
+
borderRadius: 15,
|
|
78
|
+
paddingHorizontal: 10,
|
|
79
|
+
},
|
|
80
|
+
})
|
|
81
|
+
|
|
82
|
+
const changeCred = (selection: TypedCred) => {
|
|
83
|
+
onCredChange({
|
|
84
|
+
inputDescriptorID: route.params.inputDescriptorID,
|
|
85
|
+
id: selection.credential.id,
|
|
86
|
+
claimFormat: selection.claimFormat,
|
|
87
|
+
})
|
|
88
|
+
navigation.goBack()
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
const listHeader = () => {
|
|
92
|
+
return (
|
|
93
|
+
<View style={{ ...styles.pageMargin, marginVertical: 20 }}>
|
|
94
|
+
{loading ? (
|
|
95
|
+
<View style={styles.cardLoading}>
|
|
96
|
+
<RecordLoading />
|
|
97
|
+
</View>
|
|
98
|
+
) : (
|
|
99
|
+
<ThemedText>{t('ProofRequest.MultipleCredentials')}</ThemedText>
|
|
100
|
+
)}
|
|
101
|
+
</View>
|
|
102
|
+
)
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
return (
|
|
106
|
+
<ScreenLayout screen={Screens.OpenIDProofCredentialSelect}>
|
|
107
|
+
<FlatList
|
|
108
|
+
data={credentialsRequested}
|
|
109
|
+
ListHeaderComponent={listHeader}
|
|
110
|
+
renderItem={({ item }) => {
|
|
111
|
+
return (
|
|
112
|
+
<View style={styles.pageMargin}>
|
|
113
|
+
<TouchableOpacity
|
|
114
|
+
accessibilityRole="button"
|
|
115
|
+
testID={testIdWithKey(`select:${item.credential.id}`)}
|
|
116
|
+
onPress={() => changeCred(item)}
|
|
117
|
+
style={[
|
|
118
|
+
item.credential.id === selectedCredentialID ? SelectedCredTheme : undefined,
|
|
119
|
+
{ marginBottom: 10 },
|
|
120
|
+
]}
|
|
121
|
+
>
|
|
122
|
+
<CredentialCard credential={item.credential}></CredentialCard>
|
|
123
|
+
</TouchableOpacity>
|
|
124
|
+
</View>
|
|
125
|
+
)
|
|
126
|
+
}}
|
|
127
|
+
></FlatList>
|
|
128
|
+
</ScreenLayout>
|
|
129
|
+
)
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
export default OpenIDProofCredentialSelect
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useEffect, useMemo, useState } from 'react'
|
|
1
|
+
import { useCallback, useEffect, useMemo, useState } from 'react'
|
|
2
2
|
import { DeviceEventEmitter } from 'react-native'
|
|
3
3
|
import { useAgent } from '@credo-ts/react-hooks'
|
|
4
4
|
import { useTranslation } from 'react-i18next'
|
|
@@ -31,6 +31,20 @@ import { isSdJwtProofRequest, isW3CProofRequest } from '../utils/utils'
|
|
|
31
31
|
|
|
32
32
|
type OpenIDProofPresentationProps = StackScreenProps<DeliveryStackParams, Screens.OpenIDProofPresentation>
|
|
33
33
|
|
|
34
|
+
type SatisfiedCredentialsFormat = {
|
|
35
|
+
[inputDescriptorId: string]: {
|
|
36
|
+
id: string
|
|
37
|
+
claimFormat: string
|
|
38
|
+
}[]
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
type SelectedCredentialsFormat = {
|
|
42
|
+
[inputDescriptorId: string]: {
|
|
43
|
+
id: string
|
|
44
|
+
claimFormat: string
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
34
48
|
const OpenIDProofPresentation: React.FC<OpenIDProofPresentationProps> = ({
|
|
35
49
|
navigation,
|
|
36
50
|
route: {
|
|
@@ -43,6 +57,9 @@ const OpenIDProofPresentation: React.FC<OpenIDProofPresentationProps> = ({
|
|
|
43
57
|
const [credentialsRequested, setCredentialsRequested] = useState<
|
|
44
58
|
Array<W3cCredentialRecord | SdJwtVcRecord | MdocRecord>
|
|
45
59
|
>([])
|
|
60
|
+
const [satistfiedCredentialsSubmission, setSatistfiedCredentialsSubmission] = useState<SatisfiedCredentialsFormat>()
|
|
61
|
+
const [selectedCredentialsSubmission, setSelectedCredentialsSubmission] = useState<SelectedCredentialsFormat>()
|
|
62
|
+
|
|
46
63
|
const { getW3CCredentialById, getSdJwtCredentialById } = useOpenIDCredentials()
|
|
47
64
|
|
|
48
65
|
const { ColorPallet, ListItems, TextTheme } = useTheme()
|
|
@@ -104,53 +121,61 @@ const OpenIDProofPresentation: React.FC<OpenIDProofPresentationProps> = ({
|
|
|
104
121
|
[credential]
|
|
105
122
|
)
|
|
106
123
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
return {
|
|
120
|
-
...acc,
|
|
121
|
-
[entry.inputDescriptorId]: {
|
|
122
|
-
id: entry.credentials[0].id,
|
|
123
|
-
claimFormat: entry.credentials[0].claimFormat,
|
|
124
|
-
},
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
return acc
|
|
128
|
-
}, {}),
|
|
129
|
-
[submission]
|
|
130
|
-
)
|
|
124
|
+
//This should run only once when the screen is mounted
|
|
125
|
+
useEffect(() => {
|
|
126
|
+
if (!submission) return
|
|
127
|
+
const creds = submission.entries.reduce((acc: SatisfiedCredentialsFormat, entry) => {
|
|
128
|
+
acc[entry.inputDescriptorId] = entry.credentials.map((cred) => ({
|
|
129
|
+
id: cred.id,
|
|
130
|
+
claimFormat: cred.claimFormat,
|
|
131
|
+
}))
|
|
132
|
+
return acc
|
|
133
|
+
}, {})
|
|
134
|
+
setSatistfiedCredentialsSubmission(creds)
|
|
135
|
+
}, [submission])
|
|
131
136
|
|
|
137
|
+
//Fetch all credentials satisfying the proof
|
|
132
138
|
useEffect(() => {
|
|
133
139
|
async function fetchCreds() {
|
|
134
|
-
if (!
|
|
140
|
+
if (!satistfiedCredentialsSubmission || satistfiedCredentialsSubmission.entries) return
|
|
135
141
|
|
|
136
142
|
const creds: Array<W3cCredentialRecord | SdJwtVcRecord | MdocRecord> = []
|
|
137
143
|
|
|
138
|
-
for (const [inputDescriptorID,
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
144
|
+
for (const [inputDescriptorID, credIDs] of Object.entries(satistfiedCredentialsSubmission)) {
|
|
145
|
+
for (const { id, claimFormat } of credIDs) {
|
|
146
|
+
let credential: W3cCredentialRecord | SdJwtVcRecord | MdocRecord | undefined
|
|
147
|
+
if (isW3CProofRequest(claimFormat)) {
|
|
148
|
+
credential = await getW3CCredentialById(id)
|
|
149
|
+
} else if (isSdJwtProofRequest(claimFormat)) {
|
|
150
|
+
credential = await getSdJwtCredentialById(id)
|
|
151
|
+
}
|
|
145
152
|
|
|
146
|
-
|
|
147
|
-
|
|
153
|
+
if (credential && inputDescriptorID) {
|
|
154
|
+
creds.push(credential)
|
|
155
|
+
}
|
|
148
156
|
}
|
|
149
157
|
}
|
|
150
158
|
setCredentialsRequested(creds)
|
|
151
159
|
}
|
|
152
160
|
fetchCreds()
|
|
153
|
-
}, [
|
|
161
|
+
}, [satistfiedCredentialsSubmission, getW3CCredentialById, getSdJwtCredentialById])
|
|
162
|
+
|
|
163
|
+
//Once satisfied credentials are set and all credentials fetched, we select the first one of each submission to display on screen
|
|
164
|
+
useEffect(() => {
|
|
165
|
+
if (!satistfiedCredentialsSubmission || credentialsRequested?.length <= 0) return
|
|
166
|
+
|
|
167
|
+
const creds = Object.entries(satistfiedCredentialsSubmission).reduce(
|
|
168
|
+
(acc: SelectedCredentialsFormat, [inputDescriptorId, credentials]) => {
|
|
169
|
+
acc[inputDescriptorId] = {
|
|
170
|
+
id: credentials[0].id,
|
|
171
|
+
claimFormat: credentials[0].claimFormat,
|
|
172
|
+
}
|
|
173
|
+
return acc
|
|
174
|
+
},
|
|
175
|
+
{}
|
|
176
|
+
)
|
|
177
|
+
setSelectedCredentialsSubmission(creds)
|
|
178
|
+
}, [satistfiedCredentialsSubmission, credentialsRequested])
|
|
154
179
|
|
|
155
180
|
const { verifierName } = useMemo(() => {
|
|
156
181
|
return { verifierName: credential?.verifierHostName }
|
|
@@ -158,16 +183,15 @@ const OpenIDProofPresentation: React.FC<OpenIDProofPresentationProps> = ({
|
|
|
158
183
|
|
|
159
184
|
const handleAcceptTouched = async () => {
|
|
160
185
|
try {
|
|
161
|
-
if (!agent || !credential.credentialsForRequest || !
|
|
186
|
+
if (!agent || !credential.credentialsForRequest || !selectedCredentialsSubmission) {
|
|
162
187
|
return
|
|
163
188
|
}
|
|
164
189
|
await shareProof({
|
|
165
190
|
agent,
|
|
166
191
|
authorizationRequest: credential.authorizationRequest,
|
|
167
192
|
credentialsForRequest: credential.credentialsForRequest,
|
|
168
|
-
selectedCredentials,
|
|
193
|
+
selectedCredentials: selectedCredentialsSubmission,
|
|
169
194
|
})
|
|
170
|
-
|
|
171
195
|
setAcceptModalVisible(true)
|
|
172
196
|
} catch (err: unknown) {
|
|
173
197
|
setButtonsVisible(true)
|
|
@@ -185,6 +209,47 @@ const OpenIDProofPresentation: React.FC<OpenIDProofPresentationProps> = ({
|
|
|
185
209
|
navigation.getParent()?.navigate(TabStacks.HomeStack, { screen: Screens.Home })
|
|
186
210
|
}
|
|
187
211
|
|
|
212
|
+
// Re-construct the selected credentials object based on user alt credential
|
|
213
|
+
const onCredChange = ({
|
|
214
|
+
inputDescriptorID,
|
|
215
|
+
id,
|
|
216
|
+
claimFormat,
|
|
217
|
+
}: {
|
|
218
|
+
inputDescriptorID: string
|
|
219
|
+
id: string
|
|
220
|
+
claimFormat: string
|
|
221
|
+
}) => {
|
|
222
|
+
setSelectedCredentialsSubmission((prev) => ({
|
|
223
|
+
...prev,
|
|
224
|
+
[inputDescriptorID]: {
|
|
225
|
+
id,
|
|
226
|
+
claimFormat,
|
|
227
|
+
},
|
|
228
|
+
}))
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
const handleAltCredChange = useCallback(
|
|
232
|
+
(inputDescriptorID: string, selectedCredID: string, inputDescriptor: string) => {
|
|
233
|
+
const submittionEntries = submission?.entries.find((entry) => entry.inputDescriptorId === inputDescriptor)
|
|
234
|
+
const credsForEntry = submittionEntries?.credentials
|
|
235
|
+
|
|
236
|
+
if (!credsForEntry) return
|
|
237
|
+
|
|
238
|
+
navigation.navigate(Screens.OpenIDProofCredentialSelect, {
|
|
239
|
+
inputDescriptorID: inputDescriptorID,
|
|
240
|
+
selectedCredID: selectedCredID,
|
|
241
|
+
altCredIDs: credsForEntry.map((cred) => {
|
|
242
|
+
return {
|
|
243
|
+
id: cred.id,
|
|
244
|
+
claimFormat: cred.claimFormat,
|
|
245
|
+
}
|
|
246
|
+
}),
|
|
247
|
+
onCredChange: onCredChange,
|
|
248
|
+
})
|
|
249
|
+
},
|
|
250
|
+
[submission, navigation]
|
|
251
|
+
)
|
|
252
|
+
|
|
188
253
|
const renderHeader = () => {
|
|
189
254
|
return (
|
|
190
255
|
<View style={styles.headerTextContainer}>
|
|
@@ -200,8 +265,6 @@ const OpenIDProofPresentation: React.FC<OpenIDProofPresentationProps> = ({
|
|
|
200
265
|
const renderCard = (
|
|
201
266
|
sub: FormattedSubmissionEntry,
|
|
202
267
|
selectedCredential: FormattedSelectedCredentialEntry,
|
|
203
|
-
//TODO: Support multiplae credentials
|
|
204
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
205
268
|
hasMultipleCreds: boolean
|
|
206
269
|
) => {
|
|
207
270
|
const credential = credentialsRequested.find((c) => c.id === selectedCredential.id)
|
|
@@ -209,33 +272,38 @@ const OpenIDProofPresentation: React.FC<OpenIDProofPresentationProps> = ({
|
|
|
209
272
|
return null
|
|
210
273
|
}
|
|
211
274
|
const credentialDisplay = getCredentialForDisplay(credential)
|
|
212
|
-
const fields = buildFieldsFromW3cCredsCredential(credentialDisplay)
|
|
213
275
|
const requestedAttributes = selectedCredential.requestedAttributes
|
|
214
|
-
const
|
|
276
|
+
const fields = buildFieldsFromW3cCredsCredential(credentialDisplay, requestedAttributes)
|
|
215
277
|
return (
|
|
216
278
|
<CredentialCard
|
|
217
279
|
credential={credential}
|
|
218
|
-
displayItems={
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
280
|
+
displayItems={fields as Attribute[]}
|
|
281
|
+
hasAltCredentials={hasMultipleCreds}
|
|
282
|
+
handleAltCredChange={() => {
|
|
283
|
+
handleAltCredChange(sub.inputDescriptorId, selectedCredential.id, sub.inputDescriptorId)
|
|
284
|
+
}}
|
|
222
285
|
/>
|
|
223
286
|
)
|
|
224
287
|
}
|
|
225
288
|
|
|
226
289
|
const renderBody = () => {
|
|
227
|
-
if (!submission) return null
|
|
290
|
+
if (!selectedCredentialsSubmission || !submission) return null
|
|
228
291
|
|
|
229
292
|
return (
|
|
230
293
|
<View style={styles.credentialsList}>
|
|
231
|
-
{
|
|
294
|
+
{Object.entries(selectedCredentialsSubmission).map(([inputDescriptorId, credentialSimplified], i) => {
|
|
232
295
|
//TODO: Support multiplae credentials
|
|
233
|
-
const selectedCredential = s.credentials[0]
|
|
234
296
|
|
|
235
297
|
const globalSubmissionName = submission.name
|
|
236
298
|
const globalSubmissionPurpose = submission.purpose
|
|
237
|
-
const
|
|
238
|
-
const
|
|
299
|
+
const correspondingSubmission = submission.entries?.find((s) => s.inputDescriptorId === inputDescriptorId)
|
|
300
|
+
const submissionName = correspondingSubmission?.name
|
|
301
|
+
const submissionPurpose = correspondingSubmission?.purpose
|
|
302
|
+
const isSatisfied = correspondingSubmission?.isSatisfied
|
|
303
|
+
const credentialSubmittion = correspondingSubmission?.credentials.find(
|
|
304
|
+
(s) => s.id === credentialSimplified.id
|
|
305
|
+
)
|
|
306
|
+
const requestedAttributes = credentialSubmittion?.requestedAttributes
|
|
239
307
|
|
|
240
308
|
const name = submissionName || globalSubmissionName || undefined
|
|
241
309
|
const purpose = submissionPurpose || globalSubmissionPurpose || undefined
|
|
@@ -246,12 +314,16 @@ const OpenIDProofPresentation: React.FC<OpenIDProofPresentationProps> = ({
|
|
|
246
314
|
<View style={styles.cardGroupContainer}>
|
|
247
315
|
{name && purpose && (
|
|
248
316
|
<View style={styles.cardGroupHeader}>
|
|
249
|
-
<Text style={TextTheme.
|
|
250
|
-
<Text style={TextTheme.
|
|
317
|
+
<Text style={TextTheme.bold}>{name}</Text>
|
|
318
|
+
<Text style={TextTheme.labelTitle}>{purpose}</Text>
|
|
251
319
|
</View>
|
|
252
320
|
)}
|
|
253
|
-
{
|
|
254
|
-
renderCard(
|
|
321
|
+
{isSatisfied && requestedAttributes ? (
|
|
322
|
+
renderCard(
|
|
323
|
+
correspondingSubmission,
|
|
324
|
+
credentialSubmittion,
|
|
325
|
+
correspondingSubmission.credentials.length > 1
|
|
326
|
+
)
|
|
255
327
|
) : (
|
|
256
328
|
<Text style={TextTheme.normal}>{t('ProofRequest.CredentialNotInWallet')}</Text>
|
|
257
329
|
)}
|
|
@@ -295,14 +367,14 @@ const OpenIDProofPresentation: React.FC<OpenIDProofPresentationProps> = ({
|
|
|
295
367
|
backgroundColor: ColorPallet.brand.secondaryBackground,
|
|
296
368
|
}}
|
|
297
369
|
>
|
|
298
|
-
{
|
|
370
|
+
{selectedCredentialsSubmission && Object.keys(selectedCredentialsSubmission).length > 0 ? (
|
|
299
371
|
<>
|
|
300
372
|
{footerButton(
|
|
301
|
-
t('Global.
|
|
373
|
+
t('Global.Send'),
|
|
302
374
|
handleAcceptTouched,
|
|
303
375
|
ButtonType.Primary,
|
|
304
376
|
testIdWithKey('AcceptCredentialOffer'),
|
|
305
|
-
t('Global.
|
|
377
|
+
t('Global.Send')
|
|
306
378
|
)}
|
|
307
379
|
{footerButton(
|
|
308
380
|
t('Global.Decline'),
|
|
@@ -86,6 +86,7 @@ export interface W3cCredentialDisplay {
|
|
|
86
86
|
claimFormat: ClaimFormat
|
|
87
87
|
validUntil: Date | undefined
|
|
88
88
|
validFrom: Date | undefined
|
|
89
|
+
credentialSubject: CredentialSubjectRecord | undefined
|
|
89
90
|
}
|
|
90
91
|
|
|
91
92
|
export interface OpenId4VPRequestRecord extends OpenId4VcSiopResolvedAuthorizationRequest {
|
|
@@ -96,6 +97,13 @@ export interface OpenId4VPRequestRecord extends OpenId4VcSiopResolvedAuthorizati
|
|
|
96
97
|
type: string
|
|
97
98
|
}
|
|
98
99
|
|
|
100
|
+
interface DisplayInfo {
|
|
101
|
+
name: string
|
|
102
|
+
locale?: string
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
export type CredentialSubjectRecord = Record<string, { display: DisplayInfo[] }>
|
|
106
|
+
|
|
99
107
|
export enum OpenIDCredentialType {
|
|
100
108
|
W3cCredential,
|
|
101
109
|
SdJwtVc,
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { getDomainFromUrl } from '@credo-ts/core'
|
|
2
2
|
import { Attribute, Field } from '@bifold/oca/build/legacy'
|
|
3
|
-
import { W3cCredentialDisplay } from '../types'
|
|
4
3
|
|
|
5
4
|
/**
|
|
6
5
|
* Converts a camelCase string to a sentence format (first letter capitalized, rest in lower case).
|
|
@@ -53,19 +52,6 @@ export function formatDate(input: string | Date): string {
|
|
|
53
52
|
})
|
|
54
53
|
}
|
|
55
54
|
|
|
56
|
-
export const getAttributeField = (display: W3cCredentialDisplay, searchKey: string): Attribute | undefined => {
|
|
57
|
-
for (const [key, value] of Object.entries(display.attributes)) {
|
|
58
|
-
if (searchKey === key) {
|
|
59
|
-
return new Attribute({
|
|
60
|
-
name: key,
|
|
61
|
-
value: value as string | number | null,
|
|
62
|
-
mimeType: typeof value === 'number' ? 'text/number' : 'text/plain',
|
|
63
|
-
})
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
return undefined
|
|
67
|
-
}
|
|
68
|
-
|
|
69
55
|
/**
|
|
70
56
|
* Mostly used for mdoc crednetials
|
|
71
57
|
*/
|
|
@@ -3,7 +3,7 @@ import React from 'react'
|
|
|
3
3
|
import { useTranslation } from 'react-i18next'
|
|
4
4
|
|
|
5
5
|
import { useTheme } from '../contexts/theme'
|
|
6
|
-
import
|
|
6
|
+
import RenameWallet from '../screens/RenameWallet'
|
|
7
7
|
import PasteUrl from '../screens/PasteUrl'
|
|
8
8
|
import ScanHelp from '../screens/ScanHelp'
|
|
9
9
|
import { ConnectStackParams, Screens } from '../types/navigators'
|
|
@@ -53,12 +53,12 @@ const ConnectStack: React.FC = () => {
|
|
|
53
53
|
/>
|
|
54
54
|
|
|
55
55
|
<Stack.Screen
|
|
56
|
-
name={Screens.
|
|
57
|
-
component={
|
|
56
|
+
name={Screens.RenameWallet}
|
|
57
|
+
component={RenameWallet}
|
|
58
58
|
options={{
|
|
59
59
|
title: t('Screens.NameWallet'),
|
|
60
60
|
headerBackTestID: testIdWithKey('Back'),
|
|
61
|
-
...ScreenOptionsDictionary[Screens.
|
|
61
|
+
...ScreenOptionsDictionary[Screens.RenameWallet],
|
|
62
62
|
}}
|
|
63
63
|
/>
|
|
64
64
|
</Stack.Navigator>
|
|
@@ -13,6 +13,7 @@ import { useDefaultStackOptions } from './defaultStackOptions'
|
|
|
13
13
|
import OpenIDProofPresentation from '../modules/openid/screens/OpenIDProofPresentation'
|
|
14
14
|
import { TOKENS, useServices } from '../container-api'
|
|
15
15
|
import OpenIDCredentialOffer from '../modules/openid/screens/OpenIDCredentialOffer'
|
|
16
|
+
import OpenIDProofCredentialSelect from '../modules/openid/screens/OpenIDProofChangeCredential'
|
|
16
17
|
|
|
17
18
|
const DeliveryStack: React.FC = () => {
|
|
18
19
|
const Stack = createStackNavigator<DeliveryStackParams>()
|
|
@@ -67,6 +68,14 @@ const DeliveryStack: React.FC = () => {
|
|
|
67
68
|
...ScreenOptionsDictionary[Screens.OpenIDProofPresentation],
|
|
68
69
|
}}
|
|
69
70
|
/>
|
|
71
|
+
<Stack.Screen
|
|
72
|
+
name={Screens.OpenIDProofCredentialSelect}
|
|
73
|
+
component={OpenIDProofCredentialSelect}
|
|
74
|
+
options={{
|
|
75
|
+
title: t('Screens.ProofRequest'),
|
|
76
|
+
...ScreenOptionsDictionary[Screens.OpenIDProofCredentialSelect],
|
|
77
|
+
}}
|
|
78
|
+
/>
|
|
70
79
|
</Stack.Navigator>
|
|
71
80
|
)
|
|
72
81
|
}
|
|
@@ -20,7 +20,6 @@ interface ScreenComponents {
|
|
|
20
20
|
NameWallet: React.FC<StackScreenProps<ParamListBase>>
|
|
21
21
|
Biometry: React.FC<StackScreenProps<ParamListBase>>
|
|
22
22
|
PushNotifications: React.FC<StackScreenProps<ParamListBase>>
|
|
23
|
-
Developer: React.FC<StackScreenProps<ParamListBase>>
|
|
24
23
|
AttemptLockout: React.FC<StackScreenProps<ParamListBase>>
|
|
25
24
|
OnboardingScreen: React.FC
|
|
26
25
|
CreatePINScreen: React.FC
|
|
@@ -119,15 +118,6 @@ export const getOnboardingScreens = (
|
|
|
119
118
|
...ScreenOptionsDictionary[Screens.PushNotifications],
|
|
120
119
|
}),
|
|
121
120
|
},
|
|
122
|
-
{
|
|
123
|
-
name: Screens.Developer,
|
|
124
|
-
component: components.Developer,
|
|
125
|
-
options: () => ({
|
|
126
|
-
title: t('Screens.Developer'),
|
|
127
|
-
headerBackAccessibilityLabel: t('Global.Back'),
|
|
128
|
-
...ScreenOptionsDictionary[Screens.Developer],
|
|
129
|
-
}),
|
|
130
|
-
},
|
|
131
121
|
{
|
|
132
122
|
name: Screens.EnterPIN,
|
|
133
123
|
children: components.EnterPINScreen,
|