mattrglobal / bls12381-key-pair

A library for using BLS 12-381 key pairs
Apache License 2.0
15 stars 10 forks source link

Implement support for Bls12381G1 KeyPair #15

Open tplooker opened 4 years ago

tplooker commented 4 years ago

Some BLS and BBS signatures will involve the usage of a public key in G1, hence support should be added

tplooker commented 3 years ago

All of the APIs are now exposed in bbs-signatures

tplooker commented 3 years ago

The functionality in Bls12381G2KeyPair essentially needs to be replicated in the context of G1

kdenhartog commented 3 years ago

26 got most of this done. There still remains some work to finish this which depends on https://github.com/mattrglobal/bbs-signatures/issues/52 to finish

OR13 commented 3 years ago

@tplooker @kdenhartog bump on this :)

unstable says "Not Implemented"

kdenhartog commented 3 years ago

We've got support for the representation at this point, but not the usage (signer and verifier functions which were temporarily deleted in #26). Some of the Rust code still needs to be updated so we can use the G1 keypairs with the BBS Signatures which is why the unstable release still shows as "Not Implemented" (assuming I understand what you're referring to correctly).

I think in the thick of it this work got de-prioritized at the moment while we're working through some of the other related issues with contexts at the higher layers. We'll eventually get around to finishing it up, but if you've got an immediate need for it happy to review PRs and help get it through for you.

OR13 commented 3 years ago

I don't have a use for it until we have a plan for it in https://github.com/w3c-ccg/ldp-bbs2020

I added support for both key pairs to did key over the weekend, here is a demo:

https://did.key.transmute.industries/did:key:z5TcEfyF1iXbRR3CEWmce569adi4JUCBXa7zKriHTTapk9m21APZbJXprWwBjKrNAeAs2XeYusP1nsqeeAXjg1mRGYkimTkpzT5Gj6QPUjkyfWexyowYA7iw3RCksysMRpijeh1mWxzbXAGHvYNwvwAEgm78KqDwUVexuqEoYYPuBAyE5rAcH7v8b3uggTLUmQNNSJ4Tp

{
  "@context": [
    "https://www.w3.org/ns/did/v1",
    {
      "@base": "did:key:z5TcEfyF1iXbRR3CEWmce569adi4JUCBXa7zKriHTTapk9m21APZbJXprWwBjKrNAeAs2XeYusP1nsqeeAXjg1mRGYkimTkpzT5Gj6QPUjkyfWexyowYA7iw3RCksysMRpijeh1mWxzbXAGHvYNwvwAEgm78KqDwUVexuqEoYYPuBAyE5rAcH7v8b3uggTLUmQNNSJ4Tp"
    }
  ],
  "id": "did:key:z5TcEfyF1iXbRR3CEWmce569adi4JUCBXa7zKriHTTapk9m21APZbJXprWwBjKrNAeAs2XeYusP1nsqeeAXjg1mRGYkimTkpzT5Gj6QPUjkyfWexyowYA7iw3RCksysMRpijeh1mWxzbXAGHvYNwvwAEgm78KqDwUVexuqEoYYPuBAyE5rAcH7v8b3uggTLUmQNNSJ4Tp",
  "verificationMethod": [
    {
      "id": "#z3tEGEgLVT26ULshZDW1tz6LnRNm4jGsnoiCRDxLgS3PArtULQz72oTaCUj3ySfJfCiB8b",
      "controller": "did:key:z5TcEfyF1iXbRR3CEWmce569adi4JUCBXa7zKriHTTapk9m21APZbJXprWwBjKrNAeAs2XeYusP1nsqeeAXjg1mRGYkimTkpzT5Gj6QPUjkyfWexyowYA7iw3RCksysMRpijeh1mWxzbXAGHvYNwvwAEgm78KqDwUVexuqEoYYPuBAyE5rAcH7v8b3uggTLUmQNNSJ4Tp",
      "type": "JsonWebKey2020",
      "publicKeyJwk": {
        "kty": "EC",
        "crv": "BLS12381_G1",
        "x": "rKYC5xKLYiqwmalS3AI0XxSFExCwfwzoa3ku8lwIVypGoZS9I5IXC8r65ra1-eU4"
      }
    },
    {
      "id": "#zUC73goUoJWFuBFidjGu1VJyyy9Yh1TJzuvU4UPsXDGYSaTKKfGwnEtXTLDEKsfF8WegFPaGop1EJgi7yP3rHoL8jBQksc2vr6KTsCrDu6KpPTSyJS4S66rzUydCYtZe3Bg46fY",
      "controller": "did:key:z5TcEfyF1iXbRR3CEWmce569adi4JUCBXa7zKriHTTapk9m21APZbJXprWwBjKrNAeAs2XeYusP1nsqeeAXjg1mRGYkimTkpzT5Gj6QPUjkyfWexyowYA7iw3RCksysMRpijeh1mWxzbXAGHvYNwvwAEgm78KqDwUVexuqEoYYPuBAyE5rAcH7v8b3uggTLUmQNNSJ4Tp",
      "type": "JsonWebKey2020",
      "publicKeyJwk": {
        "kty": "EC",
        "crv": "BLS12381_G2",
        "x": "iABvXhR41dnp06OEhB8fTSaCTVtpXw-ROd3tGIZ5V5BMEXZpQ9YUt8aNKTCGruV5AV8RvTqpouV2bpDcLgJh6__xn-vZIq3J0JyOhgH58rFGxSrv4iIUMJSypy6VkCGX"
      }
    }
  ],
  "authentication": [
    "#z3tEGEgLVT26ULshZDW1tz6LnRNm4jGsnoiCRDxLgS3PArtULQz72oTaCUj3ySfJfCiB8b",
    "#zUC73goUoJWFuBFidjGu1VJyyy9Yh1TJzuvU4UPsXDGYSaTKKfGwnEtXTLDEKsfF8WegFPaGop1EJgi7yP3rHoL8jBQksc2vr6KTsCrDu6KpPTSyJS4S66rzUydCYtZe3Bg46fY"
  ],
  "assertionMethod": [
    "#z3tEGEgLVT26ULshZDW1tz6LnRNm4jGsnoiCRDxLgS3PArtULQz72oTaCUj3ySfJfCiB8b",
    "#zUC73goUoJWFuBFidjGu1VJyyy9Yh1TJzuvU4UPsXDGYSaTKKfGwnEtXTLDEKsfF8WegFPaGop1EJgi7yP3rHoL8jBQksc2vr6KTsCrDu6KpPTSyJS4S66rzUydCYtZe3Bg46fY"
  ],
  "capabilityInvocation": [
    "#z3tEGEgLVT26ULshZDW1tz6LnRNm4jGsnoiCRDxLgS3PArtULQz72oTaCUj3ySfJfCiB8b",
    "#zUC73goUoJWFuBFidjGu1VJyyy9Yh1TJzuvU4UPsXDGYSaTKKfGwnEtXTLDEKsfF8WegFPaGop1EJgi7yP3rHoL8jBQksc2vr6KTsCrDu6KpPTSyJS4S66rzUydCYtZe3Bg46fY"
  ],
  "capabilityDelegation": [
    "#z3tEGEgLVT26ULshZDW1tz6LnRNm4jGsnoiCRDxLgS3PArtULQz72oTaCUj3ySfJfCiB8b",
    "#zUC73goUoJWFuBFidjGu1VJyyy9Yh1TJzuvU4UPsXDGYSaTKKfGwnEtXTLDEKsfF8WegFPaGop1EJgi7yP3rHoL8jBQksc2vr6KTsCrDu6KpPTSyJS4S66rzUydCYtZe3Bg46fY"
  ]
}