@procivis/one-react-native-components 0.3.22 → 0.3.47

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 (234) hide show
  1. package/lib/commonjs/components/entity/entity-attributes.js +15 -2
  2. package/lib/commonjs/components/entity/entity-attributes.js.map +1 -1
  3. package/lib/commonjs/components/entity/entity-details-with-buttons.js +14 -38
  4. package/lib/commonjs/components/entity/entity-details-with-buttons.js.map +1 -1
  5. package/lib/commonjs/components/entity/entity-details.js +63 -34
  6. package/lib/commonjs/components/entity/entity-details.js.map +1 -1
  7. package/lib/commonjs/components/entity/index.js +2 -15
  8. package/lib/commonjs/components/entity/index.js.map +1 -1
  9. package/lib/commonjs/components/history/history-list-item-icon.js +4 -1
  10. package/lib/commonjs/components/history/history-list-item-icon.js.map +1 -1
  11. package/lib/commonjs/components/history/history-list-item.js +15 -3
  12. package/lib/commonjs/components/history/history-list-item.js.map +1 -1
  13. package/lib/commonjs/components/history/history-list-screen.js +2 -0
  14. package/lib/commonjs/components/history/history-list-screen.js.map +1 -1
  15. package/lib/commonjs/components/proof-request/share-credential.js +2 -2
  16. package/lib/commonjs/components/proof-request/share-credential.js.map +1 -1
  17. package/lib/commonjs/ui-components/blur/index.js +2 -9
  18. package/lib/commonjs/ui-components/blur/index.js.map +1 -1
  19. package/lib/commonjs/ui-components/buttons/hold-button.js +3 -2
  20. package/lib/commonjs/ui-components/buttons/hold-button.js.map +1 -1
  21. package/lib/commonjs/ui-components/camera/index.js +2 -9
  22. package/lib/commonjs/ui-components/camera/index.js.map +1 -1
  23. package/lib/commonjs/ui-components/control/index.js +0 -12
  24. package/lib/commonjs/ui-components/control/index.js.map +1 -1
  25. package/lib/commonjs/ui-components/credential/card/credential-details-card.js +1 -1
  26. package/lib/commonjs/ui-components/credential/card/credential-details-card.js.map +1 -1
  27. package/lib/commonjs/ui-components/credential/credential-carousel-images.js +15 -8
  28. package/lib/commonjs/ui-components/credential/credential-carousel-images.js.map +1 -1
  29. package/lib/commonjs/ui-components/entity/entity-cluster.js +51 -3
  30. package/lib/commonjs/ui-components/entity/entity-cluster.js.map +1 -1
  31. package/lib/commonjs/ui-components/entity/index.js +3 -16
  32. package/lib/commonjs/ui-components/entity/index.js.map +1 -1
  33. package/lib/commonjs/ui-components/history/history-details.js +1 -1
  34. package/lib/commonjs/ui-components/history/history-details.js.map +1 -1
  35. package/lib/commonjs/ui-components/history/index.js +4 -27
  36. package/lib/commonjs/ui-components/history/index.js.map +1 -1
  37. package/lib/commonjs/ui-components/icons/entity.js +26 -1
  38. package/lib/commonjs/ui-components/icons/entity.js.map +1 -1
  39. package/lib/commonjs/ui-components/icons/history.js +3 -1
  40. package/lib/commonjs/ui-components/icons/history.js.map +1 -1
  41. package/lib/commonjs/ui-components/input/index.js +3 -32
  42. package/lib/commonjs/ui-components/input/index.js.map +1 -1
  43. package/lib/commonjs/ui-components/list/index.js +4 -19
  44. package/lib/commonjs/ui-components/list/index.js.map +1 -1
  45. package/lib/commonjs/ui-components/loader/index.js +2 -13
  46. package/lib/commonjs/ui-components/loader/index.js.map +1 -1
  47. package/lib/commonjs/ui-components/pin/index.js +2 -21
  48. package/lib/commonjs/ui-components/pin/index.js.map +1 -1
  49. package/lib/commonjs/ui-components/screens/nerd-mode-screen.js +1 -1
  50. package/lib/commonjs/ui-components/screens/nerd-mode-screen.js.map +1 -1
  51. package/lib/commonjs/ui-components/searchbar/index.js +3 -16
  52. package/lib/commonjs/ui-components/searchbar/index.js.map +1 -1
  53. package/lib/commonjs/ui-components/settings/index.js +6 -37
  54. package/lib/commonjs/ui-components/settings/index.js.map +1 -1
  55. package/lib/commonjs/ui-components/state/index.js +2 -15
  56. package/lib/commonjs/ui-components/state/index.js.map +1 -1
  57. package/lib/commonjs/utils/date.js +1 -1
  58. package/lib/commonjs/utils/date.js.map +1 -1
  59. package/lib/commonjs/utils/hooks/connectivity/connectivity.test.js +4 -0
  60. package/lib/commonjs/utils/hooks/connectivity/connectivity.test.js.map +1 -1
  61. package/lib/commonjs/utils/hooks/core/backup.js +22 -66
  62. package/lib/commonjs/utils/hooks/core/backup.js.map +1 -1
  63. package/lib/commonjs/utils/hooks/core/core-init.js +33 -25
  64. package/lib/commonjs/utils/hooks/core/core-init.js.map +1 -1
  65. package/lib/commonjs/utils/hooks/core/credentials.js +2 -1
  66. package/lib/commonjs/utils/hooks/core/credentials.js.map +1 -1
  67. package/lib/commonjs/utils/hooks/core/identifiers.js +42 -0
  68. package/lib/commonjs/utils/hooks/core/identifiers.js.map +1 -0
  69. package/lib/commonjs/utils/hooks/core/index.js +11 -0
  70. package/lib/commonjs/utils/hooks/core/index.js.map +1 -1
  71. package/lib/commonjs/utils/hooks/core/proofs.js +26 -15
  72. package/lib/commonjs/utils/hooks/core/proofs.js.map +1 -1
  73. package/lib/commonjs/utils/hooks/core/trust-entity.js +60 -13
  74. package/lib/commonjs/utils/hooks/core/trust-entity.js.map +1 -1
  75. package/lib/commonjs/utils/parsers/credential-sharing.js +9 -15
  76. package/lib/commonjs/utils/parsers/credential-sharing.js.map +1 -1
  77. package/lib/commonjs/utils/parsers/credential.js +7 -0
  78. package/lib/commonjs/utils/parsers/credential.js.map +1 -1
  79. package/lib/commonjs/utils/parsers/query.js +22 -4
  80. package/lib/commonjs/utils/parsers/query.js.map +1 -1
  81. package/lib/module/components/entity/entity-attributes.js +16 -3
  82. package/lib/module/components/entity/entity-attributes.js.map +1 -1
  83. package/lib/module/components/entity/entity-details-with-buttons.js +16 -40
  84. package/lib/module/components/entity/entity-details-with-buttons.js.map +1 -1
  85. package/lib/module/components/entity/entity-details.js +65 -36
  86. package/lib/module/components/entity/entity-details.js.map +1 -1
  87. package/lib/module/components/entity/index.js +2 -2
  88. package/lib/module/components/entity/index.js.map +1 -1
  89. package/lib/module/components/history/history-list-item-icon.js +5 -2
  90. package/lib/module/components/history/history-list-item-icon.js.map +1 -1
  91. package/lib/module/components/history/history-list-item.js +16 -4
  92. package/lib/module/components/history/history-list-item.js.map +1 -1
  93. package/lib/module/components/history/history-list-screen.js +2 -0
  94. package/lib/module/components/history/history-list-screen.js.map +1 -1
  95. package/lib/module/components/proof-request/share-credential.js +2 -2
  96. package/lib/module/components/proof-request/share-credential.js.map +1 -1
  97. package/lib/module/ui-components/blur/index.js +2 -2
  98. package/lib/module/ui-components/blur/index.js.map +1 -1
  99. package/lib/module/ui-components/buttons/hold-button.js +4 -3
  100. package/lib/module/ui-components/buttons/hold-button.js.map +1 -1
  101. package/lib/module/ui-components/camera/index.js +2 -2
  102. package/lib/module/ui-components/camera/index.js.map +1 -1
  103. package/lib/module/ui-components/control/index.js +3 -3
  104. package/lib/module/ui-components/control/index.js.map +1 -1
  105. package/lib/module/ui-components/credential/card/credential-details-card.js +1 -1
  106. package/lib/module/ui-components/credential/card/credential-details-card.js.map +1 -1
  107. package/lib/module/ui-components/credential/credential-carousel-images.js +15 -8
  108. package/lib/module/ui-components/credential/credential-carousel-images.js.map +1 -1
  109. package/lib/module/ui-components/entity/entity-cluster.js +52 -4
  110. package/lib/module/ui-components/entity/entity-cluster.js.map +1 -1
  111. package/lib/module/ui-components/entity/index.js +4 -4
  112. package/lib/module/ui-components/entity/index.js.map +1 -1
  113. package/lib/module/ui-components/history/history-details.js +1 -1
  114. package/lib/module/ui-components/history/history-details.js.map +1 -1
  115. package/lib/module/ui-components/history/index.js +6 -6
  116. package/lib/module/ui-components/history/index.js.map +1 -1
  117. package/lib/module/ui-components/icons/entity.js +24 -0
  118. package/lib/module/ui-components/icons/entity.js.map +1 -1
  119. package/lib/module/ui-components/icons/history.js +2 -0
  120. package/lib/module/ui-components/icons/history.js.map +1 -1
  121. package/lib/module/ui-components/input/index.js +6 -6
  122. package/lib/module/ui-components/input/index.js.map +1 -1
  123. package/lib/module/ui-components/list/index.js +4 -4
  124. package/lib/module/ui-components/list/index.js.map +1 -1
  125. package/lib/module/ui-components/loader/index.js +4 -4
  126. package/lib/module/ui-components/loader/index.js.map +1 -1
  127. package/lib/module/ui-components/pin/index.js +3 -3
  128. package/lib/module/ui-components/pin/index.js.map +1 -1
  129. package/lib/module/ui-components/screens/nerd-mode-screen.js +1 -1
  130. package/lib/module/ui-components/screens/nerd-mode-screen.js.map +1 -1
  131. package/lib/module/ui-components/searchbar/index.js +4 -4
  132. package/lib/module/ui-components/searchbar/index.js.map +1 -1
  133. package/lib/module/ui-components/settings/index.js +10 -10
  134. package/lib/module/ui-components/settings/index.js.map +1 -1
  135. package/lib/module/ui-components/state/index.js +2 -2
  136. package/lib/module/ui-components/state/index.js.map +1 -1
  137. package/lib/module/utils/date.js +1 -1
  138. package/lib/module/utils/date.js.map +1 -1
  139. package/lib/module/utils/hooks/connectivity/connectivity.test.js +4 -0
  140. package/lib/module/utils/hooks/connectivity/connectivity.test.js.map +1 -1
  141. package/lib/module/utils/hooks/core/backup.js +24 -68
  142. package/lib/module/utils/hooks/core/backup.js.map +1 -1
  143. package/lib/module/utils/hooks/core/core-init.js +30 -24
  144. package/lib/module/utils/hooks/core/core-init.js.map +1 -1
  145. package/lib/module/utils/hooks/core/credentials.js +2 -1
  146. package/lib/module/utils/hooks/core/credentials.js.map +1 -1
  147. package/lib/module/utils/hooks/core/identifiers.js +34 -0
  148. package/lib/module/utils/hooks/core/identifiers.js.map +1 -0
  149. package/lib/module/utils/hooks/core/index.js +1 -0
  150. package/lib/module/utils/hooks/core/index.js.map +1 -1
  151. package/lib/module/utils/hooks/core/proofs.js +26 -15
  152. package/lib/module/utils/hooks/core/proofs.js.map +1 -1
  153. package/lib/module/utils/hooks/core/trust-entity.js +60 -13
  154. package/lib/module/utils/hooks/core/trust-entity.js.map +1 -1
  155. package/lib/module/utils/parsers/credential-sharing.js +9 -15
  156. package/lib/module/utils/parsers/credential-sharing.js.map +1 -1
  157. package/lib/module/utils/parsers/credential.js +7 -0
  158. package/lib/module/utils/parsers/credential.js.map +1 -1
  159. package/lib/module/utils/parsers/query.js +20 -3
  160. package/lib/module/utils/parsers/query.js.map +1 -1
  161. package/lib/typescript/components/entity/entity-attributes.d.ts +1 -0
  162. package/lib/typescript/components/entity/entity-details-with-buttons.d.ts +2 -2
  163. package/lib/typescript/components/entity/entity-details.d.ts +4 -2
  164. package/lib/typescript/components/entity/index.d.ts +2 -1
  165. package/lib/typescript/components/history/history-list-item.d.ts +1 -0
  166. package/lib/typescript/components/history/history-list-screen.d.ts +2 -0
  167. package/lib/typescript/ui-components/blur/index.d.ts +2 -1
  168. package/lib/typescript/ui-components/buttons/hold-button.d.ts +2 -2
  169. package/lib/typescript/ui-components/camera/index.d.ts +2 -1
  170. package/lib/typescript/ui-components/control/index.d.ts +4 -2
  171. package/lib/typescript/ui-components/credential/credential-carousel-images.d.ts +1 -0
  172. package/lib/typescript/ui-components/entity/entity-cluster.d.ts +1 -0
  173. package/lib/typescript/ui-components/entity/index.d.ts +4 -2
  174. package/lib/typescript/ui-components/history/history-details.d.ts +4 -1
  175. package/lib/typescript/ui-components/history/index.d.ts +6 -3
  176. package/lib/typescript/ui-components/icons/entity.d.ts +1 -0
  177. package/lib/typescript/ui-components/icons/history.d.ts +2 -0
  178. package/lib/typescript/ui-components/input/index.d.ts +6 -3
  179. package/lib/typescript/ui-components/list/index.d.ts +4 -2
  180. package/lib/typescript/ui-components/loader/index.d.ts +4 -2
  181. package/lib/typescript/ui-components/pin/index.d.ts +4 -2
  182. package/lib/typescript/ui-components/screens/nerd-mode-screen.d.ts +4 -4
  183. package/lib/typescript/ui-components/searchbar/index.d.ts +4 -2
  184. package/lib/typescript/ui-components/settings/index.d.ts +10 -5
  185. package/lib/typescript/ui-components/state/index.d.ts +2 -1
  186. package/lib/typescript/utils/hooks/core/backup.d.ts +5 -0
  187. package/lib/typescript/utils/hooks/core/core-init.d.ts +4 -1
  188. package/lib/typescript/utils/hooks/core/credentials.d.ts +2 -1
  189. package/lib/typescript/utils/hooks/core/identifiers.d.ts +5 -0
  190. package/lib/typescript/utils/hooks/core/index.d.ts +1 -0
  191. package/lib/typescript/utils/hooks/core/proofs.d.ts +3 -1
  192. package/lib/typescript/utils/hooks/core/trust-entity.d.ts +10 -4
  193. package/lib/typescript/utils/parsers/query.d.ts +3 -2
  194. package/package.json +9 -4
  195. package/src/components/entity/entity-attributes.tsx +17 -3
  196. package/src/components/entity/entity-details-with-buttons.tsx +17 -42
  197. package/src/components/entity/entity-details.tsx +64 -37
  198. package/src/components/entity/index.ts +2 -1
  199. package/src/components/history/history-list-item-icon.tsx +5 -0
  200. package/src/components/history/history-list-item.tsx +19 -4
  201. package/src/components/history/history-list-screen.tsx +4 -1
  202. package/src/components/proof-request/share-credential.tsx +1 -1
  203. package/src/ui-components/blur/index.ts +2 -1
  204. package/src/ui-components/buttons/hold-button.tsx +6 -5
  205. package/src/ui-components/camera/index.tsx +2 -1
  206. package/src/ui-components/control/index.ts +4 -2
  207. package/src/ui-components/credential/card/credential-details-card.tsx +1 -1
  208. package/src/ui-components/credential/credential-carousel-images.tsx +15 -8
  209. package/src/ui-components/entity/entity-cluster.tsx +63 -10
  210. package/src/ui-components/entity/index.ts +4 -2
  211. package/src/ui-components/history/history-details.tsx +5 -2
  212. package/src/ui-components/history/index.ts +6 -3
  213. package/src/ui-components/icons/entity.tsx +23 -0
  214. package/src/ui-components/icons/history.tsx +2 -0
  215. package/src/ui-components/input/index.ts +6 -3
  216. package/src/ui-components/list/index.ts +4 -2
  217. package/src/ui-components/loader/index.ts +4 -2
  218. package/src/ui-components/pin/index.ts +4 -2
  219. package/src/ui-components/screens/nerd-mode-screen.tsx +5 -5
  220. package/src/ui-components/searchbar/index.ts +4 -2
  221. package/src/ui-components/settings/index.ts +10 -5
  222. package/src/ui-components/state/index.ts +2 -1
  223. package/src/utils/date.ts +1 -1
  224. package/src/utils/hooks/connectivity/connectivity.test.ts +7 -2
  225. package/src/utils/hooks/core/backup.ts +30 -72
  226. package/src/utils/hooks/core/core-init.ts +29 -23
  227. package/src/utils/hooks/core/credentials.ts +9 -3
  228. package/src/utils/hooks/core/identifiers.ts +39 -0
  229. package/src/utils/hooks/core/index.ts +2 -1
  230. package/src/utils/hooks/core/proofs.ts +31 -18
  231. package/src/utils/hooks/core/trust-entity.ts +55 -17
  232. package/src/utils/parsers/credential-sharing.tsx +30 -36
  233. package/src/utils/parsers/credential.ts +4 -0
  234. package/src/utils/parsers/query.tsx +14 -4
