summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorMatthew Miller <matthew@millerti.me>2020-10-05 02:21:40 -0700
committerMatthew Miller <matthew@millerti.me>2020-10-05 02:21:40 -0700
commit65fab90702e11dfb285ec3aa3c960a5d6b84bcea (patch)
tree0d1e81ecc731641f274cee4e160395c707387853
parent118e3b2234790d22902c61abe171df765eb5133a (diff)
Create AuthenticatorAttestationResponseFuture type
-rw-r--r--packages/typescript-types/src/index.ts35
1 files changed, 23 insertions, 12 deletions
diff --git a/packages/typescript-types/src/index.ts b/packages/typescript-types/src/index.ts
index bcecc64..23d2d99 100644
--- a/packages/typescript-types/src/index.ts
+++ b/packages/typescript-types/src/index.ts
@@ -7,9 +7,8 @@
* A variant of PublicKeyCredentialCreationOptions suitable for JSON transmission to the browser to
* (eventually) get passed into navigator.credentials.create(...) in the browser.
*/
-export interface PublicKeyCredentialCreationOptionsJSON extends Omit<
-PublicKeyCredentialCreationOptions, 'challenge' | 'user' | 'excludeCredentials'
-> {
+export interface PublicKeyCredentialCreationOptionsJSON
+ extends Omit<PublicKeyCredentialCreationOptions, 'challenge' | 'user' | 'excludeCredentials'> {
user: PublicKeyCredentialUserEntityJSON;
challenge: Base64URLString;
excludeCredentials: PublicKeyCredentialDescriptorJSON[];
@@ -19,22 +18,19 @@ PublicKeyCredentialCreationOptions, 'challenge' | 'user' | 'excludeCredentials'
* 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
+ extends Omit<PublicKeyCredentialRequestOptions, 'challenge' | 'allowCredentials'> {
challenge: Base64URLString;
allowCredentials: PublicKeyCredentialDescriptorJSON[];
}
-export interface PublicKeyCredentialDescriptorJSON extends Omit<
-PublicKeyCredentialDescriptor, 'id'
-> {
+export interface PublicKeyCredentialDescriptorJSON
+ extends Omit<PublicKeyCredentialDescriptor, 'id'> {
id: Base64URLString;
}
-export interface PublicKeyCredentialUserEntityJSON extends Omit <
-PublicKeyCredentialUserEntity, 'id'
-> {
+export interface PublicKeyCredentialUserEntityJSON
+ extends Omit<PublicKeyCredentialUserEntity, 'id'> {
id: Base64URLString;
}
@@ -111,3 +107,18 @@ export type AuthenticatorDevice = {
* An attempt to communicate that this isn't just any string, but a Base64URL-encoded string
*/
export type Base64URLString = string;
+
+/**
+ * AuthenticatorAttestationResponse in lib.dom.d.ts is outdated. Maintain an augmented version here
+ * so we can implement additional properties as the WebAuthn spec evolves.
+ *
+ * See https://www.w3.org/TR/webauthn-2/#iface-authenticatorattestationresponse
+ *
+ * Properties marked optional are not supported in all browsers.
+ */
+export interface AuthenticatorAttestationResponseFuture extends AuthenticatorAttestationResponse {
+ getTransports?: () => AuthenticatorTransport[];
+ getAuthenticatorData?: () => ArrayBuffer;
+ getPublicKey?: () => ArrayBuffer;
+ getPublicKeyAlgorithm?: () => COSEAlgorithmIdentifier[];
+}