@atproto/did 0.5.2 → 0.5.3

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.
@@ -1,109 +0,0 @@
1
- import { InvalidDidError } from '../../src/did-error.js'
2
- import { Did } from '../../src/did.js'
3
- import {
4
- asDidWeb,
5
- assertDidWeb,
6
- didWebToUrl,
7
- isDidWeb,
8
- urlToDidWeb,
9
- } from '../../src/methods/web.js'
10
-
11
- const VALID: [Did<'web'>, string][] = [
12
- ['did:web:example.com', 'https://example.com/'],
13
- ['did:web:sub.example.com', 'https://sub.example.com/'],
14
- ['did:web:example.com%3A8080', 'https://example.com:8080/'],
15
- [
16
- 'did:web:example.com:path:to:resource',
17
- 'https://example.com/path/to/resource',
18
- ],
19
- [
20
- 'did:web:example.com%3A8080:path:to:resource',
21
- 'https://example.com:8080/path/to/resource',
22
- ],
23
- [
24
- 'did:web:xn--b48h.com%3A8080:path:to:resource',
25
- 'https://🙃.com:8080/path/to/resource',
26
- ],
27
- ]
28
-
29
- const INVALID: [value: unknown, message: string][] = [
30
- ['did:web:', 'DID method-specific id must not be empty'],
31
- ['did:web:foo@example.com', 'Disallowed character in DID at position 11'],
32
- ['did:web::example.com', 'did:web MSID must not start with a colon'],
33
- ['did:web:example.com:', 'DID cannot end with ":"'],
34
- ['did:web:exam%3Aple.com%3A8080', 'Invalid Web DID'],
35
- [3, 'DID must be a string'],
36
- [{ toString: () => 'did:web:foo.com' }, 'DID must be a string'],
37
- [[''], 'DID must be a string'],
38
- ['random-string', 'Invalid did:web prefix'],
39
- ['did web', 'Invalid did:web prefix'],
40
- ['lorem ipsum dolor sit', 'Invalid did:web prefix'],
41
- ]
42
-
43
- describe('isDidWeb', () => {
44
- it('returns true for various valid dids', () => {
45
- for (const [did] of VALID) {
46
- expect(isDidWeb(did)).toBe(true)
47
- }
48
- })
49
-
50
- it('returns false for invalid dids', () => {
51
- for (const did of INVALID) {
52
- expect(isDidWeb(did)).toBe(false)
53
- }
54
- })
55
- })
56
-
57
- describe('assertDidWeb', () => {
58
- it('does not throw on valid dids', () => {
59
- for (const [did] of VALID) {
60
- expect(() => assertDidWeb(did)).not.toThrow()
61
- }
62
- })
63
-
64
- it('throws if called with non string argument', () => {
65
- for (const [val, message] of INVALID) {
66
- expect(() => assertDidWeb(val)).toThrow(
67
- new InvalidDidError(
68
- typeof val === 'string' ? val : typeof val,
69
- message,
70
- ),
71
- )
72
- }
73
- })
74
- })
75
-
76
- describe('didWebToUrl', () => {
77
- it('converts valid did:web to URL', () => {
78
- for (const [did, url] of VALID) {
79
- expect(didWebToUrl(did)).toStrictEqual(new URL(url))
80
- }
81
- })
82
- })
83
-
84
- describe('urlToDidWeb', () => {
85
- it('converts URL to valid did:web', () => {
86
- for (const [did, url] of VALID) {
87
- expect(urlToDidWeb(new URL(url))).toBe(did)
88
- }
89
- })
90
- })
91
-
92
- describe('asDidWeb', () => {
93
- it('returns the input for valid dids', () => {
94
- for (const [did] of VALID) {
95
- expect(asDidWeb(did)).toBe(did)
96
- }
97
- })
98
-
99
- it('throws if called with invalid dids', () => {
100
- for (const [val, message] of INVALID) {
101
- expect(() => asDidWeb(val)).toThrow(
102
- new InvalidDidError(
103
- typeof val === 'string' ? val : typeof val,
104
- message,
105
- ),
106
- )
107
- }
108
- })
109
- })
@@ -1,8 +0,0 @@
1
- {
2
- "extends": "../../tsconfig/isomorphic.json",
3
- "compilerOptions": {
4
- "rootDir": "./src",
5
- "outDir": "./dist",
6
- },
7
- "include": ["./src"],
8
- }
@@ -1 +0,0 @@
1
- {"version":"7.0.0-dev.20260614.1","root":["./src/atproto.ts","./src/did-document.ts","./src/did-error.ts","./src/did-ref.ts","./src/did.ts","./src/index.ts","./src/methods.ts","./src/utils.ts","./src/lib/uri.ts","./src/methods/plc.ts","./src/methods/web.ts"]}
package/tsconfig.json DELETED
@@ -1,4 +0,0 @@
1
- {
2
- "include": [],
3
- "references": [{ "path": "./tsconfig.build.json" }],
4
- }