@verii/vnf-nodejs-wallet-sdk 1.0.0-pre.1754473009 → 1.0.0-pre.1754543687
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/impl/data/verifiers/CredentialIssuerVerifierImpl.js +0 -3
- package/dist/impl/data/verifiers/CredentialIssuerVerifierImpl.js.map +1 -1
- package/package.json +3 -3
- package/dist/impl/utils/LoadJsonldContext.d.ts +0 -6
- package/dist/impl/utils/LoadJsonldContext.js +0 -68
- package/dist/impl/utils/LoadJsonldContext.js.map +0 -1
|
@@ -10,7 +10,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
const vc_checks_1 = require("@verii/vc-checks");
|
|
13
|
-
const LoadJsonldContext_1 = require("../../utils/LoadJsonldContext");
|
|
14
13
|
const VerificationUtils_1 = require("./VerificationUtils");
|
|
15
14
|
class CredentialIssuerVerifierImpl {
|
|
16
15
|
constructor(credentialTypesModel, networkService) {
|
|
@@ -20,13 +19,11 @@ class CredentialIssuerVerifierImpl {
|
|
|
20
19
|
verifyCredentials(jwtCredentials, finalizeOffersDescriptor) {
|
|
21
20
|
return __awaiter(this, void 0, void 0, function* () {
|
|
22
21
|
const verifiedPromises = jwtCredentials.map((jwtCredential) => __awaiter(this, void 0, void 0, function* () {
|
|
23
|
-
const jsonLdContext = yield (0, LoadJsonldContext_1.loadJsonldContext)(jwtCredential.payload.vc, this.networkService);
|
|
24
22
|
const credentialTypeMetadata = (0, VerificationUtils_1.getCredentialTypeMetadataByVc)(this.credentialTypesModel.data, jwtCredential);
|
|
25
23
|
return (0, vc_checks_1.verifyIssuerForCredentialType)(jwtCredential.payload.vc, finalizeOffersDescriptor.credentialManifest.issuerId, {
|
|
26
24
|
issuerAccreditation: finalizeOffersDescriptor.credentialManifest
|
|
27
25
|
.verifiedProfile.credentialSubject,
|
|
28
26
|
credentialTypeMetadata,
|
|
29
|
-
jsonLdContext,
|
|
30
27
|
}, {
|
|
31
28
|
log: console,
|
|
32
29
|
config: {},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CredentialIssuerVerifierImpl.js","sourceRoot":"","sources":["../../../../src/impl/data/verifiers/CredentialIssuerVerifierImpl.ts"],"names":[],"mappings":";;;;;;;;;;;AAMA,gDAAiE;
|
|
1
|
+
{"version":3,"file":"CredentialIssuerVerifierImpl.js","sourceRoot":"","sources":["../../../../src/impl/data/verifiers/CredentialIssuerVerifierImpl.ts"],"names":[],"mappings":";;;;;;;;;;;AAMA,gDAAiE;AAMjE,2DAAoE;AAEpE,MAAqB,4BAA4B;IAG7C,YACY,oBAA0C,EAC1C,cAA8B;QAD9B,yBAAoB,GAApB,oBAAoB,CAAsB;QAC1C,mBAAc,GAAd,cAAc,CAAgB;IACvC,CAAC;IAEE,iBAAiB,CACnB,cAAwB,EACxB,wBAAqD;;YAErD,MAAM,gBAAgB,GAAG,cAAc,CAAC,GAAG,CAAC,CAAO,aAAa,EAAE,EAAE;gBAChE,MAAM,sBAAsB,GAAG,IAAA,iDAA6B,EACxD,IAAI,CAAC,oBAAoB,CAAC,IAAI,EAC9B,aAAa,CAChB,CAAC;gBACF,OAAO,IAAA,yCAA6B,EAChC,aAAa,CAAC,OAAO,CAAC,EAAE,EACxB,wBAAwB,CAAC,kBAAkB,CAAC,QAAQ,EACpD;oBACI,mBAAmB,EACf,wBAAwB,CAAC,kBAAkB;yBACtC,eAAe,CAAC,iBAAiB;oBAC1C,sBAAsB;iBACzB,EACD;oBACI,GAAG,EAAE,OAAO;oBACZ,MAAM,EAAE,EAAE;iBACb,CACJ,CAAC;YACN,CAAC,CAAA,CAAC,CAAC;YACH,MAAM,QAAQ,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC;YACrD,OAAO,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC;QACpC,CAAC;KAAA;CACJ;AAnCD,+CAmCC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@verii/vnf-nodejs-wallet-sdk",
|
|
3
|
-
"version": "1.0.0-pre.
|
|
3
|
+
"version": "1.0.0-pre.1754543687",
|
|
4
4
|
"description": "VNF Wallet SDK Nodejs",
|
|
5
5
|
"repository": "https://github.com/LFDT-Verii/core",
|
|
6
6
|
"author": "Andres Olave",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"node": ">= 20.0.0"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@verii/vc-checks": "1.0.0-pre.
|
|
25
|
+
"@verii/vc-checks": "1.0.0-pre.1754543687",
|
|
26
26
|
"axios": "^1.7.9",
|
|
27
27
|
"canonicalize": "^2.1.0",
|
|
28
28
|
"jose": "^5.9.6",
|
|
@@ -55,5 +55,5 @@
|
|
|
55
55
|
"lib"
|
|
56
56
|
]
|
|
57
57
|
},
|
|
58
|
-
"gitHead": "
|
|
58
|
+
"gitHead": "8e7d25a089f4398a2d754426613e56100dc2d29c"
|
|
59
59
|
}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import Request from '../data/infrastructure/network/Request';
|
|
2
|
-
import { Dictionary } from '../../api/VCLTypes';
|
|
3
|
-
export interface NetworkService {
|
|
4
|
-
sendRequest: (request: Request) => Promise<any>;
|
|
5
|
-
}
|
|
6
|
-
export declare const loadJsonldContext: (issuerVcPayload: Dictionary<any>, networkService: NetworkService) => Promise<any>;
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.loadJsonldContext = void 0;
|
|
16
|
-
const fp_1 = require("lodash/fp");
|
|
17
|
-
const VCLLog_1 = __importDefault(require("./VCLLog"));
|
|
18
|
-
const Request_1 = __importDefault(require("../data/infrastructure/network/Request"));
|
|
19
|
-
const Urls_1 = require("../data/repositories/Urls");
|
|
20
|
-
const VCLError_1 = __importDefault(require("../../api/entities/error/VCLError"));
|
|
21
|
-
const VCLErrorCode_1 = __importDefault(require("../../api/entities/error/VCLErrorCode"));
|
|
22
|
-
const HttpMethod_1 = require("../data/infrastructure/network/HttpMethod");
|
|
23
|
-
const loadJsonldContext = (issuerVcPayload, networkService) => __awaiter(void 0, void 0, void 0, function* () {
|
|
24
|
-
const extractedContexts = extractContexts(issuerVcPayload) ||
|
|
25
|
-
extractContexts(issuerVcPayload.credentialSubject);
|
|
26
|
-
if (extractedContexts) {
|
|
27
|
-
const jsonldContextPromises = extractedContexts.map((jsonldContextUrl) => __awaiter(void 0, void 0, void 0, function* () {
|
|
28
|
-
try {
|
|
29
|
-
const response = yield networkService.sendRequest({
|
|
30
|
-
endpoint: jsonldContextUrl,
|
|
31
|
-
method: HttpMethod_1.HttpMethod.GET,
|
|
32
|
-
body: null,
|
|
33
|
-
headers: {
|
|
34
|
-
[Urls_1.HeaderKeys.XVnfProtocolVersion]: Urls_1.HeaderValues.XVnfProtocolVersion,
|
|
35
|
-
},
|
|
36
|
-
useCaches: true,
|
|
37
|
-
contentType: Request_1.default.ContentTypeApplicationJson,
|
|
38
|
-
});
|
|
39
|
-
return response.payload;
|
|
40
|
-
}
|
|
41
|
-
catch (error) {
|
|
42
|
-
VCLLog_1.default.error(error, `Failed to load JSON-LD context from ${jsonldContextUrl}`);
|
|
43
|
-
return null;
|
|
44
|
-
}
|
|
45
|
-
}));
|
|
46
|
-
const contexts = yield Promise.all(jsonldContextPromises);
|
|
47
|
-
const validContexts = contexts.filter((context) => context !== null);
|
|
48
|
-
if (validContexts.length > 0)
|
|
49
|
-
return validContexts[0];
|
|
50
|
-
throw new VCLError_1.default('context not found', VCLErrorCode_1.default.InvalidCredentialSubjectContext);
|
|
51
|
-
}
|
|
52
|
-
else if (!issuerVcPayload.credentialSubject) {
|
|
53
|
-
throw new VCLError_1.default('credentialSubject is NULL', VCLErrorCode_1.default.InvalidCredentialSubjectType);
|
|
54
|
-
}
|
|
55
|
-
else {
|
|
56
|
-
throw new VCLError_1.default('credentialSubject[@context] is NULL', VCLErrorCode_1.default.InvalidCredentialSubjectContext);
|
|
57
|
-
}
|
|
58
|
-
});
|
|
59
|
-
exports.loadJsonldContext = loadJsonldContext;
|
|
60
|
-
const extractContexts = (payload) => {
|
|
61
|
-
if (payload && payload['@context']) {
|
|
62
|
-
return (0, fp_1.isArray)(payload['@context'])
|
|
63
|
-
? payload['@context']
|
|
64
|
-
: [payload['@context']];
|
|
65
|
-
}
|
|
66
|
-
return null;
|
|
67
|
-
};
|
|
68
|
-
//# sourceMappingURL=LoadJsonldContext.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"LoadJsonldContext.js","sourceRoot":"","sources":["../../../src/impl/utils/LoadJsonldContext.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAOA,kCAAoC;AACpC,sDAA8B;AAC9B,qFAA6D;AAC7D,oDAAqE;AAErE,iFAAyD;AACzD,yFAAiE;AACjE,0EAAuE;AAMhE,MAAM,iB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