Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

fix[call-kit]: add tauri capabilities and required sns key (#3131)

Peter Chinman259e8a5b2a9b
diff --git a/infra/packages/shared/src/macro_notify.ts b/infra/packages/shared/src/macro_notify.ts
index c0e2f57468..002887cf67 100644
--- a/infra/packages/shared/src/macro_notify.ts
+++ b/infra/packages/shared/src/macro_notify.ts
@@ -25,7 +25,7 @@ export function getMacroNotify(): {
const notificationApnsVoipPlatformArn: pulumi.Output<string> =
notificationServiceStack
- .getOutput('notificationApnsVoipPlatformArn')
+ .requireOutput('notificationApnsVoipPlatformArn')
.apply((arn) => arn as string);
return {
diff --git a/js/app/tauri/callkit_plugin/build.rs b/js/app/tauri/callkit_plugin/build.rs
index d72a9dc168..8f641be29f 100644
--- a/js/app/tauri/callkit_plugin/build.rs
+++ b/js/app/tauri/callkit_plugin/build.rs
@@ -1,5 +1,5 @@
fn main() {
- tauri_plugin::Builder::new(&[])
+ tauri_plugin::Builder::new(&["get_voip_token", "end_active_call"])
.ios_path("ios")
.try_build()
.unwrap();
diff --git a/js/app/tauri/callkit_plugin/permissions/autogenerated/commands/end_active_call.toml b/js/app/tauri/callkit_plugin/permissions/autogenerated/commands/end_active_call.toml
new file mode 100644
index 0000000000..d5e266c03f
--- /dev/null
+++ b/js/app/tauri/callkit_plugin/permissions/autogenerated/commands/end_active_call.toml
@@ -0,0 +1,13 @@
+# Automatically generated - DO NOT EDIT!
+
+"$schema" = "../../schemas/schema.json"
+
+[[permission]]
+identifier = "allow-end-active-call"
+description = "Enables the end_active_call command without any pre-configured scope."
+commands.allow = ["end_active_call"]
+
+[[permission]]
+identifier = "deny-end-active-call"
+description = "Denies the end_active_call command without any pre-configured scope."
+commands.deny = ["end_active_call"]
diff --git a/js/app/tauri/callkit_plugin/permissions/autogenerated/commands/get_voip_token.toml b/js/app/tauri/callkit_plugin/permissions/autogenerated/commands/get_voip_token.toml
new file mode 100644
index 0000000000..1099fe327f
--- /dev/null
+++ b/js/app/tauri/callkit_plugin/permissions/autogenerated/commands/get_voip_token.toml
@@ -0,0 +1,13 @@
+# Automatically generated - DO NOT EDIT!
+
+"$schema" = "../../schemas/schema.json"
+
+[[permission]]
+identifier = "allow-get-voip-token"
+description = "Enables the get_voip_token command without any pre-configured scope."
+commands.allow = ["get_voip_token"]
+
+[[permission]]
+identifier = "deny-get-voip-token"
+description = "Denies the get_voip_token command without any pre-configured scope."
+commands.deny = ["get_voip_token"]
diff --git a/js/app/tauri/callkit_plugin/permissions/autogenerated/reference.md b/js/app/tauri/callkit_plugin/permissions/autogenerated/reference.md
new file mode 100644
index 0000000000..343f88f06c
--- /dev/null
+++ b/js/app/tauri/callkit_plugin/permissions/autogenerated/reference.md
@@ -0,0 +1,61 @@
+## Permission Table
+
+<table>
+<tr>
+<th>Identifier</th>
+<th>Description</th>
+</tr>
+
+
+<tr>
+<td>
+
+`call-kit:allow-end-active-call`
+
+</td>
+<td>
+
+Enables the end_active_call command without any pre-configured scope.
+
+</td>
+</tr>
+
+<tr>
+<td>
+
+`call-kit:deny-end-active-call`
+
+</td>
+<td>
+
+Denies the end_active_call command without any pre-configured scope.
+
+</td>
+</tr>
+
+<tr>
+<td>
+
+`call-kit:allow-get-voip-token`
+
+</td>
+<td>
+
+Enables the get_voip_token command without any pre-configured scope.
+
+</td>
+</tr>
+
+<tr>
+<td>
+
+`call-kit:deny-get-voip-token`
+
+</td>
+<td>
+
+Denies the get_voip_token command without any pre-configured scope.
+
+</td>
+</tr>
+</table>
diff --git a/js/app/tauri/callkit_plugin/permissions/schemas/schema.json b/js/app/tauri/callkit_plugin/permissions/schemas/schema.json
new file mode 100644
index 0000000000..3ae9260b77
--- /dev/null
+++ b/js/app/tauri/callkit_plugin/permissions/schemas/schema.json
@@ -0,0 +1,324 @@
+{
+ "$schema": "http://json-schema.org/draft-07/schema#",
+ "title": "PermissionFile",
+ "description": "Permission file that can define a default permission, a set of permissions or a list of inlined permissions.",
+ "type": "object",
+ "properties": {
+ "default": {
+ "description": "The default permission set for the plugin",
+ "anyOf": [
+ {
+ "$ref": "#/definitions/DefaultPermission"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ },
+ "set": {
+ "description": "A list of permissions sets defined",
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/PermissionSet"
+ }
+ },
+ "permission": {
+ "description": "A list of inlined permissions",
+ "default": [],
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/Permission"
+ }
+ }
+ },
+ "definitions": {
+ "DefaultPermission": {
+ "description": "The default permission set of the plugin.\n\nWorks similarly to a permission with the \"default\" identifier.",
+ "type": "object",
+ "required": [
+ "permissions"
+ ],
+ "properties": {
+ "version": {
+ "description": "The version of the permission.",
+ "type": [
+ "integer",
+ "null"
+ ],
+ "format": "uint64",
+ "minimum": 1.0
+ },
+ "description": {
+ "description": "Human-readable description of what the permission does. Tauri convention is to use `<h4>` headings in markdown content for Tauri documentation generation purposes.",
+ "type": [
+ "string",
+ "null"
+ ]
+ },
+ "permissions": {
+ "description": "All permissions this set contains.",
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ }
+ }
+ },
+ "PermissionSet": {
+ "description": "A set of direct permissions grouped together under a new name.",
+ "type": "object",
+ "required": [
+ "description",
+ "identifier",
+ "permissions"
+ ],
+ "properties": {
+ "identifier": {
+ "description": "A unique identifier for the permission.",
+ "type": "string"
+ },
+ "description": {
+ "description": "Human-readable description of what the permission does.",
+ "type": "string"
+ },
+ "permissions": {
+ "description": "All permissions this set contains.",
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/PermissionKind"
+ }
+ }
+ }
+ },
+ "Permission": {
+ "description": "Descriptions of explicit privileges of commands.\n\nIt can enable commands to be accessible in the frontend of the application.\n\nIf the scope is defined it can be used to fine grain control the access of individual or multiple commands.",
+ "type": "object",
+ "required": [
+ "identifier"
+ ],
+ "properties": {
+ "version": {
+ "description": "The version of the permission.",
+ "type": [
+ "integer",
+ "null"
+ ],
+ "format": "uint64",
+ "minimum": 1.0
+ },
+ "identifier": {
+ "description": "A unique identifier for the permission.",
+ "type": "string"
+ },
+ "description": {
+ "description": "Human-readable description of what the permission does. Tauri internal convention is to use `<h4>` headings in markdown content for Tauri documentation generation purposes.",
+ "type": [
+ "string",
+ "null"
+ ]
+ },
+ "commands": {
+ "description": "Allowed or denied commands when using this permission.",
+ "default": {
+ "allow": [],
+ "deny": []
+ },
+ "allOf": [
+ {
+ "$ref": "#/definitions/Commands"
+ }
+ ]
+ },
+ "scope": {
+ "description": "Allowed or denied scoped when using this permission.",
+ "allOf": [
+ {
+ "$ref": "#/definitions/Scopes"
+ }
+ ]
+ },
+ "platforms": {
+ "description": "Target platforms this permission applies. By default all platforms are affected by this permission.",
+ "type": [
+ "array",
+ "null"
+ ],
+ "items": {
+ "$ref": "#/definitions/Target"
+ }
+ }
+ }
+ },
+ "Commands": {
+ "description": "Allowed and denied commands inside a permission.\n\nIf two commands clash inside of `allow` and `deny`, it should be denied by default.",
+ "type": "object",
+ "properties": {
+ "allow": {
+ "description": "Allowed command.",
+ "default": [],
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ },
+ "deny": {
+ "description": "Denied command, which takes priority.",
+ "default": [],
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ }
+ }
+ },
+ "Scopes": {
+ "description": "An argument for fine grained behavior control of Tauri commands.\n\nIt can be of any serde serializable type and is used to allow or prevent certain actions inside a Tauri command. The configured scope is passed to the command and will be enforced by the command implementation.\n\n## Example\n\n```json { \"allow\": [{ \"path\": \"$HOME/**\" }], \"deny\": [{ \"path\": \"$HOME/secret.txt\" }] } ```",
+ "type": "object",
+ "properties": {
+ "allow": {
+ "description": "Data that defines what is allowed by the scope.",
+ "type": [
+ "array",
+ "null"
+ ],
+ "items": {
+ "$ref": "#/definitions/Value"
+ }
+ },
+ "deny": {
+ "description": "Data that defines what is denied by the scope. This should be prioritized by validation logic.",
+ "type": [
+ "array",
+ "null"
+ ],
+ "items": {
+ "$ref": "#/definitions/Value"
+ }
+ }
+ }
+ },
+ "Value": {
+ "description": "All supported ACL values.",
+ "anyOf": [
+ {
+ "description": "Represents a null JSON value.",
+ "type": "null"
+ },
+ {
+ "description": "Represents a [`bool`].",
+ "type": "boolean"
+ },
+ {
+ "description": "Represents a valid ACL [`Number`].",
+ "allOf": [
+ {
+ "$ref": "#/definitions/Number"
+ }
+ ]
+ },
+ {
+ "description": "Represents a [`String`].",
+ "type": "string"
+ },
+ {
+ "description": "Represents a list of other [`Value`]s.",
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/Value"
+ }
+ },
+ {
+ "description": "Represents a map of [`String`] keys to [`Value`]s.",
+ "type": "object",
+ "additionalProperties": {
+ "$ref": "#/definitions/Value"
+ }
+ }
+ ]
+ },
+ "Number": {
+ "description": "A valid ACL number.",
+ "anyOf": [
+ {
+ "description": "Represents an [`i64`].",
+ "type": "integer",
+ "format": "int64"
+ },
+ {
+ "description": "Represents a [`f64`].",
+ "type": "number",
+ "format": "double"
+ }
+ ]
+ },
+ "Target": {
+ "description": "Platform target.",
+ "oneOf": [
+ {
+ "description": "MacOS.",
+ "type": "string",
+ "enum": [
+ "macOS"
+ ]
+ },
+ {
+ "description": "Windows.",
+ "type": "string",
+ "enum": [
+ "windows"
+ ]
+ },
+ {
+ "description": "Linux.",
+ "type": "string",
+ "enum": [
+ "linux"
+ ]
+ },
+ {
+ "description": "Android.",
+ "type": "string",
+ "enum": [
+ "android"
+ ]
+ },
+ {
+ "description": "iOS.",
+ "type": "string",
+ "enum": [
+ "iOS"
+ ]
+ }
+ ]
+ },
+ "PermissionKind": {
+ "type": "string",
+ "oneOf": [
+ {
+ "description": "Enables the end_active_call command without any pre-configured scope.",
+ "type": "string",
+ "const": "allow-end-active-call",
+ "markdownDescription": "Enables the end_active_call command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the end_active_call command without any pre-configured scope.",
+ "type": "string",
+ "const": "deny-end-active-call",
+ "markdownDescription": "Denies the end_active_call command without any pre-configured scope."
+ },
+ {
+ "description": "Enables the get_voip_token command without any pre-configured scope.",
+ "type": "string",
+ "const": "allow-get-voip-token",
+ "markdownDescription": "Enables the get_voip_token command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the get_voip_token command without any pre-configured scope.",
+ "type": "string",
+ "const": "deny-get-voip-token",
+ "markdownDescription": "Denies the get_voip_token command without any pre-configured scope."
+ }
+ ]
+ }
+ }
+}
\ No newline at end of file
diff --git a/js/app/tauri/src-tauri/capabilities/mobile.json b/js/app/tauri/src-tauri/capabilities/mobile.json
index f902f77085..6263532d1a 100644
--- a/js/app/tauri/src-tauri/capabilities/mobile.json
+++ b/js/app/tauri/src-tauri/capabilities/mobile.json
@@ -14,6 +14,8 @@
"haptics:allow-vibrate",
"log:default",
"auth:allow-authenticate",
- "device-info:default"
+ "device-info:default",
+ "call-kit:allow-get-voip-token",
+ "call-kit:allow-end-active-call"
]
}
diff --git a/rust/cloud-storage/call/src/domain/service.rs b/rust/cloud-storage/call/src/domain/service.rs
index c8dd30ce29..6e52ce532f 100644
--- a/rust/cloud-storage/call/src/domain/service.rs
+++ b/rust/cloud-storage/call/src/domain/service.rs
@@ -463,6 +463,7 @@ impl<
let recipient_vec: Vec<MacroUserIdStr<'_>> =
recipient_ids.iter().cloned().collect();
let voip_payload = VoipPushPayload {
+ aps: Default::default(),
call_id: call.id.to_string(),
channel_id: channel_id_str.clone(),
channel_name: channel_name.clone().unwrap_or_default(),
diff --git a/rust/cloud-storage/notification/src/domain/models/apple.rs b/rust/cloud-storage/notification/src/domain/models/apple.rs
index 937809f8bf..ee49f1c86c 100644
--- a/rust/cloud-storage/notification/src/domain/models/apple.rs
+++ b/rust/cloud-storage/notification/src/domain/models/apple.rs
@@ -156,13 +156,23 @@ pub struct APNSPushNotification<T> {
pub push_notification_data: T,
}
+/// Empty `aps` object required by SNS APNS_VOIP payload validation.
+///
+/// SNS rejects VoIP push messages that lack an `aps` key, even though Apple
+/// passes the full payload verbatim to `pushRegistry(_:didReceiveIncomingPushWith:)`
+/// regardless of whether `aps` is present.
+#[derive(Serialize, Deserialize, Debug, Clone, Default)]
+pub struct VoipAps {}
+
/// Payload for a VoIP push notification (PushKit / CallKit).
///
-/// VoIP pushes must NOT contain an `aps` key — the entire payload is custom data
-/// delivered verbatim to `pushRegistry(_:didReceiveIncomingPushWith:)`.
+/// SNS's APNS_VOIP validator requires an `aps` key to be present; the value is
+/// an empty object and has no effect on delivery or the PushKit delegate payload.
#[derive(Serialize, Deserialize, Debug, Clone)]
#[serde(rename_all = "camelCase")]
pub struct VoipPushPayload {
+ /// Required by SNS APNS_VOIP validation; empty at the Apple level.
+ pub aps: VoipAps,
/// UUID string that identifies the call (used as the CallKit call UUID).
pub call_id: String,
/// Channel ID that the call belongs to.
diff --git a/rust/cloud-storage/notification/src/domain/service/voip/test.rs b/rust/cloud-storage/notification/src/domain/service/voip/test.rs
index 30104ffd03..41ba292ccf 100644
--- a/rust/cloud-storage/notification/src/domain/service/voip/test.rs
+++ b/rust/cloud-storage/notification/src/domain/service/voip/test.rs
@@ -21,6 +21,7 @@ fn user(email: &'static str) -> MacroUserIdStr<'static> {
fn payload() -> VoipPushPayload {
VoipPushPayload {
+ aps: Default::default(),
call_id: "11111111-1111-1111-1111-111111111111".to_string(),
channel_id: "ch-1".to_string(),
channel_name: "general".to_string(),