-
-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(next): remove iron session (#545)
- Loading branch information
Showing
13 changed files
with
481 additions
and
482 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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 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,29 @@ | ||
import * as crypto from 'crypto'; | ||
|
||
import { PersistKey } from '@logto/node'; | ||
|
||
import { unwrapSession, wrapSession } from './session'; | ||
|
||
const secret = 'secret'; | ||
|
||
describe('session', () => { | ||
it('should be able to wrap', async () => { | ||
const cookie = await wrapSession({ [PersistKey.IdToken]: 'idToken' }, secret, crypto); | ||
expect(cookie).toContain('.'); | ||
}); | ||
|
||
it('should be able to unwrap', async () => { | ||
const session = await unwrapSession( | ||
'BShU2NGKg5762PWEOFu8lhzXKZMktgjH1RR4ifik4aGOOerM7w==.DFFnnlzSnjRbTl7I', | ||
secret, | ||
crypto | ||
); | ||
expect(session[PersistKey.IdToken]).toEqual('idToken'); | ||
}); | ||
|
||
it('should be able to wrap and unwrap', async () => { | ||
const cookie = await wrapSession({ [PersistKey.IdToken]: 'idToken' }, secret, crypto); | ||
const session = await unwrapSession(cookie, secret, crypto); | ||
expect(session[PersistKey.IdToken]).toEqual('idToken'); | ||
}); | ||
}); |
Oops, something went wrong.