@oxy.so/core 7.26.0 → 7.28.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.
@@ -664,6 +664,20 @@ const dict = {
664
664
  month: 'Month',
665
665
  year: 'Year',
666
666
  },
667
+ pronouns: {
668
+ title: 'Pronouns',
669
+ subtitle: 'How people should refer to you',
670
+ label: 'Pronouns',
671
+ options: {
672
+ unspecified: 'Not set',
673
+ he_him: 'He/him',
674
+ she_her: 'She/her',
675
+ they_them: 'They/them',
676
+ he_they: 'He/they',
677
+ she_they: 'She/they',
678
+ it_its: 'It/its',
679
+ },
680
+ },
667
681
  locations: {
668
682
  title: 'Locations',
669
683
  subtitle: "Places you've been or live",
@@ -366,6 +366,20 @@ const dict = {
366
366
  month: 'Mes',
367
367
  year: 'Año',
368
368
  },
369
+ pronouns: {
370
+ title: 'Pronombres',
371
+ subtitle: 'Cómo deben referirse a ti las personas',
372
+ label: 'Pronombres',
373
+ options: {
374
+ unspecified: 'Sin definir',
375
+ he_him: 'He/him',
376
+ she_her: 'She/her',
377
+ they_them: 'They/them',
378
+ he_they: 'He/they',
379
+ she_they: 'She/they',
380
+ it_its: 'It/its',
381
+ },
382
+ },
369
383
  locations: {
370
384
  title: 'Ubicaciones',
371
385
  subtitle: 'Lugares donde has estado o vives',
@@ -10,6 +10,15 @@ export interface VerifyDomainResult {
10
10
  export interface RemoveDomainResult {
11
11
  success: boolean;
12
12
  }
13
+ /** Options for {@link IdentityApi.resolveDid}. */
14
+ export interface ResolveDidOptions {
15
+ /**
16
+ * Read the document from the origin now, never from a cache. Required when
17
+ * `#key-1` decides where money goes (deriving a Peable receive address): the
18
+ * key changes on a rotation or an organization key replacement.
19
+ */
20
+ fresh?: boolean;
21
+ }
13
22
  /** How the caller proves control of the CURRENT key during a key rotation. */
14
23
  export type RotateKeyProof = 'device' | 'phrase';
15
24
  /** Options for {@link IdentityApi.rotateKey}. */
@@ -93,8 +102,16 @@ export declare class IdentityApi {
93
102
  * Resolve the W3C DID document for any user. The API derives it on demand
94
103
  * from the account's `authMethods` + `publicKey` — there is no stored
95
104
  * document. Public (no auth required); short-TTL cached.
105
+ *
106
+ * `{ fresh: true }` reads the document as it is NOW: it skips (and drops)
107
+ * this client's cached copy, is not joined to an in-flight read, and sends
108
+ * `Cache-Control: no-cache` so no HTTP cache on the way answers for the
109
+ * origin. Use it whenever the answer decides where money goes: `#key-1` is
110
+ * the account's Peable receive key and changes on a rotation or an
111
+ * organization key replacement, and a cached copy would derive an address
112
+ * from the previous key for up to the cache TTL.
96
113
  */
97
- resolveDid(userId: string): Promise<DidDocument>;
114
+ resolveDid(userId: string, options?: ResolveDidOptions): Promise<DidDocument>;
98
115
  /**
99
116
  * The signed-in user's linked authentication methods plus their DID. Each
100
117
  * `identity` method carries a `verificationMethodId` linking it to its DID
@@ -37,6 +37,12 @@ export declare function deriveScopedSeedFromKey(privateKeyHex: string, info: str
37
37
  * `HMAC-SHA256(SOCIAL_RECEIVE_CHAIN_CODE_KEY, compressed identity public key)`.
38
38
  * Identical to `@fairco.in/core`'s `deriveSocialReceiveSpendingKey`.
39
39
  *
40
+ * INTERNAL to `@oxy.so/core` (not exported from `@oxy.so/core/crypto`): the
41
+ * derivation is non-hardened and the chain code is a public function of the
42
+ * identity public key, so `identity = child - I_L mod n` — whoever holds one
43
+ * child private key and the public key holds the identity key. Callers get
44
+ * signatures ({@link signSocialReceiveDigest}), never the child key.
45
+ *
40
46
  * @returns the child private key and its compressed public key, lowercase hex.
41
47
  */
42
48
  export declare function deriveSocialReceiveKey(privateKeyHex: string, index: number): {
@@ -27,7 +27,7 @@ export { hkdfSha256 } from './kdf';
27
27
  export { encryptAead, decryptAead, AEAD_KEY_LENGTH, AEAD_NONCE_LENGTH } from './aead';
28
28
  export type { AeadResult } from './aead';
29
29
  export { deriveSharedSecret } from './ecdh';
30
- export { SCOPED_SEED_KDF_SALT, SOCIAL_RECEIVE_CHAIN_CODE_KEY, MAX_SOCIAL_RECEIVE_INDEX, deriveScopedSeedFromKey, deriveSocialReceiveKey, signSocialReceiveDigest, authChallengeDigest, } from './identityDerivations';
30
+ export { SCOPED_SEED_KDF_SALT, SOCIAL_RECEIVE_CHAIN_CODE_KEY, MAX_SOCIAL_RECEIVE_INDEX, deriveScopedSeedFromKey, signSocialReceiveDigest, authChallengeDigest, } from './identityDerivations';
31
31
  export { digestIdentityPayload, signIdentityProof } from './identityProof';
32
32
  export { deriveIdentityLinkCode } from './identityLink';
33
33
  export { solveRegistrationPow } from './registrationPow';
@@ -655,6 +655,20 @@ declare const dict: {
655
655
  month: string;
656
656
  year: string;
657
657
  };
658
+ pronouns: {
659
+ title: string;
660
+ subtitle: string;
661
+ label: string;
662
+ options: {
663
+ unspecified: string;
664
+ he_him: string;
665
+ she_her: string;
666
+ they_them: string;
667
+ he_they: string;
668
+ she_they: string;
669
+ it_its: string;
670
+ };
671
+ };
658
672
  locations: {
659
673
  title: string;
660
674
  subtitle: string;
@@ -366,6 +366,20 @@ declare const dict: {
366
366
  month: string;
367
367
  year: string;
368
368
  };
369
+ pronouns: {
370
+ title: string;
371
+ subtitle: string;
372
+ label: string;
373
+ options: {
374
+ unspecified: string;
375
+ he_him: string;
376
+ she_her: string;
377
+ they_them: string;
378
+ he_they: string;
379
+ she_they: string;
380
+ it_its: string;
381
+ };
382
+ };
369
383
  locations: {
370
384
  title: string;
371
385
  subtitle: string;
@@ -41,7 +41,7 @@ export { DirectUploadInterruptedError } from './api/directUpload';
41
41
  export type { DirectUploadProgress } from './api/directUpload';
42
42
  export type { AssetsApi, AssetRecord, UploadedAsset, AssetLinkState, AssetUploadOptions, AssetUploadStageProgress, AssetLinkTarget, AssetDeleteResult, CompletedAssetUpload, LargeUploadOptions, LargeUploadProgress, LargeUploadResult, } from './api/assets';
43
43
  export { buildUserDid } from './api/identity';
44
- export type { IdentityApi, VerifyDomainResult, RemoveDomainResult, RotateKeyProof, RotateKeyOptions, RotateKeyResult, } from './api/identity';
44
+ export type { IdentityApi, VerifyDomainResult, RemoveDomainResult, ResolveDidOptions, RotateKeyProof, RotateKeyOptions, RotateKeyResult, } from './api/identity';
45
45
  export { ACCOUNT_CATEGORY_IDS, MAX_ACCOUNT_CATEGORIES, SELECTABLE_ACCOUNT_CATEGORY_IDS, isSelectableAccountCategoryId, kindAcceptsAccountCategories, } from './api/accounts';
46
46
  export type { AccountsApi, AccountKind, AccountCategoryId, AccountRelationship, AccountRole, AccountMemberStatus, AccountMemberSource, AccountMember, AccountNode, ListAccountsOptions, CreateAccountInput, UpdateAccountInput, UpdateAccountMemberInput, TransferAccountOwnershipInput, AccountSuccessResult, SwitchAccountResult, } from './api/accounts';
47
47
  export type { AppsApi, AppAssertionsApi, Application, ApplicationCallerMembership, ApplicationType, ApplicationStatus, ApplicationCredential, ApplicationCredentialType, ApplicationCredentialStatus, ApplicationEnvironment, CreateApplicationInput, UpdateApplicationInput, CreateApplicationCredentialInput, RotateApplicationCredentialInput, ApplicationCredentialWithSecret, RotateApplicationCredentialResult, ApplicationUsagePeriod, ApplicationUsageSummary, ApplicationUsageByDay, ApplicationUsageByEndpoint, ApplicationUsageStats, PublicApplication, ConnectedApp, ConnectedMcpClient, ApplicationDeleteResult, ApplicationFilesWebhook, } from './api/apps';
@@ -1,4 +1,4 @@
1
- import type { AccountKind, AccountCategoryId, AvatarCharacter, UserNameResponse, UserRelationship, ThemePreference, OxyNotificationEntityType, OxyNotificationType } from '@oxy.so/contracts';
1
+ import type { AccountKind, AccountCategoryId, AvatarCharacter, UserNameResponse, UserRelationship, ThemePreference, OxyNotificationEntityType, OxyNotificationType, Pronouns } from '@oxy.so/contracts';
2
2
  export interface OxyConfig {
3
3
  baseURL: string;
4
4
  cloudURL?: string;
@@ -135,6 +135,11 @@ export interface User {
135
135
  image?: string;
136
136
  id?: string;
137
137
  }>;
138
+ /**
139
+ * How a person account names its pronouns, from the closed list. An account
140
+ * that is not a person (organization, channel, bot, …) is always `unspecified`.
141
+ */
142
+ pronouns?: Pronouns;
138
143
  _count?: {
139
144
  followers?: number;
140
145
  following?: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oxy.so/core",
3
- "version": "7.26.0",
3
+ "version": "7.28.0",
4
4
  "description": "OxyHQ SDK Foundation — API client, authentication, cryptographic identity, and shared utilities",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -68,6 +68,16 @@ export interface RemoveDomainResult {
68
68
  success: boolean;
69
69
  }
70
70
 
71
+ /** Options for {@link IdentityApi.resolveDid}. */
72
+ export interface ResolveDidOptions {
73
+ /**
74
+ * Read the document from the origin now, never from a cache. Required when
75
+ * `#key-1` decides where money goes (deriving a Peable receive address): the
76
+ * key changes on a rotation or an organization key replacement.
77
+ */
78
+ fresh?: boolean;
79
+ }
80
+
71
81
  /** How the caller proves control of the CURRENT key during a key rotation. */
72
82
  export type RotateKeyProof = 'device' | 'phrase';
73
83
 
@@ -191,17 +201,29 @@ export class IdentityApi {
191
201
  * Resolve the W3C DID document for any user. The API derives it on demand
192
202
  * from the account's `authMethods` + `publicKey` — there is no stored
193
203
  * document. Public (no auth required); short-TTL cached.
204
+ *
205
+ * `{ fresh: true }` reads the document as it is NOW: it skips (and drops)
206
+ * this client's cached copy, is not joined to an in-flight read, and sends
207
+ * `Cache-Control: no-cache` so no HTTP cache on the way answers for the
208
+ * origin. Use it whenever the answer decides where money goes: `#key-1` is
209
+ * the account's Peable receive key and changes on a rotation or an
210
+ * organization key replacement, and a cached copy would derive an address
211
+ * from the previous key for up to the cache TTL.
194
212
  */
195
- async resolveDid(userId: string): Promise<DidDocument> {
196
- return this.ctx.request<DidDocument>(
197
- 'GET',
198
- `/u/${encodeURIComponent(userId)}/did.json`,
199
- undefined,
200
- {
201
- cache: true,
202
- cacheTTL: SHORT_TTL,
203
- },
204
- );
213
+ async resolveDid(userId: string, options: ResolveDidOptions = {}): Promise<DidDocument> {
214
+ const path = `/u/${encodeURIComponent(userId)}/did.json`;
215
+ if (options.fresh) {
216
+ this.ctx.http.invalidateCache({ keys: [`GET:${path}`] });
217
+ return this.ctx.request<DidDocument>('GET', path, undefined, {
218
+ cache: false,
219
+ deduplicate: false,
220
+ headers: { 'Cache-Control': 'no-cache' },
221
+ });
222
+ }
223
+ return this.ctx.request<DidDocument>('GET', path, undefined, {
224
+ cache: true,
225
+ cacheTTL: SHORT_TTL,
226
+ });
205
227
  }
206
228
 
207
229
  /**
@@ -73,6 +73,12 @@ export function deriveScopedSeedFromKey(privateKeyHex: string, info: string): Ui
73
73
  * `HMAC-SHA256(SOCIAL_RECEIVE_CHAIN_CODE_KEY, compressed identity public key)`.
74
74
  * Identical to `@fairco.in/core`'s `deriveSocialReceiveSpendingKey`.
75
75
  *
76
+ * INTERNAL to `@oxy.so/core` (not exported from `@oxy.so/core/crypto`): the
77
+ * derivation is non-hardened and the chain code is a public function of the
78
+ * identity public key, so `identity = child - I_L mod n` — whoever holds one
79
+ * child private key and the public key holds the identity key. Callers get
80
+ * signatures ({@link signSocialReceiveDigest}), never the child key.
81
+ *
76
82
  * @returns the child private key and its compressed public key, lowercase hex.
77
83
  */
78
84
  export function deriveSocialReceiveKey(
@@ -57,13 +57,16 @@ export type { AeadResult } from './aead';
57
57
  export { deriveSharedSecret } from './ecdh';
58
58
 
59
59
  // What the identity key computes without leaving its holder: the same functions
60
- // Commons' identity host implements natively on Android.
60
+ // Commons' identity host implements natively on Android. The social-receive
61
+ // CHILD private key (`deriveSocialReceiveKey`) is deliberately not here: the
62
+ // derivation is non-hardened under a chain code anyone can compute from the
63
+ // public key, so one leaked child private key reveals the identity key. Only
64
+ // signatures (`signSocialReceiveDigest`) leave this module.
61
65
  export {
62
66
  SCOPED_SEED_KDF_SALT,
63
67
  SOCIAL_RECEIVE_CHAIN_CODE_KEY,
64
68
  MAX_SOCIAL_RECEIVE_INDEX,
65
69
  deriveScopedSeedFromKey,
66
- deriveSocialReceiveKey,
67
70
  signSocialReceiveDigest,
68
71
  authChallengeDigest,
69
72
  } from './identityDerivations';