@0xkey-io/http 0.1.0

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 (108) hide show
  1. package/CHANGELOG.md +5 -0
  2. package/LICENSE +201 -0
  3. package/README.md +94 -0
  4. package/dist/__generated__/barrel.d.ts +2 -0
  5. package/dist/__generated__/barrel.d.ts.map +1 -0
  6. package/dist/__generated__/services/coordinator/public/v1/public_api.client.d.ts +1794 -0
  7. package/dist/__generated__/services/coordinator/public/v1/public_api.client.d.ts.map +1 -0
  8. package/dist/__generated__/services/coordinator/public/v1/public_api.client.js +3022 -0
  9. package/dist/__generated__/services/coordinator/public/v1/public_api.client.js.map +1 -0
  10. package/dist/__generated__/services/coordinator/public/v1/public_api.client.mjs +3020 -0
  11. package/dist/__generated__/services/coordinator/public/v1/public_api.client.mjs.map +1 -0
  12. package/dist/__generated__/services/coordinator/public/v1/public_api.fetcher.d.ts +150383 -0
  13. package/dist/__generated__/services/coordinator/public/v1/public_api.fetcher.d.ts.map +1 -0
  14. package/dist/__generated__/services/coordinator/public/v1/public_api.fetcher.js +2880 -0
  15. package/dist/__generated__/services/coordinator/public/v1/public_api.fetcher.js.map +1 -0
  16. package/dist/__generated__/services/coordinator/public/v1/public_api.fetcher.mjs +2639 -0
  17. package/dist/__generated__/services/coordinator/public/v1/public_api.fetcher.mjs.map +1 -0
  18. package/dist/__generated__/services/coordinator/public/v1/public_api.types.d.ts +6732 -0
  19. package/dist/__generated__/services/coordinator/public/v1/public_api.types.d.ts.map +1 -0
  20. package/dist/_kernel/transport.d.ts +2 -0
  21. package/dist/_kernel/transport.d.ts.map +1 -0
  22. package/dist/_kernel/transport.js +8 -0
  23. package/dist/_kernel/transport.js.map +1 -0
  24. package/dist/_kernel/transport.mjs +6 -0
  25. package/dist/_kernel/transport.mjs.map +1 -0
  26. package/dist/async.d.ts +32 -0
  27. package/dist/async.d.ts.map +1 -0
  28. package/dist/async.js +158 -0
  29. package/dist/async.js.map +1 -0
  30. package/dist/async.mjs +155 -0
  31. package/dist/async.mjs.map +1 -0
  32. package/dist/base.d.ts +91 -0
  33. package/dist/base.d.ts.map +1 -0
  34. package/dist/base.js +172 -0
  35. package/dist/base.js.map +1 -0
  36. package/dist/base.mjs +165 -0
  37. package/dist/base.mjs.map +1 -0
  38. package/dist/config.d.ts +32 -0
  39. package/dist/config.d.ts.map +1 -0
  40. package/dist/config.js +48 -0
  41. package/dist/config.js.map +1 -0
  42. package/dist/config.mjs +43 -0
  43. package/dist/config.mjs.map +1 -0
  44. package/dist/index.d.ts +16 -0
  45. package/dist/index.d.ts.map +1 -0
  46. package/dist/index.js +34 -0
  47. package/dist/index.js.map +1 -0
  48. package/dist/index.mjs +10 -0
  49. package/dist/index.mjs.map +1 -0
  50. package/dist/shared.d.ts +76 -0
  51. package/dist/shared.d.ts.map +1 -0
  52. package/dist/shared.js +138 -0
  53. package/dist/shared.js.map +1 -0
  54. package/dist/shared.mjs +128 -0
  55. package/dist/shared.mjs.map +1 -0
  56. package/dist/universal.d.ts +4 -0
  57. package/dist/universal.d.ts.map +1 -0
  58. package/dist/universal.js +10 -0
  59. package/dist/universal.js.map +1 -0
  60. package/dist/universal.mjs +8 -0
  61. package/dist/universal.mjs.map +1 -0
  62. package/dist/version.d.ts +2 -0
  63. package/dist/version.d.ts.map +1 -0
  64. package/dist/version.js +6 -0
  65. package/dist/version.js.map +1 -0
  66. package/dist/version.mjs +4 -0
  67. package/dist/version.mjs.map +1 -0
  68. package/dist/webauthn-json/api.d.ts +13 -0
  69. package/dist/webauthn-json/api.d.ts.map +1 -0
  70. package/dist/webauthn-json/api.js +16 -0
  71. package/dist/webauthn-json/api.js.map +1 -0
  72. package/dist/webauthn-json/api.mjs +13 -0
  73. package/dist/webauthn-json/api.mjs.map +1 -0
  74. package/dist/webauthn-json/base64url.d.ts +4 -0
  75. package/dist/webauthn-json/base64url.d.ts.map +1 -0
  76. package/dist/webauthn-json/base64url.js +22 -0
  77. package/dist/webauthn-json/base64url.js.map +1 -0
  78. package/dist/webauthn-json/base64url.mjs +20 -0
  79. package/dist/webauthn-json/base64url.mjs.map +1 -0
  80. package/dist/webauthn-json/convert.d.ts +8 -0
  81. package/dist/webauthn-json/convert.d.ts.map +1 -0
  82. package/dist/webauthn-json/convert.js +71 -0
  83. package/dist/webauthn-json/convert.js.map +1 -0
  84. package/dist/webauthn-json/convert.mjs +64 -0
  85. package/dist/webauthn-json/convert.mjs.map +1 -0
  86. package/dist/webauthn-json/index.d.ts +14 -0
  87. package/dist/webauthn-json/index.d.ts.map +1 -0
  88. package/dist/webauthn-json/index.js +18 -0
  89. package/dist/webauthn-json/index.js.map +1 -0
  90. package/dist/webauthn-json/index.mjs +15 -0
  91. package/dist/webauthn-json/index.mjs.map +1 -0
  92. package/dist/webauthn-json/json.d.ts +92 -0
  93. package/dist/webauthn-json/json.d.ts.map +1 -0
  94. package/dist/webauthn-json/schema-format.d.ts +13 -0
  95. package/dist/webauthn-json/schema-format.d.ts.map +1 -0
  96. package/dist/webauthn-json/schema.d.ts +9 -0
  97. package/dist/webauthn-json/schema.d.ts.map +1 -0
  98. package/dist/webauthn-json/schema.js +40 -0
  99. package/dist/webauthn-json/schema.js.map +1 -0
  100. package/dist/webauthn-json/schema.mjs +37 -0
  101. package/dist/webauthn-json/schema.mjs.map +1 -0
  102. package/dist/webauthn.d.ts +24 -0
  103. package/dist/webauthn.d.ts.map +1 -0
  104. package/dist/webauthn.js +97 -0
  105. package/dist/webauthn.js.map +1 -0
  106. package/dist/webauthn.mjs +93 -0
  107. package/dist/webauthn.mjs.map +1 -0
  108. package/package.json +57 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api.js","sources":["../../src/webauthn-json/api.ts"],"sourcesContent":[null],"names":["convert","bufferToBase64url","publicKeyCredentialWithAttestation","publicKeyCredentialWithAssertion"],"mappings":";;;;;;AAqBM,SAAU,oBAAoB,CAClC,UAA+B,EAAA;IAE/B,OAAOA,eAAO,CACZC,2BAAiB,EACjBC,yCAAkC,EAClC,UAAU,CACX;AACH;AAiBM,SAAU,iBAAiB,CAC/B,UAA+B,EAAA;IAE/B,OAAOF,eAAO,CACZC,2BAAiB,EACjBE,uCAAgC,EAChC,UAAU,CACX;AACH;;;;;"}
