summaryrefslogtreecommitdiffhomepage
path: root/packages/typescript-types
diff options
context:
space:
mode:
authorMatthew Miller <matthew@millerti.me>2022-05-18 16:29:30 -0700
committerGitHub <noreply@github.com>2022-05-18 16:29:30 -0700
commitc245be34b40c79c798661ce5869b49ec5a964ac3 (patch)
tree0e45394439b42b0339d4b5a48ac204458e570a69 /packages/typescript-types
parentc93517488b6efec5c72ff212b834f4c6138ad494 (diff)
parent97790e8c6f5f00a9875414aee3d4d7ed20f0f437 (diff)
Merge pull request #203 from MasterKale/fix/authenticator-transports-override
fix/authenticator-transports-override
Diffstat (limited to 'packages/typescript-types')
-rw-r--r--packages/typescript-types/extract-dom-types.ts1
-rw-r--r--packages/typescript-types/src/index.ts26
2 files changed, 19 insertions, 8 deletions
diff --git a/packages/typescript-types/extract-dom-types.ts b/packages/typescript-types/extract-dom-types.ts
index 75d16cc..856cb63 100644
--- a/packages/typescript-types/extract-dom-types.ts
+++ b/packages/typescript-types/extract-dom-types.ts
@@ -20,6 +20,7 @@ const types = [
'AuthenticatorAssertionResponse',
'AttestationConveyancePreference',
'AuthenticatorAttestationResponse',
+ 'AuthenticatorTransport',
'AuthenticationExtensionsClientInputs',
'AuthenticationExtensionsClientOutputs',
'AuthenticatorSelectionCriteria',
diff --git a/packages/typescript-types/src/index.ts b/packages/typescript-types/src/index.ts
index 6381b80..b4bafc0 100644
--- a/packages/typescript-types/src/index.ts
+++ b/packages/typescript-types/src/index.ts
@@ -42,9 +42,9 @@ export interface PublicKeyCredentialRequestOptionsJSON
}
export interface PublicKeyCredentialDescriptorJSON
- extends Omit<PublicKeyCredentialDescriptor, 'id' | 'transports'> {
+ extends Omit<PublicKeyCredentialDescriptorFuture, 'id' | 'transports'> {
id: Base64URLString;
- transports?: AuthenticatorTransport[];
+ transports?: AuthenticatorTransportFuture[];
}
export interface PublicKeyCredentialUserEntityJSON
@@ -68,7 +68,7 @@ export interface RegistrationCredentialJSON
rawId: Base64URLString;
response: AuthenticatorAttestationResponseJSON;
clientExtensionResults: AuthenticationExtensionsClientOutputs;
- transports?: AuthenticatorTransport[];
+ transports?: AuthenticatorTransportFuture[];
}
/**
@@ -123,7 +123,7 @@ export type AuthenticatorDevice = {
// Number of times this authenticator is expected to have been used
counter: number;
// From browser's `startRegistration()` -> RegistrationCredentialJSON.transports (API L2 and up)
- transports?: AuthenticatorTransport[];
+ transports?: AuthenticatorTransportFuture[];
};
/**
@@ -141,17 +141,27 @@ export type Base64URLString = string;
* Properties marked optional are not supported in all browsers.
*/
export interface AuthenticatorAttestationResponseFuture extends AuthenticatorAttestationResponse {
- getTransports?: () => AuthenticatorTransport[];
+ getTransports?: () => AuthenticatorTransportFuture[];
getAuthenticatorData?: () => ArrayBuffer;
getPublicKey?: () => ArrayBuffer;
getPublicKeyAlgorithm?: () => COSEAlgorithmIdentifier[];
}
/**
- * Communication methods by which an authenticator can talk with the browser to perform WebAuthn
- * registration and authentication.
+ * A super class of TypeScript's `AuthenticatorTransport` that includes support for the latest
+ * transports. Should eventually be replaced by TypeScript's when TypeScript gets updated to
+ * know about it (sometime after 4.6.3)
*/
-export type AuthenticatorTransport = "ble" | "internal" | "nfc" | "usb" | "cable";
+export type AuthenticatorTransportFuture = "ble" | "internal" | "nfc" | "usb" | "cable";
+
+/**
+ * A super class of TypeScript's `PublicKeyCredentialDescriptor` that knows about the latest
+ * transports. Should eventually be replaced by TypeScript's when TypeScript gets updated to
+ * know about it (sometime after 4.6.3)
+ */
+export interface PublicKeyCredentialDescriptorFuture extends Omit<PublicKeyCredentialDescriptor, 'transports'> {
+ transports?: AuthenticatorTransportFuture[];
+}
/**
* The two types of credentials as defined by bit 3 ("Backup Eligibility") in authenticator data: