@oxy.so/services 11.5.0 → 11.6.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 (126) hide show
  1. package/lib/commonjs/ui/components/organizations/OrganizationClaimReview.js +2 -2
  2. package/lib/commonjs/ui/components/organizations/OrganizationClaimReview.js.map +1 -1
  3. package/lib/commonjs/ui/components/organizations/OrganizationDirectorySearch.js +5 -5
  4. package/lib/commonjs/ui/components/organizations/OrganizationDirectorySearch.js.map +1 -1
  5. package/lib/commonjs/ui/components/organizations/OrganizationSettings.js +4 -4
  6. package/lib/commonjs/ui/components/organizations/OrganizationSettings.js.map +1 -1
  7. package/lib/commonjs/ui/components/organizations/OrganizationTypePicker.js +2 -2
  8. package/lib/commonjs/ui/components/organizations/OrganizationTypePicker.js.map +1 -1
  9. package/lib/commonjs/ui/components/signIn/OxyAuthenticatorPanel.js +3 -3
  10. package/lib/commonjs/ui/components/signIn/OxyAuthenticatorPanel.js.map +1 -1
  11. package/lib/commonjs/ui/components/signIn/OxyLinkCommonsPanel.js +6 -2
  12. package/lib/commonjs/ui/components/signIn/OxyLinkCommonsPanel.js.map +1 -1
  13. package/lib/commonjs/ui/components/signIn/OxyPasswordPanel.js +4 -4
  14. package/lib/commonjs/ui/components/signIn/OxyPasswordPanel.js.map +1 -1
  15. package/lib/commonjs/ui/components/signIn/OxySignInPanel.js +7 -7
  16. package/lib/commonjs/ui/components/signIn/OxySignInPanel.js.map +1 -1
  17. package/lib/commonjs/ui/components/signIn/OxySignUpPanel.js +6 -6
  18. package/lib/commonjs/ui/components/signIn/OxySignUpPanel.js.map +1 -1
  19. package/lib/commonjs/ui/components/signIn/ReauthStep.js +4 -4
  20. package/lib/commonjs/ui/components/signIn/ReauthStep.js.map +1 -1
  21. package/lib/commonjs/ui/components/signIn/accountFlowParts.js +23 -23
  22. package/lib/commonjs/ui/components/signIn/accountFlowParts.js.map +1 -1
  23. package/lib/commonjs/ui/context/OxyContext.js +7 -4
  24. package/lib/commonjs/ui/context/OxyContext.js.map +1 -1
  25. package/lib/commonjs/ui/context/hooks/useAuthOperations.js +5 -2
  26. package/lib/commonjs/ui/context/hooks/useAuthOperations.js.map +1 -1
  27. package/lib/commonjs/ui/oauth/applicationSessionLane.js +2 -2
  28. package/lib/commonjs/ui/oauth/applicationSessionLane.js.map +1 -1
  29. package/lib/commonjs/ui/screens/AccountSettingsScreen.js +3 -3
  30. package/lib/commonjs/ui/screens/AccountSettingsScreen.js.map +1 -1
  31. package/lib/commonjs/ui/screens/CreateAccountScreen.js +12 -12
  32. package/lib/commonjs/ui/screens/CreateAccountScreen.js.map +1 -1
  33. package/lib/commonjs/ui/utils/identityCrypto.js +19 -0
  34. package/lib/commonjs/ui/utils/identityCrypto.js.map +1 -0
  35. package/lib/module/ui/components/organizations/OrganizationClaimReview.js +2 -2
  36. package/lib/module/ui/components/organizations/OrganizationClaimReview.js.map +1 -1
  37. package/lib/module/ui/components/organizations/OrganizationDirectorySearch.js +5 -5
  38. package/lib/module/ui/components/organizations/OrganizationDirectorySearch.js.map +1 -1
  39. package/lib/module/ui/components/organizations/OrganizationSettings.js +4 -4
  40. package/lib/module/ui/components/organizations/OrganizationSettings.js.map +1 -1
  41. package/lib/module/ui/components/organizations/OrganizationTypePicker.js +1 -1
  42. package/lib/module/ui/components/organizations/OrganizationTypePicker.js.map +1 -1
  43. package/lib/module/ui/components/signIn/OxyAuthenticatorPanel.js +1 -1
  44. package/lib/module/ui/components/signIn/OxyAuthenticatorPanel.js.map +1 -1
  45. package/lib/module/ui/components/signIn/OxyLinkCommonsPanel.js +5 -1
  46. package/lib/module/ui/components/signIn/OxyLinkCommonsPanel.js.map +1 -1
  47. package/lib/module/ui/components/signIn/OxyPasswordPanel.js +1 -1
  48. package/lib/module/ui/components/signIn/OxyPasswordPanel.js.map +1 -1
  49. package/lib/module/ui/components/signIn/OxySignInPanel.js +1 -1
  50. package/lib/module/ui/components/signIn/OxySignInPanel.js.map +1 -1
  51. package/lib/module/ui/components/signIn/OxySignUpPanel.js +5 -5
  52. package/lib/module/ui/components/signIn/OxySignUpPanel.js.map +1 -1
  53. package/lib/module/ui/components/signIn/ReauthStep.js +1 -1
  54. package/lib/module/ui/components/signIn/ReauthStep.js.map +1 -1
  55. package/lib/module/ui/components/signIn/accountFlowParts.js +1 -1
  56. package/lib/module/ui/components/signIn/accountFlowParts.js.map +1 -1
  57. package/lib/module/ui/context/OxyContext.js +6 -3
  58. package/lib/module/ui/context/OxyContext.js.map +1 -1
  59. package/lib/module/ui/context/hooks/useAuthOperations.js +4 -1
  60. package/lib/module/ui/context/hooks/useAuthOperations.js.map +1 -1
  61. package/lib/module/ui/oauth/applicationSessionLane.js +2 -2
  62. package/lib/module/ui/oauth/applicationSessionLane.js.map +1 -1
  63. package/lib/module/ui/screens/AccountSettingsScreen.js +2 -2
  64. package/lib/module/ui/screens/AccountSettingsScreen.js.map +1 -1
  65. package/lib/module/ui/screens/CreateAccountScreen.js +6 -6
  66. package/lib/module/ui/screens/CreateAccountScreen.js.map +1 -1
  67. package/lib/module/ui/utils/identityCrypto.js +13 -0
  68. package/lib/module/ui/utils/identityCrypto.js.map +1 -0
  69. package/lib/typescript/commonjs/ui/components/organizations/OrganizationClaimReview.d.ts.map +1 -1
  70. package/lib/typescript/commonjs/ui/components/organizations/OrganizationDirectorySearch.d.ts +1 -1
  71. package/lib/typescript/commonjs/ui/components/organizations/OrganizationDirectorySearch.d.ts.map +1 -1
  72. package/lib/typescript/commonjs/ui/components/organizations/OrganizationSettings.d.ts.map +1 -1
  73. package/lib/typescript/commonjs/ui/components/organizations/OrganizationTypePicker.d.ts +1 -1
  74. package/lib/typescript/commonjs/ui/components/organizations/OrganizationTypePicker.d.ts.map +1 -1
  75. package/lib/typescript/commonjs/ui/components/signIn/OxyAuthenticatorPanel.d.ts.map +1 -1
  76. package/lib/typescript/commonjs/ui/components/signIn/OxyLinkCommonsPanel.d.ts.map +1 -1
  77. package/lib/typescript/commonjs/ui/components/signIn/OxySignInPanel.d.ts.map +1 -1
  78. package/lib/typescript/commonjs/ui/components/signIn/OxySignUpPanel.d.ts.map +1 -1
  79. package/lib/typescript/commonjs/ui/components/signIn/ReauthStep.d.ts +1 -1
  80. package/lib/typescript/commonjs/ui/components/signIn/ReauthStep.d.ts.map +1 -1
  81. package/lib/typescript/commonjs/ui/components/signIn/accountFlowParts.d.ts +1 -1
  82. package/lib/typescript/commonjs/ui/components/signIn/accountFlowParts.d.ts.map +1 -1
  83. package/lib/typescript/commonjs/ui/context/OxyContext.d.ts.map +1 -1
  84. package/lib/typescript/commonjs/ui/context/hooks/useAuthOperations.d.ts.map +1 -1
  85. package/lib/typescript/commonjs/ui/screens/AccountSettingsScreen.d.ts.map +1 -1
  86. package/lib/typescript/commonjs/ui/screens/CreateAccountScreen.d.ts.map +1 -1
  87. package/lib/typescript/commonjs/ui/utils/identityCrypto.d.ts +43 -0
  88. package/lib/typescript/commonjs/ui/utils/identityCrypto.d.ts.map +1 -0
  89. package/lib/typescript/module/ui/components/organizations/OrganizationClaimReview.d.ts.map +1 -1
  90. package/lib/typescript/module/ui/components/organizations/OrganizationDirectorySearch.d.ts +1 -1
  91. package/lib/typescript/module/ui/components/organizations/OrganizationDirectorySearch.d.ts.map +1 -1
  92. package/lib/typescript/module/ui/components/organizations/OrganizationSettings.d.ts.map +1 -1
  93. package/lib/typescript/module/ui/components/organizations/OrganizationTypePicker.d.ts +1 -1
  94. package/lib/typescript/module/ui/components/organizations/OrganizationTypePicker.d.ts.map +1 -1
  95. package/lib/typescript/module/ui/components/signIn/OxyAuthenticatorPanel.d.ts.map +1 -1
  96. package/lib/typescript/module/ui/components/signIn/OxyLinkCommonsPanel.d.ts.map +1 -1
  97. package/lib/typescript/module/ui/components/signIn/OxySignInPanel.d.ts.map +1 -1
  98. package/lib/typescript/module/ui/components/signIn/OxySignUpPanel.d.ts.map +1 -1
  99. package/lib/typescript/module/ui/components/signIn/ReauthStep.d.ts +1 -1
  100. package/lib/typescript/module/ui/components/signIn/ReauthStep.d.ts.map +1 -1
  101. package/lib/typescript/module/ui/components/signIn/accountFlowParts.d.ts +1 -1
  102. package/lib/typescript/module/ui/components/signIn/accountFlowParts.d.ts.map +1 -1
  103. package/lib/typescript/module/ui/context/OxyContext.d.ts.map +1 -1
  104. package/lib/typescript/module/ui/context/hooks/useAuthOperations.d.ts.map +1 -1
  105. package/lib/typescript/module/ui/screens/AccountSettingsScreen.d.ts.map +1 -1
  106. package/lib/typescript/module/ui/screens/CreateAccountScreen.d.ts.map +1 -1
  107. package/lib/typescript/module/ui/utils/identityCrypto.d.ts +43 -0
  108. package/lib/typescript/module/ui/utils/identityCrypto.d.ts.map +1 -0
  109. package/package.json +5 -5
  110. package/src/ui/components/organizations/OrganizationClaimReview.tsx +3 -5
  111. package/src/ui/components/organizations/OrganizationDirectorySearch.tsx +12 -9
  112. package/src/ui/components/organizations/OrganizationSettings.tsx +6 -9
  113. package/src/ui/components/organizations/OrganizationTypePicker.tsx +2 -1
  114. package/src/ui/components/signIn/OxyAuthenticatorPanel.tsx +2 -1
  115. package/src/ui/components/signIn/OxyLinkCommonsPanel.tsx +3 -1
  116. package/src/ui/components/signIn/OxyPasswordPanel.tsx +1 -1
  117. package/src/ui/components/signIn/OxySignInPanel.tsx +6 -4
  118. package/src/ui/components/signIn/OxySignUpPanel.tsx +6 -9
  119. package/src/ui/components/signIn/ReauthStep.tsx +2 -6
  120. package/src/ui/components/signIn/accountFlowParts.tsx +2 -2
  121. package/src/ui/context/OxyContext.tsx +7 -3
  122. package/src/ui/context/hooks/useAuthOperations.ts +2 -1
  123. package/src/ui/oauth/applicationSessionLane.ts +2 -2
  124. package/src/ui/screens/AccountSettingsScreen.tsx +6 -2
  125. package/src/ui/screens/CreateAccountScreen.tsx +10 -9
  126. package/src/ui/utils/identityCrypto.ts +10 -0
