@@ -445,12 +445,30 @@ private struct FfiConverterString: FfiConverter {
445445    } 
446446} 
447447
448+ /**
449+  * Each OHTTP request-reply exchange needs to create an OhttpSession
450+  * object to manage encryption state.
451+  */
448452public  protocol  OhttpSessionProtocol :  AnyObject  { 
453+     /**
454+      * Decypt and unpack the response from the Relay for the previously
455+      * encapsulated request. You must use the same OhttpSession that
456+      * generated the request message.
457+      */
449458    func  decapsulate( encoded:  [ UInt8 ] )  throws  ->  OhttpResponse 
450459
460+     /**
461+      * Encapsulate an HTTP request as Binary HTTP and then encrypt that
462+      * payload using HPKE. The caller is responsible for sending the
463+      * resulting message to the Relay.
464+      */
451465    func  encapsulate( method:  String ,  scheme:  String ,  server:  String ,  endpoint:  String ,  headers:  [ String :  String ] ,  payload:  [ UInt8 ] )  throws  ->  [ UInt8 ] 
452466} 
453467
468+ /**
469+  * Each OHTTP request-reply exchange needs to create an OhttpSession
470+  * object to manage encryption state.
471+  */
454472open  class  OhttpSession : 
455473    OhttpSessionProtocol 
456474{ 
@@ -481,6 +499,9 @@ open class OhttpSession:
481499        return  try ! rustCall  {  uniffi_as_ohttp_client_fn_clone_ohttpsession ( self . pointer,  $0)  } 
482500    } 
483501
502+     /**
503+      * Initialize encryption state based on specific Gateway key config
504+      */
484505    public  convenience init ( config:  [ UInt8 ] )  throws  { 
485506        let  pointer  = 
486507            try rustCallWithError ( FfiConverterTypeOhttpError . lift)  { 
@@ -499,13 +520,23 @@ open class OhttpSession:
499520        try ! rustCall  {  uniffi_as_ohttp_client_fn_free_ohttpsession ( pointer,  $0)  } 
500521    } 
501522
523+     /**
524+      * Decypt and unpack the response from the Relay for the previously
525+      * encapsulated request. You must use the same OhttpSession that
526+      * generated the request message.
527+      */
502528    open  func  decapsulate( encoded:  [ UInt8 ] )  throws  ->  OhttpResponse  { 
503529        return  try FfiConverterTypeOhttpResponse . lift ( rustCallWithError ( FfiConverterTypeOhttpError . lift)  { 
504530            uniffi_as_ohttp_client_fn_method_ohttpsession_decapsulate ( self . uniffiClonePointer ( ) , 
505531                                                                      FfiConverterSequenceUInt8 . lower ( encoded) ,  $0) 
506532        } ) 
507533    } 
508534
535+     /**
536+      * Encapsulate an HTTP request as Binary HTTP and then encrypt that
537+      * payload using HPKE. The caller is responsible for sending the
538+      * resulting message to the Relay.
539+      */
509540    open  func  encapsulate( method:  String ,  scheme:  String ,  server:  String ,  endpoint:  String ,  headers:  [ String :  String ] ,  payload:  [ UInt8 ] )  throws  ->  [ UInt8 ]  { 
510541        return  try FfiConverterSequenceUInt8 . lift ( rustCallWithError ( FfiConverterTypeOhttpError . lift)  { 
511542            uniffi_as_ohttp_client_fn_method_ohttpsession_encapsulate ( self . uniffiClonePointer ( ) , 
@@ -557,14 +588,25 @@ public func FfiConverterTypeOhttpSession_lower(_ value: OhttpSession) -> UnsafeM
557588    return  FfiConverterTypeOhttpSession . lower ( value) 
558589} 
559590
591+ /**
592+  * A testing interface for decrypting and responding to OHTTP messages. This
593+  * should only be used for testing.
594+  */
560595public  protocol  OhttpTestServerProtocol :  AnyObject  { 
596+     /**
597+      * Return the unique encryption key config for this instance of test server.
598+      */
561599    func  getConfig( )  ->  [ UInt8 ] 
562600
563601    func  receive( message:  [ UInt8 ] )  throws  ->  TestServerRequest 
564602
565603    func  respond( response:  OhttpResponse )  throws  ->  [ UInt8 ] 
566604} 
567605
606+ /**
607+  * A testing interface for decrypting and responding to OHTTP messages. This
608+  * should only be used for testing.
609+  */
568610open  class  OhttpTestServer : 
569611    OhttpTestServerProtocol 
570612{ 
@@ -612,6 +654,9 @@ open class OhttpTestServer:
612654        try ! rustCall  {  uniffi_as_ohttp_client_fn_free_ohttptestserver ( pointer,  $0)  } 
613655    } 
614656
657+     /**
658+      * Return the unique encryption key config for this instance of test server.
659+      */
615660    open  func  getConfig( )  ->  [ UInt8 ]  { 
616661        return  try ! FfiConverterSequenceUInt8 . lift ( try ! rustCall  { 
617662            uniffi_as_ohttp_client_fn_method_ohttptestserver_get_config ( self . uniffiClonePointer ( ) ,  $0) 
@@ -671,6 +716,9 @@ public func FfiConverterTypeOhttpTestServer_lower(_ value: OhttpTestServer) -> U
671716    return  FfiConverterTypeOhttpTestServer . lower ( value) 
672717} 
673718
719+ /**
720+  * The decrypted response from the Gateway/Target
721+  */
674722public  struct  OhttpResponse  { 
675723    public  var  statusCode :  UInt16 
676724    public  var  headers :  [ String :  String ] 
0 commit comments