If I want to generate a shareable link for a document, I could simply use the document id website.com/shared/:id
.
class Item: Object, ObjectKeyIdentifiable {
@Persisted(primaryKey: true) var _id: ObjectId
@Persisted var userId: String
@Persisted var name: String
}
However, I won't be able to generate a new link if a malicious user found the document id. So, I am thinking of having a separate share id website.com/shared/:shareId
.
class Item: Object, ObjectKeyIdentifiable {
@Persisted(primaryKey: true) var _id: ObjectId
@Persisted var userId: String
@Persisted var name: String
@Persisted var shareId: ObjectId // or UUID or string
}
Is it okay to simply use ObjectId
or UUID
?
I tried generating a link on Google Docs, and they don't seem to use a separate id.
When I am editing, the link is
https://docs.google.com/document/d/1HDPFRcAxzeOCVyil9OEunOcFO_vknq_kBDYGFysb35A/edit
, and the shared link is https://docs.google.com/document/d/1HDPFRcAxzeOCVyil9OEunOcFO_vknq_kBDYGFysb35A/edit?usp=sharing
.
Are there any best practices for sharing? I am not able to find much information on the topic.