@peerbit/clock-service 1.0.21 → 1.0.23
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 +3 -3
- package/lib/esm/controller.js +3 -3
- package/package.json +5 -5
- package/src/controller.ts +3 -3
package/README.md
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
# ClockService
|
|
2
2
|
|
|
3
3
|
## 🚧 Experimental state 🚧
|
|
4
|
-
This module can sign entries to verify that their
|
|
4
|
+
This module can sign entries to verify that their timestamps are set correctly.
|
|
5
5
|
|
|
6
|
-
See the [test](./src/__tests__/index.test.ts) for examples
|
|
6
|
+
See the [test](./src/__tests__/index.test.ts) for examples.
|
|
7
7
|
|
|
8
8
|
Nodes running this program will sign entries if their timestamp is not too far from "now".
|
|
9
|
-
Hence, only use this program with an identity dedicated for this job since peers can send any entry to be signed (i.e. use dedicated nodes for this)
|
|
9
|
+
Hence, only use this program with an identity dedicated for this job since peers can send any entry to be signed (i.e. use dedicated nodes for this)
|
package/lib/esm/controller.js
CHANGED
|
@@ -85,15 +85,15 @@ export let ClockService = class ClockService extends Program {
|
|
|
85
85
|
if (abs(now - cmp) > this._maxError) {
|
|
86
86
|
logger.info("Recieved an entry with an invalid timestamp");
|
|
87
87
|
return new SignError({
|
|
88
|
-
message: "Recieved an entry with an invalid timestamp"
|
|
88
|
+
message: "Recieved an entry with an invalid timestamp"
|
|
89
89
|
});
|
|
90
90
|
}
|
|
91
91
|
const signature = await this.node.identity.sign(entry.toSignable());
|
|
92
92
|
return new Ok({
|
|
93
|
-
signature
|
|
93
|
+
signature
|
|
94
94
|
});
|
|
95
95
|
}
|
|
96
|
-
: undefined
|
|
96
|
+
: undefined
|
|
97
97
|
});
|
|
98
98
|
}
|
|
99
99
|
async sign(data) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@peerbit/clock-service",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.23",
|
|
4
4
|
"description": "Clock signing",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -31,12 +31,12 @@
|
|
|
31
31
|
"license": "MIT",
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@peerbit/logger": "1.0.1",
|
|
34
|
-
"@peerbit/rpc": "2.1.
|
|
35
|
-
"@peerbit/trusted-network": "2.0.
|
|
34
|
+
"@peerbit/rpc": "2.1.4",
|
|
35
|
+
"@peerbit/trusted-network": "2.0.5"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
|
-
"@peerbit/test-utils": "^1.0.
|
|
38
|
+
"@peerbit/test-utils": "^1.0.20",
|
|
39
39
|
"memory-level": "^1.0.0"
|
|
40
40
|
},
|
|
41
|
-
"gitHead": "
|
|
41
|
+
"gitHead": "0cfa376bc90c31e1063ddaf5435c828b490e0228"
|
|
42
42
|
}
|
package/src/controller.ts
CHANGED
|
@@ -84,17 +84,17 @@ export class ClockService extends Program<Args> {
|
|
|
84
84
|
if (abs(now - cmp) > this._maxError) {
|
|
85
85
|
logger.info("Recieved an entry with an invalid timestamp");
|
|
86
86
|
return new SignError({
|
|
87
|
-
message: "Recieved an entry with an invalid timestamp"
|
|
87
|
+
message: "Recieved an entry with an invalid timestamp"
|
|
88
88
|
});
|
|
89
89
|
}
|
|
90
90
|
const signature = await this.node.identity.sign(
|
|
91
91
|
entry.toSignable()
|
|
92
92
|
);
|
|
93
93
|
return new Ok({
|
|
94
|
-
signature
|
|
94
|
+
signature
|
|
95
95
|
});
|
|
96
96
|
}
|
|
97
|
-
: undefined
|
|
97
|
+
: undefined
|
|
98
98
|
});
|
|
99
99
|
}
|
|
100
100
|
|