prividium 0.1.2 → 0.1.4
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 +23 -14
- package/dist/cli/commands/config.js +2 -2
- package/dist/cli/commands/proxy.js +3 -3
- package/dist/cli/server/config-file.js +1 -1
- package/dist/cli/server/connection-workflow.js +1 -1
- package/dist/cli/server/server.js +12 -3
- package/dist/cli/static/callback.html +3 -3
- package/dist/sdk/error-utils.d.ts +4 -0
- package/dist/sdk/error-utils.js +21 -0
- package/dist/sdk/index.d.ts +1 -0
- package/dist/sdk/index.js +1 -0
- package/dist/sdk/prividium-chain.js +10 -8
- package/dist/sdk/rpc-error-codes.d.ts +24 -0
- package/dist/sdk/rpc-error-codes.js +24 -0
- package/dist/tsconfig.sdk.tsbuildinfo +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
# Prividium SDK & CLI
|
|
1
|
+
# Prividium™ SDK & CLI
|
|
2
2
|
|
|
3
|
-
A TypeScript SDK and CLI for integrating with the Prividium authorization system. The SDK provides popup OAuth, token
|
|
4
|
-
management, and a viem transport for secure RPC; the CLI runs a local authenticated JSON-RPC proxy to your Prividium
|
|
5
|
-
and manages basic configuration.
|
|
3
|
+
A TypeScript SDK and CLI for integrating with the Prividium™ authorization system. The SDK provides popup OAuth, token
|
|
4
|
+
management, and a viem transport for secure RPC; the CLI runs a local authenticated JSON-RPC proxy to your Prividium™
|
|
5
|
+
RPC and manages basic configuration.
|
|
6
6
|
|
|
7
7
|
## Features
|
|
8
8
|
|
|
@@ -31,7 +31,7 @@ npx prividium proxy
|
|
|
31
31
|
|
|
32
32
|
## Quick Start
|
|
33
33
|
|
|
34
|
-
### 1. Create a Prividium Chain
|
|
34
|
+
### 1. Create a Prividium™ Chain
|
|
35
35
|
|
|
36
36
|
```typescript
|
|
37
37
|
import { createPrividiumChain } from 'prividium';
|
|
@@ -40,7 +40,7 @@ import { defineChain, createPublicClient, http } from 'viem';
|
|
|
40
40
|
// Define your chain
|
|
41
41
|
const prividiumChain = defineChain({
|
|
42
42
|
id: 7777,
|
|
43
|
-
name: 'Prividium Chain',
|
|
43
|
+
name: 'Prividium™ Chain',
|
|
44
44
|
nativeCurrency: { name: 'Ether', symbol: 'ETH', decimals: 18 },
|
|
45
45
|
rpcUrls: { default: { http: [] } },
|
|
46
46
|
blockExplorers: { default: { name: 'Explorer', url: 'https://explorer.prividium.io' } }
|
|
@@ -54,6 +54,7 @@ const prividium = createPrividiumChain({
|
|
|
54
54
|
chain: prividiumChain,
|
|
55
55
|
rpcUrl: 'https://rpc.prividium.io',
|
|
56
56
|
authBaseUrl: 'https://auth.prividium.io',
|
|
57
|
+
permissionsApiBaseUrl: 'https://permissions.prividium.io/api',
|
|
57
58
|
redirectUrl: window.location.origin + '/auth/callback',
|
|
58
59
|
onAuthExpiry: () => {
|
|
59
60
|
console.log('Authentication expired - please reconnect');
|
|
@@ -88,13 +89,13 @@ const balance = await client.getBalance({
|
|
|
88
89
|
|
|
89
90
|
### 4. Sending Transactions with Injected Wallets (MetaMask)
|
|
90
91
|
|
|
91
|
-
Before sending transactions through injected wallets, you need to add the Prividium network and enable wallet RPC for
|
|
92
|
+
Before sending transactions through injected wallets, you need to add the Prividium™ network and enable wallet RPC for
|
|
92
93
|
each transaction.
|
|
93
94
|
|
|
94
95
|
```typescript
|
|
95
96
|
import { createWalletClient, custom, encodeFunctionData } from 'viem';
|
|
96
97
|
|
|
97
|
-
// Add Prividium network to MetaMask
|
|
98
|
+
// Add Prividium™ network to MetaMask
|
|
98
99
|
await prividium.addNetworkToWallet();
|
|
99
100
|
|
|
100
101
|
// Create wallet client for MetaMask
|
|
@@ -172,7 +173,7 @@ page at the `redirectUrl` you configured:
|
|
|
172
173
|
|
|
173
174
|
**How it works:**
|
|
174
175
|
|
|
175
|
-
1. User clicks "Login" → SDK opens popup to Prividium user panel
|
|
176
|
+
1. User clicks "Login" → SDK opens popup to Prividium™ user panel
|
|
176
177
|
2. User authenticates → user panel redirects popup to your callback page
|
|
177
178
|
3. Callback page calls `handleAuthCallback()` → token is posted back to parent via `postMessage`
|
|
178
179
|
4. SDK receives token, validates state parameter (CSRF protection), and closes popup
|
|
@@ -194,6 +195,7 @@ const prividium = createPrividiumChain({
|
|
|
194
195
|
chain: prividiumChain,
|
|
195
196
|
rpcUrl: 'https://rpc.prividium.io',
|
|
196
197
|
authBaseUrl: 'https://auth.prividium.io',
|
|
198
|
+
permissionsApiBaseUrl: 'https://permissions.prividium.io/api',
|
|
197
199
|
redirectUrl: window.location.origin + '/auth/callback',
|
|
198
200
|
onAuthExpiry: () => {
|
|
199
201
|
console.log('Authentication expired');
|
|
@@ -217,7 +219,7 @@ are not met, the user panel will guide them through the necessary setup steps be
|
|
|
217
219
|
|
|
218
220
|
### `createPrividiumChain(config)`
|
|
219
221
|
|
|
220
|
-
Creates a new Prividium SDK instance.
|
|
222
|
+
Creates a new Prividium™ SDK instance.
|
|
221
223
|
|
|
222
224
|
**Parameters:**
|
|
223
225
|
|
|
@@ -227,6 +229,7 @@ interface PrividiumConfig {
|
|
|
227
229
|
chain: Chain; // Viem chain configuration (without rpcUrls)
|
|
228
230
|
rpcUrl: string; // Private RPC endpoint URL
|
|
229
231
|
authBaseUrl: string; // Authorization service base URL
|
|
232
|
+
permissionsApiBaseUrl: string; // Permissions API service base URL
|
|
230
233
|
redirectUrl: string; // OAuth redirect URL
|
|
231
234
|
storage?: Storage; // Custom storage implementation (optional)
|
|
232
235
|
onAuthExpiry?: () => void; // Called when authentication expires (optional)
|
|
@@ -333,7 +336,7 @@ const prividium = createPrividiumChain({
|
|
|
333
336
|
|
|
334
337
|
### Multiple Chains
|
|
335
338
|
|
|
336
|
-
Support multiple Prividium chains:
|
|
339
|
+
Support multiple Prividium™ chains:
|
|
337
340
|
|
|
338
341
|
```typescript
|
|
339
342
|
const testnetPrividium = createPrividiumChain({
|
|
@@ -341,6 +344,7 @@ const testnetPrividium = createPrividiumChain({
|
|
|
341
344
|
chain: testnetChain,
|
|
342
345
|
rpcUrl: 'https://testnet-rpc.prividium.io',
|
|
343
346
|
authBaseUrl: 'https://testnet-auth.prividium.io',
|
|
347
|
+
permissionsApiBaseUrl: 'https://testnet-permissions.prividium.io/api',
|
|
344
348
|
redirectUrl: window.location.origin + '/auth/callback'
|
|
345
349
|
});
|
|
346
350
|
|
|
@@ -349,6 +353,7 @@ const mainnetPrividium = createPrividiumChain({
|
|
|
349
353
|
chain: mainnetChain,
|
|
350
354
|
rpcUrl: 'https://mainnet-rpc.prividium.io',
|
|
351
355
|
authBaseUrl: 'https://mainnet-auth.prividium.io',
|
|
356
|
+
permissionsApiBaseUrl: 'https://mainnet-permissions.prividium.io/api',
|
|
352
357
|
redirectUrl: window.location.origin + '/auth/callback'
|
|
353
358
|
});
|
|
354
359
|
```
|
|
@@ -404,9 +409,13 @@ The SDK uses the following localStorage keys:
|
|
|
404
409
|
|
|
405
410
|
## CLI
|
|
406
411
|
|
|
407
|
-
Run a local, authenticated RPC proxy that forwards JSON-RPC requests to your Prividium RPC while injecting the OAuth
|
|
412
|
+
Run a local, authenticated RPC proxy that forwards JSON-RPC requests to your Prividium™ RPC while injecting the OAuth
|
|
408
413
|
token obtained via a quick browser sign-in.
|
|
409
414
|
|
|
415
|
+
The proxy CLI is particularly useful for deploying contracts with standard Ethereum tools (like Foundry or Hardhat)
|
|
416
|
+
without having to manage authentication manually. The proxy automatically handles authentication headers, allowing you
|
|
417
|
+
to use your existing deployment workflows.
|
|
418
|
+
|
|
410
419
|
### Install & Run
|
|
411
420
|
|
|
412
421
|
- Use without installing: `npx prividium proxy`
|
|
@@ -430,8 +439,8 @@ What happens:
|
|
|
430
439
|
|
|
431
440
|
Flags:
|
|
432
441
|
|
|
433
|
-
- `--rpc-url, -r` (string): Target Prividium RPC URL.
|
|
434
|
-
- `--user-panel-url, -u` (string): URL used to log in to Prividium
|
|
442
|
+
- `--rpc-url, -r` (string): Target Prividium™ RPC URL.
|
|
443
|
+
- `--user-panel-url, -u` (string): URL used to log in to Prividium™.
|
|
435
444
|
- `--port, -p` (number, default `24101`): Local proxy port. This has to match with the port configured in the admin
|
|
436
445
|
panel, which by default uses this same port.
|
|
437
446
|
- `--host, -h` (string, default `127.0.0.1`): host binded to server. By default only connections comming from local
|
|
@@ -23,13 +23,13 @@ export const addConfig = (cli) => {
|
|
|
23
23
|
.command('set', 'Updates config', (yargs) => yargs
|
|
24
24
|
.option('rpcUrl', {
|
|
25
25
|
alias: ['rpc-url', 'r'],
|
|
26
|
-
description: 'Specifies target Prividium rpc url. These takes precedence over config file and env variable.',
|
|
26
|
+
description: 'Specifies target Prividium™ rpc url. These takes precedence over config file and env variable.',
|
|
27
27
|
demandOption: true,
|
|
28
28
|
type: 'string'
|
|
29
29
|
})
|
|
30
30
|
.option('userPanelUrl', {
|
|
31
31
|
alias: ['user-panel-url', 'u'],
|
|
32
|
-
description: 'Specifies url used to log in into the Prividium network. Takes precedence over config file and env variable',
|
|
32
|
+
description: 'Specifies url used to log in into the Prividium™ network. Takes precedence over config file and env variable',
|
|
33
33
|
type: 'string',
|
|
34
34
|
demandOption: true
|
|
35
35
|
}), (args) => updateConfig({
|
|
@@ -35,13 +35,13 @@ export const addProxy = (cli) => {
|
|
|
35
35
|
return cli.command('proxy', 'Starts authenticated rpc proxy server', (yargs) => yargs
|
|
36
36
|
.option('rpcUrl', {
|
|
37
37
|
alias: ['rpc-url', 'r'],
|
|
38
|
-
description: 'Specifies target Prividium rpc url. These takes precedence over config file and env variable.',
|
|
38
|
+
description: 'Specifies target Prividium™ rpc url. These takes precedence over config file and env variable.',
|
|
39
39
|
demandOption: false,
|
|
40
40
|
type: 'string'
|
|
41
41
|
})
|
|
42
42
|
.option('userPanelUrl', {
|
|
43
43
|
alias: ['user-panel-url', 'u'],
|
|
44
|
-
description: 'Specifies url used to log in into the Prividium network. Takes precedence over config file and env variable',
|
|
44
|
+
description: 'Specifies url used to log in into the Prividium™ network. Takes precedence over config file and env variable',
|
|
45
45
|
type: 'string'
|
|
46
46
|
})
|
|
47
47
|
.option('configPath', {
|
|
@@ -52,7 +52,7 @@ export const addProxy = (cli) => {
|
|
|
52
52
|
})
|
|
53
53
|
.option('port', {
|
|
54
54
|
alias: ['p'],
|
|
55
|
-
description: 'Port used for local proxy. This has to match with the port configured in your Prividium network.',
|
|
55
|
+
description: 'Port used for local proxy. This has to match with the port configured in your Prividium™ network.',
|
|
56
56
|
default: 24101,
|
|
57
57
|
type: 'number'
|
|
58
58
|
})
|
|
@@ -49,7 +49,7 @@ export class ConfigFile {
|
|
|
49
49
|
}
|
|
50
50
|
print() {
|
|
51
51
|
const { prividiumRpcUrl, userPanelUrl } = this.read();
|
|
52
|
-
console.log(`${color.bold('Prividium rpc url')}: ${prividiumRpcUrl}`);
|
|
52
|
+
console.log(`${color.bold('Prividium™ rpc url')}: ${prividiumRpcUrl}`);
|
|
53
53
|
console.log(`${color.bold('Log in url')}: ${userPanelUrl}`);
|
|
54
54
|
}
|
|
55
55
|
printPath() {
|
|
@@ -19,7 +19,7 @@ export class CreationWorkflow {
|
|
|
19
19
|
start() {
|
|
20
20
|
console.log(color.blue(HEADER));
|
|
21
21
|
console.log('');
|
|
22
|
-
intro('Starting
|
|
22
|
+
intro('Starting Prividium™ proxy');
|
|
23
23
|
}
|
|
24
24
|
async gatherData(maybePrividiumRpcUrl, maybeUserPanelUrl) {
|
|
25
25
|
const { url: prividiumRpcUrl, prompted: prompted1 } = await this.askForUrl(maybePrividiumRpcUrl, 'prividium rpc');
|
|
@@ -11,6 +11,8 @@ function fastifyApp() {
|
|
|
11
11
|
function randomStateString() {
|
|
12
12
|
return randomBytes(20).toString('hex');
|
|
13
13
|
}
|
|
14
|
+
const rpcCallSchema = z.object({ method: z.string() });
|
|
15
|
+
const rpcReqSchema = z.union([rpcCallSchema, rpcCallSchema.array()]);
|
|
14
16
|
export function buildServer(config) {
|
|
15
17
|
const app = fastifyApp();
|
|
16
18
|
app.setValidatorCompiler(validatorCompiler);
|
|
@@ -57,9 +59,16 @@ export function buildServer(config) {
|
|
|
57
59
|
rewritePrefix: '/rpc',
|
|
58
60
|
routes: ['/'],
|
|
59
61
|
preValidation: (request, _reply, done) => {
|
|
60
|
-
const
|
|
61
|
-
|
|
62
|
-
|
|
62
|
+
const method = rpcReqSchema.safeParse(request.body);
|
|
63
|
+
if (!method.success) {
|
|
64
|
+
config.onCall('unknown');
|
|
65
|
+
}
|
|
66
|
+
else if (Array.isArray(method.data)) {
|
|
67
|
+
config.onCall(method.data.map((m) => m.method).join(', '));
|
|
68
|
+
}
|
|
69
|
+
else {
|
|
70
|
+
config.onCall(method.data.method);
|
|
71
|
+
}
|
|
63
72
|
done();
|
|
64
73
|
},
|
|
65
74
|
preHandler: (_req, reply, done) => {
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
<head>
|
|
4
4
|
<meta charset="UTF-8" />
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
6
|
-
<title>Prividium
|
|
6
|
+
<title>Prividium™</title>
|
|
7
7
|
<script src="https://cdn.tailwindcss.com"></script>
|
|
8
8
|
</head>
|
|
9
9
|
<body
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
id="main-title"
|
|
17
17
|
class="text-2xl md:text-3xl font-bold bg-gradient-to-r from-blue-700 to-blue-900 bg-clip-text text-transparent"
|
|
18
18
|
>
|
|
19
|
-
Finalizing Prividium sign-in...
|
|
19
|
+
Finalizing Prividium™ sign-in...
|
|
20
20
|
</h1>
|
|
21
21
|
<div class="mt-4">
|
|
22
22
|
<svg
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
</div>
|
|
36
36
|
<div id="proxy-url" style="display: none" class="mt-6 text-blue-700 text-center">
|
|
37
37
|
<img src="https://www.zksync.io/faq/faq-brackets.svg" alt="Success" class="h-12 w-auto mx-auto mb-3" />
|
|
38
|
-
<span>You can now access your Prividium RPC proxy at: </span>
|
|
38
|
+
<span>You can now access your Prividium™ RPC proxy at: </span>
|
|
39
39
|
<span class="font-bold">http://127.0.0.1:24101/rpc</span>
|
|
40
40
|
</div>
|
|
41
41
|
</div>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { UNAUTHORIZED_ERROR_CODE, FORBIDDEN_ERROR_CODE } from './rpc-error-codes.js';
|
|
3
|
+
const jsonRpcErrorSchema = z.object({
|
|
4
|
+
error: z.object({
|
|
5
|
+
code: z.number(),
|
|
6
|
+
message: z.string().optional(),
|
|
7
|
+
data: z.unknown().optional()
|
|
8
|
+
})
|
|
9
|
+
});
|
|
10
|
+
/**
|
|
11
|
+
* Checks if a Response contains a Prividium unauthorized/forbidden error.
|
|
12
|
+
*/
|
|
13
|
+
export async function hasPrividiumUnauthorizedError(response) {
|
|
14
|
+
const clonedResponse = response.clone();
|
|
15
|
+
const parsed = jsonRpcErrorSchema.safeParse(await clonedResponse.json());
|
|
16
|
+
// { success: false, error: {...} } | { success: true, data: {...} }
|
|
17
|
+
if (parsed.success) {
|
|
18
|
+
return [UNAUTHORIZED_ERROR_CODE, FORBIDDEN_ERROR_CODE].includes(parsed.data.error.code);
|
|
19
|
+
}
|
|
20
|
+
return false;
|
|
21
|
+
}
|
package/dist/sdk/index.d.ts
CHANGED
|
@@ -4,3 +4,4 @@ export { AUTH_ERRORS, STORAGE_KEYS } from './types.js';
|
|
|
4
4
|
export { LocalStorage, TokenManager } from './storage.js';
|
|
5
5
|
export { generateRandomState } from './token-utils.js';
|
|
6
6
|
export { PopupAuth, handleAuthCallback, type AuthCallbackMessage, type OauthScope } from './popup-auth.js';
|
|
7
|
+
export { UNAUTHORIZED_ERROR_CODE, FORBIDDEN_ERROR_CODE } from './rpc-error-codes.js';
|
package/dist/sdk/index.js
CHANGED
|
@@ -3,3 +3,4 @@ export { AUTH_ERRORS, STORAGE_KEYS } from './types.js';
|
|
|
3
3
|
export { LocalStorage, TokenManager } from './storage.js';
|
|
4
4
|
export { generateRandomState } from './token-utils.js';
|
|
5
5
|
export { PopupAuth, handleAuthCallback } from './popup-auth.js';
|
|
6
|
+
export { UNAUTHORIZED_ERROR_CODE, FORBIDDEN_ERROR_CODE } from './rpc-error-codes.js';
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { http } from 'viem';
|
|
2
|
-
import {
|
|
2
|
+
import { mainnet } from 'viem/chains';
|
|
3
3
|
import { LocalStorage, TokenManager } from './storage.js';
|
|
4
4
|
import { PopupAuth } from './popup-auth.js';
|
|
5
|
+
import { hasPrividiumUnauthorizedError } from './error-utils.js';
|
|
5
6
|
export function createPrividiumChain(config) {
|
|
6
7
|
const storage = config.storage || new LocalStorage();
|
|
7
8
|
const tokenManager = new TokenManager(storage, config.chain.id);
|
|
@@ -33,9 +34,9 @@ export function createPrividiumChain(config) {
|
|
|
33
34
|
...getAuthHeaders()
|
|
34
35
|
};
|
|
35
36
|
},
|
|
36
|
-
onFetchResponse: (response) => {
|
|
37
|
-
// Handle
|
|
38
|
-
if (response
|
|
37
|
+
onFetchResponse: async (response) => {
|
|
38
|
+
// Handle JSON RPC 2.0 error responses with authorization error codes
|
|
39
|
+
if (await hasPrividiumUnauthorizedError(response)) {
|
|
39
40
|
tokenManager.clearToken();
|
|
40
41
|
config.onAuthExpiry?.();
|
|
41
42
|
}
|
|
@@ -43,14 +44,15 @@ export function createPrividiumChain(config) {
|
|
|
43
44
|
});
|
|
44
45
|
return {
|
|
45
46
|
chain: {
|
|
46
|
-
...
|
|
47
|
+
...mainnet,
|
|
47
48
|
...config.chain,
|
|
49
|
+
id: config.chain.id,
|
|
48
50
|
contracts: {
|
|
49
|
-
...chainConfig.contracts,
|
|
50
51
|
...config.chain.contracts,
|
|
51
|
-
multicall3: undefined // Prividium doesn't support multicall yet
|
|
52
|
+
multicall3: undefined // Prividium™ doesn't support multicall yet
|
|
52
53
|
},
|
|
53
|
-
rpcUrls: { default: { http: [config.rpcUrl] } }
|
|
54
|
+
rpcUrls: { default: { http: [config.rpcUrl] } },
|
|
55
|
+
blockExplorers: config.chain.blockExplorers
|
|
54
56
|
},
|
|
55
57
|
transport,
|
|
56
58
|
async authorize(options) {
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* RPC error codes used in Prividium SDK.
|
|
3
|
+
* Standard codes follow JSON-RPC 2.0 spec, custom codes handle auth/authz.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Internal error (-32603). Standard JSON-RPC 2.0 code for server errors.
|
|
7
|
+
*/
|
|
8
|
+
export declare const INTERNAL_RPC_ERROR = -32603;
|
|
9
|
+
/**
|
|
10
|
+
* Invalid Request (-32600). Standard JSON-RPC 2.0 code for malformed requests.
|
|
11
|
+
*/
|
|
12
|
+
export declare const INVALID_REQUEST_ERROR_CODE = -32600;
|
|
13
|
+
/**
|
|
14
|
+
* Invalid params (-32602). Standard JSON-RPC 2.0 code for bad parameters.
|
|
15
|
+
*/
|
|
16
|
+
export declare const BAD_RPC_PARAMS_ERROR_CODE = -32602;
|
|
17
|
+
/**
|
|
18
|
+
* Unauthorized (-32090). Custom code for authentication failures (no/invalid token).
|
|
19
|
+
*/
|
|
20
|
+
export declare const UNAUTHORIZED_ERROR_CODE = -32090;
|
|
21
|
+
/**
|
|
22
|
+
* Forbidden (-32001). Custom code for authorization failures (valid token, insufficient permissions).
|
|
23
|
+
*/
|
|
24
|
+
export declare const FORBIDDEN_ERROR_CODE = -32001;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* RPC error codes used in Prividium SDK.
|
|
3
|
+
* Standard codes follow JSON-RPC 2.0 spec, custom codes handle auth/authz.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Internal error (-32603). Standard JSON-RPC 2.0 code for server errors.
|
|
7
|
+
*/
|
|
8
|
+
export const INTERNAL_RPC_ERROR = -32603;
|
|
9
|
+
/**
|
|
10
|
+
* Invalid Request (-32600). Standard JSON-RPC 2.0 code for malformed requests.
|
|
11
|
+
*/
|
|
12
|
+
export const INVALID_REQUEST_ERROR_CODE = -32600;
|
|
13
|
+
/**
|
|
14
|
+
* Invalid params (-32602). Standard JSON-RPC 2.0 code for bad parameters.
|
|
15
|
+
*/
|
|
16
|
+
export const BAD_RPC_PARAMS_ERROR_CODE = -32602;
|
|
17
|
+
/**
|
|
18
|
+
* Unauthorized (-32090). Custom code for authentication failures (no/invalid token).
|
|
19
|
+
*/
|
|
20
|
+
export const UNAUTHORIZED_ERROR_CODE = -32090;
|
|
21
|
+
/**
|
|
22
|
+
* Forbidden (-32001). Custom code for authorization failures (valid token, insufficient permissions).
|
|
23
|
+
*/
|
|
24
|
+
export const FORBIDDEN_ERROR_CODE = -32001;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"root":["../src/index.ts","../src/popup-auth.ts","../src/prividium-chain.ts","../src/storage.ts","../src/token-utils.ts","../src/types.ts"],"version":"5.8.3"}
|
|
1
|
+
{"root":["../src/error-utils.ts","../src/index.ts","../src/popup-auth.ts","../src/prividium-chain.ts","../src/rpc-error-codes.ts","../src/storage.ts","../src/token-utils.ts","../src/types.ts"],"version":"5.8.3"}
|