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
documentId
ID 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
bytes
Bytes of the encrypted document
-
Encrypts the provided document bytes.
Returns a
DocumentEncryptResult
which contains document metadata as well as theencryptedData
, which is the only thing that must be passed toSDK.document.decrypt
in 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.encryptUnmanaged
instead.Declaration
Swift
public func encrypt(bytes: [UInt8], options: DocumentEncryptOpts = DocumentEncryptOpts()) -> Result<DocumentEncryptResult, IronOxideError>
Parameters
bytes
Bytes of the document to encrypt
options
Document 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
documentId
ID of the document to update
newBytes
New 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
encryptedBytes
Bytes 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
documentId
ID of the document to update
newName
New name for the document. Provide a
DocumentName
to update to a new name ornil
to 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
DocumentAccessResult
will 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
documentId
ID of the document whose access is being modified.
users
List of users to grant access to.
groups
List 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
DocumentAccessResult
will 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
documentId
ID of the document whose access is being modified.
users
List of users to revoke access from.
groups
List of groups to revoke access from.