Add a new ssh key for the current user

        :param title: title of the new key
        :param key: the key itself
        :return: true if added, false if it didn't add it (it could be because the name or key already exists)
485031
def addsshkey(self, title, key):
        
        data = {'title': title, 'key': key}

        request = requests.post(
            self.keys_url, headers=self.headers, data=data,
            verify=self.verify_ssl, auth=self.auth, timeout=self.timeout)

        if request.status_code == 201:
            return True
        else:
            return False
255573
def ssh_key(key):
        
        value = str(key)
        # Ensure the file exists locally
        if not os.path.isfile(value):
            raise Exception("File Does not Exist: %s" % key)
        return value
172469
def add(self, user, password):
        
        if self.__contains__(user):
            raise UserExists
        self.new_users[user] = self._encrypt_password(password) + "\n"
399304
def add(self, key):
        
        if key not in self._map:
            self._map[key] = link = _Link()
            root = self._root
            last = root.prev
            link.prev, link.next, link.key = last, root, key
            last.next = root.prev = weakref.proxy(link)
799122
def create_key(self, title, key, read_only=False):
        
        assert isinstance(title, (str, unicode)), title
        assert isinstance(key, (str, unicode)), key
        assert isinstance(read_only, bool), read_only
        post_parameters = {
            "title": title,
            "key": key,
            "read_only": read_only,
        }
        headers, data = self._requester.requestJsonAndCheck(
            "POST",
            self.url + "/keys",
            input=post_parameters
        )
        return github.RepositoryKey.RepositoryKey(self._requester, headers, data, completed=True)
161075
def keypair_add(name, pubfile=None, pubkey=None, profile=None, **kwargs):
    '''
    
    '''
    conn = _auth(profile, **kwargs)
    return conn.keypair_add(
        name,
        pubfile,
        pubkey
    )
284873
def add(self, key, value):
        
        self.configfile.add(self.name, key, value)
1122246
def add_subkey(self, subkey):
        
        if self.key.lower() == 'atoms' or not self.has_subkey(subkey):
            self.subkeys.append(subkey)
1039078
def UpdateUser(self, user, ssh_keys):
    
    if not bool(USER_REGEX.match(user)):
      self.logger.warning('Invalid user account name %s.', user)
      return False
    if not self._GetUser(user):
      # User does not exist. Attempt to create the user and add them to the
      # appropriate user groups.
      if not (self._AddUser(user)
              and self._UpdateUserGroups(user, self.groups)):
        return False
    # Add the user to the google sudoers group.
    if not self._UpdateSudoer(user, sudoer=True):
      return False

    # Don't try to manage account SSH keys with a shell set to disable
    # logins. This helps avoid problems caused by operator and root sharing
    # a home directory in CentOS and RHEL.
    pw_entry = self._GetUser(user)
    if pw_entry and os.path.basename(pw_entry.pw_shell) == 'nologin':
      message = 'Not updating user %s. User set `nologin` as login shell.'
      self.logger.debug(message, user)
      return True

    try:
      self._UpdateAuthorizedKeys(user, ssh_keys)
    except (IOError, OSError) as e:
      message = 'Could not update the authorized keys file for user %s. %s.'
      self.logger.warning(message, user, str(e))
      return False
    else:
      return True
655370
def check_key(self, key: str) -> bool:
        
        keys = self.get_keys()
        return key in keys
1307139
public function addNewDeployKey(string $title, string $key): array
    {
        return $this->getApi()->request($this->getApi()
                                             ->sprintf('/repos/:owner/:repo/keys', $this->getRepositories()->getOwner(),
                                                 $this->getRepositories()->getRepo()), Request::METHOD_POST, [
                'title' => $title,
                'key'   => $key
            ]);
    }
11638
def key_exists(self, key):
        
        assert isinstance(key, str)
        self._close()
        try:
            return self._unsafe_key_exists(key)
        finally:
            self._open()
261402
def add_header(self, key, value):
        

        assert isinstance(key, str), 'header key must be of type str'
        assert isinstance(value, str), 'header value must be of type str'
        self.headers[key] = value
85813
def send_key(self, key):
        
        cmd = struct.pack(">BBBBBBH", 4, 1, 0, 0, 0, 0, key)
        self.con.send(cmd)

        cmd = struct.pack(">BBBBBBH", 4, 0, 0, 0, 0, 0, key)
        self.con.send(cmd)
1103559
def update_ssh_key(self, name):
        # The `_ssh_key` is to avoid conflicts with MutableMapping.update.
        
        api = self.doapi_manager
        return api._ssh_key(api.request(self.url, method='PUT',
                                       data={"name": name})["ssh_key"])
391717
def destroy_ssh_key(self, ssh_key_id):
        
        json = self.request('/ssh_keys/%s/destroy' % ssh_key_id, method='GET')
        status = json.get('status')
        return status
548324
def unlock_keychain(username):
    

    if 'SSH_TTY' not in os.environ:
        return

    # Don't unlock if we've already seen this user.
    if username in _unlocked:
        return

    _unlocked.add(username)

    if sys.platform == 'darwin':
        sys.stderr.write("You are running under SSH. Please unlock your local OS X KeyChain:\n")
        subprocess.call(['security', 'unlock-keychain'], stdout=subprocess.PIPE, stderr=subprocess.PIPE)