electron-webauthn 1.0.5 → 1.1.1
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/README.md +16 -1
- package/dist/additional-objc/ASCPublicKeyCredentialDescriptor.d.ts +12 -0
- package/dist/additional-objc/ASCPublicKeyCredentialDescriptor.js +2 -0
- package/dist/create/authorization-controller.d.ts +2 -1
- package/dist/create/authorization-controller.js +7 -7
- package/dist/create/internal-handler.js +29 -28
- package/dist/get/authorization-controller.d.ts +2 -1
- package/dist/get/authorization-controller.js +1 -1
- package/dist/get/internal-handler.js +30 -30
- package/dist/helpers/presentation.js +3 -4
- package/dist/helpers/prf.d.ts +1 -1
- package/dist/helpers/prf.js +3 -3
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/list/handler.d.ts +2 -0
- package/dist/list/handler.js +71 -0
- package/dist/list/types.d.ts +14 -0
- package/dist/list/types.js +1 -0
- package/package.json +3 -2
- package/dist/objc/authentication-services/as-authorization-c-public-key-credential-descriptor.d.ts +0 -9
- package/dist/objc/authentication-services/as-authorization-c-public-key-credential-descriptor.js +0 -6
- package/dist/objc/authentication-services/as-authorization-controller-delegate.d.ts +0 -7
- package/dist/objc/authentication-services/as-authorization-controller-delegate.js +0 -12
- package/dist/objc/authentication-services/as-authorization-controller-presentation-context-providing.d.ts +0 -5
- package/dist/objc/authentication-services/as-authorization-controller-presentation-context-providing.js +0 -7
- package/dist/objc/authentication-services/as-authorization-controller.d.ts +0 -15
- package/dist/objc/authentication-services/as-authorization-controller.js +0 -6
- package/dist/objc/authentication-services/as-authorization-platform-public-key-credential-assertion.d.ts +0 -17
- package/dist/objc/authentication-services/as-authorization-platform-public-key-credential-assertion.js +0 -2
- package/dist/objc/authentication-services/as-authorization-platform-public-key-credential-descriptor.d.ts +0 -8
- package/dist/objc/authentication-services/as-authorization-platform-public-key-credential-descriptor.js +0 -6
- package/dist/objc/authentication-services/as-authorization-platform-public-key-credential-provider.d.ts +0 -11
- package/dist/objc/authentication-services/as-authorization-platform-public-key-credential-provider.js +0 -6
- package/dist/objc/authentication-services/as-authorization-platform-public-key-credential-registration.d.ts +0 -15
- package/dist/objc/authentication-services/as-authorization-platform-public-key-credential-registration.js +0 -2
- package/dist/objc/authentication-services/as-authorization-platform-security-key-credential-assertion.d.ts +0 -17
- package/dist/objc/authentication-services/as-authorization-platform-security-key-credential-assertion.js +0 -2
- package/dist/objc/authentication-services/as-authorization-public-key-credential-large-blob-assertion-input.d.ts +0 -9
- package/dist/objc/authentication-services/as-authorization-public-key-credential-large-blob-assertion-input.js +0 -6
- package/dist/objc/authentication-services/as-authorization-public-key-credential-large-blob-assertion.d.ts +0 -8
- package/dist/objc/authentication-services/as-authorization-public-key-credential-large-blob-assertion.js +0 -2
- package/dist/objc/authentication-services/as-authorization-public-key-credential-large-blob-registration-input.d.ts +0 -7
- package/dist/objc/authentication-services/as-authorization-public-key-credential-large-blob-registration-input.js +0 -6
- package/dist/objc/authentication-services/as-authorization-public-key-credential-large-blob-registration-output.d.ts +0 -5
- package/dist/objc/authentication-services/as-authorization-public-key-credential-large-blob-registration-output.js +0 -2
- package/dist/objc/authentication-services/as-authorization-public-key-credential-parameters.d.ts +0 -8
- package/dist/objc/authentication-services/as-authorization-public-key-credential-parameters.js +0 -6
- package/dist/objc/authentication-services/as-authorization-public-key-credential-prf-assertion-input-valuesas-authorization-public-key-credential-prf-assertion-input-values.d.ts +0 -7
- package/dist/objc/authentication-services/as-authorization-public-key-credential-prf-assertion-input-valuesas-authorization-public-key-credential-prf-assertion-input-values.js +0 -6
- package/dist/objc/authentication-services/as-authorization-public-key-credential-prf-assertion-input.d.ts +0 -8
- package/dist/objc/authentication-services/as-authorization-public-key-credential-prf-assertion-input.js +0 -6
- package/dist/objc/authentication-services/as-authorization-public-key-credential-prf-assertion.d.ts +0 -8
- package/dist/objc/authentication-services/as-authorization-public-key-credential-prf-assertion.js +0 -2
- package/dist/objc/authentication-services/as-authorization-public-key-credential-prf-registration-input.d.ts +0 -9
- package/dist/objc/authentication-services/as-authorization-public-key-credential-prf-registration-input.js +0 -6
- package/dist/objc/authentication-services/as-authorization-public-key-credential-prf-registration-output.d.ts +0 -9
- package/dist/objc/authentication-services/as-authorization-public-key-credential-prf-registration-output.js +0 -2
- package/dist/objc/authentication-services/as-authorization-security-key-public-key-credential-provider.d.ts +0 -11
- package/dist/objc/authentication-services/as-authorization-security-key-public-key-credential-provider.js +0 -6
- package/dist/objc/authentication-services/as-authorization.d.ts +0 -7
- package/dist/objc/authentication-services/as-authorization.js +0 -2
- package/dist/objc/authentication-services/enums/as-authorization-public-key-credential-attachment.d.ts +0 -4
- package/dist/objc/authentication-services/enums/as-authorization-public-key-credential-attachment.js +0 -5
- package/dist/objc/authentication-services/enums/as-authorization-public-key-credential-attestation-kind.d.ts +0 -6
- package/dist/objc/authentication-services/enums/as-authorization-public-key-credential-attestation-kind.js +0 -7
- package/dist/objc/authentication-services/enums/as-authorization-public-key-credential-large-blob-assertion-operation.d.ts +0 -4
- package/dist/objc/authentication-services/enums/as-authorization-public-key-credential-large-blob-assertion-operation.js +0 -5
- package/dist/objc/authentication-services/enums/as-authorization-public-key-credential-large-blob-support-requirement.d.ts +0 -4
- package/dist/objc/authentication-services/enums/as-authorization-public-key-credential-large-blob-support-requirement.js +0 -5
- package/dist/objc/authentication-services/enums/as-authorization-public-key-credential-user-verification-preference.d.ts +0 -5
- package/dist/objc/authentication-services/enums/as-authorization-public-key-credential-user-verification-preference.js +0 -6
- package/dist/objc/authentication-services/index.d.ts +0 -2
- package/dist/objc/authentication-services/index.js +0 -2
- package/dist/objc/foundation/index.d.ts +0 -2
- package/dist/objc/foundation/index.js +0 -2
- package/dist/objc/foundation/nsarray.d.ts +0 -11
- package/dist/objc/foundation/nsarray.js +0 -12
- package/dist/objc/foundation/nsdata.d.ts +0 -35
- package/dist/objc/foundation/nsdata.js +0 -56
- package/dist/objc/foundation/nsdictionary.d.ts +0 -37
- package/dist/objc/foundation/nsdictionary.js +0 -64
- package/dist/objc/foundation/nserror.d.ts +0 -21
- package/dist/objc/foundation/nserror.js +0 -53
- package/dist/objc/foundation/nsinteger.d.ts +0 -50
- package/dist/objc/foundation/nsinteger.js +0 -124
- package/dist/objc/foundation/nsstring.d.ts +0 -9
- package/dist/objc/foundation/nsstring.js +0 -5
- package/dist/objc/foundation/nsview.d.ts +0 -6
- package/dist/objc/foundation/nsview.js +0 -2
- package/dist/objc/foundation/nswindow.d.ts +0 -4
- package/dist/objc/foundation/nswindow.js +0 -2
- package/dist/objc/helpers.d.ts +0 -2
- package/dist/objc/helpers.js +0 -5
package/README.md
CHANGED
|
@@ -21,6 +21,7 @@ This package provides JavaScript bindings to Apple's AuthenticationServices fram
|
|
|
21
21
|
- Credential creation (registration) with attestation
|
|
22
22
|
- Credential authentication (assertions) with existing credentials
|
|
23
23
|
- Seamless integration with Electron's native window system
|
|
24
|
+
- Passkey listing via `listPasskeys` (macOS 13.3+)
|
|
24
25
|
- PRF (Pseudo-Random Function) extension support
|
|
25
26
|
- Large Blob extension support for reading/writing credential-specific data
|
|
26
27
|
- User verification preference configuration (preferred, required, discouraged)
|
|
@@ -83,7 +84,7 @@ This library implements the W3C WebAuthn standard using Apple's native Authentic
|
|
|
83
84
|
|
|
84
85
|
## Error Handling
|
|
85
86
|
|
|
86
|
-
|
|
87
|
+
`createCredential`, `getCredential`, and `listPasskeys` all return a result object with a `success` field. Always check this field:
|
|
87
88
|
|
|
88
89
|
```typescript
|
|
89
90
|
const result = await createCredential(publicKeyOptions, additionalOptions);
|
|
@@ -118,6 +119,19 @@ if (!result.success) {
|
|
|
118
119
|
console.log("Credential ID:", result.data.credentialId);
|
|
119
120
|
```
|
|
120
121
|
|
|
122
|
+
`listPasskeys` returns an `Error` object (not a string code) when unsuccessful:
|
|
123
|
+
|
|
124
|
+
```typescript
|
|
125
|
+
const result = await listPasskeys("example.com");
|
|
126
|
+
|
|
127
|
+
if (!result.success) {
|
|
128
|
+
console.error("Failed to list passkeys:", result.error.message);
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
console.log(`Found ${result.credentials.length} passkeys`);
|
|
133
|
+
```
|
|
134
|
+
|
|
121
135
|
### Common Error Scenarios
|
|
122
136
|
|
|
123
137
|
#### For Both Registration and Authentication
|
|
@@ -141,6 +155,7 @@ console.log("Credential ID:", result.data.credentialId);
|
|
|
141
155
|
|
|
142
156
|
- ✅ WebAuthn credential creation (registration/attestation)
|
|
143
157
|
- ✅ WebAuthn assertions (authentication with existing credentials)
|
|
158
|
+
- ✅ Passkey listing with `listPasskeys` (macOS 13.3+, requires `com.apple.developer.web-browser.public-key-credential` entitlement)
|
|
144
159
|
- ✅ Cross-platform authenticators (external security keys like YubiKey)
|
|
145
160
|
- ✅ Platform authenticators (Touch ID, Face ID)
|
|
146
161
|
- ✅ Discoverable credentials (resident keys)
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { _NSArray, _NSData, _NSObject, _NSSecureCoding } from "objcjs-types/Foundation";
|
|
2
|
+
export declare class _ASCPublicKeyCredentialDescriptor extends _NSObject {
|
|
3
|
+
static alloc(): _ASCPublicKeyCredentialDescriptor;
|
|
4
|
+
static new(): _ASCPublicKeyCredentialDescriptor;
|
|
5
|
+
init(): _ASCPublicKeyCredentialDescriptor;
|
|
6
|
+
initWithCredentialID$transports$(credentialID: _NSData, allowedTransports: _NSArray | null): _ASCPublicKeyCredentialDescriptor;
|
|
7
|
+
credentialID(): _NSData;
|
|
8
|
+
transports(): _NSArray | null;
|
|
9
|
+
}
|
|
10
|
+
export interface _ASCPublicKeyCredentialDescriptor extends _NSSecureCoding {
|
|
11
|
+
}
|
|
12
|
+
export declare const ASCPublicKeyCredentialDescriptor: typeof _ASCPublicKeyCredentialDescriptor;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { NobjcObject } from "objc-js";
|
|
2
2
|
import type { ExcludeCredential } from "./internal-handler.js";
|
|
3
|
+
import type { ASAuthorizationController } from "objcjs-types/AuthenticationServices";
|
|
3
4
|
export interface PublicKeyCredentialParams {
|
|
4
5
|
type: "public-key";
|
|
5
6
|
algorithm: number;
|
|
6
7
|
}
|
|
7
8
|
export declare function setControllerState(self: NobjcObject, clientDataHash: Buffer, pubKeyCredParams: PublicKeyCredentialParams[], residentKeyRequired: boolean, excludeCredentialIds: ExcludeCredential[]): void;
|
|
8
9
|
export declare function removeControllerState(self: NobjcObject): void;
|
|
9
|
-
export declare const WebauthnCreateController:
|
|
10
|
+
export declare const WebauthnCreateController: typeof ASAuthorizationController;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { NobjcClass, NobjcObject, getPointer } from "objc-js";
|
|
2
|
-
import { NSDataFromBuffer } from "
|
|
3
|
-
import { NSArrayFromObjects } from "
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { NSNumberFromInteger } from "../objc/foundation/nsinteger.js";
|
|
2
|
+
import { NSDataFromBuffer } from "objcjs-types/nsdata";
|
|
3
|
+
import { NSArrayFromObjects, NSStringFromString } from "objcjs-types/helpers";
|
|
4
|
+
import { NSNumber } from "objcjs-types/Foundation";
|
|
5
|
+
import { ASCPublicKeyCredentialDescriptor } from "../additional-objc/ASCPublicKeyCredentialDescriptor.js";
|
|
7
6
|
const createControllerState = new Map();
|
|
8
7
|
function getObjectPointerString(self) {
|
|
9
8
|
return getPointer(self).toString("base64");
|
|
@@ -44,7 +43,8 @@ export const WebauthnCreateController = NobjcClass.define({
|
|
|
44
43
|
const supportedAlgos = [];
|
|
45
44
|
for (const param of pubKeyCredParams) {
|
|
46
45
|
if (param.type === "public-key") {
|
|
47
|
-
|
|
46
|
+
const nsNum = NSNumber.numberWithInteger$(param.algorithm);
|
|
47
|
+
supportedAlgos.push(nsNum);
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
50
|
if (supportedAlgos.length > 0) {
|
|
@@ -63,7 +63,7 @@ export const WebauthnCreateController = NobjcClass.define({
|
|
|
63
63
|
}
|
|
64
64
|
const credentialID = NSDataFromBuffer(cred.id);
|
|
65
65
|
const transportsArray = NSArrayFromObjects(transports);
|
|
66
|
-
const initializedDescriptor =
|
|
66
|
+
const initializedDescriptor = ASCPublicKeyCredentialDescriptor.alloc().initWithCredentialID$transports$(credentialID, transportsArray);
|
|
67
67
|
excludeList.push(initializedDescriptor);
|
|
68
68
|
}
|
|
69
69
|
if (excludeList.length > 0) {
|
|
@@ -4,21 +4,12 @@ import { PromiseWithResolvers } from "../helpers/index.js";
|
|
|
4
4
|
import { encodeEC2PublicKeyToSPKI } from "../helpers/public-key.js";
|
|
5
5
|
import { createPresentationContextProviderFromNativeWindowHandle } from "../helpers/presentation.js";
|
|
6
6
|
import { createPRFInput } from "../helpers/prf.js";
|
|
7
|
-
import { createAuthorizationControllerDelegate } from "../objc/authentication-services/as-authorization-controller-delegate.js";
|
|
8
|
-
import { createPlatformPublicKeyCredentialProvider } from "../objc/authentication-services/as-authorization-platform-public-key-credential-provider.js";
|
|
9
|
-
import { createASAuthorizationPublicKeyCredentialLargeBlobRegistrationInput } from "../objc/authentication-services/as-authorization-public-key-credential-large-blob-registration-input.js";
|
|
10
|
-
import { ASAuthorizationPublicKeyCredentialPRFRegistrationInput, createASAuthorizationPublicKeyCredentialPRFRegistrationInput, } from "../objc/authentication-services/as-authorization-public-key-credential-prf-registration-input.js";
|
|
11
|
-
import { ASAuthorizationPublicKeyCredentialAttestationKind } from "../objc/authentication-services/enums/as-authorization-public-key-credential-attestation-kind.js";
|
|
12
|
-
import { ASAuthorizationPublicKeyCredentialLargeBlobSupportRequirement } from "../objc/authentication-services/enums/as-authorization-public-key-credential-large-blob-support-requirement.js";
|
|
13
|
-
import { ASAuthorizationPublicKeyCredentialUserVerificationPreference } from "../objc/authentication-services/enums/as-authorization-public-key-credential-user-verification-preference.js";
|
|
14
|
-
import { NSArrayFromObjects } from "../objc/foundation/nsarray.js";
|
|
15
|
-
import { bufferFromNSDataDirect, NSDataFromBuffer, } from "../objc/foundation/nsdata.js";
|
|
16
|
-
import { NSStringFromString } from "../objc/foundation/nsstring.js";
|
|
17
7
|
import { removeControllerState, setControllerState, WebauthnCreateController, } from "./authorization-controller.js";
|
|
18
8
|
import { parseAttestationObject } from "@oslojs/webauthn";
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
9
|
+
import { NSArrayFromObjects, NSStringFromString } from "objcjs-types/helpers";
|
|
10
|
+
import { bufferFromNSDataDirect, NSDataFromBuffer } from "objcjs-types/nsdata";
|
|
11
|
+
import { ASAuthorizationPlatformPublicKeyCredentialProvider, ASAuthorizationPlatformPublicKeyCredentialRegistration, ASAuthorizationPublicKeyCredentialAttachment, ASAuthorizationPublicKeyCredentialAttestationKind, ASAuthorizationPublicKeyCredentialLargeBlobRegistrationInput, ASAuthorizationPublicKeyCredentialLargeBlobSupportRequirement, ASAuthorizationPublicKeyCredentialParameters, ASAuthorizationPublicKeyCredentialPRFRegistrationInput, ASAuthorizationPublicKeyCredentialUserVerificationPreference, ASAuthorizationSecurityKeyPublicKeyCredentialProvider, ASAuthorizationSecurityKeyPublicKeyCredentialRegistration, } from "objcjs-types/AuthenticationServices";
|
|
12
|
+
import { createDelegate } from "objcjs-types";
|
|
22
13
|
const VALID_EXTENSIONS = ["largeBlob", "prf"];
|
|
23
14
|
function setupPublicKeyCredentialRegistrationRequest(type, keyRequest, attestation, enabledExtensions, userVerification, pubKeyCredParams, additionalOptions) {
|
|
24
15
|
if (type === "platform" && enabledExtensions.includes("largeBlob")) {
|
|
@@ -36,7 +27,7 @@ function setupPublicKeyCredentialRegistrationRequest(type, keyRequest, attestati
|
|
|
36
27
|
console.warn("[electron-webauthn] largeBlobSupport is enabled but largeBlobSupport is not provided, skipping large blob support");
|
|
37
28
|
}
|
|
38
29
|
if (supportMode) {
|
|
39
|
-
const largeBlobInput =
|
|
30
|
+
const largeBlobInput = ASAuthorizationPublicKeyCredentialLargeBlobRegistrationInput.alloc().initWithSupportRequirement$(supportMode);
|
|
40
31
|
keyRequest.setLargeBlob$(largeBlobInput);
|
|
41
32
|
}
|
|
42
33
|
}
|
|
@@ -73,8 +64,9 @@ function setupPublicKeyCredentialRegistrationRequest(type, keyRequest, attestati
|
|
|
73
64
|
if (type === "security-key") {
|
|
74
65
|
const credentialParameters = [];
|
|
75
66
|
for (const param of pubKeyCredParams) {
|
|
76
|
-
if (param.type === "public-key") {
|
|
77
|
-
|
|
67
|
+
if (param.type === "public-key" && param.algorithm === -7) {
|
|
68
|
+
const paramObj = ASAuthorizationPublicKeyCredentialParameters.alloc().initWithAlgorithm$(param.algorithm);
|
|
69
|
+
credentialParameters.push(paramObj);
|
|
78
70
|
}
|
|
79
71
|
}
|
|
80
72
|
const nsCredentialParameters = NSArrayFromObjects(credentialParameters);
|
|
@@ -83,7 +75,7 @@ function setupPublicKeyCredentialRegistrationRequest(type, keyRequest, attestati
|
|
|
83
75
|
if (type === "platform" && enabledExtensions.includes("prf")) {
|
|
84
76
|
if (additionalOptions.prf) {
|
|
85
77
|
const inputValues = createPRFInput(additionalOptions.prf);
|
|
86
|
-
const prfInput =
|
|
78
|
+
const prfInput = ASAuthorizationPublicKeyCredentialPRFRegistrationInput.alloc().initWithInputValues$(inputValues);
|
|
87
79
|
keyRequest.setPrf$(prfInput);
|
|
88
80
|
}
|
|
89
81
|
else {
|
|
@@ -100,14 +92,14 @@ function createCredentialInternal(rpid, challenge, username, userID, nativeWindo
|
|
|
100
92
|
const requestArrayInput = [];
|
|
101
93
|
if (preferredAuthenticatorAttachment === "all" ||
|
|
102
94
|
preferredAuthenticatorAttachment === "platform") {
|
|
103
|
-
const platformProvider =
|
|
95
|
+
const platformProvider = ASAuthorizationPlatformPublicKeyCredentialProvider.alloc().initWithRelyingPartyIdentifier$(NS_rpID);
|
|
104
96
|
const platformKeyRequest = platformProvider.createCredentialRegistrationRequestWithChallenge$name$userID$(NS_challenge, NS_username, NS_userID);
|
|
105
97
|
setupPublicKeyCredentialRegistrationRequest("platform", platformKeyRequest, attestation, enabledExtensions, userVerification, supportedAlgorithmIdentifiers, additionalOptions);
|
|
106
98
|
requestArrayInput.push(platformKeyRequest);
|
|
107
99
|
}
|
|
108
100
|
if (preferredAuthenticatorAttachment === "all" ||
|
|
109
101
|
preferredAuthenticatorAttachment === "cross-platform") {
|
|
110
|
-
const securityKeyProvider =
|
|
102
|
+
const securityKeyProvider = ASAuthorizationSecurityKeyPublicKeyCredentialProvider.alloc().initWithRelyingPartyIdentifier$(NS_rpID);
|
|
111
103
|
const securityKeyRequest = securityKeyProvider.createCredentialRegistrationRequestWithChallenge$displayName$name$userID$(NS_challenge, NSStringFromString(additionalOptions.userDisplayName || username), NS_username, NS_userID);
|
|
112
104
|
setupPublicKeyCredentialRegistrationRequest("security-key", securityKeyRequest, attestation, enabledExtensions, userVerification, supportedAlgorithmIdentifiers, additionalOptions);
|
|
113
105
|
requestArrayInput.push(securityKeyRequest);
|
|
@@ -127,10 +119,19 @@ function createCredentialInternal(rpid, challenge, username, userID, nativeWindo
|
|
|
127
119
|
timeoutHandlerId = null;
|
|
128
120
|
}
|
|
129
121
|
};
|
|
130
|
-
const delegate =
|
|
131
|
-
didCompleteWithAuthorization
|
|
122
|
+
const delegate = createDelegate("ASAuthorizationControllerDelegate", {
|
|
123
|
+
authorizationController$didCompleteWithAuthorization$: (_, authorization) => {
|
|
132
124
|
const credential = authorization.credential();
|
|
133
125
|
console.log("Authorization succeeded:", credential);
|
|
126
|
+
const isPlatform = credential instanceof
|
|
127
|
+
ASAuthorizationPlatformPublicKeyCredentialRegistration;
|
|
128
|
+
const isSecurityKey = credential instanceof
|
|
129
|
+
ASAuthorizationSecurityKeyPublicKeyCredentialRegistration;
|
|
130
|
+
if (!isPlatform && !isSecurityKey) {
|
|
131
|
+
reject(new Error("Resulting credential is not a platform or security key credential"));
|
|
132
|
+
finished(false);
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
134
135
|
const credentialIdBuffer = bufferFromNSDataDirect(credential.credentialID());
|
|
135
136
|
const attestationObjectBuffer = bufferFromNSDataDirect(credential.rawAttestationObject());
|
|
136
137
|
const attestation = parseAttestationObject(attestationObjectBuffer);
|
|
@@ -138,10 +139,11 @@ function createCredentialInternal(rpid, challenge, username, userID, nativeWindo
|
|
|
138
139
|
const ec2Key = publicKey.ec2();
|
|
139
140
|
const publicKeySPKI = encodeEC2PublicKeyToSPKI(ec2Key.x, ec2Key.y);
|
|
140
141
|
const authenticatorData = Buffer.from(JSON.stringify(attestation.authenticatorData));
|
|
141
|
-
let authenticatorAttachment = "platform";
|
|
142
|
-
if (
|
|
143
|
-
|
|
144
|
-
|
|
142
|
+
let authenticatorAttachment = "cross-platform";
|
|
143
|
+
if (isPlatform &&
|
|
144
|
+
credential.attachment() ===
|
|
145
|
+
ASAuthorizationPublicKeyCredentialAttachment.Platform) {
|
|
146
|
+
authenticatorAttachment = "platform";
|
|
145
147
|
}
|
|
146
148
|
let isLargeBlobSupported = null;
|
|
147
149
|
if (enabledExtensions.includes("largeBlob")) {
|
|
@@ -185,9 +187,8 @@ function createCredentialInternal(rpid, challenge, username, userID, nativeWindo
|
|
|
185
187
|
resolve(data);
|
|
186
188
|
finished(true);
|
|
187
189
|
},
|
|
188
|
-
didCompleteWithError
|
|
189
|
-
const
|
|
190
|
-
const errorMessage = parsedError.localizedDescription().UTF8String();
|
|
190
|
+
authorizationController$didCompleteWithError$: (_, error) => {
|
|
191
|
+
const errorMessage = error.localizedDescription().UTF8String();
|
|
191
192
|
reject(new Error(errorMessage));
|
|
192
193
|
finished(false);
|
|
193
194
|
},
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { NobjcObject } from "objc-js";
|
|
2
|
+
import type { ASAuthorizationController } from "objcjs-types/AuthenticationServices";
|
|
2
3
|
export declare function setClientDataHash(self: NobjcObject, clientDataHash: Buffer): void;
|
|
3
4
|
export declare function removeClientDataHash(self: NobjcObject): void;
|
|
4
|
-
export declare const WebauthnGetController:
|
|
5
|
+
export declare const WebauthnGetController: typeof ASAuthorizationController;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { NobjcClass, NobjcObject, getPointer } from "objc-js";
|
|
2
|
-
import { NSDataFromBuffer } from "
|
|
2
|
+
import { NSDataFromBuffer } from "objcjs-types/nsdata";
|
|
3
3
|
const getControllerState = new Map();
|
|
4
4
|
function getObjectPointerString(self) {
|
|
5
5
|
return getPointer(self).toString("base64");
|
|
@@ -1,23 +1,14 @@
|
|
|
1
|
-
import {} from "objc-js";
|
|
2
|
-
import { createAuthorizationControllerDelegate } from "../objc/authentication-services/as-authorization-controller-delegate.js";
|
|
3
|
-
import { ASAuthorizationController } from "../objc/authentication-services/as-authorization-controller.js";
|
|
4
|
-
import { createPlatformPublicKeyCredentialProvider } from "../objc/authentication-services/as-authorization-platform-public-key-credential-provider.js";
|
|
5
|
-
import { createPlatformPublicKeyCredentialDescriptor } from "../objc/authentication-services/as-authorization-platform-public-key-credential-descriptor.js";
|
|
6
|
-
import { NSArrayFromObjects } from "../objc/foundation/nsarray.js";
|
|
7
|
-
import { bufferFromNSDataDirect, NSDataFromBuffer, } from "../objc/foundation/nsdata.js";
|
|
8
|
-
import { NSStringFromString } from "../objc/foundation/nsstring.js";
|
|
9
1
|
import { base64UrlToBuffer, PromiseWithResolvers } from "../helpers/index.js";
|
|
10
|
-
import { ASAuthorizationPublicKeyCredentialAttachment } from "../objc/authentication-services/enums/as-authorization-public-key-credential-attachment.js";
|
|
11
2
|
import { removeClientDataHash, setClientDataHash, WebauthnGetController, } from "../get/authorization-controller.js";
|
|
12
|
-
import { createSecurityKeyPublicKeyCredentialProvider } from "../objc/authentication-services/as-authorization-security-key-public-key-credential-provider.js";
|
|
13
|
-
import { createASAuthorizationPublicKeyCredentialLargeBlobAssertionInput } from "../objc/authentication-services/as-authorization-public-key-credential-large-blob-assertion-input.js";
|
|
14
|
-
import { ASAuthorizationPublicKeyCredentialLargeBlobAssertionOperation } from "../objc/authentication-services/enums/as-authorization-public-key-credential-large-blob-assertion-operation.js";
|
|
15
|
-
import { createASAuthorizationPublicKeyCredentialPRFAssertionInput } from "../objc/authentication-services/as-authorization-public-key-credential-prf-assertion-input.js";
|
|
16
|
-
import {} from "../objc/authentication-services/as-authorization-public-key-credential-prf-assertion-input-valuesas-authorization-public-key-credential-prf-assertion-input-values.js";
|
|
17
3
|
import { createPRFInput } from "../helpers/prf.js";
|
|
18
|
-
import { NSDictionaryFromKeysAndValues, } from "../objc/foundation/nsdictionary.js";
|
|
19
4
|
import { generateClientDataInfo, generateWebauthnClientData, } from "../helpers/client-data.js";
|
|
20
5
|
import { createPresentationContextProviderFromNativeWindowHandle } from "../helpers/presentation.js";
|
|
6
|
+
import { NSStringFromString } from "objcjs-types/helpers";
|
|
7
|
+
import { ASAuthorizationPlatformPublicKeyCredentialProvider, ASAuthorizationPublicKeyCredentialLargeBlobAssertionInput, ASAuthorizationPublicKeyCredentialLargeBlobAssertionOperation, ASAuthorizationPlatformPublicKeyCredentialDescriptor, ASAuthorizationSecurityKeyPublicKeyCredentialProvider, ASAuthorizationPublicKeyCredentialPRFAssertionInput, ASAuthorizationPublicKeyCredentialAttachment, ASAuthorizationPlatformPublicKeyCredentialAssertion, ASAuthorizationSecurityKeyPublicKeyCredentialAssertion, } from "objcjs-types/AuthenticationServices";
|
|
8
|
+
import { NSDataFromBuffer, bufferFromNSDataDirect } from "objcjs-types/nsdata";
|
|
9
|
+
import { createDelegate } from "objcjs-types/delegates";
|
|
10
|
+
import { NSArray, NSDictionary, } from "objcjs-types/Foundation";
|
|
11
|
+
import { NSArrayFromObjects, NSDictionaryFromKeysAndValues, } from "objcjs-types/helpers";
|
|
21
12
|
const VALID_EXTENSIONS = ["largeBlobRead", "largeBlobWrite", "prf"];
|
|
22
13
|
function setupPublicKeyCredentialRequest(type, keyRequest, userVerificationPreference, enabledExtensions, allowedCredentialIds, additionalOptions) {
|
|
23
14
|
if (userVerificationPreference === "preferred") {
|
|
@@ -34,13 +25,13 @@ function setupPublicKeyCredentialRequest(type, keyRequest, userVerificationPrefe
|
|
|
34
25
|
const largeBlobWrite = enabledExtensions.includes("largeBlobWrite");
|
|
35
26
|
if (largeBlobRead) {
|
|
36
27
|
const operation = ASAuthorizationPublicKeyCredentialLargeBlobAssertionOperation.Read;
|
|
37
|
-
const largeBlobInput =
|
|
28
|
+
const largeBlobInput = ASAuthorizationPublicKeyCredentialLargeBlobAssertionInput.alloc().initWithOperation$(operation);
|
|
38
29
|
keyRequest.setLargeBlob$(largeBlobInput);
|
|
39
30
|
}
|
|
40
31
|
else if (largeBlobWrite) {
|
|
41
32
|
if (additionalOptions.largeBlobDataToWrite) {
|
|
42
33
|
const operation = ASAuthorizationPublicKeyCredentialLargeBlobAssertionOperation.Write;
|
|
43
|
-
const largeBlobInput =
|
|
34
|
+
const largeBlobInput = ASAuthorizationPublicKeyCredentialLargeBlobAssertionInput.alloc().initWithOperation$(operation);
|
|
44
35
|
largeBlobInput.setDataToWrite$(NSDataFromBuffer(additionalOptions.largeBlobDataToWrite));
|
|
45
36
|
keyRequest.setLargeBlob$(largeBlobInput);
|
|
46
37
|
}
|
|
@@ -68,7 +59,7 @@ function setupPublicKeyCredentialRequest(type, keyRequest, userVerificationPrefe
|
|
|
68
59
|
}
|
|
69
60
|
perCredentialInputValues = NSDictionaryFromKeysAndValues(keys, values);
|
|
70
61
|
}
|
|
71
|
-
const prfInput =
|
|
62
|
+
const prfInput = ASAuthorizationPublicKeyCredentialPRFAssertionInput.alloc().initWithInputValues$perCredentialInputValues$(inputValues, perCredentialInputValues);
|
|
72
63
|
keyRequest.setPrf$(prfInput);
|
|
73
64
|
}
|
|
74
65
|
else {
|
|
@@ -80,10 +71,10 @@ function getCredentialInternal(rpid, challenge, nativeWindowHandle, origin, time
|
|
|
80
71
|
const { promise, resolve, reject } = PromiseWithResolvers();
|
|
81
72
|
const NS_rpID = NSStringFromString(rpid);
|
|
82
73
|
const NS_challenge = NSDataFromBuffer(challenge);
|
|
83
|
-
const platformProvider =
|
|
74
|
+
const platformProvider = ASAuthorizationPlatformPublicKeyCredentialProvider.alloc().initWithRelyingPartyIdentifier$(NS_rpID);
|
|
84
75
|
const platformKeyRequest = platformProvider.createCredentialAssertionRequestWithChallenge$(NS_challenge);
|
|
85
76
|
setupPublicKeyCredentialRequest("platform", platformKeyRequest, userVerificationPreference, enabledExtensions, allowedCredentialIds, additionalOptions);
|
|
86
|
-
const securityKeyProvider =
|
|
77
|
+
const securityKeyProvider = ASAuthorizationSecurityKeyPublicKeyCredentialProvider.alloc().initWithRelyingPartyIdentifier$(NS_rpID);
|
|
87
78
|
const securityKeyRequest = securityKeyProvider.createCredentialAssertionRequestWithChallenge$(NS_challenge);
|
|
88
79
|
setupPublicKeyCredentialRequest("security-key", securityKeyRequest, userVerificationPreference, enabledExtensions, allowedCredentialIds, additionalOptions);
|
|
89
80
|
const requestsArray = NSArrayFromObjects([
|
|
@@ -105,18 +96,28 @@ function getCredentialInternal(rpid, challenge, nativeWindowHandle, origin, time
|
|
|
105
96
|
}
|
|
106
97
|
};
|
|
107
98
|
if (allowedCredentialIds.length > 0) {
|
|
108
|
-
const allowedCredentials = NSArrayFromObjects(allowedCredentialIds.map((id) =>
|
|
99
|
+
const allowedCredentials = NSArrayFromObjects(allowedCredentialIds.map((id) => ASAuthorizationPlatformPublicKeyCredentialDescriptor.alloc().initWithCredentialID$(NSDataFromBuffer(id))));
|
|
109
100
|
platformKeyRequest.setAllowedCredentials$(allowedCredentials);
|
|
110
101
|
}
|
|
111
|
-
const delegate =
|
|
112
|
-
didCompleteWithAuthorization
|
|
102
|
+
const delegate = createDelegate("ASAuthorizationControllerDelegate", {
|
|
103
|
+
authorizationController$didCompleteWithAuthorization$: (_, authorization) => {
|
|
113
104
|
const credential = authorization.credential();
|
|
105
|
+
const isPlatform = credential instanceof
|
|
106
|
+
ASAuthorizationPlatformPublicKeyCredentialAssertion;
|
|
107
|
+
const isSecurityKey = credential instanceof
|
|
108
|
+
ASAuthorizationSecurityKeyPublicKeyCredentialAssertion;
|
|
109
|
+
if (!isPlatform && !isSecurityKey) {
|
|
110
|
+
reject(new Error("Resulting credential is not a platform or security key credential"));
|
|
111
|
+
finished(false);
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
114
|
const id_data = credential.credentialID();
|
|
115
115
|
const id = bufferFromNSDataDirect(id_data);
|
|
116
|
-
let authenticatorAttachment = "platform";
|
|
117
|
-
if (
|
|
118
|
-
|
|
119
|
-
|
|
116
|
+
let authenticatorAttachment = "cross-platform";
|
|
117
|
+
if (isPlatform &&
|
|
118
|
+
credential.attachment() ===
|
|
119
|
+
ASAuthorizationPublicKeyCredentialAttachment.Platform) {
|
|
120
|
+
authenticatorAttachment = "platform";
|
|
120
121
|
}
|
|
121
122
|
const prf = credential.prf();
|
|
122
123
|
const prfFirst = prf?.first ? prf.first() : null;
|
|
@@ -148,9 +149,8 @@ function getCredentialInternal(rpid, challenge, nativeWindowHandle, origin, time
|
|
|
148
149
|
});
|
|
149
150
|
finished(true);
|
|
150
151
|
},
|
|
151
|
-
didCompleteWithError
|
|
152
|
-
const
|
|
153
|
-
const errorMessage = parsedError.localizedDescription().UTF8String();
|
|
152
|
+
authorizationController$didCompleteWithError$: (_, error) => {
|
|
153
|
+
const errorMessage = error.localizedDescription().UTF8String();
|
|
154
154
|
reject(new Error(errorMessage));
|
|
155
155
|
finished(false);
|
|
156
156
|
},
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { fromPointer } from "objc-js";
|
|
2
|
-
import {
|
|
2
|
+
import { createDelegate } from "objcjs-types";
|
|
3
3
|
export function createPresentationContextProviderFromNativeWindowHandle(nativeWindowHandle) {
|
|
4
|
-
|
|
5
|
-
presentationAnchorForAuthorizationController
|
|
4
|
+
return createDelegate("ASAuthorizationControllerPresentationContextProviding", {
|
|
5
|
+
presentationAnchorForAuthorizationController$: () => {
|
|
6
6
|
const nsView = fromPointer(nativeWindowHandle);
|
|
7
7
|
const nsWindow = nsView.window();
|
|
8
8
|
return nsWindow;
|
|
9
9
|
},
|
|
10
10
|
});
|
|
11
|
-
return presentationContextProvider;
|
|
12
11
|
}
|
package/dist/helpers/prf.d.ts
CHANGED
|
@@ -2,4 +2,4 @@ export interface PRFInput {
|
|
|
2
2
|
first: Buffer;
|
|
3
3
|
second?: Buffer;
|
|
4
4
|
}
|
|
5
|
-
export declare function createPRFInput(prf: PRFInput): import("
|
|
5
|
+
export declare function createPRFInput(prf: PRFInput): import("objcjs-types/AuthenticationServices")._ASAuthorizationPublicKeyCredentialPRFAssertionInputValues;
|
package/dist/helpers/prf.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { NSDataFromBuffer } from "
|
|
1
|
+
import { ASAuthorizationPublicKeyCredentialPRFAssertionInputValues } from "objcjs-types/AuthenticationServices";
|
|
2
|
+
import { NSDataFromBuffer } from "objcjs-types/nsdata";
|
|
3
3
|
export function createPRFInput(prf) {
|
|
4
|
-
return
|
|
4
|
+
return ASAuthorizationPublicKeyCredentialPRFAssertionInputValues.alloc().initWithSaltInput1$saltInput2$(NSDataFromBuffer(prf.first), prf.second ? NSDataFromBuffer(prf.second) : null);
|
|
5
5
|
}
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { bufferToBase64Url, PromiseWithResolvers } from "../helpers/index.js";
|
|
2
|
+
import { bufferFromNSDataDirect } from "objcjs-types/nsdata";
|
|
3
|
+
import { NSStringFromString } from "objcjs-types/helpers";
|
|
4
|
+
import { ASAuthorizationWebBrowserPublicKeyCredentialManager, ASAuthorizationWebBrowserPublicKeyCredentialManagerAuthorizationState, } from "objcjs-types/AuthenticationServices";
|
|
5
|
+
import { isAtLeast, version, formatVersion, getOSVersion, } from "objcjs-types/osversion";
|
|
6
|
+
import { enumFromValue, makePromise1Result } from "objcjs-types/helpers";
|
|
7
|
+
const LOGGING_ENABLED = false;
|
|
8
|
+
function log(...args) {
|
|
9
|
+
if (!LOGGING_ENABLED)
|
|
10
|
+
return;
|
|
11
|
+
console.log(...args);
|
|
12
|
+
}
|
|
13
|
+
export async function listPasskeys(relyingPartyId) {
|
|
14
|
+
try {
|
|
15
|
+
const minVersion = version(13, 3);
|
|
16
|
+
if (!isAtLeast(minVersion)) {
|
|
17
|
+
const currentVersion = getOSVersion();
|
|
18
|
+
throw new Error(`Passkey listing requires macOS 13.3 or later (current: ${formatVersion(currentVersion)})`);
|
|
19
|
+
}
|
|
20
|
+
const manager = ASAuthorizationWebBrowserPublicKeyCredentialManager.alloc().init();
|
|
21
|
+
const authState = manager.authorizationStateForPlatformCredentials();
|
|
22
|
+
log(`[listPasskeys] Authorization state: ${authState}`);
|
|
23
|
+
if (authState ===
|
|
24
|
+
ASAuthorizationWebBrowserPublicKeyCredentialManagerAuthorizationState.NotDetermined) {
|
|
25
|
+
log("[listPasskeys] Authorization not determined, requesting...");
|
|
26
|
+
const newStateValue = await makePromise1Result(manager.requestAuthorizationForPublicKeyCredentials$.bind(manager));
|
|
27
|
+
const newState = enumFromValue(ASAuthorizationWebBrowserPublicKeyCredentialManagerAuthorizationState, newStateValue);
|
|
28
|
+
log(`[listPasskeys] Authorization request completed, new state: ${newState}`);
|
|
29
|
+
}
|
|
30
|
+
else if (authState ===
|
|
31
|
+
ASAuthorizationWebBrowserPublicKeyCredentialManagerAuthorizationState.Denied) {
|
|
32
|
+
throw new Error("Authorization DENIED - user must grant permission in System Settings > Privacy & Security");
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
log("[listPasskeys] Authorization already granted");
|
|
36
|
+
}
|
|
37
|
+
const rpIdString = NSStringFromString(relyingPartyId);
|
|
38
|
+
log(`[listPasskeys] Calling platformCredentialsForRelyingParty: ${relyingPartyId}`);
|
|
39
|
+
const credentialsArray = await makePromise1Result(manager.platformCredentialsForRelyingParty$completionHandler$.bind(manager), rpIdString);
|
|
40
|
+
const count = credentialsArray.count();
|
|
41
|
+
log(`[listPasskeys] platformCredentials returned ${count} entries`);
|
|
42
|
+
const credentials = [];
|
|
43
|
+
for (let i = 0; i < count; i++) {
|
|
44
|
+
const cred = credentialsArray.objectAtIndex$(i);
|
|
45
|
+
const credentialIdData = cred.credentialID();
|
|
46
|
+
const userName = cred.name().UTF8String();
|
|
47
|
+
const userHandleData = cred.userHandle();
|
|
48
|
+
const credentialId = bufferToBase64Url(bufferFromNSDataDirect(credentialIdData));
|
|
49
|
+
const userHandle = bufferToBase64Url(bufferFromNSDataDirect(userHandleData));
|
|
50
|
+
log(`[listPasskeys] Found credential: name=${userName}, id=${credentialId.substring(0, 20)}...`);
|
|
51
|
+
credentials.push({
|
|
52
|
+
id: credentialId,
|
|
53
|
+
rpId: relyingPartyId,
|
|
54
|
+
userName,
|
|
55
|
+
userHandle,
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
log(`[listPasskeys] Returning ${credentials.length} results`);
|
|
59
|
+
return {
|
|
60
|
+
success: true,
|
|
61
|
+
credentials,
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
catch (error) {
|
|
65
|
+
console.error("[listPasskeys] ", error);
|
|
66
|
+
return {
|
|
67
|
+
success: false,
|
|
68
|
+
error: error instanceof Error ? error : new Error(String(error)),
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface PasskeyCredential {
|
|
2
|
+
id: string;
|
|
3
|
+
rpId: string;
|
|
4
|
+
userName: string;
|
|
5
|
+
userHandle: string;
|
|
6
|
+
}
|
|
7
|
+
export interface ListPasskeysResult {
|
|
8
|
+
success: true;
|
|
9
|
+
credentials: PasskeyCredential[];
|
|
10
|
+
}
|
|
11
|
+
export interface ListPasskeysError {
|
|
12
|
+
success: false;
|
|
13
|
+
error: Error;
|
|
14
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "electron-webauthn",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"repository": "https://github.com/iamEvanYT/electron-webauthn.git",
|
|
5
5
|
"homepage": "https://github.com/iamEvanYT/electron-webauthn#readme",
|
|
6
6
|
"description": "Add support for WebAuthn for Electron.",
|
|
@@ -30,7 +30,8 @@
|
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"@oslojs/webauthn": "^1.0.0",
|
|
33
|
-
"objc-js": "^1.
|
|
33
|
+
"objc-js": "^1.3.1",
|
|
34
|
+
"objcjs-types": "^0.5.1"
|
|
34
35
|
},
|
|
35
36
|
"trustedDependencies": [
|
|
36
37
|
"objc-js"
|
package/dist/objc/authentication-services/as-authorization-c-public-key-credential-descriptor.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { NobjcObject } from "objc-js";
|
|
2
|
-
declare class _ASCPublicKeyCredentialDescriptor extends NobjcObject {
|
|
3
|
-
initWithCredentialID$transports$(credentialID: NobjcObject, transports: NobjcObject): _ASCPublicKeyCredentialDescriptor;
|
|
4
|
-
credentialID(): NobjcObject;
|
|
5
|
-
transports(): NobjcObject;
|
|
6
|
-
}
|
|
7
|
-
export declare const ASCPublicKeyCredentialDescriptor: typeof _ASCPublicKeyCredentialDescriptor;
|
|
8
|
-
export type { _ASCPublicKeyCredentialDescriptor };
|
|
9
|
-
export declare function createASCPublicKeyCredentialDescriptor(credentialID: NobjcObject, transports: NobjcObject): _ASCPublicKeyCredentialDescriptor;
|
package/dist/objc/authentication-services/as-authorization-c-public-key-credential-descriptor.js
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { AuthenticationServices } from "./index.js";
|
|
2
|
-
export const ASCPublicKeyCredentialDescriptor = AuthenticationServices.ASCPublicKeyCredentialDescriptor;
|
|
3
|
-
export function createASCPublicKeyCredentialDescriptor(credentialID, transports) {
|
|
4
|
-
const instance = ASCPublicKeyCredentialDescriptor.alloc();
|
|
5
|
-
return instance.initWithCredentialID$transports$(credentialID, transports);
|
|
6
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { NobjcObject } from "objc-js";
|
|
2
|
-
import type { _ASAuthorization } from "./as-authorization.js";
|
|
3
|
-
export interface ASAuthorizationControllerDelegateCallbacks {
|
|
4
|
-
didCompleteWithAuthorization?: (controller: NobjcObject, authorization: _ASAuthorization) => void;
|
|
5
|
-
didCompleteWithError?: (controller: NobjcObject, error: NobjcObject) => void;
|
|
6
|
-
}
|
|
7
|
-
export declare function createAuthorizationControllerDelegate(callbacks: ASAuthorizationControllerDelegateCallbacks): NobjcObject;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { NobjcObject, NobjcProtocol } from "objc-js";
|
|
2
|
-
export function createAuthorizationControllerDelegate(callbacks) {
|
|
3
|
-
const methodImplementations = {};
|
|
4
|
-
if (callbacks.didCompleteWithAuthorization) {
|
|
5
|
-
methodImplementations["authorizationController$didCompleteWithAuthorization$"] = callbacks.didCompleteWithAuthorization;
|
|
6
|
-
}
|
|
7
|
-
if (callbacks.didCompleteWithError) {
|
|
8
|
-
methodImplementations["authorizationController$didCompleteWithError$"] =
|
|
9
|
-
callbacks.didCompleteWithError;
|
|
10
|
-
}
|
|
11
|
-
return NobjcProtocol.implement("ASAuthorizationControllerDelegate", methodImplementations);
|
|
12
|
-
}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { NobjcObject } from "objc-js";
|
|
2
|
-
export interface ASAuthorizationControllerPresentationContextProvidingCallbacks {
|
|
3
|
-
presentationAnchorForAuthorizationController: (controller: NobjcObject) => NobjcObject;
|
|
4
|
-
}
|
|
5
|
-
export declare function createPresentationContextProvider(callbacks: ASAuthorizationControllerPresentationContextProvidingCallbacks): NobjcObject;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { NobjcObject, NobjcProtocol } from "objc-js";
|
|
2
|
-
export function createPresentationContextProvider(callbacks) {
|
|
3
|
-
const methodImplementations = {};
|
|
4
|
-
methodImplementations["presentationAnchorForAuthorizationController$"] =
|
|
5
|
-
callbacks.presentationAnchorForAuthorizationController;
|
|
6
|
-
return NobjcProtocol.implement("ASAuthorizationControllerPresentationContextProviding", methodImplementations);
|
|
7
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { NobjcObject } from "objc-js";
|
|
2
|
-
declare class _ASAuthorizationController extends NobjcObject {
|
|
3
|
-
initWithAuthorizationRequests$(authorizationRequests: NobjcObject): _ASAuthorizationController;
|
|
4
|
-
performRequests(): void;
|
|
5
|
-
performRequestsWithOptions$(options: NobjcObject): void;
|
|
6
|
-
performAutoFillAssistedRequests(): void;
|
|
7
|
-
cancel(): void;
|
|
8
|
-
setDelegate$(delegate: NobjcObject): void;
|
|
9
|
-
delegate(): NobjcObject;
|
|
10
|
-
setPresentationContextProvider$(provider: NobjcObject): void;
|
|
11
|
-
presentationContextProvider(): NobjcObject;
|
|
12
|
-
}
|
|
13
|
-
export declare const ASAuthorizationController: typeof _ASAuthorizationController;
|
|
14
|
-
export declare function createAuthorizationController(authorizationRequests: NobjcObject): _ASAuthorizationController;
|
|
15
|
-
export {};
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { AuthenticationServices } from "./index.js";
|
|
2
|
-
export const ASAuthorizationController = AuthenticationServices.ASAuthorizationController;
|
|
3
|
-
export function createAuthorizationController(authorizationRequests) {
|
|
4
|
-
const instance = ASAuthorizationController.alloc();
|
|
5
|
-
return instance.initWithAuthorizationRequests$(authorizationRequests);
|
|
6
|
-
}
|