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

@unumid/server-sdk

Package Overview
Dependencies
Maintainers
1
Versions
88
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@unumid/server-sdk - npm Package Compare versions

Comparing version 2.1.0 to 2.1.1

4

build/utils/convertCredentialSubject.js

@@ -16,2 +16,3 @@ "use strict";

var lodash_1 = require("lodash");
var error_1 = require("./error");
/**

@@ -22,2 +23,5 @@ * Handler to convert the JSON representation of the CredentialSubject into a Typescript interface, CredentialSubject

exports.convertCredentialSubject = function (input) {
if (typeof input !== 'string') {
throw new error_1.CustError(400, "CredentialSubject is not a string: " + input);
}
var obj = JSON.parse(input);

@@ -24,0 +28,0 @@ var claims = lodash_1.omit(obj, 'id');

2

build/verifier/sendRequest.js

@@ -84,3 +84,3 @@ "use strict";

holderAppUuid: holderAppUuid,
metadata: metadata || {},
metadata: metadata || { fields: {} },
uuid: uuid,

@@ -87,0 +87,0 @@ verifier: verifier

@@ -155,3 +155,3 @@ "use strict";

exports.verifyPresentation = function (authorization, encryptedPresentation, verifierDid, encryptionPrivateKey, presentationRequest) { return __awaiter(void 0, void 0, void 0, function () {
var presentation, requestVerificationResult, type, result_2, verificationResult_1, result_3, credentialRequests, verificationResult, result, error_2;
var presentation, presentationRequestWithoutVersion, requestVerificationResult, type, result_2, verificationResult_1, result_3, credentialRequests, verificationResult, result, error_2;
return __generator(this, function (_a) {

@@ -182,3 +182,4 @@ switch (_a.label) {

if (!(presentationRequest && presentationRequest.presentationRequest)) return [3 /*break*/, 2];
return [4 /*yield*/, verifyPresentationRequest(authorization, presentationRequest.presentationRequest)];
presentationRequestWithoutVersion = lodash_1.omit(presentationRequest.presentationRequest, 'version');
return [4 /*yield*/, verifyPresentationRequest(authorization, presentationRequestWithoutVersion)];
case 1:

@@ -185,0 +186,0 @@ requestVerificationResult = _a.sent();

@@ -57,2 +57,3 @@ "use strict";

var verify_1 = require("../utils/verify");
var convertCredentialSubject_1 = require("../utils/convertCredentialSubject");
/**

@@ -132,3 +133,4 @@ * Validates the attributes for a credential request to UnumID's SaaS.

// Check credentialSubject object has id element.
if (!credential.credentialSubject.id) {
var credentialSubject = convertCredentialSubject_1.convertCredentialSubject(credential.credentialSubject);
if (!credentialSubject.id) {
retObj.valid = false;

@@ -135,0 +137,0 @@ retObj.msg = invalidMsg + " credentialSubject must contain id property.";

{
"name": "@unumid/server-sdk",
"version": "2.1.0",
"version": "2.1.1",
"main": "build/index.js",

@@ -5,0 +5,0 @@ "repository": "git@github.com:UnumID/Server-SDK-TypeScript.git",

import { CredentialSubject, JSONObj } from '@unumid/types';
import { omit } from 'lodash';
import { CustError } from './error';

@@ -10,2 +11,6 @@ /**

export const convertCredentialSubject = (input: string): CredentialSubject => {
if (typeof input !== 'string') {
throw new CustError(400, `CredentialSubject is not a string: ${input}`);
}
const obj = JSON.parse(input);

@@ -12,0 +17,0 @@ const claims = omit(obj, 'id');

@@ -46,3 +46,3 @@ import { configData } from '../config';

holderAppUuid,
metadata: metadata || {},
metadata: metadata || { fields: {} },
uuid,

@@ -49,0 +49,0 @@ verifier

@@ -147,3 +147,5 @@

if (presentationRequest && presentationRequest.presentationRequest) {
const requestVerificationResult = await verifyPresentationRequest(authorization, presentationRequest.presentationRequest);
// removing the version attribute that the saas adds
const presentationRequestWithoutVersion: PresentationRequest = omit(presentationRequest.presentationRequest, 'version');
const requestVerificationResult = await verifyPresentationRequest(authorization, presentationRequestWithoutVersion);
authorization = requestVerificationResult.authToken;

@@ -150,0 +152,0 @@

@@ -5,3 +5,3 @@ import { omit } from 'lodash';

import { CredentialStatusInfo, RESTData, UnumDto, VerifiedStatus } from '../types';
import { Presentation, Credential, CredentialRequest, Proof, PublicKeyInfo, JSONObj } from '@unumid/types';
import { Presentation, Credential, CredentialRequest, Proof, PublicKeyInfo, JSONObj, CredentialSubject } from '@unumid/types';
import { validateProof } from './validateProof';

@@ -19,2 +19,3 @@ import { requireAuth } from '../requireAuth';

import { doVerify } from '../utils/verify';
import { convertCredentialSubject } from '../utils/convertCredentialSubject';

@@ -110,3 +111,4 @@ /**

// Check credentialSubject object has id element.
if (!credential.credentialSubject.id) {
const credentialSubject: CredentialSubject = convertCredentialSubject(credential.credentialSubject);
if (!credentialSubject.id) {
retObj.valid = false;

@@ -113,0 +115,0 @@ retObj.msg = `${invalidMsg} credentialSubject must contain id property.`;

@@ -127,6 +127,6 @@ import { NoPresentation, Presentation, VerifiedStatus, UnumDto, CustError } from '../../src/index';

},
credentialSubject: {
credentialSubject: JSON.stringify({
id: 'did:unum:3ff2f020-50b0-4f4c-a267-a9f104aedcd8',
test: 'test'
},
}),
issuer: 'did:unum:2e05967f-216f-44c4-ae8e-d6f71cd17c5a',

@@ -292,3 +292,3 @@ type: [

mockGetDIDDoc.mockResolvedValueOnce({ body: dummySubjectDidDoc, headers: dummyResponseHeaders });
mockDoVerify.mockReturnValueOnce(false);
mockDoVerify.mockReturnValue(false);
mockVerifyCredential.mockResolvedValue({ authToken: dummyAuthToken, body: false });

@@ -295,0 +295,0 @@ mockIsCredentialExpired.mockReturnValue(true);

@@ -93,6 +93,6 @@ // import * as utilLib from '../../src/utils';

},
credentialSubject: {
credentialSubject: JSON.stringify({
id: 'did:unum:5f5eb3dd-d0e0-4356-bfdd-96bc1393c705',
test: 'test'
},
}),
issuer: credentialIssuerDid,

@@ -99,0 +99,0 @@ type: [

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

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