@myronsi/messenger-api 2.1.0-alpha.14 → 2.1.0-alpha.15

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.
@@ -202,6 +202,13 @@
202
202
  "invalid_client_version",
203
203
  "blocked_by_user",
204
204
  "approval_required",
205
+ "calls_unavailable",
206
+ "calls_not_allowed",
207
+ "call_identity_required",
208
+ "call_full",
209
+ "call_ended",
210
+ "already_in_call",
211
+ "stale_epoch",
205
212
  "internal_error"
206
213
  ]
207
214
  },
@@ -887,6 +894,7 @@
887
894
  "direct_messages",
888
895
  "group_invites",
889
896
  "search_visibility",
897
+ "calls_enabled",
890
898
  "exceptions"
891
899
  ],
892
900
  "properties": {
@@ -911,6 +919,10 @@
911
919
  "search_visibility": {
912
920
  "$ref": "#/$defs/SearchVisibility"
913
921
  },
922
+ "calls_enabled": {
923
+ "type": "boolean",
924
+ "description": "Whether others may ring this user. Calls are only possible from an existing direct chat or a shared group."
925
+ },
914
926
  "exceptions": {
915
927
  "$ref": "#/$defs/PrivacyExceptions"
916
928
  }
@@ -940,6 +952,9 @@
940
952
  },
941
953
  "search_visibility": {
942
954
  "$ref": "#/$defs/SearchVisibility"
955
+ },
956
+ "calls_enabled": {
957
+ "type": "boolean"
943
958
  }
944
959
  }
945
960
  },
@@ -1546,12 +1561,13 @@
1546
1561
  "member_added",
1547
1562
  "member_joined",
1548
1563
  "member_removed",
1549
- "member_left"
1564
+ "member_left",
1565
+ "call"
1550
1566
  ]
1551
1567
  },
1552
1568
  "SystemEvent": {
1553
1569
  "type": "object",
1554
- "description": "What a `system` message records; set on system messages only, whose `content` is then `null`. The names\nare the display names at the time of the event. `target` fields are set for `member_added` and\n`member_removed`.\n",
1570
+ "description": "What a `system` message records; set on system messages only, whose `content` is then `null`. The names\nare the display names at the time of the event. `target` fields are set for `member_added` and\n`member_removed`. `call` is set for `call` messages: one per call, posted when the call ends, `actor` is the\ninitiator.\n",
1555
1571
  "required": [
1556
1572
  "kind",
1557
1573
  "actor_id",
@@ -1579,6 +1595,9 @@
1579
1595
  },
1580
1596
  "target_name": {
1581
1597
  "type": "string"
1598
+ },
1599
+ "call": {
1600
+ "$ref": "#/$defs/CallSummary"
1582
1601
  }
1583
1602
  }
1584
1603
  },
@@ -2753,6 +2772,453 @@
2753
2772
  }
2754
2773
  }
2755
2774
  },
