@textile/hub > Buckets > withKeyInfo
Buckets.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<Buckets>;
Parameters
Parameter | Type | Description |
---|---|---|
key | KeyInfo | The KeyInfo object containing {key: string, secret: string} |
options | WithKeyInfoOptions |
Returns:
Promise<Buckets>
Example
import { Buckets, KeyInfo } from '@textile/hub'
async function start () {
const keyInfo: KeyInfo = {
key: '<api key>',
secret: '<api secret>'
}
const buckets = await Buckets.withKeyInfo(keyInfo)
}