this.me 2.9.1 → 2.9.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/README.md CHANGED
@@ -1,48 +1,29 @@
1
- <img src="https://suign.github.io/assets/imgs/cleak_me-removebg.png" alt="DID Me Art" width="69" align="right">
2
- <img src="https://suign.github.io/assets/imgs/Cleaker-removebg-preview.png" alt="Cleak Me Please" width="277" align="right">
3
-
4
-
5
-
6
-
7
-
8
-
9
-
10
-
11
-
12
-
13
-
14
-
15
-
16
-
1
+ <img src="https://suign.github.io/assets/imgs/Cleaker-removebg-preview.png" alt="Cleak Me Please." width="244">
17
2
 
18
3
  # THIS.ME
19
-
20
4
  **This.Me** is a data-structured identity.
5
+ <img src="https://suign.github.io/assets/imgs/point.png" alt="Me" width="144"> Consider **.me** as a point.
21
6
 
22
- 1. **Install `this.me`:**
23
- Open your terminal and run the following command to install the `this.me` package:
7
+ this.me is designed to generate and manage identities. It's responsible for creating a user’s identity, handling attributes, and generating hashes.
24
8
 
9
+ Use Case: Suppose you're building an app where users need to create profiles or identities. You can install this.me locally in that project to manage user identities.
10
+
11
+ 1. ### **Install `this.me`:**
12
+ Open your terminal and run the following command to install the `this.me` package:
25
13
  ```js
26
14
  npm install this.me
27
15
  ```
28
-
29
- 2. **Import `Me` in Your Project:**
16
+
17
+ 2. ### **Import `Me` in Your Project:**
30
18
  In the JavaScript file where you want to use `this.me`, import the `Me` class.
31
-
32
19
  ```js
33
20
  import Me from 'this.me';
34
21
  ```
35
-
22
+
36
23
  **Explanation**
37
-
38
- ​ 1. **Dynamic Identity Addition**:
39
-
40
24
  ​ • The **be** method in the **Me** class accepts an object of **key-value pairs** and **adds these to the identity object**.
41
-
42
- ​ 2. **Flexible Attribute Addition**:
43
-
44
25
  ​ • You can call **me.be()** multiple times with different attributes to dynamically update the identity object.
45
-
26
+
46
27
  ```javascript
47
28
  // Create a new Me instance
48
29
  let me = new Me("xyxyxy");
@@ -56,43 +37,60 @@
56
37
 
57
38
  ```js
58
39
  // Add attributes to the identity
