Skip to content

walt-id/waltid-examples

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

75 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

walt.id Examples

walt.id Identity SDK Examples

Comprehensive examples and tutorials for the walt.id Identity SDK, covering cryptographic operations, DID management, and verifiable credentials.

Join community! Follow @walt_id License: Apache 2.0

📋 Table of Contents

🔧 Prerequisites

  • Java 11+ or Kotlin 1.8+
  • Gradle 7.0+ (or Maven 3.6+)
  • IDE (IntelliJ IDEA recommended)

🚀 Quick Start

  1. Clone the repository:

    git clone https://github.com/walt-id/waltid-examples.git
    cd waltid-examples
  2. Build the project:

    ./gradlew build
  3. Run all examples (Kotlin):

    ./gradlew run -PmainClass=RunAllKt
  4. Run all examples (Java):

    ./gradlew run -PmainClass=waltid.RunAll
  5. Run individual examples:

    # Generate cryptographic keys
    ./gradlew run -PmainClass=crypto.key.create.Ed25519Kt
    
    # Create a DID
    ./gradlew run -PmainClass=did.create.KeyKt
    
    # Sign a verifiable credential
    ./gradlew run -PmainClass=vc.jwt.SignKt

📁 Project Structure

waltid-examples/
├── src/main/
│   ├── kotlin/                    # Kotlin examples
│   │   ├── crypto/               # Cryptographic operations
│   │   │   ├── key/              # Key management
│   │   │   │   ├── create/       # Key generation
│   │   │   │   ├── decode/       # Key import (JWK, PEM, Raw)
│   │   │   │   └── encode/       # Key export (JWK, PEM, Raw)
│   │   │   └── signatures/       # Digital signatures
│   │   │       ├── jws/          # JSON Web Signatures
│   │   │       └── raw/          # Raw signatures
│   │   ├── did/                  # Decentralized Identifiers
│   │   │   ├── create/           # DID creation methods
│   │   │   └── resolve/          # DID resolution
│   │   ├── vc/                   # Verifiable Credentials
│   │   │   ├── jwt/              # JWT-based VCs
│   │   │   └── sdjwt/            # Selective Disclosure JWTs
│   │   └── vp/                   # Verifiable Presentations
│   └── java/                     # Java examples
│       └── waltid/               # Java implementation
└── build.gradle.kts               # Build configuration

📚 Available Examples

🔐 Cryptographic Operations

Feature Description Kotlin Java
Key Generation Create cryptographic keys (Ed25519, RSA, Secp256k1, Secp256r1) 📁 📄
Key Import Import keys from JWK, PEM, or raw formats 📁 📄
Key Export Export keys to various formats 📁 📄
Raw Signatures Sign and verify raw data 📁 📄
JWS Signatures JSON Web Signature operations 📁 📄

🆔 Decentralized Identifiers (DIDs)

Feature Description Kotlin Java
DID Creation Generate DIDs using various methods (did:key, did:web, did:jwk, did:cheqd) 📁 📄
DID Resolution Resolve DIDs to DID documents 📁 📄

🎫 Verifiable Credentials (VCs)

Feature Description Kotlin Java
JWT VCs Create and verify JWT-based verifiable credentials 📁 📄
SD-JWT VCs Selective disclosure JWT credentials 📁 📄

🎭 Verifiable Presentations (VPs)

Feature Description Kotlin Java
VP Operations Create and verify verifiable presentations 📁 📄

🏃‍♂️ Running Examples

Using Gradle

Run all examples:

# Kotlin version
./gradlew run -PmainClass=RunAllKt

# Java version  
./gradlew run -PmainClass=waltid.RunAll

Run specific examples:

# Key generation
./gradlew run -PmainClass=crypto.key.create.Ed25519Kt
./gradlew run -PmainClass=crypto.key.create.RSAKt

# DID operations
./gradlew run -PmainClass=did.create.KeyKt
./gradlew run -PmainClass=did.resolve.KeyKt

# Verifiable credentials
./gradlew run -PmainClass=vc.jwt.SignKt
./gradlew run -PmainClass=vc.sdjwt.SignKt

Using IDE

  1. IntelliJ IDEA:

    • Open the project
    • Navigate to any example file
    • Right-click and select "Run"
  2. VS Code:

    • Install Kotlin and Java extensions
    • Use the integrated terminal to run Gradle commands

Using Maven

If you prefer Maven, add the walt.id repository to your pom.xml:

<repositories>
    <repository>
        <id>walt.id</id>
        <url>https://maven.waltid.dev/releases</url>
    </repository>
</repositories>

✨ Key Features

  • 🔐 Multi-algorithm Support: Ed25519, RSA, Secp256k1, Secp256r1
  • 📦 Multiple Key Formats: JWK, PEM, Raw (Base58)
  • 🆔 DID Methods: did:key, did:web, did:jwk, did:cheqd
  • 🎫 VC Standards: JWT VCs, SD-JWT (Selective Disclosure)
  • 🎭 VP Support: Verifiable Presentations
  • 🌐 Cross-platform: Java and Kotlin implementations
  • 📚 Comprehensive: From basic key generation to complex credential workflows

📖 Documentation

🤝 Community

Connect with the walt.id community:

📄 License

This project is licensed under the Apache License, Version 2.0. See the LICENSE file for details.


Made with ❤️ by the walt.id team

WebsiteDocumentationGitHubDiscord

About

How to use walt.id libs in Kotlin and Java

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 9