Skip to main content

removeDIDParameters() function

This API is provided as a beta preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.

Remove all DID query parameters and fragment components from a DID URL

Signature:

export declare function removeDIDParameters(did: string): string

Parameters

Parameter

Type

Description

did

string

the DID URL that may contain query parameters

**Returns:**

string

DID URL without query parameters

Example

removeDIDParameters('did:example:abc:0x123?service=agent&relativeRef=%2Fpath#version=42')
// Returns: 'did:example:abc:0x123'

removeDIDParameters('https://example.com:3128/:abc:0x123?service=agent&relativeRef=%2Fpath#version=42')
// Returns: 'https://example.com:3128/:abc:0x123'

removeDIDParameters('did:example:abc:0x123#version=42')
// Returns: 'did:example:abc:0x123'

This API may change without a BREAKING CHANGE notice.