summaryrefslogtreecommitdiffhomepage
path: root/packages/typescript-types
diff options
context:
space:
mode:
authorMatthew Miller <matthew@millerti.me>2022-12-27 19:14:20 -0800
committerMatthew Miller <matthew@millerti.me>2022-12-27 19:14:31 -0800
commit5c189467882fc11a9ac7fcbac5cc8ab5d6bba03f (patch)
treea07a3fcc77a96b7c806c88e1a631bcef3e2adad4 /packages/typescript-types
parent495c0881367ec3017553f74c3c826fb68cfd407f (diff)
Copy over some registration types
Diffstat (limited to 'packages/typescript-types')
-rw-r--r--packages/typescript-types/src/index.ts45
1 files changed, 36 insertions, 9 deletions
diff --git a/packages/typescript-types/src/index.ts b/packages/typescript-types/src/index.ts
index 3bb93ba..4b20694 100644
--- a/packages/typescript-types/src/index.ts
+++ b/packages/typescript-types/src/index.ts
@@ -13,6 +13,15 @@ import type {
PublicKeyCredentialUserEntity,
AuthenticationExtensionsClientInputs,
AuthenticationExtensionsClientOutputs,
+ PublicKeyCredentialRpEntity,
+ PublicKeyCredentialType,
+ PublicKeyCredentialParameters,
+ AuthenticatorSelectionCriteria,
+ AttestationConveyancePreference,
+ UserVerificationRequirement,
+ AuthenticatorAttachment,
+ PublicKeyCredentialCreationOptions,
+ PublicKeyCredentialRequestOptions,
} from './dom';
export * from './dom';
@@ -20,12 +29,21 @@ export * from './dom';
/**
* A variant of PublicKeyCredentialCreationOptions suitable for JSON transmission to the browser to
* (eventually) get passed into navigator.credentials.create(...) in the browser.
+ *
+ * This should eventually get replaced with official TypeScript DOM types when WebAuthn L3 types
+ * eventually make it into the language:
+ *
+ * https://w3c.github.io/webauthn/#dictdef-publickeycredentialcreationoptionsjson
*/
-export interface PublicKeyCredentialCreationOptionsJSON
- extends Omit<PublicKeyCredentialCreationOptions, 'challenge' | 'user' | 'excludeCredentials'> {
+export interface PublicKeyCredentialCreationOptionsJSON {
+ rp: PublicKeyCredentialRpEntity;
user: PublicKeyCredentialUserEntityJSON;
challenge: Base64URLString;
- excludeCredentials: PublicKeyCredentialDescriptorJSON[];
+ pubKeyCredParams: PublicKeyCredentialParameters[];
+ timeout?: number;
+ excludeCredentials?: PublicKeyCredentialDescriptorJSON[];
+ authenticatorSelection?: AuthenticatorSelectionCriteria;
+ attestation?: AttestationConveyancePreference;
extensions?: AuthenticationExtensionsClientInputs;
}
@@ -33,22 +51,31 @@ export interface PublicKeyCredentialCreationOptionsJSON
* A variant of PublicKeyCredentialRequestOptions suitable for JSON transmission to the browser to
* (eventually) get passed into navigator.credentials.get(...) in the browser.
*/
-export interface PublicKeyCredentialRequestOptionsJSON
- extends Omit<PublicKeyCredentialRequestOptions, 'challenge' | 'allowCredentials'> {
+export interface PublicKeyCredentialRequestOptionsJSON {
challenge: Base64URLString;
+ timeout?: number;
+ rpId?: string;
allowCredentials?: PublicKeyCredentialDescriptorJSON[];
+ userVerification?: UserVerificationRequirement;
extensions?: AuthenticationExtensionsClientInputs;
}
-export interface PublicKeyCredentialDescriptorJSON
- extends Omit<PublicKeyCredentialDescriptorFuture, 'id' | 'transports'> {
+/**
+ * https://w3c.github.io/webauthn/#dictdef-publickeycredentialdescriptorjson
+ */
+export interface PublicKeyCredentialDescriptorJSON {
id: Base64URLString;
+ type: PublicKeyCredentialType;
transports?: AuthenticatorTransportFuture[];
}
-export interface PublicKeyCredentialUserEntityJSON
- extends Omit<PublicKeyCredentialUserEntity, 'id'> {
+/**
+ * https://w3c.github.io/webauthn/#dictdef-publickeycredentialuserentityjson
+ */
+export interface PublicKeyCredentialUserEntityJSON {
id: string;
+ name: string;
+ displayName: string;
}
/**