Skip to content

Commit

Permalink
fix: check pkijs
Browse files Browse the repository at this point in the history
  • Loading branch information
Kacper-RF committed Nov 2, 2023
1 parent 15885fe commit 23bf54d
Show file tree
Hide file tree
Showing 3 changed files with 121 additions and 2 deletions.
107 changes: 106 additions & 1 deletion packages/common/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion packages/common/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@
"@quiet/types": "^1.8.1",
"@peculiar/webcrypto": "1.4.3",
"cross-env": "^5.2.0",
"debug": "^4.3.1"
"debug": "^4.3.1",
"pkijs": "^3.0.8"
},
"jest": {
"transform": {
Expand Down
13 changes: 13 additions & 0 deletions packages/common/src/auth.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,19 @@
import { Crypto } from '@peculiar/webcrypto'
import { setEngine, CryptoEngine } from 'pkijs'

const webcrypto = new Crypto()
setEngine(
'newEngine',
webcrypto,
new CryptoEngine({
name: '',
crypto: webcrypto,
subtle: webcrypto.subtle,
})
)

global.crypto = webcrypto

const array = new Uint32Array(5)

export const generateSecret = () => webcrypto.getRandomValues(array).join('')
Expand Down

0 comments on commit 23bf54d

Please sign in to comment.