func (g *generic) parseFlat(u ...json.Unmarshaler) (JWS, error) { var p payload if len(u) > 0 { p.u = u[0] } if err := p.UnmarshalJSON(g.Payload); err != nil { return nil, err } if err := g.sigHead.unmarshal(); err != nil { return nil, err } g.sigHead.clean = true if err := checkHeaders(jose.Header(g.sigHead.protected), g.sigHead.unprotected); err != nil { return nil, err } if err := g.sigHead.assignMethod(g.sigHead.protected); err != nil { return nil, err } return &jws{ payload: &p, plcache: g.Payload, clean: true, sb: []sigHead{g.sigHead}, }, nil }
func (g *generic) parseGeneral(u ...json.Unmarshaler) (JWS, error) { var p payload if len(u) > 0 { p.u = u[0] } if err := p.UnmarshalJSON(g.Payload); err != nil { return nil, err } for i := range g.Signatures { if err := g.Signatures[i].unmarshal(); err != nil { return nil, err } if err := checkHeaders(jose.Header(g.Signatures[i].protected), g.Signatures[i].unprotected); err != nil { return nil, err } if err := g.Signatures[i].assignMethod(g.Signatures[i].protected); err != nil { return nil, err } } g.clean = len(g.Signatures) != 0 return &jws{ payload: &p, plcache: g.Payload, clean: true, sb: g.Signatures, }, nil }