@@ -15,11 +15,8 @@ import type React from 'react';
15
15
  import { useEffect, useState } from 'react';
16
16
  import { Linking, Platform } from 'react-native';
17
17
  import { toast } from '@oxy.so/bloom/toast';
18
- import {
19
- SIGN_IN_ERROR_CODES,
20
- emailAddressSchema,
21
- type EmailVerificationConfirmResponse,
22
- } from '@oxy.so/contracts';
18
+ import type { EmailVerificationConfirmResponse } from '@oxy.so/contracts';
19
+ import { SIGN_IN_ERROR_CODES, emailAddressCheck, checkContract } from '@oxy.so/contracts/client';
23
20
  import { useOxy } from '../../context/OxyContext';
24
21
  import { useAccountDialogSnapshot } from '../../hooks/accountDialogSnapshot';
25
22
  import { useI18n } from '../../hooks/useI18n';
@@ -126,13 +123,13 @@ export const OxySignUpPanel: React.FC<OxySignUpPanelProps> = ({
126
123
  };
127
124
 
128
125
  const submitEmail = () => {
129
- const parsed = emailAddressSchema.safeParse(email);
130
- if (!parsed.success) {
126
+ const address = checkContract(emailAddressCheck, email);
127
+ if (address === null) {
131
128
  setError(t('signup.email.invalid'));
132
129
  return;
133
130
  }
134
- setEmail(parsed.data);
135
- run(() => sendCode(parsed.data));
131
+ setEmail(address);
132
+ run(() => sendCode(address));
136
133
  };
137
134
 
138
135
  // The code step reports this promise's failure in place.
@@ -8,12 +8,8 @@
8
8
 
9
9
  import type React from 'react';
10
10
  import { useState } from 'react';
11
- import {
12
- EMAIL_CODE_LENGTH,
13
- TOTP_DIGITS,
14
- type ReauthAction,
15
- type ReauthProof,
16
- } from '@oxy.so/contracts';
11
+ import type { ReauthAction, ReauthProof } from '@oxy.so/contracts';
12
+ import { EMAIL_CODE_LENGTH, TOTP_DIGITS } from '@oxy.so/contracts/client';
17
13
  import { useOxy } from '../../context/OxyContext';
18
14
  import { useI18n } from '../../hooks/useI18n';
19
15
  import { SubtleLink } from '../authChooser/primitives';
@@ -18,6 +18,7 @@ import { useTheme } from '@oxy.so/bloom/theme';
18
18
  import { TextField, TextFieldHint, TextFieldInput, TextFieldLabel } from '@oxy.so/bloom/text-field';
19
19
  import { Text } from '@oxy.so/bloom/typography';
20
20
  import { WizardProgress } from '@oxy.so/bloom/wizard';
21
+ import type { EmailVerificationConfirmResponse } from '@oxy.so/contracts';
21
22
  import {
22
23
  EMAIL_CODE_LENGTH,
23
24
  EMAIL_SIGNIN_LONG_CODE_ALPHABET,
@@ -25,8 +26,7 @@ import {
25
26
  EMAIL_VERIFICATION_ERROR_CODES,
26
27
  SIGN_IN_ERROR_CODES,
27
28
  normalizeEmailSignInCode,
28
- type EmailVerificationConfirmResponse,
29
- } from '@oxy.so/contracts';
29
+ } from '@oxy.so/contracts/client';
30
30
  import { useOxy } from '../../context/OxyContext';
31
31
  import { useI18n } from '../../hooks/useI18n';
32
32
  import type { Translate } from '../authChooser/types';
@@ -29,7 +29,6 @@ import type {
29
29
  AccountDialogController,
30
30
  AccountDialogView,
31
31
  } from '@oxy.so/core/session';
32
- import { KeyManager } from '@oxy.so/core/crypto';
33
32
  import {
34
33
  refreshDeviceSecretArm,
35
34
  establishIdentitySession,
@@ -60,6 +59,7 @@ import {
60
59
  type RequestOAuthConsentOptions,
61
60
  } from '../oauth/explicitOAuthConsent';
62
61
  import { isWebBrowser } from '../utils/isWebBrowser';
62
+ import { loadIdentityCrypto } from '../utils/identityCrypto';
63
63
  import { resolveDeliveryPlatform } from '../utils/deliveryPlatform';
64
64
  import { runProviderColdBoot } from '../boot/runProviderColdBoot';
65
65
  import { resolveApplicationSessionLane } from '../oauth/applicationSessionLane';
@@ -696,6 +696,7 @@ export const OxyRuntimeProvider: React.FC<OxyRuntimeProviderProps> = ({
696
696
  try {
697
697
  // The same keys the refresh handler's second arm signs with: the
698
698
  // identity-bound client's own key, or the cross-app shared identity.
699
+ const { KeyManager } = await loadIdentityCrypto();
699
700
  return identity ? await KeyManager.hasIdentity() : await KeyManager.hasSharedIdentity();
700
701
  } catch {
701
702
  return false;
@@ -1495,9 +1496,12 @@ export const OxyRuntimeProvider: React.FC<OxyRuntimeProviderProps> = ({
1495
1496
  // — a locked keychain must never be misreported as "no identity". `hasIdentity`
1496
1497
  // still resolves `false` and `getPublicKey` still resolves `null` for a genuine
1497
1498
  // absence.
1498
- const hasIdentity = useCallback(async (): Promise<boolean> => KeyManager.hasIdentity(), []);
1499
+ const hasIdentity = useCallback(
1500
+ async (): Promise<boolean> => (await loadIdentityCrypto()).KeyManager.hasIdentity(),
1501
+ [],
1502
+ );
1499
1503
  const getPublicKey = useCallback(
1500
- async (): Promise<string | null> => KeyManager.getPublicKey(),
1504
+ async (): Promise<string | null> => (await loadIdentityCrypto()).KeyManager.getPublicKey(),
1501
1505
  [],
1502
1506
  );
1503
1507
 
@@ -8,9 +8,9 @@ import type { LogoutResult } from '../oxyContextTypes';
8
8
  import { DeviceManager } from '@oxy.so/core/session';
9
9
  import { fetchSessionsWithFallback } from '../../utils/sessionHelpers';
10
10
  import { handleAuthError, isInvalidSessionError } from '../../utils/errorHandlers';
11
+ import { loadIdentityCrypto } from '../../utils/identityCrypto';
11
12
  import type { StorageInterface } from '../../utils/storageHelpers';
12
13
  import type { OxyServices } from '@oxy.so/core';
13
- import { SignatureService } from '@oxy.so/core/crypto';
14
14
 
15
15
  export interface UseAuthOperationsOptions {
16
16
  oxyServices: OxyServices;
@@ -126,6 +126,7 @@ export const useAuthOperations = ({
126
126
  // in local storage as 'oxy_biometric_enabled' and can be checked there.
127
127
 
128
128
  // Sign the challenge
129
+ const { SignatureService } = await loadIdentityCrypto();
129
130
  const { challenge: signature, timestamp } = await SignatureService.signChallenge(challenge);
130
131
 
131
132
  let fullUser: User;
@@ -1,8 +1,8 @@
1
- import { publicApplicationSchema } from '@oxy.so/contracts';
1
+ import { publicApplicationCheck, parseContract } from '@oxy.so/contracts/client';
2
2
  import type { OxyServices } from '@oxy.so/core';
3
3
 
4
4
  export function classifyApplicationSessionLane(metadata: unknown): 'device' | 'oauth' {
5
- const application = publicApplicationSchema.parse(metadata);
5
+ const application = parseContract(publicApplicationCheck, metadata);
6
6
  return application.type === 'third_party' && !application.isOfficial && !application.isInternal
7
7
  ? 'oauth'
8
8
  : 'device';
@@ -1,5 +1,9 @@
1
1
  import type React from 'react';
2
- import { ORGANIZATION_NAME_MAX_LENGTH, organizationNameSchema } from '@oxy.so/contracts';
2
+ import {
3
+ ORGANIZATION_NAME_MAX_LENGTH,
4
+ organizationNameCheck,
5
+ checkContract,
6
+ } from '@oxy.so/contracts/client';
3
7
  import { OrganizationSettings } from '../components/organizations/OrganizationSettings';
4
8
  import { useCallback, useMemo, useState } from 'react';
5
9
  import { View, ActivityIndicator } from 'react-native';
@@ -152,7 +156,7 @@ const AccountSettingsScreen: React.FC<BaseScreenProps> = ({
152
156
  }
153
157
  if (node?.account.kind === 'organization') {
154
158
  setDisplayNameError(
155
- organizationNameSchema.safeParse(trimmed).success
159
+ checkContract(organizationNameCheck, trimmed) !== null
156
160
  ? ''
157
161
  : t('organizationDirectory.invalidName'),
158
162
  );
@@ -1,9 +1,10 @@
1
1
  import type React from 'react';
2
+ import type { OrganizationType } from '@oxy.so/contracts';
2
3
  import {
3
4
  ORGANIZATION_NAME_MAX_LENGTH,
4
- organizationNameSchema,
5
- type OrganizationType,
6
- } from '@oxy.so/contracts';
5
+ organizationNameCheck,
6
+ checkContract,
7
+ } from '@oxy.so/contracts/client';
7
8
  import { OrganizationDirectorySearch } from '../components/organizations/OrganizationDirectorySearch';
8
9
  import { OrganizationTypePicker } from '../components/organizations/OrganizationTypePicker';
9
10
  import { useState, useCallback, useRef, useEffect } from 'react';
@@ -21,12 +22,12 @@ import {
21
22
  import {
22
23
  applyBotUsernameSuffix,
23
24
  stripDisallowedUsernameCharacters,
24
- usernameSchemaForAccountKind,
25
+ usernameCheckForAccountKind,
25
26
  BOT_USERNAME_INVALID_MESSAGE,
26
27
  USERNAME_INVALID_MESSAGE,
27
28
  USERNAME_MAX_LENGTH,
28
29
  USERNAME_MIN_LENGTH,
29
- } from '@oxy.so/contracts';
30
+ } from '@oxy.so/contracts/client';
30
31
  import type { BaseScreenProps } from '../types/navigation';
31
32
  import { useI18n } from '../hooks/useI18n';
32
33
  import { useSurfaceHeader } from '../hooks/useSurfaceHeader';
@@ -196,9 +197,9 @@ const CreateAccountScreen: React.FC<BaseScreenProps> = ({ onClose, goBack, paren
196
197
  // somebody who typed `a.b` to append `bot` sends them to be refused a second
197
198
  // time. The issue is read to choose between two LOCALIZED strings rather than
198
199
  // shown directly — the schema's message is English, and this screen is not.
199
- const parsed = usernameSchemaForAccountKind(forKind).safeParse(value);
200
- if (!parsed.success) {
201
- const failedTheLabel = parsed.error.issues[0]?.message === BOT_USERNAME_INVALID_MESSAGE;
200
+ const checked = usernameCheckForAccountKind(forKind)(value, []);
201
+ if (!checked.ok) {
202
+ const failedTheLabel = checked.issue.message === BOT_USERNAME_INVALID_MESSAGE;
202
203
  setUsernameStatus('invalid');
203
204
  setUsernameMessage(
204
205
  failedTheLabel
@@ -282,7 +283,7 @@ const CreateAccountScreen: React.FC<BaseScreenProps> = ({ onClose, goBack, paren
282
283
  }
283
284
  if (kind === 'organization') {
284
285
  setDisplayNameError(
285
- organizationNameSchema.safeParse(trimmed).success
286
+ checkContract(organizationNameCheck, trimmed) !== null
286
287
  ? ''
287
288
  : t('organizationDirectory.invalidName'),
288
289
  );
@@ -0,0 +1,10 @@
1
+ /**
2
+ * The self-custody identity (`@oxy.so/core/crypto`: secp256k1, bip39, the AEAD
3
+ * cipher — ~32 KB gzipped on web), loaded where a key or signature is used.
4
+ *
5
+ * Importing it statically put it in every app's startup JavaScript, although a
6
+ * reader without an identity key never touches it before first paint. Core's
7
+ * `crypto` entry installs its polyfill before anything else, so loading it
8
+ * late keeps the order every key operation relies on.
9
+ */
10
+ export const loadIdentityCrypto = () => import('@oxy.so/core/crypto');