@@ -25,6 +25,9 @@ import * as utils from './utils';
2525import * as errors from './errors' ;
2626import { never } from './utils' ;
2727
28+ // FIXME
29+ type VerifyCallback = ( certs : Array < string > ) => void ;
30+
2831/**
2932 * Think of this as equivalent to `net.Socket`.
3033 * Errors here are emitted to the connection only.
@@ -199,6 +202,7 @@ class QUICConnection extends EventTarget {
199202 protected shortSent = false ;
200203 protected secured = false ;
201204 protected count = 0 ;
205+ protected verifyCallback : VerifyCallback | undefined ;
202206
203207 public constructor ( {
204208 type,
@@ -209,6 +213,7 @@ class QUICConnection extends EventTarget {
209213 socket,
210214 reasonToCode = ( ) => 0 ,
211215 codeToReason = ( type , code ) => new Error ( `${ type } ${ code } ` ) ,
216+ verifyCallback,
212217 logger,
213218 } :
214219 | {
@@ -220,6 +225,7 @@ class QUICConnection extends EventTarget {
220225 socket : QUICSocket ;
221226 reasonToCode ?: StreamReasonToCode ;
222227 codeToReason ?: StreamCodeToReason ;
228+ verifyCallback ?: VerifyCallback ;
223229 logger ?: Logger ;
224230 }
225231 | {
@@ -231,6 +237,7 @@ class QUICConnection extends EventTarget {
231237 socket : QUICSocket ;
232238 reasonToCode ?: StreamReasonToCode ;
233239 codeToReason ?: StreamCodeToReason ;
240+ verifyCallback ?: VerifyCallback ;
234241 logger ?: Logger ;
235242 } ) {
236243 super ( ) ;
@@ -281,6 +288,7 @@ class QUICConnection extends EventTarget {
281288 this . config = config ;
282289 this . reasonToCode = reasonToCode ;
283290 this . codeToReason = codeToReason ;
291+ this . verifyCallback = verifyCallback ;
284292 this . _remoteHost = remoteInfo . host ;
285293 this . _remotePort = remoteInfo . port ;
286294 const {
@@ -755,7 +763,7 @@ class QUICConnection extends EventTarget {
755763 // Dispatching certs available event
756764 // this.dispatchEvent(new events.QUICConnectionRemoteCertEvent()); TODO
757765 try {
758- // if (this.verifyCallback != null) this.verifyCallback(peerCertsPem); TODO
766+ if ( this . verifyCallback != null ) this . verifyCallback ( peerCertsPem ) ;
759767 this . conn . sendAckEliciting ( ) ;
760768 } catch ( e ) {
761769 // Force the connection to end.
0 commit comments