@procivis/one-react-native-components 0.3.62 → 0.3.71

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.
Files changed (98) hide show
  1. package/lib/commonjs/ui-components/buttons/index.js +7 -0
  2. package/lib/commonjs/ui-components/buttons/index.js.map +1 -1
  3. package/lib/commonjs/ui-components/buttons/share-button.js +54 -0
  4. package/lib/commonjs/ui-components/buttons/share-button.js.map +1 -0
  5. package/lib/commonjs/ui-components/icons/icons.js +24 -1
  6. package/lib/commonjs/ui-components/icons/icons.js.map +1 -1
  7. package/lib/commonjs/ui-components/index.js +11 -0
  8. package/lib/commonjs/ui-components/index.js.map +1 -1
  9. package/lib/commonjs/ui-components/loader/loading-result.js +8 -1
  10. package/lib/commonjs/ui-components/loader/loading-result.js.map +1 -1
  11. package/lib/commonjs/ui-components/nfc/index.js +14 -0
  12. package/lib/commonjs/ui-components/nfc/index.js.map +1 -0
  13. package/lib/commonjs/ui-components/nfc/nfc-process.js +77 -0
  14. package/lib/commonjs/ui-components/nfc/nfc-process.js.map +1 -0
  15. package/lib/commonjs/ui-components/screens/section-list-screen.js +20 -5
  16. package/lib/commonjs/ui-components/screens/section-list-screen.js.map +1 -1
  17. package/lib/commonjs/utils/hooks/core/backup.js +3 -4
  18. package/lib/commonjs/utils/hooks/core/backup.js.map +1 -1
  19. package/lib/commonjs/utils/hooks/core/core-init.js +4 -22
  20. package/lib/commonjs/utils/hooks/core/core-init.js.map +1 -1
  21. package/lib/commonjs/utils/hooks/core/proofs.js +10 -2
  22. package/lib/commonjs/utils/hooks/core/proofs.js.map +1 -1
  23. package/lib/commonjs/utils/hooks/index.js +11 -0
  24. package/lib/commonjs/utils/hooks/index.js.map +1 -1
  25. package/lib/commonjs/utils/hooks/nfc/nfc-status.js +40 -0
  26. package/lib/commonjs/utils/hooks/nfc/nfc-status.js.map +1 -0
  27. package/lib/commonjs/utils/index.js +12 -0
  28. package/lib/commonjs/utils/index.js.map +1 -1
  29. package/lib/commonjs/utils/parsers/query.js +1 -1
  30. package/lib/commonjs/utils/parsers/query.js.map +1 -1
  31. package/lib/commonjs/utils/url.js +80 -0
  32. package/lib/commonjs/utils/url.js.map +1 -0
  33. package/lib/module/ui-components/buttons/index.js +2 -1
  34. package/lib/module/ui-components/buttons/index.js.map +1 -1
  35. package/lib/module/ui-components/buttons/share-button.js +47 -0
  36. package/lib/module/ui-components/buttons/share-button.js.map +1 -0
  37. package/lib/module/ui-components/icons/icons.js +22 -0
  38. package/lib/module/ui-components/icons/icons.js.map +1 -1
  39. package/lib/module/ui-components/index.js +1 -0
  40. package/lib/module/ui-components/index.js.map +1 -1
  41. package/lib/module/ui-components/loader/loading-result.js +8 -1
  42. package/lib/module/ui-components/loader/loading-result.js.map +1 -1
  43. package/lib/module/ui-components/nfc/index.js +3 -0
  44. package/lib/module/ui-components/nfc/index.js.map +1 -0
  45. package/lib/module/ui-components/nfc/nfc-process.js +69 -0
  46. package/lib/module/ui-components/nfc/nfc-process.js.map +1 -0
  47. package/lib/module/ui-components/screens/section-list-screen.js +21 -6
  48. package/lib/module/ui-components/screens/section-list-screen.js.map +1 -1
  49. package/lib/module/utils/hooks/core/backup.js +4 -5
  50. package/lib/module/utils/hooks/core/backup.js.map +1 -1
  51. package/lib/module/utils/hooks/core/core-init.js +3 -20
  52. package/lib/module/utils/hooks/core/core-init.js.map +1 -1
  53. package/lib/module/utils/hooks/core/proofs.js +9 -1
  54. package/lib/module/utils/hooks/core/proofs.js.map +1 -1
  55. package/lib/module/utils/hooks/index.js +1 -0
  56. package/lib/module/utils/hooks/index.js.map +1 -1
  57. package/lib/module/utils/hooks/nfc/nfc-status.js +32 -0
  58. package/lib/module/utils/hooks/nfc/nfc-status.js.map +1 -0
  59. package/lib/module/utils/index.js +1 -0
  60. package/lib/module/utils/index.js.map +1 -1
  61. package/lib/module/utils/parsers/query.js +1 -1
  62. package/lib/module/utils/parsers/query.js.map +1 -1
  63. package/lib/module/utils/url.js +71 -0
  64. package/lib/module/utils/url.js.map +1 -0
  65. package/lib/typescript/ui-components/buttons/index.d.ts +3 -1
  66. package/lib/typescript/ui-components/buttons/share-button.d.ts +10 -0
  67. package/lib/typescript/ui-components/icons/icons.d.ts +1 -0
  68. package/lib/typescript/ui-components/index.d.ts +1 -0
  69. package/lib/typescript/ui-components/loader/loading-result.d.ts +2 -0
  70. package/lib/typescript/ui-components/nfc/index.d.ts +2 -0
  71. package/lib/typescript/ui-components/nfc/nfc-process.d.ts +17 -0
  72. package/lib/typescript/ui-components/screens/section-list-screen.d.ts +2 -1
  73. package/lib/typescript/utils/hooks/core/backup.d.ts +1 -1
  74. package/lib/typescript/utils/hooks/core/core-init.d.ts +1 -3
  75. package/lib/typescript/utils/hooks/core/proofs.d.ts +9 -1
  76. package/lib/typescript/utils/hooks/index.d.ts +1 -0
  77. package/lib/typescript/utils/hooks/nfc/nfc-status.d.ts +6 -0
  78. package/lib/typescript/utils/index.d.ts +1 -0
  79. package/lib/typescript/utils/url.d.ts +19 -0
  80. package/package.json +7 -3
  81. package/src/ui-components/buttons/index.ts +4 -0
  82. package/src/ui-components/buttons/share-button.stories.tsx +25 -0
  83. package/src/ui-components/buttons/share-button.tsx +55 -0
  84. package/src/ui-components/icons/icons.tsx +22 -0
  85. package/src/ui-components/index.ts +1 -0
  86. package/src/ui-components/loader/loading-result.stories.tsx +4 -1
  87. package/src/ui-components/loader/loading-result.tsx +7 -0
  88. package/src/ui-components/nfc/index.ts +3 -0
  89. package/src/ui-components/nfc/nfc-process.tsx +80 -0
  90. package/src/ui-components/screens/section-list-screen.tsx +21 -4
  91. package/src/utils/hooks/core/backup.ts +1 -4
  92. package/src/utils/hooks/core/core-init.ts +1 -23
  93. package/src/utils/hooks/core/proofs.ts +17 -4
  94. package/src/utils/hooks/index.ts +1 -0
  95. package/src/utils/hooks/nfc/nfc-status.ts +31 -0
  96. package/src/utils/index.ts +1 -0
  97. package/src/utils/parsers/query.ts +1 -0
  98. package/src/utils/url.ts +61 -0
@@ -0,0 +1,69 @@
1
+ import React, { memo } from 'react';
2
+ import { Platform, StyleSheet, View } from 'react-native';
3
+ import { HeaderCloseButton } from '../../components';
4
+ import { useAppColorScheme } from '../../ui-components';
5
+ import { concatTestID } from '../../utils';
6
+ import { Typography } from '..';
7
+ import { Button, ButtonType } from '../buttons';
8
+ import { NFCIcon, StatusWarningIcon } from '../icons';
9
+ import { LoaderViewState } from '../loader';
10
+ import { ScrollViewScreen } from '../screens';
11
+ const NFCProcess = ({
12
+ testID,
13
+ processState,
14
+ labels,
15
+ handleButtonClick
16
+ }) => {
17
+ const colorScheme = useAppColorScheme();
18
+ return /*#__PURE__*/React.createElement(ScrollViewScreen, {
19
+ header: {
20
+ leftItem: /*#__PURE__*/React.createElement(HeaderCloseButton, {
21
+ testID: concatTestID(testID, 'header.back')
22
+ }),
23
+ modalHandleVisible: Platform.OS === 'ios',
24
+ static: true,
25
+ testID: concatTestID(testID, 'header'),
26
+ title: processState === LoaderViewState.InProgress ? labels.share : labels.connectivity
27
+ },
28
+ scrollView: {
29
+ testID: concatTestID(testID, 'scroll')
30
+ },
31
+ testID: testID
32
+ }, /*#__PURE__*/React.createElement(View, {
33
+ style: styles.content,
34
+ testID: concatTestID(testID, 'content')
35
+ }, /*#__PURE__*/React.createElement(View, {
36
+ style: styles.info
37
+ }, processState === LoaderViewState.InProgress ? /*#__PURE__*/React.createElement(NFCIcon, {
38
+ width: 50,
39
+ height: 50
40
+ }) : /*#__PURE__*/React.createElement(StatusWarningIcon, null), /*#__PURE__*/React.createElement(Typography, {
41
+ align: "center",
42
+ color: colorScheme.black
43
+ }, processState === LoaderViewState.InProgress ? labels.shareInfo : labels.conectivityInfo))), /*#__PURE__*/React.createElement(View, {
44
+ style: styles.bottom
45
+ }, /*#__PURE__*/React.createElement(Button, {
46
+ onPress: handleButtonClick,
47
+ testID: concatTestID(testID, 'button'),
48
+ title: processState === LoaderViewState.InProgress ? labels.close : labels.tryAgain,
49
+ type: processState === LoaderViewState.InProgress ? ButtonType.Secondary : ButtonType.Primary
50
+ })));
51
+ };
52
+ const styles = StyleSheet.create({
53
+ bottom: {
54
+ paddingHorizontal: 12,
55
+ paddingTop: 16
56
+ },
57
+ content: {
58
+ flex: 1,
59
+ paddingHorizontal: 16
60
+ },
61
+ info: {
62
+ alignItems: 'center',
63
+ flex: 1,
64
+ gap: 20,
65
+ justifyContent: 'center'
66
+ }
67
+ });
68
+ export default /*#__PURE__*/memo(NFCProcess);
69
+ //# sourceMappingURL=nfc-process.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["React","memo","Platform","StyleSheet","View","HeaderCloseButton","useAppColorScheme","concatTestID","Typography","Button","ButtonType","NFCIcon","StatusWarningIcon","LoaderViewState","ScrollViewScreen","NFCProcess","testID","processState","labels","handleButtonClick","colorScheme","createElement","header","leftItem","modalHandleVisible","OS","static","title","InProgress","share","connectivity","scrollView","style","styles","content","info","width","height","align","color","black","shareInfo","conectivityInfo","bottom","onPress","close","tryAgain","type","Secondary","Primary","create","paddingHorizontal","paddingTop","flex","alignItems","gap","justifyContent"],"sources":["nfc-process.tsx"],"sourcesContent":["import React, { FC, memo } from 'react';\nimport { Platform, StyleSheet, View } from 'react-native';\n\nimport { HeaderCloseButton } from '../../components';\nimport { useAppColorScheme } from '../../ui-components';\nimport { concatTestID } from '../../utils';\nimport { Typography } from '..';\nimport { Button, ButtonType } from '../buttons';\nimport { NFCIcon, StatusWarningIcon } from '../icons';\nimport { LoaderViewState } from '../loader';\nimport { ScrollViewScreen } from '../screens';\n\ninterface NFCProcessProps {\n testID: string;\n processState: LoaderViewState;\n handleButtonClick: () => void;\n labels: {\n share: string;\n connectivity: string;\n close: string;\n tryAgain: string;\n conectivityInfo: string;\n shareInfo: string;\n };\n}\n\nconst NFCProcess: FC<NFCProcessProps> = ({ testID, processState, labels, handleButtonClick }) => {\n const colorScheme = useAppColorScheme();\n\n return (\n <ScrollViewScreen\n header={{\n leftItem: <HeaderCloseButton testID={concatTestID(testID, 'header.back')} />,\n modalHandleVisible: Platform.OS === 'ios',\n static: true,\n testID: concatTestID(testID, 'header'),\n title: processState === LoaderViewState.InProgress ? labels.share : labels.connectivity,\n }}\n scrollView={{\n testID: concatTestID(testID, 'scroll'),\n }}\n testID={testID}>\n <View style={styles.content} testID={concatTestID(testID, 'content')}>\n <View style={styles.info}>\n {processState === LoaderViewState.InProgress ? <NFCIcon width={50} height={50} /> : <StatusWarningIcon />}\n <Typography align=\"center\" color={colorScheme.black}>\n {processState === LoaderViewState.InProgress ? labels.shareInfo : labels.conectivityInfo}\n </Typography>\n </View>\n </View>\n <View style={styles.bottom}>\n <Button\n onPress={handleButtonClick}\n testID={concatTestID(testID, 'button')}\n title={processState === LoaderViewState.InProgress ? labels.close : labels.tryAgain}\n type={processState === LoaderViewState.InProgress ? ButtonType.Secondary : ButtonType.Primary}\n />\n </View>\n </ScrollViewScreen>\n );\n};\n\nconst styles = StyleSheet.create({\n bottom: {\n paddingHorizontal: 12,\n paddingTop: 16,\n },\n content: {\n flex: 1,\n paddingHorizontal: 16,\n },\n info: {\n alignItems: 'center',\n flex: 1,\n gap: 20,\n justifyContent: 'center',\n },\n});\n\nexport default memo(NFCProcess);\n"],"mappings":"AAAA,OAAOA,KAAK,IAAQC,IAAI,QAAQ,OAAO;AACvC,SAASC,QAAQ,EAAEC,UAAU,EAAEC,IAAI,QAAQ,cAAc;AAEzD,SAASC,iBAAiB,QAAQ,kBAAkB;AACpD,SAASC,iBAAiB,QAAQ,qBAAqB;AACvD,SAASC,YAAY,QAAQ,aAAa;AAC1C,SAASC,UAAU,QAAQ,IAAI;AAC/B,SAASC,MAAM,EAAEC,UAAU,QAAQ,YAAY;AAC/C,SAASC,OAAO,EAAEC,iBAAiB,QAAQ,UAAU;AACrD,SAASC,eAAe,QAAQ,WAAW;AAC3C,SAASC,gBAAgB,QAAQ,YAAY;AAgB7C,MAAMC,UAA+B,GAAGA,CAAC;EAAEC,MAAM;EAAEC,YAAY;EAAEC,MAAM;EAAEC;AA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eAC/D,CACR,CACF,CAAC,eACP1C,KAAA,CAAAqB,aAAA,CAACjB,IAAI;IAAC4B,KAAK,EAAEC,MAAM,CAACU;EAAO,gBACzB3C,KAAA,CAAAqB,aAAA,CAACZ,MAAM;IACLmC,OAAO,EAAEzB,iBAAkB;IAC3BH,MAAM,EAAET,YAAY,CAACS,MAAM,EAAE,QAAQ,CAAE;IACvCW,KAAK,EAAEV,YAAY,KAAKJ,eAAe,CAACe,UAAU,GAAGV,MAAM,CAAC2B,KAAK,GAAG3B,MAAM,CAAC4B,QAAS;IACpFC,IAAI,EAAE9B,YAAY,KAAKJ,eAAe,CAACe,UAAU,GAAGlB,UAAU,CAACsC,SAAS,GAAGtC,UAAU,CAACuC;EAAQ,CAC/F,CACG,CACU,CAAC;AAEvB,CAAC;AAED,MAAMhB,MAAM,GAAG9B,UAAU,CAAC+C,MAAM,CAAC;EAC/BP,MAAM,EAAE;IACNQ,iBAAiB,EAAE,EAAE;IACrBC,UAAU,EAAE;EACd,CAAC;EACDlB,OAAO,EAAE;IACPmB,IAAI,EAAE,CAAC;IACPF,iBAAiB,EAAE;EACrB,CAAC;EACDhB,IAAI,EAAE;IACJmB,UAAU,EAAE,QAAQ;IACpBD,IAAI,EAAE,CAAC;IACPE,GAAG,EAAE,EAAE;IACPC,cAAc,EAAE;EAClB;AACF,CAAC,CAAC;AAEF,4BAAevD,IAAI,CAACc,UAAU,CAAC","ignoreList":[]}
@@ -1,6 +1,6 @@
1
1
  function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
