Skip to content

Commit

Permalink
fix public key
Browse files Browse the repository at this point in the history
  • Loading branch information
AssafKr committed Jul 31, 2023
1 parent 493e907 commit 3d19160
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion tunnel-server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import url from 'url'
import path from 'path'
import pino from 'pino'
import { createPublicKey } from 'crypto'
import { calculateJwkThumbprintUri, exportJWK } from 'jose'
import { app as createApp } from './src/app'
import { inMemoryPreviewEnvStore } from './src/preview-env'
import { sshServer as createSshServer } from './src/ssh-server'
Expand Down Expand Up @@ -76,11 +77,15 @@ const sshServer = createSshServer({
}
const forward = await accept()
sshLogger.debug('creating tunnel %s for localSocket %s', key, forward.localSocketPath)
const pk = createPublicKey(publicKey.getPublicPEM())

await envStore.set(key, {
target: forward.localSocketPath,
clientId,
publicKey: createPublicKey(publicKey.getPublicPEM()),
publicKey: pk,
access,
hostname: key,
publicKeyThumbprint: await calculateJwkThumbprintUri(await exportJWK(pk)),
})
tunnels.set(requestId, tunnelUrl(BASE_URL, clientId, remotePath))
tunnelsGauge.inc({ clientId })
Expand Down

0 comments on commit 3d19160

Please sign in to comment.