steamguard/
protobufs.rs

1use zeroize::Zeroize;
2
3use self::steammessages_base::{cmsg_ipaddress::Ip, cmsg_proto_buf_header::Ip_addr};
4
5include!(concat!(env!("OUT_DIR"), "/protobufs/mod.rs"));
6
7impl Zeroize for Ip {
8	fn zeroize(&mut self) {
9		match self {
10			Ip::V4(ip) => ip.zeroize(),
11			Ip::V6(ip) => ip.zeroize(),
12		}
13	}
14}
15
16impl Zeroize for Ip_addr {
17	fn zeroize(&mut self) {
18		match self {
19			Ip_addr::Ip(ip) => ip.zeroize(),
20			Ip_addr::IpV6(ip) => ip.zeroize(),
21		}
22	}
23}
24
25#[cfg(test)]
26mod parse_tests {
27	use base64::Engine;
28	use protobuf::Message;
29
30	use super::steammessages_auth_steamclient::CAuthentication_GetPasswordRSAPublicKey_Request;
31
32	#[test]
33	fn test_build_protobuf() {
34		let mut req = CAuthentication_GetPasswordRSAPublicKey_Request::new();
35		req.set_account_name("hydrastar2".to_owned());
36
37		let bytes = req.write_to_bytes().unwrap();
38		let s = base64::engine::general_purpose::URL_SAFE.encode(bytes);
39		assert_eq!(s, "CgpoeWRyYXN0YXIy");
40	}
41}