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

@atproto-labs/did-resolver

Package Overview
Dependencies
Maintainers
0
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@atproto-labs/did-resolver - npm Package Compare versions

Comparing version 0.1.4 to 0.1.5

tsconfig.build.tsbuildinfo

9

CHANGELOG.md
# @atproto-labs/did-resolver
## 0.1.5
### Patch Changes
- [#2874](https://github.com/bluesky-social/atproto/pull/2874) [`7f26b1765`](https://github.com/bluesky-social/atproto/commit/7f26b176526b9856a8f61faca6f065f0afd43abf) Thanks [@matthieusieben](https://github.com/matthieusieben)! - Add "allowHttp" did:web method option
- Updated dependencies [[`9d40ccbb6`](https://github.com/bluesky-social/atproto/commit/9d40ccbb69103fae9aae7e3cec31e9b3116f3ba2)]:
- @atproto/did@0.1.3
## 0.1.4

@@ -4,0 +13,0 @@

5

dist/methods/web.d.ts

@@ -6,6 +6,9 @@ import { Fetch } from '@atproto-labs/fetch';

fetch?: Fetch;
/** @default true */
allowHttp?: boolean;
};
export declare class DidWebMethod implements DidMethod<'web'> {
protected readonly fetch: Fetch<unknown>;
constructor({ fetch }?: DidWebMethodOptions);
protected readonly allowHttp: boolean;
constructor({ fetch, allowHttp, }?: DidWebMethodOptions);
resolve(did: Did<'web'>, options?: ResolveDidOptions): Promise<{

@@ -12,0 +15,0 @@ id: `did:${string}:${string}`;

16

dist/methods/web.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.buildDidWebDocumentUrl = exports.DidWebMethod = void 0;
exports.DidWebMethod = void 0;
exports.buildDidWebDocumentUrl = buildDidWebDocumentUrl;
const fetch_1 = require("@atproto-labs/fetch");

@@ -9,3 +10,3 @@ const pipe_1 = require("@atproto-labs/pipe");

class DidWebMethod {
constructor({ fetch = globalThis.fetch } = {}) {
constructor({ fetch = globalThis.fetch, allowHttp = true, } = {}) {
Object.defineProperty(this, "fetch", {

@@ -17,6 +18,16 @@ enumerable: true,

});
Object.defineProperty(this, "allowHttp", {
enumerable: true,
configurable: true,
writable: true,
value: void 0
});
this.fetch = (0, fetch_1.bindFetch)(fetch);
this.allowHttp = allowHttp;
}
async resolve(did, options) {
const didDocumentUrl = buildDidWebDocumentUrl(did);
if (!this.allowHttp && didDocumentUrl.protocol === 'http:') {
throw new Error(`Cannot resolve DID document for localhost: ${didDocumentUrl}`);
}
// Note we do not explicitly check for "localhost" here. Instead, we rely on

@@ -51,3 +62,2 @@ // the injected 'fetch' function to handle the URL. If the URL is

}
exports.buildDidWebDocumentUrl = buildDidWebDocumentUrl;
//# sourceMappingURL=web.js.map
{
"name": "@atproto-labs/did-resolver",
"version": "0.1.4",
"version": "0.1.5",
"license": "MIT",

@@ -32,6 +32,6 @@ "description": "DID resolution and verification library",

"@atproto-labs/simple-store-memory": "0.1.1",
"@atproto/did": "0.1.2"
"@atproto/did": "0.1.3"
},
"devDependencies": {
"typescript": "^5.3.3"
"typescript": "^5.6.3"
},

@@ -38,0 +38,0 @@ "scripts": {

@@ -21,2 +21,4 @@ import {

fetch?: Fetch
/** @default true */
allowHttp?: boolean
}

@@ -26,5 +28,10 @@

protected readonly fetch: Fetch<unknown>
protected readonly allowHttp: boolean
constructor({ fetch = globalThis.fetch }: DidWebMethodOptions = {}) {
constructor({
fetch = globalThis.fetch,
allowHttp = true,
}: DidWebMethodOptions = {}) {
this.fetch = bindFetch(fetch)
this.allowHttp = allowHttp
}

@@ -35,2 +42,8 @@

if (!this.allowHttp && didDocumentUrl.protocol === 'http:') {
throw new Error(
`Cannot resolve DID document for localhost: ${didDocumentUrl}`,
)
}
// Note we do not explicitly check for "localhost" here. Instead, we rely on

@@ -37,0 +50,0 @@ // the injected 'fetch' function to handle the URL. If the URL is

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