@oxy.so/services 11.10.0 → 11.12.1
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/assets/assets/fonts/icons/OxyServicesIonicons.ttf +0 -0
- package/lib/commonjs/assets/assets/fonts/icons/OxyServicesMaterialCommunityIcons.ttf +0 -0
- package/lib/commonjs/assets/assets/fonts/icons/manifest.json +5 -4
- package/lib/commonjs/assets/fonts/icons/OxyServicesIonicons.ttf +0 -0
- package/lib/commonjs/assets/fonts/icons/OxyServicesMaterialCommunityIcons.ttf +0 -0
- package/lib/commonjs/assets/fonts/icons/manifest.json +5 -4
- package/lib/commonjs/index.js +17 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/ui/appAssertion/AppAssertionContext.js +79 -0
- package/lib/commonjs/ui/appAssertion/AppAssertionContext.js.map +1 -0
- package/lib/commonjs/ui/appAssertion/appAssertionManager.js +309 -0
- package/lib/commonjs/ui/appAssertion/appAssertionManager.js.map +1 -0
- package/lib/commonjs/ui/appAssertion/appIntegrityPlatform.js +18 -0
- package/lib/commonjs/ui/appAssertion/appIntegrityPlatform.js.map +1 -0
- package/lib/commonjs/ui/appAssertion/appIntegrityPlatform.native.js +30 -0
- package/lib/commonjs/ui/appAssertion/appIntegrityPlatform.native.js.map +1 -0
- package/lib/commonjs/ui/appAssertion/appIntegrityTypes.js +6 -0
- package/lib/commonjs/ui/appAssertion/appIntegrityTypes.js.map +1 -0
- package/lib/commonjs/ui/components/fileManagement/FileAppAccessSection.js +121 -0
- package/lib/commonjs/ui/components/fileManagement/FileAppAccessSection.js.map +1 -0
- package/lib/commonjs/ui/components/fileManagement/FileDetailsModal.js +6 -2
- package/lib/commonjs/ui/components/fileManagement/FileDetailsModal.js.map +1 -1
- package/lib/commonjs/ui/context/OxyContext.js +10 -1
- package/lib/commonjs/ui/context/OxyContext.js.map +1 -1
- package/lib/commonjs/ui/hooks/mutations/mutationKeys.js +4 -0
- package/lib/commonjs/ui/hooks/mutations/mutationKeys.js.map +1 -1
- package/lib/commonjs/ui/hooks/mutations/useAccountMutations.js +49 -1
- package/lib/commonjs/ui/hooks/mutations/useAccountMutations.js.map +1 -1
- package/lib/commonjs/ui/hooks/queries/queryKeys.js +6 -1
- package/lib/commonjs/ui/hooks/queries/queryKeys.js.map +1 -1
- package/lib/commonjs/ui/hooks/queries/useFileQueries.js +35 -1
- package/lib/commonjs/ui/hooks/queries/useFileQueries.js.map +1 -1
- package/lib/commonjs/ui/icons/subsetGlyphMaps.js +1 -0
- package/lib/commonjs/ui/icons/subsetGlyphMaps.js.map +1 -1
- package/lib/commonjs/ui/index.js +7 -0
- package/lib/commonjs/ui/index.js.map +1 -1
- package/lib/module/assets/assets/fonts/icons/OxyServicesIonicons.ttf +0 -0
- package/lib/module/assets/assets/fonts/icons/OxyServicesMaterialCommunityIcons.ttf +0 -0
- package/lib/module/assets/assets/fonts/icons/manifest.json +5 -4
- package/lib/module/assets/fonts/icons/OxyServicesIonicons.ttf +0 -0
- package/lib/module/assets/fonts/icons/OxyServicesMaterialCommunityIcons.ttf +0 -0
- package/lib/module/assets/fonts/icons/manifest.json +5 -4
- package/lib/module/index.js +4 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/ui/appAssertion/AppAssertionContext.js +72 -0
- package/lib/module/ui/appAssertion/AppAssertionContext.js.map +1 -0
- package/lib/module/ui/appAssertion/appAssertionManager.js +304 -0
- package/lib/module/ui/appAssertion/appAssertionManager.js.map +1 -0
- package/lib/module/ui/appAssertion/appIntegrityPlatform.js +14 -0
- package/lib/module/ui/appAssertion/appIntegrityPlatform.js.map +1 -0
- package/lib/module/ui/appAssertion/appIntegrityPlatform.native.js +26 -0
- package/lib/module/ui/appAssertion/appIntegrityPlatform.native.js.map +1 -0
- package/lib/module/ui/appAssertion/appIntegrityTypes.js +4 -0
- package/lib/module/ui/appAssertion/appIntegrityTypes.js.map +1 -0
- package/lib/module/ui/components/fileManagement/FileAppAccessSection.js +116 -0
- package/lib/module/ui/components/fileManagement/FileAppAccessSection.js.map +1 -0
- package/lib/module/ui/components/fileManagement/FileDetailsModal.js +6 -2
- package/lib/module/ui/components/fileManagement/FileDetailsModal.js.map +1 -1
- package/lib/module/ui/context/OxyContext.js +10 -1
- package/lib/module/ui/context/OxyContext.js.map +1 -1
- package/lib/module/ui/hooks/mutations/mutationKeys.js +4 -0
- package/lib/module/ui/hooks/mutations/mutationKeys.js.map +1 -1
- package/lib/module/ui/hooks/mutations/useAccountMutations.js +47 -0
- package/lib/module/ui/hooks/mutations/useAccountMutations.js.map +1 -1
- package/lib/module/ui/hooks/queries/queryKeys.js +6 -1
- package/lib/module/ui/hooks/queries/queryKeys.js.map +1 -1
- package/lib/module/ui/hooks/queries/useFileQueries.js +33 -1
- package/lib/module/ui/hooks/queries/useFileQueries.js.map +1 -1
- package/lib/module/ui/icons/subsetGlyphMaps.js +1 -0
- package/lib/module/ui/icons/subsetGlyphMaps.js.map +1 -1
- package/lib/module/ui/index.js +1 -0
- package/lib/module/ui/index.js.map +1 -1
- package/lib/typescript/commonjs/index.d.ts +3 -0
- package/lib/typescript/commonjs/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/appAssertion/AppAssertionContext.d.ts +41 -0
- package/lib/typescript/commonjs/ui/appAssertion/AppAssertionContext.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/appAssertion/appAssertionManager.d.ts +92 -0
- package/lib/typescript/commonjs/ui/appAssertion/appAssertionManager.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/appAssertion/appIntegrityPlatform.d.ts +9 -0
- package/lib/typescript/commonjs/ui/appAssertion/appIntegrityPlatform.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/appAssertion/appIntegrityPlatform.native.d.ts +3 -0
- package/lib/typescript/commonjs/ui/appAssertion/appIntegrityPlatform.native.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/appAssertion/appIntegrityTypes.d.ts +22 -0
- package/lib/typescript/commonjs/ui/appAssertion/appIntegrityTypes.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/components/fileManagement/FileAppAccessSection.d.ts +15 -0
- package/lib/typescript/commonjs/ui/components/fileManagement/FileAppAccessSection.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/components/fileManagement/FileDetailsModal.d.ts +2 -1
- package/lib/typescript/commonjs/ui/components/fileManagement/FileDetailsModal.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/context/OxyContext.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/hooks/mutations/mutationKeys.d.ts +3 -0
- package/lib/typescript/commonjs/ui/hooks/mutations/mutationKeys.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/hooks/mutations/useAccountMutations.d.ts +13 -1
- package/lib/typescript/commonjs/ui/hooks/mutations/useAccountMutations.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/hooks/queries/queryKeys.d.ts +5 -0
- package/lib/typescript/commonjs/ui/hooks/queries/queryKeys.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/hooks/queries/useFileQueries.d.ts +11 -1
- package/lib/typescript/commonjs/ui/hooks/queries/useFileQueries.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/icons/MaterialCommunityIcons.d.ts +1 -1
- package/lib/typescript/commonjs/ui/icons/MaterialCommunityIcons.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/icons/subsetGlyphMaps.d.ts +1 -0
- package/lib/typescript/commonjs/ui/icons/subsetGlyphMaps.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/index.d.ts +2 -0
- package/lib/typescript/commonjs/ui/index.d.ts.map +1 -1
- package/lib/typescript/module/index.d.ts +3 -0
- package/lib/typescript/module/index.d.ts.map +1 -1
- package/lib/typescript/module/ui/appAssertion/AppAssertionContext.d.ts +41 -0
- package/lib/typescript/module/ui/appAssertion/AppAssertionContext.d.ts.map +1 -0
- package/lib/typescript/module/ui/appAssertion/appAssertionManager.d.ts +92 -0
- package/lib/typescript/module/ui/appAssertion/appAssertionManager.d.ts.map +1 -0
- package/lib/typescript/module/ui/appAssertion/appIntegrityPlatform.d.ts +9 -0
- package/lib/typescript/module/ui/appAssertion/appIntegrityPlatform.d.ts.map +1 -0
- package/lib/typescript/module/ui/appAssertion/appIntegrityPlatform.native.d.ts +3 -0
- package/lib/typescript/module/ui/appAssertion/appIntegrityPlatform.native.d.ts.map +1 -0
- package/lib/typescript/module/ui/appAssertion/appIntegrityTypes.d.ts +22 -0
- package/lib/typescript/module/ui/appAssertion/appIntegrityTypes.d.ts.map +1 -0
- package/lib/typescript/module/ui/components/fileManagement/FileAppAccessSection.d.ts +15 -0
- package/lib/typescript/module/ui/components/fileManagement/FileAppAccessSection.d.ts.map +1 -0
- package/lib/typescript/module/ui/components/fileManagement/FileDetailsModal.d.ts +2 -1
- package/lib/typescript/module/ui/components/fileManagement/FileDetailsModal.d.ts.map +1 -1
- package/lib/typescript/module/ui/context/OxyContext.d.ts.map +1 -1
- package/lib/typescript/module/ui/hooks/mutations/mutationKeys.d.ts +3 -0
- package/lib/typescript/module/ui/hooks/mutations/mutationKeys.d.ts.map +1 -1
- package/lib/typescript/module/ui/hooks/mutations/useAccountMutations.d.ts +13 -1
- package/lib/typescript/module/ui/hooks/mutations/useAccountMutations.d.ts.map +1 -1
- package/lib/typescript/module/ui/hooks/queries/queryKeys.d.ts +5 -0
- package/lib/typescript/module/ui/hooks/queries/queryKeys.d.ts.map +1 -1
- package/lib/typescript/module/ui/hooks/queries/useFileQueries.d.ts +11 -1
- package/lib/typescript/module/ui/hooks/queries/useFileQueries.d.ts.map +1 -1
- package/lib/typescript/module/ui/icons/MaterialCommunityIcons.d.ts +1 -1
- package/lib/typescript/module/ui/icons/MaterialCommunityIcons.d.ts.map +1 -1
- package/lib/typescript/module/ui/icons/subsetGlyphMaps.d.ts +1 -0
- package/lib/typescript/module/ui/icons/subsetGlyphMaps.d.ts.map +1 -1
- package/lib/typescript/module/ui/index.d.ts +2 -0
- package/lib/typescript/module/ui/index.d.ts.map +1 -1
- package/package.json +8 -6
- package/src/assets/fonts/icons/OxyServicesIonicons.ttf +0 -0
- package/src/assets/fonts/icons/OxyServicesMaterialCommunityIcons.ttf +0 -0
- package/src/assets/fonts/icons/manifest.json +5 -4
- package/src/index.ts +12 -0
- package/src/ui/appAssertion/AppAssertionContext.tsx +109 -0
- package/src/ui/appAssertion/appAssertionManager.ts +363 -0
- package/src/ui/appAssertion/appIntegrityPlatform.native.ts +27 -0
- package/src/ui/appAssertion/appIntegrityPlatform.ts +12 -0
- package/src/ui/appAssertion/appIntegrityTypes.ts +23 -0
- package/src/ui/components/fileManagement/FileAppAccessSection.tsx +111 -0
- package/src/ui/components/fileManagement/FileDetailsModal.tsx +5 -1
- package/src/ui/context/OxyContext.tsx +13 -1
- package/src/ui/hooks/mutations/mutationKeys.ts +5 -0
- package/src/ui/hooks/mutations/useAccountMutations.ts +33 -0
- package/src/ui/hooks/queries/queryKeys.ts +5 -0
- package/src/ui/hooks/queries/useFileQueries.ts +44 -2
- package/src/ui/icons/subsetGlyphMaps.ts +1 -0
- package/src/ui/index.ts +2 -0
|
@@ -0,0 +1,304 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The app's assertion of which app it is (ADR 0045), obtained and refreshed for
|
|
5
|
+
* the signed-in session without any app code.
|
|
6
|
+
*
|
|
7
|
+
* One manager per `OxyProvider`. For the active session it resolves the app's
|
|
8
|
+
* application id from its registered `clientId`, proves the app by platform —
|
|
9
|
+
* the browser's `Origin` on the web, Play Integrity on Android, App Attest on
|
|
10
|
+
* iOS — trades the proof for an Oxy-signed `OXY-APP+JWT`, and refreshes it a
|
|
11
|
+
* minute before it expires. A session change drops the assertion at once: an
|
|
12
|
+
* assertion names exactly one person and one session.
|
|
13
|
+
*
|
|
14
|
+
* Outcomes are values, never thrown: `ready`, `unsupported` (this build cannot
|
|
15
|
+
* prove itself: no `clientId`, no native module, App Attest unavailable) or
|
|
16
|
+
* `unavailable` (Oxy refused or could not be reached). A refusal that will not
|
|
17
|
+
* change for this session (an unregistered origin or platform) is not retried
|
|
18
|
+
* until the session changes; anything else is retried with a backoff.
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
import { OXY_APP_ASSERTION_HEADER } from '@oxy.so/contracts/client';
|
|
22
|
+
/** Refresh this long before expiry. */
|
|
23
|
+
const REFRESH_BEFORE_MS = 60_000;
|
|
24
|
+
/** `getAppAssertion()` fetches anew when less than this is left. */
|
|
25
|
+
const MIN_REMAINING_MS = 30_000;
|
|
26
|
+
const RETRY_FIRST_MS = 30_000;
|
|
27
|
+
const RETRY_MAX_MS = 15 * 60_000;
|
|
28
|
+
|
|
29
|
+
/** Refusals that will not change for this session. */
|
|
30
|
+
const PERMANENT_REFUSALS = new Set(['application_unavailable', 'session_other_application', 'platform_not_registered', 'origin_not_registered', 'integrity_unconfigured']);
|
|
31
|
+
const IDLE = {
|
|
32
|
+
status: 'idle',
|
|
33
|
+
assertion: null,
|
|
34
|
+
applicationId: null,
|
|
35
|
+
platform: null,
|
|
36
|
+
expiresAt: null,
|
|
37
|
+
error: null
|
|
38
|
+
};
|
|
39
|
+
class Unsupported extends Error {
|
|
40
|
+
constructor(reason) {
|
|
41
|
+
super(reason);
|
|
42
|
+
this.reason = reason;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
function errorCode(error) {
|
|
46
|
+
if (error instanceof Unsupported) return error.reason;
|
|
47
|
+
const code = error?.code;
|
|
48
|
+
return typeof code === 'string' && code.length > 0 ? code : 'request_failed';
|
|
49
|
+
}
|
|
50
|
+
export class AppAssertionManager {
|
|
51
|
+
snapshot = IDLE;
|
|
52
|
+
listeners = new Set();
|
|
53
|
+
session = null;
|
|
54
|
+
/** Bumped on every session change; a result for an older generation is dropped. */
|
|
55
|
+
generation = 0;
|
|
56
|
+
inflight = null;
|
|
57
|
+
timer = null;
|
|
58
|
+
retryMs = RETRY_FIRST_MS;
|
|
59
|
+
retryAt = 0;
|
|
60
|
+
applicationId = null;
|
|
61
|
+
preparedProject = null;
|
|
62
|
+
constructor(options) {
|
|
63
|
+
this.options = options;
|
|
64
|
+
this.now = options.now ?? Date.now;
|
|
65
|
+
this.setTimer = options.setTimer ?? ((run, ms) => setTimeout(run, ms));
|
|
66
|
+
this.clearTimer = options.clearTimer ?? (timer => clearTimeout(timer));
|
|
67
|
+
}
|
|
68
|
+
subscribe = listener => {
|
|
69
|
+
this.listeners.add(listener);
|
|
70
|
+
return () => {
|
|
71
|
+
this.listeners.delete(listener);
|
|
72
|
+
};
|
|
73
|
+
};
|
|
74
|
+
getSnapshot = () => this.snapshot;
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* A current assertion for the active session, obtaining one when there is
|
|
78
|
+
* none or it is about to expire; `null` when this app cannot have one now.
|
|
79
|
+
*/
|
|
80
|
+
getAppAssertion = async () => {
|
|
81
|
+
const current = this.snapshot;
|
|
82
|
+
if (current.status === 'ready' && current.assertion && current.expiresAt !== null && current.expiresAt - this.now() > MIN_REMAINING_MS) {
|
|
83
|
+
return current.assertion;
|
|
84
|
+
}
|
|
85
|
+
if (!this.session || current.status === 'unsupported') return null;
|
|
86
|
+
if (current.status === 'unavailable' && this.now() < this.retryAt) return null;
|
|
87
|
+
return this.refresh();
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* `{ 'X-Oxy-App-Assertion': <assertion> }` for a request to a service that
|
|
92
|
+
* needs to know the app (Alia), or `{}` when there is none.
|
|
93
|
+
*/
|
|
94
|
+
getAppAssertionHeaders = async () => {
|
|
95
|
+
const assertion = await this.getAppAssertion();
|
|
96
|
+
return assertion ? {
|
|
97
|
+
[OXY_APP_ASSERTION_HEADER]: assertion
|
|
98
|
+
} : {};
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
/** Follow the active session; `null` when signed out or not yet able to call Oxy. */
|
|
102
|
+
setSession(session) {
|
|
103
|
+
const same = session?.userId === this.session?.userId && session?.sessionId === this.session?.sessionId;
|
|
104
|
+
if (same) return;
|
|
105
|
+
this.session = session;
|
|
106
|
+
this.generation += 1;
|
|
107
|
+
this.inflight = null;
|
|
108
|
+
this.retryMs = RETRY_FIRST_MS;
|
|
109
|
+
this.retryAt = 0;
|
|
110
|
+
this.cancelTimer();
|
|
111
|
+
this.publish(IDLE);
|
|
112
|
+
if (session) void this.refresh();
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/** Stop all work. A later `setSession` starts again. */
|
|
116
|
+
dispose() {
|
|
117
|
+
this.session = null;
|
|
118
|
+
this.generation += 1;
|
|
119
|
+
this.inflight = null;
|
|
120
|
+
this.cancelTimer();
|
|
121
|
+
}
|
|
122
|
+
refresh() {
|
|
123
|
+
if (this.inflight) return this.inflight;
|
|
124
|
+
const generation = this.generation;
|
|
125
|
+
const run = this.obtain().then(answer => {
|
|
126
|
+
if (generation !== this.generation) return null;
|
|
127
|
+
const expiresAt = Date.parse(answer.expiresAt);
|
|
128
|
+
this.retryMs = RETRY_FIRST_MS;
|
|
129
|
+
this.publish({
|
|
130
|
+
status: 'ready',
|
|
131
|
+
assertion: answer.assertion,
|
|
132
|
+
applicationId: answer.applicationId,
|
|
133
|
+
platform: answer.platform,
|
|
134
|
+
expiresAt,
|
|
135
|
+
error: null
|
|
136
|
+
});
|
|
137
|
+
this.schedule(Math.max(expiresAt - this.now() - REFRESH_BEFORE_MS, MIN_REMAINING_MS));
|
|
138
|
+
return answer.assertion;
|
|
139
|
+
}).catch(error => {
|
|
140
|
+
if (generation !== this.generation) return null;
|
|
141
|
+
const code = errorCode(error);
|
|
142
|
+
const unsupported = error instanceof Unsupported;
|
|
143
|
+
const current = this.snapshot;
|
|
144
|
+
if (!unsupported && !PERMANENT_REFUSALS.has(code) && current.status === 'ready' && current.expiresAt !== null && current.expiresAt - this.now() > MIN_REMAINING_MS) {
|
|
145
|
+
// The assertion in hand is still good: keep it, and try again soon.
|
|
146
|
+
this.schedule(Math.min(RETRY_FIRST_MS, current.expiresAt - this.now() - MIN_REMAINING_MS));
|
|
147
|
+
return current.assertion;
|
|
148
|
+
}
|
|
149
|
+
this.publish({
|
|
150
|
+
...IDLE,
|
|
151
|
+
status: unsupported ? 'unsupported' : 'unavailable',
|
|
152
|
+
platform: this.options.integrity.platform,
|
|
153
|
+
error: code
|
|
154
|
+
});
|
|
155
|
+
if (!unsupported) {
|
|
156
|
+
if (PERMANENT_REFUSALS.has(code)) {
|
|
157
|
+
this.retryAt = Number.POSITIVE_INFINITY;
|
|
158
|
+
} else {
|
|
159
|
+
this.retryAt = this.now() + this.retryMs;
|
|
160
|
+
this.schedule(this.retryMs);
|
|
161
|
+
this.retryMs = Math.min(this.retryMs * 2, RETRY_MAX_MS);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
return null;
|
|
165
|
+
}).finally(() => {
|
|
166
|
+
if (this.inflight === run) this.inflight = null;
|
|
167
|
+
});
|
|
168
|
+
this.inflight = run;
|
|
169
|
+
if (this.snapshot.status !== 'ready') this.publish({
|
|
170
|
+
...this.snapshot,
|
|
171
|
+
status: 'pending'
|
|
172
|
+
});
|
|
173
|
+
return run;
|
|
174
|
+
}
|
|
175
|
+
async obtain() {
|
|
176
|
+
const applicationId = await this.resolveApplicationId();
|
|
177
|
+
const {
|
|
178
|
+
platform
|
|
179
|
+
} = this.options.integrity;
|
|
180
|
+
const assertions = this.options.oxyServices.apps.assertions;
|
|
181
|
+
if (platform === 'web') return assertions.create({
|
|
182
|
+
applicationId,
|
|
183
|
+
platform: 'web'
|
|
184
|
+
});
|
|
185
|
+
const integrity = await this.options.integrity.loadIntegrity();
|
|
186
|
+
if (!integrity) throw new Unsupported('integrity_module_unavailable');
|
|
187
|
+
if (platform === 'android') return this.proveAndroid(applicationId, integrity);
|
|
188
|
+
if (!integrity.isSupported) throw new Unsupported('app_attest_unsupported');
|
|
189
|
+
return this.proveIos(applicationId, integrity);
|
|
190
|
+
}
|
|
191
|
+
resolveApplicationId() {
|
|
192
|
+
const clientId = this.options.clientId;
|
|
193
|
+
if (!clientId) return Promise.reject(new Unsupported('client_id_missing'));
|
|
194
|
+
if (this.applicationId?.clientId !== clientId) {
|
|
195
|
+
const id = this.options.oxyServices.apps.getPublic(clientId).then(app => app.id);
|
|
196
|
+
id.catch(() => {
|
|
197
|
+
if (this.applicationId?.id === id) this.applicationId = null;
|
|
198
|
+
});
|
|
199
|
+
this.applicationId = {
|
|
200
|
+
clientId,
|
|
201
|
+
id
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
return this.applicationId.id;
|
|
205
|
+
}
|
|
206
|
+
async proveAndroid(applicationId, integrity) {
|
|
207
|
+
const assertions = this.options.oxyServices.apps.assertions;
|
|
208
|
+
const challenge = await assertions.challenge({
|
|
209
|
+
applicationId,
|
|
210
|
+
platform: 'android'
|
|
211
|
+
});
|
|
212
|
+
if (!challenge.cloudProjectNumber) throw new Unsupported('integrity_unconfigured');
|
|
213
|
+
try {
|
|
214
|
+
if (this.preparedProject !== challenge.cloudProjectNumber) {
|
|
215
|
+
await integrity.prepareIntegrityTokenProviderAsync(challenge.cloudProjectNumber);
|
|
216
|
+
this.preparedProject = challenge.cloudProjectNumber;
|
|
217
|
+
}
|
|
218
|
+
const integrityToken = await integrity.requestIntegrityCheckAsync(challenge.requestHash);
|
|
219
|
+
return await assertions.create({
|
|
220
|
+
applicationId,
|
|
221
|
+
platform: 'android',
|
|
222
|
+
proof: {
|
|
223
|
+
challenge: challenge.challenge,
|
|
224
|
+
integrityToken
|
|
225
|
+
}
|
|
226
|
+
});
|
|
227
|
+
} catch (error) {
|
|
228
|
+
// A provider Google invalidated is prepared again on the next attempt.
|
|
229
|
+
this.preparedProject = null;
|
|
230
|
+
throw error;
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
async proveIos(applicationId, integrity) {
|
|
234
|
+
const keyName = `${this.options.storageKeyPrefix}_app_attest_key_${applicationId}`;
|
|
235
|
+
const storage = this.options.storage();
|
|
236
|
+
const assertOnce = async keyId => {
|
|
237
|
+
const assertions = this.options.oxyServices.apps.assertions;
|
|
238
|
+
const challenge = await assertions.challenge({
|
|
239
|
+
applicationId,
|
|
240
|
+
platform: 'ios',
|
|
241
|
+
purpose: 'assertion'
|
|
242
|
+
});
|
|
243
|
+
const assertion = await integrity.generateAssertionAsync(keyId, challenge.requestHash);
|
|
244
|
+
return assertions.create({
|
|
245
|
+
applicationId,
|
|
246
|
+
platform: 'ios',
|
|
247
|
+
proof: {
|
|
248
|
+
challenge: challenge.challenge,
|
|
249
|
+
keyId,
|
|
250
|
+
assertion
|
|
251
|
+
}
|
|
252
|
+
});
|
|
253
|
+
};
|
|
254
|
+
const stored = await storage?.getItem(keyName).catch(() => null);
|
|
255
|
+
if (stored) {
|
|
256
|
+
try {
|
|
257
|
+
return await assertOnce(stored);
|
|
258
|
+
} catch (error) {
|
|
259
|
+
// Oxy no longer knows the key (swept, or never registered): attest a new one.
|
|
260
|
+
if (errorCode(error) !== 'attest_key_unknown') throw error;
|
|
261
|
+
await storage?.removeItem(keyName).catch(() => undefined);
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
const keyId = await this.attestKey(applicationId, integrity);
|
|
265
|
+
await storage?.setItem(keyName, keyId).catch(() => undefined);
|
|
266
|
+
return assertOnce(keyId);
|
|
267
|
+
}
|
|
268
|
+
async attestKey(applicationId, integrity) {
|
|
269
|
+
const assertions = this.options.oxyServices.apps.assertions;
|
|
270
|
+
const keyId = await integrity.generateKeyAsync();
|
|
271
|
+
const challenge = await assertions.challenge({
|
|
272
|
+
applicationId,
|
|
273
|
+
platform: 'ios',
|
|
274
|
+
purpose: 'attest_key'
|
|
275
|
+
});
|
|
276
|
+
const attestation = await integrity.attestKeyAsync(keyId, challenge.requestHash);
|
|
277
|
+
await assertions.registerAttestKey({
|
|
278
|
+
applicationId,
|
|
279
|
+
keyId,
|
|
280
|
+
challenge: challenge.challenge,
|
|
281
|
+
attestation
|
|
282
|
+
});
|
|
283
|
+
return keyId;
|
|
284
|
+
}
|
|
285
|
+
schedule(ms) {
|
|
286
|
+
this.cancelTimer();
|
|
287
|
+
const generation = this.generation;
|
|
288
|
+
this.timer = this.setTimer(() => {
|
|
289
|
+
this.timer = null;
|
|
290
|
+
if (generation === this.generation && this.session) void this.refresh();
|
|
291
|
+
}, ms);
|
|
292
|
+
}
|
|
293
|
+
cancelTimer() {
|
|
294
|
+
if (this.timer !== null) {
|
|
295
|
+
this.clearTimer(this.timer);
|
|
296
|
+
this.timer = null;
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
publish(next) {
|
|
300
|
+
this.snapshot = next;
|
|
301
|
+
for (const listener of this.listeners) listener();
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
//# sourceMappingURL=appAssertionManager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["OXY_APP_ASSERTION_HEADER","REFRESH_BEFORE_MS","MIN_REMAINING_MS","RETRY_FIRST_MS","RETRY_MAX_MS","PERMANENT_REFUSALS","Set","IDLE","status","assertion","applicationId","platform","expiresAt","error","Unsupported","Error","constructor","reason","errorCode","code","length","AppAssertionManager","snapshot","listeners","session","generation","inflight","timer","retryMs","retryAt","preparedProject","options","now","Date","setTimer","run","ms","setTimeout","clearTimer","clearTimeout","subscribe","listener","add","delete","getSnapshot","getAppAssertion","current","refresh","getAppAssertionHeaders","setSession","same","userId","sessionId","cancelTimer","publish","dispose","obtain","then","answer","parse","schedule","Math","max","catch","unsupported","has","min","integrity","Number","POSITIVE_INFINITY","finally","resolveApplicationId","assertions","oxyServices","apps","create","loadIntegrity","proveAndroid","isSupported","proveIos","clientId","Promise","reject","id","getPublic","app","challenge","cloudProjectNumber","prepareIntegrityTokenProviderAsync","integrityToken","requestIntegrityCheckAsync","requestHash","proof","keyName","storageKeyPrefix","storage","assertOnce","keyId","purpose","generateAssertionAsync","stored","getItem","removeItem","undefined","attestKey","setItem","generateKeyAsync","attestation","attestKeyAsync","registerAttestKey","next"],"sourceRoot":"../../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CAACX,KAAK,CAAC;MAC3B,IAAI,CAACA,KAAK,GAAG,IAAI;IACnB;EACF;EAEQ2B,OAAOA,CAACwD,IAA0B,EAAQ;IAChD,IAAI,CAACxF,QAAQ,GAAGwF,IAAI;IACpB,KAAK,MAAMrE,QAAQ,IAAI,IAAI,CAAClB,SAAS,EAAEkB,QAAQ,CAAC,CAAC;EACnD;AACF","ignoreList":[]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Web: the app proves itself with the browser's `Origin`, which Oxy reads from
|
|
5
|
+
* the request itself (ADR 0045). Nothing to load.
|
|
6
|
+
*
|
|
7
|
+
* Native builds resolve `appIntegrityPlatform.native.ts` instead.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
export const appIntegrityPlatform = {
|
|
11
|
+
platform: 'web',
|
|
12
|
+
loadIntegrity: async () => null
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=appIntegrityPlatform.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["appIntegrityPlatform","platform","loadIntegrity"],"sourceRoot":"../../../../src","sources":["ui/appAssertion/appIntegrityPlatform.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;;AAGA,OAAO,MAAMA,oBAA0C,GAAG;EACxDC,QAAQ,EAAE,KAAK;EACfC,aAAa,EAAE,MAAAA,CAAA,KAAY;AAC7B,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* iOS and Android: the app proves itself with App Attest or Play Integrity
|
|
5
|
+
* through `@expo/app-integrity` (ADR 0045).
|
|
6
|
+
*
|
|
7
|
+
* The module is loaded lazily, and its `import()` is a direct statement of a
|
|
8
|
+
* `try` block — the shape Metro marks OPTIONAL — so an app bundle that lacks
|
|
9
|
+
* the package, or a binary built before it was added (an over-the-air update
|
|
10
|
+
* of the JavaScript alone), still boots: `requireNativeModule` throws inside
|
|
11
|
+
* the import, and the app simply has no assertion.
|
|
12
|
+
*/
|
|
13
|
+
import { Platform } from 'react-native';
|
|
14
|
+
async function loadIntegrity() {
|
|
15
|
+
try {
|
|
16
|
+
const integrity = await import('@expo/app-integrity');
|
|
17
|
+
return integrity;
|
|
18
|
+
} catch {
|
|
19
|
+
return null;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
export const appIntegrityPlatform = {
|
|
23
|
+
platform: Platform.OS === 'ios' ? 'ios' : Platform.OS === 'android' ? 'android' : 'web',
|
|
24
|
+
loadIntegrity: Platform.OS === 'ios' || Platform.OS === 'android' ? loadIntegrity : async () => null
|
|
25
|
+
};
|
|
26
|
+
//# sourceMappingURL=appIntegrityPlatform.native.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["Platform","loadIntegrity","integrity","appIntegrityPlatform","platform","OS"],"sourceRoot":"../../../../src","sources":["ui/appAssertion/appIntegrityPlatform.native.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,QAAQ,QAAQ,cAAc;AAGvC,eAAeC,aAAaA,CAAA,EAAuC;EACjE,IAAI;IACF,MAAMC,SAAS,GAAG,MAAM,MAAM,CAAC,qBAAqB,CAAC;IACrD,OAAOA,SAAS;EAClB,CAAC,CAAC,MAAM;IACN,OAAO,IAAI;EACb;AACF;AAEA,OAAO,MAAMC,oBAA0C,GAAG;EACxDC,QAAQ,EAAEJ,QAAQ,CAACK,EAAE,KAAK,KAAK,GAAG,KAAK,GAAGL,QAAQ,CAACK,EAAE,KAAK,SAAS,GAAG,SAAS,GAAG,KAAK;EACvFJ,aAAa,EACXD,QAAQ,CAACK,EAAE,KAAK,KAAK,IAAIL,QAAQ,CAACK,EAAE,KAAK,SAAS,GAAGJ,aAAa,GAAG,YAAY;AACrF,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../../src","sources":["ui/appAssertion/appIntegrityTypes.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { useCallback, useState } from 'react';
|
|
4
|
+
import { ActivityIndicator, View } from 'react-native';
|
|
5
|
+
import { Avatar } from '@oxy.so/bloom/avatar';
|
|
6
|
+
import { Button } from '@oxy.so/bloom/button';
|
|
7
|
+
import { SettingsListGroup, SettingsListItem } from '@oxy.so/bloom/settings-list';
|
|
8
|
+
import { surfaces } from '@oxy.so/bloom/surfaces';
|
|
9
|
+
import { useTheme } from '@oxy.so/bloom/theme';
|
|
10
|
+
import { toast } from '@oxy.so/bloom/toast';
|
|
11
|
+
import { Text } from '@oxy.so/bloom/typography';
|
|
12
|
+
import { useI18n } from "../../hooks/useI18n.js";
|
|
13
|
+
import { useFileAppAccess } from "../../hooks/queries/useFileQueries.js";
|
|
14
|
+
import { useRevokeFileAppAccess } from "../../hooks/mutations/useAccountMutations.js";
|
|
15
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
16
|
+
const APP_ICON_SIZE = 32;
|
|
17
|
+
/**
|
|
18
|
+
* "Apps with access" (ADR 0043 stage 4c): the applications that can open this
|
|
19
|
+
* file on their own — one that stored it for the person (`upload`), one the
|
|
20
|
+
* person attached it to (`link`) — each with a Revoke action behind a
|
|
21
|
+
* confirmation. Revoking stops the application reading the file and every
|
|
22
|
+
* playback it started; the row leaves the list at once and comes back if the
|
|
23
|
+
* revoke fails. Shown only on the owner's own file.
|
|
24
|
+
*/
|
|
25
|
+
export const FileAppAccessSection = ({
|
|
26
|
+
fileId
|
|
27
|
+
}) => {
|
|
28
|
+
const {
|
|
29
|
+
t
|
|
30
|
+
} = useI18n();
|
|
31
|
+
const {
|
|
32
|
+
colors
|
|
33
|
+
} = useTheme();
|
|
34
|
+
const {
|
|
35
|
+
data: apps,
|
|
36
|
+
isLoading,
|
|
37
|
+
isError
|
|
38
|
+
} = useFileAppAccess(fileId);
|
|
39
|
+
const revoke = useRevokeFileAppAccess();
|
|
40
|
+
const [revokingId, setRevokingId] = useState(null);
|
|
41
|
+
const confirmRevoke = useCallback(async app => {
|
|
42
|
+
const confirmed = await surfaces.confirm({
|
|
43
|
+
title: t('fileManagement.appAccess.confirm.title', {
|
|
44
|
+
name: app.name
|
|
45
|
+
}),
|
|
46
|
+
description: t('fileManagement.appAccess.confirm.message', {
|
|
47
|
+
name: app.name
|
|
48
|
+
}),
|
|
49
|
+
confirmLabel: t('fileManagement.appAccess.revoke'),
|
|
50
|
+
cancelLabel: t('common.cancel'),
|
|
51
|
+
destructive: true
|
|
52
|
+
});
|
|
53
|
+
if (!confirmed) return;
|
|
54
|
+
setRevokingId(app.applicationId);
|
|
55
|
+
try {
|
|
56
|
+
await revoke.mutateAsync({
|
|
57
|
+
fileId,
|
|
58
|
+
applicationId: app.applicationId
|
|
59
|
+
});
|
|
60
|
+
toast.success(t('fileManagement.appAccess.toasts.revoked', {
|
|
61
|
+
name: app.name
|
|
62
|
+
}));
|
|
63
|
+
} catch {
|
|
64
|
+
toast.error(t('fileManagement.appAccess.toasts.revokeFailed', {
|
|
65
|
+
name: app.name
|
|
66
|
+
}));
|
|
67
|
+
} finally {
|
|
68
|
+
setRevokingId(null);
|
|
69
|
+
}
|
|
70
|
+
}, [fileId, revoke, t]);
|
|
71
|
+
const viaText = app => app.via.map(via => t(`fileManagement.appAccess.via.${via}`)).join(' · ');
|
|
72
|
+
return /*#__PURE__*/_jsxs(View, {
|
|
73
|
+
className: "w-full mb-space-24",
|
|
74
|
+
children: [/*#__PURE__*/_jsx(Text, {
|
|
75
|
+
className: "text-text text-[16px] font-semibold mb-space-4",
|
|
76
|
+
children: t('fileManagement.appAccess.title')
|
|
77
|
+
}), /*#__PURE__*/_jsx(Text, {
|
|
78
|
+
className: "text-text-secondary text-[14px] mb-space-12",
|
|
79
|
+
children: t('fileManagement.appAccess.description')
|
|
80
|
+
}), isLoading ? /*#__PURE__*/_jsx(ActivityIndicator, {
|
|
81
|
+
color: colors.primary
|
|
82
|
+
}) : isError ? /*#__PURE__*/_jsx(Text, {
|
|
83
|
+
className: "text-text-secondary text-[14px]",
|
|
84
|
+
children: t('fileManagement.appAccess.loadError')
|
|
85
|
+
}) : !apps || apps.length === 0 ? /*#__PURE__*/_jsx(Text, {
|
|
86
|
+
className: "text-text-secondary text-[14px]",
|
|
87
|
+
children: t('fileManagement.appAccess.empty')
|
|
88
|
+
}) : /*#__PURE__*/_jsx(SettingsListGroup, {
|
|
89
|
+
children: apps.map(app => /*#__PURE__*/_jsx(SettingsListItem, {
|
|
90
|
+
icon: /*#__PURE__*/_jsx(Avatar, {
|
|
91
|
+
source: app.icon,
|
|
92
|
+
name: app.name,
|
|
93
|
+
size: APP_ICON_SIZE
|
|
94
|
+
}),
|
|
95
|
+
title: app.name,
|
|
96
|
+
description: viaText(app),
|
|
97
|
+
showChevron: false,
|
|
98
|
+
rightElement: /*#__PURE__*/_jsx(Button, {
|
|
99
|
+
appearance: "subtle",
|
|
100
|
+
tone: "danger",
|
|
101
|
+
size: "sm",
|
|
102
|
+
loading: revokingId === app.applicationId,
|
|
103
|
+
disabled: revokingId !== null,
|
|
104
|
+
accessibilityLabel: t('fileManagement.appAccess.a11y.revoke', {
|
|
105
|
+
name: app.name
|
|
106
|
+
}),
|
|
107
|
+
onPress: () => {
|
|
108
|
+
void confirmRevoke(app);
|
|
109
|
+
},
|
|
110
|
+
children: t('fileManagement.appAccess.revoke')
|
|
111
|
+
})
|
|
112
|
+
}, app.applicationId))
|
|
113
|
+
})]
|
|
114
|
+
});
|
|
115
|
+
};
|
|
116
|
+
//# sourceMappingURL=FileAppAccessSection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useCallback","useState","ActivityIndicator","View","Avatar","Button","SettingsListGroup","SettingsListItem","surfaces","useTheme","toast","Text","useI18n","useFileAppAccess","useRevokeFileAppAccess","jsx","_jsx","jsxs","_jsxs","APP_ICON_SIZE","FileAppAccessSection","fileId","t","colors","data","apps","isLoading","isError","revoke","revokingId","setRevokingId","confirmRevoke","app","confirmed","confirm","title","name","description","confirmLabel","cancelLabel","destructive","applicationId","mutateAsync","success","error","viaText","via","map","join","className","children","color","primary","length","icon","source","size","showChevron","rightElement","appearance","tone","loading","disabled","accessibilityLabel","onPress"],"sourceRoot":"../../../../../src","sources":["ui/components/fileManagement/FileAppAccessSection.tsx"],"mappings":";;AACA,SAASA,WAAW,EAAEC,QAAQ,QAAQ,OAAO;AAC7C,SAASC,iBAAiB,EAAEC,IAAI,QAAQ,cAAc;AACtD,SAASC,MAAM,QAAQ,sBAAsB;AAC7C,SAASC,MAAM,QAAQ,sBAAsB;AAC7C,SAASC,iBAAiB,EAAEC,gBAAgB,QAAQ,6BAA6B;AACjF,SAASC,QAAQ,QAAQ,wBAAwB;AACjD,SAASC,QAAQ,QAAQ,qBAAqB;AAC9C,SAASC,KAAK,QAAQ,qBAAqB;AAC3C,SAASC,IAAI,QAAQ,0BAA0B;AAE/C,SAASC,OAAO,QAAQ,wBAAqB;AAC7C,SAASC,gBAAgB,QAAQ,uCAAoC;AACrE,SAASC,sBAAsB,QAAQ,8CAA2C;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAEnF,MAAMC,aAAa,GAAG,EAAE;AAMxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,oBAAyD,GAAGA,CAAC;EAAEC;AAAO,CAAC,KAAK;EACvF,MAAM;IAAEC;EAAE,CAAC,GAAGV,OAAO,CAAC,CAAC;EACvB,MAAM;IAAEW;EAAO,CAAC,GAAGd,QAAQ,CAAC,CAAC;EAC7B,MAAM;IAAEe,IAAI,EAAEC,IAAI;IAAEC,SAAS;IAAEC;EAAQ,CAAC,GAAGd,gBAAgB,CAACQ,MAAM,CAAC;EACnE,MAA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ACnBC,IAAI,EAAC,QAAQ;UACbJ,IAAI,EAAC,IAAI;UACTK,OAAO,EAAEhC,UAAU,KAAKG,GAAG,CAACS,aAAc;UAC1CqB,QAAQ,EAAEjC,UAAU,KAAK,IAAK;UAC9BkC,kBAAkB,EAAEzC,CAAC,CAAC,sCAAsC,EAAE;YAAEc,IAAI,EAAEJ,GAAG,CAACI;UAAK,CAAC,CAAE;UAClF4B,OAAO,EAAEA,CAAA,KAAM;YACb,KAAKjC,aAAa,CAACC,GAAG,CAAC;UACzB,CAAE;UAAAkB,QAAA,EAED5B,CAAC,CAAC,iCAAiC;QAAC,CAC/B;MACT,GAnBIU,GAAG,CAACS,aAoBV,CACF;IAAC,CACe,CACpB;EAAA,CACG,CAAC;AAEX,CAAC","ignoreList":[]}
|
|
@@ -9,10 +9,12 @@ import { useTheme } from '@oxy.so/bloom/theme';
|
|
|
9
9
|
import { surfaces } from '@oxy.so/bloom/surfaces';
|
|
10
10
|
import { useI18n } from "../../hooks/useI18n.js";
|
|
11
11
|
import { formatFileSize, getFileIcon } from "../../utils/fileManagement.js";
|
|
12
|
+
import { FileAppAccessSection } from "./FileAppAccessSection.js";
|
|
12
13
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
14
|
/**
|
|
14
15
|
* File-detail panel — a rich presented surface (NOT a yes/no confirm): a file's
|
|
15
|
-
* icon + metadata
|
|
16
|
+
* icon + metadata, for the owner the applications that can open it ("Apps with
|
|
17
|
+
* access", ADR 0043 stage 4c), plus download / delete / cancel actions. Each action first
|
|
16
18
|
* dismisses this surface, then runs its handler, so a follow-up delete confirm
|
|
17
19
|
* stacks cleanly above whatever remains. Presented via {@link presentFileDetails}.
|
|
18
20
|
*/
|
|
@@ -82,7 +84,9 @@ export const FileDetailsModal = ({
|
|
|
82
84
|
children: file.metadata.description
|
|
83
85
|
})]
|
|
84
86
|
})]
|
|
85
|
-
})
|
|
87
|
+
}), isOwner ? /*#__PURE__*/_jsx(FileAppAccessSection, {
|
|
88
|
+
fileId: file.id
|
|
89
|
+
}) : null]
|
|
86
90
|
}), /*#__PURE__*/_jsxs(View, {
|
|
87
91
|
style: {
|
|
88
92
|
gap: 8
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["View","Card","Text","Ionicons","Button","useTheme","surfaces","useI18n","formatFileSize","getFileIcon","jsx","_jsx","jsxs","_jsxs","FileDetailsModal","surface","file","onDownload","onDelete","isOwner","t","colors","children","appearance","className","name","contentType","size","color","primary","filename","length","Date","uploadDate","toLocaleString","metadata","description","style","gap","tone","onPress","dismiss","
|
|
1
|
+
{"version":3,"names":["View","Card","Text","Ionicons","Button","useTheme","surfaces","useI18n","formatFileSize","getFileIcon","FileAppAccessSection","jsx","_jsx","jsxs","_jsxs","FileDetailsModal","surface","file","onDownload","onDelete","isOwner","t","colors","children","appearance","className","name","contentType","size","color","primary","filename","length","Date","uploadDate","toLocaleString","metadata","description","fileId","id","style","gap","tone","onPress","dismiss","presentFileDetails","options","present"],"sourceRoot":"../../../../../src","sources":["ui/components/fileManagement/FileDetailsModal.tsx"],"mappings":";;AACA,SAASA,IAAI,QAAQ,cAAc;AACnC,SAASC,IAAI,QAAQ,oBAAoB;AACzC,SAASC,IAAI,QAAQ,0BAA0B;AAC/C,OAAOC,QAAQ,MAAM,yBAAsB;AAC3C,SAASC,MAAM,QAAQ,sBAAsB;AAC7C,SAASC,QAAQ,QAAQ,qBAAqB;AAC9C,SAASC,QAAQ,QAA8B,wBAAwB;AAEvE,SAASC,OAAO,QAAQ,wBAAqB;AAC7C,SAASC,cAAc,EAAEC,WAAW,QAAQ,+BAA4B;AACxE,SAASC,oBAAoB,QAAQ,2BAAwB;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAW9D;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,gBAAiD,GAAGA,CAAC;EAChEC,OAAO;EACPC,IAAI;EACJC,UAAU;EACVC,QAAQ;EAC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OAAO,CAAC,CAAC;UACjB1B,UAAU,CAACD,IAAI,CAACsB,EAAE,EAAEtB,IAAI,CAACc,QAAQ,CAAC;QACpC,CAAE;QAAAR,QAAA,EAEDF,CAAC,CAAC,iCAAiC;MAAC,CAC/B,CAAC,EACRD,OAAO,gBACNR,IAAA,CAACR,MAAM;QACLoB,UAAU,EAAC,OAAO;QAClBkB,IAAI,EAAC,QAAQ;QACbC,OAAO,EAAEA,CAAA,KAAM;UACb3B,OAAO,CAAC4B,OAAO,CAAC,CAAC;UACjBzB,QAAQ,CAACF,IAAI,CAACsB,EAAE,EAAEtB,IAAI,CAACc,QAAQ,CAAC;QAClC,CAAE;QAAAR,QAAA,EAEDF,CAAC,CAAC,uBAAuB;MAAC,CACrB,CAAC,GACP,IAAI,eACRT,IAAA,CAACR,MAAM;QAACoB,UAAU,EAAC,QAAQ;QAACkB,IAAI,EAAC,SAAS;QAACC,OAAO,EAAEA,CAAA,KAAM3B,OAAO,CAAC4B,OAAO,CAAC,CAAE;QAAArB,QAAA,EACzEF,CAAC,CAAC,eAAe;MAAC,CACb,CAAC;IAAA,CACL,CAAC;EAAA,CACH,CAAC;AAEX,CAAC;;AAED;;AAGA;AACA,OAAO,SAASwB,kBAAkBA,CAACC,OAAkC,EAAQ;EAC3E,KAAKxC,QAAQ,CAACyC,OAAO,CAAE/B,OAAO,iBAAKJ,IAAA,CAACG,gBAAgB;IAACC,OAAO,EAAEA,OAAQ;IAAA,GAAK8B;EAAO,CAAG,CAAC,CAAC;AACzF","ignoreList":[]}
|
|
@@ -46,6 +46,7 @@ import { useFollow } from "../hooks/useFollow.js";
|
|
|
46
46
|
import { commitDeviceSetAndResolve } from "./commitSessionFlow.js";
|
|
47
47
|
import { clearSignInFlows } from "../components/signIn/signInFlowStore.js";
|
|
48
48
|
import { useOxyAccountGraph } from "./useOxyAccountGraph.js";
|
|
49
|
+
import { AppAssertionProvider } from "../appAssertion/AppAssertionContext.js";
|
|
49
50
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
50
51
|
const OxyRuntimeContext = /*#__PURE__*/createContext(null);
|
|
51
52
|
const subscribeNever = () => () => undefined;
|
|
@@ -1395,7 +1396,15 @@ export const OxyRuntimeProvider = ({
|
|
|
1395
1396
|
value: authActionsValue,
|
|
1396
1397
|
children: /*#__PURE__*/_jsx(OxyRuntimeContext.Provider, {
|
|
1397
1398
|
value: contextValue,
|
|
1398
|
-
children:
|
|
1399
|
+
children: /*#__PURE__*/_jsx(AppAssertionProvider, {
|
|
1400
|
+
oxyServices: oxyServices,
|
|
1401
|
+
clientId: clientId,
|
|
1402
|
+
userId: canUsePrivateApi ? user?.id ?? null : null,
|
|
1403
|
+
sessionId: canUsePrivateApi ? activeSessionId : null,
|
|
1404
|
+
storage: storage,
|
|
1405
|
+
storageKeyPrefix: storageKeyPrefix,
|
|
1406
|
+
children: children
|
|
1407
|
+
})
|
|
1399
1408
|
})
|
|
1400
1409
|
})
|
|
1401
1410
|
});
|