Admins ​
Admins are addresses that have the most permissions on a handle. Admins can:
- decrypt the handle
- use the handle as input to create new handles
- add other addresses as viewers for the handle
- allow other addresses to become admins for the handle
- make the handle publicly decryptable
Checking Admins ​
The Nox protocol smart contract provides a function to check if a specific address is an allowed admin for a given handle:
TIP
isAllowed checks admin access specifically. To check viewer access, use isViewer instead (see Manage Viewers).
solidity
function isAllowed(bytes32 handle, address account) external view returns (bool);isAllowed ABI:
json
[
{
"inputs": [
{
"internalType": "bytes32",
"name": "handle",
"type": "bytes32"
},
{
"internalType": "address",
"name": "account",
"type": "address"
}
],
"name": "isAllowed",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "view",
"type": "function"
}
]ts
const noxContract = new Contract(
NOX_CONTRACT_ADDRESS,
NOX_CONTRACT_ABI,
provider
);
const isAllowed: boolean = await noxContract.isAllowed(handle, account);ts
const isAllowed = await publicClient.readContract({
address: NOX_CONTRACT_ADDRESS,
abi: NOX_CONTRACT_ABI,
functionName: 'isAllowed',
args: [handle, account],
});Allowing Admins ​
The Nox protocol smart contract provides a function for admins to allow a specific address as an admin for a given handle:
INFO
Only allowed admins can allow new admins.
WARNING
Once allowed, an admin cannot be revoked.
solidity
function allow(bytes32 handle, address account) external;allow ABI:
json
[
{
"inputs": [
{
"internalType": "bytes32",
"name": "handle",
"type": "bytes32"
},
{
"internalType": "address",
"name": "account",
"type": "address"
}
],
"name": "allow",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
}
]ts
const noxContract = new Contract(
NOX_CONTRACT_ADDRESS,
NOX_CONTRACT_ABI,
signer
);
const tx = await noxContract.allow(handle, accountToAllow);
await tx.wait();ts
const [userAddress] = await walletClient.getAddresses();
await walletClient.writeContract({
account: userAddress,
chain: CHAIN,
address: NOX_CONTRACT_ADDRESS,
abi: NOX_CONTRACT_ABI,
functionName: 'allow',
args: [handle, accountToAllow],
});