buildStatementUri
buildStatementUri(
idDigest,digest):StatementUri
Constructs a statement URI from given hexadecimal string digests.
Parameters
Section titled “Parameters”• idDigest: HexString
A hexadecimal string representing the identifier digest. Must start with ‘0x’.
• digest: HexString
Another hexadecimal string representing the statement’s content digest. Must also start with ‘0x’.
Returns
Section titled “Returns”StatementUri
A StatementUri representing the combined URI for the statement.
Remarks
Section titled “Remarks”This function generates a standardized URI for a statement by combining a hashed identifier digest and another digest. The identifier digest is first converted to a URI with a specific prefix, and then concatenated with the sliced second digest to form the complete statement URI.
Example
Section titled “Example”const idDigest = '0x1234...';const digest = '0xabcd...';const statementUri = buildStatementUri(idDigest, digest);console.log('Statement URI:', statementUri);Throws
Section titled “Throws”If either idDigest or digest does not start with ‘0x’.
Description
Section titled “Description”The function first checks if both input parameters start with ‘0x’ as required for hexadecimal digests.
It then uses the hashToUri function to convert idDigest to a URI with a specified identifier and prefix.
The digest is then sliced to remove its ‘0x’ prefix and concatenated with the identifier URI to form
the final statement URI, which is returned as a StatementUri type.