Upload own File
This use case takes a given file outside of enmeshed, encrypts and uploads it to the Backbone and creates a File with the respective metadata information for the Identity to access it.
The File can from now on be shared by references to other Identities.
This can be the reference.truncated of the File itself, which is used, for example, when exchanging Files using Attributes, or the reference.truncated of a Token.
In the latter case, the Token for the File must be created first.
Parameters
contentis the to-be-uploaded file content as byte array.filenameis the name of the file from the operating system.mimetypeof the respective file.- Optionally,
expiresAtcan be specified, which describes the ISODateTime the File expires. - Optionally, a
titlecan be provided for the File. - Optionally, a
descriptioncan be provided for the File. - Optionally,
tagscan be provided for the File. If an IdentityAttribute with IdentityFileReference asvalue.@typeis created for the File during transferring the ownership of the File to a peer, it will have thesetagsas well. For this reason, a tag is valid if it is contained in the AttributeTagCollection for thevalue.@typeIdentityFileReference and starts with the prefixbkb:or if it starts with the custom tag prefixx:orX:, the prefixurn:, the prefixlanguage:followed by a valid ISO 639 language code or the prefixmimetype:followed by a valid MIME type matching the pattern^[a-z-*]+/[a-z-*]+$.
On Success
- An encrypted File is stored on the Backbone and can be shared by its references.
- Only the metadata of the File is stored locally.
- If
expiresAtwasn’t specified, the expiration date of the File will be set to a default value that corresponds to zero o’clock on the 31st of December, 9999. - If
titlewasn’t provided, it will be set to an empty string""as default value. - The created File is returned.
On Failure
- The parameters are malformed.
- The file size is too big.
- Invalid
tagswere provided. A tag is invalid if it is neither contained in the AttributeTagCollection for the IdentityAttributevalue.@typeIdentityFileReference and starts with the prefixbkb:nor starts with the custom tag prefixx:orX:, the prefixurn:, the prefixlanguage:followed by a valid ISO 639 language code nor the prefixmimetype:followed by a valid MIME type matching the pattern^[a-z-*]+/[a-z-*]+$.