অতিথি GraphQL
শেয়ার লিঙ্কের মাধ্যমে এনক্রিপ্ট করা অ্যাক্সেস।
key = Base64UrlDecode(shared_token)শেয়ার লিংকের shared_token; c-id = shareId
https://<host>:<port>/guest_graphqlPOST /guest_graphql
c-id: 01a1cd7b-b900-7331-9331-313131313131
JSON({ requestId, query, variables })
requestId হলো UUIDv7 এবং অনুরোধের সময় ধারণ করে। variables, operationName ও extensions ঐচ্ছিক।
রিপ্লে প্রতিরোধ
requestId = UUIDv7()JSON { requestId, query, variables } → authenticated encryptionshareId → shared_token✕ → প্রত্যাখ্যান করুন|serverTime − requestId timestamp| ≤ 60 s✕ → প্রত্যাখ্যান করুনSQLite: guest + shareId + requestIdলাইব্রেরি কল
Desktop-এর অংশ। একই graphqlRequestPayload সহায়ক UUIDv7 requestId তৈরি করে; আলাদা timestamp বা পুনরাবৃত্তি রোধের nonce পাঠানো হয় না।
// plain-desktop/src/lib/api/guest.ts
const payload = graphqlRequestPayload(query, variables)
const requestBody = chachaEncrypt(key, payload, httpRequestAad('/guest_graphql'))
const response = await httpRequest(url, {
method: 'POST', headers: { 'c-id': shareId }, body: requestBody
})
if (!response.ok) throw new Error(String(response.status))
const bytes = new Uint8Array(await response.arrayBuffer())
const result = JSON.parse(decryptGraphqlResponse(key, requestBody, bytes))
// Feature error codes are carried in extensions.code; message is diagnostic text.
if (result.errors?.length) throw GqlError.fromGraphql(result.errors[0])HTTP 403: নিষ্ক্রিয় শেয়ার বা দূরবর্তী প্রবেশ বন্ধ। 401: ডিক্রিপশন ব্যর্থ। 400: ভুল বিন্যাসের, মেয়াদোত্তীর্ণ বা পুনরাবৃত্ত অনুরোধ।
টাইপ ডেফিনিশন
scalar Instant
scalar Long
type Query {
sharedInfo(: String, : String): SharedInfo!
}
type SharedFile {
name: String!
relativePath: String!
isDir: Boolean!
size: Long!
mimeType: String!
hasThumb: Boolean!
createdAt: Instant
updatedAt: Instant!
}
type SharedInfo {
name: String!
readOnly: Boolean!
requiresPassword: Boolean!
expiresAt: Instant
urlToken: String!
entries: [SharedFile!]!
}
"""
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
}