File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- export { defaultEngineReportingSignature } from "./signature" ;
1+ export {
2+ defaultEngineReportingSignature ,
3+ hashForOperationSignature
4+ } from "./signature" ;
Original file line number Diff line number Diff line change 4343// the server no longer needs to parse the signature or run its own signature
4444// algorithm on it, and the details of the signature algorithm are now up to the
4545// reporting agent.
46-
46+ import { createHash } from "crypto" ;
4747import { DocumentNode } from "graphql" ;
4848import {
4949 printWithReducedWhitespace ,
@@ -66,3 +66,9 @@ export function defaultEngineReportingSignature(
6666 )
6767 ) ;
6868}
69+
70+ export function hashForOperationSignature ( operationSignature : string ) : string {
71+ return createHash ( "sha256" )
72+ . update ( operationSignature )
73+ . digest ( "hex" ) ;
74+ }
Original file line number Diff line number Diff line change 1- import { createHash } from "crypto" ;
2- import { defaultEngineReportingSignature } from "apollo-graphql" ;
31import { GraphQLClientProject } from "apollo-language-server" ;
2+ import {
3+ defaultEngineReportingSignature ,
4+ hashForOperationSignature
5+ } from "apollo-graphql" ;
46
57export interface ManifestEntry {
68 signature : string ;
@@ -19,7 +21,7 @@ export function getOperationManifestFromProject(
1921 const printed = defaultEngineReportingSignature ( operationAST , "" ) ;
2022
2123 return {
22- signature : manifestOperationHash ( printed ) ,
24+ signature : hashForOperationSignature ( printed ) ,
2325 document : printed ,
2426 metadata : {
2527 engineSignature : printed
@@ -29,9 +31,3 @@ export function getOperationManifestFromProject(
2931
3032 return manifest ;
3133}
32-
33- function manifestOperationHash ( str : string ) : string {
34- return createHash ( "sha256" )
35- . update ( str )
36- . digest ( "hex" ) ;
37- }
You can’t perform that action at this time.
0 commit comments