@simplewebauthn/browser 12.0.0 → 13.0.0-alpha1

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.
Files changed (52) hide show
  1. package/README.md +2 -2
  2. package/dist/bundle/index.es5.umd.min.js +2 -2
  3. package/dist/bundle/index.umd.min.js +2 -2
  4. package/esm/helpers/browserSupportsWebAuthn.d.ts +4 -0
  5. package/esm/helpers/browserSupportsWebAuthn.d.ts.map +1 -1
  6. package/esm/helpers/browserSupportsWebAuthn.js +4 -1
  7. package/esm/helpers/browserSupportsWebAuthnAutofill.d.ts.map +1 -1
  8. package/esm/helpers/toAuthenticatorAttachment.d.ts +1 -1
  9. package/esm/helpers/toAuthenticatorAttachment.d.ts.map +1 -1
  10. package/esm/helpers/toPublicKeyCredentialDescriptor.d.ts +1 -1
  11. package/esm/helpers/toPublicKeyCredentialDescriptor.d.ts.map +1 -1
  12. package/esm/helpers/webAuthnAbortService.d.ts +8 -0
  13. package/esm/helpers/webAuthnAbortService.d.ts.map +1 -1
  14. package/esm/helpers/webAuthnAbortService.js +0 -8
  15. package/esm/index.d.ts +10 -15
  16. package/esm/index.d.ts.map +1 -1
  17. package/esm/index.js +10 -14
  18. package/esm/methods/startAuthentication.d.ts +7 -7
  19. package/esm/methods/startAuthentication.d.ts.map +1 -1
  20. package/esm/methods/startRegistration.d.ts +6 -6
  21. package/esm/methods/startRegistration.d.ts.map +1 -1
  22. package/esm/types/dom.d.ts +329 -0
  23. package/esm/types/dom.d.ts.map +1 -0
  24. package/esm/types/dom.js +1 -0
  25. package/esm/types/index.d.ts +205 -0
  26. package/esm/types/index.d.ts.map +1 -0
  27. package/esm/types/index.js +1 -0
  28. package/package.json +2 -4
  29. package/script/helpers/browserSupportsWebAuthn.d.ts +4 -0
  30. package/script/helpers/browserSupportsWebAuthn.d.ts.map +1 -1
  31. package/script/helpers/browserSupportsWebAuthn.js +4 -1
  32. package/script/helpers/browserSupportsWebAuthnAutofill.d.ts.map +1 -1
  33. package/script/helpers/toAuthenticatorAttachment.d.ts +1 -1
  34. package/script/helpers/toAuthenticatorAttachment.d.ts.map +1 -1
  35. package/script/helpers/toPublicKeyCredentialDescriptor.d.ts +1 -1
  36. package/script/helpers/toPublicKeyCredentialDescriptor.d.ts.map +1 -1
  37. package/script/helpers/webAuthnAbortService.d.ts +8 -0
  38. package/script/helpers/webAuthnAbortService.d.ts.map +1 -1
  39. package/script/helpers/webAuthnAbortService.js +0 -8
  40. package/script/index.d.ts +10 -15
  41. package/script/index.d.ts.map +1 -1
  42. package/script/index.js +24 -23
  43. package/script/methods/startAuthentication.d.ts +7 -7
  44. package/script/methods/startAuthentication.d.ts.map +1 -1
  45. package/script/methods/startRegistration.d.ts +6 -6
  46. package/script/methods/startRegistration.d.ts.map +1 -1
  47. package/script/types/dom.d.ts +329 -0
  48. package/script/types/dom.d.ts.map +1 -0
  49. package/script/types/dom.js +2 -0
  50. package/script/types/index.d.ts +205 -0
  51. package/script/types/index.d.ts.map +1 -0
  52. package/script/types/index.js +2 -0
