சாதனங்களுக்கு இடையிலான GraphQL
இணைக்கப்பட்ட சாதனங்களுக்கு இடையிலான கையொப்பமிட்ட, மறைகுறியாக்கப்பட்ட கோரிக்கைகள்.
key = Base64Decode(peer.key)இணைக்கப்பட்ட பியர்; c-id = senderClientId
https://<host>:<port>/peer_graphqlPOST /peer_graphql
c-id: 706c6169-3b80-8f42-9a61-4e312e54d001
signed = compactJSON(["PEER_REQUEST", channelId, requestId, query, sortedVariables])signature = Base64(Ed25519-Sign(senderPrivateKey, signed))channelId வரிசையின் இரண்டாவது மதிப்பு: நேரடி பியர் கோரிக்கைகளில் வெறுமை; மற்றவற்றில் சரியாக c-cid சேனல் ID. கையொப்பத்தைக் கணக்கிட variables-இல் அனைத்து நிலைகளிலும் உள்ள பொருள்களின் விசைகளை வரிசைப்படுத்தவும்.JSON({ signature, requestId, query, variables })
கோரிக்கையைச் செயல்படுத்தும் முன் சாதனத்தின் கையொப்பத்தைச் சரிபார்க்கவும். UUIDv7 நேரச் செல்லுபடியாகும் வரம்பு ±60 வினாடிகள்; நகல்கள் நிரந்தரமாக நீக்கப்படுகின்றன.
மீளனுப்பல் தாக்குதல் தடுப்பு
requestId = UUIDv7()JSON { signature, requestId, query, variables } → authenticated encryptionpeer.key / channel.key + Ed25519✕ → நிராகரிக்கவும்|serverTime − requestId timestamp| ≤ 60 s✕ → நிராகரிக்கவும்SQLite: peer_graphql:channelId + senderClientId + requestIdநூலக அழைப்புகள்
Core குறியீட்டுப் பகுதிகள்; நேரடியாக இணைக்கப்பட்ட பியர் முறை (c-cid இல்லை).
// plain-rs/src/infrastructure/transport/contract.rs
let payload = contract::signed_request(&signing_keypair, query, variables, "")?;
let request_body = http_request::encrypt_raw(
&peer_key, "POST", "/peer_graphql", payload.as_bytes(),
).ok_or("encrypt failed")?;
let response = transport.post(url, &client_id, None, &request_body).await?;
let plaintext = http_response::Context::new(&request_body)
.decrypt(&peer_key, &response).ok_or("invalid response")?;HTTP 403: பியர் இணைக்கப்படவில்லை. 401: அறியாத பியர், மறைகுறி நீக்கம் அல்லது கையொப்பச் சரிபார்ப்பு தோல்வி. 400: தவறான வடிவிலான, காலாவதியான அல்லது மீண்டும் வந்த உறை.
வகை வரையறைகள்
enum ChannelSystemMessageType {
INVITE
INVITE_ACCEPT
INVITE_DECLINE
UPDATE
KICK
LEAVE
}
type ChatAttachment {
id: ID!
uri: String!
size: Long!
durationMs: Long!
width: Int!
height: Int!
summary: String!
fileName: String!
}
enum ChatAttachmentType {
IMAGE
FILE
}
union ChatContent = ChatMessageContent | ChatShareContent
type ChatDeliveryResult {
peerId: ID!
peerName: String!
error: String
}
type ChatItem {
"""
`me` when this device created the item, otherwise the client id of
the originating peer.
"""
fromId: ID!
"""
Peer id for direct messages; empty for channel messages —
`channelId` is authoritative there.
"""
toId: ID!
"""
Null for direct messages: the store keeps "" and the contract says
null, because "" is not a channel a client can query.
"""
channelId: ID
id: ID!
content: ChatContent!
createdAt: Instant!
updatedAt: Instant!
status: ChatStatus!
deliveryResults: [ChatDeliveryResult!]!
}
type ChatLinkPreview {
url: String!
title: String
description: String
image: String
imageWidth: Int!
imageHeight: Int!
siteName: String
domain: String
createdAt: Instant!
}
type ChatMessageAttachment {
type: ChatAttachmentType!
attachment: ChatAttachment!
}
type ChatMessageContent {
text: String
format: ChatTextFormat!
items: [ChatMessageAttachment!]!
linkPreviews: [ChatLinkPreview!]!
}
type ChatShareContent {
shareId: ID!
urlToken: String!
peerInfo: ChatSharePeer!
name: String!
itemCount: Long!
totalSize: Long!
expiresAt: Instant
}
type ChatSharePeer {
id: ID!
ip: String!
port: Int!
}
enum ChatStatus {
SENT
FAILED
PARTIAL
PENDING
}
enum ChatTextFormat {
PLAIN
MARKDOWN
}
scalar Instant
scalar Long
type Mutation {
createChatItem(content: String!): [ChatItem!]!
channelSystemMessage(type: ChannelSystemMessageType!, payload: String!): Boolean!
startAware: Boolean!
}
enum PeerStatus {
PAIRED
UNPAIRED
CHANNEL
}
type Query {
}
"""
Directs the executor to include this field or fragment only when the `if` argument is true.
"""
directive @include(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT
"""
Directs the executor to skip this field or fragment when the `if` argument is true.
"""
directive @skip(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT
schema {
query: Query
mutation: Mutation
}