Skip to content

walt-id/waltid-examples

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

77 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

Website โ€ข Documentation โ€ข GitHub โ€ข Discord

About

How to use walt.id libs in Kotlin and Java

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

โšก