@@ -0,0 +1,205 @@
1
+ /**
2
+ * DO NOT MODIFY THESE FILES!
3
+ *
4
+ * These files were copied from the **types** package. To update this file, make changes to those
5
+ * files instead and then run the following command from the monorepo root folder:
6
+ *
7
+ * deno task codegen:types
8
+ */
9
+ import type { AttestationConveyancePreference, AuthenticationExtensionsClientInputs, AuthenticationExtensionsClientOutputs, AuthenticatorAssertionResponse, AuthenticatorAttachment, AuthenticatorAttestationResponse, AuthenticatorSelectionCriteria, COSEAlgorithmIdentifier, PublicKeyCredential, PublicKeyCredentialCreationOptions, PublicKeyCredentialDescriptor, PublicKeyCredentialParameters, PublicKeyCredentialRequestOptions, PublicKeyCredentialRpEntity, PublicKeyCredentialType, UserVerificationRequirement } from './dom.js';
10
+ export type { AttestationConveyancePreference, AuthenticationExtensionsClientInputs, AuthenticationExtensionsClientOutputs, AuthenticatorAssertionResponse, AuthenticatorAttachment, AuthenticatorAttestationResponse, AuthenticatorSelectionCriteria, AuthenticatorTransport, COSEAlgorithmIdentifier, Crypto, PublicKeyCredential, PublicKeyCredentialCreationOptions, PublicKeyCredentialDescriptor, PublicKeyCredentialParameters, PublicKeyCredentialRequestOptions, PublicKeyCredentialRpEntity, PublicKeyCredentialType, PublicKeyCredentialUserEntity, UserVerificationRequirement, } from './dom.js';
11
+ /**
12
+ * A variant of PublicKeyCredentialCreationOptions suitable for JSON transmission to the browser to
13
+ * (eventually) get passed into navigator.credentials.create(...) in the browser.
14
+ *
15
+ * This should eventually get replaced with official TypeScript DOM types when WebAuthn L3 types
16
+ * eventually make it into the language:
17
+ *
18
+ * https://w3c.github.io/webauthn/#dictdef-publickeycredentialcreationoptionsjson
19
+ */
20
+ export interface PublicKeyCredentialCreationOptionsJSON {
21
+ rp: PublicKeyCredentialRpEntity;
22
+ user: PublicKeyCredentialUserEntityJSON;
23
+ challenge: Base64URLString;
24
+ pubKeyCredParams: PublicKeyCredentialParameters[];
25
+ timeout?: number;
26
+ excludeCredentials?: PublicKeyCredentialDescriptorJSON[];
27
+ authenticatorSelection?: AuthenticatorSelectionCriteria;
28
+ hints?: PublicKeyCredentialHint[];
29
+ attestation?: AttestationConveyancePreference;
30
+ attestationFormats?: AttestationFormat[];
31
+ extensions?: AuthenticationExtensionsClientInputs;
32
+ }
33
+ /**
34
+ * A variant of PublicKeyCredentialRequestOptions suitable for JSON transmission to the browser to
35
+ * (eventually) get passed into navigator.credentials.get(...) in the browser.
36
+ */
37
+ export interface PublicKeyCredentialRequestOptionsJSON {
38
+ challenge: Base64URLString;
39
+ timeout?: number;
40
+ rpId?: string;
41
+ allowCredentials?: PublicKeyCredentialDescriptorJSON[];
42
+ userVerification?: UserVerificationRequirement;
43
+ hints?: PublicKeyCredentialHint[];
44
+ extensions?: AuthenticationExtensionsClientInputs;
45
+ }
46
+ /**
47
+ * https://w3c.github.io/webauthn/#dictdef-publickeycredentialdescriptorjson
48
+ */
49
+ export interface PublicKeyCredentialDescriptorJSON {
50
+ id: Base64URLString;
51
+ type: PublicKeyCredentialType;
52
+ transports?: AuthenticatorTransportFuture[];
53
+ }
54
+ /**
55
+ * https://w3c.github.io/webauthn/#dictdef-publickeycredentialuserentityjson
56
+ */
57
+ export interface PublicKeyCredentialUserEntityJSON {
58
+ id: string;
59
+ name: string;
60
+ displayName: string;
61
+ }
62
+ /**
63
+ * The value returned from navigator.credentials.create()
64
+ */
65
+ export interface RegistrationCredential extends PublicKeyCredentialFuture {
66
+ response: AuthenticatorAttestationResponseFuture;
67
+ }
68
+ /**
69
+ * A slightly-modified RegistrationCredential to simplify working with ArrayBuffers that
70
+ * are Base64URL-encoded in the browser so that they can be sent as JSON to the server.
71
+ *
72
+ * https://w3c.github.io/webauthn/#dictdef-registrationresponsejson
73
+ */
74
+ export interface RegistrationResponseJSON {
75
+ id: Base64URLString;
76
+ rawId: Base64URLString;
77
+ response: AuthenticatorAttestationResponseJSON;
78
+ authenticatorAttachment?: AuthenticatorAttachment;
79
+ clientExtensionResults: AuthenticationExtensionsClientOutputs;
80
+ type: PublicKeyCredentialType;
81
+ }
82
+ /**
83
+ * The value returned from navigator.credentials.get()
84
+ */
85
+ export interface AuthenticationCredential extends PublicKeyCredentialFuture {
86
+ response: AuthenticatorAssertionResponse;
87
+ }
88
+ /**
89
+ * A slightly-modified AuthenticationCredential to simplify working with ArrayBuffers that
90
+ * are Base64URL-encoded in the browser so that they can be sent as JSON to the server.
91
+ *
92
+ * https://w3c.github.io/webauthn/#dictdef-authenticationresponsejson
93
+ */
94
+ export interface AuthenticationResponseJSON {
95
+ id: Base64URLString;
96
+ rawId: Base64URLString;
97
+ response: AuthenticatorAssertionResponseJSON;
98
+ authenticatorAttachment?: AuthenticatorAttachment;
99
+ clientExtensionResults: AuthenticationExtensionsClientOutputs;
100
+ type: PublicKeyCredentialType;
101
+ }
102
+ /**
103
+ * A slightly-modified AuthenticatorAttestationResponse to simplify working with ArrayBuffers that
104
+ * are Base64URL-encoded in the browser so that they can be sent as JSON to the server.
105
+ *
106
+ * https://w3c.github.io/webauthn/#dictdef-authenticatorattestationresponsejson
107
+ */
108
+ export interface AuthenticatorAttestationResponseJSON {
109
+ clientDataJSON: Base64URLString;
110
+ attestationObject: Base64URLString;
111
+ authenticatorData?: Base64URLString;
112
+ transports?: AuthenticatorTransportFuture[];
113
+ publicKeyAlgorithm?: COSEAlgorithmIdentifier;
114
+ publicKey?: Base64URLString;
115
+ }
116
+ /**
117
+ * A slightly-modified AuthenticatorAssertionResponse to simplify working with ArrayBuffers that
118
+ * are Base64URL-encoded in the browser so that they can be sent as JSON to the server.
119
+ *
120
+ * https://w3c.github.io/webauthn/#dictdef-authenticatorassertionresponsejson
121
+ */
122
+ export interface AuthenticatorAssertionResponseJSON {
123
+ clientDataJSON: Base64URLString;
124
+ authenticatorData: Base64URLString;
125
+ signature: Base64URLString;
126
+ userHandle?: Base64URLString;
127
+ }
128
+ /**
129
+ * Public key credential information needed to verify authentication responses
130
+ */
131
+ export type WebAuthnCredential = {
132
+ id: Base64URLString;
133
+ publicKey: Uint8Array;
134
+ counter: number;
135
+ transports?: AuthenticatorTransportFuture[];
136
+ };
137
+ /**
138
+ * An attempt to communicate that this isn't just any string, but a Base64URL-encoded string
139
+ */
140
+ export type Base64URLString = string;
141
+ /**
142
+ * AuthenticatorAttestationResponse in TypeScript's DOM lib is outdated (up through v3.9.7).
143
+ * Maintain an augmented version here so we can implement additional properties as the WebAuthn
144
+ * spec evolves.
145
+ *
146
+ * See https://www.w3.org/TR/webauthn-2/#iface-authenticatorattestationresponse
147
+ *
148
+ * Properties marked optional are not supported in all browsers.
149
+ */
150
+ export interface AuthenticatorAttestationResponseFuture extends AuthenticatorAttestationResponse {
151
+ getTransports(): AuthenticatorTransportFuture[];
152
+ }
153
+ /**
154
+ * A super class of TypeScript's `AuthenticatorTransport` that includes support for the latest
155
+ * transports. Should eventually be replaced by TypeScript's when TypeScript gets updated to
156
+ * know about it (sometime after 4.6.3)
157
+ */
158
+ export type AuthenticatorTransportFuture = 'ble' | 'cable' | 'hybrid' | 'internal' | 'nfc' | 'smart-card' | 'usb';
159
+ /**
160
+ * A super class of TypeScript's `PublicKeyCredentialDescriptor` that knows about the latest
161
+ * transports. Should eventually be replaced by TypeScript's when TypeScript gets updated to
162
+ * know about it (sometime after 4.6.3)
163
+ */
164
+ export interface PublicKeyCredentialDescriptorFuture extends Omit<PublicKeyCredentialDescriptor, 'transports'> {
165
+ transports?: AuthenticatorTransportFuture[];
166
+ }
167
+ /** */
168
+ export type PublicKeyCredentialJSON = RegistrationResponseJSON | AuthenticationResponseJSON;
169
+ /**
170
+ * A super class of TypeScript's `PublicKeyCredential` that knows about upcoming WebAuthn features
171
+ */
172
+ export interface PublicKeyCredentialFuture extends PublicKeyCredential {
173
+ type: PublicKeyCredentialType;
174
+ isConditionalMediationAvailable?(): Promise<boolean>;
175
+ parseCreationOptionsFromJSON?(options: PublicKeyCredentialCreationOptionsJSON): PublicKeyCredentialCreationOptions;
176
+ parseRequestOptionsFromJSON?(options: PublicKeyCredentialRequestOptionsJSON): PublicKeyCredentialRequestOptions;
177
+ toJSON?(): PublicKeyCredentialJSON;
178
+ }
179
+ /**
180
+ * The two types of credentials as defined by bit 3 ("Backup Eligibility") in authenticator data:
181
+ * - `"singleDevice"` credentials will never be backed up
182
+ * - `"multiDevice"` credentials can be backed up
183
+ */
184
+ export type CredentialDeviceType = 'singleDevice' | 'multiDevice';
185
+ /**
186
+ * Categories of authenticators that Relying Parties can pass along to browsers during
187
+ * registration. Browsers that understand these values can optimize their modal experience to
188
+ * start the user off in a particular registration flow:
189
+ *
190
+ * - `hybrid`: A platform authenticator on a mobile device
191
+ * - `security-key`: A portable FIDO2 authenticator capable of being used on multiple devices via a USB or NFC connection
192
+ * - `client-device`: The device that WebAuthn is being called on. Typically synonymous with platform authenticators
193
+ *
194
+ * See https://w3c.github.io/webauthn/#enumdef-publickeycredentialhint
195
+ *
196
+ * These values are less strict than `authenticatorAttachment`
197
+ */
198
+ export type PublicKeyCredentialHint = 'hybrid' | 'security-key' | 'client-device';
199
+ /**
200
+ * Values for an attestation object's `fmt`
201
+ *
202
+ * See https://www.iana.org/assignments/webauthn/webauthn.xhtml#webauthn-attestation-statement-format-ids
203
+ */
204
+ export type AttestationFormat = 'fido-u2f' | 'packed' | 'android-safetynet' | 'android-key' | 'tpm' | 'apple' | 'none';
205
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AACA;;;;;;;GAOG;AAEH,OAAO,KAAK,EACV,+BAA+B,EAC/B,oCAAoC,EACpC,qCAAqC,EACrC,8BAA8B,EAC9B,uBAAuB,EACvB,gCAAgC,EAChC,8BAA8B,EAC9B,uBAAuB,EACvB,mBAAmB,EACnB,kCAAkC,EAClC,6BAA6B,EAC7B,6BAA6B,EAC7B,iCAAiC,EACjC,2BAA2B,EAC3B,uBAAuB,EACvB,2BAA2B,EAC5B,MAAM,UAAU,CAAC;AAElB,YAAY,EACV,+BAA+B,EAC/B,oCAAoC,EACpC,qCAAqC,EACrC,8BAA8B,EAC9B,uBAAuB,EACvB,gCAAgC,EAChC,8BAA8B,EAC9B,sBAAsB,EACtB,uBAAuB,EACvB,MAAM,EACN,mBAAmB,EACnB,kCAAkC,EAClC,6BAA6B,EAC7B,6BAA6B,EAC7B,iCAAiC,EACjC,2BAA2B,EAC3B,uBAAuB,EACvB,6BAA6B,EAC7B,2BAA2B,GAC5B,MAAM,UAAU,CAAC;AAElB;;;;;;;;GAQG;AACH,MAAM,WAAW,sCAAsC;IACrD,EAAE,EAAE,2BAA2B,CAAC;IAChC,IAAI,EAAE,iCAAiC,CAAC;IACxC,SAAS,EAAE,eAAe,CAAC;IAC3B,gBAAgB,EAAE,6BAA6B,EAAE,CAAC;IAClD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,kBAAkB,CAAC,EAAE,iCAAiC,EAAE,CAAC;IACzD,sBAAsB,CAAC,EAA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