tool-db 1.0.22 → 1.1.1

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 (90) hide show
  1. package/README.md +71 -9
  2. package/dist/deduplicator.d.ts +19 -0
  3. package/dist/deduplicator.js +60 -0
  4. package/dist/deduplicator.js.map +1 -0
  5. package/dist/index.d.ts +4 -2
  6. package/dist/index.js +9 -5
  7. package/dist/index.js.map +1 -1
  8. package/dist/loadCrdtDocument.d.ts +3 -0
  9. package/dist/loadCrdtDocument.js +43 -0
  10. package/dist/loadCrdtDocument.js.map +1 -0
  11. package/dist/server.d.ts +1 -0
  12. package/dist/server.js +12 -0
  13. package/dist/server.js.map +1 -0
  14. package/dist/shared.js +0 -1
  15. package/dist/shared.js.map +1 -1
  16. package/dist/toolDbAnonSignIn.d.ts +2 -2
  17. package/dist/toolDbClientOnMessage.d.ts +2 -0
  18. package/dist/toolDbClientOnMessage.js +204 -0
  19. package/dist/toolDbClientOnMessage.js.map +1 -0
  20. package/dist/toolDbCrdtPut.d.ts +11 -0
  21. package/dist/toolDbCrdtPut.js +118 -0
  22. package/dist/toolDbCrdtPut.js.map +1 -0
  23. package/dist/toolDbGet.d.ts +2 -2
  24. package/dist/toolDbGet.js +46 -19
  25. package/dist/toolDbGet.js.map +1 -1
  26. package/dist/toolDbGetPubKey.d.ts +2 -2
  27. package/dist/toolDbKeysSignIn.d.ts +8 -0
  28. package/dist/toolDbKeysSignIn.js +23 -0
  29. package/dist/toolDbKeysSignIn.js.map +1 -0
  30. package/dist/toolDbPut.d.ts +3 -3
  31. package/dist/toolDbPut.js +33 -22
  32. package/dist/toolDbPut.js.map +1 -1
  33. package/dist/toolDbSignIn.d.ts +2 -2
  34. package/dist/toolDbSignIn.js +1 -1
  35. package/dist/toolDbSignIn.js.map +1 -1
  36. package/dist/toolDbSignUp.d.ts +2 -2
  37. package/dist/toolDbSignUp.js +25 -18
  38. package/dist/toolDbSignUp.js.map +1 -1
  39. package/dist/toolDbSubscribe.d.ts +8 -0
  40. package/dist/toolDbSubscribe.js +61 -0
  41. package/dist/toolDbSubscribe.js.map +1 -0
  42. package/dist/toolDbVerificationWrapper.d.ts +2 -2
  43. package/dist/toolDbVerificationWrapper.js +2 -2
  44. package/dist/toolDbVerificationWrapper.js.map +1 -1
  45. package/dist/tooldb.d.ts +85 -0
  46. package/dist/tooldb.js +164 -0
  47. package/dist/tooldb.js.map +1 -0
  48. package/dist/types/graph.d.ts +0 -9
  49. package/dist/types/message.d.ts +56 -0
  50. package/dist/types/tooldb.d.ts +10 -0
  51. package/dist/types/tooldb.js +3 -0
  52. package/dist/types/tooldb.js.map +1 -0
  53. package/dist/utils/base64ToBinaryChange.d.ts +2 -0
  54. package/dist/utils/base64ToBinaryChange.js +18 -0
  55. package/dist/utils/base64ToBinaryChange.js.map +1 -0
  56. package/dist/utils/base64ToBinaryDocument.d.ts +2 -0
  57. package/dist/utils/base64ToBinaryDocument.js +18 -0
  58. package/dist/utils/base64ToBinaryDocument.js.map +1 -0
  59. package/dist/utils/crypto/loadKeysComb.d.ts +2 -1
  60. package/dist/utils/crypto/loadKeysComb.js +19 -26
  61. package/dist/utils/crypto/loadKeysComb.js.map +1 -1
  62. package/dist/utils/getIpFromUrl.d.ts +1 -0
  63. package/dist/utils/getIpFromUrl.js +7 -0
  64. package/dist/utils/getIpFromUrl.js.map +1 -0
  65. package/dist/utils/indexedb.d.ts +5 -0
  66. package/dist/utils/indexedb.js +83 -0
  67. package/dist/utils/indexedb.js.map +1 -0
  68. package/dist/utils/leveldb.d.ts +5 -0
  69. package/dist/utils/leveldb.js +47 -0
  70. package/dist/utils/leveldb.js.map +1 -0
  71. package/dist/utils/proofOfWork.js +1 -1
  72. package/dist/utils/proofOfWork.js.map +1 -1
  73. package/dist/utils/uint8ToBase64.d.ts +2 -1
  74. package/dist/utils/uint8ToBase64.js.map +1 -1
  75. package/dist/utils/verifyMessage.d.ts +3 -3
  76. package/dist/utils/verifyMessage.js +29 -12
  77. package/dist/utils/verifyMessage.js.map +1 -1
  78. package/dist/wss.d.ts +28 -0
  79. package/dist/wss.js +176 -0
  80. package/dist/wss.js.map +1 -0
  81. package/package.json +14 -11
  82. package/dist/customGun.d.ts +0 -1
  83. package/dist/customGun.js +0 -147
  84. package/dist/customGun.js.map +0 -1
  85. package/dist/toolDbClient.d.ts +0 -46
  86. package/dist/toolDbClient.js +0 -83
  87. package/dist/toolDbClient.js.map +0 -1
  88. package/dist/toolDbService.d.ts +0 -29
  89. package/dist/toolDbService.js +0 -149
  90. package/dist/toolDbService.js.map +0 -1
