func TestDecode(t *testing.T) {
	assert := audit.NewTestingAssertion(t, true)
	privateKey, err := rsa.GenerateKey(rand.Reader, 2048)
	assert.Nil(err)
	claims := initClaims()
	assert.Logf("testing decoding without verifying")
	// Encode.
	jwtEncode, err := jwt.Encode(claims, privateKey, jwt.RS512)
	assert.Nil(err)
	parts := strings.Split(jwtEncode.String(), ".")
	assert.Length(parts, 3)
	// Decode.
	jwtDecode, err := jwt.Decode(jwtEncode.String())
	assert.Nil(err)
	assert.Equal(jwtEncode.Algorithm(), jwtDecode.Algorithm())
	key, err := jwtDecode.Key()
	assert.Nil(key)
	assert.ErrorMatch(err, ".*no key available, only after encoding or verifying.*")
	assert.Equal(jwtEncode.String(), jwtDecode.String())
	testClaims(assert, jwtDecode.Claims())
}
// TestDecode tests the decoding without verifying the signature.
TestDecode tests the decoding without verifying the signature.
// TestDecode tests the decoding without verifying the signature .
func TestDecode(t *testing.T) {
	assert := audit.NewTestingAssertion(t, true)
	privateKey, err := rsa.GenerateKey(rand.Reader, 2048)
	assert.Nil(err)
	claims := initClaims()
	assert.Logf("testing decoding without verifying")
	jwtEncode, err := jwt.Encode(claims, privateKey, jwt.RS512)
	assert.Nil(err)
	parts := strings.Split(jwtEncode.String(), ".")
	assert.Length(parts, 3)
	jwtDecode, err := jwt.Decode(jwtEncode.String())
	assert.Nil(err)
	assert.Equal(jwtEncode.Algorithm(), jwtDecode.Algorithm())
	key, err := jwtDecode.Key()
	assert.Nil(key)
	assert.ErrorMatch(err, ".*no key available, only after encoding or verifying.*")
	assert.Equal(jwtEncode.String(), jwtDecode.String())
	testClaims(assert, jwtDecode.Claims())
}
func TestDecode ( t * testing . T ) { assert := audit . NewTestingAssertion ( t , true ) privateKey , err := rsa . GenerateKey ( rand . Reader , 2048 ) assert . Nil ( err ) claims := initClaims ( ) assert . Logf ( " " ) jwtEncode , err := jwt . Encode ( claims , privateKey , jwt . RS512 ) assert . Nil ( err ) parts := strings . Split ( jwtEncode . String ( ) , " " ) assert . Length ( parts , 3 ) jwtDecode , err := jwt . Decode ( jwtEncode . String ( ) ) assert . Nil ( err ) assert . Equal ( jwtEncode . Algorithm ( ) , jwtDecode . Algorithm ( ) ) key , err := jwtDecode . Key ( ) assert . Nil ( key ) assert . ErrorMatch ( err , " " ) assert . Equal ( jwtEncode . String ( ) , jwtDecode . String ( ) ) testClaims ( assert , jwtDecode . Claims ( ) ) }
TestDecode tests the decoding without verifying the signature.
TestDecode tests the decoding without verifying the signature .
// Encode. // Decode.