fix(core): update
This commit is contained in:
@ -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