11import { JosePublicFDC3Security , provisionJWKS } from '../src/impl/JosePublicFDC3Security' ;
22import { connectRemoteHandlers } from '../src/secure-boundary/ClientSideHandlersImpl' ;
3- import { Channel , DesktopAgent } from '@finos/fdc3-standard' ;
3+ import { Channel , ContextMetadata , DesktopAgent } from '@finos/fdc3-standard' ;
44import { Context } from '@finos/fdc3-context' ;
55import { ExchangeDataMessage } from '../src/secure-boundary/MessageTypes' ;
66import { MockDesktopAgent } from '../test/mocks/MockDesktopAgent' ;
77import { startAppBackEnd } from '../test/mocks/AppBackEnd' ;
88import { JosePrivateFDC3Security } from '../src/impl/JosePrivateFDC3Security' ;
99import { SigningChannelDelegate } from '../src/signing/SigningChannelDelegate' ;
10- import { ContextMetadataWithAuthenticity } from '../src/signing/SigningSupport' ;
1110
1211import { DefaultFDC3Handlers } from '../src/secure-boundary/FDC3Handlers' ;
1312
@@ -26,7 +25,7 @@ class AppABackendHandlers extends DefaultFDC3Handlers {
2625 async handleRemoteChannel ( purpose : string , channel : Channel ) : Promise < void > {
2726 console . log ( `[App A Backend] Received remote channel for purpose: ${ purpose } ` ) ;
2827 // Wrap with SigningChannelDelegate to handle signing automatically
29- this . channel = new SigningChannelDelegate ( channel , this . security ) ;
28+ this . channel = new SigningChannelDelegate ( channel , this . security , false ) ;
3029 // Wait for listener to be ready
3130 setTimeout ( ( ) => this . broadcast ( ) , 1000 ) ;
3231 }
@@ -74,7 +73,7 @@ async function runExample() {
7473 ) ;
7574
7675 // Wrap the channel with SigningChannelDelegate for automatic verification
77- const signedChanB = new SigningChannelDelegate ( chanB , securityB_Public ) ;
76+ const signedChanB = new SigningChannelDelegate ( chanB , securityB_Public , false ) ;
7877
7978 // 1. Listen to the raw channel to show what's "on the wire"
8079 await chanB . addContextListener ( 'fdc3.instrument' , async ctx => {
@@ -83,32 +82,29 @@ async function runExample() {
8382 } ) ;
8483
8584 // 2. Listen via the Delegate to show the processed/verified version
86- await signedChanB . addContextListener (
87- 'fdc3.instrument' ,
88- async ( ctx : Context , meta : ContextMetadataWithAuthenticity | undefined ) => {
89- console . log ( '[App B Front-end] <<< [VERIFIED] Context Received:' ) ;
90- console . log ( JSON . stringify ( ctx , null , 2 ) ) ;
91- console . log ( '[App B Front-end] <<< [VERIFIED] Metadata Received:' ) ;
92- console . log ( JSON . stringify ( meta , null , 2 ) ) ;
93-
94- if ( meta ?. authenticity ) {
95- const auth = meta . authenticity ;
96- if ( auth . signed ) {
97- console . log ( '[App B Front-end] Verification Result: ✅ VALID' ) ;
98- console . log ( `[App B Front-end] Trusted Provider: ${ auth . jku } ` ) ;
99- } else {
100- console . log ( '[App B Front-end] Context was not signed.' ) ;
101- if ( auth . errors ) {
102- console . log ( '[App B Front-end] Errors:' , auth . errors ) ;
103- }
85+ await signedChanB . addContextListener ( 'fdc3.instrument' , async ( ctx : Context , meta : ContextMetadata | undefined ) => {
86+ console . log ( '[App B Front-end] <<< [VERIFIED] Context Received:' ) ;
87+ console . log ( JSON . stringify ( ctx , null , 2 ) ) ;
88+ console . log ( '[App B Front-end] <<< [VERIFIED] Metadata Received:' ) ;
89+ console . log ( JSON . stringify ( meta , null , 2 ) ) ;
90+
91+ if ( meta ?. authenticity ) {
92+ const auth = meta . authenticity ;
93+ if ( auth . signed ) {
94+ console . log ( '[App B Front-end] Verification Result: ✅ VALID' ) ;
95+ console . log ( `[App B Front-end] Trusted Provider: ${ auth . jku } ` ) ;
96+ } else {
97+ console . log ( '[App B Front-end] Context was not signed.' ) ;
98+ if ( auth . errors ) {
99+ console . log ( '[App B Front-end] Errors:' , auth . errors ) ;
104100 }
105101 }
106-
107- console . log ( '--- FDC3 Signing Example End ---' ) ;
108- httpServer . close ( ) ;
109- process . exit ( 0 ) ;
110102 }
111- ) ;
103+
104+ console . log ( '--- FDC3 Signing Example End ---' ) ;
105+ httpServer . close ( ) ;
106+ process . exit ( 0 ) ;
107+ } ) ;
112108
113109 // 3. App A Front-end Execution
114110 console . log ( '[App A Front-end] Connecting to remote handlers...' ) ;
0 commit comments