electron-webauthn 0.0.8 → 0.0.10

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.
Files changed (66) hide show
  1. package/dist/helpers.d.ts +20 -0
  2. package/dist/helpers.d.ts.map +1 -0
  3. package/dist/helpers.js +24 -0
  4. package/dist/helpers.js.map +1 -0
  5. package/dist/index.d.ts +10 -12
  6. package/dist/index.d.ts.map +1 -1
  7. package/dist/index.js +39 -10
  8. package/dist/index.js.map +1 -1
  9. package/dist/objc/authentication-services/as-authorization-controller-delegate.d.ts +2 -1
  10. package/dist/objc/authentication-services/as-authorization-controller-delegate.d.ts.map +1 -1
  11. package/dist/objc/authentication-services/as-authorization-controller-delegate.js.map +1 -1
  12. package/dist/objc/authentication-services/as-authorization-platform-public-key-credential-assertion.d.ts +18 -0
  13. package/dist/objc/authentication-services/as-authorization-platform-public-key-credential-assertion.d.ts.map +1 -0
  14. package/dist/objc/authentication-services/as-authorization-platform-public-key-credential-assertion.js +3 -0
  15. package/dist/objc/authentication-services/as-authorization-platform-public-key-credential-assertion.js.map +1 -0
  16. package/dist/objc/authentication-services/as-authorization-platform-public-key-credential-descriptor.d.ts +39 -0
  17. package/dist/objc/authentication-services/as-authorization-platform-public-key-credential-descriptor.d.ts.map +1 -0
  18. package/dist/objc/authentication-services/as-authorization-platform-public-key-credential-descriptor.js +13 -0
  19. package/dist/objc/authentication-services/as-authorization-platform-public-key-credential-descriptor.js.map +1 -0
  20. package/dist/objc/authentication-services/as-authorization-public-key-credential-large-blob-assertion.d.ts +9 -0
  21. package/dist/objc/authentication-services/as-authorization-public-key-credential-large-blob-assertion.d.ts.map +1 -0
  22. package/dist/objc/authentication-services/as-authorization-public-key-credential-large-blob-assertion.js +3 -0
  23. package/dist/objc/authentication-services/as-authorization-public-key-credential-large-blob-assertion.js.map +1 -0
  24. package/dist/objc/authentication-services/as-authorization-public-key-credential-prf-assertion.d.ts +9 -0
  25. package/dist/objc/authentication-services/as-authorization-public-key-credential-prf-assertion.d.ts.map +1 -0
  26. package/dist/objc/authentication-services/as-authorization-public-key-credential-prf-assertion.js +3 -0
  27. package/dist/objc/authentication-services/as-authorization-public-key-credential-prf-assertion.js.map +1 -0
  28. package/dist/objc/authentication-services/as-authorization.d.ts +42 -0
  29. package/dist/objc/authentication-services/as-authorization.d.ts.map +1 -0
  30. package/dist/objc/authentication-services/as-authorization.js +3 -0
  31. package/dist/objc/authentication-services/as-authorization.js.map +1 -0
  32. package/dist/objc/authentication-services/enums/as-authorization-public-key-credential-attachment.d.ts +8 -0
  33. package/dist/objc/authentication-services/enums/as-authorization-public-key-credential-attachment.d.ts.map +1 -0
  34. package/dist/objc/authentication-services/enums/as-authorization-public-key-credential-attachment.js +9 -0
  35. package/dist/objc/authentication-services/enums/as-authorization-public-key-credential-attachment.js.map +1 -0
  36. package/dist/objc/helpers.d.ts +0 -13
  37. package/dist/objc/helpers.d.ts.map +1 -1
  38. package/dist/objc/helpers.js +0 -21
  39. package/dist/objc/helpers.js.map +1 -1
  40. package/package.json +3 -2
  41. package/dist/example.d.ts +0 -2
  42. package/dist/example.d.ts.map +0 -1
  43. package/dist/example.js +0 -24
  44. package/dist/example.js.map +0 -1
  45. package/dist/helper.js +0 -23
  46. package/dist/objc/auth-services.js +0 -28
  47. package/dist/objc/foundation/helpers.js +0 -142
  48. package/dist/objc/foundation/main.js +0 -4
  49. package/dist/objc/foundation/nsvalue.js +0 -2
  50. package/dist/objc/foundation.js +0 -28
  51. package/dist/test/example.d.ts +0 -2
  52. package/dist/test/example.d.ts.map +0 -1
  53. package/dist/test/example.js +0 -24
  54. package/dist/test/example.js.map +0 -1
  55. package/dist/test/index.d.ts +0 -2
  56. package/dist/test/index.d.ts.map +0 -1
  57. package/dist/test/index.js +0 -9
  58. package/dist/test/index.js.map +0 -1
  59. package/dist/test/window.d.ts +0 -5
  60. package/dist/test/window.d.ts.map +0 -1
  61. package/dist/test/window.js +0 -58
  62. package/dist/test/window.js.map +0 -1
  63. package/dist/window.d.ts +0 -5
  64. package/dist/window.d.ts.map +0 -1
  65. package/dist/window.js +0 -58
  66. package/dist/window.js.map +0 -1
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Creates a Promise along with its resolve and reject callbacks.
3
+ * This is a polyfill for the native Promise.withResolvers() method.
4
+ *
5
+ * @template T - The type of value the promise resolves to
6
+ * @returns An object containing the promise and its associated resolve and reject functions
7
+ *
8
+ * @example
9
+ * ```ts
10
+ * const { promise, resolve, reject } = PromiseWithResolvers<string>();
11
+ * promise.then(value => console.log(value)); // "Hello"
12
+ * resolve("Hello");
13
+ * ```
14
+ */
15
+ export declare function PromiseWithResolvers<T = void>(): {
16
+ promise: Promise<T>;
17
+ resolve: (value: T | PromiseLike<T>) => void;
18
+ reject: (reason?: unknown) => void;
19
+ };
20
+ //# sourceMappingURL=helpers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../src/helpers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,GAAG,IAAI,KAAK;IAChD,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC;IACpB,OAAO,EAAE,CAAC,KAAK,EAAE,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC;IAC7C,MAAM,EAAE,CAAC,MAAM,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;CACpC,CAQA"}
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Creates a Promise along with its resolve and reject callbacks.
3
+ * This is a polyfill for the native Promise.withResolvers() method.
4
+ *
5
+ * @template T - The type of value the promise resolves to
6
+ * @returns An object containing the promise and its associated resolve and reject functions
7
+ *
8
+ * @example
9
+ * ```ts
10
+ * const { promise, resolve, reject } = PromiseWithResolvers<string>();
11
+ * promise.then(value => console.log(value)); // "Hello"
12
+ * resolve("Hello");
13
+ * ```
14
+ */
15
+ export function PromiseWithResolvers() {
16
+ let resolve;
17
+ let reject;
18
+ const promise = new Promise((res, rej) => {
19
+ resolve = res;
20
+ reject = rej;
21
+ });
22
+ return { promise, resolve: resolve, reject: reject };
23
+ }
24
+ //# sourceMappingURL=helpers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helpers.js","sourceRoot":"","sources":["../src/helpers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,oBAAoB;IAKlC,IAAI,OAA4C,CAAC;IACjD,IAAI,MAAkC,CAAC;IACvC,MAAM,OAAO,GAAG,IAAI,OAAO,CAAI,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE;QAC1C,OAAO,GAAG,GAAG,CAAC;QACd,MAAM,GAAG,GAAG,CAAC;IACf,CAAC,CAAC,CAAC;IACH,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAQ,EAAE,MAAM,EAAE,MAAO,EAAE,CAAC;AACzD,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1,14 +1,12 @@
1
- declare function getCredential(rpid: string, challenge: Buffer, nativeWindowHandle: Buffer): {
2
- [key: string]: import("objc-js").NobjcMethod;
3
- initWithAuthorizationRequests$(authorizationRequests: import("objc-js").NobjcObject): any;
4
- performRequests(): void;
5
- performRequestsWithOptions$(options: import("objc-js").NobjcObject): void;
6
- performAutoFillAssistedRequests(): void;
7
- cancel(): void;
8
- setDelegate$(delegate: import("objc-js").NobjcObject): void;
9
- delegate(): import("objc-js").NobjcObject;
10
- setPresentationContextProvider$(provider: import("objc-js").NobjcObject): void;
11
- presentationContextProvider(): import("objc-js").NobjcObject;
12
- };
1
+ type AuthenticatorAttachment = "platform" | "cross-platform";
2
+ export interface GetCredentialResult {
3
+ id: Buffer;
4
+ authenticatorAttachment: AuthenticatorAttachment;
5
+ clientDataJSON: Buffer;
6
+ authenticatorData: Buffer;
7
+ signature: Buffer;
8
+ userHandle: Buffer;
9
+ }
10
+ declare function getCredential(rpid: string, challenge: Buffer, nativeWindowHandle: Buffer, allowedCredentialIds: Buffer[]): Promise<GetCredentialResult>;
13
11
  export { getCredential };
