Skip to content

WIP : @accounts/token-manager Adds a package to manage jwt's #179

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

Closed
wants to merge 5 commits into from

Conversation

Aetherall
Copy link
Member

This package has the purpose to be used by the AccountsServer class to manage JWT's in a cleaner way

Usage:

// use default config
const tokenManager = new TokenManager({
	secret: 'secret',
})

// Use custom config
const tokenManager = new TokenManager({
	secret: 'secret',
	emailTokenExpiration: 1000 * 60,
	access: {
		algorithm: 'HS256',
		expiresIn: '10m'
	},
	refresh: {
		algorithm: 'HS256',
		expiresIn: '1d'
	}
})

By now it is not implemented anywhere, but the goal is to pass it to accountsServer this way :

const accountsServer = new AccountsServer({
	tokenManager
})

@codecov-io
Copy link

Codecov Report

Merging #179 into master will increase coverage by 0.15%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #179      +/-   ##
==========================================
+ Coverage   93.19%   93.35%   +0.15%     
==========================================
  Files          44       46       +2     
  Lines        1191     1219      +28     
  Branches      162      174      +12     
==========================================
+ Hits         1110     1138      +28     
  Misses         70       70              
  Partials       11       11
Impacted Files Coverage Δ
packages/token-manager/src/index.ts 100% <100%> (ø)
packages/token-manager/src/token-manager.ts 100% <100%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4709486...435a24f. Read the comment docs.

@Aetherall Aetherall mentioned this pull request Mar 13, 2018
12 tasks
Copy link
Member

@TimMikeladze TimMikeladze left a comment

Choose a reason for hiding this comment

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

👍


private refreshTokenConfig: TokenGenerationConfiguration;

constructor(config: Configuration) {
Copy link
Member

Choose a reason for hiding this comment

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

what are your thoughts on just defining and exporting Configuration interface within this file and eliminating ./types entirely?

Copy link
Member Author

@Aetherall Aetherall Mar 16, 2018

Choose a reason for hiding this comment

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

I want to enforce a pattern which has to be respected by all the packages of the suite, so if a potential contributor need to add a package, he will apply the pattern to his package naturally

I agree It is not needed everywhere but seeing that we at accounts-JS do apply it everywhere, the potential contributor will tend to adopt the pattern

Also, I like when the only different thing between two things is what actually make them different

@Aetherall
Copy link
Member Author

Closed in favor of #222

@Aetherall Aetherall closed this Apr 3, 2018
@Aetherall Aetherall deleted the feature/token-manager branch April 3, 2018 10:25
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