0.1.0 • Published 1 year ago

cx-passkeys v0.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

CX Passkeys

a node package for managing native passkeys

Pre Requisites

  • $ npx expo prebuild
  • on iOS, a provisioning profile with the associated domains capability enabled
  • on iOS, an entitlements file with valid domain. Example below:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>com.apple.developer.associated-domains</key>
	<array>
		<string>webcredentials:yourdomain.com</string>
	</array>
</dict>
</plist>
  • asset-links and apple-app-site-association files hosted on the fully qualified domain
  • api endpoints that support FIDO & WebAuthn specifications to generate a challenge

Installation

npm install cx-passkeys

Passkey Creation

const PasskeyManager = NativeModules.CXPasskeys

PasskeyManager.doPasskeyCreation(
	user.email, 
	user.id, 
	serverChallenge, 
	(result) => {
	// pass passkey registration result data to server...
})

Passkey Authentication

PasskeyManager.onAuthViaPasskey(clientData).then(data => {
    // parse data and send user to authenticated area of your app
}).catch(error => {
	console.log("Error with authentication: "+ error)
})
0.1.0

1 year ago