@@ -1,46 +0,0 @@
1
- import { GraphEntryValue } from ".";
2
- import toolDbAnonSignIn from "./toolDbAnonSignIn";
3
- import toolDbGet from "./toolDbGet";
4
- import toolDbGetPubKey from "./toolDbGetPubKey";
5
- import toolDbPut from "./toolDbPut";
6
- import toolDbSignIn from "./toolDbSignIn";
7
- import toolDbSignUp from "./toolDbSignUp";
8
- import toolDbVerificationWrapper from "./toolDbVerificationWrapper";
9
- interface Listener {
10
- key: string;
11
- timeout: number | null;
12
- fn: (msg: any) => void;
13
- }
14
- interface Verificator<T> {
15
- key: string;
16
- fn: (msg: GraphEntryValue<T>) => Promise<boolean>;
17
- }
18
- declare class ToolDbClient {
19
- debug: boolean;
20
- private _gun;
21
- getData: typeof toolDbGet;
22
- putData: typeof toolDbPut;
23
- getPubKey: typeof toolDbGetPubKey;
24
- signIn: typeof toolDbSignIn;
25
- anonSignIn: typeof toolDbAnonSignIn;
26
- signUp: typeof toolDbSignUp;
27
- verify: typeof toolDbVerificationWrapper;
28
- _keyListeners: (Listener | null)[];
29
- addKeyListener: <T = any>(key: string, fn: (msg: T) => void) => number;
30
- removeKeyListener: (id: number) => void;
31
- _customVerificator: (Verificator<any> | null)[];
32
- addCustomVerification: <T = any>(key: string, fn: (msg: GraphEntryValue<T>) => Promise<boolean>) => number;
33
- removeCustomVerification: (id: number) => void;
34
- user: {
35
- keys: {
36
- signKeys: CryptoKeyPair;
37
- encryptionKeys: CryptoKeyPair;
38
- };
39
- name: string;
40
- pubKey: string;
41
- } | undefined;
42
- constructor(peers?: string[]);
43
- get gun(): any;
44
- get requiredGun(): any;
45
- }
46
- export default ToolDbClient;
@@ -1,83 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- var customGun_1 = __importDefault(require("./customGun"));
7
- var shared_1 = __importDefault(require("./shared"));
8
- var toolDbAnonSignIn_1 = __importDefault(require("./toolDbAnonSignIn"));
9
- var toolDbGet_1 = __importDefault(require("./toolDbGet"));
10
- var toolDbGetPubKey_1 = __importDefault(require("./toolDbGetPubKey"));
11
- var toolDbPut_1 = __importDefault(require("./toolDbPut"));
12
- var toolDbSignIn_1 = __importDefault(require("./toolDbSignIn"));
13
- var toolDbSignUp_1 = __importDefault(require("./toolDbSignUp"));
14
- var toolDbVerificationWrapper_1 = __importDefault(require("./toolDbVerificationWrapper"));
15
- var Gun = require("gun");
16
- var ToolDbClient = /** @class */ (function () {
17
- function ToolDbClient(peers) {
18
- var _this = this;
19
- this.debug = false;
20
- this.getData = toolDbGet_1.default;
21
- this.putData = toolDbPut_1.default;
22
- this.getPubKey = toolDbGetPubKey_1.default;
23
- this.signIn = toolDbSignIn_1.default;
24
- this.anonSignIn = toolDbAnonSignIn_1.default;
25
- this.signUp = toolDbSignUp_1.default;
26
- this.verify = toolDbVerificationWrapper_1.default;
27
- this._keyListeners = [];
28
- this.addKeyListener = function (key, fn) {
29
- var newListener = {
30
- key: key,
31
- timeout: null,
32
- fn: fn,
33
- };
34
- _this._keyListeners.push(newListener);
35
- return _this._keyListeners.length;
36
- };
37
- this.removeKeyListener = function (id) {
38
- var _a, _b;
39
- if ((_a = _this._keyListeners[id]) === null || _a === void 0 ? void 0 : _a.timeout) {
40
- clearTimeout(((_b = _this._keyListeners[id]) === null || _b === void 0 ? void 0 : _b.timeout) || undefined);
41
- }
42
- _this._keyListeners[id] = null;
43
- };
44
- this._customVerificator = [];
45
- this.addCustomVerification = function (key, fn) {
46
- var newListener = {
47
- key: key,
48
- fn: fn,
49
- };
50
- _this._customVerificator.push(newListener);
51
- return _this._customVerificator.length;
52
- };
53
- this.removeCustomVerification = function (id) {
54
- _this._customVerificator[id] = null;
55
- };
56
- this.user = undefined;
57
- shared_1.default.toolDb = this;
58
- shared_1.default.gun = Gun;
59
- if (peers) {
60
- (0, customGun_1.default)(this, Gun);
61
- this._gun = new Gun({
62
- peers: peers,
63
- });
64
- }
65
- }
66
- Object.defineProperty(ToolDbClient.prototype, "gun", {
67
- get: function () {
68
- return this._gun;
69
- },
70
- enumerable: false,
71
- configurable: true
72
- });
73
- Object.defineProperty(ToolDbClient.prototype, "requiredGun", {
74
- get: function () {
75
- return shared_1.default.gun;
76
- },
77
- enumerable: false,
78
- configurable: true
79
- });
80
- return ToolDbClient;
81
- }());
82
- exports.default = ToolDbClient;
83
- //# sourceMappingURL=toolDbClient.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"toolDbClient.js","sourceRoot":"","sources":["../src/toolDbClient.ts"],"names":[],"mappings":";;;;;AAEA,0DAAoC;AACpC,oDAA8B;AAC9B,wEAAkD;AAClD,0DAAoC;AACpC,sEAAgD;AAChD,0DAAoC;AACpC,gEAA0C;AAC1C,gEAA0C;AAC1C,0FAAoE;AAEpE,IAAM,GAAG,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC;AAa3B;IAqEE,sBAAY,KAAgB;QAA5B,iBAUC;QA9EM,UAAK,GAAG,KAAK,CAAC;QAId,YAAO,GAAG,mBAAS,CAAC;QAEpB,YAAO,GAAG,mBAAS,CAAC;QAEpB,cAAS,GAAG,yBAAe,CAAC;QAE5B,WAAM,GAAG,sBAAY,CAAC;QAEtB,eAAU,GAAG,0BAAgB,CAAC;QAE9B,WAAM,GAAG,sBAAY,CAAC;QAEtB,WAAM,GAAG,mCAAyB,CA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,GAAG,CAAC;gBAClB,KAAK,OAAA;aACN,CAAC,CAAC;SACJ;IACH,CAAC;IAED,sBAAI,6BAAG;aAAP;YACE,OAAO,IAAI,CAAC,IAAI,CAAC;QACnB,CAAC;;;OAAA;IAED,sBAAI,qCAAW;aAAf;YACE,OAAO,gBAAM,CAAC,GAAG,CAAC;QACpB,CAAC;;;OAAA;IACH,mBAAC;AAAD,CAAC,AAxFD,IAwFC;AAED,kBAAe,YAAY,CAAC"}
@@ -1,29 +0,0 @@
1
- import { GraphEntryValue } from "./types/graph";
2
- /**
3
- * WIP move the remainder of this (custom verification) to client service!
4
- */
5
- declare class ToolDbService {
6
- private debug;
7
- /**
8
- * These can be customized depending on your db of choice.
9
- */
10
- dbInit: () => void;
11
- dbRead: <T>(key: string) => Promise<T>;
12
- dbWrite: <T>(key: string, msg: T) => void;
13
- triggerPut: (msg: GraphEntryValue) => void;
14
- onMessage: (msg: GraphEntryValue, peerId: string) => void;
15
- private _customVerification;
16
- /**
17
- * Adds an extra verification step for messages at the given key.
18
- * You can compare against a previously stored value using the value given at the callback.
19
- * The callback should return a boolean for if the message passed the verification step.
20
- * @param key data key
21
- * @param fn (stored, incoming) => boolean
22
- */
23
- addVerification: (key: string, fn: (oldData: GraphEntryValue | undefined, data: GraphEntryValue) => boolean) => void;
24
- private dataPutHandler;
25
- messageWrapper: (data: GraphEntryValue) => Promise<unknown>;
26
- constructor(debug?: boolean);
27
- initialize(): void;
28
- }
29
- export default ToolDbService;
@@ -1,149 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- var __generator = (this && this.__generator) || function (thisArg, body) {
12
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
- function verb(n) { return function (v) { return step([n, v]); }; }
15
- function step(op) {
16
- if (f) throw new TypeError("Generator is already executing.");
17
- while (_) try {
18
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
- if (y = 0, t) op = [op[0] & 2, t.value];
20
- switch (op[0]) {
21
- case 0: case 1: t = op; break;
22
- case 4: _.label++; return { value: op[1], done: false };
23
- case 5: _.label++; y = op[1]; op = [0]; continue;
24
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
- default:
26
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
- if (t[2]) _.ops.pop();
31
- _.trys.pop(); continue;
32
- }
33
- op = body.call(thisArg, _);
34
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
- }
37
- };
38
- var __importDefault = (this && this.__importDefault) || function (mod) {
39
- return (mod && mod.__esModule) ? mod : { "default": mod };
40
- };
41
- Object.defineProperty(exports, "__esModule", { value: true });
42
- var message_1 = require("./types/message");
43
- var verifyMessage_1 = __importDefault(require("./utils/verifyMessage"));
44
- /**
45
- * WIP move the remainder of this (custom verification) to client service!
46
- */
47
- var ToolDbService = /** @class */ (function () {
48
- function ToolDbService(debug) {
49
- var _this = this;
50
- if (debug === void 0) { debug = false; }
51
- this.debug = false;
52
- /**
53
- * These can be customized depending on your db of choice.
54
- */
55
- this.dbInit = function () {
56
- console.log("You need to configure a db!");
57
- };
58
- this.dbRead = function (key) {
59
- console.log("You need to configure a db!");
60
- return new Promise(function (r) { return r({}); });
61
- };
62
- this.dbWrite = function (key, msg) {
63
- console.log("You need to configure a db!");
64
- };
65
- this.triggerPut = function (msg) {
66
- //
67
- };
68
- this.onMessage = function (msg, peerId) {
69
- //
70
- };
71
- this._customVerification = {};
72
- /**
73
- * Adds an extra verification step for messages at the given key.
74
- * You can compare against a previously stored value using the value given at the callback.
75
- * The callback should return a boolean for if the message passed the verification step.
76
- * @param key data key
77
- * @param fn (stored, incoming) => boolean
78
- */
79
- this.addVerification = function (key, fn) {
80
- _this._customVerification[key] = fn;
81
- };
82
- this.messageWrapper = function (data) { return __awaiter(_this, void 0, void 0, function () {
83
- var _this = this;
84
- return __generator(this, function (_a) {
85
- // This wrapper functions filters out those messages we already handled from the listener
86
- // It also takes care of verification, data persistence and low level handling
87
- return [2 /*return*/, new Promise(function (resolve, reject) {
88
- (0, verifyMessage_1.default)(data).then(function (verified) { return __awaiter(_this, void 0, void 0, function () {
89
- var oldValue;
90
- return __generator(this, function (_a) {
91
- switch (_a.label) {
92
- case 0:
93
- if (!verified) return [3 /*break*/, 2];
94
- if (!this._customVerification[data.key]) return [3 /*break*/, 2];
95
- return [4 /*yield*/, this.dbRead(data.key)];
96
- case 1:
97
- oldValue = _a.sent();
98
- verified = !this._customVerification[data.key](oldValue || undefined, data)
99
- ? message_1.VerifyResult.InvalidVerification
100
- : verified;
101
- _a.label = 2;
102
- case 2:
103
- if (verified === message_1.VerifyResult.Verified) {
104
- this.dataPutHandler(data);
105
- resolve(true);
106
- }
107
- else {
108
- reject(new Error("Could not verify message integrity: " + verified));
109
- console.warn(data);
110
- }
111
- return [2 /*return*/];
112
- }
113
- });
114
- }); });
115
- })];
116
- });
117
- }); };
118
- this.debug = debug;
119
- }
120
- ToolDbService.prototype.dataPutHandler = function (msg) {
121
- return __awaiter(this, void 0, void 0, function () {
122
- var oldValue;
123
- return __generator(this, function (_a) {
124
- switch (_a.label) {
125
- case 0: return [4 /*yield*/, this.dbRead(msg.key)];
126
- case 1:
127
- oldValue = _a.sent();
128
- // if (this.debug) console.log("Recv PUT", msg, oldValue);
129
- if (!oldValue ||
130
- (oldValue.timestamp < msg.timestamp &&
131
- (msg.key.slice(0, 1) == ":" ? oldValue.pub === msg.pub : true))) {
132
- this.dbWrite(msg.key, msg);
133
- this.triggerPut(msg);
134
- }
135
- else {
136
- // console.warn(`Skip message write!`, oldValue, msg);
137
- }
138
- return [2 /*return*/];
139
- }
140
- });
141
- });
142
- };
143
- ToolDbService.prototype.initialize = function () {
144
- this.dbInit();
145
- };
146
- return ToolDbService;
147
- }());
148
- exports.default = ToolDbService;
149
- //# sourceMappingURL=toolDbService.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"toolDbService.js","sourceRoot":"","sources":["../src/toolDbService.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,2CAA+C;AAE/C,wEAAkD;AAClD;;GAEG;AACH;IA0FE,uBAAY,KAAa;QAAzB,iBAEC;QAFW,sBAAA,EAAA,aAAa;QAzFjB,UAAK,GAAG,KAAK,CAAC;QAEtB;;WAEG;QACI,WAAM,GAAG;YACd,OAAO,CAAC,GAAG,CAAC,6BAA6B,CAAC,CAAC;QAC7C,CAAC,CAAC;QAEK,WAAM,GAAG,UAAI,GAAW;YAC7B,OAAO,CAAC,GAAG,CAAC,6BAA6B,CAAC,CAAC;YAC3C,OAAO,IAAI,OAAO,CAAC,UAAC,CAAC,IAAK,OAAA,CAAC,CAAC,EAAO,CAAC,EAAV,CAAU,CAAC,CAAC;QACxC,CAAC,CAAC;QAEK,YAAO,GAA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