-
Notifications
You must be signed in to change notification settings - Fork 20
/
message.proto
173 lines (150 loc) · 6.44 KB
/
message.proto
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
syntax = "proto3";
import "username_proof.proto";
/**
* A Message is a delta operation on the Farcaster network. The message protobuf is an envelope
* that wraps a MessageData object and contains a hash and signature which can verify its authenticity.
*/
message Message {
MessageData data = 1; // Contents of the message
bytes hash_ = 2; // Hash digest of data
HashScheme hash_scheme = 3; // Hash scheme that produced the hash digest
bytes signature = 4; // Signature of the hash digest
SignatureScheme signature_scheme = 5; // Signature scheme that produced the signature
bytes signer = 6; // Public key or address of the key pair that produced the signature
bytes data_bytes = 7; // MessageData serialized to bytes if using protobuf serialization other than ts-proto
}
/**
* A MessageData object contains properties common to all messages and wraps a body object which
* contains properties specific to the MessageType.
*/
message MessageData {
MessageType type_ = 1; // Type of message contained in the body
uint64 fid = 2; // Farcaster ID of the user producing the message
uint32 timestamp = 3; // Farcaster epoch timestamp in seconds
FarcasterNetwork network = 4; // Farcaster network the message is intended for
CastAddBody cast_add_body = 5;
// CastRemoveBody cast_remove_body = 6;
bool empty_cast_remove_body = 6;
ReactionBody reaction_body = 7;
bool empty = 8;
VerificationAddEthAddressBody verification_add_eth_address_body = 9;
// VerificationRemoveBody verification_remove_body = 10;
bool empty_verification_remove_body = 10;
bool deprecated_signer_add_body = 11;
bool user_data_body = 12;
bool deprecated_signer_remove_body = 13;
LinkBody link_body = 14;
// UserNameProof username_proof_body = 15;
bool empty_username_proof_body = 15;
FrameActionBody frame_action_body = 16;
}
/** Type of hashing scheme used to produce a digest of MessageData */
enum HashScheme {
HASH_SCHEME_NONE = 0;
HASH_SCHEME_BLAKE3 = 1; // Default scheme for hashing MessageData
}
/** Type of signature scheme used to sign the Message hash */
enum SignatureScheme {
SIGNATURE_SCHEME_NONE = 0;
SIGNATURE_SCHEME_ED25519 = 1; // Ed25519 signature (default)
SIGNATURE_SCHEME_EIP712 = 2; // ECDSA signature using EIP-712 scheme
}
/** Type of the MessageBody */
enum MessageType {
MESSAGE_TYPE_NONE = 0;
MESSAGE_TYPE_CAST_ADD = 1; // Add a new Cast
MESSAGE_TYPE_CAST_REMOVE = 2; // Remove an existing Cast
MESSAGE_TYPE_REACTION_ADD = 3; // Add a Reaction to a Cast
MESSAGE_TYPE_REACTION_REMOVE = 4; // Remove a Reaction from a Cast
MESSAGE_TYPE_LINK_ADD = 5; // Add a new Link
MESSAGE_TYPE_LINK_REMOVE = 6; // Remove an existing Link
MESSAGE_TYPE_VERIFICATION_ADD_ETH_ADDRESS = 7; // Add a Verification of an Ethereum Address
MESSAGE_TYPE_VERIFICATION_REMOVE = 8; // Remove a Verification
DEPRECATED_MESSAGE_TYPE_SIGNER_ADD = 9; // Add a new Ed25519 key pair that signs messages for a user
DEPRECATED_MESSAGE_TYPE_SIGNER_REMOVE = 10; // Remove an Ed25519 key pair that signs messages for a user
MESSAGE_TYPE_USER_DATA_ADD = 11; // Add metadata about a user
MESSAGE_TYPE_USERNAME_PROOF = 12; // Add or replace a username proof
MESSAGE_TYPE_FRAME_ACTION = 13; // A Farcaster Frame action
}
/** Farcaster network the message is intended for */
enum FarcasterNetwork {
FARCASTER_NETWORK_NONE = 0;
FARCASTER_NETWORK_MAINNET = 1; // Public primary network
FARCASTER_NETWORK_TESTNET = 2; // Public test network
FARCASTER_NETWORK_DEVNET = 3; // Private test network
}
/** Adds metadata about a user */
message UserDataBody {
UserDataType type_ = 1; // Type of metadata
string value = 2; // Value of the metadata
}
/** Type of UserData */
enum UserDataType {
USER_DATA_TYPE_NONE = 0;
USER_DATA_TYPE_PFP = 1; // Profile Picture for the user
USER_DATA_TYPE_DISPLAY = 2; // Display Name for the user
USER_DATA_TYPE_BIO = 3; // Bio for the user
EMPTY = 4;
USER_DATA_TYPE_URL = 5; // URL of the user
USER_DATA_TYPE_USERNAME = 6; // Preferred Name for the user
}
message Embed {
string url = 1;
CastId cast_id = 2;
}
/** Adds a new Cast */
message CastAddBody {
string embeds_deprecated = 1; // URLs to be embedded in the cast
repeated uint64 mentions = 2 [packed=true]; // Fids mentioned in the cast
CastId parent_cast_id = 3; // Parent cast of the cast
string text = 4; // Text of the cast
repeated uint32 mentions_positions = 5 [packed=true]; // Positions of the mentions in the text
repeated Embed embeds = 6; // URLs or cast ids to be embedded in the cast
string parent_url = 7; // Parent URL
}
/** Removes an existing Cast */
message CastRemoveBody {
bytes target_hash = 1; // Hash of the cast to remove
}
/** Identifier used to look up a Cast */
message CastId {
uint64 fid = 1; // Fid of the user who created the cast
bytes hash_ = 2; // Hash of the cast
}
/** Adds or removes a Reaction from a Cast */
message ReactionBody {
ReactionType type_ = 1; // Type of reaction
CastId target_cast_id = 2; // CastId of the Cast to react to
string target_url = 3; // URL to react to
}
/** Type of Reaction */
enum ReactionType {
REACTION_TYPE_NONE = 0;
REACTION_TYPE_LIKE = 1; // Like the target cast
REACTION_TYPE_RECAST = 2; // Share target cast to the user's audience
}
/** Adds a Verification of ownership of an Ethereum Address */
message VerificationAddEthAddressBody {
bytes address_ = 1; // Ethereum address being verified
bytes eth_signature = 2; // Signature produced by the user's Ethereum address
bytes block_hash = 3; // Hash of the latest Ethereum block when the signature was produced
uint32 verification_type = 4; // Type of verification. 0 = EOA, 1 = contract
uint32 chain_id = 5; // 0 for EOA verifications, 1 or 10 for contract verifications
}
/** Removes a Verification of any type */
message VerificationRemoveBody {
bytes address_ = 1; // Address of the Verification to remove
}
/** Adds or removes a Link */
message LinkBody {
string type_ = 1; // Type of link, <= 8 characters
uint32 displayTimestamp = 2; // User-defined timestamp that preserves original timestamp when message.data.timestamp needs to be updated for compaction
uint64 target_fid = 3; // The fid the link relates to
}
/** A Farcaster Frame action */
message FrameActionBody {
bytes url = 1; // URL of the Frame triggering the action
uint32 button_index = 2; // The index of the button pressed (1-4)
CastId cast_id = 3; // The cast which contained the frame url
bytes input_text = 4; // Text input from the user, if present
}