Commit Graph

375 Commits

Author SHA1 Message Date
Derrick Hammer 7f5847f7da
chore: remove commented code 2024-02-16 08:42:26 -05:00
Derrick Hammer f0d7a337db
refactor: change how init of protocols works and make router building part of the interface 2024-02-16 08:39:55 -05:00
Derrick Hammer 1b3934c793
refactor: update usage of errors 2024-02-15 21:06:30 -05:00
Derrick Hammer 3f90cbfe09
refactor: use new errors and optimize code 2024-02-15 20:55:38 -05:00
Derrick Hammer c084743b47
refactor: apply auth and proxy middlewares 2024-02-14 00:41:02 -05:00
Derrick Hammer 41a6772c9f
chore: emailverifier no longer needed here 2024-02-13 23:32:23 -05:00
Derrick Hammer 8b9471aa04
refactor: switch to GetUserFromContext 2024-02-13 23:29:48 -05:00
Derrick Hammer 431dec55f9
feat: otp api support 2024-02-13 23:23:01 -05:00
Derrick Hammer 16689f6c31
feat: add GetUserFromContext 2024-02-13 23:22:36 -05:00
Derrick Hammer f645499c7f
refactor: prefix all jwt helpers 2024-02-13 22:31:44 -05:00
Derrick Hammer 50c4d8b945
refactor: clean up use of auth middleware in s5 2024-02-13 22:25:50 -05:00
Derrick Hammer 0b3d54e7c5
refactor: major middleware refactor 2024-02-13 22:17:34 -05:00
Derrick Hammer 171b810504
fix: remove duplicate check 2024-02-13 20:01:45 -05:00
Derrick Hammer 2d3b755cb2
refactor: update use of LoginPassword 2024-02-13 19:58:00 -05:00
Derrick Hammer 6f61f09ba4
refactor: move email validation to gorm 2024-02-13 19:41:00 -05:00
Derrick Hammer 3e629cf46e
refactor: update usage of account methods 2024-02-13 19:29:37 -05:00
Derrick Hammer bbb68aecb5
refactor: use EmailExists and add logging 2024-02-13 19:28:23 -05:00
Derrick Hammer 5598660176
refactor: un-export all s5 http handlers 2024-02-13 19:10:24 -05:00
Derrick Hammer 3c55ed2853
feat: add initial account services api 2024-02-13 19:07:24 -05:00
Derrick Hammer 78accd1f02
fix: add missing content responses to upload api's 2024-02-13 00:32:16 -05:00
Derrick Hammer 227ac9b403
fix: wrong proof extension 2024-02-09 15:58:15 -05:00
Derrick Hammer 0c00e2e7d9
feat: add proof download support to download endpoint 2024-02-09 15:49:34 -05:00
Derrick Hammer e7ac46de32
fix: update method calls and hash object usage 2024-02-09 15:28:50 -05:00
Derrick Hammer b939ea109c
refactor: add tags to swagger 2024-02-07 20:31:42 -05:00
Derrick Hammer 7c945f0a2d
refactor: clean up and remove version check 2024-02-07 20:21:44 -05:00
Derrick Hammer 89cdd01698
fix: update swagger json url 2024-02-07 20:20:13 -05:00
Derrick Hammer 8e04de591e
fix: add content type header to byteHandler 2024-02-07 20:19:56 -05:00
Derrick Hammer 172b040365
refactor: more refactoring on swagger handlers 2024-02-07 20:19:22 -05:00
Derrick Hammer 279cc484fc
refactor: merge flowchartsman/swaggerui into our own code base to simplify routing 2024-02-07 19:18:11 -05:00
Derrick Hammer 69ae351d94
fix: schema fixes 2024-02-07 18:25:20 -05:00
Derrick Hammer 192ac364c5
fix: schema fixes 2024-02-07 18:14:43 -05:00
Derrick Hammer 0f3f92442a
fix: schema fixes 2024-02-07 17:56:16 -05:00
Derrick Hammer be92e036f3
feat: initial swagger support 2024-02-07 17:39:18 -05:00
Derrick Hammer d13c15212c
fix: need to create a special mock handler for tus cors, and make cores a dedicated middleware function 2024-02-03 20:11:47 -05:00
Derrick Hammer 6655abe61b
fix: need to allow Upload-Length through cors 2024-02-03 20:02:11 -05:00
Derrick Hammer 8a1e586b28
fix: need to allow Upload-Concat through cors 2024-02-03 20:00:40 -05:00
Derrick Hammer 39b4977d52
fix: need to allow Expires through cors 2024-02-03 19:59:43 -05:00
Derrick Hammer 130abe6098
fix: need to allow Authorization through cors 2024-02-03 19:58:17 -05:00
Derrick Hammer 5784afe064
fix: need to create custom cors middleware instance for tus 2024-02-03 19:55:32 -05:00
Derrick Hammer 6894cd7e54
refactor: put cors middleware 1st 2024-02-03 19:46:02 -05:00
Derrick Hammer d57a14d9a3
fix: need to add options routes 2024-02-03 19:34:55 -05:00
Derrick Hammer fd721077e5
fix: need to apply cors to tus upload 2024-02-03 19:25:13 -05:00
Derrick Hammer 6d34f5b683
refactor: change struct naming convention from "impl" to "default" 2024-01-31 20:29:27 -05:00
Derrick Hammer 883504225e
fix: lifecycle setup needs to return nil 2024-01-30 14:53:50 -05:00
Derrick Hammer 1721fbf832
fix: update imports 2024-01-30 00:33:57 -05:00
Derrick Hammer e034e1d54e
refactor: restructure s5 protocol/api to use new fx module and new library structure. Also move the proto/api to its own package for organization 2024-01-29 15:11:57 -05:00
Derrick Hammer b4e2e962e5
fix: we can use modules in the builders after all 2024-01-28 05:22:11 -05:00
Derrick Hammer 18a54917a0
fix: add LifecyclesParams struct 2024-01-28 04:45:34 -05:00
Derrick Hammer 610d5fe268
fix: add init to create an empty router 2024-01-28 04:44:16 -05:00
Derrick Hammer 646a65f814
fix: need to use group tag 2024-01-28 04:23:58 -05:00
Derrick Hammer a410cc55f0
fix: dont return pointer 2024-01-28 04:22:49 -05:00
Derrick Hammer 4348ff6dfe
fix: HttpHandler needs a Result struct 2024-01-28 04:18:32 -05:00
Derrick Hammer c326d9b61b
fix: we cannot wrap the build into a module as it causes provide issues 2024-01-28 04:17:22 -05:00
Derrick Hammer 5fd601407f
chore: unused function 2024-01-28 04:02:40 -05:00
Derrick Hammer ceabb95f6d
fix: we need to pass out the api in both struct and interface form for fx to read it properly 2024-01-28 04:01:36 -05:00
Derrick Hammer 80484079d6
refactor: we dont need to register the router 2024-01-28 03:03:04 -05:00
Derrick Hammer 8c89796341
refactor: use a centralized list key for enabled protocols 2024-01-28 03:01:12 -05:00
Derrick Hammer f7057142eb
fix: add init func to s5 api 2024-01-28 02:51:35 -05:00
Derrick Hammer 55f515157d
refactor: move BuildS5TusApi and export middlewares to break import cycle 2024-01-28 02:48:02 -05:00
Derrick Hammer 2dc8fc56f5
refactor: epic refactor to use uber fx microframework/DI framework to manage dependency graph, remove the portal object, and remove the interfaces package 2024-01-28 02:20:59 -05:00
Derrick Hammer ad54cc70b3
fix: need to pass content type header before ServeContent 2024-01-25 19:18:35 -05:00
Derrick Hammer be27728b42
feat: need to support mime type in small uploads 2024-01-25 19:15:01 -05:00
Derrick Hammer 541fcff779
feat: add cors support 2024-01-25 18:25:10 -05:00
Derrick Hammer 73bd74faeb
refactor: use storage NewFile 2024-01-25 16:34:31 -05:00
Derrick Hammer 8797460bf8
refactor: revert to using http.StripPrefix 2024-01-25 09:23:23 -05:00
Derrick Hammer 14d8760c1f
fix: pass name to http.ServeContent 2024-01-24 19:23:42 -05:00
Derrick Hammer bf15faf33f
feat: need else on hash check 2024-01-24 19:10:19 -05:00
Derrick Hammer bf25d7bfda
feat: use new file abstraction and use http.ServeContent 2024-01-24 19:08:13 -05:00
Derrick Hammer 95b57cffc0
fix: handle both cid and base64url hash 2024-01-24 17:15:21 -05:00
Derrick Hammer 562742fd8e
fix: disable auth for downloads temporarily 2024-01-24 17:07:50 -05:00
Derrick Hammer 523286df32
fix: use MaxUint32 2024-01-24 12:51:19 -05:00
Derrick Hammer 60c905181c
fix: manually encode list 2024-01-24 12:34:50 -05:00
Derrick Hammer c976ec31be
fix: create an AccountPinResponse with a custom msgpack encoder 2024-01-24 12:29:25 -05:00
Derrick Hammer b3f8b483db
Revert "debug: revert prefix hack"
This reverts commit 9002064937.
2024-01-24 09:51:13 -05:00
Derrick Hammer 9002064937
debug: revert prefix hack 2024-01-24 09:34:05 -05:00
Derrick Hammer a4137102e6
fix: import cycle 2024-01-24 03:36:03 -05:00
Derrick Hammer 6a2b1b4a9b
feat: implement provider store 2024-01-24 03:28:47 -05:00
Derrick Hammer 22eacc4af1
feat: implement /s5/download/:cid 2024-01-24 01:27:05 -05:00
Derrick Hammer 35cd041978
fix: can't use JapeMiddlewareFunc in type switch to cast 2024-01-22 17:06:39 -05:00
Derrick Hammer 2020a9f1d1
fix: change HttpMiddlewareFunc to not have a variable name 2024-01-22 17:03:54 -05:00
Derrick Hammer 6402410d75
fix: use HttpMiddlewareFunc 2024-01-22 17:00:57 -05:00
Derrick Hammer 2cc600b78b
fix: api routes need to use ApplyMiddlewares 2024-01-22 16:59:14 -05:00
Derrick Hammer 527334f829
refactor: create generic AdaptMiddleware factory and change ApplyMiddlewares to take interfaces and handle multiple situations 2024-01-22 16:50:03 -05:00
Derrick Hammer 60e917120d
fix: only add slash if path is empty 2024-01-20 10:37:33 -05:00
Derrick Hammer c5b0865977
fix: need to create a custom version of strip prefix that appends a trailing slash for the router 2024-01-20 10:33:18 -05:00
Derrick Hammer 75e7ba00cd
fix: query needs to be manually built and re-encoded 2024-01-20 08:22:51 -05:00
Derrick Hammer 07c36109d8
refactor: move strip prefix to be last 2024-01-20 08:15:27 -05:00
Derrick Hammer 24e841ae97
fix: use new copy of request 2024-01-20 08:13:17 -05:00
Derrick Hammer a1e7cda659
refactor: move injectJwt to be processed after authMiddlewareFunc 2024-01-20 08:12:50 -05:00
Derrick Hammer 9bf10b19bf
refactor: add current request to tusJwtResponseWriter 2024-01-20 08:12:30 -05:00
Derrick Hammer 73fa265939
feat: implement tusJwtResponseWriter WriteHeader 2024-01-20 08:06:50 -05:00
Derrick Hammer a56fa20b6d
refactor: split findAuthToken to parseAuthTokenHeader 2024-01-20 08:03:26 -05:00
Derrick Hammer 1d1c552a0a
refactor: explicitly check the path and only for post 2024-01-20 07:57:09 -05:00
Derrick Hammer a2051acff1
feat: add initial tusJwtResponseWriter bones so we can append the auth_token to tus urls 2024-01-20 07:54:24 -05:00
Derrick Hammer b50c6c9f85
fix: dont put leading slash in prefix 2024-01-20 06:03:07 -05:00
Derrick Hammer 43e52e1ae1
fix: wrong prefix 2024-01-20 06:01:42 -05:00
Derrick Hammer fdef217078
fix: need to add a strip prefix middleware 2024-01-20 05:50:54 -05:00
Derrick Hammer fba3ee4213
fix: we don't need to wrap the tus middleware as NewHandler does it for us 2024-01-20 05:45:13 -05:00
Derrick Hammer 60c7cc5c6c
refactor: fix import cycles 2024-01-19 17:12:26 -05:00
Derrick Hammer 1f7c05434a
refactor: fix import cycles 2024-01-19 17:11:16 -05:00
Derrick Hammer 72219eb59c
feat: add tus endpoints 2024-01-19 17:08:55 -05:00
Derrick Hammer 2e64b56115
refactor: need to use middleware package 2024-01-19 17:08:05 -05:00
Derrick Hammer 5b1838a63b
feat: create tus api builder 2024-01-19 17:06:41 -05:00
Derrick Hammer 26c28db1f2
feat: create ApplyMiddlewares helper 2024-01-19 17:05:18 -05:00
Derrick Hammer e9db71f3b8
refactor: move middleware to its own package to prevent import cycles 2024-01-19 17:04:25 -05:00
Derrick Hammer 2c30477465
refactor: update putfile and gethash call names 2024-01-19 15:52:26 -05:00
Derrick Hammer 8044591697
feat: support auth in header, cookie, and query arg 2024-01-18 20:56:49 -05:00
Derrick Hammer 82f34726d6
debug: add logging 2024-01-18 14:38:15 -05:00
Derrick Hammer 12de0342f5
debug: add logging 2024-01-18 14:28:32 -05:00
Derrick Hammer 8161d36f0e
fix: bad response for existing file 2024-01-18 13:53:04 -05:00
Derrick Hammer 677635aa08
refactor: remove auth from metadata endpoint 2024-01-18 12:18:45 -05:00
Derrick Hammer f957ef5d78
feat: implement /s5/metadata/:cid 2024-01-17 22:19:42 -05:00
Derrick Hammer 510a57162c
feat: implement /s5/debug/storage_locations/:hash 2024-01-17 22:02:36 -05:00
Derrick Hammer 0c88e80a66
feat: implement /s5/blob/:cid 2024-01-17 21:23:33 -05:00
Derrick Hammer dfd03673c9
fix: pin the file if it exists 2024-01-17 17:21:15 -05:00
Derrick Hammer 7fde67aea5
fix: use PinByID and pin after creating the upload 2024-01-17 17:16:12 -05:00
Derrick Hammer b3e1840fac
fix: missing http verb 2024-01-17 16:59:53 -05:00
Derrick Hammer 72c3167e5f
feat: implement POST /s5/registry/subscription 2024-01-17 16:46:13 -05:00
Derrick Hammer acb9604b02
feat: implement POST /s5/registry 2024-01-17 16:20:51 -05:00
Derrick Hammer cde3f90d2d
feat: implement GET /s5/registry 2024-01-17 16:05:31 -05:00
Derrick Hammer 7248570e6b
feat: implement /s5/debug/download_urls/:cid 2024-01-17 15:36:21 -05:00
Derrick Hammer c338a41efd
refactor: use CreateUpload 2024-01-17 14:49:35 -05:00
Derrick Hammer 5fec2f08ff
feat: implement /s5/upload/directory 2024-01-17 14:46:37 -05:00
Derrick Hammer 6a8a3c436a
feat: implement /s5/pin/:cid 2024-01-17 13:13:37 -05:00
Derrick Hammer 66dabf5150
feat: implement /s5/delete/:cid 2024-01-17 13:04:32 -05:00
Derrick Hammer a5cbb4c4fb
fix: tier to use AccountTier struct 2024-01-17 12:38:52 -05:00
Derrick Hammer 1cf2d9880c
feat: add /s5/account/pins.bin endpoint 2024-01-17 12:33:05 -05:00
Derrick Hammer cf422aef0e
feat: add /s5/account/stats endpoint 2024-01-17 12:03:08 -05:00
Derrick Hammer ef872bf344
feat: add /s5/account endpoint 2024-01-17 11:52:54 -05:00
Derrick Hammer 897fec75ad
fix: update use of CIDFromHash 2024-01-17 11:31:48 -05:00
Derrick Hammer 708bd82879
fix: need to seek to reset reader 2024-01-17 11:04:24 -05:00
Derrick Hammer 03f0d80ae5
fix: use AuthUserIDKey in context 2024-01-17 09:09:48 -05:00
Derrick Hammer a41cdbf52c
fix: use the userid context key 2024-01-17 09:05:39 -05:00
Derrick Hammer 1d019d905b
fix: use a type switch 2024-01-17 09:02:13 -05:00
Derrick Hammer af71f68ea9
fix: needs to be uint64 2024-01-17 08:58:58 -05:00
Derrick Hammer bf65e845f3
fix: access sub directly 2024-01-17 08:57:45 -05:00
Derrick Hammer e9aa676d94
fix: use public key, not private 2024-01-17 08:53:10 -05:00
Derrick Hammer 224d7a636d
fix: need to check the decoded public key in hex format 2024-01-17 08:47:58 -05:00
Derrick Hammer e31672aad0
feat: add support for checking the user account and storing in a new context 2024-01-17 08:43:32 -05:00
Derrick Hammer ae0bddf3d1
feat: add jwt auth middleware 2024-01-17 08:16:03 -05:00
Derrick Hammer 1054c52e2f
fix: if email is empty set to a dummy address based on the pubkey 2024-01-16 16:16:37 -05:00
Derrick Hammer dd66f560ef
fix: make email optional 2024-01-16 16:15:50 -05:00
Derrick Hammer d237b42314
fix: if pubkey isnt registered, error 2024-01-16 16:05:28 -05:00
Derrick Hammer f8d0dc6787
fix: delete challenges after they have been used 2024-01-16 15:48:45 -05:00
Derrick Hammer 6c34b383d7
fix: verify the response, not the challenge 2024-01-16 15:37:08 -05:00
Derrick Hammer bc5957f881
fix: need to pass the pubkey without the prefix and encoded to hex 2024-01-16 15:30:00 -05:00
Derrick Hammer accffade40
fix: update error handling 2024-01-16 15:26:57 -05:00
Derrick Hammer f34f009f17
fix: key needs to be 33 bytes 2024-01-16 15:26:36 -05:00
Derrick Hammer e1709a7910
fix: update error handling 2024-01-16 15:23:00 -05:00
Derrick Hammer d74d29e2c5
fix: check that key is 33 bytes and is a ed25519 2024-01-16 15:22:48 -05:00
Derrick Hammer 09216e2817
fix: challenge needs to be base64url encoded 2024-01-16 15:12:05 -05:00
Derrick Hammer db46fcd774
fix: check the challenge substring 2024-01-16 14:45:07 -05:00
Derrick Hammer 1b680dd399
fix: validate without key prefix 2024-01-16 14:43:26 -05:00
Derrick Hammer dd5c6332f3
fix: response must be 65 bytes 2024-01-16 14:32:53 -05:00
Derrick Hammer 5d393c3915
fix: pubkey missing from challenge record 2024-01-16 14:22:16 -05:00
Derrick Hammer 40479d8bb3
fix: wrong account paths 2024-01-16 13:57:33 -05:00
Derrick Hammer ec9026c8b1
feat: implement AccountLogin 2024-01-16 13:56:25 -05:00
Derrick Hammer eee1faab18
feat: implement AccountLoginChallenge 2024-01-16 13:51:03 -05:00
Derrick Hammer 17441ff674
refactor: use setAuthCookie helper 2024-01-16 13:38:10 -05:00
Derrick Hammer 891ca20a72
feat: implement AccountRegister, and switch to using structs for request/response 2024-01-16 13:32:47 -05:00
Derrick Hammer c4f0226d1a
refactor: re-implement s5 routes 2024-01-16 12:20:43 -05:00
Derrick Hammer 4b56de03a3
fix: fix policies 2024-01-15 23:56:44 -05:00
Derrick Hammer 1ccc5d1141
fix: fix policies 2024-01-15 23:46:54 -05:00
Derrick Hammer 46dbfe77bc
fix: update def's 2024-01-15 23:41:13 -05:00
Derrick Hammer e40111a276
fix: sec was not used 2024-01-15 23:15:57 -05:00
Derrick Hammer b2d863d466
Revert "fix: refactor AddPolicy"
This reverts commit 17f16c53af.
2024-01-15 23:08:44 -05:00
Derrick Hammer 17f16c53af
fix: refactor AddPolicy 2024-01-15 23:07:44 -05:00
Derrick Hammer f0b92aa2d6
fix: need to load policies 2024-01-15 22:53:51 -05:00
Derrick Hammer 87ebf5012b
fix: policies need to be added after 2024-01-15 22:53:12 -05:00
Derrick Hammer 05c0aba484
feat: initial casbin support 2024-01-15 22:01:40 -05:00
Derrick Hammer 7ef2f819a8
fix: use GetHttpRouter 2024-01-15 07:56:37 -05:00
Derrick Hammer a54341dd68
fix: subdomain comes before domain 2024-01-11 23:22:56 -05:00
Derrick Hammer a57e575a82
fix: change config path 2024-01-11 23:22:33 -05:00
Derrick Hammer 519426ba7d
feat: bare bones s5 support, and more dynamic loading of subsystems 2024-01-11 23:13:10 -05:00
Derrick Hammer 444de35e31
feat: initial new portal bones 2024-01-11 19:11:53 -05:00