For the complete documentation index, see llms.txt. This page is also available as Markdown.

Use the Site Reputation SDK

Querying Site Reputation

The Site Reputation SDK enables you to warn or guard your users from accessing low reputation websites. The getSiteReputation function of the SDK returns a SiteReputation structure with attributes you can use to form a decision on whether to block access to a site or display a warning to your users.

// const client = new SudoSiteReputationClient({...})

import {
  SiteReputation
} from '@sudoplatform/sudo-site-reputation'

let siteReputation: SiteReputation
try {
  siteReputation = client.getSiteReputation('https://sudoplatform.com')
  console.log(siteReputation.reputationStatus)
} catch (error) {
  // implement error handling
}
var client: SudoSiteReputationClient!

let uri = "http://www.wikipedia.com"
let result = try await instance.getSiteReputation(url: uri)
switch result.status {
case .notMalicious:
    break
case .malicious:
    break
case .unkown:
    break
}

SiteReputation Interface

/**
 * The state of knowledge of a site's reputation.
 */
export type ReputationStatus = 'NOTMALICIOUS' | 'MALICIOUS' | 'UNKNOWN'

/**
 * The response of a given url's site reputation.
 */
export interface SiteReputation {
  /** Returns `MALICIOUS` if malicious, `NOTMALICIOUS` if not, and `UNKNOWN` if unable to be determined. */
  reputationStatus: ReputationStatus
}
public struct SiteReputation {
    
    /// Search status
     public enum ReputationStatus {
         // URI not in dataset as not malicious
         case notMalicious
         // URI found in dataset as malicious
         case malicious
         // URI not found in the dataset
         case unkown
    }

    /// The returned result of the lookup for the site. If .success you can expect the other properties to be non nil.
    public let status: ReputationStatus
}

Last updated