An “Ownable” trait for Holochain zomes.
The notion of "ownership" over a digital resource is a basic pattern many Holochain applications will need. With ownership comes the user expectance of being able to transfer that ownership, to renounce ownership, etc.
A common way to manage ownership would faciltate better interopability between apps as well as speed up development.
### Example: My data explorer
Something visually similar to a file explorer, to "Finder" or a graph visualisation
. My data
├─ Humm Earth (DNA)
| ├── Blog post 1 (Entry)
| └── Blog post 1 (Entry)
└- Holo.txt (DNA)
├── Text 1 (Entry)
└── Text 2 (Entry)
All entries above `implements Ownable` which allows for the data explorer to interact with data from different DNAs in the same way - transfer ownership etc.
What more standard traits are there? I started a list here: https://hackmd.io/QSVLhFcVRsmkeuhEAOIcfw?both
How does permissions / capabilities come into this? Or does it? Is that a separate thing?
I had a look at the widely implemented ETH Ownable contract module (see below). One difference with Holochain is that we would like the agent at the other end of an ownership transfer to approve the transfer (I guess?)
### OpenZeppelin Ownable (Solidity)
Initializes the contract setting the deployer as the initial owner.
Throws if called by any account other than the owner.
### owner() → address
Returns the address of the current owner.
### isOwner() → bool
Returns true if the caller is the current owner.
Leaves the contract without owner. It will not be possible to call onlyOwner functions anymore. Can only be called by the current owner.
Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner.
### transferOwnership(address newOwner)
Transfers ownership of the contract to a new account (newOwner). Can only be called by the current owner.
### _transferOwnership(address newOwner)
Transfers ownership of the contract to a new account (newOwner).