hashToUri
hashToUri(
digest,iDPrefix,prefix):string
Converts a digest to a URI using a specified identifier prefix and a predefined prefix string.
Parameters
Section titled “Parameters”• digest: any
The input digest to be encoded.
• iDPrefix: number
The identifier prefix, used to classify the type of data being encoded.
• prefix: string
A predefined string prefix to be appended before the encoded identifier.
Returns
Section titled “Returns”string
A string representing the URI constructed from the digest and identifier prefix.
Example
Section titled “Example”const digest = '0x1234...';const uri = hashToUri(digest, 29, 'example:');console.log('URI:', uri);Throws
Section titled “Throws”Assert error if the digest is invalid.