Skip to content

Commit 0d3e204

Browse files
committed
fix: remove unrelated changes
1 parent eab02d5 commit 0d3e204

File tree

1 file changed

+1
-44
lines changed

1 file changed

+1
-44
lines changed

src/helper/browserStorage.ts

Lines changed: 1 addition & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
import { TKeyTSS } from "@tkey/tss";
2-
import BN from "bn.js";
3-
4-
import { FIELD_ELEMENT_HEX_LEN } from "../constants";
5-
import { IAsyncStorage, IStorage, TkeyLocalStoreData } from "../interfaces";
1+
import { IAsyncStorage, IStorage } from "../interfaces";
62
import CoreKitError from "./errors";
73

84
export class MemoryStorage implements IStorage {
@@ -70,42 +66,3 @@ export class AsyncStorage {
7066
await this.storage.setItem(this._storeKey, JSON.stringify(store));
7167
}
7268
}
73-
74-
export class DeviceStorage {
75-
private tKey: TKeyTSS;
76-
77-
private currentStorage: AsyncStorage;
78-
79-
constructor(tkeyInstance: TKeyTSS, currentStorage: AsyncStorage) {
80-
this.tKey = tkeyInstance;
81-
this.currentStorage = currentStorage;
82-
}
83-
84-
// device factor
85-
async setDeviceFactor(factorKey: BN, replace = false): Promise<void> {
86-
if (!replace) {
87-
const existingFactor = await this.getDeviceFactor();
88-
if (existingFactor) {
89-
throw CoreKitError.default("Device factor already exists");
90-
}
91-
}
92-
93-
const metadata = this.tKey.getMetadata();
94-
const tkeyPubX = metadata.pubKey.x.toString(16, FIELD_ELEMENT_HEX_LEN);
95-
await this.currentStorage.set(
96-
tkeyPubX,
97-
JSON.stringify({
98-
factorKey: factorKey.toString("hex").padStart(64, "0"),
99-
} as TkeyLocalStoreData)
100-
);
101-
}
102-
103-
async getDeviceFactor(): Promise<string | undefined> {
104-
const metadata = this.tKey.getMetadata();
105-
106-
const tkeyPubX = metadata.pubKey.x.toString(16, FIELD_ELEMENT_HEX_LEN);
107-
const tKeyLocalStoreString = await this.currentStorage.get<string>(tkeyPubX);
108-
const tKeyLocalStore = JSON.parse(tKeyLocalStoreString || "{}") as TkeyLocalStoreData;
109-
return tKeyLocalStore.factorKey;
110-
}
111-
}

0 commit comments

Comments
 (0)