Skip to content

JWS: Does the General vs. Flattened format make sense? #25

@tgross35

Description

@tgross35

The current representation is as follows:

pub enum Jws {
    General(General),
    Flattened(Flattened),
}

pub struct General {
    pub payload: Option<Bytes>,
    pub signatures: Vec<Signature>,
}

pub struct Flattened {
    pub payload: Option<Bytes>,
    pub signature: Signature,
}

It seems a bit unusual to define general vs. flattened at the top level since it's only relevant for signatures. It seems like maybe something like this would work a bit better:

pub enum Jws {
    pub payload: Option<Bytes>,
    pub signatures: SomeSignatureEnum,
}

enum SomeSignatureEnum {
    Flattened(Signature),
    General(Vec<Signature>)
}

And this would at least make it easier to work with payload without needing to branch on General/Flattened.

Just curious what thoughts are here

Related: #22

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