Skip to content

Commit

Permalink
Merge pull request #92 from CQEN-QDCE/fetch/bcgov-main-8e653bd
Browse files Browse the repository at this point in the history
Fetch Upstream - main 8e653bd
  • Loading branch information
jcdrouin21 authored Apr 20, 2023
2 parents bf46ec3 + 1559295 commit 58d212c
Show file tree
Hide file tree
Showing 9 changed files with 326 additions and 22 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -167,10 +167,10 @@ jobs:
- name: Update ledgers
run: |
node bifold/scripts/make-blocks.js
# the ledgers file should be about 344K
ls -lah ledgers.json
mv ledgers.json bifold/packages/legacy/core/configs/ledgers/indy/ledgers.json
shasum bifold/packages/legacy/core/configs/ledgers/indy/ledgers.json
Expand Down Expand Up @@ -250,7 +250,7 @@ jobs:
-u "$LAMBDA_USERNAME:$LAMBDA_ACCESS_KEY" \
--location --request POST 'https://manual-api.lambdatest.com/app/upload/realDevice' \
--form 'appFile=@"export/AriesBifold.ipa"' \
--form "name=AriesBifold-$GITHUB_RUN_NUMBER.ipa" \
--form "name=QCWallet-$GITHUB_RUN_NUMBER.ipa" \
build-android:
# if: ${{ false }} # disable for now
Expand Down Expand Up @@ -368,7 +368,7 @@ jobs:
-u "$LAMBDA_USERNAME:$LAMBDA_ACCESS_KEY" \
--location --request POST 'https://manual-api.lambdatest.com/app/upload/realDevice' \
--form 'appFile=@"app/build/outputs/bundle/release/app-release.aab"' \
--form "name=AriesBifold-$GITHUB_RUN_NUMBER.aab" \
--form "name=QCWallet-$GITHUB_RUN_NUMBER.aab" \
release:
if: github.ref_name == 'main' && needs.check-android-secrets.outputs.isReleaseBuild == 'true'&& needs.check-ios-secrets.outputs.isReleaseBuild == 'true'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "13B07F861A680F5B00A75B9A"
BuildableName = "AriesBifold.app"
BuildableName = "BCWallet.app"
BlueprintName = "AriesBifold"
ReferencedContainer = "container:AriesBifold.xcodeproj">
</BuildableReference>
Expand Down Expand Up @@ -55,7 +55,7 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "13B07F861A680F5B00A75B9A"
BuildableName = "AriesBifold.app"
BuildableName = "BCWallet.app"
BlueprintName = "AriesBifold"
ReferencedContainer = "container:AriesBifold.xcodeproj">
</BuildableReference>
Expand All @@ -72,7 +72,7 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "13B07F861A680F5B00A75B9A"
BuildableName = "AriesBifold.app"
BuildableName = "BCWallet.app"
BlueprintName = "AriesBifold"
ReferencedContainer = "container:AriesBifold.xcodeproj">
</BuildableReference>
Expand Down
2 changes: 1 addition & 1 deletion app/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 11 additions & 2 deletions app/src/hooks/notifications.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
import { useCredentialByState, useProofByState } from '@aries-framework/react-hooks'
import { useStore } from 'aries-bifold'
import { CredentialMetadata, customMetadata } from 'aries-bifold/App/types/metadata'
import { ProofCustomMetadata, ProofMetadata } from 'aries-bifold/verifier'

