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 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 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 = Virgil("[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 Identity
identity = virgil.identities.create_user("alice")
# create a Virgil Card
alice_card = virgil.cards.create(identity, 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 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 an App Key that you receive during application registration at Virgil Services).
key_file_content = open("[YOUR_APP_KEY_FILEPATH_HERE]", "r").read()
raw_private_key = VirgilCrypto().strtobytes(key_file_content)
creds = Credentials(
context = VirgilContext(
virgil = Virgil(context=context)
- Import a Virgil Card from its string representation.
# import a Virgil Card from string
alice_card = virgil.cards.import_card(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.