2775
+ "CallConfig": {
2776
+ "type": "object",
2777
+ "required": [
2778
+ "enabled",
2779
+ "max_participants",
2780
+ "ring_timeout_seconds"
2781
+ ],
2782
+ "properties": {
2783
+ "enabled": {
2784
+ "type": "boolean"
2785
+ },
2786
+ "max_participants": {
2787
+ "type": "integer",
2788
+ "minimum": 2,
2789
+ "description": "Most sessions joined to one call at the same time."
2790
+ },
2791
+ "ring_timeout_seconds": {
2792
+ "type": "integer",
2793
+ "minimum": 1,
2794
+ "description": "How long an invitation rings before it counts as missed."
2795
+ }
2796
+ }
2797
+ },
2798
+ "CallIdentityRequest": {
2799
+ "type": "object",
2800
+ "required": [
2801
+ "public_key"
2802
+ ],
2803
+ "properties": {
2804
+ "public_key": {
2805
+ "$ref": "#/$defs/CallIdentityKey"
2806
+ }
2807
+ }
2808
+ },
2809
+ "CallIdentityKey": {
2810
+ "type": "string",
2811
+ "description": "P-256 public key as an uncompressed point (65 bytes, first byte `0x04`), base64url without padding.\n",
2812
+ "minLength": 87,
2813
+ "maxLength": 87,
2814
+ "pattern": "^[A-Za-z0-9_-]+$"
2815
+ },
2816
+ "CallState": {
2817
+ "type": "string",
2818
+ "description": "`ringing` until someone answers, `active` while people are in it, `ended` afterwards.",
2819
+ "enum": [
2820
+ "ringing",
2821
+ "active",
2822
+ "ended"
2823
+ ]
2824
+ },
2825
+ "CallEndReason": {
2826
+ "type": "string",
2827
+ "description": "Why the call ended: `completed` (people talked), `missed` (nobody answered in time), `declined` (the peer of a\ndirect call declined), `cancelled` (the caller hung up before an answer), `failed` (the media service lost\nthe call).\n",
2828
+ "enum": [
2829
+ "completed",
2830
+ "missed",
2831
+ "declined",
2832
+ "cancelled",
2833
+ "failed"
2834
+ ]
2835
+ },
2836
+ "CallParticipantState": {
2837
+ "type": "string",
2838
+ "description": "`left` and `declined` can become `joined` again in a group call.",
2839
+ "enum": [
2840
+ "ringing",
2841
+ "joined",
2842
+ "declined",
2843
+ "missed",
2844
+ "left"
2845
+ ]
2846
+ },
2847
+ "CallParticipant": {
2848
+ "type": "object",
2849
+ "required": [
2850
+ "user_id",
2851
+ "state",
2852
+ "session_id",
2853
+ "identity_key",
2854
+ "joined_at"
2855
+ ],
2856
+ "properties": {
2857
+ "user_id": {
2858
+ "$ref": "#/$defs/Id"
2859
+ },
2860
+ "state": {
2861
+ "$ref": "#/$defs/CallParticipantState"
2862
+ },
2863
+ "session_id": {
2864
+ "description": "The session that joined; `null` unless `state` is `joined`.",
2865
+ "oneOf": [
2866
+ {
2867
+ "type": "string",
2868
+ "format": "uuid"
2869
+ },
2870
+ {
2871
+ "type": "null"
2872
+ }
2873
+ ]
2874
+ },
2875
+ "identity_key": {
2876
+ "description": "Call identity of the joined session; `null` unless `state` is `joined`.",
2877
+ "oneOf": [
2878
+ {
2879
+ "$ref": "#/$defs/CallIdentityKey"
2880
+ },
2881
+ {
2882
+ "type": "null"
2883
+ }
2884
+ ]
2885
+ },
2886
+ "joined_at": {
2887
+ "description": "When the participant last joined; `null` if never.",
2888
+ "oneOf": [
2889
+ {
2890
+ "$ref": "#/$defs/Timestamp"
2891
+ },
2892
+ {
2893
+ "type": "null"
2894
+ }
2895
+ ]
2896
+ }
2897
+ }
2898
+ },
2899
+ "Call": {
2900
+ "type": "object",
2901
+ "required": [
2902
+ "id",
2903
+ "chat_id",
2904
+ "kind",
2905
+ "state",
2906
+ "end_reason",
2907
+ "initiator_id",
2908
+ "created_at",
2909
+ "started_at",
2910
+ "ended_at",
2911
+ "ring_expires_at",
2912
+ "epoch",
2913
+ "version",
2914
+ "max_participants",
2915
+ "participants"
2916
+ ],
2917
+ "properties": {
2918
+ "id": {
2919
+ "$ref": "#/$defs/Id"
2920
+ },
2921
+ "chat_id": {
2922
+ "$ref": "#/$defs/Id"
2923
+ },
2924
+ "kind": {
2925
+ "type": "string",
2926
+ "enum": [
2927
+ "direct",
2928
+ "group"
2929
+ ]
2930
+ },
2931
+ "state": {
2932
+ "$ref": "#/$defs/CallState"
2933
+ },
2934
+ "end_reason": {
2935
+ "oneOf": [
2936
+ {
2937
+ "$ref": "#/$defs/CallEndReason"
2938
+ },
2939
+ {
2940
+ "type": "null"
2941
+ }
2942
+ ]
2943
+ },
2944
+ "initiator_id": {
2945
+ "$ref": "#/$defs/Id"
2946
+ },
2947
+ "created_at": {
2948
+ "$ref": "#/$defs/Timestamp"
2949
+ },
2950
+ "started_at": {
2951
+ "description": "First answer; `null` while nobody answered.",
2952
+ "oneOf": [
2953
+ {
2954
+ "$ref": "#/$defs/Timestamp"
2955
+ },
2956
+ {
2957
+ "type": "null"
2958
+ }
2959
+ ]
2960
+ },
2961
+ "ended_at": {
2962
+ "oneOf": [
2963
+ {
2964
+ "$ref": "#/$defs/Timestamp"
2965
+ },
2966
+ {
2967
+ "type": "null"
2968
+ }
2969
+ ]
2970
+ },
2971
+ "ring_expires_at": {
2972
+ "description": "When ringing invitations of this call turn into `missed`.",
2973
+ "$ref": "#/$defs/Timestamp"
2974
+ },
2975
+ "epoch": {
2976
+ "type": "integer",
2977
+ "minimum": 0,
2978
+ "description": "Key epoch; increases whenever the set of joined sessions or their identity keys change."
2979
+ },
2980
+ "version": {
2981
+ "type": "integer",
2982
+ "minimum": 1,
2983
+ "description": "Increases with every change of the call; ignore events with a lower version than one already seen."
2984
+ },
2985
+ "max_participants": {
2986
+ "type": "integer",
2987
+ "minimum": 2
2988
+ },
2989
+ "participants": {
2990
+ "type": "array",
2991
+ "description": "Everyone invited or joined, the initiator first.",
2992
+ "items": {
2993
+ "$ref": "#/$defs/CallParticipant"
2994
+ }
2995
+ }
2996
+ }
2997
+ },
2998
+ "CallList": {
2999
+ "type": "object",
3000
+ "required": [
3001
+ "items"
3002
+ ],
3003
+ "properties": {
3004
+ "items": {
3005
+ "type": "array",
3006
+ "items": {
3007
+ "$ref": "#/$defs/Call"
3008
+ }
3009
+ }
3010
+ }
3011
+ },
3012
+ "StartCallRequest": {
3013
+ "type": "object",
3014
+ "required": [
3015
+ "client_request_id"
3016
+ ],
3017
+ "properties": {
3018
+ "client_request_id": {
3019
+ "type": "string",
3020
+ "format": "uuid",
3021
+ "description": "Idempotency key chosen by the client."
3022
+ }
3023
+ }
3024
+ },
3025
+ "JoinCallRequest": {
3026
+ "type": "object",
3027
+ "properties": {
3028
+ "takeover": {
3029
+ "type": "boolean",
3030
+ "default": false,
3031
+ "description": "Move the user's participation from another session to this one."
3032
+ }
3033
+ }
3034
+ },
3035
+ "CallGrant": {
3036
+ "type": "object",
3037
+ "required": [
3038
+ "url",
3039
+ "token",
3040
+ "identity",
3041
+ "expires_at"
3042
+ ],
3043
+ "properties": {
3044
+ "url": {
3045
+ "type": "string",
3046
+ "description": "WebSocket URL of the media server (`wss://`)."
3047
+ },
3048
+ "token": {
3049
+ "type": "string",
3050
+ "description": "Media access token for this call and session only; microphone audio only."
3051
+ },
3052
+ "identity": {
3053
+ "type": "string",
3054
+ "description": "The participant identity inside the media room (`<user_id>:<session_id>`)."
3055
+ },
3056
+ "expires_at": {
3057
+ "$ref": "#/$defs/Timestamp"
3058
+ }
3059
+ }
3060
+ },
3061
+ "CallJoin": {
3062
+ "type": "object",
3063
+ "required": [
3064
+ "call",
3065
+ "grant"
3066
+ ],
3067
+ "properties": {
3068
+ "call": {
3069
+ "$ref": "#/$defs/Call"
3070
+ },
3071
+ "grant": {
3072
+ "$ref": "#/$defs/CallGrant"
3073
+ }
3074
+ }
3075
+ },
3076
+ "CallKeyEnvelope": {
3077
+ "type": "object",
3078
+ "description": "An HPKE Auth-mode envelope carrying one sender key (see `docs/calls-e2ee.md`).",
3079
+ "required": [
3080
+ "epoch",
3081
+ "sender_user_id",
3082
+ "sender_session_id",
3083
+ "recipient_session_id",
3084
+ "enc",
3085
+ "ciphertext"
3086
+ ],
3087
+ "properties": {
3088
+ "epoch": {
3089
+ "type": "integer",
3090
+ "minimum": 0
3091
+ },
3092
+ "sender_user_id": {
3093
+ "$ref": "#/$defs/Id"
3094
+ },
3095
+ "sender_session_id": {
3096
+ "type": "string",
3097
+ "format": "uuid"
3098
+ },
3099
+ "recipient_session_id": {
3100
+ "type": "string",
3101
+ "format": "uuid"
3102
+ },
3103
+ "enc": {
3104
+ "type": "string",
3105
+ "description": "HPKE encapsulated key, base64url without padding.",
3106
+ "maxLength": 128,
3107
+ "pattern": "^[A-Za-z0-9_-]+$"
3108
+ },
3109
+ "ciphertext": {
3110
+ "type": "string",
3111
+ "description": "Sealed sender key, base64url without padding.",
3112
+ "maxLength": 256,
3113
+ "pattern": "^[A-Za-z0-9_-]+$"
3114
+ }
3115
+ }
3116
+ },
3117
+ "CallKeyEnvelopeList": {
3118
+ "type": "object",
3119
+ "required": [
3120
+ "call_id",
3121
+ "epoch",
3122
+ "items"
3123
+ ],
3124
+ "properties": {
3125
+ "call_id": {
3126
+ "$ref": "#/$defs/Id"
3127
+ },
3128
+ "epoch": {
3129
+ "type": "integer",
3130
+ "minimum": 0
3131
+ },
3132
+ "items": {
3133
+ "type": "array",
3134
+ "items": {
3135
+ "$ref": "#/$defs/CallKeyEnvelope"
3136
+ }
3137
+ }
3138
+ }
3139
+ },
3140
+ "SendCallKeysRequest": {
3141
+ "type": "object",
3142
+ "required": [
3143
+ "epoch",
3144
+ "envelopes"
3145
+ ],
3146
+ "properties": {
3147
+ "epoch": {
3148
+ "type": "integer",
3149
+ "minimum": 0
3150
+ },
3151
+ "envelopes": {
3152
+ "type": "array",
3153
+ "minItems": 1,
3154
+ "maxItems": 64,
3155
+ "items": {
3156
+ "$ref": "#/$defs/OutgoingCallKeyEnvelope"
3157
+ }
3158
+ }
3159
+ }
3160
+ },
3161
+ "OutgoingCallKeyEnvelope": {
3162
+ "type": "object",
3163
+ "required": [
3164
+ "recipient_session_id",
3165
+ "enc",
3166
+ "ciphertext"
3167
+ ],
3168
+ "properties": {
3169
+ "recipient_session_id": {
3170
+ "type": "string",
3171
+ "format": "uuid"
3172
+ },
3173
+ "enc": {
3174
+ "type": "string",
3175
+ "maxLength": 128,
3176
+ "pattern": "^[A-Za-z0-9_-]+$"
3177
+ },
3178
+ "ciphertext": {
3179
+ "type": "string",
3180
+ "maxLength": 256,
3181
+ "pattern": "^[A-Za-z0-9_-]+$"
3182
+ }
3183
+ }
3184
+ },
3185
+ "CallSummary": {
3186
+ "type": "object",
3187
+ "description": "The call a `call` system message records.",
3188
+ "required": [
3189
+ "call_id",
3190
+ "kind",
3191
+ "outcome",
3192
+ "duration_seconds"
3193
+ ],
3194
+ "properties": {
3195
+ "call_id": {
3196
+ "$ref": "#/$defs/Id"
3197
+ },
3198
+ "kind": {
3199
+ "type": "string",
3200
+ "enum": [
3201
+ "direct",
3202
+ "group"
3203
+ ]
3204
+ },
3205
+ "outcome": {
3206
+ "$ref": "#/$defs/CallEndReason"
3207
+ },
3208
+ "duration_seconds": {
3209
+ "description": "From the first answer to the end; `null` if nobody answered.",
3210
+ "oneOf": [
3211
+ {
3212
+ "type": "integer",
3213
+ "minimum": 0
3214
+ },
3215
+ {
3216
+ "type": "null"
3217
+ }
3218
+ ]
3219
+ }
3220
+ }
3221
+ },
2756
3222
  "ClientDeleteEvent": {
2757
3223
  "title": "ClientDeleteEvent",
2758
3224
  "description": "Delete a message for yourself or for everyone.",
@@ -3213,6 +3679,64 @@
3213
3679
  "data"
3214
3680
  ]
