virto-connect
  • GETTING STARTED
    • Introduction
    • Requirements and Infrastructure
    • Quick Start Guide
    • Local Testing
  • Basics
    • virto-connect Component
    • Low-level SDK
  • API
    • Vos Mock
  • Resources
    • Adittional resources
Powered by GitBook
On this page
  1. API

Vos Mock

PreviousAPINextAdittional resources

VOS mock authentication API

Health check endpoint

get
Responses
200
Service is healthy
application/json
503
Service is unhealthy
get
GET /api/health HTTP/1.1
Host: 
Accept: */*
{
  "status": "ok",
  "timestamp": "2023-09-28T12:00:00Z",
  "service": "vos-mock"
}

Initialize WebAuthn registration process

get
Query parameters
idstringRequired

User ID

Example: test
namestringOptional

User display name (defaults to id if not provided)

Example: Test
Responses
200
Registration initialization successful, returns attestation options
application/json
400
Bad request - Invalid or missing user data
500
Internal server error
get
GET /api/attestation?id=test HTTP/1.1
Host: 
Accept: */*
{
  "publicKey": {
    "rp": {
      "name": "Example RP"
    },
    "user": {
      "id": [
        240,
        228,
        194,
        247,
        108,
        88,
        145,
        110,
        194,
        88,
        242,
        70,
        133,
        27,
        234,
        9,
        29,
        20,
        212,
        36,
        122,
        47,
        195,
        225,
        134,
        148,
        70,
        27,
        24,
        22,
        225,
        59
      ],
      "name": "test",
      "displayName": "test"
    },
    "challenge": "0x01d3f2ddb53e97c40a6b849f9c9258438fa40df3df34aa9028e5667e8a73721c",
    "pubKeyCredParams": [
      {
        "type": "public-key",
        "alg": -7
      }
    ],
    "authenticatorSelection": {
      "userVerification": "preferred"
    },
    "timeout": 60000,
    "attestation": "none"
  },
  "blockNumber": 1107519
}

Initialize WebAuthn authentication process

get
Query parameters
userIdstringRequired

User ID for which to generate authentication assertion

Example: test
Responses
200
Authentication initialization successful, returns assertion options
application/json
400
Bad request - User ID is required or User data not found
500
Internal server error
get
GET /api/assertion?userId=test HTTP/1.1
Host: 
Accept: */*
{
  "publicKey": {
    "challenge": "0xd9c7d5339e935d1ef6b44949972ef5aaa373cd29ba16beb5edcc93acd9ce9667",
    "allowCredentials": [
      {
        "id": "yLbgoD7WL6UXBHpj5SZIOQw35XNk6z4Bz3BLSquG2HI",
        "type": "public-key",
        "transports": [
          "usb",
          "internal"
        ]
      }
    ],
    "userVerification": "preferred",
    "timeout": 60000
  },
  "blockNumber": 1107521
}

Check if a user is registered with WebAuthn

get
Query parameters
userIdstringRequired

User ID to check if registered

Example: test
Responses
200
Check completed successfully
application/json
400
Bad request - Missing required parameters
500
Internal server error
get
GET /api/check-user-registered?userId=test HTTP/1.1
Host: 
Accept: */*
{
  "ok": true
}
  • GETHealth check endpoint
  • GETInitialize WebAuthn registration process
  • POSTComplete WebAuthn registration process
  • GETInitialize WebAuthn authentication process
  • POSTComplete WebAuthn authentication process
  • GETCheck if a user is registered with WebAuthn

Complete WebAuthn registration process

post
Body
userIdstringRequired

User ID

Example: test
blockNumbernumberRequired

Blockchain block number from the attestation request

