this.me 2.7.7 → 2.7.8

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.
Files changed (64) hide show
  1. package/README.md +82 -58
  2. package/docs/Me.html +697 -0
  3. package/docs/README.md +91 -0
  4. package/docs/ThisMe.html +690 -0
  5. package/docs/cli_main.js.html +340 -0
  6. package/docs/fonts/OpenSans-Bold-webfont.eot +0 -0
  7. package/docs/fonts/OpenSans-Bold-webfont.svg +1830 -0
  8. package/docs/fonts/OpenSans-Bold-webfont.woff +0 -0
  9. package/docs/fonts/OpenSans-BoldItalic-webfont.eot +0 -0
  10. package/docs/fonts/OpenSans-BoldItalic-webfont.svg +1830 -0
  11. package/docs/fonts/OpenSans-BoldItalic-webfont.woff +0 -0
  12. package/docs/fonts/OpenSans-Italic-webfont.eot +0 -0
  13. package/docs/fonts/OpenSans-Italic-webfont.svg +1830 -0
  14. package/docs/fonts/OpenSans-Italic-webfont.woff +0 -0
  15. package/docs/fonts/OpenSans-Light-webfont.eot +0 -0
  16. package/docs/fonts/OpenSans-Light-webfont.svg +1831 -0
  17. package/docs/fonts/OpenSans-Light-webfont.woff +0 -0
  18. package/docs/fonts/OpenSans-LightItalic-webfont.eot +0 -0
  19. package/docs/fonts/OpenSans-LightItalic-webfont.svg +1835 -0
  20. package/docs/fonts/OpenSans-LightItalic-webfont.woff +0 -0
  21. package/docs/fonts/OpenSans-Regular-webfont.eot +0 -0
  22. package/docs/fonts/OpenSans-Regular-webfont.svg +1831 -0
  23. package/docs/fonts/OpenSans-Regular-webfont.woff +0 -0
  24. package/docs/global.html +454 -0
  25. package/docs/index.html +258 -0
  26. package/docs/me.js.html +211 -0
  27. package/docs/module-CLI.html +963 -0
  28. package/docs/neurons_logo.png +0 -0
  29. package/docs/scripts/app.min.js +1 -0
  30. package/docs/scripts/linenumber.js +26 -0
  31. package/docs/scripts/prettify/Apache-License-2.0.txt +202 -0
  32. package/docs/scripts/prettify/lang-css.js +2 -0
  33. package/docs/scripts/prettify/prettify.js +28 -0
  34. package/docs/scripts/search.js +39 -0
  35. package/docs/styles/app.min.css +1 -0
  36. package/docs/styles/iframe.css +13 -0
  37. package/docs/styles/jsdoc-default.css +358 -0
  38. package/docs/styles/prettify-jsdoc.css +111 -0
  39. package/docs/styles/prettify-tomorrow.css +132 -0
  40. package/docs/styles/reset.css +44 -0
  41. package/jsdoc.json +43 -0
  42. package/package.json +22 -29
  43. package/src/cli/main.js +176 -0
  44. package/src/env.js +8 -0
  45. package/{me.html → src/me.html} +1 -0
  46. package/src/me.js +47 -0
  47. package/src/os/unix/install_me.sh +5 -0
  48. package/src/this/video.js +0 -0
  49. package/Me.js +0 -71
  50. package/crypto/crypto-browser.js +0 -20
  51. package/crypto/crypto-node.js +0 -16
  52. package/crypto/hash/hashWorker.js +0 -11
  53. package/crypto/hash/hashing.js +0 -43
  54. package/demo.js +0 -12
  55. package/main.js +0 -77
  56. package/me2.js +0 -57
  57. package/src/errorHandler.js +0 -9
  58. package/test.js +0 -36
  59. package/testHashIt.js +0 -3
  60. package/webpack.config.js +0 -18
  61. /package/{this/dir.js → index.js} +0 -0
  62. /package/{this/file.js → src/this/dir.js} +0 -0
  63. /package/{this/url.js → src/this/file.js} +0 -0
  64. /package/{this/video.js → src/this/url.js} +0 -0
