GithubHelp home page GithubHelp logo

digitalcredentials / ed25519-verification-key-2020 Goto Github PK

View Code? Open in Web Editor NEW

This project forked from digitalbazaar/ed25519-verification-key-2020

1.0 1.0 2.0 168 KB

Typescript/Javascript library for generating and working with Ed25519VerificationKey2020 key pairs, for use with VCs and DIDs.

License: BSD 3-Clause "New" or "Revised" License

JavaScript 4.40% TypeScript 95.60%

ed25519-verification-key-2020's People

Stargazers

 avatar

Watchers

 avatar  avatar

Forkers

animo diwala

ed25519-verification-key-2020's Issues

toJWK fails to be imported by JOSE lib

Hi! Im using this library to support 2020 version of ed25519 keys.

Problem

Im using, https://www.npmjs.com/package/jose, where I import a JWK https://github.com/panva/jose/blob/HEAD/docs/functions/key_import.importJWK.md#readme to do JOSE work.

But this current library, which has a toJWK method on the privateKey, fails to be imported by the JOSE lib.

Before this call to toJWK, i do run the .from on a rawKeyJson that looks like this:

{
  id: "#Mkfxwd3x",
  controller: "did:peer:2.Vz6Mkfxwd3xWMeSvsgiU2MuAyshy5rXyWW1e3rDnUg1vCs2o3.SeyJpZCI6IiNkaWRjb21tIiwidCI6ImRtIiwicyI6Imh0dHBzOi8vZGV2LW9wZW4tbWVzc2FnZXMtYXBpLWx0aDRnb3dkeXEtZXcuYS5ydW4uYXBwL21lc3NhZ2VzIiwiYSI6WyJkaWRjb21tL3YyIl19",
  type: "Ed25519VerificationKey2020",
  publicKeyMultibase: "z6Mkfxwd3xWMeSvsgiU2MuAyshy5rXyWW1e3rDnUg1vCs2o3",
  privateKeyMultibase: "zrv33yPZvxDNqgEibiNh7WsiJtwPKbFDqm3LZMkTZZqAKD2oNgc5R8XbhGZsEwCV32cFUmjWLmiSTsrvvqetXyDA4zu",
}

Here is the key im able to produce by using toJsonWebKey2020 and toJWK and combine it a JWK with privatekey. Then its alos the private key value im testing with.

{
  "@context": "https://w3id.org/security/jws/v1",
  id: "did:peer:2.Vz6Mkfxwd3xWMeSvsgiU2MuAyshy5rXyWW1e3rDnUg1vCs2o3.SeyJpZCI6IiNkaWRjb21tIiwidCI6ImRtIiwicyI6Imh0dHBzOi8vZGV2LW9wZW4tbWVzc2FnZXMtYXBpLWx0aDRnb3dkeXEtZXcuYS5ydW4uYXBwL21lc3NhZ2VzIiwiYSI6WyJkaWRjb21tL3YyIl19#uBei8Do8DTpJEEXR7ikQLYin_4KRt4NPSMRO5ZJWSc0",
  type: "JsonWebKey2020",
  controller: "did:peer:2.Vz6Mkfxwd3xWMeSvsgiU2MuAyshy5rXyWW1e3rDnUg1vCs2o3.SeyJpZCI6IiNkaWRjb21tIiwidCI6ImRtIiwicyI6Imh0dHBzOi8vZGV2LW9wZW4tbWVzc2FnZXMtYXBpLWx0aDRnb3dkeXEtZXcuYS5ydW4uYXBwL21lc3NhZ2VzIiwiYSI6WyJkaWRjb21tL3YyIl19",
  privateKeyJwk: {
    crv: "Ed25519",
    kty: "OKP",
    x: "FnZHtzuBabRCjqhH6lcyC5XS2eOdJ9sMhJmMYVNq-7I",
    d: "eMu1bCoSfNOYcqe32lnm7_47MONTWY82mzdHg5JzewEWdke3O4FptEKOqEfqVzILldLZ450n2wyEmYxhU2r7sg",
  },
  publicKeyJwk: {
    crv: "Ed25519",
    kty: "OKP",
    x: "FnZHtzuBabRCjqhH6lcyC5XS2eOdJ9sMhJmMYVNq-7I",
  },
}

The error im getting from JOSE lib is

Error: error:1010A066:elliptic curve routines:ecx_key_op:invalid encoding

My expectations

Be able to export from this library and import JWK into JOSE lib.
Have encoding to work properly

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.