Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/forward-client-capabilities-to-key-packages.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@internet-privacy/marmot-ts": patch
---

Forward the `MarmotClient` `capabilities` option to `KeyPackageManager` so custom capabilities (such as adding SelfRemove proposal type `0x000A` for Amethyst interop) are reflected in generated key packages instead of being silently ignored.
6 changes: 6 additions & 0 deletions src/client/key-package-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { EventSigner } from "applesauce-core";
import { NostrEvent } from "applesauce-core/helpers/event";
import { EventEmitter } from "eventemitter3";
import {
Capabilities,
CiphersuiteName,
ciphersuites,
CryptoProvider,
Expand Down Expand Up @@ -265,6 +266,8 @@ export type KeyPackageManagerOptions = {
network: NostrNetworkInterface;
/** The crypto provider to use for cryptographic operations */
cryptoProvider?: CryptoProvider;
/** Capabilities to advertise in generated key packages. Falls back to ts-mls `defaultCapabilities()` when omitted. */
capabilities?: Capabilities;
};

/**
Expand All @@ -287,6 +290,7 @@ export class KeyPackageManager extends EventEmitter<KeyPackageManagerEvents> {
private readonly cryptoProvider: CryptoProvider;
private readonly signer: EventSigner;
private readonly network: NostrNetworkInterface;
private readonly capabilities: Capabilities | undefined;

#log = logger.extend("KeyPackageManager");

Expand All @@ -297,6 +301,7 @@ export class KeyPackageManager extends EventEmitter<KeyPackageManagerEvents> {
this.signer = options.signer;
this.network = options.network;
this.clientId = options.clientId;
this.capabilities = options.capabilities;
}

// ---------------------------------------------------------------------------
Expand Down Expand Up @@ -506,6 +511,7 @@ export class KeyPackageManager extends EventEmitter<KeyPackageManagerEvents> {
credential,
ciphersuiteImpl: ciphersuite,
isLastResort: options.isLastResort,
capabilities: this.capabilities,
});

// Store private material locally, including the slot identifier
Expand Down
1 change: 1 addition & 0 deletions src/client/marmot-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ export class MarmotClient<
signer: options.signer,
network: options.network,
clientId: options.clientId,
capabilities: this.capabilities,
});

const historyFactory = (
Expand Down