-
Notifications
You must be signed in to change notification settings - Fork 20
β¨ (signer-aleo) [LIVE-23538]: Add initial aleo signer files and handler for get app config #1297
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
Open
0xMMBD
wants to merge
6
commits into
LedgerHQ:develop
Choose a base branch
from
blockydevs:feat/live-23538-add-aleo-signer-with-get-config-command
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+1,834
β11
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
9b9922d
β¨ (signer-aleo): Add initial aleo signer files using the generator
0xMMBD 2ded923
π¨ (signer-aleo): Fix linter errors
0xMMBD ab9491c
β¨ (signer-aleo): Add get app config command
0xMMBD a73ed73
β
(signer-aleo): Add tests for the get app config and app errors
0xMMBD c2188c5
π (aleo-signer): Add changelog
0xMMBD 2510d93
π¨ (aleo-signer): Fix linter issues
0xMMBD File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| "@ledgerhq/device-signer-kit-aleo": minor | ||
| --- | ||
|
|
||
| Add aleo-signer module with get app config command support |
This file contains hidden or 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 hidden or 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 | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,314 @@ | ||||||||||||||||||||||
| # Aleo Signer Kit | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| This module provides the implementation of the Ledger aleo signer of the Device Management Kit. It enables interaction with the aleo application on a Ledger device including: | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| - Retrieving the aleo address using a given derivation path | ||||||||||||||||||||||
| - Signing a aleo transaction | ||||||||||||||||||||||
| - Signing a message displayed on a Ledger device | ||||||||||||||||||||||
| - Retrieving the app configuration | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| ## πΉ Index | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| 1. [How it works](#-how-it-works) | ||||||||||||||||||||||
| 2. [Installation](#-installation) | ||||||||||||||||||||||
| 3. [Initialisation](#-initialisation) | ||||||||||||||||||||||
| 4. [Use Cases](#-use-cases) | ||||||||||||||||||||||
| - [Get App Configuration](#use-case-1-get-app-configuration) | ||||||||||||||||||||||
| - [Get Address](#use-case-2-get-address) | ||||||||||||||||||||||
| - [Sign Transaction](#use-case-3-sign-transaction) | ||||||||||||||||||||||
| - [Sign Message](#use-case-4-sign-message) | ||||||||||||||||||||||
| 5. [Observable Behavior](#-observable-behavior) | ||||||||||||||||||||||
| 6. [Example](#-example) | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| ## πΉ How it works | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| The Ledger Aleo Signer utilizes the advanced capabilities of the Ledger device to provide secure operations for end users. It takes advantage of the interface provided by the Device Management Kit to establish communication with the Ledger device and execute various operations. The communication with the Ledger device is performed using [APDU](https://en.wikipedia.org/wiki/Smart_card_application_protocol_data_unit)s (Application Protocol Data Units), which are encapsulated within the `Command` object. These commands are then organized into tasks, allowing for the execution of complex operations with one or more APDUs. The tasks are further encapsulated within `DeviceAction` objects to handle different real-world scenarios. Finally, the Signer exposes dedicated and independent use cases that can be directly utilized by end users. | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| ## πΉ Installation | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| > **Note:** This module is not standalone; it depends on the [@ledgerhq/device-management-kit](https://github.com/LedgerHQ/device-sdk-ts/tree/develop/packages/device-management-kit) package, so you need to install it first. | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| To install the `device-signer-kit-aleo` package, run the following command: | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| ```sh | ||||||||||||||||||||||
| npm install @ledgerhq/device-signer-kit-aleo | ||||||||||||||||||||||
| ``` | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| ## πΉ Initialisation | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| To initialise a Aleo signer instance, you need a Ledger Device Management Kit instance and the ID of the session of the connected device. Use the `SignerAleoBuilder`: | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| ```typescript | ||||||||||||||||||||||
| const signerAleo = new SignerAleoBuilder({ dmk, sessionId }).build(); | ||||||||||||||||||||||
| ``` | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| ## πΉ Use Cases | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| The `SignerAleoBuilder.build()` method will return a `SignerAleo` instance that exposes 4 dedicated methods, each of which calls an independent use case. Each use case will return an object that contains an observable and a method called `cancel`. | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| --- | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| ### Use Case 1: Get App Configuration | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| This method allows users to retrieve the app configuration from the Ledger device. | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| ```typescript | ||||||||||||||||||||||
| const { observable, cancel } = signerAleo.getAppConfig(); | ||||||||||||||||||||||
| ``` | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| #### **Returns** | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| - `observable` Emits DeviceActionState updates, including the following details: | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| ```typescript | ||||||||||||||||||||||
| type GetAppConfigCommandResponse = { | ||||||||||||||||||||||
| // TODO: Define the app configuration response type | ||||||||||||||||||||||
| // Example: | ||||||||||||||||||||||
| // version: string; | ||||||||||||||||||||||
| // flags: number; | ||||||||||||||||||||||
|
Comment on lines
+64
to
+68
|
||||||||||||||||||||||
| type GetAppConfigCommandResponse = { | |
| // TODO: Define the app configuration response type | |
| // Example: | |
| // version: string; | |
| // flags: number; | |
| type AppConfig = { | |
| /** | |
| * Application version in string format (for example, "1.0.0"). | |
| */ | |
| version: string; |
This file contains hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| "use client"; | ||
| import React from "react"; | ||
|
|
||
| import { SessionIdWrapper } from "@/components/SessionIdWrapper"; | ||
| import { SignerAleoView } from "@/components/SignerAleoView"; | ||
|
|
||
| const Signer: React.FC = () => { | ||
| return <SessionIdWrapper ChildComponent={SignerAleoView} />; | ||
| }; | ||
|
|
||
| export default Signer; |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This documentation states the signer exposes 4 working methods (get address / sign transaction / sign message / get config), but in this PR only get-app-config is implemented and the other commands are stubbed (they throw). Please align the docs with the actual supported surface area, or implement the missing commands before documenting them.