shogun-core 3.3.4 → 3.3.6
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/browser/shogun-core.js +79760 -190313
- package/dist/browser/shogun-core.js.map +1 -1
- package/dist/{src/gundb → gundb}/db.js +7 -49
- package/dist/{src/index.js → index.js} +0 -1
- package/dist/{src/managers → managers}/CoreInitializer.js +0 -6
- package/dist/{src/storage → storage}/storage.js +0 -16
- package/dist/types/{src/index.d.ts → index.d.ts} +0 -1
- package/package.json +10 -32
- package/dist/browser/defaultVendors-node_modules_shogun-ipfs_node_modules_axios_index_js.shogun-core.js +0 -7
- package/dist/browser/defaultVendors-node_modules_shogun-ipfs_node_modules_is-ipfs_dist_src_index_js.shogun-core.js +0 -4908
- package/dist/browser/defaultVendors-node_modules_shogun-ipfs_node_modules_is-ipfs_dist_src_index_js.shogun-core.js.map +0 -1
- package/dist/browser/defaultVendors-node_modules_shogun-ipfs_node_modules_uint8-varint_dist_src_index_js-node_modu-0db5ba.shogun-core.js +0 -2109
- package/dist/browser/defaultVendors-node_modules_shogun-ipfs_node_modules_uint8-varint_dist_src_index_js-node_modu-0db5ba.shogun-core.js.map +0 -1
- package/dist/ship/examples/ephemeral-cli.js +0 -234
- package/dist/ship/examples/identity-cli.js +0 -503
- package/dist/ship/examples/messenger-cli.js +0 -745
- package/dist/ship/examples/stealth-cli.js +0 -433
- package/dist/ship/examples/storage-cli.js +0 -615
- package/dist/ship/examples/vault-cli.js +0 -444
- package/dist/ship/examples/wallet-cli.js +0 -767
- package/dist/ship/implementation/SHIP_00.js +0 -478
- package/dist/ship/implementation/SHIP_01.js +0 -433
- package/dist/ship/implementation/SHIP_02.js +0 -1366
- package/dist/ship/implementation/SHIP_03.js +0 -855
- package/dist/ship/implementation/SHIP_04.js +0 -589
- package/dist/ship/implementation/SHIP_05.js +0 -1064
- package/dist/ship/implementation/SHIP_06.js +0 -350
- package/dist/ship/implementation/SHIP_07.js +0 -635
- package/dist/ship/index.js +0 -17
- package/dist/ship/interfaces/ISHIP_00.js +0 -135
- package/dist/ship/interfaces/ISHIP_01.js +0 -128
- package/dist/ship/interfaces/ISHIP_02.js +0 -57
- package/dist/ship/interfaces/ISHIP_03.js +0 -61
- package/dist/ship/interfaces/ISHIP_04.js +0 -62
- package/dist/ship/interfaces/ISHIP_05.js +0 -59
- package/dist/ship/interfaces/ISHIP_06.js +0 -144
- package/dist/ship/interfaces/ISHIP_07.js +0 -194
- package/dist/types/ship/examples/ephemeral-cli.d.ts +0 -13
- package/dist/types/ship/examples/identity-cli.d.ts +0 -40
- package/dist/types/ship/examples/messenger-cli.d.ts +0 -37
- package/dist/types/ship/examples/stealth-cli.d.ts +0 -31
- package/dist/types/ship/examples/storage-cli.d.ts +0 -48
- package/dist/types/ship/examples/vault-cli.d.ts +0 -13
- package/dist/types/ship/examples/wallet-cli.d.ts +0 -131
- package/dist/types/ship/implementation/SHIP_00.d.ts +0 -113
- package/dist/types/ship/implementation/SHIP_01.d.ts +0 -80
- package/dist/types/ship/implementation/SHIP_02.d.ts +0 -297
- package/dist/types/ship/implementation/SHIP_03.d.ts +0 -127
- package/dist/types/ship/implementation/SHIP_04.d.ts +0 -76
- package/dist/types/ship/implementation/SHIP_05.d.ts +0 -70
- package/dist/types/ship/implementation/SHIP_06.d.ts +0 -66
- package/dist/types/ship/implementation/SHIP_07.d.ts +0 -101
- package/dist/types/ship/index.d.ts +0 -14
- package/dist/types/ship/interfaces/ISHIP_00.d.ts +0 -410
- package/dist/types/ship/interfaces/ISHIP_01.d.ts +0 -343
- package/dist/types/ship/interfaces/ISHIP_02.d.ts +0 -470
- package/dist/types/ship/interfaces/ISHIP_03.d.ts +0 -295
- package/dist/types/ship/interfaces/ISHIP_04.d.ts +0 -245
- package/dist/types/ship/interfaces/ISHIP_05.d.ts +0 -234
- package/dist/types/ship/interfaces/ISHIP_06.d.ts +0 -370
- package/dist/types/ship/interfaces/ISHIP_07.d.ts +0 -522
- /package/dist/{src/config → config}/simplified-config.js +0 -0
- /package/dist/{src/core.js → core.js} +0 -0
- /package/dist/{src/examples → examples}/api-test.js +0 -0
- /package/dist/{src/examples → examples}/simple-api-test.js +0 -0
- /package/dist/{src/gundb → gundb}/api.js +0 -0
- /package/dist/{src/gundb → gundb}/crypto.js +0 -0
- /package/dist/{src/gundb → gundb}/derive.js +0 -0
- /package/dist/{src/gundb → gundb}/errors.js +0 -0
- /package/dist/{src/gundb → gundb}/index.js +0 -0
- /package/dist/{src/gundb → gundb}/rxjs.js +0 -0
- /package/dist/{src/gundb → gundb}/types.js +0 -0
- /package/dist/{src/interfaces → interfaces}/common.js +0 -0
- /package/dist/{src/interfaces → interfaces}/events.js +0 -0
- /package/dist/{src/interfaces → interfaces}/plugin.js +0 -0
- /package/dist/{src/interfaces → interfaces}/shogun.js +0 -0
- /package/dist/{src/managers → managers}/AuthManager.js +0 -0
- /package/dist/{src/managers → managers}/EventManager.js +0 -0
- /package/dist/{src/managers → managers}/PluginManager.js +0 -0
- /package/dist/{src/migration-test.js → migration-test.js} +0 -0
- /package/dist/{src/plugins → plugins}/base.js +0 -0
- /package/dist/{src/plugins → plugins}/index.js +0 -0
- /package/dist/{src/plugins → plugins}/nostr/index.js +0 -0
- /package/dist/{src/plugins → plugins}/nostr/nostrConnector.js +0 -0
- /package/dist/{src/plugins → plugins}/nostr/nostrConnectorPlugin.js +0 -0
- /package/dist/{src/plugins → plugins}/nostr/nostrSigner.js +0 -0
- /package/dist/{src/plugins → plugins}/nostr/types.js +0 -0
- /package/dist/{src/plugins → plugins}/oauth/index.js +0 -0
- /package/dist/{src/plugins → plugins}/oauth/oauthConnector.js +0 -0
- /package/dist/{src/plugins → plugins}/oauth/oauthPlugin.js +0 -0
- /package/dist/{src/plugins → plugins}/oauth/types.js +0 -0
- /package/dist/{src/plugins → plugins}/web3/index.js +0 -0
- /package/dist/{src/plugins → plugins}/web3/types.js +0 -0
- /package/dist/{src/plugins → plugins}/web3/web3Connector.js +0 -0
- /package/dist/{src/plugins → plugins}/web3/web3ConnectorPlugin.js +0 -0
- /package/dist/{src/plugins → plugins}/web3/web3Signer.js +0 -0
- /package/dist/{src/plugins → plugins}/webauthn/index.js +0 -0
- /package/dist/{src/plugins → plugins}/webauthn/types.js +0 -0
- /package/dist/{src/plugins → plugins}/webauthn/webauthn.js +0 -0
- /package/dist/{src/plugins → plugins}/webauthn/webauthnPlugin.js +0 -0
- /package/dist/{src/plugins → plugins}/webauthn/webauthnSigner.js +0 -0
- /package/dist/types/{src/config → config}/simplified-config.d.ts +0 -0
- /package/dist/types/{src/core.d.ts → core.d.ts} +0 -0
- /package/dist/{src/types → types}/events.js +0 -0
- /package/dist/types/{src/examples → examples}/api-test.d.ts +0 -0
- /package/dist/types/{src/examples → examples}/simple-api-test.d.ts +0 -0
- /package/dist/types/{src/gundb → gundb}/api.d.ts +0 -0
- /package/dist/types/{src/gundb → gundb}/crypto.d.ts +0 -0
- /package/dist/types/{src/gundb → gundb}/db.d.ts +0 -0
- /package/dist/types/{src/gundb → gundb}/derive.d.ts +0 -0
- /package/dist/types/{src/gundb → gundb}/errors.d.ts +0 -0
- /package/dist/types/{src/gundb → gundb}/index.d.ts +0 -0
- /package/dist/types/{src/gundb → gundb}/rxjs.d.ts +0 -0
- /package/dist/types/{src/gundb → gundb}/types.d.ts +0 -0
- /package/dist/types/{src/interfaces → interfaces}/common.d.ts +0 -0
- /package/dist/types/{src/interfaces → interfaces}/events.d.ts +0 -0
- /package/dist/types/{src/interfaces → interfaces}/plugin.d.ts +0 -0
- /package/dist/types/{src/interfaces → interfaces}/shogun.d.ts +0 -0
- /package/dist/types/{src/managers → managers}/AuthManager.d.ts +0 -0
- /package/dist/types/{src/managers → managers}/CoreInitializer.d.ts +0 -0
- /package/dist/types/{src/managers → managers}/EventManager.d.ts +0 -0
- /package/dist/types/{src/managers → managers}/PluginManager.d.ts +0 -0
- /package/dist/types/{src/migration-test.d.ts → migration-test.d.ts} +0 -0
- /package/dist/types/{src/plugins → plugins}/base.d.ts +0 -0
- /package/dist/types/{src/plugins → plugins}/index.d.ts +0 -0
- /package/dist/types/{src/plugins → plugins}/nostr/index.d.ts +0 -0
- /package/dist/types/{src/plugins → plugins}/nostr/nostrConnector.d.ts +0 -0
- /package/dist/types/{src/plugins → plugins}/nostr/nostrConnectorPlugin.d.ts +0 -0
- /package/dist/types/{src/plugins → plugins}/nostr/nostrSigner.d.ts +0 -0
- /package/dist/types/{src/plugins → plugins}/nostr/types.d.ts +0 -0
- /package/dist/types/{src/plugins → plugins}/oauth/index.d.ts +0 -0
- /package/dist/types/{src/plugins → plugins}/oauth/oauthConnector.d.ts +0 -0
- /package/dist/types/{src/plugins → plugins}/oauth/oauthPlugin.d.ts +0 -0
- /package/dist/types/{src/plugins → plugins}/oauth/types.d.ts +0 -0
- /package/dist/types/{src/plugins → plugins}/web3/index.d.ts +0 -0
- /package/dist/types/{src/plugins → plugins}/web3/types.d.ts +0 -0
- /package/dist/types/{src/plugins → plugins}/web3/web3Connector.d.ts +0 -0
- /package/dist/types/{src/plugins → plugins}/web3/web3ConnectorPlugin.d.ts +0 -0
- /package/dist/types/{src/plugins → plugins}/web3/web3Signer.d.ts +0 -0
- /package/dist/types/{src/plugins → plugins}/webauthn/index.d.ts +0 -0
- /package/dist/types/{src/plugins → plugins}/webauthn/types.d.ts +0 -0
- /package/dist/types/{src/plugins → plugins}/webauthn/webauthn.d.ts +0 -0
- /package/dist/types/{src/plugins → plugins}/webauthn/webauthnPlugin.d.ts +0 -0
- /package/dist/types/{src/plugins → plugins}/webauthn/webauthnSigner.d.ts +0 -0
- /package/dist/{src/types → types}/shogun.js +0 -0
- /package/dist/types/{src/storage → storage}/storage.d.ts +0 -0
- /package/dist/types/{src/types → types}/events.d.ts +0 -0
- /package/dist/types/{src/types → types}/shogun.d.ts +0 -0
- /package/dist/types/{src/utils → utils}/errorHandler.d.ts +0 -0
- /package/dist/types/{src/utils → utils}/eventEmitter.d.ts +0 -0
- /package/dist/types/{src/utils → utils}/validation.d.ts +0 -0
- /package/dist/{src/utils → utils}/errorHandler.js +0 -0
- /package/dist/{src/utils → utils}/eventEmitter.js +0 -0
- /package/dist/{src/utils → utils}/validation.js +0 -0
|
@@ -113,9 +113,6 @@ class DataBase {
|
|
|
113
113
|
this.user = this.gun.user().recall({ sessionStorage: true });
|
|
114
114
|
}
|
|
115
115
|
else {
|
|
116
|
-
if (!this.silent && !this.disableAutoRecall) {
|
|
117
|
-
console.log("No pair found in sessionStorage, using gun.user()");
|
|
118
|
-
}
|
|
119
116
|
this.user = this.gun.user();
|
|
120
117
|
}
|
|
121
118
|
this.subscribeToAuthEvents();
|
|
@@ -164,7 +161,6 @@ class DataBase {
|
|
|
164
161
|
*/
|
|
165
162
|
addPeer(peer) {
|
|
166
163
|
this.gun.opt({ peers: [peer] });
|
|
167
|
-
console.log(`Added new peer: ${peer}`);
|
|
168
164
|
}
|
|
169
165
|
/**
|
|
170
166
|
* Removes a peer from the network
|
|
@@ -182,10 +178,9 @@ class DataBase {
|
|
|
182
178
|
if (peerConnection && typeof peerConnection.close === "function") {
|
|
183
179
|
peerConnection.close();
|
|
184
180
|
}
|
|
185
|
-
console.log(`Removed peer: ${peer}`);
|
|
186
181
|
}
|
|
187
182
|
else {
|
|
188
|
-
console.
|
|
183
|
+
console.error(`Peer not found in current connections: ${peer}`);
|
|
189
184
|
}
|
|
190
185
|
}
|
|
191
186
|
catch (error) {
|
|
@@ -270,7 +265,6 @@ class DataBase {
|
|
|
270
265
|
this.removePeer(peer);
|
|
271
266
|
// Add it back immediately instead of with timeout
|
|
272
267
|
this.addPeer(peer);
|
|
273
|
-
console.log(`Reconnected to peer: ${peer}`);
|
|
274
268
|
}
|
|
275
269
|
catch (error) {
|
|
276
270
|
console.error(`Error reconnecting to peer ${peer}:`, error);
|
|
@@ -294,7 +288,6 @@ class DataBase {
|
|
|
294
288
|
this.addPeer(peer);
|
|
295
289
|
});
|
|
296
290
|
}
|
|
297
|
-
console.log(`Gun database reset with ${newPeers ? newPeers.length : 0} peers: ${newPeers ? newPeers.join(", ") : "none"}`);
|
|
298
291
|
}
|
|
299
292
|
}
|
|
300
293
|
catch (error) {
|
|
@@ -531,7 +524,6 @@ class DataBase {
|
|
|
531
524
|
else {
|
|
532
525
|
const recallResult = userInstance;
|
|
533
526
|
}
|
|
534
|
-
// console.log("recallResult", recallResult);
|
|
535
527
|
}
|
|
536
528
|
catch (recallError) {
|
|
537
529
|
console.error("Error during recall:", recallError);
|
|
@@ -574,7 +566,6 @@ class DataBase {
|
|
|
574
566
|
try {
|
|
575
567
|
const currentUser = this.gun.user();
|
|
576
568
|
if (!currentUser || !currentUser.is) {
|
|
577
|
-
console.log("No user logged in, skipping logout");
|
|
578
569
|
return;
|
|
579
570
|
}
|
|
580
571
|
// Log out user
|
|
@@ -733,7 +724,6 @@ class DataBase {
|
|
|
733
724
|
});
|
|
734
725
|
}
|
|
735
726
|
else {
|
|
736
|
-
console.log(`User created successfully with userPub: ${userPub}`);
|
|
737
727
|
resolve({ success: true, userPub: userPub });
|
|
738
728
|
}
|
|
739
729
|
}
|
|
@@ -769,7 +759,6 @@ class DataBase {
|
|
|
769
759
|
}
|
|
770
760
|
if (pair) {
|
|
771
761
|
this.gun.user().auth(pair, (ack) => {
|
|
772
|
-
console.log(`Pair authentication after creation result:`, ack);
|
|
773
762
|
if (ack.err) {
|
|
774
763
|
console.error(`Authentication after creation failed: ${ack.err}`);
|
|
775
764
|
resolve({ success: false, error: ack.err });
|
|
@@ -779,9 +768,6 @@ class DataBase {
|
|
|
779
768
|
setTimeout(() => {
|
|
780
769
|
// Extract userPub from multiple possible sources
|
|
781
770
|
const userPub = ack.pub || this.gun.user().is?.pub || ack.user?.pub;
|
|
782
|
-
console.log(`Extracted userPub after pair auth: ${userPub}`);
|
|
783
|
-
console.log(`User object after pair auth:`, this.gun.user());
|
|
784
|
-
console.log(`User.is after pair auth:`, this.gun.user().is);
|
|
785
771
|
if (!userPub) {
|
|
786
772
|
console.error("Authentication successful but no userPub found");
|
|
787
773
|
resolve({
|
|
@@ -798,7 +784,6 @@ class DataBase {
|
|
|
798
784
|
}
|
|
799
785
|
else {
|
|
800
786
|
this.gun.user().auth(normalizedUsername, password, (ack) => {
|
|
801
|
-
console.log(`Password authentication after creation result:`, ack);
|
|
802
787
|
if (ack.err) {
|
|
803
788
|
console.error(`Authentication after creation failed: ${ack.err}`);
|
|
804
789
|
resolve({ success: false, error: ack.err });
|
|
@@ -808,9 +793,6 @@ class DataBase {
|
|
|
808
793
|
setTimeout(() => {
|
|
809
794
|
// Extract userPub from multiple possible sources
|
|
810
795
|
const userPub = ack.pub || this.gun.user().is?.pub || ack.user?.pub;
|
|
811
|
-
console.log(`Extracted userPub after password auth: ${userPub}`);
|
|
812
|
-
console.log(`User object after password auth:`, this.gun.user());
|
|
813
|
-
console.log(`User.is after password auth:`, this.gun.user().is);
|
|
814
796
|
if (!userPub) {
|
|
815
797
|
console.error("Authentication successful but no userPub found");
|
|
816
798
|
resolve({
|
|
@@ -874,7 +856,6 @@ class DataBase {
|
|
|
874
856
|
this.user = this.gun.user();
|
|
875
857
|
// Run post-authentication tasks
|
|
876
858
|
try {
|
|
877
|
-
console.log(`Running post-auth setup with userPub: ${authResult.userPub}`);
|
|
878
859
|
const postAuthResult = await this.runPostAuthOnAuthResult(username, authResult.userPub, authResult);
|
|
879
860
|
// Return the post-auth result which includes the complete user data
|
|
880
861
|
return postAuthResult;
|
|
@@ -931,7 +912,6 @@ class DataBase {
|
|
|
931
912
|
// For pair-based authentication, we don't need to call gun.user().create()
|
|
932
913
|
// because the pair already contains the cryptographic credentials
|
|
933
914
|
// We just need to validate that the pair is valid and return success
|
|
934
|
-
console.log(`User created successfully with pair for: ${normalizedUsername}`);
|
|
935
915
|
resolve({ success: true, userPub: pair.pub });
|
|
936
916
|
});
|
|
937
917
|
}
|
|
@@ -964,7 +944,6 @@ class DataBase {
|
|
|
964
944
|
if (normalizedUsername.length === 0) {
|
|
965
945
|
throw new Error("Username cannot be empty");
|
|
966
946
|
}
|
|
967
|
-
console.log(`Setting up user profile for ${normalizedUsername} with userPub: ${userPub}`);
|
|
968
947
|
const existingUser = await this.gun.get(userPub).then();
|
|
969
948
|
const isNewUser = !existingUser || !existingUser.alias;
|
|
970
949
|
// const isNewUser = true;
|
|
@@ -1042,7 +1021,6 @@ class DataBase {
|
|
|
1042
1021
|
if (!userMetadataResult) {
|
|
1043
1022
|
return false;
|
|
1044
1023
|
}
|
|
1045
|
-
console.log(`Comprehensive user tracking setup completed for ${username}`);
|
|
1046
1024
|
return true;
|
|
1047
1025
|
}
|
|
1048
1026
|
catch (error) {
|
|
@@ -1065,7 +1043,6 @@ class DataBase {
|
|
|
1065
1043
|
return false;
|
|
1066
1044
|
}
|
|
1067
1045
|
else {
|
|
1068
|
-
console.log(`Alias index created: ~@${username} -> ${userPub}`);
|
|
1069
1046
|
return true;
|
|
1070
1047
|
}
|
|
1071
1048
|
}
|
|
@@ -1089,7 +1066,6 @@ class DataBase {
|
|
|
1089
1066
|
return false;
|
|
1090
1067
|
}
|
|
1091
1068
|
else {
|
|
1092
|
-
console.log(`Username mapping created: ${username} -> ${userPub}`);
|
|
1093
1069
|
return true;
|
|
1094
1070
|
}
|
|
1095
1071
|
}
|
|
@@ -1120,7 +1096,6 @@ class DataBase {
|
|
|
1120
1096
|
return false;
|
|
1121
1097
|
}
|
|
1122
1098
|
else {
|
|
1123
|
-
console.log(`User registry created: ${userPub}`);
|
|
1124
1099
|
return true;
|
|
1125
1100
|
}
|
|
1126
1101
|
}
|
|
@@ -1144,7 +1119,6 @@ class DataBase {
|
|
|
1144
1119
|
return false;
|
|
1145
1120
|
}
|
|
1146
1121
|
else {
|
|
1147
|
-
console.log(`Reverse lookup created: ${userPub} -> ${username}`);
|
|
1148
1122
|
return true;
|
|
1149
1123
|
}
|
|
1150
1124
|
}
|
|
@@ -1164,7 +1138,6 @@ class DataBase {
|
|
|
1164
1138
|
return false;
|
|
1165
1139
|
}
|
|
1166
1140
|
else {
|
|
1167
|
-
console.log(`Epub index created: ${epub} -> ${userPub}`);
|
|
1168
1141
|
return true;
|
|
1169
1142
|
}
|
|
1170
1143
|
}
|
|
@@ -1190,7 +1163,6 @@ class DataBase {
|
|
|
1190
1163
|
return false;
|
|
1191
1164
|
}
|
|
1192
1165
|
else {
|
|
1193
|
-
console.log(`User metadata created for ${userPub}`);
|
|
1194
1166
|
return true;
|
|
1195
1167
|
}
|
|
1196
1168
|
}
|
|
@@ -1224,7 +1196,7 @@ class DataBase {
|
|
|
1224
1196
|
}
|
|
1225
1197
|
}
|
|
1226
1198
|
catch (error) {
|
|
1227
|
-
console.
|
|
1199
|
+
console.error(`GunDB alias lookup failed for ${normalizedAlias}:`, error);
|
|
1228
1200
|
}
|
|
1229
1201
|
// Method 2: Try username mapping (usernames/alias -> userPub)
|
|
1230
1202
|
try {
|
|
@@ -1240,7 +1212,7 @@ class DataBase {
|
|
|
1240
1212
|
}
|
|
1241
1213
|
}
|
|
1242
1214
|
catch (error) {
|
|
1243
|
-
console.
|
|
1215
|
+
console.error(`Username mapping lookup failed for ${normalizedAlias}:`, error);
|
|
1244
1216
|
}
|
|
1245
1217
|
return null;
|
|
1246
1218
|
}
|
|
@@ -1273,7 +1245,7 @@ class DataBase {
|
|
|
1273
1245
|
}
|
|
1274
1246
|
}
|
|
1275
1247
|
catch (error) {
|
|
1276
|
-
console.
|
|
1248
|
+
console.error(`User registry lookup failed for ${userPub}:`, error);
|
|
1277
1249
|
}
|
|
1278
1250
|
// Method 2: Try user's own node
|
|
1279
1251
|
try {
|
|
@@ -1289,7 +1261,7 @@ class DataBase {
|
|
|
1289
1261
|
}
|
|
1290
1262
|
}
|
|
1291
1263
|
catch (error) {
|
|
1292
|
-
console.
|
|
1264
|
+
console.error(`User node lookup failed for ${userPub}:`, error);
|
|
1293
1265
|
}
|
|
1294
1266
|
return null;
|
|
1295
1267
|
}
|
|
@@ -1373,14 +1345,14 @@ class DataBase {
|
|
|
1373
1345
|
.then();
|
|
1374
1346
|
}
|
|
1375
1347
|
catch (error) {
|
|
1376
|
-
console.
|
|
1348
|
+
console.error(`Failed to update lastSeen in user registry:`, error);
|
|
1377
1349
|
}
|
|
1378
1350
|
// Update in user's own node
|
|
1379
1351
|
try {
|
|
1380
1352
|
await this.gun.get(userPub).get("lastSeen").put(timestamp).then();
|
|
1381
1353
|
}
|
|
1382
1354
|
catch (error) {
|
|
1383
|
-
console.
|
|
1355
|
+
console.error(`Failed to update lastSeen in user node:`, error);
|
|
1384
1356
|
}
|
|
1385
1357
|
}
|
|
1386
1358
|
catch (error) {
|
|
@@ -1392,10 +1364,8 @@ class DataBase {
|
|
|
1392
1364
|
*/
|
|
1393
1365
|
async performAuthentication(username, password, pair) {
|
|
1394
1366
|
return new Promise((resolve) => {
|
|
1395
|
-
console.log(`Attempting authentication for user: ${username}`);
|
|
1396
1367
|
if (pair) {
|
|
1397
1368
|
this.gun.user().auth(pair, (ack) => {
|
|
1398
|
-
console.log(`Pair authentication result:`, ack);
|
|
1399
1369
|
if (ack.err) {
|
|
1400
1370
|
console.error(`Login error for ${username}: ${ack.err}`);
|
|
1401
1371
|
resolve({ success: false, error: ack.err });
|
|
@@ -1407,7 +1377,6 @@ class DataBase {
|
|
|
1407
1377
|
}
|
|
1408
1378
|
else {
|
|
1409
1379
|
this.gun.user().auth(username, password, (ack) => {
|
|
1410
|
-
console.log(`Password authentication result:`, ack);
|
|
1411
1380
|
if (ack.err) {
|
|
1412
1381
|
console.error(`Login error for ${username}: ${ack.err}`);
|
|
1413
1382
|
resolve({ success: false, error: ack.err });
|
|
@@ -1456,9 +1425,6 @@ class DataBase {
|
|
|
1456
1425
|
if (!alias) {
|
|
1457
1426
|
alias = username;
|
|
1458
1427
|
}
|
|
1459
|
-
console.log(`Login authentication successful, extracted userPub: ${userPub}`);
|
|
1460
|
-
console.log(`User object:`, this.gun.user());
|
|
1461
|
-
console.log(`User.is:`, this.gun.user().is);
|
|
1462
1428
|
if (!userPub) {
|
|
1463
1429
|
return {
|
|
1464
1430
|
success: false,
|
|
@@ -1624,7 +1590,6 @@ class DataBase {
|
|
|
1624
1590
|
if (!userPub) {
|
|
1625
1591
|
return { success: false, error: "User not found" };
|
|
1626
1592
|
}
|
|
1627
|
-
// console.log(`Found user public key for password recovery: ${userPub}`);
|
|
1628
1593
|
// Access the user's security data directly from their public key node
|
|
1629
1594
|
const securityData = await this.node.get(userPub)
|
|
1630
1595
|
.get("security")
|
|
@@ -1840,14 +1805,7 @@ exports.DataBase = DataBase;
|
|
|
1840
1805
|
// Errors
|
|
1841
1806
|
DataBase.Errors = GunErrors;
|
|
1842
1807
|
const createGun = (config, silent) => {
|
|
1843
|
-
if (!silent) {
|
|
1844
|
-
console.log("Creating Gun instance with config:", config);
|
|
1845
|
-
console.log("Config peers:", config?.peers);
|
|
1846
|
-
}
|
|
1847
1808
|
const gunInstance = (0, gun_1.default)(config);
|
|
1848
|
-
if (!silent) {
|
|
1849
|
-
console.log("Created Gun instance:", gunInstance);
|
|
1850
|
-
}
|
|
1851
1809
|
return gunInstance;
|
|
1852
1810
|
};
|
|
1853
1811
|
exports.createGun = createGun;
|
|
@@ -42,4 +42,3 @@ __exportStar(require("./utils/errorHandler"), exports);
|
|
|
42
42
|
__exportStar(require("./plugins"), exports);
|
|
43
43
|
__exportStar(require("./interfaces/shogun"), exports);
|
|
44
44
|
__exportStar(require("./config/simplified-config"), exports);
|
|
45
|
-
__exportStar(require("../ship"), exports);
|
|
@@ -62,9 +62,6 @@ class CoreInitializer {
|
|
|
62
62
|
* Initialize Gun instance
|
|
63
63
|
*/
|
|
64
64
|
async initializeGun(config) {
|
|
65
|
-
if (!config.silent) {
|
|
66
|
-
console.log("Initialize Gun instance", config);
|
|
67
|
-
}
|
|
68
65
|
try {
|
|
69
66
|
if (config.gunInstance && config.gunOptions === undefined) {
|
|
70
67
|
if (!config.silent) {
|
|
@@ -100,9 +97,6 @@ class CoreInitializer {
|
|
|
100
97
|
throw new Error(`Failed to create Gun instance: ${error}`);
|
|
101
98
|
}
|
|
102
99
|
try {
|
|
103
|
-
if (!config.silent) {
|
|
104
|
-
console.log("Initialize Gun instance", this.core.gun);
|
|
105
|
-
}
|
|
106
100
|
this.core.db = new gundb_1.DataBase(this.core._gun, config.gunOptions?.scope || "", { disableAutoRecall: config.disableAutoRecall, silent: config.silent });
|
|
107
101
|
// Note: user is a getter that returns _user, so we don't need to assign it
|
|
108
102
|
}
|
|
@@ -15,23 +15,12 @@ class ShogunStorage {
|
|
|
15
15
|
this.silent = silent;
|
|
16
16
|
this.isTestMode = process.env.NODE_ENV === "test";
|
|
17
17
|
this.useLocalStorage = false;
|
|
18
|
-
// Debug: log the environment (only if not silent)
|
|
19
|
-
if (!this.silent) {
|
|
20
|
-
console.log("ShogunStorage: NODE_ENV =", process.env.NODE_ENV);
|
|
21
|
-
console.log("ShogunStorage: isTestMode =", this.isTestMode);
|
|
22
|
-
}
|
|
23
18
|
// In test mode, don't use localStorage to avoid test pollution
|
|
24
19
|
if (this.isTestMode) {
|
|
25
20
|
this.useLocalStorage = false;
|
|
26
|
-
if (!this.silent) {
|
|
27
|
-
console.log("ShogunStorage: Test mode detected, localStorage disabled");
|
|
28
|
-
}
|
|
29
21
|
return;
|
|
30
22
|
}
|
|
31
23
|
if (typeof localStorage !== "undefined") {
|
|
32
|
-
if (!this.silent) {
|
|
33
|
-
console.log("ShogunStorage: localStorage is defined");
|
|
34
|
-
}
|
|
35
24
|
try {
|
|
36
25
|
// Probe localStorage without polluting expectations in tests
|
|
37
26
|
const testKey = "_shogun_test";
|
|
@@ -54,11 +43,6 @@ class ShogunStorage {
|
|
|
54
43
|
}
|
|
55
44
|
}
|
|
56
45
|
}
|
|
57
|
-
else {
|
|
58
|
-
if (!this.silent) {
|
|
59
|
-
console.log("ShogunStorage: localStorage is undefined");
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
46
|
}
|
|
63
47
|
/**
|
|
64
48
|
* Gets the stored keypair asynchronously
|
|
@@ -8,7 +8,6 @@ export * from "./utils/errorHandler";
|
|
|
8
8
|
export * from "./plugins";
|
|
9
9
|
export * from "./interfaces/shogun";
|
|
10
10
|
export * from "./config/simplified-config";
|
|
11
|
-
export * from "../ship";
|
|
12
11
|
export type * from "./interfaces/plugin";
|
|
13
12
|
export type { IGunUserInstance, IGunInstance, GunDataEventData, GunPeerEventData, DeriveOptions, TypedGunOperationResult, TypedAuthResult, };
|
|
14
13
|
export { Gun, ShogunCore, SEA, RxJS, crypto, derive, GunErrors, DataBase, SimpleGunAPI, QuickStart, quickStart, createSimpleAPI, AutoQuickStart, autoQuickStart, };
|
package/package.json
CHANGED
|
@@ -1,36 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "shogun-core",
|
|
3
|
-
"version": "3.3.
|
|
3
|
+
"version": "3.3.6",
|
|
4
4
|
"description": "SHOGUN CORE - Core library for Shogun Ecosystem",
|
|
5
|
-
"main": "./dist/
|
|
6
|
-
"module": "./dist/
|
|
7
|
-
"types": "./dist/types/
|
|
5
|
+
"main": "./dist/index.js",
|
|
6
|
+
"module": "./dist/index.js",
|
|
7
|
+
"types": "./dist/types/index.d.ts",
|
|
8
8
|
"exports": {
|
|
9
9
|
".": {
|
|
10
|
-
"types": "./dist/types/
|
|
11
|
-
"import": "./dist/
|
|
12
|
-
"require": "./dist/
|
|
10
|
+
"types": "./dist/types/index.d.ts",
|
|
11
|
+
"import": "./dist/index.js",
|
|
12
|
+
"require": "./dist/index.js",
|
|
13
13
|
"browser": "./dist/browser/shogun-core.js",
|
|
14
|
-
"default": "./dist/
|
|
15
|
-
"node": "./dist/
|
|
16
|
-
},
|
|
17
|
-
"./ship": {
|
|
18
|
-
"types": "./dist/types/ship/index.d.ts",
|
|
19
|
-
"import": "./dist/ship/index.js",
|
|
20
|
-
"require": "./dist/ship/index.js",
|
|
21
|
-
"default": "./dist/ship/index.js"
|
|
22
|
-
},
|
|
23
|
-
"./ship/implementation/*": {
|
|
24
|
-
"types": "./dist/types/ship/implementation/*.d.ts",
|
|
25
|
-
"import": "./dist/ship/implementation/*.js",
|
|
26
|
-
"require": "./dist/ship/implementation/*.js",
|
|
27
|
-
"default": "./dist/ship/implementation/*.js"
|
|
28
|
-
},
|
|
29
|
-
"./ship/interfaces/*": {
|
|
30
|
-
"types": "./dist/types/ship/interfaces/*.d.ts",
|
|
31
|
-
"import": "./dist/ship/interfaces/*.js",
|
|
32
|
-
"require": "./dist/ship/interfaces/*.js",
|
|
33
|
-
"default": "./dist/ship/interfaces/*.js"
|
|
14
|
+
"default": "./dist/index.js",
|
|
15
|
+
"node": "./dist/index.js"
|
|
34
16
|
}
|
|
35
17
|
},
|
|
36
18
|
"files": [
|
|
@@ -46,7 +28,6 @@
|
|
|
46
28
|
"wallet": "tsx ship/examples/wallet-cli.ts",
|
|
47
29
|
"stealth": "tsx ship/examples/stealth-cli.ts",
|
|
48
30
|
"storage": "tsx ship/examples/storage-cli.ts",
|
|
49
|
-
"ephemeral": "tsx ship/examples/ephemeral-cli.ts",
|
|
50
31
|
"vault": "tsx ship/examples/vault-cli.ts",
|
|
51
32
|
"format": "prettier --write \"src/**/*.ts\"",
|
|
52
33
|
"docs": "yarn typedoc --options typedoc.json",
|
|
@@ -78,18 +59,15 @@
|
|
|
78
59
|
"constants-browserify": "^1.0.0",
|
|
79
60
|
"crypto-browserify": "^3.12.0",
|
|
80
61
|
"ethers": "^6.13.5",
|
|
81
|
-
"form-data": "^4.0.4",
|
|
82
62
|
"gun": "git+https://github.com/amark/gun.git",
|
|
83
63
|
"keccak256": "^1.0.6",
|
|
84
64
|
"nostr-tools": "^2.15.0",
|
|
85
65
|
"qs": "^6.14.0",
|
|
86
66
|
"rxjs": "^7.8.2",
|
|
87
|
-
"shogun-ipfs": "file:../shogun-ipfs",
|
|
88
67
|
"ts-node": "^10.9.2",
|
|
89
68
|
"url": "^0.11.4",
|
|
90
69
|
"uuid": "^11.1.0",
|
|
91
|
-
"vm-browserify": "^1.1.2"
|
|
92
|
-
"ws": "^8.18.3"
|
|
70
|
+
"vm-browserify": "^1.1.2"
|
|
93
71
|
},
|
|
94
72
|
"devDependencies": {
|
|
95
73
|
"@babel/core": "^7.24.3",
|