Giter VIP home page Giter VIP logo

Comments (5)

YorickdeJong avatar YorickdeJong commented on June 12, 2024

Hi @nazmulidris

I can take a look at this one later today. Just to understand, I created a sample format of when a default identity doesn't or does exist. Please let me know if that is what you had in mind, such that i know what to work on.

image

from ockam.

nazmulidris avatar nazmulidris commented on June 12, 2024

@YorickdeJong Thank you for doing the mocks. I really appreciate it. This is
a great direction to head in 👏🏽 .

I think your mocks are a great starting point and we might try to create a PR that we can collaborate on as you get further in it. I can help provide feedback on the UX strings and the organization as you go. This way you won't have to iterate very far before you get feedback and I can engage with you along the way.

The identity section could reflect the following states:

  1. No identity exists on the machine. A new one is created for the user. Saved to the vault locally. Marked as default. The user can be apprised of this information.

  2. Default identity was found (eg in ~/.ockam folder or whatever $OCKAM_HOME is set to). The user can be apprised of this information - that a pre-existing default identity on the local machine is used.

  3. A given identity is used that is passed in via the --identity flag. The user can be apprised of this information that the given identity is used.

from ockam.

YorickdeJong avatar YorickdeJong commented on June 12, 2024

Hi @nazmulidris,

I'm glad the direction we're heading in is to your liking. I'll start working on the PR based on our discussion and the initial mocks I've created. I'll set up the PR (#7497), such that you can see its progression, thanks!

from ockam.

YorickdeJong avatar YorickdeJong commented on June 12, 2024

Hi @nazmulidris,

I've made progress on the issue. I found that name_identity includes name, vault_name, and is_default fields. Based on this, I've updated the terminal messages to reflect whether a default identity exists and if a specific identity is being used.

I've also added a function check_default_named_identity in the CliState struct to verify the existence of a default identity. This function returns a boolean indicating the presence of a default identity.

Here are the key changes in the code:

        // Print the identity name if it exists.
        if let Ok(named_identity) = opts
            .state
            .get_named_identity_by_identifier(&identifier)
            .await
        {

            // Notify the user that a new identity was created for them.
            if !default_identity_exist {
                opts.terminal.write_line(&fmt_log!(
                    "\nNo Identity name exists. A new identity was created for you: '{}'.", 
                    color_primary(named_identity.name())
                ))?;
            }
            // Notify the user that the default identity will be used.
            else if named_identity.is_default() && self.identity.is_none() {
                opts.terminal
                    .write_line(&fmt_log!("\nExisting default identity: '{}' will be used for enrollment. \
                    To use a different identity, run `ockam enroll --identity <IDENTITY_NAME>`.", 
                        color_primary(named_identity.name()))
                    )?;
            }
            // Notify the user that the chosen identity will be used.
            else {
                opts.terminal
                    .write_line(&fmt_log!("\nChosen identity: '{}' will be used for enrollment. \
                        To use the default identity, run `ockam enroll` instead.", 
                        color_primary(named_identity.name()))
                    )?;
            }
            
        }

This update will show different messages based on whether a default identity exists, and if a specific identity is chosen. For example:

  • ockam enroll with no default identity will now indicate that a new identity is created:
No Identity name exists. A new identity was created for you: '[name]'.
  • ockam enroll with a default identity will inform the user about using the default identity:
Existing default identity: '[name]' will be used for enrollment. To use a different identity, run `ockam enroll --identity <IDENTITY_NAME>`.
  • ockam enroll --identity [name] will confirm the chosen identity's usage:
Chosen identity: '[name]' will be used for enrollment. To use the default identity, run `ockam enroll` instead.

Do you think additional details, like vault information, should be included?

Best,
Yorick

from ockam.

nazmulidris avatar nazmulidris commented on June 12, 2024

This PR #7616 closes this issue

from ockam.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.