eos icon indicating copy to clipboard operation
eos copied to clipboard

Add ability to Cache Authorities

Open bytemaster opened this issue 9 years ago • 2 comments

When a user passes a message to a contract with a given authority, the contract can call the following API to "save" it. Later it can use the same api to "load" it before invoking a sync or async call that requires the authority.

save_authority( Scope, AccountName, PermissionLevel )
load_authority( Scope, AccountName, PermissionLevel )
clear_authority(Scope, AccountName, PermissionLevel )
get_permission( AccountName ) ///< returns permission level used by AccountName on this message

We allow the authority to be saved to any scope, but it must be loaded again from that same scope.

bytemaster avatar Jul 31 '17 19:07 bytemaster

As discussed in the call, we want to allow the account whose authority is being cached to add some restrictions to the ability to cache authorities.

Some of the restrictions we discussed:

  • Whether the permission can be cached at all -- if not allowed, then save_authority fails
  • Whether the permission can be cached for later use, or must be used immediately
  • Whether the account must be notified (which implies veto power) when its authority is used

This can be implemented by updating Message::authorization. Right now, this field has type AccountPermission[], but we could instead define a new struct:

struct MessageAuth
   permission AccountPermission
   flags UInt8

Then Message::authorization could be of type MessageAuth[]. This allows the user to specify the restrictions on whether and how their authority can be cached and subsequently used.

nathanielhourt avatar Aug 02 '17 20:08 nathanielhourt

closing this after a discussion with @bytemaster where we are going to move away from explicit authority caching to delegating permission levels to other accounts directly in the native contract for permissions.

That work is tracked as part of #402

wanderingbort avatar Sep 11 '17 21:09 wanderingbort