-
-
Notifications
You must be signed in to change notification settings - Fork 319
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: weak cache normalized CryptoKey instances
- Loading branch information
Showing
4 changed files
with
39 additions
and
16 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,9 @@ | ||
import { createPrivateKey, createPublicKey } from 'node:crypto' | ||
import type { KeyObject } from 'node:crypto' | ||
|
||
import type { JWKImportFunction } from '../interfaces.d' | ||
import type { JWK } from '../../types.d' | ||
|
||
const parse: JWKImportFunction = (jwk: JWK): KeyObject => { | ||
const parse = (jwk: JWK): KeyObject => { | ||
return (jwk.d ? createPrivateKey : createPublicKey)({ format: 'jwk', key: jwk }) | ||
} | ||
export default parse |