@oxy.so/core 1.5.0 → 1.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.
- package/dist/cjs/.tsbuildinfo +1 -1
- package/dist/cjs/HttpService.js +72 -9
- package/dist/cjs/crypto/identityMove.js +53 -34
- package/dist/cjs/crypto/identityProof.js +28 -0
- package/dist/cjs/crypto/webIdentityCarrier.js +145 -82
- package/dist/cjs/i18n/locales/ar-SA.json +1 -0
- package/dist/cjs/i18n/locales/ca-ES.json +1 -0
- package/dist/cjs/i18n/locales/de-DE.json +1 -0
- package/dist/cjs/i18n/locales/en-US.json +1 -0
- package/dist/cjs/i18n/locales/es-ES.json +1 -0
- package/dist/cjs/i18n/locales/fr-FR.json +1 -0
- package/dist/cjs/i18n/locales/it-IT.json +1 -0
- package/dist/cjs/i18n/locales/ja-JP.json +1 -0
- package/dist/cjs/i18n/locales/ko-KR.json +1 -0
- package/dist/cjs/i18n/locales/locales/ar-SA.json +1 -0
- package/dist/cjs/i18n/locales/locales/ca-ES.json +1 -0
- package/dist/cjs/i18n/locales/locales/de-DE.json +1 -0
- package/dist/cjs/i18n/locales/locales/en-US.json +1 -0
- package/dist/cjs/i18n/locales/locales/es-ES.json +1 -0
- package/dist/cjs/i18n/locales/locales/fr-FR.json +1 -0
- package/dist/cjs/i18n/locales/locales/it-IT.json +1 -0
- package/dist/cjs/i18n/locales/locales/ja-JP.json +1 -0
- package/dist/cjs/i18n/locales/locales/ko-KR.json +1 -0
- package/dist/cjs/i18n/locales/locales/pt-PT.json +1 -0
- package/dist/cjs/i18n/locales/locales/zh-CN.json +1 -0
- package/dist/cjs/i18n/locales/pt-PT.json +1 -0
- package/dist/cjs/i18n/locales/zh-CN.json +1 -0
- package/dist/cjs/index.js +22 -14
- package/dist/cjs/inference/OxyInferenceClient.js +62 -5
- package/dist/cjs/mixins/OxyServices.auth.js +129 -0
- package/dist/cjs/mixins/OxyServices.identity.js +11 -44
- package/dist/cjs/mixins/index.js +0 -2
- package/dist/cjs/server/index.js +10 -1
- package/dist/cjs/server/securityHeaders.js +9 -2
- package/dist/cjs/server/workloadIdentity.js +170 -0
- package/dist/cjs/session/refresh.js +12 -0
- package/dist/esm/.tsbuildinfo +1 -1
- package/dist/esm/HttpService.js +72 -9
- package/dist/esm/crypto/identityMove.js +51 -33
- package/dist/esm/crypto/identityProof.js +24 -0
- package/dist/esm/crypto/webIdentityCarrier.js +137 -77
- package/dist/esm/i18n/locales/ar-SA.json +1 -0
- package/dist/esm/i18n/locales/ca-ES.json +1 -0
- package/dist/esm/i18n/locales/de-DE.json +1 -0
- package/dist/esm/i18n/locales/en-US.json +1 -0
- package/dist/esm/i18n/locales/es-ES.json +1 -0
- package/dist/esm/i18n/locales/fr-FR.json +1 -0
- package/dist/esm/i18n/locales/it-IT.json +1 -0
- package/dist/esm/i18n/locales/ja-JP.json +1 -0
- package/dist/esm/i18n/locales/ko-KR.json +1 -0
- package/dist/esm/i18n/locales/locales/ar-SA.json +1 -0
- package/dist/esm/i18n/locales/locales/ca-ES.json +1 -0
- package/dist/esm/i18n/locales/locales/de-DE.json +1 -0
- package/dist/esm/i18n/locales/locales/en-US.json +1 -0
- package/dist/esm/i18n/locales/locales/es-ES.json +1 -0
- package/dist/esm/i18n/locales/locales/fr-FR.json +1 -0
- package/dist/esm/i18n/locales/locales/it-IT.json +1 -0
- package/dist/esm/i18n/locales/locales/ja-JP.json +1 -0
- package/dist/esm/i18n/locales/locales/ko-KR.json +1 -0
- package/dist/esm/i18n/locales/locales/pt-PT.json +1 -0
- package/dist/esm/i18n/locales/locales/zh-CN.json +1 -0
- package/dist/esm/i18n/locales/pt-PT.json +1 -0
- package/dist/esm/i18n/locales/zh-CN.json +1 -0
- package/dist/esm/index.js +5 -4
- package/dist/esm/inference/OxyInferenceClient.js +63 -6
- package/dist/esm/mixins/OxyServices.auth.js +96 -0
- package/dist/esm/mixins/OxyServices.identity.js +11 -44
- package/dist/esm/mixins/index.js +0 -2
- package/dist/esm/server/index.js +7 -0
- package/dist/esm/server/securityHeaders.js +9 -2
- package/dist/esm/server/workloadIdentity.js +166 -0
- package/dist/esm/session/refresh.js +12 -0
- package/dist/types/.tsbuildinfo +1 -1
- package/dist/types/HttpService.d.ts +24 -0
- package/dist/types/OxyServices.d.ts +3 -0
- package/dist/types/crypto/identityMove.d.ts +48 -32
- package/dist/types/crypto/identityProof.d.ts +16 -0
- package/dist/types/crypto/webIdentityCarrier.d.ts +74 -47
- package/dist/types/index.d.ts +7 -6
- package/dist/types/inference/OxyInferenceClient.d.ts +21 -1
- package/dist/types/mixins/OxyServices.auth.d.ts +32 -0
- package/dist/types/mixins/OxyServices.identity.d.ts +16 -30
- package/dist/types/mixins/OxyServices.utility.d.ts +2 -0
- package/dist/types/mixins/index.d.ts +1 -2
- package/dist/types/server/index.d.ts +8 -0
- package/dist/types/server/securityHeaders.d.ts +8 -0
- package/dist/types/server/workloadIdentity.d.ts +32 -0
- package/package.json +1 -1
- package/src/HttpService.ts +74 -9
- package/src/OxyServices.ts +9 -0
- package/src/__tests__/httpServiceRateLimitedRefresh.test.ts +160 -0
- package/src/__tests__/publicInterfaceParity.test.ts +75 -0
- package/src/__tests__/serviceTokenWorkloadFallback.test.ts +85 -0
- package/src/crypto/__tests__/identityMove.test.ts +93 -51
- package/src/crypto/__tests__/identityProof.test.ts +81 -0
- package/src/crypto/__tests__/webIdentityCarrier.test.ts +21 -63
- package/src/crypto/__tests__/webIdentityRecoveryMaterial.test.ts +117 -0
- package/src/crypto/identityMove.ts +77 -43
- package/src/crypto/identityProof.ts +36 -0
- package/src/crypto/webIdentityCarrier.ts +185 -117
- package/src/i18n/locales/ar-SA.json +1 -0
- package/src/i18n/locales/ca-ES.json +1 -0
- package/src/i18n/locales/de-DE.json +1 -0
- package/src/i18n/locales/en-US.json +1 -0
- package/src/i18n/locales/es-ES.json +1 -0
- package/src/i18n/locales/fr-FR.json +1 -0
- package/src/i18n/locales/it-IT.json +1 -0
- package/src/i18n/locales/ja-JP.json +1 -0
- package/src/i18n/locales/ko-KR.json +1 -0
- package/src/i18n/locales/pt-PT.json +1 -0
- package/src/i18n/locales/zh-CN.json +1 -0
- package/src/index.ts +26 -15
- package/src/inference/OxyInferenceClient.ts +84 -7
- package/src/inference/__tests__/OxyInferenceClient.test.ts +48 -0
- package/src/mixins/OxyServices.auth.ts +100 -1
- package/src/mixins/OxyServices.identity.ts +17 -67
- package/src/mixins/OxyServices.utility.ts +2 -0
- package/src/mixins/__tests__/OxyServices.identity.test.ts +1 -76
- package/src/mixins/index.ts +0 -3
- package/src/server/__tests__/securityHeaders.test.ts +15 -0
- package/src/server/__tests__/workloadIdentity.test.ts +128 -0
- package/src/server/index.ts +9 -0
- package/src/server/securityHeaders.ts +19 -6
- package/src/server/workloadIdentity.ts +207 -0
- package/src/session/__tests__/refresh.test.ts +53 -3
- package/src/session/refresh.ts +12 -0
- package/dist/cjs/mixins/OxyServices.deviceTransfer.js +0 -314
- package/dist/esm/mixins/OxyServices.deviceTransfer.js +0 -311
- package/dist/types/mixins/OxyServices.deviceTransfer.d.ts +0 -149
- package/src/mixins/OxyServices.deviceTransfer.ts +0 -393
- package/src/mixins/__tests__/OxyServices.deviceTransfer.test.ts +0 -271
|
@@ -656,6 +656,7 @@
|
|
|
656
656
|
"scanQr": "Escanear código QR",
|
|
657
657
|
"qrHeadline": "Inicia sesión con tu identidad de Oxy",
|
|
658
658
|
"signInWithOxy": "Inicia sesión con Oxy",
|
|
659
|
+
"signUpWithOxy": "Regístrate con Oxy",
|
|
659
660
|
"useIdentityOnDevice": "¿No tienes Commons? Usa una clave de acceso en este dispositivo",
|
|
660
661
|
"getCommons": "Descargar Commons",
|
|
661
662
|
"commonsNotInstalled": "¿No tienes Commons? Descarga la app para iniciar sesión con tu Oxy ID.",
|
|
@@ -108,6 +108,7 @@
|
|
|
108
108
|
"loading": "Chargement des comptes...",
|
|
109
109
|
"qrHeadline": "Connectez-vous avec votre identité Oxy",
|
|
110
110
|
"signInWithOxy": "Se connecter avec Oxy",
|
|
111
|
+
"signUpWithOxy": "S'inscrire avec Oxy",
|
|
111
112
|
"useIdentityOnDevice": "Pas de Commons ? Utilisez une clé d'accès sur cet appareil",
|
|
112
113
|
"getCommons": "Obtenir Commons",
|
|
113
114
|
"commonsNotInstalled": "Pas de Commons ? Téléchargez l'app pour vous connecter avec votre Oxy ID.",
|
|
@@ -108,6 +108,7 @@
|
|
|
108
108
|
"loading": "Caricamento account...",
|
|
109
109
|
"qrHeadline": "Accedi con la tua identità Oxy",
|
|
110
110
|
"signInWithOxy": "Accedi con Oxy",
|
|
111
|
+
"signUpWithOxy": "Registrati con Oxy",
|
|
111
112
|
"useIdentityOnDevice": "Non hai Commons? Usa una passkey su questo dispositivo",
|
|
112
113
|
"getCommons": "Ottieni Commons",
|
|
113
114
|
"commonsNotInstalled": "Non hai Commons? Scarica l'app per accedere con il tuo Oxy ID.",
|
|
@@ -108,6 +108,7 @@
|
|
|
108
108
|
"loading": "アカウントを読み込み中...",
|
|
109
109
|
"qrHeadline": "Oxy IDでサインイン",
|
|
110
110
|
"signInWithOxy": "Oxyでサインイン",
|
|
111
|
+
"signUpWithOxy": "Oxyで登録",
|
|
111
112
|
"useIdentityOnDevice": "Commonsがありませんか?このデバイスのパスキーを使用",
|
|
112
113
|
"getCommons": "Commonsを入手",
|
|
113
114
|
"commonsNotInstalled": "Commonsがありませんか?アプリを入手してOxy IDでサインインしましょう。",
|
|
@@ -108,6 +108,7 @@
|
|
|
108
108
|
"loading": "계정을 불러오는 중...",
|
|
109
109
|
"qrHeadline": "Oxy ID로 로그인",
|
|
110
110
|
"signInWithOxy": "Oxy로 로그인",
|
|
111
|
+
"signUpWithOxy": "Oxy로 가입하기",
|
|
111
112
|
"useIdentityOnDevice": "Commons가 없으신가요? 이 기기의 패스키를 사용하세요",
|
|
112
113
|
"getCommons": "Commons 다운로드",
|
|
113
114
|
"commonsNotInstalled": "Commons가 없으신가요? 앱을 다운로드하여 Oxy ID로 로그인하세요.",
|
|
@@ -108,6 +108,7 @@
|
|
|
108
108
|
"loading": "جارٍ تحميل الحسابات...",
|
|
109
109
|
"qrHeadline": "سجّل الدخول بهوية Oxy الخاصة بك",
|
|
110
110
|
"signInWithOxy": "تسجيل الدخول باستخدام Oxy",
|
|
111
|
+
"signUpWithOxy": "التسجيل باستخدام Oxy",
|
|
111
112
|
"useIdentityOnDevice": "لا تملك Commons؟ استخدم مفتاح مرور على هذا الجهاز بدلاً من ذلك",
|
|
112
113
|
"getCommons": "احصل على Commons",
|
|
113
114
|
"commonsNotInstalled": "لا تملك Commons؟ احصل على التطبيق لتسجيل الدخول بمعرّف Oxy الخاص بك.",
|
|
@@ -108,6 +108,7 @@
|
|
|
108
108
|
"loading": "S'estan carregant els comptes...",
|
|
109
109
|
"qrHeadline": "Inicia sessió amb la teva identitat d'Oxy",
|
|
110
110
|
"signInWithOxy": "Inicia sessió amb Oxy",
|
|
111
|
+
"signUpWithOxy": "Registra't amb Oxy",
|
|
111
112
|
"useIdentityOnDevice": "No tens Commons? Fes servir una clau d'accés en aquest dispositiu",
|
|
112
113
|
"getCommons": "Descarrega Commons",
|
|
113
114
|
"commonsNotInstalled": "No tens Commons? Descarrega l'app per iniciar sessió amb el teu Oxy ID.",
|
|
@@ -108,6 +108,7 @@
|
|
|
108
108
|
"loading": "Konten werden geladen...",
|
|
109
109
|
"qrHeadline": "Melden Sie sich mit Ihrer Oxy-Identität an",
|
|
110
110
|
"signInWithOxy": "Mit Oxy anmelden",
|
|
111
|
+
"signUpWithOxy": "Mit Oxy registrieren",
|
|
111
112
|
"useIdentityOnDevice": "Kein Commons? Verwenden Sie stattdessen einen Passkey auf diesem Gerät",
|
|
112
113
|
"getCommons": "Commons herunterladen",
|
|
113
114
|
"commonsNotInstalled": "Kein Commons? Holen Sie sich die App, um sich mit Ihrer Oxy-ID anzumelden.",
|
|
@@ -416,6 +416,7 @@
|
|
|
416
416
|
"scanQr": "Scan QR code",
|
|
417
417
|
"qrHeadline": "Sign in with your Oxy identity",
|
|
418
418
|
"signInWithOxy": "Sign in with Oxy",
|
|
419
|
+
"signUpWithOxy": "Sign up with Oxy",
|
|
419
420
|
"useIdentityOnDevice": "No Commons? Use a passkey on this device instead",
|
|
420
421
|
"getCommons": "Get Commons",
|
|
421
422
|
"commonsNotInstalled": "Don't have Commons? Get the app to sign in with your Oxy ID.",
|
|
@@ -656,6 +656,7 @@
|
|
|
656
656
|
"scanQr": "Escanear código QR",
|
|
657
657
|
"qrHeadline": "Inicia sesión con tu identidad de Oxy",
|
|
658
658
|
"signInWithOxy": "Inicia sesión con Oxy",
|
|
659
|
+
"signUpWithOxy": "Regístrate con Oxy",
|
|
659
660
|
"useIdentityOnDevice": "¿No tienes Commons? Usa una clave de acceso en este dispositivo",
|
|
660
661
|
"getCommons": "Descargar Commons",
|
|
661
662
|
"commonsNotInstalled": "¿No tienes Commons? Descarga la app para iniciar sesión con tu Oxy ID.",
|
|
@@ -108,6 +108,7 @@
|
|
|
108
108
|
"loading": "Chargement des comptes...",
|
|
109
109
|
"qrHeadline": "Connectez-vous avec votre identité Oxy",
|
|
110
110
|
"signInWithOxy": "Se connecter avec Oxy",
|
|
111
|
+
"signUpWithOxy": "S'inscrire avec Oxy",
|
|
111
112
|
"useIdentityOnDevice": "Pas de Commons ? Utilisez une clé d'accès sur cet appareil",
|
|
112
113
|
"getCommons": "Obtenir Commons",
|
|
113
114
|
"commonsNotInstalled": "Pas de Commons ? Téléchargez l'app pour vous connecter avec votre Oxy ID.",
|
|
@@ -108,6 +108,7 @@
|
|
|
108
108
|
"loading": "Caricamento account...",
|
|
109
109
|
"qrHeadline": "Accedi con la tua identità Oxy",
|
|
110
110
|
"signInWithOxy": "Accedi con Oxy",
|
|
111
|
+
"signUpWithOxy": "Registrati con Oxy",
|
|
111
112
|
"useIdentityOnDevice": "Non hai Commons? Usa una passkey su questo dispositivo",
|
|
112
113
|
"getCommons": "Ottieni Commons",
|
|
113
114
|
"commonsNotInstalled": "Non hai Commons? Scarica l'app per accedere con il tuo Oxy ID.",
|
|
@@ -108,6 +108,7 @@
|
|
|
108
108
|
"loading": "アカウントを読み込み中...",
|
|
109
109
|
"qrHeadline": "Oxy IDでサインイン",
|
|
110
110
|
"signInWithOxy": "Oxyでサインイン",
|
|
111
|
+
"signUpWithOxy": "Oxyで登録",
|
|
111
112
|
"useIdentityOnDevice": "Commonsがありませんか?このデバイスのパスキーを使用",
|
|
112
113
|
"getCommons": "Commonsを入手",
|
|
113
114
|
"commonsNotInstalled": "Commonsがありませんか?アプリを入手してOxy IDでサインインしましょう。",
|
|
@@ -108,6 +108,7 @@
|
|
|
108
108
|
"loading": "계정을 불러오는 중...",
|
|
109
109
|
"qrHeadline": "Oxy ID로 로그인",
|
|
110
110
|
"signInWithOxy": "Oxy로 로그인",
|
|
111
|
+
"signUpWithOxy": "Oxy로 가입하기",
|
|
111
112
|
"useIdentityOnDevice": "Commons가 없으신가요? 이 기기의 패스키를 사용하세요",
|
|
112
113
|
"getCommons": "Commons 다운로드",
|
|
113
114
|
"commonsNotInstalled": "Commons가 없으신가요? 앱을 다운로드하여 Oxy ID로 로그인하세요.",
|
|
@@ -108,6 +108,7 @@
|
|
|
108
108
|
"loading": "A carregar contas...",
|
|
109
109
|
"qrHeadline": "Inicie sessão com a sua identidade Oxy",
|
|
110
110
|
"signInWithOxy": "Iniciar sessão com Oxy",
|
|
111
|
+
"signUpWithOxy": "Registar-se com Oxy",
|
|
111
112
|
"useIdentityOnDevice": "Não tem o Commons? Use uma chave de acesso neste dispositivo",
|
|
112
113
|
"getCommons": "Obter o Commons",
|
|
113
114
|
"commonsNotInstalled": "Não tem o Commons? Obtenha a app para iniciar sessão com o seu Oxy ID.",
|
|
@@ -108,6 +108,7 @@
|
|
|
108
108
|
"loading": "正在加载账户...",
|
|
109
109
|
"qrHeadline": "使用您的 Oxy 身份登录",
|
|
110
110
|
"signInWithOxy": "使用 Oxy 登录",
|
|
111
|
+
"signUpWithOxy": "使用 Oxy 注册",
|
|
111
112
|
"useIdentityOnDevice": "没有 Commons?改用此设备上的通行密钥",
|
|
112
113
|
"getCommons": "获取 Commons",
|
|
113
114
|
"commonsNotInstalled": "没有 Commons?获取应用以使用您的 Oxy ID 登录。",
|
|
@@ -108,6 +108,7 @@
|
|
|
108
108
|
"loading": "A carregar contas...",
|
|
109
109
|
"qrHeadline": "Inicie sessão com a sua identidade Oxy",
|
|
110
110
|
"signInWithOxy": "Iniciar sessão com Oxy",
|
|
111
|
+
"signUpWithOxy": "Registar-se com Oxy",
|
|
111
112
|
"useIdentityOnDevice": "Não tem o Commons? Use uma chave de acesso neste dispositivo",
|
|
112
113
|
"getCommons": "Obter o Commons",
|
|
113
114
|
"commonsNotInstalled": "Não tem o Commons? Obtenha a app para iniciar sessão com o seu Oxy ID.",
|
|
@@ -108,6 +108,7 @@
|
|
|
108
108
|
"loading": "正在加载账户...",
|
|
109
109
|
"qrHeadline": "使用您的 Oxy 身份登录",
|
|
110
110
|
"signInWithOxy": "使用 Oxy 登录",
|
|
111
|
+
"signUpWithOxy": "使用 Oxy 注册",
|
|
111
112
|
"useIdentityOnDevice": "没有 Commons?改用此设备上的通行密钥",
|
|
112
113
|
"getCommons": "获取 Commons",
|
|
113
114
|
"commonsNotInstalled": "没有 Commons?获取应用以使用您的 Oxy ID 登录。",
|
package/dist/esm/index.js
CHANGED
|
@@ -81,10 +81,11 @@ export { RecoveryPhraseService } from './crypto/recoveryPhrase.js';
|
|
|
81
81
|
export { hkdfSha256 } from './crypto/kdf.js';
|
|
82
82
|
export { encryptAead, decryptAead, AEAD_KEY_LENGTH, AEAD_NONCE_LENGTH, } from './crypto/aead.js';
|
|
83
83
|
export { deriveSharedSecret } from './crypto/ecdh.js';
|
|
84
|
-
// Web identity
|
|
85
|
-
//
|
|
86
|
-
export { WEB_IDENTITY_PRF_INPUT, WebIdentityUnlockError,
|
|
87
|
-
export {
|
|
84
|
+
// Web identity holder — the same root as Commons, sealed under a passkey's PRF
|
|
85
|
+
// output; identity proofs; transfer to Commons (docs/adr/0024-one-oxy-account-root-holders.md)
|
|
86
|
+
export { WEB_IDENTITY_PRF_INPUT, WebIdentityUnlockError, WEB_IDENTITY_PRF_OUTPUT_LENGTH, addWrap, deriveIdentityFromMnemonic, deriveIdentityFromPrivateKey, deriveIdentityFromRecoveryMaterial, deriveKeyEncryptionKey, generateDataKey, generateWebIdentity, isUsablePrfOutput, markWrapVerified, normalizeMnemonic, openWebIdentity, parseRecoveryMaterial, removeWrap, sealWebIdentity, unlockWebIdentity, unwrapDataKey, wipeBytes, wipeOpenedIdentity, } from './crypto/webIdentityCarrier.js';
|
|
87
|
+
export { digestIdentityPayload, signIdentityProof } from './crypto/identityProof.js';
|
|
88
|
+
export { buildMoveQrPayload, createMoveCommitment, deriveMoveKey, deriveMoveSas, digestMoveCiphertext, generateMoveEphemeralKeyPair, openMovedIdentity, parseMoveQrPayload, sealIdentityForMove, signMoveReceipt, verifyMoveCommitment, verifyMoveReceipt, } from './crypto/identityMove.js';
|
|
88
89
|
// ---------------------------------------------------------------------------
|
|
89
90
|
// Devices
|
|
90
91
|
// ---------------------------------------------------------------------------
|
|
@@ -61,7 +61,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
61
61
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
62
62
|
};
|
|
63
63
|
var _OxyInferenceClient_instances, _OxyInferenceClient_baseURL, _OxyInferenceClient_credential, _OxyInferenceClient_fetch, _OxyInferenceClient_bearer, _OxyInferenceClient_headers, _OxyInferenceClient_request;
|
|
64
|
-
import { INFERENCE_ERROR_CODES, inferenceStreamEventSchema, modelIdSchema } from '@oxy.so/contracts';
|
|
64
|
+
import { INFERENCE_ERROR_CODES, MAX_INFERENCE_AUDIO_BYTES, inferenceAudioMediaTypeSchema, inferenceStreamEventSchema, modelIdSchema, } from '@oxy.so/contracts';
|
|
65
65
|
/** The base URL of the Oxy API, when a caller names none. */
|
|
66
66
|
export const OXY_INFERENCE_BASE_URL = 'https://api.oxy.so';
|
|
67
67
|
/**
|
|
@@ -202,6 +202,63 @@ export class OxyInferenceClient {
|
|
|
202
202
|
: { delegatedUserId: options.delegatedUserId }),
|
|
203
203
|
});
|
|
204
204
|
}
|
|
205
|
+
/** Generate audio bytes through Oxy's authenticated inference edge. */
|
|
206
|
+
async speech(request, options = {}) {
|
|
207
|
+
const response = await __classPrivateFieldGet(this, _OxyInferenceClient_fetch, "f").call(this, `${__classPrivateFieldGet(this, _OxyInferenceClient_baseURL, "f")}/v1/audio/speech`, {
|
|
208
|
+
method: 'POST',
|
|
209
|
+
headers: await __classPrivateFieldGet(this, _OxyInferenceClient_instances, "m", _OxyInferenceClient_headers).call(this, 'audio/*', {
|
|
210
|
+
hasBody: true,
|
|
211
|
+
...(options.idempotencyKey === undefined
|
|
212
|
+
? {}
|
|
213
|
+
: { idempotencyKey: options.idempotencyKey }),
|
|
214
|
+
...(options.delegatedUserId === undefined
|
|
215
|
+
? {}
|
|
216
|
+
: { delegatedUserId: options.delegatedUserId }),
|
|
217
|
+
}),
|
|
218
|
+
body: JSON.stringify(request),
|
|
219
|
+
...(options.signal === undefined ? {} : { signal: options.signal }),
|
|
220
|
+
});
|
|
221
|
+
const requestId = response.headers.get('X-Oxy-Request-Id') ?? '';
|
|
222
|
+
if (!response.ok) {
|
|
223
|
+
throw toInferenceError(await response.json().catch(() => undefined), response.status, requestId);
|
|
224
|
+
}
|
|
225
|
+
const mediaType = inferenceAudioMediaTypeSchema.safeParse(mediaTypeOf(response));
|
|
226
|
+
if (!mediaType.success || !response.body) {
|
|
227
|
+
await cancelUnreadResponse(response);
|
|
228
|
+
throw protocolError('The inference API returned no supported audio body.', requestId);
|
|
229
|
+
}
|
|
230
|
+
const reader = response.body.getReader();
|
|
231
|
+
const chunks = [];
|
|
232
|
+
let size = 0;
|
|
233
|
+
let completed = false;
|
|
234
|
+
try {
|
|
235
|
+
while (true) {
|
|
236
|
+
const next = await reader.read();
|
|
237
|
+
if (next.done) {
|
|
238
|
+
completed = true;
|
|
239
|
+
break;
|
|
240
|
+
}
|
|
241
|
+
size += next.value.byteLength;
|
|
242
|
+
if (size > MAX_INFERENCE_AUDIO_BYTES)
|
|
243
|
+
throw protocolError('The inference audio exceeds the response limit.', requestId);
|
|
244
|
+
chunks.push(next.value);
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
finally {
|
|
248
|
+
if (!completed)
|
|
249
|
+
await reader.cancel().catch(() => undefined);
|
|
250
|
+
reader.releaseLock();
|
|
251
|
+
}
|
|
252
|
+
if (size === 0)
|
|
253
|
+
throw protocolError('The inference API returned empty audio.', requestId);
|
|
254
|
+
const audio = new Uint8Array(size);
|
|
255
|
+
let offset = 0;
|
|
256
|
+
for (const chunk of chunks) {
|
|
257
|
+
audio.set(chunk, offset);
|
|
258
|
+
offset += chunk.byteLength;
|
|
259
|
+
}
|
|
260
|
+
return { audio, mediaType: mediaType.data, requestId };
|
|
261
|
+
}
|
|
205
262
|
/**
|
|
206
263
|
* Stream one inference request from `POST /v1/responses`.
|
|
207
264
|
*
|
|
@@ -240,11 +297,7 @@ export class OxyInferenceClient {
|
|
|
240
297
|
throw toInferenceError(payload, response.status, response.headers.get('X-Oxy-Request-Id'));
|
|
241
298
|
}
|
|
242
299
|
const requestId = response.headers.get('X-Oxy-Request-Id') ?? undefined;
|
|
243
|
-
const mediaType = response
|
|
244
|
-
.get('Content-Type')
|
|
245
|
-
?.split(';', 1)[0]
|
|
246
|
-
?.trim()
|
|
247
|
-
.toLowerCase();
|
|
300
|
+
const mediaType = mediaTypeOf(response);
|
|
248
301
|
if (mediaType !== 'text/event-stream') {
|
|
249
302
|
await cancelUnreadResponse(response);
|
|
250
303
|
throw protocolError(`The inference API answered a streaming request with ${mediaType ?? 'no Content-Type'} instead of text/event-stream.`, requestId);
|
|
@@ -373,6 +426,10 @@ const MAX_INFERENCE_STREAM_EVENT_DATA_LINES = 4096;
|
|
|
373
426
|
function protocolError(message, requestId) {
|
|
374
427
|
return new OxyInferenceProtocolError(message, requestId);
|
|
375
428
|
}
|
|
429
|
+
/** The bare, lowercased media type of a response's `Content-Type`, if any. */
|
|
430
|
+
function mediaTypeOf(response) {
|
|
431
|
+
return response.headers.get('Content-Type')?.split(';', 1)[0]?.trim().toLowerCase();
|
|
432
|
+
}
|
|
376
433
|
/** Cancel a nominally successful response whose stream contract is unreadable. */
|
|
377
434
|
async function cancelUnreadResponse(response) {
|
|
378
435
|
await response.body?.cancel().catch(() => undefined);
|
|
@@ -162,6 +162,24 @@ export function OxyServicesAuthMixin(Base) {
|
|
|
162
162
|
const key = apiKey || this._serviceApiKey;
|
|
163
163
|
const secret = apiSecret || this._serviceApiSecret;
|
|
164
164
|
if (!key || !secret) {
|
|
165
|
+
/**
|
|
166
|
+
* No credential configured — so prove what this process IS instead
|
|
167
|
+
* (ADR 0026).
|
|
168
|
+
*
|
|
169
|
+
* This is what lets an official service drop its api key and secret
|
|
170
|
+
* WITHOUT a code change: remove the two environment variables, and the
|
|
171
|
+
* next token comes from the workload path. It is deliberately the
|
|
172
|
+
* fallback rather than the preference, so a deployment that still has a
|
|
173
|
+
* credential keeps using it and the migration is one service at a time.
|
|
174
|
+
*
|
|
175
|
+
* A process with no credential AND no attestation still gets the
|
|
176
|
+
* original error: "nothing to authenticate with" is the truth there, and
|
|
177
|
+
* a local checkout must not be told to go looking for a container
|
|
178
|
+
* credentials endpoint that is not there.
|
|
179
|
+
*/
|
|
180
|
+
if (await this._canUseWorkloadIdentity()) {
|
|
181
|
+
return this._getWorkloadServiceToken();
|
|
182
|
+
}
|
|
165
183
|
throw new Error('Service credentials not provided. Call configureServiceAuth() or pass apiKey and apiSecret.');
|
|
166
184
|
}
|
|
167
185
|
const cacheKey = await this._hashApiKey(key);
|
|
@@ -237,6 +255,84 @@ export function OxyServicesAuthMixin(Base) {
|
|
|
237
255
|
}
|
|
238
256
|
}
|
|
239
257
|
}
|
|
258
|
+
/**
|
|
259
|
+
* Whether this process can prove what it is (ADR 0026).
|
|
260
|
+
*
|
|
261
|
+
* The check and the module that performs it are loaded LAZILY and only on a
|
|
262
|
+
* Node host. `@oxy.so/core`'s root barrel reaches React Native and Expo, and
|
|
263
|
+
* `server/workloadIdentity` imports `node:crypto` — a static import here
|
|
264
|
+
* would pull it into every mobile bundle for a path a phone can never take.
|
|
265
|
+
*
|
|
266
|
+
* @internal
|
|
267
|
+
*/
|
|
268
|
+
async _canUseWorkloadIdentity() {
|
|
269
|
+
if (typeof process === 'undefined' || !process.versions?.node)
|
|
270
|
+
return false;
|
|
271
|
+
try {
|
|
272
|
+
const { canAttestWorkloadIdentity } = await import('../server/workloadIdentity');
|
|
273
|
+
return canAttestWorkloadIdentity();
|
|
274
|
+
}
|
|
275
|
+
catch {
|
|
276
|
+
// A bundler that dropped the server subpath, or a runtime without it.
|
|
277
|
+
// "We cannot attest here" is the correct reading, and the caller falls
|
|
278
|
+
// back to the credential error it would have thrown anyway.
|
|
279
|
+
return false;
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
/**
|
|
283
|
+
* A service token obtained by attestation, cached like a credential's.
|
|
284
|
+
*
|
|
285
|
+
* The cache key is a constant, not a credential hash: a process has exactly
|
|
286
|
+
* one identity, so there is nothing to key on and nothing to keep separate.
|
|
287
|
+
* The secret-comparison guard the credential path applies has nothing to
|
|
288
|
+
* compare here, which is the point — there is no secret.
|
|
289
|
+
*
|
|
290
|
+
* @internal
|
|
291
|
+
*/
|
|
292
|
+
async _getWorkloadServiceToken() {
|
|
293
|
+
const cacheKey = 'workload-identity';
|
|
294
|
+
const entry = this._serviceTokenCache.get(cacheKey);
|
|
295
|
+
const now = Date.now();
|
|
296
|
+
if (entry?.token && entry.expiresAt > now + 60000)
|
|
297
|
+
return entry.token;
|
|
298
|
+
if (entry?.pending)
|
|
299
|
+
return entry.pending;
|
|
300
|
+
const { requestWorkloadServiceToken } = await import('../server/workloadIdentity');
|
|
301
|
+
const seeded = entry ?? {
|
|
302
|
+
token: '',
|
|
303
|
+
expiresAt: 0,
|
|
304
|
+
secretBuf: Buffer.alloc(0),
|
|
305
|
+
pending: null,
|
|
306
|
+
apiKey: cacheKey,
|
|
307
|
+
};
|
|
308
|
+
this._serviceTokenCache.set(cacheKey, seeded);
|
|
309
|
+
const pending = (async () => {
|
|
310
|
+
const granted = await requestWorkloadServiceToken({ baseUrl: this.getBaseURL() });
|
|
311
|
+
const current = this._serviceTokenCache.get(cacheKey);
|
|
312
|
+
if (current) {
|
|
313
|
+
current.token = granted.token;
|
|
314
|
+
current.expiresAt = Date.now() + granted.expiresIn * 1000;
|
|
315
|
+
}
|
|
316
|
+
return granted.token;
|
|
317
|
+
})();
|
|
318
|
+
seeded.pending = pending;
|
|
319
|
+
try {
|
|
320
|
+
return await pending;
|
|
321
|
+
}
|
|
322
|
+
catch (error) {
|
|
323
|
+
// Never keep an entry that never held a token: the next caller must try
|
|
324
|
+
// again rather than inherit a failure.
|
|
325
|
+
const failed = this._serviceTokenCache.get(cacheKey);
|
|
326
|
+
if (failed?.pending === pending && !failed.token)
|
|
327
|
+
this._serviceTokenCache.delete(cacheKey);
|
|
328
|
+
throw error;
|
|
329
|
+
}
|
|
330
|
+
finally {
|
|
331
|
+
const settled = this._serviceTokenCache.get(cacheKey);
|
|
332
|
+
if (settled?.pending === pending)
|
|
333
|
+
settled.pending = null;
|
|
334
|
+
}
|
|
335
|
+
}
|
|
240
336
|
/**
|
|
241
337
|
* Perform the actual /auth/service-token request and cache the result.
|
|
242
338
|
* Separated so getServiceToken() can deduplicate concurrent calls.
|
|
@@ -71,50 +71,15 @@ export function OxyServicesIdentityMixin(Base) {
|
|
|
71
71
|
}
|
|
72
72
|
}
|
|
73
73
|
/**
|
|
74
|
-
*
|
|
75
|
-
*
|
|
76
|
-
*
|
|
77
|
-
*
|
|
78
|
-
*
|
|
79
|
-
* or no user is authenticated). The signed payload is
|
|
80
|
-
* `JSON.stringify({ action: 'link_identity', userId, timestamp })` — the
|
|
81
|
-
* exact bytes the server reconstructs and verifies.
|
|
74
|
+
* The signed-in account's root readiness (ADR 0024 D5): whether a root is
|
|
75
|
+
* linked, how many passkeys can open the web holder, whether the root has a
|
|
76
|
+
* phrase and whether it is saved and was shown to recover it. Metadata only —
|
|
77
|
+
* nothing here can open the root — so any first-party surface may show a
|
|
78
|
+
* "save your recovery phrase" reminder from it.
|
|
82
79
|
*/
|
|
83
|
-
async
|
|
80
|
+
async getIdentityRootStatus() {
|
|
84
81
|
try {
|
|
85
|
-
|
|
86
|
-
if (!userId) {
|
|
87
|
-
throw new Error('No authenticated user — sign in before linking an identity key.');
|
|
88
|
-
}
|
|
89
|
-
const publicKey = await KeyManager.getPublicKey();
|
|
90
|
-
if (!publicKey) {
|
|
91
|
-
throw new Error('No identity found on this device. Create or import an identity first.');
|
|
92
|
-
}
|
|
93
|
-
const timestamp = Date.now();
|
|
94
|
-
// The signed message MUST match the server's reconstruction byte-for-byte:
|
|
95
|
-
// JSON.stringify with this exact key order (action, userId, timestamp).
|
|
96
|
-
const message = JSON.stringify({ action: 'link_identity', userId, timestamp });
|
|
97
|
-
const signature = await SignatureService.sign(message);
|
|
98
|
-
const result = await this.makeRequest('POST', '/auth/link', { type: 'identity', publicKey, signature, timestamp }, { cache: false });
|
|
99
|
-
this._invalidateIdentityCaches(userId);
|
|
100
|
-
return result;
|
|
101
|
-
}
|
|
102
|
-
catch (error) {
|
|
103
|
-
throw this.handleError(error);
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
/**
|
|
107
|
-
* Unlink an authentication method from the current account. The server
|
|
108
|
-
* refuses to remove the last remaining method (the account would become
|
|
109
|
-
* inaccessible). Unlinking `identity` downgrades the account to custodial.
|
|
110
|
-
*
|
|
111
|
-
* @param type - The auth-method type to remove.
|
|
112
|
-
*/
|
|
113
|
-
async unlinkAuthMethod(type) {
|
|
114
|
-
try {
|
|
115
|
-
const result = await this.makeRequest('DELETE', `/auth/link/${encodeURIComponent(type)}`, undefined, { cache: false });
|
|
116
|
-
this._invalidateIdentityCaches(this.getCurrentUserId());
|
|
117
|
-
return result;
|
|
82
|
+
return await this.makeRequest('GET', '/identity/root-status', undefined, { cache: false });
|
|
118
83
|
}
|
|
119
84
|
catch (error) {
|
|
120
85
|
throw this.handleError(error);
|
|
@@ -123,10 +88,12 @@ export function OxyServicesIdentityMixin(Base) {
|
|
|
123
88
|
/**
|
|
124
89
|
* Remove ONE passkey (WebAuthn credential) from the current account.
|
|
125
90
|
*
|
|
126
|
-
* Passkeys are per-credential, so
|
|
127
|
-
* removes an auth method by type) this targets a specific credential id.
|
|
91
|
+
* Passkeys are per-credential, so this targets a specific credential id.
|
|
128
92
|
* The server refuses to remove the last remaining auth method (the account
|
|
129
93
|
* would become inaccessible) and deletes the stored `WebauthnCredential`.
|
|
94
|
+
* A passkey that also opens the account's root on the web takes its wrap with
|
|
95
|
+
* it, and the ONLY such passkey is refused with
|
|
96
|
+
* `code: 'IDENTITY_LAST_WEB_HOLDER'` (ADR 0024 D6).
|
|
130
97
|
*
|
|
131
98
|
* @param credentialId - The passkey's public credential id
|
|
132
99
|
* (`AuthMethodEntry.credentialId`).
|
package/dist/esm/mixins/index.js
CHANGED
|
@@ -34,7 +34,6 @@ import { OxyServicesNodesMixin } from './OxyServices.nodes.js';
|
|
|
34
34
|
import { OxyServicesFollowGraphMixin } from './OxyServices.followGraph.js';
|
|
35
35
|
import { OxyServicesInferenceMixin } from './OxyServices.inference.js';
|
|
36
36
|
import { OxyServicesDeviceBootMixin } from './OxyServices.deviceBoot.js';
|
|
37
|
-
import { OxyServicesDeviceTransferMixin } from './OxyServices.deviceTransfer.js';
|
|
38
37
|
/**
|
|
39
38
|
* Mixin pipeline - applied in order from first to last.
|
|
40
39
|
*
|
|
@@ -106,7 +105,6 @@ const MIXIN_PIPELINE = [
|
|
|
106
105
|
OxyServicesDeviceBootMixin,
|
|
107
106
|
// Device-to-device identity transfer ("add a device"): E2E-encrypted key
|
|
108
107
|
// clone over a short-lived relay (b3 Feature 2).
|
|
109
|
-
OxyServicesDeviceTransferMixin,
|
|
110
108
|
// Utility (last, can use all above)
|
|
111
109
|
OxyServicesUtilityMixin,
|
|
112
110
|
];
|
package/dist/esm/server/index.js
CHANGED
|
@@ -50,3 +50,10 @@ export { registrableApex } from '../utils/registrableApex.js';
|
|
|
50
50
|
export { isOfficialWebOrigin } from '../utils/officialOrigins.js';
|
|
51
51
|
export { createEcosystemTraffic } from './traffic.js';
|
|
52
52
|
export { observeNodeHttp, withoutNodeHttpObservation } from './trafficNodeHttp.js';
|
|
53
|
+
/**
|
|
54
|
+
* Workload identity (ADR 0026): a first-party service asks Oxy for a service
|
|
55
|
+
* token by proving what it IS, with no api key and no secret. Server-only, and
|
|
56
|
+
* exported from this subpath rather than the root barrel because it reaches the
|
|
57
|
+
* container credentials endpoint.
|
|
58
|
+
*/
|
|
59
|
+
export { canAttestWorkloadIdentity, requestWorkloadServiceToken } from './workloadIdentity.js';
|
|
@@ -320,9 +320,16 @@ export function buildOxyPagesHeaders(options = {}) {
|
|
|
320
320
|
if (hashes.length > MAX_INLINE_SCRIPT_HASHES) {
|
|
321
321
|
throw new RangeError(`Oxy CSP: ${hashes.length} distinct inline scripts in the built HTML exceeds the ${MAX_INLINE_SCRIPT_HASHES}-hash ceiling. A per-route inline data block (e.g. an Expo Router loader) is the likely cause; allow it deliberately rather than by raising this.`);
|
|
322
322
|
}
|
|
323
|
-
const
|
|
323
|
+
const directives = buildOxyCspDirectives(hashes.length === 0
|
|
324
324
|
? options.csp
|
|
325
|
-
: { ...options.csp, scriptSrc: [...(options.csp?.scriptSrc ?? []), ...hashes] })
|
|
325
|
+
: { ...options.csp, scriptSrc: [...(options.csp?.scriptSrc ?? []), ...hashes] });
|
|
326
|
+
if (options.sensitive) {
|
|
327
|
+
const beacon = new Set([CLOUDFLARE_INSIGHTS_SCRIPT_ORIGIN, CLOUDFLARE_INSIGHTS_REPORT_ORIGIN]);
|
|
328
|
+
for (const name of ['script-src', 'connect-src']) {
|
|
329
|
+
directives[name] = (directives[name] ?? []).filter((source) => !beacon.has(source));
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
const csp = formatOxyCspPolicy(directives);
|
|
326
333
|
const lines = [
|
|
327
334
|
'/*',
|
|
328
335
|
` Content-Security-Policy: ${csp}`,
|