Creating Global Card
This guide will demonstrate how to create a Global Virgil CardGlobal Cards are created with a unique validation token received after verification through the Virgil Identity Service more .... The main feature of Global Virgil Cards is that these Cards contain an identity, which must be confirmed by a user or device. For these cases, Virgil Security has a Virgil Identity Service that is responsible for the validation of user identities. Validating a user only occur after another service - Virgil RA Services authorizes the creation of Global Virgil Cards.
For original information about the Global Virgil Card, its syntax and content, check out our Virgil Card Service endpoint here.
After a Global Virgil Card's creation, it's published at the Virgil Card Service, where an owner can find their Cards at any time.
You can not change a Global Virgil Card's content after its publishing, because each Card contains a permanent digital signature that provides data integrity for the Virgil Card over its life-cycle.
Let's start to create a Global Virgil Card
Set up your project environment before you begin to create a Global Virgil Card, with the getting started guide.
The Global Virgil Card creation procedure is shown in the figure below.
In order to create a Global Virgil Card:
- Developers need to initialize the Virgil SDKThe SDK helps take tedious complexity out of coding by providing APIs for all of Virgil Services.
api, err := virgilapi.New("")
- Once the SDK is ready we can proceed to the next step:
- Generate and save the Virgil KeyThe Virgil Key is a wrapper of the user's secure Private Key more ... (it's also necessary to enter the Virgil Key's name and password).
- Create a Global Virgil Card using their recently generated Virgil Key (they will need to enter some identifying information).
// generate a Virgil Key
aliceKey, err := api.Keys.Generate()
// save the Virgil Key into storage
err = aliceKey.Save("[KEY_NAME]", "[KEY_PASSWORD]")
// create a Global Virgil Card
aliceCard, err := api.Cards.CreateGlobal("[email protected]", aliceKey)
The Virgil Key will be saved into default device storage. Developers can also change the Virgil Key storage directory as needed, during Virgil SDK initialization.
Virgil does not keep a copy of your Virgil Key. Therefore, if you lose a Virgil Key, there is no way to recover it.
- Now, developers can initiate an identity verification process.
- A User has to confirm a Virgil Card's identity using a confirmation codeA code used to confirm ownership of a global identifier more ... received by email.
See our Virgil Identity Service typical workflow for an email confirmation here
- Finally, developers must publish the User's Global Virgil Card on Virgil Services.
// initiate identity verification process
attempt, err := aliceCard.VerifyIdentity()
// confirm an identity and grab the validation token
token, err := attempt.Confirm("[CONFIRMATION_CODE]")
// publish the Virgil Card
publishedCard, err := api.Cards.PublishGlobal(aliceCard, token)