buildFromAuthorizationProperties
buildFromAuthorizationProperties(
spaceUri
,delegateUri
,permission
,creatorUri
):Promise
<ISpaceAuthorization
>
Authorizes a delegate within a ChainSpace, allowing them to perform actions on behalf of the creator.
Parameters
• spaceUri: space:cord:${string}
The unique identifier (URI) of the ChainSpace for which the delegation is being set up.
• delegateUri: did:cord:3${string}
The decentralized identifier (DID) URI 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.
• creatorUri: did:cord:3${string}
The DID URI of the ChainSpace’s creator or owner, responsible for authorizing the delegate.
Returns
Promise
<ISpaceAuthorization
>
A promise that resolves to an ISpaceAuthorization object, encapsulating the details of the granted authorization.
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
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); });