fix(core): update
This commit is contained in:
		
							
								
								
									
										12
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										12
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							| @@ -139,9 +139,9 @@ | ||||
|       } | ||||
|     }, | ||||
|     "@pushrocks/smartcrypto": { | ||||
|       "version": "1.0.5", | ||||
|       "resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartcrypto/-/smartcrypto-1.0.5.tgz", | ||||
|       "integrity": "sha512-GkvR/3LE5X4BI/SALmHP5m4cgN4O5AwBtNSMESGiGGnWD9/JN3FL17ZtA2oXe09uuskeoUeStPPCEGi1VWIs4Q==", | ||||
|       "version": "1.0.7", | ||||
|       "resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartcrypto/-/smartcrypto-1.0.7.tgz", | ||||
|       "integrity": "sha512-o82yK1AcZCSh4YKJAt2LD4qp2wPBC2UYBgloaNhwv6ixITiF1OtKkVMky6uMhlYzTc+YfGFocl1CC0uVlSAaTw==", | ||||
|       "requires": { | ||||
|         "@pushrocks/smartpromise": "^3.0.5", | ||||
|         "@types/node-forge": "^0.8.6", | ||||
| @@ -149,9 +149,9 @@ | ||||
|       }, | ||||
|       "dependencies": { | ||||
|         "@pushrocks/smartpromise": { | ||||
|           "version": "3.0.5", | ||||
|           "resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartpromise/-/smartpromise-3.0.5.tgz", | ||||
|           "integrity": "sha512-9kHBWyDFjQ6cV1rseOfge02EH6huh/mrtqxlFoJoxnMaGWf5F8H3UEsskBBUGI6QKE1Bl8evr74AIKWwJ0r/bA==" | ||||
|           "version": "3.0.6", | ||||
|           "resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartpromise/-/smartpromise-3.0.6.tgz", | ||||
|           "integrity": "sha512-vlQlBGNVIjfClgnsfgQBU6GIKcskYSFzEcKLt18ngPzPEcjKklXcxaqzLXpnoxR+KBh30QPE8255ncYHXuPPOg==" | ||||
|         } | ||||
|       } | ||||
|     }, | ||||
|   | ||||
| @@ -21,7 +21,7 @@ | ||||
|     "tslint-config-prettier": "^1.15.0" | ||||
|   }, | ||||
|   "dependencies": { | ||||
|     "@pushrocks/smartcrypto": "^1.0.5", | ||||
|     "@pushrocks/smartcrypto": "^1.0.7", | ||||
|     "@types/jsonwebtoken": "^8.3.4", | ||||
|     "jsonwebtoken": "^8.5.1" | ||||
|   } | ||||
|   | ||||
| @@ -1,7 +1,12 @@ | ||||
| import * as plugins from './smartjwt.plugins'; | ||||
|  | ||||
| export interface ISmartJWTJSONKeypair { | ||||
|   privatePem: string; | ||||
|   publicPem: string; | ||||
| } | ||||
|  | ||||
| /** | ||||
|  *  | ||||
|  * A class to create and validate JWTs and their keys | ||||
|  */ | ||||
| export class SmartJwt { | ||||
|   public smartcryptoInstance = new plugins.smartcrypto.Smartcrypto(); | ||||
| @@ -42,6 +47,24 @@ export class SmartJwt { | ||||
|     this.publicKey = publicKey; | ||||
|   } | ||||
|  | ||||
|   /** | ||||
|    * gets the currently set kaypair as json | ||||
|    */ | ||||
|   public getKeyPairAsJson(): ISmartJWTJSONKeypair { | ||||
|     return { | ||||
|       privatePem: this.privateKey.toPemString(), | ||||
|       publicPem: this.publicKey.toPemString() | ||||
|     }; | ||||
|   } | ||||
|  | ||||
|   /** | ||||
|    * sets the currently set keypair as json | ||||
|    */ | ||||
|   public setKeyPairAsJson(jsonKeyPair: ISmartJWTJSONKeypair) { | ||||
|     this.privateKey = plugins.smartcrypto.PrivateKey.fromPemString(jsonKeyPair.privatePem); | ||||
|     this.publicKey = plugins.smartcrypto.PublicKey.fromPemString(jsonKeyPair.publicPem); | ||||
|   } | ||||
|  | ||||
|  | ||||
|   /** | ||||
|    * creates a new keypair | ||||
|   | ||||
		Reference in New Issue
	
	Block a user