@@ -0,0 +1,13 @@
1
+ import { bufferToBase64url } from './base64url.mjs';
2
+ import { convert } from './convert.mjs';
3
+ import { publicKeyCredentialWithAssertion, publicKeyCredentialWithAttestation } from './schema.mjs';
4
+
5
+ function createResponseToJSON(credential) {
6
+ return convert(bufferToBase64url, publicKeyCredentialWithAttestation, credential);
7
+ }
8
+ function getResponseToJSON(credential) {
9
+ return convert(bufferToBase64url, publicKeyCredentialWithAssertion, credential);
10
+ }
11
+
12
+ export { createResponseToJSON, getResponseToJSON };
13
+ //# sourceMappingURL=api.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api.mjs","sources":["../../src/webauthn-json/api.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;AAqBM,SAAU,oBAAoB,CAClC,UAA+B,EAAA;IAE/B,OAAO,OAAO,CACZ,iBAAiB,EACjB,kCAAkC,EAClC,UAAU,CACX;AACH;AAiBM,SAAU,iBAAiB,CAC/B,UAA+B,EAAA;IAE/B,OAAO,OAAO,CACZ,iBAAiB,EACjB,gCAAgC,EAChC,UAAU,CACX;AACH;;;;"}
@@ -0,0 +1,4 @@
1
+ export type Base64urlString = string;
2
+ export declare function base64urlToBuffer(baseurl64String: Base64urlString): ArrayBuffer;
3
+ export declare function bufferToBase64url(buffer: ArrayBuffer): Base64urlString;
4
+ //# sourceMappingURL=base64url.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base64url.d.ts","sourceRoot":"","sources":["../../src/webauthn-json/base64url.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,eAAe,GAAG,MAAM,CAAC;AAErC,wBAAgB,iBAAiB,CAC/B,eAAe,EAAE,eAAe,GAC/B,WAAW,CAgBb;AAED,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,WAAW,GAAG,eAAe,CAkBtE"}
@@ -0,0 +1,22 @@
1
+ 'use strict';
2
+
3
+ function bufferToBase64url(buffer) {
4
+ // Buffer to binary string
5
+ const byteView = new Uint8Array(buffer);
6
+ let str = "";
7
+ for (const charCode of byteView) {
8
+ str += String.fromCharCode(charCode);
9
+ }
10
+ // Binary string to base64
11
+ const base64String = btoa(str);
12
+ // Base64 to base64url
13
+ // We assume that the base64url string is well-formed.
14
+ const base64urlString = base64String
15
+ .replace(/\+/g, "-")
16
+ .replace(/\//g, "_")
17
+ .replace(/=/g, "");
18
+ return base64urlString;
19
+ }
20
+
21
+ exports.bufferToBase64url = bufferToBase64url;
22
+ //# sourceMappingURL=base64url.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base64url.js","sources":["../../src/webauthn-json/base64url.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAsBM,SAAU,iBAAiB,CAAC,MAAmB,EAAA;;AAEnD,IAAA,MAAM,QAAQ,GAAG,IAAI,UAAU,CAAC,MAAM,CAAC;IACvC,IAAI,GAAG,GAAG,EAAE;AACZ,IAAA,KAAK,MAAM,QAAQ,IAAI,QAAQ,EAAE;AAC/B,QAAA,GAAG,IAAI,MAAM,CAAC,YAAY,CAAC,QAAQ,CAAC;IACtC;;AAGA,IAAA,MAAM,YAAY,GAAG,IAAI,CAAC,GAAG,CAAC;;;IAI9B,MAAM,eAAe,GAAG;AACrB,SAAA,OAAO,CAAC,KAAK,EAAE,GAAG;AAClB,SAAA,OAAO,CAAC,KAAK,EAAE,GAAG;AAClB,SAAA,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC;AACpB,IAAA,OAAO,eAAe;AACxB;;;;"}
@@ -0,0 +1,20 @@
1
+ function bufferToBase64url(buffer) {
2
+ // Buffer to binary string
3
+ const byteView = new Uint8Array(buffer);
4
+ let str = "";
5
+ for (const charCode of byteView) {
6
+ str += String.fromCharCode(charCode);
7
+ }
8
+ // Binary string to base64
9
+ const base64String = btoa(str);
10
+ // Base64 to base64url
11
+ // We assume that the base64url string is well-formed.
12
+ const base64urlString = base64String
13
+ .replace(/\+/g, "-")
14
+ .replace(/\//g, "_")
15
+ .replace(/=/g, "");
16
+ return base64urlString;
17
+ }
18
+
19
+ export { bufferToBase64url };
20
+ //# sourceMappingURL=base64url.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base64url.mjs","sources":["../../src/webauthn-json/base64url.ts"],"sourcesContent":[null],"names":[],"mappings":"AAsBM,SAAU,iBAAiB,CAAC,MAAmB,EAAA;;AAEnD,IAAA,MAAM,QAAQ,GAAG,IAAI,UAAU,CAAC,MAAM,CAAC;IACvC,IAAI,GAAG,GAAG,EAAE;AACZ,IAAA,KAAK,MAAM,QAAQ,IAAI,QAAQ,EAAE;AAC/B,QAAA,GAAG,IAAI,MAAM,CAAC,YAAY,CAAC,QAAQ,CAAC;IACtC;;AAGA,IAAA,MAAM,YAAY,GAAG,IAAI,CAAC,GAAG,CAAC;;;IAI9B,MAAM,eAAe,GAAG;AACrB,SAAA,OAAO,CAAC,KAAK,EAAE,GAAG;AAClB,SAAA,OAAO,CAAC,KAAK,EAAE,GAAG;AAClB,SAAA,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC;AACpB,IAAA,OAAO,eAAe;AACxB;;;;"}
@@ -0,0 +1,8 @@
1
+ import type { Schema, SchemaProperty } from "./schema-format";
2
+ export declare const copyValue = "copy";
3
+ export declare const convertValue = "convert";
4
+ export declare function convert<From, To>(conversionFn: (v: From) => To, schema: Schema, input: any): any;
5
+ export declare function derived(schema: Schema, derive: (v: any) => any): SchemaProperty;
6
+ export declare function required(schema: Schema): SchemaProperty;
7
+ export declare function optional(schema: Schema): SchemaProperty;
8
+ //# sourceMappingURL=convert.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"convert.d.ts","sourceRoot":"","sources":["../../src/webauthn-json/convert.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAG9D,eAAO,MAAM,SAAS,SAAS,CAAC;AAChC,eAAO,MAAM,YAAY,YAAY,CAAC;AAEtC,wBAAgB,OAAO,CAAC,IAAI,EAAE,EAAE,EAC9B,YAAY,EAAE,CAAC,CAAC,EAAE,IAAI,KAAK,EAAE,EAC7B,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,GAAG,GACT,GAAG,CAyCL;AAED,wBAAgB,OAAO,CACrB,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,CAAC,CAAC,EAAE,GAAG,KAAK,GAAG,GACtB,cAAc,CAMhB;AAED,wBAAgB,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,cAAc,CAKvD;AAED,wBAAgB,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,cAAc,CAKvD"}
@@ -0,0 +1,71 @@
1
+ 'use strict';
2
+
3
+ // We export these values in order so that they can be used to deduplicate
4
+ // schema definitions in minified JS code.
5
+ // TODO: Parcel isn't deduplicating these values.
6
+ const copyValue = "copy";
7
+ const convertValue = "convert";
8
+ function convert(conversionFn, schema, input) {
9
+ if (schema === copyValue) {
10
+ return input;
11
+ }
12
+ if (schema === convertValue) {
13
+ return conversionFn(input);
14
+ }
15
+ if (schema instanceof Array) {
16
+ return input.map((v) => convert(conversionFn, schema[0], v));
17
+ }
18
+ if (schema instanceof Object) {
19
+ const output = {};
20
+ for (const [key, schemaField] of Object.entries(schema)) {
21
+ if (schemaField.derive) {
22
+ const v = schemaField.derive(input);
23
+ if (v !== undefined) {
24
+ input[key] = v;
25
+ }
26
+ }
27
+ if (!(key in input)) {
28
+ if (schemaField.required) {
29
+ throw new Error(`Missing key: ${key}`);
30
+ }
31
+ continue;
32
+ }
33
+ // Fields can be null (rather than missing or `undefined`), e.g. the
34
+ // `userHandle` field of the `AuthenticatorAssertionResponse`:
35
+ // https://www.w3.org/TR/webauthn/#iface-authenticatorassertionresponse
36
+ if (input[key] == null) {
37
+ output[key] = null;
38
+ continue;
39
+ }
40
+ output[key] = convert(conversionFn, schemaField.schema, input[key]);
41
+ }
42
+ return output;
43
+ }
44
+ }
45
+ function derived(schema, derive) {
46
+ return {
47
+ required: true,
48
+ schema,
49
+ derive,
50
+ };
51
+ }
52
+ function required(schema) {
53
+ return {
54
+ required: true,
55
+ schema,
56
+ };
57
+ }
58
+ function optional(schema) {
59
+ return {
60
+ required: false,
61
+ schema,
62
+ };
63
+ }
64
+
65
+ exports.convert = convert;
66
+ exports.convertValue = convertValue;
67
+ exports.copyValue = copyValue;
68
+ exports.derived = derived;
69
+ exports.optional = optional;
70
+ exports.required = required;
71
+ //# sourceMappingURL=convert.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"convert.js","sources":["../../src/webauthn-json/convert.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAAA;AACA;AAIA;AACO,MAAM,SAAS,GAAG;AAClB,MAAM,YAAY,GAAG;SAEZ,OAAO,CACrB,YAA6B,EAC7B,MAAc,EACd,KAAU,EAAA;AAEV,IAAA,IAAI,MAAM,KAAK,SAAS,EAAE;AACxB,QAAA,OAAO,KAAK;IACd;AACA,IAAA,IAAI,MAAM,KAAK,YAAY,EAAE;AAC3B,QAAA,OAAO,YAAY,CAAC,KAAK,CAAC;IAC5B;AACA,IAAA,IAAI,MAAM,YAAY,KAAK,EAAE;QAC3B,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,CAAM,KAAK,OAAO,CAAW,YAAY,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAC7E;AACA,IAAA,IAAI,MAAM,YAAY,MAAM,EAAE;QAC5B,MAAM,MAAM,GAAQ,EAAE;AACtB,QAAA,KAAK,MAAM,CAAC,GAAG,EAAE,WAAW,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE;AACvD,YAAA,IAAI,WAAW,CAAC,MAAM,EAAE;gBACtB,MAAM,CAAC,GAAG,WAAW,CAAC,MAAM,CAAC,KAAK,CAAC;AACnC,gBAAA,IAAI,CAAC,KAAK,SAAS,EAAE;AACnB,oBAAA,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC;gBAChB;YACF;AAEA,YAAA,IAAI,EAAE,GAAG,IAAI,KAAK,CAAC,EAAE;AACnB,gBAAA,IAAI,WAAW,CAAC,QAAQ,EAAE;AACxB,oBAAA,MAAM,IAAI,KAAK,CAAC,gBAAgB,GAAG,CAAA,CAAE,CAAC;gBACxC;gBACA;YACF;;;;AAIA,YAAA,IAAI,KAAK,CAAC,GAAG,CAAC,IAAI,IAAI,EAAE;AACtB,gBAAA,MAAM,CAAC,GAAG,CAAC,GAAG,IAAI;gBAClB;YACF;AACA,YAAA,MAAM,CAAC,GAAG,CAAC,GAAG,OAAO,CACnB,YAAY,EACZ,WAAW,CAAC,MAAM,EAClB,KAAK,CAAC,GAAG,CAAC,CACX;QACH;AACA,QAAA,OAAO,MAAM;IACf;AACF;AAEM,SAAU,OAAO,CACrB,MAAc,EACd,MAAuB,EAAA;IAEvB,OAAO;AACL,QAAA,QAAQ,EAAE,IAAI;QACd,MAAM;QACN,MAAM;KACP;AACH;AAEM,SAAU,QAAQ,CAAC,MAAc,EAAA;IACrC,OAAO;AACL,QAAA,QAAQ,EAAE,IAAI;QACd,MAAM;KACP;AACH;AAEM,SAAU,QAAQ,CAAC,MAAc,EAAA;IACrC,OAAO;AACL,QAAA,QAAQ,EAAE,KAAK;QACf,MAAM;KACP;AACH;;;;;;;;;"}
@@ -0,0 +1,64 @@
1
+ // We export these values in order so that they can be used to deduplicate
2
+ // schema definitions in minified JS code.
3
+ // TODO: Parcel isn't deduplicating these values.
4
+ const copyValue = "copy";
5
+ const convertValue = "convert";
6
+ function convert(conversionFn, schema, input) {
7
+ if (schema === copyValue) {
8
+ return input;
9
+ }
10
+ if (schema === convertValue) {
11
+ return conversionFn(input);
12
+ }
13
+ if (schema instanceof Array) {
14
+ return input.map((v) => convert(conversionFn, schema[0], v));
15
+ }
16
+ if (schema instanceof Object) {
17
+ const output = {};
18
+ for (const [key, schemaField] of Object.entries(schema)) {
19
+ if (schemaField.derive) {
20
+ const v = schemaField.derive(input);
21
+ if (v !== undefined) {
22
+ input[key] = v;
23
+ }
24
+ }
25
+ if (!(key in input)) {
26
+ if (schemaField.required) {
27
+ throw new Error(`Missing key: ${key}`);
28
+ }
29
+ continue;
30
+ }
31
+ // Fields can be null (rather than missing or `undefined`), e.g. the
32
+ // `userHandle` field of the `AuthenticatorAssertionResponse`:
33
+ // https://www.w3.org/TR/webauthn/#iface-authenticatorassertionresponse
34
+ if (input[key] == null) {
35
+ output[key] = null;
36
+ continue;
37
+ }
38
+ output[key] = convert(conversionFn, schemaField.schema, input[key]);
39
+ }
40
+ return output;
41
+ }
42
+ }
43
+ function derived(schema, derive) {
44
+ return {
45
+ required: true,
46
+ schema,
47
+ derive,
48
+ };
49
+ }
50
+ function required(schema) {
51
+ return {
52
+ required: true,
53
+ schema,
54
+ };
55
+ }
56
+ function optional(schema) {
57
+ return {
58
+ required: false,
59
+ schema,
60
+ };
61
+ }
62
+
63
+ export { convert, convertValue, copyValue, derived, optional, required };
64
+ //# sourceMappingURL=convert.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"convert.mjs","sources":["../../src/webauthn-json/convert.ts"],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AAIA;AACO,MAAM,SAAS,GAAG;AAClB,MAAM,YAAY,GAAG;SAEZ,OAAO,CACrB,YAA6B,EAC7B,MAAc,EACd,KAAU,EAAA;AAEV,IAAA,IAAI,MAAM,KAAK,SAAS,EAAE;AACxB,QAAA,OAAO,KAAK;IACd;AACA,IAAA,IAAI,MAAM,KAAK,YAAY,EAAE;AAC3B,QAAA,OAAO,YAAY,CAAC,KAAK,CAAC;IAC5B;AACA,IAAA,IAAI,MAAM,YAAY,KAAK,EAAE;QAC3B,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,CAAM,KAAK,OAAO,CAAW,YAAY,EAAE,MAAM,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 -0,0 +1,14 @@
1
+ import { createRequestFromJSON as parseCreationOptionsFromJSON, getRequestFromJSON as parseRequestOptionsFromJSON } from "./api";
2
+ import type { CredentialCreationOptionsJSON, CredentialRequestOptionsJSON, PublicKeyCredentialWithAssertionJSON as AuthenticationResponseJSON, PublicKeyCredentialWithAttestationJSON as RegistrationResponseJSON } from "./json";
3
+ export type { PublicKeyCredentialWithAssertionJSON, PublicKeyCredentialWithAttestationJSON, } from "./json";
4
+ export { parseCreationOptionsFromJSON, parseRequestOptionsFromJSON };
5
+ export type { CredentialCreationOptionsJSON, CredentialRequestOptionsJSON, AuthenticationResponseJSON, RegistrationResponseJSON, };
6
+ export interface RegistrationPublicKeyCredential extends PublicKeyCredential {
7
+ toJSON(): RegistrationResponseJSON;
8
+ }
9
+ export declare function create(options: CredentialCreationOptions): Promise<RegistrationPublicKeyCredential>;
10
+ export interface AuthenticationPublicKeyCredential extends PublicKeyCredential {
11
+ toJSON(): AuthenticationResponseJSON;
12
+ }
13
+ export declare function get(options: CredentialRequestOptions): Promise<AuthenticationPublicKeyCredential>;
14
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/webauthn-json/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,IAAI,4BAA4B,EAErD,kBAAkB,IAAI,2BAA2B,EAElD,MAAM,OAAO,CAAC;AAEf,OAAO,KAAK,EACV,6BAA6B,EAC7B,4BAA4B,EAC5B,oCAAoC,IAAI,0BAA0B,EAClE,sCAAsC,IAAI,wBAAwB,EACnE,MAAM,QAAQ,CAAC;AAEhB,YAAY,EACV,oCAAoC,EACpC,sCAAsC,GACvC,MAAM,QAAQ,CAAC;AAEhB,OAAO,EAAE,4BAA4B,EAAE,2BAA2B,EAAE,CAAC;AACrE,YAAY,EACV,6BAA6B,EAC7B,4BAA4B,EAC5B,0BAA0B,EAC1B,wBAAwB,GACzB,CAAC;AAEF,MAAM,WAAW,+BAAgC,SAAQ,mBAAmB;IAC1E,MAAM,IAAI,wBAAwB,CAAC;CACpC;AAED,wBAAsB,MAAM,CAC1B,OAAO,EAAE,yBAAyB,GACjC,OAAO,CAAC,+BAA+B,CAAC,CAM1C;AAED,MAAM,WAAW,iCAAkC,SAAQ,mBAAmB;IAC5E,MAAM,IAAI,0BAA0B,CAAC;CACtC;AAED,wBAAsB,GAAG,CACvB,OAAO,EAAE,wBAAwB,GAChC,OAAO,CAAC,iCAAiC,CAAC,CAM5C"}
@@ -0,0 +1,18 @@
1
+ 'use strict';
2
+
3
+ var api = require('./api.js');
4
+
5
+ async function create(options) {
6
+ const response = (await navigator.credentials.create(options));
7
+ response.toJSON = () => api.createResponseToJSON(response);
8
+ return response;
9
+ }
10
+ async function get(options) {
11
+ const response = (await navigator.credentials.get(options));
12
+ response.toJSON = () => api.getResponseToJSON(response);
13
+ return response;
14
+ }
15
+
16
+ exports.create = create;
17
+ exports.get = get;
18
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../../src/webauthn-json/index.ts"],"sourcesContent":[null],"names":["createResponseToJSON","getResponseToJSON"],"mappings":";;;;AA+BO,eAAe,MAAM,CAC1B,OAAkC,EAAA;AAElC,IAAA,MAAM,QAAQ,IAAI,MAAM,SAAS,CAAC,WAAW,CAAC,MAAM,CAClD,OAAO,CACR,CAAoC;IACrC,QAAQ,CAAC,MAAM,GAAG,MAAMA,wBAAoB,CAAC,QAAQ,CAAC;AACtD,IAAA,OAAO,QAAQ;AACjB;AAMO,eAAe,GAAG,CACvB,OAAiC,EAAA;AAEjC,IAAA,MAAM,QAAQ,IAAI,MAAM,SAAS,CAAC,WAAW,CAAC,GAAG,CAC/C,OAAO,CACR,CAAsC;IACvC,QAAQ,CAAC,MAAM,GAAG,MAAMC,qBAAiB,CAAC,QAAQ,CAAC;AACnD,IAAA,OAAO,QAAQ;AACjB;;;;;"}
@@ -0,0 +1,15 @@
1
+ import { createResponseToJSON, getResponseToJSON } from './api.mjs';
2
+
3
+ async function create(options) {
4
+ const response = (await navigator.credentials.create(options));
5
+ response.toJSON = () => createResponseToJSON(response);
6
+ return response;
7
+ }
8
+ async function get(options) {
9
+ const response = (await navigator.credentials.get(options));
10
+ response.toJSON = () => getResponseToJSON(response);
11
+ return response;
12
+ }
13
+
14
+ export { create, get };
15
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","sources":["../../src/webauthn-json/index.ts"],"sourcesContent":[null],"names":[],"mappings":";;AA+BO,eAAe,MAAM,CAC1B,OAAkC,EAAA;AAElC,IAAA,MAAM,QAAQ,IAAI,MAAM,SAAS,CAAC,WAAW,CAAC,MAAM,CAClD,OAAO,CACR,CAAoC;IACrC,QAAQ,CAAC,MAAM,GAAG,MAAM,oBAAoB,CAAC,QAAQ,CAAC;AACtD,IAAA,OAAO,QAAQ;AACjB;AAMO,eAAe,GAAG,CACvB,OAAiC,EAAA;AAEjC,IAAA,MAAM,QAAQ,IAAI,MAAM,SAAS,CAAC,WAAW,CAAC,GAAG,CAC/C,OAAO,CACR,CAAsC;IACvC,QAAQ,CAAC,MAAM,GAAG,MAAM,iBAAiB,CAAC,QAAQ,CAAC;AACnD,IAAA,OAAO,QAAQ;AACjB;;;;"}
@@ -0,0 +1,92 @@
1
+ import type { Base64urlString } from "./base64url";
2
+ interface CredPropsAuthenticationExtensionsClientOutputsJSON {
3
+ rk: boolean;
4
+ }
5
+ interface AuthenticationExtensionsClientOutputsJSON extends AuthenticationExtensionsClientOutputs {
6
+ appidExclude?: boolean;
7
+ credProps?: CredPropsAuthenticationExtensionsClientOutputsJSON;
8
+ }
9
+ type PublicKeyCredentialWithOptionalAuthenticatorAttachment = Partial<PublicKeyCredential> & Omit<PublicKeyCredential, "authenticatorAttachment">;
10
+ export interface PublicKeyCredentialWithClientExtensionResults extends PublicKeyCredentialWithOptionalAuthenticatorAttachment {
11
+ authenticatorAttachment?: string | null;
12
+ clientExtensionResults?: AuthenticationExtensionsClientOutputsJSON;
13
+ }
14
+ type AuthenticatorTransportJSON = AuthenticatorTransport | "hybrid";
15
+ export interface PublicKeyCredentialDescriptorJSON {
16
+ type: PublicKeyCredentialType;
17
+ id: Base64urlString;
18
+ transports?: AuthenticatorTransportJSON[];
19
+ }
20
+ interface SimpleWebAuthnExtensionsJSON {
21
+ appid?: string;
22
+ appidExclude?: string;
23
+ credProps?: boolean;
24
+ }
25
+ interface SimpleClientExtensionResultsJSON {
26
+ appid?: boolean;
27
+ appidExclude?: boolean;
28
+ credProps?: CredPropsAuthenticationExtensionsClientOutputsJSON;
29
+ }
30
+ interface PublicKeyCredentialJSON {
31
+ id: string;
32
+ type: PublicKeyCredentialType;
33
+ rawId: Base64urlString;
34
+ authenticatorAttachment?: AuthenticatorAttachment | null;
35
+ }
36
+ interface PublicKeyCredentialUserEntityJSON extends PublicKeyCredentialEntity {
37
+ displayName: string;
38
+ id: Base64urlString;
39
+ }
40
+ type ResidentKeyRequirement = "discouraged" | "preferred" | "required";
41
+ interface AuthenticatorSelectionCriteriaJSON extends AuthenticatorSelectionCriteria {
42
+ residentKey?: ResidentKeyRequirement;
43
+ }
44
+ export interface PublicKeyCredentialCreationOptionsJSON {
45
+ rp: PublicKeyCredentialRpEntity;
46
+ user: PublicKeyCredentialUserEntityJSON;
47
+ challenge: Base64urlString;
48
+ pubKeyCredParams: PublicKeyCredentialParameters[];
49
+ timeout?: number;
50
+ excludeCredentials?: PublicKeyCredentialDescriptorJSON[];
51
+ authenticatorSelection?: AuthenticatorSelectionCriteriaJSON;
52
+ attestation?: AttestationConveyancePreference;
53
+ extensions?: SimpleWebAuthnExtensionsJSON;
54
+ }
55
+ export interface CredentialCreationOptionsJSON {
56
+ publicKey: PublicKeyCredentialCreationOptionsJSON;
57
+ signal?: AbortSignal;
58
+ }
59
+ export interface AuthenticatorAttestationResponseJSON {
60
+ clientDataJSON: Base64urlString;
61
+ attestationObject: Base64urlString;
62
+ transports: AuthenticatorTransportJSON[];
63
+ }
64
+ export interface PublicKeyCredentialWithAttestationJSON extends PublicKeyCredentialJSON {
65
+ response: AuthenticatorAttestationResponseJSON;
66
+ clientExtensionResults: SimpleClientExtensionResultsJSON;
67
+ }
68
+ export interface PublicKeyCredentialRequestOptionsJSON {
69
+ challenge: Base64urlString;
70
+ timeout?: number;
71
+ rpId?: string;
72
+ allowCredentials?: PublicKeyCredentialDescriptorJSON[];
73
+ userVerification?: UserVerificationRequirement;
74
+ extensions?: SimpleWebAuthnExtensionsJSON;
75
+ }
76
+ export interface CredentialRequestOptionsJSON {
77
+ mediation?: CredentialMediationRequirement;
78
+ publicKey?: PublicKeyCredentialRequestOptionsJSON;
79
+ signal?: AbortSignal;
80
+ }
81
+ interface AuthenticatorAssertionResponseJSON {
82
+ clientDataJSON: Base64urlString;
83
+ authenticatorData: Base64urlString;
84
+ signature: Base64urlString;
85
+ userHandle: Base64urlString | null;
86
+ }
87
+ export interface PublicKeyCredentialWithAssertionJSON extends PublicKeyCredentialJSON {
88
+ response: AuthenticatorAssertionResponseJSON;
89
+ clientExtensionResults: SimpleClientExtensionResultsJSON;
90
+ }
91
+ export {};
92
+ //# sourceMappingURL=json.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"json.d.ts","sourceRoot":"","sources":["../../src/webauthn-json/json.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAKnD,UAAU,kDAAkD;IAC1D,EAAE,EAAE,OAAO,CAAC;CACb;AAED,UAAU,yCACR,SAAQ,qCAAqC;IAC7C,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,SAAS,CAAC,EAAE,kDAAkD,CAAC;CAChE;AAED,KAAK,sDAAsD,GACzD,OAAO,CAAC,mBAAmB,CAAC,GAC1B,IAAI,CAAC,mBAAmB,EAAE,yBAAyB,CAAC,CAAC;AAEzD,MAAM,WAAW,6CACf,SAAQ,sDAAsD;IAC9D,uBAAuB,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 schema: Schema;
5
+ derive?: (v: any) => any;
6
+ }
7
+ interface SchemaObject {
8
+ [property: string]: SchemaProperty;
9
+ }
10
+ type SchemaArray = [SchemaObject] | [SchemaLeaf];
11
+ export type Schema = SchemaLeaf | SchemaArray | SchemaObject;
12
+ export {};
13
+ //# sourceMappingURL=schema-format.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema-format.d.ts","sourceRoot":"","sources":["../../src/webauthn-json/schema-format.ts"],"names":[],"mappings":"AAAA,KAAK,UAAU,GAAG,MAAM,GAAG,SAAS,CAAC;AACrC,MAAM,WAAW,cAAc;IAC7B,QAAQ,EAAE,OAAO,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,CAAC,CAAC,EAAE,GAAG,KAAK,GAAG,CAAC;CAC1B;AACD,UAAU,YAAY;IACpB,CAAC,QAAQ,EAAE,MAAM,GAAG,cAAc,CAAC;CACpC;AACD,KAAK,WAAW,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;AAEjD,MAAM,MAAM,MAAM,GAAG,UAAU,GAAG,WAAW,GAAG,YAAY,CAAC"}
@@ -0,0 +1,9 @@
1
+ import type { Schema } from "./schema-format";
2
+ export declare const credentialCreationOptions: Schema;
3
+ export declare const publicKeyCredentialWithAttestation: Schema;
4
+ export declare const credentialRequestOptions: Schema;
5
+ export declare const publicKeyCredentialWithAssertion: Schema;
6
+ export declare const schema: {
7
+ [s: string]: Schema;
8
+ };
9
+ //# sourceMappingURL=schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/webauthn-json/schema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AA+B9C,eAAO,MAAM,yBAAyB,EAAE,MAmBvC,CAAC;AAIF,eAAO,MAAM,kCAAkC,EAAE,MAiBhD,CAAC;AAIF,eAAO,MAAM,wBAAwB,EAAE,MAWtC,CAAC;AAIF,eAAO,MAAM,gCAAgC,EAAE,MAe9C,CAAC;AAEF,eAAO,MAAM,MAAM,EAAE;IAAE,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;CAKzC,CAAC"}
@@ -0,0 +1,40 @@
1
+ 'use strict';
2
+
3
+ var convert = require('./convert.js');
4
+
5
+ const simplifiedClientExtensionResultsSchema = {
6
+ appid: convert.optional(convert.copyValue),
7
+ appidExclude: convert.optional(convert.copyValue),
8
+ credProps: convert.optional(convert.copyValue),
9
+ };
10
+ // `navigator.create()` response
11
+ const publicKeyCredentialWithAttestation = {
12
+ type: convert.required(convert.copyValue),
13
+ id: convert.required(convert.copyValue),
14
+ rawId: convert.required(convert.convertValue),
15
+ authenticatorAttachment: convert.optional(convert.copyValue),
16
+ response: convert.required({
17
+ clientDataJSON: convert.required(convert.convertValue),
18
+ attestationObject: convert.required(convert.convertValue),
19
+ transports: convert.derived(convert.copyValue, (response) => response.getTransports?.() || []),
20
+ }),
21
+ clientExtensionResults: convert.derived(simplifiedClientExtensionResultsSchema, (pkc) => pkc.getClientExtensionResults()),
22
+ };
23
+ // `navigator.get()` response
24
+ const publicKeyCredentialWithAssertion = {
25
+ type: convert.required(convert.copyValue),
26
+ id: convert.required(convert.copyValue),
27
+ rawId: convert.required(convert.convertValue),
28
+ authenticatorAttachment: convert.optional(convert.copyValue),
29
+ response: convert.required({
30
+ clientDataJSON: convert.required(convert.convertValue),
31
+ authenticatorData: convert.required(convert.convertValue),
32
+ signature: convert.required(convert.convertValue),
33
+ userHandle: convert.required(convert.convertValue),
34
+ }),
35
+ clientExtensionResults: convert.derived(simplifiedClientExtensionResultsSchema, (pkc) => pkc.getClientExtensionResults()),
36
+ };
37
+
38
+ exports.publicKeyCredentialWithAssertion = publicKeyCredentialWithAssertion;
39
+ exports.publicKeyCredentialWithAttestation = publicKeyCredentialWithAttestation;
40
+ //# sourceMappingURL=schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.js","sources":["../../src/webauthn-json/schema.ts"],"sourcesContent":[null],"names":["optional","copy","required","convert","derived"],"mappings":";;;;AAuBA,MAAM,sCAAsC,GAAG;AAC7C,IAAA,KAAK,EAAEA,gBAAQ,CAACC,iBAAI,CAAC;AACrB,IAAA,YAAY,EAAED,gBAAQ,CAACC,iBAAI,CAAC;AAC5B,IAAA,SAAS,EAAED,gBAAQ,CAACC,iBAAI,CAAC;CAC1B;AAyBD;AAEO,MAAM,kCAAkC,GAAW;AACxD,IAAA,IAAI,EAAEC,gBAAQ,CAACD,iBAAI,CAAC;AACpB,IAAA,EAAE,EAAEC,gBAAQ,CAACD,iBAAI,CAAC;AAClB,IAAA,KAAK,EAAEC,gBAAQ,CAACC,oBAAO,CAAC;AACxB,IAAA,uBAAuB,EAAEH,gBAAQ,CAACC,iBAAI,CAAC;IACvC,QAAQ,EAAEC,gBAAQ,CAAC;AACjB,QAAA,cAAc,EAAEA,gBAAQ,CAACC,oBAAO,CAAC;AACjC,QAAA,iBAAiB,EAAED,gBAAQ,CAACC,oBAAO,CAAC;AACpC,QAAA,UAAU,EAAEC,eAAO,CACjBH,iBAAI,EACJ,CAAC,QAAa,KAAK,QAAQ,CAAC,aAAa,IAAI,IAAI,EAAE,CACpD;KACF,CAAC;AACF,IAAA,sBAAsB,EAAEG,eAAO,CAC7B,sCAAsC,EACtC,CAAC,GAAwB,KAAK,GAAG,CAAC,yBAAyB,EAAE,CAC9D;;AAkBH;AAEO,MAAM,gCAAgC,GAAW;AACtD,IAAA,IAAI,EAAEF,gBAAQ,CAACD,iBAAI,CAAC;AACpB,IAAA,EAAE,EAAEC,gBAAQ,CAACD,iBAAI,CAAC;AAClB,IAAA,KAAK,EAAEC,gBAAQ,CAACC,oBAAO,CAAC;AACxB,IAAA,uBAAuB,EAAEH,gBAAQ,CAACC,iBAAI,CAAC;IACvC,QAAQ,EAAEC,gBAAQ,CAAC;AACjB,QAAA,cAAc,EAAEA,gBAAQ,CAACC,oBAAO,CAAC;AACjC,QAAA,iBAAiB,EAAED,gBAAQ,CAACC,oBAAO,CAAC;AACpC,QAAA,SAAS,EAAED,gBAAQ,CAACC,oBAAO,CAAC;AAC5B,QAAA,UAAU,EAAED,gBAAQ,CAACC,oBAAO,CAAC;KAC9B,CAAC;AACF,IAAA,sBAAsB,EAAEC,eAAO,CAC7B,sCAAsC,EACtC,CAAC,GAAwB,KAAK,GAAG,CAAC,yBAAyB,EAAE,CAC9D;;;;;;"}
@@ -0,0 +1,37 @@
1
+ import { derived, required, optional, convertValue, copyValue } from './convert.mjs';
2
+
3
+ const simplifiedClientExtensionResultsSchema = {
4
+ appid: optional(copyValue),
5
+ appidExclude: optional(copyValue),
6
+ credProps: optional(copyValue),
7
+ };
8
+ // `navigator.create()` response
9
+ const publicKeyCredentialWithAttestation = {
10
+ type: required(copyValue),
11
+ id: required(copyValue),
12
+ rawId: required(convertValue),
13
+ authenticatorAttachment: optional(copyValue),
14
+ response: required({
15
+ clientDataJSON: required(convertValue),
16
+ attestationObject: required(convertValue),
17
+ transports: derived(copyValue, (response) => response.getTransports?.() || []),
18
+ }),
19
+ clientExtensionResults: derived(simplifiedClientExtensionResultsSchema, (pkc) => pkc.getClientExtensionResults()),
20
+ };
21
+ // `navigator.get()` response
22
+ const publicKeyCredentialWithAssertion = {
23
+ type: required(copyValue),
24
+ id: required(copyValue),
25
+ rawId: required(convertValue),
26
+ authenticatorAttachment: optional(copyValue),
27
+ response: required({
28
+ clientDataJSON: required(convertValue),
29
+ authenticatorData: required(convertValue),
30
+ signature: required(convertValue),
31
+ userHandle: required(convertValue),
32
+ }),
33
+ clientExtensionResults: derived(simplifiedClientExtensionResultsSchema, (pkc) => pkc.getClientExtensionResults()),
34
+ };
35
+
36
+ export { publicKeyCredentialWithAssertion, publicKeyCredentialWithAttestation };
37
+ //# sourceMappingURL=schema.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.mjs","sources":["../../src/webauthn-json/schema.ts"],"sourcesContent":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AA,UAAU,EAAE,QAAQ,CAACA,YAAO,CAAC;KAC9B,CAAC;AACF,IAAA,sBAAsB,EAAE,OAAO,CAC7B,sCAAsC,EACtC,CAAC,GAAwB,KAAK,GAAG,CAAC,yBAAyB,EAAE,CAC9D;;;;;"}
@@ -0,0 +1,24 @@
1
+ import type { definitions } from "./__generated__/services/coordinator/public/v1/public_api.types";
2
+ type TAttestation = definitions["v1Attestation"];
3
+ type ExternalAuthenticatorTransports = AuthenticatorTransport | "hybrid";
4
+ type InternalAuthenticatorTransports = definitions["v1AuthenticatorTransport"];
5
+ export type ZeroXKeyPublicKeyCredentialRequestOptions = {
6
+ timeout?: number;
7
+ rpId?: string;
8
+ allowCredentials?: PublicKeyCredentialDescriptor[];
9
+ userVerification?: UserVerificationRequirement;
10
+ extensions?: AuthenticationExtensionsClientInputs;
11
+ };
12
+ export type ZeroXKeyCredentialRequestOptions = {
13
+ mediation?: CredentialMediationRequirement;
14
+ publicKey: ZeroXKeyPublicKeyCredentialRequestOptions;
15
+ signal?: AbortSignal;
16
+ password?: boolean;
17
+ unmediated?: boolean;
18
+ };
19
+ type ZeroXKeyCredentialCreationOptions = CredentialCreationOptions;
20
+ export type { ZeroXKeyCredentialCreationOptions };
21
+ export declare function protocolTransportEnumToInternalEnum(protocolEnum: ExternalAuthenticatorTransports): InternalAuthenticatorTransports;
22
+ export declare function getWebAuthnAssertion(payload: string, options?: ZeroXKeyCredentialRequestOptions): Promise<string>;
23
+ export declare function getWebAuthnAttestation(options: ZeroXKeyCredentialCreationOptions): Promise<TAttestation>;
24
+ //# sourceMappingURL=webauthn.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webauthn.d.ts","sourceRoot":"","sources":["../src/webauthn.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iEAAiE,CAAC;AAQnG,KAAK,YAAY,GAAG,WAAW,CAAC,eAAe,CAAC,CAAC;AAGjD,KAAK,+BAA+B,GAAG,sBAAsB,GAAG,QAAQ,CAAC;AACzE,KAAK,+BAA+B,GAAG,WAAW,CAAC,0BAA0B,CAAC,CAAC;AAM/E,MAAM,MAAM,yCAAyC,GAAG;IAEtD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,gBAAgB,CAAC,EAAE,6BAA6B,EAAE,CAAC;IACnD,gBAAgB,CAAC,EAAE,2BAA2B,CAAC;IAC/C,UAAU,CAAC,EAAE,oCAAoC,CAAC;CACnD,CAAC;AAEF,MAAM,MAAM,gCAAgC,GAAG;IAC7C,SAAS,CAAC,EAAE,8BAA8B,CAAC;IAC3C,SAAS,EAAE,yCAAyC,CAAC;IACrD,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB,CAAC;AAEF,KAAK,iCAAiC,GAAG,yBAAyB,CAAC;AAEnE,YAAY,EAAE,iCAAiC,EAAE,CAAC;AAoClD,wBAAgB,mCAAmC,CACjD,YAAY,EAAE,+BAA+B,GAC5C,+BAA+B,CAqBjC;AAeD,wBAAsB,oBAAoB,CACxC,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE,gCAAgC,GACzC,OAAO,CAAC,MAAM,CAAC,CAkBjB;AAED,wBAAsB,sBAAsB,CAC1C,OAAO,EAAE,iCAAiC,GACzC,OAAO,CAAC,YAAY,CAAC,CAUvB"}