@excom/web-authn 0.1.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/.rush/temp/chunked-rush-logs/web-authn.apply-exports.chunks.jsonl +1 -0
- package/.rush/temp/chunked-rush-logs/web-authn.build_docs.chunks.jsonl +1 -0
- package/.rush/temp/chunked-rush-logs/web-authn.build_package-metas.chunks.jsonl +1 -0
- package/.rush/temp/operation/apply-exports/all.log +1 -0
- package/.rush/temp/operation/apply-exports/log-chunks.jsonl +1 -0
- package/.rush/temp/operation/apply-exports/state.json +3 -0
- package/.rush/temp/operation/build_docs/all.log +1 -0
- package/.rush/temp/operation/build_docs/log-chunks.jsonl +1 -0
- package/.rush/temp/operation/build_docs/state.json +3 -0
- package/.rush/temp/operation/build_package-metas/all.log +1 -0
- package/.rush/temp/operation/build_package-metas/log-chunks.jsonl +1 -0
- package/.rush/temp/operation/build_package-metas/state.json +3 -0
- package/.rush/temp/shrinkwrap-deps.json +4 -0
- package/config/rig.json +5 -0
- package/index.ts +17 -0
- package/package.json +44 -0
- package/rush-logs/web-authn.apply-exports.cache.log +1 -0
- package/rush-logs/web-authn.apply-exports.log +1 -0
- package/rush-logs/web-authn.build_docs.cache.log +1 -0
- package/rush-logs/web-authn.build_docs.log +1 -0
- package/rush-logs/web-authn.build_package-metas.cache.log +1 -0
- package/rush-logs/web-authn.build_package-metas.log +1 -0
- package/support/custom-elements.json +156 -0
- package/support/demos/authenticate.html +24 -0
- package/support/demos/register.html +24 -0
- package/support/dist-docs/web-authn.md +205 -0
- package/support/docs/README.md +81 -0
- package/support/package-meta.json +240 -0
- package/support/tests/authenticate.view.test.ts +28 -0
- package/support/tests/register.view.test.ts +29 -0
- package/support/tests/web-authn.test.ts +566 -0
- package/tsconfig.json +5 -0
- package/web-authn.ts +219 -0
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
{
|
|
2
|
+
"shortName": "web-authn",
|
|
3
|
+
"package": {
|
|
4
|
+
"name": "@excom/web-authn",
|
|
5
|
+
"version": "0.1.0",
|
|
6
|
+
"description": "<web-authn> custom element",
|
|
7
|
+
"peerDependencies": {},
|
|
8
|
+
"excom": {
|
|
9
|
+
"packageType": "kit-element"
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
"demos": {
|
|
13
|
+
"authenticate": "<section>\n <web-authn options-url=\"/api/webauthn/authenticate/options\" verify-url=\"/api/webauthn/authenticate/verify\"\n start-method=\"authenticate\">\n <form>\n <label>\n Username\n <input name=\"username\" required autocomplete=\"username webauthn\">\n </label>\n <button type=\"submit\">Sign in with passkey</button>\n </form>\n <output></output>\n </web-authn>\n <quark-sheet>\n web-authn[is-success] {\n $res: prop(\"provision\").body;\n output {\n content: \"verified: #{$res.verified}\";\n }\n }\n web-authn[is-error] output {\n content: \"Ceremony failed (this mock needs an authenticator).\";\n }\n </quark-sheet>\n</section>\n",
|
|
14
|
+
"register": "<section>\n <web-authn options-url=\"/api/webauthn/register/options\" verify-url=\"/api/webauthn/register/verify\"\n start-method=\"register\">\n <form>\n <label>\n Username\n <input name=\"username\" required autocomplete=\"username\">\n </label>\n <button type=\"submit\">Register passkey</button>\n </form>\n <output></output>\n </web-authn>\n <quark-sheet>\n web-authn[is-success] {\n $res: prop(\"provision\").body;\n output {\n content: \"verified: #{$res.verified}\";\n }\n }\n web-authn[is-error] output {\n content: \"Ceremony failed (this mock needs an authenticator).\";\n }\n </quark-sheet>\n</section>\n"
|
|
15
|
+
},
|
|
16
|
+
"readme": "<h1 id=\"md-web-authn\">web-authn</h1>\n<p>Passkey register / authenticate with HTML. Pair it with Quark to render the result.</p>\n<p><include-content data-demo=\"register\"></include-content> </p>\n<include-content data-language=\"html\"><template><web-authn start-method=\"register\" options-url=\"/api/registration-options\" verify-url=\"/api/users\">\n <form>\n <button type=\"submit\">One click sign up!</button>\n </form>\n</web-authn></template></include-content>\n<h2 id=\"md-features\">Features</h2>\n<ul>\n<li><strong>Provides data</strong> Use Quark to render the verify response</li>\n<li><strong>Full ceremony</strong> Fetches options, runs the browser's WebAuthn prompt, then verifies — one element</li>\n<li><strong>Register or authenticate</strong> <code>start-method</code> picks the ceremony</li>\n<li><strong>Submit command</strong> <code>--submit</code> starts the ceremony programmatically — for forms outside the DOM subtree, or buttons outside the <code><form></code></li>\n<li><strong>Chainable</strong> <code>web-authn-success</code> fires like any <code>{tag}-success</code> event — chain a redirect or next step</li>\n<li><strong>Highly configurable</strong> Headers, credentials, redirect, etc</li>\n</ul>\n<h2 id=\"md-installation\">Installation</h2>\n<p><include-content is-active template-ref=\"/views/install-section/install-section.html\"></include-content></p>\n<p>Depends on <a href=\"https://simplewebauthn.dev/\"><code>@simplewebauthn/browser</code></a> for the actual WebAuthn calls (<code>startRegistration</code> / <code>startAuthentication</code>). You can use any server-side library to handle the WebAuthn requests, but it is recommended to use the counterpart library, <a href=\"https://simplewebauthn.dev/\"><code>@simplewebauthn/server</code></a>, since they seamlessly understand the same contract.</p>\n<h2 id=\"md-usage\">Usage</h2>\n<include-content data-language=\"html\"><template><web-authn options-url=\"/api/webauthn/register/options\"\n verify-url=\"/api/webauthn/register/verify\" start-method=\"register\">\n <form>\n <input name=\"username\" required>\n <button type=\"submit\">Register passkey</button>\n </form>\n</web-authn></template></include-content>\n<p>On submit: <code>options-url</code> is fetched for ceremony options, the browser's native passkey prompt runs (<code>@simplewebauthn/browser</code>), and the resulting credential is posted to <code>verify-url</code>. Use <code>start-method="authenticate"</code> for sign-in instead of registration.</p>\n<p>Hook the lifecycle state with CSS:</p>\n<include-content data-language=\"css\"><template>web-authn[is-loading] { /* show loading spinner */ }\nweb-authn[is-error]::before { content: \"An error occurred.\" }</template></include-content>\n<p>Or Quark:</p>\n<include-content data-language=\"quark\"><template>web-authn[is-success] {\n $res: prop(\"provision\").body;\n span { content: $res.verified; }\n}</template></include-content>\n<p>Chain a next step off success the same way you would for any <code><super-form></code> or <code><provider-fetch></code>:</p>\n<include-content data-language=\"html\"><template><event-handler listen-for=\"web-authn-success\" fire-event=\"onboarding-step-complete\">\n <web-authn options-url=\"/api/webauthn/register/options\"\n verify-url=\"/api/webauthn/register/verify\" start-method=\"register\">\n <form><input name=\"username\"><button type=\"submit\">Register</button></form>\n </web-authn>\n</event-handler></template></include-content>\n<h3 id=\"md-examples\">Examples</h3>\n<h4 id=\"md-authenticate\">Authenticate</h4>\n<p><include-content data-demo=\"authenticate\"></include-content></p>\n<h3 id=\"md-api-reference\">API Reference</h3>\n<p><include-content is-active template-ref=\"/views/api-reference/api-reference.html\"></include-content></p>\n",
|
|
17
|
+
"docs": {
|
|
18
|
+
"readme": "<h1 id=\"md-web-authn\">web-authn</h1>\n<p>Passkey register / authenticate with HTML. Pair it with Quark to render the result.</p>\n<p><include-content data-demo=\"register\"></include-content> </p>\n<include-content data-language=\"html\"><template><web-authn start-method=\"register\" options-url=\"/api/registration-options\" verify-url=\"/api/users\">\n <form>\n <button type=\"submit\">One click sign up!</button>\n </form>\n</web-authn></template></include-content>\n<h2 id=\"md-features\">Features</h2>\n<ul>\n<li><strong>Provides data</strong> Use Quark to render the verify response</li>\n<li><strong>Full ceremony</strong> Fetches options, runs the browser's WebAuthn prompt, then verifies — one element</li>\n<li><strong>Register or authenticate</strong> <code>start-method</code> picks the ceremony</li>\n<li><strong>Submit command</strong> <code>--submit</code> starts the ceremony programmatically — for forms outside the DOM subtree, or buttons outside the <code><form></code></li>\n<li><strong>Chainable</strong> <code>web-authn-success</code> fires like any <code>{tag}-success</code> event — chain a redirect or next step</li>\n<li><strong>Highly configurable</strong> Headers, credentials, redirect, etc</li>\n</ul>\n<h2 id=\"md-installation\">Installation</h2>\n<p><include-content is-active template-ref=\"/views/install-section/install-section.html\"></include-content></p>\n<p>Depends on <a href=\"https://simplewebauthn.dev/\"><code>@simplewebauthn/browser</code></a> for the actual WebAuthn calls (<code>startRegistration</code> / <code>startAuthentication</code>). You can use any server-side library to handle the WebAuthn requests, but it is recommended to use the counterpart library, <a href=\"https://simplewebauthn.dev/\"><code>@simplewebauthn/server</code></a>, since they seamlessly understand the same contract.</p>\n<h2 id=\"md-usage\">Usage</h2>\n<include-content data-language=\"html\"><template><web-authn options-url=\"/api/webauthn/register/options\"\n verify-url=\"/api/webauthn/register/verify\" start-method=\"register\">\n <form>\n <input name=\"username\" required>\n <button type=\"submit\">Register passkey</button>\n </form>\n</web-authn></template></include-content>\n<p>On submit: <code>options-url</code> is fetched for ceremony options, the browser's native passkey prompt runs (<code>@simplewebauthn/browser</code>), and the resulting credential is posted to <code>verify-url</code>. Use <code>start-method="authenticate"</code> for sign-in instead of registration.</p>\n<p>Hook the lifecycle state with CSS:</p>\n<include-content data-language=\"css\"><template>web-authn[is-loading] { /* show loading spinner */ }\nweb-authn[is-error]::before { content: \"An error occurred.\" }</template></include-content>\n<p>Or Quark:</p>\n<include-content data-language=\"quark\"><template>web-authn[is-success] {\n $res: prop(\"provision\").body;\n span { content: $res.verified; }\n}</template></include-content>\n<p>Chain a next step off success the same way you would for any <code><super-form></code> or <code><provider-fetch></code>:</p>\n<include-content data-language=\"html\"><template><event-handler listen-for=\"web-authn-success\" fire-event=\"onboarding-step-complete\">\n <web-authn options-url=\"/api/webauthn/register/options\"\n verify-url=\"/api/webauthn/register/verify\" start-method=\"register\">\n <form><input name=\"username\"><button type=\"submit\">Register</button></form>\n </web-authn>\n</event-handler></template></include-content>\n<h3 id=\"md-examples\">Examples</h3>\n<h4 id=\"md-authenticate\">Authenticate</h4>\n<p><include-content data-demo=\"authenticate\"></include-content></p>\n<h3 id=\"md-api-reference\">API Reference</h3>\n<p><include-content is-active template-ref=\"/views/api-reference/api-reference.html\"></include-content></p>\n"
|
|
19
|
+
},
|
|
20
|
+
"installation": {
|
|
21
|
+
"name": "@excom/web-authn",
|
|
22
|
+
"shortName": "web-authn",
|
|
23
|
+
"version": "0.1.0",
|
|
24
|
+
"description": "<web-authn> custom element",
|
|
25
|
+
"packageType": "kit-element",
|
|
26
|
+
"cdn": "<script src=\"https://unpkg.com/@excom/kit-utils/dist/index.umd.min.js\"></script>\n<script src=\"https://unpkg.com/@excom/neutron/dist/index.umd.min.js\"></script>\n<script src=\"https://unpkg.com/@excom/web-authn@0.1.0/dist/index.umd.min.js\"></script>",
|
|
27
|
+
"install": {
|
|
28
|
+
"npm": "npm install @excom/web-authn"
|
|
29
|
+
},
|
|
30
|
+
"imports": {
|
|
31
|
+
"js": "import \"@excom/web-authn\";",
|
|
32
|
+
"html": "<!-- import path to `node_modules` will depend on your build setup -->\n<script type=\"module\" src=\"/node_modules/@excom/web-authn\"></script>\n<link rel=\"stylesheet\" href=\"/node_modules/@excom/web-authn\">"
|
|
33
|
+
},
|
|
34
|
+
"peerDependencies": []
|
|
35
|
+
},
|
|
36
|
+
"elementApis": [
|
|
37
|
+
{
|
|
38
|
+
"tag": "web-authn",
|
|
39
|
+
"summary": "Passkey register / authenticate wired to a <code><form></code>.",
|
|
40
|
+
"kind": "class",
|
|
41
|
+
"attributes": [
|
|
42
|
+
{
|
|
43
|
+
"name": "api-method",
|
|
44
|
+
"type": "string",
|
|
45
|
+
"description": "HTTP method. Always uppercased before the request is sent.",
|
|
46
|
+
"fieldName": "apiMethod",
|
|
47
|
+
"surface": "option",
|
|
48
|
+
"default": "\"GET\"",
|
|
49
|
+
"inheritedFrom": "@excom/fetchable-element"
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
"name": "api-url",
|
|
53
|
+
"type": "string",
|
|
54
|
+
"description": "Endpoint URL. When the request has no body, the JSON payload (from <code>form-ref</code> or custom <code>doFetch()</code> args) is merged in as query params instead.",
|
|
55
|
+
"fieldName": "apiUrl",
|
|
56
|
+
"surface": "option",
|
|
57
|
+
"default": "\"\"",
|
|
58
|
+
"inheritedFrom": "@excom/fetchable-element"
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
"name": "fetch-credentials",
|
|
62
|
+
"type": "string",
|
|
63
|
+
"description": "<code>RequestInit.credentials</code> mode.",
|
|
64
|
+
"fieldName": "fetchCredentials",
|
|
65
|
+
"surface": "option",
|
|
66
|
+
"default": "\"include\"",
|
|
67
|
+
"values": "\"omit\" | \"same-origin\" | \"include\"",
|
|
68
|
+
"inheritedFrom": "@excom/fetchable-element"
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
"name": "fetch-redirect",
|
|
72
|
+
"type": "string",
|
|
73
|
+
"description": "<code>RequestInit.redirect</code> mode. Unset defers to the browser default (<code>follow</code>).",
|
|
74
|
+
"fieldName": "fetchRedirect",
|
|
75
|
+
"surface": "option",
|
|
76
|
+
"values": "\"follow\" | \"error\" | \"manual\"",
|
|
77
|
+
"inheritedFrom": "@excom/fetchable-element"
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
"name": "form-ref",
|
|
81
|
+
"type": "string",
|
|
82
|
+
"description": "CSS selector for the <code><form></code> to intercept. Must be a descendant to be heard directly — point elsewhere and invoke the <code>--submit</code> command instead.",
|
|
83
|
+
"fieldName": "formRef",
|
|
84
|
+
"surface": "option",
|
|
85
|
+
"default": "\":scope form\"",
|
|
86
|
+
"values": "<CSS Selector>"
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
"name": "form-ref",
|
|
90
|
+
"type": "string",
|
|
91
|
+
"description": "CSS selector for a <code><form></code> to source the request from — its <code>action</code> (URL), <code>method</code>, <code>enctype</code> (Content-Type), and field values (as the JSON payload) all take priority over the matching attributes below. Omit to build the request entirely from attributes / custom <code>doFetch()</code> args.",
|
|
92
|
+
"fieldName": "formRef",
|
|
93
|
+
"surface": "option",
|
|
94
|
+
"values": "<CSS Selector>",
|
|
95
|
+
"inheritedFrom": "@excom/fetchable-element"
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
"name": "has-body",
|
|
99
|
+
"type": "boolean",
|
|
100
|
+
"description": "Force a request body even for methods that don't imply one (<code>GET</code> / <code>HEAD</code>). Already implied for <code>POST</code> / <code>PUT</code> / <code>PATCH</code>.",
|
|
101
|
+
"fieldName": "hasBody",
|
|
102
|
+
"surface": "option",
|
|
103
|
+
"inheritedFrom": "@excom/fetchable-element"
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
"name": "header-accept",
|
|
107
|
+
"type": "string",
|
|
108
|
+
"description": "<code>Accept</code> request header.",
|
|
109
|
+
"fieldName": "headerAccept",
|
|
110
|
+
"surface": "option",
|
|
111
|
+
"default": "\"application/json\"",
|
|
112
|
+
"inheritedFrom": "@excom/fetchable-element"
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
"name": "header-cache-control",
|
|
116
|
+
"type": "string",
|
|
117
|
+
"description": "<code>Cache-Control</code> request header. Unset by default (browser default caching applies).",
|
|
118
|
+
"fieldName": "headerCacheControl",
|
|
119
|
+
"surface": "option",
|
|
120
|
+
"inheritedFrom": "@excom/fetchable-element"
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
"name": "header-content-type",
|
|
124
|
+
"type": "string",
|
|
125
|
+
"description": "<code>Content-Type</code> request header. Dropped entirely when the request has no body.",
|
|
126
|
+
"fieldName": "headerContentType",
|
|
127
|
+
"surface": "option",
|
|
128
|
+
"default": "\"application/json\"",
|
|
129
|
+
"inheritedFrom": "@excom/fetchable-element"
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
"name": "start-method",
|
|
133
|
+
"type": "string",
|
|
134
|
+
"description": "Which WebAuthn ceremony to run.",
|
|
135
|
+
"fieldName": "startMethod",
|
|
136
|
+
"surface": "option",
|
|
137
|
+
"values": "\"register\" | \"authenticate\""
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
"name": "verify-url",
|
|
141
|
+
"type": "string",
|
|
142
|
+
"description": "Endpoint that verifies the credential produced by the browser prompt (your server's <code>verifyRegistrationResponse</code> / <code>verifyAuthenticationResponse</code>). Receives the credential as the request body.",
|
|
143
|
+
"fieldName": "verifyUrl",
|
|
144
|
+
"surface": "option",
|
|
145
|
+
"values": "<URL>"
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
"name": "is-error",
|
|
149
|
+
"type": "boolean",
|
|
150
|
+
"description": "The most recent request failed (non-2xx status, network error, or a thrown error other than <code>AbortError</code>). Fires with the <code>error</code> event.",
|
|
151
|
+
"fieldName": "isError",
|
|
152
|
+
"surface": "state",
|
|
153
|
+
"inheritedFrom": "@excom/fetchable-element"
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
"name": "is-loading",
|
|
157
|
+
"type": "boolean",
|
|
158
|
+
"description": "A request is currently in flight.",
|
|
159
|
+
"fieldName": "isLoading",
|
|
160
|
+
"surface": "state",
|
|
161
|
+
"inheritedFrom": "@excom/fetchable-element"
|
|
162
|
+
},
|
|
163
|
+
{
|
|
164
|
+
"name": "is-success",
|
|
165
|
+
"type": "boolean",
|
|
166
|
+
"description": "The most recent request resolved successfully. Mutually exclusive with <code>is-error</code>.",
|
|
167
|
+
"fieldName": "isSuccess",
|
|
168
|
+
"surface": "state",
|
|
169
|
+
"inheritedFrom": "@excom/fetchable-element"
|
|
170
|
+
}
|
|
171
|
+
],
|
|
172
|
+
"events": [
|
|
173
|
+
{
|
|
174
|
+
"name": "web-authn-error",
|
|
175
|
+
"description": "Dispatched when the request fails — non-2xx status, network error, or a thrown error. <code>event.detail</code> is the error payload (see <code>provision</code>). Not dispatched for aborted requests.",
|
|
176
|
+
"type": "FetchableErrorEvent",
|
|
177
|
+
"typeExpanded": "CustomEvent & { type: \"{tag}-error\"; detail: { bodyUsed: boolean; headers: [string, string][]; ok: boolean; redirected: boolean; status: number; statusText: string; type: ResponseType; url: string; body: unknown; } | { message: string; stack?: string }; bubbles: true; cancelable: true; composed: true }",
|
|
178
|
+
"inheritedFrom": "@excom/fetchable-element"
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
"name": "web-authn-loading",
|
|
182
|
+
"description": "Dispatched immediately before the request is sent.",
|
|
183
|
+
"type": "FetchableLoadingEvent",
|
|
184
|
+
"typeExpanded": "CustomEvent & { type: \"{tag}-loading\"; detail: void; bubbles: true; cancelable: true; composed: true }",
|
|
185
|
+
"inheritedFrom": "@excom/fetchable-element"
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
"name": "web-authn-submit",
|
|
189
|
+
"description": "Internal — dispatched once the browser ceremony (register or authenticate) resolves, just before the verify-url fetch runs. The credential is the request body. Default action calls <code>doFetch()</code>.",
|
|
190
|
+
"type": "WebAuthnSubmitEvent",
|
|
191
|
+
"typeExpanded": "CustomEvent & { type: \"web-authn-submit\"; detail: [url: string, requestInit: RequestInit]; bubbles: true; cancelable: true; composed: true }",
|
|
192
|
+
"defaultAction": "Calls <code>doFetch(url, requestInit)</code> with the event's detail (the verify-url request)."
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
"name": "web-authn-success",
|
|
196
|
+
"description": "Dispatched when the request resolves successfully. <code>event.detail</code> is the parsed response (see <code>provision</code>).",
|
|
197
|
+
"type": "FetchableSuccessEvent",
|
|
198
|
+
"typeExpanded": "CustomEvent & { type: \"{tag}-success\"; detail: { bodyUsed: boolean; headers: [string, string][]; ok: boolean; redirected: boolean; status: number; statusText: string; type: ResponseType; url: string; body: unknown; }; bubbles: true; cancelable: true; composed: true }",
|
|
199
|
+
"inheritedFrom": "@excom/fetchable-element"
|
|
200
|
+
}
|
|
201
|
+
],
|
|
202
|
+
"slots": [],
|
|
203
|
+
"cssProperties": [],
|
|
204
|
+
"cssClasses": [],
|
|
205
|
+
"cssAliases": [],
|
|
206
|
+
"listens": [
|
|
207
|
+
{
|
|
208
|
+
"name": "submit",
|
|
209
|
+
"description": "The default action of the <code><form></code> matched by <code>form-ref</code>; prevented, then starts the ceremony.",
|
|
210
|
+
"type": "WebAuthnNativeSubmitEvent",
|
|
211
|
+
"typeExpanded": "SubmitEvent & { type: \"submit\"; bubbles: true; cancelable: true; composed: false; }"
|
|
212
|
+
}
|
|
213
|
+
],
|
|
214
|
+
"commands": [
|
|
215
|
+
{
|
|
216
|
+
"name": "--submit",
|
|
217
|
+
"description": "Starts the ceremony programmatically (<code><button command="--submit" commandfor="…"></code>) — the only option when <code>form-ref</code> points to a form that isn't a descendant."
|
|
218
|
+
}
|
|
219
|
+
],
|
|
220
|
+
"defaultActions": [
|
|
221
|
+
{
|
|
222
|
+
"name": "web-authn-submit",
|
|
223
|
+
"description": "Calls <code>doFetch(url, requestInit)</code> with the event's detail (the verify-url request)."
|
|
224
|
+
}
|
|
225
|
+
],
|
|
226
|
+
"expectedChildren": [],
|
|
227
|
+
"provisions": [
|
|
228
|
+
{
|
|
229
|
+
"name": "provision",
|
|
230
|
+
"type": "FetchResponse",
|
|
231
|
+
"typeExpanded": "{ bodyUsed: boolean; headers: [string, string][]; ok: boolean; redirected: boolean; status: number; statusText: string; type: ResponseType; url: string; body: unknown; }",
|
|
232
|
+
"description": "Response payload on success, or error payload on failure. Success shape: <code>{ status, statusText, ok, headers, url, redirected, bodyUsed, type, body }</code>. Failure shape is either that same response shape (server responded with an error status) or <code>{ message, stack }</code> (request never completed). Not reflected as an attribute.",
|
|
233
|
+
"fieldName": "provision",
|
|
234
|
+
"inheritedFrom": "@excom/fetchable-element"
|
|
235
|
+
}
|
|
236
|
+
]
|
|
237
|
+
}
|
|
238
|
+
],
|
|
239
|
+
"exportedFiles": {}
|
|
240
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import "@excom/quark-sheet";
|
|
2
|
+
import "../../index";
|
|
3
|
+
import {
|
|
4
|
+
afterEach,
|
|
5
|
+
describe,
|
|
6
|
+
expect,
|
|
7
|
+
it,
|
|
8
|
+
spyFetch,
|
|
9
|
+
} from "@excom/heft-rig/profiles/default/config/test-utils";
|
|
10
|
+
import { mountView, readDemo } from "@excom/quark/support/tests/view-helpers";
|
|
11
|
+
|
|
12
|
+
describe("authenticate view", () => {
|
|
13
|
+
afterEach(() => {
|
|
14
|
+
document.body.innerHTML = "";
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
it("mounts the authenticate form", async () => {
|
|
18
|
+
spyFetch({
|
|
19
|
+
status: 200,
|
|
20
|
+
body: JSON.stringify({ challenge: "x" }),
|
|
21
|
+
});
|
|
22
|
+
const { root } = await mountView(readDemo(import.meta.url, "authenticate"));
|
|
23
|
+
expect(root.querySelector("web-authn")?.getAttribute("start-method")).toBe(
|
|
24
|
+
"authenticate",
|
|
25
|
+
);
|
|
26
|
+
expect(root.querySelector("button")?.textContent).toMatch(/passkey/);
|
|
27
|
+
});
|
|
28
|
+
});
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import "@excom/quark-sheet";
|
|
2
|
+
import "../../index";
|
|
3
|
+
import {
|
|
4
|
+
afterEach,
|
|
5
|
+
describe,
|
|
6
|
+
expect,
|
|
7
|
+
it,
|
|
8
|
+
spyFetch,
|
|
9
|
+
} from "@excom/heft-rig/profiles/default/config/test-utils";
|
|
10
|
+
import { flush, mountView, readDemo } from "@excom/quark/support/tests/view-helpers";
|
|
11
|
+
|
|
12
|
+
describe("register view", () => {
|
|
13
|
+
afterEach(() => {
|
|
14
|
+
document.body.innerHTML = "";
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
it("mounts the register form (no authenticator in happy-dom)", async () => {
|
|
18
|
+
spyFetch({
|
|
19
|
+
status: 200,
|
|
20
|
+
body: JSON.stringify({ rp: { name: "demo" }, user: { id: "1" }, challenge: "x" }),
|
|
21
|
+
});
|
|
22
|
+
const { root } = await mountView(readDemo(import.meta.url, "register"));
|
|
23
|
+
expect(root.querySelector("web-authn")?.getAttribute("start-method")).toBe(
|
|
24
|
+
"register",
|
|
25
|
+
);
|
|
26
|
+
expect(root.querySelector('input[name="username"]')).toBeTruthy();
|
|
27
|
+
await flush();
|
|
28
|
+
});
|
|
29
|
+
});
|