Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@civic/gateway-client-core

Package Overview
Dependencies
Maintainers
0
Versions
46
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@civic/gateway-client-core - npm Package Compare versions

Comparing version 1.1.2-beta.1 to 1.1.3-alpha.1

.nyc_output/20655237-5fea-4c9d-a6c8-89d47a0d9efb.json

2

.nyc_output/processinfo/index.json

@@ -1,1 +0,1 @@

{"processes":{"6b64174d-c9f3-4624-9092-5e2730fe8c5f":{"parent":null,"children":[]},"ad7aae9b-42b4-4de2-80a1-1f20058cda47":{"parent":null,"children":[]}},"files":{"/Users/lucas/dev/civic/ociv-gatekeeper/packages/gateway-client-core/src/config.ts":["6b64174d-c9f3-4624-9092-5e2730fe8c5f"],"/Users/lucas/dev/civic/ociv-gatekeeper/packages/gateway-client-core/src/gatekeeperClient.ts":["6b64174d-c9f3-4624-9092-5e2730fe8c5f"],"/Users/lucas/dev/civic/ociv-gatekeeper/packages/gateway-client-core/src/utils/url.ts":["6b64174d-c9f3-4624-9092-5e2730fe8c5f"],"/Users/lucas/dev/civic/ociv-gatekeeper/packages/gateway-client-core/src/logger/index.ts":["6b64174d-c9f3-4624-9092-5e2730fe8c5f"],"/Users/lucas/dev/civic/ociv-gatekeeper/packages/gateway-client-core/src/logger/local.logger.ts":["6b64174d-c9f3-4624-9092-5e2730fe8c5f"],"/Users/lucas/dev/civic/ociv-gatekeeper/packages/gateway-client-core/src/logger/provider.logger.ts":["6b64174d-c9f3-4624-9092-5e2730fe8c5f"],"/Users/lucas/dev/civic/ociv-gatekeeper/packages/gateway-client-core/src/types/log.ts":["6b64174d-c9f3-4624-9092-5e2730fe8c5f"],"/Users/lucas/dev/civic/ociv-gatekeeper/packages/gateway-client-core/src/types/gatekeeperApi.ts":["6b64174d-c9f3-4624-9092-5e2730fe8c5f"],"/Users/lucas/dev/civic/ociv-gatekeeper/packages/gateway-client-core/src/types/chain.ts":["6b64174d-c9f3-4624-9092-5e2730fe8c5f"],"/Users/lucas/dev/civic/ociv-gatekeeper/packages/gateway-client-core/src/gatekeeperNetworkService.ts":["6b64174d-c9f3-4624-9092-5e2730fe8c5f"],"/Users/lucas/dev/civic/ociv-gatekeeper/packages/gateway-client-core/src/GatewayClientCore.ts":["6b64174d-c9f3-4624-9092-5e2730fe8c5f"],"/Users/lucas/dev/civic/ociv-gatekeeper/packages/gateway-client-core/src/orchestrate.ts":["6b64174d-c9f3-4624-9092-5e2730fe8c5f"],"/Users/lucas/dev/civic/ociv-gatekeeper/packages/gateway-client-core/src/listeners.ts":["6b64174d-c9f3-4624-9092-5e2730fe8c5f"],"/Users/lucas/dev/civic/ociv-gatekeeper/packages/gateway-client-core/src/types/civicPass.ts":["6b64174d-c9f3-4624-9092-5e2730fe8c5f"],"/Users/lucas/dev/civic/ociv-gatekeeper/packages/gateway-client-core/src/types/civicSign.ts":["6b64174d-c9f3-4624-9092-5e2730fe8c5f"],"/Users/lucas/dev/civic/ociv-gatekeeper/packages/gateway-client-core/src/types/fetch.ts":["6b64174d-c9f3-4624-9092-5e2730fe8c5f"],"/Users/lucas/dev/civic/ociv-gatekeeper/packages/gateway-client-core/src/types/gateway.ts":["6b64174d-c9f3-4624-9092-5e2730fe8c5f"],"/Users/lucas/dev/civic/ociv-gatekeeper/packages/gateway-client-core/src/utils/inputs.ts":["6b64174d-c9f3-4624-9092-5e2730fe8c5f"],"/Users/lucas/dev/civic/ociv-gatekeeper/packages/gateway-client-core/src/remoteSign.ts":["6b64174d-c9f3-4624-9092-5e2730fe8c5f"],"/Users/lucas/dev/civic/ociv-gatekeeper/packages/gateway-client-core/src/utils/errors.ts":["6b64174d-c9f3-4624-9092-5e2730fe8c5f"],"/Users/lucas/dev/civic/ociv-gatekeeper/packages/gateway-client-core/src/issuance.ts":["6b64174d-c9f3-4624-9092-5e2730fe8c5f"],"/Users/lucas/dev/civic/ociv-gatekeeper/packages/gateway-client-core/src/orchestratorFlow.ts":["6b64174d-c9f3-4624-9092-5e2730fe8c5f"],"/Users/lucas/dev/civic/ociv-gatekeeper/packages/gateway-client-core/src/utils/defaults.ts":["6b64174d-c9f3-4624-9092-5e2730fe8c5f","ad7aae9b-42b4-4de2-80a1-1f20058cda47"],"/Users/lucas/dev/civic/ociv-gatekeeper/packages/gateway-client-core/src/utils/expiry.ts":["6b64174d-c9f3-4624-9092-5e2730fe8c5f"],"/Users/lucas/dev/civic/ociv-gatekeeper/packages/gateway-client-core/src/refresh.ts":["6b64174d-c9f3-4624-9092-5e2730fe8c5f"],"/Users/lucas/dev/civic/ociv-gatekeeper/packages/gateway-client-core/src/utils/userInteraction.ts":["6b64174d-c9f3-4624-9092-5e2730fe8c5f"],"/Users/lucas/dev/civic/ociv-gatekeeper/packages/gateway-client-core/src/types/userInteraction.ts":["6b64174d-c9f3-4624-9092-5e2730fe8c5f"],"/Users/lucas/dev/civic/ociv-gatekeeper/packages/gateway-client-core/src/partnerReview.ts":["6b64174d-c9f3-4624-9092-5e2730fe8c5f"],"/Users/lucas/dev/civic/ociv-gatekeeper/packages/gateway-client-core/src/state/common.ts":["6b64174d-c9f3-4624-9092-5e2730fe8c5f"],"/Users/lucas/dev/civic/ociv-gatekeeper/packages/gateway-client-core/src/state/state.ts":["6b64174d-c9f3-4624-9092-5e2730fe8c5f"],"/Users/lucas/dev/civic/ociv-gatekeeper/packages/gateway-client-core/src/state/stateMapping.ts":["6b64174d-c9f3-4624-9092-5e2730fe8c5f"],"/Users/lucas/dev/civic/ociv-gatekeeper/packages/gateway-client-core/src/utils/flow.ts":["6b64174d-c9f3-4624-9092-5e2730fe8c5f"],"/Users/lucas/dev/civic/ociv-gatekeeper/packages/gateway-client-core/src/types/flow.ts":["6b64174d-c9f3-4624-9092-5e2730fe8c5f"],"/Users/lucas/dev/civic/ociv-gatekeeper/packages/gateway-client-core/src/state/gatewayStatus.ts":["6b64174d-c9f3-4624-9092-5e2730fe8c5f"],"/Users/lucas/dev/civic/ociv-gatekeeper/packages/gateway-client-core/src/state/error.ts":["6b64174d-c9f3-4624-9092-5e2730fe8c5f"],"/Users/lucas/dev/civic/ociv-gatekeeper/packages/gateway-client-core/src/state/initialisation.ts":["6b64174d-c9f3-4624-9092-5e2730fe8c5f"],"/Users/lucas/dev/civic/ociv-gatekeeper/packages/gateway-client-core/src/state/issuance.ts":["6b64174d-c9f3-4624-9092-5e2730fe8c5f"],"/Users/lucas/dev/civic/ociv-gatekeeper/packages/gateway-client-core/src/utils/partnerReview.ts":["6b64174d-c9f3-4624-9092-5e2730fe8c5f"],"/Users/lucas/dev/civic/ociv-gatekeeper/packages/gateway-client-core/src/state/refresh.ts":["6b64174d-c9f3-4624-9092-5e2730fe8c5f"],"/Users/lucas/dev/civic/ociv-gatekeeper/packages/gateway-client-core/src/state/flowParameters.ts":["6b64174d-c9f3-4624-9092-5e2730fe8c5f"],"/Users/lucas/dev/civic/ociv-gatekeeper/packages/gateway-client-core/src/utils/object.ts":["6b64174d-c9f3-4624-9092-5e2730fe8c5f"],"/Users/lucas/dev/civic/ociv-gatekeeper/packages/gateway-client-core/src/version.ts":["6b64174d-c9f3-4624-9092-5e2730fe8c5f","ad7aae9b-42b4-4de2-80a1-1f20058cda47"],"/Users/lucas/dev/civic/ociv-gatekeeper/packages/gateway-client-core/src/state/ui.ts":["6b64174d-c9f3-4624-9092-5e2730fe8c5f"],"/Users/lucas/dev/civic/ociv-gatekeeper/packages/gateway-client-core/src/ui.ts":["6b64174d-c9f3-4624-9092-5e2730fe8c5f"],"/Users/lucas/dev/civic/ociv-gatekeeper/packages/gateway-client-core/src/types/eventInterface.ts":["6b64174d-c9f3-4624-9092-5e2730fe8c5f"],"/Users/lucas/dev/civic/ociv-gatekeeper/packages/gateway-client-core/src/utils/analytics.ts":["6b64174d-c9f3-4624-9092-5e2730fe8c5f"]},"externalIds":{}}
{"processes":{"20655237-5fea-4c9d-a6c8-89d47a0d9efb":{"parent":null,"children":[]},"4900e651-00ab-4d67-adf1-d6d780fdf508":{"parent":null,"children":[]}},"files":{"/Users/daneel/work/ociv-gatekeeper/packages/gateway-client-core/src/config.ts":["20655237-5fea-4c9d-a6c8-89d47a0d9efb"],"/Users/daneel/work/ociv-gatekeeper/packages/gateway-client-core/src/gatekeeperClient.ts":["20655237-5fea-4c9d-a6c8-89d47a0d9efb"],"/Users/daneel/work/ociv-gatekeeper/packages/gateway-client-core/src/utils/url.ts":["20655237-5fea-4c9d-a6c8-89d47a0d9efb"],"/Users/daneel/work/ociv-gatekeeper/packages/gateway-client-core/src/logger/index.ts":["20655237-5fea-4c9d-a6c8-89d47a0d9efb"],"/Users/daneel/work/ociv-gatekeeper/packages/gateway-client-core/src/logger/local.logger.ts":["20655237-5fea-4c9d-a6c8-89d47a0d9efb"],"/Users/daneel/work/ociv-gatekeeper/packages/gateway-client-core/src/logger/provider.logger.ts":["20655237-5fea-4c9d-a6c8-89d47a0d9efb"],"/Users/daneel/work/ociv-gatekeeper/packages/gateway-client-core/src/types/log.ts":["20655237-5fea-4c9d-a6c8-89d47a0d9efb"],"/Users/daneel/work/ociv-gatekeeper/packages/gateway-client-core/src/types/gatekeeperApi.ts":["20655237-5fea-4c9d-a6c8-89d47a0d9efb"],"/Users/daneel/work/ociv-gatekeeper/packages/gateway-client-core/src/types/chain.ts":["20655237-5fea-4c9d-a6c8-89d47a0d9efb"],"/Users/daneel/work/ociv-gatekeeper/packages/gateway-client-core/src/gatekeeperNetworkService.ts":["20655237-5fea-4c9d-a6c8-89d47a0d9efb"],"/Users/daneel/work/ociv-gatekeeper/packages/gateway-client-core/src/GatewayClientCore.ts":["20655237-5fea-4c9d-a6c8-89d47a0d9efb"],"/Users/daneel/work/ociv-gatekeeper/packages/gateway-client-core/src/orchestrate.ts":["20655237-5fea-4c9d-a6c8-89d47a0d9efb"],"/Users/daneel/work/ociv-gatekeeper/packages/gateway-client-core/src/listeners.ts":["20655237-5fea-4c9d-a6c8-89d47a0d9efb"],"/Users/daneel/work/ociv-gatekeeper/packages/gateway-client-core/src/types/civicPass.ts":["20655237-5fea-4c9d-a6c8-89d47a0d9efb"],"/Users/daneel/work/ociv-gatekeeper/packages/gateway-client-core/src/types/civicSign.ts":["20655237-5fea-4c9d-a6c8-89d47a0d9efb"],"/Users/daneel/work/ociv-gatekeeper/packages/gateway-client-core/src/types/fetch.ts":["20655237-5fea-4c9d-a6c8-89d47a0d9efb"],"/Users/daneel/work/ociv-gatekeeper/packages/gateway-client-core/src/types/gateway.ts":["20655237-5fea-4c9d-a6c8-89d47a0d9efb"],"/Users/daneel/work/ociv-gatekeeper/packages/gateway-client-core/src/utils/inputs.ts":["20655237-5fea-4c9d-a6c8-89d47a0d9efb"],"/Users/daneel/work/ociv-gatekeeper/packages/gateway-client-core/src/remoteSign.ts":["20655237-5fea-4c9d-a6c8-89d47a0d9efb"],"/Users/daneel/work/ociv-gatekeeper/packages/gateway-client-core/src/utils/errors.ts":["20655237-5fea-4c9d-a6c8-89d47a0d9efb"],"/Users/daneel/work/ociv-gatekeeper/packages/gateway-client-core/src/issuance.ts":["20655237-5fea-4c9d-a6c8-89d47a0d9efb"],"/Users/daneel/work/ociv-gatekeeper/packages/gateway-client-core/src/orchestratorFlow.ts":["20655237-5fea-4c9d-a6c8-89d47a0d9efb"],"/Users/daneel/work/ociv-gatekeeper/packages/gateway-client-core/src/utils/defaults.ts":["20655237-5fea-4c9d-a6c8-89d47a0d9efb","4900e651-00ab-4d67-adf1-d6d780fdf508"],"/Users/daneel/work/ociv-gatekeeper/packages/gateway-client-core/src/utils/expiry.ts":["20655237-5fea-4c9d-a6c8-89d47a0d9efb"],"/Users/daneel/work/ociv-gatekeeper/packages/gateway-client-core/src/refresh.ts":["20655237-5fea-4c9d-a6c8-89d47a0d9efb"],"/Users/daneel/work/ociv-gatekeeper/packages/gateway-client-core/src/utils/userInteraction.ts":["20655237-5fea-4c9d-a6c8-89d47a0d9efb"],"/Users/daneel/work/ociv-gatekeeper/packages/gateway-client-core/src/types/userInteraction.ts":["20655237-5fea-4c9d-a6c8-89d47a0d9efb"],"/Users/daneel/work/ociv-gatekeeper/packages/gateway-client-core/src/partnerReview.ts":["20655237-5fea-4c9d-a6c8-89d47a0d9efb"],"/Users/daneel/work/ociv-gatekeeper/packages/gateway-client-core/src/state/common.ts":["20655237-5fea-4c9d-a6c8-89d47a0d9efb"],"/Users/daneel/work/ociv-gatekeeper/packages/gateway-client-core/src/state/state.ts":["20655237-5fea-4c9d-a6c8-89d47a0d9efb"],"/Users/daneel/work/ociv-gatekeeper/packages/gateway-client-core/src/state/stateMapping.ts":["20655237-5fea-4c9d-a6c8-89d47a0d9efb"],"/Users/daneel/work/ociv-gatekeeper/packages/gateway-client-core/src/utils/flow.ts":["20655237-5fea-4c9d-a6c8-89d47a0d9efb"],"/Users/daneel/work/ociv-gatekeeper/packages/gateway-client-core/src/types/flow.ts":["20655237-5fea-4c9d-a6c8-89d47a0d9efb"],"/Users/daneel/work/ociv-gatekeeper/packages/gateway-client-core/src/state/gatewayStatus.ts":["20655237-5fea-4c9d-a6c8-89d47a0d9efb"],"/Users/daneel/work/ociv-gatekeeper/packages/gateway-client-core/src/state/error.ts":["20655237-5fea-4c9d-a6c8-89d47a0d9efb"],"/Users/daneel/work/ociv-gatekeeper/packages/gateway-client-core/src/state/initialisation.ts":["20655237-5fea-4c9d-a6c8-89d47a0d9efb"],"/Users/daneel/work/ociv-gatekeeper/packages/gateway-client-core/src/state/issuance.ts":["20655237-5fea-4c9d-a6c8-89d47a0d9efb"],"/Users/daneel/work/ociv-gatekeeper/packages/gateway-client-core/src/utils/partnerReview.ts":["20655237-5fea-4c9d-a6c8-89d47a0d9efb"],"/Users/daneel/work/ociv-gatekeeper/packages/gateway-client-core/src/state/refresh.ts":["20655237-5fea-4c9d-a6c8-89d47a0d9efb"],"/Users/daneel/work/ociv-gatekeeper/packages/gateway-client-core/src/state/flowParameters.ts":["20655237-5fea-4c9d-a6c8-89d47a0d9efb"],"/Users/daneel/work/ociv-gatekeeper/packages/gateway-client-core/src/utils/object.ts":["20655237-5fea-4c9d-a6c8-89d47a0d9efb"],"/Users/daneel/work/ociv-gatekeeper/packages/gateway-client-core/src/version.ts":["20655237-5fea-4c9d-a6c8-89d47a0d9efb","4900e651-00ab-4d67-adf1-d6d780fdf508"],"/Users/daneel/work/ociv-gatekeeper/packages/gateway-client-core/src/state/ui.ts":["20655237-5fea-4c9d-a6c8-89d47a0d9efb"],"/Users/daneel/work/ociv-gatekeeper/packages/gateway-client-core/src/ui.ts":["20655237-5fea-4c9d-a6c8-89d47a0d9efb"],"/Users/daneel/work/ociv-gatekeeper/packages/gateway-client-core/src/types/eventInterface.ts":["20655237-5fea-4c9d-a6c8-89d47a0d9efb"],"/Users/daneel/work/ociv-gatekeeper/packages/gateway-client-core/src/utils/analytics.ts":["20655237-5fea-4c9d-a6c8-89d47a0d9efb"]},"externalIds":{}}
# gateway client core
## 1.1.3 - Add credential expiration support
- Handle expired credential and send relevant information to the iframe
## 1.1.2 - Add reset method & bug-fixes

