1 module libwasm.bindings.WebAuthentication; 2 3 import libwasm.types; 4 5 import memutils.ct: tuple; 6 import libwasm.bindings.CredentialManagement; 7 8 @safe: 9 nothrow: 10 11 alias AAGUID = BufferSource; 12 enum AttestationConveyancePreference { 13 none, 14 indirect, 15 direct 16 } 17 alias AuthenticationExtensionsAuthenticatorInputs = Record!(string, string); 18 struct AuthenticationExtensionsClientInputs { 19 nothrow: 20 JsHandle handle; 21 alias handle this; 22 this(Handle h) { 23 this.handle = JsHandle(h); 24 } 25 static auto create() { 26 return AuthenticationExtensionsClientInputs(libwasm_add__object()); 27 } 28 void appid()(string appid) { 29 Object_Call_string__void(this.handle, "appid", appid); 30 } 31 string appid()() { 32 return Object_Getter__string(this.handle, "appid"); 33 } 34 } 35 struct AuthenticationExtensionsClientOutputs { 36 nothrow: 37 JsHandle handle; 38 alias handle this; 39 this(Handle h) { 40 this.handle = JsHandle(h); 41 } 42 static auto create() { 43 return AuthenticationExtensionsClientOutputs(libwasm_add__object()); 44 } 45 void appid()(bool appid) { 46 Object_Call_bool__void(this.handle, "appid", appid); 47 } 48 bool appid()() { 49 return Object_Getter__bool(this.handle, "appid"); 50 } 51 } 52 struct AuthenticatorAssertionResponse { 53 nothrow: 54 libwasm.bindings.WebAuthentication.AuthenticatorResponse _parent; 55 alias _parent this; 56 this(Handle h) { 57 _parent = .AuthenticatorResponse(h); 58 } 59 auto authenticatorData()() { 60 return ArrayBuffer(Object_Getter__Handle(this._parent, "authenticatorData")); 61 } 62 auto signature()() { 63 return ArrayBuffer(Object_Getter__Handle(this._parent, "signature")); 64 } 65 auto userHandle()() { 66 return recastOpt!(ArrayBuffer)(Object_Getter__OptionalHandle(this._parent, "userHandle")); 67 } 68 } 69 enum AuthenticatorAttachment { 70 platform, 71 cross_platform 72 } 73 struct AuthenticatorAttestationResponse { 74 nothrow: 75 libwasm.bindings.WebAuthentication.AuthenticatorResponse _parent; 76 alias _parent this; 77 this(Handle h) { 78 _parent = .AuthenticatorResponse(h); 79 } 80 auto attestationObject()() { 81 return ArrayBuffer(Object_Getter__Handle(this._parent, "attestationObject")); 82 } 83 } 84 struct AuthenticatorResponse { 85 nothrow: 86 JsHandle handle; 87 alias handle this; 88 this(Handle h) { 89 this.handle = JsHandle(h); 90 } 91 auto clientDataJSON()() { 92 return ArrayBuffer(Object_Getter__Handle(this.handle, "clientDataJSON")); 93 } 94 } 95 struct AuthenticatorSelectionCriteria { 96 nothrow: 97 JsHandle handle; 98 alias handle this; 99 this(Handle h) { 100 this.handle = JsHandle(h); 101 } 102 static auto create() { 103 return AuthenticatorSelectionCriteria(libwasm_add__object()); 104 } 105 void authenticatorAttachment()(AuthenticatorAttachment authenticatorAttachment) { 106 Object_Call_int__void(this.handle, "authenticatorAttachment", authenticatorAttachment); 107 } 108 AuthenticatorAttachment authenticatorAttachment()() { 109 return Object_Getter__int(this.handle, "authenticatorAttachment"); 110 } 111 void requireResidentKey()(bool requireResidentKey) { 112 Object_Call_bool__void(this.handle, "requireResidentKey", requireResidentKey); 113 } 114 bool requireResidentKey()() { 115 return Object_Getter__bool(this.handle, "requireResidentKey"); 116 } 117 void userVerification()(UserVerificationRequirement userVerification) { 118 Object_Call_int__void(this.handle, "userVerification", userVerification); 119 } 120 UserVerificationRequirement userVerification()() { 121 return Object_Getter__int(this.handle, "userVerification"); 122 } 123 } 124 alias AuthenticatorSelectionList = Sequence!(AAGUID); 125 enum AuthenticatorTransport { 126 usb, 127 nfc, 128 ble, 129 internal 130 } 131 alias COSEAlgorithmIdentifier = int; 132 struct CollectedClientData { 133 nothrow: 134 JsHandle handle; 135 alias handle this; 136 this(Handle h) { 137 this.handle = JsHandle(h); 138 } 139 static auto create() { 140 return CollectedClientData(libwasm_add__object()); 141 } 142 void type()(string type) { 143 Object_Call_string__void(this.handle, "type", type); 144 } 145 string type()() { 146 return Object_Getter__string(this.handle, "type"); 147 } 148 void challenge()(string challenge) { 149 Object_Call_string__void(this.handle, "challenge", challenge); 150 } 151 string challenge()() { 152 return Object_Getter__string(this.handle, "challenge"); 153 } 154 void origin()(string origin) { 155 Object_Call_string__void(this.handle, "origin", origin); 156 } 157 string origin()() { 158 return Object_Getter__string(this.handle, "origin"); 159 } 160 void hashAlgorithm()(string hashAlgorithm) { 161 Object_Call_string__void(this.handle, "hashAlgorithm", hashAlgorithm); 162 } 163 string hashAlgorithm()() { 164 return Object_Getter__string(this.handle, "hashAlgorithm"); 165 } 166 void tokenBindingId()(string tokenBindingId) { 167 Object_Call_string__void(this.handle, "tokenBindingId", tokenBindingId); 168 } 169 string tokenBindingId()() { 170 return Object_Getter__string(this.handle, "tokenBindingId"); 171 } 172 void clientExtensions()(scope ref AuthenticationExtensionsClientInputs clientExtensions) { 173 Object_Call_Handle__void(this.handle, "clientExtensions", clientExtensions.handle); 174 } 175 auto clientExtensions()() { 176 return AuthenticationExtensionsClientInputs(Object_Getter__Handle(this.handle, "clientExtensions")); 177 } 178 void authenticatorExtensions()(scope ref Record!(string, string) authenticatorExtensions) { 179 Object_Call_Handle__void(this.handle, "authenticatorExtensions", authenticatorExtensions.handle); 180 } 181 auto authenticatorExtensions()() { 182 return Record!(string, string)(Object_Getter__Handle(this.handle, "authenticatorExtensions")); 183 } 184 } 185 struct PublicKeyCredential { 186 nothrow: 187 libwasm.bindings.CredentialManagement.Credential _parent; 188 alias _parent this; 189 this(Handle h) { 190 _parent = .Credential(h); 191 } 192 auto rawId()() { 193 return ArrayBuffer(Object_Getter__Handle(this._parent, "rawId")); 194 } 195 auto response()() { 196 return AuthenticatorResponse(Object_Getter__Handle(this._parent, "response")); 197 } 198 auto getClientExtensionResults()() { 199 return AuthenticationExtensionsClientOutputs(Object_Getter__Handle(this._parent, "getClientExtensionResults")); 200 } 201 auto isUserVerifyingPlatformAuthenticatorAvailable()() { 202 return JsPromise!(bool)(Object_Getter__Handle(this._parent, "isUserVerifyingPlatformAuthenticatorAvailable")); 203 } 204 auto isExternalCTAP2SecurityKeySupported()() { 205 return JsPromise!(bool)(Object_Getter__Handle(this._parent, "isExternalCTAP2SecurityKeySupported")); 206 } 207 } 208 struct PublicKeyCredentialCreationOptions { 209 nothrow: 210 JsHandle handle; 211 alias handle this; 212 this(Handle h) { 213 this.handle = JsHandle(h); 214 } 215 static auto create() { 216 return PublicKeyCredentialCreationOptions(libwasm_add__object()); 217 } 218 void rp()(scope ref PublicKeyCredentialRpEntity rp) { 219 Object_Call_Handle__void(this.handle, "rp", rp.handle); 220 } 221 auto rp()() { 222 return PublicKeyCredentialRpEntity(Object_Getter__Handle(this.handle, "rp")); 223 } 224 void user()(scope ref PublicKeyCredentialUserEntity user) { 225 Object_Call_Handle__void(this.handle, "user", user.handle); 226 } 227 auto user()() { 228 return PublicKeyCredentialUserEntity(Object_Getter__Handle(this.handle, "user")); 229 } 230 void challenge()(scope ref BufferSource challenge) { 231 Object_Call_Handle__void(this.handle, "challenge", challenge.handle); 232 } 233 auto challenge()() { 234 return BufferSource(Object_Getter__Handle(this.handle, "challenge")); 235 } 236 void pubKeyCredParams()(scope ref Sequence!(PublicKeyCredentialParameters) pubKeyCredParams) { 237 Object_Call_Handle__void(this.handle, "pubKeyCredParams", pubKeyCredParams.handle); 238 } 239 auto pubKeyCredParams()() { 240 return Sequence!(PublicKeyCredentialParameters)(Object_Getter__Handle(this.handle, "pubKeyCredParams")); 241 } 242 void timeout()(uint timeout) { 243 Object_Call_uint__void(this.handle, "timeout", timeout); 244 } 245 uint timeout()() { 246 return Object_Getter__uint(this.handle, "timeout"); 247 } 248 void excludeCredentials()(scope ref Sequence!(PublicKeyCredentialDescriptor) excludeCredentials) { 249 Object_Call_Handle__void(this.handle, "excludeCredentials", excludeCredentials.handle); 250 } 251 auto excludeCredentials()() { 252 return Sequence!(PublicKeyCredentialDescriptor)(Object_Getter__Handle(this.handle, "excludeCredentials")); 253 } 254 void authenticatorSelection()(scope ref AuthenticatorSelectionCriteria authenticatorSelection) { 255 Object_Call_Handle__void(this.handle, "authenticatorSelection", authenticatorSelection.handle); 256 } 257 auto authenticatorSelection()() { 258 return AuthenticatorSelectionCriteria(Object_Getter__Handle(this.handle, "authenticatorSelection")); 259 } 260 void attestation()(AttestationConveyancePreference attestation) { 261 Object_Call_int__void(this.handle, "attestation", attestation); 262 } 263 AttestationConveyancePreference attestation()() { 264 return Object_Getter__int(this.handle, "attestation"); 265 } 266 void extensions()(scope ref AuthenticationExtensionsClientInputs extensions) { 267 Object_Call_Handle__void(this.handle, "extensions", extensions.handle); 268 } 269 auto extensions()() { 270 return AuthenticationExtensionsClientInputs(Object_Getter__Handle(this.handle, "extensions")); 271 } 272 } 273 struct PublicKeyCredentialDescriptor { 274 nothrow: 275 JsHandle handle; 276 alias handle this; 277 this(Handle h) { 278 this.handle = JsHandle(h); 279 } 280 static auto create() { 281 return PublicKeyCredentialDescriptor(libwasm_add__object()); 282 } 283 void type()(PublicKeyCredentialType type) { 284 Object_Call_int__void(this.handle, "type", type); 285 } 286 PublicKeyCredentialType type()() { 287 return Object_Getter__int(this.handle, "type"); 288 } 289 void id()(scope ref BufferSource id) { 290 Object_Call_Handle__void(this.handle, "id", id.handle); 291 } 292 auto id()() { 293 return BufferSource(Object_Getter__Handle(this.handle, "id")); 294 } 295 void transports()(scope ref Sequence!(AuthenticatorTransport) transports) { 296 Object_Call_Handle__void(this.handle, "transports", transports.handle); 297 } 298 auto transports()() { 299 return Sequence!(AuthenticatorTransport)(Object_Getter__Handle(this.handle, "transports")); 300 } 301 } 302 struct PublicKeyCredentialEntity { 303 nothrow: 304 JsHandle handle; 305 alias handle this; 306 this(Handle h) { 307 this.handle = JsHandle(h); 308 } 309 static auto create() { 310 return PublicKeyCredentialEntity(libwasm_add__object()); 311 } 312 void name()(string name) { 313 Object_Call_string__void(this.handle, "name", name); 314 } 315 string name()() { 316 return Object_Getter__string(this.handle, "name"); 317 } 318 void icon()(string icon) { 319 Object_Call_string__void(this.handle, "icon", icon); 320 } 321 string icon()() { 322 return Object_Getter__string(this.handle, "icon"); 323 } 324 } 325 struct PublicKeyCredentialParameters { 326 nothrow: 327 JsHandle handle; 328 alias handle this; 329 this(Handle h) { 330 this.handle = JsHandle(h); 331 } 332 static auto create() { 333 return PublicKeyCredentialParameters(libwasm_add__object()); 334 } 335 void type()(PublicKeyCredentialType type) { 336 Object_Call_int__void(this.handle, "type", type); 337 } 338 PublicKeyCredentialType type()() { 339 return Object_Getter__int(this.handle, "type"); 340 } 341 void alg()(int alg) { 342 Object_Call_int__void(this.handle, "alg", alg); 343 } 344 int alg()() { 345 return Object_Getter__int(this.handle, "alg"); 346 } 347 } 348 struct PublicKeyCredentialRequestOptions { 349 nothrow: 350 JsHandle handle; 351 alias handle this; 352 this(Handle h) { 353 this.handle = JsHandle(h); 354 } 355 static auto create() { 356 return PublicKeyCredentialRequestOptions(libwasm_add__object()); 357 } 358 void challenge()(scope ref BufferSource challenge) { 359 Object_Call_Handle__void(this.handle, "challenge", challenge.handle); 360 } 361 auto challenge()() { 362 return BufferSource(Object_Getter__Handle(this.handle, "challenge")); 363 } 364 void timeout()(uint timeout) { 365 Object_Call_uint__void(this.handle, "timeout", timeout); 366 } 367 uint timeout()() { 368 return Object_Getter__uint(this.handle, "timeout"); 369 } 370 void rpId()(string rpId) { 371 Object_Call_string__void(this.handle, "rpId", rpId); 372 } 373 string rpId()() { 374 return Object_Getter__string(this.handle, "rpId"); 375 } 376 void allowCredentials()(scope ref Sequence!(PublicKeyCredentialDescriptor) allowCredentials) { 377 Object_Call_Handle__void(this.handle, "allowCredentials", allowCredentials.handle); 378 } 379 auto allowCredentials()() { 380 return Sequence!(PublicKeyCredentialDescriptor)(Object_Getter__Handle(this.handle, "allowCredentials")); 381 } 382 void userVerification()(UserVerificationRequirement userVerification) { 383 Object_Call_int__void(this.handle, "userVerification", userVerification); 384 } 385 UserVerificationRequirement userVerification()() { 386 return Object_Getter__int(this.handle, "userVerification"); 387 } 388 void extensions()(scope ref AuthenticationExtensionsClientInputs extensions) { 389 Object_Call_Handle__void(this.handle, "extensions", extensions.handle); 390 } 391 auto extensions()() { 392 return AuthenticationExtensionsClientInputs(Object_Getter__Handle(this.handle, "extensions")); 393 } 394 } 395 struct PublicKeyCredentialRpEntity { 396 nothrow: 397 libwasm.bindings.WebAuthentication.PublicKeyCredentialEntity _parent; 398 alias _parent this; 399 this(Handle h) { 400 _parent = .PublicKeyCredentialEntity(h); 401 } 402 static auto create() { 403 return PublicKeyCredentialRpEntity(libwasm_add__object()); 404 } 405 void id()(string id) { 406 Object_Call_string__void(this._parent, "id", id); 407 } 408 string id()() { 409 return Object_Getter__string(this._parent, "id"); 410 } 411 } 412 enum PublicKeyCredentialType { 413 public_key 414 } 415 struct PublicKeyCredentialUserEntity { 416 nothrow: 417 libwasm.bindings.WebAuthentication.PublicKeyCredentialEntity _parent; 418 alias _parent this; 419 this(Handle h) { 420 _parent = .PublicKeyCredentialEntity(h); 421 } 422 static auto create() { 423 return PublicKeyCredentialUserEntity(libwasm_add__object()); 424 } 425 void id()(scope ref BufferSource id) { 426 Object_Call_Handle__void(this._parent, "id", id.handle); 427 } 428 auto id()() { 429 return BufferSource(Object_Getter__Handle(this._parent, "id")); 430 } 431 void displayName()(string displayName) { 432 Object_Call_string__void(this._parent, "displayName", displayName); 433 } 434 string displayName()() { 435 return Object_Getter__string(this._parent, "displayName"); 436 } 437 } 438 enum UserVerificationRequirement { 439 required, 440 preferred, 441 discouraged 442 } 443 444