14
12
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAWA,iBAAS,aAAa,CACpB,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,MAAM,EACjB,kBAAkB,EAAE,MAAM;;;;;;;;;;;EAmD3B;AAED,OAAO,EAAE,aAAa,EAAE,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAoBA,KAAK,uBAAuB,GAAG,UAAU,GAAG,gBAAgB,CAAC;AAE7D,MAAM,WAAW,mBAAmB;IAClC,EAAE,EAAE,MAAM,CAAC;IACX,uBAAuB,EAAE,uBAAuB,CAAC;IACjD,cAAc,EAAE,MAAM,CAAC;IACvB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,iBAAS,aAAa,CACpB,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,MAAM,EACjB,kBAAkB,EAAE,MAAM,EAC1B,oBAAoB,EAAE,MAAM,EAAE,GAC7B,OAAO,CAAC,mBAAmB,CAAC,CAwF9B;AAED,OAAO,EAAE,aAAa,EAAE,CAAC"}
package/dist/index.js CHANGED
@@ -1,12 +1,17 @@
1
- import { fromPointer, getPointer } from "objc-js";
1
+ import { fromPointer } from "objc-js";
2
2
  import { createAuthorizationControllerDelegate } from "./objc/authentication-services/as-authorization-controller-delegate.js";
3
3
  import { createAuthorizationController } from "./objc/authentication-services/as-authorization-controller.js";
4
4
  import { createPresentationContextProvider } from "./objc/authentication-services/as-authorization-controller-presentation-context-providing.js";
5
5
  import { createPlatformPublicKeyCredentialProvider } from "./objc/authentication-services/as-authorization-platform-public-key-credential-provider.js";
6
- import { NSArray } from "./objc/foundation/nsarray.js";
7
- import { NSDataFromBuffer } from "./objc/foundation/nsdata.js";
6
+ import { createPlatformPublicKeyCredentialDescriptor } from "./objc/authentication-services/as-authorization-platform-public-key-credential-descriptor.js";
7
+ import { NSArray, NSArrayFromObjects } from "./objc/foundation/nsarray.js";
8
+ import { bufferFromNSDataDirect, NSDataFromBuffer, } from "./objc/foundation/nsdata.js";
8
9
  import { NSStringFromString } from "./objc/foundation/nsstring.js";
9
- function getCredential(rpid, challenge, nativeWindowHandle) {
10
+ import { PromiseWithResolvers } from "./helpers.js";
11
+ import { ASAuthorizationPublicKeyCredentialAttachment } from "./objc/authentication-services/enums/as-authorization-public-key-credential-attachment.js";
12
+ function getCredential(rpid, challenge, nativeWindowHandle, allowedCredentialIds) {
13
+ const { promise, resolve, reject } = PromiseWithResolvers();
14
+ // Create NS objects
10
15
  const NS_rpID = NSStringFromString(rpid);
11
16
  // let challenge: Data // Obtain this from the server.
12
17
  const NS_challenge = NSDataFromBuffer(challenge);
@@ -17,21 +22,45 @@ function getCredential(rpid, challenge, nativeWindowHandle) {
17
22
  // let authController = ASAuthorizationController(authorizationRequests: [platformKeyRequest])
18
23
  const requestsArray = NSArray.arrayWithObject$(platformKeyRequest);
19
24
  const authController = createAuthorizationController(requestsArray);
25
+ // Set allowed credentials if provided
26
+ if (allowedCredentialIds.length > 0) {
27
+ const allowedCredentials = NSArrayFromObjects(allowedCredentialIds.map((id) => createPlatformPublicKeyCredentialDescriptor(NSDataFromBuffer(id))));
28
+ platformKeyRequest.setAllowedCredentials$(allowedCredentials);
29
+ }
20
30
  // authController.delegate = self
21
31
  const delegate = createAuthorizationControllerDelegate({
22
- didCompleteWithAuthorization: (controller, authorization) => {
23
- console.log("Authorization succeeded:", authorization);
32
+ didCompleteWithAuthorization: (_, authorization) => {
33
+ // Cast to _ASAuthorization to access typed methods
34
+ const credential = authorization.credential();
35
+ console.log("Authorization succeeded:", credential);
36
+ const id_data = credential.credentialID();
37
+ const id = bufferFromNSDataDirect(id_data);
38
+ let authenticatorAttachment = "platform";
39
+ if (credential.attachment() ===
40
+ ASAuthorizationPublicKeyCredentialAttachment.ASAuthorizationPublicKeyCredentialAttachmentCrossPlatform) {
41
+ authenticatorAttachment = "cross-platform";
42
+ }
43
+ resolve({
44
+ id,
45
+ authenticatorAttachment,
46
+ clientDataJSON: bufferFromNSDataDirect(credential.rawClientDataJSON()),
47
+ authenticatorData: bufferFromNSDataDirect(credential.rawAuthenticatorData()),
48
+ signature: bufferFromNSDataDirect(credential.signature()),
49
+ userHandle: bufferFromNSDataDirect(credential.userID()),
50
+ });
24
51
  },
25
- didCompleteWithError: (controller, error) => {
52
+ didCompleteWithError: (_, error) => {
26
53
  // Parse the NSError into a readable format
27
54
  const parsedError = error;
28
- console.error("Authorization failed:", parsedError.localizedDescription().UTF8String());
55
+ const errorMessage = parsedError.localizedDescription().UTF8String();
56
+ console.error("Authorization failed:", errorMessage);
57
+ reject(new Error(errorMessage));
29
58
  },
30
59
  });
31
60
  authController.setDelegate$(delegate);
32
61
  // authController.presentationContextProvider = self
33
62
  const presentationContextProvider = createPresentationContextProvider({
34
- presentationAnchorForAuthorizationController: (controller) => {
63
+ presentationAnchorForAuthorizationController: () => {
35
64
  // Return the NSWindow to present the authorization UI in
36
65
  const nsView = fromPointer(nativeWindowHandle);
37
66
  const nsWindow = nsView.window();
@@ -41,7 +70,7 @@ function getCredential(rpid, challenge, nativeWindowHandle) {
41
70
  authController.setPresentationContextProvider$(presentationContextProvider);
42
71
  // authController.performRequests()
43
72
  authController.performRequests();
44
- return authController;
73
+ return promise;
45
74
  }
46
75
  export { getCredential };
47
76
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAClD,OAAO,EAAE,qCAAqC,EAAE,MAAM,wEAAwE,CAAC;AAC/H,OA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E,CAAC;IAEjC,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,OAAO,EAAE,aAAa,EAAE,CAAC"}
@@ -1,4 +1,5 @@
1
1
  import { NobjcObject } from "objc-js";
2
+ import type { _ASAuthorization } from "./as-authorization.js";
2
3
  /**
3
4
  * ASAuthorizationControllerDelegate Protocol
4
5
  *
@@ -15,7 +16,7 @@ export interface ASAuthorizationControllerDelegateCallbacks {
15
16
  * @param controller The authorization controller that completed.
16
17
  * @param authorization The authorization object containing the credential.
17
18
  */
18
- didCompleteWithAuthorization?: (controller: NobjcObject, authorization: NobjcObject) => void;
19
+ didCompleteWithAuthorization?: (controller: NobjcObject, authorization: _ASAuthorization) => void;
19
20
  /**
20
21
  * Tells the delegate that authorization failed with an error.
21
22
  * @param controller The authorization controller that failed.
@@ -1 +1 @@
1
- {"version":3,"file":"as-authorization-controller-delegate.d.ts","sourceRoot":"","sources":["../../../src/objc/authentication-services/as-authorization-controller-delegate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAiB,MAAM,SAAS,CAAC;AAErD;;;;;;;;;GASG;AAEH,MAAM,WAAW,0CAA0C;IACzD;;;;OAIG;IACH,4BAA4B,CAAC,EAAE,CAC7B,UAAU,EAAE,WAAW,EACvB,aAAa,EAAE,WAAW,KACvB,IAAI,CAAC;IAEV;;;;OAIG;IACH,oBAAoB,CAAC,EAAE,CAAC,UAAU,EAAE,WAAW,EAAE,KAAK,EAAE,WAAW,KAAK,IAAI,CAAC;CAC9E;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,qCAAqC,CACnD,SAAS,EAAE,0CAA0C,GACpD,WAAW,CAoBb"}
1
+ {"version":3,"file":"as-authorization-controller-delegate.d.ts","sourceRoot":"","sources":["../../../src/objc/authentication-services/as-authorization-controller-delegate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAiB,MAAM,SAAS,CAAC;AACrD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAE9D;;;;;;;;;GASG;AAEH,MAAM,WAAW,0CAA0C;IACzD;;;;OAIG;IACH,4BAA4B,CAAC,EAAE,CAC7B,UAAU,EAAE,WAAW,EACvB,aAAa,EAAE,gBAAgB,KAC5B,IAAI,CAAC;IAEV;;;;OAIG;IACH,oBAAoB,CAAC,EAAE,CAAC,UAAU,EAAE,WAAW,EAAE,KAAK,EAAE,WAAW,KAAK,IAAI,CAAC;CAC9E;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,qCAAqC,CACnD,SAAS,EAAE,0CAA0C,GACpD,WAAW,CAoBb"}
@@ -1 +1 @@
1
- {"version":3,"file":"as-authorization-controller-delegate.js","sourceRoot":"","sources":["../../../src/objc/authentication-services/as-authorization-controller-delegate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAgCrD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,UAAU,qCAAqC,CACnD,SAAqD;IAErD,MAAM,qBAAqB,GAA4C,EAAE,CAAC;IAE1E,iEAAiE;IACjE,IAAI,SAAS,CAAC,4BAA4B,EAAE,CAAC;QAC3C,qBAAqB,CACnB,uDAAuD,CACxD,GAAG,SAAS,CAAC,4BAA4B,CAAC;IAC7C,CAAC;IAED,IAAI,SAAS,CAAC,oBAAoB,EAAE,CAAC;QACnC,qBAAqB,CAAC,+CAA+C,CAAC;YACpE,SAAS,CAAC,oBAAoB,CAAC;IACnC,CAAC;IAED,gDAAgD;IAChD,OAAO,aAAa,CAAC,SAAS,CAC5B,mCAAmC,EACnC,qBAAqB,CACtB,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"as-authorization-controller-delegate.js","sourceRoot":"","sources":["../../../src/objc/authentication-services/as-authorization-controller-delegate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAiCrD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,UAAU,qCAAqC,CACnD,SAAqD;IAErD,MAAM,qBAAqB,GAA4C,EAAE,CAAC;IAE1E,iEAAiE;IACjE,IAAI,SAAS,CAAC,4BAA4B,EAAE,CAAC;QAC3C,qBAAqB,CACnB,uDAAuD,CACxD,GAAG,SAAS,CAAC,4BAA4B,CAAC;IAC7C,CAAC;IAED,IAAI,SAAS,CAAC,oBAAoB,EAAE,CAAC;QACnC,qBAAqB,CAAC,+CAA+C,CAAC;YACpE,SAAS,CAAC,oBAAoB,CAAC;IACnC,CAAC;IAED,gDAAgD;IAChD,OAAO,aAAa,CAAC,SAAS,CAC5B,mCAAmC,EACnC,qBAAqB,CACtB,CAAC;AACJ,CAAC"}
@@ -0,0 +1,18 @@
1
+ import type { NobjcObject } from "objc-js";
2
+ import type { _ASAuthorizationPublicKeyCredentialLargeBlobAssertionOutput } from "./as-authorization-public-key-credential-large-blob-assertion.js";
3
+ import type { _ASAuthorizationPublicKeyCredentialPRFAssertionOutput } from "./as-authorization-public-key-credential-prf-assertion.js";
4
+ import type { _NSData } from "../foundation/nsdata.js";
5
+ import type { ASAuthorizationPublicKeyCredentialAttachment } from "./enums/as-authorization-public-key-credential-attachment.js";
6
+ declare class _ASAuthorizationPlatformPublicKeyCredentialAssertion extends NobjcObject {
7
+ attachment(): ASAuthorizationPublicKeyCredentialAttachment;
8
+ largeBlob(): _ASAuthorizationPublicKeyCredentialLargeBlobAssertionOutput;
9
+ prf(): _ASAuthorizationPublicKeyCredentialPRFAssertionOutput;
10
+ rawClientDataJSON(): _NSData;
11
+ credentialID(): _NSData;
12
+ rawAuthenticatorData(): _NSData;
13
+ userID(): _NSData;
14
+ signature(): _NSData;
15
+ }
16
+ export declare const ASAuthorizationPlatformPublicKeyCredentialAssertion: typeof _ASAuthorizationPlatformPublicKeyCredentialAssertion;
17
+ export type { _ASAuthorizationPlatformPublicKeyCredentialAssertion };
18
+ //# sourceMappingURL=as-authorization-platform-public-key-credential-assertion.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"as-authorization-platform-public-key-credential-assertion.d.ts","sourceRoot":"","sources":["../../../src/objc/authentication-services/as-authorization-platform-public-key-credential-assertion.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAC3C,OAAO,KAAK,EAAE,2DAA2D,EAAE,MAAM,kEAAkE,CAAC;AACpJ,OAAO,KAAK,EAAE,qDAAqD,EAAE,MAAM,2DAA2D,CAAC;AACvI,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,KAAK,EAAE,4CAA4C,EAAE,MAAM,8DAA8D,CAAC;AAEjI,OAAO,OAAO,oDAAqD,SAAQ,WAAW;IACpF,UAAU,IAAI,4CAA4C;IAE1D,SAAS,IAAI,2DAA2D;IAExE,GAAG,IAAI,qDAAqD;IAE5D,iBAAiB,IAAI,OAAO;IAE5B,YAAY,IAAI,OAAO;IAEvB,oBAAoB,IAAI,OAAO;IAE/B,MAAM,IAAI,OAAO;IAEjB,SAAS,IAAI,OAAO;CACrB;AAED,eAAO,MAAM,mDAAmD,EAC2B,OAAO,oDAAoD,CAAC;AAEvJ,YAAY,EAAE,oDAAoD,EAAE,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { AuthenticationServices } from "./index.js";
2
+ export const ASAuthorizationPlatformPublicKeyCredentialAssertion = AuthenticationServices.ASAuthorizationPlatformPublicKeyCredentialAssertion;
3
+ //# sourceMappingURL=as-authorization-platform-public-key-credential-assertion.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"as-authorization-platform-public-key-credential-assertion.js","sourceRoot":"","sources":["../../../src/objc/authentication-services/as-authorization-platform-public-key-credential-assertion.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AAyBpD,MAAM,CAAC,MAAM,mDAAmD,GAC9D,sBAAsB,CAAC,mDAA6H,CAAC"}
@@ -0,0 +1,39 @@
1
+ import type { NobjcObject } from "objc-js";
2
+ /**
3
+ * ASAuthorizationPlatformPublicKeyCredentialDescriptor
4
+ *
5
+ * A descriptor that identifies a public key credential.
6
+ * https://developer.apple.com/documentation/authenticationservices/asauthorizationplatformpublickeycredentialdescriptor?language=objc
7
+ *
8
+ * This class is used to specify which credentials are acceptable for authentication.
9
+ * It's typically used in assertion requests to indicate which credentials the relying
10
+ * party is willing to accept.
11
+ */
12
+ declare class _ASAuthorizationPlatformPublicKeyCredentialDescriptor extends NobjcObject {
13
+ /**
14
+ * Creates a credential descriptor with the specified credential identifier.
15
+ *
16
+ * @param credentialID The credential identifier as NSData
17
+ * @returns An initialized credential descriptor
18
+ * @private Do not use this method directly. Use the helper function instead.
19
+ */
20
+ initWithCredentialID$(credentialID: NobjcObject): _ASAuthorizationPlatformPublicKeyCredentialDescriptor;
21
+ /**
22
+ * The credential identifier.
23
+ *
24
+ * This is the unique identifier for the credential, typically obtained
25
+ * during the registration process.
26
+ *
27
+ * @returns NSData containing the credential ID
28
+ */
29
+ credentialID(): NobjcObject;
30
+ }
31
+ export declare const ASAuthorizationPlatformPublicKeyCredentialDescriptor: typeof _ASAuthorizationPlatformPublicKeyCredentialDescriptor;
32
+ export type { _ASAuthorizationPlatformPublicKeyCredentialDescriptor };
33
+ /**
34
+ * Create an ASAuthorizationPlatformPublicKeyCredentialDescriptor instance
35
+ * @param credentialID The credential identifier (NSData)
36
+ * @returns An initialized credential descriptor
37
+ */
38
+ export declare function createPlatformPublicKeyCredentialDescriptor(credentialID: NobjcObject): _ASAuthorizationPlatformPublicKeyCredentialDescriptor;
39
+ //# sourceMappingURL=as-authorization-platform-public-key-credential-descriptor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"as-authorization-platform-public-key-credential-descriptor.d.ts","sourceRoot":"","sources":["../../../src/objc/authentication-services/as-authorization-platform-public-key-credential-descriptor.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAE3C;;;;;;;;;GASG;AACH,OAAO,OAAO,qDAAsD,SAAQ,WAAW;IACrF;;;;;;OAMG;IACH,qBAAqB,CACnB,YAAY,EAAE,WAAW,GACxB,qDAAqD;IAExD;;;;;;;OAOG;IACH,YAAY,IAAI,WAAW;CAC5B;AAED,eAAO,MAAM,oDAAoD,EAC2B,OAAO,qDAAqD,CAAC;AAEzJ,YAAY,EAAE,qDAAqD,EAAE,CAAC;AAItE;;;;GAIG;AACH,wBAAgB,2CAA2C,CACzD,YAAY,EAAE,WAAW,GACxB,qDAAqD,CAKvD"}
@@ -0,0 +1,13 @@
1
+ import { AuthenticationServices } from "./index.js";
2
+ export const ASAuthorizationPlatformPublicKeyCredentialDescriptor = AuthenticationServices.ASAuthorizationPlatformPublicKeyCredentialDescriptor;
3
+ // Helper Functions
4
+ /**
5
+ * Create an ASAuthorizationPlatformPublicKeyCredentialDescriptor instance
6
+ * @param credentialID The credential identifier (NSData)
7
+ * @returns An initialized credential descriptor
8
+ */
9
+ export function createPlatformPublicKeyCredentialDescriptor(credentialID) {
10
+ const instance = ASAuthorizationPlatformPublicKeyCredentialDescriptor.alloc();
11
+ return instance.initWithCredentialID$(credentialID);
12
+ }
13
+ //# sourceMappingURL=as-authorization-platform-public-key-credential-descriptor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"as-authorization-platform-public-key-credential-descriptor.js","sourceRoot":"","sources":["../../../src/objc/authentication-services/as-authorization-platform-public-key-credential-descriptor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AAoCpD,MAAM,CAAC,MAAM,oDAAoD,GAC/D,sBAAsB,CAAC,oDAA+H,CAAC;AAIzJ,mBAAmB;AAEnB;;;;GAIG;AACH,MAAM,UAAU,2CAA2C,CACzD,YAAyB;IAEzB,MAAM,QAAQ,GACZ,oDACD,CAAC,KAAK,EAAE,CAAC;IACV,OAAO,QAAQ,CAAC,qBAAqB,CAAC,YAAY,CAAC,CAAC;AACtD,CAAC"}
@@ -0,0 +1,9 @@
1
+ import type { NobjcObject } from "objc-js";
2
+ import type { _NSData } from "../foundation/nsdata.js";
3
+ declare class _ASAuthorizationPublicKeyCredentialLargeBlobAssertionOutput extends NobjcObject {
4
+ readData(): _NSData;
5
+ didWrite(): boolean;
6
+ }
7
+ export declare const ASAuthorizationPublicKeyCredentialLargeBlobAssertionOutput: typeof _ASAuthorizationPublicKeyCredentialLargeBlobAssertionOutput;
8
+ export type { _ASAuthorizationPublicKeyCredentialLargeBlobAssertionOutput };
9
+ //# sourceMappingURL=as-authorization-public-key-credential-large-blob-assertion.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"as-authorization-public-key-credential-large-blob-assertion.d.ts","sourceRoot":"","sources":["../../../src/objc/authentication-services/as-authorization-public-key-credential-large-blob-assertion.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAC3C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAEvD,OAAO,OAAO,2DAA4D,SAAQ,WAAW;IAC3F,QAAQ,IAAI,OAAO;IAEnB,QAAQ,IAAI,OAAO;CACpB;AAED,eAAO,MAAM,0DAA0D,EAC2B,OAAO,2DAA2D,CAAC;AAErK,YAAY,EAAE,2DAA2D,EAAE,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { AuthenticationServices } from "./index.js";
2
+ export const ASAuthorizationPublicKeyCredentialLargeBlobAssertionOutput = AuthenticationServices.ASAuthorizationPublicKeyCredentialLargeBlobAssertionOutput;
3
+ //# sourceMappingURL=as-authorization-public-key-credential-large-blob-assertion.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"as-authorization-public-key-credential-large-blob-assertion.js","sourceRoot":"","sources":["../../../src/objc/authentication-services/as-authorization-public-key-credential-large-blob-assertion.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AAUpD,MAAM,CAAC,MAAM,0DAA0D,GACrE,sBAAsB,CAAC,0DAA2I,CAAC"}
@@ -0,0 +1,9 @@
1
+ import type { NobjcObject } from "objc-js";
2
+ import type { _NSData } from "../foundation/nsdata.js";
3
+ declare class _ASAuthorizationPublicKeyCredentialPRFAssertionOutput extends NobjcObject {
4
+ first(): _NSData;
5
+ second(): _NSData;
6
+ }
7
+ export declare const ASAuthorizationPublicKeyCredentialPRFAssertionOutput: typeof _ASAuthorizationPublicKeyCredentialPRFAssertionOutput;
8
+ export type { _ASAuthorizationPublicKeyCredentialPRFAssertionOutput };
9
+ //# sourceMappingURL=as-authorization-public-key-credential-prf-assertion.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"as-authorization-public-key-credential-prf-assertion.d.ts","sourceRoot":"","sources":["../../../src/objc/authentication-services/as-authorization-public-key-credential-prf-assertion.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAC3C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAEvD,OAAO,OAAO,qDAAsD,SAAQ,WAAW;IACrF,KAAK,IAAI,OAAO;IAEhB,MAAM,IAAI,OAAO;CAClB;AAED,eAAO,MAAM,oDAAoD,EAC2B,OAAO,qDAAqD,CAAC;AAEzJ,YAAY,EAAE,qDAAqD,EAAE,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { AuthenticationServices } from "./index.js";
2
+ export const ASAuthorizationPublicKeyCredentialPRFAssertionOutput = AuthenticationServices.ASAuthorizationPublicKeyCredentialPRFAssertionOutput;
3
+ //# sourceMappingURL=as-authorization-public-key-credential-prf-assertion.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"as-authorization-public-key-credential-prf-assertion.js","sourceRoot":"","sources":["../../../src/objc/authentication-services/as-authorization-public-key-credential-prf-assertion.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AAUpD,MAAM,CAAC,MAAM,oDAAoD,GAC/D,sBAAsB,CAAC,oDAA+H,CAAC"}
@@ -0,0 +1,42 @@
1
+ import type { NobjcObject } from "objc-js";
2
+ /**
3
+ * ASAuthorization
4
+ *
5
+ * An authorization that a user grants to your app.
6
+ * https://developer.apple.com/documentation/authenticationservices/asauthorization?language=objc
7
+ *
8
+ * This class represents the result of a successful authorization request.
9
+ * It contains the credential that was authorized and the provider that created it.
10
+ */
11
+ declare class _ASAuthorization extends NobjcObject {
12
+ /**
13
+ * The credential that the user authorized.
14
+ *
15
+ * The type of credential depends on the authorization request:
16
+ * - ASAuthorizationPlatformPublicKeyCredentialAssertion for platform credential assertions
17
+ * - ASAuthorizationPlatformPublicKeyCredentialRegistration for platform credential registrations
18
+ * - ASAuthorizationSecurityKeyPublicKeyCredentialAssertion for security key assertions
19
+ * - ASAuthorizationSecurityKeyPublicKeyCredentialRegistration for security key registrations
20
+ * - ASAuthorizationAppleIDCredential for Sign in with Apple
21
+ * - ASAuthorizationPasswordCredential for password credentials
22
+ * - ASAuthorizationSingleSignOnCredential for single sign-on
23
+ *
24
+ * @returns The credential object
25
+ */
26
+ credential(): NobjcObject;
27
+ /**
28
+ * The authorization provider that created the credential.
29
+ *
30
+ * This is typically one of:
31
+ * - ASAuthorizationPlatformPublicKeyCredentialProvider
32
+ * - ASAuthorizationSecurityKeyPublicKeyCredentialProvider
33
+ * - ASAuthorizationAppleIDProvider
34
+ * - ASAuthorizationPasswordProvider
35
+ *
36
+ * @returns The provider object
37
+ */
38
+ provider(): NobjcObject;
39
+ }
40
+ export declare const ASAuthorization: typeof _ASAuthorization;
41
+ export type { _ASAuthorization };
42
+ //# sourceMappingURL=as-authorization.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"as-authorization.d.ts","sourceRoot":"","sources":["../../../src/objc/authentication-services/as-authorization.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAE3C;;;;;;;;GAQG;AACH,OAAO,OAAO,gBAAiB,SAAQ,WAAW;IAChD;;;;;;;;;;;;;OAaG;IACH,UAAU,IAAI,WAAW;IAEzB;;;;;;;;;;OAUG;IACH,QAAQ,IAAI,WAAW;CACxB;AAED,eAAO,MAAM,eAAe,EAC2B,OAAO,gBAAgB,CAAC;AAE/E,YAAY,EAAE,gBAAgB,EAAE,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { AuthenticationServices } from "./index.js";
2
+ export const ASAuthorization = AuthenticationServices.ASAuthorization;
3
+ //# sourceMappingURL=as-authorization.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"as-authorization.js","sourceRoot":"","sources":["../../../src/objc/authentication-services/as-authorization.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AA2CpD,MAAM,CAAC,MAAM,eAAe,GAC1B,sBAAsB,CAAC,eAAqD,CAAC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * ASAuthorizationPublicKeyCredentialAttachment
3
+ */
4
+ export declare const enum ASAuthorizationPublicKeyCredentialAttachment {
5
+ ASAuthorizationPublicKeyCredentialAttachmentPlatform = 0,
6
+ ASAuthorizationPublicKeyCredentialAttachmentCrossPlatform = 1
7
+ }
8
+ //# sourceMappingURL=as-authorization-public-key-credential-attachment.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"as-authorization-public-key-credential-attachment.d.ts","sourceRoot":"","sources":["../../../../src/objc/authentication-services/enums/as-authorization-public-key-credential-attachment.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,0BAAkB,4CAA4C;IAC5D,oDAAoD,IAAI;IACxD,yDAAyD,IAAI;CAC9D"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * ASAuthorizationPublicKeyCredentialAttachment
3
+ */
4
+ export var ASAuthorizationPublicKeyCredentialAttachment;
5
+ (function (ASAuthorizationPublicKeyCredentialAttachment) {
6
+ ASAuthorizationPublicKeyCredentialAttachment[ASAuthorizationPublicKeyCredentialAttachment["ASAuthorizationPublicKeyCredentialAttachmentPlatform"] = 0] = "ASAuthorizationPublicKeyCredentialAttachmentPlatform";
7
+ ASAuthorizationPublicKeyCredentialAttachment[ASAuthorizationPublicKeyCredentialAttachment["ASAuthorizationPublicKeyCredentialAttachmentCrossPlatform"] = 1] = "ASAuthorizationPublicKeyCredentialAttachmentCrossPlatform";
8
+ })(ASAuthorizationPublicKeyCredentialAttachment || (ASAuthorizationPublicKeyCredentialAttachment = {}));
9
+ //# sourceMappingURL=as-authorization-public-key-credential-attachment.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"as-authorization-public-key-credential-attachment.js","sourceRoot":"","sources":["../../../../src/objc/authentication-services/enums/as-authorization-public-key-credential-attachment.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAN,IAAkB,4CAGjB;AAHD,WAAkB,4CAA4C;IAC5D,+MAAwD,CAAA;IACxD,yNAA6D,CAAA;AAC/D,CAAC,EAHiB,4CAA4C,KAA5C,4CAA4C,QAG7D"}
@@ -1,17 +1,4 @@
1
1
  import type { NobjcObject } from "objc-js";
2
- export declare class NobjcInstanceWrapper {
3
- private _instance;
4
- constructor(instance: NobjcObject);
5
- get instance(): NobjcObject;
6
- }
7
- /**
8
- * Helper to allocate and initialize an Objective-C object with a single argument initializer
9
- * @param cls The Objective-C class
10
- * @param initMethod The initializer method name (e.g., "initWithRelyingPartyIdentifier:")
11
- * @param arg The argument to pass to the initializer
12
- * @returns The initialized instance
13
- */
14
- export declare function allocInit(cls: NobjcObject, initMethod: string, arg: NobjcObject): NobjcObject;
15
2
  /**
16
3
  * Helper to allocate and initialize an Objective-C object with no arguments
17
4
  * @param cls The Objective-C class
@@ -1 +1 @@
1
- {"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../src/objc/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAE3C,qBAAa,oBAAoB;IAC/B,OAAO,CAAC,SAAS,CAAc;gBAEnB,QAAQ,EAAE,WAAW;IAIjC,IAAI,QAAQ,IAAI,WAAW,CAE1B;CACF;AAED;;;;;;GAMG;AACH,wBAAgB,SAAS,CACvB,GAAG,EAAE,WAAW,EAChB,UAAU,EAAE,MAAM,EAClB,GAAG,EAAE,WAAW,GACf,WAAW,CAMb;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,WAAW,GAAG,WAAW,CAI5D"}
1
+ {"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../src/objc/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAE3C;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,WAAW,GAAG,WAAW,CAI5D"}
@@ -1,24 +1,3 @@
1
- export class NobjcInstanceWrapper {
2
- _instance;
3
- constructor(instance) {
4
- this._instance = instance;
5
- }
6
- get instance() {
7
- return this._instance;
8
- }
9
- }
10
- /**
11
- * Helper to allocate and initialize an Objective-C object with a single argument initializer
12
- * @param cls The Objective-C class
13
- * @param initMethod The initializer method name (e.g., "initWithRelyingPartyIdentifier:")
14
- * @param arg The argument to pass to the initializer
15
- * @returns The initialized instance
16
- */
17
- export function allocInit(cls, initMethod, arg) {
18
- const instance = cls["alloc"]();
19
- const initializer = instance[initMethod];
20
- return initializer(arg);
21
- }
22
1
  /**
23
2
  * Helper to allocate and initialize an Objective-C object with no arguments
24
3
  * @param cls The Objective-C class
@@ -1 +1 @@
1
- {"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../src/objc/helpers.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,oBAAoB;IACvB,SAAS,CAAc;IAE/B,YAAY,QAAqB;QAC/B,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;IAC5B,CAAC;IAED,IAAI,QAAQ;QACV,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;CACF;AAED;;;;;;GAMG;AACH,MAAM,UAAU,SAAS,CACvB,GAAgB,EAChB,UAAkB,EAClB,GAAgB;IAEhB,MAAM,QAAQ,GAAI,GAAG,CAAC,OAAO,CAAkC,EAAE,CAAC;IAClE,MAAM,WAAW,GAAG,QAAQ,CAAC,UAAU,CAEvB,CAAC;IACjB,OAAO,WAAW,CAAC,GAAG,CAAC,CAAC;AAC1B,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,cAAc,CAAC,GAAgB;IAC7C,MAAM,QAAQ,GAAI,GAAG,CAAC,OAAO,CAAkC,EAAE,CAAC;IAClE,MAAM,WAAW,GAAG,QAAQ,CAAC,MAAM,CAAiC,CAAC;IACrE,OAAO,WAAW,EAAE,CAAC;AACvB,CAAC"}
1
+ {"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../src/objc/helpers.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,MAAM,UAAU,cAAc,CAAC,GAAgB;IAC7C,MAAM,QAAQ,GAAI,GAAG,CAAC,OAAO,CAAkC,EAAE,CAAC;IAClE,MAAM,WAAW,GAAG,QAAQ,CAAC,MAAM,CAAiC,CAAC;IACrE,OAAO,WAAW,EAAE,CAAC;AACvB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "electron-webauthn",
3
- "version": "0.0.8",
3
+ "version": "0.0.10",
4
4
  "repository": "https://github.com/iamEvanYT/electron-webauthn",
5
5
  "description": "Add support for WebAuthn for Electron.",
6
6
  "main": "dist/index.js",
@@ -18,6 +18,7 @@
18
18
  ],
19
19
  "type": "module",
20
20
  "scripts": {
21
+ "build": "tsc",
21
22
  "test": "bun run src/test/index.ts"
22
23
  },
23
24
  "devDependencies": {
@@ -27,7 +28,7 @@
27
28
  "typescript": "^5"
28
29
  },
29
30
  "dependencies": {
30
- "objc-js": "^0.0.11"
31
+ "objc-js": "^0.0.13"
31
32
  },
32
33
  "trustedDependencies": [
33
34
  "objc-js"
package/dist/example.d.ts DELETED
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=example.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"example.d.ts","sourceRoot":"","sources":["../src/example.ts"],"names":[],"mappings":""}
package/dist/example.js DELETED
@@ -1,24 +0,0 @@
1
- import { NSData } from "./objc/foundation/nsdata.js";
2
- import { NSString } from "./objc/foundation/nsstring.js";
3
- import { NSArray } from "./objc/foundation/nsarray.js";
4
- const myString = NSString.stringWithUTF8String$("Hello from Objective-C!");
5
- console.log("Created NSString:", myString);
6
- const buf = Buffer.from("Hello from Objective-C!");
7
- const myData = NSData.dataWithBytes$length$(buf, buf.length);
8
- console.log("Created NSData:", myData);
9
- // Test NSArray
10
- const str1 = NSString.stringWithUTF8String$("First");
11
- const str2 = NSString.stringWithUTF8String$("Second");
12
- const str3 = NSString.stringWithUTF8String$("Third");
13
- // Create array with one object, then add more
14
- let myArray = NSArray.arrayWithObject$(str1);
15
- myArray = myArray.arrayByAddingObject$(str2);
16
- myArray = myArray.arrayByAddingObject$(str3);
17
- console.log("Created NSArray with count:", myArray.count());
18
- // Access elements
19
- for (let i = 0; i < myArray.count(); i++) {
20
- const obj = myArray.objectAtIndex$(i);
21
- const nsString = obj;
22
- console.log(`Array[${i}]:`, nsString.UTF8String());
23
- }
24
- //# sourceMappingURL=example.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"example.js","sourceRoot":"","sources":["../src/example.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,6BAA6B,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AACzD,OAAO,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAC;AAEvD,MAAM,QAAQ,GAAG,QAAQ,CAAC,qBAAqB,CAAC,yBAAyB,CAAC,CAAC;AAC3E,OAAO,CAAC,GAAG,CAAC,mBAAmB,EAAE,QAAQ,CAAC,CAAC;AAE3C,MAAM,GAAG,GAAG,MAAM,CAAC,IAAI,CAAC,yBAAyB,CAAC,CAAC;AACnD,MAAM,MAAM,GAAG,MAAM,CAAC,qBAAqB,CAAC,GAAG,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;AAC7D,OAAO,CAAC,GAAG,CAAC,iBAAiB,EAAE,MAAM,CAAC,CAAC;AAEvC,eAAe;AACf,MAAM,IAAI,GAAG,QAAQ,CAAC,qBAAqB,CAAC,OAAO,CAAC,CAAC;AACrD,MAAM,IAAI,GAAG,QAAQ,CAAC,qBAAqB,CAAC,QAAQ,CAAC,CAAC;AACtD,MAAM,IAAI,GAAG,QAAQ,CAAC,qBAAqB,CAAC,OAAO,CAAC,CAAC;AAErD,8CAA8C;AAC9C,IAAI,OAAO,GAAG,OAAO,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC;AAC7C,OAAO,GAAG,OAAO,CAAC,oBAAoB,CAAC,IAAI,CAAC,CAAC;AAC7C,OAAO,GAAG,OAAO,CAAC,oBAAoB,CAAC,IAAI,CAAC,CAAC;AAE7C,OAAO,CAAC,GAAG,CAAC,6BAA6B,EAAE,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC;AAE5D,kBAAkB;AAClB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC;IACzC,MAAM,GAAG,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC,CAAQ,CAAC;IAC7C,MAAM,QAAQ,GAAG,GAAkB,CAAC;IACpC,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,IAAI,EAAE,QAAQ,CAAC,UAAU,EAAE,CAAC,CAAC;AACrD,CAAC"}
package/dist/helper.js DELETED
@@ -1,23 +0,0 @@
1
- import { NobjcLibrary, NobjcObject } from "@iamevan/nobjc";
2
- // Load the Foundation framework
3
- export const foundation = new NobjcLibrary("/System/Library/Frameworks/Foundation.framework/Foundation");
4
- // Load the AuthenticationServices framework
5
- export const authServices = new NobjcLibrary("/System/Library/Frameworks/AuthenticationServices.framework/AuthenticationServices");
6
- // NSString helpers
7
- const NSString = foundation["NSString"];
8
- const _stringWithUTF8String = NSString["stringWithUTF8String:"];
9
- export function createNSString(str) {
10
- return _stringWithUTF8String(str);
11
- }
12
- // NSData helpers
13
- const NSData = foundation["NSData"];
14
- const _dataWithBytesLength = NSData["dataWithBytes:length:"];
15
- export function createNSData(buffer) {
16
- return _dataWithBytesLength(buffer, buffer.length);
17
- }
18
- // NSArray helpers
19
- const NSArray = foundation["NSArray"];
20
- const _arrayWithObject = NSArray["arrayWithObject:"];
21
- export function createNSArray(obj) {
22
- return _arrayWithObject(obj);
23
- }
@@ -1,28 +0,0 @@
1
- import { NobjcLibrary, NobjcObject } from "@iamevan/nobjc";
2
- import { allocInit, NobjcInstanceWrapper } from "./helpers.js";
3
- // Load the AuthenticationServices framework
4
- export const authServices = new NobjcLibrary("/System/Library/Frameworks/AuthenticationServices.framework/AuthenticationServices");
5
- // Wrapper for ASAuthorizationPlatformPublicKeyCredentialProvider
6
- const _ASAuthorizationPlatformPublicKeyCredentialProvider = authServices["ASAuthorizationPlatformPublicKeyCredentialProvider"];
7
- export class ASAuthorizationPlatformPublicKeyCredentialProvider extends NobjcInstanceWrapper {
8
- constructor(relyingPartyIdentifier) {
9
- const instance = allocInit(_ASAuthorizationPlatformPublicKeyCredentialProvider, "initWithRelyingPartyIdentifier:", relyingPartyIdentifier);
10
- super(instance);
11
- }
12
- createCredentialAssertionRequest(challenge) {
13
- const method = this.instance["createCredentialAssertionRequestWithChallenge:"];
14
- return method(challenge);
15
- }
16
- }
17
- // Wrapper for ASAuthorizationController
18
- const _ASAuthorizationController = authServices["ASAuthorizationController"];
19
- export class ASAuthorizationController extends NobjcInstanceWrapper {
20
- constructor(authorizationRequests) {
21
- const instance = allocInit(_ASAuthorizationController, "initWithAuthorizationRequests:", authorizationRequests);
22
- super(instance);
23
- }
24
- performRequests() {
25
- const method = this.instance["performRequests"];
26
- method();
27
- }
28
- }
@@ -1,142 +0,0 @@
1
- import { NSArray, NSData, NSString } from "./main";
2
- /**
3
- * Foundation Framework Helpers
4
- *
5
- * This module provides convenient helper functions for working with
6
- * Foundation framework objects in JavaScript/TypeScript.
7
- *
8
- * Key features:
9
- * - NSString: String conversion helpers
10
- * - NSData: Data conversion between Objective-C and JavaScript
11
- * - NSArray: Array creation and manipulation
12
- */
13
- /**
14
- * NSData to Buffer Conversion Methods
15
- *
16
- * Two methods are provided for converting NSData to JavaScript Buffers:
17
- *
18
- * 1. bufferFromNSData (base64): Uses base64 as an intermediate format.
19
- * - Most reliable and compatible
20
- * - Recommended for general use
21
- * - Slight overhead due to base64 encoding/decoding
22
- *
23
- * 2. bufferFromNSDataDirect (direct): Uses getBytes:length: for direct memory copy.
24
- * - More efficient for large data
25
- * - Direct memory access
26
- * - May have compatibility issues with some nobjc versions
27
- */
28
- /**
29
- * Convert NSData to a JavaScript Buffer using base64 encoding
30
- * This is the most reliable method for data conversion.
31
- * @param data The NSData object
32
- * @returns A Buffer containing the data
33
- */
34
- export function bufferFromNSData(data) {
35
- const nsData = data;
36
- const length = nsData.length();
37
- if (length === 0) {
38
- return Buffer.alloc(0);
39
- }
40
- // Use base64 encoding as a reliable bridge between NSData and JS Buffer
41
- const base64String = nsData.base64EncodedStringWithOptions$(0);
42
- const base64Str = base64String.UTF8String();
43
- return Buffer.from(base64Str, "base64");
44
- }
45
- /**
46
- * Convert NSData to a JavaScript Buffer using direct memory copy
47
- * This method uses getBytes:length: for direct memory access.
48
- * May be more efficient for large data, but requires proper buffer allocation.
49
- * @param data The NSData object
50
- * @returns A Buffer containing the data
51
- */
52
- export function bufferFromNSDataDirect(data) {
53
- const nsData = data;
54
- const length = nsData.length();
55
- if (length === 0) {
56
- return Buffer.alloc(0);
57
- }
58
- // Allocate a buffer and copy bytes directly
59
- const buffer = Buffer.alloc(length);
60
- nsData.getBytes$length$(buffer, length);
61
- return buffer;
62
- }
63
- /**
64
- * Convert NSData to a JavaScript Uint8Array
65
- * @param data The NSData object
66
- * @returns A Uint8Array containing the data
67
- */
68
- export function uint8ArrayFromNSData(data) {
69
- const buffer = bufferFromNSData(data);
70
- return new Uint8Array(buffer);
71
- }
72
- /**
73
- * Convert NSData to a base64 string
74
- * @param data The NSData object
75
- * @returns A base64-encoded string
76
- */
77
- export function base64FromNSData(data) {
78
- const nsData = data;
79
- const nsString = nsData.base64EncodedStringWithOptions$(0);
80
- return nsString.UTF8String();
81
- }
82
- /**
83
- * Create NSData from a base64 string
84
- * @param base64String The base64-encoded string
85
- * @returns An NSData object
86
- */
87
- export function NSDataFromBase64(base64String) {
88
- const nsString = NSString.stringWithUTF8String$(base64String);
89
- const nsData = NSData.alloc();
90
- return nsData.initWithBase64EncodedString$options$(nsString, 0);
91
- }
92
- /**
93
- * Get the length of NSData
94
- * @param data The NSData object
95
- * @returns The length in bytes
96
- */
97
- export function NSDataLength(data) {
98
- const nsData = data;
99
- return nsData.length();
100
- }
101
- /**
102
- * Create a copy of NSData
103
- * @param data The NSData object
104
- * @returns A new NSData object with copied data
105
- */
106
- export function NSDataCopy(data) {
107
- return NSData.dataWithData$(data);
108
- }
109
- /**
110
- * Compare two NSData objects for equality
111
- * @param data1 The first NSData object
112
- * @param data2 The second NSData object
113
- * @returns True if the data is equal
114
- */
115
- export function NSDataIsEqual(data1, data2) {
116
- const nsData1 = data1;
117
- return nsData1.isEqualToData$(data2);
118
- }
119
- /**
120
- * Extract a subrange of NSData
121
- * Note: This method may not work with all versions of nobjc due to NSRange struct limitations.
122
- * As an alternative, convert to Buffer, slice, and convert back.
123
- * @param data The NSData object
124
- * @param location The starting position
125
- * @param length The number of bytes to extract
126
- * @returns A new NSData object containing the subdata
127
- */
128
- export function NSDataSubdata(data, location, length) {
129
- // Workaround: Convert to buffer, slice, and convert back
130
- // This avoids the NSRange struct issue with nobjc
131
- const buffer = bufferFromNSData(data);
132
- const slicedBuffer = buffer.subarray(location, location + length);
133
- return NSDataFromBuffer(slicedBuffer);
134
- }
135
- // NSArray helpers
136
- export function NSArrayFromObjects(objects) {
137
- let array = NSArray.array();
138
- for (const obj of objects) {
139
- array = array.arrayByAddingObject$(obj);
140
- }
141
- return array;
142
- }
@@ -1,4 +0,0 @@
1
- import { NobjcLibrary, NobjcObject } from "@iamevan/nobjc";
2
- // Load the Foundation framework
3
- export const Foundation = new NobjcLibrary("/System/Library/Frameworks/Foundation.framework/Foundation");
4
- export const NSArray = Foundation.NSArray;
@@ -1,2 +0,0 @@
1
- import { Foundation } from ".";
2
- export const NSValue = Foundation.NSValue;
@@ -1,28 +0,0 @@
1
- import { NobjcLibrary, NobjcObject } from "@iamevan/nobjc";
2
- import { NobjcObjectWrapper } from "./helpers";
3
- // Load the Foundation framework
4
- export const foundation = new NobjcLibrary("/System/Library/Frameworks/Foundation.framework/Foundation");
5
- // NSString helpers
6
- const _NSString = foundation["NSString"];
7
- const _stringWithUTF8String = _NSString["stringWithUTF8String:"];
8
- export class NSString extends NobjcObjectWrapper {
9
- constructor(str) {
10
- super(_stringWithUTF8String(str));
11
- }
12
- }
13
- // NSData helpers
14
- const _NSData = foundation["NSData"];
15
- const _dataWithBytesLength = _NSData["dataWithBytes:length:"];
16
- export class NSData extends NobjcObjectWrapper {
17
- constructor(buffer) {
18
- super(_dataWithBytesLength(buffer, buffer.length));
19
- }
20
- }
21
- // NSArray helpers
22
- const _NSArray = foundation["NSArray"];
23
- const _arrayWithObject = _NSArray["arrayWithObject:"];
24
- export class NSArray extends NobjcObjectWrapper {
25
- constructor(obj) {
26
- super(_arrayWithObject(obj));
27
- }
28
- }
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=example.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"example.d.ts","sourceRoot":"","sources":["../../src/test/example.ts"],"names":[],"mappings":""}
@@ -1,24 +0,0 @@
1
- import { NSData } from "../objc/foundation/nsdata.js";
2
- import { NSString } from "../objc/foundation/nsstring.js";
3
- import { NSArray } from "../objc/foundation/nsarray.js";
4
- const myString = NSString.stringWithUTF8String$("Hello from Objective-C!");
5
- console.log("Created NSString:", myString);
6
- const buf = Buffer.from("Hello from Objective-C!");
7
- const myData = NSData.dataWithBytes$length$(buf, buf.length);
8
- console.log("Created NSData:", myData);
9
- // Test NSArray
10
- const str1 = NSString.stringWithUTF8String$("First");
11
- const str2 = NSString.stringWithUTF8String$("Second");
12
- const str3 = NSString.stringWithUTF8String$("Third");
13
- // Create array with one object, then add more
14
- let myArray = NSArray.arrayWithObject$(str1);
15
- myArray = myArray.arrayByAddingObject$(str2);
16
- myArray = myArray.arrayByAddingObject$(str3);
17
- console.log("Created NSArray with count:", myArray.count());
18
- // Access elements
19
- for (let i = 0; i < myArray.count(); i++) {
20
- const obj = myArray.objectAtIndex$(i);
21
- const nsString = obj;
22
- console.log(`Array[${i}]:`, nsString.UTF8String());
23
- }
24
- //# sourceMappingURL=example.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"example.js","sourceRoot":"","sources":["../../src/test/example.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAC;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,gCAAgC,CAAC;AAC1D,OAAO,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AAExD,MAAM,QAAQ,GAAG,QAAQ,CAAC,qBAAqB,CAAC,yBAAyB,CAAC,CAAC;AAC3E,OAAO,CAAC,GAAG,CAAC,mBAAmB,EAAE,QAAQ,CAAC,CAAC;AAE3C,MAAM,GAAG,GAAG,MAAM,CAAC,IAAI,CAAC,yBAAyB,CAAC,CAAC;AACnD,MAAM,MAAM,GAAG,MAAM,CAAC,qBAAqB,CAAC,GAAG,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;AAC7D,OAAO,CAAC,GAAG,CAAC,iBAAiB,EAAE,MAAM,CAAC,CAAC;AAEvC,eAAe;AACf,MAAM,IAAI,GAAG,QAAQ,CAAC,qBAAqB,CAAC,OAAO,CAAC,CAAC;AACrD,MAAM,IAAI,GAAG,QAAQ,CAAC,qBAAqB,CAAC,QAAQ,CAAC,CAAC;AACtD,MAAM,IAAI,GAAG,QAAQ,CAAC,qBAAqB,CAAC,OAAO,CAAC,CAAC;AAErD,8CAA8C;AAC9C,IAAI,OAAO,GAAG,OAAO,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC;AAC7C,OAAO,GAAG,OAAO,CAAC,oBAAoB,CAAC,IAAI,CAAC,CAAC;AAC7C,OAAO,GAAG,OAAO,CAAC,oBAAoB,CAAC,IAAI,CAAC,CAAC;AAE7C,OAAO,CAAC,GAAG,CAAC,6BAA6B,EAAE,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC;AAE5D,kBAAkB;AAClB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC;IACzC,MAAM,GAAG,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC,CAAQ,CAAC;IAC7C,MAAM,QAAQ,GAAG,GAAkB,CAAC;IACpC,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,IAAI,EAAE,QAAQ,CAAC,UAAU,EAAE,CAAC,CAAC;AACrD,CAAC"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/test/index.ts"],"names":[],"mappings":""}
@@ -1,9 +0,0 @@
1
- import { getPointer } from "objc-js";
2
- import { createEmptyWindow, getNativeWindowHandle } from "./window.js";
3
- import { getCredential } from "../index.js";
4
- const window = createEmptyWindow();
5
- const nsView = getNativeWindowHandle(window);
6
- const nsViewPointer = getPointer(nsView);
7
- const result = getCredential("example.com", Buffer.from("challenge"), nsViewPointer);
8
- console.log(result);
9
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/test/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AACvE,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C,MAAM,MAAM,GAAG,iBAAiB,EAAE,CAAC;AACnC,MAAM,MAAM,GAAG,qBAAqB,CAAC,MAAM,CAAC,CAAC;AAC7C,MAAM,aAAa,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC;AAEzC,MAAM,MAAM,GAAG,aAAa,CAC1B,aAAa,EACb,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,EACxB,aAAa,CACd,CAAC;AACF,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC"}
@@ -1,5 +0,0 @@
1
- import { type NobjcObject } from "objc-js";
2
- declare function createEmptyWindow(): NobjcObject;
3
- declare function getNativeWindowHandle(window: NobjcObject): NobjcObject;
4
- export { createEmptyWindow, getNativeWindowHandle };
5
- //# sourceMappingURL=window.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"window.d.ts","sourceRoot":"","sources":["../../src/test/window.ts"],"names":[],"mappings":"AAAA,OAAO,EAA+B,KAAK,WAAW,EAAE,MAAM,SAAS,CAAC;AAWxE,iBAAS,iBAAiB,IAAI,WAAW,CAmDxC;AAED,iBAAS,qBAAqB,CAAC,MAAM,EAAE,WAAW,GAAG,WAAW,CAG/D;AAED,OAAO,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,CAAC"}
@@ -1,58 +0,0 @@
1
- import { NobjcLibrary, NobjcProtocol } from "objc-js";
2
- import { allocInitPlain } from "../objc/helpers.js";
3
- import { NSStringFromString } from "../objc/foundation/nsstring.js";
4
- const AppKit = new NobjcLibrary("/System/Library/Frameworks/AppKit.framework/AppKit");
5
- const Foundation = new NobjcLibrary("/System/Library/Frameworks/Foundation.framework/Foundation");
6
- function createEmptyWindow() {
7
- const NSApp = AppKit.NSApplication.sharedApplication();
8
- const window = allocInitPlain(AppKit.NSWindow);
9
- const styleMask = (1 << 0) | (1 << 1) | (1 << 2) | (1 << 3); // titled, closable, miniaturizable, resizable
10
- // Make the app active and show the window.
11
- window.setStyleMask$(styleMask);
12
- window.setFrameFromString$(NSStringFromString("{{100, 100}, {800, 600}}"));
13
- NSApp.setActivationPolicy$(0);
14
- NSApp.finishLaunching();
15
- NSApp.activateIgnoringOtherApps$(true);
16
- window.setIsVisible$(true);
17
- window.makeKeyWindow();
18
- window.orderFrontRegardless();
19
- const delegate = NobjcProtocol.implement("NSWindowDelegate", {
20
- windowShouldClose$: () => {
21
- NSApp.terminate$(NSApp);
22
- return true;
23
- },
24
- windowWillClose$: () => {
25
- NSApp.terminate$(NSApp);
26
- },
27
- });
28
- window.setDelegate$(delegate);
29
- const shutdown = () => {
30
- try {
31
- window.close();
32
- }
33
- finally {
34
- NSApp.stop$(NSApp);
35
- NSApp.terminate$(NSApp);
36
- }
37
- };
38
- const handleSignal = () => shutdown();
39
- process.once("exit", shutdown);
40
- process.once("SIGINT", handleSignal);
41
- process.once("SIGTERM", handleSignal);
42
- process.once("SIGQUIT", handleSignal);
43
- // Pump the AppKit run loop for a short tick to keep JS responsive.
44
- const runLoop = Foundation.NSRunLoop.currentRunLoop();
45
- const pump = () => {
46
- const untilDate = Foundation.NSDate.dateWithTimeIntervalSinceNow$(0.01);
47
- runLoop.runUntilDate$(untilDate);
48
- };
49
- const pumpId = setInterval(pump, 10);
50
- process.once("exit", () => clearInterval(pumpId));
51
- return window;
52
- }
53
- function getNativeWindowHandle(window) {
54
- // Electron expects an NSView* on macOS; contentView returns that NSView.
55
- return window.contentView();
56
- }
57
- export { createEmptyWindow, getNativeWindowHandle };
58
- //# sourceMappingURL=window.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"window.js","sourceRoot":"","sources":["../../src/test/window.ts"],"names":[],"mappings":"AA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CAAC;AAC7C,CAAC;AAED,OAAO,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,CAAC"}
package/dist/window.d.ts DELETED
@@ -1,5 +0,0 @@
1
- import { type NobjcObject } from "objc-js";
2
- declare function createEmptyWindow(): NobjcObject;
3
- declare function getNativeWindowHandle(window: NobjcObject): NobjcObject;
4
- export { createEmptyWindow, getNativeWindowHandle };
5
- //# sourceMappingURL=window.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"window.d.ts","sourceRoot":"","sources":["../src/window.ts"],"names":[],"mappings":"AAAA,OAAO,EAA+B,KAAK,WAAW,EAAE,MAAM,SAAS,CAAC;AAWxE,iBAAS,iBAAiB,IAAI,WAAW,CAmDxC;AAED,iBAAS,qBAAqB,CAAC,MAAM,EAAE,WAAW,GAAG,WAAW,CAG/D;AAED,OAAO,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,CAAC"}
package/dist/window.js DELETED
@@ -1,58 +0,0 @@
1
- import { NobjcLibrary, NobjcProtocol } from "objc-js";
2
- import { allocInitPlain } from "./objc/helpers.js";
3
- import { NSStringFromString } from "./objc/foundation/nsstring.js";
4
- const AppKit = new NobjcLibrary("/System/Library/Frameworks/AppKit.framework/AppKit");
5
- const Foundation = new NobjcLibrary("/System/Library/Frameworks/Foundation.framework/Foundation");
6
- function createEmptyWindow() {
7
- const NSApp = AppKit.NSApplication.sharedApplication();
8
- const window = allocInitPlain(AppKit.NSWindow);
9
- const styleMask = (1 << 0) | (1 << 1) | (1 << 2) | (1 << 3); // titled, closable, miniaturizable, resizable
10
- // Make the app active and show the window.
11
- window.setStyleMask$(styleMask);
12
- window.setFrameFromString$(NSStringFromString("{{100, 100}, {800, 600}}"));
13
- NSApp.setActivationPolicy$(0);
14
- NSApp.finishLaunching();
15
- NSApp.activateIgnoringOtherApps$(true);
16
- window.setIsVisible$(true);
17
- window.makeKeyWindow();
18
- window.orderFrontRegardless();
19
- const delegate = NobjcProtocol.implement("NSWindowDelegate", {
20
- windowShouldClose$: () => {
21
- NSApp.terminate$(NSApp);
22
- return true;
23
- },
24
- windowWillClose$: () => {
25
- NSApp.terminate$(NSApp);
26
- },
27
- });
28
- window.setDelegate$(delegate);
29
- const shutdown = () => {
30
- try {
31
- window.close();
32
- }
33
- finally {
34
- NSApp.stop$(NSApp);
35
- NSApp.terminate$(NSApp);
36
- }
37
- };
38
- const handleSignal = () => shutdown();
39
- process.once("exit", shutdown);
40
- process.once("SIGINT", handleSignal);
41
- process.once("SIGTERM", handleSignal);
42
- process.once("SIGQUIT", handleSignal);
43
- // Pump the AppKit run loop for a short tick to keep JS responsive.
44
- const runLoop = Foundation.NSRunLoop.currentRunLoop();
45
- const pump = () => {
46
- const untilDate = Foundation.NSDate.dateWithTimeIntervalSinceNow$(0.01);
47
- runLoop.runUntilDate$(untilDate);
48
- };
49
- const pumpId = setInterval(pump, 10);
50
- process.once("exit", () => clearInterval(pumpId));
51
- return window;
52
- }
53
- function getNativeWindowHandle(window) {
54
- // Electron expects an NSView* on macOS; contentView returns that NSView.
55
- return window.contentView();
56
- }
57
- export { createEmptyWindow, getNativeWindowHandle };
58
- //# sourceMappingURL=window.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"window.js","sourceRoot":"","sources":["../src/window.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,aAAa,EAAoB,MAAM,SAAS,CAAC;AACxE,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAEnE,MAAM,MAAM,GAAG,IAAI,YAAY,CAC7B,oDAAoD,CACrD,CAAC;AACF,MAAM,UAAU,GAAG,IAAI,YAAY,CACjC,4DAA4D,CAC7D,CAAC;AAEF,SAAS,iBAAiB;IACxB,MAAM,KAAK,GAAG,MAAM,CAAC,aAAc,CAAC,iBAAiB,EAAG,CAAC;IACzD,MAAM,MAAM,GAAG,cAAc,CAAC,MAAM,CAAC,QAAS,CAAC,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