@procivis/one-react-native-components 0.3.106 → 0.3.115

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 (235) hide show
  1. package/lib/commonjs/components/backup/preview-credentials.js.map +1 -1
  2. package/lib/commonjs/components/credential/credential.js.map +1 -1
  3. package/lib/commonjs/components/entity/EntityButtons.js.map +1 -1
  4. package/lib/commonjs/components/entity/entity-attributes.js.map +1 -1
  5. package/lib/commonjs/components/entity/entity-details-with-buttons.js +2 -2
  6. package/lib/commonjs/components/entity/entity-details-with-buttons.js.map +1 -1
  7. package/lib/commonjs/components/entity/entity-details.js +3 -3
  8. package/lib/commonjs/components/entity/entity-details.js.map +1 -1
  9. package/lib/commonjs/components/history/history-details-screen.js +10 -10
  10. package/lib/commonjs/components/history/history-details-screen.js.map +1 -1
  11. package/lib/commonjs/components/history/history-list-item-icon.js +14 -8
  12. package/lib/commonjs/components/history/history-list-item-icon.js.map +1 -1
  13. package/lib/commonjs/components/history/history-list-item.js.map +1 -1
  14. package/lib/commonjs/components/history/history-list-screen.js.map +1 -1
  15. package/lib/commonjs/components/history/history-list-section-header.js +1 -1
  16. package/lib/commonjs/components/history/history-list-section-header.js.map +1 -1
  17. package/lib/commonjs/components/history/history-list.js.map +1 -1
  18. package/lib/commonjs/components/proof-request/v1/select-credential.js.map +1 -1
  19. package/lib/commonjs/components/proof-request/v1/share-credential.js +1 -1
  20. package/lib/commonjs/components/proof-request/v1/share-credential.js.map +1 -1
  21. package/lib/commonjs/components/proof-request/v2/select-credential-v2.js.map +1 -1
  22. package/lib/commonjs/components/proof-request/v2/share-credential-v2-group.js.map +1 -1
  23. package/lib/commonjs/components/proof-request/v2/share-credential-v2.js.map +1 -1
  24. package/lib/commonjs/ui-components/control/checkbox.js +2 -1
  25. package/lib/commonjs/ui-components/control/checkbox.js.map +1 -1
  26. package/lib/commonjs/ui-components/control/switch.js +2 -2
  27. package/lib/commonjs/ui-components/control/switch.js.map +1 -1
  28. package/lib/commonjs/ui-components/history/history-section-header.js +1 -1
  29. package/lib/commonjs/ui-components/history/history-section-header.js.map +1 -1
  30. package/lib/commonjs/ui-components/history/history-section-list-item.js +1 -1
  31. package/lib/commonjs/ui-components/history/history-section-list-item.js.map +1 -1
  32. package/lib/commonjs/ui-components/screens/nerd-mode-screen.js.map +1 -1
  33. package/lib/commonjs/utils/history.js.map +1 -1
  34. package/lib/commonjs/utils/hooks/core/backup.js +2 -2
  35. package/lib/commonjs/utils/hooks/core/backup.js.map +1 -1
  36. package/lib/commonjs/utils/hooks/core/cache.js +10 -10
  37. package/lib/commonjs/utils/hooks/core/cache.js.map +1 -1
  38. package/lib/commonjs/utils/hooks/core/core-config.js.map +1 -1
  39. package/lib/commonjs/utils/hooks/core/core-init.js +4 -2
  40. package/lib/commonjs/utils/hooks/core/core-init.js.map +1 -1
  41. package/lib/commonjs/utils/hooks/core/credential-schemas.js +1 -1
  42. package/lib/commonjs/utils/hooks/core/credential-schemas.js.map +1 -1
  43. package/lib/commonjs/utils/hooks/core/credentials.js +4 -4
  44. package/lib/commonjs/utils/hooks/core/credentials.js.map +1 -1
  45. package/lib/commonjs/utils/hooks/core/dids.js +2 -2
  46. package/lib/commonjs/utils/hooks/core/dids.js.map +1 -1
  47. package/lib/commonjs/utils/hooks/core/history.js +1 -1
  48. package/lib/commonjs/utils/hooks/core/history.js.map +1 -1
  49. package/lib/commonjs/utils/hooks/core/identifiers.js +2 -2
  50. package/lib/commonjs/utils/hooks/core/identifiers.js.map +1 -1
  51. package/lib/commonjs/utils/hooks/core/index.js +22 -0
  52. package/lib/commonjs/utils/hooks/core/index.js.map +1 -1
  53. package/lib/commonjs/utils/hooks/core/proof-schemas.js +1 -1
  54. package/lib/commonjs/utils/hooks/core/proof-schemas.js.map +1 -1
  55. package/lib/commonjs/utils/hooks/core/proofs.js +11 -11
  56. package/lib/commonjs/utils/hooks/core/proofs.js.map +1 -1
  57. package/lib/commonjs/utils/hooks/core/trust-entity.js +1 -1
  58. package/lib/commonjs/utils/hooks/core/trust-entity.js.map +1 -1
  59. package/lib/commonjs/utils/hooks/core/trust-list.js +32 -0
  60. package/lib/commonjs/utils/hooks/core/trust-list.js.map +1 -0
  61. package/lib/commonjs/utils/hooks/core/verifier-instance.js +52 -0
  62. package/lib/commonjs/utils/hooks/core/verifier-instance.js.map +1 -0
  63. package/lib/commonjs/utils/hooks/core/wallet-unit.js +38 -3
  64. package/lib/commonjs/utils/hooks/core/wallet-unit.js.map +1 -1
  65. package/lib/commonjs/utils/hooks/revocation/credential-status.js +1 -1
  66. package/lib/commonjs/utils/hooks/revocation/credential-status.js.map +1 -1
  67. package/lib/commonjs/utils/parsers/credential-images.js +3 -3
  68. package/lib/commonjs/utils/parsers/credential-images.js.map +1 -1
  69. package/lib/commonjs/utils/parsers/credential-sharing-v2.js.map +1 -1
  70. package/lib/commonjs/utils/parsers/credential-sharing.js.map +1 -1
  71. package/lib/commonjs/utils/parsers/credential.js +9 -9
  72. package/lib/commonjs/utils/parsers/credential.js.map +1 -1
  73. package/lib/commonjs/utils/parsers/query.js +2 -2
  74. package/lib/commonjs/utils/parsers/query.js.map +1 -1
  75. package/lib/module/components/backup/preview-credentials.js.map +1 -1
  76. package/lib/module/components/credential/credential.js.map +1 -1
  77. package/lib/module/components/entity/EntityButtons.js.map +1 -1
  78. package/lib/module/components/entity/entity-attributes.js.map +1 -1
  79. package/lib/module/components/entity/entity-details-with-buttons.js +3 -3
  80. package/lib/module/components/entity/entity-details-with-buttons.js.map +1 -1
  81. package/lib/module/components/entity/entity-details.js +4 -4
  82. package/lib/module/components/entity/entity-details.js.map +1 -1
  83. package/lib/module/components/history/history-details-screen.js +11 -11
  84. package/lib/module/components/history/history-details-screen.js.map +1 -1
  85. package/lib/module/components/history/history-list-item-icon.js +15 -9
  86. package/lib/module/components/history/history-list-item-icon.js.map +1 -1
  87. package/lib/module/components/history/history-list-item.js.map +1 -1
  88. package/lib/module/components/history/history-list-screen.js.map +1 -1
  89. package/lib/module/components/history/history-list-section-header.js +1 -1
  90. package/lib/module/components/history/history-list-section-header.js.map +1 -1
  91. package/lib/module/components/history/history-list.js.map +1 -1
  92. package/lib/module/components/proof-request/v1/select-credential.js.map +1 -1
  93. package/lib/module/components/proof-request/v1/share-credential.js +2 -2
  94. package/lib/module/components/proof-request/v1/share-credential.js.map +1 -1
  95. package/lib/module/components/proof-request/v2/select-credential-v2.js.map +1 -1
  96. package/lib/module/components/proof-request/v2/share-credential-v2-group.js.map +1 -1
  97. package/lib/module/components/proof-request/v2/share-credential-v2.js.map +1 -1
  98. package/lib/module/ui-components/control/checkbox.js +2 -1
  99. package/lib/module/ui-components/control/checkbox.js.map +1 -1
  100. package/lib/module/ui-components/control/switch.js +3 -3
  101. package/lib/module/ui-components/control/switch.js.map +1 -1
  102. package/lib/module/ui-components/history/history-section-header.js +1 -1
  103. package/lib/module/ui-components/history/history-section-header.js.map +1 -1
  104. package/lib/module/ui-components/history/history-section-list-item.js +1 -1
  105. package/lib/module/ui-components/history/history-section-list-item.js.map +1 -1
  106. package/lib/module/ui-components/screens/nerd-mode-screen.js.map +1 -1
  107. package/lib/module/utils/history.js.map +1 -1
  108. package/lib/module/utils/hooks/core/backup.js +3 -3
  109. package/lib/module/utils/hooks/core/backup.js.map +1 -1
  110. package/lib/module/utils/hooks/core/cache.js +11 -11
  111. package/lib/module/utils/hooks/core/cache.js.map +1 -1
  112. package/lib/module/utils/hooks/core/core-config.js.map +1 -1
  113. package/lib/module/utils/hooks/core/core-init.js +4 -2
  114. package/lib/module/utils/hooks/core/core-init.js.map +1 -1
  115. package/lib/module/utils/hooks/core/credential-schemas.js +1 -1
  116. package/lib/module/utils/hooks/core/credential-schemas.js.map +1 -1
  117. package/lib/module/utils/hooks/core/credentials.js +5 -5
  118. package/lib/module/utils/hooks/core/credentials.js.map +1 -1
  119. package/lib/module/utils/hooks/core/dids.js +3 -3
  120. package/lib/module/utils/hooks/core/dids.js.map +1 -1
  121. package/lib/module/utils/hooks/core/history.js +1 -1
  122. package/lib/module/utils/hooks/core/history.js.map +1 -1
  123. package/lib/module/utils/hooks/core/identifiers.js +3 -3
  124. package/lib/module/utils/hooks/core/identifiers.js.map +1 -1
  125. package/lib/module/utils/hooks/core/index.js +2 -0
  126. package/lib/module/utils/hooks/core/index.js.map +1 -1
  127. package/lib/module/utils/hooks/core/proof-schemas.js +1 -1
  128. package/lib/module/utils/hooks/core/proof-schemas.js.map +1 -1
  129. package/lib/module/utils/hooks/core/proofs.js +12 -12
  130. package/lib/module/utils/hooks/core/proofs.js.map +1 -1
  131. package/lib/module/utils/hooks/core/trust-entity.js +2 -2
  132. package/lib/module/utils/hooks/core/trust-entity.js.map +1 -1
  133. package/lib/module/utils/hooks/core/trust-list.js +24 -0
  134. package/lib/module/utils/hooks/core/trust-list.js.map +1 -0
  135. package/lib/module/utils/hooks/core/verifier-instance.js +43 -0
  136. package/lib/module/utils/hooks/core/verifier-instance.js.map +1 -0
  137. package/lib/module/utils/hooks/core/wallet-unit.js +36 -3
  138. package/lib/module/utils/hooks/core/wallet-unit.js.map +1 -1
  139. package/lib/module/utils/hooks/revocation/credential-status.js +2 -2
  140. package/lib/module/utils/hooks/revocation/credential-status.js.map +1 -1
  141. package/lib/module/utils/parsers/credential-images.js +4 -4
  142. package/lib/module/utils/parsers/credential-images.js.map +1 -1
  143. package/lib/module/utils/parsers/credential-sharing-v2.js.map +1 -1
  144. package/lib/module/utils/parsers/credential-sharing.js.map +1 -1
  145. package/lib/module/utils/parsers/credential.js +10 -10
  146. package/lib/module/utils/parsers/credential.js.map +1 -1
  147. package/lib/module/utils/parsers/query.js +2 -2
  148. package/lib/module/utils/parsers/query.js.map +1 -1
  149. package/lib/typescript/components/backup/preview-credentials.d.ts +2 -2
  150. package/lib/typescript/components/credential/credential.d.ts +2 -2
  151. package/lib/typescript/components/entity/EntityButtons.d.ts +2 -2
  152. package/lib/typescript/components/entity/entity-attributes.d.ts +2 -2
  153. package/lib/typescript/components/entity/entity-details-with-buttons.d.ts +3 -3
  154. package/lib/typescript/components/entity/entity-details.d.ts +5 -5
  155. package/lib/typescript/components/history/history-details-screen.d.ts +2 -2
  156. package/lib/typescript/components/history/history-list-item-icon.d.ts +3 -3
  157. package/lib/typescript/components/history/history-list-item.d.ts +5 -5
  158. package/lib/typescript/components/history/history-list-screen.d.ts +4 -4
  159. package/lib/typescript/components/history/history-list.d.ts +5 -5
  160. package/lib/typescript/components/proof-request/v1/select-credential.d.ts +2 -2
  161. package/lib/typescript/components/proof-request/v1/share-credential.d.ts +6 -6
  162. package/lib/typescript/components/proof-request/v2/select-credential-v2.d.ts +3 -3
  163. package/lib/typescript/components/proof-request/v2/share-credential-v2-group.d.ts +4 -4
  164. package/lib/typescript/components/proof-request/v2/share-credential-v2.d.ts +5 -5
  165. package/lib/typescript/ui-components/control/checkbox.d.ts +1 -1
  166. package/lib/typescript/ui-components/screens/nerd-mode-screen.d.ts +2 -2
  167. package/lib/typescript/utils/history.d.ts +3 -3
  168. package/lib/typescript/utils/hooks/core/backup.d.ts +3 -3
  169. package/lib/typescript/utils/hooks/core/cache.d.ts +2 -2
  170. package/lib/typescript/utils/hooks/core/core-config.d.ts +4 -4
  171. package/lib/typescript/utils/hooks/core/core-init.d.ts +1 -1
  172. package/lib/typescript/utils/hooks/core/credential-schemas.d.ts +6 -6
  173. package/lib/typescript/utils/hooks/core/credentials.d.ts +9 -16
  174. package/lib/typescript/utils/hooks/core/dids.d.ts +2 -2
  175. package/lib/typescript/utils/hooks/core/history.d.ts +2 -2
  176. package/lib/typescript/utils/hooks/core/identifiers.d.ts +3 -3
  177. package/lib/typescript/utils/hooks/core/index.d.ts +2 -0
  178. package/lib/typescript/utils/hooks/core/proof-schemas.d.ts +7 -7
  179. package/lib/typescript/utils/hooks/core/proofs.d.ts +9 -9
  180. package/lib/typescript/utils/hooks/core/trust-entity.d.ts +5 -5
  181. package/lib/typescript/utils/hooks/core/trust-list.d.ts +5 -0
  182. package/lib/typescript/utils/hooks/core/verifier-instance.d.ts +8 -0
  183. package/lib/typescript/utils/hooks/core/wallet-unit.d.ts +11 -5
  184. package/lib/typescript/utils/parsers/credential-images.d.ts +2 -2
  185. package/lib/typescript/utils/parsers/credential-sharing-v2.d.ts +7 -7
  186. package/lib/typescript/utils/parsers/credential-sharing.d.ts +8 -8
  187. package/lib/typescript/utils/parsers/credential.d.ts +11 -11
  188. package/lib/typescript/utils/parsers/query.d.ts +8 -8
  189. package/package.json +3 -3
  190. package/src/components/backup/preview-credentials.tsx +2 -2
  191. package/src/components/credential/credential.tsx +2 -2
  192. package/src/components/entity/EntityButtons.tsx +2 -2
  193. package/src/components/entity/entity-attributes.tsx +2 -2
  194. package/src/components/entity/entity-details-with-buttons.tsx +6 -11
  195. package/src/components/entity/entity-details.tsx +16 -17
  196. package/src/components/history/history-details-screen.tsx +13 -13
  197. package/src/components/history/history-list-item-icon.tsx +17 -15
  198. package/src/components/history/history-list-item.tsx +5 -9
  199. package/src/components/history/history-list-screen.tsx +4 -4
  200. package/src/components/history/history-list-section-header.tsx +1 -1
  201. package/src/components/history/history-list.tsx +6 -6
  202. package/src/components/proof-request/v1/select-credential.tsx +2 -2
  203. package/src/components/proof-request/v1/share-credential.tsx +11 -13
  204. package/src/components/proof-request/v2/select-credential-v2.tsx +3 -6
  205. package/src/components/proof-request/v2/share-credential-v2-group.tsx +10 -10
  206. package/src/components/proof-request/v2/share-credential-v2.tsx +9 -9
  207. package/src/ui-components/control/checkbox.tsx +13 -11
  208. package/src/ui-components/control/switch.tsx +23 -21
  209. package/src/ui-components/detail/detail.stories.tsx +1 -1
  210. package/src/ui-components/history/history-section-header.tsx +1 -1
  211. package/src/ui-components/history/history-section-list-item.tsx +1 -1
  212. package/src/ui-components/screens/nerd-mode-screen.tsx +2 -2
  213. package/src/utils/history.ts +4 -4
  214. package/src/utils/hooks/core/backup.ts +3 -3
  215. package/src/utils/hooks/core/cache.ts +13 -13
  216. package/src/utils/hooks/core/core-config.ts +3 -3
  217. package/src/utils/hooks/core/core-init.ts +3 -4
  218. package/src/utils/hooks/core/credential-schemas.ts +5 -8
  219. package/src/utils/hooks/core/credentials.ts +16 -32
  220. package/src/utils/hooks/core/dids.ts +4 -4
  221. package/src/utils/hooks/core/history.ts +3 -3
  222. package/src/utils/hooks/core/identifiers.ts +4 -8
  223. package/src/utils/hooks/core/index.ts +2 -0
  224. package/src/utils/hooks/core/proof-schemas.ts +16 -22
  225. package/src/utils/hooks/core/proofs.ts +33 -34
  226. package/src/utils/hooks/core/trust-entity.ts +8 -10
  227. package/src/utils/hooks/core/trust-list.ts +29 -0
  228. package/src/utils/hooks/core/verifier-instance.ts +54 -0
  229. package/src/utils/hooks/core/wallet-unit.ts +47 -14
  230. package/src/utils/hooks/revocation/credential-status.ts +2 -2
  231. package/src/utils/parsers/credential-images.tsx +6 -10
  232. package/src/utils/parsers/credential-sharing-v2.tsx +20 -22
  233. package/src/utils/parsers/credential-sharing.tsx +28 -28
  234. package/src/utils/parsers/credential.ts +43 -43
  235. package/src/utils/parsers/query.ts +22 -16
