This guide shows how to create a user's , which is the main entity of . 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 check out our Virgil Card Service endpoint.
Every developer can create a user's Virgil Card, that will be visible within the Application, as well as a , 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 = 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 (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. 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, so the developer must identify their Application
On the Application's Server Side, one must:
- Initialize the Virgil SDK and enter the Application (, , and ).
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.