Skip to content

Commit

Permalink
send cleanup
Browse files Browse the repository at this point in the history
new dependencies for new crypto options
  • Loading branch information
Universal Web committed Jun 9, 2023
1 parent 8d6b032 commit b6b6990
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 13 deletions.
23 changes: 23 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"@babel/eslint-parser": "^7.19.1",
"@babel/preset-env": "^7.20.2",
"@microsoft/eslint-formatter-sarif": "^3.0.0",
"@noble/curves": "^1.1.0",
"@rollup/plugin-terser": "^0.4.0",
"@universalweb/acid": "^3.0.39",
"@universalweb/docredux": "^3.2.2",
Expand Down
2 changes: 1 addition & 1 deletion scripts/certificates.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const domainProfile = createProfile({
version: 1,
// Crypto can be explicit or use shorthand like this algo: 'default' The default is listed below
// Encryption algorithm must be an AEAD algorithm (Authenticated Encryption with Associated Data) such as xchacha20poly1305
// AES, SHA, MD5, RSA are not permitted
// AES (please God no xchacha exists), SHA (fine if found essential to an existing algorithm but not as a standalone function), MD5 (Not for crypto), RSA (Just stop using RSA) are not permitted
cryptography: {
aead: 'xchacha20poly1305',
hash: 'blake2b',
Expand Down
14 changes: 7 additions & 7 deletions udsp/client/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,13 +129,6 @@ export class Client {
this.destination.connectionIdKeypair = this.keypair;
}
}
connect = clientConnect;
send = send;
request = request;
processMessage = processMessage;
emit = emit;
onListening = onListening;
onMessage = onMessage;
async attachEvents() {
const thisClient = this;
this.server.on('error', (err) => {
Expand Down Expand Up @@ -179,6 +172,13 @@ export class Client {
this.server.close();
Client.connections.delete(this.id);
}
connect = clientConnect;
send = send;
request = request;
processMessage = processMessage;
emit = emit;
onListening = onListening;
onMessage = onMessage;
destination = {};
autoConnect = true;
type = 'client';
Expand Down
6 changes: 1 addition & 5 deletions udsp/server/clients/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,17 +47,13 @@ export class Client {
updateState(state) {
this.state = state;
}
async sendPacket(packet) {
async send(packet) {
msgSent(`socket Sent -> ID: ${this.id}`);
const config = {
source: this,
packet
};
return sendPacket(config);
// await this.server().clientEvent('send', this);
}
async send(packetConfig) {
return this.sendPacket(packetConfig);
}
async received(message, frameHeaders) {
const server = this.server();
Expand Down
16 changes: 16 additions & 0 deletions utilities/cryptography.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { secp256k1, schnorr } from '@noble/curves/secp256k1';
import {
ed25519, ed25519ph, ed25519ctx, x25519, RistrettoPoint
} from '@noble/curves/ed25519';
import {
ed448, ed448ph, ed448ctx, x448
} from '@noble/curves/ed448';
import { p256 } from '@noble/curves/p256';
import { p384 } from '@noble/curves/p384';
import { p521 } from '@noble/curves/p521';
import { pallas, vesta } from '@noble/curves/pasta';
import { bls12_381 } from '@noble/curves/bls12-381';
import { bn254 } from '@noble/curves/bn254';
import { jubjub } from '@noble/curves/jubjub';
// Add all curves as options with a few exceptions
// Supply middleware to efficiently handle the different curves

0 comments on commit b6b6990

Please sign in to comment.