Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support keypairs for spells [NET-237 NET-239 NET-281 NET-283] #1382

Merged
merged 30 commits into from
Jan 16, 2023

Conversation

justprosh
Copy link
Member

@justprosh justprosh commented Dec 28, 2022

  • added ("scope" "get_peer_id") builtin that returns the existent peer id of keypair associated with INIT_PEER_ID or generates and stores a new one
  • ("spell" "install) and ("spell" "remove") are operating with scope peer_id
  • all spell particles sent on behalf of scope peer_id
  • spells deployed by the same peer_id share the same keypair (just like spells deployed by other spells)

BEGIN_COMMIT_OVERRIDE
feat: support keypairs for spells [fixes NET-237, NET-239, NET-281 and NET-283] #1382
END_COMMIT_OVERRIDE

@justprosh justprosh marked this pull request as ready for review December 28, 2022 19:31
@justprosh justprosh changed the title feat: support keypairs for spells feat: support keypairs for spells [NET-237 NET-239 NET-281 NET-283] Dec 29, 2022
@linear
Copy link

linear bot commented Dec 29, 2022

NET-237 Sign spell particles with owner-specific keypair

NET-239 Support addressing spells via PeerId derived from owner-specific keypair

(call relay (op noop) [])
(call spell (spell_id set_string) [key value])
-- `spell` is a PeerId generated from spell's owner-specific keypair

NET-281 Builtin function to trigger owner-specific keypair generation

If such keypair doesn't exist, create it. Then always return the PeerId of the owner-specific keypair.

Most likely will always be called before spell.install

NET-283 Generate random keypair for each `owner_id` on the same host

@justprosh justprosh requested a review from folex December 29, 2022 15:30
@justprosh justprosh requested a review from kmd-fl January 3, 2023 07:53
aquamarine/src/plumber.rs Outdated Show resolved Hide resolved
aquamarine/src/plumber.rs Outdated Show resolved Hide resolved
aquamarine/src/plumber.rs Outdated Show resolved Hide resolved
aquamarine/src/plumber.rs Outdated Show resolved Hide resolved
aquamarine/src/plumber.rs Outdated Show resolved Hide resolved
aquamarine/src/plumber.rs Outdated Show resolved Hide resolved
aquamarine/src/plumber.rs Outdated Show resolved Hide resolved
fn make_spell_service_functions(&self) -> Vec<SpellCustomService> {
let mut service_functions: Vec<SpellCustomService> = vec![];

let mut spell_service = SpellCustomService::new("spell");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So much better!

How about the following API:

spell_service.extend(hashmap!{
  "install" => self.make_spell_install_closure(),
  "remove" => self.make_spell_remove_closure(),
  ...
})

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But current approach is nice as well. So maybe keep it.

sorcerer/src/sorcerer.rs Outdated Show resolved Hide resolved
sorcerer/src/sorcerer.rs Outdated Show resolved Hide resolved
sorcerer/src/sorcerer.rs Outdated Show resolved Hide resolved
sorcerer/src/sorcerer.rs Outdated Show resolved Hide resolved
sorcerer/src/spells.rs Outdated Show resolved Hide resolved
Copy link
Member

@folex folex left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nicely done!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants