Skip to content

Test API server that allows SD-JWT to be tested in multiple languages

Notifications You must be signed in to change notification settings

lukasjhan/sd-jwt-test-api

Repository files navigation

SD-JWT Testing API server

This is a simple API server to test the various SD-JWT library implementations in different languages.

See the standard of SD-JWT and SD-JWT VC

How to run

pnpm install

pnpm run dev

Server

Server will be running on localhost:5600

http://localhost:5600

How to Test?

Our Test API uses REST API to test the SD-JWT library implementation.

We provides variouse test cases to test.

  • issue
  • present
  • verify
  • decode

If you're familiar with Javascript(axios), you can reference the tester directory to see how to test the API.

APIs

Method Path Description
GET /keys return a ES256 JWK for sign and verify SD-JWT
GET /test-lists return a list of test cases, you can check the following {name} by using this API
GET /tests/issue/{name} return a test case for issue SD-JWT
GET /tests/present/{name} return a test case for present SD-JWT
GET /tests/verify/{name} return a test case for verify SD-JWT
GET /tests/decode/{name} return a test case for decode SD-JWT
POST /tests/issue/{name} test a result of {name} test of issue SD-JWT
POST /tests/present/{name} test a result of {name} test of present SD-JWT
POST /tests/verify/{name} test a result of {name} test of verify SD-JWT
POST /tests/decode/{name} test a result of {name} test of decode SD-JWT

Response Body format

  • GET /keys
{
  "results": {
    "publicKey": {
      "key_ops": ["verify"],
      "ext": true,
      "kty": "EC",
      "x": "lFvD07QYuu3fAnY2TGpzXiutOYDu0TF7H6Vv7QRcy1c",
      "y": "OW6zqImPZ48IQjdL-9kf-UqN1gn3YfjUudPhQMcAwEw",
      "crv": "P-256"
    },
    "privateKey": {
      "key_ops": ["sign"],
      "ext": true,
      "kty": "EC",
      "x": "lFvD07QYuu3fAnY2TGpzXiutOYDu0TF7H6Vv7QRcy1c",
      "y": "OW6zqImPZ48IQjdL-9kf-UqN1gn3YfjUudPhQMcAwEw",
      "crv": "P-256",
      "d": "nzRm-iT0fjlPrCrSBqnjgO2PrQO1V37l0ICvZr6CWHs"
    }
  }
}
  • GET /test-lists
{
  "results": {
    "apiList": [{"path": string, "method": "GET" | "POST"}]
  }
}
  • GET /tests/issue/{name}
{
  "results": {
    "claims": object,
    "disclosureFrame": object,
  }
}
  • POST /tests/issue/{name}
// body
{
  "answer": string // Input issued sd-jwt
}

// response
{
  "results": boolean
}
  • GET /tests/present/{name}
{
  "results": {
    "credential": object,
    "presentationFrame": object,
    "kb": object | undefined
  }
}
  • POST /tests/present/{name}
// body
{
  "answer": string // Input presented sd-jwt
}

// response
{
  "results": boolean
}
  • GET /tests/verify/{name}
{
  "results": {
    "credential": string,
  }
}
  • POST /tests/verify/{name}
// body
{
  "answer": boolean // whether the sd-jwt is valid or not
}

// response
{
  "results": boolean
}
  • GET /tests/decode/{name}
{
  "results": {
    "credential": string,
  }
}
  • POST /tests/decode/{name}
// body
{
  "answer": object // decoded claims of sd-jwt
}

// response
{
  "results": boolean
}

Docker

dockerHub : https://hub.docker.com/repository/docker/treeyoon/sd-jwt-test-api/general

docker run -p 5600:5600 treeyoon/sd-jwt-test-api:latest

How it works?

Thjs project is built using Hono: https://hono.dev/

About

Test API server that allows SD-JWT to be tested in multiple languages

Resources

Stars

Watchers

Forks

Packages

No packages published