prividium 0.8.0 → 0.9.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/cli/commands/proxy.js +3 -3
- package/dist/cli/index.js +1 -1
- package/dist/cli/server/config-file.js +3 -3
- package/dist/cli/server/connection-workflow.js +2 -2
- package/dist/cli/server/server.js +6 -6
- package/dist/sdk/chain-core.d.ts +1 -1
- package/dist/sdk/index.d.ts +5 -5
- package/dist/sdk/index.js +4 -4
- package/dist/sdk/popup-auth.d.ts +1 -1
- package/dist/sdk/popup-auth.js +1 -1
- package/dist/sdk/prividium-chain.js +3 -3
- package/dist/sdk/siwe-chain.js +4 -4
- package/dist/sdk/siwe.d.ts +7 -8
- package/dist/sdk/siwe.js +6 -6
- package/dist/sdk/storage.js +2 -2
- package/dist/sdk/test-utils.js +1 -1
- package/dist/sdk/types.d.ts +1 -1
- package/package.json +2 -2
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { buildServer } from '../server/server.js';
|
|
2
1
|
import { log } from '@clack/prompts';
|
|
3
2
|
import color from 'kleur';
|
|
4
|
-
import { CreationWorkflow } from '../server/connection-workflow.js';
|
|
5
|
-
import { ConfigFile } from '../server/config-file.js';
|
|
6
3
|
import { z } from 'zod';
|
|
4
|
+
import { ConfigFile } from '../server/config-file.js';
|
|
5
|
+
import { CreationWorkflow } from '../server/connection-workflow.js';
|
|
6
|
+
import { buildServer } from '../server/server.js';
|
|
7
7
|
const envSchema = z.object({
|
|
8
8
|
PRIVIDIUM_RPC_URL: z.string().optional(),
|
|
9
9
|
USER_PANEL_URL: z.string().optional()
|
package/dist/cli/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BASE_CLI } from './base-cli.js';
|
|
2
|
-
import { addProxy } from './commands/proxy.js';
|
|
3
2
|
import { addConfig } from './commands/config.js';
|
|
3
|
+
import { addProxy } from './commands/proxy.js';
|
|
4
4
|
const actions = [addProxy, addConfig];
|
|
5
5
|
const baseCli = actions.reduce((argv, applyAction) => {
|
|
6
6
|
return applyAction(argv);
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import appDirs from 'appdirsjs';
|
|
2
|
-
import path from 'node:path';
|
|
3
1
|
import { existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from 'node:fs';
|
|
4
|
-
import
|
|
2
|
+
import path from 'node:path';
|
|
5
3
|
import { log } from '@clack/prompts';
|
|
4
|
+
import appDirs from 'appdirsjs';
|
|
6
5
|
import color from 'kleur';
|
|
6
|
+
import { z } from 'zod';
|
|
7
7
|
// biome-ignore lint/suspicious/noExplicitAny: CJS/ESM interop
|
|
8
8
|
const appDirsFn = appDirs.default;
|
|
9
9
|
const dirs = appDirsFn({ appName: 'prividium-proxy' });
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import { setTimeout } from 'node:timers/promises';
|
|
1
2
|
import { confirm, intro, log, tasks, text } from '@clack/prompts';
|
|
2
3
|
import color from 'kleur';
|
|
3
|
-
import { z } from 'zod';
|
|
4
|
-
import { setTimeout } from 'node:timers/promises';
|
|
5
4
|
import open from 'open';
|
|
5
|
+
import { z } from 'zod';
|
|
6
6
|
const HEADER = ` .__ .__ .___.__ .__ .__
|
|
7
7
|
_____________|__|__ _|__| __| _/|__|__ __ _____ ____ | | |__|
|
|
8
8
|
\\____ \\_ __ \\ \\ \\/ / |/ __ | | | | \\/ \\ ______ _/ ___\\| | | |
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import Fastify from 'fastify';
|
|
2
|
-
import { validatorCompiler } from 'fastify-type-provider-zod';
|
|
3
|
-
import fastifyStatic from '@fastify/static';
|
|
4
|
-
import path from 'node:path';
|
|
5
|
-
import { z } from 'zod';
|
|
6
|
-
import { fastifyHttpProxy } from '@fastify/http-proxy';
|
|
7
1
|
import { randomBytes } from 'node:crypto';
|
|
2
|
+
import path from 'node:path';
|
|
8
3
|
import { log } from '@clack/prompts';
|
|
4
|
+
import { fastifyHttpProxy } from '@fastify/http-proxy';
|
|
5
|
+
import fastifyStatic from '@fastify/static';
|
|
9
6
|
import { addYears } from 'date-fns/addYears';
|
|
7
|
+
import Fastify from 'fastify';
|
|
8
|
+
import { validatorCompiler } from 'fastify-type-provider-zod';
|
|
9
|
+
import { z } from 'zod';
|
|
10
10
|
function fastifyApp() {
|
|
11
11
|
return Fastify().withTypeProvider();
|
|
12
12
|
}
|
package/dist/sdk/chain-core.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Chain } from 'viem';
|
|
2
|
-
import {
|
|
2
|
+
import { type ZodType, z } from 'zod';
|
|
3
3
|
import { type AuthorizeTransactionParams, type AuthorizeTransactionResponse, type UserProfile } from './types.js';
|
|
4
4
|
export declare function rpcUrl(apiUrl: string): string;
|
|
5
5
|
export declare function walletRpcUrl(apiUrl: string, token: string): string;
|
package/dist/sdk/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
export { createPrividiumClient } from './create-prividium-client.js';
|
|
2
|
+
export { type AuthCallbackMessage, handleAuthCallback, type OauthScope, PopupAuth } from './popup-auth.js';
|
|
1
3
|
export { createPrividiumChain } from './prividium-chain.js';
|
|
2
|
-
export
|
|
3
|
-
export { AUTH_ERRORS, STORAGE_KEYS } from './types.js';
|
|
4
|
+
export { FORBIDDEN_ERROR_CODE, UNAUTHORIZED_ERROR_CODE } from './rpc-error-codes.js';
|
|
4
5
|
export { LocalStorage, TokenManager } from './storage.js';
|
|
5
6
|
export { generateRandomState } from './token-utils.js';
|
|
6
|
-
export {
|
|
7
|
-
export {
|
|
8
|
-
export { createPrividiumClient } from './create-prividium-client.js';
|
|
7
|
+
export type { AddNetworkParams, PopupOptions, PrividiumChain, PrividiumConfig, Storage, TokenData, UserProfile, UserRole } from './types.js';
|
|
8
|
+
export { AUTH_ERRORS, STORAGE_KEYS } from './types.js';
|
package/dist/sdk/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
export { createPrividiumClient } from './create-prividium-client.js';
|
|
2
|
+
export { handleAuthCallback, PopupAuth } from './popup-auth.js';
|
|
1
3
|
export { createPrividiumChain } from './prividium-chain.js';
|
|
2
|
-
export {
|
|
4
|
+
export { FORBIDDEN_ERROR_CODE, UNAUTHORIZED_ERROR_CODE } from './rpc-error-codes.js';
|
|
3
5
|
export { LocalStorage, TokenManager } from './storage.js';
|
|
4
6
|
export { generateRandomState } from './token-utils.js';
|
|
5
|
-
export {
|
|
6
|
-
export { UNAUTHORIZED_ERROR_CODE, FORBIDDEN_ERROR_CODE } from './rpc-error-codes.js';
|
|
7
|
-
export { createPrividiumClient } from './create-prividium-client.js';
|
|
7
|
+
export { AUTH_ERRORS, STORAGE_KEYS } from './types.js';
|
package/dist/sdk/popup-auth.d.ts
CHANGED
package/dist/sdk/popup-auth.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { http } from 'viem';
|
|
2
|
-
import {
|
|
3
|
-
import { PopupAuth } from './popup-auth.js';
|
|
2
|
+
import { buildChainObject, createApiMethods, rpcUrl } from './chain-core.js';
|
|
4
3
|
import { extractResponseError, hasPrividiumUnauthorizedError } from './error-utils.js';
|
|
5
4
|
import { PrividiumSessionError } from './errors.js';
|
|
6
|
-
import {
|
|
5
|
+
import { PopupAuth } from './popup-auth.js';
|
|
6
|
+
import { LocalStorage, TokenManager } from './storage.js';
|
|
7
7
|
export function createPrividiumChain(config) {
|
|
8
8
|
if (config.permissionsApiBaseUrl !== undefined) {
|
|
9
9
|
throw new Error('"permissionsApiBaseUrl" was deprecated. Please use "prividiumApiBaseUrl" instead.');
|
package/dist/sdk/siwe-chain.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { http } from 'viem';
|
|
2
|
-
import {
|
|
3
|
-
import { MemoryStorage } from './memory-storage.js';
|
|
4
|
-
import { SiweAuth } from './siwe-auth.js';
|
|
2
|
+
import { buildChainObject, createApiMethods, rpcUrl } from './chain-core.js';
|
|
5
3
|
import { extractResponseError, hasPrividiumUnauthorizedError } from './error-utils.js';
|
|
6
4
|
import { PrividiumSessionError } from './errors.js';
|
|
7
|
-
import {
|
|
5
|
+
import { MemoryStorage } from './memory-storage.js';
|
|
6
|
+
import { SiweAuth } from './siwe-auth.js';
|
|
7
|
+
import { TokenManager } from './storage.js';
|
|
8
8
|
export function createPrividiumSiweChain(config) {
|
|
9
9
|
const autoReauth = config.autoReauthenticate ?? true;
|
|
10
10
|
const storage = config.storage ?? new MemoryStorage();
|
package/dist/sdk/siwe.d.ts
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export type { PrividiumSiweConfig, PrividiumSiweChain } from './siwe-chain.js';
|
|
3
|
-
export { SiweAuth } from './siwe-auth.js';
|
|
4
|
-
export type { SiweAuthConfig } from './siwe-auth.js';
|
|
1
|
+
export { createPrividiumClient } from './create-prividium-client.js';
|
|
5
2
|
export { MemoryStorage } from './memory-storage.js';
|
|
3
|
+
export { FORBIDDEN_ERROR_CODE, UNAUTHORIZED_ERROR_CODE } from './rpc-error-codes.js';
|
|
4
|
+
export type { SiweAuthConfig } from './siwe-auth.js';
|
|
5
|
+
export { SiweAuth } from './siwe-auth.js';
|
|
6
|
+
export type { PrividiumSiweChain, PrividiumSiweConfig } from './siwe-chain.js';
|
|
7
|
+
export { createPrividiumSiweChain } from './siwe-chain.js';
|
|
6
8
|
export { TokenManager } from './storage.js';
|
|
7
|
-
export type { Storage, TokenData } from './types.js';
|
|
8
|
-
export { createPrividiumClient } from './create-prividium-client.js';
|
|
9
|
-
export type { UserProfile, UserRole, AuthorizeTransactionParams, AuthorizeTransactionResponse } from './types.js';
|
|
9
|
+
export type { AuthorizeTransactionParams, AuthorizeTransactionResponse, Storage, TokenData, UserProfile, UserRole } from './types.js';
|
|
10
10
|
export { AUTH_ERRORS } from './types.js';
|
|
11
|
-
export { UNAUTHORIZED_ERROR_CODE, FORBIDDEN_ERROR_CODE } from './rpc-error-codes.js';
|
package/dist/sdk/siwe.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
// Core factory + types
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export { SiweAuth } from './siwe-auth.js';
|
|
2
|
+
// Viem client (reusable with SIWE chain)
|
|
3
|
+
export { createPrividiumClient } from './create-prividium-client.js';
|
|
5
4
|
// Storage (MemoryStorage is the default for SIWE, but expose both + interface)
|
|
6
5
|
export { MemoryStorage } from './memory-storage.js';
|
|
6
|
+
export { FORBIDDEN_ERROR_CODE, UNAUTHORIZED_ERROR_CODE } from './rpc-error-codes.js';
|
|
7
|
+
// Auth strategy
|
|
8
|
+
export { SiweAuth } from './siwe-auth.js';
|
|
9
|
+
export { createPrividiumSiweChain } from './siwe-chain.js';
|
|
7
10
|
export { TokenManager } from './storage.js';
|
|
8
|
-
// Viem client (reusable with SIWE chain)
|
|
9
|
-
export { createPrividiumClient } from './create-prividium-client.js';
|
|
10
11
|
export { AUTH_ERRORS } from './types.js';
|
|
11
|
-
export { UNAUTHORIZED_ERROR_CODE, FORBIDDEN_ERROR_CODE } from './rpc-error-codes.js';
|
package/dist/sdk/storage.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { STORAGE_KEYS, tokenDataSchema } from './types.js';
|
|
2
|
-
import { z } from 'zod';
|
|
3
1
|
import { addYears } from 'date-fns/addYears';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { STORAGE_KEYS, tokenDataSchema } from './types.js';
|
|
4
4
|
export class LocalStorage {
|
|
5
5
|
getItem(key) {
|
|
6
6
|
if (typeof localStorage === 'undefined') {
|
package/dist/sdk/test-utils.js
CHANGED
package/dist/sdk/types.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Address, Chain, Hex, Transport } from 'viem';
|
|
2
|
-
import type { OauthScope } from './popup-auth.js';
|
|
3
2
|
import { z } from 'zod';
|
|
3
|
+
import type { OauthScope } from './popup-auth.js';
|
|
4
4
|
export interface Storage {
|
|
5
5
|
getItem(key: string): string | null;
|
|
6
6
|
setItem(key: string, value: string): void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "prividium",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"bin": {
|
|
6
6
|
"prividium": "bin/cli.js"
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@clack/prompts": "^0.11.0",
|
|
37
37
|
"@fastify/http-proxy": "^11.3.0",
|
|
38
|
-
"@fastify/static": "^
|
|
38
|
+
"@fastify/static": "^9.0.0",
|
|
39
39
|
"appdirsjs": "^1.2.7",
|
|
40
40
|
"date-fns": "^4.1.0",
|
|
41
41
|
"fastify": "^5.7.2",
|