/build/rpc / cosign / session
cosign.init
- workflowspot-trade·step 5 of 9Workflow: spot-trade · step 5 of 9
cosign.init ( "psbt" "context" "transport" ttl ) Initialize a new cosign session and return a magic link/code. Arguments: 1. psbt (string, optional) Base64-encoded PSBT (optional) 2. context (string, optional) Human-readable context label 3. transport (string, optional) Transport: auto|websocket|nostr|webrtc|tor|ur (default: auto) 4. ttl (numeric, optional) Session TTL in seconds (default: 1800 = 30 min) Result: { (json object) "session_id" : "hex", (string) 32-byte session identifier "invite_link" : "str", (string) Magic link (cosign:?r=<room>&t=<hint>#c=<code>) "invite_code" : "str", (string) 5-word mnemonic code "qr_data" : "str", (string) QR-friendly URI "qr_error_correction" : "str", (string) QR error correction level (M or Q) "sas" : "str", (string) 5-word SAS for verification "sas_numeric" : "str", (string) 6-digit numeric SAS "transport_selected" : "str", (string) Actual transport used "relay_url" : "str", (string, optional) Relay server URL (websocket/nostr transports) "transport" : "str" (string, optional) Transport protocol in use } Examples: > bitcoin-cli cosign.init > bitcoin-cli cosign.init "" "repo-offer" "websocket" 3600 > curl --user myusername --data-binary '{"jsonrpc": "2.0", "id": "curltest", "method": "cosign.init", "params": []}' -H 'content-type: application/json' http://127.0.0.1:8332/
Signature
cosign.init(psbt?: string, context?: string, transport?: string, ttl?: number) → any Code samples
curl --user "$RPC_USER:$RPC_PASS" \
--data-binary '{"jsonrpc":"1.0","id":"docs","method":"cosign.init","params":["\"<psbt>\"","\"<context>\"","\"<transport>\"",0]}' \
-H 'content-type: text/plain;' \
http://127.0.0.1:8332/ Parameters
| Name | Type | Req. | Description |
|---|---|---|---|
| psbt | string | — | Base64-encoded PSBT (optional) |
| context | string | — | Human-readable context label |
| transport | string | — | Transport: auto|websocket|nostr|webrtc|tor|ur (default: auto) |
| ttl | number | — | Session TTL in seconds (default: 1800 = 30 min) |
Result
Type: any
{ (json object) "session_id" : "hex", (string) 32-byte session identifier "invite_link" : "str", (string) Magic link (cosign:?r=<room>&t=<hint>#c=<code>) "invite_code" : "str", (string) 5-word mnemonic code "qr_data" : "str", (string) QR-friendly URI "qr_error_correction" : "str", (string) QR error correction level (M or Q) "sas" : "str", (string) 5-word SAS for verification "sas_numeric" : "str", (string) 6-digit numeric SAS "transport_selected" : "str", (string) Actual transport used "relay_url" : "str", (string, optional) Relay server URL (websocket/nostr transports) "transport" : "str" (string, optional) Transport protocol in use }
Source: services/core-node/bcore/src/rpc/cosign.cpp:802
C++ symbol: cosign_init