DocumentOperations
public struct DocumentOperations
IronOxide Document Operations
Key Terms
- ID - The ID representing a document. It must be unique within the document’s segment and will not be encrypted.
- Name - The human-readable name of a document. It does not need to be unique and will not be encrypted.
-
Lists metadata for all of the encrypted documents that the calling user can read or decrypt.
Declaration
Swift
public func list() -> Result<DocumentListResult, IronOxideError> -
Returns the metadata for an encrypted document.
This will not return the encrypted document bytes, as they are not stored by IronCore.
Declaration
Swift
public func getMetadata(documentId: DocumentId) -> Result<DocumentMetadataResult, IronOxideError>Parameters
documentIdID of the document to retrieve
-
Returns the document ID from the bytes of an encrypted document.
This is the same ID returned by
DocumentEncryptResult.id.Fails if the provided bytes are not an encrypted document or have no header.
Declaration
Swift
public func getIdFromBytes(bytes: [UInt8]) -> Result<DocumentId, IronOxideError>Parameters
bytesBytes of the encrypted document
-
Encrypts the provided document bytes.
Returns a
DocumentEncryptResultwhich contains document metadata as well as theencryptedData, which is the only thing that must be passed toSDK.document.decryptin order to decrypt the document.Metadata about the document will be stored by IronCore, but the encrypted bytes of the document will not. To encrypt without any document information being stored by IronCore, consider using
SDK.document.advanced.encryptUnmanagedinstead.Declaration
Swift
public func encrypt(bytes: [UInt8], options: DocumentEncryptOpts = DocumentEncryptOpts()) -> Result<DocumentEncryptResult, IronOxideError>Parameters
bytesBytes of the document to encrypt
optionsDocument encryption parameters
-
Updates the contents of an existing IronCore encrypted document.
The new contents will be encrypted, and which users and groups are granted access will remain unchanged.
Declaration
Swift
public func updateBytes(documentId: DocumentId, newBytes: [UInt8]) -> Result<DocumentEncryptResult, IronOxideError>Parameters
documentIdID of the document to update
newBytesNew document bytes to encrypt
-
Decrypts an IronCore encrypted document.
Requires the encrypted data returned from
SDK.document.encrypt.Returns details about the document as well as its decrypted bytes.
Fails if passed malformed data or if the calling user does not have sufficient access to the document.
Declaration
Swift
public func decrypt(encryptedBytes: [UInt8]) -> Result<DocumentDecryptResult, IronOxideError>Parameters
encryptedBytesBytes of the encrypted document
-
Modifies or removes a document’s name.
Returns the updated metadata of the document.
Declaration
Swift
public func updateName(documentId: DocumentId, newName: DocumentName?) -> Result<DocumentMetadataResult, IronOxideError>Parameters
documentIdID of the document to update
newNameNew name for the document. Provide a
DocumentNameto update to a new name ornilto clear the name field. -
Grants decryption access to a document for the provided users and/or groups.
Returns lists of successful and failed grants.
This operation supports partial success. If the request succeeds, then the resulting
DocumentAccessResultwill indicate which grants succeeded and which failed, and it will provide an explanation for each failure.Declaration
Swift
public func grantAccess(documentId: DocumentId, users: [UserId], groups: [GroupId]) -> Result<DocumentAccessResult, IronOxideError>Parameters
documentIdID of the document whose access is being modified.
usersList of users to grant access to.
groupsList of groups to grant access to.
-
Revokes decryption access to a document for the provided users and/or groups.
Returns lists of successful and failed revocations.
This operation supports partial success. If the request succeeds, then the resulting
DocumentAccessResultwill indicate which revocations succeeded and which failed, and it will provide an explanation for each failure.Declaration
Swift
public func revokeAccess(documentId: DocumentId, users: [UserId], groups: [GroupId]) -> Result<DocumentAccessResult, IronOxideError>Parameters
documentIdID of the document whose access is being modified.
usersList of users to revoke access from.
groupsList of groups to revoke access from.
View on GitHub
DocumentOperations Structure Reference