parent
2fa8a4e56c
commit
17fab6e913
|
@ -49,6 +49,47 @@ dependencies = [
|
||||||
"memchr",
|
"memchr",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "amplify"
|
||||||
|
version = "4.0.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "f26966af46e0d200e8bf2b7f16230997c1c3f2d141bc27ccc091c012ed527b58"
|
||||||
|
dependencies = [
|
||||||
|
"amplify_derive",
|
||||||
|
"amplify_num",
|
||||||
|
"ascii",
|
||||||
|
"wasm-bindgen",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "amplify_derive"
|
||||||
|
version = "3.0.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "c87df0f28e6eb1f2d355f29ba6793fa9ca643967528609608d5cbd70bd68f9d1"
|
||||||
|
dependencies = [
|
||||||
|
"amplify_syn",
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"syn 1.0.109",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "amplify_num"
|
||||||
|
version = "0.5.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "ddce3bc63e807ea02065e8d8b702695f3d302ae4158baddff8b0ce5c73947251"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "amplify_syn"
|
||||||
|
version = "2.0.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "7736fb8d473c0d83098b5bac44df6a561e20470375cd8bcae30516dc889fd62a"
|
||||||
|
dependencies = [
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"syn 1.0.109",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "android-tzdata"
|
name = "android-tzdata"
|
||||||
version = "0.1.1"
|
version = "0.1.1"
|
||||||
|
@ -288,6 +329,12 @@ dependencies = [
|
||||||
"tracing-subscriber",
|
"tracing-subscriber",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "ascii"
|
||||||
|
version = "1.1.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "d92bec98840b8f03a5ff5413de5293bfcd8bf96467cf5452609f939ec6f5de16"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "assert-impl"
|
name = "assert-impl"
|
||||||
version = "0.1.3"
|
version = "0.1.3"
|
||||||
|
@ -4569,6 +4616,7 @@ dependencies = [
|
||||||
name = "tor-netdoc"
|
name = "tor-netdoc"
|
||||||
version = "0.8.0"
|
version = "0.8.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
"amplify",
|
||||||
"base64ct",
|
"base64ct",
|
||||||
"bitflags 2.3.1",
|
"bitflags 2.3.1",
|
||||||
"cipher",
|
"cipher",
|
||||||
|
|
|
@ -78,6 +78,7 @@ dangerous-expose-struct-fields = ["visible", "visibility", "__is_experimental"]
|
||||||
__is_experimental = []
|
__is_experimental = []
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
amplify = { version = "4", default-features = false, features = ["derive"] }
|
||||||
base64ct = { version = "1.5.1", features = ["alloc"] }
|
base64ct = { version = "1.5.1", features = ["alloc"] }
|
||||||
bitflags = "2"
|
bitflags = "2"
|
||||||
cipher = { version = "0.4.1", features = ["zeroize"] }
|
cipher = { version = "0.4.1", features = ["zeroize"] }
|
||||||
|
|
|
@ -130,7 +130,7 @@ pub enum IntroAuthType {
|
||||||
|
|
||||||
/// Information in an onion service descriptor about a single
|
/// Information in an onion service descriptor about a single
|
||||||
/// introduction point.
|
/// introduction point.
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone, amplify::Getters)]
|
||||||
pub struct IntroPointDesc {
|
pub struct IntroPointDesc {
|
||||||
/// The list of link specifiers needed to extend a circuit to the introduction point.
|
/// The list of link specifiers needed to extend a circuit to the introduction point.
|
||||||
///
|
///
|
||||||
|
@ -138,6 +138,7 @@ pub struct IntroPointDesc {
|
||||||
//
|
//
|
||||||
// TODO hs: perhaps we should make certain link specifiers mandatory? That
|
// TODO hs: perhaps we should make certain link specifiers mandatory? That
|
||||||
// would make it possible for IntroPointDesc to implement CircTarget.
|
// would make it possible for IntroPointDesc to implement CircTarget.
|
||||||
|
#[getter(skip)]
|
||||||
link_specifiers: Vec<EncodedLinkSpec>,
|
link_specifiers: Vec<EncodedLinkSpec>,
|
||||||
|
|
||||||
/// The key to be used to extend a circuit _to the introduction point_, using the
|
/// The key to be used to extend a circuit _to the introduction point_, using the
|
||||||
|
@ -298,21 +299,11 @@ impl HsDesc {
|
||||||
/// One or more introduction points used to contact the onion service.
|
/// One or more introduction points used to contact the onion service.
|
||||||
///
|
///
|
||||||
/// Accessor function.
|
/// Accessor function.
|
||||||
// TODO HS derive this accessor
|
|
||||||
//
|
//
|
||||||
// For this and others I considered the following crates:
|
// TODO: We'd like to derive this, but amplify::Getters would give us &Vec<>,
|
||||||
|
// not &[].
|
||||||
//
|
//
|
||||||
// * amplify_derive, derive-getters, accessors-rs:
|
// Perhaps someday we can use derive_adhoc, or add as_ref() support?
|
||||||
// No way to deref the Vec to [], which I think is desirable
|
|
||||||
// (after all, eventually these might become Box<[]>.
|
|
||||||
//
|
|
||||||
// * getset: Always generates methods called `get_` which isn't what we want.
|
|
||||||
// * tia: Same problem. Also strange API.
|
|
||||||
// * field_accessor: Works with Strings.
|
|
||||||
// * accessors: Always uses `get` prefix, underdocumented.
|
|
||||||
// * structural: Seems to be something much more reflection-y.
|
|
||||||
//
|
|
||||||
// derive-adhoc would make short work of this problem.
|
|
||||||
pub fn intro_points(&self) -> &[IntroPointDesc] {
|
pub fn intro_points(&self) -> &[IntroPointDesc] {
|
||||||
&self.intro_points
|
&self.intro_points
|
||||||
}
|
}
|
||||||
|
@ -324,41 +315,12 @@ impl IntroPointDesc {
|
||||||
/// These can include public keys and network addresses.
|
/// These can include public keys and network addresses.
|
||||||
///
|
///
|
||||||
/// Accessor function.
|
/// Accessor function.
|
||||||
// TODO HS derive this accessor (see above)
|
//
|
||||||
|
// TODO: It would be better to derive this too, but this accessor needs to
|
||||||
|
// return a slice; Getters can only give us a &Vec<> in this case.
|
||||||
pub fn link_specifiers(&self) -> &[EncodedLinkSpec] {
|
pub fn link_specifiers(&self) -> &[EncodedLinkSpec] {
|
||||||
&self.link_specifiers
|
&self.link_specifiers
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The key to be used to extend a circuit _to the introduction point_, using the
|
|
||||||
/// ntor or ntor3 handshakes. (`KP_ntor`)
|
|
||||||
///
|
|
||||||
/// Accessor function.
|
|
||||||
// TODO HS derive this accessor (see above)
|
|
||||||
pub fn ipt_ntor_key(&self) -> &curve25519::PublicKey {
|
|
||||||
&self.ipt_ntor_key
|
|
||||||
}
|
|
||||||
|
|
||||||
/// The key to be used to identify the onion service at this introduction point.
|
|
||||||
/// (`KP_hs_ipt_sid`)
|
|
||||||
///
|
|
||||||
/// Accessor function.
|
|
||||||
// TODO HS derive this accessor (see above)
|
|
||||||
pub fn ipt_sid_key(&self) -> &HsIntroPtSessionIdKey {
|
|
||||||
&self.ipt_sid_key
|
|
||||||
}
|
|
||||||
|
|
||||||
/// `KP_hss_ntor`, the key used to encrypt a handshake _to the onion
|
|
||||||
/// service_ when using this introduction point.
|
|
||||||
///
|
|
||||||
/// The onion service uses a separate key of this type with each
|
|
||||||
/// introduction point as part of its strategy for preventing replay
|
|
||||||
/// attacks.
|
|
||||||
///
|
|
||||||
/// Accessor function.
|
|
||||||
// TODO HS derive this accessor (see above)
|
|
||||||
pub fn svc_ntor_key(&self) -> &HsSvcNtorKey {
|
|
||||||
&self.svc_ntor_key
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl EncryptedHsDesc {
|
impl EncryptedHsDesc {
|
||||||
|
|
Loading…
Reference in New Issue