this.me 2.8.2 → 2.8.3
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 +14 -5
- package/index.js +13 -4
- package/jsdoc.json +21 -13
- package/nino.js +2 -0
- package/package.json +3 -7
- package/src/cli/CLI.md +20 -0
- package/src/cli/shell.js +64 -11
- package/src/hash.js +24 -0
- package/src/me.html +0 -19
- package/src/me.js +6 -4
- package/src/searchImages.js +31 -0
- package/docs/Me.html +0 -697
- package/docs/README.md +0 -53
- package/docs/global.html +0 -890
- package/docs/index.html +0 -208
- package/docs/index.js.html +0 -169
- package/docs/module-00-Index.html +0 -243
- package/docs/module-CLI.html +0 -354
- package/docs/scripts/app.min.js +0 -1
- package/docs/scripts/linenumber.js +0 -26
- package/docs/scripts/search.js +0 -39
- package/docs/src_cli_ishell_shell.js.html +0 -305
- package/docs/src_cli_main.js.html +0 -241
- package/docs/src_me.js.html +0 -211
- package/docs/styles/app.min.css +0 -1
- package/docs/styles/iframe.css +0 -13
- package/docs/styles/prettify-jsdoc.css +0 -111
- package/docs/styles/prettify-tomorrow.css +0 -132
- package/docs/styles/reset.css +0 -44
- package/docs/this.me.png +0 -0
- package/src/os/unix/install_me.sh +0 -5
- package/src/this/dir.js +0 -0
- package/src/this/file.js +0 -0
- package/src/this/url.js +0 -0
- package/src/this/video.js +0 -0
package/README.md
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
# This.Me
|
|
2
|
+
<img src="./cleak_me-removebg.png" alt="SVG Image" style="width:89px;">
|
|
2
3
|
<img src="./this.me.png" alt="SVG Image" style="width:89px;">
|
|
3
4
|
|
|
4
|
-
**This.Me**
|
|
5
|
+
**This.Me** defines a digital identity through a cryptographic lens. Each user is equipped with a unique **'Me'** identity, secured by public-private key cryptography, enabling robust autonomous identity verification and transactional security.
|
|
5
6
|
|
|
6
|
-
**This.Me**
|
|
7
|
+
**This.Me** incorporates hashing for unimpeachable data integrity and digital signatures for undeniable authenticity. Users gain unparalleled control over their digital footprint, marking a shift towards a user-centric model of data management.
|
|
7
8
|
|
|
8
9
|
In essence, **This.Me** grants users a self-sovereign digital identity, fully within their control and independent from external entities.
|
|
9
10
|
|
|
10
11
|
### CLI Usage:
|
|
11
|
-
|
|
12
12
|
Install globally to use `this.me` as a CLI tool:
|
|
13
13
|
|
|
14
14
|
```js
|
|
@@ -36,7 +36,15 @@ const identityObject = user.getIdentityObject();
|
|
|
36
36
|
|
|
37
37
|
## Core Principles
|
|
38
38
|
|
|
39
|
-
- The `Me` class encapsulates personal information
|
|
39
|
+
- The `Me` class encapsulates personal information:
|
|
40
|
+
|
|
41
|
+
name,
|
|
42
|
+
last name,
|
|
43
|
+
birthday,
|
|
44
|
+
password,
|
|
45
|
+
PIN
|
|
46
|
+
|
|
47
|
+
This serves as the identity representation in our system.
|
|
40
48
|
|
|
41
49
|
The `all.this` collection of packages, along with the proposed `cleaker` functionality, is an approach to create a modular system where each module (like `this.text`, `this.video`, `this.img`, etc.) (all.this family) represents a distinct data structure or class. These modules, when combined with `cleaker`, generate unique **public and private key pairs**, essentially giving each instance its cryptographic identity.
|
|
42
50
|
|
|
@@ -54,4 +62,5 @@ Defining the **environment** and context in which your code runs, especially whe
|
|
|
54
62
|
|
|
55
63
|
Having a clear declaration of the environment and the context can have a series of implications for security, interoperability, and clarity. The codebase is often vast, dynamic, and continually evolving. Given the dynamic nature of such environments, ensuring the integrity of the code and data becomes paramount. You wouldn't want an agent to execute or rely on code that has been tampered with or is different from the expected version. This is where hashing comes into play.
|
|
56
64
|
|
|
57
|
-
`.me` objects to serve as both a local identity on the user's host machine and as an identity within a larger network. When a `.me` object is authenticated on a network, it can access data not only on the local host but also from other nodes within that network. Conversely, if it's not authenticated or recognized by the network, it should only access local data.
|
|
65
|
+
`.me` objects to serve as both a local identity on the user's host machine and as an identity within a larger network. When a `.me` object is authenticated on a network, it can access data not only on the local host but also from other nodes within that network. Conversely, if it's not authenticated or recognized by the network, it should only access local data.
|
|
66
|
+
|
package/index.js
CHANGED
|
@@ -1,6 +1,15 @@
|
|
|
1
|
+
//index.js
|
|
1
2
|
/**
|
|
2
|
-
* @module
|
|
3
|
+
* @module This.Me
|
|
3
4
|
* @description
|
|
4
|
-
* .Me
|
|
5
|
-
*
|
|
6
|
-
*
|
|
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.*/
|
|
10
|
+
|
|
11
|
+
// index.js in the `this.me` package
|
|
12
|
+
export { default } from './src/me.js';
|
|
13
|
+
console.log('this.me loaded successfully.');
|
|
14
|
+
// this.me/index.js
|
|
15
|
+
export { shell } from './src/cli/shell.js';
|
package/jsdoc.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"source": {
|
|
3
|
-
"include": ["./src", "./index.js", "./src/cli", "./src/cli/commands
|
|
3
|
+
"include": ["./src", "./index.js", "./src/cli", "./src/cli/commands.js", "./src/cli/shell.js"]
|
|
4
4
|
},
|
|
5
5
|
"opts": {
|
|
6
6
|
"destination": "./docs",
|
|
7
|
-
"template": "
|
|
7
|
+
"template": "../../../../../Sandbox/dev_tools/assets/better-docs",
|
|
8
8
|
"readme": "./README.md"
|
|
9
9
|
},
|
|
10
10
|
"templates": {
|
|
@@ -24,18 +24,26 @@
|
|
|
24
24
|
"hideGenerator": false,
|
|
25
25
|
"navLinks": [
|
|
26
26
|
{
|
|
27
|
-
"label": "
|
|
27
|
+
"label": "All.This",
|
|
28
28
|
"href": "https://suign.github.io/all.this/"
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
"label": "@Source",
|
|
32
|
+
"href": "https://suign.github.io/"
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"label": "Github",
|
|
36
|
+
"href": "https://github.com/suiGn/cleaker"
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"label": "Cleaker.me",
|
|
40
|
+
"href": "https://cleaker.me"
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
"label": "What is all.this?",
|
|
44
|
+
"href": "https://www.neurons.me/this"
|
|
45
|
+
}
|
|
38
46
|
]
|
|
39
|
-
|
|
47
|
+
}
|
|
40
48
|
}
|
|
41
49
|
}
|
package/nino.js
ADDED
package/package.json
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "this.me",
|
|
3
|
-
"version": "2.8.
|
|
4
|
-
"description": "User-Centric
|
|
5
|
-
"bin": {
|
|
6
|
-
".me": "./src/cli/main.js"
|
|
7
|
-
},
|
|
3
|
+
"version": "2.8.3",
|
|
4
|
+
"description": "User-Centric.",
|
|
8
5
|
"type": "module",
|
|
9
6
|
"main": "index.js",
|
|
10
7
|
"scripts": {
|
|
@@ -30,7 +27,6 @@
|
|
|
30
27
|
"repoType": "NPM Package",
|
|
31
28
|
"dependencies": {
|
|
32
29
|
"commander": "^11.1.0",
|
|
33
|
-
"inquirer": "^9.2.12"
|
|
34
|
-
"taffydb": "^2.7.3"
|
|
30
|
+
"inquirer": "^9.2.12"
|
|
35
31
|
}
|
|
36
32
|
}
|
package/src/cli/CLI.md
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
Main CLI Application (main.ts)
|
|
2
|
+
|
|
3
|
+
This is the entry point for your CLI application.
|
|
4
|
+
It displays a welcome message and user information (host session and path).
|
|
5
|
+
It imports the CLI commands (commands.ts) and the interactive shell (shell.ts).
|
|
6
|
+
CLI Commands (commands.ts)
|
|
7
|
+
|
|
8
|
+
This part defines the CLI commands and options using the commander package.
|
|
9
|
+
Currently, it defines the commands: 'View Existing Profiles,' 'Create New Profile,' and 'Exit.'
|
|
10
|
+
Interactive Shell (shell.ts)
|
|
11
|
+
|
|
12
|
+
The interactive shell provides a user-friendly interface for interacting with the CLI.
|
|
13
|
+
selectMe: Presents a list of actions for the user to choose from.
|
|
14
|
+
createMe: Prompts the user for details to create a new Me profile.
|
|
15
|
+
writeMe: Writes the Me profile to the filesystem.
|
|
16
|
+
listMeProfiles: Lists all existing Me profiles.
|
|
17
|
+
selectProfile: Prompts the user to select a Me profile or go back to the main menu.
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
package/src/cli/shell.js
CHANGED
|
@@ -2,7 +2,7 @@ import inquirer from 'inquirer';
|
|
|
2
2
|
import path from 'path';
|
|
3
3
|
import os from 'os';
|
|
4
4
|
import fs from 'fs';
|
|
5
|
-
import Me from '
|
|
5
|
+
import Me from 'this.me';
|
|
6
6
|
|
|
7
7
|
/***Interactive Shell:
|
|
8
8
|
* Leverages the `inquirer` package to provide an interactive shell experience with prompts.
|
|
@@ -94,7 +94,7 @@ async function selectMe() {
|
|
|
94
94
|
// Encrypting the data here before writing to the filesystem
|
|
95
95
|
//fs.writeFileSync(filePath, JSON.stringify(meProfile.getIdentityObject()));
|
|
96
96
|
//console.log('Profile created successfully.');
|
|
97
|
-
fs.writeFileSync(filePath, JSON.stringify(meProfile.
|
|
97
|
+
fs.writeFileSync(filePath, JSON.stringify(meProfile.getMe()));
|
|
98
98
|
console.log('Profile created successfully.');
|
|
99
99
|
}
|
|
100
100
|
|
|
@@ -113,31 +113,84 @@ async function selectMe() {
|
|
|
113
113
|
return [];
|
|
114
114
|
}
|
|
115
115
|
}
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Asks the user to verify their PIN.
|
|
119
|
+
* @param {Object} profile - The user's profile object containing their data, including the PIN.
|
|
120
|
+
* @returns {Promise<string>} Returns 'success' if the PIN is correct, 'back' to return to the previous menu.
|
|
121
|
+
*/
|
|
122
|
+
async function verifyPin(profile) {
|
|
123
|
+
while (true) {
|
|
124
|
+
const answer = await inquirer.prompt([{
|
|
125
|
+
type: 'password',
|
|
126
|
+
name: 'pin',
|
|
127
|
+
message: 'Enter your PIN to proceed:',
|
|
128
|
+
}]);
|
|
129
|
+
|
|
130
|
+
if (answer.pin === profile.pin) {
|
|
131
|
+
// Correct PIN
|
|
132
|
+
//console.log('Profile Data:', profile);
|
|
133
|
+
console.log(`Welcome ${profile.name}!`);
|
|
134
|
+
return 'success';
|
|
135
|
+
} else {
|
|
136
|
+
// Incorrect PIN
|
|
137
|
+
console.log('Incorrect PIN.');
|
|
138
|
+
const retryChoice = await inquirer.prompt([{
|
|
139
|
+
type: 'list',
|
|
140
|
+
name: 'action',
|
|
141
|
+
message: 'What would you like to do?',
|
|
142
|
+
choices: ['Try Again', 'Go Back']
|
|
143
|
+
}]);
|
|
144
|
+
if (retryChoice.action === 'Go Back') {
|
|
145
|
+
return 'back';
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
116
150
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
151
|
+
/**
|
|
152
|
+
* Allows the user to select a .me profile from a list or go back to the main menu.
|
|
153
|
+
* After selecting a profile, the user is asked to verify their PIN.
|
|
154
|
+
* @returns {Promise<Object|string>} Returns the selected profile object upon successful PIN verification, or 'back' to indicate returning to the main menu.
|
|
155
|
+
*/
|
|
156
|
+
async function selectProfile() {
|
|
122
157
|
const profiles = listMeProfiles();
|
|
123
158
|
if (profiles.length === 0) {
|
|
124
159
|
console.log('No profiles found.');
|
|
125
160
|
return 'back';
|
|
126
161
|
}
|
|
127
|
-
|
|
162
|
+
|
|
128
163
|
const choices = profiles.map(file => ({
|
|
129
164
|
name: path.basename(file, '.me'),
|
|
130
165
|
value: file
|
|
131
166
|
})).concat([{ name: 'Go Back to Main Menu', value: 'back' }]);
|
|
132
|
-
|
|
167
|
+
|
|
133
168
|
const answer = await inquirer.prompt([{
|
|
134
169
|
type: 'list',
|
|
135
170
|
name: 'selectedProfile',
|
|
136
171
|
message: 'Select a profile to view or go back:',
|
|
137
172
|
choices: choices
|
|
138
173
|
}]);
|
|
139
|
-
|
|
140
|
-
|
|
174
|
+
|
|
175
|
+
if (answer.selectedProfile === 'back') {
|
|
176
|
+
return 'back';
|
|
177
|
+
} else {
|
|
178
|
+
const profileData = fs.readFileSync(answer.selectedProfile, 'utf8');
|
|
179
|
+
const profile = JSON.parse(profileData);
|
|
180
|
+
|
|
181
|
+
const pinVerified = await verifyPin(profile);
|
|
182
|
+
if (!pinVerified) {
|
|
183
|
+
console.log('PIN verification failed. Returning to main menu.');
|
|
184
|
+
return 'back';
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
// After successful PIN verification, proceed to a different section of the CLI.
|
|
188
|
+
// ... Transition to different CLI section logic goes here ...
|
|
189
|
+
|
|
190
|
+
return profile; // Return the profile data for further processing if needed.
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
|
|
141
194
|
|
|
142
195
|
export const shell = {
|
|
143
196
|
selectMe,
|
package/src/hash.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
const crypto = require('crypto');
|
|
2
|
+
|
|
3
|
+
function generateKeyPair() {
|
|
4
|
+
const { publicKey, privateKey } = crypto.generateKeyPairSync('rsa', {
|
|
5
|
+
modulusLength: 2048,
|
|
6
|
+
publicKeyEncoding: {
|
|
7
|
+
type: 'spki',
|
|
8
|
+
format: 'pem',
|
|
9
|
+
},
|
|
10
|
+
privateKeyEncoding: {
|
|
11
|
+
type: 'pkcs8',
|
|
12
|
+
format: 'pem',
|
|
13
|
+
},
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
// Store the keys securely (e.g., in files or secure storage).
|
|
17
|
+
|
|
18
|
+
return { publicKey, privateKey };
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
// Example usage:
|
|
22
|
+
const { publicKey, privateKey } = generateKeyPair();
|
|
23
|
+
console.log('Public Key:', publicKey);
|
|
24
|
+
console.log('Private Key:', privateKey);
|
package/src/me.html
CHANGED
|
@@ -4,24 +4,5 @@
|
|
|
4
4
|
</head>
|
|
5
5
|
<body>
|
|
6
6
|
Hello, me!
|
|
7
|
-
<script>
|
|
8
|
-
window.fbAsyncInit = function() {
|
|
9
|
-
FB.init({
|
|
10
|
-
appId : '{your-app-id}',
|
|
11
|
-
cookie : true,
|
|
12
|
-
xfbml : true,
|
|
13
|
-
version : '{api-version}'
|
|
14
|
-
});
|
|
15
|
-
FB.AppEvents.logPageView();
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
(function(d, s, id){
|
|
19
|
-
var js, fjs = d.getElementsByTagName(s)[0];
|
|
20
|
-
if (d.getElementById(id)) {return;}
|
|
21
|
-
js = d.createElement(s); js.id = id;
|
|
22
|
-
js.src = "https://connect.facebook.net/en_US/sdk.js";
|
|
23
|
-
fjs.parentNode.insertBefore(js, fjs);
|
|
24
|
-
}(document, 'script', 'facebook-jssdk'));
|
|
25
|
-
</script>
|
|
26
7
|
</body>
|
|
27
8
|
</html>
|
package/src/me.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
//src/me.js
|
|
1
2
|
/**
|
|
2
3
|
* Represents a user identity in the this.me system.
|
|
3
4
|
*/
|
|
@@ -30,16 +31,17 @@ class Me {
|
|
|
30
31
|
}
|
|
31
32
|
|
|
32
33
|
/**
|
|
33
|
-
* Prepares and returns the identity object for hashing.
|
|
34
|
-
* @returns {Object} The identity object with user data.
|
|
34
|
+
* Prepares and returns the identity object for hashing .me.
|
|
35
|
+
* @returns {Object} The identity object (.me) with user data.
|
|
35
36
|
*/
|
|
36
|
-
|
|
37
|
+
getMe() {
|
|
37
38
|
this.validateData();
|
|
38
39
|
return {
|
|
39
40
|
name: this.name,
|
|
40
41
|
lastname: this.lastname,
|
|
41
42
|
birthday: this.birthday,
|
|
42
|
-
|
|
43
|
+
password: this.password, // Password as a separate field
|
|
44
|
+
pin: this.pin // Pin as a separate field
|
|
43
45
|
};
|
|
44
46
|
}
|
|
45
47
|
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Filters and displays images based on the user's search input.
|
|
3
|
+
* It searches through the filenames of the images in each gallery.
|
|
4
|
+
* The function is case-insensitive and matches any part of the filename.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* // Assuming there's an input field with id 'searchInput' and images in galleries.
|
|
8
|
+
* // User types 'example' in the search input.
|
|
9
|
+
* searchImages();
|
|
10
|
+
* // Images with 'example' in their filenames will be displayed.
|
|
11
|
+
*/
|
|
12
|
+
function searchImages() {
|
|
13
|
+
var input, filter, gallery, img, src, i;
|
|
14
|
+
input = document.getElementById("searchInput");
|
|
15
|
+
filter = input.value.toUpperCase();
|
|
16
|
+
gallery = document.getElementsByClassName("gallery");
|
|
17
|
+
|
|
18
|
+
for (var g = 0; g < gallery.length; g++) {
|
|
19
|
+
img = gallery[g].getElementsByTagName("img");
|
|
20
|
+
|
|
21
|
+
for (i = 0; i < img.length; i++) {
|
|
22
|
+
src = img[i].src;
|
|
23
|
+
var fileName = src.substring(src.lastIndexOf('/') + 1);
|
|
24
|
+
if (fileName.toUpperCase().indexOf(filter) > -1) {
|
|
25
|
+
img[i].style.display = "";
|
|
26
|
+
} else {
|
|
27
|
+
img[i].style.display = "none";
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|