ConnectClient

The ConnectClient is the easiest way to create a new Connect widget instance and make requests against a user's connection.

import { ConnectClient } from "@narval-xyz/armory-sdk";

(static) Init

ConnectClient.init(config) ⇒ Promise.<ConnectClient>

Initializes a new ConnectClient instance with the provided configuration.

Kind: static method of ConnectClient Returns: Promise.<ConnectClient> - A new instance of ConnectClient Throws:

  • ArmorySdkException If there's an error initializing the client

Param
Description

config

The configuration object for the ConnectClient

config.host

The host URL for the Connect service

config.clientId

The client ID for the Connect service

config.signer

The signer for the Connect service

config.accessToken

(optional) Hoist the access token for this instance

config.connectionId

(optional) Hoist the connection ID for this instance

Example

const connectClient = await ConnectClient.init({
  host: "https://auth.armory.narval.xyz",
  clientId: "xxx",
  signer: apiUserPrivateKey,
  accessToken: "my.jwt.token",
  connectionId: "conn-123"
});

(static) verificationHash

ConnectClient.verificationHash(params) ⇒ string

Generates a hash for connection verification.

Kind: static method of ConnectClient Returns: string - Base64URL encoded hash string

Param
Description

params

Parameters for generating the verification hash

params.nonce

Client's nonce value

params.finish

AS's nonce value

params.interactRef

Interaction reference from AS

params.host

Host URL for the grant endpoint

Example

const hash = ConnectClient.verificationHash({
  nonce: "client123",
  finish: "as456",
  interactRef: "ref789",
  host: "https://api.example.com"
});
// Returns: "dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk"

Last updated