@fedify/fedify 0.5.0-dev.88
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.
Potentially problematic release.
This version of @fedify/fedify might be problematic. Click here for more details.
- package/CHANGES.md +239 -0
- package/LICENSE +661 -0
- package/README.md +96 -0
- package/esm/_dnt.shims.d.ts +11 -0
- package/esm/_dnt.shims.d.ts.map +1 -0
- package/esm/_dnt.shims.js +67 -0
- package/esm/_dnt.test_polyfills.d.ts.map +1 -0
- package/esm/_dnt.test_shims.d.ts.map +1 -0
- package/esm/codegen/fs.d.ts.map +1 -0
- package/esm/codegen/schema.d.ts.map +1 -0
- package/esm/codegen/schema.yaml +194 -0
- package/esm/codegen/type.d.ts.map +1 -0
- package/esm/deps/crux.land/api/get/2KNRVU.d.ts.map +1 -0
- package/esm/deps/deno.land/x/mock_fetch@0.3.0/mod.d.ts.map +1 -0
- package/esm/deps/jsr.io/@david/which-runtime/0.2.0/mod.d.ts.map +1 -0
- package/esm/deps/jsr.io/@hongminhee/aitertools/0.6.0/mod.d.ts.map +1 -0
- package/esm/deps/jsr.io/@hongminhee/aitertools/0.6.0/src/collections.d.ts.map +1 -0
- package/esm/deps/jsr.io/@hongminhee/aitertools/0.6.0/src/concat.d.ts.map +1 -0
- package/esm/deps/jsr.io/@hongminhee/aitertools/0.6.0/src/drop.d.ts.map +1 -0
- package/esm/deps/jsr.io/@hongminhee/aitertools/0.6.0/src/filter.d.ts.map +1 -0
- package/esm/deps/jsr.io/@hongminhee/aitertools/0.6.0/src/fold.d.ts.map +1 -0
- package/esm/deps/jsr.io/@hongminhee/aitertools/0.6.0/src/infinite.d.ts.map +1 -0
- package/esm/deps/jsr.io/@hongminhee/aitertools/0.6.0/src/map.d.ts.map +1 -0
- package/esm/deps/jsr.io/@hongminhee/aitertools/0.6.0/src/mod.d.ts.map +1 -0
- package/esm/deps/jsr.io/@hongminhee/aitertools/0.6.0/src/range.d.ts.map +1 -0
- package/esm/deps/jsr.io/@hongminhee/aitertools/0.6.0/src/take.d.ts.map +1 -0
- package/esm/deps/jsr.io/@hongminhee/aitertools/0.6.0/src/tee.d.ts.map +1 -0
- package/esm/deps/jsr.io/@hongminhee/aitertools/0.6.0/src/testing.d.ts.map +1 -0
- package/esm/deps/jsr.io/@hongminhee/aitertools/0.6.0/src/unique.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/0.220.1/_constants.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/0.220.1/_diff.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/0.220.1/_format.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/0.220.1/assert.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/0.220.1/assert_almost_equals.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/0.220.1/assert_array_includes.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/0.220.1/assert_equals.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/0.220.1/assert_exists.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/0.220.1/assert_false.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/0.220.1/assert_greater.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/0.220.1/assert_greater_or_equal.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/0.220.1/assert_instance_of.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/0.220.1/assert_is_error.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/0.220.1/assert_less.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/0.220.1/assert_less_or_equal.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/0.220.1/assert_match.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/0.220.1/assert_not_equals.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/0.220.1/assert_not_instance_of.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/0.220.1/assert_not_match.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/0.220.1/assert_not_strict_equals.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/0.220.1/assert_object_match.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/0.220.1/assert_rejects.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/0.220.1/assert_strict_equals.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/0.220.1/assert_string_includes.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/0.220.1/assert_throws.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/0.220.1/assertion_error.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/0.220.1/equal.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/0.220.1/fail.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/0.220.1/mod.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/0.220.1/unimplemented.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/0.220.1/unreachable.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/bytes/0.220.1/concat.d.ts +14 -0
- package/esm/deps/jsr.io/@std/bytes/0.220.1/concat.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/bytes/0.220.1/concat.js +27 -0
- package/esm/deps/jsr.io/@std/bytes/0.220.1/copy.d.ts +28 -0
- package/esm/deps/jsr.io/@std/bytes/0.220.1/copy.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/bytes/0.220.1/copy.js +37 -0
- package/esm/deps/jsr.io/@std/bytes/0.220.1/ends_with.d.ts +14 -0
- package/esm/deps/jsr.io/@std/bytes/0.220.1/ends_with.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/bytes/0.220.1/ends_with.js +23 -0
- package/esm/deps/jsr.io/@std/bytes/0.220.1/equals.d.ts +6 -0
- package/esm/deps/jsr.io/@std/bytes/0.220.1/equals.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/bytes/0.220.1/equals.js +44 -0
- package/esm/deps/jsr.io/@std/bytes/0.220.1/includes_needle.d.ts +17 -0
- package/esm/deps/jsr.io/@std/bytes/0.220.1/includes_needle.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/bytes/0.220.1/includes_needle.js +21 -0
- package/esm/deps/jsr.io/@std/bytes/0.220.1/index_of_needle.d.ts +18 -0
- package/esm/deps/jsr.io/@std/bytes/0.220.1/index_of_needle.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/bytes/0.220.1/index_of_needle.js +45 -0
- package/esm/deps/jsr.io/@std/bytes/0.220.1/last_index_of_needle.d.ts +18 -0
- package/esm/deps/jsr.io/@std/bytes/0.220.1/last_index_of_needle.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/bytes/0.220.1/last_index_of_needle.js +45 -0
- package/esm/deps/jsr.io/@std/bytes/0.220.1/mod.d.ts +24 -0
- package/esm/deps/jsr.io/@std/bytes/0.220.1/mod.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/bytes/0.220.1/mod.js +25 -0
- package/esm/deps/jsr.io/@std/bytes/0.220.1/repeat.d.ts +15 -0
- package/esm/deps/jsr.io/@std/bytes/0.220.1/repeat.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/bytes/0.220.1/repeat.js +33 -0
- package/esm/deps/jsr.io/@std/bytes/0.220.1/starts_with.d.ts +14 -0
- package/esm/deps/jsr.io/@std/bytes/0.220.1/starts_with.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/bytes/0.220.1/starts_with.js +21 -0
- package/esm/deps/jsr.io/@std/encoding/0.220.1/_util.d.ts +2 -0
- package/esm/deps/jsr.io/@std/encoding/0.220.1/_util.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/encoding/0.220.1/_util.js +26 -0
- package/esm/deps/jsr.io/@std/encoding/0.220.1/base64.d.ts +27 -0
- package/esm/deps/jsr.io/@std/encoding/0.220.1/base64.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/encoding/0.220.1/base64.js +141 -0
- package/esm/deps/jsr.io/@std/fmt/0.220.1/colors.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/fs/0.220.1/_get_file_info_type.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/fs/0.220.1/_to_path_string.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/fs/0.220.1/ensure_dir.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/fs/0.220.1/ensure_file.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/http/0.220.1/_negotiation/common.d.ts +38 -0
- package/esm/deps/jsr.io/@std/http/0.220.1/_negotiation/common.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/http/0.220.1/_negotiation/common.js +40 -0
- package/esm/deps/jsr.io/@std/http/0.220.1/_negotiation/encoding.d.ts +34 -0
- package/esm/deps/jsr.io/@std/http/0.220.1/_negotiation/encoding.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/http/0.220.1/_negotiation/encoding.js +121 -0
- package/esm/deps/jsr.io/@std/http/0.220.1/_negotiation/language.d.ts +31 -0
- package/esm/deps/jsr.io/@std/http/0.220.1/_negotiation/language.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/http/0.220.1/_negotiation/language.js +113 -0
- package/esm/deps/jsr.io/@std/http/0.220.1/_negotiation/media_type.d.ts +31 -0
- package/esm/deps/jsr.io/@std/http/0.220.1/_negotiation/media_type.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/http/0.220.1/_negotiation/media_type.js +140 -0
- package/esm/deps/jsr.io/@std/http/0.220.1/negotiation.d.ts +128 -0
- package/esm/deps/jsr.io/@std/http/0.220.1/negotiation.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/http/0.220.1/negotiation.js +37 -0
- package/esm/deps/jsr.io/@std/path/0.220.1/_common/assert_path.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/path/0.220.1/_common/basename.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/path/0.220.1/_common/common.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/path/0.220.1/_common/constants.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/path/0.220.1/_common/dirname.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/path/0.220.1/_common/format.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/path/0.220.1/_common/from_file_url.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/path/0.220.1/_common/glob_to_reg_exp.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/path/0.220.1/_common/normalize.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/path/0.220.1/_common/normalize_string.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/path/0.220.1/_common/relative.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/path/0.220.1/_common/strip_trailing_separators.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/path/0.220.1/_common/to_file_url.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/path/0.220.1/_interface.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/path/0.220.1/_os.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/path/0.220.1/basename.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/path/0.220.1/common.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/path/0.220.1/constants.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/path/0.220.1/dirname.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/path/0.220.1/extname.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/path/0.220.1/format.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/path/0.220.1/from_file_url.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/path/0.220.1/glob_to_regexp.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/path/0.220.1/is_absolute.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/path/0.220.1/is_glob.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/path/0.220.1/join.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/path/0.220.1/join_globs.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/path/0.220.1/mod.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/path/0.220.1/normalize.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/path/0.220.1/normalize_glob.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/path/0.220.1/parse.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/path/0.220.1/posix/_util.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/path/0.220.1/posix/basename.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/path/0.220.1/posix/common.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/path/0.220.1/posix/constants.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/path/0.220.1/posix/dirname.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/path/0.220.1/posix/extname.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/path/0.220.1/posix/format.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/path/0.220.1/posix/from_file_url.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/path/0.220.1/posix/glob_to_regexp.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/path/0.220.1/posix/is_absolute.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/path/0.220.1/posix/is_glob.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/path/0.220.1/posix/join.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/path/0.220.1/posix/join_globs.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/path/0.220.1/posix/mod.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/path/0.220.1/posix/normalize.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/path/0.220.1/posix/normalize_glob.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/path/0.220.1/posix/parse.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/path/0.220.1/posix/relative.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/path/0.220.1/posix/resolve.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/path/0.220.1/posix/to_file_url.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/path/0.220.1/posix/to_namespaced_path.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/path/0.220.1/relative.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/path/0.220.1/resolve.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/path/0.220.1/to_file_url.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/path/0.220.1/to_namespaced_path.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/path/0.220.1/windows/_util.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/path/0.220.1/windows/basename.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/path/0.220.1/windows/common.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/path/0.220.1/windows/constants.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/path/0.220.1/windows/dirname.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/path/0.220.1/windows/extname.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/path/0.220.1/windows/format.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/path/0.220.1/windows/from_file_url.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/path/0.220.1/windows/glob_to_regexp.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/path/0.220.1/windows/is_absolute.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/path/0.220.1/windows/is_glob.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/path/0.220.1/windows/join.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/path/0.220.1/windows/join_globs.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/path/0.220.1/windows/mod.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/path/0.220.1/windows/normalize.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/path/0.220.1/windows/normalize_glob.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/path/0.220.1/windows/parse.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/path/0.220.1/windows/relative.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/path/0.220.1/windows/resolve.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/path/0.220.1/windows/to_file_url.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/path/0.220.1/windows/to_namespaced_path.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/_constants.d.ts +2 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/_constants.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/_constants.js +10 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/_shared.d.ts +44 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/_shared.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/_shared.js +161 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/can_parse.d.ts +2 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/can_parse.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/can_parse.js +14 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/compare.d.ts +11 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/compare.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/compare.js +18 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/constants.d.ts +43 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/constants.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/constants.js +73 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/difference.d.ts +6 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/difference.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/difference.js +16 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/equals.d.ts +8 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/equals.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/equals.js +10 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/format.d.ts +13 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/format.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/format.js +36 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/format_range.d.ts +9 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/format_range.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/format_range.js +16 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/greater_or_equal.d.ts +8 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/greater_or_equal.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/greater_or_equal.js +9 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/greater_than.d.ts +8 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/greater_than.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/greater_than.js +10 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/increment.d.ts +29 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/increment.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/increment.js +160 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/is_range.d.ts +13 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/is_range.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/is_range.js +28 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/is_semver.d.ts +18 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/is_semver.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/is_semver.js +38 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/less_or_equal.d.ts +8 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/less_or_equal.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/less_or_equal.js +9 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/less_than.d.ts +8 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/less_than.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/less_than.js +9 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/max_satisfying.d.ts +10 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/max_satisfying.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/max_satisfying.js +18 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/min_satisfying.d.ts +10 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/min_satisfying.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/min_satisfying.js +18 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/mod.d.ts +291 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/mod.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/mod.js +293 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/not_equals.d.ts +8 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/not_equals.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/not_equals.js +9 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/parse.d.ts +9 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/parse.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/parse.js +34 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/parse_range.d.ts +8 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/parse_range.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/parse_range.js +336 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/range_intersects.d.ts +9 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/range_intersects.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/range_intersects.js +72 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/range_max.d.ts +8 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/range_max.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/range_max.js +58 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/range_min.d.ts +8 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/range_min.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/range_min.js +49 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/test_range.d.ts +9 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/test_range.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/test_range.js +69 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/try_parse.d.ts +8 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/try_parse.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/try_parse.js +17 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/try_parse_range.d.ts +8 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/try_parse_range.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/try_parse_range.js +17 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/types.d.ts +38 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/types.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/types.js +2 -0
- package/esm/deps/jsr.io/@std/testing/0.220.1/snapshot.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/text/0.220.1/_util.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/text/0.220.1/case.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/text/0.220.1/closest_string.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/text/0.220.1/compare_similarity.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/text/0.220.1/levenshtein_distance.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/text/0.220.1/mod.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/text/0.220.1/word_similarity_sort.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/url/0.220.1/_strip.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/url/0.220.1/basename.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/url/0.220.1/dirname.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/url/0.220.1/extname.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/url/0.220.1/join.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/url/0.220.1/mod.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/url/0.220.1/normalize.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/0.220.1/_dumper/dumper.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/0.220.1/_dumper/dumper_state.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/0.220.1/_error.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/0.220.1/_loader/loader.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/0.220.1/_loader/loader_state.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/0.220.1/_mark.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/0.220.1/_state.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/0.220.1/_type/binary.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/0.220.1/_type/bool.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/0.220.1/_type/float.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/0.220.1/_type/function.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/0.220.1/_type/int.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/0.220.1/_type/map.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/0.220.1/_type/merge.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/0.220.1/_type/mod.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/0.220.1/_type/nil.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/0.220.1/_type/omap.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/0.220.1/_type/pairs.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/0.220.1/_type/regexp.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/0.220.1/_type/seq.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/0.220.1/_type/set.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/0.220.1/_type/str.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/0.220.1/_type/timestamp.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/0.220.1/_type/undefined.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/0.220.1/_utils.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/0.220.1/mod.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/0.220.1/parse.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/0.220.1/schema/core.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/0.220.1/schema/default.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/0.220.1/schema/extended.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/0.220.1/schema/failsafe.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/0.220.1/schema/json.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/0.220.1/schema/mod.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/0.220.1/schema.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/0.220.1/stringify.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/0.220.1/type.d.ts.map +1 -0
- package/esm/federation/callback.d.ts +56 -0
- package/esm/federation/callback.d.ts.map +1 -0
- package/esm/federation/callback.js +1 -0
- package/esm/federation/collection.d.ts +9 -0
- package/esm/federation/collection.d.ts.map +1 -0
- package/esm/federation/collection.js +1 -0
- package/esm/federation/context.d.ts +148 -0
- package/esm/federation/context.d.ts.map +1 -0
- package/esm/federation/context.js +1 -0
- package/esm/federation/handler.d.ts +83 -0
- package/esm/federation/handler.d.ts.map +1 -0
- package/esm/federation/handler.js +266 -0
- package/esm/federation/handler.test.d.ts.map +1 -0
- package/esm/federation/kv.d.ts +58 -0
- package/esm/federation/kv.d.ts.map +1 -0
- package/esm/federation/kv.js +45 -0
- package/esm/federation/middleware.d.ts +309 -0
- package/esm/federation/middleware.d.ts.map +1 -0
- package/esm/federation/middleware.js +626 -0
- package/esm/federation/middleware.test.d.ts.map +1 -0
- package/esm/federation/mod.d.ts +14 -0
- package/esm/federation/mod.d.ts.map +1 -0
- package/esm/federation/mod.js +13 -0
- package/esm/federation/mq.d.ts +42 -0
- package/esm/federation/mq.d.ts.map +1 -0
- package/esm/federation/mq.js +26 -0
- package/esm/federation/queue.d.ts +10 -0
- package/esm/federation/queue.d.ts.map +1 -0
- package/esm/federation/queue.js +1 -0
- package/esm/federation/router.d.ts +52 -0
- package/esm/federation/router.d.ts.map +1 -0
- package/esm/federation/router.js +80 -0
- package/esm/federation/router.test.d.ts.map +1 -0
- package/esm/federation/send.d.ts +60 -0
- package/esm/federation/send.d.ts.map +1 -0
- package/esm/federation/send.js +45 -0
- package/esm/federation/send.test.d.ts.map +1 -0
- package/esm/httpsig/key.d.ts +32 -0
- package/esm/httpsig/key.d.ts.map +1 -0
- package/esm/httpsig/key.js +62 -0
- package/esm/httpsig/key.test.d.ts.map +1 -0
- package/esm/httpsig/mod.d.ts +47 -0
- package/esm/httpsig/mod.d.ts.map +1 -0
- package/esm/httpsig/mod.js +193 -0
- package/esm/httpsig/mod.test.d.ts.map +1 -0
- package/esm/mod.d.ts +51 -0
- package/esm/mod.d.ts.map +1 -0
- package/esm/mod.js +50 -0
- package/esm/nodeinfo/handler.d.ts +33 -0
- package/esm/nodeinfo/handler.d.ts.map +1 -0
- package/esm/nodeinfo/handler.js +49 -0
- package/esm/nodeinfo/handler.test.d.ts.map +1 -0
- package/esm/nodeinfo/mod.d.ts +8 -0
- package/esm/nodeinfo/mod.d.ts.map +1 -0
- package/esm/nodeinfo/mod.js +7 -0
- package/esm/nodeinfo/types.d.ts +133 -0
- package/esm/nodeinfo/types.d.ts.map +1 -0
- package/esm/nodeinfo/types.js +60 -0
- package/esm/nodeinfo/types.test.d.ts.map +1 -0
- package/esm/package.json +3 -0
- package/esm/runtime/docloader.d.ts +104 -0
- package/esm/runtime/docloader.d.ts.map +1 -0
- package/esm/runtime/docloader.js +124 -0
- package/esm/runtime/docloader.test.d.ts.map +1 -0
- package/esm/runtime/key.d.ts +14 -0
- package/esm/runtime/key.d.ts.map +1 -0
- package/esm/runtime/key.js +24 -0
- package/esm/runtime/key.test.d.ts.map +1 -0
- package/esm/runtime/langstr.d.ts +15 -0
- package/esm/runtime/langstr.d.ts.map +1 -0
- package/esm/runtime/langstr.js +25 -0
- package/esm/runtime/langstr.test.d.ts.map +1 -0
- package/esm/runtime/mod.d.ts +10 -0
- package/esm/runtime/mod.d.ts.map +1 -0
- package/esm/runtime/mod.js +9 -0
- package/esm/shim/event.d.ts.map +1 -0
- package/esm/testing/context.d.ts.map +1 -0
- package/esm/testing/docloader.d.ts.map +1 -0
- package/esm/testing/fixtures/example.com/hong-gildong +11 -0
- package/esm/testing/fixtures/example.com/key +7 -0
- package/esm/testing/fixtures/example.com/key2 +6 -0
- package/esm/testing/fixtures/example.com/object +6 -0
- package/esm/testing/fixtures/example.com/person +22 -0
- package/esm/testing/fixtures/example.com/test +5 -0
- package/esm/testing/fixtures/example.com/users/handle +16 -0
- package/esm/testing/fixtures/example.com/wrong-type +3 -0
- package/esm/testing/fixtures/w3id.org/security/v1 +50 -0
- package/esm/testing/fixtures/www.w3.org/ns/activitystreams +379 -0
- package/esm/testing/keys.d.ts.map +1 -0
- package/esm/vocab/accept.yaml +11 -0
- package/esm/vocab/activity.yaml +42 -0
- package/esm/vocab/actor.d.ts +52 -0
- package/esm/vocab/actor.d.ts.map +1 -0
- package/esm/vocab/actor.js +94 -0
- package/esm/vocab/actor.test.d.ts.map +1 -0
- package/esm/vocab/add.yaml +12 -0
- package/esm/vocab/announce.yaml +11 -0
- package/esm/vocab/application.yaml +179 -0
- package/esm/vocab/article.yaml +8 -0
- package/esm/vocab/audio.yaml +8 -0
- package/esm/vocab/block.yaml +12 -0
- package/esm/vocab/collection.yaml +63 -0
- package/esm/vocab/collectionpage.yaml +38 -0
- package/esm/vocab/create.yaml +8 -0
- package/esm/vocab/delete.yaml +10 -0
- package/esm/vocab/dislike.yaml +8 -0
- package/esm/vocab/document.yaml +8 -0
- package/esm/vocab/endpoints.yaml +78 -0
- package/esm/vocab/event.yaml +8 -0
- package/esm/vocab/flag.yaml +11 -0
- package/esm/vocab/follow.yaml +12 -0
- package/esm/vocab/group.yaml +179 -0
- package/esm/vocab/ignore.yaml +10 -0
- package/esm/vocab/image.yaml +8 -0
- package/esm/vocab/intransitiveactivity.yaml +11 -0
- package/esm/vocab/key.yaml +25 -0
- package/esm/vocab/like.yaml +10 -0
- package/esm/vocab/link.yaml +92 -0
- package/esm/vocab/lookup.d.ts +42 -0
- package/esm/vocab/lookup.d.ts.map +1 -0
- package/esm/vocab/lookup.js +82 -0
- package/esm/vocab/lookup.test.d.ts.map +1 -0
- package/esm/vocab/mention.yaml +8 -0
- package/esm/vocab/mod.d.ts +55 -0
- package/esm/vocab/mod.d.ts.map +1 -0
- package/esm/vocab/mod.js +54 -0
- package/esm/vocab/note.yaml +10 -0
- package/esm/vocab/object.yaml +301 -0
- package/esm/vocab/orderedcollection.yaml +11 -0
- package/esm/vocab/orderedcollectionpage.yaml +20 -0
- package/esm/vocab/organization.yaml +179 -0
- package/esm/vocab/page.yaml +8 -0
- package/esm/vocab/person.yaml +179 -0
- package/esm/vocab/place.yaml +66 -0
- package/esm/vocab/profile.yaml +22 -0
- package/esm/vocab/reject.yaml +10 -0
- package/esm/vocab/relationship.yaml +46 -0
- package/esm/vocab/remove.yaml +10 -0
- package/esm/vocab/service.yaml +179 -0
- package/esm/vocab/undo.yaml +15 -0
- package/esm/vocab/update.yaml +13 -0
- package/esm/vocab/video.yaml +8 -0
- package/esm/vocab/vocab.d.ts +7191 -0
- package/esm/vocab/vocab.d.ts.map +1 -0
- package/esm/vocab/vocab.js +14279 -0
- package/esm/vocab/vocab.test.d.ts.map +1 -0
- package/esm/webfinger/handler.d.ts +29 -0
- package/esm/webfinger/handler.d.ts.map +1 -0
- package/esm/webfinger/handler.js +76 -0
- package/esm/webfinger/handler.test.d.ts.map +1 -0
- package/esm/webfinger/jrd.d.ts +52 -0
- package/esm/webfinger/jrd.d.ts.map +1 -0
- package/esm/webfinger/jrd.js +1 -0
- package/esm/webfinger/lookup.d.ts +9 -0
- package/esm/webfinger/lookup.d.ts.map +1 -0
- package/esm/webfinger/lookup.js +44 -0
- package/esm/webfinger/lookup.test.d.ts.map +1 -0
- package/esm/webfinger/mod.d.ts +8 -0
- package/esm/webfinger/mod.d.ts.map +1 -0
- package/esm/webfinger/mod.js +7 -0
- package/esm/x/fresh.d.ts +58 -0
- package/esm/x/fresh.d.ts.map +1 -0
- package/esm/x/fresh.js +77 -0
- package/logo.svg +187 -0
- package/package.json +60 -0
@@ -0,0 +1,193 @@
|
|
1
|
+
/**
|
2
|
+
* The implementation of the [HTTP
|
3
|
+
* Signatures](https://datatracker.ietf.org/doc/html/draft-cavage-http-signatures-12).
|
4
|
+
*
|
5
|
+
* @module
|
6
|
+
*/
|
7
|
+
import * as dntShim from "../_dnt.shims.js";
|
8
|
+
import { Temporal } from "@js-temporal/polyfill";
|
9
|
+
import { equals } from "../deps/jsr.io/@std/bytes/0.220.1/mod.js";
|
10
|
+
import { decodeBase64, encodeBase64 } from "../deps/jsr.io/@std/encoding/0.220.1/base64.js";
|
11
|
+
import { isActor } from "../vocab/actor.js";
|
12
|
+
import { CryptographicKey, Object as ASObject, } from "../vocab/vocab.js";
|
13
|
+
import { validateCryptoKey } from "./key.js";
|
14
|
+
export { exportJwk, generateCryptoKeyPair, importJwk } from "./key.js";
|
15
|
+
/**
|
16
|
+
* Signs a request using the given private key.
|
17
|
+
* @param request The request to sign.
|
18
|
+
* @param privateKey The private key to use for signing.
|
19
|
+
* @param keyId The key ID to use for the signature. It will be used by the
|
20
|
+
* verifier.
|
21
|
+
* @returns The signed request.
|
22
|
+
* @throws {TypeError} If the private key is invalid or unsupported.
|
23
|
+
*/
|
24
|
+
export async function sign(request, privateKey, keyId) {
|
25
|
+
validateCryptoKey(privateKey, "private");
|
26
|
+
const url = new URL(request.url);
|
27
|
+
const body = request.method !== "GET" && request.method !== "HEAD"
|
28
|
+
? await request.arrayBuffer()
|
29
|
+
: null;
|
30
|
+
const headers = new Headers(request.headers);
|
31
|
+
if (!headers.has("Host")) {
|
32
|
+
headers.set("Host", url.host);
|
33
|
+
}
|
34
|
+
if (!headers.has("Digest") && body != null) {
|
35
|
+
const digest = await dntShim.crypto.subtle.digest("SHA-256", body);
|
36
|
+
headers.set("Digest", `sha-256=${encodeBase64(digest)}`);
|
37
|
+
}
|
38
|
+
if (!headers.has("Date")) {
|
39
|
+
headers.set("Date", new Date().toUTCString());
|
40
|
+
}
|
41
|
+
const serialized = [
|
42
|
+
["(request-target)", `${request.method.toLowerCase()} ${url.pathname}`],
|
43
|
+
...headers,
|
44
|
+
];
|
45
|
+
const headerNames = serialized.map(([name]) => name);
|
46
|
+
const message = serialized
|
47
|
+
.map(([name, value]) => `${name}: ${value.trim()}`).join("\n");
|
48
|
+
// TODO: support other than RSASSA-PKCS1-v1_5:
|
49
|
+
const signature = await dntShim.crypto.subtle.sign("RSASSA-PKCS1-v1_5", privateKey, new TextEncoder().encode(message));
|
50
|
+
const sigHeader = `keyId="${keyId.href}",headers="${headerNames.join(" ")}",signature="${encodeBase64(signature)}"`;
|
51
|
+
headers.set("Signature", sigHeader);
|
52
|
+
return new Request(request, {
|
53
|
+
headers,
|
54
|
+
body,
|
55
|
+
});
|
56
|
+
}
|
57
|
+
const supportedHashAlgorithms = {
|
58
|
+
"sha": "SHA-1",
|
59
|
+
"sha-256": "SHA-256",
|
60
|
+
"sha-512": "SHA-512",
|
61
|
+
};
|
62
|
+
/**
|
63
|
+
* Verifies the signature of a request.
|
64
|
+
*
|
65
|
+
* Note that this function consumes the request body, so it should not be used
|
66
|
+
* if the request body is already consumed. Consuming the request body after
|
67
|
+
* calling this function is okay, since this function clones the request
|
68
|
+
* under the hood.
|
69
|
+
* @param request The request to verify.
|
70
|
+
* @param documentLoader The document loader to use for fetching the public key.
|
71
|
+
* @param currentTime The current time. If not specified, the current time is
|
72
|
+
* used. This is useful for testing.
|
73
|
+
* @returns The public key of the verified signature, or `null` if the signature
|
74
|
+
* could not be verified.
|
75
|
+
*/
|
76
|
+
export async function verify(request, documentLoader, currentTime) {
|
77
|
+
request = request.clone();
|
78
|
+
const dateHeader = request.headers.get("Date");
|
79
|
+
if (dateHeader == null)
|
80
|
+
return null;
|
81
|
+
const sigHeader = request.headers.get("Signature");
|
82
|
+
if (sigHeader == null)
|
83
|
+
return null;
|
84
|
+
const digestHeader = request.headers.get("Digest");
|
85
|
+
if (request.method !== "GET" && request.method !== "HEAD" &&
|
86
|
+
digestHeader == null) {
|
87
|
+
return null;
|
88
|
+
}
|
89
|
+
let body = null;
|
90
|
+
if (digestHeader != null) {
|
91
|
+
body = await request.arrayBuffer();
|
92
|
+
const digests = digestHeader.split(",").map((pair) => pair.includes("=") ? pair.split("=", 2) : [pair, ""]);
|
93
|
+
let matched = false;
|
94
|
+
for (let [algo, digestBase64] of digests) {
|
95
|
+
algo = algo.trim().toLowerCase();
|
96
|
+
if (!(algo in supportedHashAlgorithms))
|
97
|
+
continue;
|
98
|
+
const digest = decodeBase64(digestBase64);
|
99
|
+
const expectedDigest = await dntShim.crypto.subtle.digest(supportedHashAlgorithms[algo], body);
|
100
|
+
if (!equals(digest, new Uint8Array(expectedDigest)))
|
101
|
+
return null;
|
102
|
+
matched = true;
|
103
|
+
}
|
104
|
+
if (!matched)
|
105
|
+
return null;
|
106
|
+
}
|
107
|
+
const date = Temporal.Instant.from(new Date(dateHeader).toISOString());
|
108
|
+
const now = currentTime ?? Temporal.Now.instant();
|
109
|
+
if (Temporal.Instant.compare(date, now.add({ seconds: 30 })) > 0) {
|
110
|
+
// Too far in the future
|
111
|
+
return null;
|
112
|
+
}
|
113
|
+
else if (Temporal.Instant.compare(date, now.subtract({ seconds: 30 })) < 0) {
|
114
|
+
// Too far in the past
|
115
|
+
return null;
|
116
|
+
}
|
117
|
+
const sigValues = Object.fromEntries(sigHeader.split(",").map((pair) => pair.match(/^\s*([A-Za-z]+)="([^"]*)"\s*$/)).filter((m) => m != null).map((m) => m.slice(1, 3)));
|
118
|
+
if (!("keyId" in sigValues && "headers" in sigValues &&
|
119
|
+
"signature" in sigValues)) {
|
120
|
+
return null;
|
121
|
+
}
|
122
|
+
const { keyId, headers, signature } = sigValues;
|
123
|
+
const { document } = await documentLoader(keyId);
|
124
|
+
let object;
|
125
|
+
try {
|
126
|
+
object = await ASObject.fromJsonLd(document, { documentLoader });
|
127
|
+
}
|
128
|
+
catch (e) {
|
129
|
+
if (!(e instanceof TypeError))
|
130
|
+
throw e;
|
131
|
+
try {
|
132
|
+
object = await CryptographicKey.fromJsonLd(document, { documentLoader });
|
133
|
+
}
|
134
|
+
catch (e) {
|
135
|
+
if (e instanceof TypeError)
|
136
|
+
return null;
|
137
|
+
throw e;
|
138
|
+
}
|
139
|
+
}
|
140
|
+
let key = null;
|
141
|
+
if (object instanceof CryptographicKey)
|
142
|
+
key = object;
|
143
|
+
else if (isActor(object)) {
|
144
|
+
for await (const k of object.getPublicKeys({ documentLoader })) {
|
145
|
+
if (k.id?.href === keyId) {
|
146
|
+
key = k;
|
147
|
+
break;
|
148
|
+
}
|
149
|
+
}
|
150
|
+
if (key == null)
|
151
|
+
return null;
|
152
|
+
}
|
153
|
+
else
|
154
|
+
return null;
|
155
|
+
if (key.publicKey == null)
|
156
|
+
return null;
|
157
|
+
const headerNames = headers.split(/\s+/g);
|
158
|
+
if (!headerNames.includes("(request-target)") || !headerNames.includes("date")) {
|
159
|
+
return null;
|
160
|
+
}
|
161
|
+
if (body != null && !headerNames.includes("digest"))
|
162
|
+
return null;
|
163
|
+
const message = headerNames.map((name) => `${name}: ` +
|
164
|
+
(name == "(request-target)"
|
165
|
+
? `${request.method.toLowerCase()} ${new URL(request.url).pathname}`
|
166
|
+
: name == "host"
|
167
|
+
? request.headers.get("host") ?? new URL(request.url).host
|
168
|
+
: request.headers.get(name))).join("\n");
|
169
|
+
const sig = decodeBase64(signature);
|
170
|
+
// TODO: support other than RSASSA-PKCS1-v1_5:
|
171
|
+
const verified = await dntShim.crypto.subtle.verify("RSASSA-PKCS1-v1_5", key.publicKey, sig, new TextEncoder().encode(message));
|
172
|
+
return verified ? key : null;
|
173
|
+
}
|
174
|
+
/**
|
175
|
+
* Checks if the actor of the given activity owns the specified key.
|
176
|
+
* @param activity The activity to check.
|
177
|
+
* @param key The public key to check.
|
178
|
+
* @param documentLoader The document loader to use for fetching the actor.
|
179
|
+
* @returns Whether the actor is the owner of the key.
|
180
|
+
*/
|
181
|
+
export async function doesActorOwnKey(activity, key, documentLoader) {
|
182
|
+
if (key.ownerId != null) {
|
183
|
+
return key.ownerId.href === activity.actorId?.href;
|
184
|
+
}
|
185
|
+
const actor = await activity.getActor({ documentLoader });
|
186
|
+
if (actor == null || !isActor(actor))
|
187
|
+
return false;
|
188
|
+
for (const publicKeyId of actor.publicKeyIds) {
|
189
|
+
if (key.id != null && publicKeyId.href === key.id.href)
|
190
|
+
return true;
|
191
|
+
}
|
192
|
+
return false;
|
193
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"mod.test.d.ts","sourceRoot":"","sources":["../../src/httpsig/mod.test.ts"],"names":[],"mappings":"AAAA,OAAO,2BAA2B,CAAC"}
|
package/esm/mod.d.ts
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
/**
|
2
|
+
* Fedify: a fediverse server framework
|
3
|
+
* ====================================
|
4
|
+
*
|
5
|
+
* Fedify is a [Deno]/TypeScript library for building federated server apps
|
6
|
+
* powered by [ActivityPub] and other standards, which is so-called [fediverse].
|
7
|
+
* It aims to eliminate the complexity and redundant boilerplate code when
|
8
|
+
* building a federated server app, so that you can focus on your business
|
9
|
+
* logic and user experience.
|
10
|
+
*
|
11
|
+
* Currently, Fedify is moving fast and the API is not stable yet. We do not
|
12
|
+
* recommend using it in production yet, so please use it if you would like to
|
13
|
+
* experiment with it and help us improve it.
|
14
|
+
*
|
15
|
+
* The rough roadmap is to implement the following features out of the box:
|
16
|
+
*
|
17
|
+
* - Type-safe objects for [Activity Vocabulary] (including some vendor-specific
|
18
|
+
* extensions)
|
19
|
+
* - [WebFinger] client and server
|
20
|
+
* - [HTTP Signatures]
|
21
|
+
* - Middlewares for handling webhooks
|
22
|
+
* - [ActivityPub] client
|
23
|
+
* - [NodeInfo] protocol
|
24
|
+
* - Special touch for interoperability with Mastodon and few other popular
|
25
|
+
* fediverse software
|
26
|
+
*
|
27
|
+
* If you want to know more about the project, please take a look at the
|
28
|
+
* following resources:
|
29
|
+
*
|
30
|
+
* - [GitHub](https://github.com/dahlia/fedify)
|
31
|
+
* - [Manual](https://fedify.dev/manual/)
|
32
|
+
* ([Unstable](https://unstable.fedify.dev/manual/))
|
33
|
+
* - [Examples](https://github.com/dahlia/fedify/tree/main/examples)
|
34
|
+
*
|
35
|
+
* [Deno]: https://deno.com/
|
36
|
+
* [ActivityPub]: https://www.w3.org/TR/activitypub/
|
37
|
+
* [fediverse]: https://en.wikipedia.org/wiki/Fediverse
|
38
|
+
* [Activity Vocabulary]: https://www.w3.org/TR/activitystreams-vocabulary/
|
39
|
+
* [WebFinger]: https://datatracker.ietf.org/doc/html/rfc7033
|
40
|
+
* [HTTP Signatures]: https://tools.ietf.org/html/draft-cavage-http-signatures-12
|
41
|
+
* [NodeInfo]: https://nodeinfo.diaspora.software/
|
42
|
+
*
|
43
|
+
* @module
|
44
|
+
*/
|
45
|
+
export * from "./federation/mod.js";
|
46
|
+
export * from "./httpsig/mod.js";
|
47
|
+
export * from "./nodeinfo/mod.js";
|
48
|
+
export * from "./runtime/mod.js";
|
49
|
+
export * from "./vocab/mod.js";
|
50
|
+
export { lookupWebFinger, type ResourceDescriptor } from "./webfinger/mod.js";
|
51
|
+
//# sourceMappingURL=mod.d.ts.map
|
package/esm/mod.d.ts.map
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../src/mod.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AACH,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,OAAO,EAAE,eAAe,EAAE,KAAK,kBAAkB,EAAE,MAAM,oBAAoB,CAAC"}
|
package/esm/mod.js
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
/**
|
2
|
+
* Fedify: a fediverse server framework
|
3
|
+
* ====================================
|
4
|
+
*
|
5
|
+
* Fedify is a [Deno]/TypeScript library for building federated server apps
|
6
|
+
* powered by [ActivityPub] and other standards, which is so-called [fediverse].
|
7
|
+
* It aims to eliminate the complexity and redundant boilerplate code when
|
8
|
+
* building a federated server app, so that you can focus on your business
|
9
|
+
* logic and user experience.
|
10
|
+
*
|
11
|
+
* Currently, Fedify is moving fast and the API is not stable yet. We do not
|
12
|
+
* recommend using it in production yet, so please use it if you would like to
|
13
|
+
* experiment with it and help us improve it.
|
14
|
+
*
|
15
|
+
* The rough roadmap is to implement the following features out of the box:
|
16
|
+
*
|
17
|
+
* - Type-safe objects for [Activity Vocabulary] (including some vendor-specific
|
18
|
+
* extensions)
|
19
|
+
* - [WebFinger] client and server
|
20
|
+
* - [HTTP Signatures]
|
21
|
+
* - Middlewares for handling webhooks
|
22
|
+
* - [ActivityPub] client
|
23
|
+
* - [NodeInfo] protocol
|
24
|
+
* - Special touch for interoperability with Mastodon and few other popular
|
25
|
+
* fediverse software
|
26
|
+
*
|
27
|
+
* If you want to know more about the project, please take a look at the
|
28
|
+
* following resources:
|
29
|
+
*
|
30
|
+
* - [GitHub](https://github.com/dahlia/fedify)
|
31
|
+
* - [Manual](https://fedify.dev/manual/)
|
32
|
+
* ([Unstable](https://unstable.fedify.dev/manual/))
|
33
|
+
* - [Examples](https://github.com/dahlia/fedify/tree/main/examples)
|
34
|
+
*
|
35
|
+
* [Deno]: https://deno.com/
|
36
|
+
* [ActivityPub]: https://www.w3.org/TR/activitypub/
|
37
|
+
* [fediverse]: https://en.wikipedia.org/wiki/Fediverse
|
38
|
+
* [Activity Vocabulary]: https://www.w3.org/TR/activitystreams-vocabulary/
|
39
|
+
* [WebFinger]: https://datatracker.ietf.org/doc/html/rfc7033
|
40
|
+
* [HTTP Signatures]: https://tools.ietf.org/html/draft-cavage-http-signatures-12
|
41
|
+
* [NodeInfo]: https://nodeinfo.diaspora.software/
|
42
|
+
*
|
43
|
+
* @module
|
44
|
+
*/
|
45
|
+
export * from "./federation/mod.js";
|
46
|
+
export * from "./httpsig/mod.js";
|
47
|
+
export * from "./nodeinfo/mod.js";
|
48
|
+
export * from "./runtime/mod.js";
|
49
|
+
export * from "./vocab/mod.js";
|
50
|
+
export { lookupWebFinger } from "./webfinger/mod.js";
|
@@ -0,0 +1,33 @@
|
|
1
|
+
/// <reference types="node" />
|
2
|
+
import type { NodeInfoDispatcher } from "../federation/callback.js";
|
3
|
+
import type { RequestContext } from "../federation/context.js";
|
4
|
+
/**
|
5
|
+
* Parameters for {@link handleNodeInfo}.
|
6
|
+
*/
|
7
|
+
export interface NodeInfoHandlerParameters<TContextData> {
|
8
|
+
/**
|
9
|
+
* The request context.
|
10
|
+
*/
|
11
|
+
context: RequestContext<TContextData>;
|
12
|
+
/**
|
13
|
+
* The callback for dispatching the NodeInfo.
|
14
|
+
*/
|
15
|
+
nodeInfoDispatcher: NodeInfoDispatcher<TContextData>;
|
16
|
+
}
|
17
|
+
/**
|
18
|
+
* Handles a NodeInfo request. You would not typically call this function
|
19
|
+
* directly, but instead use {@link Federation.handle} method.
|
20
|
+
* @param request The NodeInfo request to handle.
|
21
|
+
* @param parameters The parameters for handling the request.
|
22
|
+
* @returns The response to the request.
|
23
|
+
*/
|
24
|
+
export declare function handleNodeInfo<TContextData>(_request: Request, { context, nodeInfoDispatcher }: NodeInfoHandlerParameters<TContextData>): Promise<Response>;
|
25
|
+
/**
|
26
|
+
* Handles a request to `/.well-known/nodeinfo`. You would not typically call
|
27
|
+
* this function directly, but instead use {@link Federation.handle} method.
|
28
|
+
* @param request The request to handle.
|
29
|
+
* @param context The request context.
|
30
|
+
* @returns The response to the request.
|
31
|
+
*/
|
32
|
+
export declare function handleNodeInfoJrd<TContextData>(_request: Request, context: RequestContext<TContextData>): Promise<Response>;
|
33
|
+
//# sourceMappingURL=handler.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"handler.d.ts","sourceRoot":"","sources":["../../src/nodeinfo/handler.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAK/D;;GAEG;AACH,MAAM,WAAW,yBAAyB,CAAC,YAAY;IACrD;;OAEG;IACH,OAAO,EAAE,cAAc,CAAC,YAAY,CAAC,CAAC;IAEtC;;OAEG;IACH,kBAAkB,EAAE,kBAAkB,CAAC,YAAY,CAAC,CAAC;CACtD;AAED;;;;;;GAMG;AACH,wBAAsB,cAAc,CAAC,YAAY,EAC/C,QAAQ,EAAE,OAAO,EACjB,EAAE,OAAO,EAAE,kBAAkB,EAAE,EAAE,yBAAyB,CAAC,YAAY,CAAC,GACvE,OAAO,CAAC,QAAQ,CAAC,CAUnB;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,YAAY,EAC5C,QAAQ,EAAE,OAAO,EACjB,OAAO,EAAE,cAAc,CAAC,YAAY,CAAC,GACpC,OAAO,CAAC,QAAQ,CAAC,CAmBnB"}
|
@@ -0,0 +1,49 @@
|
|
1
|
+
import { RouterError } from "../federation/router.js";
|
2
|
+
import { nodeInfoToJson } from "./types.js";
|
3
|
+
/**
|
4
|
+
* Handles a NodeInfo request. You would not typically call this function
|
5
|
+
* directly, but instead use {@link Federation.handle} method.
|
6
|
+
* @param request The NodeInfo request to handle.
|
7
|
+
* @param parameters The parameters for handling the request.
|
8
|
+
* @returns The response to the request.
|
9
|
+
*/
|
10
|
+
export async function handleNodeInfo(_request, { context, nodeInfoDispatcher }) {
|
11
|
+
const promise = nodeInfoDispatcher(context);
|
12
|
+
const nodeInfo = promise instanceof Promise ? await promise : promise;
|
13
|
+
const json = nodeInfoToJson(nodeInfo);
|
14
|
+
return new Response(JSON.stringify(json), {
|
15
|
+
headers: {
|
16
|
+
"Content-Type": "application/json;" +
|
17
|
+
' profile="http://nodeinfo.diaspora.software/ns/schema/2.1#"',
|
18
|
+
},
|
19
|
+
});
|
20
|
+
}
|
21
|
+
/**
|
22
|
+
* Handles a request to `/.well-known/nodeinfo`. You would not typically call
|
23
|
+
* this function directly, but instead use {@link Federation.handle} method.
|
24
|
+
* @param request The request to handle.
|
25
|
+
* @param context The request context.
|
26
|
+
* @returns The response to the request.
|
27
|
+
*/
|
28
|
+
export function handleNodeInfoJrd(_request, context) {
|
29
|
+
const links = [];
|
30
|
+
try {
|
31
|
+
links.push({
|
32
|
+
rel: "http://nodeinfo.diaspora.software/ns/schema/2.1",
|
33
|
+
href: context.getNodeInfoUri().href,
|
34
|
+
type: "application/json;" +
|
35
|
+
' profile="http://nodeinfo.diaspora.software/ns/schema/2.1#"',
|
36
|
+
});
|
37
|
+
}
|
38
|
+
catch (e) {
|
39
|
+
if (!(e instanceof RouterError))
|
40
|
+
throw e;
|
41
|
+
}
|
42
|
+
const jrd = { links };
|
43
|
+
const response = new Response(JSON.stringify(jrd), {
|
44
|
+
headers: {
|
45
|
+
"Content-Type": "application/jrd+json",
|
46
|
+
},
|
47
|
+
});
|
48
|
+
return Promise.resolve(response);
|
49
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"handler.test.d.ts","sourceRoot":"","sources":["../../src/nodeinfo/handler.test.ts"],"names":[],"mappings":"AAAA,OAAO,2BAA2B,CAAC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../src/nodeinfo/mod.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,cAAc,YAAY,CAAC"}
|
@@ -0,0 +1,133 @@
|
|
1
|
+
/// <reference types="node" />
|
2
|
+
import { type SemVer } from "../deps/jsr.io/@std/semver/0.220.1/mod.js";
|
3
|
+
/**
|
4
|
+
* The type of the result of parsing JSON.
|
5
|
+
*/
|
6
|
+
export type JsonValue = {
|
7
|
+
[key: string]: JsonValue | undefined;
|
8
|
+
} | JsonValue[] | string | number | boolean | null;
|
9
|
+
/**
|
10
|
+
* A NodeInfo object as defined in the NodeInfo 2.1 schema.
|
11
|
+
*/
|
12
|
+
export interface NodeInfo {
|
13
|
+
/**
|
14
|
+
* Metadata about server software in use.
|
15
|
+
*/
|
16
|
+
software: Software;
|
17
|
+
/**
|
18
|
+
* The protocols supported on this server. At least one protocol must be
|
19
|
+
* supported.
|
20
|
+
*/
|
21
|
+
protocols: Protocol[];
|
22
|
+
/**
|
23
|
+
* The third party sites this server can connect to via their application API.
|
24
|
+
*/
|
25
|
+
services?: Services;
|
26
|
+
/**
|
27
|
+
* Whether this server allows open self-registration. Defaults to `false`.
|
28
|
+
*/
|
29
|
+
openRegistrations?: boolean;
|
30
|
+
/**
|
31
|
+
* Usage statistics for this server.
|
32
|
+
*/
|
33
|
+
usage: Usage;
|
34
|
+
/**
|
35
|
+
* Free form key value pairs for software specific values.
|
36
|
+
* Clients should not rely on any specific key present.
|
37
|
+
*/
|
38
|
+
metadata?: Record<string, JsonValue>;
|
39
|
+
}
|
40
|
+
/**
|
41
|
+
* Metadata about server software in use.
|
42
|
+
*/
|
43
|
+
export interface Software {
|
44
|
+
/**
|
45
|
+
* The canonical name of this server software. This must comply with
|
46
|
+
* pattern `/^[a-z0-9-]+$/`.
|
47
|
+
*/
|
48
|
+
name: string;
|
49
|
+
/**
|
50
|
+
* The version of this server software.
|
51
|
+
*/
|
52
|
+
version: SemVer;
|
53
|
+
/**
|
54
|
+
* The URL of the source code repository of this server software.
|
55
|
+
*/
|
56
|
+
repository?: URL;
|
57
|
+
/**
|
58
|
+
* The URL of the homepage of this server software.
|
59
|
+
*/
|
60
|
+
homepage?: URL;
|
61
|
+
}
|
62
|
+
/**
|
63
|
+
* The protocols supported on this server.
|
64
|
+
*/
|
65
|
+
export type Protocol = "activitypub" | "buddycloud" | "dfrn" | "diaspora" | "libertree" | "ostatus" | "pumpio" | "tent" | "xmpp" | "zot";
|
66
|
+
/**
|
67
|
+
* The third party sites this server can connect to via their application API.
|
68
|
+
*/
|
69
|
+
export interface Services {
|
70
|
+
/**
|
71
|
+
* The third party sites this server can retrieve messages from for combined
|
72
|
+
* display with regular traffic.
|
73
|
+
*/
|
74
|
+
inbound?: InboundService[];
|
75
|
+
/**
|
76
|
+
* The third party sites this server can publish messages to on the behalf
|
77
|
+
* of a user.
|
78
|
+
*/
|
79
|
+
outbound?: OutboundService[];
|
80
|
+
}
|
81
|
+
/**
|
82
|
+
* The third party sites this server can retrieve messages from for combined
|
83
|
+
* display with regular traffic.
|
84
|
+
*/
|
85
|
+
export type InboundService = "atom1.0" | "gnusocial" | "imap" | "pnut" | "pop3" | "pumpio" | "rss2.0" | "twitter";
|
86
|
+
/**
|
87
|
+
* The third party sites this server can publish messages to on the behalf
|
88
|
+
* of a user.
|
89
|
+
*/
|
90
|
+
export type OutboundService = "atom1.0" | "blogger" | "buddycloud" | "diaspora" | "dreamwidth" | "drupal" | "facebook" | "friendica" | "gnusocial" | "google" | "insanejournal" | "libertree" | "linkedin" | "livejournal" | "mediagoblin" | "myspace" | "pinterest" | "pnut" | "posterous" | "pumpio" | "redmatrix" | "rss2.0" | "smtp" | "tent" | "tumblr" | "twitter" | "wordpress" | "xmpp";
|
91
|
+
/**
|
92
|
+
* Usage statistics for this server.
|
93
|
+
*/
|
94
|
+
export interface Usage {
|
95
|
+
/**
|
96
|
+
* Statistics about the users of this server.
|
97
|
+
*/
|
98
|
+
users: {
|
99
|
+
/**
|
100
|
+
* The total amount of on this server registered users. This number
|
101
|
+
* has to be an integer greater than or equal to zero.
|
102
|
+
*/
|
103
|
+
total?: number;
|
104
|
+
/**
|
105
|
+
* The amount of users that signed in at least once in the last 180 days.
|
106
|
+
* This number has to be an integer greater than or equal to zero.
|
107
|
+
*/
|
108
|
+
activeHalfyear?: number;
|
109
|
+
/**
|
110
|
+
* The amount of users that signed in at least once in the last 30 days.
|
111
|
+
* This number has to be an integer greater than or equal to zero.
|
112
|
+
*/
|
113
|
+
activeMonth?: number;
|
114
|
+
};
|
115
|
+
/**
|
116
|
+
* The amount of posts that were made by users that are registered on this
|
117
|
+
* server. This number has to be an integer greater than or equal to zero.
|
118
|
+
*/
|
119
|
+
localPosts: number;
|
120
|
+
/**
|
121
|
+
* The amount of comments that were made by users that are registered on this
|
122
|
+
* server. This number has to be an integer greater than or equal to zero.
|
123
|
+
*/
|
124
|
+
localComments: number;
|
125
|
+
}
|
126
|
+
/**
|
127
|
+
* Converts a {@link NodeInfo} object to a JSON value.
|
128
|
+
* @param nodeInfo The {@link NodeInfo} object to convert.
|
129
|
+
* @returns The JSON value that complies with the NodeInfo schema.
|
130
|
+
* @throws {TypeError} If the {@link NodeInfo} object is invalid.
|
131
|
+
*/
|
132
|
+
export declare function nodeInfoToJson(nodeInfo: NodeInfo): JsonValue;
|
133
|
+
//# sourceMappingURL=types.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/nodeinfo/types.ts"],"names":[],"mappings":";AAAA,OAAO,EAAU,KAAK,MAAM,EAAE,MAAM,2CAA2C,CAAC;AAEhF;;GAEG;AACH,MAAM,MAAM,SAAS,GACjB;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,CAAA;CAAE,GACxC,SAAS,EAAE,GACX,MAAM,GACN,MAAM,GACN,OAAO,GACP,IAAI,CAAC;AAET;;GAEG;AACH,MAAM,WAAW,QAAQ;IACvB;;OAEG;IACH,QAAQ,EAAE,QAAQ,CAAC;IAEnB;;;OAGG;IACH,SAAS,EAAE,QAAQ,EAAE,CAAC;IAEtB;;OAEG;IACH,QAAQ,CAAC,EAAE,QAAQ,CAAC;IAEpB;;OAEG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAE5B;;OAEG;IACH,KAAK,EAAE,KAAK,CAAC;IAEb;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;CACtC;AAED;;GAEG;AACH,MAAM,WAAW,QAAQ;IACvB;;;OAGG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,UAAU,CAAC,EAAE,GAAG,CAAC;IAEjB;;OAEG;IACH,QAAQ,CAAC,EAAE,GAAG,CAAC;CAChB;AAED;;GAEG;AACH,MAAM,MAAM,QAAQ,GAEhB,aAAa,GACb,YAAY,GACZ,MAAM,GACN,UAAU,GACV,WAAW,GACX,SAAS,GACT,QAAQ,GACR,MAAM,GACN,MAAM,GACN,KAAK,CAAC;AAEV;;GAEG;AACH,MAAM,WAAW,QAAQ;IACvB;;;OAGG;IACH,OAAO,CAAC,EAAE,cAAc,EAAE,CAAC;IAE3B;;;OAGG;IACH,QAAQ,CAAC,EAAE,eAAe,EAAE,CAAC;CAC9B;AAED;;;GAGG;AACH,MAAM,MAAM,cAAc,GAEtB,SAAS,GACT,WAAW,GACX,MAAM,GACN,MAAM,GACN,MAAM,GACN,QAAQ,GACR,QAAQ,GACR,SAAS,CAAC;AAEd;;;GAGG;AACH,MAAM,MAAM,eAAe,GAEvB,SAAS,GACT,SAAS,GACT,YAAY,GACZ,UAAU,GACV,YAAY,GACZ,QAAQ,GACR,UAAU,GACV,WAAW,GACX,WAAW,GACX,QAAQ,GACR,eAAe,GACf,WAAW,GACX,UAAU,GACV,aAAa,GACb,aAAa,GACb,SAAS,GACT,WAAW,GACX,MAAM,GACN,WAAW,GACX,QAAQ,GACR,WAAW,GACX,QAAQ,GACR,MAAM,GACN,MAAM,GACN,QAAQ,GACR,SAAS,GACT,WAAW,GACX,MAAM,CAAC;AAEX;;GAEG;AACH,MAAM,WAAW,KAAK;IACpB;;OAEG;IACH,KAAK,EAAE;QACL;;;WAGG;QACH,KAAK,CAAC,EAAE,MAAM,CAAC;QAEf;;;WAGG;QACH,cAAc,CAAC,EAAE,MAAM,CAAC;QAExB;;;WAGG;QACH,WAAW,CAAC,EAAE,MAAM,CAAC;KACtB,CAAC;IAEF;;;OAGG;IACH,UAAU,EAAE,MAAM,CAAC;IAEnB;;;OAGG;IACH,aAAa,EAAE,MAAM,CAAC;CACvB;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,QAAQ,GAAG,SAAS,CA8D5D"}
|
@@ -0,0 +1,60 @@
|
|
1
|
+
import { format } from "../deps/jsr.io/@std/semver/0.220.1/mod.js";
|
2
|
+
/**
|
3
|
+
* Converts a {@link NodeInfo} object to a JSON value.
|
4
|
+
* @param nodeInfo The {@link NodeInfo} object to convert.
|
5
|
+
* @returns The JSON value that complies with the NodeInfo schema.
|
6
|
+
* @throws {TypeError} If the {@link NodeInfo} object is invalid.
|
7
|
+
*/
|
8
|
+
export function nodeInfoToJson(nodeInfo) {
|
9
|
+
if (!nodeInfo.software.name.match(/^[a-z0-9-]+$/)) {
|
10
|
+
throw new TypeError("Invalid software name.");
|
11
|
+
}
|
12
|
+
if (nodeInfo.protocols.length < 1) {
|
13
|
+
throw new TypeError("At least one protocol must be supported.");
|
14
|
+
}
|
15
|
+
if (nodeInfo.usage.users.total != null &&
|
16
|
+
(nodeInfo.usage.users.total < 0 ||
|
17
|
+
!Number.isInteger(nodeInfo.usage.users.total))) {
|
18
|
+
throw new TypeError("Invalid total users.");
|
19
|
+
}
|
20
|
+
if (nodeInfo.usage.users.activeHalfyear != null &&
|
21
|
+
(nodeInfo.usage.users.activeHalfyear < 0 ||
|
22
|
+
!Number.isInteger(nodeInfo.usage.users.activeHalfyear))) {
|
23
|
+
throw new TypeError("Invalid active halfyear users.");
|
24
|
+
}
|
25
|
+
if (nodeInfo.usage.users.activeMonth != null &&
|
26
|
+
(nodeInfo.usage.users.activeMonth < 0 ||
|
27
|
+
!Number.isInteger(nodeInfo.usage.users.activeMonth))) {
|
28
|
+
throw new TypeError("Invalid active month users.");
|
29
|
+
}
|
30
|
+
if (nodeInfo.usage.localPosts < 0 ||
|
31
|
+
!Number.isInteger(nodeInfo.usage.localPosts)) {
|
32
|
+
throw new TypeError("Invalid local posts.");
|
33
|
+
}
|
34
|
+
if (nodeInfo.usage.localComments < 0 ||
|
35
|
+
!Number.isInteger(nodeInfo.usage.localComments)) {
|
36
|
+
throw new TypeError("Invalid local comments.");
|
37
|
+
}
|
38
|
+
return {
|
39
|
+
"$schema": "http://nodeinfo.diaspora.software/ns/schema/2.1#",
|
40
|
+
version: "2.1",
|
41
|
+
software: {
|
42
|
+
name: nodeInfo.software.name,
|
43
|
+
version: format(nodeInfo.software.version),
|
44
|
+
repository: nodeInfo.software.repository?.href,
|
45
|
+
homepage: nodeInfo.software.homepage?.href,
|
46
|
+
},
|
47
|
+
protocols: nodeInfo.protocols,
|
48
|
+
services: nodeInfo.services == null ? { inbound: [], outbound: [] } : {
|
49
|
+
inbound: nodeInfo.services.inbound ?? [],
|
50
|
+
outbound: nodeInfo.services.outbound ?? [],
|
51
|
+
},
|
52
|
+
openRegistrations: nodeInfo.openRegistrations ?? false,
|
53
|
+
usage: {
|
54
|
+
users: nodeInfo.usage.users,
|
55
|
+
localPosts: nodeInfo.usage.localPosts,
|
56
|
+
localComments: nodeInfo.usage.localComments,
|
57
|
+
},
|
58
|
+
metadata: nodeInfo.metadata ?? {},
|
59
|
+
};
|
60
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"types.test.d.ts","sourceRoot":"","sources":["../../src/nodeinfo/types.test.ts"],"names":[],"mappings":"AAAA,OAAO,2BAA2B,CAAC"}
|
package/esm/package.json
ADDED