getUriForAuthorization
getUriForAuthorization(
registryUri
,delegateAddress
,creatorAddress
):Promise
<RegistryAuthorizationUri
>
Generates a URI for authorization based on the provided registry URI, delegate address, and creator address.
This function computes a unique authorization URI by creating a digest from the registry identifier, the delegate’s address, and the creator’s address.
Parameters
• registryUri: `registry:cord:${string}`
The URI of the registry for which authorization is requested.
• delegateAddress: string
The address of the delegate for whom the authorization URI is generated.
• creatorAddress: string
The address of the creator of the registry, used for authentication.
Returns
Promise
<RegistryAuthorizationUri
>
A promise that resolves to the generated authorization URI for the specified registry.
Usage Example:
const registryUri = 'some-registry-uri'; // Example registry URIconst delegateAddress = 'some-delegate-address'; // Delegate addressconst creatorAddress = 'some-creator-address'; // Creator address
try { const authorizationUri = await getUriForAuthorization(registryUri, delegateAddress, creatorAddress); console.log(`Authorization URI: ${authorizationUri}`); // Logs the generated authorization URI} catch (error) { console.error(error);}
This function first encodes the registry identifier and addresses into byte arrays, then calculates the Blake2 hash digest of the combined data to create a unique authorization URI.