accounts
accounts copied to clipboard
Token manager Implemented
Here is the PR to implement the token manager with the rest of the suite
I had to open a new one because jest broke when I tried to merge with master
Codecov Report
Merging #222 into master will decrease coverage by
1.28%
. The diff coverage is100%
.
@@ Coverage Diff @@
## master #222 +/- ##
========================================
- Coverage 95.29% 94% -1.29%
========================================
Files 55 56 +1
Lines 1274 1334 +60
Branches 188 180 -8
========================================
+ Hits 1214 1254 +40
- Misses 55 74 +19
- Partials 5 6 +1
Impacted Files | Coverage Δ | |
---|---|---|
packages/server/src/index.ts | 100% <ø> (ø) |
:arrow_up: |
packages/server/src/accounts-server.ts | 90.96% <100%> (+1.01%) |
:arrow_up: |
packages/password/src/accounts-password.ts | 93.37% <100%> (+2.41%) |
:arrow_up: |
packages/token-manager/src/token-manager.ts | 100% <100%> (ø) |
|
packages/token-manager/src/index.ts | 100% <100%> (ø) |
|
packages/server/src/utils/get-first-user-email.ts | 33.33% <0%> (-66.67%) |
:arrow_down: |
packages/client/src/accounts-client.ts | 88% <0%> (-10.69%) |
:arrow_down: |
packages/server/src/utils/email.ts | 81.81% <0%> (-3.9%) |
:arrow_down: |
packages/rest-express/src/user-loader.ts | 100% <0%> (ø) |
:arrow_up: |
... and 43 more |
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 11bb4f9...7542144. Read the comment docs.
Can you add an example about how do you instantiate the server class with the token manager?
import TokenManager from '@accounts/token-manager'
const tokenManager = new TokenManager({
secret: 'secret',
emailTokenExpiration: 1000 * 60 * 60 * 2,
access: {
expiresIn: '1h'
},
refresh: {
algorithm: 'HS256'
}
})
new AccountsServer({
db,
tokenManager
}, {
password: new Password(passwordConfig)
})
So the user will have to install a new package manually, can't we just make the initialisation internal?
I think we should keep the packages simple and make the user-friendly in the preset packages ? The relations between packages would become too complicated in my opinion