moo.sdk.ssh_keys.add_ssh_key

moo.sdk.ssh_keys.add_ssh_key(player_obj, key_string)

Validate and add an SSH public key for the player’s Django User.

The key is parsed and normalised by simplesshkey before being saved. The key name is taken from the key’s comment field if present.

Parameters:
  • player_obj (Object) – the player Object to add the key to

  • key_string (str) – the SSH public key string (e.g. ssh-rsa AAAA... comment)

Returns:

the newly created UserKey instance

Return type:

UserKey

Raises:

UserError – if the caller is not wizard-owned, the key is invalid, or the player has no account