Skip to content

Should _toBuf be renamed and documented? #22425

Description

It seems that we now can use the internal function _toBuf() by exposing it directly from the internal/crypto/util. (See codes at crypto.js:Line 90~91, Line 142):

Now I wonder:

1)Generally speaking, since this is a public function exposed to the public, should it be renamed to toBuf instead of _toBuf()? The latter looks like a private function for inner usages.

2)Should it be documented? Any other suggestions or plans?

Thanks anyway!

Activity

  1. mscdex commented on Aug 21, 2018

    @mscdex
    Contributor

    No, this is an internal helper function and should not be documented.

  2. added
    cryptoIssues and PRs related to the crypto subsystem.
    on Aug 21, 2018
  3. tniessen commented on Aug 21, 2018

    @tniessen
    Member

    "internal helper function" doesn't mean "absolutely inaccessible from outside". We will need to examine whether this needs to be exposed and whether we can either deprecate or remove it from the list of exported functions safely.

  4. mscdex commented on Aug 21, 2018

    @mscdex
    Contributor

    Anything underscore-prefixed indicates that something is "private". Most of these instances could probably be transitioned to internal symbols now to reduce their "publicness".

  5. joyeecheung commented on Aug 21, 2018

    @joyeecheung
    Member

    In general access to properties/methods prefixed with underscores is considered deprecated (with a few unfortunate exceptions). We only document them when we absolutely have to (e.g. there is no way to remove them without breaking the ecosystem and they are already well-known), otherwise we just keep them as-is with plans to either migrate them to symbol properties (with or without an official deprecation cycle depending on the ecosystem usage), or replace them with an official public API.

  6. joyeecheung commented on Aug 21, 2018

    @joyeecheung
    Member

    Also, on _toBuf in particular, there was discussion about deprecating it around 8.x #11138 I guess we just forgot to follow up on that?

  7. added a commit that references this issue on Jul 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    cryptoIssues and PRs related to the crypto subsystem.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions