Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@transmute/did-key-bls12381

Package Overview
Dependencies
Maintainers
3
Versions
57
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@transmute/did-key-bls12381 - npm Package Compare versions

Comparing version 0.2.1-unstable.18 to 0.2.1-unstable.19

src/__fixtures__/did.json

8

CHANGELOG.md

@@ -6,2 +6,10 @@ # Change Log

## 0.2.1-unstable.19 (2020-09-15)
**Note:** Version bump only for package @transmute/did-key-bls12381
## 0.2.1-unstable.18 (2020-09-14)

@@ -8,0 +16,0 @@

3

dist/Bls12381G2KeyPair.d.ts
import * as mattr from '@mattrglobal/bls12381-key-pair';
export declare class Bls12381G2KeyPair extends mattr.Bls12381G2KeyPair {
static generate(options: any): Promise<mattr.Bls12381G2KeyPair>;
static generate(options?: any): Promise<mattr.Bls12381G2KeyPair>;
static toKeyPair(key: any): any;
}

@@ -96,3 +96,3 @@ 'use strict';

var keyPair = bbsSignatures.generateBls12381KeyPair();
return Promise.resolve(new mattr.Bls12381G2KeyPair(_extends({}, options, {
return Promise.resolve(Bls12381G2KeyPair.from(_extends({}, options, {
privateKeyBase58: bs58.encode(keyPair.secretKey),

@@ -106,2 +106,20 @@ publicKeyBase58: bs58.encode(keyPair.publicKey)

Bls12381G2KeyPair.toKeyPair = function toKeyPair(key) {
var fingerprint = Bls12381G2KeyPair.fingerprintFromPublicKey({
publicKeyBase58: bs58.encode(key.publicKeyBuffer)
});
var kp = {
id: '#' + fingerprint,
type: 'Bls12381G2Key2020',
controller: "did:key:" + fingerprint,
publicKeyBase58: bs58.encode(key.publicKeyBuffer)
};
if (key.privateKeyBuffer) {
kp.privateKeyBase58 = bs58.encode(key.privateKeyBuffer);
}
return kp;
};
return Bls12381G2KeyPair;

@@ -108,0 +126,0 @@ }(mattr.Bls12381G2KeyPair);

@@ -1,2 +0,2 @@

"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,r=require("@mattrglobal/bls12381-key-pair"),t=require("bs58"),i=(e=t)&&"object"==typeof e&&"default"in e?e.default:e,n=require("@mattrglobal/bbs-signatures"),o=function(e){var r="did:key:"+e.fingerprint(),t="#"+e.fingerprint();return{"@context":["https://www.w3.org/ns/did/v1",{"@base":r}],id:r,publicKey:[{id:t,type:e.type,controller:r,publicKeyBase58:i.encode(e.publicKeyBuffer)}],authentication:[t],assertionMethod:[t],capabilityDelegation:[t],capabilityInvocation:[t]}},a={__proto__:null,keyToDidDoc:o,get:function(e){var t=void 0===e?{}:e,i=t.did,n=t.url;try{if(!(i=i||n))throw new TypeError('"did" must be a string.');var a=i.split("#")[0].split("did:key:").pop();return Promise.resolve(r.Bls12381G2KeyPair.fromFingerprint({fingerprint:a})).then((function(e){return o(e)}))}catch(e){return Promise.reject(e)}}};function s(){return(s=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e}).apply(this,arguments)}exports.Bls12381G2KeyPair=function(e){var i,o;function a(){return e.apply(this,arguments)||this}return o=e,(i=a).prototype=Object.create(o.prototype),i.prototype.constructor=i,i.__proto__=o,a.generate=function(e){try{var i=n.generateBls12381KeyPair();return Promise.resolve(new r.Bls12381G2KeyPair(s({},e,{privateKeyBase58:t.encode(i.secretKey),publicKeyBase58:t.encode(i.publicKey)})))}catch(e){return Promise.reject(e)}},a}(r.Bls12381G2KeyPair),exports.driver=a;
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,r=require("@mattrglobal/bls12381-key-pair"),t=require("bs58"),i=(e=t)&&"object"==typeof e&&"default"in e?e.default:e,n=require("@mattrglobal/bbs-signatures"),o=function(e){var r="did:key:"+e.fingerprint(),t="#"+e.fingerprint();return{"@context":["https://www.w3.org/ns/did/v1",{"@base":r}],id:r,publicKey:[{id:t,type:e.type,controller:r,publicKeyBase58:i.encode(e.publicKeyBuffer)}],authentication:[t],assertionMethod:[t],capabilityDelegation:[t],capabilityInvocation:[t]}},a={__proto__:null,keyToDidDoc:o,get:function(e){var t=void 0===e?{}:e,i=t.did,n=t.url;try{if(!(i=i||n))throw new TypeError('"did" must be a string.');var a=i.split("#")[0].split("did:key:").pop();return Promise.resolve(r.Bls12381G2KeyPair.fromFingerprint({fingerprint:a})).then((function(e){return o(e)}))}catch(e){return Promise.reject(e)}}};function c(){return(c=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e}).apply(this,arguments)}exports.Bls12381G2KeyPair=function(e){var r,i;function o(){return e.apply(this,arguments)||this}return i=e,(r=o).prototype=Object.create(i.prototype),r.prototype.constructor=r,r.__proto__=i,o.generate=function(e){try{var r=n.generateBls12381KeyPair();return Promise.resolve(o.from(c({},e,{privateKeyBase58:t.encode(r.secretKey),publicKeyBase58:t.encode(r.publicKey)})))}catch(e){return Promise.reject(e)}},o.toKeyPair=function(e){var r=o.fingerprintFromPublicKey({publicKeyBase58:t.encode(e.publicKeyBuffer)}),i={id:"#"+r,type:"Bls12381G2Key2020",controller:"did:key:"+r,publicKeyBase58:t.encode(e.publicKeyBuffer)};return e.privateKeyBuffer&&(i.privateKeyBase58=t.encode(e.privateKeyBuffer)),i},o}(r.Bls12381G2KeyPair),exports.driver=a;
//# sourceMappingURL=did-key-bls12381.cjs.production.min.js.map

@@ -89,3 +89,3 @@ import { Bls12381G2KeyPair as Bls12381G2KeyPair$1 } from '@mattrglobal/bls12381-key-pair';

var keyPair = generateBls12381KeyPair();
return Promise.resolve(new Bls12381G2KeyPair$1(_extends({}, options, {
return Promise.resolve(Bls12381G2KeyPair.from(_extends({}, options, {
privateKeyBase58: encode(keyPair.secretKey),

@@ -99,2 +99,20 @@ publicKeyBase58: encode(keyPair.publicKey)

Bls12381G2KeyPair.toKeyPair = function toKeyPair(key) {
var fingerprint = Bls12381G2KeyPair.fingerprintFromPublicKey({
publicKeyBase58: encode(key.publicKeyBuffer)
});
var kp = {
id: '#' + fingerprint,
type: 'Bls12381G2Key2020',
controller: "did:key:" + fingerprint,
publicKeyBase58: encode(key.publicKeyBuffer)
};
if (key.privateKeyBuffer) {
kp.privateKeyBase58 = encode(key.privateKeyBuffer);
}
return kp;
};
return Bls12381G2KeyPair;

@@ -101,0 +119,0 @@ }(Bls12381G2KeyPair$1);

@@ -5,3 +5,3 @@ {

"module": "dist/bls12381.esm.js",
"version": "0.2.1-unstable.18",
"version": "0.2.1-unstable.19",
"license": "Apache-2.0",

@@ -43,3 +43,3 @@ "main": "dist/index.js",

},
"gitHead": "82f8cab0113718226e8cbecd4d8674e85b4f0d5d"
"gitHead": "fcf71dc3697fe57d0f2b2216796955fbcbe23030"
}

@@ -7,5 +7,5 @@ import * as mattr from '@mattrglobal/bls12381-key-pair';

export class Bls12381G2KeyPair extends mattr.Bls12381G2KeyPair {
static async generate(options: any) {
static async generate(options?: any) {
const keyPair = generateBls12381KeyPair();
return new mattr.Bls12381G2KeyPair({
return Bls12381G2KeyPair.from({
...options,

@@ -16,2 +16,19 @@ privateKeyBase58: bs58.encode(keyPair.secretKey as Uint8Array),

}
static toKeyPair(key: any) {
const fingerprint = Bls12381G2KeyPair.fingerprintFromPublicKey({
publicKeyBase58: bs58.encode(key.publicKeyBuffer),
});
let kp: any = {
id: '#' + fingerprint,
type: 'Bls12381G2Key2020',
controller: `did:key:${fingerprint}`,
publicKeyBase58: bs58.encode(key.publicKeyBuffer),
};
if (key.privateKeyBuffer) {
kp.privateKeyBase58 = bs58.encode(key.privateKeyBuffer);
}
return kp;
}
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc