@procivis/one-react-native-components 0.3.62 → 0.3.86
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/credential/credential.js +8 -2
- package/lib/commonjs/components/credential/credential.js.map +1 -1
- package/lib/commonjs/components/proof-request/index.js +23 -12
- package/lib/commonjs/components/proof-request/index.js.map +1 -1
- package/lib/commonjs/components/proof-request/select-share-credential-card-notice.js +37 -0
- package/lib/commonjs/components/proof-request/select-share-credential-card-notice.js.map +1 -0
- package/lib/commonjs/components/proof-request/share-credential-card-notice.js +36 -0
- package/lib/commonjs/components/proof-request/share-credential-card-notice.js.map +1 -0
- package/lib/commonjs/components/proof-request/{group.js → v1/group.js} +1 -1
- package/lib/commonjs/components/proof-request/v1/group.js.map +1 -0
- package/lib/commonjs/components/proof-request/v1/index.js +39 -0
- package/lib/commonjs/components/proof-request/v1/index.js.map +1 -0
- package/lib/commonjs/components/proof-request/{select-credential.js → v1/select-credential.js} +12 -6
- package/lib/commonjs/components/proof-request/v1/select-credential.js.map +1 -0
- package/lib/commonjs/components/proof-request/{share-credential.js → v1/share-credential.js} +33 -62
- package/lib/commonjs/components/proof-request/v1/share-credential.js.map +1 -0
- package/lib/commonjs/components/proof-request/v2/index.js +39 -0
- package/lib/commonjs/components/proof-request/v2/index.js.map +1 -0
- package/lib/commonjs/components/proof-request/v2/select-credential-v2.js +55 -0
- package/lib/commonjs/components/proof-request/v2/select-credential-v2.js.map +1 -0
- package/lib/commonjs/components/proof-request/v2/share-credential-v2-group.js +164 -0
- package/lib/commonjs/components/proof-request/v2/share-credential-v2-group.js.map +1 -0
- package/lib/commonjs/components/proof-request/v2/share-credential-v2.js +135 -0
- package/lib/commonjs/components/proof-request/v2/share-credential-v2.js.map +1 -0
- package/lib/commonjs/ui-components/buttons/index.js +7 -0
- package/lib/commonjs/ui-components/buttons/index.js.map +1 -1
- package/lib/commonjs/ui-components/buttons/share-button.js +54 -0
- package/lib/commonjs/ui-components/buttons/share-button.js.map +1 -0
- package/lib/commonjs/ui-components/camera/qr-code-scanner.js +5 -1
- package/lib/commonjs/ui-components/camera/qr-code-scanner.js.map +1 -1
- package/lib/commonjs/ui-components/credential/card/credential-details-list-item.js +16 -42
- package/lib/commonjs/ui-components/credential/card/credential-details-list-item.js.map +1 -1
- package/lib/commonjs/ui-components/credential/credential-attribute-item.js +3 -1
- package/lib/commonjs/ui-components/credential/credential-attribute-item.js.map +1 -1
- package/lib/commonjs/ui-components/credential/group/credential-group-header.js +72 -0
- package/lib/commonjs/ui-components/credential/group/credential-group-header.js.map +1 -0
- package/lib/commonjs/ui-components/credential/group/index.js +14 -0
- package/lib/commonjs/ui-components/credential/group/index.js.map +1 -0
- package/lib/commonjs/ui-components/credential/index.js +12 -0
- package/lib/commonjs/ui-components/credential/index.js.map +1 -1
- package/lib/commonjs/ui-components/header/foldable-header.js +29 -17
- package/lib/commonjs/ui-components/header/foldable-header.js.map +1 -1
- package/lib/commonjs/ui-components/icons/icons.js +24 -1
- package/lib/commonjs/ui-components/icons/icons.js.map +1 -1
- package/lib/commonjs/ui-components/index.js +22 -0
- package/lib/commonjs/ui-components/index.js.map +1 -1
- package/lib/commonjs/ui-components/loader/loading-result.js +8 -1
- package/lib/commonjs/ui-components/loader/loading-result.js.map +1 -1
- package/lib/commonjs/ui-components/nfc/index.js +14 -0
- package/lib/commonjs/ui-components/nfc/index.js.map +1 -0
- package/lib/commonjs/ui-components/nfc/nfc-process.js +77 -0
- package/lib/commonjs/ui-components/nfc/nfc-process.js.map +1 -0
- package/lib/commonjs/ui-components/pin/pin-lock-animation.js +477 -475
- package/lib/commonjs/ui-components/pin/pin-lock-animation.js.map +1 -1
- package/lib/commonjs/ui-components/proof-request/index.js +13 -0
- package/lib/commonjs/ui-components/proof-request/index.js.map +1 -0
- package/lib/commonjs/ui-components/proof-request/proof-request-set.js +47 -0
- package/lib/commonjs/ui-components/proof-request/proof-request-set.js.map +1 -0
- package/lib/commonjs/ui-components/screens/section-list-screen.js +37 -8
- package/lib/commonjs/ui-components/screens/section-list-screen.js.map +1 -1
- package/lib/commonjs/utils/array.js.map +1 -1
- package/lib/commonjs/utils/hooks/app-state.js +33 -0
- package/lib/commonjs/utils/hooks/app-state.js.map +1 -0
- package/lib/commonjs/utils/hooks/core/backup.js +4 -5
- package/lib/commonjs/utils/hooks/core/backup.js.map +1 -1
- package/lib/commonjs/utils/hooks/core/core-init.js +4 -22
- package/lib/commonjs/utils/hooks/core/core-init.js.map +1 -1
- package/lib/commonjs/utils/hooks/core/credentials.js +10 -3
- package/lib/commonjs/utils/hooks/core/credentials.js.map +1 -1
- package/lib/commonjs/utils/hooks/core/identifiers.js +1 -1
- package/lib/commonjs/utils/hooks/core/identifiers.js.map +1 -1
- package/lib/commonjs/utils/hooks/core/index.js +11 -0
- package/lib/commonjs/utils/hooks/core/index.js.map +1 -1
- package/lib/commonjs/utils/hooks/core/proofs.js +45 -8
- package/lib/commonjs/utils/hooks/core/proofs.js.map +1 -1
- package/lib/commonjs/utils/hooks/core/wallet-unit.js +85 -0
- package/lib/commonjs/utils/hooks/core/wallet-unit.js.map +1 -0
- package/lib/commonjs/utils/hooks/index.js +22 -0
- package/lib/commonjs/utils/hooks/index.js.map +1 -1
- package/lib/commonjs/utils/hooks/nfc/nfc-status.js +40 -0
- package/lib/commonjs/utils/hooks/nfc/nfc-status.js.map +1 -0
- package/lib/commonjs/utils/hooks/revocation/credential-status.js +1 -1
- package/lib/commonjs/utils/hooks/revocation/credential-status.js.map +1 -1
- package/lib/commonjs/utils/index.js +24 -0
- package/lib/commonjs/utils/index.js.map +1 -1
- package/lib/commonjs/utils/parsers/credential-sharing-v2.js +190 -0
- package/lib/commonjs/utils/parsers/credential-sharing-v2.js.map +1 -0
- package/lib/commonjs/utils/parsers/credential-sharing.js +31 -18
- package/lib/commonjs/utils/parsers/credential-sharing.js.map +1 -1
- package/lib/commonjs/utils/parsers/credential.js +111 -63
- package/lib/commonjs/utils/parsers/credential.js.map +1 -1
- package/lib/commonjs/utils/parsers/index.js +11 -0
- package/lib/commonjs/utils/parsers/index.js.map +1 -1
- package/lib/commonjs/utils/parsers/query.js +4 -4
- package/lib/commonjs/utils/parsers/query.js.map +1 -1
- package/lib/commonjs/utils/url.js +80 -0
- package/lib/commonjs/utils/url.js.map +1 -0
- package/lib/commonjs/utils/wallet-unit.js +30 -0
- package/lib/commonjs/utils/wallet-unit.js.map +1 -0
- package/lib/module/components/credential/credential.js +8 -2
- package/lib/module/components/credential/credential.js.map +1 -1
- package/lib/module/components/proof-request/index.js +4 -3
- package/lib/module/components/proof-request/index.js.map +1 -1
- package/lib/module/components/proof-request/select-share-credential-card-notice.js +29 -0
- package/lib/module/components/proof-request/select-share-credential-card-notice.js.map +1 -0
- package/lib/module/components/proof-request/share-credential-card-notice.js +28 -0
- package/lib/module/components/proof-request/share-credential-card-notice.js.map +1 -0
- package/lib/module/components/proof-request/{group.js → v1/group.js} +1 -1
- package/lib/module/components/proof-request/v1/group.js.map +1 -0
- package/lib/module/components/proof-request/v1/index.js +4 -0
- package/lib/module/components/proof-request/v1/index.js.map +1 -0
- package/lib/module/components/proof-request/{select-credential.js → v1/select-credential.js} +12 -6
- package/lib/module/components/proof-request/v1/select-credential.js.map +1 -0
- package/lib/module/components/proof-request/v1/share-credential.js +118 -0
- package/lib/module/components/proof-request/v1/share-credential.js.map +1 -0
- package/lib/module/components/proof-request/v2/index.js +4 -0
- package/lib/module/components/proof-request/v2/index.js.map +1 -0
- package/lib/module/components/proof-request/v2/select-credential-v2.js +46 -0
- package/lib/module/components/proof-request/v2/select-credential-v2.js.map +1 -0
- package/lib/module/components/proof-request/v2/share-credential-v2-group.js +154 -0
- package/lib/module/components/proof-request/v2/share-credential-v2-group.js.map +1 -0
- package/lib/module/components/proof-request/v2/share-credential-v2.js +126 -0
- package/lib/module/components/proof-request/v2/share-credential-v2.js.map +1 -0
- package/lib/module/ui-components/buttons/index.js +2 -1
- package/lib/module/ui-components/buttons/index.js.map +1 -1
- package/lib/module/ui-components/buttons/share-button.js +47 -0
- package/lib/module/ui-components/buttons/share-button.js.map +1 -0
- package/lib/module/ui-components/camera/qr-code-scanner.js +5 -1
- package/lib/module/ui-components/camera/qr-code-scanner.js.map +1 -1
- package/lib/module/ui-components/credential/card/credential-details-list-item.js +19 -45
- package/lib/module/ui-components/credential/card/credential-details-list-item.js.map +1 -1
- package/lib/module/ui-components/credential/credential-attribute-item.js +3 -1
- package/lib/module/ui-components/credential/credential-attribute-item.js.map +1 -1
- package/lib/module/ui-components/credential/group/credential-group-header.js +64 -0
- package/lib/module/ui-components/credential/group/credential-group-header.js.map +1 -0
- package/lib/module/ui-components/credential/group/index.js +3 -0
- package/lib/module/ui-components/credential/group/index.js.map +1 -0
- package/lib/module/ui-components/credential/index.js +1 -0
- package/lib/module/ui-components/credential/index.js.map +1 -1
- package/lib/module/ui-components/header/foldable-header.js +29 -17
- package/lib/module/ui-components/header/foldable-header.js.map +1 -1
- package/lib/module/ui-components/icons/icons.js +22 -0
- package/lib/module/ui-components/icons/icons.js.map +1 -1
- package/lib/module/ui-components/index.js +2 -0
- package/lib/module/ui-components/index.js.map +1 -1
- package/lib/module/ui-components/loader/loading-result.js +8 -1
- package/lib/module/ui-components/loader/loading-result.js.map +1 -1
- package/lib/module/ui-components/nfc/index.js +3 -0
- package/lib/module/ui-components/nfc/index.js.map +1 -0
- package/lib/module/ui-components/nfc/nfc-process.js +69 -0
- package/lib/module/ui-components/nfc/nfc-process.js.map +1 -0
- package/lib/module/ui-components/pin/pin-lock-animation.js +477 -475
- package/lib/module/ui-components/pin/pin-lock-animation.js.map +1 -1
- package/lib/module/ui-components/proof-request/index.js +3 -0
- package/lib/module/ui-components/proof-request/index.js.map +1 -0
- package/lib/module/ui-components/proof-request/proof-request-set.js +39 -0
- package/lib/module/ui-components/proof-request/proof-request-set.js.map +1 -0
- package/lib/module/ui-components/screens/section-list-screen.js +36 -9
- package/lib/module/ui-components/screens/section-list-screen.js.map +1 -1
- package/lib/module/utils/array.js.map +1 -1
- package/lib/module/utils/hooks/app-state.js +27 -0
- package/lib/module/utils/hooks/app-state.js.map +1 -0
- package/lib/module/utils/hooks/core/backup.js +5 -6
- package/lib/module/utils/hooks/core/backup.js.map +1 -1
- package/lib/module/utils/hooks/core/core-init.js +3 -20
- package/lib/module/utils/hooks/core/core-init.js.map +1 -1
- package/lib/module/utils/hooks/core/credentials.js +11 -4
- package/lib/module/utils/hooks/core/credentials.js.map +1 -1
- package/lib/module/utils/hooks/core/identifiers.js +5 -5
- package/lib/module/utils/hooks/core/identifiers.js.map +1 -1
- package/lib/module/utils/hooks/core/index.js +1 -0
- package/lib/module/utils/hooks/core/index.js.map +1 -1
- package/lib/module/utils/hooks/core/proofs.js +45 -8
- package/lib/module/utils/hooks/core/proofs.js.map +1 -1
- package/lib/module/utils/hooks/core/wallet-unit.js +75 -0
- package/lib/module/utils/hooks/core/wallet-unit.js.map +1 -0
- package/lib/module/utils/hooks/index.js +2 -0
- package/lib/module/utils/hooks/index.js.map +1 -1
- package/lib/module/utils/hooks/nfc/nfc-status.js +32 -0
- package/lib/module/utils/hooks/nfc/nfc-status.js.map +1 -0
- package/lib/module/utils/hooks/revocation/credential-status.js +1 -1
- package/lib/module/utils/hooks/revocation/credential-status.js.map +1 -1
- package/lib/module/utils/index.js +2 -0
- package/lib/module/utils/index.js.map +1 -1
- package/lib/module/utils/parsers/credential-sharing-v2.js +177 -0
- package/lib/module/utils/parsers/credential-sharing-v2.js.map +1 -0
- package/lib/module/utils/parsers/credential-sharing.js +31 -18
- package/lib/module/utils/parsers/credential-sharing.js.map +1 -1
- package/lib/module/utils/parsers/credential.js +112 -64
- package/lib/module/utils/parsers/credential.js.map +1 -1
- package/lib/module/utils/parsers/index.js +1 -0
- package/lib/module/utils/parsers/index.js.map +1 -1
- package/lib/module/utils/parsers/query.js +4 -4
- package/lib/module/utils/parsers/query.js.map +1 -1
- package/lib/module/utils/url.js +71 -0
- package/lib/module/utils/url.js.map +1 -0
- package/lib/module/utils/wallet-unit.js +22 -0
- package/lib/module/utils/wallet-unit.js.map +1 -0
- package/lib/typescript/components/proof-request/index.d.ts +4 -3
- package/lib/typescript/components/proof-request/select-share-credential-card-notice.d.ts +7 -0
- package/lib/typescript/components/proof-request/share-credential-card-notice.d.ts +6 -0
- package/lib/typescript/components/proof-request/v1/index.d.ts +3 -0
- package/lib/typescript/components/proof-request/{select-credential.d.ts → v1/select-credential.d.ts} +1 -1
- package/lib/typescript/components/proof-request/{share-credential.d.ts → v1/share-credential.d.ts} +1 -1
- package/lib/typescript/components/proof-request/v2/index.d.ts +3 -0
- package/lib/typescript/components/proof-request/v2/select-credential-v2.d.ts +14 -0
- package/lib/typescript/components/proof-request/v2/share-credential-v2-group.d.ts +24 -0
- package/lib/typescript/components/proof-request/v2/share-credential-v2.d.ts +23 -0
- package/lib/typescript/ui-components/buttons/index.d.ts +3 -1
- package/lib/typescript/ui-components/buttons/share-button.d.ts +10 -0
- package/lib/typescript/ui-components/credential/group/credential-group-header.d.ts +10 -0
- package/lib/typescript/ui-components/credential/group/index.d.ts +3 -0
- package/lib/typescript/ui-components/credential/index.d.ts +1 -0
- package/lib/typescript/ui-components/header/foldable-header.d.ts +1 -0
- package/lib/typescript/ui-components/icons/icons.d.ts +1 -0
- package/lib/typescript/ui-components/index.d.ts +2 -0
- package/lib/typescript/ui-components/loader/loading-result.d.ts +2 -0
- package/lib/typescript/ui-components/nfc/index.d.ts +2 -0
- package/lib/typescript/ui-components/nfc/nfc-process.d.ts +17 -0
- package/lib/typescript/ui-components/pin/pin-lock-animation.d.ts +311 -311
- package/lib/typescript/ui-components/proof-request/index.d.ts +3 -0
- package/lib/typescript/ui-components/proof-request/proof-request-set.d.ts +7 -0
- package/lib/typescript/ui-components/screens/section-list-screen.d.ts +5 -2
- package/lib/typescript/utils/array.d.ts +1 -0
- package/lib/typescript/utils/hooks/app-state.d.ts +5 -0
- package/lib/typescript/utils/hooks/core/backup.d.ts +1 -1
- package/lib/typescript/utils/hooks/core/core-init.d.ts +1 -3
- package/lib/typescript/utils/hooks/core/credentials.d.ts +1 -1
- package/lib/typescript/utils/hooks/core/identifiers.d.ts +1 -1
- package/lib/typescript/utils/hooks/core/index.d.ts +1 -0
- package/lib/typescript/utils/hooks/core/proofs.d.ts +10 -3
- package/lib/typescript/utils/hooks/core/wallet-unit.d.ts +9 -0
- package/lib/typescript/utils/hooks/index.d.ts +2 -0
- package/lib/typescript/utils/hooks/nfc/nfc-status.d.ts +6 -0
- package/lib/typescript/utils/index.d.ts +2 -0
- package/lib/typescript/utils/parsers/credential-sharing-v2.d.ts +11 -0
- package/lib/typescript/utils/parsers/credential-sharing.d.ts +11 -5
- package/lib/typescript/utils/parsers/credential.d.ts +9 -6
- package/lib/typescript/utils/parsers/index.d.ts +1 -0
- package/lib/typescript/utils/parsers/query.d.ts +2 -2
- package/lib/typescript/utils/url.d.ts +19 -0
- package/lib/typescript/utils/wallet-unit.d.ts +8 -0
- package/package.json +16 -6
- package/src/components/credential/credential.tsx +5 -1
- package/src/components/proof-request/index.ts +4 -3
- package/src/components/proof-request/select-share-credential-card-notice.tsx +37 -0
- package/src/components/proof-request/share-credential-card-notice.tsx +33 -0
- package/src/components/proof-request/{group.tsx → v1/group.tsx} +1 -1
- package/src/components/proof-request/v1/index.ts +3 -0
- package/src/components/proof-request/{select-credential.tsx → v1/select-credential.tsx} +12 -5
- package/src/components/proof-request/{share-credential.tsx → v1/share-credential.tsx} +35 -52
- package/src/components/proof-request/v2/index.ts +3 -0
- package/src/components/proof-request/v2/select-credential-v2.tsx +59 -0
- package/src/components/proof-request/v2/share-credential-v2-group.tsx +258 -0
- package/src/components/proof-request/v2/share-credential-v2.tsx +211 -0
- package/src/ui-components/buttons/index.ts +4 -0
- package/src/ui-components/buttons/share-button.stories.tsx +25 -0
- package/src/ui-components/buttons/share-button.tsx +55 -0
- package/src/ui-components/camera/qr-code-scanner.tsx +11 -2
- package/src/ui-components/credential/card/credential-details-list-item.tsx +27 -49
- package/src/ui-components/credential/credential-attribute-item.tsx +2 -0
- package/src/ui-components/credential/group/credential-group-header.tsx +70 -0
- package/src/ui-components/credential/group/index.ts +4 -0
- package/src/ui-components/credential/index.ts +1 -0
- package/src/ui-components/header/foldable-header.tsx +31 -16
- package/src/ui-components/icons/icons.tsx +22 -0
- package/src/ui-components/index.ts +2 -0
- package/src/ui-components/loader/loading-result.stories.tsx +4 -1
- package/src/ui-components/loader/loading-result.tsx +7 -0
- package/src/ui-components/nfc/index.ts +3 -0
- package/src/ui-components/nfc/nfc-process.tsx +80 -0
- package/src/ui-components/pin/pin-lock-animation.tsx +240 -278
- package/src/ui-components/proof-request/index.ts +4 -0
- package/src/ui-components/proof-request/proof-request-set.tsx +46 -0
- package/src/ui-components/screens/section-list-screen.tsx +39 -8
- package/src/utils/array.ts +4 -0
- package/src/utils/hooks/app-state.ts +29 -0
- package/src/utils/hooks/core/backup.ts +3 -9
- package/src/utils/hooks/core/core-init.ts +1 -23
- package/src/utils/hooks/core/credentials.ts +11 -4
- package/src/utils/hooks/core/identifiers.ts +15 -14
- package/src/utils/hooks/core/index.ts +2 -1
- package/src/utils/hooks/core/proofs.ts +47 -10
- package/src/utils/hooks/core/wallet-unit.ts +77 -0
- package/src/utils/hooks/index.ts +2 -0
- package/src/utils/hooks/nfc/nfc-status.ts +31 -0
- package/src/utils/hooks/revocation/credential-status.ts +1 -1
- package/src/utils/index.ts +2 -0
- package/src/utils/parsers/credential-sharing-v2.tsx +283 -0
- package/src/utils/parsers/credential-sharing.tsx +40 -16
- package/src/utils/parsers/credential.ts +129 -59
- package/src/utils/parsers/index.ts +1 -0
- package/src/utils/parsers/query.ts +7 -5
- package/src/utils/url.ts +61 -0
- package/src/utils/wallet-unit.ts +30 -0
- package/lib/commonjs/components/proof-request/group.js.map +0 -1
- package/lib/commonjs/components/proof-request/select-credential.js.map +0 -1
- package/lib/commonjs/components/proof-request/share-credential.js.map +0 -1
- package/lib/module/components/proof-request/group.js.map +0 -1
- package/lib/module/components/proof-request/select-credential.js.map +0 -1
- package/lib/module/components/proof-request/share-credential.js +0 -147
- package/lib/module/components/proof-request/share-credential.js.map +0 -1
- /package/lib/typescript/components/proof-request/{group.d.ts → v1/group.d.ts} +0 -0
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import React, { FunctionComponent, PropsWithChildren } from 'react';
|
|
2
|
+
import { StyleSheet, View } from 'react-native';
|
|
3
|
+
|
|
4
|
+
import { Typography } from '../text';
|
|
5
|
+
import { useAppColorScheme } from '../theme';
|
|
6
|
+
|
|
7
|
+
export type ProofRequestSetProps = {
|
|
8
|
+
headerLabel?: string;
|
|
9
|
+
showHeader?: boolean;
|
|
10
|
+
showSeparator?: boolean;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export const ProofRequestSet: FunctionComponent<PropsWithChildren<ProofRequestSetProps>> = ({
|
|
14
|
+
children,
|
|
15
|
+
headerLabel,
|
|
16
|
+
showHeader = false,
|
|
17
|
+
showSeparator = true,
|
|
18
|
+
}) => {
|
|
19
|
+
const colorScheme = useAppColorScheme();
|
|
20
|
+
return (
|
|
21
|
+
<View style={styles.set}>
|
|
22
|
+
{showSeparator && <View style={[styles.separator, { backgroundColor: colorScheme.grayDark }]} />}
|
|
23
|
+
{showHeader && headerLabel && (
|
|
24
|
+
<Typography align="left" color={colorScheme.text} preset="m" style={styles.header}>
|
|
25
|
+
{headerLabel}
|
|
26
|
+
</Typography>
|
|
27
|
+
)}
|
|
28
|
+
{children}
|
|
29
|
+
</View>
|
|
30
|
+
);
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
const styles = StyleSheet.create({
|
|
34
|
+
header: {
|
|
35
|
+
marginBottom: 16,
|
|
36
|
+
},
|
|
37
|
+
separator: {
|
|
38
|
+
height: 1,
|
|
39
|
+
marginBottom: 16,
|
|
40
|
+
marginHorizontal: 4,
|
|
41
|
+
opacity: 0.5,
|
|
42
|
+
},
|
|
43
|
+
set: {
|
|
44
|
+
marginTop: 16,
|
|
45
|
+
},
|
|
46
|
+
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { SectionList, SectionListProps, StyleSheet, View, ViewProps } from 'react-native';
|
|
1
|
+
import React, { useMemo } from 'react';
|
|
2
|
+
import { Platform, SectionList, SectionListProps, StyleSheet, View, ViewProps, ViewStyle } from 'react-native';
|
|
3
3
|
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
4
4
|
|
|
5
5
|
import { useOnScrollHeaderState } from '../../utils/hooks/header/on-scroll-header-state';
|
|
@@ -13,24 +13,52 @@ export type SectionListScreenProps<ItemT, SectionT> = ViewProps & {
|
|
|
13
13
|
static?: boolean;
|
|
14
14
|
title: string;
|
|
15
15
|
};
|
|
16
|
-
list: Omit<SectionListProps<ItemT, SectionT>, 'ListHeaderComponent' | 'onScroll'
|
|
16
|
+
list: Omit<SectionListProps<ItemT, SectionT>, 'ListHeaderComponent' | 'onScroll'> & {
|
|
17
|
+
header?: React.ComponentType<any> | React.ReactElement;
|
|
18
|
+
};
|
|
19
|
+
modalPresentation?: boolean;
|
|
17
20
|
};
|
|
18
21
|
|
|
19
22
|
const SectionListScreen = <ItemT, SectionT>({
|
|
20
23
|
header,
|
|
21
|
-
list: { contentContainerStyle, stickySectionHeadersEnabled, ...listProps },
|
|
24
|
+
list: { contentContainerStyle, header: listHeader, stickySectionHeadersEnabled, ...listProps },
|
|
25
|
+
modalPresentation,
|
|
22
26
|
style,
|
|
23
27
|
...viewProps
|
|
24
28
|
}: SectionListScreenProps<ItemT, SectionT>) => {
|
|
25
29
|
const colorScheme = useAppColorScheme();
|
|
26
|
-
const
|
|
27
|
-
const contentInsetsStyle = useListContentInset(
|
|
30
|
+
const { top } = useSafeAreaInsets();
|
|
31
|
+
const contentInsetsStyle = useListContentInset({
|
|
32
|
+
headerHeight: modalPresentation && Platform.OS === 'ios' ? 63 : 48,
|
|
33
|
+
modalPresentation,
|
|
34
|
+
});
|
|
28
35
|
const { titleVisible, onScroll } = useOnScrollHeaderState();
|
|
29
36
|
|
|
37
|
+
let headerPaddingStyle: ViewStyle | undefined;
|
|
38
|
+
if (!modalPresentation || Platform.OS === 'android') {
|
|
39
|
+
headerPaddingStyle = {
|
|
40
|
+
paddingTop: top,
|
|
41
|
+
};
|
|
42
|
+
} else if (modalPresentation && !header.modalHandleVisible && Platform.OS === 'ios') {
|
|
43
|
+
headerPaddingStyle = styles.modalHeaderWithoutHandle;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const headerView: React.ReactElement | undefined = useMemo(() => {
|
|
47
|
+
if (!listHeader) {
|
|
48
|
+
return undefined;
|
|
49
|
+
}
|
|
50
|
+
if (React.isValidElement(listHeader)) {
|
|
51
|
+
return listHeader;
|
|
52
|
+
} else {
|
|
53
|
+
const HeaderComponent = listHeader as React.ComponentType<any>;
|
|
54
|
+
return <HeaderComponent />;
|
|
55
|
+
}
|
|
56
|
+
}, [listHeader]);
|
|
57
|
+
|
|
30
58
|
return (
|
|
31
59
|
<View style={[styles.container, { backgroundColor: colorScheme.background }, style]} {...viewProps}>
|
|
32
60
|
<SectionList<ItemT, SectionT>
|
|
33
|
-
ListHeaderComponent={!header.static ? <ListTitleHeader title={header.title} /> :
|
|
61
|
+
ListHeaderComponent={!header.static ? <View><ListTitleHeader title={header.title} />{headerView}</View> : headerView}
|
|
34
62
|
contentContainerStyle={[contentInsetsStyle, contentContainerStyle]}
|
|
35
63
|
onScroll={onScroll}
|
|
36
64
|
scrollEventThrottle={100}
|
|
@@ -40,7 +68,7 @@ const SectionListScreen = <ItemT, SectionT>({
|
|
|
40
68
|
<NavigationHeader
|
|
41
69
|
animate
|
|
42
70
|
blurred
|
|
43
|
-
style={[styles.header,
|
|
71
|
+
style={[styles.header, headerPaddingStyle]}
|
|
44
72
|
titleVisible={header.static || titleVisible}
|
|
45
73
|
{...header}
|
|
46
74
|
/>
|
|
@@ -56,6 +84,9 @@ const styles = StyleSheet.create({
|
|
|
56
84
|
position: 'absolute',
|
|
57
85
|
width: '100%',
|
|
58
86
|
},
|
|
87
|
+
modalHeaderWithoutHandle: {
|
|
88
|
+
paddingTop: 15,
|
|
89
|
+
},
|
|
59
90
|
});
|
|
60
91
|
|
|
61
92
|
export default SectionListScreen;
|
package/src/utils/array.ts
CHANGED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { useEffect, useState } from 'react';
|
|
2
|
+
import { AppState } from 'react-native';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Returns current app state
|
|
6
|
+
*/
|
|
7
|
+
export function useAppState() {
|
|
8
|
+
const [appState, setAppState] = useState(AppState.currentState);
|
|
9
|
+
|
|
10
|
+
useEffect(() => {
|
|
11
|
+
const subscription = AppState.addEventListener('change', setAppState);
|
|
12
|
+
return () => subscription.remove();
|
|
13
|
+
}, []);
|
|
14
|
+
|
|
15
|
+
return appState;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export function useIsAppActive(): boolean | undefined {
|
|
19
|
+
switch (useAppState()) {
|
|
20
|
+
case 'active':
|
|
21
|
+
case 'extension':
|
|
22
|
+
return true;
|
|
23
|
+
case 'inactive':
|
|
24
|
+
case 'background':
|
|
25
|
+
return false;
|
|
26
|
+
default:
|
|
27
|
+
return undefined;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -5,7 +5,6 @@ import { useMutation, useQuery, useQueryClient } from 'react-query';
|
|
|
5
5
|
import { reportException } from '../../reporting';
|
|
6
6
|
import { useONECore } from './core-context';
|
|
7
7
|
import {
|
|
8
|
-
generateAttestationKey,
|
|
9
8
|
generateHwIdentifier,
|
|
10
9
|
generateSwIdentifier,
|
|
11
10
|
IdentifiersInitializationConfig,
|
|
@@ -71,11 +70,7 @@ export const useRollbackImport = () => {
|
|
|
71
70
|
* @param {IdentifiersInitializationConfig} config Select desired keys/dids to be restored/created
|
|
72
71
|
* @returns [hwIdentifierId, swIdentifierId]
|
|
73
72
|
*/
|
|
74
|
-
export const useBackupFinalizeImportProcedure = ({
|
|
75
|
-
generateHwKey,
|
|
76
|
-
generateSwKey,
|
|
77
|
-
generateAttestationKey: shouldGenerateAttestationKey,
|
|
78
|
-
}: IdentifiersInitializationConfig) => {
|
|
73
|
+
export const useBackupFinalizeImportProcedure = ({ generateHwKey, generateSwKey }: IdentifiersInitializationConfig) => {
|
|
79
74
|
const { mutateAsync: finalizeImport } = useFinalizeImport();
|
|
80
75
|
const { core, organisationId } = useONECore();
|
|
81
76
|
|
|
@@ -86,7 +81,7 @@ export const useBackupFinalizeImportProcedure = ({
|
|
|
86
81
|
let swIdentifierId: string | undefined;
|
|
87
82
|
if (generateSwKey) {
|
|
88
83
|
const identifiers = await core.getIdentifiers({
|
|
89
|
-
|
|
84
|
+
states: [IdentifierStateEnum.ACTIVE],
|
|
90
85
|
organisationId,
|
|
91
86
|
page: 0,
|
|
92
87
|
pageSize: 1,
|
|
@@ -99,10 +94,9 @@ export const useBackupFinalizeImportProcedure = ({
|
|
|
99
94
|
return Promise.all([
|
|
100
95
|
generateHwKey ? generateHwIdentifier(core, organisationId) : null,
|
|
101
96
|
!swIdentifierId && generateSwKey ? generateSwIdentifier(core, organisationId) : swIdentifierId,
|
|
102
|
-
shouldGenerateAttestationKey ? generateAttestationKey(core, organisationId) : null,
|
|
103
97
|
]).catch((err) => {
|
|
104
98
|
reportException(err, 'Failed to create base identifiers');
|
|
105
99
|
throw err;
|
|
106
100
|
});
|
|
107
|
-
}, [finalizeImport, generateSwKey, generateHwKey, core, organisationId
|
|
101
|
+
}, [finalizeImport, generateSwKey, generateHwKey, core, organisationId]);
|
|
108
102
|
};
|
|
@@ -77,29 +77,9 @@ export const generateSwIdentifier = async (core: ONECore, organisationId: string
|
|
|
77
77
|
});
|
|
78
78
|
};
|
|
79
79
|
|
|
80
|
-
export const generateAttestationKey = async (core: ONECore, organisationId: string) => {
|
|
81
|
-
return await core
|
|
82
|
-
.generateKey({
|
|
83
|
-
keyParams: {},
|
|
84
|
-
keyType: 'ECDSA',
|
|
85
|
-
name: 'holder-key-attestation',
|
|
86
|
-
organisationId,
|
|
87
|
-
storageParams: {},
|
|
88
|
-
storageType: 'SECURE_ELEMENT',
|
|
89
|
-
})
|
|
90
|
-
.catch((e) => {
|
|
91
|
-
// ignore if Attestation keys not supported by device
|
|
92
|
-
if (e instanceof OneError && e.code === OneErrorCode.KeyStorageNotSupported) {
|
|
93
|
-
return null;
|
|
94
|
-
}
|
|
95
|
-
throw e;
|
|
96
|
-
});
|
|
97
|
-
};
|
|
98
|
-
|
|
99
80
|
export interface IdentifiersInitializationConfig {
|
|
100
81
|
generateHwKey: boolean;
|
|
101
82
|
generateSwKey: boolean;
|
|
102
|
-
generateAttestationKey: boolean;
|
|
103
83
|
}
|
|
104
84
|
|
|
105
85
|
/**
|
|
@@ -110,7 +90,6 @@ export interface IdentifiersInitializationConfig {
|
|
|
110
90
|
export const useInitializeONECoreIdentifiers = ({
|
|
111
91
|
generateHwKey,
|
|
112
92
|
generateSwKey,
|
|
113
|
-
generateAttestationKey: shouldGenerateAttestationKey,
|
|
114
93
|
}: IdentifiersInitializationConfig) => {
|
|
115
94
|
const { core, organisationId } = useONECore();
|
|
116
95
|
|
|
@@ -127,12 +106,11 @@ export const useInitializeONECoreIdentifiers = ({
|
|
|
127
106
|
Promise.all([
|
|
128
107
|
generateHwKey ? generateHwIdentifier(core, organisationId) : null,
|
|
129
108
|
generateSwKey ? generateSwIdentifier(core, organisationId) : null,
|
|
130
|
-
shouldGenerateAttestationKey ? generateAttestationKey(core, organisationId) : null,
|
|
131
109
|
]),
|
|
132
110
|
)
|
|
133
111
|
.catch((err) => {
|
|
134
112
|
reportException(err, 'Failed to create base identifiers');
|
|
135
113
|
throw err;
|
|
136
114
|
});
|
|
137
|
-
}, [core, organisationId, generateHwKey, generateSwKey
|
|
115
|
+
}, [core, organisationId, generateHwKey, generateSwKey]);
|
|
138
116
|
};
|
|
@@ -10,9 +10,10 @@ import { useInfiniteQuery, useMutation, useQuery, useQueryClient } from 'react-q
|
|
|
10
10
|
|
|
11
11
|
import { getQueryKeyFromCredentialListQueryParams } from '../../parsers/query';
|
|
12
12
|
import { useONECore } from './core-context';
|
|
13
|
-
import { CREDENTIAL_SCHEMA_LIST_QUERY_KEY } from './credential-schemas';
|
|
13
|
+
import { CREDENTIAL_SCHEMA_DETAIL_QUERY_KEY, CREDENTIAL_SCHEMA_LIST_QUERY_KEY } from './credential-schemas';
|
|
14
14
|
import { OneErrorCode } from './error-code';
|
|
15
15
|
import { HISTORY_LIST_QUERY_KEY } from './history';
|
|
16
|
+
import { PROOF_LIST_QUERY_KEY } from './proofs';
|
|
16
17
|
|
|
17
18
|
const PAGE_SIZE = 20;
|
|
18
19
|
export const CREDENTIAL_LIST_QUERY_KEY = 'credential-list';
|
|
@@ -30,7 +31,7 @@ export const useCredentials = (queryParams?: Partial<CredentialListQuery>) => {
|
|
|
30
31
|
page: 0,
|
|
31
32
|
// TODO: workaround pagination for now, until it's supported by UI
|
|
32
33
|
pageSize: 10000,
|
|
33
|
-
|
|
34
|
+
states: [CredentialStateEnum.ACCEPTED, CredentialStateEnum.SUSPENDED, CredentialStateEnum.REVOKED],
|
|
34
35
|
...queryParams,
|
|
35
36
|
});
|
|
36
37
|
return values;
|
|
@@ -55,7 +56,7 @@ export const usePagedCredentials = (queryParams?: Partial<CredentialListQuery>)
|
|
|
55
56
|
organisationId,
|
|
56
57
|
page: pageParam,
|
|
57
58
|
pageSize: PAGE_SIZE,
|
|
58
|
-
|
|
59
|
+
states: [CredentialStateEnum.ACCEPTED, CredentialStateEnum.SUSPENDED, CredentialStateEnum.REVOKED],
|
|
59
60
|
...queryParams,
|
|
60
61
|
}),
|
|
61
62
|
{
|
|
@@ -87,9 +88,12 @@ export const useInvitationHandler = () => {
|
|
|
87
88
|
core.handleInvitation({ organisationId, ...request }),
|
|
88
89
|
{
|
|
89
90
|
onSuccess: async (result: InvitationResult) => {
|
|
90
|
-
if ('
|
|
91
|
+
if ('proofId' in result) {
|
|
92
|
+
await queryClient.invalidateQueries(PROOF_LIST_QUERY_KEY);
|
|
93
|
+
} else {
|
|
91
94
|
await queryClient.invalidateQueries(CREDENTIAL_LIST_QUERY_KEY);
|
|
92
95
|
await queryClient.invalidateQueries(CREDENTIAL_SCHEMA_LIST_QUERY_KEY);
|
|
96
|
+
await queryClient.invalidateQueries(CREDENTIAL_SCHEMA_DETAIL_QUERY_KEY);
|
|
93
97
|
}
|
|
94
98
|
await queryClient.invalidateQueries(HISTORY_LIST_QUERY_KEY);
|
|
95
99
|
},
|
|
@@ -115,6 +119,8 @@ export const useCredentialAccept = () => {
|
|
|
115
119
|
{
|
|
116
120
|
onSuccess: async () => {
|
|
117
121
|
await queryClient.invalidateQueries(CREDENTIAL_LIST_QUERY_KEY);
|
|
122
|
+
await queryClient.invalidateQueries(CREDENTIAL_SCHEMA_LIST_QUERY_KEY);
|
|
123
|
+
await queryClient.invalidateQueries(CREDENTIAL_SCHEMA_DETAIL_QUERY_KEY);
|
|
118
124
|
await queryClient.invalidateQueries(CREDENTIAL_DETAIL_QUERY_KEY);
|
|
119
125
|
await queryClient.invalidateQueries(HISTORY_LIST_QUERY_KEY);
|
|
120
126
|
},
|
|
@@ -200,6 +206,7 @@ export const useContinueIssuance = () => {
|
|
|
200
206
|
onSuccess: async () => {
|
|
201
207
|
await queryClient.invalidateQueries(CREDENTIAL_LIST_QUERY_KEY);
|
|
202
208
|
await queryClient.invalidateQueries(CREDENTIAL_SCHEMA_LIST_QUERY_KEY);
|
|
209
|
+
await queryClient.invalidateQueries(CREDENTIAL_SCHEMA_DETAIL_QUERY_KEY);
|
|
203
210
|
await queryClient.invalidateQueries(HISTORY_LIST_QUERY_KEY);
|
|
204
211
|
},
|
|
205
212
|
});
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { IdentifierListQuery, IdentifierStateEnum, IdentifierTypeEnum } from
|
|
2
|
-
import { useQuery } from
|
|
1
|
+
import { IdentifierListQuery, IdentifierStateEnum, IdentifierTypeEnum } from '@procivis/react-native-one-core';
|
|
2
|
+
import { useQuery } from 'react-query';
|
|
3
3
|
|
|
4
|
-
import { getQueryKeyFromIdentifierListQueryParams } from
|
|
5
|
-
import { useONECore } from
|
|
4
|
+
import { getQueryKeyFromIdentifierListQueryParams } from '../../parsers';
|
|
5
|
+
import { useONECore } from './core-context';
|
|
6
6
|
|
|
7
7
|
export const IDENTIFIER_DETAIL_QUERY_KEY = 'identifier-detail';
|
|
8
8
|
export const IDENTIFIER_LIST_QUERY_KEY = 'identifier-list';
|
|
@@ -19,21 +19,22 @@ export const useIdentifierDetails = (identifierId: string | undefined) => {
|
|
|
19
19
|
keepPreviousData: true,
|
|
20
20
|
},
|
|
21
21
|
);
|
|
22
|
-
}
|
|
22
|
+
};
|
|
23
23
|
|
|
24
24
|
export const useIdentifiers = (identifierFilter?: Partial<IdentifierListQuery>) => {
|
|
25
25
|
const { core, organisationId } = useONECore();
|
|
26
26
|
|
|
27
27
|
return useQuery(
|
|
28
28
|
[IDENTIFIER_LIST_QUERY_KEY, ...getQueryKeyFromIdentifierListQueryParams(identifierFilter)],
|
|
29
|
-
({ pageParam = 0 }) =>
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
29
|
+
({ pageParam = 0 }) =>
|
|
30
|
+
core.getIdentifiers({
|
|
31
|
+
types: [IdentifierTypeEnum.DID],
|
|
32
|
+
isRemote: false,
|
|
33
|
+
page: pageParam,
|
|
34
|
+
states: [IdentifierStateEnum.ACTIVE],
|
|
35
|
+
organisationId: organisationId,
|
|
36
|
+
pageSize: PAGE_SIZE,
|
|
37
|
+
...identifierFilter,
|
|
38
|
+
}),
|
|
38
39
|
);
|
|
39
40
|
};
|
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Config,
|
|
3
3
|
CreateProofRequest,
|
|
4
|
+
HistoryActionEnum,
|
|
5
|
+
HistoryEntityTypeEnum,
|
|
6
|
+
HistoryErrorMetadata,
|
|
4
7
|
IdentifierListQuery,
|
|
5
8
|
OneError,
|
|
6
9
|
PresentationSubmitCredentialRequest,
|
|
7
10
|
ProofListQuery,
|
|
8
11
|
ProofSchema,
|
|
9
12
|
ProofStateEnum,
|
|
13
|
+
ProposeProofRequest,
|
|
10
14
|
ShareProofRequest,
|
|
11
15
|
} from '@procivis/react-native-one-core';
|
|
12
16
|
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
@@ -37,11 +41,31 @@ export const useProofDetail = (proofId: string | undefined) => {
|
|
|
37
41
|
};
|
|
38
42
|
|
|
39
43
|
export const useProofState = (proofId: string | undefined, isPolling: boolean) => {
|
|
40
|
-
const { core } = useONECore();
|
|
44
|
+
const { core, organisationId } = useONECore();
|
|
41
45
|
|
|
42
46
|
return useQuery(
|
|
43
47
|
[PROOF_STATE_QUERY_KEY, proofId],
|
|
44
|
-
|
|
48
|
+
async () => {
|
|
49
|
+
if (!proofId) {
|
|
50
|
+
return undefined;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const state = await core.getProof(proofId).then((proof) => proof.state);
|
|
54
|
+
let metadata: HistoryErrorMetadata | undefined;
|
|
55
|
+
if (state === ProofStateEnum.ERROR) {
|
|
56
|
+
metadata = await core
|
|
57
|
+
.getHistory({
|
|
58
|
+
organisationId,
|
|
59
|
+
page: 0,
|
|
60
|
+
pageSize: 1,
|
|
61
|
+
entityId: proofId,
|
|
62
|
+
entityTypes: [HistoryEntityTypeEnum.PROOF],
|
|
63
|
+
actions: [HistoryActionEnum.ERRORED],
|
|
64
|
+
})
|
|
65
|
+
.then((result) => result.values[0]?.metadata as HistoryErrorMetadata);
|
|
66
|
+
}
|
|
67
|
+
return { state, metadata };
|
|
68
|
+
},
|
|
45
69
|
{
|
|
46
70
|
enabled: Boolean(proofId),
|
|
47
71
|
refetchInterval: isPolling ? 1000 : false,
|
|
@@ -60,6 +84,7 @@ export const useProofUrl = () => {
|
|
|
60
84
|
core.shareProof(proofId, request ?? {}).then((proof) => proof.url),
|
|
61
85
|
{
|
|
62
86
|
onSuccess: async () => {
|
|
87
|
+
await queryClient.invalidateQueries(PROOF_LIST_QUERY_KEY);
|
|
63
88
|
await queryClient.invalidateQueries(PROOF_DETAIL_QUERY_KEY);
|
|
64
89
|
await queryClient.invalidateQueries(PROOF_STATE_QUERY_KEY);
|
|
65
90
|
},
|
|
@@ -88,9 +113,12 @@ export const useProofAccept = () => {
|
|
|
88
113
|
{
|
|
89
114
|
onError: async (err) => {
|
|
90
115
|
reportException(err, 'Proof submission failure');
|
|
116
|
+
await queryClient.invalidateQueries(PROOF_LIST_QUERY_KEY);
|
|
91
117
|
await queryClient.invalidateQueries(PROOF_DETAIL_QUERY_KEY);
|
|
118
|
+
await queryClient.invalidateQueries(HISTORY_LIST_QUERY_KEY);
|
|
92
119
|
},
|
|
93
120
|
onSuccess: async () => {
|
|
121
|
+
await queryClient.invalidateQueries(PROOF_LIST_QUERY_KEY);
|
|
94
122
|
await queryClient.invalidateQueries(PROOF_DETAIL_QUERY_KEY);
|
|
95
123
|
await queryClient.invalidateQueries(HISTORY_LIST_QUERY_KEY);
|
|
96
124
|
},
|
|
@@ -112,6 +140,7 @@ export const useProofReject = () => {
|
|
|
112
140
|
}),
|
|
113
141
|
{
|
|
114
142
|
onSuccess: async () => {
|
|
143
|
+
await queryClient.invalidateQueries(PROOF_LIST_QUERY_KEY);
|
|
115
144
|
await queryClient.invalidateQueries(PROOF_DETAIL_QUERY_KEY);
|
|
116
145
|
await queryClient.invalidateQueries(HISTORY_LIST_QUERY_KEY);
|
|
117
146
|
},
|
|
@@ -131,15 +160,24 @@ export enum VerificationProtocol {
|
|
|
131
160
|
SCAN_TO_VERIFY = 'SCAN_TO_VERIFY',
|
|
132
161
|
}
|
|
133
162
|
|
|
163
|
+
export enum VerificationEngagement {
|
|
164
|
+
QR_CODE = 'QR_CODE',
|
|
165
|
+
NFC = 'NFC',
|
|
166
|
+
}
|
|
167
|
+
|
|
134
168
|
export const useProposeProof = () => {
|
|
135
169
|
const queryClient = useQueryClient();
|
|
136
170
|
const { core, organisationId } = useONECore();
|
|
137
171
|
|
|
138
|
-
return useMutation(
|
|
139
|
-
|
|
140
|
-
|
|
172
|
+
return useMutation(
|
|
173
|
+
async (request: Omit<ProposeProofRequest, 'organisationId'>) => core.proposeProof({ organisationId, ...request }),
|
|
174
|
+
{
|
|
175
|
+
onSuccess: async () => {
|
|
176
|
+
await queryClient.invalidateQueries(PROOF_LIST_QUERY_KEY);
|
|
177
|
+
await queryClient.invalidateQueries(HISTORY_LIST_QUERY_KEY);
|
|
178
|
+
},
|
|
141
179
|
},
|
|
142
|
-
|
|
180
|
+
);
|
|
143
181
|
};
|
|
144
182
|
|
|
145
183
|
export const useProofDelete = () => {
|
|
@@ -194,8 +232,7 @@ export const useProofCreate = () => {
|
|
|
194
232
|
return useMutation(async (data: CreateProofRequest) => core.createProof(data), {
|
|
195
233
|
onSuccess: async () => {
|
|
196
234
|
await queryClient.invalidateQueries(PROOF_LIST_QUERY_KEY);
|
|
197
|
-
await queryClient.invalidateQueries(
|
|
198
|
-
await queryClient.invalidateQueries(PROOF_DETAIL_QUERY_KEY);
|
|
235
|
+
await queryClient.invalidateQueries(HISTORY_LIST_QUERY_KEY);
|
|
199
236
|
},
|
|
200
237
|
});
|
|
201
238
|
};
|
|
@@ -267,7 +304,7 @@ export const useProofForSchemaIdWithTransport = (
|
|
|
267
304
|
return;
|
|
268
305
|
}
|
|
269
306
|
|
|
270
|
-
if (proofState !== ProofStateEnum.CREATED && proofState !== ProofStateEnum.PENDING) {
|
|
307
|
+
if (proofState?.state !== ProofStateEnum.CREATED && proofState?.state !== ProofStateEnum.PENDING) {
|
|
271
308
|
setProofId(undefined);
|
|
272
309
|
} else {
|
|
273
310
|
setDeleting(true);
|
|
@@ -339,7 +376,7 @@ export const useShareProof = (proofUrlProps: ProofUrlHookParams | undefined, ena
|
|
|
339
376
|
|
|
340
377
|
// reset when proofId changes or the proof was retracted
|
|
341
378
|
useEffect(() => {
|
|
342
|
-
if (!proofUrlProps?.proofId || proofState === ProofStateEnum.CREATED) {
|
|
379
|
+
if (!proofUrlProps?.proofId || proofState?.state === ProofStateEnum.CREATED) {
|
|
343
380
|
setSharedProof(undefined);
|
|
344
381
|
}
|
|
345
382
|
}, [proofUrlProps?.proofId, proofState]);
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { WalletProvider, WalletUnitStatusEnum } from '@procivis/react-native-one-core';
|
|
2
|
+
import { useEffect } from 'react';
|
|
3
|
+
import { useMutation, useQuery, useQueryClient } from 'react-query';
|
|
4
|
+
|
|
5
|
+
import { reportException } from '../../reporting';
|
|
6
|
+
import { useONECore } from './core-context';
|
|
7
|
+
|
|
8
|
+
export const ATTESTATION_QUERY_KEY = 'wallet-unit-attestation';
|
|
9
|
+
|
|
10
|
+
export const useWalletUnitAttestation = (active = true) => {
|
|
11
|
+
const { core, organisationId } = useONECore();
|
|
12
|
+
|
|
13
|
+
return useQuery([ATTESTATION_QUERY_KEY, organisationId], () => core.holderGetWalletUnitAttestation(organisationId), {
|
|
14
|
+
enabled: active,
|
|
15
|
+
keepPreviousData: true,
|
|
16
|
+
retry: false,
|
|
17
|
+
});
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export const useRegisterWalletUnit = () => {
|
|
21
|
+
const queryClient = useQueryClient();
|
|
22
|
+
const { core, organisationId } = useONECore();
|
|
23
|
+
|
|
24
|
+
return useMutation(
|
|
25
|
+
async (walletProvider: WalletProvider) => {
|
|
26
|
+
const result = await core.holderRegisterWalletUnit({
|
|
27
|
+
keyType: 'ECDSA',
|
|
28
|
+
organisationId,
|
|
29
|
+
walletProvider,
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
return result;
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
onSuccess: () => queryClient.invalidateQueries([ATTESTATION_QUERY_KEY, organisationId]),
|
|
36
|
+
},
|
|
37
|
+
);
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export const useRefreshWalletUnit = () => {
|
|
41
|
+
const queryClient = useQueryClient();
|
|
42
|
+
const { core, organisationId } = useONECore();
|
|
43
|
+
|
|
44
|
+
return useMutation(
|
|
45
|
+
async (appIntegrityCheckRequired: boolean) =>
|
|
46
|
+
core.holderRefreshWalletUnit({
|
|
47
|
+
appIntegrityCheckRequired,
|
|
48
|
+
organisationId,
|
|
49
|
+
}),
|
|
50
|
+
{
|
|
51
|
+
onError: async (err) => {
|
|
52
|
+
reportException(err, 'Refresh wallet unit failure');
|
|
53
|
+
await queryClient.invalidateQueries([ATTESTATION_QUERY_KEY, organisationId]);
|
|
54
|
+
},
|
|
55
|
+
onSuccess: () => queryClient.invalidateQueries([ATTESTATION_QUERY_KEY, organisationId]),
|
|
56
|
+
},
|
|
57
|
+
);
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
export const useWalletUnitCheck = (appIntegrityCheckRequired: boolean) => {
|
|
61
|
+
const { data: walletUnitAttestation, isLoading } = useWalletUnitAttestation();
|
|
62
|
+
const { mutateAsync: refreshWalletUnit, isLoading: isRefreshing, status: refreshStatus } = useRefreshWalletUnit();
|
|
63
|
+
|
|
64
|
+
useEffect(() => {
|
|
65
|
+
if (isLoading || refreshStatus !== 'idle') {
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
if (walletUnitAttestation?.status === WalletUnitStatusEnum.ACTIVE) {
|
|
69
|
+
void refreshWalletUnit(appIntegrityCheckRequired);
|
|
70
|
+
}
|
|
71
|
+
}, [isLoading, refreshStatus, walletUnitAttestation, refreshWalletUnit, appIntegrityCheckRequired]);
|
|
72
|
+
|
|
73
|
+
return {
|
|
74
|
+
isLoading: isLoading || isRefreshing,
|
|
75
|
+
walletUnitAttestation: isLoading || isRefreshing ? undefined : walletUnitAttestation,
|
|
76
|
+
};
|
|
77
|
+
};
|
package/src/utils/hooks/index.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
export * from './app-state';
|
|
1
2
|
export * from './connectivity/connectivity';
|
|
2
3
|
export * from './core';
|
|
3
4
|
export * from './credential-card/credential-card-expanding';
|
|
4
5
|
export * from './header/on-scroll-header-state';
|
|
5
6
|
export * from './list/list-content-inset';
|
|
6
7
|
export * from './navigation';
|
|
8
|
+
export * from './nfc/nfc-status';
|
|
7
9
|
export * from './pin-security/pin-security';
|
|
8
10
|
export * from './revocation/credential-status';
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { useCallback, useEffect, useState } from 'react';
|
|
2
|
+
import NfcManager from 'react-native-nfc-manager';
|
|
3
|
+
|
|
4
|
+
export const useNFCStatus = () => {
|
|
5
|
+
const [isNFCEnabled, setIsNFCEnabled] = useState<boolean>();
|
|
6
|
+
const [isLoading, setIsLoading] = useState<boolean>();
|
|
7
|
+
const [error, setError] = useState<unknown>();
|
|
8
|
+
|
|
9
|
+
const checkNFCStatus = useCallback(async () => {
|
|
10
|
+
try {
|
|
11
|
+
setIsLoading(true);
|
|
12
|
+
const isEnabled = await NfcManager.isEnabled();
|
|
13
|
+
setIsNFCEnabled(isEnabled);
|
|
14
|
+
setIsLoading(false);
|
|
15
|
+
} catch (e) {
|
|
16
|
+
setError(e);
|
|
17
|
+
}
|
|
18
|
+
}, []);
|
|
19
|
+
|
|
20
|
+
useEffect(() => {
|
|
21
|
+
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
22
|
+
checkNFCStatus();
|
|
23
|
+
}, [checkNFCStatus]);
|
|
24
|
+
|
|
25
|
+
const recheck = useCallback(() => {
|
|
26
|
+
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
27
|
+
checkNFCStatus();
|
|
28
|
+
}, [checkNFCStatus]);
|
|
29
|
+
|
|
30
|
+
return { error, isLoading, isNFCEnabled, recheck };
|
|
31
|
+
};
|
|
@@ -18,7 +18,7 @@ export const useCredentialStatusCheck = (credentialIds?: string[], forceRefresh
|
|
|
18
18
|
const { mutateAsync: check } = useCredentialRevocationCheck(forceRefresh);
|
|
19
19
|
const { data: credentials } = useCredentials({
|
|
20
20
|
ids: credentialIds,
|
|
21
|
-
|
|
21
|
+
states: [CredentialStateEnum.ACCEPTED, CredentialStateEnum.SUSPENDED],
|
|
22
22
|
});
|
|
23
23
|
|
|
24
24
|
const checkCredentialsStatus = useCallback(async () => {
|
package/src/utils/index.ts
CHANGED