this.me 2.7.8 → 2.8.0
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/docs/README.md +1 -0
- package/docs/cli_main.js.html +2 -1
- package/docs/module-CLI.html +6 -6
- package/package.json +5 -7
- package/src/cli/main.js +61 -12
- package/src/me.html +0 -4
package/docs/README.md
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# This.Me
|
|
4
4
|
|
|
5
|
+
|
|
5
6
|
**This.Me** is a digital identity representation of **Me** as it encapsulates the essence of an entity which is then passed for cryptographic guarantees.
|
|
6
7
|
|
|
7
8
|
Users no longer depend on centralized authorities for **identity and data management**. They hold the keys (literally) to their identity and data.
|
package/docs/cli_main.js.html
CHANGED
|
@@ -125,7 +125,8 @@
|
|
|
125
125
|
|
|
126
126
|
import os from 'os';
|
|
127
127
|
import Me from '../me.js';
|
|
128
|
-
import
|
|
128
|
+
import { Command } from 'commander';
|
|
129
|
+
const program = new Command();
|
|
129
130
|
import inquirer from 'inquirer';
|
|
130
131
|
import fs from 'fs';
|
|
131
132
|
import path from 'path';
|
package/docs/module-CLI.html
CHANGED
|
@@ -267,7 +267,7 @@ Author: SuiGn</div>
|
|
|
267
267
|
<p class="tag-source">
|
|
268
268
|
<a href="cli_main.js.html" class="button">View Source</a>
|
|
269
269
|
<span>
|
|
270
|
-
<a href="cli_main.js.html">cli/main.js</a>, <a href="cli_main.js.html#
|
|
270
|
+
<a href="cli_main.js.html">cli/main.js</a>, <a href="cli_main.js.html#line134">line 134</a>
|
|
271
271
|
</span>
|
|
272
272
|
</p>
|
|
273
273
|
|
|
@@ -370,7 +370,7 @@ Author: SuiGn</div>
|
|
|
370
370
|
<p class="tag-source">
|
|
371
371
|
<a href="cli_main.js.html" class="button">View Source</a>
|
|
372
372
|
<span>
|
|
373
|
-
<a href="cli_main.js.html">cli/main.js</a>, <a href="cli_main.js.html#
|
|
373
|
+
<a href="cli_main.js.html">cli/main.js</a>, <a href="cli_main.js.html#line71">line 71</a>
|
|
374
374
|
</span>
|
|
375
375
|
</p>
|
|
376
376
|
|
|
@@ -498,7 +498,7 @@ Author: SuiGn</div>
|
|
|
498
498
|
<p class="tag-source">
|
|
499
499
|
<a href="cli_main.js.html" class="button">View Source</a>
|
|
500
500
|
<span>
|
|
501
|
-
<a href="cli_main.js.html">cli/main.js</a>, <a href="cli_main.js.html#
|
|
501
|
+
<a href="cli_main.js.html">cli/main.js</a>, <a href="cli_main.js.html#line56">line 56</a>
|
|
502
502
|
</span>
|
|
503
503
|
</p>
|
|
504
504
|
|
|
@@ -627,7 +627,7 @@ Continuously prompts the user for actions until an exit command is given.
|
|
|
627
627
|
<p class="tag-source">
|
|
628
628
|
<a href="cli_main.js.html" class="button">View Source</a>
|
|
629
629
|
<span>
|
|
630
|
-
<a href="cli_main.js.html">cli/main.js</a>, <a href="cli_main.js.html#
|
|
630
|
+
<a href="cli_main.js.html">cli/main.js</a>, <a href="cli_main.js.html#line142">line 142</a>
|
|
631
631
|
</span>
|
|
632
632
|
</p>
|
|
633
633
|
|
|
@@ -728,7 +728,7 @@ Continuously prompts the user for actions until an exit command is given.
|
|
|
728
728
|
<p class="tag-source">
|
|
729
729
|
<a href="cli_main.js.html" class="button">View Source</a>
|
|
730
730
|
<span>
|
|
731
|
-
<a href="cli_main.js.html">cli/main.js</a>, <a href="cli_main.js.html#
|
|
731
|
+
<a href="cli_main.js.html">cli/main.js</a>, <a href="cli_main.js.html#line31">line 31</a>
|
|
732
732
|
</span>
|
|
733
733
|
</p>
|
|
734
734
|
|
|
@@ -880,7 +880,7 @@ Continuously prompts the user for actions until an exit command is given.
|
|
|
880
880
|
<p class="tag-source">
|
|
881
881
|
<a href="cli_main.js.html" class="button">View Source</a>
|
|
882
882
|
<span>
|
|
883
|
-
<a href="cli_main.js.html">cli/main.js</a>, <a href="cli_main.js.html#
|
|
883
|
+
<a href="cli_main.js.html">cli/main.js</a>, <a href="cli_main.js.html#line119">line 119</a>
|
|
884
884
|
</span>
|
|
885
885
|
</p>
|
|
886
886
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "this.me",
|
|
3
|
-
"version": "2.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "2.8.0",
|
|
4
|
+
"description": "User-Centric OS.",
|
|
5
5
|
"bin": {
|
|
6
6
|
".me": "./src/cli/main.js"
|
|
7
7
|
},
|
|
@@ -14,13 +14,10 @@
|
|
|
14
14
|
"build": "browserify src/me.js -s Me -o dist/me.bundle.js",
|
|
15
15
|
"keywords": [
|
|
16
16
|
"this.me",
|
|
17
|
-
"user"
|
|
18
|
-
"user-centric system",
|
|
19
|
-
"Data Sovereignty"
|
|
17
|
+
"user"
|
|
20
18
|
],
|
|
21
19
|
"devDependencies": {
|
|
22
|
-
"browserify": "^17.0.0"
|
|
23
|
-
"jsdoc": "^4.0.2"
|
|
20
|
+
"browserify": "^17.0.0"
|
|
24
21
|
},
|
|
25
22
|
"repository": {
|
|
26
23
|
"type": "git",
|
|
@@ -32,6 +29,7 @@
|
|
|
32
29
|
"license": "MIT",
|
|
33
30
|
"repoType": "NPM Package",
|
|
34
31
|
"dependencies": {
|
|
32
|
+
"commander": "^11.1.0",
|
|
35
33
|
"inquirer": "^9.2.12"
|
|
36
34
|
}
|
|
37
35
|
}
|
package/src/cli/main.js
CHANGED
|
@@ -7,7 +7,8 @@
|
|
|
7
7
|
|
|
8
8
|
import os from 'os';
|
|
9
9
|
import Me from '../me.js';
|
|
10
|
-
import
|
|
10
|
+
import { Command } from 'commander';
|
|
11
|
+
const program = new Command();
|
|
11
12
|
import inquirer from 'inquirer';
|
|
12
13
|
import fs from 'fs';
|
|
13
14
|
import path from 'path';
|
|
@@ -113,17 +114,17 @@ async function getNewProfileDetails() {
|
|
|
113
114
|
|
|
114
115
|
/**
|
|
115
116
|
* Writes the .me object to the filesystem.
|
|
116
|
-
* @param {Me}
|
|
117
|
+
* @param {Me} meProfile - The Me object to be saved.
|
|
117
118
|
*/
|
|
118
|
-
function writeMeObjectToFile(
|
|
119
|
-
const meDirectory = path.join(os.homedir(), '.
|
|
119
|
+
function writeMeObjectToFile(meProfile) {
|
|
120
|
+
const meDirectory = path.join(os.homedir(), '.me');
|
|
120
121
|
if (!fs.existsSync(meDirectory)) {
|
|
121
122
|
fs.mkdirSync(meDirectory, { recursive: true });
|
|
122
123
|
}
|
|
123
124
|
|
|
124
|
-
const filePath = path.join(meDirectory, `${
|
|
125
|
+
const filePath = path.join(meDirectory, `${meProfile.name}.me`);
|
|
125
126
|
// Consider encrypting the data here before writing to the filesystem
|
|
126
|
-
fs.writeFileSync(filePath, JSON.stringify(
|
|
127
|
+
fs.writeFileSync(filePath, JSON.stringify(meProfile.getIdentityObject()));
|
|
127
128
|
console.log('Profile created successfully.');
|
|
128
129
|
}
|
|
129
130
|
|
|
@@ -134,6 +135,47 @@ function displayOptionsAndCommands() {
|
|
|
134
135
|
console.log(program.helpInformation());
|
|
135
136
|
}
|
|
136
137
|
|
|
138
|
+
/**
|
|
139
|
+
* Lists all the .me profile file paths in the user's .me directory.
|
|
140
|
+
* @returns {string[]} An array of full file paths for each .me profile.
|
|
141
|
+
*/
|
|
142
|
+
function listMeProfiles() {
|
|
143
|
+
const meDirectory = path.join(os.homedir(), '.me');
|
|
144
|
+
if (fs.existsSync(meDirectory)) {
|
|
145
|
+
const profileFiles = fs.readdirSync(meDirectory)
|
|
146
|
+
.filter(file => file.endsWith('.me'));
|
|
147
|
+
return profileFiles.map(file => path.join(meDirectory, file));
|
|
148
|
+
} else {
|
|
149
|
+
console.log('No profiles found.');
|
|
150
|
+
return [];
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* Prompts the user to select a .me profile or go back to the main menu.
|
|
156
|
+
* @returns {Promise<string>} The file path of the selected profile or 'back' to go to the main menu.
|
|
157
|
+
*/
|
|
158
|
+
async function selectProfile() {
|
|
159
|
+
const profiles = listMeProfiles();
|
|
160
|
+
if (profiles.length === 0) {
|
|
161
|
+
console.log('No profiles found.');
|
|
162
|
+
return 'back';
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
const choices = profiles.map(file => ({
|
|
166
|
+
name: path.basename(file, '.me'),
|
|
167
|
+
value: file
|
|
168
|
+
})).concat([{ name: 'Go Back to Main Menu', value: 'back' }]);
|
|
169
|
+
|
|
170
|
+
const answer = await inquirer.prompt([{
|
|
171
|
+
type: 'list',
|
|
172
|
+
name: 'selectedProfile',
|
|
173
|
+
message: 'Select a profile to view or go back:',
|
|
174
|
+
choices: choices
|
|
175
|
+
}]);
|
|
176
|
+
return answer.selectedProfile;
|
|
177
|
+
}
|
|
178
|
+
|
|
137
179
|
/**
|
|
138
180
|
* Main function to handle the CLI interactions.
|
|
139
181
|
* Continuously prompts the user for actions until an exit command is given.
|
|
@@ -144,13 +186,19 @@ async function main() {
|
|
|
144
186
|
while (!exit) {
|
|
145
187
|
const choice = await getUserChoice();
|
|
146
188
|
switch (choice) {
|
|
147
|
-
|
|
148
|
-
|
|
189
|
+
/**
|
|
190
|
+
* Handles the 'View Existing Profiles' choice.
|
|
191
|
+
* Lists and displays all existing .me profiles.
|
|
192
|
+
*/
|
|
193
|
+
case 'View Existing Profiles':
|
|
194
|
+
const selectedProfile = await selectProfile();
|
|
195
|
+
if (selectedProfile === 'back') {
|
|
149
196
|
break;
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
197
|
+
}
|
|
198
|
+
// Read and display the selected profile details here
|
|
199
|
+
console.log(`Selected profile: ${selectedProfile}`);
|
|
200
|
+
// Add logic to handle the selected profile
|
|
201
|
+
break;
|
|
154
202
|
case 'Exit':
|
|
155
203
|
console.log('Exiting .me CLI.');
|
|
156
204
|
exit = true;
|
|
@@ -174,3 +222,4 @@ process.on('uncaughtException', (err) => {
|
|
|
174
222
|
});
|
|
175
223
|
|
|
176
224
|
|
|
225
|
+
|
package/src/me.html
CHANGED
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
</head>
|
|
5
5
|
<body>
|
|
6
6
|
Hello, me!
|
|
7
|
-
|
|
8
7
|
<script>
|
|
9
8
|
window.fbAsyncInit = function() {
|
|
10
9
|
FB.init({
|
|
@@ -13,9 +12,7 @@
|
|
|
13
12
|
xfbml : true,
|
|
14
13
|
version : '{api-version}'
|
|
15
14
|
});
|
|
16
|
-
|
|
17
15
|
FB.AppEvents.logPageView();
|
|
18
|
-
|
|
19
16
|
};
|
|
20
17
|
|
|
21
18
|
(function(d, s, id){
|
|
@@ -27,5 +24,4 @@
|
|
|
27
24
|
}(document, 'script', 'facebook-jssdk'));
|
|
28
25
|
</script>
|
|
29
26
|
</body>
|
|
30
|
-
|
|
31
27
|
</html>
|