2
2
  import React from 'react';
3
- import { SectionList, StyleSheet, View } from 'react-native';
3
+ import { Platform, SectionList, StyleSheet, View } from 'react-native';
4
4
  import { useSafeAreaInsets } from 'react-native-safe-area-context';
5
5
  import { useOnScrollHeaderState } from '../../utils/hooks/header/on-scroll-header-state';
6
6
  import { useListContentInset } from '../../utils/hooks/list/list-content-inset';
@@ -14,16 +14,30 @@ const SectionListScreen = ({
14
14
  stickySectionHeadersEnabled,
15
15
  ...listProps
16
16
  },
17
+ modalPresentation,
17
18
  style,
18
19
  ...viewProps
19
20
  }) => {
20
21
  const colorScheme = useAppColorScheme();
21
- const safeAreaInsets = useSafeAreaInsets();
22
- const contentInsetsStyle = useListContentInset();
22
+ const {
23
+ top
24
+ } = useSafeAreaInsets();
25
+ const contentInsetsStyle = useListContentInset({
26
+ headerHeight: modalPresentation && Platform.OS === 'ios' ? 63 : 48,
27
+ modalPresentation
28
+ });
23
29
  const {
24
30
  titleVisible,
25
31
  onScroll
26
32
  } = useOnScrollHeaderState();
33
+ let headerPaddingStyle;
34
+ if (!modalPresentation || Platform.OS === 'android') {
35
+ headerPaddingStyle = {
36
+ paddingTop: top
37
+ };
38
+ } else if (modalPresentation && !header.modalHandleVisible && Platform.OS === 'ios') {
39
+ headerPaddingStyle = styles.modalHeaderWithoutHandle;
40
+ }
27
41
  return /*#__PURE__*/React.createElement(View, _extends({
28
42
  style: [styles.container, {
29
43
  backgroundColor: colorScheme.background
@@ -39,9 +53,7 @@ const SectionListScreen = ({
39
53
  }, listProps)), /*#__PURE__*/React.createElement(NavigationHeader, _extends({
40
54
  animate: true,
41
55
  blurred: true,
42
- style: [styles.header, {
43
- paddingTop: safeAreaInsets.top
44
- }],
56
+ style: [styles.header, headerPaddingStyle],
45
57
  titleVisible: header.static || titleVisible
46
58
  }, header)));
47
59
  };
@@ -52,6 +64,9 @@ const styles = StyleSheet.create({
52
64
  header: {
53
65
  position: 'absolute',
54
66
  width: '100%'
67
+ },
68
+ modalHeaderWithoutHandle: {
69
+ paddingTop: 15
55
70
  }
56
71
  });
57
72
  export default SectionListScreen;
@@ -1 +1 @@
1
- {"version":3,"names":["React","SectionList","StyleSheet","View","useSafeAreaInsets","useOnScrollHeaderState","useListContentInset","NavigationHeader","ListTitleHeader","useAppColorScheme","SectionListScreen","header","list","contentContainerStyle","stickySectionHeadersEnabled","listProps","style","viewProps","colorScheme","safeAreaInsets","contentInsetsStyle","titleVisible","onScroll","createElement","_extends","styles","container","backgroundColor","background","ListHeaderComponent","static","title","undefined","scrollEventThrottle","animate","blurred","paddingTop","top","create","flex","position","width"],"sources":["section-list-screen.tsx"],"sourcesContent":["import React from 'react';\nimport { SectionList, SectionListProps, StyleSheet, View, ViewProps } from 'react-native';\nimport { useSafeAreaInsets } from 'react-native-safe-area-context';\n\nimport { useOnScrollHeaderState } from '../../utils/hooks/header/on-scroll-header-state';\nimport { useListContentInset } from '../../utils/hooks/list/list-content-inset';\nimport NavigationHeader, { NavigationHeaderProps } from '../header/navigation-header';\nimport ListTitleHeader from '../list/list-title-header';\nimport { useAppColorScheme } from '../theme/color-scheme-context';\n\nexport type SectionListScreenProps<ItemT, SectionT> = ViewProps & {\n header: Omit<NavigationHeaderProps, 'animate' | 'blurred' | 'style' | 'title' | 'titleVisible'> & {\n static?: boolean;\n title: string;\n };\n list: Omit<SectionListProps<ItemT, SectionT>, 'ListHeaderComponent' | 'onScroll'>;\n};\n\nconst SectionListScreen = <ItemT, SectionT>({\n header,\n list: { contentContainerStyle, stickySectionHeadersEnabled, ...listProps },\n style,\n ...viewProps\n}: SectionListScreenProps<ItemT, SectionT>) => {\n const colorScheme = useAppColorScheme();\n const safeAreaInsets = useSafeAreaInsets();\n const contentInsetsStyle = useListContentInset();\n const { titleVisible, onScroll } = useOnScrollHeaderState();\n\n return (\n <View style={[styles.container, { backgroundColor: colorScheme.background }, style]} {...viewProps}>\n <SectionList<ItemT, SectionT>\n ListHeaderComponent={!header.static ? <ListTitleHeader title={header.title} /> : undefined}\n contentContainerStyle={[contentInsetsStyle, contentContainerStyle]}\n onScroll={onScroll}\n scrollEventThrottle={100}\n stickySectionHeadersEnabled={stickySectionHeadersEnabled ?? false}\n {...listProps}\n />\n <NavigationHeader\n animate\n blurred\n style={[styles.header, { paddingTop: safeAreaInsets.top }]}\n titleVisible={header.static || titleVisible}\n {...header}\n />\n </View>\n );\n};\n\nconst styles = StyleSheet.create({\n container: {\n flex: 1,\n },\n header: {\n position: 'absolute',\n width: '100%',\n },\n});\n\nexport default SectionListScreen;\n"],"mappings":";AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,WAAW,EAAoBC,UAAU,EAAEC,IAAI,QAAmB,cAAc;AACzF,SAASC,iBAAiB,QAAQ,gCAAgC;AAElE,SAASC,sBAAsB,QAAQ,iDAAiD;AACxF,SAASC,mBAAmB,QAAQ,2CAA2C;AAC/E,OAAOC,gBAAgB,MAAiC,6BAA6B;AACrF,OAAOC,eAAe,MAAM,2BAA2B;AACvD,SAASC,iBAAiB,QAAQ,+BAA+B;AAUjE,MAAMC,iBAAiB,GAAGA,CAAkB;EAC1CC,MAAM;EACNC,IAAI,EAAE;IAAEC,qBAAqB;IAAEC,2BAA2B;IAAE,GAAGC;EAAU,CAAC;EAC1EC,KAAK;EACL,GAAGC;AACoC,CAAC,KAAK;EAC7C,MAAMC,WAAW,GAAGT,iBAAiB,CAAC,CAAC;EACvC,MAAMU,cAAc,GAAGf,iBAAiB,CAAC,CAAC;EAC1C,MAAMgB,kBAAkB,GAAGd,mBAAmB,CAAC,CAAC;EAChD,MAAM;IAAEe,YAAY;IAAEC;EAAS,CAAC,GAAGjB,sBAAsB,CAAC,CAAC;EAE3D,oBACEL,KAAA,CAAAuB,aAAA,CAACpB,IAAI,EAAAqB,QAAA;IAACR,KAAK,EAAE,CAACS,MAAM,CAACC,SAAS,EAAE;MAAEC,eAAe,EAAET,WAAW,CAACU;IAAW,CAAC,EAAEZ,KAAK;EAAE,GAAKC,SAAS,gBAChGjB,KAAA,CAAAuB,aAAA,CAACtB,WAAW,EAAAuB,QAAA;IACVK,mBAAmB,EAAE,CAAClB,MAAM,CAACmB,MAAM,gBAAG9B,KAAA,CAAAuB,aAAA,CAACf,eAAe;MAACuB,KAAK,EAAEpB,MAAM,CAACoB;IAAM,CAAE,CAAC,GAAGC,SAAU;IAC3FnB,qBAAqB,EAAE,CAACO,kBAAkB,EAAEP,qBAAqB,CAAE;IACnES,QAAQ,EAAEA,QAAS;IACnBW,mBAAmB,EAAE,GAAI;IACzBnB,2BAA2B,EAAEA,2BAA2B,aAA3BA,2BAA2B,cAA3BA,2BAA2B,GAAI;EAAM,GAC9DC,SAAS,CACd,CAAC,eACFf,KAAA,CAAAuB,aAAA,CAAChB,gBAAgB,EAAAiB,QAAA;IACfU,OAAO;IACPC,OAAO;IACPnB,KAAK,EAAE,CAACS,MAAM,CAACd,MAAM,EAAE;MAAEyB,UAAU,EAAEjB,cAAc,CAACkB;IAAI,CAAC,CAAE;IAC3DhB,YAAY,EAAEV,MAAM,CAACmB,MAAM,IAAIT;EAAa,GACxCV,MAAM,CACX,CACG,CAAC;AAEX,CAAC;AAED,MAAMc,MAAM,GAAGvB,UAAU,CAACoC,MAAM,CAAC;EAC/BZ,SAAS,EAAE;IACTa,IAAI,EAAE;EACR,CAAC;EACD5B,MAAM,EAAE;IACN6B,QAAQ,EAAE,UAAU;IACpBC,KAAK,EAAE;EACT;AACF,CAAC,CAAC;AAEF,eAAe/B,iBAAiB","ignoreList":[]}
1
+ {"version":3,"names":["React","Platform","SectionList","StyleSheet","View","useSafeAreaInsets","useOnScrollHeaderState","useListContentInset","NavigationHeader","ListTitleHeader","useAppColorScheme","SectionListScreen","header","list","contentContainerStyle","stickySectionHeadersEnabled","listProps","modalPresentation","style","viewProps","colorScheme","top","contentInsetsStyle","headerHeight","OS","titleVisible","onScroll","headerPaddingStyle","paddingTop","modalHandleVisible","styles","modalHeaderWithoutHandle","createElement","_extends","container","backgroundColor","background","ListHeaderComponent","static","title","undefined","scrollEventThrottle","animate","blurred","create","flex","position","width"],"sources":["section-list-screen.tsx"],"sourcesContent":["import React from 'react';\nimport { Platform, SectionList, SectionListProps, StyleSheet, View, ViewProps, ViewStyle } from 'react-native';\nimport { useSafeAreaInsets } from 'react-native-safe-area-context';\n\nimport { useOnScrollHeaderState } from '../../utils/hooks/header/on-scroll-header-state';\nimport { useListContentInset } from '../../utils/hooks/list/list-content-inset';\nimport NavigationHeader, { NavigationHeaderProps } from '../header/navigation-header';\nimport ListTitleHeader from '../list/list-title-header';\nimport { useAppColorScheme } from '../theme/color-scheme-context';\n\nexport type SectionListScreenProps<ItemT, SectionT> = ViewProps & {\n header: Omit<NavigationHeaderProps, 'animate' | 'blurred' | 'style' | 'title' | 'titleVisible'> & {\n static?: boolean;\n title: string;\n };\n list: Omit<SectionListProps<ItemT, SectionT>, 'ListHeaderComponent' | 'onScroll'>;\n modalPresentation?: boolean;\n};\n\nconst SectionListScreen = <ItemT, SectionT>({\n header,\n list: { contentContainerStyle, stickySectionHeadersEnabled, ...listProps },\n modalPresentation,\n style,\n ...viewProps\n}: SectionListScreenProps<ItemT, SectionT>) => {\n const colorScheme = useAppColorScheme();\n const { top } = useSafeAreaInsets();\n const contentInsetsStyle = useListContentInset({\n headerHeight: modalPresentation && Platform.OS === 'ios' ? 63 : 48,\n modalPresentation,\n });\n const { titleVisible, onScroll } = useOnScrollHeaderState();\n\n let headerPaddingStyle: ViewStyle | undefined;\n if (!modalPresentation || Platform.OS === 'android') {\n headerPaddingStyle = {\n paddingTop: top,\n };\n } else if (modalPresentation && !header.modalHandleVisible && Platform.OS === 'ios') {\n headerPaddingStyle = styles.modalHeaderWithoutHandle;\n }\n\n return (\n <View style={[styles.container, { backgroundColor: colorScheme.background }, style]} {...viewProps}>\n <SectionList<ItemT, SectionT>\n ListHeaderComponent={!header.static ? <ListTitleHeader title={header.title} /> : undefined}\n contentContainerStyle={[contentInsetsStyle, contentContainerStyle]}\n onScroll={onScroll}\n scrollEventThrottle={100}\n stickySectionHeadersEnabled={stickySectionHeadersEnabled ?? false}\n {...listProps}\n />\n <NavigationHeader\n animate\n blurred\n style={[styles.header, headerPaddingStyle]}\n titleVisible={header.static || titleVisible}\n {...header}\n />\n </View>\n );\n};\n\nconst styles = StyleSheet.create({\n container: {\n flex: 1,\n },\n header: {\n position: 'absolute',\n width: '100%',\n },\n modalHeaderWithoutHandle: {\n paddingTop: 15,\n },\n});\n\nexport default SectionListScreen;\n"],"mappings":";AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,QAAQ,EAAEC,WAAW,EAAoBC,UAAU,EAAEC,IAAI,QAA8B,cAAc;AAC9G,SAASC,iBAAiB,QAAQ,gCAAgC;AAElE,SAASC,sBAAsB,QAAQ,iDAAiD;AACxF,SAASC,mBAAmB,QAAQ,2CAA2C;AAC/E,OAAOC,gBAAgB,MAAiC,6BAA6B;AACrF,OAAOC,eAAe,MAAM,2BAA2B;AACvD,SAASC,iBAAiB,QAAQ,+BAA+B;AAWjE,MAAMC,iBAAiB,GAAGA,CAAkB;EAC1CC,MAAM;EACNC,IAAI,EAAE;IAAEC,qBAAqB;IAAEC,2BAA2B;IAAE,GAAGC;EAAU,CAAC;EAC1EC,iBAAiB;EACjBC,KAAK;EACL,GAAGC;AACoC,CAAC,KAAK;EAC7C,MAAMC,WAAW,GAAGV,iBAAiB,CAAC,CAAC;EACvC,MAAM;IAAEW;EAAI,CAAC,GAAGhB,iBAAiB,CAAC,CAAC;EACnC,MAAMiB,kBAAkB,GAAGf,mBAAmB,CAAC;IAC7CgB,YAAY,EAAEN,iBAAiB,IAAIhB,QAAQ,CAACuB,EAAE,KAAK,KAAK,GAAG,EAAE,GAAG,EAAE;IAClEP;EACF,CAAC,CAAC;EACF,MAAM;IAAEQ,YAAY;IAAEC;EAAS,CAAC,GAAGpB,sBAAsB,CAAC,CAAC;EAE3D,IAAIqB,kBAAyC;EAC7C,IAAI,CAACV,iBAAiB,IAAIhB,QAAQ,CAACuB,EAAE,KAAK,SAAS,EAAE;IACnDG,kBAAkB,GAAG;MACnBC,UAAU,EAAEP;IACd,CAAC;EACH,CAAC,MAAM,IAAIJ,iBAAiB,IAAI,CAACL,MAAM,CAACiB,kBAAkB,IAAI5B,QAAQ,CAACuB,EAAE,KAAK,KAAK,EAAE;IACnF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import { useMutation, useQuery, useQueryClient } from 'react-query';
4
4
  import { reportException } from '../../reporting';
5
5
  import { useONECore } from './core-context';
6
- import { generateAttestationKey, generateHwIdentifier, generateSwIdentifier, SW_DID_NAME_PREFIX } from './core-init';
6
+ import { generateHwIdentifier, generateSwIdentifier, SW_DID_NAME_PREFIX } from './core-init';
7
7
  import { HISTORY_LIST_QUERY_KEY } from './history';
8
8
  const BACKUP_INFO_QUERY_KEY = 'backup-info';
9
9
  export const useBackupInfo = () => {
@@ -64,8 +64,7 @@ export const useRollbackImport = () => {
64
64
  */
65
65
  export const useBackupFinalizeImportProcedure = ({
66
66
  generateHwKey,
67
- generateSwKey,
68
- generateAttestationKey: shouldGenerateAttestationKey
67
+ generateSwKey
69
68
  }) => {
70
69
  const {
71
70
  mutateAsync: finalizeImport
@@ -91,10 +90,10 @@ export const useBackupFinalizeImportProcedure = ({
91
90
  });
92
91
  swIdentifierId = (_identifiers$values$f = identifiers.values.find(identifier => identifier.name.startsWith(SW_DID_NAME_PREFIX))) === null || _identifiers$values$f === void 0 ? void 0 : _identifiers$values$f.id;
93
92
  }
94
- return Promise.all([generateHwKey ? generateHwIdentifier(core, organisationId) : null, !swIdentifierId && generateSwKey ? generateSwIdentifier(core, organisationId) : swIdentifierId, shouldGenerateAttestationKey ? generateAttestationKey(core, organisationId) : null]).catch(err => {
93
+ return Promise.all([generateHwKey ? generateHwIdentifier(core, organisationId) : null, !swIdentifierId && generateSwKey ? generateSwIdentifier(core, organisationId) : swIdentifierId]).catch(err => {
95
94
  reportException(err, 'Failed to create base identifiers');
96
95
  throw err;
97
96
  });
98
- }, [finalizeImport, generateSwKey, generateHwKey, core, organisationId, shouldGenerateAttestationKey]);
97
+ }, [finalizeImport, generateSwKey, generateHwKey, core, organisationId]);
99
98
  };
100
99
  //# sourceMappingURL=backup.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["IdentifierStateEnum","IdentifierTypeEnum","useCallback","useMutation","useQuery","useQueryClient","reportException","useONECore","generateAttestationKey","generateHwIdentifier","generateSwIdentifier","SW_DID_NAME_PREFIX","HISTORY_LIST_QUERY_KEY","BACKUP_INFO_QUERY_KEY","useBackupInfo","core","backupInfo","keepPreviousData","useCreateBackup","queryClient","password","outputPath","createBackup","onSuccess","invalidateQueries","useUnpackBackup","inputPath","unpackBackup","resetQueries","useFinalizeImport","finalizeImport","useRollbackImport","rollbackImport","useBackupFinalizeImportProcedure","generateHwKey","generateSwKey","shouldGenerateAttestationKey","mutateAsync","organisationId","swIdentifierId","_identifiers$values$f","identifiers","getIdentifiers","state","ACTIVE","page","pageSize","types","DID","isRemote","values","find","identifier","name","startsWith","id","Promise","all","catch","err"],"sources":["backup.ts"],"sourcesContent":["import { IdentifierStateEnum, IdentifierTypeEnum } from '@procivis/react-native-one-core';\nimport { useCallback } from 'react';\nimport { useMutation, useQuery, useQueryClient } from 'react-query';\n\nimport { reportException } from '../../reporting';\nimport { useONECore } from './core-context';\nimport {\n generateAttestationKey,\n generateHwIdentifier,\n generateSwIdentifier,\n IdentifiersInitializationConfig,\n SW_DID_NAME_PREFIX,\n} from './core-init';\nimport { HISTORY_LIST_QUERY_KEY } from './history';\n\nconst BACKUP_INFO_QUERY_KEY = 'backup-info';\n\nexport const useBackupInfo = () => {\n const { core } = useONECore();\n\n return useQuery([BACKUP_INFO_QUERY_KEY], () => core.backupInfo(), {\n keepPreviousData: true,\n });\n};\n\nexport const useCreateBackup = () => {\n const queryClient = useQueryClient();\n const { core } = useONECore();\n\n return useMutation(\n async ({ password, outputPath }: { outputPath: string; password: string }) =>\n core.createBackup(password, outputPath),\n {\n onSuccess: () => queryClient.invalidateQueries(HISTORY_LIST_QUERY_KEY),\n },\n );\n};\n\nexport const useUnpackBackup = () => {\n const queryClient = useQueryClient();\n const { core } = useONECore();\n\n return useMutation(\n async ({ password, inputPath }: { inputPath: string; password: string }) => core.unpackBackup(password, inputPath),\n {\n onSuccess: () => queryClient.resetQueries(),\n },\n );\n};\n\nexport const useFinalizeImport = () => {\n const queryClient = useQueryClient();\n const { core } = useONECore();\n\n return useMutation(async () => core.finalizeImport(), {\n onSuccess: () => queryClient.resetQueries(),\n });\n};\n\nexport const useRollbackImport = () => {\n const queryClient = useQueryClient();\n const { core } = useONECore();\n\n return useMutation(async () => core.rollbackImport(), {\n onSuccess: () => queryClient.resetQueries(),\n });\n};\n\n/**\n * Finalize backup import and extract/prepare identifiers\n * @param {IdentifiersInitializationConfig} config Select desired keys/dids to be restored/created\n * @returns [hwIdentifierId, swIdentifierId]\n */\nexport const useBackupFinalizeImportProcedure = ({\n generateHwKey,\n generateSwKey,\n generateAttestationKey: shouldGenerateAttestationKey,\n}: IdentifiersInitializationConfig) => {\n const { mutateAsync: finalizeImport } = useFinalizeImport();\n const { core, organisationId } = useONECore();\n\n return useCallback(async () => {\n await finalizeImport();\n\n // update wallet identifier references\n let swIdentifierId: string | undefined;\n if (generateSwKey) {\n const identifiers = await core.getIdentifiers({\n state: IdentifierStateEnum.ACTIVE,\n organisationId,\n page: 0,\n pageSize: 1,\n types: [IdentifierTypeEnum.DID],\n isRemote: false,\n });\n swIdentifierId = identifiers.values.find((identifier) => identifier.name.startsWith(SW_DID_NAME_PREFIX))?.id;\n }\n\n return Promise.all([\n generateHwKey ? generateHwIdentifier(core, organisationId) : null,\n !swIdentifierId && generateSwKey ? generateSwIdentifier(core, organisationId) : swIdentifierId,\n shouldGenerateAttestationKey ? generateAttestationKey(core, organisationId) : null,\n ]).catch((err) => {\n reportException(err, 'Failed to create base identifiers');\n throw err;\n });\n }, [finalizeImport, generateSwKey, generateHwKey, core, organisationId, shouldGenerateAttestationKey]);\n};\n"],"mappings":"AAAA,SAASA,mBAAmB,EAAEC,kBAAkB,QAAQ,iCAAiC;AACzF,SAASC,WAAW,QAAQ,OAAO;AACnC,SAASC,WAAW,EAAEC,QAAQ,EAAEC,cAAc,QAAQ,aAAa;AAEnE,SAASC,eAAe,QAAQ,iBAAiB;AACjD,SAASC,UAAU,QAAQ,gBAAgB;AAC3C,SACE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AW,CAACS,MAAM,CAACC,IAAI,CAAEC,UAAU,IAAKA,UAAU,CAACC,IAAI,CAACC,UAAU,CAAC3C,kBAAkB,CAAC,CAAC,cAAA6B,qBAAA,uBAAvFA,qBAAA,CAAyFe,EAAE;IAC9G;IAEA,OAAOC,OAAO,CAACC,GAAG,CAAC,CACjBvB,aAAa,GAAGzB,oBAAoB,CAACM,IAAI,EAAEuB,cAAc,CAAC,GAAG,IAAI,EACjE,CAACC,cAAc,IAAIJ,aAAa,GAAGzB,oBAAoB,CAACK,IAAI,EAAEuB,cAAc,CAAC,GAAGC,cAAc,EAC9FH,4BAA4B,GAAG5B,sBAAsB,CAACO,IAAI,EAAEuB,cAAc,CAAC,GAAG,IAAI,CACnF,CAAC,CAACoB,KAAK,CAAEC,GAAG,IAAK;MAChBrD,eAAe,CAACqD,GAAG,EAAE,mCAAmC,CAAC;MACzD,MAAMA,GAAG;IACX,CAAC,CAAC;EACJ,CAAC,EAAE,CAAC7B,cAAc,EAAEK,aAAa,EAAED,aAAa,EAAEnB,IAAI,EAAEuB,cAAc,EAAEF,4BAA4B,CAAC,CAAC;AACxG,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["IdentifierStateEnum","IdentifierTypeEnum","useCallback","useMutation","useQuery","useQueryClient","reportException","useONECore","generateHwIdentifier","generateSwIdentifier","SW_DID_NAME_PREFIX","HISTORY_LIST_QUERY_KEY","BACKUP_INFO_QUERY_KEY","useBackupInfo","core","backupInfo","keepPreviousData","useCreateBackup","queryClient","password","outputPath","createBackup","onSuccess","invalidateQueries","useUnpackBackup","inputPath","unpackBackup","resetQueries","useFinalizeImport","finalizeImport","useRollbackImport","rollbackImport","useBackupFinalizeImportProcedure","generateHwKey","generateSwKey","mutateAsync","organisationId","swIdentifierId","_identifiers$values$f","identifiers","getIdentifiers","state","ACTIVE","page","pageSize","types","DID","isRemote","values","find","identifier","name","startsWith","id","Promise","all","catch","err"],"sources":["backup.ts"],"sourcesContent":["import { IdentifierStateEnum, IdentifierTypeEnum } from '@procivis/react-native-one-core';\nimport { useCallback } from 'react';\nimport { useMutation, useQuery, useQueryClient } from 'react-query';\n\nimport { reportException } from '../../reporting';\nimport { useONECore } from './core-context';\nimport {\n generateHwIdentifier,\n generateSwIdentifier,\n IdentifiersInitializationConfig,\n SW_DID_NAME_PREFIX,\n} from './core-init';\nimport { HISTORY_LIST_QUERY_KEY } from './history';\n\nconst BACKUP_INFO_QUERY_KEY = 'backup-info';\n\nexport const useBackupInfo = () => {\n const { core } = useONECore();\n\n return useQuery([BACKUP_INFO_QUERY_KEY], () => core.backupInfo(), {\n keepPreviousData: true,\n });\n};\n\nexport const useCreateBackup = () => {\n const queryClient = useQueryClient();\n const { core } = useONECore();\n\n return useMutation(\n async ({ password, outputPath }: { outputPath: string; password: string }) =>\n core.createBackup(password, outputPath),\n {\n onSuccess: () => queryClient.invalidateQueries(HISTORY_LIST_QUERY_KEY),\n },\n );\n};\n\nexport const useUnpackBackup = () => {\n const queryClient = useQueryClient();\n const { core } = useONECore();\n\n return useMutation(\n async ({ password, inputPath }: { inputPath: string; password: string }) => core.unpackBackup(password, inputPath),\n {\n onSuccess: () => queryClient.resetQueries(),\n },\n );\n};\n\nexport const useFinalizeImport = () => {\n const queryClient = useQueryClient();\n const { core } = useONECore();\n\n return useMutation(async () => core.finalizeImport(), {\n onSuccess: () => queryClient.resetQueries(),\n });\n};\n\nexport const useRollbackImport = () => {\n const queryClient = useQueryClient();\n const { core } = useONECore();\n\n return useMutation(async () => core.rollbackImport(), {\n onSuccess: () => queryClient.resetQueries(),\n });\n};\n\n/**\n * Finalize backup import and extract/prepare identifiers\n * @param {IdentifiersInitializationConfig} config Select desired keys/dids to be restored/created\n * @returns [hwIdentifierId, swIdentifierId]\n */\nexport const useBackupFinalizeImportProcedure = ({\n generateHwKey,\n generateSwKey,\n}: IdentifiersInitializationConfig) => {\n const { mutateAsync: finalizeImport } = useFinalizeImport();\n const { core, organisationId } = useONECore();\n\n return useCallback(async () => {\n await finalizeImport();\n\n // update wallet identifier references\n let swIdentifierId: string | undefined;\n if (generateSwKey) {\n const identifiers = await core.getIdentifiers({\n state: IdentifierStateEnum.ACTIVE,\n organisationId,\n page: 0,\n pageSize: 1,\n types: [IdentifierTypeEnum.DID],\n isRemote: false,\n });\n swIdentifierId = identifiers.values.find((identifier) => identifier.name.startsWith(SW_DID_NAME_PREFIX))?.id;\n }\n\n return Promise.all([\n generateHwKey ? generateHwIdentifier(core, organisationId) : null,\n !swIdentifierId && generateSwKey ? generateSwIdentifier(core, organisationId) : swIdentifierId,\n ]).catch((err) => {\n reportException(err, 'Failed to create base identifiers');\n throw err;\n });\n }, [finalizeImport, generateSwKey, generateHwKey, core, organisationId]);\n};\n"],"mappings":"AAAA,SAASA,mBAAmB,EAAEC,kBAAkB,QAAQ,iCAAiC;AACzF,SAASC,WAAW,QAAQ,OAAO;AACnC,SAASC,WAAW,EAAEC,QAAQ,EAAEC,cAAc,QAAQ,aAAa;AAEnE,SAASC,eAAe,QAAQ,iBAAiB;AACjD,SAASC,UAAU,QAAQ,gBAAgB;AAC3C,SACEC,oBAAoB,EACpBC,oBAAoB,EAEpBC,kBAAkB,QACb,aAAa;AACpB,SAASC,sBAAsB,QAAQ,WAAW;AAElD,MAAMC,qBAAqB,GAAG,aAAa;AAE3C,OAAO,MAAMC,aAAa,GAAGA,CAAA,KAAM;EACjC,MAAM;IAAEC;EAAK,CAAC,GAAGP,UAAU,CAAC,CAAC;EAE7B,OAAOH,QAAQ,CAAC,CAACQ,qBAAqB,CAAC,EAAE,MAAME,IAAI,CAACC,UAAU,CAAC,CAAC,EAAE;IAChEC,gBAAgB,EAAE;EACpB,CAAC,CAAC;AACJ,CAAC;AAED,OAAO,MAAMC,eAAe,GAAGA,CAAA,KAAM;EACnC,MAAMC,WAAW,GAAGb,cAAc,CAAC,CAAC;EACpC,MAAM;IAAES;EAAK,CAAC,GAAGP,UAAU,CAAC,CAAC;EAE7B,OAAOJ,WAAW,CAChB,OAAO;IAAEgB,QAA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","ignoreList":[]}
@@ -67,22 +67,6 @@ export const generateSwIdentifier = async (core, organisationId) => {
67
67
  organisationId
68
68
  });
69
69
  };
70
- export const generateAttestationKey = async (core, organisationId) => {
71
- return await core.generateKey({
72
- keyParams: {},
73
- keyType: 'ECDSA',
74
- name: 'holder-key-attestation',
75
- organisationId,
76
- storageParams: {},
77
- storageType: 'SECURE_ELEMENT'
78
- }).catch(e => {
79
- // ignore if Attestation keys not supported by device
80
- if (e instanceof OneError && e.code === OneErrorCode.KeyStorageNotSupported) {
81
- return null;
82
- }
83
- throw e;
84
- });
85
- };
86
70
  /**
87
71
  * Create base local identifiers
88
72
  * @param {IdentifiersInitializationConfig} config Select desired keys/dids to be created
@@ -90,8 +74,7 @@ export const generateAttestationKey = async (core, organisationId) => {
90
74
  */
91
75
  export const useInitializeONECoreIdentifiers = ({
92
76
  generateHwKey,
93
- generateSwKey,
94
- generateAttestationKey: shouldGenerateAttestationKey
77
+ generateSwKey
95
78
  }) => {
96
79
  const {
97
80
  core,
@@ -105,10 +88,10 @@ export const useInitializeONECoreIdentifiers = ({
105
88
  return;
106
89
  }
107
90
  throw e;
108
- }).then(() => Promise.all([generateHwKey ? generateHwIdentifier(core, organisationId) : null, generateSwKey ? generateSwIdentifier(core, organisationId) : null, shouldGenerateAttestationKey ? generateAttestationKey(core, organisationId) : null])).catch(err => {
91
+ }).then(() => Promise.all([generateHwKey ? generateHwIdentifier(core, organisationId) : null, generateSwKey ? generateSwIdentifier(core, organisationId) : null])).catch(err => {
109
92
  reportException(err, 'Failed to create base identifiers');
110
93
  throw err;
111
94
  });
112
- }, [core, organisationId, generateHwKey, generateSwKey, shouldGenerateAttestationKey]);
95
+ }, [core, organisationId, generateHwKey, generateSwKey]);
113
96
  };
