@agntcy/slim-bindings-linux-arm64-gnu 2.0.0-alpha.3 → 2.0.0-alpha.5

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.
@@ -1,10 +1,10 @@
1
- import { type UniffiByteArray, type UniffiGcObject, type UniffiHandle, FfiConverterObject, FfiConverterObjectWithCallbacks, RustBuffer, UniffiAbstractObject, destructorGuardSymbol, pointerLiteralSymbol, uniffiTypeNameSymbol } from "@ubjs/core";
1
+ import { type UniffiByteArray, type UniffiGcObject, type UniffiHandle, FfiConverterObject, RustBuffer, UniffiAbstractObject, destructorGuardSymbol, pointerLiteralSymbol, uniffiTypeNameSymbol } from "@ubjs/core";
2
2
  /**
3
- * Create a new Service with builder pattern
3
+ * Create a new Service with builder pattern (native only)
4
4
  */
5
5
  export declare function createService(name: string): ServiceLike;
6
6
  /**
7
- * Create a new Service with configuration
7
+ * Create a new Service with configuration (native only)
8
8
  */
9
9
  export declare function createServiceWithConfig(name: string, config: ServiceConfig): ServiceLike;
10
10
  /**
@@ -109,7 +109,7 @@ export declare function isInitialized(): boolean;
109
109
  */
110
110
  export declare function newConfigFromJson(json: string): ClientConfig;
111
111
  /**
112
- * Create a new DataplaneConfig
112
+ * Create a new DataplaneConfig (native only)
113
113
  */
114
114
  export declare function newDataplaneConfig(): DataplaneConfig;
115
115
  /**
@@ -147,9 +147,9 @@ export declare function newServiceConfig(): ServiceConfig;
147
147
  /**
148
148
  * Create a new BindingsServiceConfig with custom values
149
149
  */
150
- export declare function newServiceConfigWith(nodeId: string | undefined, groupName: string | undefined, dataplane: DataplaneConfig): ServiceConfig;
150
+ export declare function newServiceConfigWith(nodeId: string | undefined, domainName: string | undefined, dataplane: DataplaneConfig): ServiceConfig;
151
151
  /**
152
- * Create a new ServiceConfiguration
152
+ * Create a new ServiceConfiguration (native only)
153
153
  */
154
154
  export declare function newServiceConfiguration(): ServiceConfig;
155
155
  /**
@@ -1422,8 +1422,8 @@ export type ClientConfig = {
1422
1422
  * Generated factory for {@link ClientConfig} record objects.
1423
1423
  */
1424
1424
  export declare const ClientConfig: Readonly<{
1425
- create: (partial: Partial<ClientConfig> & Required<Omit<ClientConfig, "origin" | "tls" | "headers" | "endpoint" | "serverName" | "compression" | "rateLimit" | "keepalive" | "proxy" | "connectTimeout" | "requestTimeout" | "bufferSize" | "auth" | "backoff" | "metadata" | "requireHeaderMac">>) => ClientConfig;
1426
- new: (partial: Partial<ClientConfig> & Required<Omit<ClientConfig, "origin" | "tls" | "headers" | "endpoint" | "serverName" | "compression" | "rateLimit" | "keepalive" | "proxy" | "connectTimeout" | "requestTimeout" | "bufferSize" | "auth" | "backoff" | "metadata" | "requireHeaderMac">>) => ClientConfig;
1425
+ create: (partial: Partial<ClientConfig> & Required<Omit<ClientConfig, "tls" | "headers" | "endpoint" | "origin" | "serverName" | "compression" | "rateLimit" | "keepalive" | "proxy" | "connectTimeout" | "requestTimeout" | "bufferSize" | "auth" | "backoff" | "metadata" | "requireHeaderMac">>) => ClientConfig;
1426
+ new: (partial: Partial<ClientConfig> & Required<Omit<ClientConfig, "tls" | "headers" | "endpoint" | "origin" | "serverName" | "compression" | "rateLimit" | "keepalive" | "proxy" | "connectTimeout" | "requestTimeout" | "bufferSize" | "auth" | "backoff" | "metadata" | "requireHeaderMac">>) => ClientConfig;
1427
1427
  defaults: () => Partial<ClientConfig>;
1428
1428
  }>;
1429
1429
  /**
@@ -1761,7 +1761,7 @@ export declare const ServerConfig: Readonly<{
1761
1761
  defaults: () => Partial<ServerConfig>;
1762
1762
  }>;
1763
1763
  /**
1764
- * DataPlane configuration wrapper for uniffi bindings
1764
+ * DataPlane configuration wrapper for uniffi bindings (native only — wraps gRPC config)
1765
1765
  */
1766
1766
  export type DataplaneConfig = {
1767
1767
  /**
@@ -1880,69 +1880,87 @@ export type MlsSettings = {
1880
1880
  * 0 = disable header-integrity checks; 1–100 = percent of messages to verify after decrypt.
1881
1881
  */
1882
1882
  headerIntegrityValidationPercent: number;
1883
+ /**
1884
+ * Maximum remembered control-message IDs used for replay protection.
1885
+ * `None` uses the SLIM core default.
1886
+ */
1887
+ maxSeenControlMessageIdsSize?: bigint;
1883
1888
  };
1884
1889
  /**
1885
1890
  * Generated factory for {@link MlsSettings} record objects.
1886
1891
  */
1887
1892
  export declare const MlsSettings: Readonly<{
1888
- create: (partial: Partial<MlsSettings> & Required<Omit<MlsSettings, "headerIntegrityValidationPercent">>) => MlsSettings;
1889
- new: (partial: Partial<MlsSettings> & Required<Omit<MlsSettings, "headerIntegrityValidationPercent">>) => MlsSettings;
1893
+ create: (partial: Partial<MlsSettings> & Required<Omit<MlsSettings, "headerIntegrityValidationPercent" | "maxSeenControlMessageIdsSize">>) => MlsSettings;
1894
+ new: (partial: Partial<MlsSettings> & Required<Omit<MlsSettings, "headerIntegrityValidationPercent" | "maxSeenControlMessageIdsSize">>) => MlsSettings;
1890
1895
  defaults: () => Partial<MlsSettings>;
1891
1896
  }>;
1892
1897
  /**
1893
- * Received message containing context and payload
1898
+ * Online/offline status of a session participant
1894
1899
  */
