MindLake.Permission
In Mind Lake, users can access others' data, but private encrypted data is presented as ciphertext. To share private data with a specific user, the data owner must grant the target user permission to decrypt the ciphertext, thereby enabling access to the plaintext.
1. grant() Method
Grant decryption permissions to the recipient to enable them to access the encrypted data in the specified columns.
When the Grant
method is called by a grantor for the same recipient again, the existing grant policy from the grantor to the recipient is overwritten. The previous policy becomes invalid immediately, and the new policy, which includes the new set of columns, takes effect only after the recipient invokes the Confirm
method for this grant policy.
mindlake.permission.grant(targetWalletAddress: str, columns: list) -> ResultType
# mindlake is an instance of MindLake
Parameters
targetWalletAddress
-str
: the wallet address of the recipientcolumns
-list<str>
: the columns to be shared with the recipient. Each column should be defined as a string that combines the table name, and column name, separated by dots. Specifically, the format for defining a column should be"TableName.ColumnName"
Returns
An object of . For more information.
data
-str
: the UUID string of the grant policy. The granter should share this UUID with the recipient. The recipient then needs to confirm the policy for it to take effect.
Example
result = mindlake.permission.grant(targetWalletAddress, ['TableName1.ColumnName1', 'TableName2.Column2'])
assert result, result.message
policyID = result.data
2. confirm() Method
Confirm the grant policy as the recipient. The policy will take effect after the confirmation.
mindlake.permission.confirm(policyID: str) -> ResultType
# mindlake is an instance of MindLake
Parameters
policyID -
str
: the UUID string of the grant policy. The recipient should get it from the granter.
Returns
An object of . For more information.
Example
result = mindlake.permission.confirm(policyID)
assert result, result.message
3. revoke() Method
Revoke decryption permissions for the target user. Consequently, the target user loses access to all the encrypted data belonging to the owner who invokes this method.
mindlake.permission.revoke(targetWalletAddress: str)
# mindlake is an instance of MindLake
Parameters
targetWalletAddress
-str
: the wallet address of the target whose permission is to be revoked.
Returns
An object of . For more information.
Example
result = mindlake.permission.revoke(targetWalletAddress)
assert result, result.message
4. listGrantee() Method
Retrieve a list of wallet addresses of users who have been granted permission by the invoking user.
mindlake.permission.listGrantee()
# mindlake is an instance of MindLake
Returns
An object of . For more information.
data
-list<str>
: a list of wallet addresses of users who have been granted permission by the invoking user.
Example
result = mindlake.permission.listGrantee()
assert result, result.message
granteeList = result.data
5. listOwner() Method
Retrieve a list of wallet addresses of users who have granted permission to the invoking user.
mindlake.permission.listOwner()
# mindlake is an instance of MindLake
Returns
An object of . For more information.
data
-list<str>
: a list of wallet addresses of users who have granted permission to the invoking user.
Example
result = mindlake.permission.listOwner()
assert result, result.message
ownerList = result.data
6. listGrantedColumn() Method
Retrieve a list of column names for which decryption permission has been granted to the specified user.
mindlake.permission.listGrantedColumn(targetWalletAddress)
# mindlake is an instance of MindLake
Parameters
targetWalletAddress
-str
: specify the target user by the wallet address.
Returns
An object of . For more information.
data
-list<str>
: a list of column names for which decryption permission has been granted to the specified user.
Example
result = mindlake.permission.ListGrantedColumn(targetWalletAddress)
assert result, result.message
grantedColumnList = result.data
7. listOwnerColumn() Method
Retrieve a list of column names authorized for decryption by the specified user.
mindlake.permission.listOwnerColumn(targetWalletAddress)
# mindlake is an instance of MindLake
Parameters
targetWalletAddress
-str
: specify the owner user of the authorized columns by the wallet address.
Returns
An object of . For more information.
data
-list<str>
: a list of column names authorized for decryption by the specified user.
Example
result = mindlake.permission.ListOwnerColumn(targetWalletAddress)
assert result, result.message
ownerColumnList = result.data
Last updated