shogun-core 5.2.0 → 5.2.2
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 +145 -1143
- package/dist/browser/defaultVendors-node_modules_hpke_chacha20poly1305_esm_mod_js.shogun-core.js +1220 -0
- package/dist/browser/defaultVendors-node_modules_hpke_chacha20poly1305_esm_mod_js.shogun-core.js.map +1 -0
- package/dist/browser/defaultVendors-node_modules_hpke_hybridkem-x-wing_esm_mod_js.shogun-core.js +844 -0
- package/dist/browser/defaultVendors-node_modules_hpke_hybridkem-x-wing_esm_mod_js.shogun-core.js.map +1 -0
- package/dist/browser/defaultVendors-node_modules_mlkem_esm_mod_js.shogun-core.js +2335 -0
- package/dist/browser/defaultVendors-node_modules_mlkem_esm_mod_js.shogun-core.js.map +1 -0
- package/dist/browser/defaultVendors-node_modules_noble_ciphers_chacha_js.shogun-core.js +999 -0
- package/dist/browser/defaultVendors-node_modules_noble_ciphers_chacha_js.shogun-core.js.map +1 -0
- package/dist/browser/defaultVendors-node_modules_noble_curves_esm_abstract_curve_js-node_modules_noble_curves_esm_-1ce4ed.shogun-core.js +1651 -0
- package/dist/browser/defaultVendors-node_modules_noble_curves_esm_abstract_curve_js-node_modules_noble_curves_esm_-1ce4ed.shogun-core.js.map +1 -0
- package/dist/browser/defaultVendors-node_modules_noble_curves_esm_abstract_edwards_js-node_modules_noble_curves_es-a82056.shogun-core.js +825 -0
- package/dist/browser/defaultVendors-node_modules_noble_curves_esm_abstract_edwards_js-node_modules_noble_curves_es-a82056.shogun-core.js.map +1 -0
- package/dist/browser/defaultVendors-node_modules_noble_curves_esm_ed25519_js.shogun-core.js +508 -0
- package/dist/browser/defaultVendors-node_modules_noble_curves_esm_ed25519_js.shogun-core.js.map +1 -0
- package/dist/browser/defaultVendors-node_modules_noble_curves_esm_ed448_js.shogun-core.js +747 -0
- package/dist/browser/defaultVendors-node_modules_noble_curves_esm_ed448_js.shogun-core.js.map +1 -0
- package/dist/browser/defaultVendors-node_modules_noble_curves_esm_nist_js.shogun-core.js +1608 -0
- package/dist/browser/defaultVendors-node_modules_noble_curves_esm_nist_js.shogun-core.js.map +1 -0
- package/dist/browser/defaultVendors-node_modules_noble_post-quantum_ml-dsa_js.shogun-core.js +2117 -0
- package/dist/browser/defaultVendors-node_modules_noble_post-quantum_ml-dsa_js.shogun-core.js.map +1 -0
- package/dist/browser/defaultVendors-node_modules_openpgp_dist_openpgp_min_mjs.shogun-core.js +86 -0
- package/dist/browser/defaultVendors-node_modules_openpgp_dist_openpgp_min_mjs.shogun-core.js.map +1 -0
- package/dist/browser/node_modules_hpke_ml-kem_esm_mod_js.shogun-core.js +539 -0
- package/dist/browser/node_modules_hpke_ml-kem_esm_mod_js.shogun-core.js.map +1 -0
- package/dist/browser/shogun-core.js +160386 -0
- package/dist/browser/shogun-core.js.map +1 -0
- package/dist/config/simplified-config.js +236 -0
- package/dist/core.js +329 -0
- package/dist/crypto/asymmetric.js +99 -0
- package/dist/crypto/double-ratchet.js +370 -0
- package/dist/crypto/file-encryption.js +213 -0
- package/dist/crypto/hashing.js +87 -0
- package/dist/crypto/index.js +34 -0
- package/dist/crypto/mls-codec.js +202 -0
- package/dist/crypto/mls.js +550 -0
- package/dist/crypto/pgp.js +390 -0
- package/dist/crypto/random-generation.js +341 -0
- package/dist/crypto/sframe.js +350 -0
- package/dist/crypto/signal-protocol.js +376 -0
- package/dist/crypto/symmetric.js +91 -0
- package/dist/crypto/types.js +2 -0
- package/dist/crypto/utils.js +140 -0
- package/dist/examples/auth-test.js +253 -0
- package/dist/examples/crypto-identity-example.js +151 -0
- package/dist/examples/crypto-working-test.js +83 -0
- package/dist/examples/double-ratchet-test.js +155 -0
- package/dist/examples/mls-advanced-example.js +294 -0
- package/dist/examples/mls-sframe-test.js +304 -0
- package/dist/examples/pgp-example.js +200 -0
- package/dist/examples/quick-auth-test.js +61 -0
- package/dist/examples/random-generation-test.js +151 -0
- package/dist/examples/signal-protocol-test.js +38 -0
- package/dist/examples/simple-api-test.js +114 -0
- package/dist/examples/simple-crypto-identity-example.js +84 -0
- package/dist/examples/timeout-test.js +227 -0
- package/dist/examples/zkproof-credentials-example.js +212 -0
- package/dist/examples/zkproof-example.js +201 -0
- package/dist/gundb/api.js +435 -0
- package/dist/gundb/crypto.js +283 -0
- package/dist/gundb/db.js +1946 -0
- package/dist/gundb/derive.js +232 -0
- package/dist/gundb/errors.js +76 -0
- package/dist/gundb/index.js +22 -0
- package/dist/gundb/rxjs.js +447 -0
- package/dist/gundb/types.js +5 -0
- package/dist/index.js +58 -0
- package/dist/interfaces/common.js +2 -0
- package/dist/interfaces/events.js +40 -0
- package/dist/interfaces/plugin.js +2 -0
- package/dist/interfaces/shogun.js +37 -0
- package/dist/managers/AuthManager.js +226 -0
- package/dist/managers/CoreInitializer.js +228 -0
- package/dist/managers/CryptoIdentityManager.js +366 -0
- package/dist/managers/EventManager.js +70 -0
- package/dist/managers/PluginManager.js +299 -0
- package/dist/plugins/base.js +50 -0
- package/dist/plugins/index.js +32 -0
- package/dist/plugins/nostr/index.js +20 -0
- package/dist/plugins/nostr/nostrConnector.js +419 -0
- package/dist/plugins/nostr/nostrConnectorPlugin.js +453 -0
- package/dist/plugins/nostr/nostrSigner.js +319 -0
- package/dist/plugins/nostr/types.js +2 -0
- package/dist/plugins/smartwallet/index.js +18 -0
- package/dist/plugins/smartwallet/smartWalletPlugin.js +511 -0
- package/dist/plugins/smartwallet/types.js +2 -0
- package/dist/plugins/web3/index.js +20 -0
- package/dist/plugins/web3/types.js +2 -0
- package/dist/plugins/web3/web3Connector.js +533 -0
- package/dist/plugins/web3/web3ConnectorPlugin.js +455 -0
- package/dist/plugins/web3/web3Signer.js +314 -0
- package/dist/plugins/webauthn/index.js +19 -0
- package/dist/plugins/webauthn/types.js +14 -0
- package/dist/plugins/webauthn/webauthn.js +496 -0
- package/dist/plugins/webauthn/webauthnPlugin.js +489 -0
- package/dist/plugins/webauthn/webauthnSigner.js +310 -0
- package/dist/plugins/zkproof/index.js +53 -0
- package/dist/plugins/zkproof/types.js +2 -0
- package/dist/plugins/zkproof/zkCredentials.js +213 -0
- package/dist/plugins/zkproof/zkProofConnector.js +198 -0
- package/dist/plugins/zkproof/zkProofPlugin.js +272 -0
- package/dist/storage/storage.js +145 -0
- package/dist/types/config/simplified-config.d.ts +114 -0
- package/dist/types/core.d.ts +305 -0
- package/dist/types/crypto/asymmetric.d.ts +6 -0
- package/dist/types/crypto/double-ratchet.d.ts +22 -0
- package/dist/types/crypto/file-encryption.d.ts +19 -0
- package/dist/types/crypto/hashing.d.ts +9 -0
- package/dist/types/crypto/index.d.ts +13 -0
- package/dist/types/crypto/mls-codec.d.ts +39 -0
- package/dist/types/crypto/mls.d.ts +130 -0
- package/dist/types/crypto/pgp.d.ts +95 -0
- package/dist/types/crypto/random-generation.d.ts +35 -0
- package/dist/types/crypto/sframe.d.ts +102 -0
- package/dist/types/crypto/signal-protocol.d.ts +26 -0
- package/dist/types/crypto/symmetric.d.ts +9 -0
- package/dist/types/crypto/types.d.ts +144 -0
- package/dist/types/crypto/utils.d.ts +22 -0
- package/dist/types/examples/auth-test.d.ts +8 -0
- package/dist/types/examples/crypto-identity-example.d.ts +5 -0
- package/dist/types/examples/crypto-working-test.d.ts +1 -0
- package/dist/types/examples/double-ratchet-test.d.ts +1 -0
- package/dist/types/examples/mls-advanced-example.d.ts +53 -0
- package/dist/types/examples/mls-sframe-test.d.ts +1 -0
- package/dist/types/examples/pgp-example.d.ts +75 -0
- package/dist/types/examples/quick-auth-test.d.ts +8 -0
- package/dist/types/examples/random-generation-test.d.ts +1 -0
- package/dist/types/examples/signal-protocol-test.d.ts +1 -0
- package/dist/types/examples/simple-api-test.d.ts +10 -0
- package/dist/types/examples/simple-crypto-identity-example.d.ts +6 -0
- package/dist/types/examples/timeout-test.d.ts +8 -0
- package/dist/types/examples/zkproof-credentials-example.d.ts +12 -0
- package/dist/types/examples/zkproof-example.d.ts +11 -0
- package/dist/types/gundb/api.d.ts +185 -0
- package/dist/types/gundb/crypto.d.ts +95 -0
- package/dist/types/gundb/db.d.ts +397 -0
- package/dist/types/gundb/derive.d.ts +21 -0
- package/dist/types/gundb/errors.d.ts +42 -0
- package/dist/types/gundb/index.d.ts +3 -0
- package/dist/types/gundb/rxjs.d.ts +110 -0
- package/dist/types/gundb/types.d.ts +255 -0
- package/dist/types/index.d.ts +16 -0
- package/dist/types/interfaces/common.d.ts +85 -0
- package/dist/types/interfaces/events.d.ts +131 -0
- package/dist/types/interfaces/plugin.d.ts +162 -0
- package/dist/types/interfaces/shogun.d.ts +208 -0
- package/dist/types/managers/AuthManager.d.ts +72 -0
- package/dist/types/managers/CoreInitializer.d.ts +40 -0
- package/dist/types/managers/CryptoIdentityManager.d.ts +102 -0
- package/dist/types/managers/EventManager.d.ts +49 -0
- package/dist/types/managers/PluginManager.d.ts +145 -0
- package/dist/types/plugins/base.d.ts +35 -0
- package/dist/types/plugins/index.d.ts +18 -0
- package/dist/types/plugins/nostr/index.d.ts +4 -0
- package/dist/types/plugins/nostr/nostrConnector.d.ts +119 -0
- package/dist/types/plugins/nostr/nostrConnectorPlugin.d.ts +163 -0
- package/dist/types/plugins/nostr/nostrSigner.d.ts +105 -0
- package/dist/types/plugins/nostr/types.d.ts +122 -0
- package/dist/types/plugins/smartwallet/index.d.ts +2 -0
- package/dist/types/plugins/smartwallet/smartWalletPlugin.d.ts +67 -0
- package/dist/types/plugins/smartwallet/types.d.ts +80 -0
- package/dist/types/plugins/web3/index.d.ts +4 -0
- package/dist/types/plugins/web3/types.d.ts +107 -0
- package/dist/types/plugins/web3/web3Connector.d.ts +129 -0
- package/dist/types/plugins/web3/web3ConnectorPlugin.d.ts +160 -0
- package/dist/types/plugins/web3/web3Signer.d.ts +114 -0
- package/dist/types/plugins/webauthn/index.d.ts +3 -0
- package/dist/types/plugins/webauthn/types.d.ts +183 -0
- package/dist/types/plugins/webauthn/webauthn.d.ts +129 -0
- package/dist/types/plugins/webauthn/webauthnPlugin.d.ts +179 -0
- package/dist/types/plugins/webauthn/webauthnSigner.d.ts +91 -0
- package/dist/types/plugins/zkproof/index.d.ts +48 -0
- package/dist/types/plugins/zkproof/types.d.ts +123 -0
- package/dist/types/plugins/zkproof/zkCredentials.d.ts +112 -0
- package/dist/types/plugins/zkproof/zkProofConnector.d.ts +46 -0
- package/dist/types/plugins/zkproof/zkProofPlugin.d.ts +76 -0
- package/dist/types/storage/storage.d.ts +51 -0
- package/dist/types/utils/errorHandler.d.ts +119 -0
- package/dist/types/utils/eventEmitter.d.ts +39 -0
- package/dist/types/utils/seedPhrase.d.ts +50 -0
- package/dist/types/utils/validation.d.ts +27 -0
- package/dist/utils/errorHandler.js +246 -0
- package/dist/utils/eventEmitter.js +79 -0
- package/dist/utils/seedPhrase.js +97 -0
- package/dist/utils/validation.js +81 -0
- package/package.json +10 -57
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ZK-Proof Plugin for Shogun Core
|
|
3
|
+
*
|
|
4
|
+
* Provides Zero-Knowledge Proof authentication using Semaphore protocol
|
|
5
|
+
*
|
|
6
|
+
* Features:
|
|
7
|
+
* - Anonymous authentication without revealing identity
|
|
8
|
+
* - Multi-device support via trapdoor backup
|
|
9
|
+
* - Privacy-preserving group membership proofs
|
|
10
|
+
* - Compatible with Gun decentralized storage
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```typescript
|
|
14
|
+
* // Initialize Shogun with ZK-Proof plugin
|
|
15
|
+
* const shogun = new ShogunCore({
|
|
16
|
+
* peers: ['https://gun-manhattan.herokuapp.com/gun'],
|
|
17
|
+
* zkproof: {
|
|
18
|
+
* enabled: true,
|
|
19
|
+
* defaultGroupId: 'my-app-users'
|
|
20
|
+
* }
|
|
21
|
+
* });
|
|
22
|
+
*
|
|
23
|
+
* await shogun.initialize();
|
|
24
|
+
*
|
|
25
|
+
* // Get the plugin
|
|
26
|
+
* const zkPlugin = shogun.getPlugin<ZkProofPlugin>('zkproof');
|
|
27
|
+
*
|
|
28
|
+
* // Sign up with ZK-Proof
|
|
29
|
+
* const signupResult = await zkPlugin.signUp();
|
|
30
|
+
* if (signupResult.success) {
|
|
31
|
+
* console.log('Trapdoor (save this!):', signupResult.seedPhrase);
|
|
32
|
+
* console.log('Public commitment:', signupResult.username);
|
|
33
|
+
* }
|
|
34
|
+
*
|
|
35
|
+
* // Login with trapdoor
|
|
36
|
+
* const loginResult = await zkPlugin.login(trapdoor);
|
|
37
|
+
* if (loginResult.success) {
|
|
38
|
+
* console.log('Logged in anonymously!');
|
|
39
|
+
* }
|
|
40
|
+
* ```
|
|
41
|
+
*
|
|
42
|
+
* @module zkproof
|
|
43
|
+
*/
|
|
44
|
+
export { ZkProofPlugin } from "./zkProofPlugin";
|
|
45
|
+
export { ZkProofConnector } from "./zkProofConnector";
|
|
46
|
+
export { ZkCredentials, CredentialType } from "./zkCredentials";
|
|
47
|
+
export type { ZkIdentityData, ZkProofAuthResult, ZkProofGenerationOptions, ZkProofVerificationResult, ZkProofCredential, ZkProofConfig, ZkProofPluginInterface, SemaphoreProof, } from "./types";
|
|
48
|
+
export type { CredentialClaim, VerifiableCredentialProof, CredentialVerificationResult, } from "./zkCredentials";
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { ISEAPair } from "gun";
|
|
2
|
+
/**
|
|
3
|
+
* ZK-Proof identity data
|
|
4
|
+
*/
|
|
5
|
+
export interface ZkIdentityData {
|
|
6
|
+
/** Semaphore identity commitment (public) */
|
|
7
|
+
commitment: string;
|
|
8
|
+
/** Trapdoor (private - used for recovery/login) */
|
|
9
|
+
trapdoor?: string;
|
|
10
|
+
/** Nullifier (private) */
|
|
11
|
+
nullifier?: string;
|
|
12
|
+
/** Creation timestamp */
|
|
13
|
+
createdAt: number;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* ZK-Proof authentication result
|
|
17
|
+
*/
|
|
18
|
+
export interface ZkProofAuthResult {
|
|
19
|
+
success: boolean;
|
|
20
|
+
commitment?: string;
|
|
21
|
+
userPub?: string;
|
|
22
|
+
error?: string;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* ZK-Proof generation options
|
|
26
|
+
*/
|
|
27
|
+
export interface ZkProofGenerationOptions {
|
|
28
|
+
/** Group ID for Semaphore group */
|
|
29
|
+
groupId?: string;
|
|
30
|
+
/** Custom message to prove */
|
|
31
|
+
message?: string;
|
|
32
|
+
/** Scope for the proof */
|
|
33
|
+
scope?: string;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* ZK-Proof verification result
|
|
37
|
+
*/
|
|
38
|
+
export interface ZkProofVerificationResult {
|
|
39
|
+
success: boolean;
|
|
40
|
+
verified: boolean;
|
|
41
|
+
commitment?: string;
|
|
42
|
+
error?: string;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* ZK-Proof credential for Gun authentication
|
|
46
|
+
*/
|
|
47
|
+
export interface ZkProofCredential {
|
|
48
|
+
commitment: string;
|
|
49
|
+
gunPair: ISEAPair;
|
|
50
|
+
createdAt: number;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* ZK-Proof plugin configuration
|
|
54
|
+
*/
|
|
55
|
+
export interface ZkProofConfig {
|
|
56
|
+
/** Default group ID */
|
|
57
|
+
defaultGroupId?: string;
|
|
58
|
+
/** Enable deterministic identity generation */
|
|
59
|
+
deterministic?: boolean;
|
|
60
|
+
/** Minimum entropy for identity generation */
|
|
61
|
+
minEntropy?: number;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* ZK-Proof plugin interface
|
|
65
|
+
*/
|
|
66
|
+
export interface ZkProofPluginInterface {
|
|
67
|
+
/**
|
|
68
|
+
* Generate a new ZK identity
|
|
69
|
+
* @param seed - Optional seed for deterministic generation
|
|
70
|
+
* @returns ZK identity data with trapdoor for backup
|
|
71
|
+
*/
|
|
72
|
+
generateIdentity(seed?: string): Promise<ZkIdentityData>;
|
|
73
|
+
/**
|
|
74
|
+
* Restore identity from trapdoor/seed phrase
|
|
75
|
+
* @param trapdoor - Trapdoor or seed phrase
|
|
76
|
+
* @returns ZK identity data
|
|
77
|
+
*/
|
|
78
|
+
restoreIdentity(trapdoor: string): Promise<ZkIdentityData>;
|
|
79
|
+
/**
|
|
80
|
+
* Generate credentials for Gun authentication
|
|
81
|
+
* @param identityData - ZK identity data
|
|
82
|
+
* @returns Gun SEA pair
|
|
83
|
+
*/
|
|
84
|
+
generateCredentials(identityData: ZkIdentityData): Promise<ISEAPair>;
|
|
85
|
+
/**
|
|
86
|
+
* Generate a zero-knowledge proof
|
|
87
|
+
* @param identityData - ZK identity data
|
|
88
|
+
* @param options - Proof generation options
|
|
89
|
+
* @returns Proof data
|
|
90
|
+
*/
|
|
91
|
+
generateProof(identityData: ZkIdentityData, options?: ZkProofGenerationOptions): Promise<any>;
|
|
92
|
+
/**
|
|
93
|
+
* Verify a zero-knowledge proof
|
|
94
|
+
* @param proof - Proof data to verify
|
|
95
|
+
* @param treeDepth - Merkle tree depth (default: 20)
|
|
96
|
+
* @returns Verification result
|
|
97
|
+
*/
|
|
98
|
+
verifyProof(proof: any, treeDepth?: number): Promise<ZkProofVerificationResult>;
|
|
99
|
+
/**
|
|
100
|
+
* Login with ZK proof
|
|
101
|
+
* @param trapdoor - User's trapdoor/seed phrase
|
|
102
|
+
* @returns Authentication result
|
|
103
|
+
*/
|
|
104
|
+
login(trapdoor: string): Promise<ZkProofAuthResult>;
|
|
105
|
+
/**
|
|
106
|
+
* Sign up with new ZK identity
|
|
107
|
+
* @param seed - Optional seed for deterministic generation
|
|
108
|
+
* @returns Authentication result with trapdoor for backup
|
|
109
|
+
*/
|
|
110
|
+
signUp(seed?: string): Promise<ZkProofAuthResult & {
|
|
111
|
+
trapdoor?: string;
|
|
112
|
+
}>;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Semaphore proof data structure
|
|
116
|
+
*/
|
|
117
|
+
export interface SemaphoreProof {
|
|
118
|
+
merkleTreeRoot: string;
|
|
119
|
+
nullifierHash: string;
|
|
120
|
+
signal: string;
|
|
121
|
+
externalNullifier: string;
|
|
122
|
+
proof: string[];
|
|
123
|
+
}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { Identity } from "@semaphore-protocol/identity";
|
|
2
|
+
/**
|
|
3
|
+
* Types of verifiable credentials
|
|
4
|
+
*/
|
|
5
|
+
export declare enum CredentialType {
|
|
6
|
+
AGE = "age",
|
|
7
|
+
CITIZENSHIP = "citizenship",
|
|
8
|
+
EDUCATION = "education",
|
|
9
|
+
INCOME = "income",
|
|
10
|
+
EMPLOYMENT = "employment",
|
|
11
|
+
HEALTH = "health",
|
|
12
|
+
CUSTOM = "custom"
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Credential claim data
|
|
16
|
+
*/
|
|
17
|
+
export interface CredentialClaim {
|
|
18
|
+
/** Type of credential */
|
|
19
|
+
type: CredentialType;
|
|
20
|
+
/** Public claim statement */
|
|
21
|
+
claim: string;
|
|
22
|
+
/** Private data that proves the claim */
|
|
23
|
+
privateData: Record<string, any>;
|
|
24
|
+
/** Issuer of the credential (optional) */
|
|
25
|
+
issuer?: string;
|
|
26
|
+
/** Expiration timestamp (optional) */
|
|
27
|
+
expiresAt?: number;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Verifiable credential proof
|
|
31
|
+
*/
|
|
32
|
+
export interface VerifiableCredentialProof {
|
|
33
|
+
/** Type of credential being proved */
|
|
34
|
+
type: CredentialType;
|
|
35
|
+
/** Public claim statement */
|
|
36
|
+
claim: string;
|
|
37
|
+
/** ZK proof data */
|
|
38
|
+
proof: {
|
|
39
|
+
merkleTreeRoot: string;
|
|
40
|
+
nullifierHash: string;
|
|
41
|
+
signal: string;
|
|
42
|
+
externalNullifier: string;
|
|
43
|
+
proof: string[];
|
|
44
|
+
};
|
|
45
|
+
/** Credential hash (for verification) */
|
|
46
|
+
credentialHash: string;
|
|
47
|
+
/** Timestamp when proof was generated */
|
|
48
|
+
timestamp: number;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Credential verification result
|
|
52
|
+
*/
|
|
53
|
+
export interface CredentialVerificationResult {
|
|
54
|
+
verified: boolean;
|
|
55
|
+
type?: CredentialType;
|
|
56
|
+
claim?: string;
|
|
57
|
+
timestamp?: number;
|
|
58
|
+
error?: string;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* ZK Credentials Manager
|
|
62
|
+
* Extends ZK-Proof functionality to support verifiable credentials
|
|
63
|
+
*/
|
|
64
|
+
export declare class ZkCredentials {
|
|
65
|
+
private groups;
|
|
66
|
+
/**
|
|
67
|
+
* Create a verifiable credential from private data
|
|
68
|
+
*/
|
|
69
|
+
createCredential(identity: Identity, credentialData: CredentialClaim): {
|
|
70
|
+
credential: VerifiableCredentialProof;
|
|
71
|
+
credentialHash: string;
|
|
72
|
+
};
|
|
73
|
+
/**
|
|
74
|
+
* Prove an attribute about yourself without revealing the underlying data
|
|
75
|
+
*/
|
|
76
|
+
proveAttribute(identity: Identity, credentialData: CredentialClaim, groupId?: string): Promise<VerifiableCredentialProof>;
|
|
77
|
+
/**
|
|
78
|
+
* Verify a credential proof
|
|
79
|
+
*/
|
|
80
|
+
verifyCredential(proof: VerifiableCredentialProof, treeDepth?: number): Promise<CredentialVerificationResult>;
|
|
81
|
+
/**
|
|
82
|
+
* Create a group for credential holders
|
|
83
|
+
*/
|
|
84
|
+
private getOrCreateGroup;
|
|
85
|
+
/**
|
|
86
|
+
* Add an identity to a credentials group
|
|
87
|
+
*/
|
|
88
|
+
addToCredentialGroup(identity: Identity, groupId?: string): void;
|
|
89
|
+
/**
|
|
90
|
+
* Common credential proofs
|
|
91
|
+
*/
|
|
92
|
+
/**
|
|
93
|
+
* Prove age without revealing exact birthdate
|
|
94
|
+
*/
|
|
95
|
+
proveAge(identity: Identity, birthDate: Date, minimumAge: number): Promise<VerifiableCredentialProof>;
|
|
96
|
+
/**
|
|
97
|
+
* Prove citizenship without revealing country
|
|
98
|
+
*/
|
|
99
|
+
proveCitizenship(identity: Identity, country: string, region?: string): Promise<VerifiableCredentialProof>;
|
|
100
|
+
/**
|
|
101
|
+
* Prove education without revealing institution
|
|
102
|
+
*/
|
|
103
|
+
proveEducation(identity: Identity, degree: string, university: string, year: number): Promise<VerifiableCredentialProof>;
|
|
104
|
+
/**
|
|
105
|
+
* Prove income range without revealing exact amount
|
|
106
|
+
*/
|
|
107
|
+
proveIncome(identity: Identity, amount: number, minimumRequired: number, currency?: string): Promise<VerifiableCredentialProof>;
|
|
108
|
+
/**
|
|
109
|
+
* Cleanup resources
|
|
110
|
+
*/
|
|
111
|
+
cleanup(): void;
|
|
112
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { ISEAPair } from "gun";
|
|
2
|
+
import { ZkIdentityData, ZkProofGenerationOptions, ZkProofVerificationResult, ZkProofCredential, SemaphoreProof } from "./types";
|
|
3
|
+
/**
|
|
4
|
+
* Connector for ZK-Proof operations using Semaphore protocol
|
|
5
|
+
*/
|
|
6
|
+
export declare class ZkProofConnector {
|
|
7
|
+
private identityCache;
|
|
8
|
+
private credentialCache;
|
|
9
|
+
private groups;
|
|
10
|
+
/**
|
|
11
|
+
* Generate a new Semaphore identity
|
|
12
|
+
*/
|
|
13
|
+
generateIdentity(seed?: string): Promise<ZkIdentityData>;
|
|
14
|
+
/**
|
|
15
|
+
* Restore identity from trapdoor
|
|
16
|
+
*/
|
|
17
|
+
restoreIdentity(trapdoor: string): Promise<ZkIdentityData>;
|
|
18
|
+
/**
|
|
19
|
+
* Generate Gun credentials from ZK identity
|
|
20
|
+
*/
|
|
21
|
+
generateCredentials(identityData: ZkIdentityData): Promise<ISEAPair>;
|
|
22
|
+
/**
|
|
23
|
+
* Get or create a Semaphore group
|
|
24
|
+
*/
|
|
25
|
+
private getOrCreateGroup;
|
|
26
|
+
/**
|
|
27
|
+
* Add identity to a group
|
|
28
|
+
*/
|
|
29
|
+
addToGroup(commitment: string, groupId?: string): void;
|
|
30
|
+
/**
|
|
31
|
+
* Generate a Semaphore proof
|
|
32
|
+
*/
|
|
33
|
+
generateProof(identityData: ZkIdentityData, options?: ZkProofGenerationOptions): Promise<SemaphoreProof>;
|
|
34
|
+
/**
|
|
35
|
+
* Verify a Semaphore proof
|
|
36
|
+
*/
|
|
37
|
+
verifyProof(proof: SemaphoreProof, treeDepth?: number): Promise<ZkProofVerificationResult>;
|
|
38
|
+
/**
|
|
39
|
+
* Get cached credential by commitment
|
|
40
|
+
*/
|
|
41
|
+
getCredential(commitment: string): ZkProofCredential | undefined;
|
|
42
|
+
/**
|
|
43
|
+
* Clear all caches
|
|
44
|
+
*/
|
|
45
|
+
cleanup(): void;
|
|
46
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { BasePlugin } from "../base";
|
|
2
|
+
import { ShogunCore } from "../../core";
|
|
3
|
+
import { ZkIdentityData, ZkProofPluginInterface, ZkProofGenerationOptions, ZkProofVerificationResult, ZkProofConfig } from "./types";
|
|
4
|
+
import { AuthResult, SignUpResult, PluginCategory } from "../../interfaces/shogun";
|
|
5
|
+
import { ISEAPair } from "gun";
|
|
6
|
+
/**
|
|
7
|
+
* Plugin for Zero-Knowledge Proof authentication using Semaphore protocol
|
|
8
|
+
*
|
|
9
|
+
* Features:
|
|
10
|
+
* - Anonymous authentication with ZK proofs
|
|
11
|
+
* - Multi-device support via trapdoor backup
|
|
12
|
+
* - Privacy-preserving identity management
|
|
13
|
+
* - Compatible with Gun decentralized storage
|
|
14
|
+
*/
|
|
15
|
+
export declare class ZkProofPlugin extends BasePlugin implements ZkProofPluginInterface {
|
|
16
|
+
name: string;
|
|
17
|
+
version: string;
|
|
18
|
+
description: string;
|
|
19
|
+
_category: PluginCategory;
|
|
20
|
+
private connector;
|
|
21
|
+
private config;
|
|
22
|
+
constructor(config?: ZkProofConfig);
|
|
23
|
+
/**
|
|
24
|
+
* Initialize the plugin
|
|
25
|
+
*/
|
|
26
|
+
initialize(core: ShogunCore): void;
|
|
27
|
+
/**
|
|
28
|
+
* Clean up resources
|
|
29
|
+
*/
|
|
30
|
+
destroy(): void;
|
|
31
|
+
/**
|
|
32
|
+
* Ensure connector is initialized
|
|
33
|
+
*/
|
|
34
|
+
private assertConnector;
|
|
35
|
+
/**
|
|
36
|
+
* Generate a new ZK identity
|
|
37
|
+
*/
|
|
38
|
+
generateIdentity(seed?: string): Promise<ZkIdentityData>;
|
|
39
|
+
/**
|
|
40
|
+
* Restore identity from trapdoor/seed phrase
|
|
41
|
+
*/
|
|
42
|
+
restoreIdentity(trapdoor: string): Promise<ZkIdentityData>;
|
|
43
|
+
/**
|
|
44
|
+
* Generate credentials for Gun authentication
|
|
45
|
+
*/
|
|
46
|
+
generateCredentials(identityData: ZkIdentityData): Promise<ISEAPair>;
|
|
47
|
+
/**
|
|
48
|
+
* Generate a zero-knowledge proof
|
|
49
|
+
*/
|
|
50
|
+
generateProof(identityData: ZkIdentityData, options?: ZkProofGenerationOptions): Promise<any>;
|
|
51
|
+
/**
|
|
52
|
+
* Verify a zero-knowledge proof
|
|
53
|
+
*/
|
|
54
|
+
verifyProof(proof: any, treeDepth?: number): Promise<ZkProofVerificationResult>;
|
|
55
|
+
/**
|
|
56
|
+
* Add identity to a group
|
|
57
|
+
*/
|
|
58
|
+
addToGroup(commitment: string, groupId?: string): void;
|
|
59
|
+
/**
|
|
60
|
+
* Login with ZK proof
|
|
61
|
+
* @param trapdoor - User's trapdoor/seed phrase
|
|
62
|
+
* @returns Authentication result
|
|
63
|
+
*/
|
|
64
|
+
login(trapdoor: string): Promise<AuthResult>;
|
|
65
|
+
/**
|
|
66
|
+
* Sign up with new ZK identity
|
|
67
|
+
* @param seed - Optional seed for deterministic generation
|
|
68
|
+
* @returns Authentication result with trapdoor for backup
|
|
69
|
+
*/
|
|
70
|
+
signUp(seed?: string): Promise<SignUpResult>;
|
|
71
|
+
/**
|
|
72
|
+
* Check if ZK-Proof is available
|
|
73
|
+
*/
|
|
74
|
+
isAvailable(): boolean;
|
|
75
|
+
}
|
|
76
|
+
export type { ZkProofPluginInterface } from "./types";
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Storage implementation based on StorageMock
|
|
3
|
+
* Provides a unified storage interface that works in both browser and non-browser environments
|
|
4
|
+
* In browser environments, data is persisted to localStorage as a backup
|
|
5
|
+
*/
|
|
6
|
+
export declare class ShogunStorage {
|
|
7
|
+
private store;
|
|
8
|
+
private isTestMode;
|
|
9
|
+
private useLocalStorage;
|
|
10
|
+
private silent;
|
|
11
|
+
/**
|
|
12
|
+
* Initializes storage and loads any existing keypair from localStorage if available
|
|
13
|
+
*/
|
|
14
|
+
constructor(silent?: boolean);
|
|
15
|
+
/**
|
|
16
|
+
* Gets the stored keypair asynchronously
|
|
17
|
+
* @returns Promise resolving to the keypair or null if not found
|
|
18
|
+
*/
|
|
19
|
+
getPair(): Promise<any>;
|
|
20
|
+
/**
|
|
21
|
+
* Gets the stored keypair synchronously
|
|
22
|
+
* @returns The keypair or null if not found
|
|
23
|
+
*/
|
|
24
|
+
getPairSync(): any;
|
|
25
|
+
/**
|
|
26
|
+
* Stores a keypair both in memory and localStorage if available
|
|
27
|
+
* @param pair - The keypair to store
|
|
28
|
+
*/
|
|
29
|
+
setPair(pair: any): Promise<void>;
|
|
30
|
+
/**
|
|
31
|
+
* Clears all stored data from both memory and localStorage
|
|
32
|
+
*/
|
|
33
|
+
clearAll(): void;
|
|
34
|
+
/**
|
|
35
|
+
* Gets an item from storage
|
|
36
|
+
* @param key - The key to retrieve
|
|
37
|
+
* @returns The stored value, or null if not found
|
|
38
|
+
*/
|
|
39
|
+
getItem(key: string): any;
|
|
40
|
+
/**
|
|
41
|
+
* Stores an item in both memory and localStorage if available
|
|
42
|
+
* @param key - The key to store under
|
|
43
|
+
* @param value - The value to store (must be JSON stringifiable)
|
|
44
|
+
*/
|
|
45
|
+
setItem(key: string, value: any): void;
|
|
46
|
+
/**
|
|
47
|
+
* Removes an item from both memory and localStorage if available
|
|
48
|
+
* @param key - The key to remove
|
|
49
|
+
*/
|
|
50
|
+
removeItem(key: string): void;
|
|
51
|
+
}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { LogLevel } from "../interfaces/common";
|
|
2
|
+
/**
|
|
3
|
+
* Types of errors that can occur in the application
|
|
4
|
+
*/
|
|
5
|
+
export declare enum ErrorType {
|
|
6
|
+
AUTHENTICATION = "AuthenticationError",
|
|
7
|
+
AUTHORIZATION = "AuthorizationError",
|
|
8
|
+
VALIDATION = "ValidationError",
|
|
9
|
+
NETWORK = "NetworkError",
|
|
10
|
+
DATABASE = "DatabaseError",
|
|
11
|
+
WALLET = "WalletError",
|
|
12
|
+
STORAGE = "StorageError",
|
|
13
|
+
ENCRYPTION = "EncryptionError",
|
|
14
|
+
SIGNATURE = "SignatureError",
|
|
15
|
+
ENVIRONMENT = "EnvironmentError",
|
|
16
|
+
SECURITY = "SecurityError",
|
|
17
|
+
GUN = "GunError",
|
|
18
|
+
STEALTH = "StealthError",
|
|
19
|
+
WEBAUTHN = "WebAuthnError",
|
|
20
|
+
PLUGIN = "PluginError",
|
|
21
|
+
UNKNOWN = "UnknownError",
|
|
22
|
+
CONNECTOR = "ConnectorError",
|
|
23
|
+
GENERAL = "GeneralError",
|
|
24
|
+
CONTRACT = "ContractError",
|
|
25
|
+
BIP32 = "BIP32Error",
|
|
26
|
+
ETHEREUM = "EthereumError",
|
|
27
|
+
BITCOIN = "BitcoinError"
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Standard interface for Shogun errors
|
|
31
|
+
*/
|
|
32
|
+
export interface ShogunError {
|
|
33
|
+
type: ErrorType;
|
|
34
|
+
code: string;
|
|
35
|
+
message: string;
|
|
36
|
+
originalError?: Error | unknown;
|
|
37
|
+
timestamp: number;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Wrapper to standardize errors
|
|
41
|
+
* @param type - Error type
|
|
42
|
+
* @param code - Error code
|
|
43
|
+
* @param message - Error message
|
|
44
|
+
* @param originalError - Original error
|
|
45
|
+
* @returns A structured error object
|
|
46
|
+
*/
|
|
47
|
+
export declare function createError(type: ErrorType, code: string, message: string, originalError?: Error | unknown): ShogunError;
|
|
48
|
+
/**
|
|
49
|
+
* Centralized error handler
|
|
50
|
+
*/
|
|
51
|
+
export declare class ErrorHandler {
|
|
52
|
+
private static errors;
|
|
53
|
+
private static maxErrors;
|
|
54
|
+
private static listeners;
|
|
55
|
+
private static externalLogger;
|
|
56
|
+
/**
|
|
57
|
+
* Set an external logging service for production error monitoring
|
|
58
|
+
* @param logger - External logger function to send errors to a monitoring service
|
|
59
|
+
*/
|
|
60
|
+
static setExternalLogger(logger: (error: ShogunError) => void): void;
|
|
61
|
+
/**
|
|
62
|
+
* Handles an error by logging it and notifying listeners
|
|
63
|
+
* @param error - The error to handle
|
|
64
|
+
*/
|
|
65
|
+
static handleError(error: ShogunError): void;
|
|
66
|
+
/**
|
|
67
|
+
* Handles a raw error by converting it to ShogunError
|
|
68
|
+
* @param type - Error type
|
|
69
|
+
* @param code - Error code
|
|
70
|
+
* @param message - Error message
|
|
71
|
+
* @param originalError - Original error
|
|
72
|
+
* @param logLevel - Log level for the error
|
|
73
|
+
*/
|
|
74
|
+
static handle(type: ErrorType, code: string, message: string, originalError?: Error | unknown, logLevel?: LogLevel): ShogunError;
|
|
75
|
+
/**
|
|
76
|
+
* Handles errors and throws them as standardized ShogunError objects
|
|
77
|
+
* @param type - Error type
|
|
78
|
+
* @param code - Error code
|
|
79
|
+
* @param message - Error message
|
|
80
|
+
* @param originalError - Original error
|
|
81
|
+
* @throws ShogunError
|
|
82
|
+
*/
|
|
83
|
+
static handleAndThrow(type: ErrorType, code: string, message: string, originalError?: Error | unknown): never;
|
|
84
|
+
/**
|
|
85
|
+
* Retrieves the last N errors
|
|
86
|
+
* @param count - Number of errors to retrieve
|
|
87
|
+
* @returns List of most recent errors
|
|
88
|
+
*/
|
|
89
|
+
static getRecentErrors(count?: number): ShogunError[];
|
|
90
|
+
/**
|
|
91
|
+
* Adds a listener for errors
|
|
92
|
+
* @param listener - Function that will be called when an error occurs
|
|
93
|
+
*/
|
|
94
|
+
static addListener(listener: (error: ShogunError) => void): void;
|
|
95
|
+
/**
|
|
96
|
+
* Removes an error listener
|
|
97
|
+
* @param listener - Function to remove
|
|
98
|
+
*/
|
|
99
|
+
static removeListener(listener: (error: ShogunError) => void): void;
|
|
100
|
+
/**
|
|
101
|
+
* Notifies all listeners of an error
|
|
102
|
+
* @param error - Error to notify
|
|
103
|
+
*/
|
|
104
|
+
private static notifyListeners;
|
|
105
|
+
/**
|
|
106
|
+
* Helper function to format error messages from native errors
|
|
107
|
+
* @param error - Error to format
|
|
108
|
+
* @returns Formatted error message
|
|
109
|
+
*/
|
|
110
|
+
static formatError(error: Error | unknown): string;
|
|
111
|
+
/**
|
|
112
|
+
* Error handling with retry logic
|
|
113
|
+
*/
|
|
114
|
+
static withRetry<T>(fn: () => Promise<T>, errorType: ErrorType, errorCode: string, maxRetries?: number, retryDelay?: number): Promise<T>;
|
|
115
|
+
/**
|
|
116
|
+
* Clear all stored errors
|
|
117
|
+
*/
|
|
118
|
+
static clearErrors(): void;
|
|
119
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type for any event data
|
|
3
|
+
*/
|
|
4
|
+
export type EventData = Record<string, unknown>;
|
|
5
|
+
/**
|
|
6
|
+
* Generic event listener type
|
|
7
|
+
*/
|
|
8
|
+
export type Listener<T = unknown> = (data: T) => void;
|
|
9
|
+
/**
|
|
10
|
+
* Event type che può essere string o symbol per compatibilità con Node.js EventEmitter
|
|
11
|
+
*/
|
|
12
|
+
export type EventType = string | symbol;
|
|
13
|
+
/**
|
|
14
|
+
* Simple event emitter implementation with generic event types
|
|
15
|
+
*/
|
|
16
|
+
export declare class EventEmitter<Events extends Record<string, unknown> = Record<string, unknown>> {
|
|
17
|
+
private events;
|
|
18
|
+
constructor();
|
|
19
|
+
/**
|
|
20
|
+
* Registers an event listener
|
|
21
|
+
*/
|
|
22
|
+
on(event: EventType, listener: (data: unknown) => void): void;
|
|
23
|
+
/**
|
|
24
|
+
* Emits an event with arguments
|
|
25
|
+
*/
|
|
26
|
+
emit(event: EventType, data?: unknown): boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Removes an event listener
|
|
29
|
+
*/
|
|
30
|
+
off(event: EventType, listener: (data: unknown) => void): void;
|
|
31
|
+
/**
|
|
32
|
+
* Registers a one-time event listener
|
|
33
|
+
*/
|
|
34
|
+
once(event: EventType, listener: (data: unknown) => void): void;
|
|
35
|
+
/**
|
|
36
|
+
* Removes all listeners for an event or all events
|
|
37
|
+
*/
|
|
38
|
+
removeAllListeners(event?: EventType): void;
|
|
39
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Seed Phrase Utilities for Multi-Device Authentication
|
|
3
|
+
* Provides BIP39-compatible seed phrase generation and validation
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Generate a new 12-word BIP39 mnemonic seed phrase
|
|
7
|
+
* @returns {string} 12-word mnemonic seed phrase
|
|
8
|
+
*/
|
|
9
|
+
export declare function generateSeedPhrase(): string;
|
|
10
|
+
/**
|
|
11
|
+
* Validate a BIP39 mnemonic seed phrase
|
|
12
|
+
* @param {string} mnemonic - The seed phrase to validate
|
|
13
|
+
* @returns {boolean} True if valid, false otherwise
|
|
14
|
+
*/
|
|
15
|
+
export declare function validateSeedPhrase(mnemonic: string): boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Derive a deterministic seed from mnemonic and username
|
|
18
|
+
* @param {string} mnemonic - The BIP39 mnemonic seed phrase
|
|
19
|
+
* @param {string} username - Username to include in derivation
|
|
20
|
+
* @returns {Uint8Array} 64-byte seed for key derivation
|
|
21
|
+
*/
|
|
22
|
+
export declare function mnemonicToSeed(mnemonic: string, username: string): Uint8Array;
|
|
23
|
+
/**
|
|
24
|
+
* Convert seed to deterministic password for GunDB
|
|
25
|
+
* @param {Uint8Array} seed - The seed from mnemonic
|
|
26
|
+
* @returns {string} Hex-encoded password
|
|
27
|
+
*/
|
|
28
|
+
export declare function seedToPassword(seed: Uint8Array): string;
|
|
29
|
+
/**
|
|
30
|
+
* Derive GunDB credentials from mnemonic
|
|
31
|
+
* @param {string} mnemonic - The BIP39 mnemonic
|
|
32
|
+
* @param {string} username - Username for derivation
|
|
33
|
+
* @returns {{password: string; seed: Uint8Array}} Credentials for GunDB
|
|
34
|
+
*/
|
|
35
|
+
export declare function deriveCredentialsFromMnemonic(mnemonic: string, username: string): {
|
|
36
|
+
password: string;
|
|
37
|
+
seed: Uint8Array;
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* Format seed phrase for display (with word numbers)
|
|
41
|
+
* @param {string} mnemonic - The seed phrase
|
|
42
|
+
* @returns {string} Formatted seed phrase with numbers
|
|
43
|
+
*/
|
|
44
|
+
export declare function formatSeedPhrase(mnemonic: string): string;
|
|
45
|
+
/**
|
|
46
|
+
* Normalize and clean user input for seed phrase
|
|
47
|
+
* @param {string} input - User-provided seed phrase
|
|
48
|
+
* @returns {string} Normalized seed phrase
|
|
49
|
+
*/
|
|
50
|
+
export declare function normalizeSeedPhrase(input: string): string;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Valida uno username secondo le regole comuni
|
|
3
|
+
*/
|
|
4
|
+
export declare function validateUsername(username: string): boolean;
|
|
5
|
+
/**
|
|
6
|
+
* Valida una email
|
|
7
|
+
*/
|
|
8
|
+
export declare function validateEmail(email: string): boolean;
|
|
9
|
+
/**
|
|
10
|
+
* Valida un provider OAuth supportato
|
|
11
|
+
* @deprecated OAuth has been removed from Shogun Core
|
|
12
|
+
*/
|
|
13
|
+
export declare function validateProvider(provider: string): boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Genera uno username uniforme a partire da provider e userInfo
|
|
16
|
+
* Esempio: google_utente, github_12345, nostr_pubkey, web3_0xabc...
|
|
17
|
+
*/
|
|
18
|
+
export declare function generateUsernameFromIdentity(provider: string, userInfo: {
|
|
19
|
+
id?: string;
|
|
20
|
+
email?: string;
|
|
21
|
+
name?: string;
|
|
22
|
+
}): string;
|
|
23
|
+
/**
|
|
24
|
+
* Genera una password deterministica sicura a partire da un salt
|
|
25
|
+
* Usare per OAuth, Web3, Nostr, ecc.
|
|
26
|
+
*/
|
|
27
|
+
export declare function generateDeterministicPassword(salt: string): string;
|