prividium 0.2.3 → 0.3.1
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
CHANGED
|
@@ -446,7 +446,7 @@ if (headers) {
|
|
|
446
446
|
|
|
447
447
|
The SDK uses the following localStorage keys:
|
|
448
448
|
|
|
449
|
-
- `
|
|
449
|
+
- `prividium_token_<chainId>` - Token storage
|
|
450
450
|
- `prividium_auth_state_<chainId>` - OAuth state parameter
|
|
451
451
|
|
|
452
452
|
## Security Considerations
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { confirm, intro, log, tasks, text } from '@clack/prompts';
|
|
2
2
|
import color from 'kleur';
|
|
3
3
|
import { z } from 'zod';
|
|
4
|
-
import { setTimeout } from 'timers/promises';
|
|
4
|
+
import { setTimeout } from 'node:timers/promises';
|
|
5
5
|
import open from 'open';
|
|
6
6
|
const HEADER = ` .__ .__ .___.__ .__ .__
|
|
7
7
|
_____________|__|__ _|__| __| _/|__|__ __ _____ ____ | | |__|
|
package/dist/sdk/popup-auth.d.ts
CHANGED
|
@@ -67,6 +67,10 @@ export function createPrividiumChain(config) {
|
|
|
67
67
|
headers: getAuthHeaders() || {}
|
|
68
68
|
},
|
|
69
69
|
onFetchRequest(_request, init) {
|
|
70
|
+
const isAuthenticated = tokenManager.isAuthorized();
|
|
71
|
+
if (!isAuthenticated) {
|
|
72
|
+
throw new PrividiumSessionError();
|
|
73
|
+
}
|
|
70
74
|
init.headers = {
|
|
71
75
|
...init.headers,
|
|
72
76
|
...getAuthHeaders()
|
package/dist/sdk/storage.js
CHANGED
|
@@ -29,7 +29,7 @@ export class TokenManager {
|
|
|
29
29
|
this.storage = storage;
|
|
30
30
|
this.chainId = chainId;
|
|
31
31
|
this.prividiumApiUrl = prividiumApiUrl;
|
|
32
|
-
this.onAuthExpiry = onAuthExpiry ??
|
|
32
|
+
this.onAuthExpiry = onAuthExpiry ?? (() => { });
|
|
33
33
|
}
|
|
34
34
|
get tokenKey() {
|
|
35
35
|
return `${STORAGE_KEYS.TOKEN_PREFIX}${this.chainId}`;
|
package/dist/sdk/types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import type { Address, Chain, Hex, Transport } from 'viem';
|
|
2
|
+
import type { OauthScope } from './popup-auth.js';
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
export interface Storage {
|
|
5
5
|
getItem(key: string): string | null;
|
|
@@ -108,5 +108,5 @@ export declare const AUTH_ERRORS: {
|
|
|
108
108
|
};
|
|
109
109
|
export declare const STORAGE_KEYS: {
|
|
110
110
|
readonly STATE_PREFIX: "prividium_auth_state_";
|
|
111
|
-
readonly TOKEN_PREFIX: "
|
|
111
|
+
readonly TOKEN_PREFIX: "prividium_token_";
|
|
112
112
|
};
|
package/dist/sdk/types.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "prividium",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"bin": {
|
|
5
5
|
"prividium": "bin/cli.js"
|
|
6
6
|
},
|
|
@@ -21,8 +21,6 @@
|
|
|
21
21
|
"build": "tsc -b && pnpm copy-static-files",
|
|
22
22
|
"copy-static-files": "cp -r cli/static dist/cli",
|
|
23
23
|
"dev": "tsc -b --watch",
|
|
24
|
-
"lint": "eslint . --ignore-path ../../.gitignore --max-warnings 0 --cache --cache-strategy content --cache-location ../../.eslint-cache/prividium-sdk",
|
|
25
|
-
"lint:fix": "eslint . --fix --ignore-path ../../.gitignore --cache --cache-strategy content --cache-location ../../.eslint-cache/prividium-sdk",
|
|
26
24
|
"test": "vitest run",
|
|
27
25
|
"test:watch": "vitest",
|
|
28
26
|
"typecheck": "tsc -b --noEmit",
|
|
@@ -35,7 +33,7 @@
|
|
|
35
33
|
"@fastify/static": "^8.3.0",
|
|
36
34
|
"appdirsjs": "^1.2.7",
|
|
37
35
|
"date-fns": "^4.1.0",
|
|
38
|
-
"fastify": "^5.7.
|
|
36
|
+
"fastify": "^5.7.2",
|
|
39
37
|
"fastify-type-provider-zod": "^6.1.0",
|
|
40
38
|
"kleur": "^4.1.5",
|
|
41
39
|
"open": "^10.1.0",
|
|
@@ -46,12 +44,10 @@
|
|
|
46
44
|
"viem": ">=2.0.0"
|
|
47
45
|
},
|
|
48
46
|
"devDependencies": {
|
|
49
|
-
"@repo/eslint-config": "workspace:*",
|
|
50
47
|
"@semantic-release/exec": "^7.1.0",
|
|
51
48
|
"@types/node": "^22.8.6",
|
|
52
49
|
"@types/yargs": "^17.0.34",
|
|
53
50
|
"@vitest/coverage-v8": "3.2.4",
|
|
54
|
-
"eslint": "^8",
|
|
55
51
|
"jsdom": "^25.0.0",
|
|
56
52
|
"semantic-release": "^25.0.2",
|
|
57
53
|
"tsx": "^4.20.6",
|