You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					16 lines
				
				431 B
			
		
		
			
		
	
	
					16 lines
				
				431 B
			| 
								 
											3 years ago
										 
									 | 
							
								var jwt = require('../');
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								describe('public key start with BEGIN RSA PUBLIC KEY', function () {
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								  it('should work', function (done) {
							 | 
						||
| 
								 | 
							
								    var fs = require('fs');
							 | 
						||
| 
								 | 
							
								    var cert_pub = fs.readFileSync(__dirname + '/rsa-public-key.pem');
							 | 
						||
| 
								 | 
							
								    var cert_priv = fs.readFileSync(__dirname + '/rsa-private.pem');
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								    var token = jwt.sign({ foo: 'bar' }, cert_priv, { algorithm: 'RS256'});
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								    jwt.verify(token, cert_pub, done);
							 | 
						||
| 
								 | 
							
								  });
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								});
							 |