@transmitsecurity/platform-web-sdk 1.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +479 -0
- package/README.md +72 -0
- package/VITE_CONFIG.md +107 -0
- package/build/drs-entry.d.ts +20 -0
- package/build/drs-entry.js +19 -0
- package/build/drs-only.d.ts +22 -0
- package/build/drs-only.js +25 -0
- package/build/drs.d.ts +13 -0
- package/build/drs.js +45 -0
- package/build/ido-entry.d.ts +17 -0
- package/build/ido-entry.js +19 -0
- package/build/ido.d.ts +8 -0
- package/build/ido.js +27 -0
- package/build/idv-entry.d.ts +17 -0
- package/build/idv-entry.js +19 -0
- package/build/idv.d.ts +8 -0
- package/build/idv.js +27 -0
- package/build/initialize-only.d.ts +7 -0
- package/build/initialize-only.js +40 -0
- package/build/initialize.d.ts +1 -0
- package/build/initialize.js +2 -0
- package/build/mainExport.d.ts +16 -0
- package/build/mainExport.js +43 -0
- package/build/sdk-factory.d.ts +109 -0
- package/build/sdk-factory.js +108 -0
- package/build/shared-state.d.ts +4 -0
- package/build/shared-state.js +32 -0
- package/build/webauthn-entry.d.ts +19 -0
- package/build/webauthn-entry.js +19 -0
- package/build/webauthn.d.ts +12 -0
- package/build/webauthn.js +44 -0
- package/bundler-config.json +15 -0
- package/dist/docs/.nojekyll +1 -0
- package/dist/docs/README.md +72 -0
- package/dist/docs/enums/ErrorCode.md +113 -0
- package/dist/docs/interfaces/ActionEventOptions.md +44 -0
- package/dist/docs/interfaces/ActionResponse.md +9 -0
- package/dist/docs/interfaces/AuthenticationAutofillActivateHandlers.md +61 -0
- package/dist/docs/interfaces/AutofillHandlers.md +50 -0
- package/dist/docs/interfaces/CrossDeviceController.md +27 -0
- package/dist/docs/interfaces/SdkError.md +28 -0
- package/dist/docs/interfaces/WebauthnApis.md +73 -0
- package/dist/docs/interfaces/WebauthnAuthenticationFlows.md +52 -0
- package/dist/docs/interfaces/WebauthnCrossDeviceFlows.md +107 -0
- package/dist/docs/interfaces/WebauthnCrossDeviceRegistrationOptions.md +23 -0
- package/dist/docs/interfaces/WebauthnRegistrationOptions.md +55 -0
- package/dist/docs/interfaces/initConfigParams.md +7 -0
- package/dist/docs/modules/drs.md +92 -0
- package/dist/docs/modules/idv.md +106 -0
- package/dist/docs/modules/webauthn.md +197 -0
- package/dist/docs/modules.md +146 -0
- package/dist/drs.cjs +1 -0
- package/dist/drs.d.ts +241 -0
- package/dist/drs.js +1 -0
- package/dist/ido.cjs +1 -0
- package/dist/ido.d.ts +8 -0
- package/dist/ido.js +1 -0
- package/dist/idv.cjs +1 -0
- package/dist/idv.d.ts +68 -0
- package/dist/idv.js +1 -0
- package/dist/index.cjs +1 -0
- package/dist/index.esm.js +1 -0
- package/dist/index.umd.js +1 -0
- package/dist/ts-platform-websdk.js +1 -0
- package/dist/web-sdk-drs+idv+webauthn+ido.js +1 -0
- package/dist/web-sdk.d.ts +1737 -0
- package/dist/webauthn.cjs +1 -0
- package/dist/webauthn.d.ts +461 -0
- package/dist/webauthn.js +1 -0
- package/package.json +98 -0
- package/scripts/make-semver-aliases.sh +11 -0
- package/scripts/upload-dist.sh +6 -0
- package/src/mainExport.ts +75 -0
- package/src/tsconfig.json +14 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// 🔐 WebAuthn-Only Entry Point for Perfect Tree-Shaking
|
|
2
|
+
import { initialize } from './initialize-only';
|
|
3
|
+
import * as webauthnModule from './webauthn';
|
|
4
|
+
/**
|
|
5
|
+
* 🔐 **WebAuthn (Passwordless Authentication)** (~75KB bundle)
|
|
6
|
+
* Perfect for passwordless authentication
|
|
7
|
+
*/
|
|
8
|
+
export async function createWebAuthn(config) {
|
|
9
|
+
// ✅ Validation
|
|
10
|
+
if (!config.clientId) {
|
|
11
|
+
throw new Error('❌ clientId is required');
|
|
12
|
+
}
|
|
13
|
+
// 🔧 Initialize core
|
|
14
|
+
await initialize(config);
|
|
15
|
+
// 🔄 Return WebAuthn module
|
|
16
|
+
return webauthnModule;
|
|
17
|
+
}
|
|
18
|
+
// Export for WebSDK class compatibility
|
|
19
|
+
export { createWebAuthn as webauthn };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
declare global {
|
|
2
|
+
interface Window {
|
|
3
|
+
__TS_WEB_SDK_INITIALIZED__?: boolean;
|
|
4
|
+
__TS_WEB_SDK_CONFIG__?: any;
|
|
5
|
+
}
|
|
6
|
+
}
|
|
7
|
+
export { initialize } from './initialize-only';
|
|
8
|
+
export * from '@transmit-security/authentication-sdk';
|
|
9
|
+
export declare const authenticate: (...args: any[]) => any;
|
|
10
|
+
export declare const register: (...args: any[]) => any;
|
|
11
|
+
export declare const crossDevice: (...args: any[]) => any;
|
|
12
|
+
export type { authenticate as authenticateType, WebauthnApis, WebauthnAuthenticationFlows, AutofillHandlers, AuthenticationAutofillActivateHandlers, WebauthnRegistrationOptions, isAutofillSupported, SdkError, ErrorCode, isPlatformAuthenticatorSupported, register as registerType, crossDevice as crossDeviceType, CrossDeviceController, WebauthnCrossDeviceRegistrationOptions, WebauthnCrossDeviceFlows, getDefaultPaths } from '@transmit-security/authentication-sdk';
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
// WebAuthn module - clean entry point with global state awareness
|
|
2
|
+
import { setInitConfig, getInitConfig } from '@transmit-security/web-sdk-common/dist/module-metadata/module-metadata';
|
|
3
|
+
import { emit } from '@transmit-security/web-sdk-common/dist/events';
|
|
4
|
+
import { MODULE_INITIALIZED } from '@transmit-security/web-sdk-common/dist/events';
|
|
5
|
+
// Function to sync global initialization state when needed
|
|
6
|
+
function ensureInitialized() {
|
|
7
|
+
if (typeof window !== 'undefined' && window.__TS_WEB_SDK_INITIALIZED__ && window.__TS_WEB_SDK_CONFIG__) {
|
|
8
|
+
try {
|
|
9
|
+
const currentConfig = getInitConfig();
|
|
10
|
+
if (!currentConfig || !currentConfig.clientId) {
|
|
11
|
+
console.log('🔄 Syncing global initialization state to WebAuthn module');
|
|
12
|
+
setInitConfig(window.__TS_WEB_SDK_CONFIG__);
|
|
13
|
+
emit(MODULE_INITIALIZED, undefined);
|
|
14
|
+
return true;
|
|
15
|
+
}
|
|
16
|
+
return true;
|
|
17
|
+
}
|
|
18
|
+
catch (error) {
|
|
19
|
+
// If getInitConfig fails, it means common module is not initialized
|
|
20
|
+
console.log('🔄 Initializing WebAuthn module with global state');
|
|
21
|
+
setInitConfig(window.__TS_WEB_SDK_CONFIG__);
|
|
22
|
+
emit(MODULE_INITIALIZED, undefined);
|
|
23
|
+
return true;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
return false;
|
|
27
|
+
}
|
|
28
|
+
// Import the original WebAuthn SDK
|
|
29
|
+
import * as originalWebAuthn from '@transmit-security/authentication-sdk';
|
|
30
|
+
// Create wrapper functions for the main WebAuthn methods
|
|
31
|
+
function wrapWebAuthnMethod(methodName, originalMethod) {
|
|
32
|
+
return function (...args) {
|
|
33
|
+
ensureInitialized();
|
|
34
|
+
return originalMethod.apply(originalWebAuthn, args);
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
// Re-export initialize to ensure shared state
|
|
38
|
+
export { initialize } from './initialize-only';
|
|
39
|
+
// Export all WebAuthn functionality (re-export everything)
|
|
40
|
+
export * from '@transmit-security/authentication-sdk';
|
|
41
|
+
// Override the main methods with wrapped versions (if they exist)
|
|
42
|
+
export const authenticate = originalWebAuthn.authenticate ? wrapWebAuthnMethod('authenticate', originalWebAuthn.authenticate) : originalWebAuthn.authenticate;
|
|
43
|
+
export const register = originalWebAuthn.register ? wrapWebAuthnMethod('register', originalWebAuthn.register) : originalWebAuthn.register;
|
|
44
|
+
export const crossDevice = originalWebAuthn.crossDevice ? wrapWebAuthnMethod('crossDevice', originalWebAuthn.crossDevice) : originalWebAuthn.crossDevice;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"exports": {
|
|
3
|
+
"drs": "@transmit-security/riskid_sdk",
|
|
4
|
+
"idv": "@transmit-security/ts-identity-verification",
|
|
5
|
+
"webauthn": "@transmit-security/authentication-sdk"
|
|
6
|
+
},
|
|
7
|
+
"exportsFromDefault": {
|
|
8
|
+
"ido": "@transmit-security/ido-web-sdk"
|
|
9
|
+
},
|
|
10
|
+
"mainExport": "./build/mainExport",
|
|
11
|
+
"declarations": true,
|
|
12
|
+
"docs": true,
|
|
13
|
+
"minify": true,
|
|
14
|
+
"legacyBrowsers": true
|
|
15
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
TypeDoc added this file to prevent GitHub Pages from using Jekyll. You can turn off this behavior by setting the `githubPages` option to false.
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
# Transmit Security Platform Web SDK
|
|
2
|
+
|
|
3
|
+
A comprehensive browser-based identity and security solution with fraud prevention, WebAuthn authentication, identity verification, and orchestration capabilities.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @transmitsecurity/platform-web-sdk
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Quick Start
|
|
12
|
+
|
|
13
|
+
### Recommended Usage (Full SDK Import)
|
|
14
|
+
|
|
15
|
+
```js
|
|
16
|
+
import { drs, webauthn, idv, ido, initialize } from '@transmitsecurity/platform-web-sdk';
|
|
17
|
+
|
|
18
|
+
// Single initialize call for all modules
|
|
19
|
+
await initialize({
|
|
20
|
+
clientId: 'your-client-id',
|
|
21
|
+
drs: { serverPath: 'https://api.transmitsecurity.io/risk-collect/' },
|
|
22
|
+
webauthn: { serverPath: 'https://api.transmitsecurity.io' }
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
// Use the modules
|
|
26
|
+
await drs.triggerActionEvent('login', { correlationId: 'example' });
|
|
27
|
+
const isSupported = await webauthn.isPlatformAuthenticatorSupported();
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
### Individual Module Imports (Limited Support)
|
|
31
|
+
|
|
32
|
+
⚠️ **Note**: Individual module imports have dependency resolution issues in some bundlers (like Vite). Use full SDK import for better compatibility.
|
|
33
|
+
|
|
34
|
+
```js
|
|
35
|
+
// May cause dependency resolution errors in some environments
|
|
36
|
+
import { drs, initialize } from '@transmitsecurity/platform-web-sdk/drs';
|
|
37
|
+
import { webauthn } from '@transmitsecurity/platform-web-sdk/webauthn';
|
|
38
|
+
|
|
39
|
+
// Single initialize call
|
|
40
|
+
await initialize({
|
|
41
|
+
clientId: 'your-client-id',
|
|
42
|
+
drs: { serverPath: 'https://api.transmitsecurity.io/risk-collect/' },
|
|
43
|
+
webauthn: { serverPath: 'https://api.transmitsecurity.io' }
|
|
44
|
+
});
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Bundle Size
|
|
48
|
+
|
|
49
|
+
The SDK is optimized for production use:
|
|
50
|
+
- **Gzipped**: ~180KB
|
|
51
|
+
- **Uncompressed**: ~565KB
|
|
52
|
+
- **Tree-shaking**: Modern bundlers eliminate unused code automatically
|
|
53
|
+
|
|
54
|
+
## Troubleshooting
|
|
55
|
+
|
|
56
|
+
### Vite Dependency Resolution Errors
|
|
57
|
+
|
|
58
|
+
If you encounter errors like "Could not resolve @transmit-security/web-sdk-common", see [VITE_CONFIG.md](./VITE_CONFIG.md) for detailed solutions.
|
|
59
|
+
|
|
60
|
+
**Quick fix**: Use the full SDK import instead of individual module imports.
|
|
61
|
+
|
|
62
|
+
### Other Bundlers
|
|
63
|
+
|
|
64
|
+
For webpack, Rollup, or other bundlers, the full SDK import should work without additional configuration.
|
|
65
|
+
|
|
66
|
+
## Documentation
|
|
67
|
+
|
|
68
|
+
For complete documentation, visit: https://github.com/transmitsecurity-dev/ciam-web-sdk
|
|
69
|
+
|
|
70
|
+
## License
|
|
71
|
+
|
|
72
|
+
SEE LICENSE IN LICENSE
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
# Enumeration: ErrorCode
|
|
2
|
+
|
|
3
|
+
## Enumeration Members
|
|
4
|
+
|
|
5
|
+
### NotInitialized
|
|
6
|
+
|
|
7
|
+
• **NotInitialized** = ``"not_initialized"``
|
|
8
|
+
|
|
9
|
+
Either the SDK init call failed or another function was called before initializing the SDK
|
|
10
|
+
|
|
11
|
+
___
|
|
12
|
+
|
|
13
|
+
### AuthenticationFailed
|
|
14
|
+
|
|
15
|
+
• **AuthenticationFailed** = ``"authentication_failed"``
|
|
16
|
+
|
|
17
|
+
When the call to [startAuthentication](../interfaces/WebauthnApis.md#startauthentication) failed
|
|
18
|
+
|
|
19
|
+
___
|
|
20
|
+
|
|
21
|
+
### AuthenticationAbortedTimeout
|
|
22
|
+
|
|
23
|
+
• **AuthenticationAbortedTimeout** = ``"authentication_aborted_timeout"``
|
|
24
|
+
|
|
25
|
+
When [authenticate.modal](../interfaces/WebauthnAuthenticationFlows.md#modal) or [authenticate.autofill.activate](../interfaces/AutofillHandlers.md#activate) is called and the modal is closed by the user
|
|
26
|
+
|
|
27
|
+
___
|
|
28
|
+
|
|
29
|
+
### AuthenticationCanceled
|
|
30
|
+
|
|
31
|
+
• **AuthenticationCanceled** = ``"webauthn_authentication_canceled"``
|
|
32
|
+
|
|
33
|
+
When [register](../modules.md#register) is called and the modal is closed when reaching the timeout
|
|
34
|
+
|
|
35
|
+
___
|
|
36
|
+
|
|
37
|
+
### RegistrationFailed
|
|
38
|
+
|
|
39
|
+
• **RegistrationFailed** = ``"registration_failed"``
|
|
40
|
+
|
|
41
|
+
When the call to [startRegistration](../interfaces/WebauthnApis.md#startregistration) failed
|
|
42
|
+
|
|
43
|
+
___
|
|
44
|
+
|
|
45
|
+
### AlreadyRegistered
|
|
46
|
+
|
|
47
|
+
• **AlreadyRegistered** = ``"username_already_registered"``
|
|
48
|
+
|
|
49
|
+
/ When The user attempted to register an authenticator that contains one of the credentials already registered with the relying party.
|
|
50
|
+
|
|
51
|
+
___
|
|
52
|
+
|
|
53
|
+
### RegistrationAbortedTimeout
|
|
54
|
+
|
|
55
|
+
• **RegistrationAbortedTimeout** = ``"registration_aborted_timeout"``
|
|
56
|
+
|
|
57
|
+
When [register](../modules.md#register) is called and the modal is closed by the user
|
|
58
|
+
|
|
59
|
+
___
|
|
60
|
+
|
|
61
|
+
### RegistrationCanceled
|
|
62
|
+
|
|
63
|
+
• **RegistrationCanceled** = ``"webauthn_registration_canceled"``
|
|
64
|
+
|
|
65
|
+
When [register](../modules.md#register) is called and the modal is closed when reaching the timeout
|
|
66
|
+
|
|
67
|
+
___
|
|
68
|
+
|
|
69
|
+
### AutofillAuthenticationAborted
|
|
70
|
+
|
|
71
|
+
• **AutofillAuthenticationAborted** = ``"autofill_authentication_aborted"``
|
|
72
|
+
|
|
73
|
+
Passkey autofill authentication was aborted by [abort](../interfaces/AutofillHandlers.md#abort)
|
|
74
|
+
|
|
75
|
+
___
|
|
76
|
+
|
|
77
|
+
### AuthenticationProcessAlreadyActive
|
|
78
|
+
|
|
79
|
+
• **AuthenticationProcessAlreadyActive** = ``"authentication_process_already_active"``
|
|
80
|
+
|
|
81
|
+
Passkey authentication is already active. To start a new authentication, abort the current one first by calling [abort](../interfaces/AutofillHandlers.md#abort)
|
|
82
|
+
|
|
83
|
+
___
|
|
84
|
+
|
|
85
|
+
### InvalidApprovalData
|
|
86
|
+
|
|
87
|
+
• **InvalidApprovalData** = ``"invalid_approval_data"``
|
|
88
|
+
|
|
89
|
+
The ApprovalData parameter was sent in the wrong format
|
|
90
|
+
|
|
91
|
+
___
|
|
92
|
+
|
|
93
|
+
### FailedToInitCrossDeviceSession
|
|
94
|
+
|
|
95
|
+
• **FailedToInitCrossDeviceSession** = ``"cross_device_init_failed"``
|
|
96
|
+
|
|
97
|
+
When the call to [initCrossDeviceAuthentication](../interfaces/WebauthnApis.md#initcrossdeviceauthentication) failed
|
|
98
|
+
|
|
99
|
+
___
|
|
100
|
+
|
|
101
|
+
### FailedToGetCrossDeviceStatus
|
|
102
|
+
|
|
103
|
+
• **FailedToGetCrossDeviceStatus** = ``"cross_device_status_failed"``
|
|
104
|
+
|
|
105
|
+
When the call to [getCrossDeviceTicketStatus](../interfaces/WebauthnApis.md#getcrossdeviceticketstatus) failed
|
|
106
|
+
|
|
107
|
+
___
|
|
108
|
+
|
|
109
|
+
### Unknown
|
|
110
|
+
|
|
111
|
+
• **Unknown** = ``"unknown"``
|
|
112
|
+
|
|
113
|
+
When the SDK operation fails on an unhandled error
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# Interface: ActionEventOptions
|
|
2
|
+
|
|
3
|
+
## Properties
|
|
4
|
+
|
|
5
|
+
### correlationId
|
|
6
|
+
|
|
7
|
+
• `Optional` **correlationId**: `string`
|
|
8
|
+
|
|
9
|
+
Any ID that could help relate the action with external context or session
|
|
10
|
+
|
|
11
|
+
___
|
|
12
|
+
|
|
13
|
+
### claimedUserId
|
|
14
|
+
|
|
15
|
+
• `Optional` **claimedUserId**: `string`
|
|
16
|
+
|
|
17
|
+
User ID of the not yet authenticated user, used to enhance risk and
|
|
18
|
+
trust assessments. Once the user is authenticated,
|
|
19
|
+
TSAccountProtection.setAuthenticatedUser should be called.
|
|
20
|
+
|
|
21
|
+
___
|
|
22
|
+
|
|
23
|
+
### claimedUserIdType
|
|
24
|
+
|
|
25
|
+
• `Optional` **claimedUserIdType**: `string`
|
|
26
|
+
|
|
27
|
+
The reported claimedUserId type (if provided), should not contain PII unless it is hashed.
|
|
28
|
+
Supported values: email, phone_number, account_id, ssn, national_id, passport_number, drivers_license_number, other.
|
|
29
|
+
|
|
30
|
+
___
|
|
31
|
+
|
|
32
|
+
### transactionData
|
|
33
|
+
|
|
34
|
+
• `Optional` **transactionData**: `TransactionData`
|
|
35
|
+
|
|
36
|
+
A transaction data-points object for transaction-monitoring
|
|
37
|
+
|
|
38
|
+
___
|
|
39
|
+
|
|
40
|
+
### customAttributes
|
|
41
|
+
|
|
42
|
+
• `Optional` **customAttributes**: `Record`<`string`, `string` \| `number` \| `boolean`\>
|
|
43
|
+
|
|
44
|
+
Custom attributes matching the schema previously defined in the Admin Portal
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# Interface: AuthenticationAutofillActivateHandlers
|
|
2
|
+
|
|
3
|
+
## Properties
|
|
4
|
+
|
|
5
|
+
### onSuccess
|
|
6
|
+
|
|
7
|
+
• **onSuccess**: (`webauthn_encoded_result`: `string`) => `Promise`<`void`\>
|
|
8
|
+
|
|
9
|
+
#### Type declaration
|
|
10
|
+
|
|
11
|
+
▸ (`webauthn_encoded_result`): `Promise`<`void`\>
|
|
12
|
+
|
|
13
|
+
A Callback function that will be triggered once biometrics signing is completed successfully.
|
|
14
|
+
|
|
15
|
+
##### Parameters
|
|
16
|
+
|
|
17
|
+
| Name | Type |
|
|
18
|
+
| :------ | :------ |
|
|
19
|
+
| `webauthn_encoded_result` | `string` |
|
|
20
|
+
|
|
21
|
+
##### Returns
|
|
22
|
+
|
|
23
|
+
`Promise`<`void`\>
|
|
24
|
+
|
|
25
|
+
___
|
|
26
|
+
|
|
27
|
+
### onError
|
|
28
|
+
|
|
29
|
+
• `Optional` **onError**: (`err`: [`SdkError`](SdkError.md)) => `Promise`<`void`\>
|
|
30
|
+
|
|
31
|
+
#### Type declaration
|
|
32
|
+
|
|
33
|
+
▸ (`err`): `Promise`<`void`\>
|
|
34
|
+
|
|
35
|
+
A Callback function that will be triggered if authentication fails with an SdkError.
|
|
36
|
+
|
|
37
|
+
##### Parameters
|
|
38
|
+
|
|
39
|
+
| Name | Type |
|
|
40
|
+
| :------ | :------ |
|
|
41
|
+
| `err` | [`SdkError`](SdkError.md) |
|
|
42
|
+
|
|
43
|
+
##### Returns
|
|
44
|
+
|
|
45
|
+
`Promise`<`void`\>
|
|
46
|
+
|
|
47
|
+
___
|
|
48
|
+
|
|
49
|
+
### onReady
|
|
50
|
+
|
|
51
|
+
• `Optional` **onReady**: () => `void`
|
|
52
|
+
|
|
53
|
+
#### Type declaration
|
|
54
|
+
|
|
55
|
+
▸ (): `void`
|
|
56
|
+
|
|
57
|
+
A Callback function that will be triggered when challenge excepted from the service and autofill is ready to use.
|
|
58
|
+
|
|
59
|
+
##### Returns
|
|
60
|
+
|
|
61
|
+
`void`
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# Interface: AutofillHandlers
|
|
2
|
+
|
|
3
|
+
## Methods
|
|
4
|
+
|
|
5
|
+
### activate
|
|
6
|
+
|
|
7
|
+
▸ **activate**(`handlers`, `username?`): `void`
|
|
8
|
+
|
|
9
|
+
Invokes a WebAuthn authentication, including prompting the user to select from a list of registered credentials using autofill, and then prompting the user for biometrics. In order to prompt this credentials list, the autocomplete="username webauthn" attribute **must** be defined on the username input box of the authentication page.<br/>
|
|
10
|
+
If authentication is completed successfully, the `onSuccess` callback will be triggered with the credential result, which is an object encoded as a base64 string. This encoded result should then be passed to the [backend authentication endpoint](/openapi/user/backend-webauthn/#operation/authenticateWebauthnCredential) to retrieve user tokens.<br/>
|
|
11
|
+
If it fails, the `onError` callback will be triggered with an SdkError.
|
|
12
|
+
|
|
13
|
+
**`Throws`**
|
|
14
|
+
|
|
15
|
+
[NotInitialized](../enums/ErrorCode.md#notinitialized)
|
|
16
|
+
|
|
17
|
+
**`Throws`**
|
|
18
|
+
|
|
19
|
+
[AuthenticationFailed](../enums/ErrorCode.md#authenticationfailed)
|
|
20
|
+
|
|
21
|
+
**`Throws`**
|
|
22
|
+
|
|
23
|
+
[AuthenticationCanceled](../enums/ErrorCode.md#authenticationcanceled)
|
|
24
|
+
|
|
25
|
+
**`Throws`**
|
|
26
|
+
|
|
27
|
+
[AutofillAuthenticationAborted](../enums/ErrorCode.md#autofillauthenticationaborted)
|
|
28
|
+
|
|
29
|
+
#### Parameters
|
|
30
|
+
|
|
31
|
+
| Name | Type | Description |
|
|
32
|
+
| :------ | :------ | :------ |
|
|
33
|
+
| `handlers` | [`AuthenticationAutofillActivateHandlers`](AuthenticationAutofillActivateHandlers.md) | Handlers that will be invoked once the authentication is completed (success or failure) |
|
|
34
|
+
| `username?` | `string` | Name of user account, as used in the WebAuthn registration. If not provided, the authentication will start without the context of a user and it will be inferred by the chosen passkey |
|
|
35
|
+
|
|
36
|
+
#### Returns
|
|
37
|
+
|
|
38
|
+
`void`
|
|
39
|
+
|
|
40
|
+
___
|
|
41
|
+
|
|
42
|
+
### abort
|
|
43
|
+
|
|
44
|
+
▸ **abort**(): `void`
|
|
45
|
+
|
|
46
|
+
Aborts a WebAuthn authentication. This method should be called after the passkey autofill is dismissed in order to be able to query existing passkeys once again. This will end the browser's `navigator.credentials.get()` operation.
|
|
47
|
+
|
|
48
|
+
#### Returns
|
|
49
|
+
|
|
50
|
+
`void`
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# Interface: CrossDeviceController
|
|
2
|
+
|
|
3
|
+
WebAuthn cross device handlers interfaces
|
|
4
|
+
|
|
5
|
+
## Properties
|
|
6
|
+
|
|
7
|
+
### crossDeviceTicketId
|
|
8
|
+
|
|
9
|
+
• **crossDeviceTicketId**: `string`
|
|
10
|
+
|
|
11
|
+
Ticket ID for this cross-device flow.
|
|
12
|
+
|
|
13
|
+
___
|
|
14
|
+
|
|
15
|
+
### stop
|
|
16
|
+
|
|
17
|
+
• **stop**: () => `void`
|
|
18
|
+
|
|
19
|
+
#### Type declaration
|
|
20
|
+
|
|
21
|
+
▸ (): `void`
|
|
22
|
+
|
|
23
|
+
Stops listening for events from devices in cross-device flows
|
|
24
|
+
|
|
25
|
+
##### Returns
|
|
26
|
+
|
|
27
|
+
`void`
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# Interface: SdkError
|
|
2
|
+
|
|
3
|
+
Common interface for `Promise` rejections.
|
|
4
|
+
Developers should handle according to the `errorCode`
|
|
5
|
+
|
|
6
|
+
## Properties
|
|
7
|
+
|
|
8
|
+
### errorCode
|
|
9
|
+
|
|
10
|
+
• `Readonly` **errorCode**: [`ErrorCode`](../enums/ErrorCode.md)
|
|
11
|
+
|
|
12
|
+
Error code from [ErrorCode](../enums/ErrorCode.md)
|
|
13
|
+
|
|
14
|
+
___
|
|
15
|
+
|
|
16
|
+
### message
|
|
17
|
+
|
|
18
|
+
• `Readonly` **message**: `string`
|
|
19
|
+
|
|
20
|
+
Error message
|
|
21
|
+
|
|
22
|
+
___
|
|
23
|
+
|
|
24
|
+
### data
|
|
25
|
+
|
|
26
|
+
• `Optional` `Readonly` **data**: `any`
|
|
27
|
+
|
|
28
|
+
Additional data
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# Interface: WebauthnApis
|
|
2
|
+
|
|
3
|
+
Alternate paths used by the SDK to route API calls to your proxy server.
|
|
4
|
+
|
|
5
|
+
## Properties
|
|
6
|
+
|
|
7
|
+
### startAuthentication
|
|
8
|
+
|
|
9
|
+
• **startAuthentication**: `string`
|
|
10
|
+
|
|
11
|
+
**`Default Value`**
|
|
12
|
+
|
|
13
|
+
`/v1/auth/webauthn/authenticate/start`
|
|
14
|
+
|
|
15
|
+
___
|
|
16
|
+
|
|
17
|
+
### startRegistration
|
|
18
|
+
|
|
19
|
+
• **startRegistration**: `string`
|
|
20
|
+
|
|
21
|
+
**`Default Value`**
|
|
22
|
+
|
|
23
|
+
`/v1/auth/webauthn/register/start`
|
|
24
|
+
|
|
25
|
+
___
|
|
26
|
+
|
|
27
|
+
### startCrossDeviceRegistration
|
|
28
|
+
|
|
29
|
+
• **startCrossDeviceRegistration**: `string`
|
|
30
|
+
|
|
31
|
+
**`Default Value`**
|
|
32
|
+
|
|
33
|
+
`/v1/auth/webauthn/cross-device/register/start`
|
|
34
|
+
|
|
35
|
+
___
|
|
36
|
+
|
|
37
|
+
### initCrossDeviceAuthentication
|
|
38
|
+
|
|
39
|
+
• **initCrossDeviceAuthentication**: `string`
|
|
40
|
+
|
|
41
|
+
**`Default Value`**
|
|
42
|
+
|
|
43
|
+
`/v1/auth/webauthn/cross-device/authenticate/init`
|
|
44
|
+
|
|
45
|
+
___
|
|
46
|
+
|
|
47
|
+
### startCrossDeviceAuthentication
|
|
48
|
+
|
|
49
|
+
• **startCrossDeviceAuthentication**: `string`
|
|
50
|
+
|
|
51
|
+
**`Default Value`**
|
|
52
|
+
|
|
53
|
+
`/v1/auth/webauthn/cross-device/authenticate/start`
|
|
54
|
+
|
|
55
|
+
___
|
|
56
|
+
|
|
57
|
+
### getCrossDeviceTicketStatus
|
|
58
|
+
|
|
59
|
+
• **getCrossDeviceTicketStatus**: `string`
|
|
60
|
+
|
|
61
|
+
**`Default Value`**
|
|
62
|
+
|
|
63
|
+
`/v1/auth/webauthn/cross-device/status`
|
|
64
|
+
|
|
65
|
+
___
|
|
66
|
+
|
|
67
|
+
### attachDeviceToCrossDeviceSession
|
|
68
|
+
|
|
69
|
+
• **attachDeviceToCrossDeviceSession**: `string`
|
|
70
|
+
|
|
71
|
+
**`Default Value`**
|
|
72
|
+
|
|
73
|
+
`/v1/auth/webauthn/cross-device/attach-device`
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# Interface: WebauthnAuthenticationFlows
|
|
2
|
+
|
|
3
|
+
## Methods
|
|
4
|
+
|
|
5
|
+
### modal
|
|
6
|
+
|
|
7
|
+
▸ **modal**(`username?`, `options?`): `Promise`<`string`\>
|
|
8
|
+
|
|
9
|
+
Invokes a WebAuthn authentication, including prompting the user to select from a list of registered credentials, and then prompting the user for biometrics. The credentials list is displayed using the native browser modal.<br/>
|
|
10
|
+
If username isn't provided, it will promote a modal with a list of all discoverable credentials on the device. If username is provided, this call must be invoked for a registered username. If the target username is not registered or in case of any other failure, an SdkError will be thrown.<br/>
|
|
11
|
+
If authentication is completed successfully, this call will return a promise that resolves to the credential result, which is an object encoded as a base64 string. This encoded result should then be passed to the [backend authentication endpoint](/openapi/user/backend-webauthn/#operation/authenticateWebauthnCredential) to retrieve user tokens.<br/>
|
|
12
|
+
|
|
13
|
+
**`Throws`**
|
|
14
|
+
|
|
15
|
+
[NotInitialized](../enums/ErrorCode.md#notinitialized)
|
|
16
|
+
|
|
17
|
+
**`Throws`**
|
|
18
|
+
|
|
19
|
+
[AuthenticationFailed](../enums/ErrorCode.md#authenticationfailed)
|
|
20
|
+
|
|
21
|
+
**`Throws`**
|
|
22
|
+
|
|
23
|
+
[AuthenticationCanceled](../enums/ErrorCode.md#authenticationcanceled)
|
|
24
|
+
|
|
25
|
+
**`Throws`**
|
|
26
|
+
|
|
27
|
+
[InvalidApprovalData](../enums/ErrorCode.md#invalidapprovaldata)
|
|
28
|
+
|
|
29
|
+
**`Throws`**
|
|
30
|
+
|
|
31
|
+
[AuthenticationProcessAlreadyActive](../enums/ErrorCode.md#authenticationprocessalreadyactive)
|
|
32
|
+
|
|
33
|
+
#### Parameters
|
|
34
|
+
|
|
35
|
+
| Name | Type | Description |
|
|
36
|
+
| :------ | :------ | :------ |
|
|
37
|
+
| `username?` | `string` | Name of user account, as used in the WebAuthn registration. If not provided, the authentication will start without the context of a user and it will be inferred by the chosen passkey |
|
|
38
|
+
| `options?` | `WebauthnAuthenticationOptions` | WebauthnAuthenticationOptions Options for the authentication process |
|
|
39
|
+
|
|
40
|
+
#### Returns
|
|
41
|
+
|
|
42
|
+
`Promise`<`string`\>
|
|
43
|
+
|
|
44
|
+
Base64-encoded object, which contains the credential result. This encoded result will be used to fetch user tokens via the [backend authentication endpoint](/openapi/user/backend-webauthn/#operation/authenticateWebauthnCredential).
|
|
45
|
+
|
|
46
|
+
## Properties
|
|
47
|
+
|
|
48
|
+
### autofill
|
|
49
|
+
|
|
50
|
+
• **autofill**: [`AutofillHandlers`](AutofillHandlers.md)
|
|
51
|
+
|
|
52
|
+
Property used to implement credential selection via autofill UI.
|