Canton Package Manager - CLI User Guide

In this section we will guide you on how to use Canton Package Manager (CPM).

Login

To generate an access-token that allows you to identify yourself in the CPM CLI tool, please insert the following command:

$ cpm login

When executing this command, a new tab will open on your browser requiring you to login to the Keycloak page.

The token is then provided on your terminal window.

Store your access token as it will be needed for most commands.

Download an app from the CPM Registry

When the user has been granted with permissions to download an app, they can the necessary resources by executing the following command:

$ cpm --access-token <ACCESS_TOKEN> download <ACCESS_CONTRACT_ID > <OUTPUT_FILE>

Where:

  • <ACCESS_TOKEN> is the access token returned after the user logged in.

  • <ACCESS_CONTRACT_ID> is the contract ID of the artifat access

  • <OUTPUT_FILE> is the name of the file created.

List apps published on CPM

To display a list of the applications available on the CPM registry, please insert the following command:

$ cpm list

If instead the user wants to see the list of applications published by a specific App-Builder, type in:

$ cpm list <PUBLISHER>

Where:

  • <PUBLISHER> is the Identifier of the App-Builder.

Request access to an app

In case a user has no permissions to download an app, they can request it by executing the following command:

$ cpm --access-token <ACCESS_TOKEN> request-access <ARTIFACT_CONTRACT_ID> <CUSTOMER>

Where:

  • <ACCESS_TOKEN> is the access token returned after the user logged in.

  • <ARTIFACT_CONTRACT_ID> is the contract ID of the artifact

  • <CUSTOMER> is the party for whom you want to request access.

Cancel access request

To cancel an access request type in the following command:

$ cpm --access-token <ACCESS_TOKEN> cancel-access-request <ACCESS_REQUEST_CONTRACT_ID>

Where:

  • <ACCESS_TOKEN> is the access token returned after the user logged in.

  • <ACCESS_REQUEST_CONTRACT_ID> is the contract ID that identifies the access request.

List accesses

To see all the accessible artifacts, insert the following command:

$ cpm --access-token <ACCESS_TOKEN> list-accesses

Where:

  • <ACCESS_TOKEN> is the access token returned after the user logged in.

Publish an app on the CPM Registry

App Builders can publish an app on the CPM Registry.

This can be done by executing the following command:

$ cpm --access-token <ACCESS_TOKEN> publish <PUBLISHER> <HASH> <NAME> <VERSION> <LISTER>

Where:

  • <ACCESS_TOKEN> is the access token returned after the user logged in.

  • <PUBLISHER>is the publisher of the artifact

  • <HASH> is the hash of the artifact

  • <NAME>is the name of the artifact

  • <VERSION>is the version of the artifact

  • <LISTER>is the ID of the Lister.

Unpublish an app from the CPM Registry

To unpublish an app previously published by the same user on the CPM registry, insert the following command:

$ cpm --access-token <ACCESS_TOKEN> unpublish <ARTIFACT_CONTRACT_ID>

Where:

  • <ACCESS_TOKEN> is the access token returned after the user logged in.

  • <ARTIFACT_CONTRACT_ID> is the contract ID of the artifact.

List access requests

To approve or reject a permissions request, type in the corresponding command:

$ cpm --access-token <ACCESS_TOKEN> approve-access-request <ACCESS_REQUEST_CONTRACT_ID> <URL>
$ cpm --access-token <ACCESS_TOKEN> reject-access-request <ACCESS_REQUEST_CONTRACT_ID>

Where:

  • <ACCESS_TOKEN> is the access token returned after the user logged in.

  • <ACCESS_REQUEST_CONTRACT_ID> Is the contract ID of the access request

  • <URL> is the URL to the app.

Request audit

App builders can at any time request any other Participant of the Canton network to audit their application. To do so, execute the following command:

$ cpm --access-token <ACCESS_TOKEN> request-audit <ARTIFACT_CONTRACT_ID> <AUDITOR> <URL>

Where:

  • <ACCESS_TOKEN> is the access token returned after the user logged in.

  • <ARTIFACT_CONTRACT_ID> is the contract ID of the artifact

  • <AUDITOR>is the party from whom you want to request the audit

  • <URL> is the URL for the auditor to download the artifact

Cancel audit request

To cancel a previous audit request, execute the following command:

$ cpm --access-token <ACCESS_TOKEN> cancel-audit-request <AUDIT_REQUEST_CONTRACT_ID>

Where:

  • <ACCESS_TOKEN> is the access token returned after the user logged in.

  • <AUDIT_REQUEST_CONTRACT_ID> is the contract ID of the audit request

List audit requests

To see all the Audit requests, type in the following command:

$ cpm  --access-token <ACCESS_TOKEN> list-audit-requests

Where:

  • <ACCESS_TOKEN> is the access token returned after the user logged in.

Approve or reject an audit request

As an Auditor, if you want to approve or reject an audit request, type in the corresponding command:

$ cpm  --access-token <ACCESS_TOKEN> approve-audit-request <AUDIT_REQUEST_CONTRACT_ID>
$ cpm  --access-token <ACCESS_TOKEN> reject-audit-requests <AUDIT_REQUEST_CONTRACT_ID>

Where:

  • <ACCESS_TOKEN> is the access token returned after the user logged in.

  • <AUDIT_REQUEST_CONTRACT_ID> is the contract ID of the audit request.