Skip to content

Conversation

@mondoreale
Copy link
Contributor

@mondoreale mondoreale commented Jan 12, 2026

This pull request primarily refactors the naming and usage of the default AutoCertifier client factory functions for clarity and consistency, and makes a minor cryptographic utility update. The most important changes are grouped below.

Refactoring and Consistency Improvements

  • Renamed defaultAutoCertifierClientFactory to createDefaultAutocertifierClient in both browser and nodejs implementations, and updated all imports and usages accordingly for clarity and consistency. [1] [2] [3] [4]

Utility and Cryptography Updates

  • Updated the computeSha1 function in crypto.ts to use utf8ToBinary for string-to-binary conversion, improving encoding reliability. Also imported utf8ToBinary from src/binaryUtils. [1] [2]

@github-actions github-actions bot added dht Related to DHT package utils labels Jan 12, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request refactors the default AutoCertifier client factory function naming for improved clarity and updates a cryptographic utility function to use a shared helper. The changes primarily focus on renaming defaultAutoCertifierClientFactory to createDefaultAutocertifierClient across browser and Node.js implementations and updating references.

Changes:

  • Renamed factory function from defaultAutoCertifierClientFactory to createDefaultAutocertifierClient in browser and Node.js implementations
  • Updated import and usage references in AutoCertifierClientFacade.ts
  • Refactored computeSha1 in browser crypto utilities to use utf8ToBinary helper function instead of inline TextEncoder

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
packages/dht/src/browser/createDefaultAutocertifierClient.ts Renamed exported factory function from defaultAutoCertifierClientFactory to createDefaultAutocertifierClient
packages/dht/src/nodejs/createDefaultAutocertifierClient.ts Renamed exported factory function from defaultAutoCertifierClientFactory to createDefaultAutocertifierClient
packages/dht/src/connection/websocket/AutoCertifierClientFacade.ts Updated import and usage to reference the renamed function createDefaultAutocertifierClient
packages/utils/src/browser/crypto.ts Refactored computeSha1 to use utf8ToBinary utility function instead of inline TextEncoder.encode()
Comments suppressed due to low confidence (2)

packages/dht/src/nodejs/createDefaultAutocertifierClient.ts:9

  • The function name uses lowercase 'c' in "Autocertifier" which is inconsistent with the naming convention used throughout the codebase. Other identifiers like "AutoCertifierClient", "AutoCertifierClientFacade", "IAutoCertifierClient", and "autoCertifierClient" all use uppercase 'C'. The function should be renamed to "createDefaultAutoCertifierClient" (with uppercase 'C') to maintain naming consistency.
    packages/dht/src/browser/createDefaultAutocertifierClient.ts:4
  • The function name uses lowercase 'c' in "Autocertifier" which is inconsistent with the naming convention used throughout the codebase. Other identifiers like "AutoCertifierClient", "AutoCertifierClientFacade", "IAutoCertifierClient", and "autoCertifierClient" all use uppercase 'C'. The function should be renamed to "createDefaultAutoCertifierClient" (with uppercase 'C') to maintain naming consistency.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@mondoreale mondoreale merged commit f26a940 into bundles Jan 12, 2026
27 checks passed
@mondoreale mondoreale deleted the tweaks branch January 12, 2026 12:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dht Related to DHT package utils

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants