-
Notifications
You must be signed in to change notification settings - Fork 37
feat(passport): v3 #2744
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
shineli1984
wants to merge
28
commits into
main
Choose a base branch
from
v3alpha
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+3,027
−10,109
Open
feat(passport): v3 #2744
Changes from 1 commit
Commits
Show all changes
28 commits
Select commit
Hold shift + click to select a range
ee7a2ab
step1-split wallet and auth
shineli1984 f164052
add lock file
shineli1984 f065702
make sure the code are copied
shineli1984 6958697
syncpack
shineli1984 fac8e9d
pnpm lock file
shineli1984 88a8058
node types
shineli1984 1b2aa6d
remove as any
shineli1984 9e5e0a5
wallet build
shineli1984 3bc1ba8
sample app eslint fix
shineli1984 798597f
add missing dependency
shineli1984 6b87732
remove unnecessary files
shineli1984 28eacbf
sample app lint
shineli1984 15bfd09
fix chainID
shineli1984 fb595ff
fix type error
shineli1984 9a19c4e
fix provider type
shineli1984 b101708
fix type
shineli1984 bcfb6a7
fix config
shineli1984 6780bd7
use authconfig insted
shineli1984 91461e6
Merge branch 'main' into v3alpha
shineli1984 73516a8
fix deployment settings
shineli1984 dc62012
fix publish settings
shineli1984 56b73dc
type module
shineli1984 8aeeeba
align package.json
shineli1984 648174a
make passport use auth and wallet
shineli1984 a5f2f97
fix build
shineli1984 bccc29a
session activity
shineli1984 48ae93f
remove anomynous id, move tracking
shineli1984 969c7b2
remove anomynous id
shineli1984 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| { | ||
| "name": "@imtbl/auth", | ||
| "version": "0.0.0", | ||
| "description": "Authentication SDK for Immutable", | ||
| "main": "dist/node/index.js", | ||
| "module": "dist/node/index.mjs", | ||
| "types": "dist/types/index.d.ts", | ||
| "exports": { | ||
| ".": { | ||
| "types": "./dist/types/index.d.ts", | ||
| "import": { | ||
| "browser": "./dist/browser/index.mjs", | ||
| "default": "./dist/node/index.mjs" | ||
| }, | ||
| "require": "./dist/node/index.js" | ||
| } | ||
| }, | ||
| "scripts": { | ||
| "build": "pnpm transpile && pnpm typegen", | ||
| "transpile": "tsup src/index.ts --config ../../tsup.config.js", | ||
| "typegen": "tsc --customConditions default --emitDeclarationOnly --outDir dist/types" | ||
| }, | ||
| "dependencies": { | ||
| "@imtbl/config": "workspace:*", | ||
| "@imtbl/metrics": "workspace:*", | ||
| "axios": "^1.6.2", | ||
| "jwt-decode": "^3.1.2", | ||
| "localforage": "^1.10.0", | ||
| "oidc-client-ts": "^2.4.0", | ||
| "uuid": "^9.0.1" | ||
| }, | ||
| "devDependencies": { | ||
| "@imtbl/toolkit": "workspace:*", | ||
| "tsup": "^8.3.0", | ||
| "typescript": "^5.6.2" | ||
| } | ||
| } | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,67 @@ | ||
| import { | ||
| OidcConfiguration, | ||
| AuthModuleConfiguration, | ||
| PopupOverlayOptions, | ||
| } from './types'; | ||
| import { AuthError, AuthErrorType } from './errors'; | ||
|
|
||
| const validateConfiguration = <T>( | ||
| configuration: T, | ||
| requiredKeys: Array<keyof T>, | ||
| prefix?: string, | ||
| ) => { | ||
| const missingKeys = requiredKeys | ||
| .map((key) => !configuration[key] && key) | ||
| .filter((n) => n) | ||
| .join(', '); | ||
| if (missingKeys !== '') { | ||
| const errorMessage = prefix | ||
| ? `${prefix} - ${missingKeys} cannot be null` | ||
| : `${missingKeys} cannot be null`; | ||
| throw new AuthError( | ||
| errorMessage, | ||
| AuthErrorType.INVALID_CONFIGURATION, | ||
| ); | ||
| } | ||
| }; | ||
|
|
||
| /** | ||
| * Interface that any configuration must implement to work with AuthManager | ||
| */ | ||
| export interface IAuthConfiguration { | ||
| readonly authenticationDomain: string; | ||
| readonly passportDomain: string; | ||
| readonly oidcConfiguration: OidcConfiguration; | ||
| readonly crossSdkBridgeEnabled: boolean; | ||
| readonly popupOverlayOptions?: PopupOverlayOptions; | ||
| } | ||
|
|
||
| export class AuthConfiguration implements IAuthConfiguration { | ||
| readonly authenticationDomain: string; | ||
| readonly passportDomain: string; | ||
| readonly oidcConfiguration: OidcConfiguration; | ||
| readonly crossSdkBridgeEnabled: boolean; | ||
| readonly popupOverlayOptions?: PopupOverlayOptions; | ||
|
|
||
| constructor({ | ||
| authenticationDomain, | ||
| passportDomain, | ||
| crossSdkBridgeEnabled, | ||
| popupOverlayOptions, | ||
| ...oidcConfiguration | ||
| }: AuthModuleConfiguration) { | ||
| validateConfiguration(oidcConfiguration, [ | ||
| 'clientId', | ||
| 'redirectUri', | ||
| ]); | ||
|
|
||
| this.oidcConfiguration = oidcConfiguration; | ||
| this.crossSdkBridgeEnabled = crossSdkBridgeEnabled || false; | ||
| this.popupOverlayOptions = popupOverlayOptions; | ||
|
|
||
| // Default to production auth domain if not provided | ||
| this.authenticationDomain = authenticationDomain || 'https://auth.immutable.com'; | ||
| this.passportDomain = passportDomain || 'https://passport.immutable.com'; | ||
| } | ||
| } | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.