@transmute/did-key-common
Advanced tools
Comparing version 0.2.1-unstable.35 to 0.2.1-unstable.36
@@ -6,2 +6,10 @@ # Change Log | ||
## 0.2.1-unstable.36 (2021-04-14) | ||
**Note:** Version bump only for package @transmute/did-key-common | ||
## 0.2.1-unstable.35 (2021-02-11) | ||
@@ -8,0 +16,0 @@ |
@@ -136,3 +136,3 @@ 'use strict'; | ||
var didDocument = _extends({ | ||
'@context': ['https://www.w3.org/ns/did/v1', { | ||
'@context': ['https://www.w3.org/ns/did/v1', 'https://ns.did.ai/transmute/v1', { | ||
'@base': did | ||
@@ -139,0 +139,0 @@ }], |
@@ -1,2 +0,2 @@ | ||
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var r=e(require("base64url")),t=e(require("canonicalize"));function n(){return(n=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e}).apply(this,arguments)}var i={__proto__:null,createJws:function(e,n,i){try{var o=r.encode(t(i))+"."+r.encode(t(n));return Promise.resolve(e.sign(Buffer.from(o))).then((function(e){return o+"."+r.encode(Buffer.from(e))}))}catch(e){return Promise.reject(e)}},verifyJws:function(e,t){try{var n=t.split("."),i=n[2];return Promise.resolve(e.verify(Buffer.from(n[0]+"."+n[1]),r.toBuffer(i)))}catch(e){return Promise.reject(e)}},createDetachedJws:function(e,i,o){try{var c=r.encode(t(n({},o,{b64:!1,crit:["b64"]}))),a=new Uint8Array(Buffer.concat([Buffer.from(c,"utf-8"),Buffer.from(".","utf-8"),i]));return Promise.resolve(e.sign(Buffer.from(a))).then((function(e){var t=r.encode(Buffer.from(e));return c+".."+t}))}catch(e){return Promise.reject(e)}},verifyDetachedJws:function(e,t,n){try{var i=n.split(".."),o=i[1],c=new Uint8Array(Buffer.concat([Buffer.from(i[0],"utf-8"),Buffer.from(".","utf-8"),t]));return Promise.resolve(e.verify(Buffer.from(c),r.toBuffer(o)))}catch(e){return Promise.reject(e)}}},o=require("borc"),c=function(e,r){switch(void 0===r&&(r="application/did+ld+json"),r){case"application/did+json":case"application/did+cbor":return e.toJsonWebKeyPair();case"application/did+ld+json":return e.toKeyPair()}throw new Error("This implementation of did:key does not support: "+r)},a=["application/did+json","application/did+ld+json","application/did+cbor"],u=function(e,r){void 0===r&&(r="application/did+ld+json");try{var t=function(){return n({"@context":["https://www.w3.org/ns/did/v1",{"@base":i}],id:i},u)};if(-1===a.indexOf(r))throw new Error("Unsupported DID Document representation. "+r);var i="did:key:"+e.fingerprint(),o=c(e,r),u={verificationMethod:[o]};e.verifier&&(u=n({},u,{authentication:[o.id],assertionMethod:[o.id],capabilityInvocation:[o.id],capabilityDelegation:[o.id]})),e.deriveSecret&&(u=n({},u,{keyAgreement:[o.id]}));var f=function(){if("Ed25519VerificationKey2018"===e.type)return Promise.resolve(e.toX25519KeyPair(!1)).then((function(e){var t=c(e,r);u=n({},u,{verificationMethod:[].concat(u.verificationMethod,[t]),keyAgreement:[t.id]})}))}();return Promise.resolve(f&&f.then?f.then(t):t())}catch(e){return Promise.reject(e)}};exports.Jws=i,exports.getGet=function(e){return function(r){var t=void 0===r?{}:r,n=t.did,i=t.url;try{if(!(n=n||i))throw new TypeError('"did" must be a string.');return Promise.resolve(e(n)).then((function(e){return e.didDocument}))}catch(e){return Promise.reject(e)}}},exports.getResolve=function(e){return function(r,t){void 0===t&&(t={accept:"application/did+ld+json"});try{var n=r.split("#")[0].split("did:key:").pop();return Promise.resolve(e.fromFingerprint({fingerprint:n})).then((function(e){return Promise.resolve(u(e,t.accept)).then((function(e){var r={"@context":"https://w3id.org/did-resolution/v1",didDocument:e,didDocumentMetadata:{"content-type":t.accept},didResolutionMetadata:{}};return"application/did+cbor"===t.accept?o.encode(r):r}))}))}catch(e){return Promise.reject(e)}}},exports.getVerificationMethod=c,exports.keyToDidDoc=u,exports.types={__proto__:null,staticImplements:function(){return function(e){return e}}}; | ||
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var r=e(require("base64url")),t=e(require("canonicalize"));function n(){return(n=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e}).apply(this,arguments)}var i={__proto__:null,createJws:function(e,n,i){try{var o=r.encode(t(i))+"."+r.encode(t(n));return Promise.resolve(e.sign(Buffer.from(o))).then((function(e){return o+"."+r.encode(Buffer.from(e))}))}catch(e){return Promise.reject(e)}},verifyJws:function(e,t){try{var n=t.split("."),i=n[2];return Promise.resolve(e.verify(Buffer.from(n[0]+"."+n[1]),r.toBuffer(i)))}catch(e){return Promise.reject(e)}},createDetachedJws:function(e,i,o){try{var c=r.encode(t(n({},o,{b64:!1,crit:["b64"]}))),a=new Uint8Array(Buffer.concat([Buffer.from(c,"utf-8"),Buffer.from(".","utf-8"),i]));return Promise.resolve(e.sign(Buffer.from(a))).then((function(e){var t=r.encode(Buffer.from(e));return c+".."+t}))}catch(e){return Promise.reject(e)}},verifyDetachedJws:function(e,t,n){try{var i=n.split(".."),o=i[1],c=new Uint8Array(Buffer.concat([Buffer.from(i[0],"utf-8"),Buffer.from(".","utf-8"),t]));return Promise.resolve(e.verify(Buffer.from(c),r.toBuffer(o)))}catch(e){return Promise.reject(e)}}},o=require("borc"),c=function(e,r){switch(void 0===r&&(r="application/did+ld+json"),r){case"application/did+json":case"application/did+cbor":return e.toJsonWebKeyPair();case"application/did+ld+json":return e.toKeyPair()}throw new Error("This implementation of did:key does not support: "+r)},a=["application/did+json","application/did+ld+json","application/did+cbor"],u=function(e,r){void 0===r&&(r="application/did+ld+json");try{var t=function(){return n({"@context":["https://www.w3.org/ns/did/v1","https://ns.did.ai/transmute/v1",{"@base":i}],id:i},u)};if(-1===a.indexOf(r))throw new Error("Unsupported DID Document representation. "+r);var i="did:key:"+e.fingerprint(),o=c(e,r),u={verificationMethod:[o]};e.verifier&&(u=n({},u,{authentication:[o.id],assertionMethod:[o.id],capabilityInvocation:[o.id],capabilityDelegation:[o.id]})),e.deriveSecret&&(u=n({},u,{keyAgreement:[o.id]}));var f=function(){if("Ed25519VerificationKey2018"===e.type)return Promise.resolve(e.toX25519KeyPair(!1)).then((function(e){var t=c(e,r);u=n({},u,{verificationMethod:[].concat(u.verificationMethod,[t]),keyAgreement:[t.id]})}))}();return Promise.resolve(f&&f.then?f.then(t):t())}catch(e){return Promise.reject(e)}};exports.Jws=i,exports.getGet=function(e){return function(r){var t=void 0===r?{}:r,n=t.did,i=t.url;try{if(!(n=n||i))throw new TypeError('"did" must be a string.');return Promise.resolve(e(n)).then((function(e){return e.didDocument}))}catch(e){return Promise.reject(e)}}},exports.getResolve=function(e){return function(r,t){void 0===t&&(t={accept:"application/did+ld+json"});try{var n=r.split("#")[0].split("did:key:").pop();return Promise.resolve(e.fromFingerprint({fingerprint:n})).then((function(e){return Promise.resolve(u(e,t.accept)).then((function(e){var r={"@context":"https://w3id.org/did-resolution/v1",didDocument:e,didDocumentMetadata:{"content-type":t.accept},didResolutionMetadata:{}};return"application/did+cbor"===t.accept?o.encode(r):r}))}))}catch(e){return Promise.reject(e)}}},exports.getVerificationMethod=c,exports.keyToDidDoc=u,exports.types={__proto__:null,staticImplements:function(){return function(e){return e}}}; | ||
//# sourceMappingURL=did-key-common.cjs.production.min.js.map |
@@ -130,3 +130,3 @@ import base64url from 'base64url'; | ||
var didDocument = _extends({ | ||
'@context': ['https://www.w3.org/ns/did/v1', { | ||
'@context': ['https://www.w3.org/ns/did/v1', 'https://ns.did.ai/transmute/v1', { | ||
'@base': did | ||
@@ -133,0 +133,0 @@ }], |
@@ -5,3 +5,3 @@ { | ||
"module": "dist/did-key-common.esm.js", | ||
"version": "0.2.1-unstable.35", | ||
"version": "0.2.1-unstable.36", | ||
"license": "Apache-2.0", | ||
@@ -44,3 +44,3 @@ "main": "dist/index.js", | ||
}, | ||
"gitHead": "b704ed8c640c4cabaf817cd741f36f3e5621abe3" | ||
"gitHead": "0620ebee9665087f51bcc73a1225d69e64499710" | ||
} |
@@ -8,1 +8,3 @@ # @transmute/did-key-common | ||
``` | ||
This module needs to be deprecated.... |
@@ -77,2 +77,3 @@ const cbor = require('borc'); | ||
'https://www.w3.org/ns/did/v1', | ||
'https://ns.did.ai/transmute/v1', | ||
{ | ||
@@ -79,0 +80,0 @@ '@base': did, |
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
82943
857
10