Skip to content

whiteflag v1#23

Merged
Romulus10 merged 70 commits intomasterfrom
isaac/whiteflag
Apr 4, 2022
Merged

whiteflag v1#23
Romulus10 merged 70 commits intomasterfrom
isaac/whiteflag

Conversation

@isaacadams
Copy link

@isaacadams isaacadams commented Apr 2, 2022

this code contains the essentials needed for encoding and decoding a whiteflag authentication message according to version 1 of the whiteflag protocol

a few notes

  • there is still some functionality left to be ported, this will be completed in Q2
  • code needs to be cleaned up: ensure idiomatic rust, remove references to java or java-related paradigms, etc.
  • code could possibly be refactored using rust paradigms
  • it is likely the entire whiteflag folder will be moved into its own repo to be turned into its own crate

@isaacadams isaacadams self-assigned this Apr 2, 2022
@isaacadams isaacadams added the enhancement New feature or request label Apr 2, 2022
This was linked to issues Apr 2, 2022
@Romulus10
Copy link
Contributor

The only thing I see is that we should clean out the warnings this generates prior to submission.

encode_bdx(remove_all_invalid_hex_characters(value))
}
EncodingKind::LAT | EncodingKind::LONG => encode_latlong(value),
_ => vec![0],
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Romulus10 only reason I added this is because that is what was in the java codebase

} */
let value = &data[index];
field.set(value.as_ref());
field.set(value.as_ref()).unwrap();
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Romulus10 I haven't fleshed out the error handling -- I began adding it to one or two functions but decided it could wait -- more functions need their outputs changed to handle errors and I can also add unit tests to make sure the errors are being triggered properly -- but I didn't think we needed to worry about that for M3

self.subject_code.clone()
}
pub fn set_subject_code(&mut self, arg: String) -> bool {
if self.subject_code == "" {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would be good to make the fields that can be nothing Option<>'s for the rusty version

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

correct -- there is a lot of work to do in this codebase to make it conform to idiomatic rust

I am not even sure we need all these get() and set() methods as they are more of a java convention

(buffer, len)
}

/**
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, given the proximity to the deadline, I did not focus on reformatting the comments. That is on the to-do list.

@Romulus10 Romulus10 merged commit e81ff15 into master Apr 4, 2022
@Romulus10 Romulus10 deleted the isaac/whiteflag branch April 4, 2022 02:57
body.decode(&buffer, bit_length, bit_cursor, 0);
//bit_cursor += header.bit_length();
//next_field = body.fields.len();

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

edge cases for Q and T message codes need to be ported (see below java method for implementation)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Unpack Hex to Whiteflag Message Pack Whiteflag Message to Hex

3 participants