electron-webauthn 0.0.5 → 0.0.7
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 +6 -257
- package/dist/example.d.ts +2 -0
- package/dist/example.d.ts.map +1 -0
- package/dist/example.js +24 -0
- package/dist/example.js.map +1 -0
- package/dist/helper.js +23 -0
- package/dist/index.d.ts +12 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +46 -8
- package/dist/index.js.map +1 -1
- package/dist/objc/auth-services.js +28 -0
- package/dist/objc/authentication-services/as-authorization-controller-delegate.d.ts +53 -0
- package/dist/objc/authentication-services/as-authorization-controller-delegate.d.ts.map +1 -0
- package/dist/objc/authentication-services/as-authorization-controller-delegate.js +41 -0
- package/dist/objc/authentication-services/as-authorization-controller-delegate.js.map +1 -0
- package/dist/objc/authentication-services/as-authorization-controller-presentation-context-providing.d.ts +42 -0
- package/dist/objc/authentication-services/as-authorization-controller-presentation-context-providing.d.ts.map +1 -0
- package/dist/objc/authentication-services/as-authorization-controller-presentation-context-providing.js +32 -0
- package/dist/objc/authentication-services/as-authorization-controller-presentation-context-providing.js.map +1 -0
- package/dist/objc/authentication-services/as-authorization-controller.d.ts +28 -0
- package/dist/objc/authentication-services/as-authorization-controller.d.ts.map +1 -0
- package/dist/objc/authentication-services/as-authorization-controller.js +13 -0
- package/dist/objc/authentication-services/as-authorization-controller.js.map +1 -0
- package/dist/objc/authentication-services/as-authorization-platform-public-key-credential-provider.d.ts +22 -0
- package/dist/objc/authentication-services/as-authorization-platform-public-key-credential-provider.d.ts.map +1 -0
- package/dist/objc/authentication-services/as-authorization-platform-public-key-credential-provider.js +13 -0
- package/dist/objc/authentication-services/as-authorization-platform-public-key-credential-provider.js.map +1 -0
- package/dist/objc/authentication-services/index.d.ts +3 -0
- package/dist/objc/authentication-services/index.d.ts.map +1 -0
- package/dist/objc/authentication-services/index.js +4 -0
- package/dist/objc/authentication-services/index.js.map +1 -0
- package/dist/objc/foundation/helpers.js +142 -0
- package/dist/objc/foundation/index.d.ts +3 -0
- package/dist/objc/foundation/index.d.ts.map +1 -0
- package/dist/objc/foundation/index.js +4 -0
- package/dist/objc/foundation/index.js.map +1 -0
- package/dist/objc/foundation/main.js +4 -0
- package/dist/objc/foundation/nsarray.d.ts +18 -0
- package/dist/objc/foundation/nsarray.d.ts.map +1 -0
- package/dist/objc/foundation/nsarray.js +16 -0
- package/dist/objc/foundation/nsarray.js.map +1 -0
- package/dist/objc/foundation/nsdata.d.ts +109 -0
- package/dist/objc/foundation/nsdata.d.ts.map +1 -0
- package/dist/objc/foundation/nsdata.js +120 -0
- package/dist/objc/foundation/nsdata.js.map +1 -0
- package/dist/objc/foundation/nserror.d.ts +32 -0
- package/dist/objc/foundation/nserror.d.ts.map +1 -0
- package/dist/objc/foundation/nserror.js +71 -0
- package/dist/objc/foundation/nserror.js.map +1 -0
- package/dist/objc/foundation/nsstring.d.ts +15 -0
- package/dist/objc/foundation/nsstring.d.ts.map +1 -0
- package/dist/objc/foundation/nsstring.js +12 -0
- package/dist/objc/foundation/nsstring.js.map +1 -0
- package/dist/objc/foundation/nsvalue.js +2 -0
- package/dist/objc/foundation/nsview.d.ts +7 -0
- package/dist/objc/foundation/nsview.d.ts.map +1 -0
- package/dist/objc/foundation/nsview.js +3 -0
- package/dist/objc/foundation/nsview.js.map +1 -0
- package/dist/objc/foundation/nswindow.d.ts +5 -0
- package/dist/objc/foundation/nswindow.d.ts.map +1 -0
- package/dist/objc/foundation/nswindow.js +3 -0
- package/dist/objc/foundation/nswindow.js.map +1 -0
- package/dist/objc/foundation.js +28 -0
- package/dist/objc/helpers.d.ts +21 -0
- package/dist/objc/helpers.d.ts.map +1 -0
- package/dist/objc/helpers.js +32 -0
- package/dist/objc/helpers.js.map +1 -0
- package/dist/test/example.d.ts +2 -0
- package/dist/test/example.d.ts.map +1 -0
- package/dist/test/example.js +24 -0
- package/dist/test/example.js.map +1 -0
- package/dist/test/index.d.ts +2 -0
- package/dist/test/index.d.ts.map +1 -0
- package/dist/test/index.js +9 -0
- package/dist/test/index.js.map +1 -0
- package/dist/test/window.d.ts +5 -0
- package/dist/test/window.d.ts.map +1 -0
- package/dist/test/window.js +58 -0
- package/dist/test/window.js.map +1 -0
- package/dist/window.d.ts +5 -0
- package/dist/window.d.ts.map +1 -0
- package/dist/window.js +58 -0
- package/dist/window.js.map +1 -0
- package/package.json +23 -41
- package/LICENSE +0 -21
- package/index.d.ts +0 -68
- package/index.js +0 -316
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { Foundation } from "./index.js";
|
|
2
|
+
import {} from "./nsstring.js";
|
|
3
|
+
export const NSError = Foundation.NSError;
|
|
4
|
+
/**
|
|
5
|
+
* Parse an NSError object into a JavaScript-friendly format
|
|
6
|
+
* @param error The NSError object
|
|
7
|
+
* @returns An object containing the error details
|
|
8
|
+
*/
|
|
9
|
+
export function parseNSError(error) {
|
|
10
|
+
const nsError = error;
|
|
11
|
+
const domain = nsError.domain().UTF8String();
|
|
12
|
+
const code = nsError.code();
|
|
13
|
+
const localizedDescription = nsError.localizedDescription().UTF8String();
|
|
14
|
+
// Optional properties that may be null
|
|
15
|
+
let localizedFailureReason;
|
|
16
|
+
try {
|
|
17
|
+
const reason = nsError.localizedFailureReason();
|
|
18
|
+
if (reason) {
|
|
19
|
+
localizedFailureReason = reason.UTF8String();
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
catch (e) {
|
|
23
|
+
// Property may not exist or be null
|
|
24
|
+
}
|
|
25
|
+
let localizedRecoverySuggestion;
|
|
26
|
+
try {
|
|
27
|
+
const suggestion = nsError.localizedRecoverySuggestion();
|
|
28
|
+
if (suggestion) {
|
|
29
|
+
localizedRecoverySuggestion = suggestion.UTF8String();
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
catch (e) {
|
|
33
|
+
// Property may not exist or be null
|
|
34
|
+
}
|
|
35
|
+
// userInfo is a dictionary - basic parsing
|
|
36
|
+
let userInfo;
|
|
37
|
+
try {
|
|
38
|
+
const userInfoDict = nsError.userInfo();
|
|
39
|
+
if (userInfoDict) {
|
|
40
|
+
// For now, just get the description
|
|
41
|
+
// Full dictionary parsing would require NSDictionary wrapper
|
|
42
|
+
userInfo = {
|
|
43
|
+
description: userInfoDict.description().UTF8String(),
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
catch (e) {
|
|
48
|
+
// userInfo may not be accessible
|
|
49
|
+
}
|
|
50
|
+
return {
|
|
51
|
+
domain,
|
|
52
|
+
code,
|
|
53
|
+
localizedDescription,
|
|
54
|
+
...(localizedFailureReason && { localizedFailureReason }),
|
|
55
|
+
...(localizedRecoverySuggestion && { localizedRecoverySuggestion }),
|
|
56
|
+
...(userInfo && { userInfo }),
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Convert an NSError to a JavaScript Error object
|
|
61
|
+
* @param error The NSError object
|
|
62
|
+
* @returns A JavaScript Error with NSError details
|
|
63
|
+
*/
|
|
64
|
+
export function nsErrorToJSError(error) {
|
|
65
|
+
const parsed = parseNSError(error);
|
|
66
|
+
const jsError = new Error(parsed.localizedDescription);
|
|
67
|
+
jsError.name = `${parsed.domain} (${parsed.code})`;
|
|
68
|
+
jsError.nsError = parsed;
|
|
69
|
+
return jsError;
|
|
70
|
+
}
|
|
71
|
+
//# sourceMappingURL=nserror.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nserror.js","sourceRoot":"","sources":["../../../src/objc/foundation/nserror.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAExC,OAAO,EAAkB,MAAM,eAAe,CAAC;AAc/C,MAAM,CAAC,MAAM,OAAO,GAAG,UAAU,CAAC,OAAqC,CAAC;AAExE;;;;GAIG;AACH,MAAM,UAAU,YAAY,CAAC,KAAkB;IAQ7C,MAAM,OAAO,GAAG,KAA4C,CAAC;IAE7D,MAA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CAAC;QACnE,GAAG,CAAC,QAAQ,IAAI,EAAE,QAAQ,EAAE,CAAC;KAC9B,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,gBAAgB,CAAC,KAAkB;IACjD,MAAM,MAAM,GAAG,YAAY,CAAC,KAAK,CAAC,CAAC;IACnC,MAAM,OAAO,GAAG,IAAI,KAAK,CAAC,MAAM,CAAC,oBAAoB,CAAC,CAAC;IACvD,OAAO,CAAC,IAAI,GAAG,GAAG,MAAM,CAAC,MAAM,KAAK,MAAM,CAAC,IAAI,GAAG,CAAC;IAClD,OAAe,CAAC,OAAO,GAAG,MAAM,CAAC;IAClC,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { NobjcObject } from "objc-js";
|
|
2
|
+
export declare class _NSString extends NobjcObject {
|
|
3
|
+
static stringWithUTF8String$(str: string): _NSString;
|
|
4
|
+
UTF8String(): string;
|
|
5
|
+
length(): number;
|
|
6
|
+
toString(): string;
|
|
7
|
+
}
|
|
8
|
+
export declare const NSString: typeof _NSString;
|
|
9
|
+
/**
|
|
10
|
+
* Create NSString from a JavaScript string
|
|
11
|
+
* @param str The string object
|
|
12
|
+
* @returns An NSString object
|
|
13
|
+
*/
|
|
14
|
+
export declare function NSStringFromString(str: string): _NSString;
|
|
15
|
+
//# sourceMappingURL=nsstring.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nsstring.d.ts","sourceRoot":"","sources":["../../../src/objc/foundation/nsstring.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAG3C,MAAM,CAAC,OAAO,OAAO,SAAU,SAAQ,WAAW;IAChD,MAAM,CAAC,qBAAqB,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS;IACpD,UAAU,IAAI,MAAM;IACpB,MAAM,IAAI,MAAM;IAChB,QAAQ,IAAI,MAAM;CACnB;AACD,eAAO,MAAM,QAAQ,EAAqC,OAAO,SAAS,CAAC;AAI3E;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,CAEzD"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Foundation } from "./index.js";
|
|
2
|
+
export const NSString = Foundation.NSString;
|
|
3
|
+
// Helper Functions
|
|
4
|
+
/**
|
|
5
|
+
* Create NSString from a JavaScript string
|
|
6
|
+
* @param str The string object
|
|
7
|
+
* @returns An NSString object
|
|
8
|
+
*/
|
|
9
|
+
export function NSStringFromString(str) {
|
|
10
|
+
return NSString.stringWithUTF8String$(str);
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=nsstring.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nsstring.js","sourceRoot":"","sources":["../../../src/objc/foundation/nsstring.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAUxC,MAAM,CAAC,MAAM,QAAQ,GAAG,UAAU,CAAC,QAAuC,CAAC;AAE3E,mBAAmB;AAEnB;;;;GAIG;AACH,MAAM,UAAU,kBAAkB,CAAC,GAAW;IAC5C,OAAO,QAAQ,CAAC,qBAAqB,CAAC,GAAG,CAAC,CAAC;AAC7C,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nsview.d.ts","sourceRoot":"","sources":["../../../src/objc/foundation/nsview.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAC3C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAG/C,MAAM,CAAC,OAAO,OAAO,OAAQ,SAAQ,WAAW;IAC9C,MAAM,IAAI,SAAS;CACpB;AACD,eAAO,MAAM,MAAM,EAAmC,OAAO,OAAO,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nsview.js","sourceRoot":"","sources":["../../../src/objc/foundation/nsview.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAQxC,MAAM,CAAC,MAAM,MAAM,GAAG,UAAU,CAAC,MAAmC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nswindow.d.ts","sourceRoot":"","sources":["../../../src/objc/foundation/nswindow.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAG3C,MAAM,CAAC,OAAO,OAAO,SAAU,SAAQ,WAAW;CAAG;AACrD,eAAO,MAAM,QAAQ,EAAqC,OAAO,SAAS,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nswindow.js","sourceRoot":"","sources":["../../../src/objc/foundation/nswindow.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAKxC,MAAM,CAAC,MAAM,QAAQ,GAAG,UAAU,CAAC,QAAuC,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
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
|
+
/**
|
|
16
|
+
* Helper to allocate and initialize an Objective-C object with no arguments
|
|
17
|
+
* @param cls The Objective-C class
|
|
18
|
+
* @returns The initialized instance
|
|
19
|
+
*/
|
|
20
|
+
export declare function allocInitPlain(cls: NobjcObject): NobjcObject;
|
|
21
|
+
//# sourceMappingURL=helpers.d.ts.map
|
|
@@ -0,0 +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"}
|
|
@@ -0,0 +1,32 @@
|
|
|
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
|
+
/**
|
|
23
|
+
* Helper to allocate and initialize an Objective-C object with no arguments
|
|
24
|
+
* @param cls The Objective-C class
|
|
25
|
+
* @returns The initialized instance
|
|
26
|
+
*/
|
|
27
|
+
export function allocInitPlain(cls) {
|
|
28
|
+
const instance = cls["alloc"]();
|
|
29
|
+
const initializer = instance["init"];
|
|
30
|
+
return initializer();
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=helpers.js.map
|
|
@@ -0,0 +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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"example.d.ts","sourceRoot":"","sources":["../../src/test/example.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,24 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/test/index.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,9 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,58 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"window.js","sourceRoot":"","sources":["../../src/test/window.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,aAAa,EAAoB,MAAM,SAAS,CAAC;AACxE,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAEpE,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,CAAC;IAChD,MAAM,SAAS,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,8CAA8C;IAE3G,2CAA2C;IAC3C,MAAM,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC;IAChC,MAAM,CAAC,mBAAmB,CAAC,kBAAkB,CAAC,0BAA0B,CAAC,CAAC,CAAC;IAC3E,KAAK,CAAC,oBAAoB,CAAC,CAAC,CAAC,CAAC;IAC9B,KAAK,CAAC,eAAe,EAAE,CAAC;IACxB,KAAK,CAAC,0BAA0B,CAAC,IAAI,CAAC,CAAC;IACvC,MAAM,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;IAC3B,MAAM,CAAC,aAAa,EAAE,CAAC;IACvB,MAAM,CAAC,oBAAoB,EAAE,CAAC;I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C,IAAI,CAAC,MAAM,EAAE,GAAG,EAAE,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC;IAElD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,SAAS,qBAAqB,CAAC,MAAmB;IAChD,yEAAyE;IACzE,OAAO,MAAM,CAAC,WAAW,EAAiB,CAAC;AAC7C,CAAC;AAED,OAAO,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,CAAC"}
|
package/dist/window.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
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
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
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
|
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ElD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,SAAS,qBAAqB,CAAC,MAAmB;IAChD,yEAAyE;IACzE,OAAO,MAAM,CAAC,WAAW,EAAiB,CAAC;AAC7C,CAAC;AAED,OAAO,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,53 +1,35 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "electron-webauthn",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.7",
|
|
4
|
+
"repository": "https://github.com/iamEvanYT/electron-webauthn",
|
|
5
|
+
"description": "Add support for WebAuthn for Electron.",
|
|
4
6
|
"main": "dist/index.js",
|
|
7
|
+
"module": "dist/index.js",
|
|
5
8
|
"types": "dist/index.d.ts",
|
|
6
|
-
"
|
|
7
|
-
"
|
|
8
|
-
|
|
9
|
-
"
|
|
10
|
-
|
|
11
|
-
"aarch64-pc-windows-msvc"
|
|
12
|
-
]
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"import": "./dist/index.js",
|
|
12
|
+
"require": "./dist/index.js",
|
|
13
|
+
"types": "./dist/index.d.ts"
|
|
13
14
|
}
|
|
14
15
|
},
|
|
15
|
-
"license": "MIT",
|
|
16
16
|
"files": [
|
|
17
|
-
"dist"
|
|
18
|
-
"index.d.ts",
|
|
19
|
-
"index.js"
|
|
17
|
+
"dist/"
|
|
20
18
|
],
|
|
21
|
-
"
|
|
22
|
-
|
|
23
|
-
"
|
|
24
|
-
"typescript": "^5.8.3"
|
|
19
|
+
"type": "module",
|
|
20
|
+
"scripts": {
|
|
21
|
+
"test": "bun run src/test/index.ts"
|
|
25
22
|
},
|
|
26
|
-
"
|
|
27
|
-
"
|
|
23
|
+
"devDependencies": {
|
|
24
|
+
"@types/bun": "latest"
|
|
28
25
|
},
|
|
29
|
-
"
|
|
30
|
-
"
|
|
26
|
+
"peerDependencies": {
|
|
27
|
+
"typescript": "^5"
|
|
31
28
|
},
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
"build": "yarn run build:ts && yarn run build:rust",
|
|
35
|
-
"build:ts": "tsc",
|
|
36
|
-
"build:rust": "napi build --platform --release",
|
|
37
|
-
"build:debug": "napi build --platform",
|
|
38
|
-
"prepublishOnly": "napi prepublish -t npm",
|
|
39
|
-
"test": "ava",
|
|
40
|
-
"universal": "napi universal",
|
|
41
|
-
"version": "napi version"
|
|
29
|
+
"dependencies": {
|
|
30
|
+
"objc-js": "^0.0.10"
|
|
42
31
|
},
|
|
43
|
-
"
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
"electron-webauthn-win32-x64-msvc": "0.0.5",
|
|
48
|
-
"electron-webauthn-darwin-x64": "0.0.5",
|
|
49
|
-
"electron-webauthn-linux-x64-gnu": "0.0.5",
|
|
50
|
-
"electron-webauthn-darwin-arm64": "0.0.5",
|
|
51
|
-
"electron-webauthn-win32-arm64-msvc": "0.0.5"
|
|
52
|
-
}
|
|
53
|
-
}
|
|
32
|
+
"trustedDependencies": [
|
|
33
|
+
"objc-js"
|
|
34
|
+
]
|
|
35
|
+
}
|
package/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2025 Evan
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
package/index.d.ts
DELETED
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
/* tslint:disable */
|
|
2
|
-
/* eslint-disable */
|
|
3
|
-
|
|
4
|
-
/* auto-generated by NAPI-RS */
|
|
5
|
-
|
|
6
|
-
export interface PublicKeyCredentialRpEntity {
|
|
7
|
-
id?: string | undefined
|
|
8
|
-
name: string
|
|
9
|
-
}
|
|
10
|
-
export interface PublicKeyCredentialUserEntity {
|
|
11
|
-
id: Buffer
|
|
12
|
-
name: string
|
|
13
|
-
displayName: string
|
|
14
|
-
}
|
|
15
|
-
export interface PublicKeyCredentialParameters {
|
|
16
|
-
type: string
|
|
17
|
-
alg: number
|
|
18
|
-
}
|
|
19
|
-
export interface AuthenticatorSelectionCriteria {
|
|
20
|
-
authenticatorAttachment?: string | undefined
|
|
21
|
-
requireResidentKey?: boolean | undefined
|
|
22
|
-
residentKey?: string | undefined
|
|
23
|
-
userVerification?: string | undefined
|
|
24
|
-
}
|
|
25
|
-
export interface PublicKeyCredentialDescriptor {
|
|
26
|
-
type: string
|
|
27
|
-
id: Buffer
|
|
28
|
-
transports?: Array<string> | undefined
|
|
29
|
-
}
|
|
30
|
-
export interface PublicKeyCredentialCreationOptions {
|
|
31
|
-
rp: PublicKeyCredentialRpEntity
|
|
32
|
-
user: PublicKeyCredentialUserEntity
|
|
33
|
-
challenge: Buffer
|
|
34
|
-
pubKeyCredParams: Array<PublicKeyCredentialParameters>
|
|
35
|
-
timeout?: number | undefined
|
|
36
|
-
excludeCredentials?: Array<PublicKeyCredentialDescriptor> | undefined
|
|
37
|
-
authenticatorSelection?: AuthenticatorSelectionCriteria | undefined
|
|
38
|
-
attestation?: string | undefined
|
|
39
|
-
}
|
|
40
|
-
export interface PublicKeyCredentialRequestOptions {
|
|
41
|
-
challenge: Buffer
|
|
42
|
-
timeout?: number | undefined
|
|
43
|
-
rpId?: string | undefined
|
|
44
|
-
allowCredentials?: Array<PublicKeyCredentialDescriptor> | undefined
|
|
45
|
-
userVerification?: string | undefined
|
|
46
|
-
}
|
|
47
|
-
export interface AuthenticatorAttestationResponse {
|
|
48
|
-
clientDataJson: Buffer
|
|
49
|
-
attestationObject: Buffer
|
|
50
|
-
transports: Array<string>
|
|
51
|
-
}
|
|
52
|
-
export interface AuthenticatorAssertionResponse {
|
|
53
|
-
clientDataJson: Buffer
|
|
54
|
-
authenticatorData: Buffer
|
|
55
|
-
signature: Buffer
|
|
56
|
-
userHandle?: Buffer | undefined
|
|
57
|
-
}
|
|
58
|
-
export interface PublicKeyCredential {
|
|
59
|
-
id: string
|
|
60
|
-
rawId: Buffer
|
|
61
|
-
response: AuthenticatorAttestationResponse | AuthenticatorAssertionResponse
|
|
62
|
-
authenticatorAttachment?: string | undefined
|
|
63
|
-
type: string
|
|
64
|
-
}
|
|
65
|
-
/** Create a new WebAuthn credential */
|
|
66
|
-
export declare function create(options: PublicKeyCredentialCreationOptions): PublicKeyCredential
|
|
67
|
-
/** Get/authenticate with an existing WebAuthn credential */
|
|
68
|
-
export declare function get(options: PublicKeyCredentialRequestOptions): PublicKeyCredential
|