@fedify/fedify 1.5.0-dev.665 → 1.5.0-dev.672

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.
package/CHANGES.md CHANGED
@@ -16,6 +16,9 @@ To be released.
16
16
  - Added `importPkcs1()` function.
17
17
  - Added `importPem()` function.
18
18
 
19
+ - Fedify became to choose the public key of the actor if `keyId` has no
20
+ fragment and the actor has only one public key. [[#211]]
21
+
19
22
  - Fixed a bug of the `fedify inbox` command where it had failed to render
20
23
  the web interface when the `fedify` command was installed using
21
24
  `deno install` command from JSR.
@@ -27,6 +30,7 @@ To be released.
27
30
  - You can easily copy the fediverse handle of the ephemeral actor.
28
31
 
29
32
  [#209]: https://github.com/fedify-dev/fedify/issues/209
33
+ [#211]: https://github.com/fedify-dev/fedify/issues/211
30
34
 
31
35
 
32
36
  Version 1.4.2
package/esm/deno.js CHANGED
@@ -1,6 +1,6 @@
1
1
  export default {
2
2
  "name": "@fedify/fedify",
3
- "version": "1.5.0-dev.665+b7e0de20",
3
+ "version": "1.5.0-dev.672+6a6ed659",
4
4
  "license": "MIT",
5
5
  "exports": {
6
6
  ".": "./mod.ts",
@@ -95,7 +95,7 @@ export async function importMultibaseKey(key) {
95
95
  type: "pkcs1",
96
96
  });
97
97
  const spki = keyObject.export({ type: "spki", format: "der" }).buffer;
98
- return await dntShim.crypto.subtle.importKey("spki", spki, { name: "RSASSA-PKCS1-v1_5", hash: "SHA-256" }, true, ["verify"]);
98
+ return await dntShim.crypto.subtle.importKey("spki", new Uint8Array(spki), { name: "RSASSA-PKCS1-v1_5", hash: "SHA-256" }, true, ["verify"]);
99
99
  }
100
100
  else if (code === 0xed) { // ed25519-pub
101
101
  return await dntShim.crypto.subtle.importKey("raw", content, "Ed25519", true, ["verify"]);
package/esm/sig/key.js CHANGED
@@ -208,12 +208,20 @@ cls, { documentLoader, contextLoader, keyCache, tracerProvider } = {}) {
208
208
  contextLoader,
209
209
  tracerProvider,
210
210
  });
211
+ let length = 0;
212
+ let lastKey = null;
211
213
  for await (const k of keys) {
214
+ length++;
215
+ lastKey = k;
212
216
  if (k.id?.href === keyId) {
213
217
  key = k;
214
218
  break;
215
219
  }
216
220
  }
221
+ const keyIdUrl = new URL(keyId);
222
+ if (key == null && keyIdUrl.hash === "" && length === 1) {
223
+ key = lastKey;
224
+ }
217
225
  if (key == null) {
218
226
  logger.debug("Failed to verify; object {keyId} returned an {actorType}, " +
219
227
  "but has no key matching {keyId}.", { keyId, actorType: object.constructor.name });