@procivis/one-react-native-components 0.3.27 → 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.
- package/lib/commonjs/components/entity/entity-attributes.js +14 -1
- package/lib/commonjs/components/entity/entity-attributes.js.map +1 -1
- package/lib/commonjs/components/entity/entity-details-with-buttons.js +9 -42
- package/lib/commonjs/components/entity/entity-details-with-buttons.js.map +1 -1
- package/lib/commonjs/components/entity/entity-details.js +60 -32
- package/lib/commonjs/components/entity/entity-details.js.map +1 -1
- package/lib/commonjs/components/entity/index.js +2 -15
- package/lib/commonjs/components/entity/index.js.map +1 -1
- package/lib/commonjs/components/history/history-list-item.js +14 -12
- package/lib/commonjs/components/history/history-list-item.js.map +1 -1
- package/lib/commonjs/components/proof-request/share-credential.js +1 -2
- package/lib/commonjs/components/proof-request/share-credential.js.map +1 -1
- package/lib/commonjs/ui-components/blur/index.js +2 -9
- package/lib/commonjs/ui-components/blur/index.js.map +1 -1
- package/lib/commonjs/ui-components/buttons/hold-button.js +3 -2
- package/lib/commonjs/ui-components/buttons/hold-button.js.map +1 -1
- package/lib/commonjs/ui-components/camera/index.js +2 -9
- package/lib/commonjs/ui-components/camera/index.js.map +1 -1
- package/lib/commonjs/ui-components/control/index.js +0 -12
- package/lib/commonjs/ui-components/control/index.js.map +1 -1
- package/lib/commonjs/ui-components/credential/card/credential-details-card.js +1 -1
- package/lib/commonjs/ui-components/credential/card/credential-details-card.js.map +1 -1
- package/lib/commonjs/ui-components/credential/credential-carousel-images.js +15 -8
- package/lib/commonjs/ui-components/credential/credential-carousel-images.js.map +1 -1
- package/lib/commonjs/ui-components/entity/entity-cluster.js +50 -2
- package/lib/commonjs/ui-components/entity/entity-cluster.js.map +1 -1
- package/lib/commonjs/ui-components/entity/index.js +3 -16
- package/lib/commonjs/ui-components/entity/index.js.map +1 -1
- package/lib/commonjs/ui-components/history/history-details.js +1 -1
- package/lib/commonjs/ui-components/history/history-details.js.map +1 -1
- package/lib/commonjs/ui-components/history/index.js +4 -27
- package/lib/commonjs/ui-components/history/index.js.map +1 -1
- package/lib/commonjs/ui-components/icons/entity.js +10 -13
- package/lib/commonjs/ui-components/icons/entity.js.map +1 -1
- package/lib/commonjs/ui-components/input/index.js +3 -32
- package/lib/commonjs/ui-components/input/index.js.map +1 -1
- package/lib/commonjs/ui-components/list/index.js +4 -19
- package/lib/commonjs/ui-components/list/index.js.map +1 -1
- package/lib/commonjs/ui-components/loader/index.js +2 -13
- package/lib/commonjs/ui-components/loader/index.js.map +1 -1
- package/lib/commonjs/ui-components/pin/index.js +2 -21
- package/lib/commonjs/ui-components/pin/index.js.map +1 -1
- package/lib/commonjs/ui-components/screens/nerd-mode-screen.js.map +1 -1
- package/lib/commonjs/ui-components/searchbar/index.js +3 -16
- package/lib/commonjs/ui-components/searchbar/index.js.map +1 -1
- package/lib/commonjs/ui-components/settings/index.js +6 -37
- package/lib/commonjs/ui-components/settings/index.js.map +1 -1
- package/lib/commonjs/ui-components/state/index.js +2 -15
- package/lib/commonjs/ui-components/state/index.js.map +1 -1
- package/lib/commonjs/utils/date.js +1 -1
- package/lib/commonjs/utils/date.js.map +1 -1
- package/lib/commonjs/utils/hooks/connectivity/connectivity.test.js +4 -0
- package/lib/commonjs/utils/hooks/connectivity/connectivity.test.js.map +1 -1
- package/lib/commonjs/utils/hooks/core/backup.js +22 -66
- package/lib/commonjs/utils/hooks/core/backup.js.map +1 -1
- package/lib/commonjs/utils/hooks/core/core-init.js +6 -2
- package/lib/commonjs/utils/hooks/core/core-init.js.map +1 -1
- package/lib/commonjs/utils/hooks/core/identifiers.js +23 -1
- package/lib/commonjs/utils/hooks/core/identifiers.js.map +1 -1
- package/lib/commonjs/utils/hooks/core/proofs.js +24 -14
- package/lib/commonjs/utils/hooks/core/proofs.js.map +1 -1
- package/lib/commonjs/utils/hooks/core/trust-entity.js +55 -14
- package/lib/commonjs/utils/hooks/core/trust-entity.js.map +1 -1
- package/lib/commonjs/utils/parsers/credential-sharing.js +6 -15
- package/lib/commonjs/utils/parsers/credential-sharing.js.map +1 -1
- package/lib/commonjs/utils/parsers/query.js +21 -3
- package/lib/commonjs/utils/parsers/query.js.map +1 -1
- package/lib/module/components/entity/entity-attributes.js +15 -2
- package/lib/module/components/entity/entity-attributes.js.map +1 -1
- package/lib/module/components/entity/entity-details-with-buttons.js +11 -44
- package/lib/module/components/entity/entity-details-with-buttons.js.map +1 -1
- package/lib/module/components/entity/entity-details.js +60 -32
- package/lib/module/components/entity/entity-details.js.map +1 -1
- package/lib/module/components/entity/index.js +2 -2
- package/lib/module/components/entity/index.js.map +1 -1
- package/lib/module/components/history/history-list-item.js +15 -13
- package/lib/module/components/history/history-list-item.js.map +1 -1
- package/lib/module/components/proof-request/share-credential.js +1 -2
- package/lib/module/components/proof-request/share-credential.js.map +1 -1
- package/lib/module/ui-components/blur/index.js +2 -2
- package/lib/module/ui-components/blur/index.js.map +1 -1
- package/lib/module/ui-components/buttons/hold-button.js +4 -3
- package/lib/module/ui-components/buttons/hold-button.js.map +1 -1
- package/lib/module/ui-components/camera/index.js +2 -2
- package/lib/module/ui-components/camera/index.js.map +1 -1
- package/lib/module/ui-components/control/index.js +3 -3
- package/lib/module/ui-components/control/index.js.map +1 -1
- package/lib/module/ui-components/credential/card/credential-details-card.js +1 -1
- package/lib/module/ui-components/credential/card/credential-details-card.js.map +1 -1
- package/lib/module/ui-components/credential/credential-carousel-images.js +15 -8
- package/lib/module/ui-components/credential/credential-carousel-images.js.map +1 -1
- package/lib/module/ui-components/entity/entity-cluster.js +51 -3
- package/lib/module/ui-components/entity/entity-cluster.js.map +1 -1
- package/lib/module/ui-components/entity/index.js +4 -4
- package/lib/module/ui-components/entity/index.js.map +1 -1
- package/lib/module/ui-components/history/history-details.js +1 -1
- package/lib/module/ui-components/history/history-details.js.map +1 -1
- package/lib/module/ui-components/history/index.js +6 -6
- package/lib/module/ui-components/history/index.js.map +1 -1
- package/lib/module/ui-components/icons/entity.js +10 -13
- package/lib/module/ui-components/icons/entity.js.map +1 -1
- package/lib/module/ui-components/input/index.js +6 -6
- package/lib/module/ui-components/input/index.js.map +1 -1
- package/lib/module/ui-components/list/index.js +4 -4
- package/lib/module/ui-components/list/index.js.map +1 -1
- package/lib/module/ui-components/loader/index.js +4 -4
- package/lib/module/ui-components/loader/index.js.map +1 -1
- package/lib/module/ui-components/pin/index.js +3 -3
- package/lib/module/ui-components/pin/index.js.map +1 -1
- package/lib/module/ui-components/screens/nerd-mode-screen.js.map +1 -1
- package/lib/module/ui-components/searchbar/index.js +4 -4
- package/lib/module/ui-components/searchbar/index.js.map +1 -1
- package/lib/module/ui-components/settings/index.js +10 -10
- package/lib/module/ui-components/settings/index.js.map +1 -1
- package/lib/module/ui-components/state/index.js +2 -2
- package/lib/module/ui-components/state/index.js.map +1 -1
- package/lib/module/utils/date.js +1 -1
- package/lib/module/utils/date.js.map +1 -1
- package/lib/module/utils/hooks/connectivity/connectivity.test.js +4 -0
- package/lib/module/utils/hooks/connectivity/connectivity.test.js.map +1 -1
- package/lib/module/utils/hooks/core/backup.js +24 -68
- package/lib/module/utils/hooks/core/backup.js.map +1 -1
- package/lib/module/utils/hooks/core/core-init.js +5 -3
- package/lib/module/utils/hooks/core/core-init.js.map +1 -1
- package/lib/module/utils/hooks/core/identifiers.js +21 -0
- package/lib/module/utils/hooks/core/identifiers.js.map +1 -1
- package/lib/module/utils/hooks/core/proofs.js +24 -14
- package/lib/module/utils/hooks/core/proofs.js.map +1 -1
- package/lib/module/utils/hooks/core/trust-entity.js +55 -14
- package/lib/module/utils/hooks/core/trust-entity.js.map +1 -1
- package/lib/module/utils/parsers/credential-sharing.js +6 -15
- package/lib/module/utils/parsers/credential-sharing.js.map +1 -1
- package/lib/module/utils/parsers/query.js +19 -2
- package/lib/module/utils/parsers/query.js.map +1 -1
- package/lib/typescript/components/entity/entity-attributes.d.ts +1 -0
- package/lib/typescript/components/entity/entity-details-with-buttons.d.ts +1 -2
- package/lib/typescript/components/entity/entity-details.d.ts +3 -2
- package/lib/typescript/components/entity/index.d.ts +2 -1
- package/lib/typescript/ui-components/blur/index.d.ts +2 -1
- package/lib/typescript/ui-components/buttons/hold-button.d.ts +2 -2
- package/lib/typescript/ui-components/camera/index.d.ts +2 -1
- package/lib/typescript/ui-components/control/index.d.ts +4 -2
- package/lib/typescript/ui-components/credential/credential-carousel-images.d.ts +1 -0
- package/lib/typescript/ui-components/entity/entity-cluster.d.ts +1 -0
- package/lib/typescript/ui-components/entity/index.d.ts +4 -2
- package/lib/typescript/ui-components/history/history-details.d.ts +4 -1
- package/lib/typescript/ui-components/history/index.d.ts +6 -3
- package/lib/typescript/ui-components/input/index.d.ts +6 -3
- package/lib/typescript/ui-components/list/index.d.ts +4 -2
- package/lib/typescript/ui-components/loader/index.d.ts +4 -2
- package/lib/typescript/ui-components/pin/index.d.ts +4 -2
- package/lib/typescript/ui-components/screens/nerd-mode-screen.d.ts +1 -1
- package/lib/typescript/ui-components/searchbar/index.d.ts +4 -2
- package/lib/typescript/ui-components/settings/index.d.ts +10 -5
- package/lib/typescript/ui-components/state/index.d.ts +2 -1
- package/lib/typescript/utils/hooks/core/backup.d.ts +5 -0
- package/lib/typescript/utils/hooks/core/core-init.d.ts +4 -1
- package/lib/typescript/utils/hooks/core/identifiers.d.ts +4 -1
- package/lib/typescript/utils/hooks/core/proofs.d.ts +1 -0
- package/lib/typescript/utils/hooks/core/trust-entity.d.ts +9 -3
- package/lib/typescript/utils/parsers/query.d.ts +3 -2
- package/package.json +10 -5
- package/src/components/entity/entity-attributes.tsx +16 -2
- package/src/components/entity/entity-details-with-buttons.tsx +11 -42
- package/src/components/entity/entity-details.tsx +60 -30
- package/src/components/entity/index.ts +2 -1
- package/src/components/history/history-list-item.tsx +17 -13
- package/src/components/proof-request/share-credential.tsx +0 -1
- package/src/ui-components/blur/index.ts +2 -1
- package/src/ui-components/buttons/hold-button.tsx +6 -5
- package/src/ui-components/camera/index.tsx +2 -1
- package/src/ui-components/control/index.ts +4 -2
- package/src/ui-components/credential/card/credential-details-card.tsx +1 -1
- package/src/ui-components/credential/credential-carousel-images.tsx +15 -8
- package/src/ui-components/entity/entity-cluster.tsx +63 -10
- package/src/ui-components/entity/index.ts +4 -2
- package/src/ui-components/history/history-details.tsx +5 -2
- package/src/ui-components/history/index.ts +6 -3
- package/src/ui-components/icons/entity.tsx +8 -12
- package/src/ui-components/input/index.ts +6 -3
- package/src/ui-components/list/index.ts +4 -2
- package/src/ui-components/loader/index.ts +4 -2
- package/src/ui-components/pin/index.ts +4 -2
- package/src/ui-components/screens/nerd-mode-screen.tsx +1 -1
- package/src/ui-components/searchbar/index.ts +4 -2
- package/src/ui-components/settings/index.ts +10 -5
- package/src/ui-components/state/index.ts +2 -1
- package/src/utils/date.ts +1 -1
- package/src/utils/hooks/connectivity/connectivity.test.ts +7 -2
- package/src/utils/hooks/core/backup.ts +30 -72
- package/src/utils/hooks/core/core-init.ts +5 -3
- package/src/utils/hooks/core/identifiers.ts +22 -1
- package/src/utils/hooks/core/proofs.ts +27 -16
- package/src/utils/hooks/core/trust-entity.ts +45 -11
- package/src/utils/parsers/credential-sharing.tsx +8 -14
- package/src/utils/parsers/query.tsx +12 -2
|
@@ -9,26 +9,13 @@ Object.defineProperty(exports, "AnimatedSearchBar", {
|
|
|
9
9
|
return _animatedSearchBar.default;
|
|
10
10
|
}
|
|
11
11
|
});
|
|
12
|
-
Object.defineProperty(exports, "AnimatedSearchBarProps", {
|
|
13
|
-
enumerable: true,
|
|
14
|
-
get: function () {
|
|
15
|
-
return _animatedSearchBar.AnimatedSearchBarProps;
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
12
|
Object.defineProperty(exports, "SearchBar", {
|
|
19
13
|
enumerable: true,
|
|
20
14
|
get: function () {
|
|
21
15
|
return _searchBar.default;
|
|
22
16
|
}
|
|
23
17
|
});
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
return _searchBar.SearchBarProps;
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
|
-
var _animatedSearchBar = _interopRequireWildcard(require("./animated-search-bar"));
|
|
31
|
-
var _searchBar = _interopRequireWildcard(require("./search-bar"));
|
|
32
|
-
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
33
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
18
|
+
var _animatedSearchBar = _interopRequireDefault(require("./animated-search-bar"));
|
|
19
|
+
var _searchBar = _interopRequireDefault(require("./search-bar"));
|
|
20
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
34
21
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_animatedSearchBar","
|
|
1
|
+
{"version":3,"names":["_animatedSearchBar","_interopRequireDefault","require","_searchBar","e","__esModule","default"],"sources":["index.ts"],"sourcesContent":["import type { AnimatedSearchBarProps } from './animated-search-bar';\nimport AnimatedSearchBar from './animated-search-bar';\nimport type { SearchBarProps } from './search-bar';\nimport SearchBar from './search-bar';\n\nexport { AnimatedSearchBar, AnimatedSearchBarProps };\nexport { SearchBar, SearchBarProps };\n"],"mappings":";;;;;;;;;;;;;;;;;AACA,IAAAA,kBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,UAAA,GAAAF,sBAAA,CAAAC,OAAA;AAAqC,SAAAD,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA","ignoreList":[]}
|
|
@@ -9,65 +9,34 @@ Object.defineProperty(exports, "ButtonSetting", {
|
|
|
9
9
|
return _buttonSetting.default;
|
|
10
10
|
}
|
|
11
11
|
});
|
|
12
|
-
Object.defineProperty(exports, "ButtonSettingProps", {
|
|
13
|
-
enumerable: true,
|
|
14
|
-
get: function () {
|
|
15
|
-
return _buttonSetting.ButtonSettingProps;
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
12
|
Object.defineProperty(exports, "SettingItem", {
|
|
19
13
|
enumerable: true,
|
|
20
14
|
get: function () {
|
|
21
15
|
return _settingItem.default;
|
|
22
16
|
}
|
|
23
17
|
});
|
|
24
|
-
Object.defineProperty(exports, "SettingItemProps", {
|
|
25
|
-
enumerable: true,
|
|
26
|
-
get: function () {
|
|
27
|
-
return _settingItem.SettingItemProps;
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
18
|
Object.defineProperty(exports, "SettingItemSeparator", {
|
|
31
19
|
enumerable: true,
|
|
32
20
|
get: function () {
|
|
33
21
|
return _settingItemSeparator.default;
|
|
34
22
|
}
|
|
35
23
|
});
|
|
36
|
-
Object.defineProperty(exports, "SettingItemSeparatorProps", {
|
|
37
|
-
enumerable: true,
|
|
38
|
-
get: function () {
|
|
39
|
-
return _settingItemSeparator.SettingItemSeparatorProps;
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
24
|
Object.defineProperty(exports, "SettingsButton", {
|
|
43
25
|
enumerable: true,
|
|
44
26
|
get: function () {
|
|
45
27
|
return _settingsButton.default;
|
|
46
28
|
}
|
|
47
29
|
});
|
|
48
|
-
Object.defineProperty(exports, "SettingsButtonProps", {
|
|
49
|
-
enumerable: true,
|
|
50
|
-
get: function () {
|
|
51
|
-
return _settingsButton.SettingsButtonProps;
|
|
52
|
-
}
|
|
53
|
-
});
|
|
54
30
|
Object.defineProperty(exports, "SwitchSetting", {
|
|
55
31
|
enumerable: true,
|
|
56
32
|
get: function () {
|
|
57
33
|
return _switchSetting.default;
|
|
58
34
|
}
|
|
59
35
|
});
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
}
|
|
66
|
-
var _buttonSetting = _interopRequireWildcard(require("./button-setting"));
|
|
67
|
-
var _settingItem = _interopRequireWildcard(require("./setting-item"));
|
|
68
|
-
var _settingItemSeparator = _interopRequireWildcard(require("./setting-item-separator"));
|
|
69
|
-
var _settingsButton = _interopRequireWildcard(require("./settings-button"));
|
|
70
|
-
var _switchSetting = _interopRequireWildcard(require("./switch-setting"));
|
|
71
|
-
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
72
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
36
|
+
var _buttonSetting = _interopRequireDefault(require("./button-setting"));
|
|
37
|
+
var _settingItem = _interopRequireDefault(require("./setting-item"));
|
|
38
|
+
var _settingItemSeparator = _interopRequireDefault(require("./setting-item-separator"));
|
|
39
|
+
var _settingsButton = _interopRequireDefault(require("./settings-button"));
|
|
40
|
+
var _switchSetting = _interopRequireDefault(require("./switch-setting"));
|
|
41
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
73
42
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_buttonSetting","
|
|
1
|
+
{"version":3,"names":["_buttonSetting","_interopRequireDefault","require","_settingItem","_settingItemSeparator","_settingsButton","_switchSetting","e","__esModule","default"],"sources":["index.ts"],"sourcesContent":["import type { ButtonSettingProps } from './button-setting';\nimport ButtonSetting from './button-setting';\nimport type { SettingItemProps } from './setting-item';\nimport SettingItem from './setting-item';\nimport type { SettingItemSeparatorProps } from './setting-item-separator';\nimport SettingItemSeparator from './setting-item-separator';\nimport type { SettingsButtonProps } from './settings-button';\nimport SettingsButton from './settings-button';\nimport type { SwitchSettingProps } from './switch-setting';\nimport SwitchSetting from './switch-setting';\n\nexport { ButtonSetting, ButtonSettingProps };\nexport { SettingItem, SettingItemProps };\nexport { SettingItemSeparator, SettingItemSeparatorProps };\nexport { SettingsButton, SettingsButtonProps };\nexport { SwitchSetting, SwitchSettingProps };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,IAAAA,cAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,YAAA,GAAAF,sBAAA,CAAAC,OAAA;AAEA,IAAAE,qBAAA,GAAAH,sBAAA,CAAAC,OAAA;AAEA,IAAAG,eAAA,GAAAJ,sBAAA,CAAAC,OAAA;AAEA,IAAAI,cAAA,GAAAL,sBAAA,CAAAC,OAAA;AAA6C,SAAAD,uBAAAM,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA","ignoreList":[]}
|
|
@@ -9,19 +9,6 @@ Object.defineProperty(exports, "ErrorScreen", {
|
|
|
9
9
|
return _errorScreen.default;
|
|
10
10
|
}
|
|
11
11
|
});
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
get: function () {
|
|
15
|
-
return _errorScreen.ErrorScreenButton;
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
|
-
Object.defineProperty(exports, "ErrorScreenProps", {
|
|
19
|
-
enumerable: true,
|
|
20
|
-
get: function () {
|
|
21
|
-
return _errorScreen.ErrorScreenProps;
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
var _errorScreen = _interopRequireWildcard(require("./error-screen"));
|
|
25
|
-
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
26
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
12
|
+
var _errorScreen = _interopRequireDefault(require("./error-screen"));
|
|
13
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
27
14
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_errorScreen","
|
|
1
|
+
{"version":3,"names":["_errorScreen","_interopRequireDefault","require","e","__esModule","default"],"sources":["index.ts"],"sourcesContent":["import type { ErrorScreenButton, ErrorScreenProps } from './error-screen';\nimport ErrorScreen from './error-screen';\n\nexport { ErrorScreen, ErrorScreenButton, ErrorScreenProps };\n"],"mappings":";;;;;;;;;;;AACA,IAAAA,YAAA,GAAAC,sBAAA,CAAAC,OAAA;AAAyC,SAAAD,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA","ignoreList":[]}
|
|
@@ -11,7 +11,7 @@ const MINUTE = 60 * 1000;
|
|
|
11
11
|
const DAY = 24 * 60 * MINUTE;
|
|
12
12
|
|
|
13
13
|
// OS locale
|
|
14
|
-
const systemLocale = (_I18nManager$getConst = _reactNative.I18nManager.getConstants().localeIdentifier) === null || _I18nManager$getConst === void 0 ? void 0 : _I18nManager$getConst.replace(/_/g, '-').split(
|
|
14
|
+
const systemLocale = (_I18nManager$getConst = _reactNative.I18nManager.getConstants().localeIdentifier) === null || _I18nManager$getConst === void 0 ? void 0 : _I18nManager$getConst.replace(/_/g, '-').split(/[#@]/)[0].replace(/-$/, '');
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
17
|
* Date only format
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_reactNative","require","_timeago","_I18nManager$getConst","_ref","MINUTE","DAY","systemLocale","I18nManager","getConstants","localeIdentifier","replace","split","formatDate","date","locale","options","toLocaleDateString","undefined","exports","formatTime","toLocaleTimeString","hour","minute","formatDateTime","toLocaleString","year","month","day","hour12","formatMonth","getFullYear","formatTimeAgo","format","formatTimestamp","nowLabel","_formatDateTime2","now","Date","timestamp","getTime","_formatDateTime","pad","x","String","convertDateToUTCTimestamp","parse","getMonth","getDate","convertDateStrToLocalDate","Platform","select","android","timezoneOffset","getTimezoneOffset","default","formatDateOnlyFromUTCTimestamp","utcTimestamp","_formatDate","utcDate","getUTCFullYear","getUTCMonth","getUTCDate","OS","Settings","get","formatDateTimeLocalized","formatDateLocalized"],"sources":["date.ts"],"sourcesContent":["// Date & Time formatted as specified in SW-610\n\nimport { I18nManager, Platform, Settings } from 'react-native';\nimport { format } from 'timeago.js';\n\nconst MINUTE = 60 * 1000;\nconst DAY = 24 * 60 * MINUTE;\n\n// OS locale\nconst systemLocale: string | undefined = I18nManager.getConstants().localeIdentifier\n ?.replace(/_/g, '-')\n .split(
|
|
1
|
+
{"version":3,"names":["_reactNative","require","_timeago","_I18nManager$getConst","_ref","MINUTE","DAY","systemLocale","I18nManager","getConstants","localeIdentifier","replace","split","formatDate","date","locale","options","toLocaleDateString","undefined","exports","formatTime","toLocaleTimeString","hour","minute","formatDateTime","toLocaleString","year","month","day","hour12","formatMonth","getFullYear","formatTimeAgo","format","formatTimestamp","nowLabel","_formatDateTime2","now","Date","timestamp","getTime","_formatDateTime","pad","x","String","convertDateToUTCTimestamp","parse","getMonth","getDate","convertDateStrToLocalDate","Platform","select","android","timezoneOffset","getTimezoneOffset","default","formatDateOnlyFromUTCTimestamp","utcTimestamp","_formatDate","utcDate","getUTCFullYear","getUTCMonth","getUTCDate","OS","Settings","get","formatDateTimeLocalized","formatDateLocalized"],"sources":["date.ts"],"sourcesContent":["// Date & Time formatted as specified in SW-610\n\nimport { I18nManager, Platform, Settings } from 'react-native';\nimport { format } from 'timeago.js';\n\nconst MINUTE = 60 * 1000;\nconst DAY = 24 * 60 * MINUTE;\n\n// OS locale\nconst systemLocale: string | undefined = I18nManager.getConstants().localeIdentifier\n ?.replace(/_/g, '-')\n .split(/[#@]/)[0]\n .replace(/-$/, '');\n\n/**\n * Date only format\n */\nexport const formatDate = (date: Date, locale?: string, options?: Intl.DateTimeFormatOptions) => {\n try {\n return date.toLocaleDateString(locale || systemLocale, options);\n } catch {\n return undefined;\n }\n};\n\n/**\n * Time only format\n */\nexport const formatTime = (date: Date, locale?: string) => {\n try {\n return date.toLocaleTimeString(locale || systemLocale, { hour: '2-digit', minute: '2-digit' });\n } catch {\n return undefined;\n }\n};\n\n/**\n * Date and time format\n */\nexport const formatDateTime = (date: Date, locale?: string) => {\n try {\n return date.toLocaleString(locale || systemLocale, {\n hour: '2-digit',\n minute: '2-digit',\n year: 'numeric',\n month: 'numeric',\n day: 'numeric',\n hour12: locale === 'en-US',\n });\n } catch {\n return undefined;\n }\n};\n\n/**\n * Month format\n */\nexport const formatMonth = (date: Date, locale: string): string => {\n return `${date.toLocaleString(locale, {\n month: 'long',\n })} ${date.getFullYear()}`;\n};\n\n/**\n * Time-ago format\n */\nexport const formatTimeAgo = (date: Date, locale: string): string => {\n return format(date, locale);\n};\n\n/**\n * Timestamp formatted for general use\n */\nexport const formatTimestamp = (date: Date, locale: string, nowLabel: string): string => {\n const now = Date.now();\n const timestamp = date.getTime();\n if (now < timestamp) {\n // in the future\n return formatDateTime(date, locale) ?? '';\n }\n\n // in the past\n if (now - timestamp < MINUTE) {\n // less than a minute ago\n return nowLabel;\n }\n\n // less than a day ago\n if (now - timestamp < DAY) {\n return formatTimeAgo(date, locale);\n }\n\n // longer ago\n return formatDateTime(date, locale) ?? '';\n};\n\nconst pad = (x: number) => (x >= 0 && x < 10 ? `0${x}` : String(x));\n\n/**\n * Utility function to deal with `date`-type attributes\n * @param {Date} date local timezone representation\n * @returns {number} the same day, but UTC timezone with midnight time\n */\nexport const convertDateToUTCTimestamp = (date: Date): number =>\n Date.parse(`${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())}`);\n\n/**\n * Utility function to deal with `date`-type attributes\n * @param {string} date in YYYY-MM-DD representation\n * @returns {Date} the same day, but local timezone with midnight time\n */\nexport const convertDateStrToLocalDate = (date: string): Date =>\n Platform.select({\n // android conversion using the standard date parsing doesn't work, computing the timestamp manually\n android: (() => {\n const timestamp = Date.parse(date);\n const timezoneOffset = new Date(date).getTimezoneOffset();\n return new Date(timestamp + timezoneOffset * MINUTE);\n })(),\n default: new Date(`${date}T00:00:00`),\n });\n\n/**\n * Inverted function to {@link convertDateToUTCTimestamp}\n * @param {number} utcTimestamp date timestamp represented as midnight UTC time\n * @returns {string} formatted date (based on locale settings, e.g. `21/02/2021`)\n */\nexport const formatDateOnlyFromUTCTimestamp = (utcTimestamp: number): string => {\n const utcDate = new Date(utcTimestamp);\n return (\n formatDate(\n convertDateStrToLocalDate(\n `${utcDate.getUTCFullYear()}-${pad(utcDate.getUTCMonth() + 1)}-${pad(utcDate.getUTCDate())}`,\n ),\n ) ?? ''\n );\n};\n\nconst locale = (\n Platform.OS === 'ios'\n ? Settings.get('AppleLocale')\n : I18nManager.getConstants().localeIdentifier\n)\n ?.split('@')[0]\n .replace('_', '-');\n\nexport const formatDateTimeLocalized = (date: Date) => {\n return formatDateTime(date, locale);\n};\n\nexport const form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A;AACA;AACA;AAJAK,OAAA,CAAA8B,yBAAA,GAAAA,yBAAA;AAKO,MAAMO,8BAA8B,GAAIC,YAAoB,IAAa;EAAA,IAAAC,WAAA;EAC9E,MAAMC,OAAO,GAAG,IAAIrB,IAAI,CAACmB,YAAY,CAAC;EACtC,QAAAC,WAAA,GACE7C,UAAU,CACRoC,yBAAyB,CACvB,GAAGU,OAAO,CAACC,cAAc,CAAC,CAAC,IAAIlB,GAAG,CAACiB,OAAO,CAACE,WAAW,CAAC,CAAC,GAAG,CAAC,CAAC,IAAInB,GAAG,CAACiB,OAAO,CAACG,UAAU,CAAC,CAAC,CAAC,EAC5F,CACF,CAAC,cAAAJ,WAAA,cAAAA,WAAA,GAAI,EAAE;AAEX,CAAC;AAACvC,OAAA,CAAAqC,8BAAA,GAAAA,8BAAA;AAEF,MAAMzC,MAAM,IAAAX,IAAA,GACV8C,qBAAQ,CAACa,EAAE,KAAK,KAAK,GACjBC,qBAAQ,CAACC,GAAG,CAAC,aAAa,CAAC,GAC3BzD,wBAAW,CAACC,YAAY,CAAC,CAAC,CAACC,gBAAgB,cAAAN,IAAA,uBAHlCA,IAAA,CAKXQ,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CACdD,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC;AAEb,MAAMuD,uBAAuB,GAAIpD,IAAU,IAAK;EACrD,OAAOU,cAAc,CAACV,IAAI,EAAEC,MAAM,CAAC;AACrC,CAAC;AAACI,OAAA,CAAA+C,uBAAA,GAAAA,uBAAA;AAEK,MAAMC,mBAAmB,GAAIrD,IAAU,IAAK;EACjD,OAAOD,UAAU,CAACC,IAAI,EAAEC,MAAM,CAAC;AACjC,CAAC;AAACI,OAAA,CAAAgD,mBAAA,GAAAA,mBAAA","ignoreList":[]}
|
|
@@ -7,6 +7,10 @@ jest.mock('@procivis/react-native-one-core', () => ({
|
|
|
7
7
|
jest.mock('@sentry/react-native', () => ({
|
|
8
8
|
captureException: () => {}
|
|
9
9
|
}));
|
|
10
|
+
jest.mock('../core/core-config', () => ({
|
|
11
|
+
getEnabledTransports: () => [],
|
|
12
|
+
useCoreConfig: () => ({})
|
|
13
|
+
}));
|
|
10
14
|
jest.mock('@react-native-community/netinfo', () => ({
|
|
11
15
|
addEventListener: () => {}
|
|
12
16
|
}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_connectivity","require","jest","mock","initializeCore","Promise","resolve","captureException","addEventListener","onStateChange","describe","test","transports","getInvitationUrlTransports","expect","toStrictEqual","Transport","Bluetooth","MQTT","HTTP"],"sources":["connectivity.test.ts"],"sourcesContent":["import { getInvitationUrlTransports, Transport } from './connectivity';\n\njest.mock('@procivis/react-native-one-core', () => ({\n initializeCore: () => Promise.resolve({} as any),\n}));\n\njest.mock('@sentry/react-native', () => ({\n captureException: () => {},\n}));\n\njest.mock('@react-native-community/netinfo', () => ({\n addEventListener: () => {},\n}));\n\njest.mock('react-native-bluetooth-state-manager', () => ({\n onStateChange: () => {},\n}));\n\ndescribe('getInvitationUrlTransports', () => {\n test('BLE OpenID4VP url', () => {\n const transports = getInvitationUrlTransports(\n 'OPENID4VP://connect?name=XFwsduA5&key=24c810cb01a8b12200bdb66dc5a7ac9b49a4cfdd5c4b89f51e03206be3abac5b',\n 'mdoc-openid4vp',\n );\n expect(transports).toStrictEqual([Transport.Bluetooth]);\n });\n test('MQTT OpenID4VP url', () => {\n const transports = getInvitationUrlTransports(\n 'OPENID4VP://connect?key=24c810cb01a8b12200bdb66dc5a7ac9b49a4cfdd5c4b89f51e03206be3abac5b&brokerUrl=mqtt://dev.procivis-one.com&topicId=540684a4-430c-441c-b188-786653f5ab35',\n 'mdoc-openid4vp',\n );\n expect(transports).toStrictEqual([Transport.MQTT]);\n });\n test('Mixed BLE/MQTT OpenID4VP url', () => {\n const transports = getInvitationUrlTransports(\n 'OPENID4VP://connect?name=XFwsduA5&key=24c810cb01a8b12200bdb66dc5a7ac9b49a4cfdd5c4b89f51e03206be3abac5b&brokerUrl=mqtt://dev.procivis-one.com&topicId=540684a4-430c-441c-b188-786653f5ab35',\n 'mdoc-openid4vp',\n );\n expect(transports).toStrictEqual([Transport.Bluetooth, Transport.MQTT]);\n });\n test('BLE OpenID4VP url with custom scheme', () => {\n const transports = getInvitationUrlTransports(\n 'MDOC-OPENID4VP://connect?name=XFwsduA5&key=24c810cb01a8b12200bdb66dc5a7ac9b49a4cfdd5c4b89f51e03206be3abac5b',\n 'mdoc-openid4vp',\n );\n expect(transports).toStrictEqual([Transport.Bluetooth]);\n });\n test('MQTT OpenID4VP url with custom scheme', () => {\n const transports = getInvitationUrlTransports(\n 'MDOC-OPENID4VP://connect?key=24c810cb01a8b12200bdb66dc5a7ac9b49a4cfdd5c4b89f51e03206be3abac5b&brokerUrl=mqtt://dev.procivis-one.com&topicId=540684a4-430c-441c-b188-786653f5ab35',\n 'mdoc-openid4vp',\n );\n expect(transports).toStrictEqual([Transport.MQTT]);\n });\n test('Mixed BLE/MQTT OpenID4VP url with custom scheme', () => {\n const transports = getInvitationUrlTransports(\n 'MDOC-OPENID4VP://connect?name=XFwsduA5&key=24c810cb01a8b12200bdb66dc5a7ac9b49a4cfdd5c4b89f51e03206be3abac5b&brokerUrl=mqtt://dev.procivis-one.com&topicId=540684a4-430c-441c-b188-786653f5ab35',\n 'mdoc-openid4vp',\n );\n expect(transports).toStrictEqual([Transport.Bluetooth, Transport.MQTT]);\n });\n test('HTTP OpenID4VP url', () => {\n const transports = getInvitationUrlTransports(\n 'openid4vp://?response_type=vp_token&state=25fdb134-487d-4bcd-9fdf-777e7f74f128&nonce=DZE2qP6FaDksHxkfOdYJC1LWgVyf5Ibc&client_id_scheme=redirect_uri&client_id=https%3A%2F%2Fcore.dev.procivis-one.com%2Fssi%2Foidc-verifier%2Fv1%2Fresponse&response_mode=direct_post&response_uri=https%3A%2F%2Fcore.dev.procivis-one.com%2Fssi%2Foidc-verifier%2Fv1%2Fresponse&client_metadata_uri=https%3A%2F%2Fcore.dev.procivis-one.com%2Fssi%2Foidc-verifier%2Fv1%2F89973de1-75ba-4367-89ef-4d928de88933%2Fclient-metadata&presentation_definition_uri=https%3A%2F%2Fcore.dev.procivis-one.com%2Fssi%2Foidc-verifier%2Fv1%2F89973de1-75ba-4367-89ef-4d928de88933%2Fpresentation-definition',\n 'mdoc-openid4vp',\n );\n expect(transports).toStrictEqual([Transport.HTTP]);\n });\n test('HTTP OpenID4VP url with custom scheme', () => {\n const transports = getInvitationUrlTransports(\n 'mdoc-openid4vp://?response_type=vp_token&state=25fdb134-487d-4bcd-9fdf-777e7f74f128&nonce=DZE2qP6FaDksHxkfOdYJC1LWgVyf5Ibc&client_id_scheme=redirect_uri&client_id=https%3A%2F%2Fcore.dev.procivis-one.com%2Fssi%2Foidc-verifier%2Fv1%2Fresponse&response_mode=direct_post&response_uri=https%3A%2F%2Fcore.dev.procivis-one.com%2Fssi%2Foidc-verifier%2Fv1%2Fresponse&client_metadata_uri=https%3A%2F%2Fcore.dev.procivis-one.com%2Fssi%2Foidc-verifier%2Fv1%2F89973de1-75ba-4367-89ef-4d928de88933%2Fclient-metadata&presentation_definition_uri=https%3A%2F%2Fcore.dev.procivis-one.com%2Fssi%2Foidc-verifier%2Fv1%2F89973de1-75ba-4367-89ef-4d928de88933%2Fpresentation-definition',\n 'mdoc-openid4vp',\n );\n expect(transports).toStrictEqual([Transport.HTTP]);\n });\n test('HTTP OpenID4VP url with requestUri', () => {\n const transports = getInvitationUrlTransports(\n 'openid4vp://?client_id=https%3A%2F%2Fcore.dev.procivis-one.com%2Fssi%2Foidc-verifier%2Fv1%2Fresponse&request_uri=https%3A%2F%2Fcore.dev.procivis-one.com%2Fssi%2Foidc-verifier%2Fv1%2F6e442f9d-bc14-4362-8786-504d7b79c402%2Fclient-request',\n 'mdoc-openid4vp',\n );\n expect(transports).toStrictEqual([Transport.HTTP]);\n });\n test('HTTP OpenID credential offer url', () => {\n const transports = getInvitationUrlTransports(\n 'openid-credential-offer://?credential_offer_uri=https%3A%2F%2Fcore.dev.procivis-one.com%2Fssi%2Foidc-issuer%2Fv1%2F0c2cd9a6-1eff-4536-9505-98d7bd87aad1%2Foffer%2F275c09b2-4f4f-4738-85fc-35399acad176',\n 'mdoc-openid4vp',\n );\n expect(transports).toStrictEqual([Transport.HTTP]);\n });\n\n test('Invalid link', () => {\n const transports = getInvitationUrlTransports('invalid');\n expect(transports).toStrictEqual([]);\n });\n});\n"],"mappings":";;AAAA,IAAAA,aAAA,GAAAC,OAAA;AAEAC,IAAI,CAACC,IAAI,CAAC,iCAAiC,EAAE,OAAO;EAClDC,cAAc,EAAEA,CAAA,KAAMC,OAAO,CAACC,OAAO,CAAC,CAAC,CAAQ;AACjD,CAAC,CAAC,CAAC;AAEHJ,IAAI,CAACC,IAAI,CAAC,sBAAsB,EAAE,OAAO;EACvCI,gBAAgB,EAAEA,CAAA,KAAM,CAAC;AAC3B,CAAC,CAAC,CAAC;AAEHL,IAAI,CAACC,IAAI,CAAC,iCAAiC,EAAE,OAAO;
|
|
1
|
+
{"version":3,"names":["_connectivity","require","jest","mock","initializeCore","Promise","resolve","captureException","getEnabledTransports","useCoreConfig","addEventListener","onStateChange","describe","test","transports","getInvitationUrlTransports","expect","toStrictEqual","Transport","Bluetooth","MQTT","HTTP"],"sources":["connectivity.test.ts"],"sourcesContent":["import { getInvitationUrlTransports, Transport } from './connectivity';\n\njest.mock('@procivis/react-native-one-core', () => ({\n initializeCore: () => Promise.resolve({} as any),\n}));\n\njest.mock('@sentry/react-native', () => ({\n captureException: () => {},\n}));\n\njest.mock('../core/core-config', () => ({\n getEnabledTransports: () => [],\n useCoreConfig: () => ({}),\n}));\n\njest.mock('@react-native-community/netinfo', () => ({\n addEventListener: () => { },\n}));\n\njest.mock('react-native-bluetooth-state-manager', () => ({\n onStateChange: () => { },\n}));\n\ndescribe('getInvitationUrlTransports', () => {\n test('BLE OpenID4VP url', () => {\n const transports = getInvitationUrlTransports(\n 'OPENID4VP://connect?name=XFwsduA5&key=24c810cb01a8b12200bdb66dc5a7ac9b49a4cfdd5c4b89f51e03206be3abac5b',\n 'mdoc-openid4vp',\n );\n expect(transports).toStrictEqual([Transport.Bluetooth]);\n });\n test('MQTT OpenID4VP url', () => {\n const transports = getInvitationUrlTransports(\n 'OPENID4VP://connect?key=24c810cb01a8b12200bdb66dc5a7ac9b49a4cfdd5c4b89f51e03206be3abac5b&brokerUrl=mqtt://dev.procivis-one.com&topicId=540684a4-430c-441c-b188-786653f5ab35',\n 'mdoc-openid4vp',\n );\n expect(transports).toStrictEqual([Transport.MQTT]);\n });\n test('Mixed BLE/MQTT OpenID4VP url', () => {\n const transports = getInvitationUrlTransports(\n 'OPENID4VP://connect?name=XFwsduA5&key=24c810cb01a8b12200bdb66dc5a7ac9b49a4cfdd5c4b89f51e03206be3abac5b&brokerUrl=mqtt://dev.procivis-one.com&topicId=540684a4-430c-441c-b188-786653f5ab35',\n 'mdoc-openid4vp',\n );\n expect(transports).toStrictEqual([Transport.Bluetooth, Transport.MQTT]);\n });\n test('BLE OpenID4VP url with custom scheme', () => {\n const transports = getInvitationUrlTransports(\n 'MDOC-OPENID4VP://connect?name=XFwsduA5&key=24c810cb01a8b12200bdb66dc5a7ac9b49a4cfdd5c4b89f51e03206be3abac5b',\n 'mdoc-openid4vp',\n );\n expect(transports).toStrictEqual([Transport.Bluetooth]);\n });\n test('MQTT OpenID4VP url with custom scheme', () => {\n const transports = getInvitationUrlTransports(\n 'MDOC-OPENID4VP://connect?key=24c810cb01a8b12200bdb66dc5a7ac9b49a4cfdd5c4b89f51e03206be3abac5b&brokerUrl=mqtt://dev.procivis-one.com&topicId=540684a4-430c-441c-b188-786653f5ab35',\n 'mdoc-openid4vp',\n );\n expect(transports).toStrictEqual([Transport.MQTT]);\n });\n test('Mixed BLE/MQTT OpenID4VP url with custom scheme', () => {\n const transports = getInvitationUrlTransports(\n 'MDOC-OPENID4VP://connect?name=XFwsduA5&key=24c810cb01a8b12200bdb66dc5a7ac9b49a4cfdd5c4b89f51e03206be3abac5b&brokerUrl=mqtt://dev.procivis-one.com&topicId=540684a4-430c-441c-b188-786653f5ab35',\n 'mdoc-openid4vp',\n );\n expect(transports).toStrictEqual([Transport.Bluetooth, Transport.MQTT]);\n });\n test('HTTP OpenID4VP url', () => {\n const transports = getInvitationUrlTransports(\n 'openid4vp://?response_type=vp_token&state=25fdb134-487d-4bcd-9fdf-777e7f74f128&nonce=DZE2qP6FaDksHxkfOdYJC1LWgVyf5Ibc&client_id_scheme=redirect_uri&client_id=https%3A%2F%2Fcore.dev.procivis-one.com%2Fssi%2Foidc-verifier%2Fv1%2Fresponse&response_mode=direct_post&response_uri=https%3A%2F%2Fcore.dev.procivis-one.com%2Fssi%2Foidc-verifier%2Fv1%2Fresponse&client_metadata_uri=https%3A%2F%2Fcore.dev.procivis-one.com%2Fssi%2Foidc-verifier%2Fv1%2F89973de1-75ba-4367-89ef-4d928de88933%2Fclient-metadata&presentation_definition_uri=https%3A%2F%2Fcore.dev.procivis-one.com%2Fssi%2Foidc-verifier%2Fv1%2F89973de1-75ba-4367-89ef-4d928de88933%2Fpresentation-definition',\n 'mdoc-openid4vp',\n );\n expect(transports).toStrictEqual([Transport.HTTP]);\n });\n test('HTTP OpenID4VP url with custom scheme', () => {\n const transports = getInvitationUrlTransports(\n 'mdoc-openid4vp://?response_type=vp_token&state=25fdb134-487d-4bcd-9fdf-777e7f74f128&nonce=DZE2qP6FaDksHxkfOdYJC1LWgVyf5Ibc&client_id_scheme=redirect_uri&client_id=https%3A%2F%2Fcore.dev.procivis-one.com%2Fssi%2Foidc-verifier%2Fv1%2Fresponse&response_mode=direct_post&response_uri=https%3A%2F%2Fcore.dev.procivis-one.com%2Fssi%2Foidc-verifier%2Fv1%2Fresponse&client_metadata_uri=https%3A%2F%2Fcore.dev.procivis-one.com%2Fssi%2Foidc-verifier%2Fv1%2F89973de1-75ba-4367-89ef-4d928de88933%2Fclient-metadata&presentation_definition_uri=https%3A%2F%2Fcore.dev.procivis-one.com%2Fssi%2Foidc-verifier%2Fv1%2F89973de1-75ba-4367-89ef-4d928de88933%2Fpresentation-definition',\n 'mdoc-openid4vp',\n );\n expect(transports).toStrictEqual([Transport.HTTP]);\n });\n test('HTTP OpenID4VP url with requestUri', () => {\n const transports = getInvitationUrlTransports(\n 'openid4vp://?client_id=https%3A%2F%2Fcore.dev.procivis-one.com%2Fssi%2Foidc-verifier%2Fv1%2Fresponse&request_uri=https%3A%2F%2Fcore.dev.procivis-one.com%2Fssi%2Foidc-verifier%2Fv1%2F6e442f9d-bc14-4362-8786-504d7b79c402%2Fclient-request',\n 'mdoc-openid4vp',\n );\n expect(transports).toStrictEqual([Transport.HTTP]);\n });\n test('HTTP OpenID credential offer url', () => {\n const transports = getInvitationUrlTransports(\n 'openid-credential-offer://?credential_offer_uri=https%3A%2F%2Fcore.dev.procivis-one.com%2Fssi%2Foidc-issuer%2Fv1%2F0c2cd9a6-1eff-4536-9505-98d7bd87aad1%2Foffer%2F275c09b2-4f4f-4738-85fc-35399acad176',\n 'mdoc-openid4vp',\n );\n expect(transports).toStrictEqual([Transport.HTTP]);\n });\n\n test('Invalid link', () => {\n const transports = getInvitationUrlTransports('invalid');\n expect(transports).toStrictEqual([]);\n });\n});\n"],"mappings":";;AAAA,IAAAA,aAAA,GAAAC,OAAA;AAEAC,IAAI,CAACC,IAAI,CAAC,iCAAiC,EAAE,OAAO;EAClDC,cAAc,EAAEA,CAAA,KAAMC,OAAO,CAACC,OAAO,CAAC,CAAC,CAAQ;AACjD,CAAC,CAAC,CAAC;AAEHJ,IAAI,CAACC,IAAI,CAAC,sBAAsB,EAAE,OAAO;EACvCI,gBAAgB,EAAEA,CAAA,KAAM,CAAC;AAC3B,CAAC,CAAC,CAAC;AAEHL,IAAI,CAACC,IAAI,CAAC,qBAAqB,EAAE,OAAO;EACtCK,oBAAoB,EAAEA,CAAA,KAAM,EAAE;EAC9BC,aAAa,EAAEA,CAAA,MAAO,CAAC,CAAC;AAC1B,CAAC,CAAC,CAAC;AAEHP,IAA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AAI,CAAC,CAAC;EACpD,CAAC,CAAC;EAEFR,IAAI,CAAC,cAAc,EAAE,MAAM;IACzB,MAAMC,UAAU,GAAG,IAAAC,wCAA0B,EAAC,SAAS,CAAC;IACxDC,MAAM,CAACF,UAAU,CAAC,CAACG,aAAa,CAAC,EAAE,CAAC;EACtC,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
|
|
@@ -7,10 +7,9 @@ exports.useUnpackBackup = exports.useRollbackImport = exports.useFinalizeImport
|
|
|
7
7
|
var _reactNativeOneCore = require("@procivis/react-native-one-core");
|
|
8
8
|
var _react = require("react");
|
|
9
9
|
var _reactQuery = require("react-query");
|
|
10
|
-
var
|
|
10
|
+
var _reporting = require("../../reporting");
|
|
11
11
|
var _coreContext = require("./core-context");
|
|
12
12
|
var _coreInit = require("./core-init");
|
|
13
|
-
var _errorCode = require("./error-code");
|
|
14
13
|
var _history = require("./history");
|
|
15
14
|
const BACKUP_INFO_QUERY_KEY = 'backup-info';
|
|
16
15
|
const useBackupInfo = () => {
|
|
@@ -67,6 +66,12 @@ const useRollbackImport = () => {
|
|
|
67
66
|
onSuccess: () => queryClient.resetQueries()
|
|
68
67
|
});
|
|
69
68
|
};
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Finalize backup import and extract/prepare identifiers
|
|
72
|
+
* @param {IdentifiersInitializationConfig} config Select desired keys/dids to be restored/created
|
|
73
|
+
* @returns [hwIdentifierId, swIdentifierId]
|
|
74
|
+
*/
|
|
70
75
|
exports.useRollbackImport = useRollbackImport;
|
|
71
76
|
const useBackupFinalizeImportProcedure = ({
|
|
72
77
|
generateHwKey,
|
|
@@ -80,75 +85,26 @@ const useBackupFinalizeImportProcedure = ({
|
|
|
80
85
|
organisationId
|
|
81
86
|
} = (0, _coreContext.useONECore)();
|
|
82
87
|
return (0, _react.useCallback)(async () => {
|
|
83
|
-
var _dids$values$find;
|
|
84
88
|
await finalizeImport();
|
|
85
89
|
|
|
86
|
-
// update wallet
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
type: _reactNativeOneCore.DidTypeEnum.LOCAL
|
|
93
|
-
});
|
|
94
|
-
let swDidId = (_dids$values$find = dids.values.find(did => did.name.startsWith(_coreInit.SW_DID_NAME_PREFIX))) === null || _dids$values$find === void 0 ? void 0 : _dids$values$find.id;
|
|
95
|
-
if (!swDidId && generateSwKey) {
|
|
96
|
-
const swKeyId = await core.generateKey({
|
|
97
|
-
keyParams: {},
|
|
98
|
-
keyType: 'EDDSA',
|
|
99
|
-
name: `holder-key-sw-${(0, _uuid.generateUUID)()}`,
|
|
100
|
-
organisationId,
|
|
101
|
-
storageParams: {},
|
|
102
|
-
storageType: 'INTERNAL'
|
|
103
|
-
});
|
|
104
|
-
swDidId = await core.createDid({
|
|
105
|
-
didMethod: 'KEY',
|
|
106
|
-
keys: {
|
|
107
|
-
assertionMethod: [swKeyId],
|
|
108
|
-
authentication: [swKeyId],
|
|
109
|
-
capabilityDelegation: [swKeyId],
|
|
110
|
-
capabilityInvocation: [swKeyId],
|
|
111
|
-
keyAgreement: [swKeyId]
|
|
112
|
-
},
|
|
113
|
-
name: `${_coreInit.SW_DID_NAME_PREFIX}-${(0, _uuid.generateUUID)()}`,
|
|
90
|
+
// update wallet identifier references
|
|
91
|
+
let swIdentifierId;
|
|
92
|
+
if (generateSwKey) {
|
|
93
|
+
var _identifiers$values$f;
|
|
94
|
+
const identifiers = await core.getIdentifiers({
|
|
95
|
+
state: _reactNativeOneCore.IdentifierStateEnum.ACTIVE,
|
|
114
96
|
organisationId,
|
|
115
|
-
|
|
97
|
+
page: 0,
|
|
98
|
+
pageSize: 1,
|
|
99
|
+
types: [_reactNativeOneCore.IdentifierTypeEnum.DID],
|
|
100
|
+
isRemote: false
|
|
116
101
|
});
|
|
102
|
+
swIdentifierId = (_identifiers$values$f = identifiers.values.find(identifier => identifier.name.startsWith(_coreInit.SW_DID_NAME_PREFIX))) === null || _identifiers$values$f === void 0 ? void 0 : _identifiers$values$f.id;
|
|
117
103
|
}
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
keyType: 'ECDSA',
|
|
123
|
-
name: `holder-key-hw-${(0, _uuid.generateUUID)()}`,
|
|
124
|
-
organisationId,
|
|
125
|
-
storageParams: {},
|
|
126
|
-
storageType: 'SECURE_ELEMENT'
|
|
127
|
-
}).catch(e => {
|
|
128
|
-
// ignore if HW keys not supported by device
|
|
129
|
-
if (e instanceof _reactNativeOneCore.OneError && e.code === _errorCode.OneErrorCode.KeyStorageNotSupported) {
|
|
130
|
-
return null;
|
|
131
|
-
}
|
|
132
|
-
throw e;
|
|
133
|
-
});
|
|
134
|
-
}
|
|
135
|
-
let hwDidId = null;
|
|
136
|
-
if (hwKeyId) {
|
|
137
|
-
hwDidId = await core.createDid({
|
|
138
|
-
didMethod: 'KEY',
|
|
139
|
-
keys: {
|
|
140
|
-
assertionMethod: [hwKeyId],
|
|
141
|
-
authentication: [hwKeyId],
|
|
142
|
-
capabilityDelegation: [hwKeyId],
|
|
143
|
-
capabilityInvocation: [hwKeyId],
|
|
144
|
-
keyAgreement: [hwKeyId]
|
|
145
|
-
},
|
|
146
|
-
name: `${_coreInit.HW_DID_NAME_PREFIX}-${(0, _uuid.generateUUID)()}`,
|
|
147
|
-
organisationId,
|
|
148
|
-
params: {}
|
|
149
|
-
});
|
|
150
|
-
}
|
|
151
|
-
return [hwDidId, swDidId];
|
|
104
|
+
return Promise.all([generateHwKey ? (0, _coreInit.generateHwIdentifier)(core, organisationId) : null, !swIdentifierId && generateSwKey ? (0, _coreInit.generateSwIdentifier)(core, organisationId) : swIdentifierId]).catch(err => {
|
|
105
|
+
(0, _reporting.reportException)(err, 'Failed to create base identifiers');
|
|
106
|
+
throw err;
|
|
107
|
+
});
|
|
152
108
|
}, [core, organisationId, finalizeImport, generateHwKey, generateSwKey]);
|
|
153
109
|
};
|
|
154
110
|
exports.useBackupFinalizeImportProcedure = useBackupFinalizeImportProcedure;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_reactNativeOneCore","require","_react","_reactQuery","
|
|
1
|
+
{"version":3,"names":["_reactNativeOneCore","require","_react","_reactQuery","_reporting","_coreContext","_coreInit","_history","BACKUP_INFO_QUERY_KEY","useBackupInfo","core","useONECore","useQuery","backupInfo","keepPreviousData","exports","useCreateBackup","queryClient","useQueryClient","useMutation","password","outputPath","createBackup","onSuccess","invalidateQueries","HISTORY_LIST_QUERY_KEY","useUnpackBackup","inputPath","unpackBackup","resetQueries","useFinalizeImport","finalizeImport","useRollbackImport","rollbackImport","useBackupFinalizeImportProcedure","generateHwKey","generateSwKey","mutateAsync","organisationId","useCallback","swIdentifierId","_identifiers$values$f","identifiers","getIdentifiers","state","IdentifierStateEnum","ACTIVE","page","pageSize","types","IdentifierTypeEnum","DID","isRemote","values","find","identifier","name","startsWith","SW_DID_NAME_PREFIX","id","Promise","all","generateHwIdentifier","generateSwIdentifier","catch","err","reportException"],"sources":["backup.ts"],"sourcesContent":["import { IdentifierStateEnum, IdentifierTypeEnum } from '@procivis/react-native-one-core';\nimport { useCallback } from 'react';\nimport { useMutation, useQuery, useQueryClient } from 'react-query';\n\nimport { reportException } from '../../reporting';\nimport { useONECore } from './core-context';\nimport {\n generateHwIdentifier,\n generateSwIdentifier,\n IdentifiersInitializationConfig,\n SW_DID_NAME_PREFIX,\n} from './core-init';\nimport { HISTORY_LIST_QUERY_KEY } from './history';\n\nconst BACKUP_INFO_QUERY_KEY = 'backup-info';\n\nexport const useBackupInfo = () => {\n const { core } = useONECore();\n\n return useQuery([BACKUP_INFO_QUERY_KEY], () => core.backupInfo(), {\n keepPreviousData: true,\n });\n};\n\nexport const useCreateBackup = () => {\n const queryClient = useQueryClient();\n const { core } = useONECore();\n\n return useMutation(\n async ({ password, outputPath }: { outputPath: string; password: string }) =>\n core.createBackup(password, outputPath),\n {\n onSuccess: () => queryClient.invalidateQueries(HISTORY_LIST_QUERY_KEY),\n },\n );\n};\n\nexport const useUnpackBackup = () => {\n const queryClient = useQueryClient();\n const { core } = useONECore();\n\n return useMutation(\n async ({ password, inputPath }: { inputPath: string; password: string }) => core.unpackBackup(password, inputPath),\n {\n onSuccess: () => queryClient.resetQueries(),\n },\n );\n};\n\nexport const useFinalizeImport = () => {\n const queryClient = useQueryClient();\n const { core } = useONECore();\n\n return useMutation(async () => core.finalizeImport(), {\n onSuccess: () => queryClient.resetQueries(),\n });\n};\n\nexport const useRollbackImport = () => {\n const queryClient = useQueryClient();\n const { core } = useONECore();\n\n return useMutation(async () => core.rollbackImport(), {\n onSuccess: () => queryClient.resetQueries(),\n });\n};\n\n/**\n * Finalize backup import and extract/prepare identifiers\n * @param {IdentifiersInitializationConfig} config Select desired keys/dids to be restored/created\n * @returns [hwIdentifierId, swIdentifierId]\n */\nexport const useBackupFinalizeImportProcedure = ({ generateHwKey, generateSwKey }: IdentifiersInitializationConfig) => {\n const { mutateAsync: finalizeImport } = useFinalizeImport();\n const { core, organisationId } = useONECore();\n\n return useCallback(async () => {\n await finalizeImport();\n\n // update wallet identifier references\n let swIdentifierId: string | undefined;\n if (generateSwKey) {\n const identifiers = await core.getIdentifiers({\n state: IdentifierStateEnum.ACTIVE,\n organisationId,\n page: 0,\n pageSize: 1,\n types: [IdentifierTypeEnum.DID],\n isRemote: false,\n });\n swIdentifierId = identifiers.values.find((identifier) => identifier.name.startsWith(SW_DID_NAME_PREFIX))?.id;\n }\n\n return Promise.all([\n generateHwKey ? generateHwIdentifier(core, organisationId) : null,\n !swIdentifierId && generateSwKey ? generateSwIdentifier(core, organisationId) : swIdentifierId,\n ]).catch((err) => {\n reportException(err, 'Failed to create base identifiers');\n throw err;\n });\n }, [core, organisationId, finalizeImport, generateHwKey, generateSwKey]);\n};\n"],"mappings":";;;;;;AAAA,IAAAA,mBAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AAEA,IAA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AI,CAACiC,cAAc,CAAC;QAC5CC,KAAK,EAAEC,uCAAmB,CAACC,MAAM;QACjCR,cAAc;QACdS,IAAI,EAAE,CAAC;QACPC,QAAQ,EAAE,CAAC;QACXC,KAAK,EAAE,CAACC,sCAAkB,CAACC,GAAG,CAAC;QAC/BC,QAAQ,EAAE;MACZ,CAAC,CAAC;MACFZ,cAAc,IAAAC,qBAAA,GAAGC,WAAW,CAACW,MAAM,CAACC,IAAI,CAAEC,UAAU,IAAKA,UAAU,CAACC,IAAI,CAACC,UAAU,CAACC,4BAAkB,CAAC,CAAC,cAAAjB,qBAAA,uBAAvFA,qBAAA,CAAyFkB,EAAE;IAC9G;IAEA,OAAOC,OAAO,CAACC,GAAG,CAAC,CACjB1B,aAAa,GAAG,IAAA2B,8BAAoB,EAACpD,IAAI,EAAE4B,cAAc,CAAC,GAAG,IAAI,EACjE,CAACE,cAAc,IAAIJ,aAAa,GAAG,IAAA2B,8BAAoB,EAACrD,IAAI,EAAE4B,cAAc,CAAC,GAAGE,cAAc,CAC/F,CAAC,CAACwB,KAAK,CAAEC,GAAG,IAAK;MAChB,IAAAC,0BAAe,EAACD,GAAG,EAAE,mCAAmC,CAAC;MACzD,MAAMA,GAAG;IACX,CAAC,CAAC;EACJ,CAAC,EAAE,CAACvD,IAAI,EAAE4B,cAAc,EAAEP,cAAc,EAAEI,aAAa,EAAEC,aAAa,CAAC,CAAC;AAC1E,CAAC;AAACrB,OAAA,CAAAmB,gCAAA,GAAAA,gCAAA","ignoreList":[]}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.useInitializeONECoreIdentifiers = exports.SW_DID_NAME_PREFIX = exports.HW_DID_NAME_PREFIX = void 0;
|
|
6
|
+
exports.useInitializeONECoreIdentifiers = exports.generateSwIdentifier = exports.generateHwIdentifier = exports.SW_DID_NAME_PREFIX = exports.HW_DID_NAME_PREFIX = void 0;
|
|
7
7
|
var _reactNativeOneCore = require("@procivis/react-native-one-core");
|
|
8
8
|
var _react = require("react");
|
|
9
9
|
var _reporting = require("../../reporting");
|
|
@@ -30,6 +30,7 @@ const generateHwIdentifier = async (core, organisationId) => {
|
|
|
30
30
|
return core.createIdentifier({
|
|
31
31
|
did: {
|
|
32
32
|
method: 'KEY',
|
|
33
|
+
name: HW_DID_NAME_PREFIX,
|
|
33
34
|
keys: {
|
|
34
35
|
assertionMethod: [hwKeyId],
|
|
35
36
|
authentication: [hwKeyId],
|
|
@@ -45,6 +46,7 @@ const generateHwIdentifier = async (core, organisationId) => {
|
|
|
45
46
|
}
|
|
46
47
|
return null;
|
|
47
48
|
};
|
|
49
|
+
exports.generateHwIdentifier = generateHwIdentifier;
|
|
48
50
|
const generateSwIdentifier = async (core, organisationId) => {
|
|
49
51
|
const swKeyId = await core.generateKey({
|
|
50
52
|
keyParams: {},
|
|
@@ -57,6 +59,7 @@ const generateSwIdentifier = async (core, organisationId) => {
|
|
|
57
59
|
return core.createIdentifier({
|
|
58
60
|
did: {
|
|
59
61
|
method: 'KEY',
|
|
62
|
+
name: SW_DID_NAME_PREFIX,
|
|
60
63
|
keys: {
|
|
61
64
|
assertionMethod: [swKeyId],
|
|
62
65
|
authentication: [swKeyId],
|
|
@@ -70,10 +73,11 @@ const generateSwIdentifier = async (core, organisationId) => {
|
|
|
70
73
|
organisationId
|
|
71
74
|
});
|
|
72
75
|
};
|
|
76
|
+
exports.generateSwIdentifier = generateSwIdentifier;
|
|
73
77
|
/**
|
|
74
78
|
* Create base local identifiers
|
|
75
79
|
* @param {IdentifiersInitializationConfig} config Select desired keys/dids to be created
|
|
76
|
-
* @returns [
|
|
80
|
+
* @returns [hwIdentifierId, swIdentifierId]
|
|
77
81
|
*/
|
|
78
82
|
const useInitializeONECoreIdentifiers = ({
|
|
79
83
|
generateHwKey,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_reactNativeOneCore","require","_react","_reporting","_coreContext","_errorCode","SW_DID_NAME_PREFIX","exports","HW_DID_NAME_PREFIX","generateHwIdentifier","core","organisationId","hwKeyId","generateKey","keyParams","keyType","name","storageParams","storageType","catch","e","OneError","code","OneErrorCode","KeyStorageNotSupported","createIdentifier","did","method","keys","assertionMethod","authentication","capabilityDelegation","capabilityInvocation","keyAgreement","params","generateSwIdentifier","swKeyId","useInitializeONECoreIdentifiers","generateHwKey","generateSwKey","useONECore","useCallback","createOrganisation","id","OrganisationAlreadyExists","then","Promise","all","err","reportException"],"sources":["core-init.ts"],"sourcesContent":["import { ONECore, OneError } from '@procivis/react-native-one-core';\nimport { useCallback } from 'react';\n\nimport { reportException } from '../../reporting';\nimport { useONECore } from './core-context';\nimport { OneErrorCode } from './error-code';\n\nexport const SW_DID_NAME_PREFIX = 'holder-did-sw-key';\nexport const HW_DID_NAME_PREFIX = 'holder-did-hw-key';\n\
|
|
1
|
+
{"version":3,"names":["_reactNativeOneCore","require","_react","_reporting","_coreContext","_errorCode","SW_DID_NAME_PREFIX","exports","HW_DID_NAME_PREFIX","generateHwIdentifier","core","organisationId","hwKeyId","generateKey","keyParams","keyType","name","storageParams","storageType","catch","e","OneError","code","OneErrorCode","KeyStorageNotSupported","createIdentifier","did","method","keys","assertionMethod","authentication","capabilityDelegation","capabilityInvocation","keyAgreement","params","generateSwIdentifier","swKeyId","useInitializeONECoreIdentifiers","generateHwKey","generateSwKey","useONECore","useCallback","createOrganisation","id","OrganisationAlreadyExists","then","Promise","all","err","reportException"],"sources":["core-init.ts"],"sourcesContent":["import { ONECore, OneError } from '@procivis/react-native-one-core';\nimport { useCallback } from 'react';\n\nimport { reportException } from '../../reporting';\nimport { useONECore } from './core-context';\nimport { OneErrorCode } from './error-code';\n\nexport const SW_DID_NAME_PREFIX = 'holder-did-sw-key';\nexport const HW_DID_NAME_PREFIX = 'holder-did-hw-key';\n\nexport const generateHwIdentifier = async (core: ONECore, organisationId: string) => {\n const hwKeyId = await core\n .generateKey({\n keyParams: {},\n keyType: 'ECDSA',\n name: 'holder-key-hw',\n organisationId,\n storageParams: {},\n storageType: 'SECURE_ELEMENT',\n })\n .catch((e) => {\n // ignore if HW keys not supported by device\n if (e instanceof OneError && e.code === OneErrorCode.KeyStorageNotSupported) {\n return null;\n }\n throw e;\n });\n\n if (hwKeyId) {\n return core.createIdentifier({\n did: {\n method: 'KEY',\n name: HW_DID_NAME_PREFIX,\n keys: {\n assertionMethod: [hwKeyId],\n authentication: [hwKeyId],\n capabilityDelegation: [hwKeyId],\n capabilityInvocation: [hwKeyId],\n keyAgreement: [hwKeyId],\n },\n params: {},\n },\n name: HW_DID_NAME_PREFIX,\n organisationId,\n });\n }\n\n return null;\n};\n\nexport const generateSwIdentifier = async (core: ONECore, organisationId: string) => {\n const swKeyId = await core.generateKey({\n keyParams: {},\n keyType: 'ECDSA',\n name: 'holder-key-sw',\n organisationId,\n storageParams: {},\n storageType: 'INTERNAL',\n });\n\n return core.createIdentifier({\n did: {\n method: 'KEY',\n name: SW_DID_NAME_PREFIX,\n keys: {\n assertionMethod: [swKeyId],\n authentication: [swKeyId],\n capabilityDelegation: [swKeyId],\n capabilityInvocation: [swKeyId],\n keyAgreement: [swKeyId],\n },\n params: {},\n },\n name: SW_DID_NAME_PREFIX,\n organisationId,\n });\n};\n\nexport interface IdentifiersInitializationConfig {\n generateHwKey: boolean;\n generateSwKey: boolean;\n}\n\n/**\n * Create base local identifiers\n * @param {IdentifiersInitializationConfig} config Select desired keys/dids to be created\n * @returns [hwIdentifierId, swIdentifierId]\n */\nexport const useInitializeONECoreIdentifiers = ({ generateHwKey, generateSwKey }: IdentifiersInitializationConfig) => {\n const { core, organisationId } = useONECore();\n\n return useCallback(async () => {\n return await core\n .createOrganisation({ id: organisationId })\n .catch((e) => {\n if (e instanceof OneError && e.code === OneErrorCode.OrganisationAlreadyExists) {\n return;\n }\n throw e;\n })\n .then(() =>\n Promise.all([\n generateHwKey ? generateHwIdentifier(core, organisationId) : null,\n generateSwKey ? generateSwIdentifier(core, organisationId) : null,\n ]),\n )\n .catch((err) => {\n reportException(err, 'Failed to create base identifiers');\n throw err;\n });\n }, [core, organisationId, generateHwKey, generateSwKey]);\n};\n"],"mappings":";;;;;;AAAA,IAAAA,mBAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AAEA,IAAAE,UAAA,GAAAF,OAAA;AACA,IAAAG,YAAA,GAAAH,OAAA;AACA,IAAAI,UAAA,GAAAJ,OAAA;AAEO,MAAMK,kBAAkB,GAAAC,OAAA,CAAAD,kBAAA,GAAG,mBAAmB;AAC9C,MAAME,kBAAkB,GAAAD,OAAA,CAAAC,kBAAA,GAAG,mBAAmB;AAE9C,MAAMC,oBAAoB,GAAG,MAAAA,CAAOC,IAAa,EAAEC,cAAsB,KAAK;EACnF,MAAMC,OAAO,GAAG,MAAMF,IAAI,CACvBG,WAAW,CAAC;IACXC,SAAS,EAAE,CAAC,CAAC;IACbC,OAAO,EAAE,OAAO;IAChBC,IAAI,EAAE,eAAe;IACrBL,cAAc;IACdM,aAAa,EAAE,CAAC,CAAC;IACjBC,WAAW,EAAE;EACf,CAAC,CAAC,CACDC,KAAK,CAAEC,CAAC,IAAK;IACZ;IACA,IAAIA,CAAC,YAAYC,4BAAQ,IAAID,CAAC,CAACE,IAAI,KAAKC,uBAAY,CAACC,sBAAsB,EAAE;MAC3E,OAAO,IAAI;IACb;IACA,MAAMJ,CAAC;EACT,CAAC,CAAC;EAEJ,IAAIR,OAAO,EAAE;IACX,OAAOF,IAAI,CAACe,gBAAgB,CAAC;MAC3BC,GAAG,EAAE;QACHC,MAAM,EAAE,KAAK;QACbX,IAAI,EAAER,kBAAkB;QACxBoB,IAAI,EAAE;UACJC,eAAe,EAAE,CAACjB,OAAO,CAAC;UAC1BkB,cAAc,EAAE,CAAClB,OAAO,CAAC;UACzBmB,oBAAoB,EAAE,CAACnB,OAAO,CAAC;UAC/BoB,oBAAoB,EAAE,CAACpB,OAAO,CAAC;UAC/BqB,YAAY,EAA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EAAE,EAAEhC;IAAe,CAAC,CAAC,CAC1CQ,KAAK,CAAEC,CAAC,IAAK;MACZ,IAAIA,CAAC,YAAYC,4BAAQ,IAAID,CAAC,CAACE,IAAI,KAAKC,uBAAY,CAACqB,yBAAyB,EAAE;QAC9E;MACF;MACA,MAAMxB,CAAC;IACT,CAAC,CAAC,CACDyB,IAAI,CAAC,MACJC,OAAO,CAACC,GAAG,CAAC,CACVT,aAAa,GAAG7B,oBAAoB,CAACC,IAAI,EAAEC,cAAc,CAAC,GAAG,IAAI,EACjE4B,aAAa,GAAGJ,oBAAoB,CAACzB,IAAI,EAAEC,cAAc,CAAC,GAAG,IAAI,CAClE,CACH,CAAC,CACAQ,KAAK,CAAE6B,GAAG,IAAK;MACd,IAAAC,0BAAe,EAACD,GAAG,EAAE,mCAAmC,CAAC;MACzD,MAAMA,GAAG;IACX,CAAC,CAAC;EACN,CAAC,EAAE,CAACtC,IAAI,EAAEC,cAAc,EAAE2B,aAAa,EAAEC,aAAa,CAAC,CAAC;AAC1D,CAAC;AAAChC,OAAA,CAAA8B,+BAAA,GAAAA,+BAAA","ignoreList":[]}
|
|
@@ -3,10 +3,14 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.useIdentifierDetails = exports.IDENTIFIER_DETAIL_QUERY_KEY = void 0;
|
|
6
|
+
exports.useIdentifiers = exports.useIdentifierDetails = exports.IDENTIFIER_LIST_QUERY_KEY = exports.IDENTIFIER_DETAIL_QUERY_KEY = void 0;
|
|
7
|
+
var _reactNativeOneCore = require("@procivis/react-native-one-core");
|
|
7
8
|
var _reactQuery = require("react-query");
|
|
9
|
+
var _parsers = require("../../parsers");
|
|
8
10
|
var _coreContext = require("./core-context");
|
|
9
11
|
const IDENTIFIER_DETAIL_QUERY_KEY = exports.IDENTIFIER_DETAIL_QUERY_KEY = 'identifier-detail';
|
|
12
|
+
const IDENTIFIER_LIST_QUERY_KEY = exports.IDENTIFIER_LIST_QUERY_KEY = 'identifier-list';
|
|
13
|
+
const PAGE_SIZE = 20;
|
|
10
14
|
const useIdentifierDetails = identifierId => {
|
|
11
15
|
const {
|
|
12
16
|
core
|
|
@@ -17,4 +21,22 @@ const useIdentifierDetails = identifierId => {
|
|
|
17
21
|
});
|
|
18
22
|
};
|
|
19
23
|
exports.useIdentifierDetails = useIdentifierDetails;
|
|
24
|
+
const useIdentifiers = identifierFilter => {
|
|
25
|
+
const {
|
|
26
|
+
core,
|
|
27
|
+
organisationId
|
|
28
|
+
} = (0, _coreContext.useONECore)();
|
|
29
|
+
return (0, _reactQuery.useQuery)([IDENTIFIER_LIST_QUERY_KEY, ...(0, _parsers.getQueryKeyFromIdentifierListQueryParams)(identifierFilter)], ({
|
|
30
|
+
pageParam = 0
|
|
31
|
+
}) => core.getIdentifiers({
|
|
32
|
+
types: [_reactNativeOneCore.IdentifierTypeEnum.DID],
|
|
33
|
+
isRemote: false,
|
|
34
|
+
page: pageParam,
|
|
35
|
+
state: _reactNativeOneCore.IdentifierStateEnum.ACTIVE,
|
|
36
|
+
organisationId: organisationId,
|
|
37
|
+
pageSize: PAGE_SIZE,
|
|
38
|
+
...identifierFilter
|
|
39
|
+
}));
|
|
40
|
+
};
|
|
41
|
+
exports.useIdentifiers = useIdentifiers;
|
|
20
42
|
//# sourceMappingURL=identifiers.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["_reactNativeOneCore","require","_reactQuery","_parsers","_coreContext","IDENTIFIER_DETAIL_QUERY_KEY","exports","IDENTIFIER_LIST_QUERY_KEY","PAGE_SIZE","useIdentifierDetails","identifierId","core","useONECore","useQuery","getIdentifier","undefined","enabled","Boolean","keepPreviousData","useIdentifiers","identifierFilter","organisationId","getQueryKeyFromIdentifierListQueryParams","pageParam","getIdentifiers","types","IdentifierTypeEnum","DID","isRemote","page","state","IdentifierStateEnum","ACTIVE","pageSize"],"sources":["identifiers.ts"],"sourcesContent":["import { IdentifierListQuery, IdentifierStateEnum, IdentifierTypeEnum } from \"@procivis/react-native-one-core\";\nimport { useQuery } from \"react-query\";\n\nimport { getQueryKeyFromIdentifierListQueryParams } from \"../../parsers\";\nimport { useONECore } from \"./core-context\";\n\nexport const IDENTIFIER_DETAIL_QUERY_KEY = 'identifier-detail';\nexport const IDENTIFIER_LIST_QUERY_KEY = 'identifier-list';\nconst PAGE_SIZE = 20;\n\nexport const useIdentifierDetails = (identifierId: string | undefined) => {\n const { core } = useONECore();\n\n return useQuery(\n [IDENTIFIER_DETAIL_QUERY_KEY, identifierId],\n () => (identifierId ? core.getIdentifier(identifierId) : undefined),\n {\n enabled: Boolean(identifierId),\n keepPreviousData: true,\n },\n );\n}\n\nexport const useIdentifiers = (identifierFilter?: Partial<IdentifierListQuery>) => {\n const { core, organisationId } = useONECore();\n\n return useQuery(\n [IDENTIFIER_LIST_QUERY_KEY, ...getQueryKeyFromIdentifierListQueryParams(identifierFilter)],\n ({ pageParam = 0 }) => (core.getIdentifiers({\n types: [IdentifierTypeEnum.DID],\n isRemote: false,\n page: pageParam,\n state: IdentifierStateEnum.ACTIVE,\n organisationId: organisationId,\n pageSize: PAGE_SIZE,\n ...identifierFilter,\n })),\n );\n};\n"],"mappings":";;;;;;AAAA,IAAAA,mBAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AAEA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,YAAA,GAAAH,OAAA;AAEO,MAAMI,2BAA2B,GAAAC,OAAA,CAAAD,2BAAA,GAAG,mBAAmB;AACvD,MAAME,yBAAyB,GAAAD,OAAA,CAAAC,yBAAA,GAAG,iBAAiB;AAC1D,MAAMC,SAAS,GAAG,EAAE;AAEb,MAAMC,oBAAoB,GAAIC,YAAgC,IAAK;EACxE,MAAM;IAAEC;EAAK,CAAC,GAAG,IAAAC,uBAAU,EAAC,CAAC;EAE7B,OAAO,IAAAC,oBAAQ,EACb,CAACR,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