@@ -4,0 +7,0 @@ - Add reset method for reinitializing the client-core state

@@ -9,2 +9,7 @@ import { ChainType } from './types/chain';

};
constraints?: {
expiry?: {
maxRefreshPeriodSeconds: number;
};
};
};

@@ -11,0 +16,0 @@ export type GknDataChain = {

@@ -17,4 +17,7 @@ import { GatewayCoreState } from '../types/gatewayCore';

export declare const calculateRefreshStatus: (state: GatewayCoreState) => CalculateRefreshStatusReturnType | undefined;
export type CredentialExpiredRefreshRequiredReturnType = GatewayTokenCheckType | ExtendedGatewayStatus.REFRESH_CREDENTIAL_EXPIRED | ExtendedGatewayStatus.REFRESH_CREDENTIAL_EXPIRED_START;
export declare const calculateExpiredCredentialStatus: (state: GatewayCoreState) => CredentialExpiredRefreshRequiredReturnType | undefined;
export type ComputeRefreshStatusReturnType = InternalGatewayStatus | ExtendedGatewayStatus.REFRESH_AWAITING_ON_CHAIN_TOKEN | ExtendedGatewayStatus.CHAIN_TRANSACTION_ERROR | ExtendedGatewayStatus.REFRESH_AWAITING_TRANSACTION_SEND | ExtendedGatewayStatus.REFRESH_AWAITING_THIRD_PARTY_TRANSACTION_SEND | ExtendedGatewayStatus.REFRESH_USER_INFORMATION_VALIDATED;
export declare const computeRefreshStatus: (state: GatewayCoreState) => ComputeRefreshStatusReturnType;
export declare const computeRefreshCredentialExpiredStatus: (state: GatewayCoreState) => ComputeRefreshStatusReturnType;
export type CalculateFromRefreshAwaitingOnChainReturnType = InternalGatewayStatus | ExtendedGatewayStatus.CHAIN_TIMEOUT_ERROR;

@@ -21,0 +24,0 @@ export declare const calculateFromRefreshAwaitingOnChain: (state: GatewayCoreState) => CalculateFromRefreshAwaitingOnChainReturnType | undefined;

@@ -24,2 +24,3 @@ export declare enum CivicPassMessageEventResult {

CHAIN_ERROR = "chainError",
CREDENTIAL_EXPIRED = "credentialExpired",
SIGN_TRANSACTION = "signTransaction",

@@ -26,0 +27,0 @@ AWAITING_TRANSACTION_CONFIRMATION = "awaitingTransactionConfirmation",

export declare enum FlowType {
ISSUANCE = "issuance",
REFRESH = "refresh",
REFRESH_EXPIRED_CREDENTIAL = "refreshExpiredCredential",
STATUS = "status",

@@ -5,0 +6,0 @@ REVOCATION = "revocation",

@@ -46,2 +46,3 @@ import { RequestInitRetryParams } from 'fetch-retry';

preApprovedTxAvailable?: boolean;
credentialExpired?: boolean;
pending?: {

@@ -48,0 +49,0 @@ presentationRequestId: string;

@@ -43,2 +43,4 @@ export declare enum GatewayStatus {

REFRESH_AWAITING_ON_CHAIN_TOKEN = "REFRESH_AWAITING_ON_CHAIN_TOKEN",
REFRESH_CREDENTIAL_EXPIRED = "REFRESH_CREDENTIAL_EXPIRED",
REFRESH_CREDENTIAL_EXPIRED_START = "REFRESH_CREDENTIAL_EXPIRED_START",
RESTART_REFRESH = "RESTART_REFRESH",

@@ -45,0 +47,0 @@ REFRESH_CLIENT_SENDS_REQUEST_NEW_TX = "REFRESH_CLIENT_SENDS_REQUEST_NEW_TX",

@@ -39,2 +39,3 @@ import { GknData } from '../../src/gatekeeperNetworkService';

hideWalletPrompts?: boolean;
credentialExpired?: boolean;
civicClient: string;

@@ -41,0 +42,0 @@ stage?: string;

@@ -38,2 +38,3 @@ import { LogLevel } from './log';

forceRequireRefresh?: boolean;
credentialExpired?: boolean;
};

@@ -1,1 +0,1 @@

export declare const VERSION = "@civic/gateway-client-core:1.1.2-beta.0";
export declare const VERSION = "@civic/gateway-client-core:1.1.2-beta.1";
{
"name": "@civic/gateway-client-core",
"version": "1.1.2-beta.1",
"version": "1.1.3-alpha.1",
"description": "Sample project for creating typescript library with support of iife and types.",

@@ -69,3 +69,3 @@ "keywords": [],

},
"gitHead": "4fbdd7515d09ae1b1ec3561ba658e848e4bb4090"
"gitHead": "19ee596d4688e1aee0adc88ef3f7f32001176501"
}

@@ -17,2 +17,7 @@ import { ChainType } from './types/chain';

};
constraints?: {
expiry?: {
maxRefreshPeriodSeconds: number;
};
};
};

@@ -19,0 +24,0 @@

@@ -70,3 +70,4 @@ import { FlowParameters, GatewayCoreState } from '../types/gatewayCore';

stage: state.inputs?.parameters?.stage,
credentialExpired: !!state.inputs.gatekeeperRecord?.received?.payload?.credentialExpired, // track this so we can set the correct flowType to make the iframe do a document rescan to "refresh"
};
};

@@ -17,2 +17,3 @@ import { prefixLogger } from '../logger';

computeRefreshAwaitingOnChainToken,
computeRefreshCredentialExpiredStatus,
computeRefreshInReview,

@@ -175,2 +176,3 @@ computeRefreshRequested,

ExtendedGatewayStatus.REFRESH_CLIENT_SENDS_START_NEW_TX,
ExtendedGatewayStatus.REFRESH_CREDENTIAL_EXPIRED,
],

@@ -387,2 +389,14 @@ computeRefreshStatus

),
[ExtendedGatewayStatus.REFRESH_CREDENTIAL_EXPIRED]: createTransition(
[...gatewayTokenStatuses, ...errorStatuses, ExtendedGatewayStatus.REFRESH_CREDENTIAL_EXPIRED_START],
computeRefreshCredentialExpiredStatus
),
[ExtendedGatewayStatus.REFRESH_CREDENTIAL_EXPIRED_START]: createTransition(
[
...gatewayTokenStatuses,
ExtendedGatewayStatus.REFRESH_USER_INFORMATION_VALIDATED,
ExtendedGatewayStatus.REFRESH_CLIENT_SENDS_START_NEW_TX,
],
computeRefreshStatus
),
};

@@ -389,0 +403,0 @@

@@ -1,2 +0,2 @@

import { GatewayCoreState } from '../types/gatewayCore';
import { GatewayCoreState, GatewayInput } from '../types/gatewayCore';
import { ExtendedGatewayStatus, GatewayStatus, InternalGatewayStatus } from '../types/gateway';

@@ -12,3 +12,3 @@ import {

import { CivicPassMessageAction, CivicPassMessageEventResult } from '../types/civicPass';
import { GatekeeperAPIStatus } from '../types/gatekeeperApi';
import { GatekeeperAPIStatus, GatekeeperRecordResponse } from '../types/gatekeeperApi';
import { ChainConfirmationTimeout, ErrorCode } from '../utils/errors';

@@ -124,2 +124,6 @@ import { preApprovedTxAvailable } from './issuance';

const refreshCredentialRequired = (gatekeeperRecord: GatewayInput<GatekeeperRecordResponse> | undefined): boolean => {
return !!gatekeeperRecord?.received?.payload?.credentialExpired;
};
export const calculateRefreshStatus = (state: GatewayCoreState): CalculateRefreshStatusReturnType | undefined => {

@@ -133,3 +137,12 @@ const civicPassEvent = state.inputs.civicPass?.received;

}
// Once we're in REFRESH_CREDENTIAL_EXPIRED_START status we don't want to go back to REFRESH_CREDENTIAL_EXPIRED
if (
(state?.internal?.status || '') !== ExtendedGatewayStatus.REFRESH_CREDENTIAL_EXPIRED_START &&
refreshCredentialRequired(state.inputs.gatekeeperRecord)
) {
return ExtendedGatewayStatus.REFRESH_CREDENTIAL_EXPIRED;
}
if (
civicPassEvent?.action === CivicPassMessageAction.REFRESH &&

@@ -142,2 +155,18 @@ civicPassEvent?.event === CivicPassMessageEventResult.SUCCESS

export type CredentialExpiredRefreshRequiredReturnType =
| GatewayTokenCheckType
| ExtendedGatewayStatus.REFRESH_CREDENTIAL_EXPIRED
| ExtendedGatewayStatus.REFRESH_CREDENTIAL_EXPIRED_START;
export const calculateExpiredCredentialStatus = (
state: GatewayCoreState
): CredentialExpiredRefreshRequiredReturnType | undefined => {
if (
state.inputs.civicPass.received?.action === CivicPassMessageAction.CREDENTIAL_EXPIRED &&
state.inputs.civicPass.received.event === CivicPassMessageEventResult.SUCCESS
) {
return ExtendedGatewayStatus.REFRESH_CREDENTIAL_EXPIRED_START;
}
};
export type ComputeRefreshStatusReturnType =

@@ -157,2 +186,8 @@ | InternalGatewayStatus

export const computeRefreshCredentialExpiredStatus = (state: GatewayCoreState): ComputeRefreshStatusReturnType =>
tokenNotRefreshRequired(state) ||
statusIfGatekeeperRecordRejected(state) ||
calculateExpiredCredentialStatus(state) ||
(state.internal?.status as InternalGatewayStatus);
export type CalculateFromRefreshAwaitingOnChainReturnType =

@@ -159,0 +194,0 @@ | InternalGatewayStatus

@@ -53,2 +53,4 @@ import { CivicPassMessageAction } from '../types/civicPass';

CivicPassMessageAction.TOKEN_REFRESH_IN_REVIEW,
[ExtendedGatewayStatus.REFRESH_CREDENTIAL_EXPIRED]: CivicPassMessageAction.CREDENTIAL_EXPIRED,
[ExtendedGatewayStatus.REFRESH_CREDENTIAL_EXPIRED_START]: CivicPassMessageAction.REFRESH,
};

@@ -74,2 +76,6 @@

return GatewayStatus.NOT_REQUESTED;
case ExtendedGatewayStatus.REFRESH_CREDENTIAL_EXPIRED:
return GatewayStatus.REFRESH_TOKEN_REQUIRED;
case ExtendedGatewayStatus.REFRESH_CREDENTIAL_EXPIRED_START:
return GatewayStatus.REFRESH_TOKEN_REQUIRED;
case ExtendedGatewayStatus.RESTART_REFRESH:

@@ -76,0 +82,0 @@ return GatewayStatus.REFRESH_TOKEN_REQUIRED;

@@ -25,2 +25,3 @@ export enum CivicPassMessageEventResult {

CHAIN_ERROR = 'chainError',
CREDENTIAL_EXPIRED = 'credentialExpired',
SIGN_TRANSACTION = 'signTransaction',

@@ -27,0 +28,0 @@ AWAITING_TRANSACTION_CONFIRMATION = 'awaitingTransactionConfirmation',

export enum FlowType {
ISSUANCE = 'issuance',
REFRESH = 'refresh',
REFRESH_EXPIRED_CREDENTIAL = 'refreshExpiredCredential',
STATUS = 'status',

@@ -5,0 +6,0 @@ REVOCATION = 'revocation',

@@ -52,2 +52,3 @@ import { RequestInitRetryParams } from 'fetch-retry';

preApprovedTxAvailable?: boolean;
credentialExpired?: boolean;
pending?: { presentationRequestId: string };

@@ -54,0 +55,0 @@ };

@@ -47,2 +47,4 @@ export enum GatewayStatus {

REFRESH_AWAITING_ON_CHAIN_TOKEN = 'REFRESH_AWAITING_ON_CHAIN_TOKEN',
REFRESH_CREDENTIAL_EXPIRED = 'REFRESH_CREDENTIAL_EXPIRED', // refreshing the token will require a new document scan because the previous one is expired
REFRESH_CREDENTIAL_EXPIRED_START = 'REFRESH_CREDENTIAL_EXPIRED_START', // refreshing the token will require a new document scan because the previous one is expired
RESTART_REFRESH = 'RESTART_REFRESH', // the user needs to restart the flow

@@ -49,0 +51,0 @@ REFRESH_CLIENT_SENDS_REQUEST_NEW_TX = 'REFRESH_CLIENT_SENDS_REQUEST_NEW_TX', // triggers a request to the gatekeeper for a new transaction

@@ -42,2 +42,3 @@ import { GknData } from '../../src/gatekeeperNetworkService';

hideWalletPrompts?: boolean;
credentialExpired?: boolean;
// Set to params.xCivicClientHeader if passed in, otherwise this package's (core) version from package.json.

@@ -44,0 +45,0 @@ civicClient: string;

@@ -43,2 +43,3 @@ import { LogLevel } from './log';

forceRequireRefresh?: boolean; // when set to true, initiates the refresh flow if the user has an active token
credentialExpired?: boolean; // track this so we can set the correct flowType to make the iframe do a document rescan to "refresh"
};

@@ -31,2 +31,7 @@ import { FlowStatus, FlowType } from '../types/flow';

});
if (tokenRefreshRequired && state.inputs.dynamicParameters?.credentialExpired) {
return FlowType.REFRESH_EXPIRED_CREDENTIAL;
}
if (

@@ -33,0 +38,0 @@ tokenRefreshRequired ||

// This is an auto-generated file. Do not edit.
export const VERSION = '@civic/gateway-client-core:1.1.2-beta.1';
export const VERSION = '@civic/gateway-client-core:1.1.3-alpha.1';

@@ -589,2 +589,23 @@ import GatewayClientCore, {

expectRefreshTokenRequiredWithExpiredCredential() {
expect(this.clientOutput.gatewayStatus).to.equal(GatewayStatus.REFRESH_TOKEN_REQUIRED);
this.expectFlowParameterInputs({ credentialExpired: true });
}
expectCredentialExpired() {
expect(this.clientOutput.gatewayStatus).to.equal(GatewayStatus.REFRESH_TOKEN_REQUIRED);
this.expectFlowParameterInputs({ action: CivicPassMessageAction.CREDENTIAL_EXPIRED });
}
async simulateCredentialExpiredSuccessEvent() {
this.emitter.emit('message', {
data: {
instanceId: this.client.instanceId,
source: '',
event: CivicPassMessageEventResult.SUCCESS,
action: CivicPassMessageAction.CREDENTIAL_EXPIRED,
},
});
}
expectCivicSignResponse(postMessageInput: any) {

@@ -591,0 +612,0 @@ expect(this.postMessageCallbackStub).to.have.been.calledWith(postMessageInput);

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc