rpc: Add regression tests for encoding/decoding public keys (#15054)
This PR adds some tests to ensure we don't regress in our public key encoding/decoding capabilities when making changes in this area. Release Notes: - N/A
This commit is contained in:
parent
9d11a6ff78
commit
1307a80e07
2 changed files with 19 additions and 0 deletions
|
@ -107,6 +107,20 @@ mod tests {
|
|||
assert_eq!(decrypted_token, token);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_encode_and_decode_base64_public_key() {
|
||||
// A base64-encoded public key.
|
||||
//
|
||||
// We're using a literal string to ensure that encoding and decoding works across differences in implementations.
|
||||
let encoded_public_key = "MIGJAoGBAMPvufou8wOuUIF1Wlkbtn0ZMM9nC55QJ06nTZvgMfZv5esFVU9-cQO_JC1P9ZoEcMDJweFERnQuQLqzsrMDLFbkdgL128ZU43WOLiQraxaICFIZsPUeTtWMKp2D5bPWsNxs-lnCma7vCAry6fpXuj5AKQdk7cTZJNucgvZQ0uUfAgMBAAE=".to_string();
|
||||
|
||||
// Make sure we can parse the public key.
|
||||
let public_key = PublicKey::try_from(encoded_public_key.clone()).unwrap();
|
||||
|
||||
// Make sure we re-encode to the same format.
|
||||
assert_eq!(encoded_public_key, String::try_from(public_key).unwrap());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_tokens_are_always_url_safe() {
|
||||
for _ in 0..5 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue