Skip to content

Unify browser extensions#763

Merged
feruzm merged 4 commits into
developfrom
extensions
Apr 20, 2026
Merged

Unify browser extensions#763
feruzm merged 4 commits into
developfrom
extensions

Conversation

@feruzm
Copy link
Copy Markdown
Member

@feruzm feruzm commented Apr 20, 2026

Summary by CodeRabbit

  • New Features

    • Unified browser extension support (Hive Keeper, Peak Vault, Hive Keychain) and new "Sign with Extension" login option with multi-extension icon display
  • Improvements

    • Async broadcast mode added and applied to votes, follows, reblogs and community actions; some cache invalidation deferred to align with async broadcasts
    • Login now auto-detects available extensions and prefers them for signing
  • Documentation

    • Added comprehensive edge caching guides (Cloudflare, Nginx, cache strategy)

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 20, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 0746b833-570c-48ec-9229-9be999ddd491

📥 Commits

Reviewing files that changed from the base of the PR and between 8c30f26 and b53e55f.

⛔ Files ignored due to path filters (7)
  • packages/sdk/dist/browser/index.d.ts is excluded by !**/dist/**
  • packages/sdk/dist/browser/index.js is excluded by !**/dist/**
  • packages/sdk/dist/browser/index.js.map is excluded by !**/dist/**, !**/*.map
  • packages/sdk/dist/node/index.cjs is excluded by !**/dist/**
  • packages/sdk/dist/node/index.cjs.map is excluded by !**/dist/**, !**/*.map
  • packages/sdk/dist/node/index.mjs is excluded by !**/dist/**
  • packages/sdk/dist/node/index.mjs.map is excluded by !**/dist/**, !**/*.map
📒 Files selected for processing (6)
  • apps/web/src/features/shared/login/login.tsx
  • apps/web/src/utils/hive-extensions.ts
  • packages/sdk/CHANGELOG.md
  • packages/sdk/package.json
  • packages/wallets/CHANGELOG.md
  • packages/wallets/package.json

📝 Walkthrough

Walkthrough

Adds unified detection and runtime adapters for multiple Hive browser extensions (Hive Keeper, Hive Keychain, Peak Vault); updates UI/login flows to show and use detected extensions; introduces async broadcast mode and threads it through SDK broadcast hooks and the web broadcast adapter.

Changes

Cohort / File(s) Summary
Extension Abstraction
apps/web/src/utils/hive-extensions.ts
New module: detects Hive extensions, exposes getDetectedExtensions(), hasAnyHiveExtension(), getPreferredExtension(), signBufferWithExtension() and broadcastWithExtension() with Keychain-style wrappers and Peak Vault normalization.
Global Init & Types
apps/web/src/core/global-store/modules/global-module.ts, apps/web/src/types/app-window.ts
initKeychain() expanded to detect window.peakvault, window.hive, and window.hive_keychain. AppWindow extended with hive, hive_extension, and peakvault types plus PeakVaultApi interface.
Login UI & Auth Upgrade
apps/web/src/features/shared/login/login.tsx, apps/web/src/features/shared/auth-upgrade/auth-upgrade-dialog.tsx
Replaced Keychain-only UI with extension-aware logic: detects extensions, renders multiple extension icons, updates labels to new i18n keys and toggles visibility based on detected extensions / keychain-mobile state.
Login Hook Signing Path
apps/web/src/features/shared/login/hooks/use-login-by-keychain.ts
Desktop signing path switched to signBufferWithExtension() (from @/utils/hive-extensions) instead of legacy signBuffer.
Web Broadcast Adapter
apps/web/src/providers/sdk/web-broadcast-adapter.ts
Reworked Keychain broadcast flow to use broadcastWithExtension() and hasAnyHiveExtension(); removed direct window.hive_keychain promise wrapper and its inline timeout handling.
Client Utility
apps/web/src/utils/client.ts
shouldUseKeychainMobile() now uses hasAnyHiveExtension() to determine absence of browser extensions.
Localization
apps/web/src/features/i18n/locales/en-US.json
Added i18n keys: g.login.extensions, g.key-or-hot.with-extension, g.login.with-extension.
SDK: Broadcast Mode Core
packages/sdk/src/modules/core/mutations/use-broadcast-mutation.ts
Introduced BroadcastMode (`'sync'
SDK Hooks: BroadcastMode Updates
packages/sdk/src/modules/.../mutations/*
packages/sdk/src/modules/accounts/mutations/use-follow.ts, use-unfollow.ts, packages/sdk/src/modules/communities/mutations/*, packages/sdk/src/modules/posts/mutations/*, packages/sdk/src/modules/notifications/mutations/use-set-last-read.ts
Multiple hooks updated to pass explicit 'posting' authority and { broadcastMode: 'async' } to useBroadcastMutation; some hooks defer cache invalidation (setTimeout) to align with async broadcasts.
Docs: Caching
docs/cache/*
Added cache architecture docs: README.md, cloudflare-worker.md, nginx.md describing edge caching, worker behavior, and nginx config examples.
Changelogs & Versions
packages/sdk/CHANGELOG.md, packages/sdk/package.json, packages/wallets/CHANGELOG.md, packages/wallets/package.json
Bumped package versions and added changelog entries reflecting "Unify browser extensions" release.

Sequence Diagram

sequenceDiagram
    participant User
    participant LoginUI as Login Component
    participant ExtUtils as Hive Extension Utils
    participant BrowserExt as Browser Extension
    participant Broadcast as Broadcast Layer

    User->>LoginUI: Click "Sign with Extension"
    LoginUI->>ExtUtils: getDetectedExtensions()
    ExtUtils->>BrowserExt: inspect window.hive / hive_keychain / peakvault
    BrowserExt-->>ExtUtils: available extension(s)
    ExtUtils-->>LoginUI: DetectedExtension[]
    LoginUI->>User: Render icons / label

    User->>LoginUI: Confirm / sign
    LoginUI->>ExtUtils: signBufferWithExtension(account, message)
    alt Keychain-compatible (Hive Keeper / Hive Keychain)
        ExtUtils->>BrowserExt: requestSignBuffer(buffer) (Keychain API)
        BrowserExt-->>ExtUtils: Promise<signature>
    else Peak Vault
        ExtUtils->>BrowserExt: requestSignBuffer(message) (PeakVault API)
        BrowserExt-->>ExtUtils: Promise<TxResponse>
    end
    ExtUtils-->>LoginUI: Signature / TxResponse
    LoginUI->>Broadcast: broadcastWithExtension(account, ops, keyType)
    Broadcast-->>User: Confirmation / success
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~50 minutes

Possibly related PRs

Suggested labels

patch

Poem

🐰
I sniffed three windows at the break of day,
Keeper, Keychain, Peak—each lent a way.
I stitched their hops into one tidy trail,
Sign, broadcast, and bounce—no single fail.
A joyful rabbit hops: extensions prevail!

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 75.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title 'Unify browser extensions' accurately describes the main objective: consolidating support for multiple Hive browser extensions (Keychain, Hive Keeper, Peak Vault) into a unified abstraction layer across the codebase.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch extensions

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

coderabbitai[bot]

This comment was marked as resolved.

coderabbitai[bot]

This comment was marked as resolved.

@feruzm feruzm added the patch Bug fixes and patches (1.0.0 → 1.0.1), add this only if any packages/ have patch changes in PR label Apr 20, 2026
@feruzm feruzm merged commit d93fdb8 into develop Apr 20, 2026
1 check was pending
@feruzm feruzm deleted the extensions branch April 20, 2026 13:51
@coderabbitai coderabbitai Bot mentioned this pull request Apr 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

patch Bug fixes and patches (1.0.0 → 1.0.1), add this only if any packages/ have patch changes in PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant