0.0.1 • Published 1 year ago

@darkedges/capacitor-native-passkey v0.0.1

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
1 year ago

@darkedges/webauthn

WebAuthn

Install

npm install @darkedges/webauthn
npx cap sync

API

isWebAuthnAvailable()

isWebAuthnAvailable() => Promise<{ value: boolean; }>

Returns: Promise<{ value: boolean; }>


isWebAuthnAutoFillAvailable()

isWebAuthnAutoFillAvailable() => Promise<{ value: boolean; }>

Returns: Promise<{ value: boolean; }>


startRegistration(...)

startRegistration(publicKeyCredentialCreationOptionsJSON: PublicKeyCredentialCreationOptionsJSON) => Promise<RegistrationResponseJSON>
ParamType
publicKeyCredentialCreationOptionsJSONPublicKeyCredentialCreationOptionsJSON

Returns: Promise<RegistrationResponseJSON>


startAuthentication(...)

startAuthentication(requestOptionsJSON: PublicKeyCredentialRequestOptionsJSON, useBrowserAutofill?: boolean | undefined) => Promise<AuthenticationResponseJSON>
ParamType
requestOptionsJSONPublicKeyCredentialRequestOptionsJSON
useBrowserAutofillboolean

Returns: Promise<AuthenticationResponseJSON>


Interfaces

RegistrationResponseJSON

A slightly-modified RegistrationCredential to simplify working with ArrayBuffers that are Base64URL-encoded in the browser so that they can be sent as JSON to the server.

https://w3c.github.io/webauthn/#dictdef-registrationresponsejson

PropType
idBase64URLString
rawIdBase64URLString
responseAuthenticatorAttestationResponseJSON
authenticatorAttachmentAuthenticatorAttachment
clientExtensionResultsAuthenticationExtensionsClientOutputs
typePublicKeyCredentialType

AuthenticatorAttestationResponseJSON

A slightly-modified AuthenticatorAttestationResponse to simplify working with ArrayBuffers that are Base64URL-encoded in the browser so that they can be sent as JSON to the server.

https://w3c.github.io/webauthn/#dictdef-authenticatorattestationresponsejson

PropType
clientDataJSONBase64URLString
attestationObjectBase64URLString
transportsAuthenticatorTransportFuture[]

AuthenticationExtensionsClientOutputs

PropType
appidboolean
credPropsCredentialPropertiesOutput
hmacCreateSecretboolean

CredentialPropertiesOutput

PropType
rkboolean

PublicKeyCredentialCreationOptionsJSON

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

PropType
rpPublicKeyCredentialRpEntity
userPublicKeyCredentialUserEntityJSON
challengeBase64URLString
pubKeyCredParamsPublicKeyCredentialParameters[]
timeoutnumber
excludeCredentialsPublicKeyCredentialDescriptorJSON[]
authenticatorSelectionAuthenticatorSelectionCriteria
attestationAttestationConveyancePreference
extensionsAuthenticationExtensionsClientInputs

PublicKeyCredentialRpEntity

PropType
idstring

PublicKeyCredentialUserEntityJSON

https://w3c.github.io/webauthn/#dictdef-publickeycredentialuserentityjson

PropType
idstring
namestring
displayNamestring

PublicKeyCredentialParameters

PropType
algCOSEAlgorithmIdentifier
typePublicKeyCredentialType

PublicKeyCredentialDescriptorJSON

https://w3c.github.io/webauthn/#dictdef-publickeycredentialdescriptorjson

PropType
idBase64URLString
typePublicKeyCredentialType
transportsAuthenticatorTransportFuture[]

AuthenticatorSelectionCriteria

PropType
authenticatorAttachmentAuthenticatorAttachment
requireResidentKeyboolean
residentKeyResidentKeyRequirement
userVerificationUserVerificationRequirement

AuthenticationExtensionsClientInputs

PropType
appidstring
credPropsboolean
hmacCreateSecretboolean

AuthenticationResponseJSON

A slightly-modified AuthenticationCredential to simplify working with ArrayBuffers that are Base64URL-encoded in the browser so that they can be sent as JSON to the server.

https://w3c.github.io/webauthn/#dictdef-authenticationresponsejson

PropType
idBase64URLString
rawIdBase64URLString
responseAuthenticatorAssertionResponseJSON
authenticatorAttachmentAuthenticatorAttachment
clientExtensionResultsAuthenticationExtensionsClientOutputs
typePublicKeyCredentialType

AuthenticatorAssertionResponseJSON

A slightly-modified AuthenticatorAssertionResponse to simplify working with ArrayBuffers that are Base64URL-encoded in the browser so that they can be sent as JSON to the server.

https://w3c.github.io/webauthn/#dictdef-authenticatorassertionresponsejson

PropType
clientDataJSONBase64URLString
authenticatorDataBase64URLString
signatureBase64URLString
userHandlestring

PublicKeyCredentialRequestOptionsJSON

A variant of PublicKeyCredentialRequestOptions suitable for JSON transmission to the browser to (eventually) get passed into navigator.credentials.get(...) in the browser.

PropType
challengeBase64URLString
timeoutnumber
rpIdstring
allowCredentialsPublicKeyCredentialDescriptorJSON[]
userVerificationUserVerificationRequirement
extensionsAuthenticationExtensionsClientInputs

Type Aliases

Base64URLString

An attempt to communicate that this isn't just any string, but a Base64URL-encoded string

string

AuthenticatorTransportFuture

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)

'ble' | 'internal' | 'nfc' | 'usb' | 'cable' | 'hybrid'

AuthenticatorAttachment

"cross-platform" | "platform"

PublicKeyCredentialType

"public-key"

COSEAlgorithmIdentifier

number

ResidentKeyRequirement

"discouraged" | "preferred" | "required"

UserVerificationRequirement

"discouraged" | "preferred" | "required"

AttestationConveyancePreference

"direct" | "enterprise" | "indirect" | "none"