fix: switch pairing setup codes to bootstrap tokens

This commit is contained in:
Peter Steinberger
2026-03-12 22:22:44 +00:00
parent 9cd54ea882
commit bf89947a8e
53 changed files with 1035 additions and 106 deletions

View File

@@ -2,6 +2,7 @@ import os from "node:os";
import type { OpenClawPluginApi } from "openclaw/plugin-sdk/device-pair";
import {
approveDevicePairing,
issueDeviceBootstrapToken,
listDevicePairing,
resolveGatewayBindUrl,
runPluginCommandWithTimeout,
@@ -31,8 +32,7 @@ type DevicePairPluginConfig = {
type SetupPayload = {
url: string;
token?: string;
password?: string;
bootstrapToken: string;
};
type ResolveUrlResult = {
@@ -405,8 +405,14 @@ export default function register(api: OpenClawPluginApi) {
const payload: SetupPayload = {
url: urlResult.url,
token: auth.token,
password: auth.password,
bootstrapToken: (
await issueDeviceBootstrapToken({
channel: ctx.channel,
senderId: ctx.senderId ?? ctx.from ?? ctx.to,
accountId: ctx.accountId,
threadId: ctx.messageThreadId != null ? String(ctx.messageThreadId) : undefined,
})
).token,
};
if (action === "qr") {