Remove import of crypto from js-bson

XMLWordPrintableJSON

    • Type: Improvement
    • Resolution: Unresolved
    • Priority: Unknown
    • None
    • Affects Version/s: None
    • Component/s: BSON
    • 2
    • None
    • Not Needed
    • Hide

      1. What would you like to communicate to the user about this feature?
      2. Would you like the user to see examples of the syntax and/or executable code and its output?
      3. Which versions of the driver/connector does this apply to?

      Show
      1. What would you like to communicate to the user about this feature? 2. Would you like the user to see examples of the syntax and/or executable code and its output? 3. Which versions of the driver/connector does this apply to?
    • None
    • None
    • None
    • None
    • None
    • None

      Use Case

      As a... frontend js-bson user
      I want... js-bson to not dynamically import crypto
      So that... using js-bson is a smooth experience 

      After removing support for Node.js 16 in NODE-6625 - The crypto global should be available in all our supported environments 

      User Experience

      • Determine a path forward to ease user friction when using js-bson with frontend frameworks and bundlers

      Dependencies

      • upstream and/or downstream requirements and timelines to bear in mind

      Risks/Unknowns

      • What could go wrong while implementing this change? (e.g., performance, inadvertent behavioral changes in adjacent functionality, existing tech debt, etc)
      • Is there an opportunity for better cross-driver alignment or testing in this area?
      • Is there an opportunity to improve existing documentation on this subject?

      Acceptance Criteria

      Implementation Requirements

      • Update Node byte utils to use the global crypto object's getRandomValues to produce random bytes (i.e., we should probably be doing the exact same things as the web byte utils does)
      • remove require_rewriter and usages from the rollup config

      Testing Requirements

      • All tests pass.

      Documentation Requirements

      • n/a

      Follow Up Requirements

      • n/a

            Assignee:
            Bailey Pearson
            Reporter:
            Warren James (Inactive)
            Durran Jordan
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: