invitation_is_trusted doesn't properly validate open invitations
I was testing this out today and it returns an error for a valid open invitation. Looking at the code, I think I found the issue:
let invite = unspecified_invitation_str.as_bytes();
match lox_utils::validate(invite) {
Ok(_) => Ok(false),
Err(e) => Err(JsValue::from(e.to_string())),
}
The invitation string will look something like [0,1,2,...,X]
and calling as_bytes
is going to place the integer values of [
, ,
, and ]
into the array as well which is not what we want. We want to turn it into an array with just the values of the invitation.