Skip to content
This repository has been archived by the owner on Nov 7, 2023. It is now read-only.

Create identity #30

Merged
merged 15 commits into from
Sep 8, 2020
Merged

Create identity #30

merged 15 commits into from
Sep 8, 2020

Conversation

ilanolkies
Copy link
Contributor

Removes old implementation, I created a simpler one now. It includes:

  • A reducer that stores identities, with add identity action and identities selector
  • Two operations. Init that MUST be triggered when the lib is initialised. It loads all stored identities into the reducer. Create is used to create identities.
  • An identity store that can be used as base of a bigger store.
  • Some minor docs, I will extend it when we get into more definitions

@ilanolkies ilanolkies added enhancement New feature or request daf uPort DAF agent labels Sep 4, 2020
@ilanolkies ilanolkies added this to the v0.0.1 milestone Sep 4, 2020
Copy link
Member

@jessgusclark jessgusclark left a comment

Choose a reason for hiding this comment

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

This is great! I was able to create an identity with this.

@ilanolkies
Copy link
Contributor Author

Perfect! Let's add the operations too.

  • IMHO delete one identity should use DAF delete identity and then trigger the action
  • Delete all should Promise all deletions and trigger actions?
  • Also, IMHO mnemonic deletion should be triggered "manually" because it is also "manually created". I mean, not in delete all identities

@ilanolkies
Copy link
Contributor Author

ilanolkies commented Sep 8, 2020

Addition:

  • Operations allow optional callback parameter. A callback is a closure that takes (res, err) collaborations. If the operation is succesfull the closure is executed with (res, undefined) but if it fails it is executed with (undefined, err). Correct usage of callback would be as follows

    operation(...args, (res, err) => {
      if (err) return handleError(err)
      return handleSuccess(res)
    })

@ilanolkies
Copy link
Contributor Author

Researched a little bit on callbackify and fount Node.js implementation https://nodejs.org/dist/latest-v8.x/docs/api/util.html#util_util_callbackify_original. I swapped the parameter order to make it more developer familiar. Now it is used

operation(...args, (err, res) => {
  if (err) return handleError(err)
  return handleSuccess(res)
})

Copy link
Member

@jessgusclark jessgusclark left a comment

Choose a reason for hiding this comment

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

Great!

@ilanolkies ilanolkies merged commit d2eff48 into develop Sep 8, 2020
@delete-merged-branch delete-merged-branch bot deleted the create-identity branch September 8, 2020 20:16
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
daf uPort DAF agent enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants