Skip to content

feat(core)!: migrate to @icp-sdk/auth v7#896

Draft
AntonioVentilii wants to merge 5 commits into
junobuild:mainfrom
AntonioVentilii:wip/icp-auth-v7
Draft

feat(core)!: migrate to @icp-sdk/auth v7#896
AntonioVentilii wants to merge 5 commits into
junobuild:mainfrom
AntonioVentilii:wip/icp-auth-v7

Conversation

@AntonioVentilii

@AntonioVentilii AntonioVentilii commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

First wave of the @icp-sdk/auth v7 adoption (#892).

Migrates juno's auth to the v7 API:

  • AuthClient.create()new AuthClient(); provider options (identityProvider, derivationOrigin, windowOpenerFeatures, openIdProvider) are passed at construction
  • login()signIn() (throws); logout()signOut()
  • getIdentity() is async, isAuthenticated() is sync, with the downstream datastore/storage/functions call sites adjusted (downloadUrl stays sync)
  • setAuthClientStorage mirrors the localStorage expiration flag that v7's sync isAuthenticated() reads, so OpenID-redirect / WebAuthn injected sessions are still recognised as authenticated (and logout clears it)

All 324 @junobuild/core tests pass; typecheck, eslint and prettier are clean.

Notes:

  • allowPinAuthentication and ERROR_USER_INTERRUPT are dropped because v7 removed them; the user-interrupt vs generic error distinction therefore collapses to SignInError until the signer exposes a typed cancellation error.

Follow-up waves: #897 (one-click openIdProvider) and #898 (requestAttributes / email).

…etIdentity)

- bump @icp-sdk/auth peer to ^7 across core, core-peer, core-standalone
- AuthClient.create() -> new AuthClient(); provider options (identityProvider,
  windowOpenerFeatures, derivationOrigin, openIdProvider) now passed at construction
- login() -> signIn() (throws); logout() -> signOut()
- getIdentity() is now async -> getAnyIdentity + downstream datastore/storage/functions
  call sites awaited; downloadUrl stays sync (satelliteUrl ignores identity)
- drop allowPinAuthentication and ERROR_USER_INTERRUPT (removed upstream)

Source typechecks against v7. Test mocks updated separately.
…d sessions

- update all auth/worker specs to the v7 API (constructor, signIn/signOut,
  async getIdentity, sync isAuthenticated); add ctorReturning mock helper
- remove now-dead allowPin option + ALLOW_PIN_AUTHENTICATION constant
- setAuthClientStorage now mirrors the localStorage expiration flag that v7's
  sync isAuthenticated() reads, so OpenID-redirect / WebAuthn injected sessions
  are recognised as authenticated (and logout clears it)

All 324 core tests pass; typecheck, eslint and prettier clean.
@peterpeterparker

Copy link
Copy Markdown
Contributor

Thanks for the PR. Is it addressing a specific issue or bug?

Or is the current public API of Internet Identity about to be deprecated? If yes, can you point me to the announcement and documentation?

If neither of those scenarios applies, given that Juno is in maintenance and will inevitably be deprecated in the future, I don't see any rush or reason to upgrade the AuthClient. The current authentication is in place, works fine, and is secure, so I don't really see a reason to upgrade outside of the cases mentioned above.

@AntonioVentilii

Copy link
Copy Markdown
Contributor Author

@peterpeterparker , I was actually just trying to have a look at this issue #892

But maybe it was open before putting Juno in maintenance mode, I suppose.

In any case, if that issue gets closed, i can close all the related PRs

@peterpeterparker

Copy link
Copy Markdown
Contributor

I see, thanks for the feedback. I don't remember if it was open before or just after Juno went into maintenance.
Anyways, currently I think it's best to not touch the authentication unless required as mentionned above.
We can keep this as a draft until it become a necessity.

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.

2 participants