For the complete documentation index, see llms.txt. This page is also available as Markdown.

LearnCard CLI

LearnCard CLI is an easy to use node REPL that instantiates a Learn Card wallet for you and gives you all the tools you need to easily play around with the Learn Card SDK!

Usage

npx @learncard/cli

# Optionally specify a deterministic seed to instantiate the wallet with
npx @learncard/cli 1b498556081a298261313657c32d5d0a9ce8285dc4d659e6787392207e4a7ac2

Holder Continuity Export

The CLI also provides REPL helpers from @learncard/holder-continuity for holder-controlled continuity exports. These helpers create a standard ZIP with a readable manifest and encrypted payload files for keys, credentials, presentations, consent records, and status-list snapshots.

const password = await getLearnCardBundlePassword();

await exportLearnCardBundle(learnCard, {
    out: './learncard-export.zip',
    password,
});

const freshWallet = await initLearnCard({ seed: '0'.repeat(64), network: true });
await importLearnCardBundle('./learncard-export.zip', {
    password,
    wallet: freshWallet,
    verifyBeforeImport: true,
});

getLearnCardBundlePassword() prompts without echoing the password into the REPL, which avoids saving it in REPL history. You can still pass a password string directly for local scripts.

restoreLearnCardFromBundle(...) decrypts the exported seed and returns a wallet with the original DID. It does not upload bundle payloads or recreate index records; use importLearnCardBundle(...) when copying credentials into another wallet.

If you omit the first argument, the CLI exports the default learnCard wallet it created at startup:

Lower-level helpers are also available in the REPL:

For the data model and portability caveats, see Holder Continuity and the @learncard/holder-continuity package BUNDLE_SPEC.md.

Getting Started

Run npx @learncard/cli to boot up the CLI - you should see this screen in your terminal!

From within the CLI, you should be able to start playing around with a basic LearnCard. When the CLI boots up, it creates a default LearnCard called learnCard that you can interact with.

Basic Usage

View your wallet's DID

One of the easiest ways to interact with your LearnCard is to get its DID:

If your LearnCard is initialized to support more DID methods, such as did:web, you could retrieve the corresponding DID through this function.

Basic Verifiable Credential Issuance & Verification Flow

Once the CLI has booted up, you can start issuing credentials. Try a basic Verifiable Credential issuance and verification flow, for example:

Basic Verifiable Presentation Issuance & Verification Flow

Now, take the signedVerifiableCredential you created in the VC issuance flow above, and try wrapping it into a Verifiable Presentation, and verifying it.

Initialize more LearnCards

At any point, you can initialize additional LearnCards in the CLI, which can be helpful for testing cross-wallet flows:

Check out the docs on initializing LearnCards for more ways to create a LearnCard.

And beyond!

There is a ton of functionality exposed through the CLI. Explore the Usage Examples in LearnCard Wallet SDK:

Usage Examples

Last updated

Was this helpful?