Skip to content

Instantly share code, notes, and snippets.

@ericlagergren
Created September 25, 2015 01:23
Show Gist options
  • Save ericlagergren/1f5f4283ec212d0f4c8d to your computer and use it in GitHub Desktop.
Save ericlagergren/1f5f4283ec212d0f4c8d to your computer and use it in GitHub Desktop.
// package jwt
type Claims map[string]interface{}
type JWT interface{
GetClaims() Claims
}
func Parse(b []byte) JWT {
// heuristics
if isJWE {
return jwe.New()
}
return jws.New()
}
// package jwe
type JWE struct {}
func (j *JWE) GetClaims() jwt.Claims { ... }
// package jws
type JWS struct {}
func (j *JWS) GetClaims() jwt.Claims { ... }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment