@@ -4,6 +4,7 @@ import * as events from 'events';
44import corsGate = require( 'cors-gate' ) ;
55import { GraphQLServer } from 'graphql-yoga' ;
66import { GraphQLScalarType } from 'graphql' ;
7+ import { generateSPKIFingerprint } from 'mockttp' ;
78
89import { HtkConfig } from './config' ;
910import { reportError , addBreadcrumb } from './error-tracking' ;
@@ -36,6 +37,7 @@ const typeDefs = `
3637 type InterceptionConfig {
3738 certificatePath: String!
3839 certificateContent: String!
40+ certificateFingerprint: String!
3941 }
4042
4143 type Interceptor {
@@ -62,7 +64,11 @@ const buildResolvers = (
6264 interceptors : ( ) => _ . values ( interceptors ) ,
6365 config : ( ) => ( {
6466 certificatePath : config . https . certPath ,
65- certificateContent : config . https . certContent
67+ certificateContent : config . https . certContent ,
68+ // We could calculate this client side, but it normally requires node-forge or
69+ // some other heavyweight crypto lib, and we already have that here, so it's
70+ // convenient to do it up front.
71+ certificateFingerprint : generateSPKIFingerprint ( config . https . certContent )
6672 } ) ,
6773 networkInterfaces : ( ) => os . networkInterfaces ( )
6874 } ,
0 commit comments