114
97
  //# sourceMappingURL=core-init.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["OneError","useCallback","reportException","useONECore","OneErrorCode","SW_DID_NAME_PREFIX","HW_DID_NAME_PREFIX","ATTESTATION_DID_NAME_PREFIX","generateHwIdentifier","core","organisationId","hwKeyId","generateKey","keyParams","keyType","name","storageParams","storageType","catch","e","code","KeyStorageNotSupported","createIdentifier","did","method","keys","assertionMethod","authentication","capabilityDelegation","capabilityInvocation","keyAgreement","params","generateSwIdentifier","swKeyId","generateAttestationKey","useInitializeONECoreIdentifiers","generateHwKey","generateSwKey","shouldGenerateAttestationKey","createOrganisation","id","OrganisationAlreadyExists","then","Promise","all","err"],"sources":["core-init.ts"],"sourcesContent":["import { ONECore, OneError } from '@procivis/react-native-one-core';\nimport { useCallback } from 'react';\n\nimport { reportException } from '../../reporting';\nimport { useONECore } from './core-context';\nimport { OneErrorCode } from './error-code';\n\nexport const SW_DID_NAME_PREFIX = 'holder-did-sw-key';\nexport const HW_DID_NAME_PREFIX = 'holder-did-hw-key';\nexport const ATTESTATION_DID_NAME_PREFIX = 'holder-did-attestation-key';\n\nexport const generateHwIdentifier = async (core: ONECore, organisationId: string) => {\n const hwKeyId = await core\n .generateKey({\n keyParams: {},\n keyType: 'ECDSA',\n name: 'holder-key-hw',\n organisationId,\n storageParams: {},\n storageType: 'SECURE_ELEMENT',\n })\n .catch((e) => {\n // ignore if HW keys not supported by device\n if (e instanceof OneError && e.code === OneErrorCode.KeyStorageNotSupported) {\n return null;\n }\n throw e;\n });\n\n if (hwKeyId) {\n return core.createIdentifier({\n did: {\n method: 'KEY',\n name: HW_DID_NAME_PREFIX,\n keys: {\n assertionMethod: [hwKeyId],\n authentication: [hwKeyId],\n capabilityDelegation: [hwKeyId],\n capabilityInvocation: [hwKeyId],\n keyAgreement: [hwKeyId],\n },\n params: {},\n },\n name: HW_DID_NAME_PREFIX,\n organisationId,\n });\n }\n\n return null;\n};\n\nexport const generateSwIdentifier = async (core: ONECore, organisationId: string) => {\n const swKeyId = await core.generateKey({\n keyParams: {},\n keyType: 'ECDSA',\n name: 'holder-key-sw',\n organisationId,\n storageParams: {},\n storageType: 'INTERNAL',\n });\n\n return core.createIdentifier({\n did: {\n method: 'KEY',\n name: SW_DID_NAME_PREFIX,\n keys: {\n assertionMethod: [swKeyId],\n authentication: [swKeyId],\n capabilityDelegation: [swKeyId],\n capabilityInvocation: [swKeyId],\n keyAgreement: [swKeyId],\n },\n params: {},\n },\n name: SW_DID_NAME_PREFIX,\n organisationId,\n });\n};\n\nexport const generateAttestationKey = async (core: ONECore, organisationId: string) => {\n return await core\n .generateKey({\n keyParams: {},\n keyType: 'ECDSA',\n name: 'holder-key-attestation',\n organisationId,\n storageParams: {},\n storageType: 'SECURE_ELEMENT',\n })\n .catch((e) => {\n // ignore if Attestation keys not supported by device\n if (e instanceof OneError && e.code === OneErrorCode.KeyStorageNotSupported) {\n return null;\n }\n throw e;\n });\n};\n\nexport interface IdentifiersInitializationConfig {\n generateHwKey: boolean;\n generateSwKey: boolean;\n generateAttestationKey: boolean;\n}\n\n/**\n * Create base local identifiers\n * @param {IdentifiersInitializationConfig} config Select desired keys/dids to be created\n * @returns [hwIdentifierId, swIdentifierId]\n */\nexport const useInitializeONECoreIdentifiers = ({\n generateHwKey,\n generateSwKey,\n generateAttestationKey: shouldGenerateAttestationKey,\n}: IdentifiersInitializationConfig) => {\n const { core, organisationId } = useONECore();\n\n return useCallback(async () => {\n return await core\n .createOrganisation({ id: organisationId })\n .catch((e) => {\n if (e instanceof OneError && e.code === OneErrorCode.OrganisationAlreadyExists) {\n return;\n }\n throw e;\n })\n .then(() =>\n Promise.all([\n generateHwKey ? generateHwIdentifier(core, organisationId) : null,\n generateSwKey ? generateSwIdentifier(core, organisationId) : null,\n shouldGenerateAttestationKey ? generateAttestationKey(core, organisationId) : null,\n ]),\n )\n .catch((err) => {\n reportException(err, 'Failed to create base identifiers');\n throw err;\n });\n }, [core, organisationId, generateHwKey, generateSwKey, shouldGenerateAttestationKey]);\n};\n"],"mappings":"AAAA,SAAkBA,QAAQ,QAAQ,iCAAiC;AACnE,SAASC,WAAW,QAAQ,OAAO;AAEnC,SAASC,eAAe,QAAQ,iBAAiB;AACjD,SAASC,UAAU,QAA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AAEI;AACO,CAAC,KAAK;EACrC,MAAM;IAAE7B,IAAI;IAAEC;EAAe,CAAC,GAAGP,UAAU,CAAC,CAAC;EAE7C,OAAOF,WAAW,CAAC,YAAY;IAC7B,OAAO,MAAMQ,IAAI,CACd8B,kBAAkB,CAAC;MAAEC,EAAE,EAAE9B;IAAe,CAAC,CAAC,CAC1CQ,KAAK,CAAEC,CAAC,IAAK;MACZ,IAAIA,CAAC,YAAYnB,QAAQ,IAAImB,CAAC,CAACC,IAAI,KAAKhB,YAAY,CAACqC,yBAAyB,EAAE;QAC9E;MACF;MACA,MAAMtB,CAAC;IACT,CAAC,CAAC,CACDuB,IAAI,CAAC,MACJC,OAAO,CAACC,GAAG,CAAC,CACVR,aAAa,GAAG5B,oBAAoB,CAACC,IAAI,EAAEC,cAAc,CAAC,GAAG,IAAI,EACjE2B,aAAa,GAAGL,oBAAoB,CAACvB,IAAI,EAAEC,cAAc,CAAC,GAAG,IAAI,EACjE4B,4BAA4B,GAAGJ,sBAAsB,CAACzB,IAAI,EAAEC,cAAc,CAAC,GAAG,IAAI,CACnF,CACH,CAAC,CACAQ,KAAK,CAAE2B,GAAG,IAAK;MACd3C,eAAe,CAAC2C,GAAG,EAAE,mCAAmC,CAAC;MACzD,MAAMA,GAAG;IACX,CAAC,CAAC;EACN,CAAC,EAAE,CAACpC,IAAI,EAAEC,cAAc,EAAE0B,aAAa,EAAEC,aAAa,EAAEC,4BAA4B,CAAC,CAAC;AACxF,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["OneError","useCallback","reportException","useONECore","OneErrorCode","SW_DID_NAME_PREFIX","HW_DID_NAME_PREFIX","ATTESTATION_DID_NAME_PREFIX","generateHwIdentifier","core","organisationId","hwKeyId","generateKey","keyParams","keyType","name","storageParams","storageType","catch","e","code","KeyStorageNotSupported","createIdentifier","did","method","keys","assertionMethod","authentication","capabilityDelegation","capabilityInvocation","keyAgreement","params","generateSwIdentifier","swKeyId","useInitializeONECoreIdentifiers","generateHwKey","generateSwKey","createOrganisation","id","OrganisationAlreadyExists","then","Promise","all","err"],"sources":["core-init.ts"],"sourcesContent":["import { ONECore, OneError } from '@procivis/react-native-one-core';\nimport { useCallback } from 'react';\n\nimport { reportException } from '../../reporting';\nimport { useONECore } from './core-context';\nimport { OneErrorCode } from './error-code';\n\nexport const SW_DID_NAME_PREFIX = 'holder-did-sw-key';\nexport const HW_DID_NAME_PREFIX = 'holder-did-hw-key';\nexport const ATTESTATION_DID_NAME_PREFIX = 'holder-did-attestation-key';\n\nexport const generateHwIdentifier = async (core: ONECore, organisationId: string) => {\n const hwKeyId = await core\n .generateKey({\n keyParams: {},\n keyType: 'ECDSA',\n name: 'holder-key-hw',\n organisationId,\n storageParams: {},\n storageType: 'SECURE_ELEMENT',\n })\n .catch((e) => {\n // ignore if HW keys not supported by device\n if (e instanceof OneError && e.code === OneErrorCode.KeyStorageNotSupported) {\n return null;\n }\n throw e;\n });\n\n if (hwKeyId) {\n return core.createIdentifier({\n did: {\n method: 'KEY',\n name: HW_DID_NAME_PREFIX,\n keys: {\n assertionMethod: [hwKeyId],\n authentication: [hwKeyId],\n capabilityDelegation: [hwKeyId],\n capabilityInvocation: [hwKeyId],\n keyAgreement: [hwKeyId],\n },\n params: {},\n },\n name: HW_DID_NAME_PREFIX,\n organisationId,\n });\n }\n\n return null;\n};\n\nexport const generateSwIdentifier = async (core: ONECore, organisationId: string) => {\n const swKeyId = await core.generateKey({\n keyParams: {},\n keyType: 'ECDSA',\n name: 'holder-key-sw',\n organisationId,\n storageParams: {},\n storageType: 'INTERNAL',\n });\n\n return core.createIdentifier({\n did: {\n method: 'KEY',\n name: SW_DID_NAME_PREFIX,\n keys: {\n assertionMethod: [swKeyId],\n authentication: [swKeyId],\n capabilityDelegation: [swKeyId],\n capabilityInvocation: [swKeyId],\n keyAgreement: [swKeyId],\n },\n params: {},\n },\n name: SW_DID_NAME_PREFIX,\n organisationId,\n });\n};\n\nexport interface IdentifiersInitializationConfig {\n generateHwKey: boolean;\n generateSwKey: boolean;\n}\n\n/**\n * Create base local identifiers\n * @param {IdentifiersInitializationConfig} config Select desired keys/dids to be created\n * @returns [hwIdentifierId, swIdentifierId]\n */\nexport const useInitializeONECoreIdentifiers = ({\n generateHwKey,\n generateSwKey,\n}: IdentifiersInitializationConfig) => {\n const { core, organisationId } = useONECore();\n\n return useCallback(async () => {\n return await core\n .createOrganisation({ id: organisationId })\n .catch((e) => {\n if (e instanceof OneError && e.code === OneErrorCode.OrganisationAlreadyExists) {\n return;\n }\n throw e;\n })\n .then(() =>\n Promise.all([\n generateHwKey ? generateHwIdentifier(core, organisationId) : null,\n generateSwKey ? generateSwIdentifier(core, organisationId) : null,\n ]),\n )\n .catch((err) => {\n reportException(err, 'Failed to create base identifiers');\n throw err;\n });\n }, [core, organisationId, generateHwKey, generateSwKey]);\n};\n"],"mappings":"AAAA,SAAkBA,QAAQ,QAAQ,iCAAiC;AACnE,SAASC,WAAW,QAAQ,OAAO;AAEnC,SAASC,eAAe,QAAQ,iBAAiB;AACjD,SAASC,UAAU,QAAQ,gBAAgB;AAC3C,SAASC,YAAY,QAAQ,cAAc;AAE3C,OAAO,MAAMC,kBAAkB,GAAG,mBAAmB;AACrD,OAAO,MAAMC,kBAAkB,GAAG,mBAAmB;AACrD,OAAO,MAAMC,2BAA2B,GAAG,4BAA4B;AAEvE,OAAO,MAAMC,oBAAoB,GAAG,MAAAA,CAAOC,IAAa,EAAEC,cAAsB,KAAK;EACnF,MAAMC,OAAO,GAAG,MAAMF,IAAI,CACvBG,WAAW,CAAC;IACXC,SAAS,EAAE,CAAC,CAAC;IACbC,OAAO,EAAE,OAAO;IAChBC,IAAI,EAAE,eAAe;IACrBL,cAAc;IACdM,aAAa,EAAE,CAAC,CAAC;IACjBC,WAAW,EAAE;EACf,CAAC,CAAC,CACDC,KAAK,CAAEC,CAAC,IAAK;IACZ;IACA,IAAIA,CAAC,YAAYnB,QAAQ,IAAImB,CAAC,CAACC,IAAI,KAAKhB,YAAY,CAACiB,sB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AI,EAAEV,kBAAkB;IACxBK;EACF,CAAC,CAAC;AACJ,CAAC;AAOD;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMwB,+BAA+B,GAAGA,CAAC;EAC9CC,aAAa;EACbC;AAC+B,CAAC,KAAK;EACrC,MAAM;IAAE3B,IAAI;IAAEC;EAAe,CAAC,GAAGP,UAAU,CAAC,CAAC;EAE7C,OAAOF,WAAW,CAAC,YAAY;IAC7B,OAAO,MAAMQ,IAAI,CACd4B,kBAAkB,CAAC;MAAEC,EAAE,EAAE5B;IAAe,CAAC,CAAC,CAC1CQ,KAAK,CAAEC,CAAC,IAAK;MACZ,IAAIA,CAAC,YAAYnB,QAAQ,IAAImB,CAAC,CAACC,IAAI,KAAKhB,YAAY,CAACmC,yBAAyB,EAAE;QAC9E;MACF;MACA,MAAMpB,CAAC;IACT,CAAC,CAAC,CACDqB,IAAI,CAAC,MACJC,OAAO,CAACC,GAAG,CAAC,CACVP,aAAa,GAAG3B,oBAAoB,CAACC,IAAI,EAAEC,cAAc,CAAC,GAAG,IAAI,EACjE0B,aAAa,GAAGJ,oBAAoB,CAACvB,IAAI,EAAEC,cAAc,CAAC,GAAG,IAAI,CAClE,CACH,CAAC,CACAQ,KAAK,CAAEyB,GAAG,IAAK;MACdzC,eAAe,CAACyC,GAAG,EAAE,mCAAmC,CAAC;MACzD,MAAMA,GAAG;IACX,CAAC,CAAC;EACN,CAAC,EAAE,CAAClC,IAAI,EAAEC,cAAc,EAAEyB,aAAa,EAAEC,aAAa,CAAC,CAAC;AAC1D,CAAC","ignoreList":[]}
