1 module libwasm.bindings.CredentialManagement;
2 
3 import libwasm.types;
4 
5 import memutils.ct: tuple;
6 import libwasm.bindings.AbortSignal;
7 import libwasm.bindings.WebAuthentication;
8 
9 @safe:
10 nothrow:
11 
12 struct Credential {
13   nothrow:
14   JsHandle handle;
15   alias handle this;
16   this(Handle h) {
17     this.handle = JsHandle(h);
18   }
19   string id()() {
20     return Object_Getter__string(this.handle, "id");
21   }
22   string type()() {
23     return Object_Getter__string(this.handle, "type");
24   }
25 }
26 struct CredentialCreationOptions {
27   nothrow:
28   JsHandle handle;
29   alias handle this;
30   this(Handle h) {
31     this.handle = JsHandle(h);
32   }
33   static auto create() {
34     return CredentialCreationOptions(libwasm_add__object());
35   }
36   void publicKey()(scope ref PublicKeyCredentialCreationOptions publicKey) {
37     Object_Call_Handle__void(this.handle, "publicKey", publicKey.handle);
38   }
39   auto publicKey()() {
40     return PublicKeyCredentialCreationOptions(Object_Getter__Handle(this.handle, "publicKey"));
41   }
42   void signal()(scope ref AbortSignal signal) {
43     Object_Call_Handle__void(this.handle, "signal", signal._parent);
44   }
45   auto signal()() {
46     return AbortSignal(Object_Getter__Handle(this.handle, "signal"));
47   }
48 }
49 struct CredentialRequestOptions {
50   nothrow:
51   JsHandle handle;
52   alias handle this;
53   this(Handle h) {
54     this.handle = JsHandle(h);
55   }
56   static auto create() {
57     return CredentialRequestOptions(libwasm_add__object());
58   }
59   void publicKey()(scope ref PublicKeyCredentialRequestOptions publicKey) {
60     Object_Call_Handle__void(this.handle, "publicKey", publicKey.handle);
61   }
62   auto publicKey()() {
63     return PublicKeyCredentialRequestOptions(Object_Getter__Handle(this.handle, "publicKey"));
64   }
65   void signal()(scope ref AbortSignal signal) {
66     Object_Call_Handle__void(this.handle, "signal", signal._parent);
67   }
68   auto signal()() {
69     return AbortSignal(Object_Getter__Handle(this.handle, "signal"));
70   }
71 }
72 struct CredentialsContainer {
73   nothrow:
74   JsHandle handle;
75   alias handle this;
76   this(Handle h) {
77     this.handle = JsHandle(h);
78   }
79   auto get()(scope ref CredentialRequestOptions options) {
80     return JsPromise!(Optional!(Credential))(Object_Call_Handle__Handle(this.handle, "get", options.handle));
81   }
82   auto get()() {
83     return JsPromise!(Optional!(Credential))(Object_Getter__Handle(this.handle, "get"));
84   }
85   auto create()(scope ref CredentialCreationOptions options) {
86     return JsPromise!(Optional!(Credential))(Object_Call_Handle__Handle(this.handle, "create", options.handle));
87   }
88   auto create()() {
89     return JsPromise!(Optional!(Credential))(Object_Getter__Handle(this.handle, "create"));
90   }
91   auto store()(scope ref Credential credential) {
92     return JsPromise!(Credential)(Object_Call_Handle__Handle(this.handle, "store", credential.handle));
93   }
94   auto preventSilentAccess()() {
95     return JsPromise!(void)(Object_Getter__Handle(this.handle, "preventSilentAccess"));
96   }
97 }
98 
99