@civic/gateway-client-core
Advanced tools
Comparing version 1.1.0 to 1.1.1-beta.0
@@ -1,1 +0,1 @@ | ||
{"processes":{"72cd20c0-7965-4b5c-b75a-37ebf57bfebb":{"parent":null,"children":[]},"76d6bce0-1a4b-4772-965c-81c03cc79795":{"parent":null,"children":[]}},"files":{"/Users/kevincolgan/code/ociv-gatekeeper/packages/gateway-client-core/src/config.ts":["72cd20c0-7965-4b5c-b75a-37ebf57bfebb"],"/Users/kevincolgan/code/ociv-gatekeeper/packages/gateway-client-core/src/gatekeeperClient.ts":["72cd20c0-7965-4b5c-b75a-37ebf57bfebb"],"/Users/kevincolgan/code/ociv-gatekeeper/packages/gateway-client-core/src/utils/url.ts":["72cd20c0-7965-4b5c-b75a-37ebf57bfebb"],"/Users/kevincolgan/code/ociv-gatekeeper/packages/gateway-client-core/src/logger/index.ts":["72cd20c0-7965-4b5c-b75a-37ebf57bfebb"],"/Users/kevincolgan/code/ociv-gatekeeper/packages/gateway-client-core/src/logger/local.logger.ts":["72cd20c0-7965-4b5c-b75a-37ebf57bfebb"],"/Users/kevincolgan/code/ociv-gatekeeper/packages/gateway-client-core/src/logger/provider.logger.ts":["72cd20c0-7965-4b5c-b75a-37ebf57bfebb"],"/Users/kevincolgan/code/ociv-gatekeeper/packages/gateway-client-core/src/types/log.ts":["72cd20c0-7965-4b5c-b75a-37ebf57bfebb"],"/Users/kevincolgan/code/ociv-gatekeeper/packages/gateway-client-core/src/types/gatekeeperApi.ts":["72cd20c0-7965-4b5c-b75a-37ebf57bfebb"],"/Users/kevincolgan/code/ociv-gatekeeper/packages/gateway-client-core/src/types/chain.ts":["72cd20c0-7965-4b5c-b75a-37ebf57bfebb"],"/Users/kevincolgan/code/ociv-gatekeeper/packages/gateway-client-core/src/gatekeeperNetworkService.ts":["72cd20c0-7965-4b5c-b75a-37ebf57bfebb"],"/Users/kevincolgan/code/ociv-gatekeeper/packages/gateway-client-core/src/GatewayClientCore.ts":["72cd20c0-7965-4b5c-b75a-37ebf57bfebb"],"/Users/kevincolgan/code/ociv-gatekeeper/packages/gateway-client-core/src/orchestrate.ts":["72cd20c0-7965-4b5c-b75a-37ebf57bfebb"],"/Users/kevincolgan/code/ociv-gatekeeper/packages/gateway-client-core/src/listeners.ts":["72cd20c0-7965-4b5c-b75a-37ebf57bfebb"],"/Users/kevincolgan/code/ociv-gatekeeper/packages/gateway-client-core/src/types/civicPass.ts":["72cd20c0-7965-4b5c-b75a-37ebf57bfebb"],"/Users/kevincolgan/code/ociv-gatekeeper/packages/gateway-client-core/src/types/civicSign.ts":["72cd20c0-7965-4b5c-b75a-37ebf57bfebb"],"/Users/kevincolgan/code/ociv-gatekeeper/packages/gateway-client-core/src/types/fetch.ts":["72cd20c0-7965-4b5c-b75a-37ebf57bfebb"],"/Users/kevincolgan/code/ociv-gatekeeper/packages/gateway-client-core/src/types/gateway.ts":["72cd20c0-7965-4b5c-b75a-37ebf57bfebb"],"/Users/kevincolgan/code/ociv-gatekeeper/packages/gateway-client-core/src/utils/inputs.ts":["72cd20c0-7965-4b5c-b75a-37ebf57bfebb"],"/Users/kevincolgan/code/ociv-gatekeeper/packages/gateway-client-core/src/remoteSign.ts":["72cd20c0-7965-4b5c-b75a-37ebf57bfebb"],"/Users/kevincolgan/code/ociv-gatekeeper/packages/gateway-client-core/src/utils/errors.ts":["72cd20c0-7965-4b5c-b75a-37ebf57bfebb"],"/Users/kevincolgan/code/ociv-gatekeeper/packages/gateway-client-core/src/issuance.ts":["72cd20c0-7965-4b5c-b75a-37ebf57bfebb"],"/Users/kevincolgan/code/ociv-gatekeeper/packages/gateway-client-core/src/orchestratorFlow.ts":["72cd20c0-7965-4b5c-b75a-37ebf57bfebb"],"/Users/kevincolgan/code/ociv-gatekeeper/packages/gateway-client-core/src/utils/defaults.ts":["72cd20c0-7965-4b5c-b75a-37ebf57bfebb","76d6bce0-1a4b-4772-965c-81c03cc79795"],"/Users/kevincolgan/code/ociv-gatekeeper/packages/gateway-client-core/src/utils/expiry.ts":["72cd20c0-7965-4b5c-b75a-37ebf57bfebb"],"/Users/kevincolgan/code/ociv-gatekeeper/packages/gateway-client-core/src/refresh.ts":["72cd20c0-7965-4b5c-b75a-37ebf57bfebb"],"/Users/kevincolgan/code/ociv-gatekeeper/packages/gateway-client-core/src/utils/userInteraction.ts":["72cd20c0-7965-4b5c-b75a-37ebf57bfebb"],"/Users/kevincolgan/code/ociv-gatekeeper/packages/gateway-client-core/src/types/userInteraction.ts":["72cd20c0-7965-4b5c-b75a-37ebf57bfebb"],"/Users/kevincolgan/code/ociv-gatekeeper/packages/gateway-client-core/src/partnerReview.ts":["72cd20c0-7965-4b5c-b75a-37ebf57bfebb"],"/Users/kevincolgan/code/ociv-gatekeeper/packages/gateway-client-core/src/state/common.ts":["72cd20c0-7965-4b5c-b75a-37ebf57bfebb"],"/Users/kevincolgan/code/ociv-gatekeeper/packages/gateway-client-core/src/state/state.ts":["72cd20c0-7965-4b5c-b75a-37ebf57bfebb"],"/Users/kevincolgan/code/ociv-gatekeeper/packages/gateway-client-core/src/state/stateMapping.ts":["72cd20c0-7965-4b5c-b75a-37ebf57bfebb"],"/Users/kevincolgan/code/ociv-gatekeeper/packages/gateway-client-core/src/utils/flow.ts":["72cd20c0-7965-4b5c-b75a-37ebf57bfebb"],"/Users/kevincolgan/code/ociv-gatekeeper/packages/gateway-client-core/src/types/flow.ts":["72cd20c0-7965-4b5c-b75a-37ebf57bfebb"],"/Users/kevincolgan/code/ociv-gatekeeper/packages/gateway-client-core/src/state/gatewayStatus.ts":["72cd20c0-7965-4b5c-b75a-37ebf57bfebb"],"/Users/kevincolgan/code/ociv-gatekeeper/packages/gateway-client-core/src/state/error.ts":["72cd20c0-7965-4b5c-b75a-37ebf57bfebb"],"/Users/kevincolgan/code/ociv-gatekeeper/packages/gateway-client-core/src/state/initialisation.ts":["72cd20c0-7965-4b5c-b75a-37ebf57bfebb"],"/Users/kevincolgan/code/ociv-gatekeeper/packages/gateway-client-core/src/state/issuance.ts":["72cd20c0-7965-4b5c-b75a-37ebf57bfebb"],"/Users/kevincolgan/code/ociv-gatekeeper/packages/gateway-client-core/src/utils/partnerReview.ts":["72cd20c0-7965-4b5c-b75a-37ebf57bfebb"],"/Users/kevincolgan/code/ociv-gatekeeper/packages/gateway-client-core/src/state/refresh.ts":["72cd20c0-7965-4b5c-b75a-37ebf57bfebb"],"/Users/kevincolgan/code/ociv-gatekeeper/packages/gateway-client-core/src/state/flowParameters.ts":["72cd20c0-7965-4b5c-b75a-37ebf57bfebb"],"/Users/kevincolgan/code/ociv-gatekeeper/packages/gateway-client-core/src/utils/object.ts":["72cd20c0-7965-4b5c-b75a-37ebf57bfebb"],"/Users/kevincolgan/code/ociv-gatekeeper/packages/gateway-client-core/src/version.ts":["72cd20c0-7965-4b5c-b75a-37ebf57bfebb","76d6bce0-1a4b-4772-965c-81c03cc79795"],"/Users/kevincolgan/code/ociv-gatekeeper/packages/gateway-client-core/src/state/ui.ts":["72cd20c0-7965-4b5c-b75a-37ebf57bfebb"],"/Users/kevincolgan/code/ociv-gatekeeper/packages/gateway-client-core/src/ui.ts":["72cd20c0-7965-4b5c-b75a-37ebf57bfebb"],"/Users/kevincolgan/code/ociv-gatekeeper/packages/gateway-client-core/src/types/eventInterface.ts":["72cd20c0-7965-4b5c-b75a-37ebf57bfebb"],"/Users/kevincolgan/code/ociv-gatekeeper/packages/gateway-client-core/src/utils/analytics.ts":["72cd20c0-7965-4b5c-b75a-37ebf57bfebb"]},"externalIds":{}} | ||
{"processes":{"9dbe6272-d51c-447d-9d1b-a1fe3d68eb3c":{"parent":null,"children":[]},"e352ae99-7ce1-47fd-aa9f-9a17fd3cb19f":{"parent":null,"children":[]}},"files":{"/Users/lucas/dev/civic/ociv-gatekeeper/packages/gateway-client-core/src/utils/defaults.ts":["9dbe6272-d51c-447d-9d1b-a1fe3d68eb3c","e352ae99-7ce1-47fd-aa9f-9a17fd3cb19f"],"/Users/lucas/dev/civic/ociv-gatekeeper/packages/gateway-client-core/src/version.ts":["9dbe6272-d51c-447d-9d1b-a1fe3d68eb3c","e352ae99-7ce1-47fd-aa9f-9a17fd3cb19f"],"/Users/lucas/dev/civic/ociv-gatekeeper/packages/gateway-client-core/src/config.ts":["e352ae99-7ce1-47fd-aa9f-9a17fd3cb19f"],"/Users/lucas/dev/civic/ociv-gatekeeper/packages/gateway-client-core/src/gatekeeperClient.ts":["e352ae99-7ce1-47fd-aa9f-9a17fd3cb19f"],"/Users/lucas/dev/civic/ociv-gatekeeper/packages/gateway-client-core/src/utils/url.ts":["e352ae99-7ce1-47fd-aa9f-9a17fd3cb19f"],"/Users/lucas/dev/civic/ociv-gatekeeper/packages/gateway-client-core/src/logger/index.ts":["e352ae99-7ce1-47fd-aa9f-9a17fd3cb19f"],"/Users/lucas/dev/civic/ociv-gatekeeper/packages/gateway-client-core/src/logger/local.logger.ts":["e352ae99-7ce1-47fd-aa9f-9a17fd3cb19f"],"/Users/lucas/dev/civic/ociv-gatekeeper/packages/gateway-client-core/src/logger/provider.logger.ts":["e352ae99-7ce1-47fd-aa9f-9a17fd3cb19f"],"/Users/lucas/dev/civic/ociv-gatekeeper/packages/gateway-client-core/src/types/log.ts":["e352ae99-7ce1-47fd-aa9f-9a17fd3cb19f"],"/Users/lucas/dev/civic/ociv-gatekeeper/packages/gateway-client-core/src/types/gatekeeperApi.ts":["e352ae99-7ce1-47fd-aa9f-9a17fd3cb19f"],"/Users/lucas/dev/civic/ociv-gatekeeper/packages/gateway-client-core/src/types/chain.ts":["e352ae99-7ce1-47fd-aa9f-9a17fd3cb19f"],"/Users/lucas/dev/civic/ociv-gatekeeper/packages/gateway-client-core/src/gatekeeperNetworkService.ts":["e352ae99-7ce1-47fd-aa9f-9a17fd3cb19f"],"/Users/lucas/dev/civic/ociv-gatekeeper/packages/gateway-client-core/src/GatewayClientCore.ts":["e352ae99-7ce1-47fd-aa9f-9a17fd3cb19f"],"/Users/lucas/dev/civic/ociv-gatekeeper/packages/gateway-client-core/src/orchestrate.ts":["e352ae99-7ce1-47fd-aa9f-9a17fd3cb19f"],"/Users/lucas/dev/civic/ociv-gatekeeper/packages/gateway-client-core/src/listeners.ts":["e352ae99-7ce1-47fd-aa9f-9a17fd3cb19f"],"/Users/lucas/dev/civic/ociv-gatekeeper/packages/gateway-client-core/src/types/civicPass.ts":["e352ae99-7ce1-47fd-aa9f-9a17fd3cb19f"],"/Users/lucas/dev/civic/ociv-gatekeeper/packages/gateway-client-core/src/types/civicSign.ts":["e352ae99-7ce1-47fd-aa9f-9a17fd3cb19f"],"/Users/lucas/dev/civic/ociv-gatekeeper/packages/gateway-client-core/src/types/fetch.ts":["e352ae99-7ce1-47fd-aa9f-9a17fd3cb19f"],"/Users/lucas/dev/civic/ociv-gatekeeper/packages/gateway-client-core/src/types/gateway.ts":["e352ae99-7ce1-47fd-aa9f-9a17fd3cb19f"],"/Users/lucas/dev/civic/ociv-gatekeeper/packages/gateway-client-core/src/utils/inputs.ts":["e352ae99-7ce1-47fd-aa9f-9a17fd3cb19f"],"/Users/lucas/dev/civic/ociv-gatekeeper/packages/gateway-client-core/src/remoteSign.ts":["e352ae99-7ce1-47fd-aa9f-9a17fd3cb19f"],"/Users/lucas/dev/civic/ociv-gatekeeper/packages/gateway-client-core/src/utils/errors.ts":["e352ae99-7ce1-47fd-aa9f-9a17fd3cb19f"],"/Users/lucas/dev/civic/ociv-gatekeeper/packages/gateway-client-core/src/issuance.ts":["e352ae99-7ce1-47fd-aa9f-9a17fd3cb19f"],"/Users/lucas/dev/civic/ociv-gatekeeper/packages/gateway-client-core/src/orchestratorFlow.ts":["e352ae99-7ce1-47fd-aa9f-9a17fd3cb19f"],"/Users/lucas/dev/civic/ociv-gatekeeper/packages/gateway-client-core/src/utils/expiry.ts":["e352ae99-7ce1-47fd-aa9f-9a17fd3cb19f"],"/Users/lucas/dev/civic/ociv-gatekeeper/packages/gateway-client-core/src/refresh.ts":["e352ae99-7ce1-47fd-aa9f-9a17fd3cb19f"],"/Users/lucas/dev/civic/ociv-gatekeeper/packages/gateway-client-core/src/utils/userInteraction.ts":["e352ae99-7ce1-47fd-aa9f-9a17fd3cb19f"],"/Users/lucas/dev/civic/ociv-gatekeeper/packages/gateway-client-core/src/types/userInteraction.ts":["e352ae99-7ce1-47fd-aa9f-9a17fd3cb19f"],"/Users/lucas/dev/civic/ociv-gatekeeper/packages/gateway-client-core/src/partnerReview.ts":["e352ae99-7ce1-47fd-aa9f-9a17fd3cb19f"],"/Users/lucas/dev/civic/ociv-gatekeeper/packages/gateway-client-core/src/state/common.ts":["e352ae99-7ce1-47fd-aa9f-9a17fd3cb19f"],"/Users/lucas/dev/civic/ociv-gatekeeper/packages/gateway-client-core/src/state/state.ts":["e352ae99-7ce1-47fd-aa9f-9a17fd3cb19f"],"/Users/lucas/dev/civic/ociv-gatekeeper/packages/gateway-client-core/src/state/stateMapping.ts":["e352ae99-7ce1-47fd-aa9f-9a17fd3cb19f"],"/Users/lucas/dev/civic/ociv-gatekeeper/packages/gateway-client-core/src/utils/flow.ts":["e352ae99-7ce1-47fd-aa9f-9a17fd3cb19f"],"/Users/lucas/dev/civic/ociv-gatekeeper/packages/gateway-client-core/src/types/flow.ts":["e352ae99-7ce1-47fd-aa9f-9a17fd3cb19f"],"/Users/lucas/dev/civic/ociv-gatekeeper/packages/gateway-client-core/src/state/gatewayStatus.ts":["e352ae99-7ce1-47fd-aa9f-9a17fd3cb19f"],"/Users/lucas/dev/civic/ociv-gatekeeper/packages/gateway-client-core/src/state/error.ts":["e352ae99-7ce1-47fd-aa9f-9a17fd3cb19f"],"/Users/lucas/dev/civic/ociv-gatekeeper/packages/gateway-client-core/src/state/initialisation.ts":["e352ae99-7ce1-47fd-aa9f-9a17fd3cb19f"],"/Users/lucas/dev/civic/ociv-gatekeeper/packages/gateway-client-core/src/state/issuance.ts":["e352ae99-7ce1-47fd-aa9f-9a17fd3cb19f"],"/Users/lucas/dev/civic/ociv-gatekeeper/packages/gateway-client-core/src/utils/partnerReview.ts":["e352ae99-7ce1-47fd-aa9f-9a17fd3cb19f"],"/Users/lucas/dev/civic/ociv-gatekeeper/packages/gateway-client-core/src/state/refresh.ts":["e352ae99-7ce1-47fd-aa9f-9a17fd3cb19f"],"/Users/lucas/dev/civic/ociv-gatekeeper/packages/gateway-client-core/src/state/flowParameters.ts":["e352ae99-7ce1-47fd-aa9f-9a17fd3cb19f"],"/Users/lucas/dev/civic/ociv-gatekeeper/packages/gateway-client-core/src/utils/object.ts":["e352ae99-7ce1-47fd-aa9f-9a17fd3cb19f"],"/Users/lucas/dev/civic/ociv-gatekeeper/packages/gateway-client-core/src/state/ui.ts":["e352ae99-7ce1-47fd-aa9f-9a17fd3cb19f"],"/Users/lucas/dev/civic/ociv-gatekeeper/packages/gateway-client-core/src/ui.ts":["e352ae99-7ce1-47fd-aa9f-9a17fd3cb19f"],"/Users/lucas/dev/civic/ociv-gatekeeper/packages/gateway-client-core/src/types/eventInterface.ts":["e352ae99-7ce1-47fd-aa9f-9a17fd3cb19f"],"/Users/lucas/dev/civic/ociv-gatekeeper/packages/gateway-client-core/src/utils/analytics.ts":["e352ae99-7ce1-47fd-aa9f-9a17fd3cb19f"]},"externalIds":{}} |
@@ -5,3 +5,2 @@ # gateway client core | ||
Handle, parse and return any civic-sign errors as an ERROR_RESPONSE | ||
Add requestId to remote sign responses | ||
@@ -8,0 +7,0 @@ ## 1.0.8 - ICP chain type |
@@ -19,7 +19,7 @@ import { ChainClientInterface, DID, ProveWalletOwnershipResponse, SignatureMethod } from './types/chain'; | ||
constructor(postMessageTarget: EventEmitter, instanceId: string); | ||
sendPublicKey(publicKey: string): void; | ||
sendDid(did: string): void; | ||
sendSignedProof(proof: string, signatureMethod: SignatureMethod): void; | ||
sendSignedMessage(message: Uint8Array): void; | ||
sendError(request: CivicSignEventTypeRequest, error: Error | ChainError): void; | ||
sendPublicKey(requestId: string, publicKey: string): void; | ||
sendDid(requestId: string, did: string): void; | ||
sendSignedProof(requestId: string, proof: string, signatureMethod: SignatureMethod): void; | ||
sendSignedMessage(requestId: string, message: Uint8Array): void; | ||
sendError(requestId: string, request: CivicSignEventTypeRequest, error: Error | ChainError): void; | ||
private emit; | ||
@@ -26,0 +26,0 @@ } |
@@ -5,1 +5,2 @@ import { InternalGatewayStatus } from '../types/gateway'; | ||
export declare const handleGatekeeperError: (state: GatewayCoreState) => InternalGatewayStatus; | ||
export declare const handleUserValidationFailed: (state: GatewayCoreState) => InternalGatewayStatus; |
@@ -0,1 +1,2 @@ | ||
import { ChainError } from '../utils/errors'; | ||
import { SignatureMethod } from './chain'; | ||
@@ -19,8 +20,10 @@ import { CivicPassMessageBase } from './civicPass'; | ||
payload?: Uint8Array | string; | ||
requestId: string; | ||
} | ||
export interface RemoteSign { | ||
sendPublicKey: (publicKey: string) => void; | ||
sendDid: (did: string) => void; | ||
sendSignedProof: (proof: string, signatureMethod: SignatureMethod) => void; | ||
sendSignedMessage: (message: Uint8Array) => void; | ||
sendPublicKey: (requestId: string, publicKey: string) => void; | ||
sendDid: (requestId: string, did: string) => void; | ||
sendSignedProof: (requestId: string, proof: string, signatureMethod: SignatureMethod) => void; | ||
sendSignedMessage: (requestId: string, message: Uint8Array) => void; | ||
sendError: (requestId: string, request: CivicSignEventTypeRequest, error: Error | ChainError) => void; | ||
} | ||
@@ -27,0 +30,0 @@ export type CivicSignResponseEvent = { |
@@ -26,2 +26,3 @@ export declare enum GatewayStatus { | ||
TOKEN_REFRESH_IN_REVIEW = "TOKEN_REFRESH_IN_REVIEW", | ||
USER_VALIDATION_FAILED = "USER_VALIDATION_FAILED", | ||
RESTART = "RESTART", | ||
@@ -28,0 +29,0 @@ CHAIN_SIGN_MESSAGE_ERROR = "CHAIN_SIGN_MESSAGE_ERROR", |
@@ -7,2 +7,3 @@ import { LogLevel } from './log'; | ||
clientSendsMaxRetries?: number; | ||
disableAutoRestartOnValidationFailure?: boolean; | ||
}; | ||
@@ -9,0 +10,0 @@ export interface WalletAdapter { |
{ | ||
"name": "@civic/gateway-client-core", | ||
"version": "1.1.0", | ||
"version": "1.1.1-beta.0", | ||
"description": "Sample project for creating typescript library with support of iife and types.", | ||
@@ -69,3 +69,3 @@ "main": "dist/civic-gateway-client-core.min.js", | ||
"license": "MIT", | ||
"gitHead": "5067572cd47ead04a802726b82a405de4ff1eb91" | ||
"gitHead": "c224a36ac2cff51dcc1af19f07c1942c9075a0b6" | ||
} |
@@ -40,33 +40,38 @@ import { prefixLogger } from './logger'; | ||
public sendPublicKey(publicKey: string) { | ||
public sendPublicKey(requestId: string, publicKey: string) { | ||
this.emit({ | ||
event: CivicSignEventTypeResponse.RESPONSE_PUBLIC_KEY, | ||
data: publicKey, | ||
requestId, | ||
}); | ||
} | ||
public sendDid(did: string) { | ||
public sendDid(requestId: string, did: string) { | ||
this.emit({ | ||
event: CivicSignEventTypeResponse.RESPONSE_DID, | ||
data: did, | ||
requestId, | ||
}); | ||
} | ||
public sendSignedProof(proof: string, signatureMethod: SignatureMethod) { | ||
public sendSignedProof(requestId: string, proof: string, signatureMethod: SignatureMethod) { | ||
this.emit({ | ||
event: CivicSignEventTypeResponse.RESPONSE_SIGNED_PROOF, | ||
data: { proof, signatureMethod }, | ||
requestId, | ||
}); | ||
} | ||
public sendSignedMessage(message: Uint8Array) { | ||
public sendSignedMessage(requestId: string, message: Uint8Array) { | ||
this.emit({ | ||
event: CivicSignEventTypeResponse.RESPONSE_SIGNED_MESSAGE, | ||
data: message, | ||
requestId, | ||
}); | ||
} | ||
public sendError(request: CivicSignEventTypeRequest, error: Error | ChainError) { | ||
public sendError(requestId: string, request: CivicSignEventTypeRequest, error: Error | ChainError) { | ||
this.emit({ | ||
event: CivicSignEventTypeResponse.RESPONSE_ERROR, | ||
requestId, | ||
data: { | ||
@@ -106,7 +111,7 @@ request, | ||
if (message.request === CivicSignEventTypeRequest.REQUEST_PUBLIC_KEY) { | ||
remoteSignerInst?.sendPublicKey(wallet.address); | ||
remoteSignerInst?.sendPublicKey(message.requestId, wallet.address); | ||
return wallet.address; | ||
} | ||
if (message.request === CivicSignEventTypeRequest.REQUEST_DID) { | ||
remoteSignerInst?.sendDid(ownerDids?.[0]); | ||
remoteSignerInst?.sendDid(message.requestId, ownerDids?.[0]); | ||
return ownerDids?.[0]; | ||
@@ -116,3 +121,3 @@ } | ||
const powoResponse = await chainImplementation.proveWalletOwnership(message.payload as string); | ||
remoteSignerInst?.sendSignedProof(powoResponse.proof, powoResponse.signatureMethod); | ||
remoteSignerInst?.sendSignedProof(message.requestId, powoResponse.proof, powoResponse.signatureMethod); | ||
return { proof: powoResponse.proof, signatureMethod: powoResponse.signatureMethod }; | ||
@@ -126,3 +131,3 @@ } | ||
const signMessageResponse = await chainImplementation.signMessage?.(Buffer.from(message.payload)); | ||
remoteSignerInst?.sendSignedMessage(signMessageResponse); | ||
remoteSignerInst?.sendSignedMessage(message.requestId, signMessageResponse); | ||
return signMessageResponse; | ||
@@ -135,3 +140,3 @@ } | ||
logError(`Error handling remote sign event, sending back an error response with code ${code}`, useError); | ||
remoteSignerInst?.sendError(message.request, useError); | ||
remoteSignerInst?.sendError(message.requestId, message.request, useError); | ||
return { | ||
@@ -138,0 +143,0 @@ request: message.request, |
@@ -59,1 +59,6 @@ import { DEFAULT_MAX_CLIENT_SENDS_RETRIES } from '../utils/defaults'; | ||
}; | ||
export const handleUserValidationFailed = (state: GatewayCoreState): InternalGatewayStatus => | ||
state.inputs.parameters?.options?.disableAutoRestartOnValidationFailure | ||
? ExtendedGatewayStatus.USER_VALIDATION_FAILED | ||
: ExtendedGatewayStatus.RESTART; |
@@ -5,3 +5,3 @@ import { prefixLogger } from '../logger'; | ||
import { GatewayTokenCheckType, handleGatewayTokenExistsStatus, ValidationGatewayStatusType } from './common'; | ||
import { handleChainError, handleGatekeeperError } from './error'; | ||
import { handleChainError, handleGatekeeperError, handleUserValidationFailed } from './error'; | ||
import { checkForInProgress, computeInitialState } from './initialisation'; | ||
@@ -93,2 +93,3 @@ import { | ||
ExtendedGatewayStatus.ISSUANCE_RESTART_DATA_COLLECTION, | ||
ExtendedGatewayStatus.USER_VALIDATION_FAILED, | ||
], | ||
@@ -166,2 +167,6 @@ computeIssuanceStatus | ||
[GatewayStatus.VPN_NOT_SUPPORTED]: createTransition([], () => GatewayStatus.VPN_NOT_SUPPORTED), // final state | ||
[ExtendedGatewayStatus.USER_VALIDATION_FAILED]: createTransition( | ||
[ExtendedGatewayStatus.USER_VALIDATION_FAILED, ExtendedGatewayStatus.RESTART], | ||
handleUserValidationFailed | ||
), | ||
[GatewayStatus.REFRESH_TOKEN_REQUIRED]: createTransition( | ||
@@ -168,0 +173,0 @@ [ |
@@ -150,3 +150,3 @@ import { GatewayCoreState, GatewayInput } from '../types/gatewayCore'; | ||
if (civicPassEvent?.event === CivicPassMessageEventResult.FAILURE) { | ||
return ExtendedGatewayStatus.RESTART; | ||
return ExtendedGatewayStatus.USER_VALIDATION_FAILED; | ||
} | ||
@@ -219,3 +219,3 @@ const gatewayStatusFromValidationProcess = | ||
if (civicPassEvent?.event === CivicPassMessageEventResult.FAILURE) { | ||
return ExtendedGatewayStatus.RESTART; | ||
return ExtendedGatewayStatus.USER_VALIDATION_FAILED; | ||
} | ||
@@ -222,0 +222,0 @@ |
@@ -25,2 +25,3 @@ import { CivicPassMessageAction } from '../types/civicPass'; | ||
[GatewayStatus.USER_INFORMATION_REJECTED]: CivicPassMessageAction.ISSUANCE, | ||
[ExtendedGatewayStatus.USER_VALIDATION_FAILED]: CivicPassMessageAction.ISSUANCE, | ||
[ExtendedGatewayStatus.ISSUANCE_RESTART_DATA_COLLECTION]: CivicPassMessageAction.ISSUANCE, | ||
@@ -75,2 +76,4 @@ [ExtendedGatewayStatus.ISSUANCE_AWAITING_TRANSACTION_SEND]: CivicPassMessageAction.SIGN_TRANSACTION, | ||
return GatewayStatus.REFRESH_TOKEN_REQUIRED; | ||
case ExtendedGatewayStatus.USER_VALIDATION_FAILED: | ||
return GatewayStatus.ERROR; | ||
case ExtendedGatewayStatus.CHAIN_SIGN_MESSAGE_ERROR: | ||
@@ -77,0 +80,0 @@ return GatewayStatus.ERROR; |
// TODO: Duplicate types in CivicSign | ||
import { ChainError } from '../utils/errors'; | ||
import { SignatureMethod } from './chain'; | ||
@@ -25,9 +26,11 @@ import { CivicPassMessageBase } from './civicPass'; | ||
payload?: Uint8Array | string; | ||
requestId: string; | ||
} | ||
export interface RemoteSign { | ||
sendPublicKey: (publicKey: string) => void; | ||
sendDid: (did: string) => void; | ||
sendSignedProof: (proof: string, signatureMethod: SignatureMethod) => void; | ||
sendSignedMessage: (message: Uint8Array) => void; | ||
sendPublicKey: (requestId: string, publicKey: string) => void; | ||
sendDid: (requestId: string, did: string) => void; | ||
sendSignedProof: (requestId: string, proof: string, signatureMethod: SignatureMethod) => void; | ||
sendSignedMessage: (requestId: string, message: Uint8Array) => void; | ||
sendError: (requestId: string, request: CivicSignEventTypeRequest, error: Error | ChainError) => void; | ||
} | ||
@@ -34,0 +37,0 @@ |
@@ -28,2 +28,4 @@ export enum GatewayStatus { | ||
TOKEN_REFRESH_IN_REVIEW = 'TOKEN_REFRESH_IN_REVIEW', // during pii-sharing flow | ||
USER_VALIDATION_FAILED = 'USER_VALIDATION_FAILED', // during the user validation flow | ||
RESTART = 'RESTART', // the user needs to restart the flow | ||
@@ -30,0 +32,0 @@ CHAIN_SIGN_MESSAGE_ERROR = 'CHAIN_SIGN_MESSAGE_ERROR', // during civic-sign sign message request |
@@ -8,2 +8,3 @@ import { LogLevel } from './log'; | ||
clientSendsMaxRetries?: number; | ||
disableAutoRestartOnValidationFailure?: boolean; // when set to true, the flow will not be automatically restarted on user validation failure | ||
}; | ||
@@ -10,0 +11,0 @@ |
import { FlowStatus, FlowType } from '../types/flow'; | ||
import { v4 as uuid } from 'uuid'; | ||
import { GatewayStatus, InternalGatewayStatus } from '../types/gateway'; | ||
import { ExtendedGatewayStatus, GatewayStatus, InternalGatewayStatus } from '../types/gateway'; | ||
import { GatewayCoreState } from '../types/gatewayCore'; | ||
@@ -132,2 +132,7 @@ import { UserInteractionStatus } from '../types/userInteraction'; | ||
// If the user validation failed, it should be handled as a finished flow and close the iframe | ||
if (computedInternalStatus === ExtendedGatewayStatus.USER_VALIDATION_FAILED) { | ||
return FlowStatus.FINISHED; | ||
} | ||
if (state.internal?.userInteraction.status === UserInteractionStatus.STARTED) { | ||
@@ -134,0 +139,0 @@ return FlowStatus.IN_PROGRESS; |
// This is an auto-generated file. Do not edit. | ||
export const VERSION = '@civic/gateway-client-core:1.1.0'; | ||
export const VERSION = '@civic/gateway-client-core:1.1.1-beta.0'; |
@@ -99,3 +99,3 @@ import { step } from 'mocha-steps'; | ||
context(`with a civic-pass ${validationStatus} status that arrives before checking is complete`, () => { | ||
context(`with a civic-pass ${validationStatus} status that arrives before checking is complete`, () => { | ||
before(() => { | ||
@@ -136,2 +136,94 @@ testHelpers = new IntegrationTestHelpers(sandbox); | ||
}); | ||
context('with a validation failure', () => { | ||
context('with auto-restart on validation failure', () => { | ||
before(() => { | ||
testHelpers = new IntegrationTestHelpers(sandbox); | ||
testHelpers.stubSuccessfulFetchCalls(); | ||
}); | ||
after(() => { | ||
testHelpers.cleanup(); | ||
sandbox.restore(); | ||
}); | ||
step('1. expect the Gatekeeper client to successfully initialize', () => { | ||
testHelpers.initializeGatewayCore(); | ||
}); | ||
step('2. wait for GK and on-chain checks to complete', async () => { | ||
await sleep(110); | ||
}); | ||
step('3. Simulate an event for a started validation process', async () => { | ||
testHelpers.simulateDataCollectionStatusEvent(ValidationStatus.COLLECTING as ValidationStatus); | ||
}); | ||
step('5. wait for GK and on-chain checks to complete', async () => { | ||
await sleep(110); | ||
}); | ||
step('6. Expect the status to change to COLLECTING_USER_INFORMATION', async () => { | ||
testHelpers.expectRejected(GatewayStatus.COLLECTING_USER_INFORMATION); | ||
}); | ||
step('7. Simulating a civic-pass validation failure (e.g.: scope request patch rejected)', async () => { | ||
await testHelpers.simulateCivicPassFailureEvent(); | ||
}); | ||
step('8. Wait for the status change', async () => { | ||
await sleep(120); | ||
}); | ||
step('9. Expect it to re-initialize and status to be NOT_REQUESTED', async () => { | ||
testHelpers.expectRejected(GatewayStatus.NOT_REQUESTED); | ||
}); | ||
}); | ||
context('with auto-restart on validation failure disabled (disableAutoRestartOnValidationFailure)', () => { | ||
before(() => { | ||
testHelpers = new IntegrationTestHelpers(sandbox); | ||
testHelpers.stubSuccessfulFetchCalls(); | ||
}); | ||
after(() => { | ||
testHelpers.cleanup(); | ||
sandbox.restore(); | ||
}); | ||
step('1. expect the Gatekeeper client to successfully initialize', () => { | ||
testHelpers.initializeGatewayCore({ | ||
options: { | ||
disableAutoRestartOnValidationFailure: true, | ||
}, | ||
}); | ||
}); | ||
step('2. wait for GK and on-chain checks to complete', async () => { | ||
await sleep(110); | ||
}); | ||
step('3. Simulate an event for a started validation process', async () => { | ||
testHelpers.simulateDataCollectionStatusEvent(ValidationStatus.COLLECTING as ValidationStatus); | ||
}); | ||
step('5. wait for GK and on-chain checks to complete', async () => { | ||
await sleep(110); | ||
}); | ||
step('6. Expect the status to change to COLLECTING_USER_INFORMATION', async () => { | ||
testHelpers.expectRejected(GatewayStatus.COLLECTING_USER_INFORMATION); | ||
}); | ||
step('7. Simulating a civic-pass validation failure (e.g.: scope request patch rejected)', async () => { | ||
await testHelpers.simulateCivicPassFailureEvent(); | ||
}); | ||
step('8. Wait for the status change', async () => { | ||
await sleep(120); | ||
}); | ||
step('9. Expect status to be ERROR', async () => { | ||
testHelpers.expectRejected(GatewayStatus.ERROR); | ||
}); | ||
}); | ||
}); | ||
}); | ||
@@ -138,0 +230,0 @@ |
@@ -13,6 +13,7 @@ import { SinonStubbedInstance } from 'sinon'; | ||
import { ChainError } from '../src/utils/errors'; | ||
import { v4 as uuid } from 'uuid'; | ||
const { expect } = chai; | ||
const sandbox = sinon.createSandbox(); | ||
describe('remoteSign', () => { | ||
@@ -24,3 +25,3 @@ let message: CivicSignEventTypeRequestMessage; | ||
let chainImplementationStub: ChainClientInterface; | ||
let requestId: string; | ||
afterEach(sandbox.restore); | ||
@@ -31,3 +32,3 @@ | ||
did = 'did:sol:0x123'; | ||
requestId = uuid(); | ||
chainImplementationStub = { | ||
@@ -48,2 +49,3 @@ ownerDids: () => Promise.resolve([did]), | ||
let postMessageStub: sinon.SinonStub; | ||
beforeEach(() => { | ||
@@ -58,3 +60,3 @@ postMessageStub = sandbox.stub(); | ||
it('should emit an event with the public key', async () => { | ||
await remoteSignerInst.sendPublicKey(wallet.address); | ||
await remoteSignerInst.sendPublicKey(requestId, wallet.address); | ||
expect(postMessageStub).calledWith({ | ||
@@ -64,2 +66,3 @@ event: CivicSignEventTypeResponse.RESPONSE_PUBLIC_KEY, | ||
instanceId: 'test', | ||
requestId, | ||
}); | ||
@@ -71,3 +74,3 @@ }); | ||
it('should emit an event with the did', async () => { | ||
await remoteSignerInst.sendDid(did); | ||
await remoteSignerInst.sendDid(requestId, did); | ||
expect(postMessageStub).calledWith({ | ||
@@ -77,2 +80,3 @@ event: CivicSignEventTypeResponse.RESPONSE_DID, | ||
instanceId: 'test', | ||
requestId, | ||
}); | ||
@@ -84,3 +88,3 @@ }); | ||
it('should emit an event with the proof and signatureMethod', async () => { | ||
await remoteSignerInst.sendSignedProof('proof', SignatureMethod.MESSAGE); | ||
await remoteSignerInst.sendSignedProof(requestId, 'proof', SignatureMethod.MESSAGE); | ||
expect(postMessageStub).calledWith({ | ||
@@ -90,2 +94,3 @@ event: CivicSignEventTypeResponse.RESPONSE_SIGNED_PROOF, | ||
instanceId: 'test', | ||
requestId, | ||
}); | ||
@@ -97,3 +102,3 @@ }); | ||
it('should emit an event with the message', async () => { | ||
await remoteSignerInst.sendSignedMessage(Buffer.from('test_message')); | ||
await remoteSignerInst.sendSignedMessage(requestId, Buffer.from('test_message')); | ||
expect(postMessageStub).calledWith({ | ||
@@ -103,2 +108,3 @@ event: CivicSignEventTypeResponse.RESPONSE_SIGNED_MESSAGE, | ||
instanceId: 'test', | ||
requestId, | ||
}); | ||
@@ -111,2 +117,3 @@ }); | ||
await remoteSignerInst.sendError( | ||
requestId, | ||
CivicSignEventTypeRequest.REQUEST_DID, | ||
@@ -125,2 +132,3 @@ new ChainError('test_error', 'test_code') | ||
instanceId: 'test', | ||
requestId, | ||
}); | ||
@@ -136,2 +144,3 @@ }); | ||
message = { | ||
requestId, | ||
request: CivicSignEventTypeRequest.REQUEST_PUBLIC_KEY, | ||
@@ -146,3 +155,3 @@ }; | ||
}); | ||
expect(remoteSignerInstStub.sendPublicKey).calledWith(wallet.address); | ||
expect(remoteSignerInstStub.sendPublicKey).calledWith(requestId, wallet.address); | ||
}); | ||
@@ -162,2 +171,3 @@ | ||
message = { | ||
requestId, | ||
request: CivicSignEventTypeRequest.REQUEST_DID, | ||
@@ -171,3 +181,3 @@ }; | ||
}); | ||
expect(remoteSignerInstStub.sendDid).calledWith(did); | ||
expect(remoteSignerInstStub.sendDid).calledWith(requestId, did); | ||
}); | ||
@@ -188,2 +198,3 @@ | ||
message = { | ||
requestId, | ||
request: CivicSignEventTypeRequest.REQUEST_SIGNED_PROOF, | ||
@@ -212,3 +223,3 @@ payload: 'proof', | ||
}); | ||
expect(remoteSignerInstStub.sendSignedProof).calledWith('test_proof', 'test_signatureMethod'); | ||
expect(remoteSignerInstStub.sendSignedProof).calledWith(requestId, 'test_proof', 'test_signatureMethod'); | ||
}); | ||
@@ -227,4 +238,5 @@ | ||
const sendErrorArgs = remoteSignerInstStub.sendError.getCall(0).args; | ||
expect(sendErrorArgs[0]).to.equal(CivicSignEventTypeRequest.REQUEST_SIGNED_PROOF); | ||
expect(sendErrorArgs[1]).to.be.instanceOf(ChainError); | ||
expect(sendErrorArgs[0]).to.equal(requestId); | ||
expect(sendErrorArgs[1]).to.equal(CivicSignEventTypeRequest.REQUEST_SIGNED_PROOF); | ||
expect(sendErrorArgs[2]).to.be.instanceOf(ChainError); | ||
}); | ||
@@ -247,9 +259,11 @@ | ||
message = { | ||
requestId, | ||
request: CivicSignEventTypeRequest.REQUEST_SIGNED_MESSAGE, | ||
payload: 'proof', | ||
}; | ||
chainImplResponse = Buffer.from( | ||
JSON.stringify({ proof: 'test_signedMessage', signatureMethod: SignatureMethod.MESSAGE }) | ||
); | ||
signMessageStub = sinon.stub(chainImplementationStub, 'signMessage'); | ||
signMessageStub | ||
.withArgs(message.payload?.toString() as string) | ||
.resolves({ proof: 'test_signedMessage', signatureMethod: SignatureMethod.MESSAGE }); | ||
signMessageStub.withArgs(Buffer.from(message.payload?.toString() as string)).resolves(chainImplResponse); | ||
}); | ||
@@ -270,3 +284,3 @@ | ||
}); | ||
expect(remoteSignerInstStub.sendSignedMessage).calledWith(chainImplResponse); | ||
expect(remoteSignerInstStub.sendSignedMessage).calledWith(requestId, chainImplResponse); | ||
}); | ||
@@ -282,2 +296,12 @@ | ||
it('should return an error if the chainImplementation does not support signMessage', async () => { | ||
chainImplementationStub.signMessage = undefined; | ||
const response = await handleRemoteSignEvent(message, remoteSignerInstStub, { | ||
wallet, | ||
chainImplementation: chainImplementationStub, | ||
}); | ||
expect(response).to.have.property('error'); | ||
expect((response as RemoteError).error.message).to.equal('Chain implementation does not support signMessage'); | ||
}); | ||
context('when the chainImplementation call throws an error', () => { | ||
@@ -294,4 +318,5 @@ beforeEach(() => { | ||
const sendErrorArgs = remoteSignerInstStub.sendError.getCall(0).args; | ||
expect(sendErrorArgs[0]).to.equal(CivicSignEventTypeRequest.REQUEST_SIGNED_MESSAGE); | ||
expect(sendErrorArgs[1]).to.be.instanceOf(ChainError); | ||
expect(sendErrorArgs[0]).to.equal(requestId); | ||
expect(sendErrorArgs[1]).to.equal(CivicSignEventTypeRequest.REQUEST_SIGNED_MESSAGE); | ||
expect(sendErrorArgs[2]).to.be.instanceOf(ChainError); | ||
}); | ||
@@ -314,2 +339,3 @@ | ||
payload: 'proof', | ||
requestId, | ||
}; | ||
@@ -316,0 +342,0 @@ }); |
import { ClientCoreInternal, ExtendedGatewayStatus, GatewayCoreState, GatewayStatus } from '../../src'; | ||
import { handleChainError, handleGatekeeperError } from '../../src/state/error'; | ||
import { handleChainError, handleGatekeeperError, handleUserValidationFailed } from '../../src/state/error'; | ||
import chai from 'chai'; | ||
@@ -340,2 +340,42 @@ import { CivicPassMessageAction, CivicPassMessageEventResult } from '../../src/types/civicPass'; | ||
}); | ||
context('handleUserValidationFailed', () => { | ||
it('should return RESTART state if disableAutoRestartOnValidationFailure is not defined', () => { | ||
const state = { | ||
inputs: { | ||
parameters: {}, | ||
}, | ||
} as unknown as GatewayCoreState; | ||
const result = handleUserValidationFailed(state); | ||
expect(result).to.equal(ExtendedGatewayStatus.RESTART); | ||
}); | ||
it('should return RESTART state if disableAutoRestartOnValidationFailure is false', () => { | ||
const state = { | ||
inputs: { | ||
parameters: { | ||
options: { | ||
disableAutoRestartOnValidationFailure: false, | ||
}, | ||
}, | ||
}, | ||
} as unknown as GatewayCoreState; | ||
const result = handleUserValidationFailed(state); | ||
expect(result).to.equal(ExtendedGatewayStatus.RESTART); | ||
}); | ||
it('should return USER_VALIDATION_FAILED state if disableAutoRestartOnValidationFailure is true', () => { | ||
const state = { | ||
inputs: { | ||
parameters: { | ||
options: { | ||
disableAutoRestartOnValidationFailure: true, | ||
}, | ||
}, | ||
}, | ||
} as unknown as GatewayCoreState; | ||
const result = handleUserValidationFailed(state); | ||
expect(result).to.equal(ExtendedGatewayStatus.USER_VALIDATION_FAILED); | ||
}); | ||
}); | ||
}); |
@@ -305,2 +305,40 @@ import { InputStatus } from '../../src/types/fetch'; | ||
}); | ||
context('with user validation failed', () => { | ||
context('with disableAutoRestartOnValidationFailure set to false or undefined', () => { | ||
it('should return RESTART state', () => { | ||
const state = { | ||
inputs: { | ||
...initialInputState, | ||
parameters: {}, | ||
}, | ||
internal: { | ||
status: ExtendedGatewayStatus.USER_VALIDATION_FAILED, | ||
}, | ||
} as GatewayCoreState; | ||
const result = computeInternalStatus(state); | ||
expect(result).to.equal(ExtendedGatewayStatus.RESTART); | ||
}); | ||
}); | ||
context('with disableAutoRestartOnValidationFailure set to true', () => { | ||
it('should return USER_VALIDATION_FAILED as a final state', () => { | ||
const state = { | ||
inputs: { | ||
...initialInputState, | ||
parameters: { | ||
options: { | ||
disableAutoRestartOnValidationFailure: true, | ||
}, | ||
}, | ||
}, | ||
internal: { | ||
status: ExtendedGatewayStatus.USER_VALIDATION_FAILED, | ||
}, | ||
} as GatewayCoreState; | ||
const result = computeInternalStatus(state); | ||
expect(result).to.equal(ExtendedGatewayStatus.USER_VALIDATION_FAILED); | ||
}); | ||
}); | ||
}); | ||
}); | ||
@@ -443,3 +481,3 @@ | ||
context('with a state that is invalid or not mapped', () => { | ||
it('should throw an error', () => { | ||
it('should throw an error if status is unknow', () => { | ||
const state = { | ||
@@ -457,2 +495,14 @@ inputs: { | ||
}); | ||
it('should throw an error if no status if undefined', () => { | ||
const state = { | ||
inputs: { | ||
...initialInputState, | ||
}, | ||
internal: { | ||
// status is not defined | ||
}, | ||
} as GatewayCoreState; | ||
expect(() => computeInternalStatus(state)).to.throw('No transition function defined for undefined status'); | ||
}); | ||
}); | ||
@@ -459,0 +509,0 @@ |
@@ -199,3 +199,3 @@ import { ExtendedGatewayStatus, GatewayClientParameters, GatewayCoreState, GatewayStatus } from '../../src'; | ||
context('with a civicPass event of failure', () => { | ||
it('should return RESTART', () => { | ||
it('should return USER_VALIDATION_FAILED', () => { | ||
const state = { | ||
@@ -211,3 +211,3 @@ inputs: { | ||
const result = calculateIssuanceRequestedDataCollectionRestart(state); | ||
expect(result).to.equal(ExtendedGatewayStatus.RESTART); | ||
expect(result).to.equal(ExtendedGatewayStatus.USER_VALIDATION_FAILED); | ||
}); | ||
@@ -384,3 +384,3 @@ }); | ||
context('with a civicPass event of failure', () => { | ||
it('should return RESTART', () => { | ||
it('should return USER_VALIDATION_FAILED', () => { | ||
const state = { | ||
@@ -396,3 +396,3 @@ inputs: { | ||
const result = calculateIssuanceStatus(state); | ||
expect(result).to.equal(ExtendedGatewayStatus.RESTART); | ||
expect(result).to.equal(ExtendedGatewayStatus.USER_VALIDATION_FAILED); | ||
}); | ||
@@ -399,0 +399,0 @@ }); |
@@ -32,2 +32,3 @@ import GatewayClientCore, { | ||
import * as getGatekeeperNetworkData from '../src/gatekeeperNetworkService'; | ||
import { v4 as uuid } from 'uuid'; | ||
@@ -590,2 +591,3 @@ chai.use(sinonChai); | ||
async expectSuccessfulCivicSignPublicKeyRequestResponse() { | ||
const requestId = uuid(); | ||
this.emitter.emit('message', { | ||
@@ -597,2 +599,3 @@ data: { | ||
payload: {}, | ||
requestId, | ||
}, | ||
@@ -607,2 +610,3 @@ }); | ||
data: this.inputs.walletAddress, | ||
requestId, | ||
}); | ||
@@ -612,2 +616,3 @@ } | ||
async expectSuccessfulCivicSignDIDRequestResponse() { | ||
const requestId = uuid(); | ||
this.emitter.emit('message', { | ||
@@ -619,2 +624,3 @@ data: { | ||
payload: {}, | ||
requestId, | ||
}, | ||
@@ -629,2 +635,3 @@ }); | ||
data: this.inputs.did, | ||
requestId, | ||
}); | ||
@@ -634,2 +641,3 @@ } | ||
async expectSuccessfulCivicSignProofRequestResponse() { | ||
const requestId = uuid(); | ||
this.signMessageStub.resolves(Buffer.from('signature')); | ||
@@ -642,2 +650,3 @@ this.emitter.emit('message', { | ||
payload: 'message-to-sign', | ||
requestId, | ||
}, | ||
@@ -653,2 +662,3 @@ }); | ||
data: mockProofObj, | ||
requestId, | ||
}); | ||
@@ -823,2 +833,13 @@ } | ||
async simulateCivicPassFailureEvent() { | ||
this.emitter.emit('message', { | ||
data: { | ||
instanceId: this.client.instanceId, | ||
source: '', | ||
event: CivicPassMessageEventResult.FAILURE, | ||
action: CivicPassMessageAction.ISSUANCE, | ||
}, | ||
}); | ||
} | ||
async simulateCivicPassRejectionAction(gkAPIState: GatekeeperAPIStatus) { | ||
@@ -825,0 +846,0 @@ let action; |
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2795656
192
24914
2
11