Skip to content

refactor: improve guest UUID generation and docs#950

Merged
susnux merged 2 commits into
nextcloud-libraries:mainfrom
joshtrichards:jtr/guestUUID
Jul 20, 2026
Merged

refactor: improve guest UUID generation and docs#950
susnux merged 2 commits into
nextcloud-libraries:mainfrom
joshtrichards:jtr/guestUUID

Conversation

@joshtrichards

Copy link
Copy Markdown
Contributor

Summary

Some polishing of lib/guest.ts to improve the UUID helper implementation and docs:

  • improve randomUUID() fallback behavior by using crypto.getRandomValues() (available even in Insecure Contexts like HTTP) before falling back as last resort to Math.random()
    • completely compatible; no BC introduced
  • correct randomUUID() incorrect/misleading documentation (crypto.randomUUID is the preferred/best/most secure method)
  • correct JSDoc for getGuestUser() (it does not return null)
  • add brief JSDoc for class

This change preserves the API while making the UUID fallback logic more robust and the inline documentation more accurate.

🤖 AI (if applicable)

  • The content of this PR was partly or fully generated using AI

Signed-off-by: Josh <josh.t.richards@gmail.com>
Signed-off-by: Josh <josh.t.richards@gmail.com>
@susnux
susnux merged commit ab6cb7a into nextcloud-libraries:main Jul 20, 2026
7 checks passed
@codecov

codecov Bot commented Jul 20, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 12.50000% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 64.36%. Comparing base (0b08876) to head (00b5eb3).
⚠️ Report is 6 commits behind head on main.

Files with missing lines Patch % Lines
lib/guest.ts 12.50% 7 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #950      +/-   ##
==========================================
- Coverage   70.00%   64.36%   -5.64%     
==========================================
  Files           4        4              
  Lines          80       87       +7     
  Branches       23       24       +1     
==========================================
  Hits           56       56              
- Misses         19       26       +7     
  Partials        5        5              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants