@oxy.so/services 6.0.0 → 6.1.0

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 (125) hide show
  1. package/README.md +1 -1
  2. package/lib/commonjs/index.js +32 -0
  3. package/lib/commonjs/index.js.map +1 -1
  4. package/lib/commonjs/ui/components/OxyAuthChooser.js +1 -2
  5. package/lib/commonjs/ui/components/OxyAuthChooser.js.map +1 -1
  6. package/lib/commonjs/ui/components/authChooser/AccountsMenuView.js +1 -8
  7. package/lib/commonjs/ui/components/authChooser/AccountsMenuView.js.map +1 -1
  8. package/lib/commonjs/ui/components/authChooser/types.js.map +1 -1
  9. package/lib/commonjs/ui/components/signIn/OxyCreateAccountPanel.js +236 -0
  10. package/lib/commonjs/ui/components/signIn/OxyCreateAccountPanel.js.map +1 -0
  11. package/lib/commonjs/ui/components/signIn/OxyDeleteAccountPanel.js +114 -0
  12. package/lib/commonjs/ui/components/signIn/OxyDeleteAccountPanel.js.map +1 -0
  13. package/lib/commonjs/ui/components/signIn/OxyLinkCommonsPanel.js +275 -0
  14. package/lib/commonjs/ui/components/signIn/OxyLinkCommonsPanel.js.map +1 -0
  15. package/lib/commonjs/ui/components/signIn/OxyRecoverAccountPanel.js +170 -0
  16. package/lib/commonjs/ui/components/signIn/OxyRecoverAccountPanel.js.map +1 -0
  17. package/lib/commonjs/ui/components/signIn/accountFlowParts.js +244 -0
  18. package/lib/commonjs/ui/components/signIn/accountFlowParts.js.map +1 -0
  19. package/lib/commonjs/ui/context/OxyContext.js.map +1 -1
  20. package/lib/commonjs/ui/context/passkeyFlow.js +22 -0
  21. package/lib/commonjs/ui/context/passkeyFlow.js.map +1 -1
  22. package/lib/commonjs/ui/screens/EditProfileFieldScreen.js +0 -23
  23. package/lib/commonjs/ui/screens/EditProfileFieldScreen.js.map +1 -1
  24. package/lib/commonjs/ui/screens/EditProfileScreen.js +0 -8
  25. package/lib/commonjs/ui/screens/EditProfileScreen.js.map +1 -1
  26. package/lib/commonjs/ui/screens/ManageAccountScreen.js +3 -3
  27. package/lib/commonjs/ui/screens/ManageAccountScreen.js.map +1 -1
  28. package/lib/commonjs/ui/utils/accountDeletionHandoff.js +2 -2
  29. package/lib/commonjs/ui/utils/accountDeletionHandoff.js.map +1 -1
  30. package/lib/module/index.js +7 -0
  31. package/lib/module/index.js.map +1 -1
  32. package/lib/module/ui/components/OxyAuthChooser.js +2 -3
  33. package/lib/module/ui/components/OxyAuthChooser.js.map +1 -1
  34. package/lib/module/ui/components/authChooser/AccountsMenuView.js +1 -8
  35. package/lib/module/ui/components/authChooser/AccountsMenuView.js.map +1 -1
  36. package/lib/module/ui/components/authChooser/types.js.map +1 -1
  37. package/lib/module/ui/components/signIn/OxyCreateAccountPanel.js +231 -0
  38. package/lib/module/ui/components/signIn/OxyCreateAccountPanel.js.map +1 -0
  39. package/lib/module/ui/components/signIn/OxyDeleteAccountPanel.js +109 -0
  40. package/lib/module/ui/components/signIn/OxyDeleteAccountPanel.js.map +1 -0
  41. package/lib/module/ui/components/signIn/OxyLinkCommonsPanel.js +270 -0
  42. package/lib/module/ui/components/signIn/OxyLinkCommonsPanel.js.map +1 -0
  43. package/lib/module/ui/components/signIn/OxyRecoverAccountPanel.js +165 -0
  44. package/lib/module/ui/components/signIn/OxyRecoverAccountPanel.js.map +1 -0
  45. package/lib/module/ui/components/signIn/accountFlowParts.js +235 -0
  46. package/lib/module/ui/components/signIn/accountFlowParts.js.map +1 -0
  47. package/lib/module/ui/context/OxyContext.js.map +1 -1
  48. package/lib/module/ui/context/passkeyFlow.js +21 -0
  49. package/lib/module/ui/context/passkeyFlow.js.map +1 -1
  50. package/lib/module/ui/screens/EditProfileFieldScreen.js +1 -24
  51. package/lib/module/ui/screens/EditProfileFieldScreen.js.map +1 -1
  52. package/lib/module/ui/screens/EditProfileScreen.js +0 -8
  53. package/lib/module/ui/screens/EditProfileScreen.js.map +1 -1
  54. package/lib/module/ui/screens/ManageAccountScreen.js +3 -3
  55. package/lib/module/ui/screens/ManageAccountScreen.js.map +1 -1
  56. package/lib/module/ui/utils/accountDeletionHandoff.js +2 -2
  57. package/lib/module/ui/utils/accountDeletionHandoff.js.map +1 -1
  58. package/lib/typescript/commonjs/index.d.ts +8 -0
  59. package/lib/typescript/commonjs/index.d.ts.map +1 -1
  60. package/lib/typescript/commonjs/ui/components/OxyAuthChooser.d.ts.map +1 -1
  61. package/lib/typescript/commonjs/ui/components/authChooser/AccountsMenuView.d.ts.map +1 -1
  62. package/lib/typescript/commonjs/ui/components/authChooser/types.d.ts +0 -5
  63. package/lib/typescript/commonjs/ui/components/authChooser/types.d.ts.map +1 -1
  64. package/lib/typescript/commonjs/ui/components/signIn/OxyCreateAccountPanel.d.ts +24 -0
  65. package/lib/typescript/commonjs/ui/components/signIn/OxyCreateAccountPanel.d.ts.map +1 -0
  66. package/lib/typescript/commonjs/ui/components/signIn/OxyDeleteAccountPanel.d.ts +16 -0
  67. package/lib/typescript/commonjs/ui/components/signIn/OxyDeleteAccountPanel.d.ts.map +1 -0
  68. package/lib/typescript/commonjs/ui/components/signIn/OxyLinkCommonsPanel.d.ts +21 -0
  69. package/lib/typescript/commonjs/ui/components/signIn/OxyLinkCommonsPanel.d.ts.map +1 -0
  70. package/lib/typescript/commonjs/ui/components/signIn/OxyRecoverAccountPanel.d.ts +20 -0
  71. package/lib/typescript/commonjs/ui/components/signIn/OxyRecoverAccountPanel.d.ts.map +1 -0
  72. package/lib/typescript/commonjs/ui/components/signIn/accountFlowParts.d.ts +60 -0
  73. package/lib/typescript/commonjs/ui/components/signIn/accountFlowParts.d.ts.map +1 -0
  74. package/lib/typescript/commonjs/ui/context/OxyContext.d.ts.map +1 -1
  75. package/lib/typescript/commonjs/ui/context/oxyContextTypes.d.ts +7 -1
  76. package/lib/typescript/commonjs/ui/context/oxyContextTypes.d.ts.map +1 -1
  77. package/lib/typescript/commonjs/ui/context/passkeyFlow.d.ts +16 -1
  78. package/lib/typescript/commonjs/ui/context/passkeyFlow.d.ts.map +1 -1
  79. package/lib/typescript/commonjs/ui/hooks/mutations/useAccountMutations.d.ts.map +1 -1
  80. package/lib/typescript/commonjs/ui/screens/EditProfileFieldScreen.d.ts +1 -1
  81. package/lib/typescript/commonjs/ui/screens/EditProfileFieldScreen.d.ts.map +1 -1
  82. package/lib/typescript/commonjs/ui/screens/EditProfileScreen.d.ts.map +1 -1
  83. package/lib/typescript/module/index.d.ts +8 -0
  84. package/lib/typescript/module/index.d.ts.map +1 -1
  85. package/lib/typescript/module/ui/components/OxyAuthChooser.d.ts.map +1 -1
  86. package/lib/typescript/module/ui/components/authChooser/AccountsMenuView.d.ts.map +1 -1
  87. package/lib/typescript/module/ui/components/authChooser/types.d.ts +0 -5
  88. package/lib/typescript/module/ui/components/authChooser/types.d.ts.map +1 -1
  89. package/lib/typescript/module/ui/components/signIn/OxyCreateAccountPanel.d.ts +24 -0
  90. package/lib/typescript/module/ui/components/signIn/OxyCreateAccountPanel.d.ts.map +1 -0
  91. package/lib/typescript/module/ui/components/signIn/OxyDeleteAccountPanel.d.ts +16 -0
  92. package/lib/typescript/module/ui/components/signIn/OxyDeleteAccountPanel.d.ts.map +1 -0
  93. package/lib/typescript/module/ui/components/signIn/OxyLinkCommonsPanel.d.ts +21 -0
  94. package/lib/typescript/module/ui/components/signIn/OxyLinkCommonsPanel.d.ts.map +1 -0
  95. package/lib/typescript/module/ui/components/signIn/OxyRecoverAccountPanel.d.ts +20 -0
  96. package/lib/typescript/module/ui/components/signIn/OxyRecoverAccountPanel.d.ts.map +1 -0
  97. package/lib/typescript/module/ui/components/signIn/accountFlowParts.d.ts +60 -0
  98. package/lib/typescript/module/ui/components/signIn/accountFlowParts.d.ts.map +1 -0
  99. package/lib/typescript/module/ui/context/OxyContext.d.ts.map +1 -1
  100. package/lib/typescript/module/ui/context/oxyContextTypes.d.ts +7 -1
  101. package/lib/typescript/module/ui/context/oxyContextTypes.d.ts.map +1 -1
  102. package/lib/typescript/module/ui/context/passkeyFlow.d.ts +16 -1
  103. package/lib/typescript/module/ui/context/passkeyFlow.d.ts.map +1 -1
  104. package/lib/typescript/module/ui/hooks/mutations/useAccountMutations.d.ts.map +1 -1
  105. package/lib/typescript/module/ui/screens/EditProfileFieldScreen.d.ts +1 -1
  106. package/lib/typescript/module/ui/screens/EditProfileFieldScreen.d.ts.map +1 -1
  107. package/lib/typescript/module/ui/screens/EditProfileScreen.d.ts.map +1 -1
  108. package/package.json +4 -4
  109. package/src/index.ts +11 -0
  110. package/src/ui/components/OxyAuthChooser.tsx +2 -3
  111. package/src/ui/components/authChooser/AccountsMenuView.tsx +0 -7
  112. package/src/ui/components/authChooser/types.ts +0 -5
  113. package/src/ui/components/signIn/OxyCreateAccountPanel.tsx +207 -0
  114. package/src/ui/components/signIn/OxyDeleteAccountPanel.tsx +106 -0
  115. package/src/ui/components/signIn/OxyLinkCommonsPanel.tsx +222 -0
  116. package/src/ui/components/signIn/OxyRecoverAccountPanel.tsx +154 -0
  117. package/src/ui/components/signIn/accountFlowParts.tsx +204 -0
  118. package/src/ui/context/OxyContext.tsx +2 -1
  119. package/src/ui/context/__tests__/passkeyFlow.test.ts +59 -1
  120. package/src/ui/context/oxyContextTypes.ts +7 -1
  121. package/src/ui/context/passkeyFlow.ts +28 -0
  122. package/src/ui/screens/EditProfileFieldScreen.tsx +1 -27
  123. package/src/ui/screens/EditProfileScreen.tsx +0 -6
  124. package/src/ui/screens/ManageAccountScreen.tsx +3 -3
  125. package/src/ui/utils/accountDeletionHandoff.ts +2 -2
@@ -0,0 +1,114 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.OxyDeleteAccountPanel = void 0;
7
+ var _react = require("react");
8
+ var _OxyContext = require("../../context/OxyContext.js");
9
+ var _useI18n = require("../../hooks/useI18n.js");
10
+ var _passkeyClient = require("../../../webauthn/passkeyClient");
11
+ var _passkeyFlow = require("../../context/passkeyFlow.js");
12
+ var _OxyAuthScreen = require("./OxyAuthScreen.js");
13
+ var _accountFlowParts = require("./accountFlowParts.js");
14
+ var _jsxRuntime = require("react/jsx-runtime");
15
+ /**
16
+ * Deleting a passkey account (ADR 0029 D3), auth.oxy.so's `/delete-account`.
17
+ *
18
+ * A passkey account has no key to sign its deletion with, so the person types
19
+ * the username and asserts one of the account's passkeys — on auth.oxy.so, the
20
+ * one origin that asserts them — over a challenge the API minted for the
21
+ * account. An account with a Commons key is deleted in Commons, with its key.
22
+ * The page must be signed in as the account; the host renders sign-in first.
23
+ */
24
+
25
+ const OxyDeleteAccountPanel = ({
26
+ onDeleted
27
+ }) => {
28
+ const {
29
+ t
30
+ } = (0, _useI18n.useI18n)();
31
+ const {
32
+ user,
33
+ oxyServices,
34
+ logout
35
+ } = (0, _OxyContext.useOxy)();
36
+ const [confirmText, setConfirmText] = (0, _react.useState)('');
37
+ const [pending, setPending] = (0, _react.useState)(false);
38
+ const [error, setError] = (0, _react.useState)(null);
39
+ const [deleted, setDeleted] = (0, _react.useState)(false);
40
+ if (deleted) {
41
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_OxyAuthScreen.OxyAuthScreen, {
42
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_OxyAuthScreen.OxyAuthScreenHeader, {
43
+ title: t('deleteAccount.passkey.done'),
44
+ description: t('deleteAccount.passkey.closeWindow')
45
+ })
46
+ });
47
+ }
48
+ const username = user?.username ?? '';
49
+ if (user?.publicKey) {
50
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_OxyAuthScreen.OxyAuthScreen, {
51
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_OxyAuthScreen.OxyAuthScreenHeader, {
52
+ title: t('deleteAccount.handoff.commonsTitle'),
53
+ description: t('deleteAccount.passkey.commons')
54
+ })
55
+ });
56
+ }
57
+
58
+ // The ceremony opens the browser's passkey prompt, so it starts from the press.
59
+ const remove = () => {
60
+ if (pending) return;
61
+ if (confirmText.trim() !== username) {
62
+ setError(t('deleteAccount.confirmLabel', {
63
+ username
64
+ }));
65
+ return;
66
+ }
67
+ setError(null);
68
+ setPending(true);
69
+ (async () => {
70
+ if (!(0, _passkeyClient.isPasskeySupported)()) throw new Error(_passkeyFlow.PASSKEY_UNSUPPORTED_MESSAGE);
71
+ const options = await oxyServices.getAccountDeletionOptions();
72
+ const assertion = await (0, _passkeyClient.runAuthenticationCeremony)(options);
73
+ await oxyServices.deleteAccountWithPasskey(confirmText.trim(), assertion);
74
+ await logout().catch(() => undefined);
75
+ setDeleted(true);
76
+ onDeleted?.();
77
+ })().catch(reason => setError((0, _accountFlowParts.describeAccountFlowError)(reason, t))).finally(() => setPending(false));
78
+ };
79
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_OxyAuthScreen.OxyAuthScreen, {
80
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_OxyAuthScreen.OxyAuthScreenHeader, {
81
+ title: t('deleteAccount.title'),
82
+ description: t('deleteAccount.passkey.subtitle', {
83
+ username
84
+ })
85
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_accountFlowParts.AccountFlowNote, {
86
+ children: t('deleteAccount.warning')
87
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_accountFlowParts.AccountFlowField, {
88
+ label: t('deleteAccount.confirmLabel', {
89
+ username
90
+ }),
91
+ value: confirmText,
92
+ onChange: value => {
93
+ setConfirmText(value);
94
+ if (error) setError(null);
95
+ },
96
+ onSubmit: remove,
97
+ error: null,
98
+ disabled: pending,
99
+ placeholder: username,
100
+ autoComplete: "off",
101
+ testID: "delete-account-confirm"
102
+ }), error ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_accountFlowParts.AccountFlowErrorLine, {
103
+ message: error
104
+ }) : null, /*#__PURE__*/(0, _jsxRuntime.jsx)(_accountFlowParts.AccountFlowAction, {
105
+ label: t('deleteAccount.passkey.action'),
106
+ onPress: remove,
107
+ pending: pending,
108
+ disabled: confirmText.trim() !== username,
109
+ testID: "delete-account-passkey"
110
+ })]
111
+ });
112
+ };
113
+ exports.OxyDeleteAccountPanel = OxyDeleteAccountPanel;
114
+ //# sourceMappingURL=OxyDeleteAccountPanel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_react","require","_OxyContext","_useI18n","_passkeyClient","_passkeyFlow","_OxyAuthScreen","_accountFlowParts","_jsxRuntime","OxyDeleteAccountPanel","onDeleted","t","useI18n","user","oxyServices","logout","useOxy","confirmText","setConfirmText","useState","pending","setPending","error","setError","deleted","setDeleted","jsx","OxyAuthScreen","children","OxyAuthScreenHeader","title","description","username","publicKey","remove","trim","isPasskeySupported","Error","PASSKEY_UNSUPPORTED_MESSAGE","options","getAccountDeletionOptions","assertion","runAuthenticationCeremony","deleteAccountWithPasskey","catch","undefined","reason","describeAccountFlowError","finally","jsxs","AccountFlowNote","AccountFlowField","label","value","onChange","onSubmit","disabled","placeholder","autoComplete","testID","AccountFlowErrorLine","message","AccountFlowAction","onPress","exports"],"sourceRoot":"../../../../../src","sources":["ui/components/signIn/OxyDeleteAccountPanel.tsx"],"mappings":";;;;;;AAWA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,cAAA,GAAAH,OAAA;AACA,IAAAI,YAAA,GAAAJ,OAAA;AACA,IAAAK,cAAA,GAAAL,OAAA;AACA,IAAAM,iBAAA,GAAAN,OAAA;AAM4B,IAAAO,WAAA,GAAAP,OAAA;AAvB5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAsBO,MAAMQ,qBAA2D,GAAGA,CAAC;EAAEC;AAAU,CAAC,KAAK;EAC5F,MAAM;IAAEC;EAAE,CAAC,GAAG,IAAAC,gBAAO,EAAC,CAAC;EACvB,MAAM;IAAEC,IAAI;IAAEC,WAAW;IAAEC;EAAO,CAAC,GAAG,IAAAC,kBAAM,EAAC,CAAC;EAC9C,MAAM,CAACC,WAAW,EAAEC,cAAc,CAAC,GAAG,IAAA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,KAAK,EAAEpC,WAAY;MACnBqC,QAAQ,EAAGD,KAAK,IAAK;QACnBnC,cAAc,CAACmC,KAAK,CAAC;QACrB,IAAI/B,KAAK,EAAEC,QAAQ,CAAC,IAAI,CAAC;MAC3B,CAAE;MACFgC,QAAQ,EAAErB,MAAO;MACjBZ,KAAK,EAAE,IAAK;MACZkC,QAAQ,EAAEpC,OAAQ;MAClBqC,WAAW,EAAEzB,QAAS;MACtB0B,YAAY,EAAC,KAAK;MAClBC,MAAM,EAAC;IAAwB,CAChC,CAAC,EACDrC,KAAK,gBAAG,IAAAd,WAAA,CAAAkB,GAAA,EAACnB,iBAAA,CAAAqD,oBAAoB;MAACC,OAAO,EAAEvC;IAAM,CAAE,CAAC,GAAG,IAAI,eACxD,IAAAd,WAAA,CAAAkB,GAAA,EAACnB,iBAAA,CAAAuD,iBAAiB;MAChBV,KAAK,EAAEzC,CAAC,CAAC,8BAA8B,CAAE;MACzCoD,OAAO,EAAE7B,MAAO;MAChBd,OAAO,EAAEA,OAAQ;MACjBoC,QAAQ,EAAEvC,WAAW,CAACkB,IAAI,CAAC,CAAC,KAAKH,QAAS;MAC1C2B,MAAM,EAAC;IAAwB,CAChC,CAAC;EAAA,CACW,CAAC;AAEpB,CAAC;AAACK,OAAA,CAAAvD,qBAAA,GAAAA,qBAAA","ignoreList":[]}
@@ -0,0 +1,275 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.OxyLinkCommonsPanel = exports.IDENTITY_LINK_POLL_MS = void 0;
7
+ var _react = require("react");
8
+ var _reactNative = require("react-native");
9
+ var _reactNativeQrcodeSvg = _interopRequireDefault(require("react-native-qrcode-svg"));
10
+ var _button = require("@oxy.so/bloom/button");
11
+ var _theme = require("@oxy.so/bloom/theme");
12
+ var _typography = require("@oxy.so/bloom/typography");
13
+ var _core = require("@oxy.so/core");
14
+ var _OxyContext = require("../../context/OxyContext.js");
15
+ var _passkeyFlow = require("../../context/passkeyFlow.js");
16
+ var _useI18n = require("../../hooks/useI18n.js");
17
+ var _passkeyClient = require("../../../webauthn/passkeyClient");
18
+ var _OxyAuthScreen = require("./OxyAuthScreen.js");
19
+ var _accountFlowParts = require("./accountFlowParts.js");
20
+ var _jsxRuntime = require("react/jsx-runtime");
21
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
22
+ /**
23
+ * Linking Commons to a passkey account (ADR 0029 D3), auth.oxy.so's
24
+ * `/link-commons`:
25
+ *
26
+ * QR → Commons scans and signs with its key → both screens show the same
27
+ * code → the person confirms here with the passkey → linked
28
+ *
29
+ * Afterwards the account is self-custodied: its root is the key Commons holds,
30
+ * its recovery email is deleted, and its phrase in Commons is how it gets back
31
+ * in. The passkey keeps signing in on the web. The page must be signed in as
32
+ * the account; the host renders sign-in first.
33
+ */
34
+
35
+ /** How often the page asks whether Commons has signed. */
36
+ const IDENTITY_LINK_POLL_MS = exports.IDENTITY_LINK_POLL_MS = 2000;
37
+
38
+ /** High-contrast, un-themed on purpose: scan reliability. */
39
+ const QR_PLATE_BG = '#FFFFFF';
40
+ const QR_FOREGROUND = '#000000';
41
+ const QR_SIZE = 200;
42
+ const OxyLinkCommonsPanel = ({
43
+ onLinked
44
+ }) => {
45
+ const theme = (0, _theme.useTheme)();
46
+ const {
47
+ t
48
+ } = (0, _useI18n.useI18n)();
49
+ const {
50
+ user,
51
+ oxyServices
52
+ } = (0, _OxyContext.useOxy)();
53
+ const [step, setStep] = (0, _react.useState)({
54
+ name: 'opening'
55
+ });
56
+ const [pending, setPending] = (0, _react.useState)(false);
57
+ const [error, setError] = (0, _react.useState)(null);
58
+ const alreadyLinked = Boolean(user?.publicKey);
59
+ const open = (0, _react.useCallback)(() => {
60
+ setError(null);
61
+ setStep({
62
+ name: 'opening'
63
+ });
64
+ oxyServices.createIdentityLink().then(link => setStep({
65
+ name: 'qr',
66
+ link
67
+ })).catch(reason => {
68
+ setError((0, _accountFlowParts.describeAccountFlowError)(reason, t));
69
+ setStep({
70
+ name: 'expired'
71
+ });
72
+ });
73
+ }, [oxyServices, t]);
74
+
75
+ // One request per visit, opened once the page knows the account has no root.
76
+ const opened = (0, _react.useRef)(false);
77
+ (0, _react.useEffect)(() => {
78
+ if (alreadyLinked || opened.current) return;
79
+ opened.current = true;
80
+ open();
81
+ }, [alreadyLinked, open]);
82
+
83
+ // While the QR shows, ask whether Commons has signed; a request only lives a
84
+ // few minutes, and an expired one says so instead of waiting forever.
85
+ const link = step.name === 'qr' ? step.link : null;
86
+ (0, _react.useEffect)(() => {
87
+ if (!link) return;
88
+ let stopped = false;
89
+ const poll = async () => {
90
+ if (stopped) return;
91
+ if (Date.now() >= link.expiresAt) {
92
+ setStep({
93
+ name: 'expired'
94
+ });
95
+ return;
96
+ }
97
+ try {
98
+ const state = await oxyServices.getIdentityLink(link.linkId);
99
+ if (stopped) return;
100
+ if (state.status === 'signed' && state.publicKey) {
101
+ setStep({
102
+ name: 'matching',
103
+ link,
104
+ code: (0, _core.deriveIdentityLinkCode)(link.linkId, state.publicKey)
105
+ });
106
+ return;
107
+ }
108
+ if (state.status === 'cancelled') {
109
+ setStep({
110
+ name: 'expired'
111
+ });
112
+ return;
113
+ }
114
+ } catch {
115
+ // A missed poll is retried on the next tick.
116
+ }
117
+ if (!stopped) timer = setTimeout(() => void poll(), IDENTITY_LINK_POLL_MS);
118
+ };
119
+ let timer = setTimeout(() => void poll(), IDENTITY_LINK_POLL_MS);
120
+ return () => {
121
+ stopped = true;
122
+ clearTimeout(timer);
123
+ };
124
+ }, [link, oxyServices]);
125
+
126
+ // The ceremony opens the browser's passkey prompt, so it starts from the press.
127
+ const confirm = confirmed => {
128
+ if (pending) return;
129
+ setError(null);
130
+ setPending(true);
131
+ (async () => {
132
+ if (!(0, _passkeyClient.isPasskeySupported)()) throw new Error(_passkeyFlow.PASSKEY_UNSUPPORTED_MESSAGE);
133
+ const options = await oxyServices.getIdentityLinkAssertionOptions(confirmed.linkId, confirmed.challenge);
134
+ const assertion = await (0, _passkeyClient.runAuthenticationCeremony)(options);
135
+ await oxyServices.completeIdentityLink(confirmed.linkId, assertion);
136
+ setStep({
137
+ name: 'done'
138
+ });
139
+ onLinked?.();
140
+ })().catch(reason => setError((0, _accountFlowParts.describeAccountFlowError)(reason, t))).finally(() => setPending(false));
141
+ };
142
+ const cancel = cancelled => {
143
+ void oxyServices.cancelIdentityLink(cancelled.linkId).catch(() => undefined);
144
+ setStep({
145
+ name: 'expired'
146
+ });
147
+ };
148
+ if (alreadyLinked) {
149
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_OxyAuthScreen.OxyAuthScreen, {
150
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_OxyAuthScreen.OxyAuthScreenHeader, {
151
+ title: t('linkCommons.title'),
152
+ description: t('linkCommons.already')
153
+ })
154
+ });
155
+ }
156
+ switch (step.name) {
157
+ case 'done':
158
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_OxyAuthScreen.OxyAuthScreen, {
159
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_OxyAuthScreen.OxyAuthScreenHeader, {
160
+ title: t('linkCommons.doneTitle'),
161
+ description: t('linkCommons.done')
162
+ })
163
+ });
164
+ case 'expired':
165
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_OxyAuthScreen.OxyAuthScreen, {
166
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_OxyAuthScreen.OxyAuthScreenHeader, {
167
+ title: t('linkCommons.title'),
168
+ description: t('linkCommons.expired')
169
+ }), error ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_accountFlowParts.AccountFlowErrorLine, {
170
+ message: error
171
+ }) : null, /*#__PURE__*/(0, _jsxRuntime.jsx)(_accountFlowParts.AccountFlowAction, {
172
+ label: t('linkCommons.renew'),
173
+ onPress: open,
174
+ pending: false,
175
+ testID: "link-commons-renew"
176
+ })]
177
+ });
178
+ case 'matching':
179
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_OxyAuthScreen.OxyAuthScreen, {
180
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_OxyAuthScreen.OxyAuthScreenHeader, {
181
+ title: t('linkCommons.compareTitle'),
182
+ description: t('linkCommons.compare')
183
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_typography.Text, {
184
+ accessibilityLabel: step.code.split('').join(' '),
185
+ style: [styles.code, {
186
+ color: theme.colors.text
187
+ }],
188
+ testID: "link-commons-code",
189
+ children: `${step.code.slice(0, 3)} ${step.code.slice(3)}`
190
+ }), error ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_accountFlowParts.AccountFlowErrorLine, {
191
+ message: error
192
+ }) : null, /*#__PURE__*/(0, _jsxRuntime.jsx)(_accountFlowParts.AccountFlowAction, {
193
+ label: t('linkCommons.confirm'),
194
+ onPress: () => confirm(step.link),
195
+ pending: pending,
196
+ testID: "link-commons-confirm"
197
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_button.Button, {
198
+ appearance: "plain",
199
+ tone: "neutral",
200
+ size: "lg",
201
+ fullWidth: true,
202
+ disabled: pending,
203
+ onPress: () => cancel(step.link),
204
+ testID: "link-commons-cancel",
205
+ children: t('linkCommons.cancel')
206
+ })]
207
+ });
208
+ case 'qr':
209
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_OxyAuthScreen.OxyAuthScreen, {
210
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_OxyAuthScreen.OxyAuthScreenHeader, {
211
+ title: t('linkCommons.title'),
212
+ description: t('linkCommons.subtitle')
213
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
214
+ style: styles.plateRow,
215
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
216
+ style: [styles.plate, {
217
+ borderColor: theme.colors.border
218
+ }],
219
+ testID: "link-commons-qr",
220
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNativeQrcodeSvg.default, {
221
+ value: step.link.qrPayload,
222
+ size: QR_SIZE,
223
+ backgroundColor: QR_PLATE_BG,
224
+ color: QR_FOREGROUND
225
+ })
226
+ })
227
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_accountFlowParts.AccountFlowNote, {
228
+ children: t('linkCommons.scan')
229
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_accountFlowParts.AccountFlowNote, {
230
+ children: t('linkCommons.waiting')
231
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_button.Button, {
232
+ appearance: "plain",
233
+ tone: "neutral",
234
+ size: "lg",
235
+ fullWidth: true,
236
+ onPress: () => cancel(step.link),
237
+ testID: "link-commons-cancel",
238
+ children: t('linkCommons.cancel')
239
+ })]
240
+ });
241
+ default:
242
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_OxyAuthScreen.OxyAuthScreen, {
243
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_OxyAuthScreen.OxyAuthScreenHeader, {
244
+ title: t('linkCommons.title'),
245
+ description: t('linkCommons.subtitle')
246
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
247
+ style: styles.plateRow,
248
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.ActivityIndicator, {
249
+ size: "large",
250
+ color: theme.colors.primary
251
+ })
252
+ })]
253
+ });
254
+ }
255
+ };
256
+ exports.OxyLinkCommonsPanel = OxyLinkCommonsPanel;
257
+ const styles = _reactNative.StyleSheet.create({
258
+ plateRow: {
259
+ alignItems: 'center'
260
+ },
261
+ plate: {
262
+ padding: 12,
263
+ borderRadius: 16,
264
+ borderWidth: _reactNative.StyleSheet.hairlineWidth,
265
+ backgroundColor: QR_PLATE_BG
266
+ },
267
+ code: {
268
+ fontSize: 40,
269
+ lineHeight: 48,
270
+ fontWeight: '700',
271
+ letterSpacing: 4,
272
+ textAlign: 'center'
273
+ }
274
+ });
275
+ //# sourceMappingURL=OxyLinkCommonsPanel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_react","require","_reactNative","_reactNativeQrcodeSvg","_interopRequireDefault","_button","_theme","_typography","_core","_OxyContext","_passkeyFlow","_useI18n","_passkeyClient","_OxyAuthScreen","_accountFlowParts","_jsxRuntime","e","__esModule","default","IDENTITY_LINK_POLL_MS","exports","QR_PLATE_BG","QR_FOREGROUND","QR_SIZE","OxyLinkCommonsPanel","onLinked","theme","useTheme","t","useI18n","user","oxyServices","useOxy","step","setStep","useState","name","pending","setPending","error","setError","alreadyLinked","Boolean","publicKey","open","useCallback","createIdentityLink","then","link","catch","reason","describeAccountFlowError","opened","useRef","useEffect","current","stopped","poll","Date","now","expiresAt","state","getIdentityLink","linkId","status","code","deriveIdentityLinkCode","timer","setTimeout","clearTimeout","confirm","confirmed","isPasskeySupported","Error","PASSKEY_UNSUPPORTED_MESSAGE","options","getIdentityLinkAssertionOptions","challenge","assertion","runAuthenticationCeremony","completeIdentityLink","finally","cancel","cancelled","cancelIdentityLink","undefined","jsx","OxyAuthScreen","children","OxyAuthScreenHeader","title","description","jsxs","AccountFlowErrorLine","message","AccountFlowAction","label","onPress","testID","Text","accessibilityLabel","split","join","style","styles","color","colors","text","slice","Button","appearance","tone","size","fullWidth","disabled","View","plateRow","plate","borderColor","border","value","qrPayload","backgroundColor","AccountFlowNote","ActivityIndicator","primary","StyleSheet","create","alignItems","padding","borderRadius","borderWidth","hairlineWidth","fontSize","lineHeight","fontWeight","letterSpacing","textAlign"],"sourceRoot":"../../../../../src","sources":["ui/components/signIn/OxyLinkCommonsPanel.tsx"],"mappings":";;;;;;AAcA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,qBAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AACA,IAAAM,WAAA,GAAAN,OAAA;AACA,IAAAO,KAAA,GAAAP,OAAA;AAEA,IAAAQ,WAAA,GAAAR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,CAAE,CAAC,eAC9F,IAAAb,WAAA,CAAAuE,GAAA,EAACpF,YAAA,CAAAiH,IAAI;UAACZ,KAAK,EAAEC,MAAM,CAACY,QAAS;UAAA5B,QAAA,eAC3B,IAAAzE,WAAA,CAAAuE,GAAA,EAACpF,YAAA,CAAA0H,iBAAiB;YAACZ,IAAI,EAAC,OAAO;YAACP,KAAK,EAAE/E,KAAK,CAACgF,MAAM,CAACmB;UAAQ,CAAE;QAAC,CAC3D,CAAC;MAAA,CACM,CAAC;EAEtB;AACF,CAAC;AAACzG,OAAA,CAAAI,mBAAA,GAAAA,mBAAA;AAEF,MAAMgF,MAAM,GAAGsB,uBAAU,CAACC,MAAM,CAAC;EAC/BX,QAAQ,EAAE;IACRY,UAAU,EAAE;EACd,CAAC;EACDX,KAAK,EAAE;IACLY,OAAO,EAAE,EAAE;IACXC,YAAY,EAAE,EAAE;IAChBC,WAAW,EAAEL,uBAAU,CAACM,aAAa;IACrCV,eAAe,EAAErG;EACnB,CAAC;EACD4C,IAAI,EAAE;IACJoE,QAAQ,EAAE,EAAE;IACZC,UAAU,EAAE,EAAE;IACdC,UAAU,EAAE,KAAK;IACjBC,aAAa,EAAE,CAAC;IAChBC,SAAS,EAAE;EACb;AACF,CAAC,CAAC","ignoreList":[]}
@@ -0,0 +1,170 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.OxyRecoverAccountPanel = void 0;
7
+ var _react = require("react");
8
+ var _theme = require("@oxy.so/bloom/theme");
9
+ var _core = require("@oxy.so/core");
10
+ var _OxyContext = require("../../context/OxyContext.js");
11
+ var _passkeyFlow = require("../../context/passkeyFlow.js");
12
+ var _useI18n = require("../../hooks/useI18n.js");
13
+ var _passkeyClient = require("../../../webauthn/passkeyClient");
14
+ var _primitives = require("../authChooser/primitives.js");
15
+ var _OxyAuthScreen = require("./OxyAuthScreen.js");
16
+ var _accountFlowParts = require("./accountFlowParts.js");
17
+ var _jsxRuntime = require("react/jsx-runtime");
18
+ /**
19
+ * Recovering a passkey account (ADR 0029 D3), auth.oxy.so's `/recover`:
20
+ *
21
+ * username or email → the code sent to the recovery email → new passkey → signed in
22
+ *
23
+ * The first step answers the same whether or not the account exists, so it
24
+ * never says who has one. An account that uses Commons has no recovery email:
25
+ * it recovers in Commons with its phrase, and the first step says so. The new
26
+ * passkey joins the ones the account has; lost ones are removed afterwards in
27
+ * the account's security settings.
28
+ */
29
+
30
+ const OxyRecoverAccountPanel = ({
31
+ onRecovered,
32
+ onSignIn
33
+ }) => {
34
+ const theme = (0, _theme.useTheme)();
35
+ const {
36
+ t
37
+ } = (0, _useI18n.useI18n)();
38
+ const {
39
+ oxyServices,
40
+ handleWebSession
41
+ } = (0, _OxyContext.useOxy)();
42
+ const [step, setStep] = (0, _react.useState)({
43
+ name: 'entry'
44
+ });
45
+ const [identifier, setIdentifier] = (0, _react.useState)('');
46
+ const [pending, setPending] = (0, _react.useState)(false);
47
+ const [error, setError] = (0, _react.useState)(null);
48
+ const run = work => {
49
+ if (pending) return;
50
+ setError(null);
51
+ setPending(true);
52
+ work().catch(reason => {
53
+ if ((0, _accountFlowParts.isTicketExpired)(reason)) setStep({
54
+ name: 'entry'
55
+ });
56
+ setError((0, _accountFlowParts.describeAccountFlowError)(reason, t));
57
+ }).finally(() => setPending(false));
58
+ };
59
+ const sendCode = async () => {
60
+ const {
61
+ verificationId
62
+ } = await oxyServices.startEmailVerification({
63
+ purpose: 'recovery',
64
+ identifier: identifier.trim()
65
+ });
66
+ setStep({
67
+ name: 'code',
68
+ verificationId
69
+ });
70
+ };
71
+ const submitIdentifier = () => {
72
+ if (!identifier.trim()) {
73
+ setError(t('recover.identifier.required'));
74
+ return;
75
+ }
76
+ run(sendCode);
77
+ };
78
+
79
+ // The ceremony opens the browser's passkey prompt, so it starts from the press.
80
+ const addPasskey = recoveryTicket => run(() => (0, _passkeyFlow.runPasskeyRegisterSignIn)({
81
+ isSupported: _passkeyClient.isPasskeySupported,
82
+ getRegisterOptions: () => oxyServices.webauthnRegisterOptions({
83
+ recoveryTicket
84
+ }),
85
+ runCeremony: _passkeyClient.runRegistrationCeremony,
86
+ registerVerify: response => oxyServices.webauthnRegisterVerify(response, {
87
+ recoveryTicket,
88
+ deviceFingerprint: JSON.stringify(_core.DeviceManager.getDeviceFingerprint())
89
+ }),
90
+ commit: async session => {
91
+ await handleWebSession(session);
92
+ onRecovered();
93
+ }
94
+ }));
95
+ switch (step.name) {
96
+ case 'code':
97
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_accountFlowParts.EmailCodeStep, {
98
+ description: t('emailCode.sentIfAccount'),
99
+ verificationId: step.verificationId,
100
+ onConfirmed: ({
101
+ ticket,
102
+ username
103
+ }) => {
104
+ setError(null);
105
+ setStep({
106
+ name: 'passkey',
107
+ recoveryTicket: ticket,
108
+ username
109
+ });
110
+ },
111
+ onResend: sendCode,
112
+ back: {
113
+ label: t('signin.actions.back'),
114
+ onPress: () => setStep({
115
+ name: 'entry'
116
+ })
117
+ }
118
+ });
119
+ case 'passkey':
120
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_OxyAuthScreen.OxyAuthScreen, {
121
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_OxyAuthScreen.OxyAuthScreenHeader, {
122
+ title: t('recover.passkey.title'),
123
+ description: t('recover.passkey.subtitle', {
124
+ username: step.username ?? ''
125
+ })
126
+ }), error ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_accountFlowParts.AccountFlowErrorLine, {
127
+ message: error
128
+ }) : null, /*#__PURE__*/(0, _jsxRuntime.jsx)(_accountFlowParts.AccountFlowAction, {
129
+ label: t('recover.passkey.action'),
130
+ onPress: () => addPasskey(step.recoveryTicket),
131
+ pending: pending,
132
+ testID: "recover-create-passkey"
133
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_OxyAuthScreen.OxyAuthTerms, {})]
134
+ });
135
+ default:
136
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_OxyAuthScreen.OxyAuthScreen, {
137
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_OxyAuthScreen.OxyAuthScreenHeader, {
138
+ title: t('recover.title'),
139
+ description: t('recover.subtitle')
140
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_accountFlowParts.AccountFlowField, {
141
+ label: t('recover.identifier.label'),
142
+ value: identifier,
143
+ onChange: value => {
144
+ setIdentifier(value);
145
+ if (error) setError(null);
146
+ },
147
+ onSubmit: submitIdentifier,
148
+ error: error,
149
+ disabled: pending,
150
+ placeholder: t('recover.identifier.placeholder'),
151
+ autoComplete: "username",
152
+ testID: "recover-identifier"
153
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_accountFlowParts.AccountFlowNote, {
154
+ children: t('recover.commonsNote')
155
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_accountFlowParts.AccountFlowAction, {
156
+ label: t('signin.actions.continue'),
157
+ onPress: submitIdentifier,
158
+ pending: pending,
159
+ testID: "recover-continue"
160
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_primitives.SubtleLink, {
161
+ label: t('recover.backToSignIn'),
162
+ theme: theme,
163
+ onPress: onSignIn,
164
+ testID: "back-to-sign-in"
165
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_OxyAuthScreen.OxyAuthTerms, {})]
166
+ });
167
+ }
168
+ };
169
+ exports.OxyRecoverAccountPanel = OxyRecoverAccountPanel;
170
+ //# sourceMappingURL=OxyRecoverAccountPanel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_react","require","_theme","_core","_OxyContext","_passkeyFlow","_useI18n","_passkeyClient","_primitives","_OxyAuthScreen","_accountFlowParts","_jsxRuntime","OxyRecoverAccountPanel","onRecovered","onSignIn","theme","useTheme","t","useI18n","oxyServices","handleWebSession","useOxy","step","setStep","useState","name","identifier","setIdentifier","pending","setPending","error","setError","run","work","catch","reason","isTicketExpired","describeAccountFlowError","finally","sendCode","verificationId","startEmailVerification","purpose","trim","submitIdentifier","addPasskey","recoveryTicket","runPasskeyRegisterSignIn","isSupported","isPasskeySupported","getRegisterOptions","webauthnRegisterOptions","runCeremony","runRegistrationCeremony","registerVerify","response","webauthnRegisterVerify","deviceFingerprint","JSON","stringify","DeviceManager","getDeviceFingerprint","commit","session","jsx","EmailCodeStep","description","onConfirmed","ticket","username","onResend","back","label","onPress","jsxs","OxyAuthScreen","children","OxyAuthScreenHeader","title","AccountFlowErrorLine","message","AccountFlowAction","testID","OxyAuthTerms","AccountFlowField","value","onChange","onSubmit","disabled","placeholder","autoComplete","AccountFlowNote","SubtleLink","exports"],"sourceRoot":"../../../../../src","sources":["ui/components/signIn/OxyRecoverAccountPanel.tsx"],"mappings":";;;;;;AAaA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AACA,IAAAI,YAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AACA,IAAAM,cAAA,GAAAN,OAAA;AACA,IAAAO,WAAA,GAAAP,OAAA;AACA,IAAAQ,cAAA,GAAAR,OAAA;AACA,IAAAS,iBAAA,GAAAT,OAAA;AAQ4B,IAAAU,WAAA,GAAAV,OAAA;AA9B5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAkCO,MAAMW,sBAA6D,GAAGA,CAAC;EAAEC,WAAW;EAAEC;AAAS,CAAC,KAAK;EAC1G,MAAMC,KAAK,GAAG,IAAAC,eAAQ,EAAC,CAAC;EACxB,MAAM;IAAEC;EAAE,CAAC,GAAG,IAAAC,gBAAO,EAAC,CAAC;EACvB,MAAM;IAAEC,WAAW;IAAEC;EAAiB,CAAC,GAAG,IAAAC,kBAAM,EAAC,CAAC;EAClD,MAAM,CAACC,IAAI,EAAEC,OAAO,CAAC,GAAG,IAAAC,eAAQ,EAAO;IAAEC,IAAI,EAAE;E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