Skip to content

zap-finance/capacitor-native-webauthn

 
 

Repository files navigation

@darkedges/capacitor-native-webauthn

PassKey

Install

npm install @darkedges/capacitor-native-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>
Param Type
publicKeyCredentialCreationOptionsJSON PublicKeyCredentialCreationOptionsJSON

Returns: Promise<RegistrationResponseJSON>


startAuthentication(...)

startAuthentication(requestOptionsJSON: PublicKeyCredentialRequestOptionsJSON, useBrowserAutofill?: boolean | undefined) => Promise<AuthenticationResponseJSON>
Param Type
requestOptionsJSON PublicKeyCredentialRequestOptionsJSON
useBrowserAutofill boolean

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

Prop Type
id Base64URLString
rawId Base64URLString
response AuthenticatorAttestationResponseJSON
authenticatorAttachment AuthenticatorAttachment
clientExtensionResults AuthenticationExtensionsClientOutputs
type PublicKeyCredentialType

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

Prop Type
clientDataJSON Base64URLString
attestationObject Base64URLString
authenticatorData Base64URLString
transports AuthenticatorTransportFuture[]
publicKeyAlgorithm COSEAlgorithmIdentifier
publicKey Base64URLString

AuthenticationExtensionsClientOutputs

Prop Type
appid boolean
credProps CredentialPropertiesOutput
hmacCreateSecret boolean

CredentialPropertiesOutput

Prop Type
rk boolean

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

Prop Type
rp PublicKeyCredentialRpEntity
user PublicKeyCredentialUserEntityJSON
challenge Base64URLString
pubKeyCredParams PublicKeyCredentialParameters[]
timeout number
excludeCredentials PublicKeyCredentialDescriptorJSON[]
authenticatorSelection AuthenticatorSelectionCriteria
attestation AttestationConveyancePreference
extensions AuthenticationExtensionsClientInputs

PublicKeyCredentialRpEntity

Prop Type
id string

PublicKeyCredentialUserEntityJSON

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

Prop Type
id string
name string
displayName string

PublicKeyCredentialParameters

Prop Type
alg COSEAlgorithmIdentifier
type PublicKeyCredentialType

PublicKeyCredentialDescriptorJSON

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

Prop Type
id Base64URLString
type PublicKeyCredentialType
transports AuthenticatorTransportFuture[]

AuthenticatorSelectionCriteria

Prop Type
authenticatorAttachment AuthenticatorAttachment
requireResidentKey boolean
residentKey ResidentKeyRequirement
userVerification UserVerificationRequirement

AuthenticationExtensionsClientInputs

Prop Type
appid string
credProps boolean
hmacCreateSecret boolean

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

Prop Type
id Base64URLString
rawId Base64URLString
response AuthenticatorAssertionResponseJSON
authenticatorAttachment AuthenticatorAttachment
clientExtensionResults AuthenticationExtensionsClientOutputs
type PublicKeyCredentialType

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

Prop Type
clientDataJSON Base64URLString
authenticatorData Base64URLString
signature Base64URLString
userHandle string

PublicKeyCredentialRequestOptionsJSON

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

Prop Type
challenge Base64URLString
timeout number
rpId string
allowCredentials PublicKeyCredentialDescriptorJSON[]
userVerification UserVerificationRequirement
extensions AuthenticationExtensionsClientInputs

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' | 'cable' | 'hybrid' | 'internal' | 'nfc' | 'smart-card' | 'usb'

COSEAlgorithmIdentifier

number

AuthenticatorAttachment

"cross-platform" | "platform"

PublicKeyCredentialType

"public-key"

ResidentKeyRequirement

"discouraged" | "preferred" | "required"

UserVerificationRequirement

"discouraged" | "preferred" | "required"

AttestationConveyancePreference

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

Releases

No releases published

Packages

No packages published

Languages

  • Java 44.3%
  • Swift 36.7%
  • TypeScript 9.8%
  • Ruby 3.9%
  • Objective-C 3.3%
  • JavaScript 2.0%