import { getInvitationCredentialDate, showBCIDSelector } from '../helpers/BCIDHelper'
import { BCState } from '../store'
Expand All @@ -26,7 +27,15 @@ interface Notifications {
export const useNotifications = (): Notifications => {
const [store] = useStore<BCState>()
const offers = useCredentialByState(CredentialState.OfferReceived)
const proofs = useProofByState(ProofState.RequestReceived)
const proofsRequested = useProofByState(ProofState.RequestReceived)
const proofsDone = useProofByState([ProofState.Done, ProofState.PresentationReceived]).filter(
(proof: ProofExchangeRecord) => {
if (proof.isVerified === undefined) return false

const metadata = proof.metadata.get(ProofMetadata.customMetadata) as ProofCustomMetadata
return !metadata?.details_seen
}
)
const revoked = useCredentialByState(CredentialState.Done).filter((cred: CredentialRecord) => {
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
const metadata = cred!.metadata.get(CredentialMetadata.customMetadata) as customMetadata
Expand All @@ -50,7 +59,7 @@ export const useNotifications = (): Notifications => {
? [{ type: 'CustomNotification', createdAt: invitationDate, id: 'custom' }]
: []

const notifications = [...offers, ...proofs, ...revoked, ...custom].sort(
const notifications = [...offers, ...proofsRequested, ...proofsDone, ...revoked, ...custom].sort(
(a, b) => new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime()
)

Expand Down
2 changes: 2 additions & 0 deletions app/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import { useNotifications } from './hooks/notifications'
import en from './localization/en'
import fr from './localization/fr'
import TermsStack from './navigators/TermsStack'
import { proofRequestTemplates } from './request-templates'
import Developer from './screens/Developer'
import { pages } from './screens/OnboardingPages'
import PersonCredential from './screens/PersonCredential'
Expand Down Expand Up @@ -66,6 +67,7 @@ const configuration: ConfigurationContext = {
buttonTitle: 'PersonCredentialNotification.ButtonTitle',
},
useCustomNotifications: useNotifications,
proofRequestTemplates,
}

export default { theme, localization, configuration }
151 changes: 151 additions & 0 deletions app/src/request-templates.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
import { PredicateType } from '@aries-framework/core'
import { ProofRequestTemplate, ProofRequestType } from 'aries-bifold'

export const proofRequestTemplates: Array<ProofRequestTemplate> = [
{
id: 'BC:5:FullName:0.0.1:indy',
name: 'Full name',
description: 'Verify the full name of a person',
version: '0.0.1',
payload: {
type: ProofRequestType.Indy,
data: [
{
schema: 'XUxBrVSALWHLeycAUhrNr9:2:Person:1.0',
requestedAttributes: [
{
name: 'given_names',
restrictions: [{ schema_id: 'XUxBrVSALWHLeycAUhrNr9:2:Person:1.0' }],
},
{
name: 'family_name',
restrictions: [{ schema_id: 'XUxBrVSALWHLeycAUhrNr9:2:Person:1.0' }],
},
],
},
],
},
},
{
id: 'BC:5:19+AndFullName:0.0.1:indy',
name: '19+ and Full name',
description: 'Verify if a person is 19 years end up and full name.',
version: '0.0.1',
payload: {
type: ProofRequestType.Indy,
data: [
{
schema: 'XUxBrVSALWHLeycAUhrNr9:2:Person:1.0',
requestedAttributes: [
{
names: ['given_names', 'family_name'],
restrictions: [{ schema_id: 'XUxBrVSALWHLeycAUhrNr9:2:Person:1.0' }],
},
],
requestedPredicates: [
{
name: 'birthdate_dateint',
predicateType: PredicateType.GreaterThanOrEqualTo,
predicateValue: 18,
restrictions: [{ schema_id: 'XUxBrVSALWHLeycAUhrNr9:2:Person:1.0' }],
},
],
},
],
},
},
{
id: 'BC:5:Over19YearsOfAge:0.0.1:indy',
name: 'Over 19 years of age',
description: 'Verify if a person is 19 years end up.',
version: '0.0.1',
payload: {
type: ProofRequestType.Indy,
data: [
{
schema: 'XUxBrVSALWHLeycAUhrNr9:2:Person:1.0',
requestedPredicates: [
{
name: 'birthdate_dateint',
predicateType: PredicateType.GreaterThanOrEqualTo,
predicateValue: 18,
restrictions: [{ schema_id: 'XUxBrVSALWHLeycAUhrNr9:2:Person:1.0' }],
},
],
},
],
},
},
{
id: 'BC:5:PractisingLawyer:0.0.1:indy',
name: 'Practising lawyer',
description: 'Verify if a person`is a practicing lawyer.',
version: '0.0.1',
payload: {
type: ProofRequestType.Indy,
data: [
{
schema: 'XUxBrVSALWHLeycAUhrNr9:2:Member Card:1.5.1',
requestedAttributes: [
{
names: ['Given Name', 'Surname', 'PPID', 'Member Status'],
restrictions: [{ schema_id: 'XUxBrVSALWHLeycAUhrNr9:2:Member Card:1.5.1' }],
},
],
},
],
},
},
{
id: 'BC:5:PractisingLawyerAndFullName:0.0.1:indy',
name: 'Practising lawyer and full name',
description: 'Verify if a person`is a practicing lawyer using two different credentials for extra assurance',
version: '0.0.1',
payload: {
type: ProofRequestType.Indy,
data: [
{
schema: 'XUxBrVSALWHLeycAUhrNr9:2:Person:1.0',
requestedAttributes: [
{
names: ['given_names', 'family_name'],
restrictions: [{ schema_id: 'XUxBrVSALWHLeycAUhrNr9:2:Person:1.0' }],
},
],
},
{
schema: 'XUxBrVSALWHLeycAUhrNr9:2:Member Card:1.5.1',
requestedAttributes: [
{
names: ['Given Name', 'Surname', 'PPID', 'Member Status'],
restrictions: [{ schema_id: 'XUxBrVSALWHLeycAUhrNr9:2:Member Card:1.5.1' }],
},
],
},
],
},
},
{
id: 'BC:5:OverSomeYearsOfAge:0.0.1:indy',
name: 'Over some years of age',
description: 'Verify if a person is over some years ends up.',
version: '0.0.1',
payload: {
type: ProofRequestType.Indy,
data: [
{
schema: 'XUxBrVSALWHLeycAUhrNr9:2:Person:1.0',
requestedPredicates: [
{
name: 'birthdate_dateint',
predicateType: PredicateType.GreaterThanOrEqualTo,
predicateValue: 18,
parameterizable: true,
restrictions: [{ schema_id: 'XUxBrVSALWHLeycAUhrNr9:2:Person:1.0' }],
},
],
},
],
},
},
]
47 changes: 45 additions & 2 deletions app/src/screens/Developer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ const Settings: React.FC = () => {
const { SettingsTheme, TextTheme, ColorPallet } = useTheme()
const [environmentModalVisible, setEnvironmentModalVisible] = useState<boolean>(false)
const [devMode, setDevMode] = useState<boolean>(true)
const [useVerifierCapability, setUseVerifierCapability] = useState<boolean>(!!store.preferences.useVerifierCapability)
const [useConnectionInviterCapability, setConnectionInviterCapability] = useState(
!!store.preferences.useConnectionInviterCapability
)

const styles = StyleSheet.create({
container: {
Expand Down Expand Up @@ -135,8 +139,10 @@ const Settings: React.FC = () => {
style={styles.sectionRow}
onPress={onPress}
>
<Text style={[TextTheme.headingFour, { fontWeight: 'normal' }]}>{title}</Text>
<Text style={[TextTheme.headingFour, { fontWeight: 'normal', color: ColorPallet.brand.link }]}>{value}</Text>
<Text style={[TextTheme.headingFour, { fontWeight: 'normal', maxWidth: '90%' }]}>{title}</Text>
<Text style={[TextTheme.headingFour, { fontWeight: 'normal', maxWidth: '90%', color: ColorPallet.brand.link }]}>
{value}
</Text>
{children}
</TouchableOpacity>
</View>
Expand All @@ -150,6 +156,22 @@ const Settings: React.FC = () => {
setDevMode(!devMode)
}

const toggleVerifierCapabilitySwitch = () => {
dispatch({
type: DispatchAction.USE_VERIFIER_CAPABILITY,
payload: [!useVerifierCapability],
})
setUseVerifierCapability((previousState) => !previousState)
}

const toggleConnectionInviterCapabilitySwitch = () => {
dispatch({
type: DispatchAction.USE_CONNECTION_INVITER_CAPABILITY,
payload: [!useConnectionInviterCapability],
})
setConnectionInviterCapability((previousState) => !previousState)
}

return (
<SafeAreaView edges={['bottom', 'left', 'right']}>
<Modal
Expand Down Expand Up @@ -199,6 +221,27 @@ const Settings: React.FC = () => {
sections={settingsSections}
stickySectionHeadersEnabled={false}
></SectionList>
<SectionRow title={t('Verifier.UseVerifierCapability')}>
<Switch
accessibilityLabel={t('Verifier.Toggle')}
testID={testIdWithKey('ToggleVerifierCapability')}
trackColor={{ false: ColorPallet.grayscale.lightGrey, true: ColorPallet.brand.primaryDisabled }}
thumbColor={useVerifierCapability ? ColorPallet.brand.primary : ColorPallet.grayscale.mediumGrey}
ios_backgroundColor={ColorPallet.grayscale.lightGrey}
onValueChange={toggleVerifierCapabilitySwitch}
value={useVerifierCapability}
/>
</SectionRow>
<SectionRow title={t('Connection.UseConnectionInviterCapability')}>
<Switch
testID={testIdWithKey('ToggleConnectionInviterCapabilitySwitch')}
trackColor={{ false: ColorPallet.grayscale.lightGrey, true: ColorPallet.brand.primaryDisabled }}
thumbColor={useConnectionInviterCapability ? ColorPallet.brand.primary : ColorPallet.grayscale.mediumGrey}
ios_backgroundColor={ColorPallet.grayscale.lightGrey}
onValueChange={toggleConnectionInviterCapabilitySwitch}
value={useConnectionInviterCapability}
/>
</SectionRow>
</View>
</SafeAreaView>
)
Expand Down
Loading

0 comments on commit 58d212c

Please sign in to comment.