createAPISig() function
createAPISig generates an authorization signature and message only.
This function should NOT be used client-side, as it requires a key secret.
Signature:
export declare function createAPISig(secret: string, date?: Date): Promise<APISig>;
Parameters
Parameter | Type | Description |
---|---|---|
secret | string | The key secret to generate the signature. See KeyInfo for details. |
date | Date | An optional future Date to use as signature message. Once date has passed, this authorization signature and message will expire. Defaults to one minute from Date.now . |
Returns:
Promise<APISig>
Example
Basic usage
import {createAPISig, APISig} from '@textile/hub'
async function sign (key: string) {
const sig: APISig = await createAPISig(key)
return sig
}