Unverified Commit 235629d5 authored by Hong Minhee's avatar Hong Minhee
Browse files

Rename publicKeyCache to publicKey

parent c796129a
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -86,7 +86,7 @@ To be released.
     -  Added `VerifyRequestOptions.keyCache` property.
     -  Added `VerifyProofOptions.keyCache` property.
     -  Added `VerifyObjectOptions.keyCache` property.
     -  Added `FederationKvPrefixes.publicKeyCache` property.
     -  Added `FederationKvPrefixes.publicKey` property.

 -  The built-in document loaders now recognize JSON-LD context provided in
    an HTTP `Link` header. [[#6]]
+6 −0
Original line number Diff line number Diff line
@@ -80,6 +80,12 @@ that the `Federation` object uses:
:   The key prefix used for storing remote JSON-LD documents.
    `["_fedify", "remoteDocument"]` by default.

`~FederationKvPrefixes.publicKey`
:   *This API is available since Fedify 0.12.0.*

    The key prefix used for caching public keys.  `["_fedify", "publicKey"]`
    by default.

### `queue`

*This API is available since Fedify 0.5.0.*
+3 −3
Original line number Diff line number Diff line
@@ -317,7 +317,7 @@ export interface InboxHandlerParameters<TContextData> {
  kv: KvStore;
  kvPrefixes: {
    activityIdempotence: KvKey;
    publicKeyCache: KvKey;
    publicKey: KvKey;
  };
  queue?: MessageQueue;
  actorDispatcher?: ActorDispatcher<TContextData>;
@@ -374,7 +374,7 @@ export async function handleInbox<TContextData>(
  const keyCache: KeyCache = {
    async get(keyId: URL) {
      const serialized = await kv.get([
        ...kvPrefixes.publicKeyCache,
        ...kvPrefixes.publicKey,
        keyId.href,
      ]);
      if (serialized == null) return null;
@@ -391,7 +391,7 @@ export async function handleInbox<TContextData>(
    },
    async set(keyId: URL, key: CryptographicKey | Multikey) {
      const serialized = await key.toJsonLd(context);
      await kv.set([...kvPrefixes.publicKeyCache, keyId.href], serialized);
      await kv.set([...kvPrefixes.publicKey, keyId.href], serialized);
    },
  };
  let activity: Activity | null;
+4 −4
Original line number Diff line number Diff line
@@ -246,11 +246,11 @@ export interface FederationKvPrefixes {
  remoteDocument: KvKey;

  /**
   * The key prefix used for caching public keys.  `["_fedify", "publicKey"]`
   * by default.
   * The key prefix used for caching public keys.
   * `["_fedify", "publicKey"]` by default.
   * @since 0.12.0
   */
  publicKeyCache: KvKey;
  publicKey: KvKey;
}

const invokedByCreateFederation = Symbol("invokedByCreateFederation");
@@ -335,7 +335,7 @@ export class Federation<TContextData> {
      ...({
        activityIdempotence: ["_fedify", "activityIdempotence"],
        remoteDocument: ["_fedify", "remoteDocument"],
        publicKeyCache: ["_fedify", "publicKey"],
        publicKey: ["_fedify", "publicKey"],
      } satisfies FederationKvPrefixes),
      ...(options.kvPrefixes ?? {}),
    };