Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

types fix #1519

Closed
wants to merge 3 commits into from
Closed

types fix #1519

wants to merge 3 commits into from

Conversation

rrrooommmaaa
Copy link
Contributor

allow constructing keys from packet list of AllowedKeyPackets (includes Signature, UserId etc.), the reverse of toPacketList()

…kets` (includes Signature, UserId etc.), the reverse of `toPacketList()`
@larabr
Copy link
Collaborator

larabr commented May 13, 2022

Thanks! These constructors should actually take AnyPacket, since those that are not AllowedKeyPackets are accepted and simply ignored -- they do not cause runtime errors.
That said, a PrivateKey constructor errors if it encounters Public(Sub)Key packets, and similarly a PublicKey will reject Private(Sub)Key packets.

We could improve the types in that sense, if needed, e.g. using Exclude.

@larabr
Copy link
Collaborator

larabr commented May 24, 2022

My bad, Exclude can only be used with union types and it does nothing in this case. I'd have expected some sort of warning from the compiler at least.

@larabr
Copy link
Collaborator

larabr commented May 24, 2022

Thanks for the fix! I've included it in #1522 , since it required a related type update.

@larabr larabr closed this May 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants