Party ids in Canton

Hi Daml Community,

To create contracts with the JSON API i need a Party Id in order to create the JWT token. In Canton how can i get Party ids? Is it possible to create a json file with this content like with the following command?

daml start --script-option --output-file=parties.json

How can i get this Partyid? The command used:

val bob = participant1.parties.enable(“Bob”)

image

Hi @Derek

You might want to have a look at user management: Authorization — Daml SDK 2.2.0 documentation

We’ve added support for user names that allow you to use stable identifiers and JWT tokens and manage the permissions the users have with respect to parties on the participant node directly. Right now, we support both types of tokens, the ones referring directly to parties and the ones using the user management feature.

You can create stable user names that you can map locally on a participant to a set of parties:

@ val alice = participant1.parties.enable("Alice")
alice: PartyId = Alice::1220f95d22be...

@ val myUser = participant1.ledger_api.users.create("myuser", actAs=Set(alice.toLf), primaryParty=Some(alice.toLf), readAs=Set(alice.toLf), participantAdmin=true)
myUser: LedgerApiUser = LedgerApiUser(id = "myuser", primaryParty = Some(value = "Alice::1220f95d22be53f44b9004e6d03b2ba5069bbad3f4abe03340747d52042c1f1e69aa"))

Please check

participant1.ledger_api.users.help("create")

for some additional help!

You can also create users via Daml script or Repl: Module Daml.Script — Daml SDK 2.2.0 documentation

There is actually a bigger blog overview of how to manage parties: Parties and users in Daml 2.0
You should read that!

Thanks!
Ratko