resolve-did 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Catena Labs, Inc. and contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,21 @@
1
+ # resolve-did
2
+
3
+ Resolve DIDs from the command line and in code.
4
+
5
+ Use it from the command line:
6
+
7
+ ```sh
8
+ npx resolve-did did:web:venabl.es
9
+ ```
10
+
11
+ Or, use it in code:
12
+
13
+ ```ts
14
+ import { resolveDid } from "resolve-did"
15
+
16
+ const { did, didDocument } = await resolveDid("did:web:venabl.es")
17
+ ```
18
+
19
+ ## Powered by Agent Commerce Kit
20
+
21
+ This library uses the DID methods from [Agent Commerce Kit](https://agentcommercekit.com).
package/dist/cli.d.ts ADDED
@@ -0,0 +1 @@
1
+ export { };
package/dist/cli.js ADDED
@@ -0,0 +1,25 @@
1
+ #!/usr/bin/env node
2
+ import { resolveDid } from "./resolve-did-CFoKT9AD.js";
3
+ import { inspect } from "node:util";
4
+
5
+ //#region src/cli.ts
6
+ async function main(didUri) {
7
+ if (!didUri) {
8
+ console.error("Usage: npx resolve-did <did-uri>");
9
+ process.exit(1);
10
+ }
11
+ const { didDocument } = await resolveDid(didUri);
12
+ console.log(inspect(didDocument, {
13
+ colors: true,
14
+ depth: null,
15
+ compact: false
16
+ }));
17
+ }
18
+ main(process.argv[2]).then(() => {
19
+ process.exit(0);
20
+ }).catch((error) => {
21
+ console.error(error);
22
+ process.exit(1);
23
+ });
24
+
25
+ //#endregion
@@ -0,0 +1,18 @@
1
+ import * as _agentcommercekit_did0 from "@agentcommercekit/did";
2
+ import { DidDocument, DidUri } from "@agentcommercekit/did";
3
+
4
+ //#region src/resolve-did.d.ts
5
+
6
+ /**
7
+ * Resolve a did URI
8
+ *
9
+ * @param didUri - The did URI to resolve
10
+ * @param resolver - The resolver to use
11
+ * @returns An object containing the `did` and the `didDocument`
12
+ */
13
+ declare function resolveDid(didUri: unknown, resolver?: _agentcommercekit_did0.DidResolver): Promise<{
14
+ did: DidUri;
15
+ didDocument: DidDocument;
16
+ }>;
17
+ //#endregion
18
+ export { resolveDid };
package/dist/index.js ADDED
@@ -0,0 +1,3 @@
1
+ import { resolveDid } from "./resolve-did-CFoKT9AD.js";
2
+
3
+ export { resolveDid };
@@ -0,0 +1,21 @@
1
+ import { getDidResolver, isDidUri, resolveDid } from "@agentcommercekit/did";
2
+
3
+ //#region src/resolve-did.ts
4
+ /**
5
+ * Resolve a did URI
6
+ *
7
+ * @param didUri - The did URI to resolve
8
+ * @param resolver - The resolver to use
9
+ * @returns An object containing the `did` and the `didDocument`
10
+ */
11
+ async function resolveDid$1(didUri, resolver = getDidResolver()) {
12
+ if (!isDidUri(didUri)) throw new Error("Invalid DID URI");
13
+ const { did, didDocument } = await resolveDid(didUri, resolver);
14
+ return {
15
+ did,
16
+ didDocument
17
+ };
18
+ }
19
+
20
+ //#endregion
21
+ export { resolveDid$1 as resolveDid };
package/package.json ADDED
@@ -0,0 +1,53 @@
1
+ {
2
+ "name": "resolve-did",
3
+ "version": "1.0.0",
4
+ "description": "Resolve DIDs from the command line and in code",
5
+ "homepage": "https://github.com/catena-labs/resolve-did#readme",
6
+ "bugs": "https://github.com/catena-labs/resolve-did/issues",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/catena-labs/resolve-did.git"
10
+ },
11
+ "license": "MIT",
12
+ "author": {
13
+ "name": "Catena Labs",
14
+ "url": "https://catenalabs.com"
15
+ },
16
+ "type": "module",
17
+ "bin": {
18
+ "resolve-did": "dist/cli.js"
19
+ },
20
+ "files": [
21
+ "dist"
22
+ ],
23
+ "dependencies": {
24
+ "@agentcommercekit/did": "^0.2.0"
25
+ },
26
+ "devDependencies": {
27
+ "@eslint/js": "^9.28.0",
28
+ "@types/node": "^22.15.29",
29
+ "eslint": "^9.28.0",
30
+ "globals": "^16.2.0",
31
+ "prettier": "^3.5.3",
32
+ "prettier-plugin-packagejson": "^2.5.15",
33
+ "publint": "^0.3.12",
34
+ "tsdown": "^0.12.6",
35
+ "typescript": "^5.8.3",
36
+ "typescript-eslint": "^8.33.1",
37
+ "vitest": "^3.2.1"
38
+ },
39
+ "scripts": {
40
+ "build": "tsdown src/index.ts src/cli.ts --dts",
41
+ "check": "pnpm check:format && pnpm check:lint && pnpm check:types && pnpm test && pnpm check:publint",
42
+ "check:format": "prettier --check .",
43
+ "check:lint": "eslint .",
44
+ "check:publint": "publint",
45
+ "check:types": "tsc --noEmit",
46
+ "clean": "git clean -fdX .turbo dist",
47
+ "fix": "pnpm format && pnpm lint:fix",
48
+ "format": "prettier --write .",
49
+ "lint": "eslint .",
50
+ "lint:fix": "eslint . --fix",
51
+ "test": "vitest"
52
+ }
53
+ }