Giter VIP home page Giter VIP logo

sd-jwt-ts's Introduction

Selective Disclosure JWT (SD-JWT) Draft 06 & Selective Disclosure JWT VC 01

Compliant with

Design decisions

Bring your own crypto

This library does not provide any of the cryptographic primitives required for encryption, decryption, signing, verification and hashing. It is expected that the user of this library provides this. The main reason for this is that most libraries have their own library and KMS. Providing private keys to this library adds another layer of insecurity which should be avoided. Hashing has not been added for platform compatibility between node,js, browser and React Native. In the future a platform-independent sha2-256 may be provided.

Specification backwards compatibility

Since these specifications are in early drafts, no time will be spend in supporting earlier versions of the specifications. This library may work for older versions, e.g. the addition of selectively disclosable items in an array does not break previous implementations. Once a non-draft specification is released it will stay up-to-date with that version.

Dependencies

This library only has one dependency on buffer which makes sure this library works in Node.js, the browser and React Native. Buffer is used internally for base64-url-no-pad encoding.

Usage

I'd highly recommend to check out the examples folder to see how this library can be leveraged.

Issuance API

The issuance API takes an object called a disclosureFrame. This disclosureFrame is a Boolean Map of the payload which allows you to specify which attributes of the payload may be selectively disclosed. If an attribute is not provided in the disclosureFrame, it will be included in the clear-text payload. For example:

// The payload
{
    "iss": "https://example.org/issuer",
    "is_age_over_21": true,
    "is_age_over_24": true,
    "is_age_over_65": false,
    "date_of_birth": "1990-01-01",
    "address": {
        "street": "some street",
        "house_number": 200,
        "zipcode": "2344GH"
    }
}
// The disclosure frame
{
    "is_age_over_21": true,
    "is_age_over_24": true,
    "is_age_over_65": true,
    "date_of_birth": true,
    "address": {
        "street": true,
        "house_number": true,
        "zipcode": true
    }
}

// or to only disclose the address as a group
{
    "is_age_over_21": true,
    "is_age_over_24": true,
    "is_age_over_65": true,
    "date_of_birth": true,
    "address": true
}

Presentation and verification API

Since there is officially standardized way to request and present a presentation, High Assurance Interoperability Profile may be used, the API is defined in a way which works in a primitive manner for now. For example, to present you can provide a list of indices of the disclosures which will be included. Examples of this can be found in the examples folder. For verification a list of keys or required claims can be provided. It does not matter whether these are selectively disclosable claims, or if they are included inside the payload.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.