3215
3681
  },
3682
+ "ServerCallKeysEvent": {
3683
+ "title": "ServerCallKeysEvent",
3684
+ "description": "Sealed sender keys for this session (see docs/calls-e2ee.md). Sent only to the recipient session.",
3685
+ "type": "object",
3686
+ "properties": {
3687
+ "type": {
3688
+ "const": "call_keys"
3689
+ },
3690
+ "event_id": {
3691
+ "$ref": "#/$defs/Id"
3692
+ },
3693
+ "chat_id": {
3694
+ "$ref": "#/$defs/Id"
3695
+ },
3696
+ "data": {
3697
+ "$ref": "#/$defs/CallKeyEnvelopeList"
3698
+ }
3699
+ },
3700
+ "required": [
3701
+ "type",
3702
+ "event_id",
3703
+ "chat_id",
3704
+ "data"
3705
+ ]
3706
+ },
3707
+ "ServerCallUpdatedEvent": {
3708
+ "title": "ServerCallUpdatedEvent",
3709
+ "description": "A call of the chat started, rang, changed participants or epoch, or ended. Carries the whole call; keep the one with the highest `version`. Sent to every member of the chat.",
3710
+ "type": "object",
3711
+ "properties": {
3712
+ "type": {
3713
+ "const": "call_updated"
3714
+ },
3715
+ "event_id": {
3716
+ "$ref": "#/$defs/Id"
3717
+ },
3718
+ "chat_id": {
3719
+ "$ref": "#/$defs/Id"
3720
+ },
3721
+ "data": {
3722
+ "type": "object",
3723
+ "properties": {
3724
+ "call": {
3725
+ "$ref": "#/$defs/Call"
3726
+ }
3727
+ },
3728
+ "required": [
3729
+ "call"
3730
+ ]
3731
+ }
3732
+ },
3733
+ "required": [
3734
+ "type",
3735
+ "event_id",
3736
+ "chat_id",
3737
+ "data"
3738
+ ]
3739
+ },
3216
3740
  "ServerChatCreatedEvent": {
3217
3741
  "title": "ServerChatCreatedEvent",
3218
3742
  "description": "A chat was created with you.",
@@ -3968,6 +4492,12 @@
3968
4492
  {
3969
4493
  "$ref": "#/$defs/ServerApprovalRequestCreatedEvent"
3970
4494
  },
4495
+ {
4496
+ "$ref": "#/$defs/ServerCallKeysEvent"
4497
+ },
4498
+ {
4499
+ "$ref": "#/$defs/ServerCallUpdatedEvent"
4500
+ },
3971
4501
  {
3972
4502
  "$ref": "#/$defs/ServerChatCreatedEvent"
3973
4503
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@myronsi/messenger-api",
3
- "version": "2.1.0-alpha.14",
3
+ "version": "2.1.0-alpha.15",
4
4
  "description": "API contract of the Messenger backend: OpenAPI document, WebSocket event schemas and generated TypeScript types",
5
5
  "license": "MIT",
6
6
  "repository": {