SchnorrSecp256k1Signature2019

View on GitHub

CI

Relies on bitcoin-ts for secp256k1 crypto.

Relies on jsonld-signatures for jsonld operations. Some of the javascript from that repo needed to be converted to typescript to get this module to build properly, I have retained the copyrights on source files.

Relies on undrafted / unoffical JWS alg:

JOSE Alg COSE Alg Value Description Recommended
SS256K TBD (requested assignment -48) Schnorr signature using secp256k1 curve and SHA-256 Yes

JSON-LD 1.1 is being formally specified in the W3C JSON-LD Working Group. To participate in this work, please join the W3C and then join the Working Group.

Suite Details

Per ld-signatures, this Signature Suite defines the following:

{
  "id": "https://identity.foundation/SchnorrSecp256k1Signature2019#SchnorrSecp256k1Signature2019",
  "type": "SignatureSuite",
  "canonicalizationAlgorithm": "https://w3id.org/security#URDNA2015",
  "digestAlgorithm": "https://www.ietf.org/assignments/jwa-parameters#SHA256",
  "signatureAlgorithm": "https://tools.ietf.org/html/rfc7515"
}

Terminology

SS256K

This suite uses detached JWS using alg “SS256K” an unregistered, experimental Schnorr over secp256k1. Please review the details below.

SS256K is just ES256K but uses Schnorr instead of ECDSA.

The detached JWS must have the following header:

{
  "alg": "SS256K",
  "b64": false,
  "crit": ["b64"]
}

SchnorrSecp256k1Signature2019

This is what a proof with SchnorrSecp256k1Signature2019 looks like:

{
  "type": "SchnorrSecp256k1Signature2019",
  "created": "2020-04-11T21:07:06Z",
  "verificationMethod": "did:example:123#vm-3",
  "proofPurpose": "assertionMethod",
  "jws": "eyJhbGciOiJFUzI1NkstUiIsImI2NCI6ZmFsc2UsImNyaXQiOlsiYjY0Il19..pp9eiLCMfN4EfSB3cbl3UxJ4TtgUaTfByDaaB6IZbXsnvIy5AUIFjbgaiFNtq9-3f8mP7foD_HXpjrdWZfzlwAE"
}

Local Development

This project was bootstrapped with TSDX.

Below is a list of commands you will probably find useful.

npm start or yarn start

Runs the project in development/watch mode. Your project will be rebuilt upon changes. TSDX has a special logger for you convenience. Error messages are pretty printed and formatted for compatibility VS Code’s Problems tab.

Your library will be rebuilt if you make edits.

npm run build or yarn build

Bundles the package to the dist folder. The package is optimized and bundled with Rollup into multiple formats (CommonJS, UMD, and ES Module).

npm test or yarn test

Runs the test watcher (Jest) in an interactive mode. By default, runs tests related to files changed since the last commit.