Skip to content

asn1: Support type aliases #14892

@loewexy

Description

@loewexy

While working with the new asn1 module i stubled upon one limitation when using type aliases. For example this excerpt from the documentation:

@asn1.sequence
class Validity:
    not_before: asn1.UTCTime | asn1.GeneralizedTime
    not_after: asn1.UTCTime | asn1.GeneralizedTime

I would be nice to instead write:

type Time = asn1.UTCTime | asn1.GeneralizedTime

@asn1.sequence
class Validity:
    not_before: Time
    not_after: Time

However this is currently not supported by cryptography. I think it would be nice to also support type aliases, so common combinations can be declared and reused.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions