Skip to content

Vonage Network SIM Swap

github-actions edited this page Jan 10, 2025 · 40 revisions

Vonage Network SIM Swap


Documentation / Vonage Network SIM Swap

Vonage Network SIM Swap

Classes

SIMSwap

Defined in: network-sim-swap/lib/simSwap.ts:5

Extends

Constructors

new SIMSwap()
new SIMSwap(auth, config?): SIMSwap

Defined in: network-client/dist/networkClient.d.ts:34

Parameters
auth

NetworkAuthParameters

config?

NetworkConfigParameters

Returns

SIMSwap

Inherited from

NetworkClient.constructor

Properties

_msisdn
protected _msisdn: string;

Defined in: network-client/dist/networkClient.d.ts:21

The msisdn that will be used for API calls

Inherited from

NetworkClient._msisdn

_purpose?
protected optional _purpose: FRAUD_PREVENTION_AND_DETECTION;

Defined in: network-client/dist/networkClient.d.ts:25

The purpose for the scope

Inherited from

NetworkClient._purpose

_scope?
protected optional _scope: Scope;

Defined in: network-client/dist/networkClient.d.ts:29

The scope for the token

Inherited from

NetworkClient._scope

accessToken?
protected optional accessToken: string;

Defined in: network-client/dist/networkClient.d.ts:13

The current token

Inherited from

NetworkClient.accessToken

auth
protected auth: AuthInterface;

Defined in: server-client/dist/lib/client.d.ts:24

The authentication instance responsible for generating authentication headers and query parameters.

Inherited from

NetworkClient.auth

authType?
protected optional authType: CIBA = AuthenticationType.CIBA;

Defined in: network-sim-swap/lib/simSwap.ts:6

The type of authentication used for the client's requests.

Overrides

NetworkClient.authType

config
protected config: NetworkConfigParameters;

Defined in: network-client/dist/networkClient.d.ts:33

Configuration settings for the client, including default hosts for various services and other request settings.

Inherited from

NetworkClient.config

expires
protected expires: number;

Defined in: network-client/dist/networkClient.d.ts:17

Timestamp until the token expires

Inherited from

NetworkClient.expires

gettingToken
protected gettingToken: boolean;

Defined in: network-client/dist/networkClient.d.ts:9

Flags if we are currently getting a token

Inherited from

NetworkClient.gettingToken

transformers
static transformers: object;

Defined in: server-client/dist/lib/client.d.ts:11

Static property containing utility transformers.

camelCaseObjectKeys
camelCaseObjectKeys: PartialTransformFunction;
kebabCaseObjectKeys
kebabCaseObjectKeys: PartialTransformFunction;
omit()
omit: (keys, obj) => TransformedObject;
Parameters
keys

string[]

obj

ObjectToTransform

Returns

TransformedObject

snakeCaseObjectKeys
snakeCaseObjectKeys: PartialTransformFunction;
Inherited from

NetworkClient.transformers

Accessors

msisdn
Get Signature
get msisdn(): string

Defined in: network-client/dist/networkClient.d.ts:40

Get the msisdn

Throws

If the msisdn is not set

Returns

string

The msisdn

Inherited from

NetworkClient.msisdn

purpose
Get Signature
get purpose(): FRAUD_PREVENTION_AND_DETECTION

Defined in: network-client/dist/networkClient.d.ts:48

Get the purpose

Throws

If the purpose is not set

Throws

If the purpose is not valid

Returns

FRAUD_PREVENTION_AND_DETECTION

The purpose

Set Signature
set purpose(value): void

Defined in: network-client/dist/networkClient.d.ts:53

Set the purpose

Parameters
value

FRAUD_PREVENTION_AND_DETECTION

The purpose

Returns

void

Inherited from

NetworkClient.purpose

scope
Get Signature
get scope(): Scope

Defined in: network-client/dist/networkClient.d.ts:61

Get the scope

Throws

If the scope is not set

Throws

If the scope is not valid

Returns

Scope

The scope

Set Signature
set scope(value): void

Defined in: network-client/dist/networkClient.d.ts:69

Set the scope

Throws

If the scope is not valid

Throws

If the scope is not set

Parameters
value

Scope

The scope

Returns

void

Inherited from

NetworkClient.scope

Methods

addAuthenticationToRequest()
addAuthenticationToRequest(request): Promise<VetchOptions>

Defined in: network-client/dist/networkClient.d.ts:78

Add authentication to the auth

This will make the calls to get a network token if required.

Parameters
request

VetchOptions

The request to add authentication to

Returns

Promise<VetchOptions>

The request with authentication added

Inherited from

NetworkClient.addAuthenticationToRequest

addBasicAuthToRequest()
protected addBasicAuthToRequest(request): Promise<VetchOptions>

Defined in: server-client/dist/lib/client.d.ts:71

Adds basic authentication headers to the request.

Parameters
request

VetchOptions

The request options to which authentication needs to be added.

Returns

Promise<VetchOptions>

  • The request options with the added authentication.
Inherited from

NetworkClient.addBasicAuthToRequest

addJWTToRequest()
protected addJWTToRequest(request): Promise<VetchOptions>

Defined in: server-client/dist/lib/client.d.ts:64

Adds a JWT to the request.

Parameters
request

VetchOptions

The request options to which authentication needs to be added.

Returns

Promise<VetchOptions>

  • The request options with the added authentication.
Inherited from

NetworkClient.addJWTToRequest

addQueryKeySecretToRequest()
protected addQueryKeySecretToRequest(request): Promise<VetchOptions>

Defined in: server-client/dist/lib/client.d.ts:57

Adds API key and secret to the request.

Parameters
request

VetchOptions

The request options to which authentication needs to be added.

Returns

Promise<VetchOptions>

  • The request options with the added authentication.
Inherited from

NetworkClient.addQueryKeySecretToRequest

addQueryKeySecretToRequestBody()
protected addQueryKeySecretToRequestBody(request): Promise<VetchOptions>

Defined in: server-client/dist/lib/client.d.ts:50

Adds API key and secret to the request body.

Parameters
request

VetchOptions

The request options to which authentication needs to be added.

Returns

Promise<VetchOptions>

  • The request options with the added authentication.
Inherited from

NetworkClient.addQueryKeySecretToRequestBody

buildOIDCURL()
buildOIDCURL(state?): string

Defined in: network-client/dist/networkClient.d.ts:85

Build the URL for the OIDC flow

Parameters
state?

string

The state to use

Returns

string

The URL for the OIDC flow

Inherited from

NetworkClient.buildOIDCURL

checkSwapSim()
checkSwapSim(params): Promise<boolean>

Defined in: network-sim-swap/lib/simSwap.ts:8

Parameters
params

SIMSwapParameters

Returns

Promise<boolean>

exchangeCodeForToken()
exchangeCodeForToken(code): Promise<NetworkTokenResponse>

Defined in: network-client/dist/networkClient.d.ts:92

Exchange the code for a network token

Parameters
code

string

The code to exchange

Returns

Promise<NetworkTokenResponse>

The network token token

Inherited from

NetworkClient.exchangeCodeForToken

getCIBAAccessToken()
protected getCIBAAccessToken(cibaRequestId): Promise<NetworkTokenResponse>

Defined in: network-client/dist/networkClient.d.ts:106

Get a network token

Parameters
cibaRequestId

string

The CIBA request id

Returns

Promise<NetworkTokenResponse>

The network token data

Inherited from

NetworkClient.getCIBAAccessToken

getCIBARequestId()
protected getCIBARequestId(): Promise<string>

Defined in: network-client/dist/networkClient.d.ts:112

Get an CIBA request id

Returns

Promise<string>

The CIBA request id

Inherited from

NetworkClient.getCIBARequestId

getCIBAToken()
protected getCIBAToken(): Promise<void>

Defined in: network-client/dist/networkClient.d.ts:99

Get the access token for the CIBA flow

This is a two step process. First we need to get an CIBA request id, then we can use that to get a network token.

Returns

Promise<void>

Inherited from

NetworkClient.getCIBAToken

getConfig()
getConfig(): ConfigParams

Defined in: server-client/dist/lib/client.d.ts:36

Returns

ConfigParams

Inherited from

NetworkClient.getConfig

parseResponse()
protected parseResponse<T>(request, response): Promise<VetchResponse<T>>

Defined in: server-client/dist/lib/client.d.ts:168

Parses the response based on its content type.

Type Parameters

T

The expected type of the parsed response data.

Parameters
request

VetchOptions

The request options.

response

Response

The raw response from the request.

Returns

Promise<VetchResponse<T>>

  • The parsed response.
Inherited from

NetworkClient.parseResponse

prepareBody()
protected prepareBody(request): undefined | string

Defined in: server-client/dist/lib/client.d.ts:158

Prepares the body for the request based on the content type.

Parameters
request

VetchOptions

The request options.

Returns

undefined | string

  • The prepared request body as a string or undefined.
Inherited from

NetworkClient.prepareBody

prepareRequest()
protected prepareRequest(request): Promise<VetchOptions>

Defined in: server-client/dist/lib/client.d.ts:151

Prepares the request with necessary headers, authentication, and query parameters.

Parameters
request

VetchOptions

The initial request options.

Returns

Promise<VetchOptions>

  • The modified request options.
Inherited from

NetworkClient.prepareRequest

sendDeleteRequest()
sendDeleteRequest<T>(url): Promise<VetchResponse<T>>

Defined in: server-client/dist/lib/client.d.ts:78

Sends a DELETE request to the specified URL.

Type Parameters

T

Parameters
url

string

The URL endpoint for the DELETE request.

Returns

Promise<VetchResponse<T>>

  • The response from the DELETE request.
Inherited from

NetworkClient.sendDeleteRequest

sendFormSubmitRequest()
sendFormSubmitRequest<T>(url, payload?): Promise<VetchResponse<T>>

Defined in: server-client/dist/lib/client.d.ts:86

Sends a POST request with form data to the specified URL.

Type Parameters

T

Parameters
url

string

The URL endpoint for the POST request.

payload?

Record<string, undefined | string>

Optional payload containing form data to send with the POST request.

Returns

Promise<VetchResponse<T>>

  • The response from the POST request.
Inherited from

NetworkClient.sendFormSubmitRequest

sendGetRequest()
sendGetRequest<T>(url, queryParams?): Promise<VetchResponse<T>>

Defined in: server-client/dist/lib/client.d.ts:94

Sends a GET request to the specified URL with optional query parameters.

Type Parameters

T

Parameters
url

string

The URL endpoint for the GET request.

queryParams?

Optional query parameters to append to the URL. These should be compatible with Node's URLSearchParams.

Returns

Promise<VetchResponse<T>>

  • The response from the GET request.
Inherited from

NetworkClient.sendGetRequest

sendPatchRequest()
sendPatchRequest<T>(url, payload?): Promise<VetchResponse<T>>

Defined in: server-client/dist/lib/client.d.ts:104

Sends a PATCH request to the specified URL with an optional payload.

Type Parameters

T

Parameters
url

string

The URL endpoint for the PATCH request.

payload?

Optional payload to be sent as the body of the PATCH request.

Returns

Promise<VetchResponse<T>>

  • The response from the PATCH request.
Inherited from

NetworkClient.sendPatchRequest

sendPostRequest()
sendPostRequest<T>(url, payload?): Promise<VetchResponse<T>>

Defined in: server-client/dist/lib/client.d.ts:114

Sends a POST request to the specified URL with an optional payload.

Type Parameters

T

Parameters
url

string

The URL endpoint for the POST request.

payload?

Optional payload to be sent as the body of the POST request.

Returns

Promise<VetchResponse<T>>

  • The response from the POST request.
Inherited from

NetworkClient.sendPostRequest

sendPutRequest()
sendPutRequest<T>(url, payload?): Promise<VetchResponse<T>>

Defined in: server-client/dist/lib/client.d.ts:124

Sends a PUT request to the specified URL with an optional payload.

Type Parameters

T

Parameters
url

string

The URL endpoint for the PUT request.

payload?

Optional payload to be sent as the body of the PUT request.

Returns

Promise<VetchResponse<T>>

  • The response from the PUT request.
Inherited from

NetworkClient.sendPutRequest

sendRequest()
sendRequest<T>(request): Promise<VetchResponse<T>>

Defined in: server-client/dist/lib/client.d.ts:144

Sends a request adding necessary headers, handling authentication, and parsing the response.

Type Parameters

T

Parameters
request

VetchOptions

The options defining the request, including URL, method, headers, and data.

Returns

Promise<VetchResponse<T>>

  • The parsed response from the request.
Inherited from

NetworkClient.sendRequest

sendRequestWithData()
sendRequestWithData<T>(
   method, 
   url, 
payload?): Promise<VetchResponse<T>>

Defined in: server-client/dist/lib/client.d.ts:135

Sends a request with JSON-encoded data to the specified URL using the provided HTTP method.

Type Parameters

T

Parameters
method

The HTTP method to be used for the request (only POST, PATCH, or PUT are acceptable).

POST | PUT | PATCH

url

string

The URL endpoint for the request.

payload?

Optional payload to be sent as the body of the request, JSON-encoded.

Returns

Promise<VetchResponse<T>>

  • The response from the request.
Inherited from

NetworkClient.sendRequestWithData

Type Aliases

SIMSwapParameters

type SIMSwapParameters = object;

Defined in: network-sim-swap/lib/types/parameters/simSwapParameters.ts:1

Type declaration

maxAge?
optional maxAge: number;

The number of days to check if the SIM was swapped

From 1 to 2400

phoneNumber
phoneNumber: string;

The Phone number to check if the SIM was swapped


SIMSwapResponse

type SIMSwapResponse = object;

Defined in: network-sim-swap/lib/types/responses/simSwapResponse.ts:1

Type declaration

swapped
swapped: boolean;

Weahter the SIM was swapped or not

Clone this wiki locally