Skip to content

Add global frontend api#21

Open
yaroslav8765 wants to merge 6 commits intomainfrom
add-global-frontend-api
Open

Add global frontend api#21
yaroslav8765 wants to merge 6 commits intomainfrom
add-global-frontend-api

Conversation

@yaroslav8765
Copy link
Copy Markdown
Contributor

No description provided.

Copy link
Copy Markdown

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 PR introduces a global(ish) frontend API/state for the 2FA modal by centralizing modal state and callbacks into a Pinia store, and refactoring the modal component to consume that store.

Changes:

  • Added a new Pinia store (use2faApi) to hold 2FA modal state, callbacks, and API checks.
  • Refactored TwoFAModal.vue to render and operate based on the store (twofaApi.*) instead of local refs.
  • Wired OTP-input event listener registration through the store.

Reviewed changes

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

File Description
custom/use2faApi.ts New Pinia store that centralizes modal open state, title, callbacks, and passkey/skip checks.
custom/TwoFAModal.vue Uses the new store for modal rendering and callback plumbing; registers OTP listener via the store.

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

Comment thread custom/use2faApi.ts
Comment thread custom/use2faApi.ts Outdated
Comment thread custom/use2faApi.ts
Comment thread custom/use2faApi.ts
Comment thread custom/use2faApi.ts
Comment thread custom/TwoFAModal.vue Outdated
Comment thread custom/TwoFAModal.vue Outdated
Comment thread custom/TwoFAModal.vue Outdated
Copy link
Copy Markdown

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

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


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

Comment thread custom/use2faApi.ts
Comment thread custom/use2faApi.ts
Comment thread custom/use2faApi.ts
rejectFn,
setModalMode,
doesUserHavePasskeys,
modalMode,
Copy link
Copy Markdown
Contributor

@ivictbor ivictbor Apr 9, 2026

Choose a reason for hiding this comment

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

@yaroslav8765 this is over-exposed and this is a critical issue, for users and LLM Agentic stability. In all plugins, always we need to expose from useXXAPI only methods which might be used by someone, very limited set (same method we had before exposed in window, nothing more then it), we should hide all internal implementation, e.g. setIsOpene can brake internal state, it is only get2FaConfirmationResult and maybe some couple of other methods?

Please never expose "just in case someone might use it" - it will cause a lot of issues, every exposed API method should be carefully planned, otherwise we mislead. Even before LLMs plain Ctrl+Space will show user all avaialble methods, user will think he can use it and by using some internal state method he might achieven unexpected unclear behaviour

Please read, ask chat to explain and remember these very basic principles:

  1. https://en.wikipedia.org/wiki/Encapsulation_%28computer_programming%29
  2. https://en.wikipedia.org/wiki/Information_hiding
  3. https://en.wikipedia.org/wiki/Law_of_Demeter
  4. https://en.wikipedia.org/wiki/Interface_segregation_principle

Lets discuss all 4 principles later

(add missing cookies/headers params when we are verifying user at the registerPasskeyRequest api)

https://web.tracklify.com/project/2b7ZVgE5/AdminForth/1426/J92azLP8/image
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants