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

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 (103) hide show
  1. package/lib/commonjs/components/credential/credential.js +6 -3
  2. package/lib/commonjs/components/credential/credential.js.map +1 -1
  3. package/lib/commonjs/components/history/history-list-item-icon.js +3 -1
  4. package/lib/commonjs/components/history/history-list-item-icon.js.map +1 -1
  5. package/lib/commonjs/components/history/history-list-screen.js +2 -2
  6. package/lib/commonjs/components/history/history-list-screen.js.map +1 -1
  7. package/lib/commonjs/components/proof-request/select-credential.js +7 -3
  8. package/lib/commonjs/components/proof-request/select-credential.js.map +1 -1
  9. package/lib/commonjs/components/proof-request/share-credential.js +6 -9
  10. package/lib/commonjs/components/proof-request/share-credential.js.map +1 -1
  11. package/lib/commonjs/ui-components/credential/card/credential-card.js +14 -29
  12. package/lib/commonjs/ui-components/credential/card/credential-card.js.map +1 -1
  13. package/lib/commonjs/ui-components/credential/card/credential-details-card.js +27 -28
  14. package/lib/commonjs/ui-components/credential/card/credential-details-card.js.map +1 -1
  15. package/lib/commonjs/ui-components/credential/card/credential-details-list-item.js +10 -6
  16. package/lib/commonjs/ui-components/credential/card/credential-details-list-item.js.map +1 -1
  17. package/lib/commonjs/ui-components/header/header.js +7 -5
  18. package/lib/commonjs/ui-components/header/header.js.map +1 -1
  19. package/lib/commonjs/ui-components/history/history-details.js +3 -1
  20. package/lib/commonjs/ui-components/history/history-details.js.map +1 -1
  21. package/lib/commonjs/ui-components/icons/icons.js +100 -1
  22. package/lib/commonjs/ui-components/icons/icons.js.map +1 -1
  23. package/lib/commonjs/ui-components/searchbar/animated-search-bar.js +10 -8
  24. package/lib/commonjs/ui-components/searchbar/animated-search-bar.js.map +1 -1
  25. package/lib/commonjs/utils/hooks/core/backup.js +4 -3
  26. package/lib/commonjs/utils/hooks/core/backup.js.map +1 -1
  27. package/lib/commonjs/utils/hooks/core/core-init.js +23 -4
  28. package/lib/commonjs/utils/hooks/core/core-init.js.map +1 -1
  29. package/lib/commonjs/utils/hooks/core/credentials.js +4 -4
  30. package/lib/commonjs/utils/hooks/core/credentials.js.map +1 -1
  31. package/lib/commonjs/utils/hooks/core/proofs.js +3 -1
  32. package/lib/commonjs/utils/hooks/core/proofs.js.map +1 -1
  33. package/lib/commonjs/utils/parsers/credential-sharing.js +18 -1
  34. package/lib/commonjs/utils/parsers/credential-sharing.js.map +1 -1
  35. package/lib/commonjs/utils/parsers/credential.js.map +1 -1
  36. package/lib/module/components/credential/credential.js +5 -3
  37. package/lib/module/components/credential/credential.js.map +1 -1
  38. package/lib/module/components/history/history-list-item-icon.js +3 -1
  39. package/lib/module/components/history/history-list-item-icon.js.map +1 -1
  40. package/lib/module/components/history/history-list-screen.js +2 -2
  41. package/lib/module/components/history/history-list-screen.js.map +1 -1
  42. package/lib/module/components/proof-request/select-credential.js +5 -2
  43. package/lib/module/components/proof-request/select-credential.js.map +1 -1
  44. package/lib/module/components/proof-request/share-credential.js +7 -10
  45. package/lib/module/components/proof-request/share-credential.js.map +1 -1
  46. package/lib/module/ui-components/credential/card/credential-card.js +15 -30
  47. package/lib/module/ui-components/credential/card/credential-card.js.map +1 -1
  48. package/lib/module/ui-components/credential/card/credential-details-card.js +27 -28
  49. package/lib/module/ui-components/credential/card/credential-details-card.js.map +1 -1
  50. package/lib/module/ui-components/credential/card/credential-details-list-item.js +10 -6
  51. package/lib/module/ui-components/credential/card/credential-details-list-item.js.map +1 -1
  52. package/lib/module/ui-components/header/header.js +7 -5
  53. package/lib/module/ui-components/header/header.js.map +1 -1
  54. package/lib/module/ui-components/history/history-details.js +4 -2
  55. package/lib/module/ui-components/history/history-details.js.map +1 -1
  56. package/lib/module/ui-components/icons/icons.js +95 -0
  57. package/lib/module/ui-components/icons/icons.js.map +1 -1
  58. package/lib/module/ui-components/searchbar/animated-search-bar.js +10 -8
  59. package/lib/module/ui-components/searchbar/animated-search-bar.js.map +1 -1
  60. package/lib/module/utils/hooks/core/backup.js +5 -4
  61. package/lib/module/utils/hooks/core/backup.js.map +1 -1
  62. package/lib/module/utils/hooks/core/core-init.js +21 -3
  63. package/lib/module/utils/hooks/core/core-init.js.map +1 -1
  64. package/lib/module/utils/hooks/core/credentials.js +4 -4
  65. package/lib/module/utils/hooks/core/credentials.js.map +1 -1
  66. package/lib/module/utils/hooks/core/proofs.js +3 -1
  67. package/lib/module/utils/hooks/core/proofs.js.map +1 -1
  68. package/lib/module/utils/parsers/credential-sharing.js +18 -1
  69. package/lib/module/utils/parsers/credential-sharing.js.map +1 -1
  70. package/lib/module/utils/parsers/credential.js.map +1 -1
  71. package/lib/typescript/components/proof-request/share-credential.d.ts +4 -5
  72. package/lib/typescript/ui-components/credential/card/credential-card.d.ts +1 -0
  73. package/lib/typescript/ui-components/header/header.d.ts +1 -1
  74. package/lib/typescript/ui-components/icons/icons.d.ts +4 -0
  75. package/lib/typescript/ui-components/searchbar/animated-search-bar.d.ts +2 -2
  76. package/lib/typescript/utils/hooks/core/backup.d.ts +1 -1
  77. package/lib/typescript/utils/hooks/core/core-init.d.ts +4 -1
  78. package/lib/typescript/utils/hooks/core/credentials.d.ts +2 -6
  79. package/lib/typescript/utils/parsers/credential-sharing.d.ts +6 -6
  80. package/lib/typescript/utils/parsers/credential.d.ts +6 -3
  81. package/package.json +3 -3
  82. package/src/components/credential/credential.tsx +4 -2
  83. package/src/components/history/history-list-item-icon.tsx +2 -0
  84. package/src/components/history/history-list-screen.tsx +9 -7
  85. package/src/components/proof-request/select-credential.tsx +4 -2
  86. package/src/components/proof-request/share-credential.tsx +10 -10
  87. package/src/ui-components/credential/card/credential-card.stories.tsx +14 -2
  88. package/src/ui-components/credential/card/credential-card.tsx +16 -23
  89. package/src/ui-components/credential/card/credential-details-card.stories.tsx +14 -4
  90. package/src/ui-components/credential/card/credential-details-card.tsx +32 -34
  91. package/src/ui-components/credential/card/credential-details-list-item.tsx +10 -6
  92. package/src/ui-components/detail/detail.stories.tsx +3 -3
  93. package/src/ui-components/header/header.stories.tsx +8 -6
  94. package/src/ui-components/header/header.tsx +7 -5
  95. package/src/ui-components/history/history-details.tsx +3 -1
  96. package/src/ui-components/icons/icons.tsx +85 -0
  97. package/src/ui-components/searchbar/animated-search-bar.tsx +11 -9
  98. package/src/utils/hooks/core/backup.ts +8 -2
  99. package/src/utils/hooks/core/core-init.ts +28 -2
  100. package/src/utils/hooks/core/credentials.ts +3 -3
  101. package/src/utils/hooks/core/proofs.ts +3 -1
  102. package/src/utils/parsers/credential-sharing.tsx +34 -11
  103. package/src/utils/parsers/credential.ts +8 -4
