@ledgerhq/device-signer-kit-icp 0.0.0-develop-20260721105622
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.MD +202 -0
- package/README.md +186 -0
- package/lib/cjs/api/SignerIcp.js +2 -0
- package/lib/cjs/api/SignerIcp.js.map +7 -0
- package/lib/cjs/api/SignerIcpBuilder.js +2 -0
- package/lib/cjs/api/SignerIcpBuilder.js.map +7 -0
- package/lib/cjs/api/SignerIcpBuilder.test.js +2 -0
- package/lib/cjs/api/SignerIcpBuilder.test.js.map +7 -0
- package/lib/cjs/api/app-binder/GetAddressDeviceActionTypes.js +2 -0
- package/lib/cjs/api/app-binder/GetAddressDeviceActionTypes.js.map +7 -0
- package/lib/cjs/api/app-binder/GetVersionDeviceActionTypes.js +2 -0
- package/lib/cjs/api/app-binder/GetVersionDeviceActionTypes.js.map +7 -0
- package/lib/cjs/api/app-binder/SignTransactionDeviceActionTypes.js +2 -0
- package/lib/cjs/api/app-binder/SignTransactionDeviceActionTypes.js.map +7 -0
- package/lib/cjs/api/index.js +2 -0
- package/lib/cjs/api/index.js.map +7 -0
- package/lib/cjs/api/model/Address.js +2 -0
- package/lib/cjs/api/model/Address.js.map +7 -0
- package/lib/cjs/api/model/Signature.js +2 -0
- package/lib/cjs/api/model/Signature.js.map +7 -0
- package/lib/cjs/api/model/Version.js +2 -0
- package/lib/cjs/api/model/Version.js.map +7 -0
- package/lib/cjs/index.js +2 -0
- package/lib/cjs/index.js.map +7 -0
- package/lib/cjs/internal/DefaultSignerIcp.js +2 -0
- package/lib/cjs/internal/DefaultSignerIcp.js.map +7 -0
- package/lib/cjs/internal/DefaultSignerIcp.test.js +2 -0
- package/lib/cjs/internal/DefaultSignerIcp.test.js.map +7 -0
- package/lib/cjs/internal/app-binder/IcpAppBinder.js +2 -0
- package/lib/cjs/internal/app-binder/IcpAppBinder.js.map +7 -0
- package/lib/cjs/internal/app-binder/IcpAppBinder.test.js +2 -0
- package/lib/cjs/internal/app-binder/IcpAppBinder.test.js.map +7 -0
- package/lib/cjs/internal/app-binder/command/GetAddressCommand.js +2 -0
- package/lib/cjs/internal/app-binder/command/GetAddressCommand.js.map +7 -0
- package/lib/cjs/internal/app-binder/command/GetAddressCommand.test.js +2 -0
- package/lib/cjs/internal/app-binder/command/GetAddressCommand.test.js.map +7 -0
- package/lib/cjs/internal/app-binder/command/GetVersionCommand.js +2 -0
- package/lib/cjs/internal/app-binder/command/GetVersionCommand.js.map +7 -0
- package/lib/cjs/internal/app-binder/command/GetVersionCommand.test.js +2 -0
- package/lib/cjs/internal/app-binder/command/GetVersionCommand.test.js.map +7 -0
- package/lib/cjs/internal/app-binder/command/SignTransactionCommand.js +2 -0
- package/lib/cjs/internal/app-binder/command/SignTransactionCommand.js.map +7 -0
- package/lib/cjs/internal/app-binder/command/SignTransactionCommand.test.js +2 -0
- package/lib/cjs/internal/app-binder/command/SignTransactionCommand.test.js.map +7 -0
- package/lib/cjs/internal/app-binder/command/__test-utils__/expectStatusWordError.js +2 -0
- package/lib/cjs/internal/app-binder/command/__test-utils__/expectStatusWordError.js.map +7 -0
- package/lib/cjs/internal/app-binder/command/__test-utils__/pathToBuffer.js +2 -0
- package/lib/cjs/internal/app-binder/command/__test-utils__/pathToBuffer.js.map +7 -0
- package/lib/cjs/internal/app-binder/command/utils/EncodeDerivationPath.js +2 -0
- package/lib/cjs/internal/app-binder/command/utils/EncodeDerivationPath.js.map +7 -0
- package/lib/cjs/internal/app-binder/command/utils/EncodeDerivationPath.test.js +2 -0
- package/lib/cjs/internal/app-binder/command/utils/EncodeDerivationPath.test.js.map +7 -0
- package/lib/cjs/internal/app-binder/command/utils/IcpApplicationError.test.js +2 -0
- package/lib/cjs/internal/app-binder/command/utils/IcpApplicationError.test.js.map +7 -0
- package/lib/cjs/internal/app-binder/command/utils/IcpApplicationErrors.js +2 -0
- package/lib/cjs/internal/app-binder/command/utils/IcpApplicationErrors.js.map +7 -0
- package/lib/cjs/internal/app-binder/constants.js +2 -0
- package/lib/cjs/internal/app-binder/constants.js.map +7 -0
- package/lib/cjs/internal/app-binder/di/appBinderModule.js +2 -0
- package/lib/cjs/internal/app-binder/di/appBinderModule.js.map +7 -0
- package/lib/cjs/internal/app-binder/di/appBinderModule.test.js +2 -0
- package/lib/cjs/internal/app-binder/di/appBinderModule.test.js.map +7 -0
- package/lib/cjs/internal/app-binder/di/appBinderTypes.js +2 -0
- package/lib/cjs/internal/app-binder/di/appBinderTypes.js.map +7 -0
- package/lib/cjs/internal/app-binder/task/SignTransactionTask.js +2 -0
- package/lib/cjs/internal/app-binder/task/SignTransactionTask.js.map +7 -0
- package/lib/cjs/internal/app-binder/task/SignTransactionTask.test.js +2 -0
- package/lib/cjs/internal/app-binder/task/SignTransactionTask.test.js.map +7 -0
- package/lib/cjs/internal/di.js +2 -0
- package/lib/cjs/internal/di.js.map +7 -0
- package/lib/cjs/internal/externalTypes.js +2 -0
- package/lib/cjs/internal/externalTypes.js.map +7 -0
- package/lib/cjs/internal/use-cases/address/GetAddressUseCase.js +2 -0
- package/lib/cjs/internal/use-cases/address/GetAddressUseCase.js.map +7 -0
- package/lib/cjs/internal/use-cases/address/GetAddressUseCase.test.js +2 -0
- package/lib/cjs/internal/use-cases/address/GetAddressUseCase.test.js.map +7 -0
- package/lib/cjs/internal/use-cases/address/di/addressModule.js +2 -0
- package/lib/cjs/internal/use-cases/address/di/addressModule.js.map +7 -0
- package/lib/cjs/internal/use-cases/address/di/addressModule.test.js +2 -0
- package/lib/cjs/internal/use-cases/address/di/addressModule.test.js.map +7 -0
- package/lib/cjs/internal/use-cases/address/di/addressTypes.js +2 -0
- package/lib/cjs/internal/use-cases/address/di/addressTypes.js.map +7 -0
- package/lib/cjs/internal/use-cases/config/GetAppConfigurationUseCase.js +2 -0
- package/lib/cjs/internal/use-cases/config/GetAppConfigurationUseCase.js.map +7 -0
- package/lib/cjs/internal/use-cases/config/GetAppConfigurationUseCase.test.js +2 -0
- package/lib/cjs/internal/use-cases/config/GetAppConfigurationUseCase.test.js.map +7 -0
- package/lib/cjs/internal/use-cases/config/di/configModule.js +2 -0
- package/lib/cjs/internal/use-cases/config/di/configModule.js.map +7 -0
- package/lib/cjs/internal/use-cases/config/di/configModule.test.js +2 -0
- package/lib/cjs/internal/use-cases/config/di/configModule.test.js.map +7 -0
- package/lib/cjs/internal/use-cases/config/di/configTypes.js +2 -0
- package/lib/cjs/internal/use-cases/config/di/configTypes.js.map +7 -0
- package/lib/cjs/internal/use-cases/transaction/SignTransactionUseCase.js +2 -0
- package/lib/cjs/internal/use-cases/transaction/SignTransactionUseCase.js.map +7 -0
- package/lib/cjs/internal/use-cases/transaction/SignTransactionUseCase.test.js +2 -0
- package/lib/cjs/internal/use-cases/transaction/SignTransactionUseCase.test.js.map +7 -0
- package/lib/cjs/internal/use-cases/transaction/di/transactionModule.js +2 -0
- package/lib/cjs/internal/use-cases/transaction/di/transactionModule.js.map +7 -0
- package/lib/cjs/internal/use-cases/transaction/di/transactionModule.test.js +2 -0
- package/lib/cjs/internal/use-cases/transaction/di/transactionModule.test.js.map +7 -0
- package/lib/cjs/internal/use-cases/transaction/di/transactionTypes.js +2 -0
- package/lib/cjs/internal/use-cases/transaction/di/transactionTypes.js.map +7 -0
- package/lib/cjs/package.json +60 -0
- package/lib/esm/api/SignerIcp.js +1 -0
- package/lib/esm/api/SignerIcp.js.map +7 -0
- package/lib/esm/api/SignerIcpBuilder.js +2 -0
- package/lib/esm/api/SignerIcpBuilder.js.map +7 -0
- package/lib/esm/api/SignerIcpBuilder.test.js +2 -0
- package/lib/esm/api/SignerIcpBuilder.test.js.map +7 -0
- package/lib/esm/api/app-binder/GetAddressDeviceActionTypes.js +1 -0
- package/lib/esm/api/app-binder/GetAddressDeviceActionTypes.js.map +7 -0
- package/lib/esm/api/app-binder/GetVersionDeviceActionTypes.js +1 -0
- package/lib/esm/api/app-binder/GetVersionDeviceActionTypes.js.map +7 -0
- package/lib/esm/api/app-binder/SignTransactionDeviceActionTypes.js +1 -0
- package/lib/esm/api/app-binder/SignTransactionDeviceActionTypes.js.map +7 -0
- package/lib/esm/api/index.js +2 -0
- package/lib/esm/api/index.js.map +7 -0
- package/lib/esm/api/model/Address.js +1 -0
- package/lib/esm/api/model/Address.js.map +7 -0
- package/lib/esm/api/model/Signature.js +1 -0
- package/lib/esm/api/model/Signature.js.map +7 -0
- package/lib/esm/api/model/Version.js +1 -0
- package/lib/esm/api/model/Version.js.map +7 -0
- package/lib/esm/index.js +2 -0
- package/lib/esm/index.js.map +7 -0
- package/lib/esm/internal/DefaultSignerIcp.js +2 -0
- package/lib/esm/internal/DefaultSignerIcp.js.map +7 -0
- package/lib/esm/internal/DefaultSignerIcp.test.js +2 -0
- package/lib/esm/internal/DefaultSignerIcp.test.js.map +7 -0
- package/lib/esm/internal/app-binder/IcpAppBinder.js +2 -0
- package/lib/esm/internal/app-binder/IcpAppBinder.js.map +7 -0
- package/lib/esm/internal/app-binder/IcpAppBinder.test.js +2 -0
- package/lib/esm/internal/app-binder/IcpAppBinder.test.js.map +7 -0
- package/lib/esm/internal/app-binder/command/GetAddressCommand.js +2 -0
- package/lib/esm/internal/app-binder/command/GetAddressCommand.js.map +7 -0
- package/lib/esm/internal/app-binder/command/GetAddressCommand.test.js +2 -0
- package/lib/esm/internal/app-binder/command/GetAddressCommand.test.js.map +7 -0
- package/lib/esm/internal/app-binder/command/GetVersionCommand.js +2 -0
- package/lib/esm/internal/app-binder/command/GetVersionCommand.js.map +7 -0
- package/lib/esm/internal/app-binder/command/GetVersionCommand.test.js +2 -0
- package/lib/esm/internal/app-binder/command/GetVersionCommand.test.js.map +7 -0
- package/lib/esm/internal/app-binder/command/SignTransactionCommand.js +2 -0
- package/lib/esm/internal/app-binder/command/SignTransactionCommand.js.map +7 -0
- package/lib/esm/internal/app-binder/command/SignTransactionCommand.test.js +2 -0
- package/lib/esm/internal/app-binder/command/SignTransactionCommand.test.js.map +7 -0
- package/lib/esm/internal/app-binder/command/__test-utils__/expectStatusWordError.js +2 -0
- package/lib/esm/internal/app-binder/command/__test-utils__/expectStatusWordError.js.map +7 -0
- package/lib/esm/internal/app-binder/command/__test-utils__/pathToBuffer.js +2 -0
- package/lib/esm/internal/app-binder/command/__test-utils__/pathToBuffer.js.map +7 -0
- package/lib/esm/internal/app-binder/command/utils/EncodeDerivationPath.js +2 -0
- package/lib/esm/internal/app-binder/command/utils/EncodeDerivationPath.js.map +7 -0
- package/lib/esm/internal/app-binder/command/utils/EncodeDerivationPath.test.js +2 -0
- package/lib/esm/internal/app-binder/command/utils/EncodeDerivationPath.test.js.map +7 -0
- package/lib/esm/internal/app-binder/command/utils/IcpApplicationError.test.js +2 -0
- package/lib/esm/internal/app-binder/command/utils/IcpApplicationError.test.js.map +7 -0
- package/lib/esm/internal/app-binder/command/utils/IcpApplicationErrors.js +2 -0
- package/lib/esm/internal/app-binder/command/utils/IcpApplicationErrors.js.map +7 -0
- package/lib/esm/internal/app-binder/constants.js +2 -0
- package/lib/esm/internal/app-binder/constants.js.map +7 -0
- package/lib/esm/internal/app-binder/di/appBinderModule.js +2 -0
- package/lib/esm/internal/app-binder/di/appBinderModule.js.map +7 -0
- package/lib/esm/internal/app-binder/di/appBinderModule.test.js +2 -0
- package/lib/esm/internal/app-binder/di/appBinderModule.test.js.map +7 -0
- package/lib/esm/internal/app-binder/di/appBinderTypes.js +2 -0
- package/lib/esm/internal/app-binder/di/appBinderTypes.js.map +7 -0
- package/lib/esm/internal/app-binder/task/SignTransactionTask.js +2 -0
- package/lib/esm/internal/app-binder/task/SignTransactionTask.js.map +7 -0
- package/lib/esm/internal/app-binder/task/SignTransactionTask.test.js +2 -0
- package/lib/esm/internal/app-binder/task/SignTransactionTask.test.js.map +7 -0
- package/lib/esm/internal/di.js +2 -0
- package/lib/esm/internal/di.js.map +7 -0
- package/lib/esm/internal/externalTypes.js +2 -0
- package/lib/esm/internal/externalTypes.js.map +7 -0
- package/lib/esm/internal/use-cases/address/GetAddressUseCase.js +2 -0
- package/lib/esm/internal/use-cases/address/GetAddressUseCase.js.map +7 -0
- package/lib/esm/internal/use-cases/address/GetAddressUseCase.test.js +2 -0
- package/lib/esm/internal/use-cases/address/GetAddressUseCase.test.js.map +7 -0
- package/lib/esm/internal/use-cases/address/di/addressModule.js +2 -0
- package/lib/esm/internal/use-cases/address/di/addressModule.js.map +7 -0
- package/lib/esm/internal/use-cases/address/di/addressModule.test.js +2 -0
- package/lib/esm/internal/use-cases/address/di/addressModule.test.js.map +7 -0
- package/lib/esm/internal/use-cases/address/di/addressTypes.js +2 -0
- package/lib/esm/internal/use-cases/address/di/addressTypes.js.map +7 -0
- package/lib/esm/internal/use-cases/config/GetAppConfigurationUseCase.js +2 -0
- package/lib/esm/internal/use-cases/config/GetAppConfigurationUseCase.js.map +7 -0
- package/lib/esm/internal/use-cases/config/GetAppConfigurationUseCase.test.js +2 -0
- package/lib/esm/internal/use-cases/config/GetAppConfigurationUseCase.test.js.map +7 -0
- package/lib/esm/internal/use-cases/config/di/configModule.js +2 -0
- package/lib/esm/internal/use-cases/config/di/configModule.js.map +7 -0
- package/lib/esm/internal/use-cases/config/di/configModule.test.js +2 -0
- package/lib/esm/internal/use-cases/config/di/configModule.test.js.map +7 -0
- package/lib/esm/internal/use-cases/config/di/configTypes.js +2 -0
- package/lib/esm/internal/use-cases/config/di/configTypes.js.map +7 -0
- package/lib/esm/internal/use-cases/transaction/SignTransactionUseCase.js +2 -0
- package/lib/esm/internal/use-cases/transaction/SignTransactionUseCase.js.map +7 -0
- package/lib/esm/internal/use-cases/transaction/SignTransactionUseCase.test.js +2 -0
- package/lib/esm/internal/use-cases/transaction/SignTransactionUseCase.test.js.map +7 -0
- package/lib/esm/internal/use-cases/transaction/di/transactionModule.js +2 -0
- package/lib/esm/internal/use-cases/transaction/di/transactionModule.js.map +7 -0
- package/lib/esm/internal/use-cases/transaction/di/transactionModule.test.js +2 -0
- package/lib/esm/internal/use-cases/transaction/di/transactionModule.test.js.map +7 -0
- package/lib/esm/internal/use-cases/transaction/di/transactionTypes.js +2 -0
- package/lib/esm/internal/use-cases/transaction/di/transactionTypes.js.map +7 -0
- package/lib/esm/package.json +60 -0
- package/lib/types/api/SignerIcp.d.ts +16 -0
- package/lib/types/api/SignerIcp.d.ts.map +1 -0
- package/lib/types/api/SignerIcpBuilder.d.ts +22 -0
- package/lib/types/api/SignerIcpBuilder.d.ts.map +1 -0
- package/lib/types/api/SignerIcpBuilder.test.d.ts +2 -0
- package/lib/types/api/SignerIcpBuilder.test.d.ts.map +1 -0
- package/lib/types/api/app-binder/GetAddressDeviceActionTypes.d.ts +10 -0
- package/lib/types/api/app-binder/GetAddressDeviceActionTypes.d.ts.map +1 -0
- package/lib/types/api/app-binder/GetVersionDeviceActionTypes.d.ts +10 -0
- package/lib/types/api/app-binder/GetVersionDeviceActionTypes.d.ts.map +1 -0
- package/lib/types/api/app-binder/SignTransactionDeviceActionTypes.d.ts +12 -0
- package/lib/types/api/app-binder/SignTransactionDeviceActionTypes.d.ts.map +1 -0
- package/lib/types/api/index.d.ts +9 -0
- package/lib/types/api/index.d.ts.map +1 -0
- package/lib/types/api/model/Address.d.ts +6 -0
- package/lib/types/api/model/Address.d.ts.map +1 -0
- package/lib/types/api/model/Signature.d.ts +7 -0
- package/lib/types/api/model/Signature.d.ts.map +1 -0
- package/lib/types/api/model/Version.d.ts +6 -0
- package/lib/types/api/model/Version.d.ts.map +1 -0
- package/lib/types/index.d.ts +3 -0
- package/lib/types/index.d.ts.map +1 -0
- package/lib/types/internal/DefaultSignerIcp.d.ts +18 -0
- package/lib/types/internal/DefaultSignerIcp.d.ts.map +1 -0
- package/lib/types/internal/DefaultSignerIcp.test.d.ts +2 -0
- package/lib/types/internal/DefaultSignerIcp.test.d.ts.map +1 -0
- package/lib/types/internal/app-binder/IcpAppBinder.d.ts +21 -0
- package/lib/types/internal/app-binder/IcpAppBinder.d.ts.map +1 -0
- package/lib/types/internal/app-binder/IcpAppBinder.test.d.ts +2 -0
- package/lib/types/internal/app-binder/IcpAppBinder.test.d.ts.map +1 -0
- package/lib/types/internal/app-binder/command/GetAddressCommand.d.ts +26 -0
- package/lib/types/internal/app-binder/command/GetAddressCommand.d.ts.map +1 -0
- package/lib/types/internal/app-binder/command/GetAddressCommand.test.d.ts +2 -0
- package/lib/types/internal/app-binder/command/GetAddressCommand.test.d.ts.map +1 -0
- package/lib/types/internal/app-binder/command/GetVersionCommand.d.ts +17 -0
- package/lib/types/internal/app-binder/command/GetVersionCommand.d.ts.map +1 -0
- package/lib/types/internal/app-binder/command/GetVersionCommand.test.d.ts +2 -0
- package/lib/types/internal/app-binder/command/GetVersionCommand.test.d.ts.map +1 -0
- package/lib/types/internal/app-binder/command/SignTransactionCommand.d.ts +39 -0
- package/lib/types/internal/app-binder/command/SignTransactionCommand.d.ts.map +1 -0
- package/lib/types/internal/app-binder/command/SignTransactionCommand.test.d.ts +2 -0
- package/lib/types/internal/app-binder/command/SignTransactionCommand.test.d.ts.map +1 -0
- package/lib/types/internal/app-binder/command/__test-utils__/expectStatusWordError.d.ts +4 -0
- package/lib/types/internal/app-binder/command/__test-utils__/expectStatusWordError.d.ts.map +1 -0
- package/lib/types/internal/app-binder/command/__test-utils__/pathToBuffer.d.ts +2 -0
- package/lib/types/internal/app-binder/command/__test-utils__/pathToBuffer.d.ts.map +1 -0
- package/lib/types/internal/app-binder/command/utils/EncodeDerivationPath.d.ts +2 -0
- package/lib/types/internal/app-binder/command/utils/EncodeDerivationPath.d.ts.map +1 -0
- package/lib/types/internal/app-binder/command/utils/EncodeDerivationPath.test.d.ts +2 -0
- package/lib/types/internal/app-binder/command/utils/EncodeDerivationPath.test.d.ts.map +1 -0
- package/lib/types/internal/app-binder/command/utils/IcpApplicationError.test.d.ts +2 -0
- package/lib/types/internal/app-binder/command/utils/IcpApplicationError.test.d.ts.map +1 -0
- package/lib/types/internal/app-binder/command/utils/IcpApplicationErrors.d.ts +24 -0
- package/lib/types/internal/app-binder/command/utils/IcpApplicationErrors.d.ts.map +1 -0
- package/lib/types/internal/app-binder/constants.d.ts +2 -0
- package/lib/types/internal/app-binder/constants.d.ts.map +1 -0
- package/lib/types/internal/app-binder/di/appBinderModule.d.ts +3 -0
- package/lib/types/internal/app-binder/di/appBinderModule.d.ts.map +1 -0
- package/lib/types/internal/app-binder/di/appBinderModule.test.d.ts +2 -0
- package/lib/types/internal/app-binder/di/appBinderModule.test.d.ts.map +1 -0
- package/lib/types/internal/app-binder/di/appBinderTypes.d.ts +4 -0
- package/lib/types/internal/app-binder/di/appBinderTypes.d.ts.map +1 -0
- package/lib/types/internal/app-binder/task/SignTransactionTask.d.ts +16 -0
- package/lib/types/internal/app-binder/task/SignTransactionTask.d.ts.map +1 -0
- package/lib/types/internal/app-binder/task/SignTransactionTask.test.d.ts +2 -0
- package/lib/types/internal/app-binder/task/SignTransactionTask.test.d.ts.map +1 -0
- package/lib/types/internal/di.d.ts +9 -0
- package/lib/types/internal/di.d.ts.map +1 -0
- package/lib/types/internal/externalTypes.d.ts +6 -0
- package/lib/types/internal/externalTypes.d.ts.map +1 -0
- package/lib/types/internal/use-cases/address/GetAddressUseCase.d.ts +9 -0
- package/lib/types/internal/use-cases/address/GetAddressUseCase.d.ts.map +1 -0
- package/lib/types/internal/use-cases/address/GetAddressUseCase.test.d.ts +2 -0
- package/lib/types/internal/use-cases/address/GetAddressUseCase.test.d.ts.map +1 -0
- package/lib/types/internal/use-cases/address/di/addressModule.d.ts +3 -0
- package/lib/types/internal/use-cases/address/di/addressModule.d.ts.map +1 -0
- package/lib/types/internal/use-cases/address/di/addressModule.test.d.ts +2 -0
- package/lib/types/internal/use-cases/address/di/addressModule.test.d.ts.map +1 -0
- package/lib/types/internal/use-cases/address/di/addressTypes.d.ts +4 -0
- package/lib/types/internal/use-cases/address/di/addressTypes.d.ts.map +1 -0
- package/lib/types/internal/use-cases/config/GetAppConfigurationUseCase.d.ts +8 -0
- package/lib/types/internal/use-cases/config/GetAppConfigurationUseCase.d.ts.map +1 -0
- package/lib/types/internal/use-cases/config/GetAppConfigurationUseCase.test.d.ts +2 -0
- package/lib/types/internal/use-cases/config/GetAppConfigurationUseCase.test.d.ts.map +1 -0
- package/lib/types/internal/use-cases/config/di/configModule.d.ts +3 -0
- package/lib/types/internal/use-cases/config/di/configModule.d.ts.map +1 -0
- package/lib/types/internal/use-cases/config/di/configModule.test.d.ts +2 -0
- package/lib/types/internal/use-cases/config/di/configModule.test.d.ts.map +1 -0
- package/lib/types/internal/use-cases/config/di/configTypes.d.ts +4 -0
- package/lib/types/internal/use-cases/config/di/configTypes.d.ts.map +1 -0
- package/lib/types/internal/use-cases/transaction/SignTransactionUseCase.d.ts +9 -0
- package/lib/types/internal/use-cases/transaction/SignTransactionUseCase.d.ts.map +1 -0
- package/lib/types/internal/use-cases/transaction/SignTransactionUseCase.test.d.ts +2 -0
- package/lib/types/internal/use-cases/transaction/SignTransactionUseCase.test.d.ts.map +1 -0
- package/lib/types/internal/use-cases/transaction/di/transactionModule.d.ts +3 -0
- package/lib/types/internal/use-cases/transaction/di/transactionModule.d.ts.map +1 -0
- package/lib/types/internal/use-cases/transaction/di/transactionModule.test.d.ts +2 -0
- package/lib/types/internal/use-cases/transaction/di/transactionModule.test.d.ts.map +1 -0
- package/lib/types/internal/use-cases/transaction/di/transactionTypes.d.ts +4 -0
- package/lib/types/internal/use-cases/transaction/di/transactionTypes.d.ts.map +1 -0
- package/lib/types/tsconfig.prod.tsbuildinfo +1 -0
- package/package.json +60 -0
package/LICENSE.MD
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright 2024-present Ledger
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
# Ledger Internet Computer Signer Implementation
|
|
2
|
+
|
|
3
|
+
This module provides the implementation of the Ledger Internet Computer (ICP) signer of the Device Management Kit. It enables interaction with the Internet Computer application on a Ledger device including:
|
|
4
|
+
|
|
5
|
+
- Retrieving the ICP public key, account identifier and principal for a given derivation path;
|
|
6
|
+
- Signing an Internet Computer transaction;
|
|
7
|
+
- Retrieving the app configuration (version);
|
|
8
|
+
|
|
9
|
+
## 🔹 Index
|
|
10
|
+
|
|
11
|
+
1. [How it works](#-how-it-works)
|
|
12
|
+
2. [Installation](#-installation)
|
|
13
|
+
3. [Initialisation](#-initialisation)
|
|
14
|
+
4. [Use Cases](#-use-cases)
|
|
15
|
+
- [Get Address](#use-case-1-get-address)
|
|
16
|
+
- [Sign Transaction](#use-case-2-sign-transaction)
|
|
17
|
+
- [Get App Configuration](#use-case-3-get-app-configuration)
|
|
18
|
+
5. [Observable Behavior](#-observable-behavior)
|
|
19
|
+
6. [Example](#-example)
|
|
20
|
+
|
|
21
|
+
## 🔹 How it works
|
|
22
|
+
|
|
23
|
+
The Ledger Internet Computer 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.
|
|
24
|
+
|
|
25
|
+
## 🔹 Installation
|
|
26
|
+
|
|
27
|
+
> **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.
|
|
28
|
+
|
|
29
|
+
To install the `device-signer-kit-icp` package, run the following command:
|
|
30
|
+
|
|
31
|
+
```sh
|
|
32
|
+
npm install @ledgerhq/device-signer-kit-icp
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## 🔹 Initialisation
|
|
36
|
+
|
|
37
|
+
To initialise an ICP signer instance, you need a Ledger Device Management Kit instance and the ID of the session of the connected device. Use the `SignerIcpBuilder`:
|
|
38
|
+
|
|
39
|
+
```typescript
|
|
40
|
+
const signerIcp = new SignerIcpBuilder({ dmk, sessionId }).build();
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## 🔹 Use Cases
|
|
44
|
+
|
|
45
|
+
The `SignerIcpBuilder.build()` method will return a `SignerIcp` instance that exposes 3 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`.
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
### Use Case 1: Get Address
|
|
50
|
+
|
|
51
|
+
This method allows users to retrieve the ICP public key, account identifier and principal based on a given `derivationPath`.
|
|
52
|
+
|
|
53
|
+
```typescript
|
|
54
|
+
const { observable, cancel } = signerIcp.getAddress(derivationPath, options);
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
#### **Parameters**
|
|
58
|
+
|
|
59
|
+
- `derivationPath`
|
|
60
|
+
|
|
61
|
+
- **Required**
|
|
62
|
+
- **Type:** `string` (e.g., `"44'/223'/0'/0/0"`)
|
|
63
|
+
- The derivation path used for the ICP address. See [here](https://www.ledger.com/blog/understanding-crypto-addresses-and-derivation-paths) for more information.
|
|
64
|
+
|
|
65
|
+
- `options`
|
|
66
|
+
|
|
67
|
+
- Optional
|
|
68
|
+
- Type: `AddressOptions`
|
|
69
|
+
|
|
70
|
+
```typescript
|
|
71
|
+
type AddressOptions = {
|
|
72
|
+
checkOnDevice?: boolean;
|
|
73
|
+
skipOpenApp?: boolean;
|
|
74
|
+
};
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
- `checkOnDevice`: An optional boolean indicating whether user confirmation on the device is required (`true`) or not (`false`).
|
|
78
|
+
- `skipOpenApp`: An optional boolean indicating whether to skip opening the ICP app on the device (`true`) or not (`false`). Use when the app is already open.
|
|
79
|
+
|
|
80
|
+
#### **Returns**
|
|
81
|
+
|
|
82
|
+
- `observable` Emits DeviceActionState updates, including the following details:
|
|
83
|
+
|
|
84
|
+
```typescript
|
|
85
|
+
type Address = {
|
|
86
|
+
publicKey: string; // hex-encoded secp256k1 public key
|
|
87
|
+
accountId: string; // hex-encoded account identifier
|
|
88
|
+
principal: string; // textual principal
|
|
89
|
+
};
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
- `cancel` A function to cancel the action on the Ledger device.
|
|
93
|
+
|
|
94
|
+
---
|
|
95
|
+
|
|
96
|
+
### Use Case 2: Sign Transaction
|
|
97
|
+
|
|
98
|
+
Securely sign an Internet Computer transaction on Ledger devices.
|
|
99
|
+
|
|
100
|
+
```typescript
|
|
101
|
+
const { observable, cancel } = signerIcp.signTransaction(
|
|
102
|
+
derivationPath,
|
|
103
|
+
transaction,
|
|
104
|
+
options,
|
|
105
|
+
);
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
#### **Parameters**
|
|
109
|
+
|
|
110
|
+
- `derivationPath`
|
|
111
|
+
|
|
112
|
+
- **Required**
|
|
113
|
+
- **Type:** `string` (e.g., `"44'/223'/0'/0/0"`)
|
|
114
|
+
- The derivation path used for the ICP address.
|
|
115
|
+
|
|
116
|
+
- `transaction`
|
|
117
|
+
|
|
118
|
+
- **Required**
|
|
119
|
+
- **Type:** `Uint8Array`
|
|
120
|
+
- The serialized transaction bytes (CBOR request) to sign.
|
|
121
|
+
|
|
122
|
+
- `options`
|
|
123
|
+
|
|
124
|
+
- Optional
|
|
125
|
+
- Type: `TransactionOptions`
|
|
126
|
+
|
|
127
|
+
```typescript
|
|
128
|
+
type TransactionOptions = {
|
|
129
|
+
skipOpenApp?: boolean;
|
|
130
|
+
};
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
- `skipOpenApp`: An optional boolean indicating whether to skip opening the ICP app on the device (`true`) or not (`false`). Use when the app is already open.
|
|
134
|
+
|
|
135
|
+
#### **Returns**
|
|
136
|
+
|
|
137
|
+
- `observable` Emits DeviceActionState updates, including the following details:
|
|
138
|
+
|
|
139
|
+
```typescript
|
|
140
|
+
type Signature = {
|
|
141
|
+
r: string; // hex-encoded 32-byte R value
|
|
142
|
+
s: string; // hex-encoded 32-byte S value
|
|
143
|
+
v: number; // recovery id
|
|
144
|
+
der: string; // hex-encoded DER signature
|
|
145
|
+
};
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
- `cancel` A function to cancel the action on the Ledger device.
|
|
149
|
+
|
|
150
|
+
---
|
|
151
|
+
|
|
152
|
+
### Use Case 3: Get App Configuration
|
|
153
|
+
|
|
154
|
+
This method allows the user to fetch the current app configuration.
|
|
155
|
+
|
|
156
|
+
```typescript
|
|
157
|
+
const { observable, cancel } = signerIcp.getAppConfiguration();
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
#### **Returns**
|
|
161
|
+
|
|
162
|
+
- `observable` Emits DeviceActionState updates, including the following details:
|
|
163
|
+
|
|
164
|
+
```typescript
|
|
165
|
+
type Version = {
|
|
166
|
+
version: string; // "major.minor.patch"
|
|
167
|
+
testMode: boolean;
|
|
168
|
+
locked: boolean;
|
|
169
|
+
};
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
- `cancel` A function to cancel the action on the Ledger device.
|
|
173
|
+
|
|
174
|
+
## 🔹 Observable Behavior
|
|
175
|
+
|
|
176
|
+
Each method returns an [Observable](https://rxjs.dev/guide/observable) emitting updates structured as [`DeviceActionState`](https://github.com/LedgerHQ/device-sdk-ts/blob/develop/packages/device-management-kit/src/api/device-action/model/DeviceActionState.ts). These updates reflect the operation's progress and status:
|
|
177
|
+
|
|
178
|
+
- **NotStarted**: The operation hasn't started.
|
|
179
|
+
- **Pending**: The operation is in progress and may require user interaction.
|
|
180
|
+
- **Stopped**: The operation was canceled or stopped.
|
|
181
|
+
- **Completed**: The operation completed successfully, with results available.
|
|
182
|
+
- **Error**: An error occurred.
|
|
183
|
+
|
|
184
|
+
## 🔹 Example
|
|
185
|
+
|
|
186
|
+
We encourage you to explore the Internet Computer 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.
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var o=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var s=Object.getOwnPropertyNames;var a=Object.prototype.hasOwnProperty;var A=(t,e,i,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of s(e))!a.call(t,n)&&n!==i&&o(t,n,{get:()=>e[n],enumerable:!(r=p(e,n))||r.enumerable});return t};var d=t=>A(o({},"__esModule",{value:!0}),t);var y={};module.exports=d(y);
|
|
2
|
+
//# sourceMappingURL=SignerIcp.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/api/SignerIcp.ts"],
|
|
4
|
+
"sourcesContent": ["import { type GetAddressDAReturnType } from \"@api/app-binder/GetAddressDeviceActionTypes\";\nimport { type GetVersionDAReturnType } from \"@api/app-binder/GetVersionDeviceActionTypes\";\nimport { type SignTransactionDAReturnType } from \"@api/app-binder/SignTransactionDeviceActionTypes\";\n\nexport type AddressOptions = {\n checkOnDevice?: boolean;\n skipOpenApp?: boolean;\n};\n\nexport type TransactionOptions = {\n skipOpenApp?: boolean;\n};\n\nexport interface SignerIcp {\n getAppConfiguration: () => GetVersionDAReturnType;\n\n getAddress: (\n derivationPath: string,\n options?: AddressOptions,\n ) => GetAddressDAReturnType;\n\n signTransaction: (\n derivationPath: string,\n transaction: Uint8Array,\n options?: TransactionOptions,\n ) => SignTransactionDAReturnType;\n}\n"],
|
|
5
|
+
"mappings": "+WAAA,IAAAA,EAAA,kBAAAC,EAAAD",
|
|
6
|
+
"names": ["SignerIcp_exports", "__toCommonJS"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var t=Object.defineProperty;var d=Object.getOwnPropertyDescriptor;var c=Object.getOwnPropertyNames;var p=Object.prototype.hasOwnProperty;var m=(i,e)=>{for(var s in e)t(i,s,{get:e[s],enumerable:!0})},I=(i,e,s,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of c(e))!p.call(i,r)&&r!==s&&t(i,r,{get:()=>e[r],enumerable:!(n=d(e,r))||n.enumerable});return i};var a=i=>I(t({},"__esModule",{value:!0}),i);var u={};m(u,{SignerIcpBuilder:()=>g});module.exports=a(u);var o=require("../internal/DefaultSignerIcp");class g{_dmk;_sessionId;constructor({dmk:e,sessionId:s}){this._dmk=e,this._sessionId=s}build(){return new o.DefaultSignerIcp({dmk:this._dmk,sessionId:this._sessionId})}}0&&(module.exports={SignerIcpBuilder});
|
|
2
|
+
//# sourceMappingURL=SignerIcpBuilder.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/api/SignerIcpBuilder.ts"],
|
|
4
|
+
"sourcesContent": ["import {\n type DeviceManagementKit,\n type DeviceSessionId,\n} from \"@ledgerhq/device-management-kit\";\n\nimport { type SignerIcp } from \"@api/SignerIcp\";\nimport { DefaultSignerIcp } from \"@internal/DefaultSignerIcp\";\n\ntype SignerIcpBuilderConstructorArgs = {\n dmk: DeviceManagementKit;\n sessionId: DeviceSessionId;\n};\n\n/**\n * Builder for the `SignerIcp` class.\n */\nexport class SignerIcpBuilder {\n private readonly _dmk: DeviceManagementKit;\n private readonly _sessionId: DeviceSessionId;\n\n constructor({ dmk, sessionId }: SignerIcpBuilderConstructorArgs) {\n this._dmk = dmk;\n this._sessionId = sessionId;\n }\n\n /**\n * Build the signer instance\n *\n * @returns the signer instance\n */\n public build(): SignerIcp {\n return new DefaultSignerIcp({\n dmk: this._dmk,\n sessionId: this._sessionId,\n });\n }\n}\n"],
|
|
5
|
+
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,sBAAAE,IAAA,eAAAC,EAAAH,GAMA,IAAAI,EAAiC,sCAU1B,MAAMF,CAAiB,CACX,KACA,WAEjB,YAAY,CAAE,IAAAG,EAAK,UAAAC,CAAU,EAAoC,CAC/D,KAAK,KAAOD,EACZ,KAAK,WAAaC,CACpB,CAOO,OAAmB,CACxB,OAAO,IAAI,mBAAiB,CAC1B,IAAK,KAAK,KACV,UAAW,KAAK,UAClB,CAAC,CACH,CACF",
|
|
6
|
+
"names": ["SignerIcpBuilder_exports", "__export", "SignerIcpBuilder", "__toCommonJS", "import_DefaultSignerIcp", "dmk", "sessionId"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var e=require("./SignerIcpBuilder"),i=require("../internal/DefaultSignerIcp");describe("SignerIcpBuilder",()=>{it("should build a SignerIcp instance",()=>{const n={},t="test-session-id",s=new e.SignerIcpBuilder({dmk:n,sessionId:t}).build();expect(s).toBeInstanceOf(i.DefaultSignerIcp)})});
|
|
2
|
+
//# sourceMappingURL=SignerIcpBuilder.test.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/api/SignerIcpBuilder.test.ts"],
|
|
4
|
+
"sourcesContent": ["import { type DeviceManagementKit } from \"@ledgerhq/device-management-kit\";\n\nimport { SignerIcpBuilder } from \"@api/SignerIcpBuilder\";\nimport { DefaultSignerIcp } from \"@internal/DefaultSignerIcp\";\n\ndescribe(\"SignerIcpBuilder\", () => {\n it(\"should build a SignerIcp instance\", () => {\n // ARRANGE\n const dmk = {} as DeviceManagementKit;\n const sessionId = \"test-session-id\";\n const builder = new SignerIcpBuilder({ dmk, sessionId });\n\n // ACT\n const signer = builder.build();\n\n // ASSERT\n expect(signer).toBeInstanceOf(DefaultSignerIcp);\n });\n});\n"],
|
|
5
|
+
"mappings": "aAEA,IAAAA,EAAiC,iCACjCC,EAAiC,sCAEjC,SAAS,mBAAoB,IAAM,CACjC,GAAG,oCAAqC,IAAM,CAE5C,MAAMC,EAAM,CAAC,EACPC,EAAY,kBAIZC,EAHU,IAAI,mBAAiB,CAAE,IAAAF,EAAK,UAAAC,CAAU,CAAC,EAGhC,MAAM,EAG7B,OAAOC,CAAM,EAAE,eAAe,kBAAgB,CAChD,CAAC,CACH,CAAC",
|
|
6
|
+
"names": ["import_SignerIcpBuilder", "import_DefaultSignerIcp", "dmk", "sessionId", "signer"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var p=Object.defineProperty;var o=Object.getOwnPropertyDescriptor;var s=Object.getOwnPropertyNames;var A=Object.prototype.hasOwnProperty;var m=(r,e,n,d)=>{if(e&&typeof e=="object"||typeof e=="function")for(let t of s(e))!A.call(r,t)&&t!==n&&p(r,t,{get:()=>e[t],enumerable:!(d=o(e,t))||d.enumerable});return r};var u=r=>m(p({},"__esModule",{value:!0}),r);var i={};module.exports=u(i);
|
|
2
|
+
//# sourceMappingURL=GetAddressDeviceActionTypes.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/api/app-binder/GetAddressDeviceActionTypes.ts"],
|
|
4
|
+
"sourcesContent": ["import {\n type CommandErrorResult,\n type ExecuteDeviceActionReturnType,\n type OpenAppDAError,\n type SendCommandInAppDAIntermediateValue,\n type SendCommandInAppDAOutput,\n type UserInteractionRequired,\n} from \"@ledgerhq/device-management-kit\";\n\nimport { type GetAddressCommandResponse } from \"@internal/app-binder/command/GetAddressCommand\";\nimport { type IcpErrorCodes } from \"@internal/app-binder/command/utils/IcpApplicationErrors\";\n\ntype GetAddressDAUserInteractionRequired =\n | UserInteractionRequired.None\n | UserInteractionRequired.VerifyAddress;\n\nexport type GetAddressDAOutput =\n SendCommandInAppDAOutput<GetAddressCommandResponse>;\n\nexport type GetAddressDAError =\n | OpenAppDAError\n | CommandErrorResult<IcpErrorCodes>[\"error\"];\n\nexport type GetAddressDAIntermediateValue =\n SendCommandInAppDAIntermediateValue<GetAddressDAUserInteractionRequired>;\n\nexport type GetAddressDAReturnType = ExecuteDeviceActionReturnType<\n GetAddressDAOutput,\n GetAddressDAError,\n GetAddressDAIntermediateValue\n>;\n"],
|
|
5
|
+
"mappings": "+WAAA,IAAAA,EAAA,kBAAAC,EAAAD",
|
|
6
|
+
"names": ["GetAddressDeviceActionTypes_exports", "__toCommonJS"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var o=Object.defineProperty;var i=Object.getOwnPropertyDescriptor;var m=Object.getOwnPropertyNames;var s=Object.prototype.hasOwnProperty;var u=(r,e,p,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let t of m(e))!s.call(r,t)&&t!==p&&o(r,t,{get:()=>e[t],enumerable:!(n=i(e,t))||n.enumerable});return r};var A=r=>u(o({},"__esModule",{value:!0}),r);var d={};module.exports=A(d);
|
|
2
|
+
//# sourceMappingURL=GetVersionDeviceActionTypes.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/api/app-binder/GetVersionDeviceActionTypes.ts"],
|
|
4
|
+
"sourcesContent": ["import {\n type CommandErrorResult,\n type ExecuteDeviceActionReturnType,\n type OpenAppDAError,\n type SendCommandInAppDAIntermediateValue,\n type SendCommandInAppDAOutput,\n type UserInteractionRequired,\n} from \"@ledgerhq/device-management-kit\";\n\nimport { type GetVersionCommandResponse } from \"@internal/app-binder/command/GetVersionCommand\";\nimport { type IcpErrorCodes } from \"@internal/app-binder/command/utils/IcpApplicationErrors\";\n\ntype GetVersionDAUserInteractionRequired = UserInteractionRequired.None;\n\nexport type GetVersionDAOutput =\n SendCommandInAppDAOutput<GetVersionCommandResponse>;\n\nexport type GetVersionDAError =\n | OpenAppDAError\n | CommandErrorResult<IcpErrorCodes>[\"error\"];\n\nexport type GetVersionDAIntermediateValue =\n SendCommandInAppDAIntermediateValue<GetVersionDAUserInteractionRequired>;\n\nexport type GetVersionDAReturnType = ExecuteDeviceActionReturnType<\n GetVersionDAOutput,\n GetVersionDAError,\n GetVersionDAIntermediateValue\n>;\n"],
|
|
5
|
+
"mappings": "+WAAA,IAAAA,EAAA,kBAAAC,EAAAD",
|
|
6
|
+
"names": ["GetVersionDeviceActionTypes_exports", "__toCommonJS"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var i=Object.defineProperty;var o=Object.getOwnPropertyDescriptor;var a=Object.getOwnPropertyNames;var u=Object.prototype.hasOwnProperty;var c=(r,e,p,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let t of a(e))!u.call(r,t)&&t!==p&&i(r,t,{get:()=>e[t],enumerable:!(n=o(e,t))||n.enumerable});return r};var A=r=>c(i({},"__esModule",{value:!0}),r);var d={};module.exports=A(d);
|
|
2
|
+
//# sourceMappingURL=SignTransactionDeviceActionTypes.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/api/app-binder/SignTransactionDeviceActionTypes.ts"],
|
|
4
|
+
"sourcesContent": ["import {\n type CommandErrorResult,\n type ExecuteDeviceActionReturnType,\n type OpenAppDAError,\n type OpenAppDARequiredInteraction,\n type SendCommandInAppDAOutput,\n type UserInteractionRequired,\n} from \"@ledgerhq/device-management-kit\";\n\nimport { type Signature } from \"@api/model/Signature\";\nimport { type IcpErrorCodes } from \"@internal/app-binder/command/utils/IcpApplicationErrors\";\n\nexport type SignTransactionDAOutput = SendCommandInAppDAOutput<Signature>;\nexport type SignTransactionDAError =\n | OpenAppDAError\n | CommandErrorResult<IcpErrorCodes>[\"error\"];\n\ntype SignTransactionDARequiredInteraction =\n | OpenAppDARequiredInteraction\n | UserInteractionRequired.SignTransaction;\n\nexport type SignTransactionDAIntermediateValue = {\n requiredUserInteraction: SignTransactionDARequiredInteraction;\n};\n\nexport type SignTransactionDAReturnType = ExecuteDeviceActionReturnType<\n SignTransactionDAOutput,\n SignTransactionDAError,\n SignTransactionDAIntermediateValue\n>;\n"],
|
|
5
|
+
"mappings": "+WAAA,IAAAA,EAAA,kBAAAC,EAAAD",
|
|
6
|
+
"names": ["SignTransactionDeviceActionTypes_exports", "__toCommonJS"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var o=Object.defineProperty;var i=Object.getOwnPropertyDescriptor;var y=Object.getOwnPropertyNames;var A=Object.prototype.hasOwnProperty;var a=(t,e)=>{for(var p in e)o(t,p,{get:e[p],enumerable:!0})},d=(t,e,p,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of y(e))!A.call(t,r)&&r!==p&&o(t,r,{get:()=>e[r],enumerable:!(n=i(e,r))||n.enumerable});return t};var u=t=>d(o({},"__esModule",{value:!0}),t);var D={};a(D,{SignerIcpBuilder:()=>s.SignerIcpBuilder});module.exports=u(D);var s=require("./SignerIcpBuilder");0&&(module.exports={SignerIcpBuilder});
|
|
2
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/api/index.ts"],
|
|
4
|
+
"sourcesContent": ["export {\n type GetAddressDAError,\n type GetAddressDAIntermediateValue,\n type GetAddressDAOutput,\n type GetAddressDAReturnType,\n} from \"@api/app-binder/GetAddressDeviceActionTypes\";\nexport {\n type GetVersionDAError,\n type GetVersionDAIntermediateValue,\n type GetVersionDAOutput,\n type GetVersionDAReturnType,\n} from \"@api/app-binder/GetVersionDeviceActionTypes\";\nexport {\n type SignTransactionDAError,\n type SignTransactionDAIntermediateValue,\n type SignTransactionDAOutput,\n type SignTransactionDAReturnType,\n} from \"@api/app-binder/SignTransactionDeviceActionTypes\";\nexport { type Address } from \"@api/model/Address\";\nexport { type Signature } from \"@api/model/Signature\";\nexport { type Version } from \"@api/model/Version\";\nexport {\n type AddressOptions,\n type SignerIcp,\n type TransactionOptions,\n} from \"@api/SignerIcp\";\nexport { SignerIcpBuilder } from \"@api/SignerIcpBuilder\";\n"],
|
|
5
|
+
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,0DAAAE,EAAAF,GA0BA,IAAAG,EAAiC",
|
|
6
|
+
"names": ["api_exports", "__export", "__toCommonJS", "import_SignerIcpBuilder"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var p=Object.defineProperty;var c=Object.getOwnPropertyDescriptor;var e=Object.getOwnPropertyNames;var d=Object.prototype.hasOwnProperty;var g=(r,i,s,n)=>{if(i&&typeof i=="object"||typeof i=="function")for(let t of e(i))!d.call(r,t)&&t!==s&&p(r,t,{get:()=>i[t],enumerable:!(n=c(i,t))||n.enumerable});return r};var a=r=>g(p({},"__esModule",{value:!0}),r);var l={};module.exports=a(l);
|
|
2
|
+
//# sourceMappingURL=Address.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/api/model/Address.ts"],
|
|
4
|
+
"sourcesContent": ["export type Address = {\n publicKey: string;\n accountId: string;\n principal: string;\n};\n"],
|
|
5
|
+
"mappings": "+WAAA,IAAAA,EAAA,kBAAAC,EAAAD",
|
|
6
|
+
"names": ["Address_exports", "__toCommonJS"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var g=Object.defineProperty;var s=Object.getOwnPropertyDescriptor;var p=Object.getOwnPropertyNames;var u=Object.prototype.hasOwnProperty;var a=(t,r,i,n)=>{if(r&&typeof r=="object"||typeof r=="function")for(let e of p(r))!u.call(t,e)&&e!==i&&g(t,e,{get:()=>r[e],enumerable:!(n=s(r,e))||n.enumerable});return t};var b=t=>a(g({},"__esModule",{value:!0}),t);var d={};module.exports=b(d);
|
|
2
|
+
//# sourceMappingURL=Signature.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/api/model/Signature.ts"],
|
|
4
|
+
"sourcesContent": ["export type Signature = {\n r: string;\n s: string;\n v: number;\n der: string;\n};\n"],
|
|
5
|
+
"mappings": "+WAAA,IAAAA,EAAA,kBAAAC,EAAAD",
|
|
6
|
+
"names": ["Signature_exports", "__toCommonJS"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var r=Object.defineProperty;var i=Object.getOwnPropertyDescriptor;var l=Object.getOwnPropertyNames;var a=Object.prototype.hasOwnProperty;var b=(o,e,s,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of l(e))!a.call(o,n)&&n!==s&&r(o,n,{get:()=>e[n],enumerable:!(t=i(e,n))||t.enumerable});return o};var d=o=>b(r({},"__esModule",{value:!0}),o);var p={};module.exports=d(p);
|
|
2
|
+
//# sourceMappingURL=Version.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/api/model/Version.ts"],
|
|
4
|
+
"sourcesContent": ["export type Version = {\n version: string;\n testMode: boolean;\n locked: boolean;\n};\n"],
|
|
5
|
+
"mappings": "+WAAA,IAAAA,EAAA,kBAAAC,EAAAD",
|
|
6
|
+
"names": ["Version_exports", "__toCommonJS"]
|
|
7
|
+
}
|
package/lib/cjs/index.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var x=Object.defineProperty;var a=Object.getOwnPropertyDescriptor;var b=Object.getOwnPropertyNames;var c=Object.prototype.hasOwnProperty;var f=(r,o,t,i)=>{if(o&&typeof o=="object"||typeof o=="function")for(let m of b(o))!c.call(r,m)&&m!==t&&x(r,m,{get:()=>o[m],enumerable:!(i=a(o,m))||i.enumerable});return r},e=(r,o,t)=>(f(r,o,"default"),t&&f(t,o,"default"));var d=r=>f(x({},"__esModule",{value:!0}),r);var p={};module.exports=d(p);var h=require("reflect-metadata");e(p,require("./api/index"),module.exports);0&&(module.exports={...require("./api/index")});
|
|
2
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/index.ts"],
|
|
4
|
+
"sourcesContent": ["// inversify requirement\nimport \"reflect-metadata\";\n\nexport * from \"@api/index\";\n"],
|
|
5
|
+
"mappings": "iaAAA,IAAAA,EAAA,kBAAAC,EAAAD,GACA,IAAAE,EAAO,4BAEPC,EAAAH,EAAc,sBAHd",
|
|
6
|
+
"names": ["index_exports", "__toCommonJS", "import_reflect_metadata", "__reExport"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var i=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var g=Object.getOwnPropertyNames;var y=Object.prototype.hasOwnProperty;var d=(r,e)=>{for(var t in e)i(r,t,{get:e[t],enumerable:!0})},u=(r,e,t,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of g(e))!y.call(r,n)&&n!==t&&i(r,n,{get:()=>e[n],enumerable:!(s=m(e,n))||s.enumerable});return r};var f=r=>u(i({},"__esModule",{value:!0}),r);var C={};d(C,{DefaultSignerIcp:()=>A});module.exports=f(C);var o=require("./di"),p=require("./use-cases/address/di/addressTypes"),a=require("./use-cases/config/di/configTypes"),c=require("./use-cases/transaction/di/transactionTypes");class A{_container;constructor({dmk:e,sessionId:t}){this._container=(0,o.makeContainer)({dmk:e,sessionId:t})}getAppConfiguration(){return this._container.get(a.configTypes.GetAppConfigurationUseCase).execute()}getAddress(e,t){return this._container.get(p.addressTypes.GetAddressUseCase).execute(e,t)}signTransaction(e,t,s){return this._container.get(c.transactionTypes.SignTransactionUseCase).execute(e,t,s)}}0&&(module.exports={DefaultSignerIcp});
|
|
2
|
+
//# sourceMappingURL=DefaultSignerIcp.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/internal/DefaultSignerIcp.ts"],
|
|
4
|
+
"sourcesContent": ["import {\n type DeviceManagementKit,\n type DeviceSessionId,\n} from \"@ledgerhq/device-management-kit\";\nimport { type Container } from \"inversify\";\n\nimport { type GetAddressDAReturnType } from \"@api/app-binder/GetAddressDeviceActionTypes\";\nimport { type GetVersionDAReturnType } from \"@api/app-binder/GetVersionDeviceActionTypes\";\nimport { type SignTransactionDAReturnType } from \"@api/app-binder/SignTransactionDeviceActionTypes\";\nimport {\n type AddressOptions,\n type SignerIcp,\n type TransactionOptions,\n} from \"@api/SignerIcp\";\nimport { makeContainer } from \"@internal/di\";\nimport { addressTypes } from \"@internal/use-cases/address/di/addressTypes\";\nimport { type GetAddressUseCase } from \"@internal/use-cases/address/GetAddressUseCase\";\nimport { configTypes } from \"@internal/use-cases/config/di/configTypes\";\nimport { type GetAppConfigurationUseCase } from \"@internal/use-cases/config/GetAppConfigurationUseCase\";\nimport { transactionTypes } from \"@internal/use-cases/transaction/di/transactionTypes\";\nimport { type SignTransactionUseCase } from \"@internal/use-cases/transaction/SignTransactionUseCase\";\n\ntype DefaultSignerIcpConstructorArgs = {\n dmk: DeviceManagementKit;\n sessionId: DeviceSessionId;\n};\n\nexport class DefaultSignerIcp implements SignerIcp {\n private readonly _container: Container;\n\n constructor({ dmk, sessionId }: DefaultSignerIcpConstructorArgs) {\n this._container = makeContainer({ dmk, sessionId });\n }\n\n getAppConfiguration(): GetVersionDAReturnType {\n return this._container\n .get<GetAppConfigurationUseCase>(configTypes.GetAppConfigurationUseCase)\n .execute();\n }\n\n getAddress(\n derivationPath: string,\n options?: AddressOptions,\n ): GetAddressDAReturnType {\n return this._container\n .get<GetAddressUseCase>(addressTypes.GetAddressUseCase)\n .execute(derivationPath, options);\n }\n\n signTransaction(\n derivationPath: string,\n transaction: Uint8Array,\n options?: TransactionOptions,\n ): SignTransactionDAReturnType {\n return this._container\n .get<SignTransactionUseCase>(transactionTypes.SignTransactionUseCase)\n .execute(derivationPath, transaction, options);\n }\n}\n"],
|
|
5
|
+
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,sBAAAE,IAAA,eAAAC,EAAAH,GAcA,IAAAI,EAA8B,wBAC9BC,EAA6B,uDAE7BC,EAA4B,qDAE5BC,EAAiC,+DAQ1B,MAAML,CAAsC,CAChC,WAEjB,YAAY,CAAE,IAAAM,EAAK,UAAAC,CAAU,EAAoC,CAC/D,KAAK,cAAa,iBAAc,CAAE,IAAAD,EAAK,UAAAC,CAAU,CAAC,CACpD,CAEA,qBAA8C,CAC5C,OAAO,KAAK,WACT,IAAgC,cAAY,0BAA0B,EACtE,QAAQ,CACb,CAEA,WACEC,EACAC,EACwB,CACxB,OAAO,KAAK,WACT,IAAuB,eAAa,iBAAiB,EACrD,QAAQD,EAAgBC,CAAO,CACpC,CAEA,gBACED,EACAE,EACAD,EAC6B,CAC7B,OAAO,KAAK,WACT,IAA4B,mBAAiB,sBAAsB,EACnE,QAAQD,EAAgBE,EAAaD,CAAO,CACjD,CACF",
|
|
6
|
+
"names": ["DefaultSignerIcp_exports", "__export", "DefaultSignerIcp", "__toCommonJS", "import_di", "import_addressTypes", "import_configTypes", "import_transactionTypes", "dmk", "sessionId", "derivationPath", "options", "transaction"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var n=require("vitest"),i=require("./DefaultSignerIcp");describe("DefaultSignerIcp",()=>{const a="test-session-id",r=()=>({}),c=e=>{const t={executeDeviceAction:e,getLoggerFactory:n.vi.fn().mockReturnValue(r)};return new i.DefaultSignerIcp({dmk:t,sessionId:a})};it("getAppConfiguration should delegate to the version device action",()=>{const e={observable:{},cancel:n.vi.fn()},t=n.vi.fn().mockReturnValue(e),o=c(t).getAppConfiguration();expect(t).toHaveBeenCalledTimes(1),expect(o).toBe(e)}),it("getAddress should delegate to the address device action",()=>{const e={observable:{},cancel:n.vi.fn()},t=n.vi.fn().mockReturnValue(e),o=c(t).getAddress("44'/223'/0'/0/0");expect(t).toHaveBeenCalledTimes(1),expect(o).toBe(e)}),it("signTransaction should delegate to the transaction device action",()=>{const e={observable:{},cancel:n.vi.fn()},t=n.vi.fn().mockReturnValue(e),o=c(t).signTransaction("44'/223'/0'/0/0",new Uint8Array([1,2]));expect(t).toHaveBeenCalledTimes(1),expect(o).toBe(e)})});
|
|
2
|
+
//# sourceMappingURL=DefaultSignerIcp.test.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/internal/DefaultSignerIcp.test.ts"],
|
|
4
|
+
"sourcesContent": ["import {\n type DeviceManagementKit,\n type DeviceSessionId,\n} from \"@ledgerhq/device-management-kit\";\nimport { vi } from \"vitest\";\n\nimport { DefaultSignerIcp } from \"./DefaultSignerIcp\";\n\ndescribe(\"DefaultSignerIcp\", () => {\n const sessionId = \"test-session-id\" as DeviceSessionId;\n const mockLoggerFactory = () => ({});\n\n const makeSigner = (executeDeviceActionMock: ReturnType<typeof vi.fn>) => {\n const dmkMock = {\n executeDeviceAction: executeDeviceActionMock,\n getLoggerFactory: vi.fn().mockReturnValue(mockLoggerFactory),\n } as unknown as DeviceManagementKit;\n return new DefaultSignerIcp({ dmk: dmkMock, sessionId });\n };\n\n it(\"getAppConfiguration should delegate to the version device action\", () => {\n // ARRANGE\n const expectedResult = { observable: {}, cancel: vi.fn() };\n const executeDeviceActionMock = vi.fn().mockReturnValue(expectedResult);\n const signer = makeSigner(executeDeviceActionMock);\n\n // ACT\n const result = signer.getAppConfiguration();\n\n // ASSERT\n expect(executeDeviceActionMock).toHaveBeenCalledTimes(1);\n expect(result).toBe(expectedResult);\n });\n\n it(\"getAddress should delegate to the address device action\", () => {\n // ARRANGE\n const expectedResult = { observable: {}, cancel: vi.fn() };\n const executeDeviceActionMock = vi.fn().mockReturnValue(expectedResult);\n const signer = makeSigner(executeDeviceActionMock);\n\n // ACT\n const result = signer.getAddress(\"44'/223'/0'/0/0\");\n\n // ASSERT\n expect(executeDeviceActionMock).toHaveBeenCalledTimes(1);\n expect(result).toBe(expectedResult);\n });\n\n it(\"signTransaction should delegate to the transaction device action\", () => {\n // ARRANGE\n const expectedResult = { observable: {}, cancel: vi.fn() };\n const executeDeviceActionMock = vi.fn().mockReturnValue(expectedResult);\n const signer = makeSigner(executeDeviceActionMock);\n\n // ACT\n const result = signer.signTransaction(\n \"44'/223'/0'/0/0\",\n new Uint8Array([0x01, 0x02]),\n );\n\n // ASSERT\n expect(executeDeviceActionMock).toHaveBeenCalledTimes(1);\n expect(result).toBe(expectedResult);\n });\n});\n"],
|
|
5
|
+
"mappings": "aAIA,IAAAA,EAAmB,kBAEnBC,EAAiC,8BAEjC,SAAS,mBAAoB,IAAM,CACjC,MAAMC,EAAY,kBACZC,EAAoB,KAAO,CAAC,GAE5BC,EAAcC,GAAsD,CACxE,MAAMC,EAAU,CACd,oBAAqBD,EACrB,iBAAkB,KAAG,GAAG,EAAE,gBAAgBF,CAAiB,CAC7D,EACA,OAAO,IAAI,mBAAiB,CAAE,IAAKG,EAAS,UAAAJ,CAAU,CAAC,CACzD,EAEA,GAAG,mEAAoE,IAAM,CAE3E,MAAMK,EAAiB,CAAE,WAAY,CAAC,EAAG,OAAQ,KAAG,GAAG,CAAE,EACnDF,EAA0B,KAAG,GAAG,EAAE,gBAAgBE,CAAc,EAIhEC,EAHSJ,EAAWC,CAAuB,EAG3B,oBAAoB,EAG1C,OAAOA,CAAuB,EAAE,sBAAsB,CAAC,EACvD,OAAOG,CAAM,EAAE,KAAKD,CAAc,CACpC,CAAC,EAED,GAAG,0DAA2D,IAAM,CAElE,MAAMA,EAAiB,CAAE,WAAY,CAAC,EAAG,OAAQ,KAAG,GAAG,CAAE,EACnDF,EAA0B,KAAG,GAAG,EAAE,gBAAgBE,CAAc,EAIhEC,EAHSJ,EAAWC,CAAuB,EAG3B,WAAW,iBAAiB,EAGlD,OAAOA,CAAuB,EAAE,sBAAsB,CAAC,EACvD,OAAOG,CAAM,EAAE,KAAKD,CAAc,CACpC,CAAC,EAED,GAAG,mEAAoE,IAAM,CAE3E,MAAMA,EAAiB,CAAE,WAAY,CAAC,EAAG,OAAQ,KAAG,GAAG,CAAE,EACnDF,EAA0B,KAAG,GAAG,EAAE,gBAAgBE,CAAc,EAIhEC,EAHSJ,EAAWC,CAAuB,EAG3B,gBACpB,kBACA,IAAI,WAAW,CAAC,EAAM,CAAI,CAAC,CAC7B,EAGA,OAAOA,CAAuB,EAAE,sBAAsB,CAAC,EACvD,OAAOG,CAAM,EAAE,KAAKD,CAAc,CACpC,CAAC,CACH,CAAC",
|
|
6
|
+
"names": ["import_vitest", "import_DefaultSignerIcp", "sessionId", "mockLoggerFactory", "makeSigner", "executeDeviceActionMock", "dmkMock", "expectedResult", "result"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var a=Object.defineProperty;var k=Object.getOwnPropertyDescriptor;var T=Object.getOwnPropertyNames;var h=Object.prototype.hasOwnProperty;var l=(n,e)=>{for(var i in e)a(n,i,{get:e[i],enumerable:!0})},I=(n,e,i,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let t of T(e))!h.call(n,t)&&t!==i&&a(n,t,{get:()=>e[t],enumerable:!(r=k(e,t))||r.enumerable});return n};var f=n=>I(a({},"__esModule",{value:!0}),n),u=(n,e,i,r)=>{for(var t=r>1?void 0:r?k(e,i):e,g=n.length-1,A;g>=0;g--)(A=n[g])&&(t=(r?A(e,i,t):A(t))||t);return r&&t&&a(e,i,t),t},m=(n,e)=>(i,r)=>e(i,r,n);var S={};l(S,{IcpAppBinder:()=>p});module.exports=f(S);var o=require("@ledgerhq/device-management-kit"),s=require("inversify"),y=require("../app-binder/command/GetAddressCommand"),v=require("../app-binder/command/GetVersionCommand"),c=require("../app-binder/constants"),D=require("../app-binder/task/SignTransactionTask"),d=require("../externalTypes");let p=class{constructor(e,i,r){this.dmk=e;this.sessionId=i;this.dmkLoggerFactory=r}getVersion(e){return this.dmk.executeDeviceAction({sessionId:this.sessionId,deviceAction:new o.SendCommandInAppDeviceAction({input:{command:new v.GetVersionCommand,appName:c.APP_NAME,requiredUserInteraction:o.UserInteractionRequired.None,skipOpenApp:e.skipOpenApp},logger:this.dmkLoggerFactory("GetVersionCommand")})})}getAddress(e){return this.dmk.executeDeviceAction({sessionId:this.sessionId,deviceAction:new o.SendCommandInAppDeviceAction({input:{command:new y.GetAddressCommand(e),appName:c.APP_NAME,requiredUserInteraction:e.checkOnDevice?o.UserInteractionRequired.VerifyAddress:o.UserInteractionRequired.None,skipOpenApp:e.skipOpenApp},logger:this.dmkLoggerFactory("GetAddressCommand")})})}signTransaction(e){return this.dmk.executeDeviceAction({sessionId:this.sessionId,deviceAction:new o.CallTaskInAppDeviceAction({input:{task:async i=>new D.SignTransactionTask(i,e,this.dmkLoggerFactory("SignTransactionTask")).run(),appName:c.APP_NAME,requiredUserInteraction:o.UserInteractionRequired.SignTransaction,skipOpenApp:e.skipOpenApp??!1},logger:this.dmkLoggerFactory("SignTransactionCommand")})})}};p=u([(0,s.injectable)(),m(0,(0,s.inject)(d.externalTypes.Dmk)),m(1,(0,s.inject)(d.externalTypes.SessionId)),m(2,(0,s.inject)(d.externalTypes.DmkLoggerFactory))],p);0&&(module.exports={IcpAppBinder});
|
|
2
|
+
//# sourceMappingURL=IcpAppBinder.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/internal/app-binder/IcpAppBinder.ts"],
|
|
4
|
+
"sourcesContent": ["import {\n CallTaskInAppDeviceAction,\n type DeviceManagementKit,\n type DeviceSessionId,\n LoggerPublisherService,\n SendCommandInAppDeviceAction,\n UserInteractionRequired,\n} from \"@ledgerhq/device-management-kit\";\nimport { inject, injectable } from \"inversify\";\n\nimport { type GetAddressDAReturnType } from \"@api/app-binder/GetAddressDeviceActionTypes\";\nimport { type GetVersionDAReturnType } from \"@api/app-binder/GetVersionDeviceActionTypes\";\nimport { type SignTransactionDAReturnType } from \"@api/app-binder/SignTransactionDeviceActionTypes\";\nimport {\n GetAddressCommand,\n type GetAddressCommandArgs,\n} from \"@internal/app-binder/command/GetAddressCommand\";\nimport { GetVersionCommand } from \"@internal/app-binder/command/GetVersionCommand\";\nimport { APP_NAME } from \"@internal/app-binder/constants\";\nimport { SignTransactionTask } from \"@internal/app-binder/task/SignTransactionTask\";\nimport { externalTypes } from \"@internal/externalTypes\";\n\n@injectable()\nexport class IcpAppBinder {\n constructor(\n @inject(externalTypes.Dmk) private dmk: DeviceManagementKit,\n @inject(externalTypes.SessionId) private sessionId: DeviceSessionId,\n @inject(externalTypes.DmkLoggerFactory)\n private dmkLoggerFactory: (tag: string) => LoggerPublisherService,\n ) {}\n\n getVersion(args: { skipOpenApp: boolean }): GetVersionDAReturnType {\n return this.dmk.executeDeviceAction({\n sessionId: this.sessionId,\n deviceAction: new SendCommandInAppDeviceAction({\n input: {\n command: new GetVersionCommand(),\n appName: APP_NAME,\n requiredUserInteraction: UserInteractionRequired.None,\n skipOpenApp: args.skipOpenApp,\n },\n logger: this.dmkLoggerFactory(\"GetVersionCommand\"),\n }),\n });\n }\n\n getAddress(args: GetAddressCommandArgs): GetAddressDAReturnType {\n return this.dmk.executeDeviceAction({\n sessionId: this.sessionId,\n deviceAction: new SendCommandInAppDeviceAction({\n input: {\n command: new GetAddressCommand(args),\n appName: APP_NAME,\n requiredUserInteraction: args.checkOnDevice\n ? UserInteractionRequired.VerifyAddress\n : UserInteractionRequired.None,\n skipOpenApp: args.skipOpenApp,\n },\n logger: this.dmkLoggerFactory(\"GetAddressCommand\"),\n }),\n });\n }\n\n signTransaction(args: {\n derivationPath: string;\n transaction: Uint8Array;\n skipOpenApp?: boolean;\n }): SignTransactionDAReturnType {\n return this.dmk.executeDeviceAction({\n sessionId: this.sessionId,\n deviceAction: new CallTaskInAppDeviceAction({\n input: {\n task: async (internalApi) =>\n new SignTransactionTask(\n internalApi,\n args,\n this.dmkLoggerFactory(\"SignTransactionTask\"),\n ).run(),\n appName: APP_NAME,\n requiredUserInteraction: UserInteractionRequired.SignTransaction,\n skipOpenApp: args.skipOpenApp ?? false,\n },\n logger: this.dmkLoggerFactory(\"SignTransactionCommand\"),\n }),\n });\n }\n}\n"],
|
|
5
|
+
"mappings": "okBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,kBAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAOO,2CACPC,EAAmC,qBAKnCC,EAGO,0DACPC,EAAkC,0DAClCC,EAAyB,0CACzBC,EAAoC,yDACpCC,EAA8B,mCAGvB,IAAMC,EAAN,KAAmB,CACxB,YACqCC,EACMC,EAEjCC,EACR,CAJmC,SAAAF,EACM,eAAAC,EAEjC,sBAAAC,CACP,CAEH,WAAWC,EAAwD,CACjE,OAAO,KAAK,IAAI,oBAAoB,CAClC,UAAW,KAAK,UAChB,aAAc,IAAI,+BAA6B,CAC7C,MAAO,CACL,QAAS,IAAI,oBACb,QAAS,WACT,wBAAyB,0BAAwB,KACjD,YAAaA,EAAK,WACpB,EACA,OAAQ,KAAK,iBAAiB,mBAAmB,CACnD,CAAC,CACH,CAAC,CACH,CAEA,WAAWA,EAAqD,CAC9D,OAAO,KAAK,IAAI,oBAAoB,CAClC,UAAW,KAAK,UAChB,aAAc,IAAI,+BAA6B,CAC7C,MAAO,CACL,QAAS,IAAI,oBAAkBA,CAAI,EACnC,QAAS,WACT,wBAAyBA,EAAK,cAC1B,0BAAwB,cACxB,0BAAwB,KAC5B,YAAaA,EAAK,WACpB,EACA,OAAQ,KAAK,iBAAiB,mBAAmB,CACnD,CAAC,CACH,CAAC,CACH,CAEA,gBAAgBA,EAIgB,CAC9B,OAAO,KAAK,IAAI,oBAAoB,CAClC,UAAW,KAAK,UAChB,aAAc,IAAI,4BAA0B,CAC1C,MAAO,CACL,KAAM,MAAOC,GACX,IAAI,sBACFA,EACAD,EACA,KAAK,iBAAiB,qBAAqB,CAC7C,EAAE,IAAI,EACR,QAAS,WACT,wBAAyB,0BAAwB,gBACjD,YAAaA,EAAK,aAAe,EACnC,EACA,OAAQ,KAAK,iBAAiB,wBAAwB,CACxD,CAAC,CACH,CAAC,CACH,CACF,EA/DaJ,EAANM,EAAA,IADN,cAAW,EAGPC,EAAA,eAAO,gBAAc,GAAG,GACxBA,EAAA,eAAO,gBAAc,SAAS,GAC9BA,EAAA,eAAO,gBAAc,gBAAgB,IAJ7BP",
|
|
6
|
+
"names": ["IcpAppBinder_exports", "__export", "IcpAppBinder", "__toCommonJS", "import_device_management_kit", "import_inversify", "import_GetAddressCommand", "import_GetVersionCommand", "import_constants", "import_SignTransactionTask", "import_externalTypes", "IcpAppBinder", "dmk", "sessionId", "dmkLoggerFactory", "args", "internalApi", "__decorateClass", "__decorateParam"]
|
|
7
|
+
}
|