@hive-p2p/browser 1.0.74 → 1.0.76

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.
@@ -3,7 +3,7 @@ import { SIMULATION, NODE, IDENTITY, GOSSIP, UNICAST, LOG_CSS } from './config.m
3
3
  import { GossipMessage } from './gossip.mjs';
4
4
  import { DirectMessage, ReroutedDirectMessage } from './unicast.mjs';
5
5
  import { Converter } from '../services/converter.mjs';
6
- import { ed25519, x25519, chacha20poly1305, randomBytes , Argon2Unified } from '../services/cryptos.mjs'; // now exposed in full and browser builds
6
+ import { ed25519, x25519, chacha20poly1305, randomBytes, Argon2Unified } from '../services/cryptos.mjs'; // now exposed in full and browser builds
7
7
  import { concatBytes } from '@noble/ciphers/utils.js';
8
8
 
9
9
  export class CryptoCodex {
@@ -27,10 +27,11 @@ export class CryptoCodex {
27
27
  for (let i = 0; i < IDENTITY.ID_LENGTH; i++) this.publicKey[i] = idBytes[i];
28
28
  }
29
29
 
30
- /** @param {boolean} asPublicNode Default: false @param {Uint8Array} seed PrivateKey *-optional* */
30
+ /** @param {boolean} asPublicNode Default: false @param {Uint8Array | string} seed 32 bytes PrivateKey *-optional* */
31
31
  static async createCryptoCodex(asPublicNode, seed) {
32
32
  const cryptoCodex = new CryptoCodex(undefined, this.verbose);
33
- await cryptoCodex.generate(asPublicNode, seed);
33
+ const seedBytes = !seed ? undefined : (typeof seed === 'string' ? cryptoCodex.converter.hexToBytes(seed) : seed);
34
+ await cryptoCodex.generate(asPublicNode, seedBytes);
34
35
  return cryptoCodex;
35
36
  }
36
37
 
package/core/node.mjs CHANGED
@@ -26,11 +26,9 @@ export async function createPublicNode(options = {}) {
26
26
 
27
27
  await clockSync;
28
28
  const node = new Node(codex, options.bootstraps || [], verbose);
29
- if (domain) {
30
- node.services = new NodeServices(codex, node.peerStore, undefined, verbose);
31
- node.services.start(domain, options.port || SERVICE.PORT);
32
- node.topologist.services = node.services;
33
- }
29
+ node.services = new NodeServices(codex, node.peerStore, undefined, verbose);
30
+ node.services.start(domain, options.port || SERVICE.PORT);
31
+ node.topologist.services = node.services;
34
32
  if (options.autoStart !== false) await node.start();
35
33
  return node;
36
34
  }