shogun-core 3.3.7 → 4.0.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.
Files changed (55) hide show
  1. package/README.md +1378 -1221
  2. package/dist/browser/shogun-core.js +78074 -45286
  3. package/dist/browser/shogun-core.js.map +1 -1
  4. package/dist/core.js +2 -3
  5. package/dist/examples/simple-api-test.js +90 -65
  6. package/dist/examples/zkproof-credentials-example.js +218 -0
  7. package/dist/examples/zkproof-example.js +206 -0
  8. package/dist/gundb/api.js +111 -467
  9. package/dist/index.js +10 -1
  10. package/dist/interfaces/shogun.js +2 -2
  11. package/dist/managers/AuthManager.js +0 -2
  12. package/dist/managers/CoreInitializer.js +9 -12
  13. package/dist/plugins/index.js +9 -21
  14. package/dist/plugins/nostr/nostrConnectorPlugin.js +2 -2
  15. package/dist/plugins/webauthn/webauthn.js +20 -7
  16. package/dist/plugins/webauthn/webauthnPlugin.js +101 -17
  17. package/dist/plugins/zkproof/index.js +53 -0
  18. package/dist/plugins/zkproof/zkCredentials.js +213 -0
  19. package/dist/plugins/zkproof/zkProofConnector.js +198 -0
  20. package/dist/plugins/zkproof/zkProofPlugin.js +272 -0
  21. package/dist/types/core.d.ts +1 -1
  22. package/dist/types/examples/simple-api-test.d.ts +6 -1
  23. package/dist/types/examples/zkproof-credentials-example.d.ts +12 -0
  24. package/dist/types/examples/zkproof-example.d.ts +11 -0
  25. package/dist/types/gundb/api.d.ts +77 -165
  26. package/dist/types/gundb/types.d.ts +1 -1
  27. package/dist/types/index.d.ts +1 -0
  28. package/dist/types/interfaces/events.d.ts +3 -3
  29. package/dist/types/interfaces/shogun.d.ts +9 -24
  30. package/dist/types/plugins/index.d.ts +5 -3
  31. package/dist/types/plugins/webauthn/types.d.ts +22 -1
  32. package/dist/types/plugins/webauthn/webauthn.d.ts +1 -1
  33. package/dist/types/plugins/webauthn/webauthnPlugin.d.ts +23 -2
  34. package/dist/types/plugins/zkproof/index.d.ts +48 -0
  35. package/dist/types/plugins/zkproof/types.d.ts +123 -0
  36. package/dist/types/plugins/zkproof/zkCredentials.d.ts +112 -0
  37. package/dist/types/plugins/zkproof/zkProofConnector.d.ts +46 -0
  38. package/dist/types/plugins/zkproof/zkProofPlugin.d.ts +76 -0
  39. package/dist/types/utils/seedPhrase.d.ts +50 -0
  40. package/dist/types/utils/validation.d.ts +2 -2
  41. package/dist/utils/seedPhrase.js +97 -0
  42. package/dist/utils/validation.js +3 -1
  43. package/package.json +14 -8
  44. package/dist/examples/api-test.js +0 -273
  45. package/dist/migration-test.js +0 -96
  46. package/dist/plugins/oauth/index.js +0 -8
  47. package/dist/plugins/oauth/oauthConnector.js +0 -759
  48. package/dist/plugins/oauth/oauthPlugin.js +0 -400
  49. package/dist/types/examples/api-test.d.ts +0 -12
  50. package/dist/types/migration-test.d.ts +0 -16
  51. package/dist/types/plugins/oauth/index.d.ts +0 -3
  52. package/dist/types/plugins/oauth/oauthConnector.d.ts +0 -110
  53. package/dist/types/plugins/oauth/oauthPlugin.d.ts +0 -91
  54. package/dist/types/plugins/oauth/types.d.ts +0 -114
  55. /package/dist/plugins/{oauth → zkproof}/types.js +0 -0
@@ -1,114 +0,0 @@
1
- import { BaseConfig, BaseResult, BaseCacheEntry } from "../../interfaces/common";
2
- import { AuthResult, SignUpResult } from "../../interfaces/shogun";
3
- /**
4
- * Supported OAuth providers
5
- */
6
- export type OAuthProvider = "google" | "github" | "discord" | "twitter" | "custom";
7
- /**
8
- * OAuth provider configuration
9
- */
10
- export interface OAuthProviderConfig {
11
- clientId: string;
12
- clientSecret?: string;
13
- redirectUri: string;
14
- scope: string[];
15
- authUrl: string;
16
- tokenUrl: string;
17
- userInfoUrl: string;
18
- usePKCE?: boolean;
19
- }
20
- /**
21
- * OAuth configuration
22
- */
23
- export interface OAuthConfig extends BaseConfig {
24
- providers: Partial<Record<OAuthProvider, OAuthProviderConfig>>;
25
- usePKCE?: boolean;
26
- cacheDuration?: number;
27
- timeout?: number;
28
- maxRetries?: number;
29
- retryDelay?: number;
30
- allowUnsafeClientSecret?: boolean;
31
- stateTimeout?: number;
32
- }
33
- /**
34
- * OAuth token response
35
- */
36
- export interface OAuthTokenResponse {
37
- access_token: string;
38
- token_type: string;
39
- expires_in: number;
40
- refresh_token?: string;
41
- scope?: string;
42
- id_token?: string;
43
- }
44
- /**
45
- * User info from OAuth provider
46
- */
47
- export interface OAuthUserInfo {
48
- id: string;
49
- email?: string;
50
- name?: string;
51
- picture?: string;
52
- verified_email?: boolean;
53
- provider: OAuthProvider;
54
- }
55
- /**
56
- * Credentials generated from OAuth flow
57
- */
58
- export interface OAuthCredentials {
59
- username: string;
60
- password: string;
61
- salt?: string;
62
- key?: any;
63
- provider: OAuthProvider;
64
- }
65
- /**
66
- * Connection result for OAuth
67
- */
68
- export interface OAuthConnectionResult extends BaseResult {
69
- provider?: OAuthProvider;
70
- userInfo?: OAuthUserInfo;
71
- authUrl?: string;
72
- }
73
- /**
74
- * OAuth plugin interface
75
- */
76
- export interface OAuthPluginInterface {
77
- /**
78
- * Check if OAuth is supported
79
- */
80
- isSupported(): boolean;
81
- /**
82
- * Get available OAuth providers
83
- */
84
- getAvailableProviders(): OAuthProvider[];
85
- /**
86
- * Initiate OAuth flow with a provider
87
- */
88
- initiateOAuth(provider: OAuthProvider): Promise<OAuthConnectionResult>;
89
- /**
90
- * Complete OAuth flow
91
- */
92
- completeOAuth(provider: OAuthProvider, authCode: string, state?: string): Promise<OAuthConnectionResult>;
93
- /**
94
- * Generate credentials from OAuth user info
95
- */
96
- generateCredentials(userInfo: OAuthUserInfo, provider: OAuthProvider, masterkey?: string): Promise<OAuthCredentials>;
97
- /**
98
- * Login with OAuth
99
- */
100
- login(provider: OAuthProvider): Promise<AuthResult>;
101
- /**
102
- * Sign up with OAuth provider
103
- * @param provider OAuth provider to use
104
- * @returns Promise with authentication result
105
- */
106
- signUp(provider: OAuthProvider): Promise<SignUpResult>;
107
- }
108
- /**
109
- * Cache entry for OAuth data
110
- */
111
- export interface OAuthCache extends BaseCacheEntry<OAuthUserInfo> {
112
- provider: OAuthProvider;
113
- userId: string;
114
- }
File without changes