shogun-core 1.3.0 → 1.3.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 +4 -40
- package/dist/browser/shogun-core.js +1 -1
- package/dist/browser/shogun-core.light.js +1 -1
- package/dist/browser/shogun-core.vendors.light.js +1 -1
- package/dist/core.js +9 -29
- package/dist/gundb/gunInstance.js +1 -1
- package/dist/types/core.d.ts +0 -21
- package/dist/types/gundb/index.d.ts +1 -0
- package/package.json +1 -1
package/dist/core.js
CHANGED
|
@@ -110,6 +110,15 @@ class ShogunCore {
|
|
|
110
110
|
(0, logger_1.logError)("Error initializing Gun user:", error);
|
|
111
111
|
throw new Error(`Failed to initialize Gun user: ${error}`);
|
|
112
112
|
}
|
|
113
|
+
this._gun.on("auth", (user) => {
|
|
114
|
+
(0, logger_1.log)("Gun auth event received", user);
|
|
115
|
+
this._user = this._gun.user();
|
|
116
|
+
this.eventEmitter.emit("auth:login", {
|
|
117
|
+
pub: user.pub,
|
|
118
|
+
alias: user.alias,
|
|
119
|
+
method: "recall",
|
|
120
|
+
});
|
|
121
|
+
});
|
|
113
122
|
this.rx = new rxjs_integration_1.GunRxJS(this._gun);
|
|
114
123
|
this.registerBuiltinPlugins(config);
|
|
115
124
|
if (config.plugins?.autoRegister &&
|
|
@@ -592,34 +601,5 @@ class ShogunCore {
|
|
|
592
601
|
getAuthMethod() {
|
|
593
602
|
return this.currentAuthMethod;
|
|
594
603
|
}
|
|
595
|
-
// *********************************************************************************************************
|
|
596
|
-
// 🔐 CRYPTO CONVENIENCE METHODS 🔐
|
|
597
|
-
// *********************************************************************************************************
|
|
598
|
-
/**
|
|
599
|
-
* Encrypts data using Gun.SEA (convenience method)
|
|
600
|
-
* @param data Data to encrypt
|
|
601
|
-
* @param key Encryption key
|
|
602
|
-
* @returns Promise that resolves with the encrypted data
|
|
603
|
-
*/
|
|
604
|
-
async encrypt(data, key) {
|
|
605
|
-
return this.gundb.encrypt(data, key);
|
|
606
|
-
}
|
|
607
|
-
/**
|
|
608
|
-
* Decrypts data using Gun.SEA (convenience method)
|
|
609
|
-
* @param encryptedData Encrypted data
|
|
610
|
-
* @param key Decryption key
|
|
611
|
-
* @returns Promise that resolves with the decrypted data
|
|
612
|
-
*/
|
|
613
|
-
async decrypt(encryptedData, key) {
|
|
614
|
-
return this.gundb.decrypt(encryptedData, key);
|
|
615
|
-
}
|
|
616
|
-
/**
|
|
617
|
-
* Hashes text using Gun.SEA (convenience method)
|
|
618
|
-
* @param text Text to hash
|
|
619
|
-
* @returns Promise that resolves with the hashed text
|
|
620
|
-
*/
|
|
621
|
-
async hashText(text) {
|
|
622
|
-
return this.gundb.hashText(text);
|
|
623
|
-
}
|
|
624
604
|
}
|
|
625
605
|
exports.ShogunCore = ShogunCore;
|
|
@@ -1026,7 +1026,7 @@ class GunInstance {
|
|
|
1026
1026
|
}
|
|
1027
1027
|
// Save security questions and encrypted hint
|
|
1028
1028
|
await this.saveUserData("security", {
|
|
1029
|
-
questions: securityQuestions,
|
|
1029
|
+
questions: JSON.stringify(securityQuestions),
|
|
1030
1030
|
hint: encryptedHint,
|
|
1031
1031
|
});
|
|
1032
1032
|
return { success: true };
|
package/dist/types/core.d.ts
CHANGED
|
@@ -11,7 +11,6 @@ export * from "./gundb";
|
|
|
11
11
|
export * from "./gundb/rxjs-integration";
|
|
12
12
|
export * from "./plugins";
|
|
13
13
|
export type * from "./types/plugin";
|
|
14
|
-
export type * from "./utils/errorHandler";
|
|
15
14
|
export type { IGunUserInstance, IGunInstance } from "./gundb/gun-es/gun-es";
|
|
16
15
|
export { SEA, Gun };
|
|
17
16
|
export * from "./types/shogun";
|
|
@@ -197,24 +196,4 @@ export declare class ShogunCore implements IShogunCore {
|
|
|
197
196
|
* @returns The current authentication method or undefined if not set
|
|
198
197
|
*/
|
|
199
198
|
getAuthMethod(): AuthMethod | undefined;
|
|
200
|
-
/**
|
|
201
|
-
* Encrypts data using Gun.SEA (convenience method)
|
|
202
|
-
* @param data Data to encrypt
|
|
203
|
-
* @param key Encryption key
|
|
204
|
-
* @returns Promise that resolves with the encrypted data
|
|
205
|
-
*/
|
|
206
|
-
encrypt(data: any, key: string): Promise<string>;
|
|
207
|
-
/**
|
|
208
|
-
* Decrypts data using Gun.SEA (convenience method)
|
|
209
|
-
* @param encryptedData Encrypted data
|
|
210
|
-
* @param key Decryption key
|
|
211
|
-
* @returns Promise that resolves with the decrypted data
|
|
212
|
-
*/
|
|
213
|
-
decrypt(encryptedData: string, key: string): Promise<string | any>;
|
|
214
|
-
/**
|
|
215
|
-
* Hashes text using Gun.SEA (convenience method)
|
|
216
|
-
* @param text Text to hash
|
|
217
|
-
* @returns Promise that resolves with the hashed text
|
|
218
|
-
*/
|
|
219
|
-
hashText(text: string): Promise<string | any>;
|
|
220
199
|
}
|