Giter VIP home page Giter VIP logo

zkid-sdk's Introduction

zkid-sdk license

zkid-sdk

This repo implements zkID protocol such as: did protocol, vc protocol, and some utilities.

For more information about DID and VC, please visit DID-official W3C specification, VC-official W3C specification

overview

This repository is split up into a number of internal packages.

protocol implement of DID and VC.

Package Stable Beta Size
@zcloak/ctype npm beta minzip
@zcloak/did npm beta minzip
@zcloak/did-resolver npm beta minzip
@zcloak/vc npm beta minzip

wasm utility, crypto utility, and the keyring of manage keys.

Package Stable Beta Size
@zcloak/crypto npm beta minzip
@zcloak/keyring npm beta minzip
@zcloak/wasm npm beta minzip
@zcloak/wasm-asm npm beta minzip
@zcloak/wasm-bridge npm beta minzip

some packages of the protocol

Package Stable Beta Size
@zcloak/message npm beta minzip
@zcloak/verify npm beta minzip

zkid-login protocol

This library exposes methods for dapps to interact with wallets for @zcloak/login, provides providers and verify. For complete documentation around the verify, providers and their use, visit the documentation portal.

Package Stable Beta Size
@zcloak/login-rpc npm beta minzip
@zcloak/login-rpc-defines npm beta minzip
@zcloak/login-providers npm beta minzip
@zcloak/login-did npm beta minzip
@zcloak/login-verify npm beta minzip

CONTRIBUTING

See CONTRIBUTING.md

zkid-sdk's People

Contributors

actions-user avatar dejavukong avatar github-actions[bot] avatar jonathanxuu avatar linhan-work avatar whgreate avatar zzcwoshizz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

zkid-sdk's Issues

Upgrade: VC version upgrade, PublicVC involved

Abstract:

Based on the existing VC, we are happy to prepare an upgrade (from VC version 0 to version 1) that will introduce 'PublicVC', which is simpler and more suitable for public information presentation. PublicVC still retains the most important MerkleTree structure and hash method to ensure the security of attestation and presentation.

This release plans to:

  1. Offer PublicVC. For entities to store data which can be made public. This kind of VC is more concise and the data size is much smaller;
  2. Improve the data signing system to provide greater security for users;
  3. Improve parts of VC structure to expand application scenarios and achieve higher security;

Upgrade1: Public VC

Background

In terms of usage scenarios, there are many occasions that need to disclose VC, we call the VC that can be made public/published in public storage as 'PublicVC'.

As a result, structures such as nonceMap for privacy are redundant in such public scenario. If stored on-chain, nonceMap will also take up additional storage overhead. So we offer PublicVC which discards nonceMap to save such overhead.

Users should give priority to using PublicVC when dealing with publicly available data, which can greatly reduce the storage space and facilitate the transfer of credentials.

Solution

Compared to the VC before, PublicVC doesn't have the nonceMap structure(The only difference).

Entity that use PublicVC doesn't need to use 'zero-knowledge proof' (because all data is publicly available), so there's no need of using nonceMap in such PublicVC.

You can think of nonceMap as a protection for data privacy, once the data can be made public, then there's no need for the structure anymore.

Upgrade2: Data Signing

Background

Currently, there is no review mechanism(censorship) for the message to be signed. If the signed message is a malicious act (such as forging a transaction, etc.), then the users may lose their assets.

Solution(WIP)

In order to standardize the signature system, once users need to sign messages that is received from others, a reliable mechanism should be adopted to ensure the security of the signature. Here, we are planning to use standard like EIP-191 or other.

The final solution is still WIP, need another issue to track the Data Signing Solution.

Upgrade3: DigestHash Calculation

Background

For some issuance-time-sensitive VC(for a permanent VC, what we care is when the VC is issued rather than its expiration time, because some VC never expire), we will include issuanceDate into DigestHash's calculation to prevent faking of issuance time.

Solution

Add issuanceDate into the calculation of DigestHash, so the DigestHash calculation involves:

  1. rootHash: the rootHash of the VC
  2. holder:the DidUrl of the holder, which usually started with 'zk::did::'
  3. issuanceDate: the issuance time of this VC, represented in timestamp
  4. expirationDate: the expiration time of this VC, represented in timestamp
  5. ctype: the ctype of the VC
export function calcDigest(
  payload: DigestPayload,
  hashType: HashType = DEFAULT_DIGEST_HASH_TYPE
): DigestResult {
  const encoded = u8aConcat(
    payload.rootHash,
    stringToU8a(payload.holder),
    numberToU8a(payload.issuanceDate),
    numberToU8a(payload.expirationDate),
    payload.ctype
  );

Due to the upgrade above, we plan to update VC version 0 to version 1.

Perhaps, there are some important updates not mentioned here. But we'll keep tracking. If you have any comments and suggestions, please feel free to make them.

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.