Skip to content

Commit

Permalink
🔀 (sync): Resolve conflicts with develop
Browse files Browse the repository at this point in the history
  • Loading branch information
valpinkman committed Nov 22, 2024
2 parents 0b12fca + 8c2c05d commit 00cea69
Show file tree
Hide file tree
Showing 237 changed files with 2,742 additions and 1,738 deletions.
2 changes: 1 addition & 1 deletion .changeset/calm-months-live.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
"@ledgerhq/device-signer-kit-btc": minor
"@ledgerhq/device-signer-kit-bitcoin": minor
---

Implement MerkleTree and MerkleMap services
9 changes: 9 additions & 0 deletions .changeset/chilly-carpets-press.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
"@ledgerhq/device-management-kit": minor
"@ledgerhq/device-transport-kit-mockserver": minor
"@ledgerhq/device-transport-kit-web-ble": minor
"@ledgerhq/device-transport-kit-web-hid": minor
"@ledgerhq/device-management-kit-sample": minor
---

Extract Transports to their own module
8 changes: 1 addition & 7 deletions .changeset/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,5 @@
"access": "public",
"baseBranch": "develop",
"updateInternalDependencies": "patch",
"ignore": [
"@ledgerhq/ledger-dmk-docs",
"@ledgerhq/device-management-kit-sample",
"@ledgerhq/device-signer-kit-btc",
"@ledgerhq/device-signer-kit-ethereum",
"@ledgerhq/context-module"
]
"ignore": []
}
2 changes: 1 addition & 1 deletion .changeset/cuddly-impalas-sing.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
"@ledgerhq/device-signer-kit-btc": minor
"@ledgerhq/device-signer-kit-bitcoin": minor
---

Implement GetExtendedPublicKeyCommand
5 changes: 5 additions & 0 deletions .changeset/gorgeous-tables-cheer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@ledgerhq/device-signer-kit-bitcoin": patch
---

Set bitcoin-js as peer dep
2 changes: 1 addition & 1 deletion .changeset/lucky-keys-explode.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
"@ledgerhq/device-signer-kit-btc": minor
"@ledgerhq/device-signer-kit-bitcoin": minor
---

Implement GetMasterFingerprintCommand
2 changes: 1 addition & 1 deletion .changeset/mighty-vans-kiss.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
"@ledgerhq/device-signer-kit-btc": patch
"@ledgerhq/device-signer-kit-bitcoin": patch
---

Implement wallet policy service
2 changes: 1 addition & 1 deletion .changeset/perfect-deers-sneeze.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
"@ledgerhq/device-signer-kit-btc": patch
"@ledgerhq/device-signer-kit-bitcoin": patch
---

Rename packages
5 changes: 5 additions & 0 deletions .changeset/rich-pumpkins-laugh.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@ledgerhq/device-signer-kit-ethereum": patch
---

Improve transaction v6 typeguard
4 changes: 2 additions & 2 deletions .changeset/tall-hairs-cheer.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
"@ledgerhq/device-signer-kit-btc": minor
"@ledgerhq/device-signer-kit-bitcoin": minor
---

Create device-signer-kit-btc package
Create device-signer-kit-bitcoin package
2 changes: 1 addition & 1 deletion .changeset/weak-ads-chew.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
"@ledgerhq/device-signer-kit-btc": patch
"@ledgerhq/device-signer-kit-bitcoin": patch
---

Implement PSBT parser and mapper services
2 changes: 1 addition & 1 deletion .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
checks:
name: Run health check and unit tests
needs: [danger]
runs-on: ${{ github.event.pull_request.head.repo.fork == 'true' && 'ubuntu-latest' || 'ledgerhq-device-sdk' }}
runs-on: ${{ !github.event.pull_request.head.repo.fork && 'ledgerhq-device-sdk' || 'ubuntu-latest' }}
steps:
- uses: actions/checkout@v4

Expand Down
59 changes: 48 additions & 11 deletions .github/workflows/snapshot_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,29 @@ on:
inputs:
ref:
description: The base branch to publish a snapshot release from
required: true
required: false
default: "develop"
tag:
description: Snapshot version name
required: false
default: ""
default: "develop"

env:
FORCE_COLOR: "1"
# if no inputs it's considered as a cron job
REF: ${{ inputs.ref || 'develop' }}
TAG: ${{ inputs.tag || 'develop' }}
NPM_TOKEN: ${{ secrets.NPMJS_TOKEN }}
REF: ${{ inputs.ref }}
TAG: ${{ inputs.tag }}
NPM_REGISTRY: jfrog.ledgerlabs.net/artifactory/api/npm/ldk-npm-prod-public

