This guide shows how to create a user's Virgil CardEach Card contains attributes associated with the holder of the Private key and are used to prove the ownership of a Public key more ..., which is the main entity of Virgil ServicesVirgil Services is a group of cryptographic services that make up the Virgil Security infrastructure more .... Where every user/device is represented with a Virgil Card which contains all the necessary information to identify them.
For original information about the Virgil Card, its syntax and content, check out our Virgil Card Service endpoint here.
Every developer can create a user's Virgil Card, that will be visible within the Application, as well as a Global Virgil CardGlobal Cards are created with a unique validation token received after verification through the Virgil Identity Service more ..., that is not related to any Application and will be visible to anybody.
After a Virgil Card is created, it's published at Virgil Card Service, where an owner can find their Virgil Cards at any time.
You cannot change a Virgil Card's content after it is published. Each Virgil Card contains a permanent digital signature that provides data integrity for the Virgil Card over its life-cycle.
Let's start to create a user's Virgil Card
Set up your project environment before you begin to create a user's Virgil Card, with the getting started guide.
The Virgil Card creation procedure is shown in the figure below.
In order to create a 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.
virgil = VirgilApi.new(access_token: "[YOUR_ACCESS_TOKEN_HERE]")
Users' Virgil Card creation is carried out on the client side.
- Once the SDK is ready, we can proceed to the next step:
- Generate and save a 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 Virgil Card using the recently generated Virgil Key
# generate a new Virgil Key
alice_key = virgil.keys.generate()
# save the Virgil Key into the storage
# create a Virgil Card
alice_card = virgil.cards.create("alice", alice_key)
The Virgil Key will be saved into default device storage. Developers can also change the Virgil Key's storage directory as needed during Virgil SDK initialization.
Virgil doesn't keep a copy of your Virgil Key. Therefore, if you lose a Virgil Key, there is no way to recover it.
- Developers have to transmit the Virgil Card to the App's server side where it will be signed, validated and then published on Virgil Services (this is necessary for further operations with the Virgil Card).
# export a Virgil Card to string
exported_alice_card = alice_card.export
A user's Virgil Card is related to its Application. Which means that the developer must identify their Application
On the Application's Server Side, one must:
- Initialize the Virgil SDK and enter the Application credentialsA necessary app-attribute that authorizes a developer to use the application. (App IDThis is an identifier, which uniquely identifies an Application at Virgil Services more ..., App KeyThis is a secure Private Key for your application that you receive during registration at Virgil Services more ..., and App Key passwordA password set for a App Key that you receive during application registration at Virgil Services).
virgil = VirgilApi.new(context: VirgilContext.new(
- Import a Virgil Card from its string representation.
# import a Virgil Card from string
alice_card = virgil.cards.import(exported_alice_card)
- Then publish a Virgil Card on Virgil Services.
# publish a Virgil Card
Developers also can create a Virgil Card using the Virgil CLI. More details are available here.