1- // ! adapted from https://github.com/github/webauthn-json/blob/63958abfcf04d1e56e3d054d9a156d1cfb3d3ee0/src/webauthn-json/basic/json.ts
2-
3- /**
4- * Using a branded type to communicate that this isn't just any string, but a Base64URL-encoded string
5- */
6- export type Base64URLString = string
1+ import type {
2+ // - for override
3+ AuthenticationExtensionsClientInputs as TypeScriptAuthenticationExtensionsClientInputs ,
4+ // - for use & reexport
5+ Base64URLString ,
6+ AuthenticatorTransportFuture ,
7+ PublicKeyCredentialJSON ,
8+ PublicKeyCredentialDescriptorJSON ,
9+ PublicKeyCredentialUserEntityJSON ,
10+ AuthenticatorAttestationResponseJSON ,
11+ } from '@simplewebauthn/typescript-types'
12+
13+ export type {
14+ AttestationConveyancePreference ,
15+ AuthenticationCredential ,
16+ AuthenticatorAssertionResponse ,
17+ AuthenticatorAttachment ,
18+ AuthenticatorAttestationResponse ,
19+ AuthenticatorSelectionCriteria ,
20+ AuthenticatorTransport ,
21+ COSEAlgorithmIdentifier ,
22+ Crypto ,
23+ PublicKeyCredentialCreationOptions ,
24+ PublicKeyCredentialDescriptor ,
25+ PublicKeyCredentialParameters ,
26+ PublicKeyCredentialRequestOptions ,
27+ PublicKeyCredentialRpEntity ,
28+ PublicKeyCredentialType ,
29+ PublicKeyCredentialUserEntity ,
30+ RegistrationCredential ,
31+ UserVerificationRequirement ,
32+ } from '@simplewebauthn/typescript-types'
33+
34+ export type {
35+ Base64URLString ,
36+ PublicKeyCredentialJSON ,
37+ AuthenticatorTransportFuture ,
38+ PublicKeyCredentialDescriptorJSON ,
39+ PublicKeyCredentialUserEntityJSON ,
40+ AuthenticatorAttestationResponseJSON ,
41+ }
742
843/**
944 * A variant of PublicKeyCredentialCreationOptions suitable for JSON transmission
@@ -37,24 +72,6 @@ export interface PublicKeyCredentialRequestOptionsJSON {
3772 extensions ?: AuthenticationExtensionsClientInputs
3873}
3974
40- /**
41- * - Specification reference: https://w3c.github.io/webauthn/#dictdef-publickeycredentialdescriptorjson
42- */
43- export interface PublicKeyCredentialDescriptorJSON {
44- id : Base64URLString
45- type : PublicKeyCredentialType
46- transports ?: AuthenticatorTransportFuture [ ]
47- }
48-
49- /**
50- * - Specification reference: https://w3c.github.io/webauthn/#dictdef-publickeycredentialuserentityjson
51- */
52- export interface PublicKeyCredentialUserEntityJSON {
53- id : string
54- name : string
55- displayName : string
56- }
57-
5875/**
5976 * A slightly-modified RegistrationCredential to simplify working with ArrayBuffers that
6077 * are Base64URL-encoded so that they can be sent as JSON.
@@ -85,24 +102,6 @@ export interface AuthenticationResponseJSON {
85102 type : PublicKeyCredentialType
86103}
87104
88- /**
89- * A slightly-modified AuthenticatorAttestationResponse to simplify working with ArrayBuffers that
90- * are Base64URL-encoded so that they can be sent as JSON.
91- *
92- * - Specification reference: https://w3c.github.io/webauthn/#dictdef-authenticatorattestationresponsejson
93- */
94- export interface AuthenticatorAttestationResponseJSON {
95- clientDataJSON : Base64URLString
96- attestationObject : Base64URLString
97- // Optional in L2, but becomes required in L3. Play it safe until L3 becomes Recommendation
98- authenticatorData ?: Base64URLString
99- // Optional in L2, but becomes required in L3. Play it safe until L3 becomes Recommendation
100- transports ?: AuthenticatorTransportFuture [ ]
101- // Optional in L2, but becomes required in L3. Play it safe until L3 becomes Recommendation
102- publicKeyAlgorithm ?: COSEAlgorithmIdentifier
103- publicKey ?: Base64URLString
104- }
105-
106105/**
107106 * A slightly-modified AuthenticatorAssertionResponse to simplify working with ArrayBuffers that
108107 * are Base64URL-encoded so that they can be sent as JSON.
@@ -116,57 +115,15 @@ export interface AuthenticatorAssertionResponseJSON {
116115 userHandle ?: string
117116}
118117
119- /**
120- * A WebAuthn-compatible device and the information needed to verify assertions by it
121- */
122- export type AuthenticatorDevice = {
123- credentialPublicKey : Uint8Array
124- credentialID : Uint8Array
125- // Number of times this authenticator is expected to have been used
126- counter : number
127- // From browser's `startRegistration()` -> RegistrationCredentialJSON.transports (API L2 and up)
128- transports ?: AuthenticatorTransportFuture [ ]
129- }
130-
131- /**
132- * A super class of TypeScript's `AuthenticatorTransport` that includes support for the latest
133- * transports. Should eventually be replaced by TypeScript's when TypeScript gets updated to
134- * know about it (sometime after 5.3)
135- */
136- export type AuthenticatorTransportFuture =
137- | 'ble'
138- | 'cable'
139- | 'hybrid'
140- | 'internal'
141- | 'nfc'
142- | 'smart-card'
143- | 'usb'
144-
145- /**
146- * A super class of TypeScript's `PublicKeyCredentialDescriptor` that knows about the latest
147- * transports. Should eventually be replaced by TypeScript's when TypeScript gets updated to
148- * know about it (sometime after 5.3)
149- */
150- export interface PublicKeyCredentialDescriptorFuture
151- extends Omit < PublicKeyCredentialDescriptor , 'transports' > {
152- transports ?: AuthenticatorTransportFuture [ ]
153- }
154-
155- /**
156- * - Specification reference: https://w3c.github.io/webauthn/#typedefdef-publickeycredentialjson
157- */
158- export type PublicKeyCredentialJSON = RegistrationResponseJSON | AuthenticationResponseJSON
159-
160118/**
161119 * TypeScript's types are behind the latest extensions spec, so we define them here.
162120 * Should eventually be replaced by TypeScript's when TypeScript gets updated to
163121 * know about it (sometime after 5.3)
164- */
165-
166- /**
122+ *
167123 * - Specification reference: https://w3c.github.io/webauthn/#dictdef-authenticationextensionsclientinputs
168124 */
169- export interface AuthenticationExtensionsClientInputs {
125+ export interface AuthenticationExtensionsClientInputs
126+ extends TypeScriptAuthenticationExtensionsClientInputs {
170127 largeBlob ?: AuthenticationExtensionsLargeBlobInputs
171128}
172129
0 commit comments