Skip to content

Commit

Permalink
Merge branch 'main' into issue-1913-validateddo-params
Browse files Browse the repository at this point in the history
  • Loading branch information
paulo-ocean committed Feb 25, 2025
2 parents 390c5fc + 76ce298 commit 2c00003
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 2 additions & 1 deletion docs/classes/Provider.md
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ ___

### getDownloadUrl

**getDownloadUrl**(`did`, `serviceId`, `fileIndex`, `transferTxId`, `providerUri`, `signer`, `userCustomParameters?`): `Promise`<`any`\>
**getDownloadUrl**(`did`, `serviceId`, `fileIndex`, `transferTxId`, `providerUri`, `signer`, `policyServerUrl?` `userCustomParameters?`): `Promise`<`any`\>

Gets the download URL.

Expand All @@ -297,6 +297,7 @@ Gets the download URL.
| `transferTxId` | `string` | The transfer transaction ID. |
| `providerUri` | `string` | The provider URI. |
| `signer` | `Signer` | The signer. |
| `policyServerUrl` | `string` | The policy server URL (if any to be used). |
| `userCustomParameters?` | [`UserCustomParameters`](../interfaces/UserCustomParameters.md) | The user custom parameters. |

#### Returns
Expand Down
6 changes: 6 additions & 0 deletions src/services/Provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -478,6 +478,7 @@ export class Provider {
* @param {string} transferTxId - The transfer transaction ID.
* @param {string} providerUri - The provider URI.
* @param {Signer} signer - The signer.
* @param {string} policyServerUrl - The policy server url (if any is to be used).
* @param {UserCustomParameters} userCustomParameters - The user custom parameters.
* @returns {Promise<any>} The download URL.
*/
Expand All @@ -488,6 +489,7 @@ export class Provider {
transferTxId: string,
providerUri: string,
signer: Signer,
policyServerUrl?: string,
userCustomParameters?: UserCustomParameters
): Promise<any> {
const providerEndpoints = await this.getEndpoints(providerUri)
Expand Down Expand Up @@ -518,6 +520,10 @@ export class Provider {
consumeUrl += `&serviceId=${serviceId}`
consumeUrl += `&consumerAddress=${consumerAddress}`
consumeUrl += `&nonce=${nonce}`
if (policyServerUrl) {
consumeUrl += `&policyServer=${policyServerUrl}`
}

consumeUrl += `&signature=${signature}`
if (userCustomParameters)
consumeUrl += '&userdata=' + encodeURI(JSON.stringify(userCustomParameters))
Expand Down

0 comments on commit 2c00003

Please sign in to comment.