How to give another user permission to write to mdata?

I just need to confirm if I understood this right:

In order to give another user permission to write to my mdata I have to:

  1. get his app pubSignKey as byte[]
  2. convert the byte[] to NativeHandle using NativeBindings.signPubKeyNew()
  3. get permissions NativeHandle with mdataListPermissions
  4. use mdataPermissionsInsert() to insert new permissions for the given user/app.

I see that there is also method mdataSetUserPermissions() which seems easier to use. Will it do the same?


The mdataPermissionsInsert() API is used to insert a key and it’s relevant permission set to a permissions handle, before the mutable data is PUT to the network. For mutable data that already exists on the network, you should use the mdataSetUserPermissions() API. The version number that is taken by this function is the version of the mutable data shell itself.

You can find the API usage in this unit test.