@textile/hub > Filecoin > withKeyInfo
Filecoin.withKeyInfo() method
Creates a new API client instance for accessing the gRPC API using key & secret based authentication. This method is recommended for admin or insecure implementations where the non-signing keys or key with secret can be embedded directly in an app.
Signature:
static withKeyInfo(key: KeyInfo, options?: WithKeyInfoOptions): Promise<Filecoin>;
Parameters
Parameter | Type | Description |
---|---|---|
key | KeyInfo | The KeyInfo object containing {key: string, secret: string} |
options | WithKeyInfoOptions |
Returns:
Promise<Filecoin>
Example
import { Filecoin, KeyInfo } from '@textile/hub'
async function start () {
const keyInfo: KeyInfo = {
key: '<api key>',
secret: '<api secret>'
}
const filecoin = await Filecoin.withKeyInfo(keyInfo)
}