@@ -1,6 +1,13 @@
1
- import React, { FunctionComponent, useMemo } from 'react';
1
+ import React, { FunctionComponent, useEffect, useMemo } from 'react';
2
2
  import { Platform, StyleSheet, View, ViewProps } from 'react-native';
3
+ import Animated, {
4
+ useAnimatedStyle,
5
+ useSharedValue,
6
+ withRepeat,
7
+ withTiming,
8
+ } from 'react-native-reanimated';
3
9
 
10
+ import { LoaderView, LoaderViewState } from '../../ui-components/loader';
4
11
  import { concatTestID } from '../../utils';
5
12
  import Typography from '../text/typography';
6
13
  import { useAppColorScheme } from '../theme/color-scheme-context';
@@ -13,6 +20,7 @@ export type EntityClusterProps = ViewProps & {
13
20
  textColor?: string;
14
21
  sublineColor?: string;
15
22
  testID?: string;
23
+ isLoading?: boolean;
16
24
  };
17
25
 
18
26
  // https://www.figma.com/file/52qDYWUMjXAGre1dcnz5bz/Procivis-One-Wallet?type=design&node-id=426-25595&mode=design&t=YI1oD2BfBie5HcvJ-0
@@ -24,31 +32,67 @@ const EntityCluster: FunctionComponent<EntityClusterProps> = ({
24
32
  style,
25
33
  sublineColor,
26
34
  testID,
35
+ isLoading,
27
36
  ...viewProps
28
37
  }) => {
29
38
  const colorScheme = useAppColorScheme();
39
+
40
+ const opacity = useSharedValue<number>(1);
41
+
42
+ const animatedStyle = useAnimatedStyle(() => ({
43
+ opacity: opacity.value,
44
+ }));
45
+
46
+ useEffect(() => {
47
+ if (!isLoading) {
48
+ return;
49
+ }
50
+ opacity.value = withRepeat(
51
+ withTiming(0.3, { duration: 1000 }),
52
+ 0,
53
+ true
54
+ );
55
+ }, [opacity, isLoading]);
30
56
 
31
57
  const avatarProps = useMemo<AvatarProps>(() => {
58
+ if (isLoading) {
59
+ return {
60
+ avatar: {
61
+ component:
62
+ <View style={[styles.loaderWrapper, { backgroundColor: colorScheme.grayDark }]}>
63
+ <View style={styles.loader}>
64
+ <LoaderView animate={true} state={LoaderViewState.InProgress} />
65
+ </View>
66
+ </View>
67
+ }
68
+ }
69
+ }
32
70
  const initials = entityName.split(' ', 3).map((word: string) => word[0]);
33
71
  const placeholderText = initials.length > 0 ? initials.join('') : '';
34
72
  return {
35
73
  ...avatar,
36
74
  placeholderText: avatar?.placeholderText ?? placeholderText,
37
75
  };
38
- }, [avatar, entityName]);
76
+ }, [avatar, entityName, colorScheme.grayDark, isLoading]);
39
77
 