@@ -1,5 +1,5 @@
1
1
  import React, { ComponentType, FC, ReactElement, useEffect, useMemo } from 'react';
2
- import { ColorValue, ImageSourcePropType, StyleSheet, View } from 'react-native';
2
+ import { ColorValue, Dimensions, ImageSourcePropType, StyleSheet, View } from 'react-native';
3
3
 
4
4
  import { CredentialDetails, CredentialDetailsProps, EntityDetails, EntityDetailsProps } from '../../components';
5
5
  import { HeaderInfoButton } from '../../components/navigation/header-buttons';
@@ -92,6 +92,7 @@ export const HistoryDetailsView: FC<HistoryDetailsViewProps> = ({
92
92
  }) => {
93
93
  const colorScheme = useAppColorScheme();
94
94
  const { expandedCredential, onHeaderPress, setInitialCredential } = useCredentialListExpandedCard();
95
+ const cardWidth = useMemo(() => Dimensions.get('window').width - 32, []);
95
96
 
96
97
  // Expand the first credential
97
98
  useEffect(() => {
@@ -199,6 +200,7 @@ export const HistoryDetailsView: FC<HistoryDetailsViewProps> = ({
199
200
  card: {
200
201
  ...props.credentialCard.card,
201
202
  onHeaderPress: props.credentialCard.headerPressable === false ? undefined : onHeaderPress,
203
+ width: cardWidth,
202
204
  },
203
205
  };
204
206
  return (
@@ -145,3 +145,88 @@ export const PlusIcon: FC<SvgProps> = ({ color, ...props }) => {
145
145
  </Svg>
146
146
  );
147
147
  };
148
+
149
+ // https://www.figma.com/design/S3WwgTMHuqxAsfu5zElCzq/App-Icon-Library--Design-?node-id=660-148&t=vEKCP9Mq209PFHFX-0
150
+ export const WalletUnitAttestationIcon: FC<SvgProps> = ({ color, ...props }) => {
151
+ const colorScheme = useAppColorScheme();
152
+ const iconColor = color ?? colorScheme.text;
153
+
154
+ return (
155
+ <Svg width={24} height={24} viewBox="0 0 24 24" fill="none" {...props}>
156
+ <Rect x={7.5} y={7.5} width={8} height={11} rx={1.5} stroke={iconColor} />
157
+ <Path
158
+ fillRule="evenodd"
159
+ clipRule="evenodd"
160
+ d="M12.176 4.882h5.295c.487 0 .882.395.882.883v8.823a.882.882 0 01-.882.883v.882c.974 0 1.764-.79 1.764-1.765V5.765c0-.975-.79-1.765-1.764-1.765h-5.295c-.974 0-1.764.79-1.764 1.765h.882c0-.488.395-.883.882-.883z"
161
+ fill={iconColor}
162
+ />
163
+ <Path d="M10 17h3" stroke={iconColor} />
164
+ </Svg>
165
+ );
166
+ };
167
+
168
+ // https://www.figma.com/file/52qDYWUMjXAGre1dcnz5bz/Procivis-One-Wallet?node-id=426-27862
169
+ export const StatusErrorIcon: FC<SvgProps> = (props) => {
170
+ const colorScheme = useAppColorScheme();
171
+ return (
172
+ <Svg fill="none" height="22" viewBox="0 0 22 22" width="22" {...props}>
173
+ <Path
174
+ d="M10.5747 20C9.40153 20 8.29753 19.7759 7.2627 19.3276C6.22786 18.8849 5.31478 18.2679 4.52344 17.4766C3.73763 16.6852 3.12061 15.7721 2.67236 14.7373C2.22412 13.7025 2 12.5985 2 11.4253C2 10.2521 2.22412 9.14811 2.67236 8.11328C3.12061 7.07845 3.73763 6.16813 4.52344 5.38232C5.31478 4.59098 6.2251 3.97119 7.25439 3.52295C8.28923 3.07471 9.39323 2.85059 10.5664 2.85059C11.7451 2.85059 12.8519 3.07471 13.8867 3.52295C14.9215 3.97119 15.8346 4.59098 16.626 5.38232C17.4173 6.16813 18.0371 7.07845 18.4854 8.11328C18.9336 9.14811 19.1577 10.2521 19.1577 11.4253C19.1577 12.5985 18.9336 13.7025 18.4854 14.7373C18.0371 15.7721 17.4173 16.6852 16.626 17.4766C15.8346 18.2679 14.9215 18.8849 13.8867 19.3276C12.8519 19.7759 11.7479 20 10.5747 20Z"
175
+ fill={colorScheme.error}
176
+ />
177
+ <Path
178
+ d="M3.81385 18.1812L3.81633 18.1837C4.69776 19.0651 5.71679 19.7536 6.86722 20.2461C8.032 20.7503 9.27117 21 10.5747 21C11.8782 21 13.1174 20.7503 14.2821 20.2461C15.4326 19.7537 16.4516 19.0651 17.3331 18.1837C18.2142 17.3026 18.9051 16.2842 19.403 15.1348C19.9077 13.9694 20.1577 12.7296 20.1577 11.4253C20.1577 10.121 19.9077 8.88117 19.403 7.71581C18.905 6.56624 18.2138 5.55009 17.3318 4.67398C16.451 3.79349 15.4331 3.103 14.2842 2.60533C13.1182 2.10029 11.8755 1.85059 10.5664 1.85059C9.26213 1.85059 8.02228 2.10055 6.85692 2.60533L6.85513 2.60611C5.71136 3.10421 4.69653 3.79502 3.81633 4.67522C2.94015 5.5514 2.25228 6.56718 1.75475 7.71581C1.24997 8.88117 1 10.121 1 11.4253C1 12.7296 1.24997 13.9694 1.75475 15.1348C2.252 16.2828 2.93915 17.3003 3.81385 18.1812Z"
179
+ stroke={colorScheme.white}
180
+ strokeOpacity="0.2"
181
+ strokeWidth="2"
182
+ />
183
+ <Path
184
+ d="M8.43311 14.7124C8.27262 14.8618 8.07894 14.9365 7.85205 14.9365C7.63623 14.9365 7.45085 14.8618 7.2959 14.7124C7.14648 14.5575 7.07178 14.3721 7.07178 14.1562C7.07178 13.9404 7.14925 13.7578 7.3042 13.6084L9.4707 11.4336L7.3042 9.27539C7.14925 9.11491 7.07178 8.93229 7.07178 8.72754C7.07178 8.50065 7.14648 8.31527 7.2959 8.17139C7.45085 8.02197 7.63623 7.94727 7.85205 7.94727C8.06787 7.94727 8.25326 8.01921 8.4082 8.16309L10.583 10.3296L12.7661 8.16309C12.9211 8.00814 13.1064 7.93066 13.3223 7.93066C13.5381 7.93066 13.7207 8.00814 13.8701 8.16309C14.0251 8.3125 14.1025 8.49512 14.1025 8.71094C14.1025 8.92122 14.0251 9.10661 13.8701 9.26709L11.6953 11.4336L13.8618 13.6001C14.0168 13.744 14.0942 13.9294 14.0942 14.1562C14.0942 14.3721 14.0168 14.5575 13.8618 14.7124C13.7124 14.8618 13.527 14.9365 13.3057 14.9365C13.0788 14.9365 12.8906 14.8618 12.7412 14.7124L10.583 12.5459L8.43311 14.7124Z"
185
+ fill={colorScheme.white}
186
+ />
187
+ </Svg>
188
+ );
189
+ };
190
+
191
+ // https://www.figma.com/file/52qDYWUMjXAGre1dcnz5bz/Procivis-One-Wallet?node-id=454-100241
192
+ export const StatusSuccessIcon: FC<SvgProps> = (props) => {
193
+ const colorScheme = useAppColorScheme();
194
+ return (
195
+ <Svg fill="none" height="22" viewBox="0 0 22 22" width="22" {...props}>
196
+ <Path
197
+ d="M10.5747 20C9.40153 20 8.29753 19.7759 7.2627 19.3276C6.22786 18.8849 5.31478 18.2679 4.52344 17.4766C3.73763 16.6852 3.12061 15.7721 2.67236 14.7373C2.22412 13.7025 2 12.5985 2 11.4253C2 10.2521 2.22412 9.14811 2.67236 8.11328C3.12061 7.07845 3.73763 6.16813 4.52344 5.38232C5.31478 4.59098 6.2251 3.97119 7.25439 3.52295C8.28923 3.07471 9.39323 2.85059 10.5664 2.85059C11.7451 2.85059 12.8519 3.07471 13.8867 3.52295C14.9215 3.97119 15.8346 4.59098 16.626 5.38232C17.4173 6.16813 18.0371 7.07845 18.4854 8.11328C18.9336 9.14811 19.1577 10.2521 19.1577 11.4253C19.1577 12.5985 18.9336 13.7025 18.4854 14.7373C18.0371 15.7721 17.4173 16.6852 16.626 17.4766C15.8346 18.2679 14.9215 18.8849 13.8867 19.3276C12.8519 19.7759 11.7479 20 10.5747 20Z"
198
+ fill={colorScheme.success}
199
+ />
200
+ <Path
201
+ d="M3.81385 18.1812L3.81633 18.1837C4.69776 19.0651 5.71679 19.7536 6.86722 20.2461C8.032 20.7503 9.27117 21 10.5747 21C11.8782 21 13.1174 20.7503 14.2821 20.2461C15.4326 19.7537 16.4516 19.0651 17.3331 18.1837C18.2142 17.3026 18.9051 16.2842 19.403 15.1348C19.9077 13.9694 20.1577 12.7296 20.1577 11.4253C20.1577 10.121 19.9077 8.88117 19.403 7.71581C18.905 6.56624 18.2138 5.55009 17.3318 4.67398C16.451 3.79349 15.4331 3.103 14.2842 2.60533C13.1182 2.10029 11.8755 1.85059 10.5664 1.85059C9.26213 1.85059 8.02228 2.10055 6.85692 2.60533L6.85513 2.60611C5.71136 3.10421 4.69653 3.79502 3.81633 4.67522C2.94015 5.5514 2.25228 6.56718 1.75475 7.71581C1.24997 8.88117 1 10.121 1 11.4253C1 12.7296 1.24997 13.9694 1.75475 15.1348C2.252 16.2828 2.93915 17.3003 3.81385 18.1812Z"
202
+ stroke="white"
203
+ strokeOpacity="0.2"
204
+ strokeWidth="2"
205
+ />
206
+ <Path
207
+ d="M9.91406 15.3828C10.0703 15.3828 10.2135 15.3464 10.3438 15.2734C10.4792 15.1953 10.5938 15.0885 10.6875 14.9531L14.3359 9.3125C14.3932 9.22396 14.4401 9.13021 14.4766 9.03125C14.5182 8.93229 14.5391 8.83333 14.5391 8.73438C14.5391 8.51562 14.4557 8.33854 14.2891 8.20312C14.1276 8.06771 13.9427 8 13.7344 8C13.4583 8 13.2266 8.14844 13.0391 8.44531L9.89062 13.4766L8.44531 11.6641C8.34115 11.5339 8.23698 11.4427 8.13281 11.3906C8.02865 11.3333 7.91146 11.3047 7.78125 11.3047C7.5625 11.3047 7.3776 11.3828 7.22656 11.5391C7.07552 11.6901 7 11.875 7 12.0938C7 12.1979 7.01823 12.2995 7.05469 12.3984C7.09635 12.4922 7.15365 12.5885 7.22656 12.6875L9.10938 14.9531C9.22396 15.099 9.34635 15.2083 9.47656 15.2812C9.60677 15.349 9.7526 15.3828 9.91406 15.3828Z"
208
+ fill="white"
209
+ />
210
+ </Svg>
211
+ );
212
+ };
213
+
214
+ // https://www.figma.com/design/52qDYWUMjXAGre1dcnz5bz/Procivis-One-Wallet?node-id=415-5641&m=dev
215
+ export const StatusWarningIcon: FC<SvgProps> = ({ ...props }) => (
216
+ <Svg fill="none" height={20} viewBox="0 0 22 20" width={22} {...props}>
217
+ <Path
218
+ d="M4.357 17.967c-.481 0-.899-.105-1.253-.315a2.196 2.196 0 01-.822-.847A2.473 2.473 0 012 15.627c0-.421.11-.822.332-1.204L8.757 3.225c.216-.393.506-.689.871-.888a2.36 2.36 0 011.146-.299c.398 0 .777.1 1.137.299.36.194.653.49.88.888l6.425 11.198a2.384 2.384 0 01.332 1.204c0 .431-.097.824-.29 1.178a2.196 2.196 0 01-.822.847c-.35.21-.764.315-1.246.315H4.357z"
219
+ fill="#F7BF0B"
220
+ />
221
+ <Path
222
+ d="M1.4 17.274h-.001l.006.011c.281.515.683.927 1.188 1.227.534.316 1.134.455 1.764.455H17.19c.63 0 1.229-.138 1.759-.457.504-.3.905-.711 1.186-1.225.28-.512.413-1.071.413-1.659a3.345 3.345 0 00-.467-1.705L13.66 2.73v-.002a3.226 3.226 0 00-1.27-1.27 3.312 3.312 0 00-1.616-.42 3.36 3.36 0 00-1.624.42 3.172 3.172 0 00-1.265 1.276L1.467 13.92l-.001.002A3.364 3.364 0 001 15.627c0 .582.128 1.138.4 1.647z"
223
+ stroke="#fff"
224
+ strokeOpacity={0.2}
225
+ strokeWidth={2}
226
+ />
227
+ <Path
228
+ d="M11.538 11.51c-.011.514-.263.771-.756.771-.503 0-.763-.254-.78-.763l-.116-4.184a.766.766 0 01.232-.614c.166-.166.385-.25.656-.25.266 0 .484.084.656.25.171.16.252.368.24.622l-.132 4.167zM11.496 14.871c-.2.177-.437.266-.714.266-.277 0-.517-.089-.722-.266a.87.87 0 01-.299-.68c0-.272.1-.499.3-.681.198-.183.439-.274.721-.274.277 0 .515.091.714.274.2.182.299.41.299.68a.87.87 0 01-.299.681z"
229
+ fill="#000"
230
+ />
231
+ </Svg>
232
+ );
@@ -5,7 +5,7 @@ import SearchBar, { SearchBarProps } from './search-bar';
5
5
 
6
6
  export type AnimatedSearchBarProps = {
7
7
  collapsed: boolean;
8
- rightButton?: ReactNode;
8
+ rightButtons?: ReactNode[];
9
9
  rightButtonAlwaysVisible?: boolean;
10
10
  searchBarProps: SearchBarProps;
11
11
  };
@@ -17,10 +17,10 @@ const AnimatedSearchBar = ({
17
17
  collapsed,
18
18
  rightButtonAlwaysVisible = false,
19
19
  searchBarProps,
20
- rightButton,
20
+ rightButtons = [],
21
21
  }: AnimatedSearchBarProps) => {
22
22
  const [rightIconFadeAnimation] = useState(
23
- () => new Animated.Value(rightButton && rightButtonAlwaysVisible ? 1.5 : 0),
23
+ () => new Animated.Value(rightButtons && rightButtonAlwaysVisible ? 1.5 : 0),
24
24
  );
25
25
  const [searchPaddingAnimation] = useState(() => new Animated.Value(0));
26
26
 
@@ -39,10 +39,10 @@ const AnimatedSearchBar = ({
39
39
 
40
40
  Animated.timing(rightIconFadeAnimation, {
41
41
  duration: 250,
42
- toValue: collapsed && rightButton ? 1.5 : 0,
42
+ toValue: collapsed && rightButtons ? 1.5 : 0,
43
43
  useNativeDriver: false,
44
44
  }).start();
45
- }, [rightButtonAlwaysVisible, rightIconFadeAnimation, rightButton, collapsed]);
45
+ }, [rightButtonAlwaysVisible, rightIconFadeAnimation, rightButtons, collapsed]);
46
46
 
47
47
  const searchBarContainerAnimatedStyle = {
48
48
  paddingHorizontal: searchPaddingAnimation.interpolate({
@@ -64,7 +64,7 @@ const AnimatedSearchBar = ({
64
64
  width: rightIconFadeAnimation.interpolate({
65
65
  extrapolate: 'clamp',
66
66
  inputRange: [0, 1],
67
- outputRange: ['100%', '88%'],
67
+ outputRange: ['100%', `${100 - 12 * rightButtons.length}%`],
68
68
  }),
69
69
  };
70
70
 
@@ -74,8 +74,8 @@ const AnimatedSearchBar = ({
74
74
  <Animated.View style={searchBarAnimatedStyle}>
75
75
  <SearchBar {...searchProps} />
76
76
  </Animated.View>
77
- {rightButton && (
78
- <Animated.View style={[styles.rightButtonWrapper, optionsIconAnimatedStyle]}>{rightButton}</Animated.View>
77
+ {rightButtons && (
78
+ <Animated.View style={[styles.rightButtonWrapper, optionsIconAnimatedStyle]}>{rightButtons}</Animated.View>
79
79
  )}
80
80
  </Animated.View>
81
81
  );
@@ -83,7 +83,9 @@ const AnimatedSearchBar = ({
83
83
 
84
84
  const styles = StyleSheet.create({
85
85
  rightButtonWrapper: {
86
- alignItems: 'flex-end',
86
+ alignItems: 'center',
87
+ flexDirection: 'row',
88
+ gap: '16',
87
89
  justifyContent: 'center',
88
90
  },
89
91
  searchBarContainer: {
@@ -5,6 +5,7 @@ import { useMutation, useQuery, useQueryClient } from 'react-query';
5
5
  import { reportException } from '../../reporting';
6
6
  import { useONECore } from './core-context';
7
7
  import {
8
+ generateAttestationKey,
8
9
  generateHwIdentifier,
9
10
  generateSwIdentifier,
10
11
  IdentifiersInitializationConfig,
@@ -70,7 +71,11 @@ export const useRollbackImport = () => {
70
71
  * @param {IdentifiersInitializationConfig} config Select desired keys/dids to be restored/created
71
72
  * @returns [hwIdentifierId, swIdentifierId]
72
73
  */
73
- export const useBackupFinalizeImportProcedure = ({ generateHwKey, generateSwKey }: IdentifiersInitializationConfig) => {
74
+ export const useBackupFinalizeImportProcedure = ({
75
+ generateHwKey,
76
+ generateSwKey,
77
+ generateAttestationKey: shouldGenerateAttestationKey,
78
+ }: IdentifiersInitializationConfig) => {
74
79
  const { mutateAsync: finalizeImport } = useFinalizeImport();
75
80
  const { core, organisationId } = useONECore();
76
81
 
@@ -94,9 +99,10 @@ export const useBackupFinalizeImportProcedure = ({ generateHwKey, generateSwKey
94
99
  return Promise.all([
95
100
  generateHwKey ? generateHwIdentifier(core, organisationId) : null,
96
101
  !swIdentifierId && generateSwKey ? generateSwIdentifier(core, organisationId) : swIdentifierId,
102
+ shouldGenerateAttestationKey ? generateAttestationKey(core, organisationId) : null,
97
103
  ]).catch((err) => {
98
104
  reportException(err, 'Failed to create base identifiers');
99
105
  throw err;
100
106
  });
101
- }, [core, organisationId, finalizeImport, generateHwKey, generateSwKey]);
107
+ }, [finalizeImport, generateSwKey, generateHwKey, core, organisationId, shouldGenerateAttestationKey]);
102
108
  };
@@ -7,6 +7,7 @@ import { OneErrorCode } from './error-code';
7
7
 
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
+ export const ATTESTATION_DID_NAME_PREFIX = 'holder-did-attestation-key';
10
11
 
11
12
  export const generateHwIdentifier = async (core: ONECore, organisationId: string) => {
12
13
  const hwKeyId = await core
@@ -76,9 +77,29 @@ export const generateSwIdentifier = async (core: ONECore, organisationId: string
76
77
  });
77
78
  };
78
79
 
80
+ export const generateAttestationKey = async (core: ONECore, organisationId: string) => {
81
+ return await core
82
+ .generateKey({
83
+ keyParams: {},
84
+ keyType: 'ECDSA',
85
+ name: 'holder-key-attestation',
86
+ organisationId,
87
+ storageParams: {},
88
+ storageType: 'SECURE_ELEMENT',
89
+ })
90
+ .catch((e) => {
91
+ // ignore if Attestation keys not supported by device
92
+ if (e instanceof OneError && e.code === OneErrorCode.KeyStorageNotSupported) {
93
+ return null;
94
+ }
95
+ throw e;
96
+ });
97
+ };
98
+
79
99
  export interface IdentifiersInitializationConfig {
80
100
  generateHwKey: boolean;
81
101
  generateSwKey: boolean;
102
+ generateAttestationKey: boolean;
82
103
  }
83
104
 
84
105
  /**
@@ -86,7 +107,11 @@ export interface IdentifiersInitializationConfig {
86
107
  * @param {IdentifiersInitializationConfig} config Select desired keys/dids to be created
87
108
  * @returns [hwIdentifierId, swIdentifierId]
88
109
  */
89
- export const useInitializeONECoreIdentifiers = ({ generateHwKey, generateSwKey }: IdentifiersInitializationConfig) => {
110
+ export const useInitializeONECoreIdentifiers = ({
111
+ generateHwKey,
112
+ generateSwKey,
113
+ generateAttestationKey: shouldGenerateAttestationKey,
114
+ }: IdentifiersInitializationConfig) => {
90
115
  const { core, organisationId } = useONECore();
91
116
 
92
117
  return useCallback(async () => {
@@ -102,11 +127,12 @@ export const useInitializeONECoreIdentifiers = ({ generateHwKey, generateSwKey }
102
127
  Promise.all([
103
128
  generateHwKey ? generateHwIdentifier(core, organisationId) : null,
104
129
  generateSwKey ? generateSwIdentifier(core, organisationId) : null,
130
+ shouldGenerateAttestationKey ? generateAttestationKey(core, organisationId) : null,
105
131
  ]),
106
132
  )
107
133
  .catch((err) => {
108
134
  reportException(err, 'Failed to create base identifiers');
109
135
  throw err;
110
136
  });
111
- }, [core, organisationId, generateHwKey, generateSwKey]);
137
+ }, [core, organisationId, generateHwKey, generateSwKey, shouldGenerateAttestationKey]);
112
138
  };
@@ -1,6 +1,7 @@
1
1
  import {
2
2
  CredentialListQuery,
3
3
  CredentialStateEnum,
4
+ HandleInvitationRequest,
4
5
  InitiateIssuanceRequest,
5
6
  InvitationResult,
6
7
  OneError,
@@ -8,7 +9,6 @@ import {
8
9
  import { useInfiniteQuery, useMutation, useQuery, useQueryClient } from 'react-query';
9
10
 
10
11
  import { getQueryKeyFromCredentialListQueryParams } from '../../parsers/query';
11
- import { Transport } from '../connectivity/connectivity';
12
12
  import { useONECore } from './core-context';
13
13
  import { CREDENTIAL_SCHEMA_LIST_QUERY_KEY } from './credential-schemas';
14
14
  import { OneErrorCode } from './error-code';
@@ -83,8 +83,8 @@ export const useInvitationHandler = () => {
83
83
  const { core, organisationId } = useONECore();
84
84
 
85
85
  return useMutation(
86
- async ({ invitationUrl, transport }: { invitationUrl: string; transport: Transport }) =>
87
- core.handleInvitation(invitationUrl, organisationId, [transport]),
86
+ async (request: Omit<HandleInvitationRequest, 'organisationId'>) =>
87
+ core.handleInvitation({ organisationId, ...request }),
88
88
  {
89
89
  onSuccess: async (result: InvitationResult) => {
90
90
  if ('credentialIds' in result) {
@@ -13,6 +13,7 @@ import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
13
13
  import { useMutation, useQuery, useQueryClient } from 'react-query';
14
14
 
15
15
  import { getQueryKeyFromProofListQueryParams } from '../../parsers/query';
16
+ import { reportException } from '../../reporting';
16
17
  import { Transport } from '../connectivity/connectivity';
17
18
  import { useCoreConfig } from './core-config';
18
19
  import { useONECore } from './core-context';
@@ -85,7 +86,8 @@ export const useProofAccept = () => {
85
86
  keyId?: string;
86
87
  }) => core.holderSubmitProof(interactionId, credentials, didId, identifierId, keyId),
87
88
  {
88
- onError: async () => {
89
+ onError: async (err) => {
90
+ reportException(err, 'Proof submission failure');
89
91
  await queryClient.invalidateQueries(PROOF_DETAIL_QUERY_KEY);
90
92
  },
91
93
  onSuccess: async () => {
@@ -10,7 +10,6 @@ import React from 'react';
10
10
  import {
11
11
  CredentialAttribute,
12
12
  CredentialCardProps,
13
- CredentialDetailsCardProps,
14
13
  CredentialHeaderProps,
15
14
  Selector,
16
15
  SelectorStatus,
@@ -20,6 +19,7 @@ import { CredentialNoticeWarningIcon, CredentialWarningIcon, RequiredAttributeIc
20
19
  import { concatTestID } from '../testID';
21
20
  import {
22
21
  CardLabels,
22
+ CredentialDetailsCardPropsWithoutWidth,
23
23
  detailsCardAttributeFromClaim,
24
24
  getCredentialCardPropsFromCredential,
25
25
  getValidityState,
@@ -37,7 +37,7 @@ export const validityCheckedCardFromCredential = (
37
37
  notice: CredentialCardNotice | undefined,
38
38
  testID: string,
39
39
  labels: ShareCredentialCardLabels,
40
- ): Omit<CredentialCardProps, 'onHeaderPress' | 'style' | 'testID'> => {
40
+ ): Omit<CredentialCardProps, 'onHeaderPress' | 'style' | 'testID' | 'width'> => {
41
41
  let credentialHeaderDetail:
42
42
  | Pick<
43
43
  CredentialHeaderProps,
@@ -77,7 +77,7 @@ export const missingCredentialCardFromRequest = (
77
77
  notice: CredentialCardNotice | undefined,
78
78
  testID: string,
79
79
  labels: ShareCredentialCardLabels,
80
- ): Omit<CredentialCardProps, 'onHeaderPress' | 'style'> => {
80
+ ): Omit<CredentialCardProps, 'onHeaderPress' | 'style' | 'width'> => {
81
81
  return {
82
82
  cardImage: undefined,
83
83
  color: undefined,
@@ -145,18 +145,41 @@ const getDisplayedAttributes = (
145
145
  ): DisplayedAttribute[] => {
146
146
  const claims = credential ? spreadClaims(credential.claims) : undefined;
147
147
 
148
- return request.fields.map((field) => {
148
+ let fields = request.fields;
149
+ if (credential) {
150
+ const fieldsWithNoKeyMapping = request.fields.filter((field) => !(credential.id in field.keyMap));
151
+ const fullyNestedFields = getFullyNestedFields(request.fields, credential.id);
152
+
153
+ fields = [...fieldsWithNoKeyMapping, ...fullyNestedFields];
154
+ }
155
+
156
+ return fields.map((field) => {
149
157
  const selected = !field.required && selectedFields?.includes(field.id);
150
- const claim =
151
- credential ?
152
- claims?.find(({ key }) => {
158
+ const claim = credential
159
+ ? claims?.find(({ key }) => {
153
160
  return key === field.keyMap[credential.id];
154
- }) : undefined;
155
- const status = selectiveDisclosureSupported === false ? SelectorStatus.Required : getAttributeSelectorStatus(field, validityState, credential, claim, selected);
161
+ })
162
+ : undefined;
163
+ const status =
164
+ selectiveDisclosureSupported === false
165
+ ? SelectorStatus.Required
166
+ : getAttributeSelectorStatus(field, validityState, credential, claim, selected);
156
167
  return { claim, field, id: field.id, selected, status };
157
168
  });
158
169
  };
159
170
 
171
+ const getFullyNestedFields = (
172
+ fields: PresentationDefinitionRequestedCredential['fields'],
173
+ credentialId: CredentialDetail['id'],
174
+ ) => {
175
+ const allKeys = fields.filter((field) => credentialId in field.keyMap).map((field) => field.keyMap[credentialId]);
176
+
177
+ return fields
178
+ .map((field) => ({ field, key: field.keyMap[credentialId] }))
179
+ .filter(({ key }) => key && allKeys.every((k) => !k.startsWith(`${key}/`)))
180
+ .map(({ field }) => field);
181
+ };
182
+
160
183
  export const shareCredentialCardAttributeFromClaim = (
161
184
  id: string,
162
185
  config: Config,
@@ -228,7 +251,7 @@ export const shareCredentialCardFromCredential = (
228
251
  config: Config,
229
252
  testID: string,
230
253
  labels: ShareCredentialCardLabels,
231
- ): Omit<CredentialDetailsCardProps, 'expanded'> => {
254
+ ): CredentialDetailsCardPropsWithoutWidth => {
232
255
  const selectiveDisclosureSupported = supportsSelectiveDisclosure(
233
256
  credential ? { ...credential, issuer: credential.issuer?.id } : undefined,
234
257
  config,
@@ -312,7 +335,7 @@ export const selectCredentialCardFromCredential = (
312
335
  config: Config,
313
336
  testID: string,
314
337
  labels: ShareCredentialCardLabels,
315
- ): Omit<CredentialDetailsCardProps, 'expanded'> => {
338
+ ): CredentialDetailsCardPropsWithoutWidth => {
316
339
  const selectiveDisclosureSupported = supportsSelectiveDisclosure(
317
340
  credential ? { ...credential, issuer: credential.issuer?.id } : undefined,
318
341
  config,
@@ -169,7 +169,7 @@ export const getCredentialCardPropsFromCredential = (
169
169
  notice: CredentialCardNotice | undefined,
170
170
  testID: string,
171
171
  labels: CardLabels,
172
- ): Omit<CredentialCardProps, 'onHeaderPress' | 'style'> => {
172
+ ): Omit<CredentialCardProps, 'onHeaderPress' | 'style' | 'width'> => {
173
173
  const { layoutProperties } = credential.schema;
174
174
 
175
175
  if (hasMsoValidityIssues(credential)) {
@@ -179,7 +179,7 @@ export const getCredentialCardPropsFromCredential = (
179
179
  };
180
180
  }
181
181
 
182
- const result: Omit<CredentialCardProps, 'onHeaderPress' | 'style'> = {
182
+ const result: Omit<CredentialCardProps, 'onHeaderPress' | 'style' | 'width'> = {
183
183
  cardCarouselImages: getCarouselImagesFromClaims(claims, layoutProperties, concatTestID(testID, 'carousel')),
184
184
  cardImage: layoutProperties?.background?.image
185
185
  ? { imageSource: { uri: layoutProperties.background.image } }
@@ -255,12 +255,16 @@ const detailsCardAttributeValueFromClaim = (claim: Claim, config: Config, testID
255
255
  }
256
256
  };
257
257
 
258
+ export type CredentialDetailsCardPropsWithoutWidth = Omit<CredentialDetailsCardProps, 'expanded' | 'card'> & {
259
+ card: Omit<CredentialCardProps, 'width'>;
260
+ }
261
+
258
262
  export const detailsCardFromCredential = (
259
263
  credential: CredentialDetail,
260
264
  config: Config,
261
265
  testID: string,
262
266
  labels: CardLabels,
263
- ): Omit<CredentialDetailsCardProps, 'expanded'> => {
267
+ ): CredentialDetailsCardPropsWithoutWidth => {
264
268
  return detailsCardFromCredentialWithClaims(credential, credential.claims, config, testID, labels);
265
269
  };
266
270
 
@@ -270,7 +274,7 @@ export const detailsCardFromCredentialWithClaims = (
270
274
  config: Config,
271
275
  testID: string,
272
276
  labels: CardLabels,
273
- ): Omit<CredentialDetailsCardProps, 'expanded'> => {
277
+ ): CredentialDetailsCardPropsWithoutWidth => {
274
278
  const attributes: CredentialAttribute[] = claims.map((claim, index) =>
275
279
  detailsCardAttributeFromClaim(claim, config, concatTestID(testID, 'attribute', index.toString())),
276
280
  );