Skip to content

Commit abd0929

Browse files
committed
Add method to remove session key
1 parent abb795b commit abd0929

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@openfort/openfort-js",
3-
"version": "0.1.7",
3+
"version": "0.1.8",
44
"description": "",
55
"author": "",
66
"repository": {

src/key-pair.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import {LocalStorage} from "./storage/local-storage";
33
import {StorageKeys} from "./storage/storage-keys";
44
import {SigningKey} from "@ethersproject/signing-key";
55
import {arrayify, Bytes, BytesLike, joinSignature} from "@ethersproject/bytes";
6-
import {computeAddress} from "@ethersproject/transactions"
6+
import {computeAddress} from "@ethersproject/transactions";
77
import {hashMessage} from "@ethersproject/hash";
88

99
export class KeyPair extends SigningKey {
@@ -32,6 +32,13 @@ export class KeyPair extends SigningKey {
3232
await KeyPair.storage.save(StorageKeys.SESSION_KEY, this.privateKey);
3333
}
3434

35+
/**
36+
* Remove the keypair from the storage
37+
*/
38+
public async remove(): Promise<void> {
39+
await KeyPair.storage.remove(StorageKeys.SESSION_KEY);
40+
}
41+
3542
/**
3643
* Load private key from the storage and generate keypair based on it.
3744
*/

src/openfort.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,10 @@ export default class Openfort {
4949
return this.sessionKey.save();
5050
}
5151

52+
public async removeSessionKey(): Promise<void> {
53+
return this.sessionKey.remove();
54+
}
55+
5256
public signMessage(message: Bytes | string): string {
5357
return this.sessionKey.sign(message);
5458
}

0 commit comments

Comments
 (0)