@textile/hub > Client > withKeyInfo
Client.withKeyInfo() method
Create a new gRPC client instance from a supplied key and secret
Signature:
static withKeyInfo(key: KeyInfo, host?: string, debug?: boolean): Promise<Client>;
Parameters
Parameter | Type | Description |
---|---|---|
key | KeyInfo | The KeyInfo object containing {key: string, secret: string, type: 0}. 0 === User Group Key, 1 === Account Key |
host | string | The remote gRPC host to connect with. Should be left as default. |
debug | boolean | Whether to run in debug mode. Defaults to false. |
Returns:
Promise<Client>
Example
import {KeyInfo, Client} from '@textile/hub'
async function create (keyInfo: KeyInfo) {
return await Client.withKeyInfo(keyInfo)
}