Skip to content

Commit 949b848

Browse files
authored
Beta (#104)
BETA SYNC
1 parent 3d42738 commit 949b848

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+1834
-628
lines changed

.prettierrc

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
11
{
2-
"trailingComma": "es5"
2+
"trailingComma": "es5",
3+
"printWidth": 80,
4+
"tabWidth": 2,
5+
"useTabs": false,
6+
"semi": true,
7+
"singleQuote": true,
8+
"bracketSpacing": true,
9+
"arrowParens": "avoid",
10+
"endOfLine": "lf"
311
}

components/certificate/certificate.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@ import {
66
isArray,
77
isBuffer,
88
isNumber,
9-
untilTrueArray
9+
untilTrueArray,
1010
} from '@universalweb/acid';
1111
import { encode, encodeStrict } from '#utilities/serialize';
1212
import {
1313
getCipher,
1414
getCiphers,
1515
getKeyExchangeAlgorithm,
16-
getSignatureAlgorithm
16+
getSignatureAlgorithm,
1717
} from '#crypto/index.js';
1818
import dis from '#components/dis/index';
1919
import { resolve } from 'path';
@@ -128,7 +128,7 @@ export class Certificate {
128128
const saved = await this.saveToFile({
129129
certificate: await this.encode(),
130130
savePath,
131-
certificateName
131+
certificateName,
132132
});
133133
return saved;
134134
}
@@ -137,7 +137,7 @@ export class Certificate {
137137
const saved = await this.saveToFile({
138138
certificate,
139139
savePath,
140-
certificateName
140+
certificateName,
141141
});
142142
return saved;
143143
}

components/certificate/domain.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import {
99
isPlainObject,
1010
isString,
1111
merge,
12-
promise
12+
promise,
1313
} from '@universalweb/acid';
1414
import { decode, encodeStrict } from '#utilities/serialize';
1515
import { getCipher, getKeyExchangeAlgorithm, getSignatureAlgorithm } from '#crypto/index.js';
@@ -44,7 +44,7 @@ export async function createDomainCertificateObject(config = {}, options = {}) {
4444
protocolOptions,
4545
start = currentDate.getTime(),
4646
end = currentDate.setUTCMonth(currentDate.getUTCMonth() + 3),
47-
keyExchangeAlgorithm = 0
47+
keyExchangeAlgorithm = 0,
4848
} = config;
4949
const certificate = {
5050
version,
@@ -53,7 +53,7 @@ export async function createDomainCertificateObject(config = {}, options = {}) {
5353
start,
5454
end,
5555
certificateType,
56-
keyExchangeAlgorithm
56+
keyExchangeAlgorithm,
5757
};
5858
if (ownerHash) {
5959
certificate.ownerHash = ownerHash;
@@ -121,10 +121,10 @@ export function objectToRawDomainCertificate(certificateObject) {
121121
certificate[4] = ownerHash;
122122
certificate[5] = [
123123
[
124-
signatureAlgorithm, signatureKeypair.publicKey, signatureKeypair.privateKey
124+
signatureAlgorithm, signatureKeypair.publicKey, signatureKeypair.privateKey,
125125
],
126126
[
127-
keyExchangeAlgorithm, keyExchangeKeypair.publicKey, keyExchangeKeypair.privateKey
127+
keyExchangeAlgorithm, keyExchangeKeypair.publicKey, keyExchangeKeypair.privateKey,
128128
],
129129
];
130130
if (hasValue(ciphers)) {
@@ -183,7 +183,7 @@ export async function rawToObjectDomainCertificate(rawObject, selfSignature, sig
183183
};
184184
if (isArray(signatureKeypair)) {
185185
certificate.signatureKeypair = {
186-
publicKey: signatureKeypair[1]
186+
publicKey: signatureKeypair[1],
187187
};
188188
certificate.signatureAlgorithm = signatureKeypair[0];
189189
if (signatureKeypair[2]) {
@@ -211,7 +211,7 @@ export async function rawToObjectDomainCertificate(rawObject, selfSignature, sig
211211
if (protocolOptions) {
212212
const [
213213
protocolVersion,
214-
realtime
214+
realtime,
215215
] = protocolOptions;
216216
certificate.protocolOptions = {};
217217
if (hasValue(protocolVersion)) {

components/certificate/keychain.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ import { toBase64 } from '#utilities/cryptography/utils';
55
export const keychainService = 'UniversalWeb';
66
export async function keychainGetPromise(account, accept, reject) {
77
console.log('Keychain Account', account);
8-
keychain.getPassword({
8+
await keychain.getPassword({
99
account,
10-
service: keychainService
10+
service: keychainService,
1111
}, async (err, data) => {
1212
if (err) {
1313
return console.log(`Keychain couldn't locate record`, err);
@@ -28,11 +28,11 @@ export async function keychainCallback(config, accept, reject) {
2828
config.password = await encodeStrict(config.password);
2929
}
3030
const password = toBase64(config.password);
31-
keychain.setPassword({
31+
await keychain.setPassword({
3232
account: config.account,
3333
service: keychainService,
3434
type: 'generic',
35-
password
35+
password,
3636
}, (err) => {
3737
if (err) {
3838
return console.log('Keychain Access Save Failed', err);

components/cryptoID/index.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@ import {
2222
} from '#utilities/logs/classLogMethods';
2323
import { read, readStructured, write } from '#utilities/file';
2424
import { cryptoIDVersion } from '#components/cryptoID/defaults';
25+
import { getHomeDirectory } from '#utilities/directory';
2526
import path from 'node:path';
27+
import { toBase64Url } from '#crypto/utils.js';
2628
import viat from '#crypto/cipherSuite/viat.js';
2729
export class CryptoID {
2830
constructor(config, optionalArg) {
@@ -200,6 +202,11 @@ export class CryptoID {
200202
// console.log('FILE WRITE', fullPath, binaryData, encryptionPassword);
201203
return write(fullPath, binaryData, 'binary', true);
202204
}
205+
async save(fileLocationArg, fileNameArg, encryptionPassword, encoding) {
206+
const fileLocation = (fileLocationArg) ? fileLocationArg : await getHomeDirectory();
207+
const fileName = (fileNameArg) ? fileNameArg : await this.getAddressString(encoding);
208+
return this.saveToFile(fileName, fileLocation, encryptionPassword);
209+
}
203210
async importFile(filePath, encryptionPassword) {
204211
const data = await readStructured(filePath);
205212
if (data) {
@@ -262,6 +269,10 @@ export class CryptoID {
262269
const address = this.address || await this.generateAddress();
263270
return address;
264271
}
272+
async getAddressString(encoding) {
273+
const address = await this.getAddress();
274+
return (encoding) ? address.toString(encoding) : toBase64Url(address);
275+
}
265276
setAlias(value) {
266277
this.alias = value;
267278
}

docs/README.md

Lines changed: 85 additions & 70 deletions
Large diffs are not rendered by default.

docs/content.html

Lines changed: 85 additions & 70 deletions
Large diffs are not rendered by default.

docs/index.css

Lines changed: 75 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,119 +1,135 @@
11
:root {
2-
--font-sans: "0xProto Nerd Font";
3-
--font-mono: "ProggyClean CE Nerd Font";
4-
--bg-color: #121212;
5-
--text-color: #e0e0e0;
6-
--accent-color: #00bcd4;
7-
--secondary-accent: #f50057;
8-
--heading-size: 1.5rem;
9-
--subheading-size: 1.15rem;
10-
--paragraph-size: 1rem;
11-
--header-border: rgba(255, 255, 255, 0.1);
12-
--max-width: 65ch;
2+
--font-sans: '0xProto Nerd Font';
3+
--font-mono: 'ProggyClean CE Nerd Font';
4+
--bg-color: #121212;
5+
--text-color: #e0e0e0;
6+
--accent-color: #00bcd4;
7+
--secondary-accent: #f50057;
8+
--heading-size: 1.5rem;
9+
--subheading-size: 1.15rem;
10+
--paragraph-size: 1rem;
11+
--header-border: rgba(255, 255, 255, 0.1);
12+
--max-width: 70ch;
1313
}
1414

1515
html,
1616
body {
17-
margin: 0;
18-
padding: 0;
19-
background-color: var(--bg-color);
20-
color: var(--text-color);
21-
font-family: var(--font-sans);
22-
line-height: 1.6;
17+
margin: 0;
18+
padding: 0;
19+
background-color: var(--bg-color);
20+
color: var(--text-color);
21+
font-family: var(--font-sans);
22+
line-height: 1.62;
2323
}
2424

2525
.content {
26-
position: relative;
27-
z-index: 1;
28-
max-width: var(--max-width);
29-
margin: 2rem auto;
30-
padding: 1rem;
26+
box-shadow: 0px 10px 25px rgba(0, 0, 0.1);
27+
border: 1px inset rgba(255, 255, 255, 0.2);
28+
border-radius: 8px;
29+
backdrop-filter: blur(10px);
30+
position: relative;
31+
z-index: 1;
32+
max-width: var(--max-width);
33+
margin: 3.2rem auto;
34+
padding: 1.5rem;
35+
background: rgba(0, 0, 0, 0.2);
36+
}
37+
38+
h3.mono a,h4.mono a, h5.mono a, h6.mono a {
39+
letter-spacing: 2px;
40+
padding: 2px;
41+
font-size: 1.2rem;
42+
}
43+
44+
h4.mono {
45+
border-bottom: 1px solid rgba(255, 255, 255, 0.1);
46+
font-size: 1.4rem;
3147
}
3248

3349
#particle-canvas {
34-
position: fixed;
35-
z-index: 0;
36-
top: 0;
37-
left: 0;
38-
width: 100%;
39-
height: 100%;
40-
display: block;
50+
position: fixed;
51+
z-index: 0;
52+
top: 0;
53+
left: 0;
54+
width: 100%;
55+
height: 100%;
56+
display: block;
4157
}
4258
h1,
4359
h2,
4460
h3,
4561
h4,
4662
h5,
4763
h6 {
48-
margin: 1.5rem 0 0.5rem;
49-
font-weight: 600;
50-
line-height: 1.2;
64+
margin: 1.5rem 0 0.5rem;
65+
font-weight: 600;
66+
line-height: 1.62;
5167
}
5268

5369
h1 {
54-
font-size: 2rem;
55-
text-align: center;
56-
border-bottom: 2px solid var(--header-border);
57-
padding-bottom: 0.5rem;
58-
margin-bottom: 1rem;
70+
font-size: 2rem;
71+
text-align: center;
72+
border-bottom: 2px solid var(--header-border);
73+
padding-bottom: 0.5rem;
74+
margin-bottom: 1rem;
5975
}
6076

6177
h4,
6278
h5,
6379
h6 {
64-
font-size: var(--subheading-size);
80+
font-size: var(--subheading-size);
6581
}
6682

6783
p,
6884
ul,
6985
li,
7086
a,
7187
small {
72-
font-size: var(--paragraph-size);
73-
margin-bottom: 1rem;
88+
font-size: var(--paragraph-size);
89+
margin-bottom: 1rem;
7490
}
7591

7692
a {
77-
color: var(--accent-color);
78-
text-decoration: none;
79-
border-bottom: 1px solid var(--accent-color);
93+
color: var(--accent-color);
94+
text-decoration: none;
95+
border-bottom: 1px solid var(--accent-color);
8096
}
8197

8298
a:hover {
83-
background-color: var(--secondary-accent);
84-
color: #ffffff;
99+
background-color: var(--secondary-accent);
100+
color: #ffffff;
85101
}
86102

87103
.mono {
88-
font-family: var(--font-mono);
89-
font-size: var(--paragraph-size);
104+
font-family: var(--font-mono);
105+
font-size: var(--paragraph-size);
90106
}
91107

92108
img.header {
93-
border-radius: 8px;
94-
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
95-
margin-bottom: 1rem;
109+
border-radius: 8px;
110+
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
111+
margin-bottom: 1rem;
96112
}
97113

98114
hr {
99-
border: none;
100-
border-top: 1px solid var(--header-border);
101-
margin: 2rem 0;
115+
border: none;
116+
border-top: 1px solid var(--header-border);
117+
margin: 2rem 0;
102118
}
103119

104120
ul {
105-
padding-left: 1.5rem;
106-
list-style: disc;
121+
padding-left: 1.5rem;
122+
list-style: disc;
107123
}
108124

109-
[align="center"] {
110-
text-align: center;
125+
[align='center'] {
126+
text-align: center;
111127
}
112128

113129
small {
114-
color: rgba(255, 255, 255, 0.6);
130+
color: rgba(255, 255, 255, 0.6);
115131
}
116132

117133
.bold {
118-
font-weight: 700;
134+
font-weight: 700;
119135
}

0 commit comments

Comments
 (0)