@unumid/server-sdk
Advanced tools
Comparing version 3.11.1 to 3.12.0
@@ -18,5 +18,5 @@ import { registerVerifier } from './verifier/registerVerifier'; | ||
import { getVersionedRequest } from './verifier/getVersionedRequest'; | ||
import { verifySubjectCredentialRequests } from './issuer/verifySubjectCredentialRequest'; | ||
import { verifySubjectCredentialRequests } from './issuer/verifySubjectCredentialRequests'; | ||
import { verifySubjectDidDocument } from './utils/verifyDidDocument'; | ||
export { registerIssuer, issueCredential, issueCredentials, updateCredentialStatus, verifySubjectCredentialRequests, registerVerifier, sendEmail, sendRequest, sendSms, verifyPresentation, checkCredentialStatus, getRequest, getVersionedRequest, UnumDto, RegisteredVerifier, VerifiedStatus, SubjectCredentialRequestVerifiedStatus, Presentation, RegisteredIssuer, CredentialSubject, DecryptedPresentation, CredentialStatusInfo, CustError, Proof, Credential, CredentialInfo, extractCredentialInfo, verifySubjectDidDocument, createProof, createProofPb, convertCredentialSubject }; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -36,6 +36,6 @@ "use strict"; | ||
Object.defineProperty(exports, "getVersionedRequest", { enumerable: true, get: function () { return getVersionedRequest_1.getVersionedRequest; } }); | ||
var verifySubjectCredentialRequest_1 = require("./issuer/verifySubjectCredentialRequest"); | ||
Object.defineProperty(exports, "verifySubjectCredentialRequests", { enumerable: true, get: function () { return verifySubjectCredentialRequest_1.verifySubjectCredentialRequests; } }); | ||
var verifySubjectCredentialRequests_1 = require("./issuer/verifySubjectCredentialRequests"); | ||
Object.defineProperty(exports, "verifySubjectCredentialRequests", { enumerable: true, get: function () { return verifySubjectCredentialRequests_1.verifySubjectCredentialRequests; } }); | ||
var verifyDidDocument_1 = require("./utils/verifyDidDocument"); | ||
Object.defineProperty(exports, "verifySubjectDidDocument", { enumerable: true, get: function () { return verifyDidDocument_1.verifySubjectDidDocument; } }); | ||
//# sourceMappingURL=index.js.map |
import { RegisteredIssuer, UnumDto } from '../types'; | ||
import { VersionInfo } from '@unumid/types'; | ||
/** | ||
@@ -7,3 +8,3 @@ * Handles registering an Issuer with UnumID's SaaS. | ||
*/ | ||
export declare const registerIssuer: (customerUuid: string, apiKey: string) => Promise<UnumDto<RegisteredIssuer>>; | ||
export declare const registerIssuer: (customerUuid: string, apiKey: string, url: string, versionInfo?: VersionInfo[]) => Promise<UnumDto<RegisteredIssuer>>; | ||
//# sourceMappingURL=registerIssuer.d.ts.map |
@@ -49,2 +49,3 @@ "use strict"; | ||
var networkRequestHelper_1 = require("../utils/networkRequestHelper"); | ||
var validateVersionInfo_1 = require("../utils/validateVersionInfo"); | ||
/** | ||
@@ -81,3 +82,3 @@ * Creates an object to encapsulate key information after key pair creation. | ||
*/ | ||
var validateInParams = function (customerUuid, apiKey) { | ||
var validateInParams = function (customerUuid, apiKey, url, versionInfo) { | ||
if (!customerUuid) { | ||
@@ -89,2 +90,6 @@ throw new error_1.CustError(400, 'Invalid Issuer: customerUuid is required.'); | ||
} | ||
if (!url) { | ||
throw new error_1.CustError(400, 'Invalid Issuer: url is required.'); | ||
} | ||
validateVersionInfo_1.validateVersionInfo(versionInfo); | ||
}; | ||
@@ -96,50 +101,57 @@ /** | ||
*/ | ||
exports.registerIssuer = function (customerUuid, apiKey) { return __awaiter(void 0, void 0, void 0, function () { | ||
var kpSet, issuerOpt, restData, restResp, authToken, issuerResp, error_2; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: | ||
_a.trys.push([0, 3, , 4]); | ||
validateInParams(customerUuid, apiKey); | ||
return [4 /*yield*/, createKeyPairs_1.createKeyPairSet()]; | ||
case 1: | ||
kpSet = _a.sent(); | ||
issuerOpt = { | ||
customerUuid: customerUuid, | ||
publicKeyInfo: constructKeyObjs(kpSet) | ||
}; | ||
restData = { | ||
method: 'POST', | ||
baseUrl: config_1.configData.SaaSUrl, | ||
endPoint: 'issuer', | ||
header: { Authorization: 'Bearer ' + apiKey }, | ||
data: issuerOpt | ||
}; | ||
return [4 /*yield*/, networkRequestHelper_1.makeNetworkRequest(restData)]; | ||
case 2: | ||
restResp = _a.sent(); | ||
authToken = networkRequestHelper_1.handleAuthTokenHeader(restResp); | ||
issuerResp = { | ||
authToken: authToken, | ||
body: { | ||
uuid: restResp.body.uuid, | ||
customerUuid: restResp.body.customerUuid, | ||
did: restResp.body.did, | ||
name: restResp.body.name, | ||
createdAt: restResp.body.createdAt, | ||
updatedAt: restResp.body.updatedAt, | ||
isAuthorized: restResp.body.isAuthorized, | ||
keys: kpSet, | ||
apiKey: apiKey | ||
} | ||
}; | ||
return [2 /*return*/, issuerResp]; | ||
case 3: | ||
error_2 = _a.sent(); | ||
logger_1.default.error("Error registering an Issuer with UnumID SaaS. " + error_2); | ||
throw error_2; | ||
case 4: return [2 /*return*/]; | ||
} | ||
exports.registerIssuer = function (customerUuid, apiKey, url, versionInfo) { | ||
if (versionInfo === void 0) { versionInfo = [{ target: { version: '1.0.0' }, sdkVersion: '3.0.0' }]; } | ||
return __awaiter(void 0, void 0, void 0, function () { | ||
var kpSet, issuerOpt, restData, restResp, authToken, issuerResp, error_2; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: | ||
_a.trys.push([0, 3, , 4]); | ||
validateInParams(customerUuid, apiKey, url, versionInfo); | ||
return [4 /*yield*/, createKeyPairs_1.createKeyPairSet()]; | ||
case 1: | ||
kpSet = _a.sent(); | ||
issuerOpt = { | ||
customerUuid: customerUuid, | ||
publicKeyInfo: constructKeyObjs(kpSet), | ||
url: url, | ||
versionInfo: versionInfo | ||
}; | ||
restData = { | ||
method: 'POST', | ||
baseUrl: config_1.configData.SaaSUrl, | ||
endPoint: 'issuer', | ||
header: { Authorization: 'Bearer ' + apiKey }, | ||
data: issuerOpt | ||
}; | ||
return [4 /*yield*/, networkRequestHelper_1.makeNetworkRequest(restData)]; | ||
case 2: | ||
restResp = _a.sent(); | ||
authToken = networkRequestHelper_1.handleAuthTokenHeader(restResp); | ||
issuerResp = { | ||
authToken: authToken, | ||
body: { | ||
uuid: restResp.body.uuid, | ||
customerUuid: restResp.body.customerUuid, | ||
did: restResp.body.did, | ||
name: restResp.body.name, | ||
createdAt: restResp.body.createdAt, | ||
updatedAt: restResp.body.updatedAt, | ||
isAuthorized: restResp.body.isAuthorized, | ||
keys: kpSet, | ||
apiKey: apiKey, | ||
url: restResp.body.url, | ||
versionInfo: restResp.body.versionInfo | ||
} | ||
}; | ||
return [2 /*return*/, issuerResp]; | ||
case 3: | ||
error_2 = _a.sent(); | ||
logger_1.default.error("Error registering an Issuer with UnumID SaaS. " + error_2); | ||
throw error_2; | ||
case 4: return [2 /*return*/]; | ||
} | ||
}); | ||
}); | ||
}); }; | ||
}; | ||
//# sourceMappingURL=registerIssuer.js.map |
@@ -49,2 +49,3 @@ "use strict"; | ||
var networkRequestHelper_1 = require("../utils/networkRequestHelper"); | ||
var validateVersionInfo_1 = require("../utils/validateVersionInfo"); | ||
/** | ||
@@ -81,3 +82,3 @@ * Creates an object to encapsulate key information after key pair creation. | ||
*/ | ||
var validateInParams = function (customerUuid, url, apiKey) { | ||
var validateInParams = function (customerUuid, url, apiKey, versionInfo) { | ||
if (!customerUuid) { | ||
@@ -92,2 +93,3 @@ throw new __1.CustError(400, 'Invalid Verifier Options: customerUuid is required.'); | ||
} | ||
validateVersionInfo_1.validateVersionInfo(versionInfo); | ||
}; | ||
@@ -102,3 +104,3 @@ /** | ||
exports.registerVerifier = function (customerUuid, url, apiKey, versionInfo) { | ||
if (versionInfo === void 0) { versionInfo = [{ target: { version: '1.0.0' }, sdkVersion: '2.0.0' }]; } | ||
if (versionInfo === void 0) { versionInfo = [{ target: { version: '1.0.0' }, sdkVersion: '3.0.0' }]; } | ||
return __awaiter(void 0, void 0, void 0, function () { | ||
@@ -110,3 +112,3 @@ var kpSet, verifierOpt, restData, restResp, authToken, verifierResp, error_1; | ||
_a.trys.push([0, 3, , 4]); | ||
validateInParams(customerUuid, url, apiKey); | ||
validateInParams(customerUuid, url, apiKey, versionInfo); | ||
return [4 /*yield*/, createKeyPairs_1.createKeyPairSet()]; | ||
@@ -113,0 +115,0 @@ case 1: |
{ | ||
"name": "@unumid/server-sdk", | ||
"version": "3.11.1", | ||
"version": "3.12.0", | ||
"main": "build/index.js", | ||
@@ -47,3 +47,3 @@ "repository": "git@github.com:UnumID/Server-SDK-TypeScript.git", | ||
"@unumid/library-crypto": "https://github.com/UnumID/Library-Crypto-TypeScript.git#1.7.0", | ||
"@unumid/types": "https://github.com/UnumID/types.git#3.24.2", | ||
"@unumid/types": "https://github.com/UnumID/types.git#3.25.1", | ||
"@unumid/types-v2": "npm:@unumid/types@2.1.3", | ||
@@ -50,0 +50,0 @@ "dotenv": "^8.2.0", |
@@ -161,4 +161,11 @@ # Unum ID Typescript Server-SDK | ||
You need to provide the your issuer's `did` along with the SubjectCredentialRequest array from your `/credentialRequest` endpoint. | ||
You need to provide the your issuer's `did` along with the SubjectCredentialRequest array from your `/credentialRequest` [endpoint](https://gist.github.com/UnumIDAdmin/d76d9fe46e459e529d7f7b6f9319a0b6). | ||
Each request is cryptographically signed by the subject's private key. This function verifies the signatures are valid. Furthermore, it validates that all requests are from the same subject and that requested Issuer requirements are met. After which, your application code will need to evaluate wether it can issue the requested credentials. An example implementation can be found [here](https://github.com/UnumID/demo-issuer-server/blob/main/src/services/api/credentialRequest/credentialRequest.class.ts). | ||
The main use case of this to allow bootstrapping users that just installed the Unum ID Wallet with credentials necessary to use across the network, i.e for instant sign ups with a partner. | ||
_Note_: Despite this having "verify" in its name, this function only serves Issuers in determining whether a subject's request for credentials is valid. It is up to you application logic to determine whether you have the data relating to the the subject to issue the requested credentials. | ||
```typescript | ||
@@ -182,7 +189,8 @@ export type SubjectCredentialRequest = { | ||
Response Body: [**VerifiedStatus**]. | ||
Response Body: [**SubjectCredentialRequestVerifiedStatus**]. | ||
```typescript | ||
export interface VerifiedStatus { | ||
isVerified: boolean; | ||
message?: string; // message containing information iff it was not verified | ||
export interface SubjectCredentialRequestVerifiedStatus { | ||
subjectDid: string; // returns the subject DID that made and signed all the requests | ||
isVerified: boolean; // returns true if all requests are verified and validation requirements are met | ||
message?: string; // (optional) only populated iff isVerified is false | ||
} | ||
@@ -294,3 +302,3 @@ ``` | ||
You need to be able to receive presentations from users and pass them to this function. To do this, you need to create a `/presentation` endpoint that conforms to our [OpenAPI specification](https://unumid.postman.co/workspace/Unum-ID-Team-Workspace~48b1f312-a6e6-4bcc-86a0-aa4bc37df9b4/api/09ad0ccd-c614-4d54-a1b4-ff9ae85b8449?version=c217a461-fc05-4476-a792-6c9163f2a198&tab=define). The Unum ID cloud sends encrypted presentations to this endpoint, which should pass those presentations to the `verifyPresentation` function to be decrypted and verified. | ||
You need to be able to receive presentations from users and pass them to this function. To do this, you need to create a `/presentation` endpoint that conforms to our [OpenAPI specification](https://gist.github.com/UnumIDAdmin/2bffdf092594196beba48ce7738b60fa). The Unum ID cloud sends encrypted presentations to this endpoint, which should pass those presentations to the `verifyPresentation` function to be decrypted and verified. | ||
@@ -297,0 +305,0 @@ You need to provide: |
@@ -18,3 +18,3 @@ import { registerVerifier } from './verifier/registerVerifier'; | ||
import { getVersionedRequest } from './verifier/getVersionedRequest'; | ||
import { verifySubjectCredentialRequests } from './issuer/verifySubjectCredentialRequest'; | ||
import { verifySubjectCredentialRequests } from './issuer/verifySubjectCredentialRequests'; | ||
import { verifySubjectDidDocument } from './utils/verifyDidDocument'; | ||
@@ -21,0 +21,0 @@ |
@@ -5,3 +5,3 @@ import { configData } from '../config'; | ||
import logger from '../logger'; | ||
import { DidKeyType, IssuerOptions, JSONObj, KeyPair, PublicKeyInfo } from '@unumid/types'; | ||
import { DidKeyType, IssuerOptions, JSONObj, KeyPair, PublicKeyInfo, VersionInfo } from '@unumid/types'; | ||
import { getUUID } from '../utils/helpers'; | ||
@@ -11,2 +11,3 @@ import { CustError } from '../utils/error'; | ||
import { handleAuthTokenHeader, makeNetworkRequest } from '../utils/networkRequestHelper'; | ||
import { validateVersionInfo } from '../utils/validateVersionInfo'; | ||
@@ -47,3 +48,3 @@ /** | ||
*/ | ||
const validateInParams = (customerUuid: string, apiKey: string) => { | ||
const validateInParams = (customerUuid: string, apiKey: string, url: string, versionInfo: VersionInfo[]) => { | ||
if (!customerUuid) { | ||
@@ -56,2 +57,8 @@ throw new CustError(400, 'Invalid Issuer: customerUuid is required.'); | ||
} | ||
if (!url) { | ||
throw new CustError(400, 'Invalid Issuer: url is required.'); | ||
} | ||
validateVersionInfo(versionInfo); | ||
}; | ||
@@ -64,5 +71,5 @@ | ||
*/ | ||
export const registerIssuer = async (customerUuid: string, apiKey: string): Promise<UnumDto<RegisteredIssuer>> => { | ||
export const registerIssuer = async (customerUuid: string, apiKey: string, url:string, versionInfo: VersionInfo[] = [{ target: { version: '1.0.0' }, sdkVersion: '3.0.0' }]): Promise<UnumDto<RegisteredIssuer>> => { | ||
try { | ||
validateInParams(customerUuid, apiKey); | ||
validateInParams(customerUuid, apiKey, url, versionInfo); | ||
@@ -72,4 +79,7 @@ const kpSet: KeyPairSet = await createKeyPairSet(); | ||
customerUuid, | ||
publicKeyInfo: constructKeyObjs(kpSet) | ||
publicKeyInfo: constructKeyObjs(kpSet), | ||
url, | ||
versionInfo | ||
}; | ||
const restData: RESTData = { | ||
@@ -98,3 +108,5 @@ method: 'POST', | ||
keys: kpSet, | ||
apiKey | ||
apiKey, | ||
url: restResp.body.url, | ||
versionInfo: restResp.body.versionInfo | ||
} | ||
@@ -101,0 +113,0 @@ }; |
@@ -9,2 +9,3 @@ import { configData } from '../config'; | ||
import { makeNetworkRequest, handleAuthTokenHeader } from '../utils/networkRequestHelper'; | ||
import { validateVersionInfo } from '../utils/validateVersionInfo'; | ||
@@ -45,3 +46,3 @@ /** | ||
*/ | ||
const validateInParams = (customerUuid: string, url: string, apiKey: string): void => { | ||
const validateInParams = (customerUuid: string, url: string, apiKey: string, versionInfo: VersionInfo[]): void => { | ||
if (!customerUuid) { | ||
@@ -58,2 +59,4 @@ throw new CustError(400, 'Invalid Verifier Options: customerUuid is required.'); | ||
} | ||
validateVersionInfo(versionInfo); | ||
}; | ||
@@ -68,5 +71,5 @@ | ||
*/ | ||
export const registerVerifier = async (customerUuid: string, url: string, apiKey: string, versionInfo: VersionInfo[] = [{ target: { version: '1.0.0' }, sdkVersion: '2.0.0' }]): Promise<UnumDto<RegisteredVerifier>> => { | ||
export const registerVerifier = async (customerUuid: string, url: string, apiKey: string, versionInfo: VersionInfo[] = [{ target: { version: '1.0.0' }, sdkVersion: '3.0.0' }]): Promise<UnumDto<RegisteredVerifier>> => { | ||
try { | ||
validateInParams(customerUuid, url, apiKey); | ||
validateInParams(customerUuid, url, apiKey, versionInfo); | ||
@@ -73,0 +76,0 @@ const kpSet: KeyPairSet = await createKeyPairSet(); |
@@ -7,2 +7,3 @@ import { JSONObj, RegisteredIssuer, UnumDto } from '../../src/types'; | ||
import { makeNetworkRequest } from '../../src/utils/networkRequestHelper'; | ||
import { VersionInfo } from '@unumid/types'; | ||
@@ -66,6 +67,7 @@ jest.mock('../../src/utils/networkRequestHelper', () => ({ | ||
const customerUuid = '5e46f1ba-4c82-471d-bbc7-251924a90532'; | ||
const url = 'dummy.com'; | ||
it('returns a CustError with a descriptive error message if customerUuid is missing', async () => { | ||
try { | ||
await registerIssuer('', dummyIssuerApiKey); | ||
await registerIssuer('', dummyIssuerApiKey, url); | ||
fail(); | ||
@@ -81,3 +83,3 @@ } catch (e) { | ||
try { | ||
await registerIssuer(customerUuid, ''); | ||
await registerIssuer(customerUuid, '', url); | ||
fail(); | ||
@@ -90,2 +92,62 @@ } catch (e) { | ||
}); | ||
it('returns a CustError with a descriptive error message if url is missing', async () => { | ||
try { | ||
await registerIssuer(customerUuid, dummyIssuerApiKey, undefined); | ||
fail(); | ||
} catch (e) { | ||
expect(e).toEqual(new CustError(400, 'Invalid Issuer: url is required.')); | ||
expect(e.code).toEqual(400); | ||
expect(e.message).toEqual('Invalid Issuer: url is required.'); | ||
} | ||
}); | ||
it('returns a CustError with a descriptive error message if versionInfo target is missing', async () => { | ||
// const badVersionInfo: VersionInfo[] = [{ target: { version: '1.0.x' }, sdkVersion: '3.0.0' }]; | ||
const badVersionInfo: VersionInfo[] = [{ sdkVersion: '3.0.0' }]; | ||
try { | ||
await registerIssuer(customerUuid, dummyIssuerApiKey, url, badVersionInfo); | ||
fail(); | ||
} catch (e) { | ||
expect(e).toEqual(new CustError(400, '\'versionInfo[0].target\' must be defined.')); | ||
expect(e.code).toEqual(400); | ||
expect(e.message).toEqual('\'versionInfo[0].target\' must be defined.'); | ||
} | ||
}); | ||
it('returns a CustError with a descriptive error message if versionInfo url or version is missing', async () => { | ||
const badVersionInfo: VersionInfo[] = [{ target: { hat: '1.0.x' }, sdkVersion: '3.0.0' }]; | ||
try { | ||
await registerIssuer(customerUuid, dummyIssuerApiKey, url, badVersionInfo); | ||
fail(); | ||
} catch (e) { | ||
expect(e).toEqual(new CustError(400, '\'versionInfo[0].target.version\' or \'versionInfo[0].target.url\' must be defined.')); | ||
expect(e.code).toEqual(400); | ||
expect(e.message).toEqual('\'versionInfo[0].target.version\' or \'versionInfo[0].target.url\' must be defined.'); | ||
} | ||
}); | ||
it('returns a CustError with a descriptive error message if versionInfo version is not in semver notation', async () => { | ||
const badVersionInfo: VersionInfo[] = [{ target: { version: '1.0.x' }, sdkVersion: '3.0.0' }]; | ||
try { | ||
await registerIssuer(customerUuid, dummyIssuerApiKey, url, badVersionInfo); | ||
fail(); | ||
} catch (e) { | ||
expect(e).toEqual(new CustError(400, '\'versionInfo[0].target.version\' must be valid semver notation.')); | ||
expect(e.code).toEqual(400); | ||
expect(e.message).toEqual('\'versionInfo[0].target.version\' must be valid semver notation.'); | ||
} | ||
}); | ||
it('returns a CustError with a descriptive error message if versionInfo sdkVersion is not in semver notation', async () => { | ||
const badVersionInfo: VersionInfo[] = [{ target: { version: '1.0.0' }, sdkVersion: '3.0.x' }]; | ||
try { | ||
await registerIssuer(customerUuid, dummyIssuerApiKey, url, badVersionInfo); | ||
fail(); | ||
} catch (e) { | ||
expect(e).toEqual(new CustError(400, '\'versionInfo[0].sdkVersion\' must be valid semver notation.')); | ||
expect(e.code).toEqual(400); | ||
expect(e.message).toEqual('\'versionInfo[0].sdkVersion\' must be valid semver notation.'); | ||
} | ||
}); | ||
}); | ||
@@ -96,2 +158,3 @@ | ||
const customerUuid = '5e46f1ba-4c82-471d-bbc7-251924a90532'; | ||
const url = 'dummy.com'; | ||
@@ -101,3 +164,3 @@ it('Response code should be 403 when uuid is not valid', async () => { | ||
try { | ||
await registerIssuer('123', dummyIssuerApiKey); | ||
await registerIssuer('123', dummyIssuerApiKey, url); | ||
} catch (e) { | ||
@@ -112,3 +175,3 @@ expect(e.code).toBe(403); | ||
try { | ||
await registerIssuer(customerUuid, 'abc'); | ||
await registerIssuer(customerUuid, 'abc', url); | ||
} catch (e) { | ||
@@ -115,0 +178,0 @@ expect(e.code).toBe(403); |
@@ -119,2 +119,51 @@ import { | ||
}); | ||
it('returns a CustError with a descriptive error message if versionInfo target is missing', async () => { | ||
// const badVersionInfo: VersionInfo[] = [{ target: { version: '1.0.x' }, sdkVersion: '3.0.0' }]; | ||
const badVersionInfo: VersionInfo[] = [{ sdkVersion: '3.0.0' }]; | ||
try { | ||
await registerVerifier(customerUuid, url, dummyVerifierApiKey, badVersionInfo); | ||
fail(); | ||
} catch (e) { | ||
expect(e).toEqual(new CustError(400, '\'versionInfo[0].target\' must be defined.')); | ||
expect(e.code).toEqual(400); | ||
expect(e.message).toEqual('\'versionInfo[0].target\' must be defined.'); | ||
} | ||
}); | ||
it('returns a CustError with a descriptive error message if versionInfo url or version is missing', async () => { | ||
const badVersionInfo: VersionInfo[] = [{ target: { hat: '1.0.x' }, sdkVersion: '3.0.0' }]; | ||
try { | ||
await registerVerifier(customerUuid, url, dummyVerifierApiKey, badVersionInfo); | ||
fail(); | ||
} catch (e) { | ||
expect(e).toEqual(new CustError(400, '\'versionInfo[0].target.version\' or \'versionInfo[0].target.url\' must be defined.')); | ||
expect(e.code).toEqual(400); | ||
expect(e.message).toEqual('\'versionInfo[0].target.version\' or \'versionInfo[0].target.url\' must be defined.'); | ||
} | ||
}); | ||
it('returns a CustError with a descriptive error message if versionInfo version is not in semver notation', async () => { | ||
const badVersionInfo: VersionInfo[] = [{ target: { version: '1.0.x' }, sdkVersion: '3.0.0' }]; | ||
try { | ||
await registerVerifier(customerUuid, url, dummyVerifierApiKey, badVersionInfo); | ||
fail(); | ||
} catch (e) { | ||
expect(e).toEqual(new CustError(400, '\'versionInfo[0].target.version\' must be valid semver notation.')); | ||
expect(e.code).toEqual(400); | ||
expect(e.message).toEqual('\'versionInfo[0].target.version\' must be valid semver notation.'); | ||
} | ||
}); | ||
it('returns a CustError with a descriptive error message if versionInfo sdkVersion is not in semver notation', async () => { | ||
const badVersionInfo: VersionInfo[] = [{ target: { version: '1.0.0' }, sdkVersion: '3.0.x' }]; | ||
try { | ||
await registerVerifier(customerUuid, url, dummyVerifierApiKey, badVersionInfo); | ||
fail(); | ||
} catch (e) { | ||
expect(e).toEqual(new CustError(400, '\'versionInfo[0].sdkVersion\' must be valid semver notation.')); | ||
expect(e.code).toEqual(400); | ||
expect(e.message).toEqual('\'versionInfo[0].sdkVersion\' must be valid semver notation.'); | ||
} | ||
}); | ||
}); | ||
@@ -121,0 +170,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
HTTP dependency
Supply chain riskContains a dependency which resolves to a remote HTTP URL which could be used to inject untrusted code and reduce overall package reliability.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
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
HTTP dependency
Supply chain riskContains a dependency which resolves to a remote HTTP URL which could be used to inject untrusted code and reduce overall package reliability.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
1382255
252
16260
406