Example: 1107519
Responses
200
Registration completed successfully
application/json
400
Bad request - Missing required parameters
500
Internal server error
post
POST /api/register HTTP/1.1
Host: 
Content-Type: application/json
Accept: */*
Content-Length: 783

{
  "userId": "test",
  "attestationResponse": {
    "id": "yLbgoD7WL6UXBHpj5SZIOQw35XNk6z4Bz3BLSquG2HI",
    "rawId": "yLbgoD7WL6UXBHpj5SZIOQw35XNk6z4Bz3BLSquG2HI",
    "type": "public-key",
    "response": {
      "authenticatorData": "SZYN5YgOjGh0NBcPZHZgW4_krrmihjLHmVzzuoMdl2NBAAAAAQAAAAAAAAAAAAAAAAAAAAAAIMi24KA-1i-lFwR6Y-UmSDkMN-VzZOs-Ac9wS0qrhthypQECAyYgASFYID57cUySgqw4bWodA5jLfVWGG55NfoHZ4_kc6rypYr1WIlgg_DAzXqVKpUTg95LctxL7274k4V7k31yuTKYSCjEGRhE",
      "clientDataJSON": "eyJ0eXBlIjoid2ViYXV0aG4uY3JlYXRlIiwiY2hhbGxlbmdlIjoiQWRQeTNiVS1sOFFLYTRTZm5KSllRNC1rRGZQZk5LcVFLT1ZtZm9wemNodyIsIm9yaWdpbiI6Imh0dHA6Ly9sb2NhbGhvc3Q6ODA4NSIsImNyb3NzT3JpZ2luIjpmYWxzZX0",
      "publicKey": "MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEPntxTJKCrDhtah0DmMt9VYYbnk1-gdnj-RzqvKlivVb8MDNepUqlROD3kty3EvvbviThXuTfXK5MphIKMQZGEQ"
    }
  },
  "blockNumber": 1107519
}
{
  "ext": "0xd107040600f0e4c2f76c58916ec258f246851bea091d14d4247a2fc3e18694461b1816e13b006b726569766f5f700000000000000000000000000000000000000000000000000e5751c026e543b2e8ab2eb06099daa1d1e5df47778f7787faab45cdf12fe3a83fe61000910249960de5880e8c687434170f6476605b8fe4aeb9a28632c7995cf3ba831d97634100000001000000000000000000000000000000000020c8b6e0a03ed62fa517047a63e52648390c37e57364eb3e01cf704b4aab86d872a50102032620012158203e7b714c9282ac386d6a1d0398cb7d55861b9e4d7e81d9e3f91ceabca962bd56225820fc30335ea54aa544e0f792dcb712fbdbbe24e15ee4df5cae4ca6120a3106461125027b2274797065223a22776562617574686e2e637265617465222c226368616c6c656e6765223a22416450793362552d6c38514b613453666e4a4a5951342d6b446650664e4b71514b4f566d666f707a636877222c226f726967696e223a22687474703a2f2f6c6f63616c686f73743a38303835222c2263726f73734f726967696e223a66616c73657d3059301306072a8648ce3d020106082a8648ce3d030107034200043e7b714c9282ac386d6a1d0398cb7d55861b9e4d7e81d9e3f91ceabca962bd56fc30335ea54aa544e0f792dcb712fbdbbe24e15ee4df5cae4ca6120a31064611",
  "address": "alsdkfjalsdjkf"
}

Complete WebAuthn authentication process

post
Body
userIdstringRequired

User ID

Example: test
blockNumbernumberRequired

Blockchain block number from the assertion request

Example: 1107521
Responses
200
Authentication completed successfully
application/json
400
Bad request - Missing required parameters or User data not found
500
Internal server error
post
POST /api/connect HTTP/1.1
Host: 
Content-Type: application/json
Accept: */*
Content-Length: 725

