# Module: key

Source:
  - resource/models/key.js, line 2

### Methods

#### (static) create(title, key, callback)

Create a ssh key

##### Parameters:

Name | Type | Description
--- | --- | ---
`title` | String | key title
`key` | String | the public ssh key
`callback` | module:resin.models.key~createCallback | callback

Source:
  - resource/models/key.js, line 149
To Do:
  - We should return an id for consistency with the other models

##### Example

    resin.models.key.create 'Main', 'ssh-rsa AAAAB....', (error) ->
    		throw error if error?

#### (static) create(title, key, callback)

Create a ssh key

##### Parameters:

Name | Type | Description
--- | --- | ---
`title` | String | key title
`key` | String | the public ssh key
`callback` | module:resin.models.key~createCallback | callback

Source:
  - models/key.js, line 149
To Do:
  - We should return an id for consistency with the other models

##### Example

    resin.models.key.create 'Main', 'ssh-rsa AAAAB....', (error) ->
    		throw error if error?

#### (static) get(id, callback)

Get a single ssh key

##### Parameters:

Name | Type | Description
--- | --- | ---
`id` | String | Number | key id
`callback` | module:resin.models.key~getCallback | callback

Source:
  - models/key.js, line 81

##### Example

    resin.models.key.get 51, (error, key) ->
    		throw error if error?
    		console.log(key)

#### (static) get(id, callback)

Get a single ssh key

##### Parameters:

Name | Type | Description
--- | --- | ---
`id` | String | Number | key id
`callback` | module:resin.models.key~getCallback | callback

Source:
  - resource/models/key.js, line 81

##### Example

    resin.models.key.get 51, (error, key) ->
    		throw error if error?
    		console.log(key)

#### (static) getAll(callback)

Get all ssh keys

##### Parameters:

Name | Type | Description
--- | --- | ---
`callback` | module:resin.models.key~getAllCallback | callback

Source:
  - resource/models/key.js, line 43

##### Example

    resin.models.key.getAll (error, keys) ->
    		throw error if error?
    		console.log(keys)

#### (static) getAll(callback)

Get all ssh keys

##### Parameters:

Name | Type | Description
--- | --- | ---
`callback` | module:resin.models.key~getAllCallback | callback

Source:
  - models/key.js, line 43

##### Example

    resin.models.key.getAll (error, keys) ->
    		throw error if error?
    		console.log(keys)

#### (static) remove(id, callback)

Remove ssh key

##### Parameters:

Name | Type | Description
--- | --- | ---
`id` | String | Number | key id
`callback` | module:resin.models.key~removeCallback | callback

Source:
  - resource/models/key.js, line 118

##### Example

    resin.models.key.remove 51, (error) ->
    		throw error if error?

#### (static) remove(id, callback)

Remove ssh key

##### Parameters:

Name | Type | Description
--- | --- | ---
`id` | String | Number | key id
`callback` | module:resin.models.key~removeCallback | callback

Source:
  - models/key.js, line 118

##### Example

    resin.models.key.remove 51, (error) ->
    		throw error if error?

### Type Definitions

#### Key

A Resin API key

##### Type:

- Object

Source:
  - models/key.js, line 16

#### Key

A Resin API key

##### Type:

- Object

Source:
  - resource/models/key.js, line 16

Source:
  - models/key.js, line 2

### Methods

#### (static) create(title, key, callback)

Create a ssh key

##### Parameters:

Name | Type | Description
--- | --- | ---
`title` | String | key title
`key` | String | the public ssh key
`callback` | module:resin.models.key~createCallback | callback

Source:
  - resource/models/key.js, line 149
To Do:
  - We should return an id for consistency with the other models

##### Example

    resin.models.key.create 'Main', 'ssh-rsa AAAAB....', (error) ->
    		throw error if error?

#### (static) create(title, key, callback)

Create a ssh key

##### Parameters:

Name | Type | Description
--- | --- | ---
`title` | String | key title
`key` | String | the public ssh key
`callback` | module:resin.models.key~createCallback | callback

Source:
  - models/key.js, line 149
To Do:
  - We should return an id for consistency with the other models

##### Example

    resin.models.key.create 'Main', 'ssh-rsa AAAAB....', (error) ->
    		throw error if error?

#### (static) get(id, callback)

Get a single ssh key

##### Parameters:

Name | Type | Description
--- | --- | ---
`id` | String | Number | key id
`callback` | module:resin.models.key~getCallback | callback

Source:
  - models/key.js, line 81

##### Example

    resin.models.key.get 51, (error, key) ->
    		throw error if error?
    		console.log(key)

#### (static) get(id, callback)

Get a single ssh key

##### Parameters:

Name | Type | Description
--- | --- | ---
`id` | String | Number | key id
`callback` | module:resin.models.key~getCallback | callback

Source:
  - resource/models/key.js, line 81

##### Example

    resin.models.key.get 51, (error, key) ->
    		throw error if error?
    		console.log(key)

#### (static) getAll(callback)

Get all ssh keys

##### Parameters:

Name | Type | Description
--- | --- | ---
`callback` | module:resin.models.key~getAllCallback | callback

Source:
  - resource/models/key.js, line 43

##### Example

    resin.models.key.getAll (error, keys) ->
    		throw error if error?
    		console.log(keys)

#### (static) getAll(callback)

Get all ssh keys

##### Parameters:

Name | Type | Description
--- | --- | ---
`callback` | module:resin.models.key~getAllCallback | callback

Source:
  - models/key.js, line 43

##### Example

    resin.models.key.getAll (error, keys) ->
    		throw error if error?
    		console.log(keys)

#### (static) remove(id, callback)

Remove ssh key

##### Parameters:

Name | Type | Description
--- | --- | ---
`id` | String | Number | key id
`callback` | module:resin.models.key~removeCallback | callback

Source:
  - resource/models/key.js, line 118

##### Example

    resin.models.key.remove 51, (error) ->
    		throw error if error?

#### (static) remove(id, callback)

Remove ssh key

##### Parameters:

Name | Type | Description
--- | --- | ---
`id` | String | Number | key id
`callback` | module:resin.models.key~removeCallback | callback

Source:
  - models/key.js, line 118

##### Example

    resin.models.key.remove 51, (error) ->
    		throw error if error?

### Type Definitions

#### Key

A Resin API key

##### Type:

- Object

Source:
  - models/key.js, line 16

#### Key

A Resin API key

##### Type:

- Object

Source:
  - resource/models/key.js, line 16