@crossauth/backend 0.0.2

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 (109) hide show
  1. package/LICENSE +203 -0
  2. package/README.md +14 -0
  3. package/dist/apikey.d.ts +100 -0
  4. package/dist/apikey.d.ts.map +1 -0
  5. package/dist/auth.d.ts +131 -0
  6. package/dist/auth.d.ts.map +1 -0
  7. package/dist/authenticators/dummyfactor2.d.ts +129 -0
  8. package/dist/authenticators/dummyfactor2.d.ts.map +1 -0
  9. package/dist/authenticators/emailauth.d.ts +176 -0
  10. package/dist/authenticators/emailauth.d.ts.map +1 -0
  11. package/dist/authenticators/ldapauth.d.ts +89 -0
  12. package/dist/authenticators/ldapauth.d.ts.map +1 -0
  13. package/dist/authenticators/passwordauth.d.ts +159 -0
  14. package/dist/authenticators/passwordauth.d.ts.map +1 -0
  15. package/dist/authenticators/smsauth.d.ts +160 -0
  16. package/dist/authenticators/smsauth.d.ts.map +1 -0
  17. package/dist/authenticators/tests/ldapauth.test.d.ts +2 -0
  18. package/dist/authenticators/tests/ldapauth.test.d.ts.map +1 -0
  19. package/dist/authenticators/totpauth.d.ts +117 -0
  20. package/dist/authenticators/totpauth.d.ts.map +1 -0
  21. package/dist/authenticators/twilioauth.d.ts +29 -0
  22. package/dist/authenticators/twilioauth.d.ts.map +1 -0
  23. package/dist/cookieauth.d.ts +269 -0
  24. package/dist/cookieauth.d.ts.map +1 -0
  25. package/dist/crypto.d.ts +196 -0
  26. package/dist/crypto.d.ts.map +1 -0
  27. package/dist/emailtokens.d.ts +178 -0
  28. package/dist/emailtokens.d.ts.map +1 -0
  29. package/dist/index.cjs +9107 -0
  30. package/dist/index.d.ts +46 -0
  31. package/dist/index.d.ts.map +1 -0
  32. package/dist/index.js +9090 -0
  33. package/dist/oauth/authserver.d.ts +490 -0
  34. package/dist/oauth/authserver.d.ts.map +1 -0
  35. package/dist/oauth/client.d.ts +72 -0
  36. package/dist/oauth/client.d.ts.map +1 -0
  37. package/dist/oauth/clientmanager.d.ts +73 -0
  38. package/dist/oauth/clientmanager.d.ts.map +1 -0
  39. package/dist/oauth/resserver.d.ts +43 -0
  40. package/dist/oauth/resserver.d.ts.map +1 -0
  41. package/dist/oauth/tests/common.d.ts +58 -0
  42. package/dist/oauth/tests/common.d.ts.map +1 -0
  43. package/dist/oauth/tests/oauthauthserver_authzcode.test.d.ts +2 -0
  44. package/dist/oauth/tests/oauthauthserver_authzcode.test.d.ts.map +1 -0
  45. package/dist/oauth/tests/oauthauthserver_clientcred.test.d.ts +2 -0
  46. package/dist/oauth/tests/oauthauthserver_clientcred.test.d.ts.map +1 -0
  47. package/dist/oauth/tests/oauthauthserver_device.test.d.ts +2 -0
  48. package/dist/oauth/tests/oauthauthserver_device.test.d.ts.map +1 -0
  49. package/dist/oauth/tests/oauthauthserver_mfa.test.d.ts +5 -0
  50. package/dist/oauth/tests/oauthauthserver_mfa.test.d.ts.map +1 -0
  51. package/dist/oauth/tests/oauthauthserver_password.test.d.ts +2 -0
  52. package/dist/oauth/tests/oauthauthserver_password.test.d.ts.map +1 -0
  53. package/dist/oauth/tests/oauthclient.test.d.ts +2 -0
  54. package/dist/oauth/tests/oauthclient.test.d.ts.map +1 -0
  55. package/dist/oauth/tests/oauthresserver.test.d.ts +2 -0
  56. package/dist/oauth/tests/oauthresserver.test.d.ts.map +1 -0
  57. package/dist/oauth/tokenconsumer.d.ts +80 -0
  58. package/dist/oauth/tokenconsumer.d.ts.map +1 -0
  59. package/dist/session.d.ts +491 -0
  60. package/dist/session.d.ts.map +1 -0
  61. package/dist/storage/dbconnection.d.ts +19 -0
  62. package/dist/storage/dbconnection.d.ts.map +1 -0
  63. package/dist/storage/dbstorage.d.ts +319 -0
  64. package/dist/storage/dbstorage.d.ts.map +1 -0
  65. package/dist/storage/inmemorystorage.d.ts +225 -0
  66. package/dist/storage/inmemorystorage.d.ts.map +1 -0
  67. package/dist/storage/ldapstorage.d.ts +143 -0
  68. package/dist/storage/ldapstorage.d.ts.map +1 -0
  69. package/dist/storage/postgresconnection.d.ts +27 -0
  70. package/dist/storage/postgresconnection.d.ts.map +1 -0
  71. package/dist/storage/postgresstorage.d.ts +83 -0
  72. package/dist/storage/postgresstorage.d.ts.map +1 -0
  73. package/dist/storage/prismastorage.d.ts +361 -0
  74. package/dist/storage/prismastorage.d.ts.map +1 -0
  75. package/dist/storage/sqliteconnection.d.ts +35 -0
  76. package/dist/storage/sqliteconnection.d.ts.map +1 -0
  77. package/dist/storage/sqlitestorage.d.ts +83 -0
  78. package/dist/storage/sqlitestorage.d.ts.map +1 -0
  79. package/dist/storage/tests/dbtests.d.ts +5 -0
  80. package/dist/storage/tests/dbtests.d.ts.map +1 -0
  81. package/dist/storage/tests/inmemorystorage.test.d.ts +5 -0
  82. package/dist/storage/tests/inmemorystorage.test.d.ts.map +1 -0
  83. package/dist/storage/tests/inmemorytestdata.d.ts +4 -0
  84. package/dist/storage/tests/inmemorytestdata.d.ts.map +1 -0
  85. package/dist/storage/tests/ldapstorage.test.d.ts +2 -0
  86. package/dist/storage/tests/ldapstorage.test.d.ts.map +1 -0
  87. package/dist/storage/tests/postgresstorage.test.d.ts +2 -0
  88. package/dist/storage/tests/postgresstorage.test.d.ts.map +1 -0
  89. package/dist/storage/tests/prismastorage.test.d.ts +4 -0
  90. package/dist/storage/tests/prismastorage.test.d.ts.map +1 -0
  91. package/dist/storage/tests/sqlitestorage.test.d.ts +2 -0
  92. package/dist/storage/tests/sqlitestorage.test.d.ts.map +1 -0
  93. package/dist/storage.d.ts +411 -0
  94. package/dist/storage.d.ts.map +1 -0
  95. package/dist/tests/cookieauth.test.d.ts +4 -0
  96. package/dist/tests/cookieauth.test.d.ts.map +1 -0
  97. package/dist/tests/crypto.test.d.ts +2 -0
  98. package/dist/tests/crypto.test.d.ts.map +1 -0
  99. package/dist/tests/email.test.d.ts +4 -0
  100. package/dist/tests/email.test.d.ts.map +1 -0
  101. package/dist/tests/password.test.d.ts +5 -0
  102. package/dist/tests/password.test.d.ts.map +1 -0
  103. package/dist/tests/tmp.test.d.ts +2 -0
  104. package/dist/tests/tmp.test.d.ts.map +1 -0
  105. package/dist/tests/utils.test.d.ts +2 -0
  106. package/dist/tests/utils.test.d.ts.map +1 -0
  107. package/dist/utils.d.ts +41 -0
  108. package/dist/utils.d.ts.map +1 -0
  109. package/package.json +71 -0
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=utils.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.test.d.ts","sourceRoot":"","sources":["../../src/tests/utils.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,41 @@
1
+ /**
2
+ * Type of parameter that can be parsed from an option value or
3
+ * environment variable
4
+ */
5
+ export declare enum ParamType {
6
+ String = 0,
7
+ Number = 1,
8
+ Boolean = 2,
9
+ Json = 3,
10
+ JsonArray = 4
11
+ }
12
+ /**
13
+ * Sets an instance variable in the passed object from the passed options
14
+ * object and environment variable.
15
+ *
16
+ * If the named parameter exists in the options object, that the instance
17
+ * variable is set to that value. Otherwise if the named environment
18
+ * variable exists, it is set from that. Otherwise, the instance variable
19
+ * is not updarted.
20
+ *
21
+ * @param param the name of the parameter in the options variable and the
22
+ * name of the variable in the instance
23
+ * @param type The type of variable. If the value is `StringArray` or `Json`,
24
+ * both the option and the environment variable value should be a
25
+ * string, which will be parsed.
26
+ * @param instance options present in the `options` or environment variables
27
+ * will be set oin a corresponding instance variable in this
28
+ * class or object.
29
+ * @param options object containing options as key/value pairs
30
+ * @param envName name of environment variable
31
+ * @param required if true, an exception will be thrown if the variable is
32
+ * not present in `options` or the environment variable
33
+ * @throws {@link @crossauth/common!CrossauthError} with
34
+ * {@link @crossauth/common!ErrorCode} `Configuration` if `required`
35
+ * is set but the option was not present, or if there was a parsing
36
+ * error.
37
+ */
38
+ export declare function setParameter(param: string, type: ParamType, instance: any, options: {
39
+ [key: string]: any;
40
+ }, envName?: string, required?: boolean): void;
41
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAGA;;;GAGG;AACH,oBAAY,SAAS;IACjB,MAAM,IAAI;IACV,MAAM,IAAA;IACN,OAAO,IAAA;IACP,IAAI,IAAA;IACJ,SAAS,IAAA;CACZ;AAkDD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAG,MAAM,EACd,IAAI,EAAG,SAAS,EAChB,QAAQ,EAAG,GAAG,EACd,OAAO,EAAG;IAAC,CAAC,GAAG,EAAC,MAAM,GAAG,GAAG,CAAA;CAAC,EAC7B,OAAO,CAAC,EAAG,MAAM,EAAE,QAAQ,GAAG,OAAa,GAAI,IAAI,CAU/E"}
package/package.json ADDED
@@ -0,0 +1,71 @@
1
+ {
2
+ "name": "@crossauth/backend",
3
+ "private": false,
4
+ "version": "0.0.2",
5
+ "type": "module",
6
+ "main": "./dist/index.cjs",
7
+ "module": "./dist/index.js",
8
+ "typings": "./dist/index.d.ts",
9
+ "types": "./dist/index.d.ts",
10
+ "files": [
11
+ "dist/*"
12
+ ],
13
+ "devDependencies": {
14
+ "@types/node": "^20.10.8",
15
+ "jimp": "^0.22.10",
16
+ "jsqr": "^1.4.0",
17
+ "prisma": "^5.12.0",
18
+ "typedoc": "^0.25.4",
19
+ "typescript": "^5.3.3",
20
+ "vite": "^5.0.8",
21
+ "vite-plugin-dts": "^3.6.4",
22
+ "vitest": "^1.1.0",
23
+ "vitest-fetch-mock": "^0.2.2"
24
+ },
25
+ "dependencies": {
26
+ "@esbuild-plugins/node-modules-polyfill": "^0.2.2",
27
+ "@prisma/client": "^5.12.0",
28
+ "@types/cookie": "^0.6.0",
29
+ "@types/cookie-parser": "^1.4.6",
30
+ "@types/express": "^4.17.21",
31
+ "@types/jsonwebtoken": "^9.0.5",
32
+ "@types/ldapjs": "^3.0.6",
33
+ "@types/nodemailer": "^6.4.14",
34
+ "@types/nunjucks": "^3.2.6",
35
+ "@types/pg": "^8.11.8",
36
+ "@types/qrcode": "^1.5.5",
37
+ "@types/twilio": "^3.19.3",
38
+ "cookie": "^0.6.0",
39
+ "cookie-parser": "^1.4.6",
40
+ "dotenv": "^16.3.1",
41
+ "dotenv-cli": "^7.3.0",
42
+ "events": "^3.3.0",
43
+ "http-request-mock": "^1.8.18",
44
+ "install": "^0.13.0",
45
+ "jose": "^5.2.3",
46
+ "jsonwebtoken": "^9.0.2",
47
+ "jwt-decode": "^4.0.0",
48
+ "ldap-async": "^2.1.1",
49
+ "ldapjs": "^3.0.7",
50
+ "nodemailer": "^6.9.8",
51
+ "nunjucks": "^3.2.4",
52
+ "otplib": "^12.0.1",
53
+ "pg": "^8.12.0",
54
+ "qrcode": "^1.5.3",
55
+ "sonic-boom": "^3.7.0",
56
+ "sqlite3": "^5.1.7",
57
+ "twilio": "^5.0.3",
58
+ "@crossauth/common": "^0.0.2"
59
+ },
60
+ "scripts": {
61
+ "dev": "vite",
62
+ "build": "vite build",
63
+ "preview": "vite preview",
64
+ "test": "dotenv -e .env.unittest vitest",
65
+ "testonce": "dotenv -e .env.unittest vitest run",
66
+ "doc": "typedoc",
67
+ "preinstall": "bash ../../removeprismaclient.sh",
68
+ "postinstall": "bash ../../copyprismaclient.sh && bash ../../ifdotenv.sh -e .env.unittest prisma generate",
69
+ "prisma": "dotenv -e .env.unittest pnpm exec prisma"
70
+ }
71
+ }