permissions:
id-token: write
contents: write
pull-requests: write
# Need to attest artifacts
attestations: write

jobs:
snapshot:
runs-on: ubuntu-latest
runs-on: ledgerhq-device-sdk
steps:
- uses: actions/checkout@v4
with:
Expand All @@ -31,14 +37,45 @@ jobs:
- uses: LedgerHQ/device-sdk-ts/.github/actions/setup-toolchain-composite@develop

- name: build libraries
run: pnpm build
run: pnpm build:libs

- name: Login to internal JFrog registry
id: jfrog-login
uses: LedgerHQ/actions-security/actions/jfrog-login@actions/jfrog-login-1

- name: Setup npm config for JFrog
env:
NPM_REGISTRY_TOKEN: ${{ steps.jfrog-login.outputs.oidc-token }}
run: |
cat << EOF | tee .npmrc
enable-pre-post-scripts=true
registry=https://${NPM_REGISTRY}/
//${NPM_REGISTRY}/:_authToken=${NPM_REGISTRY_TOKEN}
EOF
- name: Create dist directory to store tarball
run: mkdir -p dist

- name: create .npmrc
run: echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" >> .npmrc
# - name: create .npmrc
# run: echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" >> .npmrc

- name: create and publish snapshot release version
id: changesets
run: |
pnpm bump --snapshot ${{ env.TAG }}
pnpm release --snapshot --no-git-tag --tag ${{ env.TAG }}
env:
GITHUB_TOKEN: ${{ github.token }}
GITHUB_TOKEN: ${{ secrets.CI_BOT_TOKEN }}

- name: Attest tarball
if: steps.changesets.conclusion == 'success'
uses: LedgerHQ/actions-security/actions/attest@actions/attest-1
with:
subject-path: ./dist

