forked from alchemyplatform/aa-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add session key extensions for managing keys
- Loading branch information
Showing
6 changed files
with
131 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
import { client } from "./base-client.js"; | ||
|
||
// TODO before GA, we should add a util like we do for remove session key to make this easier | ||
const result = await client.rotateSessionKey({ | ||
args: ["0xOldKey", "0xpredecessor", "0xNewKey"], | ||
oldKey: "0xOldKey", | ||
newKey: "0xNewKey", | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,14 @@ | ||
import { SessionKeyPermissionsBuilder } from "@alchemy/aa-accounts"; | ||
import { client } from "./base-client.js"; | ||
|
||
const result = await client.updateKeyPermissions({ | ||
const result = await client.updateSessionKeyPermissions({ | ||
key: "0xSessionKeyAddress", | ||
// add other permissions to the builder | ||
args: [ | ||
"0xSessionKeyAddress", | ||
new SessionKeyPermissionsBuilder() | ||
.setTimeRange({ | ||
validFrom: Date.now() / 1000, | ||
// valid for 1 hour | ||
validUntil: Date.now() / 1000 + 60 * 60, | ||
}) | ||
.encode(), | ||
], | ||
permissions: new SessionKeyPermissionsBuilder() | ||
.setTimeRange({ | ||
validFrom: Date.now() / 1000, | ||
// valid for 1 hour | ||
validUntil: Date.now() / 1000 + 60 * 60, | ||
}) | ||
.encode(), | ||
}); |