@@ -97,13 +97,21 @@ export let VerificationProtocol = /*#__PURE__*/function (VerificationProtocol) {
97
97
  VerificationProtocol["SCAN_TO_VERIFY"] = "SCAN_TO_VERIFY";
98
98
  return VerificationProtocol;
99
99
  }({});
100
+ export let VerificationEngagement = /*#__PURE__*/function (VerificationEngagement) {
101
+ VerificationEngagement["QR_CODE"] = "QR_CODE";
102
+ VerificationEngagement["NFC"] = "NFC";
103
+ return VerificationEngagement;
104
+ }({});
100
105
  export const useProposeProof = () => {
101
106
  const queryClient = useQueryClient();
102
107
  const {
103
108
  core,
104
109
  organisationId
105
110
  } = useONECore();
106
- return useMutation(async exchange => core.proposeProof(exchange, organisationId), {
111
+ return useMutation(async ({
112
+ exchange,
113
+ engagement
114
+ }) => core.proposeProof(exchange, organisationId, engagement), {
107
115
  onSuccess: async () => {
108
116
  await queryClient.invalidateQueries(HISTORY_LIST_QUERY_KEY);
109
117
  }
@@ -1 +1 @@
1
- {"version":3,"names":["OneError","ProofStateEnum","useCallback","useEffect","useMemo","useRef","useState","useMutation","useQuery","useQueryClient","getQueryKeyFromProofListQueryParams","reportException","useCoreConfig","useONECore","OneErrorCode","HISTORY_LIST_QUERY_KEY","useIdentifiers","useProofSchemaDetail","PAGE_SIZE","PROOF_DETAIL_QUERY_KEY","PROOF_STATE_QUERY_KEY","PROOF_LIST_QUERY_KEY","useProofDetail","proofId","core","getProof","undefined","enabled","Boolean","keepPreviousData","useProofState","isPolling","then","proof","state","refetchInterval","useProofUrl","queryClient","request","shareProof","url","onSuccess","invalidateQueries","useProofAccept","interactionId","credentials","didId","identifierId","keyId","holderSubmitProof","onError","err","useProofReject","holderRejectProof","catch","e","code","OperationNotSupported","IssuanceProtocol","VerificationProtocol","useProposeProof","organisationId","exchange","proposeProof","useProofDelete","deleteProof","useProofs","queryParams","queryKey","pageParam","getProofs","page","pageSize","useProofCreate","data","createProof","getIdentifierFilterForProofSchema","proofSchema","config","requestedFormats","proofInputSchemas","map","schema","credentialSchema","format","requestedFormatsCapabilities","_config$format$format","capabilities","filter","x","keyAlgorithms","reduce","others","_others$filter","current","verificationKeyAlgorithms","item","includes","keyStorages","_others$filter2","verificationKeyStorages","useProofForSchemaIdWithTransport","proofSchemaId","transport","identifierFilter","identifiers","mutateAsync","deleting","setDeleting","setProofIdState","proofIdRef","proofState","setProofId","id","CREATED","PENDING","values","length","protocol","OPENID4VP_PROXIMITY_DRAFT00","verifierIdentifierId","useCleanupUnusedProofs","proofs","proofStates","cleaned","setCleaned","forEach","useShareProof","proofUrlProps","sharedProof","setSharedProof","bleAdapterDisabled","error","_error$cause","cause","useRetainProofCheck","runTask","removeQueries","useDeleteProofData","deleteProofClaims","useDeleteAllProofsData","schemaId","proofSchemaIds","ACCEPTED","result","Promise","all","reverse"],"sources":["proofs.ts"],"sourcesContent":["import {\n Config,\n CreateProofRequest,\n IdentifierListQuery,\n OneError,\n PresentationSubmitCredentialRequest,\n ProofListQuery,\n ProofSchema,\n ProofStateEnum,\n ShareProofRequest,\n} from '@procivis/react-native-one-core';\nimport { useCallback, useEffect, useMemo, useRef, useState } from 'react';\nimport { useMutation, useQuery, useQueryClient } from 'react-query';\n\nimport { getQueryKeyFromProofListQueryParams } from '../../parsers/query';\nimport { reportException } from '../../reporting';\nimport { Transport } from '../connectivity/connectivity';\nimport { useCoreConfig } from './core-config';\nimport { useONECore } from './core-context';\nimport { OneErrorCode } from './error-code';\nimport { HISTORY_LIST_QUERY_KEY } from './history';\nimport { useIdentifiers } from './identifiers';\nimport { useProofSchemaDetail } from './proof-schemas';\n\nconst PAGE_SIZE = 10;\nexport const PROOF_DETAIL_QUERY_KEY = 'proof-detail';\nexport const PROOF_STATE_QUERY_KEY = 'proof-state';\nexport const PROOF_LIST_QUERY_KEY = 'proof-list';\n\nexport const useProofDetail = (proofId: string | undefined) => {\n const { core } = useONECore();\n\n return useQuery([PROOF_DETAIL_QUERY_KEY, proofId], () => (proofId ? core.getProof(proofId) : undefined), {\n enabled: Boolean(proofId),\n keepPreviousData: true,\n });\n};\n\nexport const useProofState = (proofId: string | undefined, isPolling: boolean) => {\n const { core } = useONECore();\n\n return useQuery(\n [PROOF_STATE_QUERY_KEY, proofId],\n () => (proofId ? core.getProof(proofId).then((proof) => proof.state) : undefined),\n {\n enabled: Boolean(proofId),\n refetchInterval: isPolling ? 1000 : false,\n },\n );\n};\n\ntype ProofUrlHookParams = { proofId: string; request?: ShareProofRequest };\n\nexport const useProofUrl = () => {\n const queryClient = useQueryClient();\n const { core } = useONECore();\n\n return useMutation(\n async ({ proofId, request }: ProofUrlHookParams) =>\n core.shareProof(proofId, request ?? {}).then((proof) => proof.url),\n {\n onSuccess: async () => {\n await queryClient.invalidateQueries(PROOF_DETAIL_QUERY_KEY);\n await queryClient.invalidateQueries(PROOF_STATE_QUERY_KEY);\n },\n },\n );\n};\n\nexport const useProofAccept = () => {\n const queryClient = useQueryClient();\n const { core } = useONECore();\n\n return useMutation(\n async ({\n interactionId,\n credentials,\n didId,\n identifierId,\n keyId,\n }: {\n credentials: Record<string, PresentationSubmitCredentialRequest>;\n didId?: string;\n identifierId?: string;\n interactionId: string;\n keyId?: string;\n }) => core.holderSubmitProof(interactionId, credentials, didId, identifierId, keyId),\n {\n onError: async (err) => {\n reportException(err, 'Proof submission failure');\n await queryClient.invalidateQueries(PROOF_DETAIL_QUERY_KEY);\n },\n onSuccess: async () => {\n await queryClient.invalidateQueries(PROOF_DETAIL_QUERY_KEY);\n await queryClient.invalidateQueries(HISTORY_LIST_QUERY_KEY);\n },\n },\n );\n};\n\nexport const useProofReject = () => {\n const queryClient = useQueryClient();\n const { core } = useONECore();\n\n return useMutation(\n async (interactionId: string) =>\n core.holderRejectProof(interactionId).catch((e) => {\n if (e instanceof OneError && e.code === OneErrorCode.OperationNotSupported) {\n return;\n }\n throw e;\n }),\n {\n onSuccess: async () => {\n await queryClient.invalidateQueries(PROOF_DETAIL_QUERY_KEY);\n await queryClient.invalidateQueries(HISTORY_LIST_QUERY_KEY);\n },\n },\n );\n};\n\nexport enum IssuanceProtocol {\n OPENID4VCI_DRAFT13 = 'OPENID4VCI_DRAFT13',\n}\n\nexport enum VerificationProtocol {\n ISO_MDL = 'ISO_MDL',\n OPENID4VP_DRAFT20 = 'OPENID4VP_DRAFT20',\n OPENID4VP_DRAFT25 = 'OPENID4VP_DRAFT25',\n OPENID4VP_PROXIMITY_DRAFT00 = 'OPENID4VP_PROXIMITY_DRAFT00',\n SCAN_TO_VERIFY = 'SCAN_TO_VERIFY',\n}\n\nexport const useProposeProof = () => {\n const queryClient = useQueryClient();\n const { core, organisationId } = useONECore();\n\n return useMutation(async (exchange: VerificationProtocol) => core.proposeProof(exchange, organisationId), {\n onSuccess: async () => {\n await queryClient.invalidateQueries(HISTORY_LIST_QUERY_KEY);\n },\n });\n};\n\nexport const useProofDelete = () => {\n const queryClient = useQueryClient();\n const { core } = useONECore();\n\n return useMutation(\n async (proofId: string) => {\n return core.deleteProof(proofId).catch((e) => {\n if (e instanceof OneError && e.code === OneErrorCode.OperationNotSupported) {\n return;\n }\n throw e;\n });\n },\n {\n onSuccess: async () => {\n await queryClient.invalidateQueries(PROOF_LIST_QUERY_KEY);\n await queryClient.invalidateQueries(PROOF_STATE_QUERY_KEY);\n await queryClient.invalidateQueries(PROOF_DETAIL_QUERY_KEY);\n await queryClient.invalidateQueries(HISTORY_LIST_QUERY_KEY);\n },\n },\n );\n};\n\nexport const useProofs = (queryParams?: Partial<ProofListQuery>) => {\n const { core, organisationId } = useONECore();\n\n const queryKey = [PROOF_LIST_QUERY_KEY, ...getQueryKeyFromProofListQueryParams(queryParams)];\n\n return useQuery(\n queryKey,\n ({ pageParam = 0 }) =>\n core.getProofs({\n organisationId,\n page: pageParam,\n pageSize: PAGE_SIZE,\n ...queryParams,\n }),\n {\n keepPreviousData: false,\n },\n );\n};\n\nexport const useProofCreate = () => {\n const queryClient = useQueryClient();\n\n const { core } = useONECore();\n\n return useMutation(async (data: CreateProofRequest) => core.createProof(data), {\n onSuccess: async () => {\n await queryClient.invalidateQueries(PROOF_LIST_QUERY_KEY);\n await queryClient.invalidateQueries(PROOF_STATE_QUERY_KEY);\n await queryClient.invalidateQueries(PROOF_DETAIL_QUERY_KEY);\n },\n });\n};\n\nconst getIdentifierFilterForProofSchema = (proofSchema: ProofSchema, config: Config): Partial<IdentifierListQuery> => {\n const requestedFormats = proofSchema.proofInputSchemas.map((schema) => schema.credentialSchema.format);\n const requestedFormatsCapabilities = requestedFormats\n .map((format) => config.format[format]?.capabilities)\n .filter((x) => x);\n\n // key algorithms must be supported by all requested formats\n const keyAlgorithms = requestedFormatsCapabilities.reduce<string[] | undefined>((others, capabilities) => {\n const current = capabilities.verificationKeyAlgorithms;\n return others?.filter((item) => current.includes(item)) ?? current;\n }, undefined);\n\n // key storages must be supported by all requested formats\n const keyStorages = requestedFormatsCapabilities.reduce<string[] | undefined>((others, capabilities) => {\n const current = capabilities.verificationKeyStorages;\n return others?.filter((item) => current.includes(item)) ?? current;\n }, undefined);\n\n return { keyAlgorithms, keyStorages };\n};\n\nexport const useProofForSchemaIdWithTransport = (\n proofSchemaId: string,\n transport: Transport[] | undefined,\n enabled: boolean,\n) => {\n const { data: proofSchema } = useProofSchemaDetail(proofSchemaId, enabled);\n const { data: config } = useCoreConfig();\n\n const identifierFilter = useMemo(\n () => (proofSchema && config ? getIdentifierFilterForProofSchema(proofSchema, config) : undefined),\n [config, proofSchema],\n );\n\n const { data: identifiers } = useIdentifiers(identifierFilter);\n const { mutateAsync: createProof } = useProofCreate();\n const { mutateAsync: deleteProof } = useProofDelete();\n\n const [deleting, setDeleting] = useState(false);\n const [proofId, setProofIdState] = useState<string | undefined>(undefined);\n const proofIdRef = useRef<string>();\n\n const { data: proofState } = useProofState(deleting ? undefined : proofId, enabled);\n\n const setProofId = useCallback((id: string | undefined) => {\n proofIdRef.current = id;\n setProofIdState(id);\n }, []);\n\n useEffect(() => {\n if (!proofIdRef.current) {\n return;\n }\n setDeleting(true);\n deleteProof(proofIdRef.current)\n .then(() => {\n setProofId(undefined);\n setDeleting(false);\n })\n .catch(() => {});\n }, [proofIdRef, deleteProof, proofSchemaId, transport, setProofId]);\n\n useEffect(() => {\n if (enabled) {\n return;\n }\n\n if (proofState !== ProofStateEnum.CREATED && proofState !== ProofStateEnum.PENDING) {\n setProofId(undefined);\n } else {\n setDeleting(true);\n deleteProof(proofIdRef.current || '')\n .then(() => {\n setProofId(undefined);\n setDeleting(false);\n })\n .catch(() => {});\n }\n }, [deleteProof, enabled, proofId, proofState, setProofId]);\n\n useEffect(() => {\n if (\n deleting ||\n !enabled ||\n proofId ||\n !identifiers ||\n !identifierFilter ||\n !identifiers.values.length ||\n !transport ||\n transport.length === 0\n ) {\n return;\n }\n\n createProof({\n protocol: VerificationProtocol.OPENID4VP_PROXIMITY_DRAFT00,\n proofSchemaId,\n transport,\n verifierIdentifierId: identifiers.values[0].id,\n })\n .then((id) => {\n setProofId(id);\n })\n .catch(() => {});\n }, [proofSchemaId, identifiers, identifierFilter, createProof, enabled, transport, proofId, setProofId, deleting]);\n\n return deleting ? undefined : proofId;\n};\n\nexport const useCleanupUnusedProofs = () => {\n const { mutateAsync: deleteProof } = useProofDelete();\n const { data: proofs } = useProofs({\n page: 0,\n pageSize: 100,\n proofStates: [ProofStateEnum.CREATED, ProofStateEnum.PENDING],\n });\n const [cleaned, setCleaned] = useState(false);\n\n useEffect(() => {\n if (cleaned || !proofs) {\n return;\n }\n setCleaned(true);\n proofs.values.forEach((proof) => deleteProof(proof.id));\n }, [cleaned, deleteProof, proofs]);\n};\n\nexport const useShareProof = (proofUrlProps: ProofUrlHookParams | undefined, enabled: boolean) => {\n const { mutateAsync: shareProof } = useProofUrl();\n const { data: proofState } = useProofState(proofUrlProps?.proofId, enabled);\n\n const [sharedProof, setSharedProof] = useState<{\n bleAdapterDisabled: boolean;\n url?: string;\n error?: unknown;\n }>();\n\n // reset when proofId changes or the proof was retracted\n useEffect(() => {\n if (!proofUrlProps?.proofId || proofState === ProofStateEnum.CREATED) {\n setSharedProof(undefined);\n }\n }, [proofUrlProps?.proofId, proofState]);\n\n useEffect(() => {\n if (!proofUrlProps || !enabled || sharedProof) {\n return;\n }\n\n shareProof(proofUrlProps)\n .then((url) => {\n setSharedProof({\n bleAdapterDisabled: false,\n url,\n });\n })\n .catch((error: unknown) => {\n if (error instanceof OneError && error.cause?.includes('BLE adapter not enabled')) {\n setSharedProof({\n bleAdapterDisabled: true,\n });\n } else {\n setSharedProof({ error, bleAdapterDisabled: false });\n }\n });\n }, [enabled, proofUrlProps, shareProof, sharedProof]);\n\n return sharedProof;\n};\n\nexport const useRetainProofCheck = (proofId?: string) => {\n const queryClient = useQueryClient();\n\n const { core } = useONECore();\n\n return useMutation(async () => core.runTask('RETAIN_PROOF_CHECK'), {\n onSuccess: async () => {\n if (proofId) {\n await queryClient.removeQueries([PROOF_DETAIL_QUERY_KEY, proofId]);\n await queryClient.invalidateQueries(HISTORY_LIST_QUERY_KEY);\n }\n },\n });\n};\n\nexport const useDeleteProofData = (proofId: string) => {\n const queryClient = useQueryClient();\n\n const { core } = useONECore();\n\n return useMutation(async () => core.deleteProofClaims(proofId), {\n onSuccess: async () => {\n await queryClient.removeQueries([PROOF_DETAIL_QUERY_KEY, proofId]);\n await queryClient.invalidateQueries(HISTORY_LIST_QUERY_KEY);\n },\n });\n};\n\nexport const useDeleteAllProofsData = (schemaId: string) => {\n const queryClient = useQueryClient();\n\n const { core, organisationId } = useONECore();\n\n return useMutation(\n async () =>\n core\n .getProofs({\n organisationId,\n page: 0,\n pageSize: 1000,\n proofSchemaIds: [schemaId],\n proofStates: [ProofStateEnum.ACCEPTED],\n })\n .then((result) => Promise.all(result.values.reverse().map((proof) => core.deleteProofClaims(proof.id)))),\n {\n onSuccess: async () => {\n await queryClient.invalidateQueries(PROOF_DETAIL_QUERY_KEY);\n await queryClient.invalidateQueries(HISTORY_LIST_QUERY_KEY);\n },\n },\n );\n};\n"],"mappings":"AAAA,SAIEA,QAAQ,EAIRC,cAAc,QAET,iCAAiC;AACxC,SAASC,WAAW,EAAEC,SAAS,EAAEC,OAAO,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,OAAO;AACzE,SAASC,WAAW,EAAEC,QAAQ,EAAEC,cAAc,QAAQ,aAAa;AAEnE,SAASC,mCAAmC,QAAQ,qBAAqB;AACzE,SAASC,eAAe,QAAQ,iBAAiB;AAEjD,SAASC,aAAa,QAAQ,eAAe;AAC7C,SAASC,UAAU,QAAQ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CAACK,iBAAiB,CAAC3B,sBAAsB,CAAC;IAC7D;EACF,CAAC,CAAC;AACJ,CAAC;AAED,OAAO,MAAM6H,sBAAsB,GAAIC,QAAgB,IAAK;EAC1D,MAAMxG,WAAW,GAAG5B,cAAc,CAAC,CAAC;EAEpC,MAAM;IAAEe,IAAI;IAAEqC;EAAe,CAAC,GAAGhD,UAAU,CAAC,CAAC;EAE7C,OAAON,WAAW,CAChB,YACEiB,IAAI,CACD8C,SAAS,CAAC;IACTT,cAAc;IACdU,IAAI,EAAE,CAAC;IACPC,QAAQ,EAAE,IAAI;IACdsE,cAAc,EAAE,CAACD,QAAQ,CAAC;IAC1BlB,WAAW,EAAE,CAAC1H,cAAc,CAAC8I,QAAQ;EACvC,CAAC,CAAC,CACD/G,IAAI,CAAEgH,MAAM,IAAKC,OAAO,CAACC,GAAG,CAACF,MAAM,CAAC5B,MAAM,CAAC+B,OAAO,CAAC,CAAC,CAAClE,GAAG,CAAEhD,KAAK,IAAKT,IAAI,CAACmH,iBAAiB,CAAC1G,KAAK,CAACgF,EAAE,CAAC,CAAC,CAAC,CAAC,EAC5G;IACExE,SAAS,EAAE,MAAAA,CAAA,KAAY;MACrB,MAAMJ,WAAW,CAACK,iBAAiB,CAACvB,sBAAsB,CAAC;MAC3D,MAAMkB,WAAW,CAACK,iBAAiB,CAAC3B,sBAAsB,CAAC;IAC7D;EACF,CACF,CAAC;AACH,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["OneError","ProofStateEnum","useCallback","useEffect","useMemo","useRef","useState","useMutation","useQuery","useQueryClient","getQueryKeyFromProofListQueryParams","reportException","useCoreConfig","useONECore","OneErrorCode","HISTORY_LIST_QUERY_KEY","useIdentifiers","useProofSchemaDetail","PAGE_SIZE","PROOF_DETAIL_QUERY_KEY","PROOF_STATE_QUERY_KEY","PROOF_LIST_QUERY_KEY","useProofDetail","proofId","core","getProof","undefined","enabled","Boolean","keepPreviousData","useProofState","isPolling","then","proof","state","refetchInterval","useProofUrl","queryClient","request","shareProof","url","onSuccess","invalidateQueries","useProofAccept","interactionId","credentials","didId","identifierId","keyId","holderSubmitProof","onError","err","useProofReject","holderRejectProof","catch","e","code","OperationNotSupported","IssuanceProtocol","VerificationProtocol","VerificationEngagement","useProposeProof","organisationId","exchange","engagement","proposeProof","useProofDelete","deleteProof","useProofs","queryParams","queryKey","pageParam","getProofs","page","pageSize","useProofCreate","data","createProof","getIdentifierFilterForProofSchema","proofSchema","config","requestedFormats","proofInputSchemas","map","schema","credentialSchema","format","requestedFormatsCapabilities","_config$format$format","capabilities","filter","x","keyAlgorithms","reduce","others","_others$filter","current","verificationKeyAlgorithms","item","includes","keyStorages","_others$filter2","verificationKeyStorages","useProofForSchemaIdWithTransport","proofSchemaId","transport","identifierFilter","identifiers","mutateAsync","deleting","setDeleting","setProofIdState","proofIdRef","proofState","setProofId","id","CREATED","PENDING","values","length","protocol","OPENID4VP_PROXIMITY_DRAFT00","verifierIdentifierId","useCleanupUnusedProofs","proofs","proofStates","cleaned","setCleaned","forEach","useShareProof","proofUrlProps","sharedProof","setSharedProof","bleAdapterDisabled","error","_error$cause","cause","useRetainProofCheck","runTask","removeQueries","useDeleteProofData","deleteProofClaims","useDeleteAllProofsData","schemaId","proofSchemaIds","ACCEPTED","result","Promise","all","reverse"],"sources":["proofs.ts"],"sourcesContent":["import {\n Config,\n CreateProofRequest,\n IdentifierListQuery,\n OneError,\n PresentationSubmitCredentialRequest,\n ProofListQuery,\n ProofSchema,\n ProofStateEnum,\n ShareProofRequest,\n} from '@procivis/react-native-one-core';\nimport { useCallback, useEffect, useMemo, useRef, useState } from 'react';\nimport { useMutation, useQuery, useQueryClient } from 'react-query';\n\nimport { getQueryKeyFromProofListQueryParams } from '../../parsers/query';\nimport { reportException } from '../../reporting';\nimport { Transport } from '../connectivity/connectivity';\nimport { useCoreConfig } from './core-config';\nimport { useONECore } from './core-context';\nimport { OneErrorCode } from './error-code';\nimport { HISTORY_LIST_QUERY_KEY } from './history';\nimport { useIdentifiers } from './identifiers';\nimport { useProofSchemaDetail } from './proof-schemas';\n\nconst PAGE_SIZE = 10;\nexport const PROOF_DETAIL_QUERY_KEY = 'proof-detail';\nexport const PROOF_STATE_QUERY_KEY = 'proof-state';\nexport const PROOF_LIST_QUERY_KEY = 'proof-list';\n\nexport const useProofDetail = (proofId: string | undefined) => {\n const { core } = useONECore();\n\n return useQuery([PROOF_DETAIL_QUERY_KEY, proofId], () => (proofId ? core.getProof(proofId) : undefined), {\n enabled: Boolean(proofId),\n keepPreviousData: true,\n });\n};\n\nexport const useProofState = (proofId: string | undefined, isPolling: boolean) => {\n const { core } = useONECore();\n\n return useQuery(\n [PROOF_STATE_QUERY_KEY, proofId],\n () => (proofId ? core.getProof(proofId).then((proof) => proof.state) : undefined),\n {\n enabled: Boolean(proofId),\n refetchInterval: isPolling ? 1000 : false,\n },\n );\n};\n\ntype ProofUrlHookParams = { proofId: string; request?: ShareProofRequest };\n\nexport const useProofUrl = () => {\n const queryClient = useQueryClient();\n const { core } = useONECore();\n\n return useMutation(\n async ({ proofId, request }: ProofUrlHookParams) =>\n core.shareProof(proofId, request ?? {}).then((proof) => proof.url),\n {\n onSuccess: async () => {\n await queryClient.invalidateQueries(PROOF_DETAIL_QUERY_KEY);\n await queryClient.invalidateQueries(PROOF_STATE_QUERY_KEY);\n },\n },\n );\n};\n\nexport const useProofAccept = () => {\n const queryClient = useQueryClient();\n const { core } = useONECore();\n\n return useMutation(\n async ({\n interactionId,\n credentials,\n didId,\n identifierId,\n keyId,\n }: {\n credentials: Record<string, PresentationSubmitCredentialRequest>;\n didId?: string;\n identifierId?: string;\n interactionId: string;\n keyId?: string;\n }) => core.holderSubmitProof(interactionId, credentials, didId, identifierId, keyId),\n {\n onError: async (err) => {\n reportException(err, 'Proof submission failure');\n await queryClient.invalidateQueries(PROOF_DETAIL_QUERY_KEY);\n },\n onSuccess: async () => {\n await queryClient.invalidateQueries(PROOF_DETAIL_QUERY_KEY);\n await queryClient.invalidateQueries(HISTORY_LIST_QUERY_KEY);\n },\n },\n );\n};\n\nexport const useProofReject = () => {\n const queryClient = useQueryClient();\n const { core } = useONECore();\n\n return useMutation(\n async (interactionId: string) =>\n core.holderRejectProof(interactionId).catch((e) => {\n if (e instanceof OneError && e.code === OneErrorCode.OperationNotSupported) {\n return;\n }\n throw e;\n }),\n {\n onSuccess: async () => {\n await queryClient.invalidateQueries(PROOF_DETAIL_QUERY_KEY);\n await queryClient.invalidateQueries(HISTORY_LIST_QUERY_KEY);\n },\n },\n );\n};\n\nexport enum IssuanceProtocol {\n OPENID4VCI_DRAFT13 = 'OPENID4VCI_DRAFT13',\n}\n\nexport enum VerificationProtocol {\n ISO_MDL = 'ISO_MDL',\n OPENID4VP_DRAFT20 = 'OPENID4VP_DRAFT20',\n OPENID4VP_DRAFT25 = 'OPENID4VP_DRAFT25',\n OPENID4VP_PROXIMITY_DRAFT00 = 'OPENID4VP_PROXIMITY_DRAFT00',\n SCAN_TO_VERIFY = 'SCAN_TO_VERIFY',\n}\n\nexport enum VerificationEngagement {\n QR_CODE = 'QR_CODE',\n NFC = 'NFC',\n}\n\nexport interface ProposeProofRequest {\n exchange: VerificationProtocol;\n engagement: VerificationEngagement[];\n}\n\nexport const useProposeProof = () => {\n const queryClient = useQueryClient();\n const { core, organisationId } = useONECore();\n\n return useMutation(\n async ({ exchange, engagement }: ProposeProofRequest) => core.proposeProof(exchange, organisationId, engagement),\n {\n onSuccess: async () => {\n await queryClient.invalidateQueries(HISTORY_LIST_QUERY_KEY);\n },\n },\n );\n};\n\nexport const useProofDelete = () => {\n const queryClient = useQueryClient();\n const { core } = useONECore();\n\n return useMutation(\n async (proofId: string) => {\n return core.deleteProof(proofId).catch((e) => {\n if (e instanceof OneError && e.code === OneErrorCode.OperationNotSupported) {\n return;\n }\n throw e;\n });\n },\n {\n onSuccess: async () => {\n await queryClient.invalidateQueries(PROOF_LIST_QUERY_KEY);\n await queryClient.invalidateQueries(PROOF_STATE_QUERY_KEY);\n await queryClient.invalidateQueries(PROOF_DETAIL_QUERY_KEY);\n await queryClient.invalidateQueries(HISTORY_LIST_QUERY_KEY);\n },\n },\n );\n};\n\nexport const useProofs = (queryParams?: Partial<ProofListQuery>) => {\n const { core, organisationId } = useONECore();\n\n const queryKey = [PROOF_LIST_QUERY_KEY, ...getQueryKeyFromProofListQueryParams(queryParams)];\n\n return useQuery(\n queryKey,\n ({ pageParam = 0 }) =>\n core.getProofs({\n organisationId,\n page: pageParam,\n pageSize: PAGE_SIZE,\n ...queryParams,\n }),\n {\n keepPreviousData: false,\n },\n );\n};\n\nexport const useProofCreate = () => {\n const queryClient = useQueryClient();\n\n const { core } = useONECore();\n\n return useMutation(async (data: CreateProofRequest) => core.createProof(data), {\n onSuccess: async () => {\n await queryClient.invalidateQueries(PROOF_LIST_QUERY_KEY);\n await queryClient.invalidateQueries(PROOF_STATE_QUERY_KEY);\n await queryClient.invalidateQueries(PROOF_DETAIL_QUERY_KEY);\n },\n });\n};\n\nconst getIdentifierFilterForProofSchema = (proofSchema: ProofSchema, config: Config): Partial<IdentifierListQuery> => {\n const requestedFormats = proofSchema.proofInputSchemas.map((schema) => schema.credentialSchema.format);\n const requestedFormatsCapabilities = requestedFormats\n .map((format) => config.format[format]?.capabilities)\n .filter((x) => x);\n\n // key algorithms must be supported by all requested formats\n const keyAlgorithms = requestedFormatsCapabilities.reduce<string[] | undefined>((others, capabilities) => {\n const current = capabilities.verificationKeyAlgorithms;\n return others?.filter((item) => current.includes(item)) ?? current;\n }, undefined);\n\n // key storages must be supported by all requested formats\n const keyStorages = requestedFormatsCapabilities.reduce<string[] | undefined>((others, capabilities) => {\n const current = capabilities.verificationKeyStorages;\n return others?.filter((item) => current.includes(item)) ?? current;\n }, undefined);\n\n return { keyAlgorithms, keyStorages };\n};\n\nexport const useProofForSchemaIdWithTransport = (\n proofSchemaId: string,\n transport: Transport[] | undefined,\n enabled: boolean,\n) => {\n const { data: proofSchema } = useProofSchemaDetail(proofSchemaId, enabled);\n const { data: config } = useCoreConfig();\n\n const identifierFilter = useMemo(\n () => (proofSchema && config ? getIdentifierFilterForProofSchema(proofSchema, config) : undefined),\n [config, proofSchema],\n );\n\n const { data: identifiers } = useIdentifiers(identifierFilter);\n const { mutateAsync: createProof } = useProofCreate();\n const { mutateAsync: deleteProof } = useProofDelete();\n\n const [deleting, setDeleting] = useState(false);\n const [proofId, setProofIdState] = useState<string | undefined>(undefined);\n const proofIdRef = useRef<string>();\n\n const { data: proofState } = useProofState(deleting ? undefined : proofId, enabled);\n\n const setProofId = useCallback((id: string | undefined) => {\n proofIdRef.current = id;\n setProofIdState(id);\n }, []);\n\n useEffect(() => {\n if (!proofIdRef.current) {\n return;\n }\n setDeleting(true);\n deleteProof(proofIdRef.current)\n .then(() => {\n setProofId(undefined);\n setDeleting(false);\n })\n .catch(() => {});\n }, [proofIdRef, deleteProof, proofSchemaId, transport, setProofId]);\n\n useEffect(() => {\n if (enabled) {\n return;\n }\n\n if (proofState !== ProofStateEnum.CREATED && proofState !== ProofStateEnum.PENDING) {\n setProofId(undefined);\n } else {\n setDeleting(true);\n deleteProof(proofIdRef.current || '')\n .then(() => {\n setProofId(undefined);\n setDeleting(false);\n })\n .catch(() => {});\n }\n }, [deleteProof, enabled, proofId, proofState, setProofId]);\n\n useEffect(() => {\n if (\n deleting ||\n !enabled ||\n proofId ||\n !identifiers ||\n !identifierFilter ||\n !identifiers.values.length ||\n !transport ||\n transport.length === 0\n ) {\n return;\n }\n\n createProof({\n protocol: VerificationProtocol.OPENID4VP_PROXIMITY_DRAFT00,\n proofSchemaId,\n transport,\n verifierIdentifierId: identifiers.values[0].id,\n })\n .then((id) => {\n setProofId(id);\n })\n .catch(() => {});\n }, [proofSchemaId, identifiers, identifierFilter, createProof, enabled, transport, proofId, setProofId, deleting]);\n\n return deleting ? undefined : proofId;\n};\n\nexport const useCleanupUnusedProofs = () => {\n const { mutateAsync: deleteProof } = useProofDelete();\n const { data: proofs } = useProofs({\n page: 0,\n pageSize: 100,\n proofStates: [ProofStateEnum.CREATED, ProofStateEnum.PENDING],\n });\n const [cleaned, setCleaned] = useState(false);\n\n useEffect(() => {\n if (cleaned || !proofs) {\n return;\n }\n setCleaned(true);\n proofs.values.forEach((proof) => deleteProof(proof.id));\n }, [cleaned, deleteProof, proofs]);\n};\n\nexport const useShareProof = (proofUrlProps: ProofUrlHookParams | undefined, enabled: boolean) => {\n const { mutateAsync: shareProof } = useProofUrl();\n const { data: proofState } = useProofState(proofUrlProps?.proofId, enabled);\n\n const [sharedProof, setSharedProof] = useState<{\n bleAdapterDisabled: boolean;\n url?: string;\n error?: unknown;\n }>();\n\n // reset when proofId changes or the proof was retracted\n useEffect(() => {\n if (!proofUrlProps?.proofId || proofState === ProofStateEnum.CREATED) {\n setSharedProof(undefined);\n }\n }, [proofUrlProps?.proofId, proofState]);\n\n useEffect(() => {\n if (!proofUrlProps || !enabled || sharedProof) {\n return;\n }\n\n shareProof(proofUrlProps)\n .then((url) => {\n setSharedProof({\n bleAdapterDisabled: false,\n url,\n });\n })\n .catch((error: unknown) => {\n if (error instanceof OneError && error.cause?.includes('BLE adapter not enabled')) {\n setSharedProof({\n bleAdapterDisabled: true,\n });\n } else {\n setSharedProof({ error, bleAdapterDisabled: false });\n }\n });\n }, [enabled, proofUrlProps, shareProof, sharedProof]);\n\n return sharedProof;\n};\n\nexport const useRetainProofCheck = (proofId?: string) => {\n const queryClient = useQueryClient();\n\n const { core } = useONECore();\n\n return useMutation(async () => core.runTask('RETAIN_PROOF_CHECK'), {\n onSuccess: async () => {\n if (proofId) {\n await queryClient.removeQueries([PROOF_DETAIL_QUERY_KEY, proofId]);\n await queryClient.invalidateQueries(HISTORY_LIST_QUERY_KEY);\n }\n },\n });\n};\n\nexport const useDeleteProofData = (proofId: string) => {\n const queryClient = useQueryClient();\n\n const { core } = useONECore();\n\n return useMutation(async () => core.deleteProofClaims(proofId), {\n onSuccess: async () => {\n await queryClient.removeQueries([PROOF_DETAIL_QUERY_KEY, proofId]);\n await queryClient.invalidateQueries(HISTORY_LIST_QUERY_KEY);\n },\n });\n};\n\nexport const useDeleteAllProofsData = (schemaId: string) => {\n const queryClient = useQueryClient();\n\n const { core, organisationId } = useONECore();\n\n return useMutation(\n async () =>\n core\n .getProofs({\n organisationId,\n page: 0,\n pageSize: 1000,\n proofSchemaIds: [schemaId],\n proofStates: [ProofStateEnum.ACCEPTED],\n })\n .then((result) => Promise.all(result.values.reverse().map((proof) => core.deleteProofClaims(proof.id)))),\n {\n onSuccess: async () => {\n await queryClient.invalidateQueries(PROOF_DETAIL_QUERY_KEY);\n await queryClient.invalidateQueries(HISTORY_LIST_QUERY_KEY);\n },\n },\n );\n};\n"],"mappings":"AAAA,SAIEA,QAAQ,EAIRC,cAAc,QAET,iCAAiC;AACxC,SAASC,WAAW,EAAEC,SAAS,EAAEC,OAAO,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,OAAO;AACzE,SAASC,WAAW,EAAEC,QAAQ,EAAEC,cAAc,QAAQ,aAAa;AAEnE,SAASC,mCAAmC,QAAQ,qBAAqB;AACzE,SAASC,eAAe,QAAQ,iBAAiB;AAEjD,SAASC,aAAa,QAAQ,eAAe;AAC7C,SAASC,UAAU,QAAQ,gBAAgB;AAC3C,SAASC,YAAY,QAAQ,cAAc;AAC3C,SAASC,sBAAsB,QAAQ,WAAW;AAClD,SAASC,cAAc,QAAQ,eAAe;AAC9C,SAASC,oBAAoB,QAAQ,iBAAiB;AAEtD,MAAMC,SAAS,GAAG,EAAE;AACpB,OAAO,MAAMC,sBAAsB,GAAG,cAAc;AACpD,OAAO,MAAMC,qBAAqB,GAAG,aAAa;AAClD,OAAO,MAAMC,oBAAoB,GAAG,YAAY;AAEhD,OAAO,MAAMC,cAAc,GAAIC,OAA2B,IAAK;EAC7D,MAAM;IAAEC;EAAK,CAAC,GAAGX,UAAU,CAAC,CAAC;EAE7B,OAAOL,QAAQ,CAAC,CAACW,sBAAsB,EAAEI,OAAO,CAAC,EAAE,MAAOA,OAAO,GAAGC,IAAI,CAAC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;IACdsE,cAAc,EAAE,CAACD,QAAQ,CAAC;IAC1BlB,WAAW,EAAE,CAAC5H,cAAc,CAACgJ,QAAQ;EACvC,CAAC,CAAC,CACDjH,IAAI,CAAEkH,MAAM,IAAKC,OAAO,CAACC,GAAG,CAACF,MAAM,CAAC5B,MAAM,CAAC+B,OAAO,CAAC,CAAC,CAAClE,GAAG,CAAElD,KAAK,IAAKT,IAAI,CAACqH,iBAAiB,CAAC5G,KAAK,CAACkF,EAAE,CAAC,CAAC,CAAC,CAAC,EAC5G;IACE1E,SAAS,EAAE,MAAAA,CAAA,KAAY;MACrB,MAAMJ,WAAW,CAACK,iBAAiB,CAACvB,sBAAsB,CAAC;MAC3D,MAAMkB,WAAW,CAACK,iBAAiB,CAAC3B,sBAAsB,CAAC;IAC7D;EACF,CACF,CAAC;AACH,CAAC","ignoreList":[]}
@@ -4,6 +4,7 @@ export * from './credential-card/credential-card-expanding';
4
4
  export * from './header/on-scroll-header-state';
5
5
  export * from './list/list-content-inset';
6
6
  export * from './navigation';
7
+ export * from './nfc/nfc-status';
7
8
  export * from './pin-security/pin-security';
8
9
  export * from './revocation/credential-status';
9
10
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from './connectivity/connectivity';\nexport * from './core';\nexport * from './credential-card/credential-card-expanding';\nexport * from './header/on-scroll-header-state';\nexport * from './list/list-content-inset';\nexport * from './navigation';\nexport * from './pin-security/pin-security';\nexport * from './revocation/credential-status';\n"],"mappings":"AAAA,cAAc,6BAA6B;AAC3C,cAAc,QAAQ;AACtB,cAAc,6CAA6C;AAC3D,cAAc,iCAAiC;AAC/C,cAAc,2BAA2B;AACzC,cAAc,cAAc;AAC5B,cAAc,6BAA6B;AAC3C,cAAc,gCAAgC","ignoreList":[]}
1
+ {"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from './connectivity/connectivity';\nexport * from './core';\nexport * from './credential-card/credential-card-expanding';\nexport * from './header/on-scroll-header-state';\nexport * from './list/list-content-inset';\nexport * from './navigation';\nexport * from './nfc/nfc-status';\nexport * from './pin-security/pin-security';\nexport * from './revocation/credential-status';\n"],"mappings":"AAAA,cAAc,6BAA6B;AAC3C,cAAc,QAAQ;AACtB,cAAc,6CAA6C;AAC3D,cAAc,iCAAiC;AAC/C,cAAc,2BAA2B;AACzC,cAAc,cAAc;AAC5B,cAAc,kBAAkB;AAChC,cAAc,6BAA6B;AAC3C,cAAc,gCAAgC","ignoreList":[]}
@@ -0,0 +1,32 @@
1
+ import { useCallback, useEffect, useState } from 'react';
2
+ import NfcManager from 'react-native-nfc-manager';
3
+ export const useNFCStatus = () => {
4
+ const [isNFCEnabled, setIsNFCEnabled] = useState();
5
+ const [isLoading, setIsLoading] = useState();
6
+ const [error, setError] = useState();
7
+ const checkNFCStatus = useCallback(async () => {
8
+ try {
9
+ setIsLoading(true);
10
+ const isEnabled = await NfcManager.isEnabled();
11
+ setIsNFCEnabled(isEnabled);
12
+ setIsLoading(false);
13
+ } catch (e) {
14
+ setError(e);
15
+ }
16
+ }, []);
17
+ useEffect(() => {
18
+ // eslint-disable-next-line @typescript-eslint/no-floating-promises
19
+ checkNFCStatus();
20
+ }, [checkNFCStatus]);
21
+ const recheck = useCallback(() => {
22
+ // eslint-disable-next-line @typescript-eslint/no-floating-promises
23
+ checkNFCStatus();
24
+ }, [checkNFCStatus]);
25
+ return {
26
+ error,
27
+ isLoading,
28
+ isNFCEnabled,
29
+ recheck
30
+ };
31
+ };
32
+ //# sourceMappingURL=nfc-status.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["useCallback","useEffect","useState","NfcManager","useNFCStatus","isNFCEnabled","setIsNFCEnabled","isLoading","setIsLoading","error","setError","checkNFCStatus","isEnabled","e","recheck"],"sources":["nfc-status.ts"],"sourcesContent":["import { useCallback, useEffect, useState } from 'react';\nimport NfcManager from 'react-native-nfc-manager';\n\nexport const useNFCStatus = () => {\n const [isNFCEnabled, setIsNFCEnabled] = useState<boolean>();\n const [isLoading, setIsLoading] = useState<boolean>();\n const [error, setError] = useState<unknown>();\n\n const checkNFCStatus = useCallback(async () => {\n try {\n setIsLoading(true);\n const isEnabled = await NfcManager.isEnabled();\n setIsNFCEnabled(isEnabled);\n setIsLoading(false);\n } catch (e) {\n setError(e);\n }\n }, []);\n\n useEffect(() => {\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n checkNFCStatus();\n }, [checkNFCStatus]);\n\n const recheck = useCallback(() => {\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n checkNFCStatus();\n }, [checkNFCStatus]);\n\n return { error, isLoading, isNFCEnabled, recheck };\n};\n"],"mappings":"AAAA,SAASA,WAAW,EAAEC,SAAS,EAAEC,QAAQ,QAAQ,OAAO;AACxD,OAAOC,UAAU,MAAM,0BAA0B;AAEjD,OAAO,MAAMC,YAAY,GAAGA,CAAA,KAAM;EAChC,MAAM,CAACC,YAAY,EAAEC,eAAe,CAAC,GAAGJ,QAAQ,CAAU,CAAC;EAC3D,MAAM,CAACK,SAAS,EAAEC,YAAY,CAAC,GAAGN,QAAQ,CAAU,CAAC;EACrD,MAAM,CAACO,KAAK,EAAEC,QAAQ,CAAC,GAAGR,QAAQ,CAAU,CAAC;EAE7C,MAAMS,cAAc,GAAGX,WAAW,CAAC,YAAY;IAC7C,IAAI;MACFQ,YAAY,CAAC,IAAI,CAAC;MAClB,MAAMI,SAAS,GAAG,MAAMT,UAAU,CAACS,SAAS,CAAC,CAAC;MAC9CN,eAAe,CAACM,SAAS,CAAC;MAC1BJ,YAAY,CAAC,KAAK,CAAC;IACrB,CAAC,CAAC,OAAOK,CAAC,EAAE;MACVH,QAAQ,CAACG,CAAC,CAAC;IACb;EACF,CAAC,EAAE,EAAE,CAAC;EAENZ,SAAS,CAAC,MAAM;IACd;IACAU,cAAc,CAAC,CAAC;EAClB,CAAC,EAAE,CAACA,cAAc,CAAC,CAAC;EAEpB,MAAMG,OAAO,GAAGd,WAAW,CAAC,MAAM;IAChC;IACAW,cAAc,CAAC,CAAC;EAClB,CAAC,EAAE,CAACA,cAAc,CAAC,CAAC;EAEpB,OAAO;IAAEF,KAAK;IAAEF,SAAS;IAAEF,YAAY;IAAES;EAAQ,CAAC;AACpD,CAAC","ignoreList":[]}
@@ -15,4 +15,5 @@ export * from './reporting';
15
15
  export * from './string';
16
16
  export * from './useMemoAsync';
17
17
  export * from './uuid';
18
+ export * from './url';
18
19
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["ContrastingStatusBar","concatTestID"],"sources":["index.ts"],"sourcesContent":["import ContrastingStatusBar from './contrasting-status-bar';\nimport { concatTestID } from './testID';\n\nexport { concatTestID, ContrastingStatusBar };\n\nexport * from './array';\nexport * from './backup';\nexport * from './color';\nexport * from './date';\nexport * from './filtering';\nexport * from './history';\nexport * from './hooks';\nexport * from './navigation';\nexport * from './parsers';\nexport * from './ref';\nexport * from './reporting';\nexport * from './string';\nexport * from './useMemoAsync';\nexport * from './uuid';\n"],"mappings":"AAAA,OAAOA,oBAAoB,MAAM,0BAA0B;AAC3D,SAASC,YAAY,QAAQ,UAAU;AAEvC,SAASA,YAAY,EAAED,oBAAoB;AAE3C,cAAc,SAAS;AACvB,cAAc,UAAU;AACxB,cAAc,SAAS;AACvB,cAAc,QAAQ;AACtB,cAAc,aAAa;AAC3B,cAAc,WAAW;AACzB,cAAc,SAAS;AACvB,cAAc,cAAc;AAC5B,cAAc,WAAW;AACzB,cAAc,OAAO;AACrB,cAAc,aAAa;AAC3B,cAAc,UAAU;AACxB,cAAc,gBAAgB;AAC9B,cAAc,QAAQ","ignoreList":[]}
1
+ {"version":3,"names":["ContrastingStatusBar","concatTestID"],"sources":["index.ts"],"sourcesContent":["import ContrastingStatusBar from './contrasting-status-bar';\nimport { concatTestID } from './testID';\n\nexport { concatTestID, ContrastingStatusBar };\n\nexport * from './array';\nexport * from './backup';\nexport * from './color';\nexport * from './date';\nexport * from './filtering';\nexport * from './history';\nexport * from './hooks';\nexport * from './navigation';\nexport * from './parsers';\nexport * from './ref';\nexport * from './reporting';\nexport * from './string';\nexport * from './useMemoAsync';\nexport * from './uuid';\nexport * from './url';\n"],"mappings":"AAAA,OAAOA,oBAAoB,MAAM,0BAA0B;AAC3D,SAASC,YAAY,QAAQ,UAAU;AAEvC,SAASA,YAAY,EAAED,oBAAoB;AAE3C,cAAc,SAAS;AACvB,cAAc,UAAU;AACxB,cAAc,SAAS;AACvB,cAAc,QAAQ;AACtB,cAAc,aAAa;AAC3B,cAAc,WAAW;AACzB,cAAc,SAAS;AACvB,cAAc,cAAc;AAC5B,cAAc,WAAW;AACzB,cAAc,OAAO;AACrB,cAAc,aAAa;AAC3B,cAAc,UAAU;AACxB,cAAc,gBAAgB;AAC9B,cAAc,QAAQ;AACtB,cAAc,OAAO","ignoreList":[]}
@@ -5,7 +5,7 @@ function getQueryKey(queryParams, params) {
5
5
  return params.map(param => queryParams[param]);
6
6
  }
7
7
  export const getQueryKeyFromCredentialListQueryParams = (queryParams = {}) => {
8
- return getQueryKey(queryParams, ['page', 'pageSize', 'organisationId', 'name', 'searchText', 'searchType', 'sort', 'sortDirection', 'exact', 'role', 'ids', 'status', 'include', 'profile', 'createdDateAfter', 'createdDateBefore', 'lastModifiedAfter', 'lastModifiedBefore', 'issuanceDateAfter', 'issuanceDateBefore', 'revocationDateAfter', 'revocationDateBefore']);
8
+ return getQueryKey(queryParams, ['page', 'pageSize', 'organisationId', 'name', 'searchText', 'searchType', 'sort', 'sortDirection', 'exact', 'role', 'ids', 'status', 'include', 'profile', 'credentialSchemaIds', 'createdDateAfter', 'createdDateBefore', 'lastModifiedAfter', 'lastModifiedBefore', 'issuanceDateAfter', 'issuanceDateBefore', 'revocationDateAfter', 'revocationDateBefore']);
9
9
  };
10
10
  export const getQueryKeyFromHistoryListQueryParams = (queryParams = {}) => {
11
11
  return getQueryKey(queryParams, ['page', 'pageSize', 'organisationId', 'entityId', 'actions', 'entityTypes', 'createdDateAfter', 'createdDateBefore', 'identifierId', 'credentialId', 'credentialSchemaId', 'proofSchemaId', 'search']);