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

key-did-resolver

Package Overview
Dependencies
Maintainers
7
Versions
62
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

key-did-resolver - npm Package Compare versions

Comparing version 2.0.0-alpha.0 to 2.0.0-alpha.1

31

lib/ed25519.js

@@ -1,25 +0,3 @@

"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.keyToDidDoc = void 0;
const u8a = __importStar(require("uint8arrays"));
const ed25519_1 = require("@stablelib/ed25519");
import * as u8a from 'uint8arrays';
import { convertPublicKeyToX25519 } from '@stablelib/ed25519';
function encodeKey(key) {

@@ -32,6 +10,6 @@ const bytes = new Uint8Array(key.length + 2);

}
function keyToDidDoc(pubKeyBytes, fingerprint) {
export function keyToDidDoc(pubKeyBytes, fingerprint) {
const did = `did:key:${fingerprint}`;
const keyId = `${did}#${fingerprint}`;
const x25519PubBytes = ed25519_1.convertPublicKeyToX25519(pubKeyBytes);
const x25519PubBytes = convertPublicKeyToX25519(pubKeyBytes);
const x25519KeyId = `${did}#${encodeKey(x25519PubBytes)}`;

@@ -62,3 +40,2 @@ return {

}
exports.keyToDidDoc = keyToDidDoc;
//# sourceMappingURL=ed25519.js.map
import type { ResolverRegistry } from 'did-resolver';
export declare function getResolver(): ResolverRegistry;
declare const _default: {
getResolver: typeof getResolver;
};
export default _default;
//# sourceMappingURL=index.d.ts.map

@@ -1,30 +0,5 @@

"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.getResolver = void 0;
const varint_1 = __importDefault(require("varint"));
const base58_1 = require("multiformats/bases/base58");
const secp256k1 = __importStar(require("./secp256k1"));
const ed25519 = __importStar(require("./ed25519"));
import varint from 'varint';
import { base58btc } from 'multiformats/bases/base58';
import * as secp256k1 from './secp256k1.js';
import * as ed25519 from './ed25519.js';
const DID_LD_JSON = 'application/did+ld+json';

@@ -36,3 +11,3 @@ const DID_JSON = 'application/did+json';

};
function getResolver() {
export function getResolver() {
return {

@@ -47,5 +22,5 @@ key: async (did, parsed, r, options) => {

try {
const multicodecPubKey = base58_1.base58btc.decode(parsed.id);
const keyType = varint_1.default.decode(multicodecPubKey);
const pubKeyBytes = multicodecPubKey.slice(varint_1.default.decode.bytes);
const multicodecPubKey = base58btc.decode(parsed.id);
const keyType = varint.decode(multicodecPubKey);
const pubKeyBytes = multicodecPubKey.slice(varint.decode.bytes);
const doc = await prefixToDriverMap[keyType].keyToDidDoc(pubKeyBytes, parsed.id);

@@ -72,4 +47,2 @@ if (contentType === DID_LD_JSON) {

}
exports.getResolver = getResolver;
exports.default = { getResolver };
//# sourceMappingURL=index.js.map

@@ -1,25 +0,3 @@

"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.keyToDidDoc = void 0;
const u8a = __importStar(require("uint8arrays"));
function keyToDidDoc(pubKeyBytes, fingerprint) {
import * as u8a from 'uint8arrays';
export function keyToDidDoc(pubKeyBytes, fingerprint) {
const did = `did:key:${fingerprint}`;

@@ -43,3 +21,2 @@ const keyId = `${did}#${fingerprint}`;

}
exports.keyToDidDoc = keyToDidDoc;
//# sourceMappingURL=secp256k1.js.map

24

package.json
{
"name": "key-did-resolver",
"version": "2.0.0-alpha.0",
"version": "2.0.0-alpha.1",
"description": "Ceramic did:key method resolver",

@@ -15,11 +15,17 @@ "keywords": [

"directories": {
"lib": "lib"
"lib": "./lib"
},
"main": "lib/index.js",
"main": "./lib/index.js",
"types": "./lib/index.d.ts",
"type": "module",
"exports": {
".": "./lib/index.js"
},
"files": [
"lib"
],
"sideEffects": false,
"scripts": {
"test": "../../node_modules/.bin/jest --silent --coverage",
"build": "../../node_modules/.bin/tsc -p tsconfig.json",
"build": "../../node_modules/.bin/tsc --project tsconfig.json",
"prepublishOnly": "npm run build",

@@ -36,11 +42,7 @@ "prebuild": "npm run clean",

"devDependencies": {
"@types/node": "^13.13.15",
"@types/node": "^17.0.5",
"@types/varint": "^6.0.0",
"did-resolver": "^3.1.3"
"did-resolver": "^3.1.5"
},
"jest": {
"testEnvironment": "node",
"resolver": "jest-resolver-enhanced"
},
"gitHead": "f432b554a4b134db45f24b2555bfda176feac505"
"gitHead": "fb9c06e9cdce755eede1a2563ce62f8083e4e06a"
}
# did:key method resolver
![ceramicnetwork](https://circleci.com/gh/ceramicnetwork/js-ceramic.svg?style=shield)
[![MIT license](https://img.shields.io/badge/License-MIT-blue.svg)](https://lbesson.mit-license.org/)
[![](https://img.shields.io/badge/Chat%20on-Discord-orange.svg?style=flat)](https://discord.gg/6VRZpGP)
[![Twitter](https://img.shields.io/twitter/follow/ceramicnetwork?label=Follow&style=social)](https://twitter.com/ceramicnetwork)
> This package contains did:key method resolver implementation
### Installation
## Installation
```

@@ -10,2 +14,6 @@ $ npm install key-did-resolver

## Usage
See the [ceramic developer site](https://developers.ceramic.network/) for more details about how to use this package.
## Contributing

@@ -12,0 +20,0 @@ We are happy to accept small and large contributions. Make sure to check out the [Ceramic specifications](https://github.com/ceramicnetwork/specs) for details of how the protocol works.

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

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