DotnsPopResolver
Inherits: Initializable, UUPSUpgradeable, OwnableUpgradeable, ERC165Upgradeable, IDotnsPopResolver
Title: DotnsPopResolver
Per-node resolver holding records produced by the PoP username flow.
Writes are gated on the protocol-registered POP_CONTROLLER rather
than on node ownership. PoP records are issued by the gateway as part
of identity issuance, not curated by the holder, so authority lives
with the controller and not the user.
Note: security-contact: admin@parity.io
State Variables
protocolRegistry
Protocol-level address registry used to resolve the authorised writer.
IDotnsProtocolRegistry public protocolRegistry
_chatKeys
Stored chat-key bytes keyed by node.
mapping(bytes32 node => bytes chatKey) private _chatKeys
_deviceLinks
Stored device-name labelhash keyed by personhood-name node.
Forward direction: maps a personhood-name node to the labelhash of the device name it is linked to.
Note: oz-renamed-from: _liteLinks
mapping(bytes32 personhoodNode => bytes32 deviceLabelhash) private _deviceLinks
_personhoodNodes
Reverse index mapping a device-name labelhash to the personhood-name node it is linked to.
Written alongside _deviceLinks on every link so consumers that look up by device
name resolve the personhood name without scanning events. Zero when the device name
has never been linked.
Note: oz-renamed-from: _fullClaims
mapping(bytes32 deviceLabelhash => bytes32 personhoodNode) private _personhoodNodes
__gap
Reserved storage space to allow for layout changes in the future.
uint256[50] private __gap
Functions
onlyPopController
Restricts writes to the address registered as POP_CONTROLLER.
modifier onlyPopController() ;
constructor
Note: oz-upgrades-unsafe-allow: constructor
constructor() ;
initialize
Initialises the PoP resolver.
Called once through the UUPS proxy; _disableInitializers on the implementation
makes direct calls revert and any repeat call on the proxy reverts with
Note:
reverts: InvalidInitialization. The registry pointer is the only storage this
setup needs because the authorised writer is resolved dynamically through
POP_CONTROLLER. Emits @custom:emits OwnershipTransferred when msg.sender is
recorded as the initial owner and @custom:emits Initialized once setup completes.
function initialize(
address initialOwner,
IDotnsProtocolRegistry registry
)
external
initializer;
Parameters
| Name | Type | Description |
|---|---|---|
initialOwner | address | Address that owns the contract once initialised. |
registry | IDotnsProtocolRegistry | Protocol-level address registry used for writer resolution. |
setChatKey
Sets the chat key for node.
Callable only by the address registered under DotnsProtocolRegistry.POP_CONTROLLER,
otherwise @custom:reverts NotPopController. Overwrites any previous value. The payload
must be exactly 65 bytes: the uncompressed secp256k1 public key encoding (1 prefix
byte followed by the 32-byte X and 32-byte Y affine coordinates); any other length
reverts with @custom:reverts InvalidChatKeyLength. Emits @custom:emits ChatKeyUpdated
on every successful write.
function setChatKey(
bytes32 node,
bytes calldata chatKeyBytes
)
external
override
onlyPopController;
Parameters
| Name | Type | Description |
|---|---|---|
node | bytes32 | The node whose chat key is being written. |
chatKeyBytes | bytes |
setDeviceLink
Sets the device link for a personhood-name node.
Callable only by the authorised PoP controller, otherwise
Note:
reverts: NotPopController. Overwrites any previous link. When overwriting, the
stale inverse entry is nulled so both the forward (deviceLabelhashOf) and reverse
(personhoodNodeOf) indices remain consistent: re-linking the same personhoodNode to
a new deviceLabelhash clears personhoodNodeOf(oldDevice), and re-linking the same
deviceLabelhash to a new personhoodNode clears deviceLabelhashOf(oldPersonhood).
The invariant personhoodNodeOf(deviceLabelhashOf(node)) == node always holds after
the call. Emits @custom:emits DeviceLinkUpdated on every successful write.
function setDeviceLink(
bytes32 personhoodNode,
bytes32 deviceLabelhash
)
external
override
onlyPopController;
Parameters
| Name | Type | Description |
|---|---|---|
personhoodNode | bytes32 | The personhood-name node carrying the link. |
deviceLabelhash | bytes32 | The labelhash of the linked device name. |
chatKey
Returns the chat key associated with a node.
function chatKey(bytes32 node) external view override returns (bytes memory);
Parameters
| Name | Type | Description |
|---|---|---|
node | bytes32 | The node to query. |
Returns
| Name | Type | Description |
|---|---|---|
<none> | bytes | chatKey The stored chat key bytes, or empty if unset. |
deviceLabelhashOf
Returns the device-name labelhash linked to a personhood-name node.
function deviceLabelhashOf(bytes32 personhoodNode) external view override returns (bytes32);
Parameters
| Name | Type | Description |
|---|---|---|
personhoodNode | bytes32 | The personhood-name node to query. |
Returns
| Name | Type | Description |
|---|---|---|
<none> | bytes32 | deviceLabelhash The linked device-name labelhash, or zero if unset. |
personhoodNodeOf
Returns the personhood-name node a device name is linked to.
Reverse of @custom:function deviceLabelhashOf. Written by the same setDeviceLink call
so the two directions stay in lockstep. Returns zero when the device name has never
been linked to a personhood name.
function personhoodNodeOf(bytes32 deviceLabelhash) external view override returns (bytes32);
Parameters
| Name | Type | Description |
|---|---|---|
deviceLabelhash | bytes32 | The labelhash of the device name to query. |
Returns
| Name | Type | Description |
|---|---|---|
<none> | bytes32 | personhoodNode The linked personhood-name node, or zero if unset. |
version
Returns the release this network declares it runs, read live from the protocol registry so every dotNS contract reports one synchronised value.
Mirror of IDotnsProtocolRegistry.protocolVersion, kept under the historical
version() selector for ABI compatibility. It reports the network's declaration,
not this contract's build; per-contract identity is the codehash declared on the
registry.
function version() external view virtual returns (string memory versionString);
Returns
| Name | Type | Description |
|---|---|---|
versionString | string | Declared release as bare semver, empty when never declared. |
supportsInterface
function supportsInterface(bytes4 interfaceId) public view override returns (bool);
_onlyPopController
Internal check enforcing PoP-controller-only access.
function _onlyPopController() internal view;
_authorizeUpgrade
Function that should revert when msg.sender is not authorized to upgrade the contract.
Called by
{upgradeToAndCall}.
Normally, this function will use an xref:access.adoc[access control] modifier such as
{Ownable-onlyOwner}.
function _authorizeUpgrade(address) internal onlyOwner {}
function _authorizeUpgrade(address newImplementation) internal override onlyOwner;