@@ -0,0 +1,340 @@
1
+
2
+
3
+ <!DOCTYPE html>
4
+ <html lang="en">
5
+
6
+ <head>
7
+ ...
8
+ <meta charset="utf-8">
9
+ <meta name="viewport" content="width=device-width, initial-scale=1">
10
+ <title>This.Me cli/main.js</title>
11
+
12
+ <script src="https://cdn.jsdelivr.net/gh/google/code-prettify@master/loader/run_prettify.js"></script>
13
+ <script src="https://unpkg.com/@babel/standalone/babel.min.js"></script>
14
+ <script src="./build/entry.js"></script>
15
+ <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
16
+ <!--[if lt IE 9]>
17
+ <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
18
+ <![endif]-->
19
+ <link href="https://fonts.googleapis.com/css?family=Roboto:100,400,700|Inconsolata,700" rel="stylesheet">
20
+ <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.6.3/css/all.css" integrity="sha384-UHRtZLI+pbxtHCWp1t77Bi1L4ZtiqrqD80Kn4Z8NTSRyMA2Fd33n5dQ8lWUE00s/" crossorigin="anonymous">
21
+ <link type="text/css" rel="stylesheet" href="https://jmblog.github.io/color-themes-for-google-code-prettify/themes/tomorrow-night.min.css">
22
+ <link type="text/css" rel="stylesheet" href="styles/app.min.css">
23
+ <link type="text/css" rel="stylesheet" href="styles/iframe.css">
24
+ <link type="text/css" rel="stylesheet" href="style.css">
25
+ <script async defer src="https://buttons.github.io/buttons.js"></script>
26
+
27
+
28
+ </head>
29
+
30
+
31
+
32
+ <body class="layout small-header">
33
+ <div id="stickyNavbarOverlay"></div>
34
+
35
+
36
+ <div class="top-nav">
37
+ <div class="inner">
38
+ <a id="hamburger" role="button" class="navbar-burger" aria-label="menu" aria-expanded="false">
39
+ <span aria-hidden="true"></span>
40
+ <span aria-hidden="true"></span>
41
+ <span aria-hidden="true"></span>
42
+ </a>
43
+ <div class="logo">
44
+
45
+
46
+ <a href="index.html">
47
+ <h1 class="navbar-item">This.Me</h1>
48
+ </a>
49
+
50
+ </div>
51
+ <div class="menu">
52
+
53
+ <div class="navigation">
54
+ <a
55
+ href="index.html"
56
+ class="link"
57
+ >
58
+ Documentation
59
+ </a>
60
+
61
+
62
+
63
+ <a
64
+ class="link user-link "
65
+ href="https://suign.github.io/all.this/"
66
+ >
67
+ all.This @Packages
68
+ </a>
69
+
70
+ <a
71
+ class="link user-link "
72
+ href="https://github.com/suiGn/neurons.me"
73
+ >
74
+ Github
75
+ </a>
76
+
77
+ <a
78
+ class="link user-link "
79
+ href="https://neurons.me"
80
+ >
81
+ App
82
+ </a>
83
+
84
+
85
+
86
+ </div>
87
+ </div>
88
+ </div>
89
+ </div>
90
+ <div id="main">
91
+ <div
92
+ class="sidebar "
93
+ id="sidebarNav"
94
+ >
95
+
96
+ <div class="search-wrapper">
97
+ <input id="search" type="text" placeholder="Search docs..." class="input">
98
+ </div>
99
+
100
+ <nav>
101
+
102
+ <h2><a href="index.html">Documentation</a></h2><div class="category"><h3>Modules</h3><ul><li><a href="module-CLI.html">CLI</a></li></ul><h3>Classes</h3><ul><li><a href="Me.html">Me</a></li></ul></div>
103
+
104
+ </nav>
105
+ </div>
106
+ <div class="core" id="main-content-wrapper">
107
+ <div class="content">
108
+ <header class="page-title">
109
+ <p>Source</p>
110
+ <h1>cli/main.js</h1>
111
+ </header>
112
+
113
+
114
+
115
+
116
+
117
+ <section>
118
+ <article>
119
+ <pre class="prettyprint source linenums"><code>#!/usr/bin/env node
120
+ /**
121
+ * @module CLI
122
+ * @description Command Line Interface Functionalities for .me
123
+ * Author: SuiGn
124
+ */
125
+
126
+ import os from 'os';
127
+ import Me from '../me.js';
128
+ import program from 'commander';
129
+ import inquirer from 'inquirer';
130
+ import fs from 'fs';
131
+ import path from 'path';
132
+ import crypto from 'crypto';
133
+
134
+ program
135
+ .command('user &lt;username> &lt;pin>')
136
+ .description('Authenticate and start a session for a given user')
137
+ .action((username, pin) => {
138
+ console.log(`Attempting to authenticate user: ${username}`);
139
+ // Authentication logic here
140
+ });
141
+
142
+ program
143
+ .option('-o, --options', 'View options and commands');
144
+
145
+ /**
146
+ * Display a welcome message to the user.
147
+ */
148
+ function welcomeToMe() {
149
+ console.log(`
150
+ ___________
151
+ [------------]
152
+ | .--------. |
153
+ | |01010101| | __________
154
+ | |11010101| | /__________\
155
+ [--------| -------- |------| --*-- |-------]
156
+ | [----_-.-----] |o ====== | |
157
+ | ______|_|_______ |__________| |
158
+ | / %%%%%%%%%%%% \ |
159
+ | / %%%%%%%%%%%%%% \ |
160
+ | ^^^^^^^^^^^^^^^^^^^^ |
161
+ [---------------------------------.me-----------]
162
+ -^^^^^^^^...
163
+ Welcome to .me.
164
+ `);
165
+ console.log(`Host_Session@ ${os.userInfo().username}`);
166
+ console.log(`v.path@ ${os.homedir()}/this.me`);
167
+ }
168
+
169
+ /**
170
+ * Prompts the user to select an action and returns their choice.
171
+ * @returns {Promise&lt;string>} The user's choice.
172
+ */
173
+ async function getUserChoice() {
174
+ const choices = ['View Existing Profiles', 'Create New Profile', 'Exit'];
175
+ const answer = await inquirer.prompt([{
176
+ type: 'list',
177
+ name: 'action',
178
+ message: 'What would you like to do?',
179
+ choices: choices
180
+ }]);
181
+ return answer.action;
182
+ }
183
+
184
+ /**
185
+ * Prompts the user for details to create a new profile.
186
+ * @returns {Promise&lt;Me>} The new Me object with user details.
187
+ */
188
+ async function getNewProfileDetails() {
189
+ const questions = [
190
+ {
191
+ type: 'input',
192
+ name: 'name',
193
+ message: 'What is your first name?',
194
+ // Add validation as needed
195
+ },
196
+ {
197
+ type: 'input',
198
+ name: 'lastname',
199
+ message: 'What is your last name?',
200
+ // Add validation as needed
201
+ },
202
+ {
203
+ type: 'input',
204
+ name: 'birthday',
205
+ message: 'What is your birthday? (YYYY-MM-DD)',
206
+ // Add validation as needed
207
+ },
208
+ {
209
+ type: 'password',
210
+ name: 'password',
211
+ message: 'Choose a password:',
212
+ // Add validation as needed
213
+ },
214
+ {
215
+ type: 'input',
216
+ name: 'pin',
217
+ message: 'Choose a PIN:',
218
+ // Add validation as needed
219
+ },
220
+ // ... Add more questions as needed
221
+ ];
222
+ const userDetails = await inquirer.prompt(questions);
223
+ return new Me(
224
+ userDetails.name,
225
+ userDetails.lastname,
226
+ userDetails.birthday,
227
+ userDetails.password,
228
+ userDetails.pin
229
+ );
230
+ }
231
+
232
+ /**
233
+ * Writes the .me object to the filesystem.
234
+ * @param {Me} meObject - The Me object to be saved.
235
+ */
236
+ function writeMeObjectToFile(meObject) {
237
+ const meDirectory = path.join(os.homedir(), '.thisme');
238
+ if (!fs.existsSync(meDirectory)) {
239
+ fs.mkdirSync(meDirectory, { recursive: true });
240
+ }
241
+
242
+ const filePath = path.join(meDirectory, `${meObject.name}.me`);
243
+ // Consider encrypting the data here before writing to the filesystem
244
+ fs.writeFileSync(filePath, JSON.stringify(meObject.getIdentityObject()));
245
+ console.log('Profile created successfully.');
246
+ }
247
+
248
+ /**
249
+ * Function to display options and commands.
250
+ */
251
+ function displayOptionsAndCommands() {
252
+ console.log(program.helpInformation());
253
+ }
254
+
255
+ /**
256
+ * Main function to handle the CLI interactions.
257
+ * Continuously prompts the user for actions until an exit command is given.
258
+ */
259
+ async function main() {
260
+ welcomeToMe();
261
+ let exit = false;
262
+ while (!exit) {
263
+ const choice = await getUserChoice();
264
+ switch (choice) {
265
+ case 'View Existing Profiles':
266
+ console.log('Existing profiles will be displayed here.');
267
+ break;
268
+ case 'Create New Profile':
269
+ const meObject = await getNewProfileDetails();
270
+ writeMeObjectToFile(meObject);
271
+ break;
272
+ case 'Exit':
273
+ console.log('Exiting .me CLI.');
274
+ exit = true;
275
+ break;
276
+ default:
277
+ console.log('Invalid choice. Please try again.');
278
+ }
279
+ }
280
+ }
281
+
282
+ if (process.argv.length > 2) {
283
+ program.parse(process.argv);
284
+ } else {
285
+ main();
286
+ }
287
+
288
+ // Error handling for CLI
289
+ process.on('uncaughtException', (err) => {
290
+ console.error('An error occurred in the CLI:', err.message);
291
+ process.exit(1);
292
+ });
293
+
294
+
295
+ </code></pre>
296
+ </article>
297
+ </section>
298
+
299
+
300
+
301
+
302
+ </div>
303
+
304
+ <footer class="footer">
305
+ <div class="content has-text-centered">
306
+ <p>
307
+ <style>
308
+ .center-div {
309
+ display: flex;
310
+ justify-content: center;
311
+ align-items: center;
312
+ height: 89px;
313
+ }
314
+
315
+ img {
316
+ max-width: 100%;
317
+ max-height: 100%;
318
+ }
319
+ </style>
320
+ <div class="center-div">
321
+ <img src="https://suign.github.io/neurons.me/neurons_logo.png" alt="Witness our Seal.">
322
+ </div>
323
+ <a href="http://neurons.me" target="_blank">neurons.me</a>
324
+ </p>
325
+ </div>
326
+ </footer>
327
+
328
+ </div>
329
+ <div id="side-nav" class="side-nav">
330
+ </div>
331
+ </div>
332
+ <script src="scripts/app.min.js"></script>
333
+ <script>PR.prettyPrint();</script>
334
+ <script src="scripts/linenumber.js"> </script>
335
+
336
+ <script src="scripts/search.js"> </script>
337
+
338
+
339
+ </body>
340
+ </html>