1895
- export type ReceivedMessage = {
1896
- context: MessageContext;
1897
- payload: ArrayBuffer;
1900
+ export declare enum ParticipantStatus {
1901
+ Online = 0,
1902
+ Offline = 1
1903
+ }
1904
+ /**
1905
+ * A participant in a session together with their current status
1906
+ */
1907
+ export type ParticipantInfo = {
1908
+ name: NameLike;
1909
+ status: ParticipantStatus;
1898
1910
  };
1899
1911
  /**
1900
- * Generated factory for {@link ReceivedMessage} record objects.
1912
+ * Generated factory for {@link ParticipantInfo} record objects.
1901
1913
  */
1902
- export declare const ReceivedMessage: Readonly<{
1903
- create: (partial: Partial<ReceivedMessage> & Required<Omit<ReceivedMessage, "context" | "payload">>) => ReceivedMessage;
1904
- new: (partial: Partial<ReceivedMessage> & Required<Omit<ReceivedMessage, "context" | "payload">>) => ReceivedMessage;
1905
- defaults: () => Partial<ReceivedMessage>;
1914
+ export declare const ParticipantInfo: Readonly<{
1915
+ create: (partial: Partial<ParticipantInfo> & Required<Omit<ParticipantInfo, "name" | "status">>) => ParticipantInfo;
1916
+ new: (partial: Partial<ParticipantInfo> & Required<Omit<ParticipantInfo, "name" | "status">>) => ParticipantInfo;
1917
+ defaults: () => Partial<ParticipantInfo>;
1906
1918
  }>;
1907
1919
  /**
1908
- * Per-message context for a multicast RPC response — identifies which group
1909
- * member sent the response.
1920
+ * Where and how a session's MLS/state is persisted at rest.
1921
+ *
1922
+ * Persistence is opt-in and app-level: pass this to
1923
+ * [`Service::create_app_with_persistence`] to get a restorable app.
1910
1924
  */
1911
- export type RpcMessageContext = {
1925
+ export type PersistenceConfig = {
1926
+ /**
1927
+ * Directory holding the encrypted store (one file per identity).
1928
+ */
1929
+ path: string;
1912
1930
  /**
1913
- * The SLIM name of the group member that sent this response.
1931
+ * Passphrase protecting the store. **Set this.**
1932
+ *
1933
+ * When `Some`, a 256-bit AES key is derived from it and the store is
1934
+ * genuinely confidential. When `None`, the key is instead derived from the
1935
+ * app's **public** name: the store still detects tampering and is stable
1936
+ * across restarts, but it offers **no confidentiality** — anyone who can
1937
+ * read the database file and knows the app name can decrypt it. Only rely
1938
+ * on the `None` fallback when the filesystem itself is your trust boundary.
1914
1939
  */
1915
- source: NameLike;
1940
+ passphrase?: string;
1916
1941
  };
1917
1942
  /**
1918
- * Generated factory for {@link RpcMessageContext} record objects.
1943
+ * Generated factory for {@link PersistenceConfig} record objects.
1919
1944
  */
1920
- export declare const RpcMessageContext: Readonly<{
1921
- create: (partial: Partial<RpcMessageContext> & Required<Omit<RpcMessageContext, "source">>) => RpcMessageContext;
1922
- new: (partial: Partial<RpcMessageContext> & Required<Omit<RpcMessageContext, "source">>) => RpcMessageContext;
1923
- defaults: () => Partial<RpcMessageContext>;
1945
+ export declare const PersistenceConfig: Readonly<{
1946
+ create: (partial: Partial<PersistenceConfig> & Required<Omit<PersistenceConfig, "path" | "passphrase">>) => PersistenceConfig;
1947
+ new: (partial: Partial<PersistenceConfig> & Required<Omit<PersistenceConfig, "path" | "passphrase">>) => PersistenceConfig;
1948
+ defaults: () => Partial<PersistenceConfig>;
1924
1949
  }>;
1925
1950
  /**
1926
- * A single item in a multicast response stream, pairing the response payload
1927
- * with the identity of the member that produced it.
1951
+ * Received message containing context and payload
1928
1952
  */
1929
- export type RpcMulticastItem = {
1930
- /**
1931
- * Context identifying the source member.
1932
- */
1933
- context: RpcMessageContext;
1934
- /**
1935
- * The encoded response payload (raw bytes).
1936
- */
1937
- message: ArrayBuffer;
1953
+ export type ReceivedMessage = {
1954
+ context: MessageContext;
1955
+ payload: ArrayBuffer;
1938
1956
  };
1939
1957
  /**
1940
- * Generated factory for {@link RpcMulticastItem} record objects.
1958
+ * Generated factory for {@link ReceivedMessage} record objects.
1941
1959
  */
1942
- export declare const RpcMulticastItem: Readonly<{
1943
- create: (partial: Partial<RpcMulticastItem> & Required<Omit<RpcMulticastItem, "message" | "context">>) => RpcMulticastItem;
1944
- new: (partial: Partial<RpcMulticastItem> & Required<Omit<RpcMulticastItem, "message" | "context">>) => RpcMulticastItem;
1945
- defaults: () => Partial<RpcMulticastItem>;
1960
+ export declare const ReceivedMessage: Readonly<{
1961
+ create: (partial: Partial<ReceivedMessage> & Required<Omit<ReceivedMessage, "context" | "payload">>) => ReceivedMessage;
1962
+ new: (partial: Partial<ReceivedMessage> & Required<Omit<ReceivedMessage, "context" | "payload">>) => ReceivedMessage;
1963
+ defaults: () => Partial<ReceivedMessage>;
1946
1964
  }>;
1947
1965
  /**
1948
1966
  * Runtime configuration for the SLIM bindings
@@ -1972,7 +1990,7 @@ export declare const RuntimeConfig: Readonly<{
1972
1990
  defaults: () => Partial<RuntimeConfig>;
1973
1991
  }>;
1974
1992
  /**
1975
- * Service configuration wrapper for uniffi bindings
1993
+ * Service configuration wrapper for uniffi bindings (native only — includes gRPC dataplane config)
1976
1994
  */
1977
1995
  export type ServiceConfig = {
1978
1996
  /**
@@ -1982,7 +2000,7 @@ export type ServiceConfig = {
1982
2000
  /**
1983
2001
  * Optional group name for the service
1984
2002
  */
1985
- groupName?: string;
2003
+ domainName?: string;
1986
2004
  /**
1987
2005
  * DataPlane configuration (servers and clients)
1988
2006
  */
@@ -1992,8 +2010,8 @@ export type ServiceConfig = {
1992
2010
  * Generated factory for {@link ServiceConfig} record objects.
1993
2011
  */
1994
2012
  export declare const ServiceConfig: Readonly<{
1995
- create: (partial: Partial<ServiceConfig> & Required<Omit<ServiceConfig, "nodeId" | "groupName" | "dataplane">>) => ServiceConfig;
1996
- new: (partial: Partial<ServiceConfig> & Required<Omit<ServiceConfig, "nodeId" | "groupName" | "dataplane">>) => ServiceConfig;
2013
+ create: (partial: Partial<ServiceConfig> & Required<Omit<ServiceConfig, "nodeId" | "domainName" | "dataplane">>) => ServiceConfig;
2014
+ new: (partial: Partial<ServiceConfig> & Required<Omit<ServiceConfig, "nodeId" | "domainName" | "dataplane">>) => ServiceConfig;
1997
2015
  defaults: () => Partial<ServiceConfig>;
1998
2016
  }>;
1999
2017
  /**
@@ -3018,6 +3036,22 @@ export declare class CompletionHandle extends UniffiAbstractObject implements Co
3018
3036
  uniffiDestroy(): void;
3019
3037
  static instanceOf(obj_: any): obj_ is CompletionHandle;
3020
3038
  }
3039
+ /**
3040
+ * How a session should be closed.
3041
+ */
3042
+ export declare enum CloseMode {
3043
+ /**
3044
+ * Soft close: go offline so the session can be brought back later with
3045
+ * `rejoin()`. This is an in-memory group operation and does not require
3046
+ * persistence (though a persisted session also survives a process restart).
3047
+ * Not valid for point-to-point sessions.
3048
+ */
3049
+ Soft = 0,
3050
+ /**
3051
+ * Hard close: terminate the session permanently.
3052
+ */
3053
+ Hard = 1
3054
+ }
3021
3055
  /**
3022
3056
  * Session context for language bindings (UniFFI-compatible)
3023
3057
  *
@@ -3025,6 +3059,54 @@ export declare class CompletionHandle extends UniffiAbstractObject implements Co
3025
3059
  * Provides both synchronous (blocking) and asynchronous methods for FFI compatibility.
3026
3060
  */
3027
3061
  export interface SessionLike {
3062
+ /**
3063
+ * Hard-close the session (blocking version): terminate it permanently.
3064
+ * For a soft, restorable close use [`Self::close_with_mode`].
3065
+ */
3066
+ close(): CompletionHandleLike;
3067
+ /**
3068
+ * Hard-close the session and wait for completion (blocking version). See [`Self::close`].
3069
+ */
3070
+ closeAndWait(): void;
3071
+ /**
3072
+ * Hard-close the session and wait for completion (async version). See [`Self::close`].
3073
+ */
3074
+ closeAndWaitAsync(asyncOpts_?: {
3075
+ signal: AbortSignal;
3076
+ }): Promise<void>;
3077
+ /**
3078
+ * Hard-close the session (async version). See [`Self::close`].
3079
+ */
3080
+ closeAsync(asyncOpts_?: {
3081
+ signal: AbortSignal;
3082
+ }): Promise<CompletionHandleLike>;
3083
+ /**
3084
+ * Close the session with an explicit [`CloseMode`] (blocking version).
3085
+ *
3086
+ * [`CloseMode::Soft`] notifies the group that this participant is going
3087
+ * offline so it can be brought back with `rejoin()` (an in-memory group
3088
+ * operation; persistence is not required). Only valid for Group sessions;
3089
+ * returns an error for PointToPoint sessions. [`CloseMode::Hard`] terminates
3090
+ * the session permanently. Returns a completion handle that resolves when
3091
+ * ACKs are collected or on timeout.
3092
+ */
3093
+ closeWithMode(mode: CloseMode): CompletionHandleLike;
3094
+ /**
3095
+ * Close the session with an explicit [`CloseMode`] and wait for completion (blocking version).
3096
+ */
3097
+ closeWithModeAndWait(mode: CloseMode): void;
3098
+ /**
3099
+ * Close the session with an explicit [`CloseMode`] and wait for completion (async version).
3100
+ */
3101
+ closeWithModeAndWaitAsync(mode: CloseMode, asyncOpts_?: {
3102
+ signal: AbortSignal;
3103
+ }): Promise<void>;
3104
+ /**
3105
+ * Close the session with an explicit [`CloseMode`] (async version). See [`Self::close_with_mode`].
3106
+ */
3107
+ closeWithModeAsync(mode: CloseMode, asyncOpts_?: {
3108
+ signal: AbortSignal;
3109
+ }): Promise<CompletionHandleLike>;
3028
3110
  /**
3029
3111
  * Get the session configuration
3030
3112
  */
@@ -3087,15 +3169,15 @@ export interface SessionLike {
3087
3169
  */
3088
3170
  metadata(): Map<string, string>;
3089
3171
  /**
3090
- * Get list of participants in the session (blocking version for FFI)
3172
+ * Get list of participants in the session with their online/offline status (blocking version for FFI)
3091
3173
  */
3092
- participantsList(): Array<NameLike>;
3174
+ participantsList(): Array<ParticipantInfo>;
3093
3175
  /**
3094
- * Get list of participants in the session
3176
+ * Get list of participants in the session with their online/offline status (async version)
3095
3177
  */
3096
3178
  participantsListAsync(asyncOpts_?: {
3097
3179
  signal: AbortSignal;
3098
- }): Promise<Array<NameLike>>;
3180
+ }): Promise<Array<ParticipantInfo>>;
3099
3181
  /**
3100
3182
  * Publish a message to the session's destination (blocking version)
3101
3183
  *
@@ -3202,6 +3284,30 @@ export interface SessionLike {
3202
3284
  publishWithParamsAsync(destination: NameLike, fanout: number, data: ArrayBuffer, connectionOut: bigint | undefined, payloadType: string | undefined, metadata: Map<string, string> | undefined, asyncOpts_?: {
3203
3285
  signal: AbortSignal;
3204
3286
  }): Promise<void>;
3287
+ /**
3288
+ * Notify the group that this participant is back online (blocking version).
3289
+ *
3290
+ * Only valid for Group sessions; returns an error for PointToPoint sessions.
3291
+ * Returns a completion handle that resolves when ACKs/NACKs are collected.
3292
+ * If any participant NACKs due to an MLS epoch mismatch, the rejoin fails.
3293
+ */
3294
+ rejoin(): CompletionHandleLike;
3295
+ /**
3296
+ * Notify the group that this participant is back online and wait for completion (blocking version).
3297
+ */
3298
+ rejoinAndWait(): void;
3299
+ /**
3300
+ * Notify the group that this participant is back online and wait for completion (async version).
3301
+ */
3302
+ rejoinAndWaitAsync(asyncOpts_?: {
3303
+ signal: AbortSignal;
3304
+ }): Promise<void>;
3305
+ /**
3306
+ * Notify the group that this participant is back online (async version).
3307
+ */
3308
+ rejoinAsync(asyncOpts_?: {
3309
+ signal: AbortSignal;
3310
+ }): Promise<CompletionHandleLike>;
3205
3311
  /**
3206
3312
  * Remove a participant from the session (blocking version)
3207
3313
  *
@@ -3258,6 +3364,54 @@ export declare class Session extends UniffiAbstractObject implements SessionLike
3258
3364
  readonly [destructorGuardSymbol]: UniffiGcObject;
3259
3365
  readonly [pointerLiteralSymbol]: UniffiHandle;
3260
3366
  private constructor();
3367
+ /**
3368
+ * Hard-close the session (blocking version): terminate it permanently.
3369
+ * For a soft, restorable close use [`Self::close_with_mode`].
3370
+ */
3371
+ close(): CompletionHandleLike;
3372
+ /**
3373
+ * Hard-close the session and wait for completion (blocking version). See [`Self::close`].
3374
+ */
3375
+ closeAndWait(): void;
3376
+ /**
3377
+ * Hard-close the session and wait for completion (async version). See [`Self::close`].
3378
+ */
3379
+ closeAndWaitAsync(asyncOpts_?: {
3380
+ signal: AbortSignal;
3381
+ }): Promise<void>;
3382
+ /**
3383
+ * Hard-close the session (async version). See [`Self::close`].
3384
+ */
3385
+ closeAsync(asyncOpts_?: {
3386
+ signal: AbortSignal;
3387
+ }): Promise<CompletionHandleLike>;
3388
+ /**
3389
+ * Close the session with an explicit [`CloseMode`] (blocking version).
3390
+ *
3391
+ * [`CloseMode::Soft`] notifies the group that this participant is going
3392
+ * offline so it can be brought back with `rejoin()` (an in-memory group
3393
+ * operation; persistence is not required). Only valid for Group sessions;
3394
+ * returns an error for PointToPoint sessions. [`CloseMode::Hard`] terminates
3395
+ * the session permanently. Returns a completion handle that resolves when
3396
+ * ACKs are collected or on timeout.
3397
+ */
3398
+ closeWithMode(mode: CloseMode): CompletionHandleLike;
3399
+ /**
3400
+ * Close the session with an explicit [`CloseMode`] and wait for completion (blocking version).
3401
+ */
3402
+ closeWithModeAndWait(mode: CloseMode): void;
3403
+ /**
3404
+ * Close the session with an explicit [`CloseMode`] and wait for completion (async version).
3405
+ */
3406
+ closeWithModeAndWaitAsync(mode: CloseMode, asyncOpts_?: {
3407
+ signal: AbortSignal;
3408
+ }): Promise<void>;
3409
+ /**
3410
+ * Close the session with an explicit [`CloseMode`] (async version). See [`Self::close_with_mode`].
3411
+ */
3412
+ closeWithModeAsync(mode: CloseMode, asyncOpts_?: {
3413
+ signal: AbortSignal;
3414
+ }): Promise<CompletionHandleLike>;
3261
3415
  /**
3262
3416
  * Get the session configuration
3263
3417
  */
@@ -3320,15 +3474,15 @@ export declare class Session extends UniffiAbstractObject implements SessionLike
3320
3474
  */
3321
3475
  metadata(): Map<string, string>;
3322
3476
  /**
3323
- * Get list of participants in the session (blocking version for FFI)
3477
+ * Get list of participants in the session with their online/offline status (blocking version for FFI)
3324
3478
  */
3325
- participantsList(): Array<NameLike>;
3479
+ participantsList(): Array<ParticipantInfo>;
3326
3480
  /**
3327
- * Get list of participants in the session
3481
+ * Get list of participants in the session with their online/offline status (async version)
3328
3482
  */
3329
3483
  participantsListAsync(asyncOpts_?: {
3330
3484
  signal: AbortSignal;
3331
- }): Promise<Array<NameLike>>;
3485
+ }): Promise<Array<ParticipantInfo>>;
3332
3486
  /**
3333
3487
  * Publish a message to the session's destination (blocking version)
3334
3488
  *
@@ -3435,6 +3589,30 @@ export declare class Session extends UniffiAbstractObject implements SessionLike
3435
3589
  publishWithParamsAsync(destination: NameLike, fanout: number, data: ArrayBuffer, connectionOut: bigint | undefined, payloadType: string | undefined, metadata: Map<string, string> | undefined, asyncOpts_?: {
3436
3590
  signal: AbortSignal;
3437
3591
  }): Promise<void>;
3592
+ /**
3593
+ * Notify the group that this participant is back online (blocking version).
3594
+ *
3595
+ * Only valid for Group sessions; returns an error for PointToPoint sessions.
3596
+ * Returns a completion handle that resolves when ACKs/NACKs are collected.
3597
+ * If any participant NACKs due to an MLS epoch mismatch, the rejoin fails.
3598
+ */
3599
+ rejoin(): CompletionHandleLike;
3600
+ /**
3601
+ * Notify the group that this participant is back online and wait for completion (blocking version).
3602
+ */
3603
+ rejoinAndWait(): void;
3604
+ /**
3605
+ * Notify the group that this participant is back online and wait for completion (async version).
3606
+ */
3607
+ rejoinAndWaitAsync(asyncOpts_?: {
3608
+ signal: AbortSignal;
3609
+ }): Promise<void>;
3610
+ /**
3611
+ * Notify the group that this participant is back online (async version).
3612
+ */
3613
+ rejoinAsync(asyncOpts_?: {
3614
+ signal: AbortSignal;
3615
+ }): Promise<CompletionHandleLike>;
3438
3616
  /**
3439
3617
  * Remove a participant from the session (blocking version)
3440
3618
  *
@@ -3911,2249 +4089,373 @@ export declare const IdentityVerifierConfig: Readonly<{
3911
4089
  */
3912
4090
  export type IdentityVerifierConfig = InstanceType<typeof IdentityVerifierConfig['SharedSecret' | 'Jwt' | 'Spire' | 'None']>;
3913
4091
  /**
3914
- * gRPC status codes
4092
+ * Transport protocol for dataplane communication.
4093
+ */
4094
+ export declare enum TransportProtocol {
4095
+ Grpc = 0,
4096
+ Websocket = 1
4097
+ }
4098
+ /**
4099
+ * Adapter that bridges the App API with the language-bindings interface.
4100
+ *
4101
+ * Both native and browser builds wrap the same [`slim_service::app::App`] with
4102
+ * the same `AuthProvider`/`AuthVerifier` type parameters; the only structural
4103
+ * difference is the lifecycle owner:
4104
+ *
4105
+ * - Native keeps the owning [`slim_service::Service`] alive.
4106
+ * - Browser (wasm32) uses `AuthProvider::SharedSecret` identity and keeps the
4107
+ * WebSocket [`slim_datapath::message_processing::MessageProcessor`] alive
4108
+ * together with the upstream connection id.
3915
4109
  */
3916
- export declare enum RpcCode {
4110
+ export interface AppLike {
4111
+ /**
4112
+ * Create a new session (blocking version for FFI)
4113
+ *
4114
+ * Returns a SessionWithCompletion containing the session context and a completion handle.
4115
+ * Call `.wait()` on the completion handle to wait for session establishment.
4116
+ */
4117
+ createSession(config: SessionConfig, destination: NameLike): SessionWithCompletion;
4118
+ /**
4119
+ * Create a new session and wait for completion (blocking version)
4120
+ *
4121
+ * This method creates a session and blocks until the session establishment completes.
4122
+ * Returns only the session context, as the completion has already been awaited.
4123
+ */
4124
+ createSessionAndWait(config: SessionConfig, destination: NameLike): SessionLike;
4125
+ /**
4126
+ * Create a new session and wait for completion (async version)
4127
+ *
4128
+ * This method creates a session and waits until the session establishment completes.
4129
+ * Returns only the session context, as the completion has already been awaited.
4130
+ */
4131
+ createSessionAndWaitAsync(config: SessionConfig, destination: NameLike, asyncOpts_?: {
4132
+ signal: AbortSignal;
4133
+ }): Promise<SessionLike>;
4134
+ /**
4135
+ * Create a new session (async version)
4136
+ *
4137
+ * Returns a SessionWithCompletion containing the session context and a completion handle.
4138
+ * Await the completion handle to wait for session establishment.
4139
+ * For point-to-point sessions, this ensures the remote peer has acknowledged the session.
4140
+ * For multicast sessions, this ensures the initial setup is complete.
4141
+ */
4142
+ createSessionAsync(config: SessionConfig, destination: NameLike, asyncOpts_?: {
4143
+ signal: AbortSignal;
4144
+ }): Promise<SessionWithCompletion>;
3917
4145
  /**
3918
- * Success
4146
+ * Delete a session (blocking version for FFI)
4147
+ *
4148
+ * Returns a completion handle that can be awaited to ensure the deletion completes.
4149
+ */
4150
+ deleteSession(session: SessionLike): CompletionHandleLike;
4151
+ /**
4152
+ * Delete a session and wait for completion (blocking version)
4153
+ *
4154
+ * This method deletes a session and blocks until the deletion completes.
3919
4155
  */
3920
- Ok = 0,
4156
+ deleteSessionAndWait(session: SessionLike): void;
3921
4157
  /**
3922
- * The operation was cancelled
4158
+ * Delete a session and wait for completion (async version)
4159
+ *
4160
+ * This method deletes a session and waits until the deletion completes.
3923
4161
  */
3924
- Cancelled = 1,
4162
+ deleteSessionAndWaitAsync(session: SessionLike, asyncOpts_?: {
4163
+ signal: AbortSignal;
4164
+ }): Promise<void>;
3925
4165
  /**
3926
- * Unknown error
4166
+ * Delete a session (async version)
4167
+ *
4168
+ * Returns a completion handle that can be awaited to ensure the deletion completes.
3927
4169
  */
3928
- Unknown = 2,
4170
+ deleteSessionAsync(session: SessionLike, asyncOpts_?: {
4171
+ signal: AbortSignal;
4172
+ }): Promise<CompletionHandleLike>;
3929
4173
  /**
3930
- * Client specified an invalid argument
4174
+ * Get the app ID in UUID format
3931
4175
  */
3932
- InvalidArgument = 3,
4176
+ id(): string;
3933
4177
  /**
3934
- * Deadline exceeded before operation could complete
4178
+ * Listen for incoming sessions (blocking version for FFI)
3935
4179
  */
3936
- DeadlineExceeded = 4,
4180
+ listenForSession(timeout: number | undefined): SessionLike;
3937
4181
  /**
3938
- * Some requested entity was not found
4182
+ * Listen for incoming sessions (async version)
3939
4183
  */
3940
- NotFound = 5,
4184
+ listenForSessionAsync(timeout: number | undefined, asyncOpts_?: {
4185
+ signal: AbortSignal;
4186
+ }): Promise<SessionLike>;
3941
4187
  /**
3942
- * Some entity that we attempted to create already exists
4188
+ * Get the app name
3943
4189
  */
3944
- AlreadyExists = 6,
4190
+ name(): NameLike;
3945
4191
  /**
3946
- * The caller does not have permission to execute the specified operation
4192
+ * Remove a route (blocking version for FFI)
3947
4193
  */
3948
- PermissionDenied = 7,
4194
+ removeRoute(name: NameLike, connectionId: bigint): void;
3949
4195
  /**
3950
- * Some resource has been exhausted
4196
+ * Remove a route (async version)
3951
4197
  */
3952
- ResourceExhausted = 8,
4198
+ removeRouteAsync(name: NameLike, connectionId: bigint, asyncOpts_?: {
4199
+ signal: AbortSignal;
4200
+ }): Promise<void>;
3953
4201
  /**
3954
- * The system is not in a state required for the operation's execution
4202
+ * Blocking wrapper around [`App::restore_sessions_async`].
3955
4203
  */
3956
- FailedPrecondition = 9,
4204
+ restoreSessions(connId: bigint): Array<SessionLike>;
3957
4205
  /**
3958
- * The operation was aborted
4206
+ * Restore the app's persisted sessions after a restart (async).
4207
+ *
4208
+ * Only meaningful for an app created with
4209
+ * [`crate::service::Service::create_app_with_persistence`]; returns an
4210
+ * empty list when persistence is disabled. `conn_id` must be the live
4211
+ * upstream connection to the node (the one the app subscribes over).
4212
+ * Each restored session rejoins its MLS group without repeating the
4213
+ * invite/welcome handshake.
3959
4214
  */
3960
- Aborted = 10,
4215
+ restoreSessionsAsync(connId: bigint, asyncOpts_?: {
4216
+ signal: AbortSignal;
4217
+ }): Promise<Array<SessionLike>>;
3961
4218
  /**
3962
- * Operation was attempted past the valid range
4219
+ * Set a route to a name for a specific connection (blocking version for FFI)
3963
4220
  */
3964
- OutOfRange = 11,
4221
+ setRoute(name: NameLike, connectionId: bigint): void;
3965
4222
  /**
3966
- * Operation is not implemented or not supported
4223
+ * Set a route to a name for a specific connection (async version)
3967
4224
  */
3968
- Unimplemented = 12,
4225
+ setRouteAsync(name: NameLike, connectionId: bigint, asyncOpts_?: {
4226
+ signal: AbortSignal;
4227
+ }): Promise<void>;
3969
4228
  /**
3970
- * Internal errors
4229
+ * Subscribe to a session name (blocking version for FFI)
3971
4230
  */
3972
- Internal = 13,
4231
+ subscribe(name: NameLike, connectionId: bigint | undefined): void;
3973
4232
  /**
3974
- * The service is currently unavailable
4233
+ * Subscribe to a name (async version)
3975
4234
  */
3976
- Unavailable = 14,
4235
+ subscribeAsync(name: NameLike, connectionId: bigint | undefined, asyncOpts_?: {
4236
+ signal: AbortSignal;
4237
+ }): Promise<void>;
3977
4238
  /**
3978
- * Unrecoverable data loss or corruption
4239
+ * Unsubscribe from a name (blocking version for FFI)
3979
4240
  */
3980
- DataLoss = 15,
4241
+ unsubscribe(name: NameLike, connectionId: bigint | undefined): void;
3981
4242
  /**
3982
- * The request does not have valid authentication credentials
4243
+ * Unsubscribe from a name (async version)
3983
4244
  */
3984
- Unauthenticated = 16
3985
- }
3986
- export declare enum RpcError_Tags {
3987
- Rpc = "Rpc",
3988
- MulticastRpc = "MulticastRpc",
3989
- MulticastSessionClosed = "MulticastSessionClosed"
4245
+ unsubscribeAsync(name: NameLike, connectionId: bigint | undefined, asyncOpts_?: {
4246
+ signal: AbortSignal;
4247
+ }): Promise<void>;
3990
4248
  }
3991
4249
  /**
3992
- * UniFFI-compatible RPC error
4250
+ * @deprecated Use `AppLike` instead.
4251
+ */
4252
+ export type AppInterface = AppLike;
4253
+ /**
4254
+ * Adapter that bridges the App API with the language-bindings interface.
4255
+ *
4256
+ * Both native and browser builds wrap the same [`slim_service::app::App`] with
4257
+ * the same `AuthProvider`/`AuthVerifier` type parameters; the only structural
4258
+ * difference is the lifecycle owner:
3993
4259
  *
3994
- * This represents RPC errors with gRPC-compatible status codes.
4260
+ * - Native keeps the owning [`slim_service::Service`] alive.
4261
+ * - Browser (wasm32) uses `AuthProvider::SharedSecret` identity and keeps the
4262
+ * WebSocket [`slim_datapath::message_processing::MessageProcessor`] alive
4263
+ * together with the upstream connection id.
3995
4264
  */
3996
- export declare const RpcError: Readonly<{
3997
- instanceOf: (obj: any) => obj is RpcError;
3998
- Rpc: {
3999
- new (inner: {
4000
- code: RpcCode;
4001
- message: string;
4002
- details?: ArrayBuffer;
4003
- }): {
4004
- readonly tag: RpcError_Tags.Rpc;
4005
- readonly inner: Readonly<{
4006
- code: RpcCode;
4007
- message: string;
4008
- details?: ArrayBuffer;
4009
- }>;
4010
- /**
4011
- * @private
4012
- * This field is private and should not be used, use `tag` instead.
4013
- */
4014
- readonly [uniffiTypeNameSymbol]: "RpcError";
4015
- name: string;
4016
- message: string;
4017
- stack?: string;
4018
- };
4019
- "new"(inner: {
4020
- code: RpcCode;
4021
- message: string;
4022
- details?: ArrayBuffer;
4023
- }): {
4024
- readonly tag: RpcError_Tags.Rpc;
4025
- readonly inner: Readonly<{
4026
- code: RpcCode;
4027
- message: string;
4028
- details?: ArrayBuffer;
4029
- }>;
4030
- /**
4031
- * @private
4032
- * This field is private and should not be used, use `tag` instead.
4033
- */
4034
- readonly [uniffiTypeNameSymbol]: "RpcError";
4035
- name: string;
4036
- message: string;
4037
- stack?: string;
4038
- };
4039
- instanceOf(obj: any): obj is {
4040
- readonly tag: RpcError_Tags.Rpc;
4041
- readonly inner: Readonly<{
4042
- code: RpcCode;
4043
- message: string;
4044
- details?: ArrayBuffer;
4045
- }>;
4046
- /**
4047
- * @private
4048
- * This field is private and should not be used, use `tag` instead.
4049
- */
4050
- readonly [uniffiTypeNameSymbol]: "RpcError";
4051
- name: string;
4052
- message: string;
4053
- stack?: string;
4054
- };
4055
- hasInner(obj: any): obj is {
4056
- readonly tag: RpcError_Tags.Rpc;
4057
- readonly inner: Readonly<{
4058
- code: RpcCode;
4059
- message: string;
4060
- details?: ArrayBuffer;
4061
- }>;
4062
- /**
4063
- * @private
4064
- * This field is private and should not be used, use `tag` instead.
4065
- */
4066
- readonly [uniffiTypeNameSymbol]: "RpcError";
4067
- name: string;
4068
- message: string;
4069
- stack?: string;
4070
- };
4071
- getInner(obj: {
4072
- readonly tag: RpcError_Tags.Rpc;
4073
- readonly inner: Readonly<{
4074
- code: RpcCode;
4075
- message: string;
4076
- details?: ArrayBuffer;
4077
- }>;
4078
- /**
4079
- * @private
4080
- * This field is private and should not be used, use `tag` instead.
4081
- */
4082
- readonly [uniffiTypeNameSymbol]: "RpcError";
4083
- name: string;
4084
- message: string;
4085
- stack?: string;
4086
- }): Readonly<{
4087
- code: RpcCode;
4088
- message: string;
4089
- details?: ArrayBuffer;
4090
- }>;
4091
- captureStackTrace(targetObject: object, constructorOpt?: Function): void;
4092
- prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any;
4093
- stackTraceLimit: number;
4094
- };
4095
- MulticastRpc: {
4096
- new (inner: {
4097
- origin: string;
4098
- code: RpcCode;
4099
- message: string;
4100
- details?: ArrayBuffer;
4101
- }): {
4102
- readonly tag: RpcError_Tags.MulticastRpc;
4103
- readonly inner: Readonly<{
4104
- origin: string;
4105
- code: RpcCode;
4106
- message: string;
4107
- details?: ArrayBuffer;
4108
- }>;
4109
- /**
4110
- * @private
4111
- * This field is private and should not be used, use `tag` instead.
4112
- */
4113
- readonly [uniffiTypeNameSymbol]: "RpcError";
4114
- name: string;
4115
- message: string;
4116
- stack?: string;
4117
- };
4118
- "new"(inner: {
4119
- origin: string;
4120
- code: RpcCode;
4121
- message: string;
4122
- details?: ArrayBuffer;
4123
- }): {
4124
- readonly tag: RpcError_Tags.MulticastRpc;
4125
- readonly inner: Readonly<{
4126
- origin: string;
4127
- code: RpcCode;
4128
- message: string;
4129
- details?: ArrayBuffer;
4130
- }>;
4131
- /**
4132
- * @private
4133
- * This field is private and should not be used, use `tag` instead.
4134
- */
4135
- readonly [uniffiTypeNameSymbol]: "RpcError";
4136
- name: string;
4137
- message: string;
4138
- stack?: string;
4139
- };
4140
- instanceOf(obj: any): obj is {
4141
- readonly tag: RpcError_Tags.MulticastRpc;
4142
- readonly inner: Readonly<{
4143
- origin: string;
4144
- code: RpcCode;
4145
- message: string;
4146
- details?: ArrayBuffer;
4147
- }>;
4148
- /**
4149
- * @private
4150
- * This field is private and should not be used, use `tag` instead.
4151
- */
4152
- readonly [uniffiTypeNameSymbol]: "RpcError";
4153
- name: string;
4154
- message: string;
4155
- stack?: string;
4156
- };
4157
- hasInner(obj: any): obj is {
4158
- readonly tag: RpcError_Tags.MulticastRpc;
4159
- readonly inner: Readonly<{
4160
- origin: string;
4161
- code: RpcCode;
4162
- message: string;
4163
- details?: ArrayBuffer;
4164
- }>;
4165
- /**
4166
- * @private
4167
- * This field is private and should not be used, use `tag` instead.
4168
- */
4169
- readonly [uniffiTypeNameSymbol]: "RpcError";
4170
- name: string;
4171
- message: string;
4172
- stack?: string;
4173
- };
4174
- getInner(obj: {
4175
- readonly tag: RpcError_Tags.MulticastRpc;
4176
- readonly inner: Readonly<{
4177
- origin: string;
4178
- code: RpcCode;
4179
- message: string;
4180
- details?: ArrayBuffer;
4181
- }>;
4182
- /**
4183
- * @private
4184
- * This field is private and should not be used, use `tag` instead.
4185
- */
4186
- readonly [uniffiTypeNameSymbol]: "RpcError";
4187
- name: string;
4188
- message: string;
4189
- stack?: string;
4190
- }): Readonly<{
4191
- origin: string;
4192
- code: RpcCode;
4193
- message: string;
4194
- details?: ArrayBuffer;
4195
- }>;
4196
- captureStackTrace(targetObject: object, constructorOpt?: Function): void;
4197
- prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any;
4198
- stackTraceLimit: number;
4199
- };
4200
- MulticastSessionClosed: {
4201
- new (inner: {
4202
- completed: bigint;
4203
- total: bigint;
4204
- received: Array<string>;
4205
- missing: Array<string>;
4206
- }): {
4207
- readonly tag: RpcError_Tags.MulticastSessionClosed;
4208
- readonly inner: Readonly<{
4209
- completed: bigint;
4210
- total: bigint;
4211
- received: Array<string>;
4212
- missing: Array<string>;
4213
- }>;
4214
- /**
4215
- * @private
4216
- * This field is private and should not be used, use `tag` instead.
4217
- */
4218
- readonly [uniffiTypeNameSymbol]: "RpcError";
4219
- name: string;
4220
- message: string;
4221
- stack?: string;
4222
- };
4223
- "new"(inner: {
4224
- completed: bigint;
4225
- total: bigint;
4226
- received: Array<string>;
4227
- missing: Array<string>;
4228
- }): {
4229
- readonly tag: RpcError_Tags.MulticastSessionClosed;
4230
- readonly inner: Readonly<{
4231
- completed: bigint;
4232
- total: bigint;
4233
- received: Array<string>;
4234
- missing: Array<string>;
4235
- }>;
4236
- /**
4237
- * @private
4238
- * This field is private and should not be used, use `tag` instead.
4239
- */
4240
- readonly [uniffiTypeNameSymbol]: "RpcError";
4241
- name: string;
4242
- message: string;
4243
- stack?: string;
4244
- };
4245
- instanceOf(obj: any): obj is {
4246
- readonly tag: RpcError_Tags.MulticastSessionClosed;
4247
- readonly inner: Readonly<{
4248
- completed: bigint;
4249
- total: bigint;
4250
- received: Array<string>;
4251
- missing: Array<string>;
4252
- }>;
4253
- /**
4254
- * @private
4255
- * This field is private and should not be used, use `tag` instead.
4256
- */
4257
- readonly [uniffiTypeNameSymbol]: "RpcError";
4258
- name: string;
4259
- message: string;
4260
- stack?: string;
4261
- };
4262
- hasInner(obj: any): obj is {
4263
- readonly tag: RpcError_Tags.MulticastSessionClosed;
4264
- readonly inner: Readonly<{
4265
- completed: bigint;
4266
- total: bigint;
4267
- received: Array<string>;
4268
- missing: Array<string>;
4269
- }>;
4270
- /**
4271
- * @private
4272
- * This field is private and should not be used, use `tag` instead.
4273
- */
4274
- readonly [uniffiTypeNameSymbol]: "RpcError";
4275
- name: string;
4276
- message: string;
4277
- stack?: string;
4278
- };
4279
- getInner(obj: {
4280
- readonly tag: RpcError_Tags.MulticastSessionClosed;
4281
- readonly inner: Readonly<{
4282
- completed: bigint;
4283
- total: bigint;
4284
- received: Array<string>;
4285
- missing: Array<string>;
4286
- }>;
4287
- /**
4288
- * @private
4289
- * This field is private and should not be used, use `tag` instead.
4290
- */
4291
- readonly [uniffiTypeNameSymbol]: "RpcError";
4292
- name: string;
4293
- message: string;
4294
- stack?: string;
4295
- }): Readonly<{
4296
- completed: bigint;
4297
- total: bigint;
4298
- received: Array<string>;
4299
- missing: Array<string>;
4300
- }>;
4301
- captureStackTrace(targetObject: object, constructorOpt?: Function): void;
4302
- prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any;
4303
- stackTraceLimit: number;
4304
- };
4305
- }>;
4306
- /**
4307
- * UniFFI-compatible RPC error
4308
- *
4309
- * This represents RPC errors with gRPC-compatible status codes.
4310
- */
4311
- export type RpcError = InstanceType<typeof RpcError['Rpc' | 'MulticastRpc' | 'MulticastSessionClosed']>;
4312
- export declare enum MulticastStreamMessage_Tags {
4313
- Data = "Data",
4314
- Error = "Error",
4315
- End = "End"
4316
- }
4317
- /**
4318
- * Message from a multicast response stream.
4319
- */
4320
- export declare const MulticastStreamMessage: Readonly<{
4321
- instanceOf: (obj: any) => obj is MulticastStreamMessage;
4322
- Data: {
4323
- new (inner: {
4324
- item: RpcMulticastItem;
4325
- }): {
4326
- readonly tag: MulticastStreamMessage_Tags.Data;
4327
- readonly inner: Readonly<{
4328
- item: RpcMulticastItem;
4329
- }>;
4330
- /**
4331
- * @private
4332
- * This field is private and should not be used, use `tag` instead.
4333
- */
4334
- readonly [uniffiTypeNameSymbol]: "MulticastStreamMessage";
4335
- };
4336
- "new"(inner: {
4337
- item: RpcMulticastItem;
4338
- }): {
4339
- readonly tag: MulticastStreamMessage_Tags.Data;
4340
- readonly inner: Readonly<{
4341
- item: RpcMulticastItem;
4342
- }>;
4343
- /**
4344
- * @private
4345
- * This field is private and should not be used, use `tag` instead.
4346
- */
4347
- readonly [uniffiTypeNameSymbol]: "MulticastStreamMessage";
4348
- };
4349
- instanceOf(obj: any): obj is {
4350
- readonly tag: MulticastStreamMessage_Tags.Data;
4351
- readonly inner: Readonly<{
4352
- item: RpcMulticastItem;
4353
- }>;
4354
- /**
4355
- * @private
4356
- * This field is private and should not be used, use `tag` instead.
4357
- */
4358
- readonly [uniffiTypeNameSymbol]: "MulticastStreamMessage";
4359
- };
4360
- };
4361
- Error: {
4362
- new (inner: {
4363
- error: RpcError;
4364
- }): {
4365
- readonly tag: MulticastStreamMessage_Tags.Error;
4366
- readonly inner: Readonly<{
4367
- error: RpcError;
4368
- }>;
4369
- /**
4370
- * @private
4371
- * This field is private and should not be used, use `tag` instead.
4372
- */
4373
- readonly [uniffiTypeNameSymbol]: "MulticastStreamMessage";
4374
- };
4375
- "new"(inner: {
4376
- error: RpcError;
4377
- }): {
4378
- readonly tag: MulticastStreamMessage_Tags.Error;
4379
- readonly inner: Readonly<{
4380
- error: RpcError;
4381
- }>;
4382
- /**
4383
- * @private
4384
- * This field is private and should not be used, use `tag` instead.
4385
- */
4386
- readonly [uniffiTypeNameSymbol]: "MulticastStreamMessage";
4387
- };
4388
- instanceOf(obj: any): obj is {
4389
- readonly tag: MulticastStreamMessage_Tags.Error;
4390
- readonly inner: Readonly<{
4391
- error: RpcError;
4392
- }>;
4393
- /**
4394
- * @private
4395
- * This field is private and should not be used, use `tag` instead.
4396
- */
4397
- readonly [uniffiTypeNameSymbol]: "MulticastStreamMessage";
4398
- };
4399
- };
4400
- End: {
4401
- new (): {
4402
- readonly tag: MulticastStreamMessage_Tags.End;
4403
- /**
4404
- * @private
4405
- * This field is private and should not be used, use `tag` instead.
4406
- */
4407
- readonly [uniffiTypeNameSymbol]: "MulticastStreamMessage";
4408
- };
4409
- "new"(): {
4410
- readonly tag: MulticastStreamMessage_Tags.End;
4411
- /**
4412
- * @private
4413
- * This field is private and should not be used, use `tag` instead.
4414
- */
4415
- readonly [uniffiTypeNameSymbol]: "MulticastStreamMessage";
4416
- };
4417
- instanceOf(obj: any): obj is {
4418
- readonly tag: MulticastStreamMessage_Tags.End;
4419
- /**
4420
- * @private
4421
- * This field is private and should not be used, use `tag` instead.
4422
- */
4423
- readonly [uniffiTypeNameSymbol]: "MulticastStreamMessage";
4424
- };
4425
- };
4426
- }>;
4427
- /**
4428
- * Message from a multicast response stream.
4429
- */
4430
- export type MulticastStreamMessage = InstanceType<typeof MulticastStreamMessage['Data' | 'Error' | 'End']>;
4431
- export declare enum StreamMessage_Tags {
4432
- Data = "Data",
4433
- Error = "Error",
4434
- End = "End"
4435
- }
4436
- /**
4437
- * Message from a stream
4438
- */
4439
- export declare const StreamMessage: Readonly<{
4440
- instanceOf: (obj: any) => obj is StreamMessage;
4441
- Data: {
4442
- new (v0: ArrayBuffer): {
4443
- readonly tag: StreamMessage_Tags.Data;
4444
- readonly inner: Readonly<[ArrayBuffer]>;
4445
- /**
4446
- * @private
4447
- * This field is private and should not be used, use `tag` instead.
4448
- */
4449
- readonly [uniffiTypeNameSymbol]: "StreamMessage";
4450
- };
4451
- "new"(v0: ArrayBuffer): {
4452
- readonly tag: StreamMessage_Tags.Data;
4453
- readonly inner: Readonly<[ArrayBuffer]>;
4454
- /**
4455
- * @private
4456
- * This field is private and should not be used, use `tag` instead.
4457
- */
4458
- readonly [uniffiTypeNameSymbol]: "StreamMessage";
4459
- };
4460
- instanceOf(obj: any): obj is {
4461
- readonly tag: StreamMessage_Tags.Data;
4462
- readonly inner: Readonly<[ArrayBuffer]>;
4463
- /**
4464
- * @private
4465
- * This field is private and should not be used, use `tag` instead.
4466
- */
4467
- readonly [uniffiTypeNameSymbol]: "StreamMessage";
4468
- };
4469
- };
4470
- Error: {
4471
- new (v0: RpcError): {
4472
- readonly tag: StreamMessage_Tags.Error;
4473
- readonly inner: Readonly<[RpcError]>;
4474
- /**
4475
- * @private
4476
- * This field is private and should not be used, use `tag` instead.
4477
- */
4478
- readonly [uniffiTypeNameSymbol]: "StreamMessage";
4479
- };
4480
- "new"(v0: RpcError): {
4481
- readonly tag: StreamMessage_Tags.Error;
4482
- readonly inner: Readonly<[RpcError]>;
4483
- /**
4484
- * @private
4485
- * This field is private and should not be used, use `tag` instead.
4486
- */
4487
- readonly [uniffiTypeNameSymbol]: "StreamMessage";
4488
- };
4489
- instanceOf(obj: any): obj is {
4490
- readonly tag: StreamMessage_Tags.Error;
4491
- readonly inner: Readonly<[RpcError]>;
4492
- /**
4493
- * @private
4494
- * This field is private and should not be used, use `tag` instead.
4495
- */
4496
- readonly [uniffiTypeNameSymbol]: "StreamMessage";
4497
- };
4498
- };
4499
- End: {
4500
- new (): {
4501
- readonly tag: StreamMessage_Tags.End;
4502
- /**
4503
- * @private
4504
- * This field is private and should not be used, use `tag` instead.
4505
- */
4506
- readonly [uniffiTypeNameSymbol]: "StreamMessage";
4507
- };
4508
- "new"(): {
4509
- readonly tag: StreamMessage_Tags.End;
4510
- /**
4511
- * @private
4512
- * This field is private and should not be used, use `tag` instead.
4513
- */
4514
- readonly [uniffiTypeNameSymbol]: "StreamMessage";
4515
- };
4516
- instanceOf(obj: any): obj is {
4517
- readonly tag: StreamMessage_Tags.End;
4518
- /**
4519
- * @private
4520
- * This field is private and should not be used, use `tag` instead.
4521
- */
4522
- readonly [uniffiTypeNameSymbol]: "StreamMessage";
4523
- };
4524
- };
4525
- }>;
4526
- /**
4527
- * Message from a stream
4528
- */
4529
- export type StreamMessage = InstanceType<typeof StreamMessage['Data' | 'Error' | 'End']>;
4530
- /**
4531
- * Transport protocol for dataplane communication.
4532
- */
4533
- export declare enum TransportProtocol {
4534
- Grpc = 0,
4535
- Websocket = 1
4536
- }
4537
- /**
4538
- * Adapter that bridges the App API with language-bindings interface
4539
- *
4540
- * This adapter uses enum-based auth types (`AuthProvider`/`AuthVerifier`) instead of generics
4541
- * to be compatible with UniFFI, supporting multiple authentication mechanisms (SharedSecret,
4542
- * JWT, SPIRE, StaticToken). It provides both synchronous (blocking) and asynchronous methods
4543
- * for flexibility.
4544
- */
4545
- export interface AppLike {
4546
- /**
4547
- * Create a new session (blocking version for FFI)
4548
- *
4549
- * Returns a SessionWithCompletion containing the session context and a completion handle.
4550
- * Call `.wait()` on the completion handle to wait for session establishment.
4551
- */
4552
- createSession(config: SessionConfig, destination: NameLike): SessionWithCompletion;
4553
- /**
4554
- * Create a new session and wait for completion (blocking version)
4555
- *
4556
- * This method creates a session and blocks until the session establishment completes.
4557
- * Returns only the session context, as the completion has already been awaited.
4558
- */
4559
- createSessionAndWait(config: SessionConfig, destination: NameLike): SessionLike;
4560
- /**
4561
- * Create a new session and wait for completion (async version)
4562
- *
4563
- * This method creates a session and waits until the session establishment completes.
4564
- * Returns only the session context, as the completion has already been awaited.
4565
- */
4566
- createSessionAndWaitAsync(config: SessionConfig, destination: NameLike, asyncOpts_?: {
4567
- signal: AbortSignal;
4568
- }): Promise<SessionLike>;
4569
- /**
4570
- * Create a new session (async version)
4571
- *
4572
- * Returns a SessionWithCompletion containing the session context and a completion handle.
4573
- * Await the completion handle to wait for session establishment.
4574
- * For point-to-point sessions, this ensures the remote peer has acknowledged the session.
4575
- * For multicast sessions, this ensures the initial setup is complete.
4576
- */
4577
- createSessionAsync(config: SessionConfig, destination: NameLike, asyncOpts_?: {
4578
- signal: AbortSignal;
4579
- }): Promise<SessionWithCompletion>;
4580
- /**
4581
- * Delete a session (blocking version for FFI)
4582
- *
4583
- * Returns a completion handle that can be awaited to ensure the deletion completes.
4584
- */
4585
- deleteSession(session: SessionLike): CompletionHandleLike;
4586
- /**
4587
- * Delete a session and wait for completion (blocking version)
4588
- *
4589
- * This method deletes a session and blocks until the deletion completes.
4590
- */
4591
- deleteSessionAndWait(session: SessionLike): void;
4592
- /**
4593
- * Delete a session and wait for completion (async version)
4594
- *
4595
- * This method deletes a session and waits until the deletion completes.
4596
- */
4597
- deleteSessionAndWaitAsync(session: SessionLike, asyncOpts_?: {
4598
- signal: AbortSignal;
4599
- }): Promise<void>;
4600
- /**
4601
- * Delete a session (async version)
4602
- *
4603
- * Returns a completion handle that can be awaited to ensure the deletion completes.
4604
- */
4605
- deleteSessionAsync(session: SessionLike, asyncOpts_?: {
4606
- signal: AbortSignal;
4607
- }): Promise<CompletionHandleLike>;
4608
- /**
4609
- * Get the app ID in UUID format
4610
- */
4611
- id(): string;
4612
- /**
4613
- * Listen for incoming sessions (blocking version for FFI)
4614
- */
4615
- listenForSession(timeout: number | undefined): SessionLike;
4616
- /**
4617
- * Listen for incoming sessions (async version)
4618
- */
4619
- listenForSessionAsync(timeout: number | undefined, asyncOpts_?: {
4620
- signal: AbortSignal;
4621
- }): Promise<SessionLike>;
4622
- /**
4623
- * Get the app name
4624
- */
4625
- name(): NameLike;
4626
- /**
4627
- * Remove a route (blocking version for FFI)
4628
- */
4629
- removeRoute(name: NameLike, connectionId: bigint): void;
4630
- /**
4631
- * Remove a route (async version)
4632
- */
4633
- removeRouteAsync(name: NameLike, connectionId: bigint, asyncOpts_?: {
4634
- signal: AbortSignal;
4635
- }): Promise<void>;
4636
- /**
4637
- * Set a route to a name for a specific connection (blocking version for FFI)
4638
- */
4639
- setRoute(name: NameLike, connectionId: bigint): void;
4640
- /**
4641
- * Set a route to a name for a specific connection (async version)
4642
- */
4643
- setRouteAsync(name: NameLike, connectionId: bigint, asyncOpts_?: {
4644
- signal: AbortSignal;
4645
- }): Promise<void>;
4646
- /**
4647
- * Subscribe to a session name (blocking version for FFI)
4648
- */
4649
- subscribe(name: NameLike, connectionId: bigint | undefined): void;
4650
- /**
4651
- * Subscribe to a name (async version)
4652
- */
4653
- subscribeAsync(name: NameLike, connectionId: bigint | undefined, asyncOpts_?: {
4654
- signal: AbortSignal;
4655
- }): Promise<void>;
4656
- /**
4657
- * Unsubscribe from a name (blocking version for FFI)
4658
- */
4659
- unsubscribe(name: NameLike, connectionId: bigint | undefined): void;
4660
- /**
4661
- * Unsubscribe from a name (async version)
4662
- */
4663
- unsubscribeAsync(name: NameLike, connectionId: bigint | undefined, asyncOpts_?: {
4664
- signal: AbortSignal;
4665
- }): Promise<void>;
4666
- }
4667
- /**
4668
- * @deprecated Use `AppLike` instead.
4669
- */
4670
- export type AppInterface = AppLike;
4671
- /**
4672
- * Adapter that bridges the App API with language-bindings interface
4673
- *
4674
- * This adapter uses enum-based auth types (`AuthProvider`/`AuthVerifier`) instead of generics
4675
- * to be compatible with UniFFI, supporting multiple authentication mechanisms (SharedSecret,
4676
- * JWT, SPIRE, StaticToken). It provides both synchronous (blocking) and asynchronous methods
4677
- * for flexibility.
4678
- */
4679
- export declare class App extends UniffiAbstractObject implements AppLike {
4680
- readonly [uniffiTypeNameSymbol] = "App";
4681
- readonly [destructorGuardSymbol]: UniffiGcObject;
4682
- readonly [pointerLiteralSymbol]: UniffiHandle;
4683
- /**
4684
- * Create a new App with identity provider and verifier configurations
4685
- *
4686
- * This is the main entry point for creating a SLIM application from language bindings.
4687
- *
4688
- * # Arguments
4689
- * * `base_name` - The base name for the app (without ID)
4690
- * * `identity_provider_config` - Configuration for proving identity to others
4691
- * * `identity_verifier_config` - Configuration for verifying identity of others
4692
- *
4693
- * # Returns
4694
- * * `Ok(Arc<App>)` - Successfully created adapter
4695
- * * `Err(SlimError)` - If adapter creation fails
4696
- *
4697
- * # Supported Identity Types
4698
- * - SharedSecret: Symmetric key authentication
4699
- * - JWT: Dynamic JWT generation/verification with signing/decoding keys
4700
- * - StaticJWT: Static JWT loaded from file with auto-reload
4701
- */
4702
- constructor(baseName: NameLike, identityProviderConfig: IdentityProviderConfig, identityVerifierConfig: IdentityVerifierConfig);
4703
- /**
4704
- * Create a new App with traffic direction (blocking version)
4705
- *
4706
- * This is a convenience function for creating a SLIM application with configurable
4707
- * traffic direction (send-only, receive-only, bidirectional, or none).
4708
- *
4709
- * # Arguments
4710
- * * `name` - The base name for the app (without ID)
4711
- * * `identity_provider_config` - Configuration for proving identity to others
4712
- * * `identity_verifier_config` - Configuration for verifying identity of others
4713
- * * `direction` - Traffic direction for sessions (Send, Recv, Bidirectional, or None)
4714
- *
4715
- * # Returns
4716
- * * `Ok(Arc<App>)` - Successfully created app
4717
- * * `Err(SlimError)` - If app creation fails
4718
- */
4719
- static newWithDirection(name: NameLike, identityProviderConfig: IdentityProviderConfig, identityVerifierConfig: IdentityVerifierConfig, direction: Direction): AppLike;
4720
- /**
4721
- * Create a new App with SharedSecret authentication (blocking version)
4722
- *
4723
- * This is a convenience function for creating a SLIM application using SharedSecret authentication.
4724
- *
4725
- * # Arguments
4726
- * * `name` - The base name for the app (without ID)
4727
- * * `secret` - The shared secret string for authentication
4728
- *
4729
- * # Returns
4730
- * * `Ok(Arc<App>)` - Successfully created adapter
4731
- * * `Err(SlimError)` - If adapter creation fails
4732
- */
4733
- static newWithSecret(name: NameLike, secret: string): AppLike;
4734
- /**
4735
- * Create a new session (blocking version for FFI)
4736
- *
4737
- * Returns a SessionWithCompletion containing the session context and a completion handle.
4738
- * Call `.wait()` on the completion handle to wait for session establishment.
4739
- */
4740
- createSession(config: SessionConfig, destination: NameLike): SessionWithCompletion;
4741
- /**
4742
- * Create a new session and wait for completion (blocking version)
4743
- *
4744
- * This method creates a session and blocks until the session establishment completes.
4745
- * Returns only the session context, as the completion has already been awaited.
4746
- */
4747
- createSessionAndWait(config: SessionConfig, destination: NameLike): SessionLike;
4748
- /**
4749
- * Create a new session and wait for completion (async version)
4750
- *
4751
- * This method creates a session and waits until the session establishment completes.
4752
- * Returns only the session context, as the completion has already been awaited.
4753
- */
4754
- createSessionAndWaitAsync(config: SessionConfig, destination: NameLike, asyncOpts_?: {
4755
- signal: AbortSignal;
4756
- }): Promise<SessionLike>;
4757
- /**
4758
- * Create a new session (async version)
4759
- *
4760
- * Returns a SessionWithCompletion containing the session context and a completion handle.
4761
- * Await the completion handle to wait for session establishment.
4762
- * For point-to-point sessions, this ensures the remote peer has acknowledged the session.
4763
- * For multicast sessions, this ensures the initial setup is complete.
4764
- */
4765
- createSessionAsync(config: SessionConfig, destination: NameLike, asyncOpts_?: {
4766
- signal: AbortSignal;
4767
- }): Promise<SessionWithCompletion>;
4768
- /**
4769
- * Delete a session (blocking version for FFI)
4770
- *
4771
- * Returns a completion handle that can be awaited to ensure the deletion completes.
4772
- */
4773
- deleteSession(session: SessionLike): CompletionHandleLike;
4774
- /**
4775
- * Delete a session and wait for completion (blocking version)
4776
- *
4777
- * This method deletes a session and blocks until the deletion completes.
4778
- */
4779
- deleteSessionAndWait(session: SessionLike): void;
4780
- /**
4781
- * Delete a session and wait for completion (async version)
4782
- *
4783
- * This method deletes a session and waits until the deletion completes.
4784
- */
4785
- deleteSessionAndWaitAsync(session: SessionLike, asyncOpts_?: {
4786
- signal: AbortSignal;
4787
- }): Promise<void>;
4788
- /**
4789
- * Delete a session (async version)
4790
- *
4791
- * Returns a completion handle that can be awaited to ensure the deletion completes.
4792
- */
4793
- deleteSessionAsync(session: SessionLike, asyncOpts_?: {
4794
- signal: AbortSignal;
4795
- }): Promise<CompletionHandleLike>;
4796
- /**
4797
- * Get the app ID in UUID format
4798
- */
4799
- id(): string;
4800
- /**
4801
- * Listen for incoming sessions (blocking version for FFI)
4802
- */
4803
- listenForSession(timeout: number | undefined): SessionLike;
4804
- /**
4805
- * Listen for incoming sessions (async version)
4806
- */
4807
- listenForSessionAsync(timeout: number | undefined, asyncOpts_?: {
4808
- signal: AbortSignal;
4809
- }): Promise<SessionLike>;
4810
- /**
4811
- * Get the app name
4812
- */
4813
- name(): NameLike;
4814
- /**
4815
- * Remove a route (blocking version for FFI)
4816
- */
4817
- removeRoute(name: NameLike, connectionId: bigint): void;
4818
- /**
4819
- * Remove a route (async version)
4820
- */
4821
- removeRouteAsync(name: NameLike, connectionId: bigint, asyncOpts_?: {
4822
- signal: AbortSignal;
4823
- }): Promise<void>;
4824
- /**
4825
- * Set a route to a name for a specific connection (blocking version for FFI)
4826
- */
4827
- setRoute(name: NameLike, connectionId: bigint): void;
4828
- /**
4829
- * Set a route to a name for a specific connection (async version)
4830
- */
4831
- setRouteAsync(name: NameLike, connectionId: bigint, asyncOpts_?: {
4832
- signal: AbortSignal;
4833
- }): Promise<void>;
4834
- /**
4835
- * Subscribe to a session name (blocking version for FFI)
4836
- */
4837
- subscribe(name: NameLike, connectionId: bigint | undefined): void;
4838
- /**
4839
- * Subscribe to a name (async version)
4840
- */
4841
- subscribeAsync(name: NameLike, connectionId: bigint | undefined, asyncOpts_?: {
4842
- signal: AbortSignal;
4843
- }): Promise<void>;
4844
- /**
4845
- * Unsubscribe from a name (blocking version for FFI)
4846
- */
4847
- unsubscribe(name: NameLike, connectionId: bigint | undefined): void;
4848
- /**
4849
- * Unsubscribe from a name (async version)
4850
- */
4851
- unsubscribeAsync(name: NameLike, connectionId: bigint | undefined, asyncOpts_?: {
4852
- signal: AbortSignal;
4853
- }): Promise<void>;
4854
- uniffiDestroy(): void;
4855
- static instanceOf(obj_: any): obj_ is App;
4856
- }
4857
- /**
4858
- * Bidirectional stream handler for stream-to-stream RPC calls
4859
- *
4860
- * Allows sending and receiving messages concurrently.
4861
- */
4862
- export interface BidiStreamHandlerLike {
4863
- /**
4864
- * Close the request stream (no more messages will be sent)
4865
- */
4866
- closeSend(): void;
4867
- /**
4868
- * Close the request stream (async version)
4869
- */
4870
- closeSendAsync(asyncOpts_?: {
4871
- signal: AbortSignal;
4872
- }): Promise<void>;
4873
- /**
4874
- * Receive the next response message (blocking version)
4875
- */
4876
- recv(): StreamMessage;
4877
- /**
4878
- * Receive the next response message (async version)
4879
- */
4880
- recvAsync(asyncOpts_?: {
4881
- signal: AbortSignal;
4882
- }): Promise<StreamMessage>;
4883
- /**
4884
- * Send a request message to the stream (blocking version)
4885
- */
4886
- send(data: ArrayBuffer): void;
4887
- /**
4888
- * Send a request message to the stream (async version)
4889
- */
4890
- sendAsync(data: ArrayBuffer, asyncOpts_?: {
4891
- signal: AbortSignal;
4892
- }): Promise<void>;
4893
- }
4894
- /**
4895
- * @deprecated Use `BidiStreamHandlerLike` instead.
4896
- */
4897
- export type BidiStreamHandlerInterface = BidiStreamHandlerLike;
4898
- /**
4899
- * Bidirectional stream handler for stream-to-stream RPC calls
4900
- *
4901
- * Allows sending and receiving messages concurrently.
4902
- */
4903
- export declare class BidiStreamHandler extends UniffiAbstractObject implements BidiStreamHandlerLike {
4904
- readonly [uniffiTypeNameSymbol] = "BidiStreamHandler";
4905
- readonly [destructorGuardSymbol]: UniffiGcObject;
4906
- readonly [pointerLiteralSymbol]: UniffiHandle;
4907
- private constructor();
4908
- /**
4909
- * Close the request stream (no more messages will be sent)
4910
- */
4911
- closeSend(): void;
4912
- /**
4913
- * Close the request stream (async version)
4914
- */
4915
- closeSendAsync(asyncOpts_?: {
4916
- signal: AbortSignal;
4917
- }): Promise<void>;
4918
- /**
4919
- * Receive the next response message (blocking version)
4920
- */
4921
- recv(): StreamMessage;
4922
- /**
4923
- * Receive the next response message (async version)
4924
- */
4925
- recvAsync(asyncOpts_?: {
4926
- signal: AbortSignal;
4927
- }): Promise<StreamMessage>;
4928
- /**
4929
- * Send a request message to the stream (blocking version)
4930
- */
4931
- send(data: ArrayBuffer): void;
4932
- /**
4933
- * Send a request message to the stream (async version)
4934
- */
4935
- sendAsync(data: ArrayBuffer, asyncOpts_?: {
4936
- signal: AbortSignal;
4937
- }): Promise<void>;
4938
- uniffiDestroy(): void;
4939
- static instanceOf(obj_: any): obj_ is BidiStreamHandler;
4940
- }
4941
- /**
4942
- * Bidirectional stream handler for multicast stream-to-unary and
4943
- * stream-to-stream RPC calls.
4944
- *
4945
- * Send request messages via [`send`](Self::send) / [`send_async`](Self::send_async),
4946
- * close the request stream via [`close_send`](Self::close_send), and receive
4947
- * responses via [`recv`](Self::recv) / [`recv_async`](Self::recv_async). Each
4948
- * response item carries the source member's identity.
4949
- */
4950
- export interface MulticastBidiStreamHandlerLike {
4951
- /**
4952
- * Close the request stream — signals that no more messages will be sent
4953
- * (blocking).
4954
- */
4955
- closeSend(): void;
4956
- /**
4957
- * Close the request stream (async).
4958
- */
4959
- closeSendAsync(asyncOpts_?: {
4960
- signal: AbortSignal;
4961
- }): Promise<void>;
4962
- /**
4963
- * Receive the next response item (blocking).
4964
- */
4965
- recv(): MulticastStreamMessage;
4966
- /**
4967
- * Receive the next response item (async).
4968
- */
4969
- recvAsync(asyncOpts_?: {
4970
- signal: AbortSignal;
4971
- }): Promise<MulticastStreamMessage>;
4972
- /**
4973
- * Send a request message to the stream (blocking).
4974
- */
4975
- send(data: ArrayBuffer): void;
4976
- /**
4977
- * Send a request message to the stream (async).
4978
- */
4979
- sendAsync(data: ArrayBuffer, asyncOpts_?: {
4980
- signal: AbortSignal;
4981
- }): Promise<void>;
4982
- }
4983
- /**
4984
- * @deprecated Use `MulticastBidiStreamHandlerLike` instead.
4985
- */
4986
- export type MulticastBidiStreamHandlerInterface = MulticastBidiStreamHandlerLike;
4987
- /**
4988
- * Bidirectional stream handler for multicast stream-to-unary and
4989
- * stream-to-stream RPC calls.
4990
- *
4991
- * Send request messages via [`send`](Self::send) / [`send_async`](Self::send_async),
4992
- * close the request stream via [`close_send`](Self::close_send), and receive
4993
- * responses via [`recv`](Self::recv) / [`recv_async`](Self::recv_async). Each
4994
- * response item carries the source member's identity.
4995
- */
4996
- export declare class MulticastBidiStreamHandler extends UniffiAbstractObject implements MulticastBidiStreamHandlerLike {
4997
- readonly [uniffiTypeNameSymbol] = "MulticastBidiStreamHandler";
4998
- readonly [destructorGuardSymbol]: UniffiGcObject;
4999
- readonly [pointerLiteralSymbol]: UniffiHandle;
5000
- private constructor();
5001
- /**
5002
- * Close the request stream — signals that no more messages will be sent
5003
- * (blocking).
5004
- */
5005
- closeSend(): void;
5006
- /**
5007
- * Close the request stream (async).
5008
- */
5009
- closeSendAsync(asyncOpts_?: {
5010
- signal: AbortSignal;
5011
- }): Promise<void>;
5012
- /**
5013
- * Receive the next response item (blocking).
5014
- */
5015
- recv(): MulticastStreamMessage;
5016
- /**
5017
- * Receive the next response item (async).
5018
- */
5019
- recvAsync(asyncOpts_?: {
5020
- signal: AbortSignal;
5021
- }): Promise<MulticastStreamMessage>;
5022
- /**
5023
- * Send a request message to the stream (blocking).
5024
- */
5025
- send(data: ArrayBuffer): void;
5026
- /**
5027
- * Send a request message to the stream (async).
5028
- */
5029
- sendAsync(data: ArrayBuffer, asyncOpts_?: {
5030
- signal: AbortSignal;
5031
- }): Promise<void>;
5032
- uniffiDestroy(): void;
5033
- static instanceOf(obj_: any): obj_ is MulticastBidiStreamHandler;
5034
- }
5035
- /**
5036
- * Response stream reader for multicast RPC calls.
5037
- *
5038
- * Allows pulling `RpcMulticastItem`s from a GROUP response stream one at a
5039
- * time. Each item carries the source member's identity alongside the payload.
5040
- */
5041
- export interface MulticastResponseReaderLike {
5042
- /**
5043
- * Pull the next item from the multicast response stream (blocking).
5044
- */
5045
- next(): MulticastStreamMessage;
5046
- /**
5047
- * Pull the next item from the multicast response stream (async).
5048
- */
5049
- nextAsync(asyncOpts_?: {
5050
- signal: AbortSignal;
5051
- }): Promise<MulticastStreamMessage>;
5052
- }
5053
- /**
5054
- * @deprecated Use `MulticastResponseReaderLike` instead.
5055
- */
5056
- export type MulticastResponseReaderInterface = MulticastResponseReaderLike;
5057
- /**
5058
- * Response stream reader for multicast RPC calls.
5059
- *
5060
- * Allows pulling `RpcMulticastItem`s from a GROUP response stream one at a
5061
- * time. Each item carries the source member's identity alongside the payload.
5062
- */
5063
- export declare class MulticastResponseReader extends UniffiAbstractObject implements MulticastResponseReaderLike {
5064
- readonly [uniffiTypeNameSymbol] = "MulticastResponseReader";
5065
- readonly [destructorGuardSymbol]: UniffiGcObject;
5066
- readonly [pointerLiteralSymbol]: UniffiHandle;
5067
- private constructor();
5068
- /**
5069
- * Pull the next item from the multicast response stream (blocking).
5070
- */
5071
- next(): MulticastStreamMessage;
5072
- /**
5073
- * Pull the next item from the multicast response stream (async).
5074
- */
5075
- nextAsync(asyncOpts_?: {
5076
- signal: AbortSignal;
5077
- }): Promise<MulticastStreamMessage>;
5078
- uniffiDestroy(): void;
5079
- static instanceOf(obj_: any): obj_ is MulticastResponseReader;
5080
- }
5081
- /**
5082
- * Request stream writer for stream-to-unary RPC calls
5083
- *
5084
- * Allows sending multiple request messages and getting a final response.
5085
- */
5086
- export interface RequestStreamWriterLike {
5087
- /**
5088
- * Finalize the stream and get the response (async version)
5089
- *
5090
- * **Deprecated**: Use [`finalize_stream_async`](Self::finalize_stream_async) instead.
5091
- */
5092
- finalizeAsync(asyncOpts_?: {
5093
- signal: AbortSignal;
5094
- }): Promise<ArrayBuffer>;
5095
- /**
5096
- * Finalize the stream and get the response (blocking version)
5097
- */
5098
- finalizeStream(): ArrayBuffer;
5099
- /**
5100
- * Finalize the stream and get the response (async version)
5101
- */
5102
- finalizeStreamAsync(asyncOpts_?: {
5103
- signal: AbortSignal;
5104
- }): Promise<ArrayBuffer>;
5105
- /**
5106
- * Send a request message to the stream (blocking version)
5107
- */
5108
- send(data: ArrayBuffer): void;
5109
- /**
5110
- * Send a request message to the stream (async version)
5111
- */
5112
- sendAsync(data: ArrayBuffer, asyncOpts_?: {
5113
- signal: AbortSignal;
5114
- }): Promise<void>;
5115
- }
5116
- /**
5117
- * @deprecated Use `RequestStreamWriterLike` instead.
5118
- */
5119
- export type RequestStreamWriterInterface = RequestStreamWriterLike;
5120
- /**
5121
- * Request stream writer for stream-to-unary RPC calls
5122
- *
5123
- * Allows sending multiple request messages and getting a final response.
5124
- */
5125
- export declare class RequestStreamWriter extends UniffiAbstractObject implements RequestStreamWriterLike {
5126
- readonly [uniffiTypeNameSymbol] = "RequestStreamWriter";
5127
- readonly [destructorGuardSymbol]: UniffiGcObject;
5128
- readonly [pointerLiteralSymbol]: UniffiHandle;
5129
- private constructor();
5130
- /**
5131
- * Finalize the stream and get the response (async version)
5132
- *
5133
- * **Deprecated**: Use [`finalize_stream_async`](Self::finalize_stream_async) instead.
5134
- */
5135
- finalizeAsync(asyncOpts_?: {
5136
- signal: AbortSignal;
5137
- }): Promise<ArrayBuffer>;
5138
- /**
5139
- * Finalize the stream and get the response (blocking version)
5140
- */
5141
- finalizeStream(): ArrayBuffer;
5142
- /**
5143
- * Finalize the stream and get the response (async version)
5144
- */
5145
- finalizeStreamAsync(asyncOpts_?: {
5146
- signal: AbortSignal;
5147
- }): Promise<ArrayBuffer>;
5148
- /**
5149
- * Send a request message to the stream (blocking version)
5150
- */
5151
- send(data: ArrayBuffer): void;
5152
- /**
5153
- * Send a request message to the stream (async version)
5154
- */
5155
- sendAsync(data: ArrayBuffer, asyncOpts_?: {
5156
- signal: AbortSignal;
5157
- }): Promise<void>;
5158
- uniffiDestroy(): void;
5159
- static instanceOf(obj_: any): obj_ is RequestStreamWriter;
5160
- }
5161
- /**
5162
- * Response stream reader for unary-to-stream RPC calls
5163
- *
5164
- * Allows pulling messages from a server response stream one at a time.
5165
- */
5166
- export interface ResponseStreamReaderLike {
5167
- /**
5168
- * Pull the next message from the response stream (blocking version)
5169
- *
5170
- * Returns a StreamMessage indicating the result
5171
- */
5172
- next(): StreamMessage;
5173
- /**
5174
- * Pull the next message from the response stream (async version)
5175
- *
5176
- * Returns a StreamMessage indicating the result
5177
- */
5178
- nextAsync(asyncOpts_?: {
5179
- signal: AbortSignal;
5180
- }): Promise<StreamMessage>;
5181
- }
5182
- /**
5183
- * @deprecated Use `ResponseStreamReaderLike` instead.
5184
- */
5185
- export type ResponseStreamReaderInterface = ResponseStreamReaderLike;
5186
- /**
5187
- * Response stream reader for unary-to-stream RPC calls
5188
- *
5189
- * Allows pulling messages from a server response stream one at a time.
5190
- */
5191
- export declare class ResponseStreamReader extends UniffiAbstractObject implements ResponseStreamReaderLike {
5192
- readonly [uniffiTypeNameSymbol] = "ResponseStreamReader";
5193
- readonly [destructorGuardSymbol]: UniffiGcObject;
5194
- readonly [pointerLiteralSymbol]: UniffiHandle;
5195
- private constructor();
5196
- /**
5197
- * Pull the next message from the response stream (blocking version)
5198
- *
5199
- * Returns a StreamMessage indicating the result
5200
- */
5201
- next(): StreamMessage;
5202
- /**
5203
- * Pull the next message from the response stream (async version)
5204
- *
5205
- * Returns a StreamMessage indicating the result
5206
- */
5207
- nextAsync(asyncOpts_?: {
5208
- signal: AbortSignal;
5209
- }): Promise<StreamMessage>;
5210
- uniffiDestroy(): void;
5211
- static instanceOf(obj_: any): obj_ is ResponseStreamReader;
5212
- }
5213
- /**
5214
- * Client-side channel for making RPC calls.
5215
- *
5216
- * Manages a single persistent SLIM session: either a `PointToPoint` session
5217
- * to a single remote server, or a `Multicast` (GROUP) session shared across
5218
- * multiple remote servers. The session is lazily initialised and recreated
5219
- * when dead.
5220
- *
5221
- * ## Constructor
5222
- *
5223
- * - `new_with_members_internal(app, members)` — Smart constructor:
5224
- * - **1 member**: creates a P2P channel.
5225
- * - **Many members**: creates a GROUP channel with a generated session name
5226
- * and auto-invites all members on the first multicast call.
5227
- */
5228
- export interface ChannelLike {
5229
- /**
5230
- * Broadcast a request stream to all GROUP members and stream their
5231
- * responses.
5232
- *
5233
- * Semantically equivalent to `call_multicast_stream_unary` at the
5234
- * transport level; the difference (one vs many responses per member) is
5235
- * determined by the server handler.
5236
- */
5237
- callMulticastStreamStream(serviceName: string, methodName: string, timeout: number | undefined, metadata: Map<string, string> | undefined): MulticastBidiStreamHandlerLike;
5238
- /**
5239
- * Broadcast a request stream to all GROUP members and collect their
5240
- * responses.
5241
- *
5242
- * Returns a handler that lets you send requests and receive responses
5243
- * concurrently. Use `send` / `send_async` to push request messages,
5244
- * `close_send` / `close_send_async` to signal end-of-requests, and
5245
- * `recv` / `recv_async` to pull response items.
5246
- */
5247
- callMulticastStreamUnary(serviceName: string, methodName: string, timeout: number | undefined, metadata: Map<string, string> | undefined): MulticastBidiStreamHandlerLike;
5248
- /**
5249
- * Broadcast one request to all GROUP members and collect their responses.
5250
- *
5251
- * Returns a reader from which each member's response (wrapped in
5252
- * `MulticastStreamMessage`) can be pulled one at a time (blocking).
5253
- */
5254
- callMulticastUnary(serviceName: string, methodName: string, request: ArrayBuffer, timeout: number | undefined, metadata: Map<string, string> | undefined): MulticastResponseReaderLike;
5255
- /**
5256
- * Broadcast one request to all GROUP members and collect their responses
5257
- * (async).
5258
- */
5259
- callMulticastUnaryAsync(serviceName: string, methodName: string, request: ArrayBuffer, timeout: number | undefined, metadata: Map<string, string> | undefined, asyncOpts_?: {
5260
- signal: AbortSignal;
5261
- }): Promise<MulticastResponseReaderLike>;
5262
- /**
5263
- * Broadcast one request to all GROUP members and stream their responses
5264
- * (blocking).
5265
- *
5266
- * Semantically identical to `call_multicast_unary` at the transport level;
5267
- * the difference is that each member may send multiple responses before its
5268
- * EOS, which the server handler determines.
5269
- */
5270
- callMulticastUnaryStream(serviceName: string, methodName: string, request: ArrayBuffer, timeout: number | undefined, metadata: Map<string, string> | undefined): MulticastResponseReaderLike;
5271
- /**
5272
- * Broadcast one request to all GROUP members and stream their responses
5273
- * (async).
5274
- */
5275
- callMulticastUnaryStreamAsync(serviceName: string, methodName: string, request: ArrayBuffer, timeout: number | undefined, metadata: Map<string, string> | undefined, asyncOpts_?: {
5276
- signal: AbortSignal;
5277
- }): Promise<MulticastResponseReaderLike>;
5278
- callStreamStream(serviceName: string, methodName: string, timeout: number | undefined, metadata: Map<string, string> | undefined): BidiStreamHandlerLike;
5279
- callStreamUnary(serviceName: string, methodName: string, timeout: number | undefined, metadata: Map<string, string> | undefined): RequestStreamWriterLike;
5280
- callUnary(serviceName: string, methodName: string, request: ArrayBuffer, timeout: number | undefined, metadata: Map<string, string> | undefined): ArrayBuffer;
5281
- callUnaryAsync(serviceName: string, methodName: string, request: ArrayBuffer, timeout: number | undefined, metadata: Map<string, string> | undefined, asyncOpts_?: {
5282
- signal: AbortSignal;
5283
- }): Promise<ArrayBuffer>;
5284
- callUnaryStream(serviceName: string, methodName: string, request: ArrayBuffer, timeout: number | undefined, metadata: Map<string, string> | undefined): ResponseStreamReaderLike;
5285
- callUnaryStreamAsync(serviceName: string, methodName: string, request: ArrayBuffer, timeout: number | undefined, metadata: Map<string, string> | undefined, asyncOpts_?: {
5286
- signal: AbortSignal;
5287
- }): Promise<ResponseStreamReaderLike>;
5288
- /**
5289
- * Close the persistent SLIM session held by this channel, if any.
5290
- *
5291
- * `timeout` optionally bounds how long to wait for the session layer to
5292
- * confirm the close before giving up and proceeding with cleanup anyway.
5293
- * Pass `None` to wait indefinitely.
5294
- *
5295
- * After this call the channel can still be used; a new session will be
5296
- * created automatically on the next RPC call.
5297
- */
5298
- close(timeout: number | undefined): void;
5299
- /**
5300
- * Async version of [`close`](Self::close).
5301
- */
5302
- closeAsync(timeout: number | undefined, asyncOpts_?: {
5303
- signal: AbortSignal;
5304
- }): Promise<void>;
5305
- }
5306
- /**
5307
- * @deprecated Use `ChannelLike` instead.
5308
- */
5309
- export type ChannelInterface = ChannelLike;
5310
- /**
5311
- * Client-side channel for making RPC calls.
5312
- *
5313
- * Manages a single persistent SLIM session: either a `PointToPoint` session
5314
- * to a single remote server, or a `Multicast` (GROUP) session shared across
5315
- * multiple remote servers. The session is lazily initialised and recreated
5316
- * when dead.
5317
- *
5318
- * ## Constructor
5319
- *
5320
- * - `new_with_members_internal(app, members)` — Smart constructor:
5321
- * - **1 member**: creates a P2P channel.
5322
- * - **Many members**: creates a GROUP channel with a generated session name
5323
- * and auto-invites all members on the first multicast call.
5324
- */
5325
- export declare class Channel extends UniffiAbstractObject implements ChannelLike {
5326
- readonly [uniffiTypeNameSymbol] = "Channel";
5327
- readonly [destructorGuardSymbol]: UniffiGcObject;
5328
- readonly [pointerLiteralSymbol]: UniffiHandle;
5329
- constructor(app: AppLike, remote: NameLike);
5330
- static newGroup(app: AppLike, members: Array<NameLike>): ChannelLike;
5331
- static newGroupWithConnection(app: AppLike, members: Array<NameLike>, connectionId: bigint | undefined): ChannelLike;
5332
- static newWithConnection(app: AppLike, remote: NameLike, connectionId: bigint | undefined): ChannelLike;
5333
- /**
5334
- * Broadcast a request stream to all GROUP members and stream their
5335
- * responses.
5336
- *
5337
- * Semantically equivalent to `call_multicast_stream_unary` at the
5338
- * transport level; the difference (one vs many responses per member) is
5339
- * determined by the server handler.
5340
- */
5341
- callMulticastStreamStream(serviceName: string, methodName: string, timeout: number | undefined, metadata: Map<string, string> | undefined): MulticastBidiStreamHandlerLike;
5342
- /**
5343
- * Broadcast a request stream to all GROUP members and collect their
5344
- * responses.
5345
- *
5346
- * Returns a handler that lets you send requests and receive responses
5347
- * concurrently. Use `send` / `send_async` to push request messages,
5348
- * `close_send` / `close_send_async` to signal end-of-requests, and
5349
- * `recv` / `recv_async` to pull response items.
5350
- */
5351
- callMulticastStreamUnary(serviceName: string, methodName: string, timeout: number | undefined, metadata: Map<string, string> | undefined): MulticastBidiStreamHandlerLike;
5352
- /**
5353
- * Broadcast one request to all GROUP members and collect their responses.
5354
- *
5355
- * Returns a reader from which each member's response (wrapped in
5356
- * `MulticastStreamMessage`) can be pulled one at a time (blocking).
5357
- */
5358
- callMulticastUnary(serviceName: string, methodName: string, request: ArrayBuffer, timeout: number | undefined, metadata: Map<string, string> | undefined): MulticastResponseReaderLike;
5359
- /**
5360
- * Broadcast one request to all GROUP members and collect their responses
5361
- * (async).
5362
- */
5363
- callMulticastUnaryAsync(serviceName: string, methodName: string, request: ArrayBuffer, timeout: number | undefined, metadata: Map<string, string> | undefined, asyncOpts_?: {
5364
- signal: AbortSignal;
5365
- }): Promise<MulticastResponseReaderLike>;
5366
- /**
5367
- * Broadcast one request to all GROUP members and stream their responses
5368
- * (blocking).
5369
- *
5370
- * Semantically identical to `call_multicast_unary` at the transport level;
5371
- * the difference is that each member may send multiple responses before its
5372
- * EOS, which the server handler determines.
5373
- */
5374
- callMulticastUnaryStream(serviceName: string, methodName: string, request: ArrayBuffer, timeout: number | undefined, metadata: Map<string, string> | undefined): MulticastResponseReaderLike;
5375
- /**
5376
- * Broadcast one request to all GROUP members and stream their responses
5377
- * (async).
5378
- */
5379
- callMulticastUnaryStreamAsync(serviceName: string, methodName: string, request: ArrayBuffer, timeout: number | undefined, metadata: Map<string, string> | undefined, asyncOpts_?: {
5380
- signal: AbortSignal;
5381
- }): Promise<MulticastResponseReaderLike>;
5382
- callStreamStream(serviceName: string, methodName: string, timeout: number | undefined, metadata: Map<string, string> | undefined): BidiStreamHandlerLike;
5383
- callStreamUnary(serviceName: string, methodName: string, timeout: number | undefined, metadata: Map<string, string> | undefined): RequestStreamWriterLike;
5384
- callUnary(serviceName: string, methodName: string, request: ArrayBuffer, timeout: number | undefined, metadata: Map<string, string> | undefined): ArrayBuffer;
5385
- callUnaryAsync(serviceName: string, methodName: string, request: ArrayBuffer, timeout: number | undefined, metadata: Map<string, string> | undefined, asyncOpts_?: {
5386
- signal: AbortSignal;
5387
- }): Promise<ArrayBuffer>;
5388
- callUnaryStream(serviceName: string, methodName: string, request: ArrayBuffer, timeout: number | undefined, metadata: Map<string, string> | undefined): ResponseStreamReaderLike;
5389
- callUnaryStreamAsync(serviceName: string, methodName: string, request: ArrayBuffer, timeout: number | undefined, metadata: Map<string, string> | undefined, asyncOpts_?: {
5390
- signal: AbortSignal;
5391
- }): Promise<ResponseStreamReaderLike>;
5392
- /**
5393
- * Close the persistent SLIM session held by this channel, if any.
5394
- *
5395
- * `timeout` optionally bounds how long to wait for the session layer to
5396
- * confirm the close before giving up and proceeding with cleanup anyway.
5397
- * Pass `None` to wait indefinitely.
5398
- *
5399
- * After this call the channel can still be used; a new session will be
5400
- * created automatically on the next RPC call.
5401
- */
5402
- close(timeout: number | undefined): void;
5403
- /**
5404
- * Async version of [`close`](Self::close).
5405
- */
5406
- closeAsync(timeout: number | undefined, asyncOpts_?: {
5407
- signal: AbortSignal;
5408
- }): Promise<void>;
5409
- uniffiDestroy(): void;
5410
- static instanceOf(obj_: any): obj_ is Channel;
5411
- }
5412
- /**
5413
- * Context passed to RPC handlers
5414
- *
5415
- * Contains all contextual information about an RPC call including:
5416
- * - Session information (source, destination, session ID)
5417
- * - Metadata (key-value pairs)
5418
- * - Deadline/timeout information
5419
- * - Message routing details
5420
- */
5421
- export interface ContextLike {
5422
- /**
5423
- * Get the deadline for this RPC call
5424
- */
5425
- deadline(): Date;
5426
- /**
5427
- * Check if the deadline has been exceeded
5428
- */
5429
- isDeadlineExceeded(): boolean;
5430
- /**
5431
- * Get the rpc session metadata
5432
- */
5433
- metadata(): Map<string, string>;
5434
- /**
5435
- * Get the remaining time until deadline
5436
- *
5437
- * Returns Duration::ZERO if the deadline has already passed
5438
- */
5439
- remainingTime(): number;
5440
- /**
5441
- * Get the session ID
5442
- */
5443
- sessionId(): string;
5444
- }
5445
- /**
5446
- * @deprecated Use `ContextLike` instead.
5447
- */
5448
- export type ContextInterface = ContextLike;
5449
- /**
5450
- * Context passed to RPC handlers
5451
- *
5452
- * Contains all contextual information about an RPC call including:
5453
- * - Session information (source, destination, session ID)
5454
- * - Metadata (key-value pairs)
5455
- * - Deadline/timeout information
5456
- * - Message routing details
5457
- */
5458
- export declare class Context extends UniffiAbstractObject implements ContextLike {
5459
- readonly [uniffiTypeNameSymbol] = "Context";
5460
- readonly [destructorGuardSymbol]: UniffiGcObject;
5461
- readonly [pointerLiteralSymbol]: UniffiHandle;
5462
- private constructor();
5463
- /**
5464
- * Get the deadline for this RPC call
5465
- */
5466
- deadline(): Date;
5467
- /**
5468
- * Check if the deadline has been exceeded
5469
- */
5470
- isDeadlineExceeded(): boolean;
5471
- /**
5472
- * Get the rpc session metadata
5473
- */
5474
- metadata(): Map<string, string>;
5475
- /**
5476
- * Get the remaining time until deadline
5477
- *
5478
- * Returns Duration::ZERO if the deadline has already passed
5479
- */
5480
- remainingTime(): number;
5481
- /**
5482
- * Get the session ID
5483
- */
5484
- sessionId(): string;
5485
- uniffiDestroy(): void;
5486
- static instanceOf(obj_: any): obj_ is Context;
5487
- }
5488
- /**
5489
- * Request stream reader
5490
- *
5491
- * Allows pulling messages from a client request stream.
5492
- * This wraps the underlying async stream and provides a blocking interface
5493
- * suitable for UniFFI callback traits.
5494
- */
5495
- export interface RequestStreamLike {
5496
- /**
5497
- * Pull the next message from the stream (blocking version)
5498
- *
5499
- * Returns a StreamMessage indicating the result
5500
- */
5501
- next(): StreamMessage;
5502
- /**
5503
- * Pull the next message from the stream (async version)
5504
- *
5505
- * Returns a StreamMessage indicating the result
5506
- */
5507
- nextAsync(asyncOpts_?: {
5508
- signal: AbortSignal;
5509
- }): Promise<StreamMessage>;
5510
- }
5511
- /**
5512
- * @deprecated Use `RequestStreamLike` instead.
5513
- */
5514
- export type RequestStreamInterface = RequestStreamLike;
5515
- /**
5516
- * Request stream reader
5517
- *
5518
- * Allows pulling messages from a client request stream.
5519
- * This wraps the underlying async stream and provides a blocking interface
5520
- * suitable for UniFFI callback traits.
5521
- */
5522
- export declare class RequestStream extends UniffiAbstractObject implements RequestStreamLike {
5523
- readonly [uniffiTypeNameSymbol] = "RequestStream";
5524
- readonly [destructorGuardSymbol]: UniffiGcObject;
5525
- readonly [pointerLiteralSymbol]: UniffiHandle;
5526
- private constructor();
5527
- /**
5528
- * Pull the next message from the stream (blocking version)
5529
- *
5530
- * Returns a StreamMessage indicating the result
5531
- */
5532
- next(): StreamMessage;
5533
- /**
5534
- * Pull the next message from the stream (async version)
5535
- *
5536
- * Returns a StreamMessage indicating the result
5537
- */
5538
- nextAsync(asyncOpts_?: {
5539
- signal: AbortSignal;
5540
- }): Promise<StreamMessage>;
5541
- uniffiDestroy(): void;
5542
- static instanceOf(obj_: any): obj_ is RequestStream;
5543
- }
5544
- /**
5545
- * Response stream writer
5546
- *
5547
- * Allows pushing messages to a client response stream.
5548
- * This wraps an async channel sender and provides a blocking interface
5549
- * suitable for UniFFI callback traits.
5550
- */
5551
- export interface ResponseSinkLike {
5552
- /**
5553
- * Close the response stream (blocking version)
5554
- *
5555
- * Signals that no more messages will be sent.
5556
- * The stream will end gracefully.
5557
- */
5558
- close(): void;
5559
- /**
5560
- * Close the response stream (async version)
5561
- *
5562
- * Signals that no more messages will be sent.
5563
- * The stream will end gracefully.
5564
- */
5565
- closeAsync(asyncOpts_?: {
5566
- signal: AbortSignal;
5567
- }): Promise<void>;
5568
- /**
5569
- * Check if the sink has been closed (blocking version)
5570
- */
5571
- isClosed(): boolean;
5572
- /**
5573
- * Check if the sink has been closed (async version)
5574
- */
5575
- isClosedAsync(asyncOpts_?: {
5576
- signal: AbortSignal;
5577
- }): Promise<boolean>;
5578
- /**
5579
- * Send a message to the response stream (blocking version)
5580
- *
5581
- * Returns an error if the stream has been closed or if sending fails.
5582
- */
5583
- send(data: ArrayBuffer): void;
5584
- /**
5585
- * Send a message to the response stream (async version)
5586
- *
5587
- * Returns an error if the stream has been closed or if sending fails.
5588
- */
5589
- sendAsync(data: ArrayBuffer, asyncOpts_?: {
5590
- signal: AbortSignal;
5591
- }): Promise<void>;
5592
- /**
5593
- * Send an error to the response stream and close it (blocking version)
5594
- *
5595
- * This terminates the stream with an error status.
5596
- */
5597
- sendError(error: RpcError): void;
5598
- /**
5599
- * Send an error to the response stream and close it (async version)
5600
- *
5601
- * This terminates the stream with an error status.
5602
- */
5603
- sendErrorAsync(error: RpcError, asyncOpts_?: {
5604
- signal: AbortSignal;
5605
- }): Promise<void>;
5606
- }
5607
- /**
5608
- * @deprecated Use `ResponseSinkLike` instead.
5609
- */
5610
- export type ResponseSinkInterface = ResponseSinkLike;
5611
- /**
5612
- * Response stream writer
5613
- *
5614
- * Allows pushing messages to a client response stream.
5615
- * This wraps an async channel sender and provides a blocking interface
5616
- * suitable for UniFFI callback traits.
5617
- */
5618
- export declare class ResponseSink extends UniffiAbstractObject implements ResponseSinkLike {
5619
- readonly [uniffiTypeNameSymbol] = "ResponseSink";
5620
- readonly [destructorGuardSymbol]: UniffiGcObject;
5621
- readonly [pointerLiteralSymbol]: UniffiHandle;
5622
- private constructor();
5623
- /**
5624
- * Close the response stream (blocking version)
5625
- *
5626
- * Signals that no more messages will be sent.
5627
- * The stream will end gracefully.
5628
- */
5629
- close(): void;
5630
- /**
5631
- * Close the response stream (async version)
5632
- *
5633
- * Signals that no more messages will be sent.
5634
- * The stream will end gracefully.
5635
- */
5636
- closeAsync(asyncOpts_?: {
5637
- signal: AbortSignal;
5638
- }): Promise<void>;
5639
- /**
5640
- * Check if the sink has been closed (blocking version)
5641
- */
5642
- isClosed(): boolean;
5643
- /**
5644
- * Check if the sink has been closed (async version)
5645
- */
5646
- isClosedAsync(asyncOpts_?: {
5647
- signal: AbortSignal;
5648
- }): Promise<boolean>;
5649
- /**
5650
- * Send a message to the response stream (blocking version)
5651
- *
5652
- * Returns an error if the stream has been closed or if sending fails.
5653
- */
5654
- send(data: ArrayBuffer): void;
5655
- /**
5656
- * Send a message to the response stream (async version)
5657
- *
5658
- * Returns an error if the stream has been closed or if sending fails.
5659
- */
5660
- sendAsync(data: ArrayBuffer, asyncOpts_?: {
5661
- signal: AbortSignal;
5662
- }): Promise<void>;
5663
- /**
5664
- * Send an error to the response stream and close it (blocking version)
5665
- *
5666
- * This terminates the stream with an error status.
5667
- */
5668
- sendError(error: RpcError): void;
5669
- /**
5670
- * Send an error to the response stream and close it (async version)
5671
- *
5672
- * This terminates the stream with an error status.
5673
- */
5674
- sendErrorAsync(error: RpcError, asyncOpts_?: {
5675
- signal: AbortSignal;
5676
- }): Promise<void>;
5677
- uniffiDestroy(): void;
5678
- static instanceOf(obj_: any): obj_ is ResponseSink;
5679
- }
5680
- /**
5681
- * Stream-to-Stream RPC handler trait
5682
- *
5683
- * Implement this trait to handle stream-to-stream RPC calls.
5684
- * The handler receives multiple requests via the stream and sends multiple responses via the sink.
5685
- */
5686
- export interface StreamStreamHandler {
5687
- /**
5688
- * Handle a stream-to-stream RPC call
5689
- *
5690
- * # Arguments
5691
- * * `stream` - Request stream to pull messages from
5692
- * * `context` - RPC context with metadata and session information
5693
- * * `sink` - Response sink to send streaming responses
5694
- *
5695
- * # Returns
5696
- * Ok(()) if handling succeeded, or an error
5697
- *
5698
- * # Note
5699
- * You must call `sink.close()` or `sink.send_error()` when done.
5700
- */
5701
- handle(stream: RequestStreamLike, context: ContextLike, sink: ResponseSinkLike, asyncOpts_?: {
5702
- signal: AbortSignal;
5703
- }): Promise<void>;
5704
- }
5705
- /**
5706
- * Stream-to-Stream RPC handler trait
5707
- *
5708
- * Implement this trait to handle stream-to-stream RPC calls.
5709
- * The handler receives multiple requests via the stream and sends multiple responses via the sink.
5710
- */
5711
- export declare class StreamStreamHandlerImpl extends UniffiAbstractObject implements StreamStreamHandler {
5712
- readonly [uniffiTypeNameSymbol] = "StreamStreamHandlerImpl";
4265
+ export declare class App extends UniffiAbstractObject implements AppLike {
4266
+ readonly [uniffiTypeNameSymbol] = "App";
5713
4267
  readonly [destructorGuardSymbol]: UniffiGcObject;
5714
4268
  readonly [pointerLiteralSymbol]: UniffiHandle;
5715
- private constructor();
5716
4269
  /**
5717
- * Handle a stream-to-stream RPC call
4270
+ * Create a new App with identity provider and verifier configurations
4271
+ *
4272
+ * This is the main entry point for creating a SLIM application from language bindings.
5718
4273
  *
5719
4274
  * # Arguments
5720
- * * `stream` - Request stream to pull messages from
5721
- * * `context` - RPC context with metadata and session information
5722
- * * `sink` - Response sink to send streaming responses
4275
+ * * `base_name` - The base name for the app (without ID)
4276
+ * * `identity_provider_config` - Configuration for proving identity to others
4277
+ * * `identity_verifier_config` - Configuration for verifying identity of others
5723
4278
  *
5724
4279
  * # Returns
5725
- * Ok(()) if handling succeeded, or an error
4280
+ * * `Ok(Arc<App>)` - Successfully created adapter
4281
+ * * `Err(SlimError)` - If adapter creation fails
5726
4282
  *
5727
- * # Note
5728
- * You must call `sink.close()` or `sink.send_error()` when done.
4283
+ * # Supported Identity Types
4284
+ * - SharedSecret: Symmetric key authentication
4285
+ * - JWT: Dynamic JWT generation/verification with signing/decoding keys
4286
+ * - StaticJWT: Static JWT loaded from file with auto-reload
5729
4287
  */
5730
- handle(stream: RequestStreamLike, context: ContextLike, sink: ResponseSinkLike, asyncOpts_?: {
5731
- signal: AbortSignal;
5732
- }): Promise<void>;
5733
- uniffiDestroy(): void;
5734
- static instanceOf(obj_: any): obj_ is StreamStreamHandlerImpl;
5735
- }
5736
- /**
5737
- * Stream-to-Unary RPC handler trait
5738
- *
5739
- * Implement this trait to handle stream-to-unary RPC calls.
5740
- * The handler receives multiple requests via the stream and returns a single response.
5741
- */
5742
- export interface StreamUnaryHandler {
4288
+ constructor(baseName: NameLike, identityProviderConfig: IdentityProviderConfig, identityVerifierConfig: IdentityVerifierConfig);
5743
4289
  /**
5744
- * Handle a stream-to-unary RPC call
4290
+ * Create a new App with traffic direction (blocking version)
4291
+ *
4292
+ * This is a convenience function for creating a SLIM application with configurable
4293
+ * traffic direction (send-only, receive-only, bidirectional, or none).
5745
4294
  *
5746
4295
  * # Arguments
5747
- * * `stream` - Request stream to pull messages from
5748
- * * `context` - RPC context with metadata and session information
4296
+ * * `name` - The base name for the app (without ID)
4297
+ * * `identity_provider_config` - Configuration for proving identity to others
4298
+ * * `identity_verifier_config` - Configuration for verifying identity of others
4299
+ * * `direction` - Traffic direction for sessions (Send, Recv, Bidirectional, or None)
5749
4300
  *
5750
4301
  * # Returns
5751
- * The response message bytes or an error
4302
+ * * `Ok(Arc<App>)` - Successfully created app
4303
+ * * `Err(SlimError)` - If app creation fails
5752
4304
  */
5753
- handle(stream: RequestStreamLike, context: ContextLike, asyncOpts_?: {
5754
- signal: AbortSignal;
5755
- }): Promise<ArrayBuffer>;
5756
- }
5757
- /**
5758
- * Stream-to-Unary RPC handler trait
5759
- *
5760
- * Implement this trait to handle stream-to-unary RPC calls.
5761
- * The handler receives multiple requests via the stream and returns a single response.
5762
- */
5763
- export declare class StreamUnaryHandlerImpl extends UniffiAbstractObject implements StreamUnaryHandler {
5764
- readonly [uniffiTypeNameSymbol] = "StreamUnaryHandlerImpl";
5765
- readonly [destructorGuardSymbol]: UniffiGcObject;
5766
- readonly [pointerLiteralSymbol]: UniffiHandle;
5767
- private constructor();
4305
+ static newWithDirection(name: NameLike, identityProviderConfig: IdentityProviderConfig, identityVerifierConfig: IdentityVerifierConfig, direction: Direction): AppLike;
5768
4306
  /**
5769
- * Handle a stream-to-unary RPC call
4307
+ * Create a new App with SharedSecret authentication (blocking version)
4308
+ *
4309
+ * This is a convenience function for creating a SLIM application using SharedSecret authentication.
5770
4310
  *
5771
4311
  * # Arguments
5772
- * * `stream` - Request stream to pull messages from
5773
- * * `context` - RPC context with metadata and session information
4312
+ * * `name` - The base name for the app (without ID)
4313
+ * * `secret` - The shared secret string for authentication
5774
4314
  *
5775
4315
  * # Returns
5776
- * The response message bytes or an error
4316
+ * * `Ok(Arc<App>)` - Successfully created adapter
4317
+ * * `Err(SlimError)` - If adapter creation fails
5777
4318
  */
5778
- handle(stream: RequestStreamLike, context: ContextLike, asyncOpts_?: {
5779
- signal: AbortSignal;
5780
- }): Promise<ArrayBuffer>;
5781
- uniffiDestroy(): void;
5782
- static instanceOf(obj_: any): obj_ is StreamUnaryHandlerImpl;
5783
- }
5784
- /**
5785
- * Unary-to-Stream RPC handler trait
5786
- *
5787
- * Implement this trait to handle unary-to-stream RPC calls.
5788
- * The handler receives a single request and sends multiple responses via the sink.
5789
- */
5790
- export interface UnaryStreamHandler {
4319
+ static newWithSecret(name: NameLike, secret: string): AppLike;
5791
4320
  /**
5792
- * Handle a unary-to-stream RPC call
5793
- *
5794
- * # Arguments
5795
- * * `request` - The request message bytes
5796
- * * `context` - RPC context with metadata and session information
5797
- * * `sink` - Response sink to send streaming responses
5798
- *
5799
- * # Returns
5800
- * Ok(()) if handling succeeded, or an error
4321
+ * Create a new session (blocking version for FFI)
5801
4322
  *
5802
- * # Note
5803
- * You must call `sink.close()` or `sink.send_error()` when done.
4323
+ * Returns a SessionWithCompletion containing the session context and a completion handle.
4324
+ * Call `.wait()` on the completion handle to wait for session establishment.
5804
4325
  */
5805
- handle(request: ArrayBuffer, context: ContextLike, sink: ResponseSinkLike, asyncOpts_?: {
5806
- signal: AbortSignal;
5807
- }): Promise<void>;
5808
- }
5809
- /**
5810
- * Unary-to-Stream RPC handler trait
5811
- *
5812
- * Implement this trait to handle unary-to-stream RPC calls.
5813
- * The handler receives a single request and sends multiple responses via the sink.
5814
- */
5815
- export declare class UnaryStreamHandlerImpl extends UniffiAbstractObject implements UnaryStreamHandler {
5816
- readonly [uniffiTypeNameSymbol] = "UnaryStreamHandlerImpl";
5817
- readonly [destructorGuardSymbol]: UniffiGcObject;
5818
- readonly [pointerLiteralSymbol]: UniffiHandle;
5819
- private constructor();
4326
+ createSession(config: SessionConfig, destination: NameLike): SessionWithCompletion;
5820
4327
  /**
5821
- * Handle a unary-to-stream RPC call
5822
- *
5823
- * # Arguments
5824
- * * `request` - The request message bytes
5825
- * * `context` - RPC context with metadata and session information
5826
- * * `sink` - Response sink to send streaming responses
5827
- *
5828
- * # Returns
5829
- * Ok(()) if handling succeeded, or an error
4328
+ * Create a new session and wait for completion (blocking version)
5830
4329
  *
5831
- * # Note
5832
- * You must call `sink.close()` or `sink.send_error()` when done.
4330
+ * This method creates a session and blocks until the session establishment completes.
4331
+ * Returns only the session context, as the completion has already been awaited.
5833
4332
  */
5834
- handle(request: ArrayBuffer, context: ContextLike, sink: ResponseSinkLike, asyncOpts_?: {
5835
- signal: AbortSignal;
5836
- }): Promise<void>;
5837
- uniffiDestroy(): void;
5838
- static instanceOf(obj_: any): obj_ is UnaryStreamHandlerImpl;
5839
- }
5840
- /**
5841
- * Unary-to-Unary RPC handler trait
5842
- *
5843
- * Implement this trait to handle unary-to-unary RPC calls.
5844
- * The handler receives a single request and returns a single response.
5845
- */
5846
- export interface UnaryUnaryHandler {
4333
+ createSessionAndWait(config: SessionConfig, destination: NameLike): SessionLike;
5847
4334
  /**
5848
- * Handle a unary-to-unary RPC call
5849
- *
5850
- * # Arguments
5851
- * * `request` - The request message bytes
5852
- * * `context` - RPC context with metadata and session information
4335
+ * Create a new session and wait for completion (async version)
5853
4336
  *
5854
- * # Returns
5855
- * The response message bytes or an error
4337
+ * This method creates a session and waits until the session establishment completes.
4338
+ * Returns only the session context, as the completion has already been awaited.
5856
4339
  */
5857
- handle(request: ArrayBuffer, context: ContextLike, asyncOpts_?: {
4340
+ createSessionAndWaitAsync(config: SessionConfig, destination: NameLike, asyncOpts_?: {
5858
4341
  signal: AbortSignal;
5859
- }): Promise<ArrayBuffer>;
5860
- }
5861
- /**
5862
- * Unary-to-Unary RPC handler trait
5863
- *
5864
- * Implement this trait to handle unary-to-unary RPC calls.
5865
- * The handler receives a single request and returns a single response.
5866
- */
5867
- export declare class UnaryUnaryHandlerImpl extends UniffiAbstractObject implements UnaryUnaryHandler {
5868
- readonly [uniffiTypeNameSymbol] = "UnaryUnaryHandlerImpl";
5869
- readonly [destructorGuardSymbol]: UniffiGcObject;
5870
- readonly [pointerLiteralSymbol]: UniffiHandle;
5871
- private constructor();
4342
+ }): Promise<SessionLike>;
5872
4343
  /**
5873
- * Handle a unary-to-unary RPC call
5874
- *
5875
- * # Arguments
5876
- * * `request` - The request message bytes
5877
- * * `context` - RPC context with metadata and session information
4344
+ * Create a new session (async version)
5878
4345
  *
5879
- * # Returns
5880
- * The response message bytes or an error
4346
+ * Returns a SessionWithCompletion containing the session context and a completion handle.
4347
+ * Await the completion handle to wait for session establishment.
4348
+ * For point-to-point sessions, this ensures the remote peer has acknowledged the session.
4349
+ * For multicast sessions, this ensures the initial setup is complete.
5881
4350
  */
5882
- handle(request: ArrayBuffer, context: ContextLike, asyncOpts_?: {
4351
+ createSessionAsync(config: SessionConfig, destination: NameLike, asyncOpts_?: {
5883
4352
  signal: AbortSignal;
5884
- }): Promise<ArrayBuffer>;
5885
- uniffiDestroy(): void;
5886
- static instanceOf(obj_: any): obj_ is UnaryUnaryHandlerImpl;
5887
- }
5888
- /**
5889
- * RPC Server
5890
- *
5891
- * Handles incoming RPC requests by creating sessions and dispatching
5892
- * to registered service handlers.
5893
- *
5894
- * # Example
5895
- *
5896
- * ```no_run
5897
- * # use slim_bindings::{Server, Context, RpcError, Decoder, Encoder, App, Name};
5898
- * # use std::sync::Arc;
5899
- * # fn main() -> Result<(), Box<dyn std::error::Error>> {
5900
- * # use slim_bindings::{IdentityProviderConfig, IdentityVerifierConfig};
5901
- * # let app_name = Arc::new(Name::new("test".to_string(), "app".to_string(), "v1".to_string()));
5902
- * # let provider = IdentityProviderConfig::SharedSecret { id: "test".to_string(), data: "secret".to_string() };
5903
- * # let verifier = IdentityVerifierConfig::SharedSecret { id: "test".to_string(), data: "secret".to_string() };
5904
- * # let app = App::new(app_name, provider, verifier)?;
5905
- * # let core_app = app.inner();
5906
- * # let notification_rx = app.notification_receiver();
5907
- * # #[derive(Default)]
5908
- * # struct Request {}
5909
- * # impl Decoder for Request {
5910
- * # fn decode(_buf: impl Into<Vec<u8>>) -> Result<Self, RpcError> { Ok(Request::default()) }
5911
- * # }
5912
- * # #[derive(Default)]
5913
- * # struct Response {}
5914
- * # impl Encoder for Response {
5915
- * # fn encode(self) -> Result<Vec<u8>, RpcError> { Ok(vec![]) }
5916
- * # }
5917
- * let base_name = Name::new("org".to_string(), "namespace".to_string(), "service".to_string());
5918
- * let server = Server::new_with_shared_rx_and_connection(core_app, base_name.as_slim_name(), None, notification_rx, None);
5919
- *
5920
- * // Register handlers
5921
- * server.register_unary_unary_internal(
5922
- * "MyService",
5923
- * "MyMethod",
5924
- * |request: Request, _ctx: Context| async move {
5925
- * Ok(Response::default())
5926
- * }
5927
- * );
5928
- * # Ok(())
5929
- * # }
5930
- * ```
5931
- */
5932
- export interface ServerLike {
4353
+ }): Promise<SessionWithCompletion>;
5933
4354
  /**
5934
- * Register a stream-to-stream RPC handler
4355
+ * Delete a session (blocking version for FFI)
5935
4356
  *
5936
- * # Arguments
5937
- * * `service_name` - The service name
5938
- * * `method_name` - The method name
5939
- * * `handler` - Implementation of the StreamStreamHandler trait
4357
+ * Returns a completion handle that can be awaited to ensure the deletion completes.
5940
4358
  */
5941
- registerStreamStream(serviceName: string, methodName: string, handler: StreamStreamHandler): void;
4359
+ deleteSession(session: SessionLike): CompletionHandleLike;
5942
4360
  /**
5943
- * Register a stream-to-unary RPC handler
4361
+ * Delete a session and wait for completion (blocking version)
5944
4362
  *
5945
- * # Arguments
5946
- * * `service_name` - The service name
5947
- * * `method_name` - The method name
5948
- * * `handler` - Implementation of the StreamUnaryHandler trait
4363
+ * This method deletes a session and blocks until the deletion completes.
5949
4364
  */
5950
- registerStreamUnary(serviceName: string, methodName: string, handler: StreamUnaryHandler): void;
4365
+ deleteSessionAndWait(session: SessionLike): void;
5951
4366
  /**
5952
- * Register a unary-to-stream RPC handler
4367
+ * Delete a session and wait for completion (async version)
5953
4368
  *
5954
- * # Arguments
5955
- * * `service_name` - The service name
5956
- * * `method_name` - The method name
5957
- * * `handler` - Implementation of the UnaryStreamHandler trait
4369
+ * This method deletes a session and waits until the deletion completes.
5958
4370
  */
5959
- registerUnaryStream(serviceName: string, methodName: string, handler: UnaryStreamHandler): void;
4371
+ deleteSessionAndWaitAsync(session: SessionLike, asyncOpts_?: {
4372
+ signal: AbortSignal;
4373
+ }): Promise<void>;
5960
4374
  /**
5961
- * Register a unary-to-unary RPC handler
4375
+ * Delete a session (async version)
5962
4376
  *
5963
- * # Arguments
5964
- * * `service_name` - The service name (e.g., "MyService")
5965
- * * `method_name` - The method name (e.g., "GetUser")
5966
- * * `handler` - Implementation of the UnaryUnaryHandler trait
4377
+ * Returns a completion handle that can be awaited to ensure the deletion completes.
5967
4378
  */
5968
- registerUnaryUnary(serviceName: string, methodName: string, handler: UnaryUnaryHandler): void;
4379
+ deleteSessionAsync(session: SessionLike, asyncOpts_?: {
4380
+ signal: AbortSignal;
4381
+ }): Promise<CompletionHandleLike>;
5969
4382
  /**
5970
- * Start serving RPC requests (blocking version)
5971
- *
5972
- * This is a blocking method that runs until the server is shut down.
5973
- * It listens for incoming RPC calls and dispatches them to registered handlers.
4383
+ * Get the app ID in UUID format
5974
4384
  */
5975
- serve(): void;
4385
+ id(): string;
5976
4386
  /**
5977
- * Start serving RPC requests (async version)
5978
- *
5979
- * This is an async method that runs until the server is shut down.
5980
- * It listens for incoming RPC calls and dispatches them to registered handlers.
4387
+ * Listen for incoming sessions (blocking version for FFI)
5981
4388
  */
5982
- serveAsync(asyncOpts_?: {
5983
- signal: AbortSignal;
5984
- }): Promise<void>;
4389
+ listenForSession(timeout: number | undefined): SessionLike;
5985
4390
  /**
5986
- * Shutdown the server gracefully (blocking version)
5987
- *
5988
- * This signals the server to stop accepting new requests and wait for
5989
- * in-flight requests to complete.
4391
+ * Listen for incoming sessions (async version)
5990
4392
  */
5991
- shutdown(): void;
4393
+ listenForSessionAsync(timeout: number | undefined, asyncOpts_?: {
4394
+ signal: AbortSignal;
4395
+ }): Promise<SessionLike>;
5992
4396
  /**
5993
- * Shutdown the server gracefully (async version)
5994
- *
5995
- * This signals the server to stop accepting new requests and wait for
5996
- * in-flight requests to complete.
4397
+ * Get the app name
5997
4398
  */
5998
- shutdownAsync(asyncOpts_?: {
5999
- signal: AbortSignal;
6000
- }): Promise<void>;
6001
- }
6002
- /**
6003
- * @deprecated Use `ServerLike` instead.
6004
- */
6005
- export type ServerInterface = ServerLike;
6006
- /**
6007
- * RPC Server
6008
- *
6009
- * Handles incoming RPC requests by creating sessions and dispatching
6010
- * to registered service handlers.
6011
- *
6012
- * # Example
6013
- *
6014
- * ```no_run
6015
- * # use slim_bindings::{Server, Context, RpcError, Decoder, Encoder, App, Name};
6016
- * # use std::sync::Arc;
6017
- * # fn main() -> Result<(), Box<dyn std::error::Error>> {
6018
- * # use slim_bindings::{IdentityProviderConfig, IdentityVerifierConfig};
6019
- * # let app_name = Arc::new(Name::new("test".to_string(), "app".to_string(), "v1".to_string()));
6020
- * # let provider = IdentityProviderConfig::SharedSecret { id: "test".to_string(), data: "secret".to_string() };
6021
- * # let verifier = IdentityVerifierConfig::SharedSecret { id: "test".to_string(), data: "secret".to_string() };
6022
- * # let app = App::new(app_name, provider, verifier)?;
6023
- * # let core_app = app.inner();
6024
- * # let notification_rx = app.notification_receiver();
6025
- * # #[derive(Default)]
6026
- * # struct Request {}
6027
- * # impl Decoder for Request {
6028
- * # fn decode(_buf: impl Into<Vec<u8>>) -> Result<Self, RpcError> { Ok(Request::default()) }
6029
- * # }
6030
- * # #[derive(Default)]
6031
- * # struct Response {}
6032
- * # impl Encoder for Response {
6033
- * # fn encode(self) -> Result<Vec<u8>, RpcError> { Ok(vec![]) }
6034
- * # }
6035
- * let base_name = Name::new("org".to_string(), "namespace".to_string(), "service".to_string());
6036
- * let server = Server::new_with_shared_rx_and_connection(core_app, base_name.as_slim_name(), None, notification_rx, None);
6037
- *
6038
- * // Register handlers
6039
- * server.register_unary_unary_internal(
6040
- * "MyService",
6041
- * "MyMethod",
6042
- * |request: Request, _ctx: Context| async move {
6043
- * Ok(Response::default())
6044
- * }
6045
- * );
6046
- * # Ok(())
6047
- * # }
6048
- * ```
6049
- */
6050
- export declare class Server extends UniffiAbstractObject implements ServerLike {
6051
- readonly [uniffiTypeNameSymbol] = "Server";
6052
- readonly [destructorGuardSymbol]: UniffiGcObject;
6053
- readonly [pointerLiteralSymbol]: UniffiHandle;
4399
+ name(): NameLike;
6054
4400
  /**
6055
- * Create a new RPC server
6056
- *
6057
- * This is the primary constructor for creating an RPC server instance
6058
- * that can handle incoming RPC requests over SLIM.
6059
- *
6060
- * # Arguments
6061
- * * `app` - The SLIM application instance that provides the underlying
6062
- * network transport and session management
6063
- * * `base_name` - The base name for this service (e.g., org.namespace.service).
6064
- * This name is used to construct subscription names for RPC methods.
6065
- *
6066
- * # Returns
6067
- * A new RPC server instance wrapped in an Arc for shared ownership
4401
+ * Remove a route (blocking version for FFI)
6068
4402
  */
6069
- constructor(app: AppLike, baseName: NameLike);
4403
+ removeRoute(name: NameLike, connectionId: bigint): void;
6070
4404
  /**
6071
- * Create a new RPC server with optional connection ID
6072
- *
6073
- * The connection ID is used to set up routing before serving RPC requests,
6074
- * enabling multi-hop RPC calls through specific connections.
6075
- *
6076
- * # Arguments
6077
- * * `app` - The SLIM application instance that provides the underlying
6078
- * network transport and session management
6079
- * * `base_name` - The base name for this service (e.g., org.namespace.service).
6080
- * This name is used to construct subscription names for RPC methods.
6081
- * * `connection_id` - Optional connection ID for routing setup
6082
- *
6083
- * # Returns
6084
- * A new RPC server instance wrapped in an Arc for shared ownership
4405
+ * Remove a route (async version)
6085
4406
  */
6086
- static newWithConnection(app: AppLike, baseName: NameLike, connectionId: bigint | undefined): ServerLike;
4407
+ removeRouteAsync(name: NameLike, connectionId: bigint, asyncOpts_?: {
4408
+ signal: AbortSignal;
4409
+ }): Promise<void>;
6087
4410
  /**
6088
- * Register a stream-to-stream RPC handler
6089
- *
6090
- * # Arguments
6091
- * * `service_name` - The service name
6092
- * * `method_name` - The method name
6093
- * * `handler` - Implementation of the StreamStreamHandler trait
4411
+ * Blocking wrapper around [`App::restore_sessions_async`].
6094
4412
  */
6095
- registerStreamStream(serviceName: string, methodName: string, handler: StreamStreamHandler): void;
4413
+ restoreSessions(connId: bigint): Array<SessionLike>;
6096
4414
  /**
6097
- * Register a stream-to-unary RPC handler
4415
+ * Restore the app's persisted sessions after a restart (async).
6098
4416
  *
6099
- * # Arguments
6100
- * * `service_name` - The service name
6101
- * * `method_name` - The method name
6102
- * * `handler` - Implementation of the StreamUnaryHandler trait
4417
+ * Only meaningful for an app created with
4418
+ * [`crate::service::Service::create_app_with_persistence`]; returns an
4419
+ * empty list when persistence is disabled. `conn_id` must be the live
4420
+ * upstream connection to the node (the one the app subscribes over).
4421
+ * Each restored session rejoins its MLS group without repeating the
4422
+ * invite/welcome handshake.
6103
4423
  */
6104
- registerStreamUnary(serviceName: string, methodName: string, handler: StreamUnaryHandler): void;
4424
+ restoreSessionsAsync(connId: bigint, asyncOpts_?: {
4425
+ signal: AbortSignal;
4426
+ }): Promise<Array<SessionLike>>;
6105
4427
  /**
6106
- * Register a unary-to-stream RPC handler
6107
- *
6108
- * # Arguments
6109
- * * `service_name` - The service name
6110
- * * `method_name` - The method name
6111
- * * `handler` - Implementation of the UnaryStreamHandler trait
4428
+ * Set a route to a name for a specific connection (blocking version for FFI)
6112
4429
  */
6113
- registerUnaryStream(serviceName: string, methodName: string, handler: UnaryStreamHandler): void;
4430
+ setRoute(name: NameLike, connectionId: bigint): void;
6114
4431
  /**
6115
- * Register a unary-to-unary RPC handler
6116
- *
6117
- * # Arguments
6118
- * * `service_name` - The service name (e.g., "MyService")
6119
- * * `method_name` - The method name (e.g., "GetUser")
6120
- * * `handler` - Implementation of the UnaryUnaryHandler trait
4432
+ * Set a route to a name for a specific connection (async version)
6121
4433
  */
6122
- registerUnaryUnary(serviceName: string, methodName: string, handler: UnaryUnaryHandler): void;
4434
+ setRouteAsync(name: NameLike, connectionId: bigint, asyncOpts_?: {
4435
+ signal: AbortSignal;
4436
+ }): Promise<void>;
6123
4437
  /**
6124
- * Start serving RPC requests (blocking version)
6125
- *
6126
- * This is a blocking method that runs until the server is shut down.
6127
- * It listens for incoming RPC calls and dispatches them to registered handlers.
4438
+ * Subscribe to a session name (blocking version for FFI)
6128
4439
  */
6129
- serve(): void;
4440
+ subscribe(name: NameLike, connectionId: bigint | undefined): void;
6130
4441
  /**
6131
- * Start serving RPC requests (async version)
6132
- *
6133
- * This is an async method that runs until the server is shut down.
6134
- * It listens for incoming RPC calls and dispatches them to registered handlers.
4442
+ * Subscribe to a name (async version)
6135
4443
  */
6136
- serveAsync(asyncOpts_?: {
4444
+ subscribeAsync(name: NameLike, connectionId: bigint | undefined, asyncOpts_?: {
6137
4445
  signal: AbortSignal;
6138
4446
  }): Promise<void>;
6139
4447
  /**
6140
- * Shutdown the server gracefully (blocking version)
6141
- *
6142
- * This signals the server to stop accepting new requests and wait for
6143
- * in-flight requests to complete.
4448
+ * Unsubscribe from a name (blocking version for FFI)
6144
4449
  */
6145
- shutdown(): void;
4450
+ unsubscribe(name: NameLike, connectionId: bigint | undefined): void;
6146
4451
  /**
6147
- * Shutdown the server gracefully (async version)
6148
- *
6149
- * This signals the server to stop accepting new requests and wait for
6150
- * in-flight requests to complete.
4452
+ * Unsubscribe from a name (async version)
6151
4453
  */
6152
- shutdownAsync(asyncOpts_?: {
4454
+ unsubscribeAsync(name: NameLike, connectionId: bigint | undefined, asyncOpts_?: {
6153
4455
  signal: AbortSignal;
6154
4456
  }): Promise<void>;
6155
4457
  uniffiDestroy(): void;
6156
- static instanceOf(obj_: any): obj_ is Server;
4458
+ static instanceOf(obj_: any): obj_ is App;
6157
4459
  }
6158
4460
  /**
6159
4461
  * Service wrapper for uniffi bindings
@@ -6245,6 +4547,21 @@ export interface ServiceLike {
6245
4547
  createAppWithDirectionAsync(name: NameLike, identityProviderConfig: IdentityProviderConfig, identityVerifierConfig: IdentityVerifierConfig, direction: Direction, asyncOpts_?: {
6246
4548
  signal: AbortSignal;
6247
4549
  }): Promise<AppLike>;
4550
+ /**
4551
+ * Blocking wrapper around [`Service::create_app_with_persistence_async`].
4552
+ */
4553
+ createAppWithPersistence(name: NameLike, identityProviderConfig: IdentityProviderConfig, identityVerifierConfig: IdentityVerifierConfig, direction: Direction, persistence: PersistenceConfig): AppLike;
4554
+ /**
4555
+ * Create an app with restorable MLS/session state persisted under
4556
+ * `persistence.path` (async).
4557
+ *
4558
+ * Mirror of [`Service::create_app_with_direction_async`] with persistence
4559
+ * enabled. Restore the app's sessions after a restart with
4560
+ * [`App::restore_sessions`].
4561
+ */
4562
+ createAppWithPersistenceAsync(name: NameLike, identityProviderConfig: IdentityProviderConfig, identityVerifierConfig: IdentityVerifierConfig, direction: Direction, persistence: PersistenceConfig, asyncOpts_?: {
4563
+ signal: AbortSignal;
4564
+ }): Promise<AppLike>;
6248
4565
  /**
6249
4566
  * Create a new App with SharedSecret authentication (helper function)
6250
4567
  *
@@ -6429,6 +4746,21 @@ export declare class Service extends UniffiAbstractObject implements ServiceLike
6429
4746
  createAppWithDirectionAsync(name: NameLike, identityProviderConfig: IdentityProviderConfig, identityVerifierConfig: IdentityVerifierConfig, direction: Direction, asyncOpts_?: {
6430
4747
  signal: AbortSignal;
6431
4748
  }): Promise<AppLike>;
4749
+ /**
4750
+ * Blocking wrapper around [`Service::create_app_with_persistence_async`].
4751
+ */
4752
+ createAppWithPersistence(name: NameLike, identityProviderConfig: IdentityProviderConfig, identityVerifierConfig: IdentityVerifierConfig, direction: Direction, persistence: PersistenceConfig): AppLike;
4753
+ /**
4754
+ * Create an app with restorable MLS/session state persisted under
4755
+ * `persistence.path` (async).
4756
+ *
4757
+ * Mirror of [`Service::create_app_with_direction_async`] with persistence
4758
+ * enabled. Restore the app's sessions after a restart with
4759
+ * [`App::restore_sessions`].
4760
+ */
4761
+ createAppWithPersistenceAsync(name: NameLike, identityProviderConfig: IdentityProviderConfig, identityVerifierConfig: IdentityVerifierConfig, direction: Direction, persistence: PersistenceConfig, asyncOpts_?: {
4762
+ signal: AbortSignal;
4763
+ }): Promise<AppLike>;
6432
4764
  /**
6433
4765
  * Create a new App with SharedSecret authentication (helper function)
6434
4766
  *
@@ -6539,7 +4871,6 @@ declare const _default: Readonly<{
6539
4871
  lift(value: UniffiByteArray): BasicAuth;
6540
4872
  lower(value: BasicAuth, alloc: import("@ubjs/core").RustBufferAllocator): UniffiByteArray;
6541
4873
  };
6542
- FfiConverterTypeBidiStreamHandler: FfiConverterObject<BidiStreamHandlerLike>;
6543
4874
  FfiConverterTypeBuildInfo: {
6544
4875
  read(from: RustBuffer): BuildInfo;
6545
4876
  write(value: BuildInfo, into: RustBuffer): void;
@@ -6554,7 +4885,6 @@ declare const _default: Readonly<{
6554
4885
  lift(value: UniffiByteArray): CaSource;
6555
4886
  lower(value: CaSource, alloc: import("@ubjs/core").RustBufferAllocator): UniffiByteArray;
6556
4887
  };
6557
- FfiConverterTypeChannel: FfiConverterObject<ChannelLike>;
6558
4888
  FfiConverterTypeClientAuthenticationConfig: {
6559
4889
  read(from: RustBuffer): ClientAuthenticationConfig;
6560
4890
  write(value: ClientAuthenticationConfig, into: RustBuffer): void;
@@ -6576,6 +4906,13 @@ declare const _default: Readonly<{
6576
4906
  lift(value: UniffiByteArray): ClientJwtAuth;
6577
4907
  lower(value: ClientJwtAuth, alloc: import("@ubjs/core").RustBufferAllocator): UniffiByteArray;
6578
4908
  };
4909
+ FfiConverterTypeCloseMode: {
4910
+ read(from: RustBuffer): CloseMode;
4911
+ write(value: CloseMode, into: RustBuffer): void;
4912
+ allocationSize(value: CloseMode): number;
4913
+ lift(value: UniffiByteArray): CloseMode;
4914
+ lower(value: CloseMode, alloc: import("@ubjs/core").RustBufferAllocator): UniffiByteArray;
4915
+ };
6579
4916
  FfiConverterTypeCompletionHandle: FfiConverterObject<CompletionHandleLike>;
6580
4917
  FfiConverterTypeCompressionType: {
6581
4918
  read(from: RustBuffer): CompressionType;
@@ -6584,7 +4921,6 @@ declare const _default: Readonly<{
6584
4921
  lift(value: UniffiByteArray): CompressionType;
6585
4922
  lower(value: CompressionType, alloc: import("@ubjs/core").RustBufferAllocator): UniffiByteArray;
6586
4923
  };
6587
- FfiConverterTypeContext: FfiConverterObject<ContextLike>;
6588
4924
  FfiConverterTypeDataplaneConfig: {
6589
4925
  read(from: RustBuffer): DataplaneConfig;
6590
4926
  write(value: DataplaneConfig, into: RustBuffer): void;
@@ -6697,16 +5033,28 @@ declare const _default: Readonly<{
6697
5033
  lift(value: UniffiByteArray): MlsSettings;
6698
5034
  lower(value: MlsSettings, alloc: import("@ubjs/core").RustBufferAllocator): UniffiByteArray;
6699
5035
  };
6700
- FfiConverterTypeMulticastBidiStreamHandler: FfiConverterObject<MulticastBidiStreamHandlerLike>;
6701
- FfiConverterTypeMulticastResponseReader: FfiConverterObject<MulticastResponseReaderLike>;
6702
- FfiConverterTypeMulticastStreamMessage: {
6703
- read(from: RustBuffer): MulticastStreamMessage;
6704
- write(value: MulticastStreamMessage, into: RustBuffer): void;
6705
- allocationSize(value: MulticastStreamMessage): number;
6706
- lift(value: UniffiByteArray): MulticastStreamMessage;
6707
- lower(value: MulticastStreamMessage, alloc: import("@ubjs/core").RustBufferAllocator): UniffiByteArray;
6708
- };
6709
5036
  FfiConverterTypeName: FfiConverterObject<NameLike>;
5037
+ FfiConverterTypeParticipantInfo: {
5038
+ read(from: RustBuffer): ParticipantInfo;
5039
+ write(value: ParticipantInfo, into: RustBuffer): void;
5040
+ allocationSize(value: ParticipantInfo): number;
5041
+ lift(value: UniffiByteArray): ParticipantInfo;
5042
+ lower(value: ParticipantInfo, alloc: import("@ubjs/core").RustBufferAllocator): UniffiByteArray;
5043
+ };
5044
+ FfiConverterTypeParticipantStatus: {
5045
+ read(from: RustBuffer): ParticipantStatus;
5046
+ write(value: ParticipantStatus, into: RustBuffer): void;
5047
+ allocationSize(value: ParticipantStatus): number;
5048
+ lift(value: UniffiByteArray): ParticipantStatus;
5049
+ lower(value: ParticipantStatus, alloc: import("@ubjs/core").RustBufferAllocator): UniffiByteArray;
5050
+ };
5051
+ FfiConverterTypePersistenceConfig: {
5052
+ read(from: RustBuffer): PersistenceConfig;
5053
+ write(value: PersistenceConfig, into: RustBuffer): void;
5054
+ allocationSize(value: PersistenceConfig): number;
5055
+ lift(value: UniffiByteArray): PersistenceConfig;
5056
+ lower(value: PersistenceConfig, alloc: import("@ubjs/core").RustBufferAllocator): UniffiByteArray;
5057
+ };
6710
5058
  FfiConverterTypeProxyConfig: {
6711
5059
  read(from: RustBuffer): ProxyConfig;
6712
5060
  write(value: ProxyConfig, into: RustBuffer): void;
@@ -6721,38 +5069,6 @@ declare const _default: Readonly<{
6721
5069
  lift(value: UniffiByteArray): ReceivedMessage;
6722
5070
  lower(value: ReceivedMessage, alloc: import("@ubjs/core").RustBufferAllocator): UniffiByteArray;
6723
5071
  };
6724
- FfiConverterTypeRequestStream: FfiConverterObject<RequestStreamLike>;
6725
- FfiConverterTypeRequestStreamWriter: FfiConverterObject<RequestStreamWriterLike>;
6726
- FfiConverterTypeResponseSink: FfiConverterObject<ResponseSinkLike>;
6727
- FfiConverterTypeResponseStreamReader: FfiConverterObject<ResponseStreamReaderLike>;
6728
- FfiConverterTypeRpcCode: {
6729
- read(from: RustBuffer): RpcCode;
6730
- write(value: RpcCode, into: RustBuffer): void;
6731
- allocationSize(value: RpcCode): number;
6732
- lift(value: UniffiByteArray): RpcCode;
6733
- lower(value: RpcCode, alloc: import("@ubjs/core").RustBufferAllocator): UniffiByteArray;
6734
- };
6735
- FfiConverterTypeRpcError: {
6736
- read(from: RustBuffer): RpcError;
6737
- write(value: RpcError, into: RustBuffer): void;
6738
- allocationSize(value: RpcError): number;
6739
- lift(value: UniffiByteArray): RpcError;
6740
- lower(value: RpcError, alloc: import("@ubjs/core").RustBufferAllocator): UniffiByteArray;
6741
- };
6742
- FfiConverterTypeRpcMessageContext: {
6743
- read(from: RustBuffer): RpcMessageContext;
6744
- write(value: RpcMessageContext, into: RustBuffer): void;
6745
- allocationSize(value: RpcMessageContext): number;
6746
- lift(value: UniffiByteArray): RpcMessageContext;
6747
- lower(value: RpcMessageContext, alloc: import("@ubjs/core").RustBufferAllocator): UniffiByteArray;
6748
- };
6749
- FfiConverterTypeRpcMulticastItem: {
6750
- read(from: RustBuffer): RpcMulticastItem;
6751
- write(value: RpcMulticastItem, into: RustBuffer): void;
6752
- allocationSize(value: RpcMulticastItem): number;
6753
- lift(value: UniffiByteArray): RpcMulticastItem;
6754
- lower(value: RpcMulticastItem, alloc: import("@ubjs/core").RustBufferAllocator): UniffiByteArray;
6755
- };
6756
5072
  FfiConverterTypeRuntimeConfig: {
6757
5073
  read(from: RustBuffer): RuntimeConfig;
6758
5074
  write(value: RuntimeConfig, into: RustBuffer): void;
@@ -6760,7 +5076,6 @@ declare const _default: Readonly<{
6760
5076
  lift(value: UniffiByteArray): RuntimeConfig;
6761
5077
  lower(value: RuntimeConfig, alloc: import("@ubjs/core").RustBufferAllocator): UniffiByteArray;
6762
5078
  };
6763
- FfiConverterTypeServer: FfiConverterObject<ServerLike>;
6764
5079
  FfiConverterTypeServerAuthenticationConfig: {
6765
5080
  read(from: RustBuffer): ServerAuthenticationConfig;
6766
5081
  write(value: ServerAuthenticationConfig, into: RustBuffer): void;
@@ -6826,15 +5141,6 @@ declare const _default: Readonly<{
6826
5141
  lift(value: UniffiByteArray): StaticJwtAuth;
6827
5142
  lower(value: StaticJwtAuth, alloc: import("@ubjs/core").RustBufferAllocator): UniffiByteArray;
6828
5143
  };
6829
- FfiConverterTypeStreamMessage: {
6830
- read(from: RustBuffer): StreamMessage;
6831
- write(value: StreamMessage, into: RustBuffer): void;
6832
- allocationSize(value: StreamMessage): number;
6833
- lift(value: UniffiByteArray): StreamMessage;
6834
- lower(value: StreamMessage, alloc: import("@ubjs/core").RustBufferAllocator): UniffiByteArray;
6835
- };
6836
- FfiConverterTypeStreamStreamHandler: FfiConverterObjectWithCallbacks<StreamStreamHandler>;
6837
- FfiConverterTypeStreamUnaryHandler: FfiConverterObjectWithCallbacks<StreamUnaryHandler>;
6838
5144
  FfiConverterTypeTlsClientConfig: {
6839
5145
  read(from: RustBuffer): TlsClientConfig;
6840
5146
  write(value: TlsClientConfig, into: RustBuffer): void;
@@ -6870,8 +5176,6 @@ declare const _default: Readonly<{
6870
5176
  lift(value: UniffiByteArray): TransportProtocol;
6871
5177
  lower(value: TransportProtocol, alloc: import("@ubjs/core").RustBufferAllocator): UniffiByteArray;
6872
5178
  };
6873
- FfiConverterTypeUnaryStreamHandler: FfiConverterObjectWithCallbacks<UnaryStreamHandler>;
6874
- FfiConverterTypeUnaryUnaryHandler: FfiConverterObjectWithCallbacks<UnaryUnaryHandler>;
6875
5179
  };
6876
5180
  }>;
6877
5181
  export default _default;