uriToEntryIdAndDigest
uriToEntryIdAndDigest(
registryEntryUri
):object
Extracts the identifier and digest from a given registry entry URI.
Parameters
• registryEntryUri: `entry:cord:${string}`
The registry entry URI to be parsed. Format: ‘entry:cord:
Returns
object
An object containing the extracted identifier and digest.
digest
digest:
HexString
identifier
identifier:
string
Remarks
This function parses a registry entry URI and extracts the identifier and digest components.
Example
const entryUri = 'entry:cord:1234:abcd';const { identifier, digest } = uriToEntryIdAndDigest(entryUri);console.log('Identifier:', identifier, 'Digest:', digest);
Throws
If the registryEntryUri
does not follow the expected format.
Description
The function splits the registryEntryUri
string and validates its format. If valid, it returns the identifier
and the digest (with ‘0x’ prefix).