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

@atproto/did

Package Overview
Dependencies
Maintainers
0
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@atproto/did - npm Package Compare versions

Comparing version 0.1.2 to 0.1.3

tsconfig.build.tsbuildinfo

6

CHANGELOG.md
# @atproto/did
## 0.1.3
### Patch Changes
- [#2871](https://github.com/bluesky-social/atproto/pull/2871) [`9d40ccbb6`](https://github.com/bluesky-social/atproto/commit/9d40ccbb69103fae9aae7e3cec31e9b3116f3ba2) Thanks [@matthieusieben](https://github.com/matthieusieben)! - Add atprotoDidSchema to validate Atproto supported DID's using zod
## 0.1.2

@@ -4,0 +10,0 @@

2

dist/atproto.d.ts

@@ -0,4 +1,6 @@

import { z } from 'zod';
import { Did } from './did.js';
export type AtprotoIdentityDidMethods = 'plc' | 'web';
export type AtprotoDid = Did<AtprotoIdentityDidMethods>;
export declare const atprotoDidSchema: z.ZodEffects<z.ZodString, `did:plc:${string}` | `did:web:${string}`, string>;
export declare function isAtprotoDid(input: unknown): input is AtprotoDid;

@@ -5,0 +7,0 @@ export declare function asAtprotoDid(input: unknown): AtprotoDid;

16

dist/atproto.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.isAtprotoDidWeb = exports.assertAtprotoDidWeb = exports.assertAtprotoDid = exports.asAtprotoDid = exports.isAtprotoDid = void 0;
exports.atprotoDidSchema = void 0;
exports.isAtprotoDid = isAtprotoDid;
exports.asAtprotoDid = asAtprotoDid;
exports.assertAtprotoDid = assertAtprotoDid;
exports.assertAtprotoDidWeb = assertAtprotoDidWeb;
exports.isAtprotoDidWeb = isAtprotoDidWeb;
const zod_1 = require("zod");
const did_error_js_1 = require("./did-error.js");
const methods_js_1 = require("./methods.js");
exports.atprotoDidSchema = zod_1.z
.string()
.refine(isAtprotoDid, `Atproto only allows "plc" and "web" DID methods`);
function isAtprotoDid(input) {

@@ -22,3 +31,2 @@ // Optimized equivalent of:

}
exports.isAtprotoDid = isAtprotoDid;
function asAtprotoDid(input) {

@@ -28,3 +36,2 @@ assertAtprotoDid(input);

}
exports.asAtprotoDid = asAtprotoDid;
function assertAtprotoDid(input) {

@@ -44,3 +51,2 @@ if (typeof input !== 'string') {

}
exports.assertAtprotoDid = assertAtprotoDid;
function assertAtprotoDidWeb(input) {

@@ -56,3 +62,2 @@ (0, methods_js_1.assertDidWeb)(input);

}
exports.assertAtprotoDidWeb = assertAtprotoDidWeb;
/**

@@ -70,3 +75,2 @@ * @see {@link https://atproto.com/specs/did#blessed-did-methods}

}
exports.isAtprotoDidWeb = isAtprotoDidWeb;
//# sourceMappingURL=atproto.js.map

@@ -45,3 +45,3 @@ import { z } from 'zod';

*/
export declare function extractDidMethod<D extends Did>(did: D): D extends `did:${AsDidMethod<infer M extends string>}:${string}` ? M : string;
export declare function extractDidMethod<D extends Did>(did: D): D extends Did<infer M> ? M : string;
/**

@@ -48,0 +48,0 @@ * DID Method-specific identifier check function.

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.didSchema = exports.asDid = exports.isDid = exports.assertDid = exports.assertDidMsid = exports.extractDidMethod = exports.assertDidMethod = exports.DID_PREFIX = void 0;
exports.didSchema = exports.DID_PREFIX = void 0;
exports.assertDidMethod = assertDidMethod;
exports.extractDidMethod = extractDidMethod;
exports.assertDidMsid = assertDidMsid;
exports.assertDid = assertDid;
exports.isDid = isDid;
exports.asDid = asDid;
const zod_1 = require("zod");

@@ -35,3 +41,2 @@ const did_error_js_1 = require("./did-error.js");

}
exports.assertDidMethod = assertDidMethod;
/**

@@ -45,3 +50,2 @@ * This method assumes the input is a valid Did

}
exports.extractDidMethod = extractDidMethod;
/**

@@ -102,3 +106,2 @@ * DID Method-specific identifier check function.

}
exports.assertDidMsid = assertDidMsid;
function assertDid(input) {

@@ -122,3 +125,2 @@ if (typeof input !== 'string') {

}
exports.assertDid = assertDid;
function isDid(input) {

@@ -137,3 +139,2 @@ try {

}
exports.isDid = isDid;
function asDid(input) {

@@ -143,3 +144,2 @@ assertDid(input);

}
exports.asDid = asDid;
exports.didSchema = zod_1.z

@@ -146,0 +146,0 @@ .string()

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.assertDidPlc = exports.asDidPlc = exports.isDidPlc = exports.DID_PLC_PREFIX = void 0;
exports.DID_PLC_PREFIX = void 0;
exports.isDidPlc = isDidPlc;
exports.asDidPlc = asDidPlc;
exports.assertDidPlc = assertDidPlc;
const did_error_js_1 = require("../did-error.js");

@@ -23,3 +26,2 @@ const DID_PLC_PREFIX = `did:plc:`;

}
exports.isDidPlc = isDidPlc;
function asDidPlc(input) {

@@ -29,3 +31,2 @@ assertDidPlc(input);

}
exports.asDidPlc = asDidPlc;
function assertDidPlc(input) {

@@ -49,4 +50,3 @@ if (typeof input !== 'string') {

}
exports.assertDidPlc = assertDidPlc;
const isBase32Char = (c) => (c >= 0x61 && c <= 0x7a) || (c >= 0x32 && c <= 0x37); // [a-z2-7]
//# sourceMappingURL=plc.js.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.urlToDidWeb = exports.didWebToUrl = exports.assertDidWeb = exports.asDidWeb = exports.isDidWeb = exports.DID_WEB_PREFIX = void 0;
exports.DID_WEB_PREFIX = void 0;
exports.isDidWeb = isDidWeb;
exports.asDidWeb = asDidWeb;
exports.assertDidWeb = assertDidWeb;
exports.didWebToUrl = didWebToUrl;
exports.urlToDidWeb = urlToDidWeb;
const did_error_js_1 = require("../did-error.js");

@@ -22,3 +27,2 @@ const did_js_1 = require("../did.js");

}
exports.isDidWeb = isDidWeb;
function asDidWeb(input) {

@@ -28,3 +32,2 @@ assertDidWeb(input);

}
exports.asDidWeb = asDidWeb;
function assertDidWeb(input) {

@@ -36,3 +39,2 @@ if (typeof input !== 'string') {

}
exports.assertDidWeb = assertDidWeb;
function didWebToUrl(did) {

@@ -60,3 +62,2 @@ if (!did.startsWith(exports.DID_WEB_PREFIX)) {

}
exports.didWebToUrl = didWebToUrl;
function urlToDidWeb(url) {

@@ -68,3 +69,2 @@ const path = url.pathname === '/'

}
exports.urlToDidWeb = urlToDidWeb;
//# sourceMappingURL=web.js.map
{
"name": "@atproto/did",
"version": "0.1.2",
"version": "0.1.3",
"license": "MIT",

@@ -31,3 +31,3 @@ "description": "DID resolution and verification library",

"devDependencies": {
"typescript": "^5.3.3"
"typescript": "^5.6.3"
},

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

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

import { z } from 'zod'
import { InvalidDidError } from './did-error.js'

@@ -16,2 +18,6 @@ import { Did } from './did.js'

export const atprotoDidSchema = z
.string()
.refine(isAtprotoDid, `Atproto only allows "plc" and "web" DID methods`)
export function isAtprotoDid(input: unknown): input is AtprotoDid {

@@ -18,0 +24,0 @@ // Optimized equivalent of:

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

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