Skip to content

CConfirmation

DoctorMcKay edited this page Jun 21, 2023 · 6 revisions

A class which represents an outstanding confirmation on your account.

v3.12.1 or later is required to use anything relating to confirmations

Properties

id

The ID of this confirmation. This is not the same as a trade offer ID.

type

v3.25.0 or later is required to use this property

What type of thing this confirmation wants to confirm. The enum is available as a property of SteamCommunity.

creator

v3.25.0 or later is required to use this property

The ID of the thing that created this confirmation (trade offer ID for a trade, market listing ID for a market listing).

key

The key for this confirmation. This is required when confirming or canceling the confirmation. This is not the same as the TOTP confirmation key.

title

The title of this confirmation.

receiving

A textual description of what you will receive from this confirmation, if this is a trade. If this is a market listing, then this is empty.

sending

v3.45.1 or later is required to use this property

A textual description of what you will lose from this confirmation, if this is a trade. If this is a market listing, then this is a string containing the name of the item you're listing on the market.

time

A textual description of when this confirmation was created.

timestamp

v3.45.2 or later is required to use this property

A Date object of when this confirmation was created.

icon

The URL to your trading partner's avatar, if this is a trade. The URL to the image of the item, if this is a market listing. Otherwise, an empty string.

Methods

getOfferID(time, key, callback)

  • time - The Unix timestamp with which the following key was generated
  • key - The confirmation key that was generated using the preceeding time and the tag "details" (this key can be reused). You can use steam-totp to generate this.
  • callback - Called when the request completes
    • err - An Error object on failure, or null on success
    • offerID - The ID of the trade offer this is confirming, or null if not a confirmation for a trade offer

Gets the ID of the trade offer that this confirmation is confirming, if it's for a trade.

Prior to v3.25.0, this makes an HTTP request to Steam. At and after v3.25.0, this simply grabs the creator property from the confirmation. It's unnecessary to use this method since v3.25.0, and so it's deprecated.

respond(time, key, accept, callback)

  • time - The Unix timestamp with which the following key was generated
  • key - The confirmation key that was generated using the preceeding time and the tag "allow" (if accepting) or "cancel" (if declining). You can use steam-totp to generate this.
  • accept - true if you are accepting, false if you are canceling
  • callback - Called when the request completes
    • err - An Error object on failure, or null on success

Accept or decline the confirmation.

Example:

// assume that "confirmation" is a CConfirmation object, and we want to approve it
// also assume that identitySecret is your account's "identity_secret"

var SteamTotp = require('steam-totp');
var time = SteamTotp.time();
var confKey = SteamTotp.getConfirmationKey(identitySecret, time, "allow");
confirmation.respond(time, confKey, true, function(err) {
    if (err) {
        console.log("Cannot accept confirmation: " + err.message);
    } else {
        console.log("Confirmation accepted successfully");
    }
});