Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: remove file storage #515

Merged
merged 3 commits into from
Jun 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @biconomy/account

## 4.4.6

### Patch Changes

- Move SessionStorageClient to its own package (https://www.npmjs.com/package/@biconomy/session-file-storage)

## 4.4.5

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"sideEffects": false,
"name": "@biconomy/account",
"author": "Biconomy",
"version": "4.4.5",
"version": "4.4.6",
"description": "SDK for Biconomy integration with support for account abstraction, smart accounts, ERC-4337.",
"keywords": [
"erc-7579",
Expand Down
6 changes: 0 additions & 6 deletions src/modules/SessionKeyManagerModule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import type {
SessionSearchParam,
SessionStatus
} from "./interfaces/ISessionStorage.js"
import { SessionFileStorage } from "./session-storage/SessionFileStorage.js"
import { SessionLocalStorage } from "./session-storage/SessionLocalStorage.js"
import { SessionMemoryStorage } from "./session-storage/SessionMemoryStorage.js"
import {
Expand Down Expand Up @@ -93,11 +92,6 @@ export class SessionKeyManagerModule extends BaseValidationModule {
moduleConfig.smartAccountAddress
)
break
case StorageType.FILE_STORAGE:
instance.sessionStorageClient = new SessionFileStorage(
moduleConfig.smartAccountAddress
)
break
case StorageType.LOCAL_STORAGE:
instance.sessionStorageClient = new SessionLocalStorage(
moduleConfig.smartAccountAddress
Expand Down
301 changes: 0 additions & 301 deletions src/modules/session-storage/SessionFileStorage.ts

This file was deleted.

1 change: 0 additions & 1 deletion src/modules/session-storage/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
export { SessionFileStorage } from "./SessionFileStorage.js"
export { SessionLocalStorage } from "./SessionLocalStorage.js"
export { SessionMemoryStorage } from "./SessionMemoryStorage.js"
export * from "./utils.js"
10 changes: 3 additions & 7 deletions src/modules/session-storage/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,7 @@ import type { Address, Chain, Hex } from "viem"
import type { BiconomySmartAccountV2, SmartAccountSigner } from "../../account"
import type { ISessionStorage } from "../interfaces/ISessionStorage"
import { supportsLocalStorage } from "./SessionLocalStorage"
import {
SessionFileStorage,
SessionLocalStorage,
SessionMemoryStorage
} from "./index.js"
import { SessionLocalStorage, SessionMemoryStorage } from "./index.js"

export type SessionStoragePayload = {
sessionKeyAddress: Hex
Expand All @@ -19,7 +15,7 @@ export type SessionStoragePayload = {
*
* This function is used to store a new session key in the session storage.
* If the session storage client is not provided as the third argument, it will create a new session storage client based on the environment.
* When localStorage is supported, it will return SessionLocalStorage, otherwise it will assume you are in a backend and use SessionFileStorage.
* When localStorage is supported, it will return SessionLocalStorage, otherwise it will assume you are in a backend and use SessionMemoryStorage.
*
* @param smartAccount: BiconomySmartAccountV2
* @param chain: Chain
Expand Down Expand Up @@ -63,7 +59,7 @@ export const getDefaultStorageClient = (address: Address): ISessionStorage => {
return new SessionLocalStorage(address)
}
if (inNodeBackend()) {
return new SessionFileStorage(address)
return new SessionMemoryStorage(address) // Fallback to memory storage
}
throw new Error("No session storage client available")
}
2 changes: 1 addition & 1 deletion src/modules/sessions/abi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ export type SessionGrantedPayload = UserOpResponse & { session: Session }
* import { createSmartAccountClient } from "@biconomy/account"
* import { createWalletClient, http } from "viem";
* import { polygonAmoy } from "viem/chains";
*
* import { SessionFileStorage } from "@biconomy/session-file-storage";
* const signer = createWalletClient({
* account,
* chain: polygonAmoy,
Expand Down
Loading
Loading