[Encrypting] Creating a credential using the API (from another NextCloud application)

Hello,

I use PassMan from an application I developed for NextCloud and will use it to store user accounts.
I want to create and activate the sharing of a “credential” to display its share link to the user.

I manage to create an entry from the API which is detailed at the following address : https://github.com/nextcloud/passman/wiki/API#create-new-credential-post
But there are two fields “password” and “url” noted “(encrypted)” during POST, but I can not determine how to encrypt them.
That’s when the PassMan application tells me “An error occurred while decrypting” when I’m on the page that displays the “credentials”.

Request credential creation in POST :

{
	vault_id:		vault_id,
	label:			'A random chain',
	description:	'Another random chain',
	tags:			null,
	email:			mail,
	username:		'john-doe',
	password:		'abcdefg',
	url:			'ftp://john-doe.domain.tld',
	favicon:		null,
	renew_interval:	null,
	expire_time:	timestamp + 1h,
	delete_time:	0,
	files:			null,
	custom_fields:	null,
	otp:			null,
	hidden:			false
}

My second concern is most certainly caused by the first.
I can not activate the sharing of a user that I created with the API from my application (I have the button to activate the share, but it is not activated in any case), that this either directly in PassMan or with the sharing API.

I tried to solve the encrypting problem by including the PassMan encrypting service in my application, but it can not decrypt the string it has generated (encrypted with the inclusion of the service and credential created with the API).

There is an example of decrypting using the Stanford JavaScript Crypto Library (SJCL), but I do not know which key to use.
Here is my code :

var config = config: {
	adata:	'',
	iter:	1000,
	ks:		256,
	mode:	'ccm',
	ts:		64
};

function encrypt( key, value ) {
	var rp = {};
	var ciphertext = value;
	try
	{
		return ( window.btoa( sjcl.encrypt( key, ciphertext, passman.config, rp ) ) );
	}
	catch ( e ) {}

	return ( false );
}

function decrypt( key, value ) {
	var rp = {};
	var ciphertext = window.atob( value );
	try
	{
		return ( window.btoa( sjcl.decrypt( key, ciphertext, rp ) ) );
		//return ( window.btoa( sjcl.decrypt( key, ciphertext, passman.config, rp ) ) );
	}
	catch ( e ) {}

	return ( false );
}

Summary:
1 - Encrypting concerns (password, url) for credential creation with the PassMan API,
2 - Sharing is not activated on credentials created with my request to the PassMan API.

Thank you in advance if you have an idea of ​​how to move forward in solving my problem.