diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..c673805 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,32 @@ +name: workspace publish + +on: + push: + branches: + - main + +jobs: + publish: + runs-on: ubuntu-latest + + permissions: + contents: read + id-token: write + + steps: + - name: Clone repository + uses: actions/checkout@v5 + + - name: Set up Deno + uses: denoland/setup-deno@v2 + with: + cache: true + + - name: Format + run: deno fmt --check + + - name: Test + run: deno test -A + + - name: Publish to JSR + run: deno publish diff --git a/ui8/alloc.ts b/bytes/alloc.ts similarity index 100% rename from ui8/alloc.ts rename to bytes/alloc.ts diff --git a/ui8/compare.ts b/bytes/compare.ts similarity index 100% rename from ui8/compare.ts rename to bytes/compare.ts diff --git a/ui8/concat.ts b/bytes/concat.ts similarity index 100% rename from ui8/concat.ts rename to bytes/concat.ts diff --git a/ui8/deno.json b/bytes/deno.json similarity index 88% rename from ui8/deno.json rename to bytes/deno.json index bd2cc86..c33f400 100644 --- a/ui8/deno.json +++ b/bytes/deno.json @@ -1,5 +1,5 @@ { - "name": "@atp/ui8", + "name": "@atp/bytes", "version": "0.1.0-alpha.1", "exports": "./mod.ts", "license": "MIT", diff --git a/ui8/mod.ts b/bytes/mod.ts similarity index 100% rename from ui8/mod.ts rename to bytes/mod.ts diff --git a/ui8/string.ts b/bytes/string.ts similarity index 100% rename from ui8/string.ts rename to bytes/string.ts diff --git a/ui8/tests/alloc_test.ts b/bytes/tests/alloc_test.ts similarity index 100% rename from ui8/tests/alloc_test.ts rename to bytes/tests/alloc_test.ts diff --git a/ui8/tests/compare_test.ts b/bytes/tests/compare_test.ts similarity index 100% rename from ui8/tests/compare_test.ts rename to bytes/tests/compare_test.ts diff --git a/ui8/tests/concat_test.ts b/bytes/tests/concat_test.ts similarity index 100% rename from ui8/tests/concat_test.ts rename to bytes/tests/concat_test.ts diff --git a/ui8/tests/string_test.ts b/bytes/tests/string_test.ts similarity index 100% rename from ui8/tests/string_test.ts rename to bytes/tests/string_test.ts diff --git a/ui8/util.ts b/bytes/util.ts similarity index 100% rename from ui8/util.ts rename to bytes/util.ts diff --git a/ui8/xor.ts b/bytes/xor.ts similarity index 100% rename from ui8/xor.ts rename to bytes/xor.ts diff --git a/common/deno.json b/common/deno.json index c9fefcc..0c0b866 100644 --- a/common/deno.json +++ b/common/deno.json @@ -5,18 +5,16 @@ "license": "MIT", "imports": { "@ipld/dag-cbor": "npm:@ipld/dag-cbor@^9.2.5", - "@logtape/file": "jsr:@logtape/file@^1.0.4", - "@logtape/logtape": "jsr:@logtape/logtape@^1.0.4", + "@logtape/file": "jsr:@logtape/file@^1.2.0-dev.344+834f24a9", + "@logtape/logtape": "jsr:@logtape/logtape@^1.2.0-dev.344+834f24a9", "@std/assert": "jsr:@std/assert@^1.0.14", - "@std/bytes": "jsr:@std/bytes@^1.0.6", "@std/cbor": "jsr:@std/cbor@^0.1.8", "@std/crypto": "jsr:@std/crypto@^1.0.5", "@std/encoding": "jsr:@std/encoding@^1.0.10", "@std/fs": "jsr:@std/fs@^1.0.19", "@std/io": "jsr:@std/io@^0.225.2", "@std/streams": "jsr:@std/streams@^1.0.12", - "multiformats": "npm:multiformats@^13.4.0", - "uint8arrays": "npm:uint8arrays@^5.1.0", - "zod": "jsr:@zod/zod@^4.1.5" + "multiformats": "npm:multiformats@^13.4.1", + "zod": "jsr:@zod/zod@^4.1.11" } } diff --git a/common/ipld.ts b/common/ipld.ts index 3a8551c..ccf8ba2 100644 --- a/common/ipld.ts +++ b/common/ipld.ts @@ -7,7 +7,7 @@ import { sha256 } from "multiformats/hashes/sha2"; import { schema } from "./types.ts"; import * as check from "./check.ts"; import { crypto } from "@std/crypto"; -import { concat, equals, fromString, toString } from "@atp/ui8"; +import { concat, equals, fromString, toString } from "@atp/bytes"; export const cborEncode = cborCodec.encode; export const cborDecode = cborCodec.decode; diff --git a/common/streams.ts b/common/streams.ts index ab5e48c..56cce8f 100644 --- a/common/streams.ts +++ b/common/streams.ts @@ -1,4 +1,4 @@ -import { concat } from "@std/bytes"; +import { concat } from "@atp/bytes"; import { Buffer } from "@std/io"; export const forwardStreamErrors = (..._streams: ReadableStream[]) => { diff --git a/common/tests/ipld-multi_test.ts b/common/tests/ipld-multi_test.ts index 09f88e6..a44d404 100644 --- a/common/tests/ipld-multi_test.ts +++ b/common/tests/ipld-multi_test.ts @@ -1,5 +1,5 @@ import { CID } from "multiformats/cid"; -import * as ui8 from "uint8arrays"; +import * as ui8 from "@atp/bytes"; import { cborDecodeMulti, cborEncode, type CborObject } from "../mod.ts"; import { assert, assertEquals } from "@std/assert"; diff --git a/common/tests/ipld_test.ts b/common/tests/ipld_test.ts index 3f3589f..5f9e721 100644 --- a/common/tests/ipld_test.ts +++ b/common/tests/ipld_test.ts @@ -1,4 +1,4 @@ -import * as ui8 from "uint8arrays"; +import * as ui8 from "@atp/bytes"; import { cborDecode, cborEncode, diff --git a/crypto/deno.json b/crypto/deno.json index e2187a2..86dc5e9 100644 --- a/crypto/deno.json +++ b/crypto/deno.json @@ -7,7 +7,6 @@ "@noble/curves": "jsr:@noble/curves@^2.0.1", "@noble/hashes": "jsr:@noble/hashes@^2.0.1", "@std/assert": "jsr:@std/assert@^1.0.14", - "multiformats": "npm:multiformats@^13.4.1", - "uint8arrays": "npm:uint8arrays@^5.1.0" + "multiformats": "npm:multiformats@^13.4.1" } } diff --git a/crypto/did.ts b/crypto/did.ts index e9c3a08..b0b6d3d 100644 --- a/crypto/did.ts +++ b/crypto/did.ts @@ -1,4 +1,4 @@ -import * as uint8arrays from "@atp/ui8"; +import * as uint8arrays from "@atp/bytes"; import { BASE58_MULTIBASE_PREFIX, DID_KEY_PREFIX } from "./const.ts"; import { plugins } from "./plugins.ts"; import { extractMultikey, extractPrefixedBytes, hasPrefix } from "./utils.ts"; diff --git a/crypto/multibase.ts b/crypto/multibase.ts index 34b98f2..38ccf55 100644 --- a/crypto/multibase.ts +++ b/crypto/multibase.ts @@ -1,4 +1,4 @@ -import { fromString, type SupportedEncodings, toString } from "@atp/ui8"; +import { fromString, type SupportedEncodings, toString } from "@atp/bytes"; export const multibaseToBytes = (mb: string): Uint8Array => { const base = mb[0]; diff --git a/crypto/p256/encoding.ts b/crypto/p256/encoding.ts index 07c98c5..fcaa340 100644 --- a/crypto/p256/encoding.ts +++ b/crypto/p256/encoding.ts @@ -1,5 +1,5 @@ import { p256 } from "@noble/curves/nist.js"; -import { toString } from "@atp/ui8"; +import { toString } from "@atp/bytes"; export const compressPubkey = (pubkeyBytes: Uint8Array): Uint8Array => { // Check if key is already compressed (33 bytes starting with 0x02 or 0x03) diff --git a/crypto/p256/keypair.ts b/crypto/p256/keypair.ts index 9e2b6fb..ef5728a 100644 --- a/crypto/p256/keypair.ts +++ b/crypto/p256/keypair.ts @@ -1,7 +1,10 @@ import { p256 } from "@noble/curves/nist.js"; import { sha256 } from "@noble/hashes/sha2.js"; -import { fromString as ui8FromString, toString as ui8ToString } from "@atp/ui8"; -import type { SupportedEncodings } from "uint8arrays/to-string"; +import { + fromString as ui8FromString, + type SupportedEncodings, + toString as ui8ToString, +} from "@atp/bytes"; import { P256_JWT_ALG } from "../const.ts"; import * as did from "../did.ts"; import type { Keypair } from "../types.ts"; diff --git a/crypto/p256/operations.ts b/crypto/p256/operations.ts index 43e8bdc..90d1533 100644 --- a/crypto/p256/operations.ts +++ b/crypto/p256/operations.ts @@ -1,6 +1,6 @@ import { p256 } from "@noble/curves/nist.js"; import { sha256 } from "@noble/hashes/sha2.js"; -import { equals as ui8equals } from "@atp/ui8"; +import { equals as ui8equals } from "@atp/bytes"; import { P256_DID_PREFIX } from "../const.ts"; import type { VerifyOptions } from "../types.ts"; import { extractMultikey, extractPrefixedBytes, hasPrefix } from "../utils.ts"; diff --git a/crypto/random.ts b/crypto/random.ts index 236e2bf..b76fe17 100644 --- a/crypto/random.ts +++ b/crypto/random.ts @@ -1,5 +1,5 @@ import * as noble from "@noble/hashes/utils.js"; -import { type SupportedEncodings, toString } from "@atp/ui8"; +import { type SupportedEncodings, toString } from "@atp/bytes"; import { sha256 } from "./sha.ts"; export const randomBytes = noble.randomBytes; diff --git a/crypto/secp256k1/encoding.ts b/crypto/secp256k1/encoding.ts index f53a7e4..866846d 100644 --- a/crypto/secp256k1/encoding.ts +++ b/crypto/secp256k1/encoding.ts @@ -1,5 +1,5 @@ import { secp256k1 as k256 } from "@noble/curves/secp256k1.js"; -import { toString } from "@atp/ui8"; +import { toString } from "@atp/bytes"; export const compressPubkey = (pubkeyBytes: Uint8Array): Uint8Array => { // Check if key is already compressed (33 bytes starting with 0x02 or 0x03) diff --git a/crypto/secp256k1/keypair.ts b/crypto/secp256k1/keypair.ts index 2ef9698..dcb86ba 100644 --- a/crypto/secp256k1/keypair.ts +++ b/crypto/secp256k1/keypair.ts @@ -4,7 +4,7 @@ import { fromString as ui8FromString, type SupportedEncodings, toString as ui8ToString, -} from "@atp/ui8"; +} from "@atp/bytes"; import { SECP256K1_JWT_ALG } from "../const.ts"; import * as did from "../did.ts"; import type { Keypair } from "../types.ts"; diff --git a/crypto/secp256k1/operations.ts b/crypto/secp256k1/operations.ts index 9e72a2f..0106450 100644 --- a/crypto/secp256k1/operations.ts +++ b/crypto/secp256k1/operations.ts @@ -1,6 +1,6 @@ import { secp256k1 as k256 } from "@noble/curves/secp256k1.js"; import { sha256 } from "@noble/hashes/sha2.js"; -import { equals } from "@atp/ui8"; +import { equals } from "@atp/bytes"; import { SECP256K1_DID_PREFIX } from "../const.ts"; import type { VerifyOptions } from "../types.ts"; import { extractMultikey, extractPrefixedBytes, hasPrefix } from "../utils.ts"; diff --git a/crypto/sha.ts b/crypto/sha.ts index 774e3ee..08e68f2 100644 --- a/crypto/sha.ts +++ b/crypto/sha.ts @@ -1,5 +1,5 @@ import * as noble from "@noble/hashes/sha2.js"; -import * as uint8arrays from "@atp/ui8"; +import * as uint8arrays from "@atp/bytes"; // takes either bytes of utf8 input // @TODO this can be sync diff --git a/crypto/tests/did_test.ts b/crypto/tests/did_test.ts index ea1cdf5..42375c6 100644 --- a/crypto/tests/did_test.ts +++ b/crypto/tests/did_test.ts @@ -1,4 +1,4 @@ -import { equals, fromString } from "@atp/ui8"; +import { equals, fromString } from "@atp/bytes"; import { P256Keypair, Secp256k1Keypair } from "../mod.ts"; import * as did from "../did.ts"; import { assert, assertEquals } from "@std/assert"; diff --git a/crypto/tests/generate-vectors.ts b/crypto/tests/generate-vectors.ts index 902bd10..839a033 100644 --- a/crypto/tests/generate-vectors.ts +++ b/crypto/tests/generate-vectors.ts @@ -1,7 +1,7 @@ import { writeFileSync } from "node:fs"; import { dirname, join } from "node:path"; import { fileURLToPath } from "node:url"; -import { equals, fromString, toString } from "@atp/ui8"; +import { equals, fromString, toString } from "@atp/bytes"; import { cborEncode } from "@atp/common"; import { bytesToMultibase, diff --git a/crypto/tests/signatures_test.ts b/crypto/tests/signatures_test.ts index 6cf6009..559876f 100644 --- a/crypto/tests/signatures_test.ts +++ b/crypto/tests/signatures_test.ts @@ -1,5 +1,5 @@ import fs from "node:fs"; -import * as uint8arrays from "@atp/ui8"; +import * as uint8arrays from "@atp/bytes"; import { multibaseToBytes, P256_JWT_ALG, diff --git a/crypto/utils.ts b/crypto/utils.ts index 7e38c4a..250ae52 100644 --- a/crypto/utils.ts +++ b/crypto/utils.ts @@ -1,4 +1,4 @@ -import { equals, fromString } from "@atp/ui8"; +import { equals, fromString } from "@atp/bytes"; import { BASE58_MULTIBASE_PREFIX, DID_KEY_PREFIX } from "./const.ts"; export const extractMultikey = (did: string): string => { diff --git a/crypto/verify.ts b/crypto/verify.ts index 35fcb20..7c3eafd 100644 --- a/crypto/verify.ts +++ b/crypto/verify.ts @@ -1,4 +1,4 @@ -import { fromString } from "@atp/ui8"; +import { fromString } from "@atp/bytes"; import { parseDidKey } from "./did.ts"; import { plugins } from "./plugins.ts"; import type { VerifyOptions } from "./types.ts"; diff --git a/deno.json b/deno.json index cb83c6b..bbc62d6 100644 --- a/deno.json +++ b/deno.json @@ -1,7 +1,7 @@ { "workspace": [ "common", - "ui8", + "bytes", "syntax", "crypto", "lexicon", diff --git a/deno.lock b/deno.lock index 9acd885..40705c9 100644 --- a/deno.lock +++ b/deno.lock @@ -7,18 +7,14 @@ "jsr:@cliffy/internal@1.0.0-rc.8": "1.0.0-rc.8", "jsr:@cliffy/table@1.0.0-rc.8": "1.0.0-rc.8", "jsr:@david/code-block-writer@13": "13.0.3", - "jsr:@hono/hono@^4.7.10": "4.9.6", - "jsr:@logtape/file@*": "1.0.4", - "jsr:@logtape/file@^1.0.4": "1.0.4", - "jsr:@logtape/logtape@*": "1.0.4", - "jsr:@logtape/logtape@^1.0.4": "1.0.4", + "jsr:@hono/hono@^4.9.8": "4.9.8", + "jsr:@logtape/file@^1.2.0-dev.344+834f24a9": "1.2.0-dev.344+834f24a9", + "jsr:@logtape/logtape@^1.2.0-dev.344+834f24a9": "1.2.0-dev.344+834f24a9", "jsr:@noble/curves@^2.0.1": "2.0.1", "jsr:@noble/hashes@2": "2.0.1", "jsr:@noble/hashes@^2.0.1": "2.0.1", "jsr:@std/assert@*": "1.0.14", "jsr:@std/assert@^1.0.14": "1.0.14", - "jsr:@std/bytes@*": "1.0.6", - "jsr:@std/bytes@^1.0.2": "1.0.6", "jsr:@std/bytes@^1.0.5": "1.0.6", "jsr:@std/bytes@^1.0.6": "1.0.6", "jsr:@std/cbor@~0.1.8": "0.1.8", @@ -31,7 +27,6 @@ "jsr:@std/fs@^1.0.19": "1.0.19", "jsr:@std/internal@^1.0.10": "1.0.10", "jsr:@std/internal@^1.0.9": "1.0.10", - "jsr:@std/io@*": "0.224.9", "jsr:@std/io@~0.224.9": "0.224.9", "jsr:@std/io@~0.225.2": "0.225.2", "jsr:@std/path@1": "1.1.2", @@ -42,24 +37,17 @@ "jsr:@std/text@~1.0.7": "1.0.16", "jsr:@ts-morph/common@0.27": "0.27.0", "jsr:@ts-morph/ts-morph@26": "26.0.0", - "jsr:@zod/zod@^4.0.17": "4.1.11", "jsr:@zod/zod@^4.1.11": "4.1.11", - "jsr:@zod/zod@^4.1.5": "4.1.11", - "npm:@atproto/crypto@~0.4.4": "0.4.4", "npm:@ipld/dag-cbor@^9.2.5": "9.2.5", "npm:@types/node@*": "24.2.0", "npm:cbor-x@*": "1.6.0", "npm:get-port@^7.1.0": "7.1.0", "npm:http-errors@2": "2.0.0", "npm:key-encoder@^2.0.3": "2.0.3", - "npm:multiformats@*": "13.4.0", - "npm:multiformats@^13.4.0": "13.4.0", "npm:multiformats@^13.4.1": "13.4.1", "npm:prettier@^3.6.2": "3.6.2", - "npm:rate-limiter-flexible@^2.4.1": "2.4.2", - "npm:uint8arrays@3.0.0": "3.0.0", - "npm:uint8arrays@^5.1.0": "5.1.0", - "npm:ws@^8.12.0": "8.18.3", + "npm:rate-limiter-flexible@^2.4.2": "2.4.2", + "npm:ws@^8.18.3": "8.18.3", "npm:zod@^4.1.11": "4.1.11" }, "jsr": { @@ -100,17 +88,17 @@ "@david/code-block-writer@13.0.3": { "integrity": "f98c77d320f5957899a61bfb7a9bead7c6d83ad1515daee92dbacc861e13bb7f" }, - "@hono/hono@4.9.6": { - "integrity": "b85abb0013d167a290b1808d1d4d542dee269df31d4f47122023259fdd7e184b" + "@hono/hono@4.9.8": { + "integrity": "908150f13e90181a051a3af3bf15203aff00190682afedfd38824d0cb9299a95" }, - "@logtape/file@1.0.4": { - "integrity": "80f49feb4826fa748ae3ebd1eaf2fa7f23f1820c84d5402a1f7de76f529464e4", + "@logtape/file@1.2.0-dev.344+834f24a9": { + "integrity": "4d674c368f8130dc1403c5c93a316726a65d6b17e36b094780f1b2ed301f5e1b", "dependencies": [ - "jsr:@logtape/logtape@^1.0.4" + "jsr:@logtape/logtape" ] }, - "@logtape/logtape@1.0.4": { - "integrity": "6ada87764d995b1033c352a17fd9e20b217f3672083bc2d8debe356eac03fe10" + "@logtape/logtape@1.2.0-dev.344+834f24a9": { + "integrity": "204222be0f94cd1b64a500e2dcdea22a1618a086fc531b054351e3cfa079c435" }, "@noble/curves@2.0.1": { "integrity": "21ef41d207a203f60ba37a4fdcbc4f4a545b10c5dab7f293889f18292f81ab23", @@ -157,10 +145,7 @@ "integrity": "e3be62ce42cab0e177c27698e5d9800122f67b766a0bea6ca4867886cbde8cf7" }, "@std/io@0.224.9": { - "integrity": "4414664b6926f665102e73c969cfda06d2c4c59bd5d0c603fd4f1b1c840d6ee3", - "dependencies": [ - "jsr:@std/bytes@^1.0.2" - ] + "integrity": "4414664b6926f665102e73c969cfda06d2c4c59bd5d0c603fd4f1b1c840d6ee3" }, "@std/io@0.225.2": { "integrity": "3c740cd4ee4c082e6cfc86458f47e2ab7cb353dc6234d5e9b1f91a2de5f4d6c7", @@ -208,14 +193,6 @@ } }, "npm": { - "@atproto/crypto@0.4.4": { - "integrity": "sha512-Yq9+crJ7WQl7sxStVpHgie5Z51R05etaK9DLWYG/7bR5T4bhdcIgF6IfklLShtZwLYdVVj+K15s0BqW9a8PSDA==", - "dependencies": [ - "@noble/curves", - "@noble/hashes", - "uint8arrays@3.0.0" - ] - }, "@cbor-extract/cbor-extract-darwin-arm64@2.2.0": { "integrity": "sha512-P7swiOAdF7aSi0H+tHtHtr6zrpF3aAq/W9FXx5HektRvLTM2O89xCyXF3pk7pLc7QpaY7AoaE8UowVf9QBdh3w==", "os": ["darwin"], @@ -250,18 +227,9 @@ "integrity": "sha512-84wSr4jv30biui7endhobYhXBQzQE4c/wdoWlFrKcfiwH+ofaPg8fwsM8okX9cOzkkrsAsNdDyH3ou+kiLquwQ==", "dependencies": [ "cborg", - "multiformats@13.4.0" - ] - }, - "@noble/curves@1.9.7": { - "integrity": "sha512-gbKGcRUYIjA3/zCCNaWDciTMFI0dCkvou3TL8Zmy5Nc7sJ47a0jtOeZoTaMxkuqRo9cRhjOdZJXegxYE5FN/xw==", - "dependencies": [ - "@noble/hashes" + "multiformats" ] }, - "@noble/hashes@1.8.0": { - "integrity": "sha512-jCs9ldd7NwzpgXDIf6P3+NrHh9/sD6CQdxHyjQI+h/6rDNo88ypBxxz45UDuZHz9r3tNz7N/VInSVoVdtXEI4A==" - }, "@types/bn.js@5.2.0": { "integrity": "sha512-DLbJ1BPqxvQhIGbeu8VbUC1DiAiahHtAYvA0ZEAa4P31F7IaArc8z3C3BRQdWX4mtLQuABG4yzp76ZrS02Ui1Q==", "dependencies": [ @@ -385,15 +353,9 @@ "minimalistic-crypto-utils@1.0.1": { "integrity": "sha512-JIYlbt6g8i5jKfJ3xz7rF0LXmv2TkDxBLUkiBeZ7bAx4GnnNMr8xFpGnOxn6GhTEHx3SjRrZEoU+j04prX1ktg==" }, - "multiformats@13.4.0": { - "integrity": "sha512-Mkb/QcclrJxKC+vrcIFl297h52QcKh2Az/9A5vbWytbQt4225UWWWmIuSsKksdww9NkIeYcA7DkfftyLuC/JSg==" - }, "multiformats@13.4.1": { "integrity": "sha512-VqO6OSvLrFVAYYjgsr8tyv62/rCQhPgsZUXLTqoFLSgdkgiUYKYeArbt1uWLlEpkjxQe+P0+sHlbPEte1Bi06Q==" }, - "multiformats@9.9.0": { - "integrity": "sha512-HoMUjhH9T8DDBNT+6xzkrd9ga/XiBI4xLr58LJACwK6G3HTOPeMz4nB4KJs33L2BelrIJa7P0VuNaVF3hMYfjg==" - }, "node-gyp-build-optional-packages@5.1.1": { "integrity": "sha512-+P72GAjVAbTxjjwUmwjVrqrdZROD4nf8KgpBoDxqXXTiYZZt/ud60dE5yvCSr9lRO8e8yv6kgJIC0K0PfZFVQw==", "dependencies": [ @@ -420,18 +382,6 @@ "toidentifier@1.0.1": { "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==" }, - "uint8arrays@3.0.0": { - "integrity": "sha512-HRCx0q6O9Bfbp+HHSfQQKD7wU70+lydKVt4EghkdOvlK/NlrF90z+eXV34mUd48rNvVJXwkrMSPpCATkct8fJA==", - "dependencies": [ - "multiformats@9.9.0" - ] - }, - "uint8arrays@5.1.0": { - "integrity": "sha512-vA6nFepEmlSKkMBnLBaUMVvAC4G3CTmO58C12y4sq6WPDOR7mOFYOi7GlrQ4djeSbP6JG9Pv9tJDM97PedRSww==", - "dependencies": [ - "multiformats@13.4.0" - ] - }, "undici-types@7.10.0": { "integrity": "sha512-t5Fy/nfn+14LuOc2KNYg75vZqClpAiqscVvMygNnlsHBFpSXdJaYtXMcdNLpl/Qvc3P2cB3s6lOV51nqsFq4ag==" }, @@ -454,22 +404,26 @@ }, "workspace": { "members": { + "bytes": { + "dependencies": [ + "jsr:@std/assert@^1.0.14", + "npm:multiformats@^13.4.1" + ] + }, "common": { "dependencies": [ - "jsr:@logtape/file@^1.0.4", - "jsr:@logtape/logtape@^1.0.4", + "jsr:@logtape/file@^1.2.0-dev.344+834f24a9", + "jsr:@logtape/logtape@^1.2.0-dev.344+834f24a9", "jsr:@std/assert@^1.0.14", - "jsr:@std/bytes@^1.0.6", "jsr:@std/cbor@~0.1.8", "jsr:@std/crypto@^1.0.5", "jsr:@std/encoding@^1.0.10", "jsr:@std/fs@^1.0.19", "jsr:@std/io@~0.225.2", "jsr:@std/streams@^1.0.12", - "jsr:@zod/zod@^4.1.5", + "jsr:@zod/zod@^4.1.11", "npm:@ipld/dag-cbor@^9.2.5", - "npm:multiformats@^13.4.0", - "npm:uint8arrays@^5.1.0" + "npm:multiformats@^13.4.1" ] }, "crypto": { @@ -477,8 +431,7 @@ "jsr:@noble/curves@^2.0.1", "jsr:@noble/hashes@^2.0.1", "jsr:@std/assert@^1.0.14", - "npm:multiformats@^13.4.1", - "npm:uint8arrays@^5.1.0" + "npm:multiformats@^13.4.1" ] }, "lex-cli": { @@ -488,7 +441,7 @@ "jsr:@std/fs@^1.0.19", "jsr:@std/path@^1.1.2", "jsr:@ts-morph/ts-morph@26", - "jsr:@zod/zod@^4.1.5", + "jsr:@zod/zod@^4.1.11", "npm:prettier@^3.6.2" ] }, @@ -504,12 +457,6 @@ "jsr:@std/assert@^1.0.14" ] }, - "ui8": { - "dependencies": [ - "jsr:@std/assert@^1.0.14", - "npm:multiformats@^13.4.1" - ] - }, "xrpc": { "dependencies": [ "jsr:@zod/zod@^4.1.11" @@ -517,19 +464,17 @@ }, "xrpc-server": { "dependencies": [ - "jsr:@hono/hono@^4.7.10", + "jsr:@hono/hono@^4.9.8", "jsr:@std/assert@^1.0.14", "jsr:@std/cbor@~0.1.8", "jsr:@std/encoding@^1.0.10", - "jsr:@zod/zod@^4.0.17", - "npm:@atproto/crypto@~0.4.4", + "jsr:@zod/zod@^4.1.11", "npm:get-port@^7.1.0", "npm:http-errors@2", "npm:key-encoder@^2.0.3", "npm:multiformats@^13.4.1", - "npm:rate-limiter-flexible@^2.4.1", - "npm:uint8arrays@3.0.0", - "npm:ws@^8.12.0" + "npm:rate-limiter-flexible@^2.4.2", + "npm:ws@^8.18.3" ] } } diff --git a/lex-cli/deno.json b/lex-cli/deno.json index 5f878f8..8bb1626 100644 --- a/lex-cli/deno.json +++ b/lex-cli/deno.json @@ -10,6 +10,6 @@ "@std/path": "jsr:@std/path@^1.1.2", "prettier": "npm:prettier@^3.6.2", "ts-morph": "jsr:@ts-morph/ts-morph@^26.0.0", - "zod": "jsr:@zod/zod@^4.1.5" + "zod": "jsr:@zod/zod@^4.1.11" } } diff --git a/xrpc-server/auth.ts b/xrpc-server/auth.ts index 6af6f1d..e863457 100644 --- a/xrpc-server/auth.ts +++ b/xrpc-server/auth.ts @@ -1,7 +1,7 @@ -import * as ui8 from "uint8arrays"; +import * as ui8 from "@atp/bytes"; import * as common from "@atp/common"; import { MINUTE } from "@atp/common"; -import * as crypto from "@atproto/crypto"; +import * as crypto from "@atp/crypto"; import { AuthRequiredError } from "./errors.ts"; type ServiceJwtParams = { @@ -86,7 +86,7 @@ export type VerifySignatureWithKeyFn = ( msgBytes: Uint8Array, sigBytes: Uint8Array, alg: string, -) => Promise; +) => boolean; export const verifyJwt = async ( jwtStr: string, @@ -112,7 +112,7 @@ export const verifyJwt = async ( // service tokens are not OAuth 2.0 access tokens // https://datatracker.ietf.org/doc/html/rfc9068 header["typ"] === "at+jwt" || - // "refresh+jwt" is a non-standard type used by the @atproto packages + // "refresh+jwt" is a non-standard type used by atproto packages header["typ"] === "refresh+jwt" || // "DPoP" proofs are not meant to be used as service tokens // https://datatracker.ietf.org/doc/html/rfc9449 diff --git a/xrpc-server/deno.json b/xrpc-server/deno.json index 0c17e62..dc78082 100644 --- a/xrpc-server/deno.json +++ b/xrpc-server/deno.json @@ -4,7 +4,6 @@ "exports": "./mod.ts", "license": "MIT", "imports": { - "@atproto/crypto": "npm:@atproto/crypto@^0.4.4", "@std/assert": "jsr:@std/assert@^1.0.14", "@std/cbor": "jsr:@std/cbor@^0.1.8", "@std/encoding": "jsr:@std/encoding@^1.0.10", @@ -12,10 +11,9 @@ "http-errors": "npm:http-errors@^2.0.0", "key-encoder": "npm:key-encoder@^2.0.3", "multiformats": "npm:multiformats@^13.4.1", - "zod": "jsr:@zod/zod@^4.0.17", - "hono": "jsr:@hono/hono@^4.7.10", - "rate-limiter-flexible": "npm:rate-limiter-flexible@^2.4.1", - "uint8arrays": "npm:uint8arrays@3.0.0", - "ws": "npm:ws@^8.12.0" + "zod": "jsr:@zod/zod@^4.1.11", + "hono": "jsr:@hono/hono@^4.9.8", + "rate-limiter-flexible": "npm:rate-limiter-flexible@^2.4.2", + "ws": "npm:ws@^8.18.3" } } diff --git a/xrpc-server/tests/auth_test.ts b/xrpc-server/tests/auth_test.ts index 2800ce4..ffdc95d 100644 --- a/xrpc-server/tests/auth_test.ts +++ b/xrpc-server/tests/auth_test.ts @@ -1,5 +1,5 @@ import { MINUTE } from "@atp/common"; -import { Secp256k1Keypair } from "@atproto/crypto"; +import { Secp256k1Keypair } from "@atp/crypto"; import type { LexiconDoc } from "@atp/lexicon"; import { XrpcClient, XRPCError } from "@atp/xrpc"; import * as xrpcServer from "../mod.ts"; diff --git a/xrpc-server/tests/bodies_test.ts b/xrpc-server/tests/bodies_test.ts index 7535cec..7acd2d5 100644 --- a/xrpc-server/tests/bodies_test.ts +++ b/xrpc-server/tests/bodies_test.ts @@ -1,5 +1,5 @@ import { cidForCbor } from "@atp/common"; -import { randomBytes } from "@atproto/crypto"; +import { randomBytes } from "@atp/crypto"; import type { LexiconDoc } from "@atp/lexicon"; import { ResponseType, XrpcClient, XRPCError } from "@atp/xrpc"; import * as xrpcServer from "../mod.ts"; diff --git a/xrpc-server/tests/frames_test.ts b/xrpc-server/tests/frames_test.ts index fe88275..9498c9f 100644 --- a/xrpc-server/tests/frames_test.ts +++ b/xrpc-server/tests/frames_test.ts @@ -1,5 +1,5 @@ import { encodeCbor } from "@std/cbor"; -import * as uint8arrays from "uint8arrays"; +import * as uint8arrays from "@atp/bytes"; import { ErrorFrame, Frame, FrameType, MessageFrame } from "../mod.ts"; import { assertEquals, assertThrows } from "@std/assert";