this.me 2.8.73 → 2.9.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.
- package/README.md +115 -70
- package/index.js +14 -10
- package/package.json +7 -5
- package/src/.me.cli.js +20 -0
- package/src/CLI/AddMe.js +35 -0
- package/src/CLI/LogMe.js +26 -0
- package/src/CLI/me_MainChoices.js +28 -0
- package/src/example.js +23 -0
- package/src/me.js +53 -0
- package/knowledge_files/00_Context.md +0 -40
- package/src/browser/meFormatter.browser.js +0 -9
- package/src/createMeFormatter.js +0 -15
- package/src/nodejs/meFormatter.node.js +0 -9
- package/src/this.me.js +0 -58
- package/src/this.me.promises.js +0 -21
package/README.md
CHANGED
|
@@ -1,34 +1,23 @@
|
|
|
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">
|
|
1
3
|
|
|
2
4
|
|
|
3
|
-
<img src="https://suign.github.io/assets/imgs/cleak_me-removebg.png" alt="DID Me Art" width="244">
|
|
4
5
|
|
|
5
|
-
<img src="https://suign.github.io/assets/imgs/Cleaker-removebg-preview.png" alt="Cleak Me Please" width="244">
|
|
6
6
|
|
|
7
|
-
# THIS.ME
|
|
8
7
|
|
|
9
|
-
**This.Me** is a digital identity representation of **.Me** as it encapsulates **the essence of an entity**.
|
|
10
8
|
|
|
11
|
-
Services become **user-centric,** based on cryptographic proofs rather than centralized authorities.
|
|
12
9
|
|
|
13
|
-
-----------
|
|
14
10
|
|
|
15
|
-
### [Project Status : Experimental and Under Development, Subject to Major Changes]
|
|
16
11
|
|
|
17
|
-
The module is in active development, and as such, it is subject to significant changes as we refine our approach and methodologies to best support our goals.
|
|
18
12
|
|
|
19
|
-
visit: https://neurons.me to learn more.
|
|
20
13
|
|
|
21
|
-
----------
|
|
22
|
-
|
|
23
|
-
# Getting Started
|
|
24
|
-
|
|
25
|
-
**This.Me** is a class focused on **encapsulating user identity,** specifically crafted to facilitate the creation of instances ready for **hashing and cryptographic signature** generation. It opens the door to coding and decoding through **".me"** signatures, offering a modular framework that prioritizes privacy and integrity in application-wide identity management.
|
|
26
14
|
|
|
27
15
|
|
|
28
16
|
|
|
29
|
-
**This.Me** is also part of the **all.this Data Structures** which means aligns well with the entire **neurons.me ecosystem.**
|
|
30
17
|
|
|
18
|
+
# THIS.ME
|
|
31
19
|
|
|
20
|
+
**This.Me** is a data-structured identity.
|
|
32
21
|
|
|
33
22
|
1. **Install `this.me`:**
|
|
34
23
|
Open your terminal and run the following command to install the `this.me` package:
|
|
@@ -44,101 +33,157 @@ visit: https://neurons.me to learn more.
|
|
|
44
33
|
import Me from 'this.me';
|
|
45
34
|
```
|
|
46
35
|
|
|
36
|
+
**Explanation**
|
|
47
37
|
|
|
38
|
+
1. **Dynamic Identity Addition**:
|
|
48
39
|
|
|
49
|
-
|
|
40
|
+
• The **be** method in the **Me** class accepts an object of **key-value pairs** and **adds these to the identity object**.
|
|
50
41
|
|
|
51
|
-
|
|
42
|
+
2. **Flexible Attribute Addition**:
|
|
52
43
|
|
|
53
|
-
|
|
44
|
+
• You can call **me.be()** multiple times with different attributes to dynamically update the identity object.
|
|
54
45
|
|
|
55
|
-
|
|
46
|
+
```javascript
|
|
47
|
+
// Create a new Me instance
|
|
48
|
+
let me = new Me("xyxyxy");
|
|
49
|
+
|
|
50
|
+
// Add attributes to the identity
|
|
51
|
+
me.be({ a: "XXX", b: "YYY" });
|
|
52
|
+
me.be({ c: "z" });
|
|
53
|
+
```
|
|
56
54
|
|
|
57
|
-
|
|
55
|
+
**A less abstract example:**
|
|
58
56
|
|
|
59
|
-
|
|
57
|
+
```js
|
|
58
|
+
// Add attributes to the identity
|
|
59
|
+
me.be({ name: "XXXY WWC", phone: "33550000" });
|
|
60
|
+
```
|
|
60
61
|
|
|
61
|
-
|
|
62
|
-
- Users can manage their local profile, which includes their personal settings, preferences, and local data access permissions.
|
|
62
|
+
**Dynamic Property Assignment**:
|
|
63
63
|
|
|
64
|
-
|
|
64
|
+
• We use an object users to store Me instances, with each key being the username.
|
|
65
65
|
|
|
66
|
-
|
|
67
|
-
- Once authenticated, the `.me` object's hash is recognized across the network, granting the user access to network resources according to their permissions.
|
|
66
|
+
• `users[username] = new Me(username)` dynamically assigns the Me instance to a key that matches the username.
|
|
68
67
|
|
|
69
|
-
|
|
68
|
+
**Accessing Instances**:
|
|
70
69
|
|
|
71
|
-
|
|
72
|
-
- These ACLs determine what resources the `.me` object can access and the level of interaction permitted (read, write, execute).
|
|
70
|
+
• You can access the Me instance using the username as the key: `users['suign']`.
|
|
73
71
|
|
|
74
|
-
|
|
72
|
+
**Adding Attributes**:
|
|
75
73
|
|
|
76
|
-
|
|
77
|
-
- If authenticated, the `.me` object can retrieve data from across the network based on the established ACLs.
|
|
78
|
-
- If not authenticated, the `.me` object is limited to retrieving data from the local host.
|
|
74
|
+
• The **be()** method is used to add attributes to the identity object.
|
|
79
75
|
|
|
80
|
-
|
|
76
|
+
. **Example Usage**:
|
|
81
77
|
|
|
82
|
-
|
|
83
|
-
- It could include commands to "login" to the network, "logout", or "sync" local profiles with network profiles.
|
|
78
|
+
• Two users, user1 and user2, are created and their identities are dynamically managed within the **users** object.
|
|
84
79
|
|
|
85
|
-
|
|
80
|
+
--------
|
|
86
81
|
|
|
87
|
-
|
|
88
|
-
- The `.me` object's unique hash can be part of the encryption key, ensuring that only the intended `.me` object can decrypt and access the shared data.
|
|
82
|
+
### Neural Networks - **One-Hot Encoding**
|
|
89
83
|
|
|
90
|
-
|
|
84
|
+
------
|
|
91
85
|
|
|
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.
|
|
92
87
|
|
|
88
|
+
Here’s a step-by-step approach to achieve this:
|
|
93
89
|
|
|
94
|
-
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
- `me sync`: Synchronizes local `.me` object data with the network profile.
|
|
98
|
-
- `me fetch`: Retrieves data from the local host or network based on authentication status.
|
|
90
|
+
1. **One-Hot Encoding:** Convert each element (“me”, “you”, “him”, “her”, “it”, “us”, “them”) into a one-hot encoded vector.
|
|
91
|
+
2. **Combination Representation:** Create input vectors for each combination by combining the one-hot encoded vectors.
|
|
92
|
+
3. **Neural Network Design:** Design a simple neural network to process these input vectors.
|
|
99
93
|
|
|
100
|
-
|
|
94
|
+
#### Step 1: One-Hot Encoding
|
|
101
95
|
|
|
102
|
-
|
|
96
|
+
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:
|
|
103
97
|
|
|
104
|
-
|
|
98
|
+
```js
|
|
99
|
+
// Create Me instances
|
|
100
|
+
const meInstance = new Me('me');
|
|
101
|
+
const youInstance = new Me('you');
|
|
102
|
+
const himInstance = new Me('him');
|
|
103
|
+
const herInstance = new Me('her');
|
|
104
|
+
const itInstance = new Me('it');
|
|
105
|
+
const usInstance = new Me('us');
|
|
106
|
+
const themInstance = new Me('them');
|
|
105
107
|
|
|
106
|
-
|
|
108
|
+
// One-hot encoding representation
|
|
109
|
+
const subjects = {
|
|
110
|
+
'me': [1, 0, 0, 0, 0, 0, 0],
|
|
111
|
+
'you': [0, 1, 0, 0, 0, 0, 0],
|
|
112
|
+
'him': [0, 0, 1, 0, 0, 0, 0],
|
|
113
|
+
'her': [0, 0, 0, 1, 0, 0, 0],
|
|
114
|
+
'it': [0, 0, 0, 0, 1, 0, 0],
|
|
115
|
+
'us': [0, 0, 0, 0, 0, 1, 0],
|
|
116
|
+
'them': [0, 0, 0, 0, 0, 0, 1]
|
|
117
|
+
};
|
|
118
|
+
```
|
|
107
119
|
|
|
108
|
-
|
|
120
|
+
#### Step 2: Combination Representation
|
|
109
121
|
|
|
110
|
-
|
|
122
|
+
For each combination, we can create an input vector by combining the one-hot encoded vectors of its elements. For example:
|
|
111
123
|
|
|
112
|
-
|
|
124
|
+
Combination “me, you” would be represented as the sum of the one-hot vectors for “me” and “you”:
|
|
113
125
|
|
|
114
|
-
|
|
126
|
+
```
|
|
127
|
+
[1, 0, 0, 0, 0, 0, 0] + [0, 1, 0, 0, 0, 0, 0] = [1, 1, 0, 0, 0, 0, 0]
|
|
128
|
+
```
|
|
115
129
|
|
|
116
|
-
|
|
130
|
+
---
|
|
131
|
+
Hello, I am .me
|
|
132
|
+
? Who are you? (Use arrow keys)
|
|
133
|
+
❯ add.me
|
|
134
|
+
---
|
|
117
135
|
|
|
118
|
-
|
|
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
|
+
```
|
|
119
169
|
|
|
120
|
-
|
|
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.
|
|
121
171
|
|
|
122
|
-
|
|
172
|
+
----------
|
|
123
173
|
|
|
124
|
-
|
|
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/)**
|
|
125
177
|
|
|
126
|
-
- **
|
|
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.**
|
|
127
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.
|
|
128
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)
|
|
129
|
-
|
|
130
|
-
**Learn more** at https://neurons.me
|
|
131
|
-
|
|
132
|
-
**Author:** SuiGn
|
|
133
|
-
|
|
134
185
|
[By neurons.me](https://neurons.me)
|
|
135
186
|
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
----
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
187
|
<img src="https://suign.github.io/neurons.me/neurons_logo.png" alt="neurons.me logo" width="123" height="123" style="width123px; height:123px;">
|
|
143
188
|
|
|
144
189
|
|
package/index.js
CHANGED
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
this.me/index.js
|
|
3
|
-
ⓝⓔⓤⓡⓞⓝⓢ.ⓜⓔ
|
|
4
|
-
🆂🆄🅸🅶🅽
|
|
5
|
-
*/
|
|
1
|
+
//index.js
|
|
6
2
|
/**
|
|
7
3
|
* @module This.Me
|
|
8
4
|
* @description
|
|
@@ -12,10 +8,18 @@ this.me/index.js
|
|
|
12
8
|
* This dual functionality ensures seamless interoperability and heightened security.
|
|
13
9
|
* Command Definitions and Interactive Shell.*/
|
|
14
10
|
|
|
15
|
-
//
|
|
16
|
-
|
|
17
|
-
import Me from './src/this.me.js';
|
|
18
|
-
export default Me;
|
|
19
|
-
console.log('this.me loaded');
|
|
11
|
+
//index.js in the `this.me` package
|
|
12
|
+
import Me from './src/me.js';
|
|
20
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
|
+
*/
|
|
21
24
|
|
|
25
|
+
export default Me;
|
package/package.json
CHANGED
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "this.me",
|
|
3
|
-
"version": "2.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "2.9.1",
|
|
4
|
+
"description": "_me-Centric.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"start": "node index.js",
|
|
8
8
|
"test": "test"
|
|
9
9
|
},
|
|
10
|
+
"bin": {
|
|
11
|
+
".me": "src/.me.cli.js"
|
|
12
|
+
},
|
|
10
13
|
"keywords": [
|
|
11
14
|
"this.me",
|
|
12
15
|
"user"
|
|
13
16
|
],
|
|
14
|
-
"devDependencies": {
|
|
15
|
-
},
|
|
16
17
|
"repository": {
|
|
17
18
|
"type": "git",
|
|
18
19
|
"url": "git+https://github.com/suiGn/this.me.git"
|
|
@@ -25,6 +26,7 @@
|
|
|
25
26
|
"repoType": "NPM Package",
|
|
26
27
|
"category": "dataformatter",
|
|
27
28
|
"dependencies": {
|
|
28
|
-
|
|
29
|
+
"chalk": "^5.3.0",
|
|
30
|
+
"inquirer": "^9.2.16"
|
|
29
31
|
}
|
|
30
32
|
}
|
package/src/.me.cli.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
//.me.cli.js
|
|
3
|
+
import { program } from 'commander';
|
|
4
|
+
import { meMainChoices } from './CLI/me_MainChoices.js';
|
|
5
|
+
import AddMe from './CLI/AddMe.js';
|
|
6
|
+
import LogMe from './CLI/LogMe.js';
|
|
7
|
+
program
|
|
8
|
+
.description('.Me Command Line Interface')
|
|
9
|
+
.version('1.0.0')
|
|
10
|
+
.action(meMainChoices);
|
|
11
|
+
|
|
12
|
+
program.command('add-me')
|
|
13
|
+
.description('+ Add .me')
|
|
14
|
+
.action(AddMe);
|
|
15
|
+
|
|
16
|
+
program.command('log-me')
|
|
17
|
+
.description('Log .me')
|
|
18
|
+
.action(LogMe);
|
|
19
|
+
|
|
20
|
+
program.parse(process.argv);
|
package/src/CLI/AddMe.js
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
//CLI/AddMe.js
|
|
2
|
+
import inquirer from 'inquirer';
|
|
3
|
+
import chalk from 'chalk';
|
|
4
|
+
import fs from 'fs';
|
|
5
|
+
import path from 'path';
|
|
6
|
+
|
|
7
|
+
const getConfigPath = () => path.join(process.env.HOME, '.me_config');
|
|
8
|
+
|
|
9
|
+
const saveNewUser = (username) => {
|
|
10
|
+
const configPath = getConfigPath();
|
|
11
|
+
let users = [];
|
|
12
|
+
if (fs.existsSync(configPath)) {
|
|
13
|
+
users = JSON.parse(fs.readFileSync(configPath, 'utf-8'));
|
|
14
|
+
}
|
|
15
|
+
users.push(username);
|
|
16
|
+
fs.writeFileSync(configPath, JSON.stringify(users));
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
const AddMe = async () => {
|
|
20
|
+
const response = await inquirer.prompt([
|
|
21
|
+
{
|
|
22
|
+
type: 'input',
|
|
23
|
+
name: 'newMe',
|
|
24
|
+
message: 'Enter your new .me username:',
|
|
25
|
+
// Validate input: adjust as per your validation rules
|
|
26
|
+
validate: (input) => !!input.trim() || 'Username cannot be empty!',
|
|
27
|
+
},
|
|
28
|
+
]);
|
|
29
|
+
|
|
30
|
+
const newMe = response.newMe.trim();
|
|
31
|
+
saveNewUser(newMe);
|
|
32
|
+
console.log(chalk.green(`New .me username added: ${newMe}`));
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export default AddMe;
|
package/src/CLI/LogMe.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// Source: CLI/LogMe.js
|
|
2
|
+
import inquirer from 'inquirer';
|
|
3
|
+
import chalk from 'chalk';
|
|
4
|
+
|
|
5
|
+
const getExistingUsers = () => {
|
|
6
|
+
// Simulate fetching existing users: adjust to your actual logic
|
|
7
|
+
return ['user1', 'user2']; // Example user names
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
const LogMe = async () => {
|
|
11
|
+
const existingUsers = getExistingUsers();
|
|
12
|
+
|
|
13
|
+
const response = await inquirer.prompt([
|
|
14
|
+
{
|
|
15
|
+
type: 'list',
|
|
16
|
+
name: 'selectedUser',
|
|
17
|
+
message: 'Confirm your identity:',
|
|
18
|
+
choices: existingUsers,
|
|
19
|
+
},
|
|
20
|
+
]);
|
|
21
|
+
|
|
22
|
+
const selectedUser = response.selectedUser;
|
|
23
|
+
console.log(chalk.green(`.me confirmed: ${selectedUser}`));
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export default LogMe;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// CLI/me_MainMenu.js
|
|
2
|
+
import inquirer from 'inquirer';
|
|
3
|
+
import chalk from 'chalk';
|
|
4
|
+
import AddMe from './AddMe.js'; // Corrected import statement
|
|
5
|
+
import LogMe from './LogMe.js'; // Corrected import statement
|
|
6
|
+
|
|
7
|
+
export async function meMainChoices() {
|
|
8
|
+
const answers = await inquirer.prompt([
|
|
9
|
+
{
|
|
10
|
+
type: 'list',
|
|
11
|
+
name: 'action',
|
|
12
|
+
message: 'Choose an action:',
|
|
13
|
+
choices: ['Add .me', 'Log .me', new inquirer.Separator(), 'Exit'],
|
|
14
|
+
},
|
|
15
|
+
]);
|
|
16
|
+
|
|
17
|
+
switch (answers.action) {
|
|
18
|
+
case 'Add .me':
|
|
19
|
+
AddMe();
|
|
20
|
+
break;
|
|
21
|
+
case 'Log .me':
|
|
22
|
+
LogMe();
|
|
23
|
+
break;
|
|
24
|
+
case 'Exit':
|
|
25
|
+
console.log(chalk.green('Exiting...'));
|
|
26
|
+
process.exit();
|
|
27
|
+
}
|
|
28
|
+
}
|
package/src/example.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import Me from './me.js';
|
|
2
|
+
import chalk from 'chalk';
|
|
3
|
+
|
|
4
|
+
// Create a new Me instance
|
|
5
|
+
let me = new Me('suign');
|
|
6
|
+
// Add attributes to the identity
|
|
7
|
+
me.be({ fullName: "Jose", lastName: "Abella" });
|
|
8
|
+
me.be({ xy: "z" });
|
|
9
|
+
console.log(me.identify());
|
|
10
|
+
// Examplconsole.log(me.identity());e with another instance
|
|
11
|
+
let anotherMe = new Me('anotherUser');
|
|
12
|
+
anotherMe.be({ nickname: "hero", favoriteColor: "blue" });
|
|
13
|
+
console.log(anotherMe.identify());
|
|
14
|
+
// Create a new Me instance with dynamic property name
|
|
15
|
+
let user = 'suign';
|
|
16
|
+
let users = {};
|
|
17
|
+
users[user] = new Me(user);
|
|
18
|
+
// Add attributes to the identity
|
|
19
|
+
users[user].be({ fullName: "ZZZ", lastName: "WWW" });
|
|
20
|
+
users[user].be({ xy: "axax" });
|
|
21
|
+
console.log(users[user]);
|
|
22
|
+
|
|
23
|
+
|
package/src/me.js
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
//this.me/src/me.js
|
|
2
|
+
import crypto from 'crypto';
|
|
3
|
+
import os from 'os';
|
|
4
|
+
|
|
5
|
+
// Define the .me class
|
|
6
|
+
class Me {
|
|
7
|
+
constructor(username = 'monad') {
|
|
8
|
+
this.username = this.validateUsername(username);
|
|
9
|
+
this.identity = {
|
|
10
|
+
username: this.username,
|
|
11
|
+
hash: this.sha256(),
|
|
12
|
+
host: this.getHostInfo()
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
// Method to validate the username
|
|
17
|
+
validateUsername(username) {
|
|
18
|
+
const regex = /^[a-zA-Z0-9]+$/; // Only letters and numbers
|
|
19
|
+
if (regex.test(username)) {
|
|
20
|
+
return username;
|
|
21
|
+
} else {
|
|
22
|
+
throw new Error('Incorrect username. Only letters and numbers are allowed.');
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
// Method to generate a cryptographic hash of the username
|
|
27
|
+
sha256() {
|
|
28
|
+
return crypto.createHash('sha256').update(this.username).digest('hex');
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// Method to get host information
|
|
32
|
+
getHostInfo() {
|
|
33
|
+
return {
|
|
34
|
+
hostname: os.hostname(),
|
|
35
|
+
platform: os.platform(),
|
|
36
|
+
networkInterfaces: os.networkInterfaces()
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// Method to add key-value pairs to the identity object
|
|
41
|
+
be(attributes) {
|
|
42
|
+
for (const [key, value] of Object.entries(attributes)) {
|
|
43
|
+
this.identity[key] = value;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// Method to get the identity object
|
|
48
|
+
identify() {
|
|
49
|
+
return this.be;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export default Me;
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
Key Points of This.Me:
|
|
2
|
-
Digital Identity Representation:
|
|
3
|
-
|
|
4
|
-
This.Me encapsulates the essence of an entity, providing a robust framework for managing digital identities.
|
|
5
|
-
It allows for cryptographic proof-based interactions, moving away from centralized authority reliance.
|
|
6
|
-
User-Centric Services:
|
|
7
|
-
|
|
8
|
-
The design focuses on user-centricity, where services rely on cryptographic proofs, enhancing security and user control.
|
|
9
|
-
Project Status:
|
|
10
|
-
|
|
11
|
-
Being experimental and under active development, it's highlighted that significant changes may occur, showing transparency in its developmental stage.
|
|
12
|
-
Integration and Usage:
|
|
13
|
-
|
|
14
|
-
The quick start guide simplifies the integration process, encouraging users to start utilizing This.Me in their projects for identity management and cryptographic operations.
|
|
15
|
-
Local and Network Identity:
|
|
16
|
-
|
|
17
|
-
The dual identity system (local and network) provides a versatile approach to data access and user interaction, distinguishing between authenticated network interactions and local-only data access.
|
|
18
|
-
CLI Functionality:
|
|
19
|
-
|
|
20
|
-
Proposed CLI commands (me init, me login, etc.) offer straightforward interfaces for users to manage their .me objects, enhancing usability.
|
|
21
|
-
Modular Data Structures:
|
|
22
|
-
|
|
23
|
-
Being part of all.this data structures, This.Me aligns with a suite of modules, each specializing in different data aspects, ensuring integration and interoperability within the neurons.me ecosystem.
|
|
24
|
-
Security and Privacy:
|
|
25
|
-
|
|
26
|
-
Emphasizes security through unique cryptographic identities for each module instance and adheres to privacy-centric policies, reassuring users of their data integrity and privacy.
|
|
27
|
-
Enhancements and Considerations:
|
|
28
|
-
Interactivity Between Instances:
|
|
29
|
-
While each Me instance represents an identity, considering how these instances interact and relate within each sphere (personal, family, friends, etc.) can further enrich the model. For instance, defining interaction protocols or shared spaces where instances influence or contribute to each other's state or data.
|
|
30
|
-
|
|
31
|
-
Data Inheritance and Sharing:
|
|
32
|
-
Exploring how instances might inherit or share data within a sphere (like family traits or common friend group memories) could add depth to the identity representations.
|
|
33
|
-
|
|
34
|
-
Network Dynamics:
|
|
35
|
-
Delving deeper into the network identity aspect, considering how a Me instance evolves or influences the network when transitioning from a local to a networked context, could provide insights into collective behaviors or network effects.
|
|
36
|
-
|
|
37
|
-
External Interactions:
|
|
38
|
-
Reflecting on how Me instances interact with external entities or services (beyond the user's direct network) could expand on the role of digital identity in broader ecosystems.
|
|
39
|
-
|
|
40
|
-
By fleshing out these aspects, This.Me can offer a comprehensive and nuanced framework for digital identity, providing users with a versatile and secure way to manage their presence and interactions across various contexts and networks.
|
package/src/createMeFormatter.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
// createMeFormatter.js
|
|
2
|
-
import MeFormatterNode from './nodejs/meFormatter.node.js';
|
|
3
|
-
import MeFormatterBrowser from './browser/meFormatter.browser.js';
|
|
4
|
-
|
|
5
|
-
function isNode() {
|
|
6
|
-
return typeof window === 'undefined';
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export async function createMeFormatter() {
|
|
10
|
-
if (isNode()) {
|
|
11
|
-
return { formatter: new MeFormatterNode(), error: null };
|
|
12
|
-
} else {
|
|
13
|
-
return { formatter: new MeFormatterBrowser(), error: null };
|
|
14
|
-
}
|
|
15
|
-
}
|
package/src/this.me.js
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
this.me.js
|
|
3
|
-
ⓝⓔⓤⓡⓞⓝⓢ.ⓜⓔ
|
|
4
|
-
🆂🆄🅸🅶🅽
|
|
5
|
-
*/
|
|
6
|
-
import { createMeFormatter } from './createMeFormatter.js';
|
|
7
|
-
/**
|
|
8
|
-
* Represents a '.me' entity with personal information and methods to process and manage it.
|
|
9
|
-
* name: 'Alice',
|
|
10
|
-
* dob: '1990-01-01',
|
|
11
|
-
* city: 'Wonderland',
|
|
12
|
-
* gender: 'Female',
|
|
13
|
-
* textInfo: 'Loves adventures'
|
|
14
|
-
*/
|
|
15
|
-
class Me {
|
|
16
|
-
/**
|
|
17
|
-
* Creates an instance of the Me class representing user identity.
|
|
18
|
-
* @param {Object} meInfo - User's personal information.
|
|
19
|
-
* @param {string} meInfo.name - The user's name.
|
|
20
|
-
* @param {string} meInfo.dob - The user's date of birth.
|
|
21
|
-
* @param {string} meInfo.city - The city associated with the user.
|
|
22
|
-
* @param {string} meInfo.gender - The user's gender.
|
|
23
|
-
* @param {string} meInfo.bio - A short biography or description of the user.
|
|
24
|
-
* @param {string} meInfo.password - A password for the user's identity (should be handled securely).
|
|
25
|
-
* @param {string} meInfo.pin - A PIN for additional security or quick access.
|
|
26
|
-
*/
|
|
27
|
-
constructor(meInfo = {}) {
|
|
28
|
-
this.name = meInfo.name || 'Unknown';
|
|
29
|
-
this.dob = meInfo.dob || 'Unknown';
|
|
30
|
-
this.city = meInfo.city || 'Unknown';
|
|
31
|
-
this.gender = meInfo.gender || 'Unknown';
|
|
32
|
-
this.bio = meInfo.bio || 'No bio provided';
|
|
33
|
-
this.password = meInfo.password || ''; // Consider encryption/hashing for security
|
|
34
|
-
this.pin = meInfo.pin || ''; // Consider encryption/hashing for security
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* Updates the user's information in the .Me instance.
|
|
39
|
-
* @param {Object} updateInfo - The information to update.
|
|
40
|
-
*/
|
|
41
|
-
updateInfo(updateInfo) {
|
|
42
|
-
this.name = updateInfo.name || this.name;
|
|
43
|
-
this.dob = updateInfo.dob || this.dob;
|
|
44
|
-
this.city = updateInfo.city || this.city;
|
|
45
|
-
this.gender = updateInfo.gender || this.gender;
|
|
46
|
-
this.bio = updateInfo.bio || this.bio;
|
|
47
|
-
// Password and PIN updates should be handled carefully, potentially with additional security checks
|
|
48
|
-
if (updateInfo.password) {
|
|
49
|
-
this.password = updateInfo.password; // Consider implementing a method to securely update the password
|
|
50
|
-
}
|
|
51
|
-
if (updateInfo.pin) {
|
|
52
|
-
this.pin = updateInfo.pin; // Consider implementing a method to securely update the PIN
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
export default Me;
|
package/src/this.me.promises.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
// Path: Lisa/monadLisa/workspaces/packages/dataformatters/this.me/src/this.me.promises.js
|
|
2
|
-
// this.me.promises.js
|
|
3
|
-
export const logMeSuccess = (result) => {
|
|
4
|
-
console.log('Operation successful:', result);
|
|
5
|
-
};
|
|
6
|
-
|
|
7
|
-
export const logMeError = (error) => {
|
|
8
|
-
console.error('Operation failed:', error);
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
export const handleMePromise = (promise, successHandler, errorHandler) => {
|
|
12
|
-
promise.then(successHandler).catch(errorHandler);
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
export const BeMe = (promise, successHandler, errorHandler) => {
|
|
16
|
-
promise.then(successHandler).catch(errorHandler);
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
// You can add more handlers as needed.
|
|
21
|
-
|