@arbidocs/client 0.3.16 → 0.3.17
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/README.md +8 -8
- package/dist/index.cjs +17 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +34 -22
- package/dist/index.d.ts +34 -22
- package/dist/index.js +17 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -20,8 +20,8 @@ npm install fake-indexeddb
|
|
|
20
20
|
import { createArbiClient } from '@arbidocs/client'
|
|
21
21
|
|
|
22
22
|
const arbi = createArbiClient({
|
|
23
|
-
baseUrl: 'https://
|
|
24
|
-
deploymentDomain: '
|
|
23
|
+
baseUrl: 'https://www.arbidocs.com',
|
|
24
|
+
deploymentDomain: 'www.arbidocs.com',
|
|
25
25
|
})
|
|
26
26
|
|
|
27
27
|
// Login
|
|
@@ -46,8 +46,8 @@ const { createArbiClient } = require('@arbidocs/client')
|
|
|
46
46
|
|
|
47
47
|
async function main() {
|
|
48
48
|
const arbi = createArbiClient({
|
|
49
|
-
baseUrl: 'https://
|
|
50
|
-
deploymentDomain: '
|
|
49
|
+
baseUrl: 'https://www.arbidocs.com',
|
|
50
|
+
deploymentDomain: 'www.arbidocs.com',
|
|
51
51
|
credentials: 'omit', // No cookies in Node.js
|
|
52
52
|
})
|
|
53
53
|
|
|
@@ -88,8 +88,8 @@ const {
|
|
|
88
88
|
|
|
89
89
|
async function main() {
|
|
90
90
|
const arbi = createArbiClient({
|
|
91
|
-
baseUrl: 'https://
|
|
92
|
-
deploymentDomain: '
|
|
91
|
+
baseUrl: 'https://www.arbidocs.com',
|
|
92
|
+
deploymentDomain: 'www.arbidocs.com',
|
|
93
93
|
credentials: 'omit',
|
|
94
94
|
})
|
|
95
95
|
|
|
@@ -131,7 +131,7 @@ async function main() {
|
|
|
131
131
|
formData.append('files', new Blob([pdf], { type: 'application/pdf' }), 'contract.pdf')
|
|
132
132
|
|
|
133
133
|
const uploadRes = await fetch(
|
|
134
|
-
`https://
|
|
134
|
+
`https://www.arbidocs.com/api/document/upload?workspace_ext_id=${workspace.external_id}`,
|
|
135
135
|
{
|
|
136
136
|
method: 'POST',
|
|
137
137
|
headers: {
|
|
@@ -187,7 +187,7 @@ Creates an SDK client instance.
|
|
|
187
187
|
|
|
188
188
|
```typescript
|
|
189
189
|
interface ArbiClientOptions {
|
|
190
|
-
baseUrl: string // ARBI API URL (e.g. "https://
|
|
190
|
+
baseUrl: string // ARBI API URL (e.g. "https://www.arbidocs.com")
|
|
191
191
|
deploymentDomain: string // Used for deterministic key derivation
|
|
192
192
|
credentials?: RequestCredentials // Default: 'include'. Use 'omit' for Node.js
|
|
193
193
|
ssoTokenProvider?: { getToken(): Promise<string | null> } | null
|
package/dist/index.cjs
CHANGED
|
@@ -618,6 +618,14 @@ async function getOrCreateWrappingKey() {
|
|
|
618
618
|
if (result?.key) {
|
|
619
619
|
resolve(result.key);
|
|
620
620
|
} else {
|
|
621
|
+
if (!crypto?.subtle) {
|
|
622
|
+
reject(
|
|
623
|
+
new Error(
|
|
624
|
+
"Web Crypto API not available. Ensure the page is served over HTTPS or localhost."
|
|
625
|
+
)
|
|
626
|
+
);
|
|
627
|
+
return;
|
|
628
|
+
}
|
|
621
629
|
crypto.subtle.generateKey(
|
|
622
630
|
{
|
|
623
631
|
name: "AES-GCM",
|
|
@@ -684,6 +692,9 @@ async function decryptWithWrappingKey(ciphertext, iv) {
|
|
|
684
692
|
return new Uint8Array(decrypted);
|
|
685
693
|
}
|
|
686
694
|
async function saveSession(sessionData) {
|
|
695
|
+
if (!crypto?.subtle) {
|
|
696
|
+
return;
|
|
697
|
+
}
|
|
687
698
|
await ensureDatabase();
|
|
688
699
|
if (!db) {
|
|
689
700
|
throw new Error("Database not initialized");
|
|
@@ -725,6 +736,9 @@ async function saveSession(sessionData) {
|
|
|
725
736
|
}
|
|
726
737
|
}
|
|
727
738
|
async function getSession() {
|
|
739
|
+
if (!crypto?.subtle) {
|
|
740
|
+
return null;
|
|
741
|
+
}
|
|
728
742
|
await ensureDatabase();
|
|
729
743
|
if (!db) {
|
|
730
744
|
throw new Error("Database not initialized");
|
|
@@ -833,6 +847,9 @@ async function clearWrappingKey() {
|
|
|
833
847
|
});
|
|
834
848
|
}
|
|
835
849
|
async function clearAllData() {
|
|
850
|
+
if (!crypto?.subtle) {
|
|
851
|
+
return;
|
|
852
|
+
}
|
|
836
853
|
await clearSession();
|
|
837
854
|
await clearWrappingKey();
|
|
838
855
|
}
|