this.me 2.7.3 → 2.7.4

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/main.js CHANGED
@@ -9,7 +9,7 @@ const neurons = require("neurons.me");
9
9
  const cleaker = require("cleaker");
10
10
  const netget = require("netget");
11
11
  //User Context.
12
- const Me = require("this.me/me");
12
+ const Me = require("./me");
13
13
  const os = require('os');
14
14
  const me = new Me(
15
15
  'Me',
@@ -48,7 +48,7 @@ console.log("System Role: ", cleaked.role);
48
48
  /* Create a function that computes the hash of the @src directory.
49
49
  'hashSrc') to handle hashing when the relevant command is passed to the script.*/
50
50
  const { fork } = require('child_process');
51
- const { getAllFiles, hashThis } = require('this.me/crypto/hash/hashing');
51
+ const { getAllFiles, hashThis } = require('./crypto/hash/hashing');
52
52
  function hashSrc() {
53
53
  try {
54
54
  // Adjust this to the exact location of your @src directory
package/me.js CHANGED
@@ -16,7 +16,35 @@ class Me {
16
16
  this.keyPair = cryptoModule.generateKeyPair();
17
17
  // ... rest of your class logic using the cryptoModule abstraction ...
18
18
  }
19
- // ... other methods ...
19
+ // ... methods ...
20
+ generateKeyPair() {
21
+ const { privateKey, publicKey } = crypto.generateKeyPairSync('rsa', {
22
+ modulusLength: 2048,
23
+ });
24
+ return {
25
+ privateKey: privateKey.export({ type: 'pkcs1', format: 'pem' }),
26
+ publicKey: publicKey.export({ type: 'pkcs1', format: 'pem' }),
27
+ };
28
+ }
29
+ getPublicKey() {
30
+ return this.keyPair.publicKey;
31
+ }
32
+ // Use the private key for signing data, and the public key can be shared for verification
33
+ signData(data) {
34
+ const sign = crypto.createSign('SHA256');
35
+ sign.update(data);
36
+ sign.end();
37
+ return sign.sign(this.keyPair.privateKey);
38
+ }
39
+ verifySignature(data, signature) {
40
+ const verify = crypto.createVerify('SHA256');
41
+ verify.update(data);
42
+ verify.end();
43
+ return verify.verify(this.keyPair.publicKey, signature);
44
+ }
45
+ updateLocation(newLocation) {
46
+ this.location = newLocation;
47
+ }
20
48
  }
21
49
  module.exports = Me;
22
50
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "this.me",
3
- "version": "2.7.3",
3
+ "version": "2.7.4",
4
4
  "description": "This.me should This.be",
5
5
  "bin": {
6
6
  ".me": "./main.js"
@@ -29,7 +29,7 @@
29
29
  "i.mlearning": "^2.2.0",
30
30
  "netget": "^2.2.3",
31
31
  "neurons.me": "^2.7.1",
32
- "this.atom":"^1.3.2",
32
+ "this.atom":"^1.3.1",
33
33
  "this.audio": "^1.0.6",
34
34
  "this.be": "^2.1.6",
35
35
  "this.dom": "^1.0.4",
File without changes