# The action currently doesn't support pushing the blob to the registry
- name: Sign tarball
if: steps.changesets.conclusion == 'success'
uses: LedgerHQ/actions-security/actions/sign-blob@actions/sign-blob-1
with:
path: ./dist
27 changes: 15 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,16 +81,19 @@ This project uses [turbo monorepo](https://turbo.build/repo/docs) to build and r

A brief description of this project packages:

| Name | Path | Description |
|----------------------------------------|--------------------------------|------------------------------------------------------------------------------------------------------------------------------------------|
| @ledgerhq/device-management-kit-sample | apps/sample | React Next web app used to test & demonstrate the Web Device Management Kit |
| @ledgerhq/eslint-config-dsdk | packages/config/eslint | internal package which contains eslint shared config. Used by `extends: ["@ledgerhq/dsdk"]` in `.eslintrc`. |
| @ledgerhq/jest-config-dsdk | packages/config/jest | internal package which contains jest shared config. Used by `preset: "@ledgerhq/jest-config-dsdk"` in `jest.config.ts` |
| @ledgerhq/tsconfig-dsdk | packages/config/typescript | internal package which contains typescript shared config. Used by `"extends": "@ledgerhq/tsconfig-dsdk/tsconfig.sdk"` in `tsconfig.json` |
| @ledgerhq/device-management-kit | packages/device-management-kit | external package that contains the core of the Web Device Management Kit |
| @ledgerhq/device-signer-kit-ethereum | packages/signer/signer-eth | external package that contains device ethereum coin application dedicated handlers |
| @ledgerhq/device-signer-kit-solana | packages/signer/signer-solana | external package that contains device solana coin application dedicated handlers |
| @ledgerhq/device-management-kit-flipper-plugin-client | packages/flipper-plugin-client | external package that contains [flipper](https://github.com/facebook/flipper) logger for Device Management Kit |
| Name | Path | Description |
|-------------------------------------------------------|--------------------------------|------------------------------------------------------------------------------------------------------------------------------------------|
| @ledgerhq/device-management-kit-sample | apps/sample | React Next web app used to test & demonstrate the Web Device Management Kit |
| @ledgerhq/eslint-config-dsdk | packages/config/eslint | internal package which contains eslint shared config. Used by `extends: ["@ledgerhq/dsdk"]` in `.eslintrc`. |
| @ledgerhq/jest-config-dsdk | packages/config/jest | internal package which contains jest shared config. Used by `preset: "@ledgerhq/jest-config-dsdk"` in `jest.config.ts` |
| @ledgerhq/tsconfig-dsdk | packages/config/typescript | internal package which contains typescript shared config. Used by `"extends": "@ledgerhq/tsconfig-dsdk/tsconfig.sdk"` in `tsconfig.json` |
| @ledgerhq/device-management-kit | packages/device-management-kit | external package that contains the core of the Web Device Management Kit |
| @ledgerhq/device-signer-kit-ethereum | packages/signer/signer-eth | external package that contains device ethereum coin application dedicated handlers |
| @ledgerhq/device-signer-kit-solana | packages/signer/signer-solana | external package that contains device solana coin application dedicated handlers |
| @ledgerhq/device-management-kit-flipper-plugin-client | packages/flipper-plugin-client | external package that contains [flipper](https://github.com/facebook/flipper) logger for Device Management Kit |
| @ledgerhq/device-transport-kit-web-hid | packages/transport/web-hid | external package that contains the Web Hid transport implementation |
| @ledgerhq/device-transport-kit-web-ble | packages/transport/web-ble | external package that contains the Web Ble transport implementation |
| @ledgerhq/device-mockserver-client | packages/mockserver-client | external package that contains the client to interact with the mock-server |

# Getting started

Expand Down Expand Up @@ -178,7 +181,7 @@ Please configure JEST extention accordingly.

Each package is built using the following command (at the root of the monorepo).

### Core
### Device Management Kit

Device Management Kit main module.

Expand Down Expand Up @@ -275,7 +278,7 @@ pnpm hygen <name> with-prompt

| workspace | script | description |
| --------- | --------------- | ------------------------------------- |
| 📦 core | `module:create` | scaffolds a new _src/internal_ module |
| 📦 dmk | `module:create` | scaffolds a new _src/internal_ module |

## Play with the sample app ?

Expand Down
6 changes: 3 additions & 3 deletions apps/docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
"@ledgerhq/eslint-config-dsdk": "workspace:*",
"@ledgerhq/prettier-config-dsdk": "workspace:*",
"@ledgerhq/tsconfig-dsdk": "workspace:*",
"@types/node": "^22.7.5",
"@types/react": "^18.3.11",
"globals": "15.11.0"
"@types/node": "^22.9.0",
"@types/react": "^18.3.12",
"globals": "15.12.0"
}
}
4 changes: 0 additions & 4 deletions apps/docs/pages/_meta.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,5 @@
"docs": {
"title": "Documentation",
"type": "page"
},
"references": {
"title": "References",
"type": "page"
}
}
2 changes: 1 addition & 1 deletion apps/docs/pages/docs/_meta.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"docs": "Ledger Device Management Kits",
"explanations": "Explanations",
"begginers": "Begginer's guide",
"beginners": "Beginner's guide",
"integration_walkthroughs": "Integration Walkthrough",
"migrations": "Migrations",
"references": "References (TSDoc)"
Expand Down
Empty file removed apps/docs/pages/docs/begginers.mdx
Empty file.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion apps/docs/pages/docs/docs.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ You can follow the migration guidelines [here](./migrations/)

## Glossary

Through all the documentation we will use some acronyme that you can find the following description :
Throughout all the documentation we will use several acronyms that you can find the following description :

- DMK: Device Management Kit
- DSK: Device Signer Kit
Expand Down
Empty file.
26 changes: 15 additions & 11 deletions apps/docs/pages/docs/explanations/dmk.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Callout } from "nextra/components";

# Device Management Kit

The device management kit is the entry point for all the other libraries related to.
The device management kit is the entry point for all the other libraries related to it.
As we wanted to make the project modular.

## Main Features
Expand All @@ -22,9 +22,9 @@ As we wanted to make the project modular.
> [!NOTE]
> At the moment we do not provide the possibility to distinguish two devices of the same model, via WebHID and to avoid connection to the same device twice.
## Communicate with the device
## Communicate with a Ledger device

DMK is offering several ways to communicate with the device.
The DMK is offering several ways to communicate with a Ledger device.

### Send APDU

Expand All @@ -33,11 +33,12 @@ DMK is offering several ways to communicate with the device.
the _Command_ or _DeviceAction_ instead.
</Callout>

You can send APDU commands to the device using the `sendApdu` method of the `dmk` instance.
Parameters:
You can send APDU commands to the device using the `sendApdu` method of the Device Management Kit instance (here `dmk`) instance.

- `sessionId`: string - The session ID, which an identifier of the connection with a device.
- `apdu`: UInt8Array - Byte array of data to be send to the device.
<u>**Parameters**</u>:

- `sessionId`: string - The session ID, identifier of the connection with a device.
- `apdu`: UInt8Array - bytes array of data to be send to the device.

