@ledgerhq/device-signer-kit-aleo 0.2.0 → 0.3.0
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/lib/cjs/api/SignerAleo.js +1 -1
- package/lib/cjs/api/SignerAleo.js.map +1 -1
- package/lib/cjs/api/app-binder/SignNestedCallDeviceActionTypes.js +2 -0
- package/lib/cjs/api/app-binder/SignNestedCallDeviceActionTypes.js.map +7 -0
- package/lib/cjs/api/index.js +1 -1
- package/lib/cjs/api/index.js.map +2 -2
- package/lib/cjs/internal/DefaultSignerAleo.js +1 -1
- package/lib/cjs/internal/DefaultSignerAleo.js.map +3 -3
- package/lib/cjs/internal/app-binder/AleoAppBinder.js +1 -1
- package/lib/cjs/internal/app-binder/AleoAppBinder.js.map +3 -3
- package/lib/cjs/internal/app-binder/command/SignNestedCallCommand.js +2 -0
- package/lib/cjs/internal/app-binder/command/SignNestedCallCommand.js.map +7 -0
- package/lib/cjs/internal/app-binder/command/SignNestedCallCommand.test.js +2 -0
- package/lib/cjs/internal/app-binder/command/SignNestedCallCommand.test.js.map +7 -0
- package/lib/cjs/internal/app-binder/command/utils/apduHeaderUtils.js +1 -1
- package/lib/cjs/internal/app-binder/command/utils/apduHeaderUtils.js.map +3 -3
- package/lib/cjs/internal/app-binder/task/SignFeeIntentTask.js +1 -1
- package/lib/cjs/internal/app-binder/task/SignFeeIntentTask.js.map +3 -3
- package/lib/cjs/internal/app-binder/task/SignNestedCallTask.js +2 -0
- package/lib/cjs/internal/app-binder/task/SignNestedCallTask.js.map +7 -0
- package/lib/cjs/internal/app-binder/task/SignNestedCallTask.test.js +2 -0
- package/lib/cjs/internal/app-binder/task/SignNestedCallTask.test.js.map +7 -0
- package/lib/cjs/internal/app-binder/task/SignRootIntentTask.js +1 -1
- package/lib/cjs/internal/app-binder/task/SignRootIntentTask.js.map +3 -3
- package/lib/cjs/internal/use-cases/transaction/SignNestedCallUseCase.js +2 -0
- package/lib/cjs/internal/use-cases/transaction/SignNestedCallUseCase.js.map +7 -0
- package/lib/cjs/internal/use-cases/transaction/di/transactionModule.js +1 -1
- package/lib/cjs/internal/use-cases/transaction/di/transactionModule.js.map +3 -3
- package/lib/cjs/internal/use-cases/transaction/di/transactionTypes.js +1 -1
- package/lib/cjs/internal/use-cases/transaction/di/transactionTypes.js.map +2 -2
- package/lib/cjs/package.json +3 -3
- package/lib/esm/api/app-binder/SignNestedCallDeviceActionTypes.js +1 -0
- package/lib/esm/api/app-binder/SignNestedCallDeviceActionTypes.js.map +7 -0
- package/lib/esm/api/index.js.map +2 -2
- package/lib/esm/internal/DefaultSignerAleo.js +1 -1
- package/lib/esm/internal/DefaultSignerAleo.js.map +3 -3
- package/lib/esm/internal/app-binder/AleoAppBinder.js +1 -1
- package/lib/esm/internal/app-binder/AleoAppBinder.js.map +3 -3
- package/lib/esm/internal/app-binder/command/SignNestedCallCommand.js +2 -0
- package/lib/esm/internal/app-binder/command/SignNestedCallCommand.js.map +7 -0
- package/lib/esm/internal/app-binder/command/SignNestedCallCommand.test.js +2 -0
- package/lib/esm/internal/app-binder/command/SignNestedCallCommand.test.js.map +7 -0
- package/lib/esm/internal/app-binder/command/utils/apduHeaderUtils.js +1 -1
- package/lib/esm/internal/app-binder/command/utils/apduHeaderUtils.js.map +3 -3
- package/lib/esm/internal/app-binder/task/SignFeeIntentTask.js +1 -1
- package/lib/esm/internal/app-binder/task/SignFeeIntentTask.js.map +3 -3
- package/lib/esm/internal/app-binder/task/SignNestedCallTask.js +2 -0
- package/lib/esm/internal/app-binder/task/SignNestedCallTask.js.map +7 -0
- package/lib/esm/internal/app-binder/task/SignNestedCallTask.test.js +2 -0
- package/lib/esm/internal/app-binder/task/SignNestedCallTask.test.js.map +7 -0
- package/lib/esm/internal/app-binder/task/SignRootIntentTask.js +1 -1
- package/lib/esm/internal/app-binder/task/SignRootIntentTask.js.map +3 -3
- package/lib/esm/internal/use-cases/transaction/SignNestedCallUseCase.js +2 -0
- package/lib/esm/internal/use-cases/transaction/SignNestedCallUseCase.js.map +7 -0
- package/lib/esm/internal/use-cases/transaction/di/transactionModule.js +1 -1
- package/lib/esm/internal/use-cases/transaction/di/transactionModule.js.map +3 -3
- package/lib/esm/internal/use-cases/transaction/di/transactionTypes.js +1 -1
- package/lib/esm/internal/use-cases/transaction/di/transactionTypes.js.map +2 -2
- package/lib/esm/package.json +3 -3
- package/lib/types/api/SignerAleo.d.ts +2 -0
- package/lib/types/api/SignerAleo.d.ts.map +1 -1
- package/lib/types/api/app-binder/SignNestedCallDeviceActionTypes.d.ts +12 -0
- package/lib/types/api/app-binder/SignNestedCallDeviceActionTypes.d.ts.map +1 -0
- package/lib/types/api/index.d.ts +1 -0
- package/lib/types/api/index.d.ts.map +1 -1
- package/lib/types/internal/DefaultSignerAleo.d.ts +2 -0
- package/lib/types/internal/DefaultSignerAleo.d.ts.map +1 -1
- package/lib/types/internal/app-binder/AleoAppBinder.d.ts +5 -0
- package/lib/types/internal/app-binder/AleoAppBinder.d.ts.map +1 -1
- package/lib/types/internal/app-binder/command/SignNestedCallCommand.d.ts +22 -0
- package/lib/types/internal/app-binder/command/SignNestedCallCommand.d.ts.map +1 -0
- package/lib/types/internal/app-binder/command/SignNestedCallCommand.test.d.ts +2 -0
- package/lib/types/internal/app-binder/command/SignNestedCallCommand.test.d.ts.map +1 -0
- package/lib/types/internal/app-binder/command/utils/apduHeaderUtils.d.ts +5 -0
- package/lib/types/internal/app-binder/command/utils/apduHeaderUtils.d.ts.map +1 -1
- package/lib/types/internal/app-binder/task/SignFeeIntentTask.d.ts.map +1 -1
- package/lib/types/internal/app-binder/task/SignNestedCallTask.d.ts +13 -0
- package/lib/types/internal/app-binder/task/SignNestedCallTask.d.ts.map +1 -0
- package/lib/types/internal/app-binder/task/SignNestedCallTask.test.d.ts +2 -0
- package/lib/types/internal/app-binder/task/SignNestedCallTask.test.d.ts.map +1 -0
- package/lib/types/internal/app-binder/task/SignRootIntentTask.d.ts.map +1 -1
- package/lib/types/internal/use-cases/transaction/SignNestedCallUseCase.d.ts +9 -0
- package/lib/types/internal/use-cases/transaction/SignNestedCallUseCase.d.ts.map +1 -0
- package/lib/types/internal/use-cases/transaction/di/transactionModule.d.ts.map +1 -1
- package/lib/types/internal/use-cases/transaction/di/transactionTypes.d.ts +1 -0
- package/lib/types/internal/use-cases/transaction/di/transactionTypes.d.ts.map +1 -1
- package/lib/types/tsconfig.prod.tsbuildinfo +1 -1
- package/package.json +10 -10
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var i=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var s=Object.getOwnPropertyNames;var y=Object.prototype.hasOwnProperty;var A=(e,t,o,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of s(t))!y.call(e,n)&&n!==o&&i(e,n,{get:()=>t[n],enumerable:!(r=p(t,n))||r.enumerable});return e};var a=e=>A(i({},"__esModule",{value:!0}),e);var d={};module.exports=a(d);
|
|
2
2
|
//# sourceMappingURL=SignerAleo.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/api/SignerAleo.ts"],
|
|
4
|
-
"sourcesContent": ["import { type GetAddressDAReturnType } from \"@api/app-binder/GetAddressDeviceActionTypes\";\nimport { type GetAppConfigDAReturnType } from \"@api/app-binder/GetAppConfigDeviceActionTypes\";\nimport { type GetViewKeyDAReturnType } from \"@api/app-binder/GetViewKeyDeviceActionTypes\";\nimport { type SignFeeIntentDAReturnType } from \"@api/app-binder/SignFeeIntentDeviceActionTypes\";\nimport { type SignRootIntentDAReturnType } from \"@api/app-binder/SignRootIntentDeviceActionTypes\";\nimport { type AddressOptions } from \"@api/model/AddressOptions\";\nimport { type TransactionOptions } from \"@api/model/TransactionOptions\";\n\nexport interface SignerAleo {\n getAppConfig: () => GetAppConfigDAReturnType;\n\n getAddress: (\n derivationPath: string,\n options?: AddressOptions,\n ) => GetAddressDAReturnType;\n\n getViewKey: (\n derivationPath: string,\n options?: AddressOptions,\n ) => GetViewKeyDAReturnType;\n\n signRootIntent: (\n derivationPath: string,\n rootIntent: Uint8Array,\n options?: TransactionOptions,\n ) => SignRootIntentDAReturnType;\n\n signFeeIntent: (\n feeIntent: Uint8Array,\n options?: TransactionOptions,\n ) => SignFeeIntentDAReturnType;\n}\n"],
|
|
4
|
+
"sourcesContent": ["import { type GetAddressDAReturnType } from \"@api/app-binder/GetAddressDeviceActionTypes\";\nimport { type GetAppConfigDAReturnType } from \"@api/app-binder/GetAppConfigDeviceActionTypes\";\nimport { type GetViewKeyDAReturnType } from \"@api/app-binder/GetViewKeyDeviceActionTypes\";\nimport { type SignFeeIntentDAReturnType } from \"@api/app-binder/SignFeeIntentDeviceActionTypes\";\nimport { type SignNestedCallDAReturnType } from \"@api/app-binder/SignNestedCallDeviceActionTypes\";\nimport { type SignRootIntentDAReturnType } from \"@api/app-binder/SignRootIntentDeviceActionTypes\";\nimport { type AddressOptions } from \"@api/model/AddressOptions\";\nimport { type TransactionOptions } from \"@api/model/TransactionOptions\";\n\nexport interface SignerAleo {\n getAppConfig: () => GetAppConfigDAReturnType;\n\n getAddress: (\n derivationPath: string,\n options?: AddressOptions,\n ) => GetAddressDAReturnType;\n\n getViewKey: (\n derivationPath: string,\n options?: AddressOptions,\n ) => GetViewKeyDAReturnType;\n\n signRootIntent: (\n derivationPath: string,\n rootIntent: Uint8Array,\n options?: TransactionOptions,\n ) => SignRootIntentDAReturnType;\n\n signNestedCall: (\n nestedCallRequest: Uint8Array,\n options?: TransactionOptions,\n ) => SignNestedCallDAReturnType;\n\n signFeeIntent: (\n feeIntent: Uint8Array,\n options?: TransactionOptions,\n ) => SignFeeIntentDAReturnType;\n}\n"],
|
|
5
5
|
"mappings": "+WAAA,IAAAA,EAAA,kBAAAC,EAAAD",
|
|
6
6
|
"names": ["SignerAleo_exports", "__toCommonJS"]
|
|
7
7
|
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var o=Object.defineProperty;var i=Object.getOwnPropertyDescriptor;var l=Object.getOwnPropertyNames;var a=Object.prototype.hasOwnProperty;var d=(t,e,p,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of l(e))!a.call(t,r)&&r!==p&&o(t,r,{get:()=>e[r],enumerable:!(n=i(e,r))||n.enumerable});return t};var s=t=>d(o({},"__esModule",{value:!0}),t);var A={};module.exports=s(A);
|
|
2
|
+
//# sourceMappingURL=SignNestedCallDeviceActionTypes.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/api/app-binder/SignNestedCallDeviceActionTypes.ts"],
|
|
4
|
+
"sourcesContent": ["import {\n type CommandErrorResult,\n type ExecuteDeviceActionReturnType,\n type OpenAppDAError,\n type OpenAppDARequiredInteraction,\n type UserInteractionRequired,\n} from \"@ledgerhq/device-management-kit\";\n\nimport { type SignNestedCallCommandResponse } from \"@internal/app-binder/command/SignNestedCallCommand\";\nimport { type AleoErrorCodes } from \"@internal/app-binder/command/utils/aleoApplicationErrors\";\n\nexport type SignNestedCallDAOutput = SignNestedCallCommandResponse;\n\nexport type SignNestedCallDAError =\n | OpenAppDAError\n | CommandErrorResult<AleoErrorCodes>[\"error\"];\n\ntype SignNestedCallDARequiredInteraction =\n | OpenAppDARequiredInteraction\n | UserInteractionRequired.None;\n\nexport type SignNestedCallDAIntermediateValue = {\n requiredUserInteraction: SignNestedCallDARequiredInteraction;\n};\n\nexport type SignNestedCallDAReturnType = ExecuteDeviceActionReturnType<\n SignNestedCallDAOutput,\n SignNestedCallDAError,\n SignNestedCallDAIntermediateValue\n>;\n"],
|
|
5
|
+
"mappings": "+WAAA,IAAAA,EAAA,kBAAAC,EAAAD",
|
|
6
|
+
"names": ["SignNestedCallDeviceActionTypes_exports", "__toCommonJS"]
|
|
7
|
+
}
|
package/lib/cjs/api/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var a=Object.defineProperty;var
|
|
1
|
+
"use strict";var a=Object.defineProperty;var d=Object.getOwnPropertyDescriptor;var D=Object.getOwnPropertyNames;var s=Object.prototype.hasOwnProperty;var o=(i,e,r,A)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of D(e))!s.call(i,n)&&n!==r&&a(i,n,{get:()=>e[n],enumerable:!(A=d(e,n))||A.enumerable});return i},p=(i,e,r)=>(o(i,e,"default"),r&&o(r,e,"default"));var u=i=>o(a({},"__esModule",{value:!0}),i);var t={};module.exports=u(t);p(t,require("./SignerAleo"),module.exports);p(t,require("./SignerAleoBuilder"),module.exports);0&&(module.exports={...require("./SignerAleo"),...require("./SignerAleoBuilder")});
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/lib/cjs/api/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/api/index.ts"],
|
|
4
|
-
"sourcesContent": ["export type {\n GetAddressDAError,\n GetAddressDAIntermediateValue,\n GetAddressDAOutput,\n} from \"@api/app-binder/GetAddressDeviceActionTypes\";\nexport type {\n GetAppConfigDAError,\n GetAppConfigDAIntermediateValue,\n GetAppConfigDAOutput,\n} from \"@api/app-binder/GetAppConfigDeviceActionTypes\";\nexport type {\n GetViewKeyDAError,\n GetViewKeyDAIntermediateValue,\n GetViewKeyDAOutput,\n} from \"@api/app-binder/GetViewKeyDeviceActionTypes\";\nexport type {\n SignFeeIntentDAError,\n SignFeeIntentDAIntermediateValue,\n SignFeeIntentDAOutput,\n} from \"@api/app-binder/SignFeeIntentDeviceActionTypes\";\nexport type {\n SignRootIntentDAError,\n SignRootIntentDAIntermediateValue,\n SignRootIntentDAOutput,\n} from \"@api/app-binder/SignRootIntentDeviceActionTypes\";\nexport * from \"@api/SignerAleo\";\nexport * from \"@api/SignerAleoBuilder\";\n// Export other types as needed\n"],
|
|
5
|
-
"mappings": "iaAAA,IAAAA,EAAA,kBAAAC,EAAAD,
|
|
4
|
+
"sourcesContent": ["export type {\n GetAddressDAError,\n GetAddressDAIntermediateValue,\n GetAddressDAOutput,\n} from \"@api/app-binder/GetAddressDeviceActionTypes\";\nexport type {\n GetAppConfigDAError,\n GetAppConfigDAIntermediateValue,\n GetAppConfigDAOutput,\n} from \"@api/app-binder/GetAppConfigDeviceActionTypes\";\nexport type {\n GetViewKeyDAError,\n GetViewKeyDAIntermediateValue,\n GetViewKeyDAOutput,\n} from \"@api/app-binder/GetViewKeyDeviceActionTypes\";\nexport type {\n SignFeeIntentDAError,\n SignFeeIntentDAIntermediateValue,\n SignFeeIntentDAOutput,\n} from \"@api/app-binder/SignFeeIntentDeviceActionTypes\";\nexport type {\n SignNestedCallDAError,\n SignNestedCallDAIntermediateValue,\n SignNestedCallDAOutput,\n} from \"@api/app-binder/SignNestedCallDeviceActionTypes\";\nexport type {\n SignRootIntentDAError,\n SignRootIntentDAIntermediateValue,\n SignRootIntentDAOutput,\n} from \"@api/app-binder/SignRootIntentDeviceActionTypes\";\nexport * from \"@api/SignerAleo\";\nexport * from \"@api/SignerAleoBuilder\";\n// Export other types as needed\n"],
|
|
5
|
+
"mappings": "iaAAA,IAAAA,EAAA,kBAAAC,EAAAD,GA8BAE,EAAAF,EAAc,2BA9Bd,gBA+BAE,EAAAF,EAAc,kCA/Bd",
|
|
6
6
|
"names": ["api_exports", "__toCommonJS", "__reExport"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var o=Object.defineProperty;var g=Object.getOwnPropertyDescriptor;var y=Object.getOwnPropertyNames;var A=Object.prototype.hasOwnProperty;var C=(n,e)=>{for(var t in e)o(n,t,{get:e[t],enumerable:!0})},d=(n,e,t,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of y(e))!A.call(n,r)&&r!==t&&o(n,r,{get:()=>e[r],enumerable:!(s=g(e,r))||s.enumerable});return n};var f=n=>d(o({},"__esModule",{value:!0}),n);var c={};C(c,{DefaultSignerAleo:()=>u});module.exports=f(c);var a=require("./di"),p=require("./use-cases/address/di/addressTypes"),m=require("./use-cases/config/di/configTypes"),i=require("./use-cases/transaction/di/transactionTypes");class u{_container;constructor({dmk:e,sessionId:t}){this._container=(0,a.makeContainer)({dmk:e,sessionId:t})}getAppConfig(){return this._container.get(m.configTypes.GetAppConfigUseCase).execute()}getAddress(e,t){return this._container.get(p.addressTypes.GetAddressUseCase).execute(e,t)}getViewKey(e,t){return this._container.get(p.addressTypes.GetViewKeyUseCase).execute(e,t)}signRootIntent(e,t,s){return this._container.get(i.transactionTypes.SignRootIntentUseCase).execute(e,t,s)}signNestedCall(e,t){return this._container.get(i.transactionTypes.SignNestedCallUseCase).execute(e,t)}signFeeIntent(e,t){return this._container.get(i.transactionTypes.SignFeeIntentUseCase).execute(e,t)}}0&&(module.exports={DefaultSignerAleo});
|
|
2
2
|
//# sourceMappingURL=DefaultSignerAleo.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/internal/DefaultSignerAleo.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 GetAppConfigDAReturnType } from \"@api/app-binder/GetAppConfigDeviceActionTypes\";\nimport { type GetViewKeyDAReturnType } from \"@api/app-binder/GetViewKeyDeviceActionTypes\";\nimport { type SignFeeIntentDAReturnType } from \"@api/app-binder/SignFeeIntentDeviceActionTypes\";\nimport { type SignRootIntentDAReturnType } from \"@api/app-binder/SignRootIntentDeviceActionTypes\";\nimport { type AddressOptions } from \"@api/model/AddressOptions\";\nimport { type TransactionOptions } from \"@api/model/TransactionOptions\";\nimport { type SignerAleo } from \"@api/SignerAleo\";\nimport { makeContainer } from \"@internal/di\";\nimport { addressTypes } from \"@internal/use-cases/address/di/addressTypes\";\nimport { type GetAddressUseCase } from \"@internal/use-cases/address/GetAddressUseCase\";\nimport { type GetViewKeyUseCase } from \"@internal/use-cases/address/GetViewKeyUseCase\";\nimport { configTypes } from \"@internal/use-cases/config/di/configTypes\";\nimport { type GetAppConfigUseCase } from \"@internal/use-cases/config/GetAppConfigUseCase\";\nimport { transactionTypes } from \"@internal/use-cases/transaction/di/transactionTypes\";\nimport { type SignFeeIntentUseCase } from \"@internal/use-cases/transaction/SignFeeIntentUseCase\";\nimport { type SignRootIntentUseCase } from \"@internal/use-cases/transaction/SignRootIntentUseCase\";\n\ntype DefaultSignerAleoConstructorArgs = {\n dmk: DeviceManagementKit;\n sessionId: DeviceSessionId;\n};\n\nexport class DefaultSignerAleo implements SignerAleo {\n private readonly _container: Container;\n\n constructor({ dmk, sessionId }: DefaultSignerAleoConstructorArgs) {\n this._container = makeContainer({ dmk, sessionId });\n }\n\n getAppConfig(): GetAppConfigDAReturnType {\n return this._container\n .get<GetAppConfigUseCase>(configTypes.GetAppConfigUseCase)\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 getViewKey(\n derivationPath: string,\n options?: AddressOptions,\n ): GetViewKeyDAReturnType {\n return this._container\n .get<GetViewKeyUseCase>(addressTypes.GetViewKeyUseCase)\n .execute(derivationPath, options);\n }\n\n signRootIntent(\n derivationPath: string,\n rootIntent: Uint8Array,\n options?: TransactionOptions,\n ): SignRootIntentDAReturnType {\n return this._container\n .get<SignRootIntentUseCase>(transactionTypes.SignRootIntentUseCase)\n .execute(derivationPath, rootIntent, options);\n }\n\n signFeeIntent(\n feeIntent: Uint8Array,\n options?: TransactionOptions,\n ): SignFeeIntentDAReturnType {\n return this._container\n .get<SignFeeIntentUseCase>(transactionTypes.SignFeeIntentUseCase)\n .execute(feeIntent, options);\n }\n}\n"],
|
|
5
|
-
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,uBAAAE,IAAA,eAAAC,EAAAH,
|
|
6
|
-
"names": ["DefaultSignerAleo_exports", "__export", "DefaultSignerAleo", "__toCommonJS", "import_di", "import_addressTypes", "import_configTypes", "import_transactionTypes", "dmk", "sessionId", "derivationPath", "options", "rootIntent", "feeIntent"]
|
|
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 GetAppConfigDAReturnType } from \"@api/app-binder/GetAppConfigDeviceActionTypes\";\nimport { type GetViewKeyDAReturnType } from \"@api/app-binder/GetViewKeyDeviceActionTypes\";\nimport { type SignFeeIntentDAReturnType } from \"@api/app-binder/SignFeeIntentDeviceActionTypes\";\nimport { type SignNestedCallDAReturnType } from \"@api/app-binder/SignNestedCallDeviceActionTypes\";\nimport { type SignRootIntentDAReturnType } from \"@api/app-binder/SignRootIntentDeviceActionTypes\";\nimport { type AddressOptions } from \"@api/model/AddressOptions\";\nimport { type TransactionOptions } from \"@api/model/TransactionOptions\";\nimport { type SignerAleo } from \"@api/SignerAleo\";\nimport { makeContainer } from \"@internal/di\";\nimport { addressTypes } from \"@internal/use-cases/address/di/addressTypes\";\nimport { type GetAddressUseCase } from \"@internal/use-cases/address/GetAddressUseCase\";\nimport { type GetViewKeyUseCase } from \"@internal/use-cases/address/GetViewKeyUseCase\";\nimport { configTypes } from \"@internal/use-cases/config/di/configTypes\";\nimport { type GetAppConfigUseCase } from \"@internal/use-cases/config/GetAppConfigUseCase\";\nimport { transactionTypes } from \"@internal/use-cases/transaction/di/transactionTypes\";\nimport { type SignFeeIntentUseCase } from \"@internal/use-cases/transaction/SignFeeIntentUseCase\";\nimport { type SignNestedCallUseCase } from \"@internal/use-cases/transaction/SignNestedCallUseCase\";\nimport { type SignRootIntentUseCase } from \"@internal/use-cases/transaction/SignRootIntentUseCase\";\n\ntype DefaultSignerAleoConstructorArgs = {\n dmk: DeviceManagementKit;\n sessionId: DeviceSessionId;\n};\n\nexport class DefaultSignerAleo implements SignerAleo {\n private readonly _container: Container;\n\n constructor({ dmk, sessionId }: DefaultSignerAleoConstructorArgs) {\n this._container = makeContainer({ dmk, sessionId });\n }\n\n getAppConfig(): GetAppConfigDAReturnType {\n return this._container\n .get<GetAppConfigUseCase>(configTypes.GetAppConfigUseCase)\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 getViewKey(\n derivationPath: string,\n options?: AddressOptions,\n ): GetViewKeyDAReturnType {\n return this._container\n .get<GetViewKeyUseCase>(addressTypes.GetViewKeyUseCase)\n .execute(derivationPath, options);\n }\n\n signRootIntent(\n derivationPath: string,\n rootIntent: Uint8Array,\n options?: TransactionOptions,\n ): SignRootIntentDAReturnType {\n return this._container\n .get<SignRootIntentUseCase>(transactionTypes.SignRootIntentUseCase)\n .execute(derivationPath, rootIntent, options);\n }\n\n signNestedCall(\n nestedCallRequest: Uint8Array,\n options?: TransactionOptions,\n ): SignNestedCallDAReturnType {\n return this._container\n .get<SignNestedCallUseCase>(transactionTypes.SignNestedCallUseCase)\n .execute(nestedCallRequest, options);\n }\n\n signFeeIntent(\n feeIntent: Uint8Array,\n options?: TransactionOptions,\n ): SignFeeIntentDAReturnType {\n return this._container\n .get<SignFeeIntentUseCase>(transactionTypes.SignFeeIntentUseCase)\n .execute(feeIntent, options);\n }\n}\n"],
|
|
5
|
+
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,uBAAAE,IAAA,eAAAC,EAAAH,GAeA,IAAAI,EAA8B,wBAC9BC,EAA6B,uDAG7BC,EAA4B,qDAE5BC,EAAiC,+DAU1B,MAAML,CAAwC,CAClC,WAEjB,YAAY,CAAE,IAAAM,EAAK,UAAAC,CAAU,EAAqC,CAChE,KAAK,cAAa,iBAAc,CAAE,IAAAD,EAAK,UAAAC,CAAU,CAAC,CACpD,CAEA,cAAyC,CACvC,OAAO,KAAK,WACT,IAAyB,cAAY,mBAAmB,EACxD,QAAQ,CACb,CAEA,WACEC,EACAC,EACwB,CACxB,OAAO,KAAK,WACT,IAAuB,eAAa,iBAAiB,EACrD,QAAQD,EAAgBC,CAAO,CACpC,CAEA,WACED,EACAC,EACwB,CACxB,OAAO,KAAK,WACT,IAAuB,eAAa,iBAAiB,EACrD,QAAQD,EAAgBC,CAAO,CACpC,CAEA,eACED,EACAE,EACAD,EAC4B,CAC5B,OAAO,KAAK,WACT,IAA2B,mBAAiB,qBAAqB,EACjE,QAAQD,EAAgBE,EAAYD,CAAO,CAChD,CAEA,eACEE,EACAF,EAC4B,CAC5B,OAAO,KAAK,WACT,IAA2B,mBAAiB,qBAAqB,EACjE,QAAQE,EAAmBF,CAAO,CACvC,CAEA,cACEG,EACAH,EAC2B,CAC3B,OAAO,KAAK,WACT,IAA0B,mBAAiB,oBAAoB,EAC/D,QAAQG,EAAWH,CAAO,CAC/B,CACF",
|
|
6
|
+
"names": ["DefaultSignerAleo_exports", "__export", "DefaultSignerAleo", "__toCommonJS", "import_di", "import_addressTypes", "import_configTypes", "import_transactionTypes", "dmk", "sessionId", "derivationPath", "options", "rootIntent", "nestedCallRequest", "feeIntent"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var d=Object.defineProperty;var I=Object.getOwnPropertyDescriptor;var R=Object.getOwnPropertyNames;var g=Object.prototype.hasOwnProperty;var h=(i,e)=>{for(var n in e)d(i,n,{get:e[n],enumerable:!0})},T=(i,e,n,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let p of R(e))!g.call(i,p)&&p!==n&&d(i,p,{get:()=>e[p],enumerable:!(o=I(e,p))||o.enumerable});return i};var w=i=>T(d({},"__esModule",{value:!0}),i),k=(i,e,n,o)=>{for(var p=o>1?void 0:o?I(e,n):e,m=i.length-1,c;m>=0;m--)(c=i[m])&&(p=(o?c(e,n,p):c(p))||p);return o&&p&&d(e,n,p),p},A=(i,e)=>(n,o)=>e(n,o,i);var C={};h(C,{AleoAppBinder:()=>r});module.exports=w(C);var t=require("@ledgerhq/device-management-kit"),a=require("inversify"),s=require("../app-binder/constants"),u=require("../externalTypes"),y=require("./command/GetAddressCommand"),v=require("./command/GetAppConfigCommand"),D=require("./command/GetViewKeyCommand"),f=require("./task/SignFeeIntentTask"),l=require("./task/SignNestedCallTask"),O=require("./task/SignRootIntentTask");let r=class{constructor(e,n){this.dmk=e;this.sessionId=n}getAppConfig(e){return this.dmk.executeDeviceAction({sessionId:this.sessionId,deviceAction:new t.SendCommandInAppDeviceAction({input:{command:new v.GetAppConfigCommand,appName:s.APP_NAME,requiredUserInteraction:t.UserInteractionRequired.None,skipOpenApp:e.skipOpenApp}})})}getAddress(e){return this.dmk.executeDeviceAction({sessionId:this.sessionId,deviceAction:new t.SendCommandInAppDeviceAction({input:{command:new y.GetAddressCommand(e),appName:s.APP_NAME,requiredUserInteraction:e.checkOnDevice?t.UserInteractionRequired.VerifyAddress:t.UserInteractionRequired.None,skipOpenApp:e.skipOpenApp}})})}getViewKey(e){return this.dmk.executeDeviceAction({sessionId:this.sessionId,deviceAction:new t.SendCommandInAppDeviceAction({input:{command:new D.GetViewKeyCommand(e),appName:s.APP_NAME,requiredUserInteraction:t.UserInteractionRequired.VerifyAddress,skipOpenApp:e.skipOpenApp}})})}signRootIntent(e){return this.dmk.executeDeviceAction({sessionId:this.sessionId,deviceAction:new t.CallTaskInAppDeviceAction({input:{task:n=>new O.SignRootIntentTask(n,{derivationPath:e.derivationPath,rootIntent:e.rootIntent}).run(),appName:s.APP_NAME,requiredUserInteraction:t.UserInteractionRequired.SignTransaction,skipOpenApp:e.skipOpenApp}})})}signNestedCall(e){return this.dmk.executeDeviceAction({sessionId:this.sessionId,deviceAction:new t.CallTaskInAppDeviceAction({input:{task:n=>new l.SignNestedCallTask(n,{nestedCallRequest:e.nestedCallRequest}).run(),appName:s.APP_NAME,requiredUserInteraction:t.UserInteractionRequired.None,skipOpenApp:e.skipOpenApp}})})}signFeeIntent(e){return this.dmk.executeDeviceAction({sessionId:this.sessionId,deviceAction:new t.CallTaskInAppDeviceAction({input:{task:n=>new f.SignFeeIntentTask(n,{feeIntent:e.feeIntent}).run(),appName:s.APP_NAME,requiredUserInteraction:t.UserInteractionRequired.SignTransaction,skipOpenApp:e.skipOpenApp}})})}};r=k([(0,a.injectable)(),A(0,(0,a.inject)(u.externalTypes.Dmk)),A(1,(0,a.inject)(u.externalTypes.SessionId))],r);0&&(module.exports={AleoAppBinder});
|
|
2
2
|
//# sourceMappingURL=AleoAppBinder.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/internal/app-binder/AleoAppBinder.ts"],
|
|
4
|
-
"sourcesContent": ["import {\n CallTaskInAppDeviceAction,\n type DeviceManagementKit,\n type DeviceSessionId,\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 GetAppConfigDAReturnType } from \"@api/app-binder/GetAppConfigDeviceActionTypes\";\nimport { type GetViewKeyDAReturnType } from \"@api/app-binder/GetViewKeyDeviceActionTypes\";\nimport { type SignFeeIntentDAReturnType } from \"@api/app-binder/SignFeeIntentDeviceActionTypes\";\nimport { type SignRootIntentDAReturnType } from \"@api/app-binder/SignRootIntentDeviceActionTypes\";\nimport { APP_NAME } from \"@internal/app-binder/constants\";\nimport { externalTypes } from \"@internal/externalTypes\";\n\nimport { GetAddressCommand } from \"./command/GetAddressCommand\";\nimport { GetAppConfigCommand } from \"./command/GetAppConfigCommand\";\nimport { GetViewKeyCommand } from \"./command/GetViewKeyCommand\";\nimport { SignFeeIntentTask } from \"./task/SignFeeIntentTask\";\nimport { SignRootIntentTask } from \"./task/SignRootIntentTask\";\n\n@injectable()\nexport class AleoAppBinder {\n constructor(\n @inject(externalTypes.Dmk) private dmk: DeviceManagementKit,\n @inject(externalTypes.SessionId) private sessionId: DeviceSessionId,\n ) {}\n\n getAppConfig(args: { skipOpenApp: boolean }): GetAppConfigDAReturnType {\n return this.dmk.executeDeviceAction({\n sessionId: this.sessionId,\n deviceAction: new SendCommandInAppDeviceAction({\n input: {\n command: new GetAppConfigCommand(),\n appName: APP_NAME,\n requiredUserInteraction: UserInteractionRequired.None,\n skipOpenApp: args.skipOpenApp,\n },\n }),\n });\n }\n\n getAddress(args: {\n derivationPath: string;\n checkOnDevice: boolean;\n skipOpenApp: boolean;\n }): 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 }),\n });\n }\n\n getViewKey(args: {\n derivationPath: string;\n skipOpenApp: boolean;\n }): GetViewKeyDAReturnType {\n return this.dmk.executeDeviceAction({\n sessionId: this.sessionId,\n deviceAction: new SendCommandInAppDeviceAction({\n input: {\n command: new GetViewKeyCommand(args),\n appName: APP_NAME,\n requiredUserInteraction: UserInteractionRequired.VerifyAddress,\n skipOpenApp: args.skipOpenApp,\n },\n }),\n });\n }\n\n signRootIntent(args: {\n derivationPath: string;\n rootIntent: Uint8Array;\n skipOpenApp: boolean;\n }): SignRootIntentDAReturnType {\n return this.dmk.executeDeviceAction({\n sessionId: this.sessionId,\n deviceAction: new CallTaskInAppDeviceAction({\n input: {\n task: (internalApi) =>\n new SignRootIntentTask(internalApi, {\n derivationPath: args.derivationPath,\n rootIntent: args.rootIntent,\n }).run(),\n appName: APP_NAME,\n requiredUserInteraction: UserInteractionRequired.SignTransaction,\n skipOpenApp: args.skipOpenApp,\n },\n }),\n });\n }\n\n signFeeIntent(args: {\n feeIntent: Uint8Array;\n skipOpenApp: boolean;\n }): SignFeeIntentDAReturnType {\n return this.dmk.executeDeviceAction({\n sessionId: this.sessionId,\n deviceAction: new CallTaskInAppDeviceAction({\n input: {\n task: (internalApi) =>\n new SignFeeIntentTask(internalApi, {\n feeIntent: args.feeIntent,\n }).run(),\n appName: APP_NAME,\n requiredUserInteraction: UserInteractionRequired.SignTransaction,\n skipOpenApp: args.skipOpenApp,\n },\n }),\n });\n }\n}\n"],
|
|
5
|
-
"mappings": "okBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,mBAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAMO,2CACPC,EAAmC,
|
|
6
|
-
"names": ["AleoAppBinder_exports", "__export", "AleoAppBinder", "__toCommonJS", "import_device_management_kit", "import_inversify", "import_constants", "import_externalTypes", "import_GetAddressCommand", "import_GetAppConfigCommand", "import_GetViewKeyCommand", "import_SignFeeIntentTask", "import_SignRootIntentTask", "AleoAppBinder", "dmk", "sessionId", "args", "internalApi", "__decorateClass", "__decorateParam"]
|
|
4
|
+
"sourcesContent": ["import {\n CallTaskInAppDeviceAction,\n type DeviceManagementKit,\n type DeviceSessionId,\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 GetAppConfigDAReturnType } from \"@api/app-binder/GetAppConfigDeviceActionTypes\";\nimport { type GetViewKeyDAReturnType } from \"@api/app-binder/GetViewKeyDeviceActionTypes\";\nimport { type SignFeeIntentDAReturnType } from \"@api/app-binder/SignFeeIntentDeviceActionTypes\";\nimport { type SignNestedCallDAReturnType } from \"@api/app-binder/SignNestedCallDeviceActionTypes\";\nimport { type SignRootIntentDAReturnType } from \"@api/app-binder/SignRootIntentDeviceActionTypes\";\nimport { APP_NAME } from \"@internal/app-binder/constants\";\nimport { externalTypes } from \"@internal/externalTypes\";\n\nimport { GetAddressCommand } from \"./command/GetAddressCommand\";\nimport { GetAppConfigCommand } from \"./command/GetAppConfigCommand\";\nimport { GetViewKeyCommand } from \"./command/GetViewKeyCommand\";\nimport { SignFeeIntentTask } from \"./task/SignFeeIntentTask\";\nimport { SignNestedCallTask } from \"./task/SignNestedCallTask\";\nimport { SignRootIntentTask } from \"./task/SignRootIntentTask\";\n\n@injectable()\nexport class AleoAppBinder {\n constructor(\n @inject(externalTypes.Dmk) private dmk: DeviceManagementKit,\n @inject(externalTypes.SessionId) private sessionId: DeviceSessionId,\n ) {}\n\n getAppConfig(args: { skipOpenApp: boolean }): GetAppConfigDAReturnType {\n return this.dmk.executeDeviceAction({\n sessionId: this.sessionId,\n deviceAction: new SendCommandInAppDeviceAction({\n input: {\n command: new GetAppConfigCommand(),\n appName: APP_NAME,\n requiredUserInteraction: UserInteractionRequired.None,\n skipOpenApp: args.skipOpenApp,\n },\n }),\n });\n }\n\n getAddress(args: {\n derivationPath: string;\n checkOnDevice: boolean;\n skipOpenApp: boolean;\n }): 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 }),\n });\n }\n\n getViewKey(args: {\n derivationPath: string;\n skipOpenApp: boolean;\n }): GetViewKeyDAReturnType {\n return this.dmk.executeDeviceAction({\n sessionId: this.sessionId,\n deviceAction: new SendCommandInAppDeviceAction({\n input: {\n command: new GetViewKeyCommand(args),\n appName: APP_NAME,\n requiredUserInteraction: UserInteractionRequired.VerifyAddress,\n skipOpenApp: args.skipOpenApp,\n },\n }),\n });\n }\n\n signRootIntent(args: {\n derivationPath: string;\n rootIntent: Uint8Array;\n skipOpenApp: boolean;\n }): SignRootIntentDAReturnType {\n return this.dmk.executeDeviceAction({\n sessionId: this.sessionId,\n deviceAction: new CallTaskInAppDeviceAction({\n input: {\n task: (internalApi) =>\n new SignRootIntentTask(internalApi, {\n derivationPath: args.derivationPath,\n rootIntent: args.rootIntent,\n }).run(),\n appName: APP_NAME,\n requiredUserInteraction: UserInteractionRequired.SignTransaction,\n skipOpenApp: args.skipOpenApp,\n },\n }),\n });\n }\n\n signNestedCall(args: {\n nestedCallRequest: Uint8Array;\n skipOpenApp: boolean;\n }): SignNestedCallDAReturnType {\n return this.dmk.executeDeviceAction({\n sessionId: this.sessionId,\n deviceAction: new CallTaskInAppDeviceAction({\n input: {\n task: (internalApi) =>\n new SignNestedCallTask(internalApi, {\n nestedCallRequest: args.nestedCallRequest,\n }).run(),\n appName: APP_NAME,\n requiredUserInteraction: UserInteractionRequired.None,\n skipOpenApp: args.skipOpenApp,\n },\n }),\n });\n }\n\n signFeeIntent(args: {\n feeIntent: Uint8Array;\n skipOpenApp: boolean;\n }): SignFeeIntentDAReturnType {\n return this.dmk.executeDeviceAction({\n sessionId: this.sessionId,\n deviceAction: new CallTaskInAppDeviceAction({\n input: {\n task: (internalApi) =>\n new SignFeeIntentTask(internalApi, {\n feeIntent: args.feeIntent,\n }).run(),\n appName: APP_NAME,\n requiredUserInteraction: UserInteractionRequired.SignTransaction,\n skipOpenApp: args.skipOpenApp,\n },\n }),\n });\n }\n}\n"],
|
|
5
|
+
"mappings": "okBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,mBAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAMO,2CACPC,EAAmC,qBAQnCC,EAAyB,0CACzBC,EAA8B,mCAE9BC,EAAkC,uCAClCC,EAAoC,yCACpCC,EAAkC,uCAClCC,EAAkC,oCAClCC,EAAmC,qCACnCC,EAAmC,qCAG5B,IAAMC,EAAN,KAAoB,CACzB,YACqCC,EACMC,EACzC,CAFmC,SAAAD,EACM,eAAAC,CACxC,CAEH,aAAaC,EAA0D,CACrE,OAAO,KAAK,IAAI,oBAAoB,CAClC,UAAW,KAAK,UAChB,aAAc,IAAI,+BAA6B,CAC7C,MAAO,CACL,QAAS,IAAI,sBACb,QAAS,WACT,wBAAyB,0BAAwB,KACjD,YAAaA,EAAK,WACpB,CACF,CAAC,CACH,CAAC,CACH,CAEA,WAAWA,EAIgB,CACzB,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,CACF,CAAC,CACH,CAAC,CACH,CAEA,WAAWA,EAGgB,CACzB,OAAO,KAAK,IAAI,oBAAoB,CAClC,UAAW,KAAK,UAChB,aAAc,IAAI,+BAA6B,CAC7C,MAAO,CACL,QAAS,IAAI,oBAAkBA,CAAI,EACnC,QAAS,WACT,wBAAyB,0BAAwB,cACjD,YAAaA,EAAK,WACpB,CACF,CAAC,CACH,CAAC,CACH,CAEA,eAAeA,EAIgB,CAC7B,OAAO,KAAK,IAAI,oBAAoB,CAClC,UAAW,KAAK,UAChB,aAAc,IAAI,4BAA0B,CAC1C,MAAO,CACL,KAAOC,GACL,IAAI,qBAAmBA,EAAa,CAClC,eAAgBD,EAAK,eACrB,WAAYA,EAAK,UACnB,CAAC,EAAE,IAAI,EACT,QAAS,WACT,wBAAyB,0BAAwB,gBACjD,YAAaA,EAAK,WACpB,CACF,CAAC,CACH,CAAC,CACH,CAEA,eAAeA,EAGgB,CAC7B,OAAO,KAAK,IAAI,oBAAoB,CAClC,UAAW,KAAK,UAChB,aAAc,IAAI,4BAA0B,CAC1C,MAAO,CACL,KAAOC,GACL,IAAI,qBAAmBA,EAAa,CAClC,kBAAmBD,EAAK,iBAC1B,CAAC,EAAE,IAAI,EACT,QAAS,WACT,wBAAyB,0BAAwB,KACjD,YAAaA,EAAK,WACpB,CACF,CAAC,CACH,CAAC,CACH,CAEA,cAAcA,EAGgB,CAC5B,OAAO,KAAK,IAAI,oBAAoB,CAClC,UAAW,KAAK,UAChB,aAAc,IAAI,4BAA0B,CAC1C,MAAO,CACL,KAAOC,GACL,IAAI,oBAAkBA,EAAa,CACjC,UAAWD,EAAK,SAClB,CAAC,EAAE,IAAI,EACT,QAAS,WACT,wBAAyB,0BAAwB,gBACjD,YAAaA,EAAK,WACpB,CACF,CAAC,CACH,CAAC,CACH,CACF,EAtHaH,EAANK,EAAA,IADN,cAAW,EAGPC,EAAA,eAAO,gBAAc,GAAG,GACxBA,EAAA,eAAO,gBAAc,SAAS,IAHtBN",
|
|
6
|
+
"names": ["AleoAppBinder_exports", "__export", "AleoAppBinder", "__toCommonJS", "import_device_management_kit", "import_inversify", "import_constants", "import_externalTypes", "import_GetAddressCommand", "import_GetAppConfigCommand", "import_GetViewKeyCommand", "import_SignFeeIntentTask", "import_SignNestedCallTask", "import_SignRootIntentTask", "AleoAppBinder", "dmk", "sessionId", "args", "internalApi", "__decorateClass", "__decorateParam"]
|
|
7
7
|
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var l=Object.defineProperty;var i=Object.getOwnPropertyDescriptor;var C=Object.getOwnPropertyNames;var g=Object.prototype.hasOwnProperty;var u=(n,e)=>{for(var r in e)l(n,r,{get:e[r],enumerable:!0})},A=(n,e,r,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of C(e))!g.call(n,o)&&o!==r&&l(n,o,{get:()=>e[o],enumerable:!(s=i(e,o))||s.enumerable});return n};var N=n=>A(l({},"__esModule",{value:!0}),n);var S={};u(S,{SignNestedCallCommand:()=>y});module.exports=N(S);var a=require("@ledgerhq/device-management-kit"),m=require("@ledgerhq/signer-utils"),p=require("purify-ts"),t=require("../../app-binder/command/utils/apduHeaderUtils"),d=require("./utils/aleoApplicationErrors");class y{constructor(e){this.args=e}name="signNestedCall";errorHelper=new m.CommandErrorHelper(d.ALEO_APP_ERRORS,d.AleoAppCommandErrorFactory);getApdu(){const e={cla:t.ALEO_CLA,ins:t.INS.SIGN_INTENT,p1:t.P1.SIGN_MODE_NESTED_CALL,p2:this.args.isFirst?t.P2.FIRST_CHUNK:t.P2.NEXT_CHUNK},r=new a.ApduBuilder(e);return r.addBufferToData(this.args.chunkedData),r.build()}parseResponse(e){return p.Maybe.fromNullable(this.errorHelper.getError(e)).orDefaultLazy(()=>{const r=new a.ApduParser(e),s=r.getUnparsedRemainingLength(),o=r.extractFieldByLength(s);return o&&o.length>0?(0,a.CommandResultFactory)({data:{tlvSignature:r.encodeToHexaString(o)}}):(0,a.CommandResultFactory)({data:{tlvSignature:""}})})}}0&&(module.exports={SignNestedCallCommand});
|
|
2
|
+
//# sourceMappingURL=SignNestedCallCommand.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/internal/app-binder/command/SignNestedCallCommand.ts"],
|
|
4
|
+
"sourcesContent": ["import {\n type Apdu,\n ApduBuilder,\n type ApduBuilderArgs,\n ApduParser,\n type ApduResponse,\n type Command,\n type CommandResult,\n CommandResultFactory,\n} from \"@ledgerhq/device-management-kit\";\nimport { CommandErrorHelper } from \"@ledgerhq/signer-utils\";\nimport { Maybe } from \"purify-ts\";\n\nimport {\n ALEO_CLA,\n INS,\n P1,\n P2,\n} from \"@internal/app-binder/command/utils/apduHeaderUtils\";\nimport { type AleoChunkableCommandArgs } from \"@internal/app-binder/task/AleoChunkableCommandArgs\";\n\nimport {\n ALEO_APP_ERRORS,\n AleoAppCommandErrorFactory,\n type AleoErrorCodes,\n} from \"./utils/aleoApplicationErrors\";\n\nexport type SignNestedCallCommandArgs = AleoChunkableCommandArgs;\n\nexport type SignNestedCallCommandResponse = {\n readonly tlvSignature: string;\n};\n\n/**\n * Command to sign a nested call in an Aleo transaction.\n * This command can be called multiple times after the root intent is signed.\n * The device uses tvk from the intent's signature response as 'root_tvk'.\n * On success, the device responds with TLV-encoded request signature data and a 0x9000 status code.\n */\nexport class SignNestedCallCommand\n implements\n Command<\n SignNestedCallCommandResponse,\n SignNestedCallCommandArgs,\n AleoErrorCodes\n >\n{\n readonly name = \"signNestedCall\";\n private readonly errorHelper = new CommandErrorHelper<\n SignNestedCallCommandResponse,\n AleoErrorCodes\n >(ALEO_APP_ERRORS, AleoAppCommandErrorFactory);\n\n constructor(private readonly args: SignNestedCallCommandArgs) {}\n\n getApdu(): Apdu {\n const signNestedCallArgs: ApduBuilderArgs = {\n cla: ALEO_CLA,\n ins: INS.SIGN_INTENT,\n p1: P1.SIGN_MODE_NESTED_CALL,\n p2: this.args.isFirst ? P2.FIRST_CHUNK : P2.NEXT_CHUNK,\n };\n\n const builder = new ApduBuilder(signNestedCallArgs);\n\n builder.addBufferToData(this.args.chunkedData);\n\n return builder.build();\n }\n\n parseResponse(\n response: ApduResponse,\n ): CommandResult<SignNestedCallCommandResponse, AleoErrorCodes> {\n return Maybe.fromNullable(\n this.errorHelper.getError(response),\n ).orDefaultLazy(() => {\n const parser = new ApduParser(response);\n\n const remainingLength = parser.getUnparsedRemainingLength();\n\n const data = parser.extractFieldByLength(remainingLength);\n\n if (data && data.length > 0) {\n return CommandResultFactory({\n data: {\n tlvSignature: parser.encodeToHexaString(data),\n },\n });\n }\n\n // for intermediate chunks, the device returns 0 bytes of data with 0x9000.\n return CommandResultFactory({\n data: {\n tlvSignature: \"\",\n },\n });\n });\n }\n}\n"],
|
|
5
|
+
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,2BAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EASO,2CACPC,EAAmC,kCACnCC,EAAsB,qBAEtBC,EAKO,8DAGPC,EAIO,yCAcA,MAAMN,CAOb,CAOE,YAA6BO,EAAiC,CAAjC,UAAAA,CAAkC,CANtD,KAAO,iBACC,YAAc,IAAI,qBAGjC,kBAAiB,4BAA0B,EAI7C,SAAgB,CACd,MAAMC,EAAsC,CAC1C,IAAK,WACL,IAAK,MAAI,YACT,GAAI,KAAG,sBACP,GAAI,KAAK,KAAK,QAAU,KAAG,YAAc,KAAG,UAC9C,EAEMC,EAAU,IAAI,cAAYD,CAAkB,EAElD,OAAAC,EAAQ,gBAAgB,KAAK,KAAK,WAAW,EAEtCA,EAAQ,MAAM,CACvB,CAEA,cACEC,EAC8D,CAC9D,OAAO,QAAM,aACX,KAAK,YAAY,SAASA,CAAQ,CACpC,EAAE,cAAc,IAAM,CACpB,MAAMC,EAAS,IAAI,aAAWD,CAAQ,EAEhCE,EAAkBD,EAAO,2BAA2B,EAEpDE,EAAOF,EAAO,qBAAqBC,CAAe,EAExD,OAAIC,GAAQA,EAAK,OAAS,KACjB,wBAAqB,CAC1B,KAAM,CACJ,aAAcF,EAAO,mBAAmBE,CAAI,CAC9C,CACF,CAAC,KAII,wBAAqB,CAC1B,KAAM,CACJ,aAAc,EAChB,CACF,CAAC,CACH,CAAC,CACH,CACF",
|
|
6
|
+
"names": ["SignNestedCallCommand_exports", "__export", "SignNestedCallCommand", "__toCommonJS", "import_device_management_kit", "import_signer_utils", "import_purify_ts", "import_apduHeaderUtils", "import_aleoApplicationErrors", "args", "signNestedCallArgs", "builder", "response", "parser", "remainingLength", "data"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var r=require("@ledgerhq/device-management-kit"),t=require("../../app-binder/command/utils/apduHeaderUtils"),a=require("./SignNestedCallCommand");describe("SignNestedCallCommand",()=>{const n=new Uint8Array([5,6,7,8]),c=new Uint8Array(255).fill(36);describe("name",()=>{it("should be 'signNestedCall'",()=>{const s=new a.SignNestedCallCommand({chunkedData:n,isFirst:!0});expect(s.name).toBe("signNestedCall")})}),describe("getApdu",()=>{it("should create correct APDU for the first chunk",()=>{const e=new a.SignNestedCallCommand({chunkedData:n,isFirst:!0}).getApdu();expect(e.cla).toBe(t.ALEO_CLA),expect(e.ins).toBe(t.INS.SIGN_INTENT),expect(e.p1).toBe(t.P1.SIGN_MODE_NESTED_CALL),expect(e.p2).toBe(t.P2.FIRST_CHUNK),expect(e.data.length).toBe(n.length),expect(e.data).toEqual(n)}),it("should create correct APDU for subsequent chunks",()=>{const e=new a.SignNestedCallCommand({chunkedData:n,isFirst:!1}).getApdu();expect(e.cla).toBe(t.ALEO_CLA),expect(e.ins).toBe(t.INS.SIGN_INTENT),expect(e.p1).toBe(t.P1.SIGN_MODE_NESTED_CALL),expect(e.p2).toBe(t.P2.NEXT_CHUNK),expect(e.data.length).toBe(n.length),expect(e.data).toEqual(n)}),it("should create correct APDU for a long chunk (255 bytes)",()=>{const e=new a.SignNestedCallCommand({chunkedData:c,isFirst:!1}).getApdu();expect(e.cla).toBe(t.ALEO_CLA),expect(e.ins).toBe(t.INS.SIGN_INTENT),expect(e.p1).toBe(t.P1.SIGN_MODE_NESTED_CALL),expect(e.p2).toBe(t.P2.NEXT_CHUNK),expect(e.data.length).toBe(255),expect(e.data).toEqual(c)})}),describe("parseResponse",()=>{it("should return hexadecimal string for successful response",()=>{const s=new a.SignNestedCallCommand({chunkedData:n,isFirst:!0}),e={statusCode:new Uint8Array([144,0]),data:new Uint8Array([1,2,3])},o=s.parseResponse(e);expect(o).toEqual((0,r.CommandResultFactory)({data:{tlvSignature:"010203"}}))}),it("should return empty signature for successful response without data (intermediate chunks)",()=>{const s=new a.SignNestedCallCommand({chunkedData:n,isFirst:!0}),e={statusCode:new Uint8Array([144,0]),data:new Uint8Array([])},o=s.parseResponse(e);expect(o).toEqual((0,r.CommandResultFactory)({data:{tlvSignature:""}}))}),it("should handle user rejection",()=>{const s=new a.SignNestedCallCommand({chunkedData:n,isFirst:!0}),e={statusCode:new Uint8Array([105,240]),data:new Uint8Array([])},o=s.parseResponse(e);expect((0,r.isSuccessCommandResult)(o)).toBe(!1),(0,r.isSuccessCommandResult)(o)||expect(o.error).toEqual(expect.objectContaining({_tag:"AleoAppCommandError",errorCode:"69f0",message:"Denied by user"}))}),it("should handle device error codes",()=>{const s=new a.SignNestedCallCommand({chunkedData:n,isFirst:!0}),e={statusCode:new Uint8Array([176,8]),data:new Uint8Array([])},o=s.parseResponse(e);expect((0,r.isSuccessCommandResult)(o)).toBe(!1),(0,r.isSuccessCommandResult)(o)||expect(o.error).toEqual(expect.objectContaining({_tag:"AleoAppCommandError",errorCode:"b008",message:"Signature fail"}))})})});
|
|
2
|
+
//# sourceMappingURL=SignNestedCallCommand.test.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/internal/app-binder/command/SignNestedCallCommand.test.ts"],
|
|
4
|
+
"sourcesContent": ["import {\n type Apdu,\n type ApduResponse,\n CommandResultFactory,\n isSuccessCommandResult,\n} from \"@ledgerhq/device-management-kit\";\n\nimport {\n ALEO_CLA,\n INS,\n P1,\n P2,\n} from \"@internal/app-binder/command/utils/apduHeaderUtils\";\n\nimport { SignNestedCallCommand } from \"./SignNestedCallCommand\";\n\ndescribe(\"SignNestedCallCommand\", () => {\n const mockChunkedData = new Uint8Array([0x05, 0x06, 0x07, 0x08]);\n const mockLongChunkedData = new Uint8Array(255).fill(0x24);\n\n describe(\"name\", () => {\n it(\"should be 'signNestedCall'\", () => {\n const command = new SignNestedCallCommand({\n chunkedData: mockChunkedData,\n isFirst: true,\n });\n expect(command.name).toBe(\"signNestedCall\");\n });\n });\n\n describe(\"getApdu\", () => {\n it(\"should create correct APDU for the first chunk\", () => {\n // Given\n const command = new SignNestedCallCommand({\n chunkedData: mockChunkedData,\n isFirst: true,\n });\n\n // When\n const apdu: Apdu = command.getApdu();\n\n // Then\n expect(apdu.cla).toBe(ALEO_CLA);\n expect(apdu.ins).toBe(INS.SIGN_INTENT);\n expect(apdu.p1).toBe(P1.SIGN_MODE_NESTED_CALL);\n expect(apdu.p2).toBe(P2.FIRST_CHUNK);\n\n expect(apdu.data.length).toBe(mockChunkedData.length);\n expect(apdu.data).toEqual(mockChunkedData);\n });\n\n it(\"should create correct APDU for subsequent chunks\", () => {\n // Given\n const command = new SignNestedCallCommand({\n chunkedData: mockChunkedData,\n isFirst: false,\n });\n\n // When\n const apdu: Apdu = command.getApdu();\n\n // Then\n expect(apdu.cla).toBe(ALEO_CLA);\n expect(apdu.ins).toBe(INS.SIGN_INTENT);\n expect(apdu.p1).toBe(P1.SIGN_MODE_NESTED_CALL);\n expect(apdu.p2).toBe(P2.NEXT_CHUNK);\n\n expect(apdu.data.length).toBe(mockChunkedData.length);\n expect(apdu.data).toEqual(mockChunkedData);\n });\n\n it(\"should create correct APDU for a long chunk (255 bytes)\", () => {\n // Given\n const command = new SignNestedCallCommand({\n chunkedData: mockLongChunkedData,\n isFirst: false,\n });\n\n // When\n const apdu: Apdu = command.getApdu();\n\n // Then\n expect(apdu.cla).toBe(ALEO_CLA);\n expect(apdu.ins).toBe(INS.SIGN_INTENT);\n expect(apdu.p1).toBe(P1.SIGN_MODE_NESTED_CALL);\n expect(apdu.p2).toBe(P2.NEXT_CHUNK);\n\n expect(apdu.data.length).toBe(255);\n expect(apdu.data).toEqual(mockLongChunkedData);\n });\n });\n\n describe(\"parseResponse\", () => {\n it(\"should return hexadecimal string for successful response\", () => {\n // Given\n const command = new SignNestedCallCommand({\n chunkedData: mockChunkedData,\n isFirst: true,\n });\n\n const response: ApduResponse = {\n statusCode: new Uint8Array([0x90, 0x00]),\n data: new Uint8Array([0x01, 0x02, 0x03]),\n };\n\n // When\n const result = command.parseResponse(response);\n\n // Then\n expect(result).toEqual(\n CommandResultFactory({\n data: {\n tlvSignature: \"010203\",\n },\n }),\n );\n });\n\n it(\"should return empty signature for successful response without data (intermediate chunks)\", () => {\n // Given\n const command = new SignNestedCallCommand({\n chunkedData: mockChunkedData,\n isFirst: true,\n });\n\n const response: ApduResponse = {\n statusCode: new Uint8Array([0x90, 0x00]),\n data: new Uint8Array([]),\n };\n\n // When\n const result = command.parseResponse(response);\n\n // Then\n expect(result).toEqual(\n CommandResultFactory({\n data: {\n tlvSignature: \"\",\n },\n }),\n );\n });\n\n it(\"should handle user rejection\", () => {\n // Given\n const command = new SignNestedCallCommand({\n chunkedData: mockChunkedData,\n isFirst: true,\n });\n\n const response: ApduResponse = {\n statusCode: new Uint8Array([0x69, 0xf0]),\n data: new Uint8Array([]),\n };\n\n // When\n const result = command.parseResponse(response);\n\n // Then\n expect(isSuccessCommandResult(result)).toBe(false);\n if (!isSuccessCommandResult(result)) {\n expect(result.error).toEqual(\n expect.objectContaining({\n _tag: \"AleoAppCommandError\",\n errorCode: \"69f0\",\n message: \"Denied by user\",\n }),\n );\n }\n });\n\n it(\"should handle device error codes\", () => {\n // Given\n const command = new SignNestedCallCommand({\n chunkedData: mockChunkedData,\n isFirst: true,\n });\n\n // Signature fail (0xb008)\n const response: ApduResponse = {\n statusCode: new Uint8Array([0xb0, 0x08]),\n data: new Uint8Array([]),\n };\n\n // When\n const result = command.parseResponse(response);\n\n // Then\n expect(isSuccessCommandResult(result)).toBe(false);\n if (!isSuccessCommandResult(result)) {\n expect(result.error).toEqual(\n expect.objectContaining({\n _tag: \"AleoAppCommandError\",\n errorCode: \"b008\",\n message: \"Signature fail\",\n }),\n );\n }\n });\n });\n});\n"],
|
|
5
|
+
"mappings": "aAAA,IAAAA,EAKO,2CAEPC,EAKO,8DAEPC,EAAsC,mCAEtC,SAAS,wBAAyB,IAAM,CACtC,MAAMC,EAAkB,IAAI,WAAW,CAAC,EAAM,EAAM,EAAM,CAAI,CAAC,EACzDC,EAAsB,IAAI,WAAW,GAAG,EAAE,KAAK,EAAI,EAEzD,SAAS,OAAQ,IAAM,CACrB,GAAG,6BAA8B,IAAM,CACrC,MAAMC,EAAU,IAAI,wBAAsB,CACxC,YAAaF,EACb,QAAS,EACX,CAAC,EACD,OAAOE,EAAQ,IAAI,EAAE,KAAK,gBAAgB,CAC5C,CAAC,CACH,CAAC,EAED,SAAS,UAAW,IAAM,CACxB,GAAG,iDAAkD,IAAM,CAQzD,MAAMC,EANU,IAAI,wBAAsB,CACxC,YAAaH,EACb,QAAS,EACX,CAAC,EAG0B,QAAQ,EAGnC,OAAOG,EAAK,GAAG,EAAE,KAAK,UAAQ,EAC9B,OAAOA,EAAK,GAAG,EAAE,KAAK,MAAI,WAAW,EACrC,OAAOA,EAAK,EAAE,EAAE,KAAK,KAAG,qBAAqB,EAC7C,OAAOA,EAAK,EAAE,EAAE,KAAK,KAAG,WAAW,EAEnC,OAAOA,EAAK,KAAK,MAAM,EAAE,KAAKH,EAAgB,MAAM,EACpD,OAAOG,EAAK,IAAI,EAAE,QAAQH,CAAe,CAC3C,CAAC,EAED,GAAG,mDAAoD,IAAM,CAQ3D,MAAMG,EANU,IAAI,wBAAsB,CACxC,YAAaH,EACb,QAAS,EACX,CAAC,EAG0B,QAAQ,EAGnC,OAAOG,EAAK,GAAG,EAAE,KAAK,UAAQ,EAC9B,OAAOA,EAAK,GAAG,EAAE,KAAK,MAAI,WAAW,EACrC,OAAOA,EAAK,EAAE,EAAE,KAAK,KAAG,qBAAqB,EAC7C,OAAOA,EAAK,EAAE,EAAE,KAAK,KAAG,UAAU,EAElC,OAAOA,EAAK,KAAK,MAAM,EAAE,KAAKH,EAAgB,MAAM,EACpD,OAAOG,EAAK,IAAI,EAAE,QAAQH,CAAe,CAC3C,CAAC,EAED,GAAG,0DAA2D,IAAM,CAQlE,MAAMG,EANU,IAAI,wBAAsB,CACxC,YAAaF,EACb,QAAS,EACX,CAAC,EAG0B,QAAQ,EAGnC,OAAOE,EAAK,GAAG,EAAE,KAAK,UAAQ,EAC9B,OAAOA,EAAK,GAAG,EAAE,KAAK,MAAI,WAAW,EACrC,OAAOA,EAAK,EAAE,EAAE,KAAK,KAAG,qBAAqB,EAC7C,OAAOA,EAAK,EAAE,EAAE,KAAK,KAAG,UAAU,EAElC,OAAOA,EAAK,KAAK,MAAM,EAAE,KAAK,GAAG,EACjC,OAAOA,EAAK,IAAI,EAAE,QAAQF,CAAmB,CAC/C,CAAC,CACH,CAAC,EAED,SAAS,gBAAiB,IAAM,CAC9B,GAAG,2DAA4D,IAAM,CAEnE,MAAMC,EAAU,IAAI,wBAAsB,CACxC,YAAaF,EACb,QAAS,EACX,CAAC,EAEKI,EAAyB,CAC7B,WAAY,IAAI,WAAW,CAAC,IAAM,CAAI,CAAC,EACvC,KAAM,IAAI,WAAW,CAAC,EAAM,EAAM,CAAI,CAAC,CACzC,EAGMC,EAASH,EAAQ,cAAcE,CAAQ,EAG7C,OAAOC,CAAM,EAAE,WACb,wBAAqB,CACnB,KAAM,CACJ,aAAc,QAChB,CACF,CAAC,CACH,CACF,CAAC,EAED,GAAG,2FAA4F,IAAM,CAEnG,MAAMH,EAAU,IAAI,wBAAsB,CACxC,YAAaF,EACb,QAAS,EACX,CAAC,EAEKI,EAAyB,CAC7B,WAAY,IAAI,WAAW,CAAC,IAAM,CAAI,CAAC,EACvC,KAAM,IAAI,WAAW,CAAC,CAAC,CACzB,EAGMC,EAASH,EAAQ,cAAcE,CAAQ,EAG7C,OAAOC,CAAM,EAAE,WACb,wBAAqB,CACnB,KAAM,CACJ,aAAc,EAChB,CACF,CAAC,CACH,CACF,CAAC,EAED,GAAG,+BAAgC,IAAM,CAEvC,MAAMH,EAAU,IAAI,wBAAsB,CACxC,YAAaF,EACb,QAAS,EACX,CAAC,EAEKI,EAAyB,CAC7B,WAAY,IAAI,WAAW,CAAC,IAAM,GAAI,CAAC,EACvC,KAAM,IAAI,WAAW,CAAC,CAAC,CACzB,EAGMC,EAASH,EAAQ,cAAcE,CAAQ,EAG7C,UAAO,0BAAuBC,CAAM,CAAC,EAAE,KAAK,EAAK,KAC5C,0BAAuBA,CAAM,GAChC,OAAOA,EAAO,KAAK,EAAE,QACnB,OAAO,iBAAiB,CACtB,KAAM,sBACN,UAAW,OACX,QAAS,gBACX,CAAC,CACH,CAEJ,CAAC,EAED,GAAG,mCAAoC,IAAM,CAE3C,MAAMH,EAAU,IAAI,wBAAsB,CACxC,YAAaF,EACb,QAAS,EACX,CAAC,EAGKI,EAAyB,CAC7B,WAAY,IAAI,WAAW,CAAC,IAAM,CAAI,CAAC,EACvC,KAAM,IAAI,WAAW,CAAC,CAAC,CACzB,EAGMC,EAASH,EAAQ,cAAcE,CAAQ,EAG7C,UAAO,0BAAuBC,CAAM,CAAC,EAAE,KAAK,EAAK,KAC5C,0BAAuBA,CAAM,GAChC,OAAOA,EAAO,KAAK,EAAE,QACnB,OAAO,iBAAiB,CACtB,KAAM,sBACN,UAAW,OACX,QAAS,gBACX,CAAC,CACH,CAEJ,CAAC,CACH,CAAC,CACH,CAAC",
|
|
6
|
+
"names": ["import_device_management_kit", "import_apduHeaderUtils", "import_SignNestedCallCommand", "mockChunkedData", "mockLongChunkedData", "command", "apdu", "response", "result"]
|
|
7
|
+
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var T=Object.defineProperty;var s=Object.getOwnPropertyDescriptor;var t=Object.getOwnPropertyNames;var I=Object.prototype.hasOwnProperty;var A=(_,E)=>{for(var x in E)T(_,x,{get:E[x],enumerable:!0})},S=(_,E,x,o)=>{if(E&&typeof E=="object"||typeof E=="function")for(let N of t(E))!I.call(_,N)&&N!==x&&T(_,N,{get:()=>E[N],enumerable:!(o=s(E,N))||o.enumerable});return _};var c=_=>S(T({},"__esModule",{value:!0}),_);var P={};A(P,{ALEO_CLA:()=>n,APDU_SECTION_LENGTH:()=>H,INS:()=>C,P1:()=>G,P2:()=>O,P2_DEFAULT:()=>D});module.exports=c(P);const n=224,D=0,O={FIRST_CHUNK:0,NEXT_CHUNK:1},C={GET_APP_VERSION:3,GET_ADDRESS:5,SIGN_INTENT:6,GET_VIEW_KEY:7},G={SIGN_MODE_ROOT:0,SIGN_MODE_NESTED_CALL:1,SIGN_MODE_FEE:2,CHECK_ON_DEVICE:1,NO_CHECK:0},H={DATA_SIZE:2,DERIVATION_PATH_SEGMENT:4,DERIVATION_PATH_LENGTH:1};0&&(module.exports={ALEO_CLA,APDU_SECTION_LENGTH,INS,P1,P2,P2_DEFAULT});
|
|
2
2
|
//# sourceMappingURL=apduHeaderUtils.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../src/internal/app-binder/command/utils/apduHeaderUtils.ts"],
|
|
4
|
-
"sourcesContent": ["export const ALEO_CLA = 0xe0 as const;\nexport const P2_DEFAULT = 0x00 as const;\n\nexport const P2 = {\n FIRST_CHUNK: 0x00,\n NEXT_CHUNK: 0x01,\n} as const;\n\nexport const INS = {\n GET_APP_VERSION: 0x03,\n GET_ADDRESS: 0x05,\n SIGN_INTENT: 0x06,\n GET_VIEW_KEY: 0x07,\n} as const;\n\nexport const P1 = {\n SIGN_MODE_ROOT: 0x00,\n SIGN_MODE_NESTED_CALL: 0x01,\n SIGN_MODE_FEE: 0x02,\n CHECK_ON_DEVICE: 0x01,\n NO_CHECK: 0x00,\n} as const;\n"],
|
|
5
|
-
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,cAAAE,EAAA,QAAAC,EAAA,OAAAC,EAAA,OAAAC,EAAA,eAAAC,IAAA,eAAAC,
|
|
6
|
-
"names": ["apduHeaderUtils_exports", "__export", "ALEO_CLA", "INS", "P1", "P2", "P2_DEFAULT", "__toCommonJS"]
|
|
4
|
+
"sourcesContent": ["export const ALEO_CLA = 0xe0 as const;\nexport const P2_DEFAULT = 0x00 as const;\n\nexport const P2 = {\n FIRST_CHUNK: 0x00,\n NEXT_CHUNK: 0x01,\n} as const;\n\nexport const INS = {\n GET_APP_VERSION: 0x03,\n GET_ADDRESS: 0x05,\n SIGN_INTENT: 0x06,\n GET_VIEW_KEY: 0x07,\n} as const;\n\nexport const P1 = {\n SIGN_MODE_ROOT: 0x00,\n SIGN_MODE_NESTED_CALL: 0x01,\n SIGN_MODE_FEE: 0x02,\n CHECK_ON_DEVICE: 0x01,\n NO_CHECK: 0x00,\n} as const;\n\nexport const APDU_SECTION_LENGTH = {\n DATA_SIZE: 2, // How many bytes are needed to store APDU data length\n DERIVATION_PATH_SEGMENT: 4,\n DERIVATION_PATH_LENGTH: 1, // Derivation path length is encoded on one byte\n} as const;\n"],
|
|
5
|
+
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,cAAAE,EAAA,wBAAAC,EAAA,QAAAC,EAAA,OAAAC,EAAA,OAAAC,EAAA,eAAAC,IAAA,eAAAC,EAAAR,GAAO,MAAME,EAAW,IACXK,EAAa,EAEbD,EAAK,CAChB,YAAa,EACb,WAAY,CACd,EAEaF,EAAM,CACjB,gBAAiB,EACjB,YAAa,EACb,YAAa,EACb,aAAc,CAChB,EAEaC,EAAK,CAChB,eAAgB,EAChB,sBAAuB,EACvB,cAAe,EACf,gBAAiB,EACjB,SAAU,CACZ,EAEaF,EAAsB,CACjC,UAAW,EACX,wBAAyB,EACzB,uBAAwB,CAC1B",
|
|
6
|
+
"names": ["apduHeaderUtils_exports", "__export", "ALEO_CLA", "APDU_SECTION_LENGTH", "INS", "P1", "P2", "P2_DEFAULT", "__toCommonJS"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var a=Object.defineProperty;var
|
|
1
|
+
"use strict";var a=Object.defineProperty;var g=Object.getOwnPropertyDescriptor;var l=Object.getOwnPropertyNames;var I=Object.prototype.hasOwnProperty;var y=(t,e)=>{for(var n in e)a(t,n,{get:e[n],enumerable:!0})},u=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of l(e))!I.call(t,o)&&o!==n&&a(t,o,{get:()=>e[o],enumerable:!(r=g(e,o))||r.enumerable});return t};var A=t=>u(a({},"__esModule",{value:!0}),t);var c={};y(c,{SignFeeIntentTask:()=>C});module.exports=A(c);var s=require("@ledgerhq/device-management-kit"),m=require("../../app-binder/command/SignFeeIntentCommand"),i=require("../../app-binder/command/utils/apduHeaderUtils"),d=require("./SendAleoCommandInChunksTask");class C{constructor(e,n){this.api=e;this.args=n}async run(){const{feeIntent:e}=this.args,n=i.APDU_SECTION_LENGTH.DATA_SIZE+e.byteLength,r=new s.ByteArrayBuilder(n);r.add16BitUIntToData(e.byteLength),r.addBufferToData(e);const o=r.build();return new d.SendAleoCommandInChunksTask(this.api,{dataLength:e.byteLength,data:o,commandFactory:p=>new m.SignFeeIntentCommand(p)}).run()}}0&&(module.exports={SignFeeIntentTask});
|
|
2
2
|
//# sourceMappingURL=SignFeeIntentTask.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/internal/app-binder/task/SignFeeIntentTask.ts"],
|
|
4
|
-
"sourcesContent": ["import {\n ByteArrayBuilder,\n type CommandResult,\n type InternalApi,\n} from \"@ledgerhq/device-management-kit\";\n\nimport {\n SignFeeIntentCommand,\n type SignFeeIntentCommandResponse,\n} from \"@internal/app-binder/command/SignFeeIntentCommand\";\nimport { type AleoErrorCodes } from \"@internal/app-binder/command/utils/aleoApplicationErrors\";\n\nimport { SendAleoCommandInChunksTask } from \"./SendAleoCommandInChunksTask\";\n\nexport type SignFeeIntentTaskArgs = {\n feeIntent: Uint8Array;\n};\n\nexport class SignFeeIntentTask {\n constructor(\n private api: InternalApi,\n private args: SignFeeIntentTaskArgs,\n ) {}\n\n async run(): Promise<\n CommandResult<SignFeeIntentCommandResponse, AleoErrorCodes>\n > {\n const { feeIntent } = this.args;\n\n // Data length (2 bytes) + Fee intent data\n const totalLength =
|
|
5
|
-
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,uBAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAIO,2CAEPC,EAGO,
|
|
6
|
-
"names": ["SignFeeIntentTask_exports", "__export", "SignFeeIntentTask", "__toCommonJS", "import_device_management_kit", "import_SignFeeIntentCommand", "import_SendAleoCommandInChunksTask", "api", "args", "feeIntent", "totalLength", "builder", "fullPayload", "chunkArgs"]
|
|
4
|
+
"sourcesContent": ["import {\n ByteArrayBuilder,\n type CommandResult,\n type InternalApi,\n} from \"@ledgerhq/device-management-kit\";\n\nimport {\n SignFeeIntentCommand,\n type SignFeeIntentCommandResponse,\n} from \"@internal/app-binder/command/SignFeeIntentCommand\";\nimport { type AleoErrorCodes } from \"@internal/app-binder/command/utils/aleoApplicationErrors\";\nimport { APDU_SECTION_LENGTH } from \"@internal/app-binder/command/utils/apduHeaderUtils\";\n\nimport { SendAleoCommandInChunksTask } from \"./SendAleoCommandInChunksTask\";\n\nexport type SignFeeIntentTaskArgs = {\n feeIntent: Uint8Array;\n};\n\nexport class SignFeeIntentTask {\n constructor(\n private api: InternalApi,\n private args: SignFeeIntentTaskArgs,\n ) {}\n\n async run(): Promise<\n CommandResult<SignFeeIntentCommandResponse, AleoErrorCodes>\n > {\n const { feeIntent } = this.args;\n\n // Data length (2 bytes) + Fee intent data\n const totalLength = APDU_SECTION_LENGTH.DATA_SIZE + feeIntent.byteLength;\n\n const builder = new ByteArrayBuilder(totalLength);\n\n // Add intent length\n builder.add16BitUIntToData(feeIntent.byteLength);\n\n // Add the fee intent data\n builder.addBufferToData(feeIntent);\n\n const fullPayload = builder.build();\n\n return new SendAleoCommandInChunksTask<SignFeeIntentCommandResponse>(\n this.api,\n {\n dataLength: feeIntent.byteLength,\n data: fullPayload,\n commandFactory: (chunkArgs) => new SignFeeIntentCommand(chunkArgs),\n },\n ).run();\n }\n}\n"],
|
|
5
|
+
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,uBAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAIO,2CAEPC,EAGO,6DAEPC,EAAoC,8DAEpCC,EAA4C,yCAMrC,MAAML,CAAkB,CAC7B,YACUM,EACAC,EACR,CAFQ,SAAAD,EACA,UAAAC,CACP,CAEH,MAAM,KAEJ,CACA,KAAM,CAAE,UAAAC,CAAU,EAAI,KAAK,KAGrBC,EAAc,sBAAoB,UAAYD,EAAU,WAExDE,EAAU,IAAI,mBAAiBD,CAAW,EAGhDC,EAAQ,mBAAmBF,EAAU,UAAU,EAG/CE,EAAQ,gBAAgBF,CAAS,EAEjC,MAAMG,EAAcD,EAAQ,MAAM,EAElC,OAAO,IAAI,8BACT,KAAK,IACL,CACE,WAAYF,EAAU,WACtB,KAAMG,EACN,eAAiBC,GAAc,IAAI,uBAAqBA,CAAS,CACnE,CACF,EAAE,IAAI,CACR,CACF",
|
|
6
|
+
"names": ["SignFeeIntentTask_exports", "__export", "SignFeeIntentTask", "__toCommonJS", "import_device_management_kit", "import_SignFeeIntentCommand", "import_apduHeaderUtils", "import_SendAleoCommandInChunksTask", "api", "args", "feeIntent", "totalLength", "builder", "fullPayload", "chunkArgs"]
|
|
7
7
|
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var r=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var C=Object.getOwnPropertyNames;var g=Object.prototype.hasOwnProperty;var y=(t,e)=>{for(var a in e)r(t,a,{get:e[a],enumerable:!0})},u=(t,e,a,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of C(e))!g.call(t,n)&&n!==a&&r(t,n,{get:()=>e[n],enumerable:!(o=p(e,n))||o.enumerable});return t};var A=t=>u(r({},"__esModule",{value:!0}),t);var S={};y(S,{SignNestedCallTask:()=>c});module.exports=A(S);var s=require("@ledgerhq/device-management-kit"),l=require("../../app-binder/command/SignNestedCallCommand"),d=require("../../app-binder/command/utils/apduHeaderUtils"),m=require("./SendAleoCommandInChunksTask");class c{constructor(e,a){this.api=e;this.args=a}async run(){const{nestedCallRequest:e}=this.args,a=d.APDU_SECTION_LENGTH.DATA_SIZE+e.byteLength,o=new s.ByteArrayBuilder(a);o.add16BitUIntToData(e.byteLength),o.addBufferToData(e);const n=o.build();return new m.SendAleoCommandInChunksTask(this.api,{dataLength:e.byteLength,data:n,commandFactory:i=>new l.SignNestedCallCommand(i)}).run()}}0&&(module.exports={SignNestedCallTask});
|
|
2
|
+
//# sourceMappingURL=SignNestedCallTask.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/internal/app-binder/task/SignNestedCallTask.ts"],
|
|
4
|
+
"sourcesContent": ["import {\n ByteArrayBuilder,\n type CommandResult,\n type InternalApi,\n} from \"@ledgerhq/device-management-kit\";\n\nimport {\n SignNestedCallCommand,\n type SignNestedCallCommandResponse,\n} from \"@internal/app-binder/command/SignNestedCallCommand\";\nimport { type AleoErrorCodes } from \"@internal/app-binder/command/utils/aleoApplicationErrors\";\nimport { APDU_SECTION_LENGTH } from \"@internal/app-binder/command/utils/apduHeaderUtils\";\n\nimport { SendAleoCommandInChunksTask } from \"./SendAleoCommandInChunksTask\";\n\nexport type SignNestedCallTaskArgs = {\n nestedCallRequest: Uint8Array;\n};\n\nexport class SignNestedCallTask {\n constructor(\n private readonly api: InternalApi,\n private readonly args: SignNestedCallTaskArgs,\n ) {}\n\n async run(): Promise<\n CommandResult<SignNestedCallCommandResponse, AleoErrorCodes>\n > {\n const { nestedCallRequest } = this.args;\n\n // Data length (2 bytes) + nested call request data\n const totalLength =\n APDU_SECTION_LENGTH.DATA_SIZE + nestedCallRequest.byteLength;\n\n const builder = new ByteArrayBuilder(totalLength);\n\n builder.add16BitUIntToData(nestedCallRequest.byteLength);\n\n builder.addBufferToData(nestedCallRequest);\n\n const fullPayload = builder.build();\n\n return new SendAleoCommandInChunksTask<SignNestedCallCommandResponse>(\n this.api,\n {\n dataLength: nestedCallRequest.byteLength,\n data: fullPayload,\n commandFactory: (chunkArgs) => new SignNestedCallCommand(chunkArgs),\n },\n ).run();\n }\n}\n"],
|
|
5
|
+
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,wBAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAIO,2CAEPC,EAGO,8DAEPC,EAAoC,8DAEpCC,EAA4C,yCAMrC,MAAML,CAAmB,CAC9B,YACmBM,EACAC,EACjB,CAFiB,SAAAD,EACA,UAAAC,CAChB,CAEH,MAAM,KAEJ,CACA,KAAM,CAAE,kBAAAC,CAAkB,EAAI,KAAK,KAG7BC,EACJ,sBAAoB,UAAYD,EAAkB,WAE9CE,EAAU,IAAI,mBAAiBD,CAAW,EAEhDC,EAAQ,mBAAmBF,EAAkB,UAAU,EAEvDE,EAAQ,gBAAgBF,CAAiB,EAEzC,MAAMG,EAAcD,EAAQ,MAAM,EAElC,OAAO,IAAI,8BACT,KAAK,IACL,CACE,WAAYF,EAAkB,WAC9B,KAAMG,EACN,eAAiBC,GAAc,IAAI,wBAAsBA,CAAS,CACpE,CACF,EAAE,IAAI,CACR,CACF",
|
|
6
|
+
"names": ["SignNestedCallTask_exports", "__export", "SignNestedCallTask", "__toCommonJS", "import_device_management_kit", "import_SignNestedCallCommand", "import_apduHeaderUtils", "import_SendAleoCommandInChunksTask", "api", "args", "nestedCallRequest", "totalLength", "builder", "fullPayload", "chunkArgs"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var e=require("@ledgerhq/device-management-kit"),u=require("../../app-binder/task/__test-utils__/makeInternalApi"),o=require("../../app-binder/task/SignNestedCallTask");describe("SignNestedCallTask",()=>{const t=(0,u.makeDeviceActionInternalApiMock)(),c={tlvSignature:"mock_signature"},d=(0,e.CommandResultFactory)({data:c}),m=(0,e.CommandResultFactory)({data:{tlvSignature:""}});beforeEach(()=>{vi.resetAllMocks()}),it("should send the nested call request in a single command",async()=>{const a=new Uint8Array([5,6,7,8]),n=new e.ByteArrayBuilder(2+a.length);n.add16BitUIntToData(a.length),n.addBufferToData(a);const s=n.build();t.sendCommand.mockResolvedValueOnce(d);const l=await new o.SignNestedCallTask(t,{nestedCallRequest:a}).run();expect(t.sendCommand).toHaveBeenCalledTimes(1),expect(t.sendCommand).toHaveBeenCalledWith(expect.objectContaining({args:{chunkedData:s,isFirst:!0}})),(0,e.isSuccessCommandResult)(l)?expect(l.data).toEqual(c):assert.fail("Expected success")}),it("should send the nested call request in multiple chunks",async()=>{const a=new Uint8Array(300).fill(36),n=new e.ByteArrayBuilder(2+a.length);n.add16BitUIntToData(a.length),n.addBufferToData(a);const s=n.build(),i=s.slice(0,e.APDU_MAX_PAYLOAD),l=s.slice(e.APDU_MAX_PAYLOAD);t.sendCommand.mockResolvedValueOnce(m).mockResolvedValueOnce(d);const r=await new o.SignNestedCallTask(t,{nestedCallRequest:a}).run();expect(t.sendCommand).toHaveBeenCalledTimes(2),expect(t.sendCommand).toHaveBeenNthCalledWith(1,expect.objectContaining({args:{chunkedData:i,isFirst:!0}})),expect(t.sendCommand).toHaveBeenNthCalledWith(2,expect.objectContaining({args:{chunkedData:l,isFirst:!1}})),(0,e.isSuccessCommandResult)(r)?expect(r.data).toEqual(c):assert.fail("Expected success")})});
|
|
2
|
+
//# sourceMappingURL=SignNestedCallTask.test.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/internal/app-binder/task/SignNestedCallTask.test.ts"],
|
|
4
|
+
"sourcesContent": ["import {\n APDU_MAX_PAYLOAD,\n ByteArrayBuilder,\n CommandResultFactory,\n isSuccessCommandResult,\n} from \"@ledgerhq/device-management-kit\";\n\nimport { makeDeviceActionInternalApiMock } from \"@internal/app-binder/task/__test-utils__/makeInternalApi\";\nimport { SignNestedCallTask } from \"@internal/app-binder/task/SignNestedCallTask\";\n\ndescribe(\"SignNestedCallTask\", () => {\n const apiMock = makeDeviceActionInternalApiMock();\n const signature = { tlvSignature: \"mock_signature\" };\n const resultOk = CommandResultFactory({ data: signature });\n const resultEmpty = CommandResultFactory({ data: { tlvSignature: \"\" } });\n\n beforeEach(() => {\n vi.resetAllMocks();\n });\n\n it(\"should send the nested call request in a single command\", async () => {\n // GIVEN\n const nestedCallRequest = new Uint8Array([0x05, 0x06, 0x07, 0x08]);\n\n const builder = new ByteArrayBuilder(2 + nestedCallRequest.length);\n builder.add16BitUIntToData(nestedCallRequest.length);\n builder.addBufferToData(nestedCallRequest);\n const expectedPayload = builder.build();\n\n apiMock.sendCommand.mockResolvedValueOnce(resultOk);\n\n const task = new SignNestedCallTask(apiMock, {\n nestedCallRequest,\n });\n\n // WHEN\n const result = await task.run();\n\n // THEN\n expect(apiMock.sendCommand).toHaveBeenCalledTimes(1);\n expect(apiMock.sendCommand).toHaveBeenCalledWith(\n expect.objectContaining({\n args: {\n chunkedData: expectedPayload,\n isFirst: true,\n },\n }),\n );\n\n if (isSuccessCommandResult(result)) {\n expect(result.data).toEqual(signature);\n } else {\n assert.fail(\"Expected success\");\n }\n });\n\n it(\"should send the nested call request in multiple chunks\", async () => {\n // GIVEN\n const nestedCallRequest = new Uint8Array(300).fill(0x24);\n\n const builder = new ByteArrayBuilder(2 + nestedCallRequest.length);\n builder.add16BitUIntToData(nestedCallRequest.length);\n builder.addBufferToData(nestedCallRequest);\n const fullPayload = builder.build();\n\n const chunk1 = fullPayload.slice(0, APDU_MAX_PAYLOAD);\n const chunk2 = fullPayload.slice(APDU_MAX_PAYLOAD);\n\n apiMock.sendCommand\n .mockResolvedValueOnce(resultEmpty)\n .mockResolvedValueOnce(resultOk);\n\n const task = new SignNestedCallTask(apiMock, {\n nestedCallRequest,\n });\n\n // WHEN\n const result = await task.run();\n\n // THEN\n expect(apiMock.sendCommand).toHaveBeenCalledTimes(2);\n\n expect(apiMock.sendCommand).toHaveBeenNthCalledWith(\n 1,\n expect.objectContaining({\n args: {\n chunkedData: chunk1,\n isFirst: true,\n },\n }),\n );\n\n expect(apiMock.sendCommand).toHaveBeenNthCalledWith(\n 2,\n expect.objectContaining({\n args: {\n chunkedData: chunk2,\n isFirst: false,\n },\n }),\n );\n\n if (isSuccessCommandResult(result)) {\n expect(result.data).toEqual(signature);\n } else {\n assert.fail(\"Expected success\");\n }\n });\n});\n"],
|
|
5
|
+
"mappings": "aAAA,IAAAA,EAKO,2CAEPC,EAAgD,oEAChDC,EAAmC,wDAEnC,SAAS,qBAAsB,IAAM,CACnC,MAAMC,KAAU,mCAAgC,EAC1CC,EAAY,CAAE,aAAc,gBAAiB,EAC7CC,KAAW,wBAAqB,CAAE,KAAMD,CAAU,CAAC,EACnDE,KAAc,wBAAqB,CAAE,KAAM,CAAE,aAAc,EAAG,CAAE,CAAC,EAEvE,WAAW,IAAM,CACf,GAAG,cAAc,CACnB,CAAC,EAED,GAAG,0DAA2D,SAAY,CAExE,MAAMC,EAAoB,IAAI,WAAW,CAAC,EAAM,EAAM,EAAM,CAAI,CAAC,EAE3DC,EAAU,IAAI,mBAAiB,EAAID,EAAkB,MAAM,EACjEC,EAAQ,mBAAmBD,EAAkB,MAAM,EACnDC,EAAQ,gBAAgBD,CAAiB,EACzC,MAAME,EAAkBD,EAAQ,MAAM,EAEtCL,EAAQ,YAAY,sBAAsBE,CAAQ,EAOlD,MAAMK,EAAS,MALF,IAAI,qBAAmBP,EAAS,CAC3C,kBAAAI,CACF,CAAC,EAGyB,IAAI,EAG9B,OAAOJ,EAAQ,WAAW,EAAE,sBAAsB,CAAC,EACnD,OAAOA,EAAQ,WAAW,EAAE,qBAC1B,OAAO,iBAAiB,CACtB,KAAM,CACJ,YAAaM,EACb,QAAS,EACX,CACF,CAAC,CACH,KAEI,0BAAuBC,CAAM,EAC/B,OAAOA,EAAO,IAAI,EAAE,QAAQN,CAAS,EAErC,OAAO,KAAK,kBAAkB,CAElC,CAAC,EAED,GAAG,yDAA0D,SAAY,CAEvE,MAAMG,EAAoB,IAAI,WAAW,GAAG,EAAE,KAAK,EAAI,EAEjDC,EAAU,IAAI,mBAAiB,EAAID,EAAkB,MAAM,EACjEC,EAAQ,mBAAmBD,EAAkB,MAAM,EACnDC,EAAQ,gBAAgBD,CAAiB,EACzC,MAAMI,EAAcH,EAAQ,MAAM,EAE5BI,EAASD,EAAY,MAAM,EAAG,kBAAgB,EAC9CE,EAASF,EAAY,MAAM,kBAAgB,EAEjDR,EAAQ,YACL,sBAAsBG,CAAW,EACjC,sBAAsBD,CAAQ,EAOjC,MAAMK,EAAS,MALF,IAAI,qBAAmBP,EAAS,CAC3C,kBAAAI,CACF,CAAC,EAGyB,IAAI,EAG9B,OAAOJ,EAAQ,WAAW,EAAE,sBAAsB,CAAC,EAEnD,OAAOA,EAAQ,WAAW,EAAE,wBAC1B,EACA,OAAO,iBAAiB,CACtB,KAAM,CACJ,YAAaS,EACb,QAAS,EACX,CACF,CAAC,CACH,EAEA,OAAOT,EAAQ,WAAW,EAAE,wBAC1B,EACA,OAAO,iBAAiB,CACtB,KAAM,CACJ,YAAaU,EACb,QAAS,EACX,CACF,CAAC,CACH,KAEI,0BAAuBH,CAAM,EAC/B,OAAOA,EAAO,IAAI,EAAE,QAAQN,CAAS,EAErC,OAAO,KAAK,kBAAkB,CAElC,CAAC,CACH,CAAC",
|
|
6
|
+
"names": ["import_device_management_kit", "import_makeInternalApi", "import_SignNestedCallTask", "apiMock", "signature", "resultOk", "resultEmpty", "nestedCallRequest", "builder", "expectedPayload", "result", "fullPayload", "chunk1", "chunk2"]
|
|
7
|
+
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var m=Object.defineProperty;var T=Object.getOwnPropertyDescriptor;var h=Object.getOwnPropertyNames;var A=Object.prototype.hasOwnProperty;var y=(o,t)=>{for(var n in t)m(o,n,{get:t[n],enumerable:!0})},R=(o,t,n,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let e of h(t))!A.call(o,e)&&e!==n&&m(o,e,{get:()=>t[e],enumerable:!(a=T(t,e))||a.enumerable});return o};var c=o=>R(m({},"__esModule",{value:!0}),o);var C={};y(C,{SignRootIntentTask:()=>u});module.exports=c(C);var d=require("@ledgerhq/device-management-kit"),p=require("@ledgerhq/signer-utils"),I=require("../../app-binder/command/SignRootIntentCommand"),i=require("../../app-binder/command/utils/apduHeaderUtils"),g=require("./SendAleoCommandInChunksTask");class u{constructor(t,n){this.api=t;this.args=n}async run(){const{derivationPath:t,rootIntent:n}=this.args,a=p.DerivationPathUtils.splitPath(t),e=i.APDU_SECTION_LENGTH.DERIVATION_PATH_LENGTH+a.length*i.APDU_SECTION_LENGTH.DERIVATION_PATH_SEGMENT+i.APDU_SECTION_LENGTH.DATA_SIZE+n.byteLength,r=new d.ByteArrayBuilder(e);r.add8BitUIntToData(a.length),a.forEach(s=>{r.add32BitUIntToData(s)}),r.add16BitUIntToData(n.byteLength),r.addBufferToData(n);const l=r.build();return new g.SendAleoCommandInChunksTask(this.api,{dataLength:n.byteLength,data:l,commandFactory:s=>new I.SignRootIntentCommand(s)}).run()}}0&&(module.exports={SignRootIntentTask});
|
|
2
2
|
//# sourceMappingURL=SignRootIntentTask.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/internal/app-binder/task/SignRootIntentTask.ts"],
|
|
4
|
-
"sourcesContent": ["import {\n ByteArrayBuilder,\n type CommandResult,\n type InternalApi,\n} from \"@ledgerhq/device-management-kit\";\nimport { DerivationPathUtils } from \"@ledgerhq/signer-utils\";\n\nimport {\n SignRootIntentCommand,\n type SignRootIntentCommandResponse,\n} from \"@internal/app-binder/command/SignRootIntentCommand\";\nimport { type AleoErrorCodes } from \"@internal/app-binder/command/utils/aleoApplicationErrors\";\n\nimport { SendAleoCommandInChunksTask } from \"./SendAleoCommandInChunksTask\";\n\nexport type SignRootIntentTaskArgs = {\n derivationPath: string;\n rootIntent: Uint8Array;\n};\n\nexport class SignRootIntentTask {\n constructor(\n private api: InternalApi,\n private args: SignRootIntentTaskArgs,\n ) {}\n\n async run(): Promise<\n CommandResult<SignRootIntentCommandResponse, AleoErrorCodes>\n > {\n const { derivationPath, rootIntent } = this.args;\n\n const path = DerivationPathUtils.splitPath(derivationPath);\n // Path length (1 byte) + Path (4 bytes per element) + Data length (2 bytes) + Root intent data\n const totalLength
|
|
5
|
-
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,wBAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAIO,2CACPC,EAAoC,kCAEpCC,EAGO,
|
|
6
|
-
"names": ["SignRootIntentTask_exports", "__export", "SignRootIntentTask", "__toCommonJS", "import_device_management_kit", "import_signer_utils", "import_SignRootIntentCommand", "import_SendAleoCommandInChunksTask", "api", "args", "derivationPath", "rootIntent", "path", "totalLength", "builder", "element", "fullPayload", "chunkArgs"]
|
|
4
|
+
"sourcesContent": ["import {\n ByteArrayBuilder,\n type CommandResult,\n type InternalApi,\n} from \"@ledgerhq/device-management-kit\";\nimport { DerivationPathUtils } from \"@ledgerhq/signer-utils\";\n\nimport {\n SignRootIntentCommand,\n type SignRootIntentCommandResponse,\n} from \"@internal/app-binder/command/SignRootIntentCommand\";\nimport { type AleoErrorCodes } from \"@internal/app-binder/command/utils/aleoApplicationErrors\";\nimport { APDU_SECTION_LENGTH } from \"@internal/app-binder/command/utils/apduHeaderUtils\";\n\nimport { SendAleoCommandInChunksTask } from \"./SendAleoCommandInChunksTask\";\n\nexport type SignRootIntentTaskArgs = {\n derivationPath: string;\n rootIntent: Uint8Array;\n};\n\nexport class SignRootIntentTask {\n constructor(\n private api: InternalApi,\n private args: SignRootIntentTaskArgs,\n ) {}\n\n async run(): Promise<\n CommandResult<SignRootIntentCommandResponse, AleoErrorCodes>\n > {\n const { derivationPath, rootIntent } = this.args;\n\n const path = DerivationPathUtils.splitPath(derivationPath);\n // Path length (1 byte) + Path (4 bytes per element) + Data length (2 bytes) + Root intent data\n const totalLength =\n APDU_SECTION_LENGTH.DERIVATION_PATH_LENGTH +\n path.length * APDU_SECTION_LENGTH.DERIVATION_PATH_SEGMENT +\n APDU_SECTION_LENGTH.DATA_SIZE +\n rootIntent.byteLength;\n\n const builder = new ByteArrayBuilder(totalLength);\n\n // Add the derivation path\n builder.add8BitUIntToData(path.length);\n path.forEach((element) => {\n builder.add32BitUIntToData(element);\n });\n\n // Add intent length\n builder.add16BitUIntToData(rootIntent.byteLength);\n\n // Add the root intent data\n builder.addBufferToData(rootIntent);\n\n const fullPayload = builder.build();\n\n return new SendAleoCommandInChunksTask<SignRootIntentCommandResponse>(\n this.api,\n {\n dataLength: rootIntent.byteLength,\n data: fullPayload,\n commandFactory: (chunkArgs) => new SignRootIntentCommand(chunkArgs),\n },\n ).run();\n }\n}\n"],
|
|
5
|
+
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,wBAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAIO,2CACPC,EAAoC,kCAEpCC,EAGO,8DAEPC,EAAoC,8DAEpCC,EAA4C,yCAOrC,MAAMN,CAAmB,CAC9B,YACUO,EACAC,EACR,CAFQ,SAAAD,EACA,UAAAC,CACP,CAEH,MAAM,KAEJ,CACA,KAAM,CAAE,eAAAC,EAAgB,WAAAC,CAAW,EAAI,KAAK,KAEtCC,EAAO,sBAAoB,UAAUF,CAAc,EAEnDG,EACJ,sBAAoB,uBACpBD,EAAK,OAAS,sBAAoB,wBAClC,sBAAoB,UACpBD,EAAW,WAEPG,EAAU,IAAI,mBAAiBD,CAAW,EAGhDC,EAAQ,kBAAkBF,EAAK,MAAM,EACrCA,EAAK,QAASG,GAAY,CACxBD,EAAQ,mBAAmBC,CAAO,CACpC,CAAC,EAGDD,EAAQ,mBAAmBH,EAAW,UAAU,EAGhDG,EAAQ,gBAAgBH,CAAU,EAElC,MAAMK,EAAcF,EAAQ,MAAM,EAElC,OAAO,IAAI,8BACT,KAAK,IACL,CACE,WAAYH,EAAW,WACvB,KAAMK,EACN,eAAiBC,GAAc,IAAI,wBAAsBA,CAAS,CACpE,CACF,EAAE,IAAI,CACR,CACF",
|
|
6
|
+
"names": ["SignRootIntentTask_exports", "__export", "SignRootIntentTask", "__toCommonJS", "import_device_management_kit", "import_signer_utils", "import_SignRootIntentCommand", "import_apduHeaderUtils", "import_SendAleoCommandInChunksTask", "api", "args", "derivationPath", "rootIntent", "path", "totalLength", "builder", "element", "fullPayload", "chunkArgs"]
|
|
7
7
|
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var o=Object.defineProperty;var d=Object.getOwnPropertyDescriptor;var l=Object.getOwnPropertyNames;var y=Object.prototype.hasOwnProperty;var f=(r,p)=>{for(var n in p)o(r,n,{get:p[n],enumerable:!0})},u=(r,p,n,e)=>{if(p&&typeof p=="object"||typeof p=="function")for(let i of l(p))!y.call(r,i)&&i!==n&&o(r,i,{get:()=>p[i],enumerable:!(e=d(p,i))||e.enumerable});return r};var T=r=>u(o({},"__esModule",{value:!0}),r),c=(r,p,n,e)=>{for(var i=e>1?void 0:e?d(p,n):p,a=r.length-1,m;a>=0;a--)(m=r[a])&&(i=(e?m(p,n,i):m(i))||i);return e&&i&&o(p,n,i),i},s=(r,p)=>(n,e)=>p(n,e,r);var O={};f(O,{SignNestedCallUseCase:()=>t});module.exports=T(O);var A=require("inversify"),B=require("../../app-binder/di/appBinderTypes");let t=class{_appBinder;constructor(p){this._appBinder=p}execute(p,n){return this._appBinder.signNestedCall({nestedCallRequest:p,skipOpenApp:n?.skipOpenApp??!1})}};t=c([(0,A.injectable)(),s(0,(0,A.inject)(B.appBinderTypes.AppBinding))],t);0&&(module.exports={SignNestedCallUseCase});
|
|
2
|
+
//# sourceMappingURL=SignNestedCallUseCase.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/internal/use-cases/transaction/SignNestedCallUseCase.ts"],
|
|
4
|
+
"sourcesContent": ["import { inject, injectable } from \"inversify\";\n\nimport { type SignNestedCallDAReturnType } from \"@api/app-binder/SignNestedCallDeviceActionTypes\";\nimport { type TransactionOptions } from \"@api/model/TransactionOptions\";\nimport { AleoAppBinder } from \"@internal/app-binder/AleoAppBinder\";\nimport { appBinderTypes } from \"@internal/app-binder/di/appBinderTypes\";\n\n@injectable()\nexport class SignNestedCallUseCase {\n private readonly _appBinder: AleoAppBinder;\n\n constructor(@inject(appBinderTypes.AppBinding) appBinder: AleoAppBinder) {\n this._appBinder = appBinder;\n }\n\n execute(\n nestedCallRequest: Uint8Array,\n options?: TransactionOptions,\n ): SignNestedCallDAReturnType {\n return this._appBinder.signNestedCall({\n nestedCallRequest,\n skipOpenApp: options?.skipOpenApp ?? false,\n });\n }\n}\n"],
|
|
5
|
+
"mappings": "okBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,2BAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAmC,qBAKnCC,EAA+B,kDAGxB,IAAMC,EAAN,KAA4B,CAChB,WAEjB,YAA+CC,EAA0B,CACvE,KAAK,WAAaA,CACpB,CAEA,QACEC,EACAC,EAC4B,CAC5B,OAAO,KAAK,WAAW,eAAe,CACpC,kBAAAD,EACA,YAAaC,GAAS,aAAe,EACvC,CAAC,CACH,CACF,EAhBaH,EAANI,EAAA,IADN,cAAW,EAIGC,EAAA,eAAO,iBAAe,UAAU,IAHlCL",
|
|
6
|
+
"names": ["SignNestedCallUseCase_exports", "__export", "SignNestedCallUseCase", "__toCommonJS", "import_inversify", "import_appBinderTypes", "SignNestedCallUseCase", "appBinder", "nestedCallRequest", "options", "__decorateClass", "__decorateParam"]
|
|
7
|
+
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var r=Object.defineProperty;var
|
|
1
|
+
"use strict";var r=Object.defineProperty;var g=Object.getOwnPropertyDescriptor;var l=Object.getOwnPropertyNames;var S=Object.prototype.hasOwnProperty;var U=(e,t)=>{for(var n in t)r(e,n,{get:t[n],enumerable:!0})},f=(e,t,n,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of l(t))!S.call(e,o)&&o!==n&&r(e,o,{get:()=>t[o],enumerable:!(a=g(t,o))||a.enumerable});return e};var c=e=>f(r({},"__esModule",{value:!0}),e);var F={};U(F,{transactionModuleFactory:()=>I});module.exports=c(F);var i=require("inversify"),s=require("../../../use-cases/transaction/di/transactionTypes"),m=require("../../../use-cases/transaction/SignFeeIntentUseCase"),C=require("../../../use-cases/transaction/SignNestedCallUseCase"),p=require("../../../use-cases/transaction/SignRootIntentUseCase");const I=()=>new i.ContainerModule(({bind:e})=>{e(s.transactionTypes.SignRootIntentUseCase).to(p.SignRootIntentUseCase),e(s.transactionTypes.SignNestedCallUseCase).to(C.SignNestedCallUseCase),e(s.transactionTypes.SignFeeIntentUseCase).to(m.SignFeeIntentUseCase)});0&&(module.exports={transactionModuleFactory});
|
|
2
2
|
//# sourceMappingURL=transactionModule.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../src/internal/use-cases/transaction/di/transactionModule.ts"],
|
|
4
|
-
"sourcesContent": ["import { ContainerModule } from \"inversify\";\n\nimport { transactionTypes } from \"@internal/use-cases/transaction/di/transactionTypes\";\nimport { SignFeeIntentUseCase } from \"@internal/use-cases/transaction/SignFeeIntentUseCase\";\nimport { SignRootIntentUseCase } from \"@internal/use-cases/transaction/SignRootIntentUseCase\";\n\nexport const transactionModuleFactory = () =>\n new ContainerModule(({ bind }) => {\n bind(transactionTypes.SignRootIntentUseCase).to(SignRootIntentUseCase);\n bind(transactionTypes.SignFeeIntentUseCase).to(SignFeeIntentUseCase);\n });\n"],
|
|
5
|
-
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,8BAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAgC,qBAEhCC,EAAiC,+DACjCC,EAAqC,gEACrCC,EAAsC,iEAE/B,
|
|
6
|
-
"names": ["transactionModule_exports", "__export", "transactionModuleFactory", "__toCommonJS", "import_inversify", "import_transactionTypes", "import_SignFeeIntentUseCase", "import_SignRootIntentUseCase", "bind"]
|
|
4
|
+
"sourcesContent": ["import { ContainerModule } from \"inversify\";\n\nimport { transactionTypes } from \"@internal/use-cases/transaction/di/transactionTypes\";\nimport { SignFeeIntentUseCase } from \"@internal/use-cases/transaction/SignFeeIntentUseCase\";\nimport { SignNestedCallUseCase } from \"@internal/use-cases/transaction/SignNestedCallUseCase\";\nimport { SignRootIntentUseCase } from \"@internal/use-cases/transaction/SignRootIntentUseCase\";\n\nexport const transactionModuleFactory = () =>\n new ContainerModule(({ bind }) => {\n bind(transactionTypes.SignRootIntentUseCase).to(SignRootIntentUseCase);\n bind(transactionTypes.SignNestedCallUseCase).to(SignNestedCallUseCase);\n bind(transactionTypes.SignFeeIntentUseCase).to(SignFeeIntentUseCase);\n });\n"],
|
|
5
|
+
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,8BAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAgC,qBAEhCC,EAAiC,+DACjCC,EAAqC,gEACrCC,EAAsC,iEACtCC,EAAsC,iEAE/B,MAAMN,EAA2B,IACtC,IAAI,kBAAgB,CAAC,CAAE,KAAAO,CAAK,IAAM,CAChCA,EAAK,mBAAiB,qBAAqB,EAAE,GAAG,uBAAqB,EACrEA,EAAK,mBAAiB,qBAAqB,EAAE,GAAG,uBAAqB,EACrEA,EAAK,mBAAiB,oBAAoB,EAAE,GAAG,sBAAoB,CACrE,CAAC",
|
|
6
|
+
"names": ["transactionModule_exports", "__export", "transactionModuleFactory", "__toCommonJS", "import_inversify", "import_transactionTypes", "import_SignFeeIntentUseCase", "import_SignNestedCallUseCase", "import_SignRootIntentUseCase", "bind"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var o=Object.defineProperty;var S=Object.getOwnPropertyDescriptor;var
|
|
1
|
+
"use strict";var o=Object.defineProperty;var S=Object.getOwnPropertyDescriptor;var C=Object.getOwnPropertyNames;var i=Object.prototype.hasOwnProperty;var l=(s,e)=>{for(var t in e)o(s,t,{get:e[t],enumerable:!0})},g=(s,e,t,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of C(e))!i.call(s,n)&&n!==t&&o(s,n,{get:()=>e[n],enumerable:!(a=S(e,n))||a.enumerable});return s};var U=s=>g(o({},"__esModule",{value:!0}),s);var y={};l(y,{transactionTypes:()=>r});module.exports=U(y);const r={SignRootIntentUseCase:Symbol.for("SignRootIntentUseCase"),SignNestedCallUseCase:Symbol.for("SignNestedCallUseCase"),SignFeeIntentUseCase:Symbol.for("SignFeeIntentUseCase")};0&&(module.exports={transactionTypes});
|
|
2
2
|
//# sourceMappingURL=transactionTypes.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../src/internal/use-cases/transaction/di/transactionTypes.ts"],
|
|
4
|
-
"sourcesContent": ["export const transactionTypes = {\n SignRootIntentUseCase: Symbol.for(\"SignRootIntentUseCase\"),\n SignFeeIntentUseCase: Symbol.for(\"SignFeeIntentUseCase\"),\n} as const;\n"],
|
|
5
|
-
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,sBAAAE,IAAA,eAAAC,EAAAH,GAAO,MAAME,EAAmB,CAC9B,sBAAuB,OAAO,IAAI,uBAAuB,EACzD,qBAAsB,OAAO,IAAI,sBAAsB,CACzD",
|
|
4
|
+
"sourcesContent": ["export const transactionTypes = {\n SignRootIntentUseCase: Symbol.for(\"SignRootIntentUseCase\"),\n SignNestedCallUseCase: Symbol.for(\"SignNestedCallUseCase\"),\n SignFeeIntentUseCase: Symbol.for(\"SignFeeIntentUseCase\"),\n} as const;\n"],
|
|
5
|
+
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,sBAAAE,IAAA,eAAAC,EAAAH,GAAO,MAAME,EAAmB,CAC9B,sBAAuB,OAAO,IAAI,uBAAuB,EACzD,sBAAuB,OAAO,IAAI,uBAAuB,EACzD,qBAAsB,OAAO,IAAI,sBAAsB,CACzD",
|
|
6
6
|
"names": ["transactionTypes_exports", "__export", "transactionTypes", "__toCommonJS"]
|
|
7
7
|
}
|
package/lib/cjs/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"dependencies": {
|
|
3
3
|
"@ledgerhq/context-module": "workspace:^",
|
|
4
|
-
"@ledgerhq/signer-utils": "
|
|
4
|
+
"@ledgerhq/signer-utils": "^1.2.0",
|
|
5
5
|
"inversify": "catalog:",
|
|
6
6
|
"purify-ts": "catalog:",
|
|
7
7
|
"reflect-metadata": "catalog:",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"name": "@ledgerhq/device-signer-kit-aleo",
|
|
38
38
|
"peerDependencies": {
|
|
39
39
|
"@ledgerhq/context-module": "workspace:^",
|
|
40
|
-
"@ledgerhq/device-management-kit": "
|
|
40
|
+
"@ledgerhq/device-management-kit": "workspace:^"
|
|
41
41
|
},
|
|
42
42
|
"private": false,
|
|
43
43
|
"repository": {
|
|
@@ -59,5 +59,5 @@
|
|
|
59
59
|
"watch:builds": "pnpm ldmk-tool watch --entryPoints src/index.ts,src/**/*.ts --tsconfig tsconfig.prod.json",
|
|
60
60
|
"watch:types": "concurrently \"tsc --watch -p tsconfig.prod.json\" \"tsc-alias --watch -p tsconfig.prod.json\""
|
|
61
61
|
},
|
|
62
|
-
"version": "0.
|
|
62
|
+
"version": "0.3.0"
|
|
63
63
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=SignNestedCallDeviceActionTypes.js.map
|
package/lib/esm/api/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/api/index.ts"],
|
|
4
|
-
"sourcesContent": ["export type {\n GetAddressDAError,\n GetAddressDAIntermediateValue,\n GetAddressDAOutput,\n} from \"@api/app-binder/GetAddressDeviceActionTypes\";\nexport type {\n GetAppConfigDAError,\n GetAppConfigDAIntermediateValue,\n GetAppConfigDAOutput,\n} from \"@api/app-binder/GetAppConfigDeviceActionTypes\";\nexport type {\n GetViewKeyDAError,\n GetViewKeyDAIntermediateValue,\n GetViewKeyDAOutput,\n} from \"@api/app-binder/GetViewKeyDeviceActionTypes\";\nexport type {\n SignFeeIntentDAError,\n SignFeeIntentDAIntermediateValue,\n SignFeeIntentDAOutput,\n} from \"@api/app-binder/SignFeeIntentDeviceActionTypes\";\nexport type {\n SignRootIntentDAError,\n SignRootIntentDAIntermediateValue,\n SignRootIntentDAOutput,\n} from \"@api/app-binder/SignRootIntentDeviceActionTypes\";\nexport * from \"@api/SignerAleo\";\nexport * from \"@api/SignerAleoBuilder\";\n// Export other types as needed\n"],
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["export type {\n GetAddressDAError,\n GetAddressDAIntermediateValue,\n GetAddressDAOutput,\n} from \"@api/app-binder/GetAddressDeviceActionTypes\";\nexport type {\n GetAppConfigDAError,\n GetAppConfigDAIntermediateValue,\n GetAppConfigDAOutput,\n} from \"@api/app-binder/GetAppConfigDeviceActionTypes\";\nexport type {\n GetViewKeyDAError,\n GetViewKeyDAIntermediateValue,\n GetViewKeyDAOutput,\n} from \"@api/app-binder/GetViewKeyDeviceActionTypes\";\nexport type {\n SignFeeIntentDAError,\n SignFeeIntentDAIntermediateValue,\n SignFeeIntentDAOutput,\n} from \"@api/app-binder/SignFeeIntentDeviceActionTypes\";\nexport type {\n SignNestedCallDAError,\n SignNestedCallDAIntermediateValue,\n SignNestedCallDAOutput,\n} from \"@api/app-binder/SignNestedCallDeviceActionTypes\";\nexport type {\n SignRootIntentDAError,\n SignRootIntentDAIntermediateValue,\n SignRootIntentDAOutput,\n} from \"@api/app-binder/SignRootIntentDeviceActionTypes\";\nexport * from \"@api/SignerAleo\";\nexport * from \"@api/SignerAleoBuilder\";\n// Export other types as needed\n"],
|
|
5
|
+
"mappings": "AA8BA,WAAc,kBACd,WAAc",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{makeContainer as i}from"./di";import{addressTypes as
|
|
1
|
+
import{makeContainer as i}from"./di";import{addressTypes as r}from"./use-cases/address/di/addressTypes";import{configTypes as o}from"./use-cases/config/di/configTypes";import{transactionTypes as n}from"./use-cases/transaction/di/transactionTypes";class A{_container;constructor({dmk:e,sessionId:t}){this._container=i({dmk:e,sessionId:t})}getAppConfig(){return this._container.get(o.GetAppConfigUseCase).execute()}getAddress(e,t){return this._container.get(r.GetAddressUseCase).execute(e,t)}getViewKey(e,t){return this._container.get(r.GetViewKeyUseCase).execute(e,t)}signRootIntent(e,t,s){return this._container.get(n.SignRootIntentUseCase).execute(e,t,s)}signNestedCall(e,t){return this._container.get(n.SignNestedCallUseCase).execute(e,t)}signFeeIntent(e,t){return this._container.get(n.SignFeeIntentUseCase).execute(e,t)}}export{A as DefaultSignerAleo};
|
|
2
2
|
//# sourceMappingURL=DefaultSignerAleo.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/internal/DefaultSignerAleo.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 GetAppConfigDAReturnType } from \"@api/app-binder/GetAppConfigDeviceActionTypes\";\nimport { type GetViewKeyDAReturnType } from \"@api/app-binder/GetViewKeyDeviceActionTypes\";\nimport { type SignFeeIntentDAReturnType } from \"@api/app-binder/SignFeeIntentDeviceActionTypes\";\nimport { type SignRootIntentDAReturnType } from \"@api/app-binder/SignRootIntentDeviceActionTypes\";\nimport { type AddressOptions } from \"@api/model/AddressOptions\";\nimport { type TransactionOptions } from \"@api/model/TransactionOptions\";\nimport { type SignerAleo } from \"@api/SignerAleo\";\nimport { makeContainer } from \"@internal/di\";\nimport { addressTypes } from \"@internal/use-cases/address/di/addressTypes\";\nimport { type GetAddressUseCase } from \"@internal/use-cases/address/GetAddressUseCase\";\nimport { type GetViewKeyUseCase } from \"@internal/use-cases/address/GetViewKeyUseCase\";\nimport { configTypes } from \"@internal/use-cases/config/di/configTypes\";\nimport { type GetAppConfigUseCase } from \"@internal/use-cases/config/GetAppConfigUseCase\";\nimport { transactionTypes } from \"@internal/use-cases/transaction/di/transactionTypes\";\nimport { type SignFeeIntentUseCase } from \"@internal/use-cases/transaction/SignFeeIntentUseCase\";\nimport { type SignRootIntentUseCase } from \"@internal/use-cases/transaction/SignRootIntentUseCase\";\n\ntype DefaultSignerAleoConstructorArgs = {\n dmk: DeviceManagementKit;\n sessionId: DeviceSessionId;\n};\n\nexport class DefaultSignerAleo implements SignerAleo {\n private readonly _container: Container;\n\n constructor({ dmk, sessionId }: DefaultSignerAleoConstructorArgs) {\n this._container = makeContainer({ dmk, sessionId });\n }\n\n getAppConfig(): GetAppConfigDAReturnType {\n return this._container\n .get<GetAppConfigUseCase>(configTypes.GetAppConfigUseCase)\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 getViewKey(\n derivationPath: string,\n options?: AddressOptions,\n ): GetViewKeyDAReturnType {\n return this._container\n .get<GetViewKeyUseCase>(addressTypes.GetViewKeyUseCase)\n .execute(derivationPath, options);\n }\n\n signRootIntent(\n derivationPath: string,\n rootIntent: Uint8Array,\n options?: TransactionOptions,\n ): SignRootIntentDAReturnType {\n return this._container\n .get<SignRootIntentUseCase>(transactionTypes.SignRootIntentUseCase)\n .execute(derivationPath, rootIntent, options);\n }\n\n signFeeIntent(\n feeIntent: Uint8Array,\n options?: TransactionOptions,\n ): SignFeeIntentDAReturnType {\n return this._container\n .get<SignFeeIntentUseCase>(transactionTypes.SignFeeIntentUseCase)\n .execute(feeIntent, options);\n }\n}\n"],
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": ["makeContainer", "addressTypes", "configTypes", "transactionTypes", "DefaultSignerAleo", "dmk", "sessionId", "derivationPath", "options", "rootIntent", "feeIntent"]
|
|
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 GetAppConfigDAReturnType } from \"@api/app-binder/GetAppConfigDeviceActionTypes\";\nimport { type GetViewKeyDAReturnType } from \"@api/app-binder/GetViewKeyDeviceActionTypes\";\nimport { type SignFeeIntentDAReturnType } from \"@api/app-binder/SignFeeIntentDeviceActionTypes\";\nimport { type SignNestedCallDAReturnType } from \"@api/app-binder/SignNestedCallDeviceActionTypes\";\nimport { type SignRootIntentDAReturnType } from \"@api/app-binder/SignRootIntentDeviceActionTypes\";\nimport { type AddressOptions } from \"@api/model/AddressOptions\";\nimport { type TransactionOptions } from \"@api/model/TransactionOptions\";\nimport { type SignerAleo } from \"@api/SignerAleo\";\nimport { makeContainer } from \"@internal/di\";\nimport { addressTypes } from \"@internal/use-cases/address/di/addressTypes\";\nimport { type GetAddressUseCase } from \"@internal/use-cases/address/GetAddressUseCase\";\nimport { type GetViewKeyUseCase } from \"@internal/use-cases/address/GetViewKeyUseCase\";\nimport { configTypes } from \"@internal/use-cases/config/di/configTypes\";\nimport { type GetAppConfigUseCase } from \"@internal/use-cases/config/GetAppConfigUseCase\";\nimport { transactionTypes } from \"@internal/use-cases/transaction/di/transactionTypes\";\nimport { type SignFeeIntentUseCase } from \"@internal/use-cases/transaction/SignFeeIntentUseCase\";\nimport { type SignNestedCallUseCase } from \"@internal/use-cases/transaction/SignNestedCallUseCase\";\nimport { type SignRootIntentUseCase } from \"@internal/use-cases/transaction/SignRootIntentUseCase\";\n\ntype DefaultSignerAleoConstructorArgs = {\n dmk: DeviceManagementKit;\n sessionId: DeviceSessionId;\n};\n\nexport class DefaultSignerAleo implements SignerAleo {\n private readonly _container: Container;\n\n constructor({ dmk, sessionId }: DefaultSignerAleoConstructorArgs) {\n this._container = makeContainer({ dmk, sessionId });\n }\n\n getAppConfig(): GetAppConfigDAReturnType {\n return this._container\n .get<GetAppConfigUseCase>(configTypes.GetAppConfigUseCase)\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 getViewKey(\n derivationPath: string,\n options?: AddressOptions,\n ): GetViewKeyDAReturnType {\n return this._container\n .get<GetViewKeyUseCase>(addressTypes.GetViewKeyUseCase)\n .execute(derivationPath, options);\n }\n\n signRootIntent(\n derivationPath: string,\n rootIntent: Uint8Array,\n options?: TransactionOptions,\n ): SignRootIntentDAReturnType {\n return this._container\n .get<SignRootIntentUseCase>(transactionTypes.SignRootIntentUseCase)\n .execute(derivationPath, rootIntent, options);\n }\n\n signNestedCall(\n nestedCallRequest: Uint8Array,\n options?: TransactionOptions,\n ): SignNestedCallDAReturnType {\n return this._container\n .get<SignNestedCallUseCase>(transactionTypes.SignNestedCallUseCase)\n .execute(nestedCallRequest, options);\n }\n\n signFeeIntent(\n feeIntent: Uint8Array,\n options?: TransactionOptions,\n ): SignFeeIntentDAReturnType {\n return this._container\n .get<SignFeeIntentUseCase>(transactionTypes.SignFeeIntentUseCase)\n .execute(feeIntent, options);\n }\n}\n"],
|
|
5
|
+
"mappings": "AAeA,OAAS,iBAAAA,MAAqB,eAC9B,OAAS,gBAAAC,MAAoB,8CAG7B,OAAS,eAAAC,MAAmB,4CAE5B,OAAS,oBAAAC,MAAwB,sDAU1B,MAAMC,CAAwC,CAClC,WAEjB,YAAY,CAAE,IAAAC,EAAK,UAAAC,CAAU,EAAqC,CAChE,KAAK,WAAaN,EAAc,CAAE,IAAAK,EAAK,UAAAC,CAAU,CAAC,CACpD,CAEA,cAAyC,CACvC,OAAO,KAAK,WACT,IAAyBJ,EAAY,mBAAmB,EACxD,QAAQ,CACb,CAEA,WACEK,EACAC,EACwB,CACxB,OAAO,KAAK,WACT,IAAuBP,EAAa,iBAAiB,EACrD,QAAQM,EAAgBC,CAAO,CACpC,CAEA,WACED,EACAC,EACwB,CACxB,OAAO,KAAK,WACT,IAAuBP,EAAa,iBAAiB,EACrD,QAAQM,EAAgBC,CAAO,CACpC,CAEA,eACED,EACAE,EACAD,EAC4B,CAC5B,OAAO,KAAK,WACT,IAA2BL,EAAiB,qBAAqB,EACjE,QAAQI,EAAgBE,EAAYD,CAAO,CAChD,CAEA,eACEE,EACAF,EAC4B,CAC5B,OAAO,KAAK,WACT,IAA2BL,EAAiB,qBAAqB,EACjE,QAAQO,EAAmBF,CAAO,CACvC,CAEA,cACEG,EACAH,EAC2B,CAC3B,OAAO,KAAK,WACT,IAA0BL,EAAiB,oBAAoB,EAC/D,QAAQQ,EAAWH,CAAO,CAC/B,CACF",
|
|
6
|
+
"names": ["makeContainer", "addressTypes", "configTypes", "transactionTypes", "DefaultSignerAleo", "dmk", "sessionId", "derivationPath", "options", "rootIntent", "nestedCallRequest", "feeIntent"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var y=Object.defineProperty;var v=Object.getOwnPropertyDescriptor;var
|
|
1
|
+
var y=Object.defineProperty;var v=Object.getOwnPropertyDescriptor;var u=(s,e,n,p)=>{for(var t=p>1?void 0:p?v(e,n):e,a=s.length-1,d;a>=0;a--)(d=s[a])&&(t=(p?d(e,n,t):d(t))||t);return p&&t&&y(e,n,t),t},m=(s,e)=>(n,p)=>e(n,p,s);import{CallTaskInAppDeviceAction as c,SendCommandInAppDeviceAction as A,UserInteractionRequired as i}from"@ledgerhq/device-management-kit";import{inject as I,injectable as D}from"inversify";import{APP_NAME as o}from"../app-binder/constants";import{externalTypes as k}from"../externalTypes";import{GetAddressCommand as f}from"./command/GetAddressCommand";import{GetAppConfigCommand as l}from"./command/GetAppConfigCommand";import{GetViewKeyCommand as O}from"./command/GetViewKeyCommand";import{SignFeeIntentTask as R}from"./task/SignFeeIntentTask";import{SignNestedCallTask as g}from"./task/SignNestedCallTask";import{SignRootIntentTask as h}from"./task/SignRootIntentTask";let r=class{constructor(e,n){this.dmk=e;this.sessionId=n}getAppConfig(e){return this.dmk.executeDeviceAction({sessionId:this.sessionId,deviceAction:new A({input:{command:new l,appName:o,requiredUserInteraction:i.None,skipOpenApp:e.skipOpenApp}})})}getAddress(e){return this.dmk.executeDeviceAction({sessionId:this.sessionId,deviceAction:new A({input:{command:new f(e),appName:o,requiredUserInteraction:e.checkOnDevice?i.VerifyAddress:i.None,skipOpenApp:e.skipOpenApp}})})}getViewKey(e){return this.dmk.executeDeviceAction({sessionId:this.sessionId,deviceAction:new A({input:{command:new O(e),appName:o,requiredUserInteraction:i.VerifyAddress,skipOpenApp:e.skipOpenApp}})})}signRootIntent(e){return this.dmk.executeDeviceAction({sessionId:this.sessionId,deviceAction:new c({input:{task:n=>new h(n,{derivationPath:e.derivationPath,rootIntent:e.rootIntent}).run(),appName:o,requiredUserInteraction:i.SignTransaction,skipOpenApp:e.skipOpenApp}})})}signNestedCall(e){return this.dmk.executeDeviceAction({sessionId:this.sessionId,deviceAction:new c({input:{task:n=>new g(n,{nestedCallRequest:e.nestedCallRequest}).run(),appName:o,requiredUserInteraction:i.None,skipOpenApp:e.skipOpenApp}})})}signFeeIntent(e){return this.dmk.executeDeviceAction({sessionId:this.sessionId,deviceAction:new c({input:{task:n=>new R(n,{feeIntent:e.feeIntent}).run(),appName:o,requiredUserInteraction:i.SignTransaction,skipOpenApp:e.skipOpenApp}})})}};r=u([D(),m(0,I(k.Dmk)),m(1,I(k.SessionId))],r);export{r as AleoAppBinder};
|
|
2
2
|
//# sourceMappingURL=AleoAppBinder.js.map
|