{
  "userId": "test",
  "assertionResponse": {
    "id": "yLbgoD7WL6UXBHpj5SZIOQw35XNk6z4Bz3BLSquG2HI",
    "rawId": "yLbgoD7WL6UXBHpj5SZIOQw35XNk6z4Bz3BLSquG2HI",
    "type": "public-key",
    "response": {
      "authenticatorData": "SZYN5YgOjGh0NBcPZHZgW4_krrmihjLHmVzzuoMdl2MBAAAAAg",
      "clientDataJSON": "eyJ0eXBlIjoid2ViYXV0aG4uZ2V0IiwiY2hhbGxlbmdlIjoiMmNmVk01NlRYUjcydEVsSmx5NzFxcU56elNtNkZyNjE3Y3lUck5uT2xtYyIsIm9yaWdpbiI6Imh0dHA6Ly9sb2NhbGhvc3Q6ODA4NSIsImNyb3NzT3JpZ2luIjpmYWxzZSwib3RoZXJfa2V5c19jYW5fYmVfYWRkZWRfaGVyZSI6ImRvIG5vdCBjb21wYXJlIGNsaWVudERhdGFKU09OIGFnYWluc3QgYSB0ZW1wbGF0ZS4gU2VlIGh0dHBzOi8vZ29vLmdsL3lhYlBleCJ9",
      "signature": "MEQCIBADT7Cz8Lk9hb8NR6EoQDEutSeBBsO5Qm_7kMtyu5nVAiBZHLwvgo4K72PIGwNklpef7bCjbfk1HXijpGBL0lFG-g"
    }
  },
  "blockNumber": 1107521
}
{
  "command": {
    "url": "ws://localhost:12281/pass/authenticate",
    "body": [
      "0x0e5751c026e543b2e8ab2eb06099daa1d1e5df47778f7787faab45cdf12fe3a8",
      {
        "webAuthn": {
          "meta": {
            "authorityId": "0x6b726569766f5f70000000000000000000000000000000000000000000000000",
            "userId": "0xf0e4c2f76c58916ec258f246851bea091d14d4247a2fc3e18694461b1816e13b",
            "context": 1107521
          },
          "authenticatorData": "0x49960de5880e8c687434170f6476605b8fe4aeb9a28632c7995cf3ba831d97630100000002",
          "clientData": "0x7b2274797065223a22776562617574686e2e676574222c226368616c6c656e6765223a22326366564d3536545852373274456c4a6c79373171714e7a7a536d364672363137637954724e6e4f6c6d63222c226f726967696e223a22687474703a2f2f6c6f63616c686f73743a38303835222c2263726f73734f726967696e223a66616c73652c226f746865725f6b6579735f63616e5f62655f61646465645f68657265223a22646f206e6f7420636f6d7061726520636c69656e74446174614a534f4e20616761696e737420612074656d706c6174652e205365652068747470733a2f2f676f6f2e676c2f796162506578227d",
          "signature": "0x3044022010034fb0b3f0b93d85bf0d47a12840312eb5278106c3b9426ffb90cb72bb99d50220591cbc2f828e0aef63c81b036496979fedb0a36df9351d78a3a4604bd25146fa"
        }
      },
      null
    ],
    "hex": "0x06030e5751c026e543b2e8ab2eb06099daa1d1e5df47778f7787faab45cdf12fe3a8006b726569766f5f70000000000000000000000000000000000000000000000000f0e4c2f76c58916ec258f246851bea091d14d4247a2fc3e18694461b1816e13b41e610009449960de5880e8c687434170f6476605b8fe4aeb9a28632c7995cf3ba831d97630100000002cd037b2274797065223a22776562617574686e2e676574222c226368616c6c656e6765223a22326366564d3536545852373274456c4a6c79373171714e7a7a536d364672363137637954724e6e4f6c6d63222c226f726967696e223a22687474703a2f2f6c6f63616c686f73743a38303835222c2263726f73734f726967696e223a66616c73652c226f746865725f6b6579735f63616e5f62655f61646465645f68657265223a22646f206e6f7420636f6d7061726520636c69656e74446174614a534f4e20616761696e737420612074656d706c6174652e205365652068747470733a2f2f676f6f2e676c2f796162506578227d19013044022010034fb0b3f0b93d85bf0d47a12840312eb5278106c3b9426ffb90cb72bb99d50220591cbc2f828e0aef63c81b036496979fedb0a36df9351d78a3a4604bd25146fa00"
  }
}