buildFromAuthorizationProperties
buildFromAuthorizationProperties(
spaceUri,delegateAddress,permission,creatorAddress):Promise<ISpaceAuthorizationAccountType>
Authorizes a delegate within a ChainSpace, allowing them to perform actions on behalf of the creator.
Parameters
Section titled “Parameters”• spaceUri: `space:cord:${string}`
The unique identifier (URI) of the ChainSpace for which the delegation is being set up.
• delegateAddress: string
The account address of the delegate, the entity being authorized.
• permission: number
The type of permission being granted to the delegate, defining their role and actions within the ChainSpace.
• creatorAddress: string
The DID URI of the ChainSpace’s creator or owner, responsible for authorizing the delegate.
Returns
Section titled “Returns”Promise<ISpaceAuthorizationAccountType>
A promise that resolves to an ISpaceAuthorizationAccountType object, encapsulating the details of the granted authorization.
Remarks
Section titled “Remarks”This function facilitates the delegation of permissions or roles to another entity within a specific ChainSpace. It is instrumental in managing the decentralized governance and control within the ChainSpace, enabling the ChainSpace’s creator or owner to grant specific permissions to a delegate.
Example
Section titled “Example”const spaceUri = 'space:example_uri';const delegateUri = 'did:example:delegateUri';const permission = PermissionType.EXAMPLE_PERMISSION;const creatorUri = 'did:example:creatorUri';
buildFromAuthorizationProperties(spaceUri, delegateUri, permission, creatorUri) .then(spaceAuth => { console.log('Authorization URI:', spaceAuth.authorizationUri); }) .catch(error => { console.error('Error creating authorization:', error); });