Skip to content

Commit

Permalink
lazyly require BcryptDriver
Browse files Browse the repository at this point in the history
  • Loading branch information
marcuspoehls committed Oct 14, 2023
1 parent 13adbb3 commit 99ae52c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog

## [3.20.3](https://github.com/supercharge/framework/compare/v3.20.1...v3.20.2) - 2023-10-14

### Updated
- `@supercharge/hashing`
- require `BcryptDriver` inside the `createBcryptDriver` method to only import dependencies when needed. This will support Supercharge to use Bun (the new runtime) because it doesn’t reference a bcrypt_napi bridge
- bump dependencies


## [3.20.2](https://github.com/supercharge/framework/compare/v3.20.1...v3.20.2) - 2023-08-24

### Updated
Expand Down
3 changes: 2 additions & 1 deletion packages/hashing/src/hash-manager.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
'use strict'

import { Manager } from '@supercharge/manager'
import { BcryptHasher } from './bcrypt-hasher'
import { ScryptHasher } from './scrypt-hasher'
import { Hasher } from '@supercharge/contracts'

Expand All @@ -27,6 +26,8 @@ export class HashManager extends Manager implements Hasher {
* Create a bcrypt hasher instance.
*/
protected createBcryptDriver (): Hasher {
const { BcryptHasher } = require('./bcrypt-hasher')

return new BcryptHasher({
rounds: this.config().get('hashing.bcrypt.rounds', 10)
})
Expand Down

0 comments on commit 99ae52c

Please sign in to comment.