nsIObliviousHttp.idl (3441B)
1 /* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ 2 /* This Source Code Form is subject to the terms of the Mozilla Public 3 * License, v. 2.0. If a copy of the MPL was not distributed with this 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 5 6 #include "nsISupports.idl" 7 8 interface nsIChannel; 9 interface nsIURI; 10 11 [scriptable, builtinclass, uuid(f2a4aaa4-046a-439e-beef-893b15a90cff)] 12 interface nsIObliviousHttpClientResponse : nsISupports { 13 // Decrypt an encrypted response ("enc_response" in the RFC). 14 // Can only be called once. 15 Array<octet> decapsulate(in Array<octet> encResponse); 16 }; 17 18 [scriptable, builtinclass, uuid(403af7f9-4a76-49fc-a622-38d6ba3ee496)] 19 interface nsIObliviousHttpClientRequest : nsISupports { 20 // The encrypted request ("enc_request" in the RFC). 21 readonly attribute Array<octet> encRequest; 22 // The context for decrypting the eventual response. 23 readonly attribute nsIObliviousHttpClientResponse response; 24 }; 25 26 [scriptable, builtinclass, uuid(105deb62-45b4-407a-b330-550433279111)] 27 interface nsIObliviousHttpServerResponse : nsISupports { 28 readonly attribute Array<octet> request; 29 30 Array<octet> encapsulate(in Array<octet> response); 31 }; 32 33 [scriptable, builtinclass, uuid(fb1abc56-b525-4e1a-a4c6-341a9b32084e)] 34 interface nsIObliviousHttpServer : nsISupports { 35 readonly attribute Array<octet> encodedConfig; 36 37 nsIObliviousHttpServerResponse decapsulate(in Array<octet> encRequest); 38 }; 39 40 41 // IDL bindings for the rust implementation of oblivious http. 42 // Client code will generally call `encapsulateRequest` given an encoded 43 // oblivious gateway key configuration and an encoded binary http request. 44 // This function returns a nsIObliviousHttpClientRequest. The `encRequest` 45 // attribute of that object is the encapsulated request that can be sent to an 46 // oblivious relay to be forwarded on to the oblivious gateway and then to the 47 // actual target. The `response` attribute is used to decapsulate the response 48 // returned by the oblivious relay. 49 // For tests, this implementation provides a facility for decapsulating 50 // requests and encapsulating responses. Call `server` to get an 51 // `nsIObliviousHttpServer`, which has an attribute `encodedConfig` for use 52 // with `encapsulateRequest`. It also has a function `decapsulate`, which 53 // decapsulates an encapsulated client request and returns an 54 // `nsIObliviousHttpServerResponse`. This object can `encapsulate` a response, 55 // which the `nsIObliviousHttpClientResponse` from the original request should 56 // be able to `decapsulate`. 57 // Thread safety: nsIObliviousHttp may be used on any thread, but any objects 58 // created by it must only be used on the threads they are created on. 59 [scriptable, builtinclass, uuid(d581149e-3319-4563-b95e-46c64af5c4e8)] 60 interface nsIObliviousHttp : nsISupports 61 { 62 nsIObliviousHttpClientRequest encapsulateRequest( 63 in Array<octet> encodedConfig, 64 in Array<octet> request); 65 66 nsIObliviousHttpServer server(); 67 68 Array<Array<octet> > decodeConfigList(in Array<octet> encodedConfigList); 69 }; 70 71 [scriptable, builtinclass, uuid(b1f08d56-fca6-4290-9500-d5168dc9d8c3)] 72 interface nsIObliviousHttpService : nsISupports 73 { 74 nsIChannel newChannel(in nsIURI relayURI, in nsIURI targetURI, in Array<octet> encodedConfig); 75 76 void getTRRSettings(out nsIURI relayURI, out Array<octet> encodedConfig); 77 78 // Clears the config 79 void clearTRRConfig(); 80 };