```typescript
await dmk.sendApdu({ sessionId, apdu });
Expand All @@ -47,7 +48,8 @@ await dmk.sendApdu({ sessionId, apdu });

Commands are pre-defined actions that you can send to the device.
You can use the `sendCommand` method of the `dmk` instance to send a command to the device.
Parameters:

<u>**Parameters**</u>:

- `sessionId`: string - The session ID, which an identifier of the connection with a device.
- `command`: Command - The command to be sent to the device.
Expand All @@ -67,7 +69,7 @@ You can use the `executeDeviceAction` method of the `dmk` instance to execute a
It is returning an observable that will emit different states of the action execution.
A device action is cancellable, you can cancel it by calling the `cancel` function returned by the `executeDeviceAction` method.

Parameters:
<u>**Parameters**</u>:

- `sessionId`: string - The session ID, which an identifier of the connection with a device.
- `deviceAction`: DeviceAction - The DeviceAction to be sent to the device.
Expand All @@ -84,8 +86,10 @@ const { observable, cancel } = await dmk.executeDeviceAction({
## State Management

For each connected device, we are managing and providing a device state.
The states are:

The different states are:

- `connected`: The device is connected.
- `locked`: The device is locked.
- `locked`: The device is locked. User needs to unlock it to perform operations.
- `busy`: The device is busy, so not reachable.
- `disconnected`: The device is disconnected.
8 changes: 4 additions & 4 deletions apps/docs/pages/docs/explanations/ledgerjs.mdx
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
# Differences with LedgerJS

Device management kit aim to replace LedgerJS libraries, mainly `hw-app-XXX` and `transport-XXX` libraries
Device management kit aims to replace LedgerJS libraries, mainly `hw-app-XXX` and `hw-transport-XXX` libraries

## Current Problems

Ledger JS libraries where initially made for **Ledger Live** applications. As Ledger Live is a pretty old project (> 7 years),
we have inevitably a big technical debt. Moreover time make that some part of the logic are today hard to understand and to maintain.

Moreover, some device behavior are not well handled by the libraries. For example, opening an application on the device will cause unexpected disconnection.
Another feedback we have learnt from partners (software wallets) is that we have a lack of simplicity in the libraries, it require low level knowledge to use them (ex: APDU concept).
Some device behavior are not correctly handled by the libraries, for example opening an application on the device will cause unexpected disconnection.
Another feedback we have learnt from partners (software wallets) is that we have a lack of simplicity in the libraries, it requires low level knowledge to use them (ex: APDU concept).

## Target

LedgerJS was intended for Ledger Live. It was not designed to be used by third party developers.
With DMK we are targeting **third party developers first**.
With the Device Management Kit we are targeting **third party developers first**.

## Abstract complexity

Expand Down
6 changes: 3 additions & 3 deletions apps/docs/pages/docs/explanations/signers.mdx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# Signer Kits

As ledger device are able to install application that will allow to be compatible with different blockchain,
As ledger devices are able to install applications that will allow to be compatible with different blockchains,
we have created these kits.

Each **signer kit** is coming along with a Ledger Embedded App (ex: _signer-kit-eth_ is comig with _ledger app ethereum_ ).
Each **signer kit** is coming along with a Ledger Embedded App (ex: _signer-kit-eth_ is coming with _ledger app ethereum_ ).

The main goal of each signer is to ease interaction with the app in the seamlessly possible way.
The main goal of each signer is to ease interaction with the app in the most seamless way possible.

## Available Signers

Expand Down
2 changes: 1 addition & 1 deletion apps/docs/pages/docs/explanations/signers/eth.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -530,7 +530,7 @@ const { observable, cancel } = signerEth.signTypedData(

## Example

We encourage you to explore the Ethereum Signer by trying it out in our online [sample application](https://app.devicesdk.ledger-test.com/). Experience how it works and see its capabilities in action. Of course, you will need a Ledger device connected.
We encourage you to explore the Ethereum Signer by trying it out in our online [sample application](https://app.devicesdk.ledger.com/). Experience how it works and see its capabilities in action. Of course, you will need a Ledger device connected.

## Clear Signing Initiative

Expand Down
7 changes: 5 additions & 2 deletions apps/docs/pages/docs/references.mdx
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#References
# References

Device Management Kit References
Device Management Kits References:

- [Device Management Kit]() - _Coming Soon..._
- [Device Signer Kit Ethereum]() - _Coming Soon..._
Loading

0 comments on commit 00cea69

Please sign in to comment.