accounts
Version:
Tempo Accounts SDK
29 lines • 1.07 kB
JavaScript
import * as CoreProvider from '../core/Provider.js';
import { cli } from './adapter.js';
/**
* Creates a provider that bootstraps access-key authorization through the CLI
* device-code flow.
*/
export function create(options) {
const { host = 'https://wallet.tempo.xyz/api/auth/cli', keysPath, open, pollIntervalMs, timeoutMs, ...rest } = options;
// CLI defaults `mode` to `'pull'` (local account friendly path).
const mpp = (() => {
if (!options.mpp)
return undefined;
if (typeof options.mpp === 'object')
return { mode: 'pull', ...options.mpp };
return { mode: 'pull' };
})();
return CoreProvider.create({
...rest,
adapter: cli({
host,
...(keysPath ? { keysPath } : {}),
...(open ? { open } : {}),
...(typeof pollIntervalMs !== 'undefined' ? { pollIntervalMs } : {}),
...(typeof timeoutMs !== 'undefined' ? { timeoutMs } : {}),
}),
...(mpp ? { mpp } : {}),
});
}
//# sourceMappingURL=Provider.js.map