@@ -1,8 +1,8 @@
1
1
  import {
2
- CreateProofSchemaRequestDto,
3
- GetProofSchemaListItemBindingDto,
4
- ImportProofSchemaBindingDto,
5
- ListProofSchemasFiltersBindingDto,
2
+ CreateProofSchemaRequest,
3
+ ImportProofSchema,
4
+ ProofSchemaListItem,
5
+ ProofSchemaListQuery,
6
6
  } from '@procivis/react-native-one-core';
7
7
  import { useInfiniteQuery, useMutation, useQuery, useQueryClient } from 'react-query';
8
8
 
@@ -18,14 +18,14 @@ export const PROOF_SCHEMA_IMPORT_DETAIL_QUERY_KEY = 'proof-schema-import';
18
18
  export const PROOF_SCHEMA_DETAIL_QUERY_KEY = 'proof-schema-detail';
19
19
  export const PROOF_SCHEMA_SHARE_QUERY_KEY = 'proof-schema-share';
20
20
 
21
- export const useProofSchemas = (queryParams?: Partial<ListProofSchemasFiltersBindingDto>, keepPreviousData = true) => {
21
+ export const useProofSchemas = (queryParams?: Partial<ProofSchemaListQuery>, keepPreviousData = true) => {
22
22
  const { core, organisationId } = useONECore();
23
23
 
24
24
  return useInfiniteQuery(
25
25
  [PROOF_SCHEMA_LIST_QUERY_KEY, ...getQueryKeyFromProofSchemaListQueryParams(queryParams)],
26
26
  ({ pageParam = 0 }) =>
27
27
  core
28
- .getProofSchemas({
28
+ .listProofSchemas({
29
29
  organisationId,
30
30
  page: pageParam,
31
31
  pageSize: PAGE_SIZE,
@@ -39,10 +39,7 @@ export const useProofSchemas = (queryParams?: Partial<ListProofSchemasFiltersBin
39
39
  );
40
40
  };
41
41
 
42
- export const useProofSchemaDetail = (
43
- proofSchemaId: GetProofSchemaListItemBindingDto['id'] | undefined,
44
- active = true,
45
- ) => {
42
+ export const useProofSchemaDetail = (proofSchemaId: ProofSchemaListItem['id'] | undefined, active = true) => {
46
43
  const { core } = useONECore();
47
44
 
48
45
  return useQuery(
@@ -65,7 +62,7 @@ export const useProofSchemaImportDetail = (url: string) => {
65
62
  if (!response.ok) {
66
63
  throw response.originalError;
67
64
  }
68
- return response.data as ImportProofSchemaBindingDto;
65
+ return response.data as ImportProofSchema;
69
66
  }),
70
67
  {
71
68
  keepPreviousData: true,
@@ -78,7 +75,7 @@ export const useProofSchemaAccept = () => {
78
75
  const { core, organisationId } = useONECore();
79
76
 
80
77
  return useMutation(
81
- async ({ schema }: { schema: ImportProofSchemaBindingDto }) =>
78
+ async ({ schema }: { schema: ImportProofSchema }) =>
82
79
  core.importProofSchema({
83
80
  organisationId,
84
81
  schema,
@@ -97,7 +94,7 @@ export const useProofSchemaCreate = () => {
97
94
  const queryClient = useQueryClient();
98
95
  const { core } = useONECore();
99
96
 
100
- return useMutation(async (proofSchema: CreateProofSchemaRequestDto) => core.createProofSchema(proofSchema), {
97
+ return useMutation(async (proofSchema: CreateProofSchemaRequest) => core.createProofSchema(proofSchema), {
101
98
  onSuccess: async () => {
102
99
  await queryClient.invalidateQueries(PROOF_SCHEMA_LIST_QUERY_KEY);
103
100
  await queryClient.invalidateQueries(HISTORY_LIST_QUERY_KEY);
@@ -109,16 +106,13 @@ export const useProofSchemaDelete = () => {
109
106
  const queryClient = useQueryClient();
110
107
  const { core } = useONECore();
111
108
 
112
- return useMutation(
113
- async (proofSchemaId: GetProofSchemaListItemBindingDto['id']) => core.deleteProofSchema(proofSchemaId),
114
- {
115
- onSuccess: async (_, proofSchemaId) => {
116
- await queryClient.invalidateQueries(PROOF_SCHEMA_LIST_QUERY_KEY);
117
- await queryClient.invalidateQueries(HISTORY_LIST_QUERY_KEY);
118
- await queryClient.removeQueries([PROOF_SCHEMA_DETAIL_QUERY_KEY, proofSchemaId]);
119
- },
109
+ return useMutation(async (proofSchemaId: ProofSchemaListItem['id']) => core.deleteProofSchema(proofSchemaId), {
110
+ onSuccess: async (_, proofSchemaId) => {
111
+ await queryClient.invalidateQueries(PROOF_SCHEMA_LIST_QUERY_KEY);
112
+ await queryClient.invalidateQueries(HISTORY_LIST_QUERY_KEY);
113
+ await queryClient.removeQueries([PROOF_SCHEMA_DETAIL_QUERY_KEY, proofSchemaId]);
120
114
  },
121
- );
115
+ });
122
116
  };
123
117
 
124
118
  export const useShareProofSchema = (schemaId?: string) => {
@@ -1,17 +1,17 @@
1
1
  import {
2
- Config,
3
- CreateProofRequestBindingDto,
4
- GetProofSchemaBindingDto,
5
- HistoryActionBindingEnum,
6
- HistoryEntityTypeBindingEnum,
7
- HistoryErrorMetadataBindingDto,
8
- IdentifierListQueryBindingDto,
2
+ CoreConfig,
3
+ CreateProofRequest,
4
+ HistoryAction,
5
+ HistoryEntityType,
6
+ HistoryErrorMetadata,
7
+ IdentifierListQuery,
9
8
  OneError,
10
- PresentationSubmitCredentialRequestBindingDto,
11
- ProofListQueryBindingDto,
12
- ProofStateBindingEnum,
13
- ProposeProofRequestBindingDto,
14
- ShareProofRequestBindingDto,
9
+ PresentationSubmitCredentialRequest,
10
+ ProofListQuery,
11
+ ProofSchemaDetail,
12
+ ProofState,
13
+ ProposeProofRequest,
14
+ ShareProofRequest,
15
15
  } from '@procivis/react-native-one-core';
16
16
  import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
17
17
  import { useMutation, useQuery, useQueryClient } from 'react-query';
@@ -51,18 +51,18 @@ export const useProofState = (proofId: string | undefined, isPolling: boolean) =
51
51
  }
52
52
 
53
53
  const state = await core.getProof(proofId).then((proof) => proof.state);
54
- let metadata: HistoryErrorMetadataBindingDto | undefined;
55
- if (state === ProofStateBindingEnum.ERROR) {
54
+ let metadata: HistoryErrorMetadata | undefined;
55
+ if (state === ProofState.ERROR) {
56
56
  metadata = await core
57
- .getHistoryList({
57
+ .listHistory({
58
58
  organisationId,
59
59
  page: 0,
60
60
  pageSize: 1,
61
61
  entityIds: [proofId],
62
- entityTypes: [HistoryEntityTypeBindingEnum.PROOF],
63
- actions: [HistoryActionBindingEnum.ERRORED],
62
+ entityTypes: [HistoryEntityType.PROOF],
63
+ actions: [HistoryAction.ERRORED],
64
64
  })
65
- .then((result) => result.values[0]?.metadata?.value as HistoryErrorMetadataBindingDto);
65
+ .then((result) => result.values[0]?.metadata?.value as HistoryErrorMetadata);
66
66
  }
67
67
  return { state, metadata };
68
68
  },
@@ -73,7 +73,7 @@ export const useProofState = (proofId: string | undefined, isPolling: boolean) =
73
73
  );
74
74
  };
75
75
 
76
- type ProofUrlHookParams = { proofId: string; request?: ShareProofRequestBindingDto };
76
+ type ProofUrlHookParams = { proofId: string; request?: ShareProofRequest };
77
77
 
78
78
  export const useProofUrl = () => {
79
79
  const queryClient = useQueryClient();
@@ -101,7 +101,7 @@ export const useProofAccept = () => {
101
101
  interactionId,
102
102
  credentials,
103
103
  }: {
104
- credentials: Record<string, PresentationSubmitCredentialRequestBindingDto[]>;
104
+ credentials: Record<string, PresentationSubmitCredentialRequest[]>;
105
105
  interactionId: string;
106
106
  }) => core.holderSubmitProof(interactionId, credentials),
107
107
  {
@@ -163,8 +163,7 @@ export const useProposeProof = () => {
163
163
  const { core, organisationId } = useONECore();
164
164
 
165
165
  return useMutation(
166
- async (request: Omit<ProposeProofRequestBindingDto, 'organisationId'>) =>
167
- core.proposeProof({ organisationId, ...request }),
166
+ async (request: Omit<ProposeProofRequest, 'organisationId'>) => core.proposeProof({ organisationId, ...request }),
168
167
  {
169
168
  onSuccess: async () => {
170
169
  await queryClient.invalidateQueries(PROOF_LIST_QUERY_KEY);
@@ -198,7 +197,7 @@ export const useProofDelete = () => {
198
197
  );
199
198
  };
200
199
 
201
- export const useProofs = (queryParams?: Partial<ProofListQueryBindingDto>) => {
200
+ export const useProofs = (queryParams?: Partial<ProofListQuery>) => {
202
201
  const { core, organisationId } = useONECore();
203
202
 
204
203
  const queryKey = [PROOF_LIST_QUERY_KEY, ...getQueryKeyFromProofListQueryParams(queryParams)];
@@ -206,7 +205,7 @@ export const useProofs = (queryParams?: Partial<ProofListQueryBindingDto>) => {
206
205
  return useQuery(
207
206
  queryKey,
208
207
  ({ pageParam = 0 }) =>
209
- core.getProofs({
208
+ core.listProofs({
210
209
  organisationId,
211
210
  page: pageParam,
212
211
  pageSize: PAGE_SIZE,
@@ -223,7 +222,7 @@ export const useProofCreate = () => {
223
222
 
224
223
  const { core } = useONECore();
225
224
 
226
- return useMutation(async (data: CreateProofRequestBindingDto) => core.createProof(data), {
225
+ return useMutation(async (data: CreateProofRequest) => core.createProof(data), {
227
226
  onSuccess: async () => {
228
227
  await queryClient.invalidateQueries(PROOF_LIST_QUERY_KEY);
229
228
  await queryClient.invalidateQueries(HISTORY_LIST_QUERY_KEY);
@@ -232,9 +231,9 @@ export const useProofCreate = () => {
232
231
  };
233
232
 
234
233
  const getIdentifierFilterForProofSchema = (
235
- proofSchema: GetProofSchemaBindingDto,
236
- config: Config,
237
- ): Partial<IdentifierListQueryBindingDto> => {
234
+ proofSchema: ProofSchemaDetail,
235
+ config: CoreConfig,
236
+ ): Partial<IdentifierListQuery> => {
238
237
  const requestedFormats = proofSchema.proofInputSchemas.map((schema) => schema.credentialSchema.format);
239
238
  const requestedFormatsCapabilities = requestedFormats
240
239
  .map((format) => config.format[format]?.capabilities)
@@ -310,7 +309,7 @@ export const useProofForSchemaIdWithTransport = (
310
309
  return;
311
310
  }
312
311
 
313
- if (proofState?.state !== ProofStateBindingEnum.CREATED && proofState?.state !== ProofStateBindingEnum.PENDING) {
312
+ if (proofState?.state !== ProofState.CREATED && proofState?.state !== ProofState.PENDING) {
314
313
  setProofId(undefined);
315
314
  } else {
316
315
  setDeleting(true);
@@ -357,7 +356,7 @@ export const useCleanupUnusedProofs = () => {
357
356
  const { data: proofs } = useProofs({
358
357
  page: 0,
359
358
  pageSize: 100,
360
- proofStates: [ProofStateBindingEnum.CREATED, ProofStateBindingEnum.PENDING],
359
+ proofStates: [ProofState.CREATED, ProofState.PENDING],
361
360
  });
362
361
  const [cleaned, setCleaned] = useState(false);
363
362
 
@@ -382,7 +381,7 @@ export const useShareProof = (proofUrlProps: ProofUrlHookParams | undefined, ena
382
381
 
383
382
  // reset when proofId changes or the proof was retracted
384
383
  useEffect(() => {
385
- if (!proofUrlProps?.proofId || proofState?.state === ProofStateBindingEnum.CREATED) {
384
+ if (!proofUrlProps?.proofId || proofState?.state === ProofState.CREATED) {
386
385
  setSharedProof(undefined);
387
386
  }
388
387
  }, [proofUrlProps?.proofId, proofState]);
@@ -418,7 +417,7 @@ export const useRetainProofCheck = (proofId?: string) => {
418
417
 
419
418
  const { core } = useONECore();
420
419
 
421
- return useMutation(async () => core.runTask('RETAIN_PROOF_CHECK'), {
420
+ return useMutation(async () => core.runTask('RETAIN_PROOF_CHECK', undefined), {
422
421
  onSuccess: async () => {
423
422
  if (proofId) {
424
423
  await queryClient.removeQueries([PROOF_DETAIL_QUERY_KEY, proofId]);
@@ -449,12 +448,12 @@ export const useDeleteAllProofsData = (schemaId: string) => {
449
448
  return useMutation(
450
449
  async () =>
451
450
  core
452
- .getProofs({
451
+ .listProofs({
453
452
  organisationId,
454
453
  page: 0,
455
454
  pageSize: 1000,
456
455
  proofSchemaIds: [schemaId],
457
- proofStates: [ProofStateBindingEnum.ACCEPTED],
456
+ proofStates: [ProofState.ACCEPTED],
458
457
  })
459
458
  .then((result) => Promise.all(result.values.reverse().map((proof) => core.deleteProofClaims(proof.id)))),
460
459
  {
@@ -1,10 +1,10 @@
1
1
  import {
2
- CreateRemoteTrustEntityRequestBindingDto,
3
- GetTrustAnchorResponseBindingDto,
4
- IdentifierTypeBindingEnum,
2
+ CreateRemoteTrustEntityRequest,
3
+ IdentifierType,
5
4
  ONECore,
6
5
  OneError,
7
- UpdateRemoteTrustEntityFromDidRequestBindingDto,
6
+ TrustAnchorDetail,
7
+ UpdateRemoteTrustEntityRequest,
8
8
  } from '@procivis/react-native-one-core';
9
9
  import { useCallback } from 'react';
10
10
  import { useMutation, useQuery, useQueryClient } from 'react-query';
@@ -31,7 +31,7 @@ export const useCreateTrustAnchor = () => {
31
31
  if (trustAnchors.values.length > 0) {
32
32
  return;
33
33
  }
34
- const response = await httpClient.get<GetTrustAnchorResponseBindingDto>(publisherReference);
34
+ const response = await httpClient.get<TrustAnchorDetail>(publisherReference);
35
35
  if (!response.ok || !response.data) {
36
36
  return;
37
37
  }
@@ -66,7 +66,7 @@ export const useTrustEntity = (identifierId: string | undefined) => {
66
66
  identifiers: [
67
67
  {
68
68
  certificateId:
69
- identifierDetail?.type === IdentifierTypeBindingEnum.CERTIFICATE
69
+ identifierDetail?.type === IdentifierType.CERTIFICATE
70
70
  ? identifierDetail.certificates?.[0]?.id
71
71
  : undefined,
72
72
  id: identifierId,
@@ -110,9 +110,7 @@ export const useCreateRemoteTrustEntity = () => {
110
110
  const { core } = useONECore();
111
111
 
112
112
  return useMutation(
113
- async (
114
- request: Omit<CreateRemoteTrustEntityRequestBindingDto, 'didId'> & { identifierId?: string; didId?: string },
115
- ) => {
113
+ async (request: Omit<CreateRemoteTrustEntityRequest, 'didId'> & { identifierId?: string; didId?: string }) => {
116
114
  const { identifierId, didId } = request;
117
115
 
118
116
  let entityDidId = didId;
@@ -142,7 +140,7 @@ export const useUpdateRemoteTrustEntity = () => {
142
140
 
143
141
  return useMutation(
144
142
  async (
145
- request: Omit<UpdateRemoteTrustEntityFromDidRequestBindingDto, 'didId'> & {
143
+ request: Omit<UpdateRemoteTrustEntityRequest, 'didId'> & {
146
144
  identifierId?: string;
147
145
  didId?: string;
148
146
  },
@@ -0,0 +1,29 @@
1
+ import { HolderWalletUnit } from '@procivis/react-native-one-core';
2
+ import { useMutation } from 'react-query';
3
+
4
+ import { reportException } from '../../reporting';
5
+ import { useONECore } from './core-context';
6
+
7
+ export const useTrustCollectionSync = () => {
8
+ const { core } = useONECore();
9
+
10
+ return useMutation(
11
+ async (params: { holderWalletUnitId?: HolderWalletUnit['id']; verifierInstanceId?: string }) =>
12
+ core.runTask('TRUST_COLLECTION_SYNC', JSON.stringify(params)),
13
+ {
14
+ onError: (err) => {
15
+ reportException(err, 'TRUST_COLLECTION_SYNC error');
16
+ },
17
+ },
18
+ );
19
+ };
20
+
21
+ export const useTrustListSubscriptionUpdate = () => {
22
+ const { core } = useONECore();
23
+
24
+ return useMutation(async () => core.runTask('TRUST_LIST_SUBSCRIPTION_UPDATE', undefined), {
25
+ onError: (err) => {
26
+ reportException(err, 'TRUST_LIST_SUBSCRIPTION_UPDATE error');
27
+ },
28
+ });
29
+ };
@@ -0,0 +1,54 @@
1
+ import { RegisterVerifierInstanceRequest, UpdateVerifierInstanceRequest } from '@procivis/react-native-one-core';
2
+ import { useMutation, useQuery, useQueryClient } from 'react-query';
3
+
4
+ import { reportException } from '../../reporting';
5
+ import { useONECore } from './core-context';
6
+
7
+ export const VERIFIER_INSTANCE_TRUST_COLLECTIONS_QUERY_KEY = 'verifier-instance-trust-collections';
8
+
9
+ export const useVerifierInstanceTrustCollections = (verifierInstanceId: string | undefined, active = true) => {
10
+ const { core } = useONECore();
11
+
12
+ return useQuery(
13
+ [VERIFIER_INSTANCE_TRUST_COLLECTIONS_QUERY_KEY, verifierInstanceId],
14
+ () => (verifierInstanceId ? core.getVerifierInstanceTrustCollections(verifierInstanceId) : undefined),
15
+ {
16
+ enabled: active && Boolean(verifierInstanceId),
17
+ keepPreviousData: true,
18
+ },
19
+ );
20
+ };
21
+
22
+ export const useRegisterVerifierInstance = () => {
23
+ const queryClient = useQueryClient();
24
+ const { core, organisationId } = useONECore();
25
+
26
+ return useMutation(
27
+ async (request: Omit<RegisterVerifierInstanceRequest, 'organisationId'>) =>
28
+ core.registerVerifierInstance({
29
+ organisationId,
30
+ ...request,
31
+ }),
32
+
33
+ {
34
+ onSuccess: () => queryClient.invalidateQueries(VERIFIER_INSTANCE_TRUST_COLLECTIONS_QUERY_KEY),
35
+ },
36
+ );
37
+ };
38
+
39
+ export const useVerifierInstanceUpdate = () => {
40
+ const queryClient = useQueryClient();
41
+ const { core } = useONECore();
42
+
43
+ return useMutation(
44
+ async ({ verifierInstanceId, update }: { verifierInstanceId: string; update: UpdateVerifierInstanceRequest }) =>
45
+ core.updateVerifierInstance(verifierInstanceId, update),
46
+ {
47
+ onError: async (err) => {
48
+ reportException(err, 'Update verifier instance failure');
49
+ await queryClient.invalidateQueries(VERIFIER_INSTANCE_TRUST_COLLECTIONS_QUERY_KEY);
50
+ },
51
+ onSuccess: () => queryClient.invalidateQueries(VERIFIER_INSTANCE_TRUST_COLLECTIONS_QUERY_KEY),
52
+ },
53
+ );
54
+ };
@@ -1,7 +1,8 @@
1
1
  import {
2
- HolderWalletUnitResponseBindingDto,
3
- WalletProviderBindingDto,
4
- WalletUnitStatusBindingEnum,
2
+ HolderWalletUnit,
3
+ HolderWalletUnitUpdateRequest,
4
+ WalletProvider,
5
+ WalletUnitStatus,
5
6
  } from '@procivis/react-native-one-core';
6
7
  import { useEffect } from 'react';
7
8
  import { useMutation, useQuery, useQueryClient } from 'react-query';
@@ -10,11 +11,9 @@ import { reportException } from '../../reporting';
10
11
  import { useONECore } from './core-context';
11
12
 
12
13
  export const WALLET_UNIT_QUERY_KEY = 'wallet-unit';
14
+ export const WALLET_UNIT_TRUST_COLLECTIONS_QUERY_KEY = 'wallet-unit-trust-collections';
13
15
 
14
- export const useWalletUnitDetail = (
15
- walletUnitId: HolderWalletUnitResponseBindingDto['id'] | undefined,
16
- active = true,
17
- ) => {
16
+ export const useWalletUnitDetail = (walletUnitId: HolderWalletUnit['id'] | undefined, active = true) => {
18
17
  const { core } = useONECore();
19
18
 
20
19
  return useQuery(
@@ -27,12 +26,25 @@ export const useWalletUnitDetail = (
27
26
  );
28
27
  };
29
28
 
29
+ export const useWalletUnitTrustCollections = (walletUnitId: HolderWalletUnit['id'] | undefined, active = true) => {
30
+ const { core } = useONECore();
31
+
32
+ return useQuery(
33
+ [WALLET_UNIT_TRUST_COLLECTIONS_QUERY_KEY, walletUnitId],
34
+ () => (walletUnitId ? core.holderGetWalletUnitTrustCollections(walletUnitId) : undefined),
35
+ {
36
+ enabled: active && Boolean(walletUnitId),
37
+ keepPreviousData: true,
38
+ },
39
+ );
40
+ };
41
+
30
42
  export const useRegisterWalletUnit = () => {
31
43
  const queryClient = useQueryClient();
32
44
  const { core, organisationId } = useONECore();
33
45
 
34
46
  return useMutation(
35
- async (walletProvider: WalletProviderBindingDto) =>
47
+ async (walletProvider: WalletProvider) =>
36
48
  core.holderRegisterWalletUnit({
37
49
  keyType: 'ECDSA',
38
50
  organisationId,
@@ -40,7 +52,10 @@ export const useRegisterWalletUnit = () => {
40
52
  }),
41
53
 
42
54
  {
43
- onSuccess: () => queryClient.invalidateQueries(WALLET_UNIT_QUERY_KEY),
55
+ onSuccess: async () => {
56
+ await queryClient.invalidateQueries(WALLET_UNIT_QUERY_KEY);
57
+ await queryClient.invalidateQueries(WALLET_UNIT_TRUST_COLLECTIONS_QUERY_KEY);
58
+ },
44
59
  },
45
60
  );
46
61
  };
@@ -49,19 +64,37 @@ export const useWalletUnitStatus = () => {
49
64
  const queryClient = useQueryClient();
50
65
  const { core } = useONECore();
51
66
 
67
+ return useMutation(async (walletUnitId: HolderWalletUnit['id']) => core.holderWalletUnitStatus(walletUnitId), {
68
+ onError: async (err) => {
69
+ reportException(err, 'Refresh wallet unit failure');
70
+ await queryClient.invalidateQueries(WALLET_UNIT_QUERY_KEY);
71
+ },
72
+ onSuccess: () => queryClient.invalidateQueries(WALLET_UNIT_QUERY_KEY),
73
+ });
74
+ };
75
+
76
+ export const useWalletUnitUpdate = () => {
77
+ const queryClient = useQueryClient();
78
+ const { core } = useONECore();
79
+
52
80
  return useMutation(
53
- async (walletUnitId: HolderWalletUnitResponseBindingDto['id']) => core.holderWalletUnitStatus(walletUnitId),
81
+ async ({ walletUnitId, update }: { walletUnitId: HolderWalletUnit['id']; update: HolderWalletUnitUpdateRequest }) =>
82
+ core.holderWalletUnitUpdate(walletUnitId, update),
54
83
  {
55
84
  onError: async (err) => {
56
- reportException(err, 'Refresh wallet unit failure');
85
+ reportException(err, 'Update wallet unit failure');
86
+ await queryClient.invalidateQueries(WALLET_UNIT_QUERY_KEY);
87
+ await queryClient.invalidateQueries(WALLET_UNIT_TRUST_COLLECTIONS_QUERY_KEY);
88
+ },
89
+ onSuccess: async () => {
57
90
  await queryClient.invalidateQueries(WALLET_UNIT_QUERY_KEY);
91
+ await queryClient.invalidateQueries(WALLET_UNIT_TRUST_COLLECTIONS_QUERY_KEY);
58
92
  },
59
- onSuccess: () => queryClient.invalidateQueries(WALLET_UNIT_QUERY_KEY),
60
93
  },
61
94
  );
62
95
  };
63
96
 
64
- export const useWalletUnitCheck = (walletUnitId: HolderWalletUnitResponseBindingDto['id'] | undefined) => {
97
+ export const useWalletUnitCheck = (walletUnitId: HolderWalletUnit['id'] | undefined) => {
65
98
  const { data: walletUnitDetail, isLoading } = useWalletUnitDetail(walletUnitId);
66
99
  const { mutateAsync: refreshWalletUnit, isLoading: isRefreshing, status: refreshStatus } = useWalletUnitStatus();
67
100
 
@@ -69,7 +102,7 @@ export const useWalletUnitCheck = (walletUnitId: HolderWalletUnitResponseBinding
69
102
  if (isLoading || refreshStatus !== 'idle') {
70
103
  return;
71
104
  }
72
- if (walletUnitId && walletUnitDetail?.status === WalletUnitStatusBindingEnum.ACTIVE) {
105
+ if (walletUnitId && walletUnitDetail?.status === WalletUnitStatus.ACTIVE) {
73
106
  void refreshWalletUnit(walletUnitId);
74
107
  }
75
108
  }, [isLoading, refreshStatus, walletUnitDetail, refreshWalletUnit, walletUnitId]);
@@ -1,4 +1,4 @@
1
- import { CredentialStateBindingEnum } from '@procivis/react-native-one-core';
1
+ import { CredentialState } from '@procivis/react-native-one-core';
2
2
  import { useIsFocused } from '@react-navigation/native';
3
3
  import { useCallback, useRef } from 'react';
4
4
 
@@ -18,7 +18,7 @@ export const useCredentialStatusCheck = (credentialIds?: string[], forceRefresh
18
18
  const { mutateAsync: check } = useCredentialRevocationCheck(forceRefresh);
19
19
  const { data: credentials } = useCredentials({
20
20
  ids: credentialIds,
21
- states: [CredentialStateBindingEnum.ACCEPTED, CredentialStateBindingEnum.SUSPENDED],
21
+ states: [CredentialState.ACCEPTED, CredentialState.SUSPENDED],
22
22
  });
23
23
 
24
24
  const checkCredentialsStatus = useCallback(async () => {
@@ -1,8 +1,4 @@
1
- import {
2
- ClaimBindingDto,
3
- CredentialSchemaCodeTypeBindingDto,
4
- CredentialSchemaLayoutPropertiesBindingDto,
5
- } from '@procivis/react-native-one-core';
1
+ import { Claim, CredentialSchemaCodeType, CredentialSchemaLayoutProperties } from '@procivis/react-native-one-core';
6
2
  import React from 'react';
7
3
  import { StyleSheet } from 'react-native';
8
4
 
@@ -21,8 +17,8 @@ const styles = StyleSheet.create({
21
17
  });
22
18
 
23
19
  export const getCarouselImagesFromClaims = (
24
- claims: ClaimBindingDto[],
25
- layoutProperties?: CredentialSchemaLayoutPropertiesBindingDto,
20
+ claims: Claim[],
21
+ layoutProperties?: CredentialSchemaLayoutProperties,
26
22
  testID?: string,
27
23
  ): CarouselImage[] => {
28
24
  const result: CarouselImage[] = [];
@@ -62,17 +58,17 @@ export const getCarouselImagesFromClaims = (
62
58
  return result;
63
59
  }
64
60
 
65
- if (code.type === CredentialSchemaCodeTypeBindingDto.QR_CODE) {
61
+ if (code.type === CredentialSchemaCodeType.QR_CODE) {
66
62
  result.push({
67
63
  element: <QrCode content={claimValue} testID={concatTestID(testID, CarouselImageType.QrCode)} />,
68
64
  type: CarouselImageType.QrCode,
69
65
  });
70
- } else if (code.type === CredentialSchemaCodeTypeBindingDto.BARCODE && isASCII(claimValue)) {
66
+ } else if (code.type === CredentialSchemaCodeType.BARCODE && isASCII(claimValue)) {
71
67
  result.push({
72
68
  element: <Barcode content={claimValue} testID={concatTestID(testID, CarouselImageType.Barcode)} />,
73
69
  type: CarouselImageType.Barcode,
74
70
  });
75
- } else if (code.type === CredentialSchemaCodeTypeBindingDto.MRZ) {
71
+ } else if (code.type === CredentialSchemaCodeType.MRZ) {
76
72
  result.push({
77
73
  element: <Mrz content={claimValue} testID={concatTestID(testID, CarouselImageType.MRZ)} />,
78
74
  type: CarouselImageType.MRZ,