59
- me.be({ name: "XXXY WWC", phone: "33550000" });
40
+ me.be({ name: "Alice", phone: "33550000" });
60
41
  ```
61
42
 
62
- **Dynamic Property Assignment**:
43
+ **1. Registry as a Service:**
44
+
45
+ • The registry becomes a centralized service hosted by an authority (e.g., neurons.me).
46
+
47
+ • This service would handle the verification and management of all Me instances across the network.
63
48
 
64
- ​ • We use an object users to store Me instances, with each key being the username.
49
+ **Example Flow:**
65
50
 
66
- ​ • `users[username] = new Me(username)` dynamically assigns the Me instance to a key that matches the username.
51
+ 1. **Setup**: A developer installs this.me and configures it to connect to neurons.me.
67
52
 
68
- **Accessing Instances**:
53
+ 2. **User Registration**: Users register their Me identity through the service, and the library connects to the neurons.me registry for verification.
69
54
 
70
- ​ • You can access the Me instance using the username as the key: `users['suign']`.
55
+ 3. **Service Interaction**: When a user interacts with a service that uses this.me, the service can trust the identity by querying the selected registry.
71
56
 
72
- **Adding Attributes**:
57
+ **Implementation:**
73
58
 
74
- ​ • The **be()** method is used to add attributes to the identity object.
59
+ ```js
60
+ import Me from 'this.me';
61
+ const config = {
62
+ registryURL: 'https://registry.neurons.me', // Registry authority URL
63
+ };
64
+ let me = new Me('alice', config);
65
+ me.register({ password: 'securePass123', email: 'alice@example.com' });
66
+ // Verify and interact with services using the connected registry
67
+ ```
75
68
 
76
- . **Example Usage**:
77
69
 
78
- ​ • Two users, user1 and user2, are created and their identities are dynamically managed within the **users** object.
79
70
 
80
71
  --------
72
+ <img src="https://suign.github.io/assets/imgs/monads.png" alt="Cleak Me Please" width="244">Hello, I am **.me**
81
73
 
82
- ### Neural Networks - **One-Hot Encoding**
74
+ ### add.me
75
+ ----
83
76
 
84
- ------
77
+ ###### Using the CLI and this.me globally to manage user sessions.
85
78
 
79
+ ```bash
80
+ npm i -g this.me
81
+ ```
82
+
83
+
84
+ ### Neural Networks - **One-Hot Encoding**
85
+ --------
86
86
  To represent the combinations of **“me, you, him, her, it, us, them”** in a neural network, we need to convert the elements into a suitable format for neural network processing, such as one-hot encoding, and design a neural network architecture that can process these inputs.
87
87
 
88
88
  Here’s a step-by-step approach to achieve this:
89
-
90
89
  1. **One-Hot Encoding:** Convert each element (“me”, “you”, “him”, “her”, “it”, “us”, “them”) into a one-hot encoded vector.
91
90
  2. **Combination Representation:** Create input vectors for each combination by combining the one-hot encoded vectors.
92
91
  3. **Neural Network Design:** Design a simple neural network to process these input vectors.
93
92
 
94
93
  #### Step 1: One-Hot Encoding
95
-
96
94
  One-hot encoding represents each element as a binary vector with a single high (1) value and the rest low (0). For the elements “me”, “you”, “him”, “her”, “it”, “us”, “them”, we can assign the following one-hot encoded vectors:
97
95
 
98
96
  ```js