40
78
  return (
41
79
  <View style={[styles.entity, style]} testID={testID} {...viewProps}>
42
80
  <Avatar testID={concatTestID(testID, 'avatar')} {...avatarProps} />
43
81
  <View style={styles.labels}>
44
- <Typography
45
- testID={concatTestID(testID, 'entityName')}
46
- color={textColor ?? colorScheme.text}
47
- numberOfLines={2}
48
- preset="m"
49
- style={styles.entityName}>
50
- {entityName}
51
- </Typography>
82
+ {isLoading ? (
83
+ <Animated.View style={[{ backgroundColor: colorScheme.grayDark }, animatedStyle]}>
84
+ <Typography color={colorScheme.grayDark} />
85
+ </Animated.View>
86
+ ) : (
87
+ <Typography
88
+ testID={concatTestID(testID, 'entityName')}
89
+ color={textColor ?? colorScheme.text}
90
+ numberOfLines={1}
91
+ preset="m"
92
+ style={styles.entityName}>
93
+ {!isLoading ? entityName : undefined}
94
+ </Typography>
95
+ )}
52
96
  {subline && (
53
97
  <View>
54
98
  <Typography
@@ -77,6 +121,15 @@ const styles = StyleSheet.create({
77
121
  flex: 1,
78
122
  marginLeft: 12,
79
123
  },
124
+ loader: {
125
+ transform: [{scale: 0.5}],
126
+ },
127
+ loaderWrapper: {
128
+ height: 72,
129
+ paddingLeft: 3,
130
+ paddingTop: 4,
131
+ width: 72,
132
+ }
80
133
  });
81
134
 
82
135
  export default EntityCluster;
@@ -1,5 +1,7 @@
1
- import Avatar, { AvatarProps } from './avatar';
2
- import EntityCluster, { EntityClusterProps } from './entity-cluster';
1
+ import type { AvatarProps } from './avatar';
2
+ import Avatar from './avatar';
3
+ import type { EntityClusterProps } from './entity-cluster';
4
+ import EntityCluster from './entity-cluster';
3
5
 
4
6
  export { Avatar, AvatarProps };
5
7
  export { EntityCluster, EntityClusterProps };
@@ -37,7 +37,10 @@ type CredentialDetails = Omit<
37
37
  type CredentialCard = Omit<
38
38
  CredentialDetailsCardListItemProps,
39
39
  'expanded' | 'labels' | 'lastItem' | 'onHeaderPress' | 'onImagePreview'
40
- >;
40
+ > & {
41
+ /** default: true */
42
+ headerPressable?: boolean;
43
+ };
41
44
 
42
45
  export type HistoryDetailsViewProps = {
43
46
  assets?: {
@@ -195,7 +198,7 @@ export const HistoryDetailsView: FC<HistoryDetailsViewProps> = ({
195
198
  ...props.credentialCard,
196
199
  card: {
197
200
  ...props.credentialCard.card,
198
- onHeaderPress,
201
+ onHeaderPress: props.credentialCard.headerPressable === false ? undefined : onHeaderPress,
199
202
  },
200
203
  };
201
204
  return (
@@ -1,7 +1,10 @@
1
- import DataItem, { DataItemProps } from './data-item';
2
- import HistoryItemView, { HistoryItemViewProps } from './history-item';
1
+ import type { DataItemProps } from './data-item';
2
+ import DataItem from './data-item';
3
+ import type { HistoryItemViewProps } from './history-item';
4
+ import HistoryItemView from './history-item';
3
5
  import HistorySectionHeaderView from './history-section-header';
4
- import HistorySectionListItem, { HistorySectionListItemProps } from './history-section-list-item';
6
+ import type { HistorySectionListItemProps } from './history-section-list-item';
7
+ import HistorySectionListItem from './history-section-list-item';
5
8
 
6
9
  export * from './history-details';
7
10
  export { DataItem, DataItemProps };
@@ -29,3 +29,26 @@ export const EntityTrustedIcon: FC<SvgProps> = ({ ...props }) => {
29
29
  </Svg>
30
30
  );
31
31
  };
32
+
33
+ // https://www.figma.com/design/52qDYWUMjXAGre1dcnz5bz/Procivis-One-Wallet?node-id=415-5402&t=8jP7yF4eYj70Gm9A-0
34
+ export const EntityNotTrustedIcon: FC<SvgProps> = ({ ...props }) => {
35
+ const colorScheme = useAppColorScheme();
36
+ return (
37
+ <Svg width={22} height={22} viewBox="0 0 22 22" fill="none" {...props}>
38
+ <Path
39
+ d="M10.575 20a8.241 8.241 0 01-3.312-.672 8.649 8.649 0 01-2.74-1.851 8.837 8.837 0 01-1.85-2.74A8.242 8.242 0 012 11.425c0-1.173.224-2.277.672-3.312a8.793 8.793 0 014.582-4.59 8.243 8.243 0 013.312-.672c1.18 0 2.286.224 3.32.672a8.766 8.766 0 012.74 1.86 8.667 8.667 0 011.86 2.73 8.243 8.243 0 01.672 3.312 8.243 8.243 0 01-.673 3.312 8.768 8.768 0 01-4.598 4.59 8.241 8.241 0 01-3.312.673z"
40
+ fill={colorScheme.error}
41
+ />
42
+ <Path
43
+ d="M10.566 1.85c1.31 0 2.552.25 3.718.755a9.765 9.765 0 013.047 2.068l.321.335a9.671 9.671 0 011.751 2.708 9.244 9.244 0 01.755 3.71c0 1.304-.25 2.544-.755 3.709a9.766 9.766 0 01-5.123 5.112h0a9.242 9.242 0 01-3.705.753 9.244 9.244 0 01-3.706-.754 9.648 9.648 0 01-3.053-2.062l-.003-.002a9.836 9.836 0 01-2.058-3.047A9.242 9.242 0 011 11.425c0-1.304.25-2.544.755-3.71a9.793 9.793 0 015.1-5.11h.001a9.244 9.244 0 013.71-.754z"
44
+ stroke={colorScheme.white}
45
+ strokeOpacity={0.2}
46
+ strokeWidth={2}
47
+ />
48
+ <Path
49
+ d="M8.433 14.712a.822.822 0 01-.58.225.773.773 0 01-.557-.225.773.773 0 01-.224-.556c0-.216.077-.398.232-.548l2.167-2.174-2.167-2.159a.768.768 0 01-.232-.547c0-.227.074-.413.224-.557a.773.773 0 01.556-.224c.216 0 .401.072.556.216l2.175 2.167 2.183-2.167a.759.759 0 01.556-.232c.216 0 .399.077.548.232.155.15.232.332.232.548 0 .21-.077.396-.232.556l-2.175 2.167 2.167 2.166c.155.144.232.33.232.556a.759.759 0 01-.232.556.755.755 0 01-.556.225.765.765 0 01-.565-.225l-2.158-2.166-2.15 2.166z"
50
+ fill={colorScheme.white}
51
+ />
52
+ </Svg>
53
+ )
54
+ }
@@ -114,6 +114,8 @@ export const HistorySuspendIcon: FC<SvgProps> = (props) => {
114
114
 
115
115
  // TODO: replace HistoryDidIcon with icon of schema
116
116
  export const HistoryDidIcon = HistoryIssueIcon;
117
+ export const HistoryIdentifierIcon = HistoryIssueIcon;
118
+ export const HistoryCertificateIcon = HistoryIssueIcon;
117
119
 
118
120
  // TODO: replace HistoryKeyIcon with icon of schema
119
121
  export const HistoryKeyIcon = HistoryIssueIcon;
@@ -1,6 +1,9 @@
1
- import RadioGroup, { RadioGroupItem, RadioGroupProps } from './radio-group';
2
- import SelectionInput, { SelectionInputChoice, SelectionInputProps } from './selection-input';
3
- import TextInput, { TextInputAccessory, TextInputProps } from './text-input';
1
+ import type { RadioGroupItem, RadioGroupProps } from './radio-group';
2
+ import RadioGroup from './radio-group';
3
+ import type { SelectionInputChoice, SelectionInputProps } from './selection-input';
4
+ import SelectionInput from './selection-input';
5
+ import type { TextInputProps } from './text-input';
6
+ import TextInput, { TextInputAccessory } from './text-input';
4
7
 
5
8
  export { RadioGroup, RadioGroupItem, RadioGroupProps };
6
9
  export { SelectionInput, SelectionInputChoice, SelectionInputProps };
@@ -1,5 +1,7 @@
1
- import ListSectionHeader, { ListSectionHeaderProps } from './list-section-header';
2
- import ListTitleHeader, { ListTitleHeaderProps } from './list-title-header';
1
+ import type { ListSectionHeaderProps } from './list-section-header';
2
+ import ListSectionHeader from './list-section-header';
3
+ import type { ListTitleHeaderProps } from './list-title-header';
4
+ import ListTitleHeader from './list-title-header';
3
5
 
4
6
  export { ListSectionHeader, ListSectionHeaderProps };
5
7
  export { ListTitleHeader, ListTitleHeaderProps };
@@ -1,5 +1,7 @@
1
- import LoaderView, { LoaderViewProps, LoaderViewState } from './loader';
2
- import LoadingResultScreen, { LoadingResultScreenProps } from './loading-result';
1
+ import type { LoaderViewProps } from './loader';
2
+ import LoaderView, { LoaderViewState } from './loader';
3
+ import type { LoadingResultScreenProps } from './loading-result';
4
+ import LoadingResultScreen from './loading-result';
3
5
 
4
6
  export { LoaderView, LoaderViewProps, LoaderViewState };
5
7
  export { LoadingResultScreen, LoadingResultScreenProps };
@@ -1,5 +1,7 @@
1
1
  import { Biometry } from './keypad';
2
- import { PinCodeScreen, PinCodeScreenActions, PinCodeScreenProps } from './pin-code-screen';
3
- import PinLockModal, { PinLockModalLabels } from './pin-lock';
2
+ import type { PinCodeScreenActions, PinCodeScreenProps } from './pin-code-screen';
3
+ import { PinCodeScreen } from './pin-code-screen';
4
+ import type { PinLockModalLabels } from './pin-lock';
5
+ import PinLockModal from './pin-lock';
4
6
 
5
7
  export { Biometry, PinCodeScreen, PinCodeScreenActions, PinCodeScreenProps, PinLockModal, PinLockModalLabels };
@@ -1,4 +1,4 @@
1
- import { DidListItem } from '@procivis/react-native-one-core';
1
+ import { IdentifierListItem } from '@procivis/react-native-one-core';
2
2
  import React, { FunctionComponent, useState } from 'react';
3
3
  import { SectionList, StyleSheet, View } from 'react-native';
4
4
  import Animated, { useAnimatedScrollHandler, useSharedValue } from 'react-native-reanimated';
@@ -26,15 +26,15 @@ export interface EntityLabels {
26
26
 
27
27
  export interface AttributesLabels {
28
28
  trustRegistry: string;
29
- issuerDid: string;
30
- entityDid: string;
29
+ issuerIdentifier: string;
30
+ entityIdentifier: string;
31
31
  role: string;
32
32
  expand: string;
33
33
  collapse: string;
34
34
  }
35
35
 
36
36
  interface SectionEntityCluster {
37
- did?: DidListItem;
37
+ identifier?: IdentifierListItem;
38
38
  subline?: string;
39
39
  entityLabels: EntityLabels;
40
40
  role: ContextRole;
@@ -66,7 +66,7 @@ export enum EntityType {
66
66
  }
67
67
 
68
68
  function isSectionEntityCluster(item: NerdModeSectionItem): item is SectionEntityCluster {
69
- return (item as SectionEntityCluster).did !== undefined;
69
+ return (item as SectionEntityCluster).identifier !== undefined;
70
70
  }
71
71
 
72
72
  const AnimatedSectionList = Animated.createAnimatedComponent(SectionList<NerdModeSectionItem>);
@@ -1,5 +1,7 @@
1
- import AnimatedSearchBar, { AnimatedSearchBarProps } from './animated-search-bar';
2
- import SearchBar, { SearchBarProps } from './search-bar';
1
+ import type { AnimatedSearchBarProps } from './animated-search-bar';
2
+ import AnimatedSearchBar from './animated-search-bar';
3
+ import type { SearchBarProps } from './search-bar';
4
+ import SearchBar from './search-bar';
3
5
 
4
6
  export { AnimatedSearchBar, AnimatedSearchBarProps };
5
7
  export { SearchBar, SearchBarProps };
@@ -1,8 +1,13 @@
1
- import ButtonSetting, { ButtonSettingProps } from './button-setting';
2
- import SettingItem, { SettingItemProps } from './setting-item';
3
- import SettingItemSeparator, { SettingItemSeparatorProps } from './setting-item-separator';
4
- import SettingsButton, { SettingsButtonProps } from './settings-button';
5
- import SwitchSetting, { SwitchSettingProps } from './switch-setting';
1
+ import type { ButtonSettingProps } from './button-setting';
2
+ import ButtonSetting from './button-setting';
3
+ import type { SettingItemProps } from './setting-item';
4
+ import SettingItem from './setting-item';
5
+ import type { SettingItemSeparatorProps } from './setting-item-separator';
6
+ import SettingItemSeparator from './setting-item-separator';
7
+ import type { SettingsButtonProps } from './settings-button';
8
+ import SettingsButton from './settings-button';
9
+ import type { SwitchSettingProps } from './switch-setting';
10
+ import SwitchSetting from './switch-setting';
6
11
 
7
12
  export { ButtonSetting, ButtonSettingProps };
8
13
  export { SettingItem, SettingItemProps };
@@ -1,3 +1,4 @@
1
- import ErrorScreen, { ErrorScreenButton, ErrorScreenProps } from './error-screen';
1
+ import type { ErrorScreenButton, ErrorScreenProps } from './error-screen';
2
+ import ErrorScreen from './error-screen';
2
3
 
3
4
  export { ErrorScreen, ErrorScreenButton, ErrorScreenProps };
package/src/utils/date.ts CHANGED
@@ -9,7 +9,7 @@ const DAY = 24 * 60 * MINUTE;
9
9
  // OS locale
10
10
  const systemLocale: string | undefined = I18nManager.getConstants().localeIdentifier
11
11
  ?.replace(/_/g, '-')
12
- .split('#')[0]
12
+ .split(/[#@]/)[0]
13
13
  .replace(/-$/, '');
14
14
 
15
15
  /**
@@ -8,12 +8,17 @@ jest.mock('@sentry/react-native', () => ({
8
8
  captureException: () => {},
9
9
  }));
10
10
 
11
+ jest.mock('../core/core-config', () => ({
12
+ getEnabledTransports: () => [],
13
+ useCoreConfig: () => ({}),
14
+ }));
15
+
11
16
  jest.mock('@react-native-community/netinfo', () => ({
12
- addEventListener: () => {},
17
+ addEventListener: () => { },
13
18
  }));
14
19
 
15
20
  jest.mock('react-native-bluetooth-state-manager', () => ({
16
- onStateChange: () => {},
21
+ onStateChange: () => { },
17
22
  }));
18
23
 
19
24
  describe('getInvitationUrlTransports', () => {
@@ -1,11 +1,15 @@
1
- import { DidTypeEnum, OneError } from '@procivis/react-native-one-core';
1
+ import { IdentifierStateEnum, IdentifierTypeEnum } from '@procivis/react-native-one-core';
2
2
  import { useCallback } from 'react';
3
3
  import { useMutation, useQuery, useQueryClient } from 'react-query';
4
4
 
5
- import { generateUUID } from '../../uuid';
5
+ import { reportException } from '../../reporting';
6
6
  import { useONECore } from './core-context';
7
- import { HW_DID_NAME_PREFIX, IdentifiersInitializationConfig, SW_DID_NAME_PREFIX } from './core-init';
8
- import { OneErrorCode } from './error-code';
7
+ import {
8
+ generateHwIdentifier,
9
+ generateSwIdentifier,
10
+ IdentifiersInitializationConfig,
11
+ SW_DID_NAME_PREFIX,
12
+ } from './core-init';
9
13
  import { HISTORY_LIST_QUERY_KEY } from './history';
10
14
 
11
15
  const BACKUP_INFO_QUERY_KEY = 'backup-info';
@@ -61,6 +65,11 @@ export const useRollbackImport = () => {
61
65
  });
62
66
  };
63
67
 
68
+ /**
69
+ * Finalize backup import and extract/prepare identifiers
70
+ * @param {IdentifiersInitializationConfig} config Select desired keys/dids to be restored/created
71
+ * @returns [hwIdentifierId, swIdentifierId]
72
+ */
64
73
  export const useBackupFinalizeImportProcedure = ({ generateHwKey, generateSwKey }: IdentifiersInitializationConfig) => {
65
74
  const { mutateAsync: finalizeImport } = useFinalizeImport();
66
75
  const { core, organisationId } = useONECore();
@@ -68,77 +77,26 @@ export const useBackupFinalizeImportProcedure = ({ generateHwKey, generateSwKey
68
77
  return useCallback(async () => {
69
78
  await finalizeImport();
70
79
 
71
- // update wallet did references
72
- const dids = await core.getDids({
73
- deactivated: false,
74
- organisationId,
75
- page: 0,
76
- pageSize: 1,
77
- type: DidTypeEnum.LOCAL,
78
- });
79
- let swDidId = dids.values.find((did) => did.name.startsWith(SW_DID_NAME_PREFIX))?.id;
80
-
81
- if (!swDidId && generateSwKey) {
82
- const swKeyId = await core.generateKey({
83
- keyParams: {},
84
- keyType: 'EDDSA',
85
- name: `holder-key-sw-${generateUUID()}`,
86
- organisationId,
87
- storageParams: {},
88
- storageType: 'INTERNAL',
89
- });
90
- swDidId = await core.createDid({
91
- didMethod: 'KEY',
92
- keys: {
93
- assertionMethod: [swKeyId],
94
- authentication: [swKeyId],
95
- capabilityDelegation: [swKeyId],
96
- capabilityInvocation: [swKeyId],
97
- keyAgreement: [swKeyId],
98
- },
99
- name: `${SW_DID_NAME_PREFIX}-${generateUUID()}`,
80
+ // update wallet identifier references
81
+ let swIdentifierId: string | undefined;
82
+ if (generateSwKey) {
83
+ const identifiers = await core.getIdentifiers({
84
+ state: IdentifierStateEnum.ACTIVE,
100
85
  organisationId,
101
- params: {},
86
+ page: 0,
87
+ pageSize: 1,
88
+ types: [IdentifierTypeEnum.DID],
89
+ isRemote: false,
102
90
  });
91
+ swIdentifierId = identifiers.values.find((identifier) => identifier.name.startsWith(SW_DID_NAME_PREFIX))?.id;
103
92
  }
104
93
 
105
- let hwKeyId: string | null = null;
106
- if (generateHwKey) {
107
- hwKeyId = await core
108
- .generateKey({
109
- keyParams: {},
110
- keyType: 'ECDSA',
111
- name: `holder-key-hw-${generateUUID()}`,
112
- organisationId,
113
- storageParams: {},
114
- storageType: 'SECURE_ELEMENT',
115
- })
116
- .catch((e) => {
117
- // ignore if HW keys not supported by device
118
- if (e instanceof OneError && e.code === OneErrorCode.KeyStorageNotSupported) {
119
- return null;
120
- }
121
- throw e;
122
- });
123
- }
124
-
125
- let hwDidId: string | null = null;
126
- if (hwKeyId) {
127
- hwDidId = await core.createDid({
128
- didMethod: 'KEY',
129
- keys: {
130
- assertionMethod: [hwKeyId],
131
- authentication: [hwKeyId],
132
- capabilityDelegation: [hwKeyId],
133
- capabilityInvocation: [hwKeyId],
134
- keyAgreement: [hwKeyId],
135
- },
136
- name: `${HW_DID_NAME_PREFIX}-${generateUUID()}`,
137
- organisationId,
138
- params: {},
139
- });
140
- }
141
-
142
- return [hwDidId, swDidId] as [string | null, string | undefined];
94
+ return Promise.all([
95
+ generateHwKey ? generateHwIdentifier(core, organisationId) : null,
96
+ !swIdentifierId && generateSwKey ? generateSwIdentifier(core, organisationId) : swIdentifierId,
97
+ ]).catch((err) => {
98
+ reportException(err, 'Failed to create base identifiers');
99
+ throw err;
100
+ });
143
101
  }, [core, organisationId, finalizeImport, generateHwKey, generateSwKey]);
144
102
  };
@@ -8,7 +8,7 @@ import { OneErrorCode } from './error-code';
8
8
  export const SW_DID_NAME_PREFIX = 'holder-did-sw-key';
9
9
  export const HW_DID_NAME_PREFIX = 'holder-did-hw-key';
10
10
 
11
- const generateHwDid = async (core: ONECore, organisationId: string) => {
11
+ export const generateHwIdentifier = async (core: ONECore, organisationId: string) => {
12
12
  const hwKeyId = await core
13
13
  .generateKey({
14
14
  keyParams: {},
@@ -27,25 +27,28 @@ const generateHwDid = async (core: ONECore, organisationId: string) => {
27
27
  });
28
28
 
29
29
  if (hwKeyId) {
30
- return core.createDid({
31
- didMethod: 'KEY',
32
- keys: {
33
- assertionMethod: [hwKeyId],
34
- authentication: [hwKeyId],
35
- capabilityDelegation: [hwKeyId],
36
- capabilityInvocation: [hwKeyId],
37
- keyAgreement: [hwKeyId],
30
+ return core.createIdentifier({
31
+ did: {
32
+ method: 'KEY',
33
+ name: HW_DID_NAME_PREFIX,
34
+ keys: {
35
+ assertionMethod: [hwKeyId],
36
+ authentication: [hwKeyId],
37
+ capabilityDelegation: [hwKeyId],
38
+ capabilityInvocation: [hwKeyId],
39
+ keyAgreement: [hwKeyId],
40
+ },
41
+ params: {},
38
42
  },
39
43
  name: HW_DID_NAME_PREFIX,
40
44
  organisationId,
41
- params: {},
42
45
  });
43
46
  }
44
47
 
45
48
  return null;
46
49
  };
47
50
 
48
- const generateSwDid = async (core: ONECore, organisationId: string) => {
51
+ export const generateSwIdentifier = async (core: ONECore, organisationId: string) => {
49
52
  const swKeyId = await core.generateKey({
50
53
  keyParams: {},
51
54
  keyType: 'ECDSA',
@@ -55,18 +58,21 @@ const generateSwDid = async (core: ONECore, organisationId: string) => {
55
58
  storageType: 'INTERNAL',
56
59
  });
57
60
 
58
- return core.createDid({
59
- didMethod: 'KEY',
60
- keys: {
61
- assertionMethod: [swKeyId],
62
- authentication: [swKeyId],
63
- capabilityDelegation: [swKeyId],
64
- capabilityInvocation: [swKeyId],
65
- keyAgreement: [swKeyId],
61
+ return core.createIdentifier({
62
+ did: {
63
+ method: 'KEY',
64
+ name: SW_DID_NAME_PREFIX,
65
+ keys: {
66
+ assertionMethod: [swKeyId],
67
+ authentication: [swKeyId],
68
+ capabilityDelegation: [swKeyId],
69
+ capabilityInvocation: [swKeyId],
70
+ keyAgreement: [swKeyId],
71
+ },
72
+ params: {},
66
73
  },
67
74
  name: SW_DID_NAME_PREFIX,
68
75
  organisationId,
69
- params: {},
70
76
  });
71
77
  };
72
78
 
@@ -78,7 +84,7 @@ export interface IdentifiersInitializationConfig {
78
84
  /**
79
85
  * Create base local identifiers
80
86
  * @param {IdentifiersInitializationConfig} config Select desired keys/dids to be created
81
- * @returns [hwDidId, swDidId]
87
+ * @returns [hwIdentifierId, swIdentifierId]
82
88
  */
83
89
  export const useInitializeONECoreIdentifiers = ({ generateHwKey, generateSwKey }: IdentifiersInitializationConfig) => {
84
90
  const { core, organisationId } = useONECore();
@@ -94,8 +100,8 @@ export const useInitializeONECoreIdentifiers = ({ generateHwKey, generateSwKey }
94
100
  })
95
101
  .then(() =>
96
102
  Promise.all([
97
- generateHwKey ? generateHwDid(core, organisationId) : null,
98
- generateSwKey ? generateSwDid(core, organisationId) : null,
103
+ generateHwKey ? generateHwIdentifier(core, organisationId) : null,
104
+ generateSwKey ? generateSwIdentifier(core, organisationId) : null,
99
105
  ]),
100
106
  )
101
107
  .catch((err) => {
@@ -95,11 +95,17 @@ export const useCredentialAccept = () => {
95
95
  const queryClient = useQueryClient();
96
96
  const { core } = useONECore();
97
97
 
98
- type CredentialAcceptHookParams = { didId: string; interactionId: string; keyId?: string; txCode?: string };
98
+ type CredentialAcceptHookParams = {
99
+ didId?: string;
100
+ identifierId?: string;
101
+ interactionId: string;
102
+ keyId?: string;
103
+ txCode?: string;
104
+ };
99
105
 
100
106
  return useMutation(
101
- async ({ interactionId, didId, keyId, txCode }: CredentialAcceptHookParams) =>
102
- core.holderAcceptCredential(interactionId, didId, keyId, txCode),
107
+ async ({ interactionId, didId, identifierId, keyId, txCode }: CredentialAcceptHookParams) =>
108
+ core.holderAcceptCredential(interactionId, didId, identifierId, keyId, txCode),
103
109
  {
104
110
  onSuccess: async () => {
105
111
  await queryClient.invalidateQueries(CREDENTIAL_LIST_QUERY_KEY);
@@ -0,0 +1,39 @@
1
+ import { IdentifierListQuery, IdentifierStateEnum, IdentifierTypeEnum } from "@procivis/react-native-one-core";
2
+ import { useQuery } from "react-query";
3
+
4
+ import { getQueryKeyFromIdentifierListQueryParams } from "../../parsers";
5
+ import { useONECore } from "./core-context";
6
+
7
+ export const IDENTIFIER_DETAIL_QUERY_KEY = 'identifier-detail';
8
+ export const IDENTIFIER_LIST_QUERY_KEY = 'identifier-list';
9
+ const PAGE_SIZE = 20;
10
+
11
+ export const useIdentifierDetails = (identifierId: string | undefined) => {
12
+ const { core } = useONECore();
13
+
14
+ return useQuery(
15
+ [IDENTIFIER_DETAIL_QUERY_KEY, identifierId],
16
+ () => (identifierId ? core.getIdentifier(identifierId) : undefined),
17
+ {
18
+ enabled: Boolean(identifierId),
19
+ keepPreviousData: true,
20
+ },
21
+ );
22
+ }
23
+
24
+ export const useIdentifiers = (identifierFilter?: Partial<IdentifierListQuery>) => {
25
+ const { core, organisationId } = useONECore();
26
+
27
+ return useQuery(
28
+ [IDENTIFIER_LIST_QUERY_KEY, ...getQueryKeyFromIdentifierListQueryParams(identifierFilter)],
29
+ ({ pageParam = 0 }) => (core.getIdentifiers({
30
+ types: [IdentifierTypeEnum.DID],
31
+ isRemote: false,
32
+ page: pageParam,
33
+ state: IdentifierStateEnum.ACTIVE,
34
+ organisationId: organisationId,
35
+ pageSize: PAGE_SIZE,
36
+ ...identifierFilter,
37
+ })),
38
+ );
39
+ };
@@ -7,7 +7,8 @@ export * from './credential-schemas';
7
7
  export * from './credentials';
8
8
  export * from './dids';
9
9
  export * from './history';
10
+ export * from './identifiers';
10
11
  export * from './proof-schemas';
11
12
  export * from './proofs';
12
13
  export * from './query';
13
- export * from './trust-entity';
14
+ export * from './trust-entity';