Public Keys
A PublicKey is used to authenticate to Files.com via SFTP (SSH File Transfer Protocol). This method of authentication allows users to use their private key (which is never shared with Files.com) to authenticate themselves against the PublicKey stored on Files.com.
When a user configures their PublicKey, it allows them to bypass traditional password-based authentication, leveraging the security of key-based authentication instead.
Note that Files.com's SSH support is limited to file operations only. While users can securely transfer files and manage their data via SFTP, they do not have access to a full shell environment for executing arbitrary commands.
When generating new SSH keys, here are the available options: Files.com supports multiple SSH key algorithms: RSA (default 4096 bits, range 1024-4096 in 8-bit increments), DSA (1024 bits only), Ed25519 (256 bits), and ECDSA (256, 384, or 521 bits). When generating keys, the system uses these default lengths unless a specific length is specified.
Files.com also supports importing additional key types that cannot be generated: security key types (sk-ecdsa-sha2-nistp256, sk-ssh-ed25519). RSA keys up to 8192 bits are also supported for import.
List Public Keys
SDK Method
Files::PublicKey.list
Return Object
List<PublicKey>
Authorization Requirement
Not available to user API keys or sessions from users that are marked as Shared/Bot users.
Method Arguments
| Argument | Description |
|---|---|
| user_id int64 | User ID. Provide a value of 0 to operate the current session's user. |
Additional Arguments
Show Public Key
SDK Method
Files::PublicKey.find
Return Object
PublicKey
Authorization Requirement
Not available to user API keys or sessions from users that are marked as Shared/Bot users.
Method Arguments
| Argument | Description |
|---|---|
| id int64 Required | Public Key ID. |
Create Public Key
SDK Method
Files::PublicKey.create
Return Object
PublicKey
Authorization Requirement
Not available to user API keys or sessions from users that are marked as Shared/Bot users.
Method Arguments
| Argument | Default | Description |
|---|---|---|
| user_id int64 | User ID. Provide a value of 0 to operate the current session's user. | |
| title string Required | Internal reference for key. | |
| public_key string | Actual contents of SSH key. | |
| generate_keypair boolean | false | If true, generate a new SSH key pair. Can not be used with public_key |
| generate_private_key_password string | Password for the private key. Used for the generation of the key. Will be ignored if generate_keypair is false. | |
| generate_algorithm string | "rsa" | Type of key to generate. One of rsa, dsa, ecdsa, ed25519. Used for the generation of the key. Will be ignored if generate_keypair is false. |
| generate_length int64 | Length of key to generate. If algorithm is ecdsa, this is the signature size. Used for the generation of the key. Will be ignored if generate_keypair is false. |
Update Public Key
SDK Method
public_key.update
Return Object
PublicKey
Authorization Requirement
Not available to user API keys or sessions from users that are marked as Shared/Bot users.
Method Arguments
| Argument | Description |
|---|---|
| title string Required | Internal reference for key. |
Delete Public Key
SDK Method
public_key.delete
Return Object
nil
Authorization Requirement
Not available to user API keys or sessions from users that are marked as Shared/Bot users.
The PublicKey Object
Some of the methods above return a PublicKey object. The attributes of this object are listed below.
| Attribute | Description |
|---|---|
| id int64 | Public key ID |
| workspace_id int64 | Workspace ID (0 for default workspace). |
| title string | Public key title |
| created_at date-time | Public key created at date/time |
| expires_at date-time | Public key expiration date/time |
| expired boolean | Is this public key expired? |
| fingerprint string | Public key fingerprint (MD5) |
| fingerprint_sha256 string | Public key fingerprint (SHA256) |
| status string | Only returned when generating keys. Can be invalid, not_generated, generating, complete Possible values: error, not_set, to_be_generated, generating, complete |
| last_login_at date-time | Key's most recent login time via SFTP |
| generated_private_key string | Only returned when generating keys. Private key generated for the user. |
| generated_public_key string | Only returned when generating keys. Public key generated for the user. |
| username string | Username of the user this public key is associated with |
| user_id int64 | User ID this public key is associated with |