@@ -118,73 +116,17 @@ const subjects = {
118
116
  ```
119
117
 
120
118
  #### Step 2: Combination Representation
121
-
122
119
  For each combination, we can create an input vector by combining the one-hot encoded vectors of its elements. For example:
123
-
124
120
  Combination “me, you” would be represented as the sum of the one-hot vectors for “me” and “you”:
125
121
 
126
122
  ```
127
123
  [1, 0, 0, 0, 0, 0, 0] + [0, 1, 0, 0, 0, 0, 0] = [1, 1, 0, 0, 0, 0, 0]
128
124
  ```
129
-
130
- ---
131
- Hello, I am .me
132
- ? Who are you? (Use arrow keys)
133
- ❯ add.me
134
125
  ---
126
+ ### Me Deviation Formula
127
+ **How Spread Out the data Points are around the .me?**
135
128
 
136
- 1. **Install `this.me`:**
137
- Open your terminal and run the following command to install the `this.me` package:
138
-
139
- ```js
140
- npm install this.me
141
- ```
142
-
143
- 2. **Import `Me` in Your Project:**
144
- In the JavaScript file where you want to use `this.me`, import the `Me` class.
145
-
146
- ```js
147
- import Me from 'this.me';
148
- ```
149
-
150
- 3. **Create an Instance of `Me`:**
151
- Instantiate the `Me` class with the required user details.
152
-
153
- ```js
154
- const user = new Me('John', 'Doe', '1990-01-01', 'password123', '1234');
155
- ```
156
-
157
- 4. **Validate and Use the Instance:**
158
- Utilize the instance for user data validation and preparation for cryptographic actions.
159
- In other words. Log In.
160
- ```js
161
- try {
162
- const identity = user.getMe();
163
- // Ready for hashing and cryptographic signatures
164
- } catch (error) {
165
- console.error(error.message);
166
- // Error handling for missing fields
167
- }
168
- ```
169
-
170
- This quick start guide provides a straightforward path to incorporating `this.me` into your project, enabling you to manage user identities and prepare them for secure cryptographic processes efficiently.
171
129
 
172
130
  ----------
173
131
 
174
- # About All.This
175
- ## Modular Data Structures:
176
- **[this.me](https://suign.github.io/this.me) - [this.audio](https://suign.github.io/this.audio) - [this.text](https://suign.github.io/this.text) - [this.wallet](https://suign.github.io/this.wallet) - [this.img](https://suign.github.io/this.img) - [this.pixel](https://suign.github.io/Pixels) - [be.this](https://suign.github.io/be.this) - [this.DOM](https://suign.github.io/this.DOM) - [this.env](https://suign.github.io/this.env/) - [this.GUI](https://suign.github.io/this.GUI) - [this.be](https://suign.github.io/this.be) - [this.video](https://suign.github.io/this.video) - [this.atom](https://suign.github.io/this.atom) - [this.dictionaries](https://suign.github.io/this.dictionaries/)**
177
-
178
- **Each module** in **[all.this](https://neurons.me/all-this)** represents a specific **datastructure**. These classes encapsulate the functionalities and **data specific to their domain.**
179
-
180
- ## Neurons.me
181
- ### License & Policies
182
- - **License**: MIT License (see LICENSE for details).
183
- - **Privacy Policy**: Respects user privacy; no collection/storage of personal data.
184
- - **Terms of Usage**: Use responsibly. No guarantees/warranties provided. [Terms](https://www.neurons.me/terms-of-use) | [Privacy](https://www.neurons.me/privacy-policy)
185
- [By neurons.me](https://neurons.me)
186
-
187
- <img src="https://suign.github.io/neurons.me/neurons_logo.png" alt="neurons.me logo" width="123" height="123" style="width123px; height:123px;">
188
-
189
-
190
132
 
package/index.js CHANGED
@@ -2,24 +2,11 @@
2
2
  /**
3
3
  * @module This.Me
4
4
  * @description
5
- * This.Me adapts to various environments, enabling `.me` objects to function both locally and within a network.
6
- * A `.me` object authenticated on a network accesses data beyond the local scope,
7
- * while unauthenticated instances are confined to local data.
8
- * This dual functionality ensures seamless interoperability and heightened security.
9
- * Command Definitions and Interactive Shell.*/
5
+ * This.Me is a data-structured identity...
6
+ * */
10
7
 
11
- //index.js in the `this.me` package
12
8
  import Me from './src/me.js';
13
-
14
- //when a user declares "I am," their digital existence is affirmed and recorded in the system.
15
- //The user's `.me` object is then retrieved and displayed.
16
- //The user is greeted with their `.me` object, and the system is queried about its own identity.
17
- /*
18
- User Instance Hash: Anchoring each user’s identity and space is a cryptographic hash, providing a secure and unique foundation.
19
- This unique space not only encapsulates its creator but can also forge Inter-Space Connections with others, manifesting in:
20
- Relative Paths: Tailoring interactions within a user’s space, relative paths connect varied datasets, objects, and interactions in a user-oriented manner.
21
- Cross Paths: Creating conduits between user spaces, allowing permissioned access to specific datasets and interactions.
22
- Dual Endpoints: Curating diverse experiences through endpoints that exhibit varied interactions or representations based on user permissions and contexts.
23
- */
24
-
9
+ //when a user declares "I am %.me," their digital existence is affirmed and recorded in the system.
25
10
  export default Me;
11
+
12
+ console.log("this.me is loaded!!");
package/md/context.md ADDED
@@ -0,0 +1,42 @@
1
+ Lo que estás describiendo sobre **this.me** y el proceso de autenticación con **Cleaker** como una red de identificación descentralizada (**DID**) tiene sentido dentro de un marco de criptografía y autenticación distribuida. A continuación, desgloso los puntos importantes para asegurarnos de que el concepto sea claro y funcional:
2
+
3
+ ### **Inmutabilidad de la Identidad Básica**
4
+ Tu sistema **this.me** se basa en la creación de una identidad criptográficamente segura. Los componentes inmutables que mencionas (nombre de usuario, email y la red de autenticación) son fundamentales para que el sistema garantice que la identidad siempre se pueda verificar a partir de un hash único.
5
+
6
+ 1. **Nombre de Usuario (username)**: El nombre de usuario es clave en la identidad. No puede cambiar una vez creado porque el hash que lo representa depende de esta cadena de caracteres.
7
+ 2. **Correo Electrónico (email)**: Esto actúa como otra pieza inmutable, probablemente porque es un dato importante para autenticar usuarios a través de redes o servicios.
8
+ 3. **Red de Autenticación (Cleaker)**: Como mencionas, **Cleaker** actuaría como el **DID**, o sea, la autoridad central que autentica tu identidad. Es clave para asegurar que no cualquiera pueda crear una identidad falsa.
9
+
10
+ ### **Proceso de Creación del Hash**
11
+ Lo que estás describiendo es un esquema de hashing similar al que se usa en la criptografía para asegurar que los datos no sean manipulados. Cuando generas una identidad con `this.me`, combinas información inmutable (username, email, red) para generar un **hash único**, que se convierte en tu **clave pública**.
12
+
13
+ 1. **Hash como Clave Pública**: Cuando hasheas tu información (e.g., nombre + email + red), se genera una clave pública (hash). Esta clave es única para cada combinación de información.
14
+ - Si cambias incluso una letra de tu nombre o red, el hash resultante será completamente diferente.
15
+ - Este hash será tu "firma digital" o clave pública para verificarte ante otros sistemas.
16
+
17
+ 2. **Encriptación y Desencriptación de Datos**: Utilizando tu **clave pública** (hash generado), puedes firmar o desencriptar información que hayas dejado en el sistema. Esencialmente, es una forma de probar que eres el propietario legítimo de esa clave.
18
+ - Si alguien intenta usar un hash distinto (porque cambió alguna información), no podrá desencriptar la información asociada a tu clave pública original.
19
+
20
+ ### **Uso de Cleaker como DID**
21
+ **Cleaker** sería la red de confianza que actúa como verificador. En este caso:
22
+ - **Cleaker** puede autenticar tu identidad, asegurando que el hash generado sea correcto, en el sentido de que el nombre de usuario, email, y red de autenticación son válidos.
23
+ - **Cleaker** también sirve como autoridad para evitar que cualquiera pueda generar una identidad falsa o duplicada. Si intentas acceder a la red con información diferente, el sistema rechaza la autenticación porque el hash no coincide con los registros en la red.
24
+
25
+ ### **Flujo Ejemplificado de Autenticación**
26
+ 1. Creas tu identidad en **this.me** con tu nombre de usuario, email y red de autenticación (**Cleaker**).
27
+ 2. **this.me** genera un **hash único** para esa combinación de datos, lo que te da una **clave pública**.
28
+ 3. Puedes usar esa clave pública para autenticarte en cualquier servicio compatible, y solo tú puedes desencriptar los datos usando tu hash, ya que corresponde exactamente con la información que usaste para crearlo.
29
+ 4. Si cambias cualquier parte de tu información (nombre, email o red), obtendrás un hash completamente diferente, lo que efectivamente cambia tu identidad digital.
30
+
31
+ ### **Encriptación y Desencriptación**
32
+ Al tener tu clave pública, puedes usarla para desencriptar datos que hayas almacenado en sistemas que utilizan **this.me**. La clave pública se usa para verificar tu identidad y acceder a la información que has dejado. Como mencionabas:
33
+
34
+ - Si hasheas "jose" y "abella", obtendrás un hash específico.
35
+ - Si cambias "abella" por "abellae", el hash cambia y no podrás desencriptar la información almacenada bajo el hash anterior.
36
+
37
+ Este proceso asegura que tu identidad es única y está protegida criptográficamente.
38
+
39
+ ### **Conclusión**
40
+ Este sistema de identidad descentralizada que estás describiendo se asemeja a los **DIDs** utilizados en blockchain y criptografía, donde las identidades no dependen de un servidor centralizado, sino de la prueba criptográfica de su validez. **Cleaker** actuaría como una red que verifica la validez del hash, y **this.me** genera y gestiona las identidades de una forma flexible pero segura. El uso de hashes y criptografía garantiza que las identidades sean inmutables y verificables sin depender de terceros centralizados.
41
+
42
+ Este sistema tiene aplicaciones en una amplia gama de servicios donde la autenticación segura es fundamental y donde se quiere evitar la creación de múltiples credenciales en diferentes plataformas.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "this.me",
3
- "version": "2.9.1",
3
+ "version": "2.9.4",
4
4
  "description": "_me-Centric.",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -16,7 +16,7 @@
16
16
  ],
17
17
  "repository": {
18
18
  "type": "git",
19
- "url": "git+https://github.com/suiGn/this.me.git"
19
+ "url": "git+https://github.com/neurons-me/this.me.git"
20
20
  },
21
21
  "homepage": "https://www.npmjs.com/package/this.me",
22
22
  "docs": "https://suiGn.github.io/this.me",
@@ -27,6 +27,7 @@
27
27
  "category": "dataformatter",
28
28
  "dependencies": {
29
29
  "chalk": "^5.3.0",
30
+ "commander": "^12.1.0",
30
31
  "inquirer": "^9.2.16"
31
32
  }
32
33
  }
package/src/example.js CHANGED
@@ -6,11 +6,11 @@ let me = new Me('suign');
6
6
  // Add attributes to the identity
7
7
  me.be({ fullName: "Jose", lastName: "Abella" });
8
8
  me.be({ xy: "z" });
9
- console.log(me.identify());
9
+ console.log(me);
10
10
  // Examplconsole.log(me.identity());e with another instance
11
11
  let anotherMe = new Me('anotherUser');
12
12
  anotherMe.be({ nickname: "hero", favoriteColor: "blue" });
13
- console.log(anotherMe.identify());
13
+ console.log(anotherMe);
14
14
  // Create a new Me instance with dynamic property name
15
15
  let user = 'suign';
16
16
  let users = {};
@@ -20,4 +20,6 @@ users[user].be({ fullName: "ZZZ", lastName: "WWW" });
20
20
  users[user].be({ xy: "axax" });
21
21
  console.log(users[user]);
22
22
 
23
+ console.log(users);
24
+
23
25
 
package/src/me.js CHANGED
@@ -3,32 +3,36 @@ import crypto from 'crypto';
3
3
  import os from 'os';
4
4
 
5
5
  // Define the .me class
6
- class Me {
6
+ class Me{
7
+ // Static property to keep track of all users globally
8
+ static registry = {};
9
+
7
10
  constructor(username = 'monad') {
8
- this.username = this.validateUsername(username);
11
+ if (Me.registry[username]) {
12
+ throw new Error(`Username ${username} already exists in the registry.`);
13
+ }
14
+ this.username = this.validateMe(username);
9
15
  this.identity = {
10
16
  username: this.username,
11
17
  hash: this.sha256(),
12
18
  host: this.getHostInfo()
13
19
  };
20
+ Me.registry[username] = this; // Add to global registry
14
21
  }
15
22
 
16
- // Method to validate the username
17
- validateUsername(username) {
18
- const regex = /^[a-zA-Z0-9]+$/; // Only letters and numbers
23
+ validateMe(username) {
24
+ const regex = /^[a-zA-Z0-9]{1,21}$/;
19
25
  if (regex.test(username)) {
20
26
  return username;
21
27
  } else {
22
- throw new Error('Incorrect username. Only letters and numbers are allowed.');
28
+ throw new Error('Incorrect username. Only letters and numbers are allowed, and it must be between 1 and 21 characters.');
23
29
  }
24
30
  }
25
31
 
26
- // Method to generate a cryptographic hash of the username
27
32
  sha256() {
28
33
  return crypto.createHash('sha256').update(this.username).digest('hex');
29
34
  }
30
35
 
31
- // Method to get host information
32
36
  getHostInfo() {
33
37
  return {
34
38
  hostname: os.hostname(),
@@ -37,16 +41,15 @@ class Me {
37
41
  };
38
42
  }
39
43
 
40
- // Method to add key-value pairs to the identity object
41
44
  be(attributes) {
42
45
  for (const [key, value] of Object.entries(attributes)) {
43
46
  this.identity[key] = value;
44
47
  }
45
48
  }
46
49
 
47
- // Method to get the identity object
48
- identify() {
49
- return this.be;
50
+ // Static method to retrieve all users
51
+ static getAllUsers() {
52
+ return Me.registry;
50
53
  }
51
54
  }
52
55