@interop/did-web-resolver 0.2.0 → 2.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/CHANGELOG.md +33 -0
- package/README.md +65 -22
- package/build-dist.sh +14 -0
- package/dist/DidWebResolver.js +336 -0
- package/dist/esm/index.js +5 -0
- package/dist/esm/package.json +3 -0
- package/dist/index.js +14 -0
- package/package.json +48 -23
- package/rollup.config.js +15 -0
- package/src/DidWebResolver.js +228 -31
- package/src/index.js +7 -2
- package/.idea/codeStyles/Project.xml +0 -79
- package/.idea/codeStyles/codeStyleConfig.xml +0 -5
- package/.idea/dbnavigator.xml +0 -456
- package/.idea/did-web-driver.iml +0 -12
- package/.idea/misc.xml +0 -10
- package/.idea/modules.xml +0 -8
- package/.idea/vcs.xml +0 -6
- package/.idea/workspace.xml +0 -176
- package/.travis.yml +0 -10
- package/src/main.js +0 -5
- package/test/karma.conf.js +0 -40
- package/test/unit/DidWebResolver.spec.js +0 -152
package/.idea/workspace.xml
DELETED
|
@@ -1,176 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<project version="4">
|
|
3
|
-
<component name="ChangeListManager">
|
|
4
|
-
<list default="true" id="982d0c4b-2e39-438c-82c5-f7c5dae0767b" name="Default Changelist" comment="" />
|
|
5
|
-
<option name="SHOW_DIALOG" value="false" />
|
|
6
|
-
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
|
7
|
-
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
|
8
|
-
<option name="LAST_RESOLUTION" value="IGNORE" />
|
|
9
|
-
</component>
|
|
10
|
-
<component name="Git.Settings">
|
|
11
|
-
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
|
|
12
|
-
</component>
|
|
13
|
-
<component name="PackageJsonUpdateNotifier">
|
|
14
|
-
<dismissed value="$PROJECT_DIR$/package.json" />
|
|
15
|
-
</component>
|
|
16
|
-
<component name="ProjectId" id="1bQLHI0WhsKYVw8oRwSLGfJ5bdW" />
|
|
17
|
-
<component name="ProjectLevelVcsManager">
|
|
18
|
-
<ConfirmationsSetting value="1" id="Add" />
|
|
19
|
-
</component>
|
|
20
|
-
<component name="ProjectViewState">
|
|
21
|
-
<option name="autoscrollFromSource" value="true" />
|
|
22
|
-
<option name="autoscrollToSource" value="true" />
|
|
23
|
-
<option name="hideEmptyMiddlePackages" value="true" />
|
|
24
|
-
<option name="showLibraryContents" value="true" />
|
|
25
|
-
<option name="showMembers" value="true" />
|
|
26
|
-
</component>
|
|
27
|
-
<component name="PropertiesComponent">
|
|
28
|
-
<property name="RunOnceActivity.OpenProjectViewOnStart" value="true" />
|
|
29
|
-
<property name="RunOnceActivity.ShowReadmeOnStart" value="true" />
|
|
30
|
-
<property name="WebServerToolWindowFactoryState" value="false" />
|
|
31
|
-
<property name="last_opened_file_path" value="$PROJECT_DIR$" />
|
|
32
|
-
<property name="node.js.detected.package.eslint" value="true" />
|
|
33
|
-
<property name="node.js.detected.package.tslint" value="true" />
|
|
34
|
-
<property name="node.js.path.for.package.eslint" value="project" />
|
|
35
|
-
<property name="node.js.path.for.package.tslint" value="project" />
|
|
36
|
-
<property name="node.js.selected.package.eslint" value="(autodetect)" />
|
|
37
|
-
<property name="node.js.selected.package.tslint" value="(autodetect)" />
|
|
38
|
-
<property name="nodejs.mocha.mocha_node_package_dir" value="$PROJECT_DIR$/node_modules/mocha" />
|
|
39
|
-
<property name="nodejs_package_manager_path" value="npm" />
|
|
40
|
-
<property name="standardjs.codestyle.accepted" value="true" />
|
|
41
|
-
</component>
|
|
42
|
-
<component name="RecentsManager">
|
|
43
|
-
<key name="CopyFile.RECENT_KEYS">
|
|
44
|
-
<recent name="$PROJECT_DIR$" />
|
|
45
|
-
</key>
|
|
46
|
-
</component>
|
|
47
|
-
<component name="RunManager">
|
|
48
|
-
<configuration name="All tests" type="mocha-javascript-test-runner">
|
|
49
|
-
<node-interpreter>project</node-interpreter>
|
|
50
|
-
<node-options />
|
|
51
|
-
<mocha-package>$PROJECT_DIR$/node_modules/mocha</mocha-package>
|
|
52
|
-
<working-directory>$PROJECT_DIR$</working-directory>
|
|
53
|
-
<pass-parent-env>true</pass-parent-env>
|
|
54
|
-
<ui>bdd</ui>
|
|
55
|
-
<extra-mocha-options>-r esm --preserve-symlinks -t 10000</extra-mocha-options>
|
|
56
|
-
<test-kind>DIRECTORY</test-kind>
|
|
57
|
-
<test-directory>$PROJECT_DIR$/test</test-directory>
|
|
58
|
-
<recursive>true</recursive>
|
|
59
|
-
<method v="2" />
|
|
60
|
-
</configuration>
|
|
61
|
-
</component>
|
|
62
|
-
<component name="SvnConfiguration">
|
|
63
|
-
<configuration />
|
|
64
|
-
</component>
|
|
65
|
-
<component name="TaskManager">
|
|
66
|
-
<task active="true" id="Default" summary="Default task">
|
|
67
|
-
<changelist id="982d0c4b-2e39-438c-82c5-f7c5dae0767b" name="Default Changelist" comment="" />
|
|
68
|
-
<created>1588559281957</created>
|
|
69
|
-
<option name="number" value="Default" />
|
|
70
|
-
<option name="presentableId" value="Default" />
|
|
71
|
-
<updated>1588559281957</updated>
|
|
72
|
-
<workItem from="1588559283565" duration="1578000" />
|
|
73
|
-
<workItem from="1588642336517" duration="11958000" />
|
|
74
|
-
<workItem from="1589821427782" duration="200000" />
|
|
75
|
-
<workItem from="1589850167412" duration="9406000" />
|
|
76
|
-
<workItem from="1591493293550" duration="1508000" />
|
|
77
|
-
<workItem from="1595719508671" duration="1999000" />
|
|
78
|
-
<workItem from="1596230374917" duration="10272000" />
|
|
79
|
-
</task>
|
|
80
|
-
<servers />
|
|
81
|
-
</component>
|
|
82
|
-
<component name="TypeScriptGeneratedFilesManager">
|
|
83
|
-
<option name="version" value="2" />
|
|
84
|
-
</component>
|
|
85
|
-
<component name="WindowStateProjectService">
|
|
86
|
-
<state x="2236" y="275" key="#com.intellij.execution.impl.EditConfigurationsDialog" timestamp="1588645661064">
|
|
87
|
-
<screen x="1440" y="23" width="1920" height="1057" />
|
|
88
|
-
</state>
|
|
89
|
-
<state x="2236" y="275" key="#com.intellij.execution.impl.EditConfigurationsDialog/1440.23.1920.1057/0.23.1440.842@1440.23.1920.1057" timestamp="1588645661064" />
|
|
90
|
-
<state width="1404" height="364" key="GridCell.Tab.0.bottom" timestamp="1596319770099">
|
|
91
|
-
<screen x="0" y="23" width="1440" height="843" />
|
|
92
|
-
</state>
|
|
93
|
-
<state width="1404" height="364" key="GridCell.Tab.0.bottom/0.23.1440.843@0.23.1440.843" timestamp="1596319770099" />
|
|
94
|
-
<state width="1396" height="277" key="GridCell.Tab.0.bottom/1440.23.1920.1057/0.23.1440.842@1440.23.1920.1057" timestamp="1589996693041" />
|
|
95
|
-
<state width="1404" height="364" key="GridCell.Tab.0.center" timestamp="1596319770098">
|
|
96
|
-
<screen x="0" y="23" width="1440" height="843" />
|
|
97
|
-
</state>
|
|
98
|
-
<state width="1404" height="364" key="GridCell.Tab.0.center/0.23.1440.843@0.23.1440.843" timestamp="1596319770098" />
|
|
99
|
-
<state width="1396" height="277" key="GridCell.Tab.0.center/1440.23.1920.1057/0.23.1440.842@1440.23.1920.1057" timestamp="1589996693040" />
|
|
100
|
-
<state width="1404" height="364" key="GridCell.Tab.0.left" timestamp="1596319770098">
|
|
101
|
-
<screen x="0" y="23" width="1440" height="843" />
|
|
102
|
-
</state>
|
|
103
|
-
<state width="1404" height="364" key="GridCell.Tab.0.left/0.23.1440.843@0.23.1440.843" timestamp="1596319770098" />
|
|
104
|
-
<state width="1396" height="277" key="GridCell.Tab.0.left/1440.23.1920.1057/0.23.1440.842@1440.23.1920.1057" timestamp="1589996693040" />
|
|
105
|
-
<state width="1404" height="364" key="GridCell.Tab.0.right" timestamp="1596319770098">
|
|
106
|
-
<screen x="0" y="23" width="1440" height="843" />
|
|
107
|
-
</state>
|
|
108
|
-
<state width="1404" height="364" key="GridCell.Tab.0.right/0.23.1440.843@0.23.1440.843" timestamp="1596319770098" />
|
|
109
|
-
<state width="1396" height="277" key="GridCell.Tab.0.right/1440.23.1920.1057/0.23.1440.842@1440.23.1920.1057" timestamp="1589996693040" />
|
|
110
|
-
<state width="1404" height="364" key="GridCell.Tab.1.bottom" timestamp="1596319770100">
|
|
111
|
-
<screen x="0" y="23" width="1440" height="843" />
|
|
112
|
-
</state>
|
|
113
|
-
<state width="1404" height="364" key="GridCell.Tab.1.bottom/0.23.1440.843@0.23.1440.843" timestamp="1596319770100" />
|
|
114
|
-
<state width="1404" height="364" key="GridCell.Tab.1.center" timestamp="1596319770099">
|
|
115
|
-
<screen x="0" y="23" width="1440" height="843" />
|
|
116
|
-
</state>
|
|
117
|
-
<state width="1404" height="364" key="GridCell.Tab.1.center/0.23.1440.843@0.23.1440.843" timestamp="1596319770099" />
|
|
118
|
-
<state width="1404" height="364" key="GridCell.Tab.1.left" timestamp="1596319770099">
|
|
119
|
-
<screen x="0" y="23" width="1440" height="843" />
|
|
120
|
-
</state>
|
|
121
|
-
<state width="1404" height="364" key="GridCell.Tab.1.left/0.23.1440.843@0.23.1440.843" timestamp="1596319770099" />
|
|
122
|
-
<state width="1404" height="364" key="GridCell.Tab.1.right" timestamp="1596319770099">
|
|
123
|
-
<screen x="0" y="23" width="1440" height="843" />
|
|
124
|
-
</state>
|
|
125
|
-
<state width="1404" height="364" key="GridCell.Tab.1.right/0.23.1440.843@0.23.1440.843" timestamp="1596319770099" />
|
|
126
|
-
<state width="1404" height="364" key="GridCell.Tab.2.bottom" timestamp="1596319770101">
|
|
127
|
-
<screen x="0" y="23" width="1440" height="843" />
|
|
128
|
-
</state>
|
|
129
|
-
<state width="1404" height="364" key="GridCell.Tab.2.bottom/0.23.1440.843@0.23.1440.843" timestamp="1596319770101" />
|
|
130
|
-
<state width="1404" height="364" key="GridCell.Tab.2.center" timestamp="1596319770100">
|
|
131
|
-
<screen x="0" y="23" width="1440" height="843" />
|
|
132
|
-
</state>
|
|
133
|
-
<state width="1404" height="364" key="GridCell.Tab.2.center/0.23.1440.843@0.23.1440.843" timestamp="1596319770100" />
|
|
134
|
-
<state width="1404" height="364" key="GridCell.Tab.2.left" timestamp="1596319770100">
|
|
135
|
-
<screen x="0" y="23" width="1440" height="843" />
|
|
136
|
-
</state>
|
|
137
|
-
<state width="1404" height="364" key="GridCell.Tab.2.left/0.23.1440.843@0.23.1440.843" timestamp="1596319770100" />
|
|
138
|
-
<state width="1404" height="364" key="GridCell.Tab.2.right" timestamp="1596319770100">
|
|
139
|
-
<screen x="0" y="23" width="1440" height="843" />
|
|
140
|
-
</state>
|
|
141
|
-
<state width="1404" height="364" key="GridCell.Tab.2.right/0.23.1440.843@0.23.1440.843" timestamp="1596319770100" />
|
|
142
|
-
<state width="1404" height="364" key="GridCell.Tab.3.bottom" timestamp="1596319770102">
|
|
143
|
-
<screen x="0" y="23" width="1440" height="843" />
|
|
144
|
-
</state>
|
|
145
|
-
<state width="1404" height="364" key="GridCell.Tab.3.bottom/0.23.1440.843@0.23.1440.843" timestamp="1596319770102" />
|
|
146
|
-
<state width="1404" height="364" key="GridCell.Tab.3.center" timestamp="1596319770101">
|
|
147
|
-
<screen x="0" y="23" width="1440" height="843" />
|
|
148
|
-
</state>
|
|
149
|
-
<state width="1404" height="364" key="GridCell.Tab.3.center/0.23.1440.843@0.23.1440.843" timestamp="1596319770101" />
|
|
150
|
-
<state width="1404" height="364" key="GridCell.Tab.3.left" timestamp="1596319770101">
|
|
151
|
-
<screen x="0" y="23" width="1440" height="843" />
|
|
152
|
-
</state>
|
|
153
|
-
<state width="1404" height="364" key="GridCell.Tab.3.left/0.23.1440.843@0.23.1440.843" timestamp="1596319770101" />
|
|
154
|
-
<state width="1404" height="364" key="GridCell.Tab.3.right" timestamp="1596319770102">
|
|
155
|
-
<screen x="0" y="23" width="1440" height="843" />
|
|
156
|
-
</state>
|
|
157
|
-
<state width="1404" height="364" key="GridCell.Tab.3.right/0.23.1440.843@0.23.1440.843" timestamp="1596319770102" />
|
|
158
|
-
<state x="661" y="214" width="568" height="490" key="find.popup" timestamp="1596335082025">
|
|
159
|
-
<screen x="0" y="23" width="1440" height="843" />
|
|
160
|
-
</state>
|
|
161
|
-
<state x="2321" y="263" width="586" height="490" key="find.popup/1440.23.1920.1057/0.23.1440.842@1440.23.1920.1057" timestamp="1591493303927" />
|
|
162
|
-
<state x="661" y="214" width="568" height="490" key="find.popup/1440.23.1920.1057/0.23.1440.843@0.23.1440.843" timestamp="1596335082025" />
|
|
163
|
-
</component>
|
|
164
|
-
<component name="XDebuggerManager">
|
|
165
|
-
<breakpoint-manager>
|
|
166
|
-
<breakpoints>
|
|
167
|
-
<line-breakpoint enabled="true" type="javascript">
|
|
168
|
-
<url>file://$PROJECT_DIR$/node_modules/did-io/src/DidDocument.js</url>
|
|
169
|
-
<line>63</line>
|
|
170
|
-
<properties lambdaOrdinal="-1" />
|
|
171
|
-
<option name="timeStamp" value="1" />
|
|
172
|
-
</line-breakpoint>
|
|
173
|
-
</breakpoints>
|
|
174
|
-
</breakpoint-manager>
|
|
175
|
-
</component>
|
|
176
|
-
</project>
|
package/.travis.yml
DELETED
package/src/main.js
DELETED
package/test/karma.conf.js
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
module.exports = (config) => {
|
|
2
|
-
const bundler = process.env.BUNDLER || 'webpack'
|
|
3
|
-
const frameworks = ['mocha']
|
|
4
|
-
const files = ['**/*.spec.js']
|
|
5
|
-
const reporters = ['mocha']
|
|
6
|
-
const browsers = ['ChromeHeadless']
|
|
7
|
-
const client = {
|
|
8
|
-
mocha: {
|
|
9
|
-
timeout: 2000
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
// main bundle preprocessors
|
|
13
|
-
const preprocessors = []
|
|
14
|
-
preprocessors.push(bundler)
|
|
15
|
-
preprocessors.push('sourcemap')
|
|
16
|
-
|
|
17
|
-
return config.set({
|
|
18
|
-
frameworks,
|
|
19
|
-
files,
|
|
20
|
-
reporters,
|
|
21
|
-
basePath: '',
|
|
22
|
-
port: 9876,
|
|
23
|
-
colors: true,
|
|
24
|
-
browsers,
|
|
25
|
-
client,
|
|
26
|
-
singleRun: true,
|
|
27
|
-
preprocessors: {
|
|
28
|
-
'unit/*.js': preprocessors
|
|
29
|
-
},
|
|
30
|
-
webpack: {
|
|
31
|
-
devtool: 'inline-source-map',
|
|
32
|
-
mode: 'development',
|
|
33
|
-
node: {
|
|
34
|
-
Buffer: false,
|
|
35
|
-
crypto: false,
|
|
36
|
-
setImmediate: false
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
})
|
|
40
|
-
}
|
|
@@ -1,152 +0,0 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
import { DidWebResolver, urlFromDid, didFromUrl } from '../../src'
|
|
4
|
-
|
|
5
|
-
import { CryptoLD } from 'crypto-ld'
|
|
6
|
-
import { Ed25519VerificationKey2018 } from '@digitalbazaar/ed25519-verification-key-2018'
|
|
7
|
-
|
|
8
|
-
import chai from 'chai'
|
|
9
|
-
import dirtyChai from 'dirty-chai'
|
|
10
|
-
const cryptoLd = new CryptoLD()
|
|
11
|
-
cryptoLd.use(Ed25519VerificationKey2018)
|
|
12
|
-
chai.use(dirtyChai)
|
|
13
|
-
chai.should()
|
|
14
|
-
const { expect } = chai
|
|
15
|
-
|
|
16
|
-
describe('DidWebDriver', () => {
|
|
17
|
-
describe('constructor', () => {
|
|
18
|
-
it('should exist', () => {
|
|
19
|
-
expect(new DidWebResolver()).to.exist()
|
|
20
|
-
})
|
|
21
|
-
})
|
|
22
|
-
|
|
23
|
-
describe('generate()', () => {
|
|
24
|
-
let didWeb
|
|
25
|
-
|
|
26
|
-
beforeEach(async () => {
|
|
27
|
-
didWeb = new DidWebResolver({ cryptoLd })
|
|
28
|
-
})
|
|
29
|
-
|
|
30
|
-
it('should generate using default key map', async () => {
|
|
31
|
-
const url = 'https://example.com'
|
|
32
|
-
const { didDocument, didKeys } = await didWeb.generate({ url })
|
|
33
|
-
|
|
34
|
-
expect(didDocument).to.have.property('@context')
|
|
35
|
-
expect(didDocument.id).to.equal('did:web:example.com')
|
|
36
|
-
expect(didDocument.capabilityInvocation[0].type)
|
|
37
|
-
.to.equal('Ed25519VerificationKey2018')
|
|
38
|
-
expect(didDocument.authentication[0].type)
|
|
39
|
-
.to.equal('Ed25519VerificationKey2018')
|
|
40
|
-
expect(didDocument.assertionMethod[0].type)
|
|
41
|
-
.to.equal('Ed25519VerificationKey2018')
|
|
42
|
-
expect(didDocument.capabilityDelegation[0].type)
|
|
43
|
-
.to.equal('Ed25519VerificationKey2018')
|
|
44
|
-
|
|
45
|
-
for (const keyId in didKeys) {
|
|
46
|
-
expect(didKeys[keyId].type).to.equal('Ed25519VerificationKey2018')
|
|
47
|
-
}
|
|
48
|
-
})
|
|
49
|
-
})
|
|
50
|
-
|
|
51
|
-
describe('urlFromDid()', () => {
|
|
52
|
-
it('should error on missing did', () => {
|
|
53
|
-
let error
|
|
54
|
-
try {
|
|
55
|
-
urlFromDid()
|
|
56
|
-
} catch (e) {
|
|
57
|
-
error = e
|
|
58
|
-
}
|
|
59
|
-
expect(error.message).to.equal('Cannot convert did to url, missing did.')
|
|
60
|
-
})
|
|
61
|
-
|
|
62
|
-
it('should error on non-did:web dids', () => {
|
|
63
|
-
let error
|
|
64
|
-
try {
|
|
65
|
-
urlFromDid({ did: 'did:example:1234' })
|
|
66
|
-
} catch (e) {
|
|
67
|
-
error = e
|
|
68
|
-
}
|
|
69
|
-
expect(error.message)
|
|
70
|
-
.to.equal('DID Method not supported: "did:example:1234".')
|
|
71
|
-
})
|
|
72
|
-
|
|
73
|
-
it('should convert first id fragment to pathname plus default path', () => {
|
|
74
|
-
expect(urlFromDid({ did: 'did:web:example.com' }))
|
|
75
|
-
.to.equal('https://example.com/.well-known/did.json')
|
|
76
|
-
})
|
|
77
|
-
|
|
78
|
-
it('should url-decode host', () => {
|
|
79
|
-
expect(urlFromDid({ did: 'did:web:localhost%3A8080' }))
|
|
80
|
-
.to.equal('https://localhost:8080/.well-known/did.json')
|
|
81
|
-
})
|
|
82
|
-
|
|
83
|
-
it('should url-decode path fragments', () => {
|
|
84
|
-
expect(urlFromDid({ did: 'did:web:example.com:path:some%2Bsubpath' }))
|
|
85
|
-
.to.equal('https://example.com/path/some+subpath')
|
|
86
|
-
})
|
|
87
|
-
})
|
|
88
|
-
|
|
89
|
-
describe('didFromUrl', () => {
|
|
90
|
-
it('should error on missing url', () => {
|
|
91
|
-
let error
|
|
92
|
-
try {
|
|
93
|
-
didFromUrl()
|
|
94
|
-
} catch (e) {
|
|
95
|
-
error = e
|
|
96
|
-
}
|
|
97
|
-
expect(error.message).to.equal('Cannot convert url to did, missing url.')
|
|
98
|
-
})
|
|
99
|
-
|
|
100
|
-
it('should error on http URLs', () => {
|
|
101
|
-
let error
|
|
102
|
-
try {
|
|
103
|
-
didFromUrl({ url: 'http://example.com' })
|
|
104
|
-
} catch (e) {
|
|
105
|
-
error = e
|
|
106
|
-
}
|
|
107
|
-
expect(error.message).to.equal('did:web does not support non-HTTPS URLs.')
|
|
108
|
-
})
|
|
109
|
-
|
|
110
|
-
it('should error on invalid URLs', () => {
|
|
111
|
-
let error
|
|
112
|
-
try {
|
|
113
|
-
didFromUrl({ url: 'non-url' })
|
|
114
|
-
} catch (e) {
|
|
115
|
-
error = e
|
|
116
|
-
}
|
|
117
|
-
expect(error.message).to.equal('Invalid url: "non-url".')
|
|
118
|
-
})
|
|
119
|
-
|
|
120
|
-
it('should convert host to did identifier', () => {
|
|
121
|
-
expect(didFromUrl({ url: 'https://localhost' }))
|
|
122
|
-
.to.equal('did:web:localhost')
|
|
123
|
-
expect(didFromUrl({ url: 'https://example.com' }))
|
|
124
|
-
.to.equal('did:web:example.com')
|
|
125
|
-
})
|
|
126
|
-
|
|
127
|
-
it('should url-encode host', () => {
|
|
128
|
-
expect(didFromUrl({ url: 'https://localhost:8080' }))
|
|
129
|
-
.to.equal('did:web:localhost%3A8080')
|
|
130
|
-
})
|
|
131
|
-
|
|
132
|
-
it('should leave off the default / path', () => {
|
|
133
|
-
expect(didFromUrl({ url: 'https://example.com/' }))
|
|
134
|
-
.to.equal('did:web:example.com')
|
|
135
|
-
})
|
|
136
|
-
|
|
137
|
-
it('should encode path / separators as :', () => {
|
|
138
|
-
expect(didFromUrl({ url: 'https://example.com/path/subpath/did.json' }))
|
|
139
|
-
.to.equal('did:web:example.com:path:subpath:did.json')
|
|
140
|
-
})
|
|
141
|
-
|
|
142
|
-
it('should drop the default /.well-known/did.json pathname', () => {
|
|
143
|
-
expect(didFromUrl({ url: 'https://example.com/.well-known/did.json' }))
|
|
144
|
-
.to.equal('did:web:example.com')
|
|
145
|
-
})
|
|
146
|
-
|
|
147
|
-
it('should url-encode path fragments', () => {
|
|
148
|
-
expect(didFromUrl({ url: 'https://example.com/path/some+subpath' }))
|
|
149
|
-
.to.equal('did:web:example.com:path:some%2Bsubpath')
|
|
150
|
-
})
|
|
151
|
-
})
|
|
152
|
-
})
|