From 7d025310674836e534e46da5cb01c3eb1ead2baf Mon Sep 17 00:00:00 2001 From: Nicholas Molnar <65710+neekolas@users.noreply.github.com> Date: Mon, 29 Jan 2024 16:50:02 -0800 Subject: [PATCH 1/2] feat: frames support --- dev/ts/generate | 1 + proto/message_contents/frames.proto | 25 +++++++++++++++++++++++++ ts/index.ts | 1 + 3 files changed, 27 insertions(+) create mode 100644 proto/message_contents/frames.proto diff --git a/dev/ts/generate b/dev/ts/generate index 481f58ca..969e1ea7 100755 --- a/dev/ts/generate +++ b/dev/ts/generate @@ -28,6 +28,7 @@ docker run --rm -i -v${PWD}:/code xmtp/protoc \ message_contents/ciphertext.proto \ message_contents/public_key.proto \ message_contents/contact.proto \ + message_contents/frames.proto \ message_contents/invitation.proto \ message_contents/private_key.proto \ message_contents/content.proto \ diff --git a/proto/message_contents/frames.proto b/proto/message_contents/frames.proto new file mode 100644 index 00000000..fbad5104 --- /dev/null +++ b/proto/message_contents/frames.proto @@ -0,0 +1,25 @@ +// Signature is a generic structure for public key signatures. +syntax = "proto3"; + +package xmtp.message_contents; + +import "message_contents/public_key.proto"; +import "message_contents/signature.proto"; + +option go_package = "github.com/xmtp/proto/v3/go/message_contents"; +option java_package = "org.xmtp.proto.message.contents"; + +// The message that will be signed by the Client and returned inside the `action_body` field of the FrameAction message +message FrameActionBody { + bytes frame_url = 1; // Why did Farcaster make the frame_url a byte array and not a string??? + bytes button_index = 2; // Same question for the button index + string conversation_identifier = 3; // This field needs to be a little different from FC's version + string message_id = 4; // Also include a reference to the specific message +} + +// The outer payload that will be sent as the `messageBytes` in the `trusted_data` part of the Frames message +message FrameAction { + Signature signature = 1; // XMTP already has signature types that can be used here + SignedPublicKeyBundle signed_public_key_bundle = 2; // The SignedPublicKeyBundle of the signer, used to link the XMTP signature with a blockchain account through a chain of signatures. + bytes action_body = 3; // Serialized FrameActionBody message, so that the signature verification can happen on a byte-perfect representation of the message +} diff --git a/ts/index.ts b/ts/index.ts index 36b1e24a..12dfecbb 100644 --- a/ts/index.ts +++ b/ts/index.ts @@ -3,6 +3,7 @@ export * as fetcher from "./fetch.pb"; export * as authn from "./message_api/v1/authn.pb"; export * as message from "./message_contents/message.pb"; export * as content from "./message_contents/content.pb"; +export * as frames from "./message_contents/frames.pb"; export * as conversationReference from "./message_contents/conversation_reference.pb"; export * as composite from "./message_contents/composite.pb"; export * as privateKey from "./message_contents/private_key.pb"; From 82145518021d82dfc4a88a8f5569ea0255a8ce5d Mon Sep 17 00:00:00 2001 From: Nicholas Molnar <65710+neekolas@users.noreply.github.com> Date: Mon, 29 Jan 2024 16:56:46 -0800 Subject: [PATCH 2/2] chore: fmt --- proto/message_contents/frames.proto | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/proto/message_contents/frames.proto b/proto/message_contents/frames.proto index fbad5104..52762b3b 100644 --- a/proto/message_contents/frames.proto +++ b/proto/message_contents/frames.proto @@ -9,17 +9,23 @@ import "message_contents/signature.proto"; option go_package = "github.com/xmtp/proto/v3/go/message_contents"; option java_package = "org.xmtp.proto.message.contents"; -// The message that will be signed by the Client and returned inside the `action_body` field of the FrameAction message +// The message that will be signed by the Client and returned inside the +// `action_body` field of the FrameAction message message FrameActionBody { - bytes frame_url = 1; // Why did Farcaster make the frame_url a byte array and not a string??? - bytes button_index = 2; // Same question for the button index - string conversation_identifier = 3; // This field needs to be a little different from FC's version + bytes frame_url = 1; + bytes button_index = 2; + string conversation_identifier = 3; string message_id = 4; // Also include a reference to the specific message } -// The outer payload that will be sent as the `messageBytes` in the `trusted_data` part of the Frames message +// The outer payload that will be sent as the `messageBytes` in the +// `trusted_data` part of the Frames message message FrameAction { - Signature signature = 1; // XMTP already has signature types that can be used here - SignedPublicKeyBundle signed_public_key_bundle = 2; // The SignedPublicKeyBundle of the signer, used to link the XMTP signature with a blockchain account through a chain of signatures. - bytes action_body = 3; // Serialized FrameActionBody message, so that the signature verification can happen on a byte-perfect representation of the message + Signature signature = 1; + // The SignedPublicKeyBundle of the signer, used to link the XMTP signature + // with a blockchain account through a chain of signatures. + SignedPublicKeyBundle signed_public_key_bundle = 2; + // Serialized FrameActionBody message, so that the signature verification can + // happen on a byte-perfect representation of the message + bytes action_body = 3; }