@sphereon/ssi-sdk.data-store 0.29.1-unstable.94 → 0.29.1-unstable.96
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/digitalCredential/DigitalCredentialStore.js +1 -1
- package/dist/digitalCredential/DigitalCredentialStore.js.map +1 -1
- package/dist/entities/digitalCredential/DigitalCredentialEntity.d.ts +2 -2
- package/dist/entities/digitalCredential/DigitalCredentialEntity.d.ts.map +1 -1
- package/dist/entities/digitalCredential/DigitalCredentialEntity.js.map +1 -1
- package/dist/migrations/postgres/1708525189001-CreateDigitalCredential.js +1 -1
- package/dist/migrations/postgres/1708525189001-CreateDigitalCredential.js.map +1 -1
- package/dist/migrations/sqlite/1708525189002-CreateDigitalCredential.js +2 -2
- package/dist/types/digitalCredential/digitalCredential.d.ts +1 -7
- package/dist/types/digitalCredential/digitalCredential.d.ts.map +1 -1
- package/dist/types/digitalCredential/digitalCredential.js +0 -32
- package/dist/types/digitalCredential/digitalCredential.js.map +1 -1
- package/dist/utils/digitalCredential/MappingUtils.d.ts +2 -1
- package/dist/utils/digitalCredential/MappingUtils.d.ts.map +1 -1
- package/dist/utils/digitalCredential/MappingUtils.js +9 -7
- package/dist/utils/digitalCredential/MappingUtils.js.map +1 -1
- package/package.json +7 -7
- package/src/digitalCredential/DigitalCredentialStore.ts +1 -1
- package/src/entities/digitalCredential/DigitalCredentialEntity.ts +2 -9
- package/src/migrations/postgres/1708525189001-CreateDigitalCredential.ts +1 -1
- package/src/migrations/sqlite/1708525189002-CreateDigitalCredential.ts +2 -2
- package/src/types/digitalCredential/digitalCredential.ts +1 -29
- package/src/utils/digitalCredential/MappingUtils.ts +15 -17
|
@@ -40,7 +40,7 @@ class DigitalCredentialStore extends AbstractDigitalCredentialStore_1.AbstractDi
|
|
|
40
40
|
return (0, MappingUtils_1.digitalCredentialFrom)(result);
|
|
41
41
|
});
|
|
42
42
|
this.getCredentials = (args) => __awaiter(this, void 0, void 0, function* () {
|
|
43
|
-
const { filter = {}, offset, limit, order = '
|
|
43
|
+
const { filter = {}, offset, limit, order = 'id.asc' } = args !== null && args !== void 0 ? args : {};
|
|
44
44
|
const sortOptions = order && typeof order === 'string'
|
|
45
45
|
? (0, SortingUtils_1.parseAndValidateOrderOptions)(order)
|
|
46
46
|
: order;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DigitalCredentialStore.js","sourceRoot":"","sources":["../../src/digitalCredential/DigitalCredentialStore.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,qFAAiF;AACjF,oCAUiB;AAGjB,kDAAyB;AACzB,mGAA+F;AAC/F,0EAIgD;AAEhD,wDAAoE;AAEpE,MAAM,KAAK,GAAmB,IAAA,eAAK,EAAC,mCAAmC,CAAC,CAAA;AAExE,MAAa,sBAAuB,SAAQ,+DAA8B;IAGxE,YAAY,YAAmC;QAC7C,KAAK,EAAE,CAAA;QAIT,kBAAa,GAAG,CAAO,IAAuB,EAA8B,EAAE;YAC5E,KAAK,CAAC,mBAAmB,EAAE,IAAI,CAAC,CAAA;YAChC,MAAM,iCAAiC,GAAwC,CAAC,MAAM,IAAI,CAAC,YAAY,CAAC,CAAC,aAAa,CAAC,iDAAuB,CAAC,CAAA;YAC/I,MAAM,gBAAgB,GAAkC,IAAA,6DAA8C,EAAC,IAAI,CAAC,CAAA;YAC5G,MAAM,aAAa,GAA4B,MAAM,iCAAiC,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAA;YAC7G,OAAO,OAAO,CAAC,OAAO,CAAC,IAAA,oCAAqB,EAAC,aAAa,CAAC,CAAC,CAAA;QAC9D,CAAC,CAAA,CAAA;QAED,kBAAa,GAAG,CAAO,IAAuB,EAA8B,EAAE;YAC5E,MAAM,MAAM,GAAmC,MAAM,CAAC,MAAM,IAAI,CAAC,YAAY,CAAC,CAAC,aAAa,CAAC,iDAAuB,CAAC,CAAC,OAAO,CAAC;gBAC5H,KAAK,EAAE,IAAI;aACZ,C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AI,CAAC,YAAY,GAAG,YAAY,CAAA;IAClC,CAAC;CAoGF;AA1GD,wDA0GC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BaseEntity } from 'typeorm';
|
|
2
|
-
import { CredentialCorrelationType, CredentialDocumentFormat, CredentialRole, CredentialStateType,
|
|
3
|
-
export declare class DigitalCredentialEntity extends BaseEntity
|
|
2
|
+
import { CredentialCorrelationType, CredentialDocumentFormat, CredentialRole, CredentialStateType, DocumentType } from '../../types';
|
|
3
|
+
export declare class DigitalCredentialEntity extends BaseEntity {
|
|
4
4
|
id: string;
|
|
5
5
|
documentType: DocumentType;
|
|
6
6
|
documentFormat: CredentialDocumentFormat;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DigitalCredentialEntity.d.ts","sourceRoot":"","sources":["../../../src/entities/digitalCredential/DigitalCredentialEntity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAA8E,MAAM,SAAS,CAAA;AAChH,OAAO,
|
|
1
|
+
{"version":3,"file":"DigitalCredentialEntity.d.ts","sourceRoot":"","sources":["../../../src/entities/digitalCredential/DigitalCredentialEntity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAA8E,MAAM,SAAS,CAAA;AAChH,OAAO,EAAE,yBAAyB,EAAE,wBAAwB,EAAE,cAAc,EAAE,mBAAmB,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAGpI,qBACa,uBAAwB,SAAQ,UAAU;IAErD,EAAE,EAAG,MAAM,CAAA;IAGX,YAAY,EAAG,YAAY,CAAA;IAG3B,cAAc,EAAG,wBAAwB,CAAA;IAGzC,cAAc,EAAG,cAAc,CAAA;IAG/B,WAAW,EAAG,MAAM,CAAA;IAGpB,eAAe,EAAG,MAAM,CAAA;IAGxB,YAAY,EAAG,MAAM,CAAA;IAGrB,IAAI,EAAG,MAAM,CAAA;IAGb,qBAAqB,EAAG,yBAAyB,CAAA;IAGjD,sBAAsB,CAAC,EAAE,yBAAyB,CAAA;IAGlD,mBAAmB,EAAG,MAAM,CAAA;IAG5B,oBAAoB,CAAC,EAAE,MAAM,CAAA;IAG7B,aAAa,CAAC,EAAE,mBAAmB,CAAA;IAGnC,QAAQ,CAAC,EAAE,MAAM,CAAA;IAGjB,SAAS,EAAG,IAAI,CAAA;IAGhB,aAAa,EAAG,IAAI,CAAA;IAGpB,UAAU,CAAC,EAAE,IAAI,CAAA;IAGjB,SAAS,CAAC,EAAE,IAAI,CAAA;IAGhB,UAAU,CAAC,EAAE,IAAI,CAAA;IAGjB,SAAS,CAAC,EAAE,IAAI,CAAA;CACjB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DigitalCredentialEntity.js","sourceRoot":"","sources":["../../../src/entities/digitalCredential/DigitalCredentialEntity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qCAAgH;AAChH,
|
|
1
|
+
{"version":3,"file":"DigitalCredentialEntity.js","sourceRoot":"","sources":["../../../src/entities/digitalCredential/DigitalCredentialEntity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qCAAgH;AAChH,uCAAoI;AACpI,yEAA6E;AAGtE,IAAM,uBAAuB,GAA7B,MAAM,uBAAwB,SAAQ,oBAAU;CA4DtD,CAAA;AA5DY,0DAAuB;AAElC;IADC,IAAA,gCAAsB,EAAC,MAAM,CAAC;;mDACpB;AAGX;IADC,IAAA,gBAAM,EAAC,aAAa,EAAE,EAAE,IAAI,EAAE,eAAe,EAAE,IAAI,EAAE,oBAAY,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;;6DAC3D;AAG3B;IADC,IAAA,gBAAM,EAAC,aAAa,EAAE,EAAE,IAAI,EAAE,iBAAiB,EAAE,IAAI,EAAE,gCAAwB,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;;+DAC3D;AAGzC;IADC,IAAA,gBAAM,EAAC,aAAa,EAAE,EAAE,IAAI,EAAE,iBAAiB,EAAE,IAAI,EAAE,sBAAc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CREATE TYPE "digital_credential_document_format" AS ENUM('JSON_LD', 'JWT', 'SD_JWT', 'MDOC')`);
|
|
21
21
|
yield queryRunner.query(`CREATE TYPE "digital_credential_credential_role" AS ENUM('ISSUER', 'VERIFIER', 'HOLDER')`);
|
|
22
|
-
yield queryRunner.query(`CREATE TYPE "digital_credential_correlation_type" AS ENUM('DID'
|
|
22
|
+
yield queryRunner.query(`CREATE TYPE "digital_credential_correlation_type" AS ENUM('DID')`);
|
|
23
23
|
yield queryRunner.query(`CREATE TYPE "digital_credential_state_type" AS ENUM('REVOKED', 'VERIFIED', 'EXPIRED')`);
|
|
24
24
|
yield queryRunner.query(`
|
|
25
25
|
CREATE TABLE "DigitalCredential" (
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"1708525189001-CreateDigitalCredential.js","sourceRoot":"","sources":["../../../src/migrations/postgres/1708525189001-CreateDigitalCredential.ts"],"names":[],"mappings":";;;;;;;;;;;;AAEA,MAAa,oCAAoC;IAAjD;QACE,SAAI,GAAG,sCAAsC,CAAA;IA4C/C,CAAC;IA1Cc,EAAE,CAAC,WAAwB;;YACtC,MAAM,WAAW,CAAC,KAAK,CAAC,mEAAmE,CAAC,CAAA;YAC5F,MAAM,WAAW,CAAC,KAAK,CAAC,8FAA8F,CAAC,CAAA;YACvH,MAAM,WAAW,CAAC,KAAK,CAAC,0FAA0F,CAAC,CAAA;YACnH,MAAM,WAAW,CAAC,KAAK,CAAC,
|
|
1
|
+
{"version":3,"file":"1708525189001-CreateDigitalCredential.js","sourceRoot":"","sources":["../../../src/migrations/postgres/1708525189001-CreateDigitalCredential.ts"],"names":[],"mappings":";;;;;;;;;;;;AAEA,MAAa,oCAAoC;IAAjD;QACE,SAAI,GAAG,sCAAsC,CAAA;IA4C/C,CAAC;IA1Cc,EAAE,CAAC,WAAwB;;YACtC,MAAM,WAAW,CAAC,KAAK,CAAC,mEAAmE,CAAC,CAAA;YAC5F,MAAM,WAAW,CAAC,KAAK,CAAC,8FAA8F,CAAC,CAAA;YACvH,MAAM,WAAW,CAAC,KAAK,CAAC,0FAA0F,CAAC,CAAA;YACnH,MAAM,WAAW,CAAC,KAAK,CAAC,kEAAkE,CAAC,CAAA;YAC3F,MAAM,WAAW,CAAC,KAAK,CAAC,uFAAuF,CAAC,CAAA;YAEhH,MAAM,WAAW,CAAC,KAAK,CAAC;;;;;;;;;;;;;;;;;;;;;;;;KAwBvB,CAAC,CAAA;QACJ,CAAC;KAAA;IAEY,IAAI,CAAC,WAAwB;;YACxC,MAAM,WAAW,CAAC,KAAK,CAAC,gCAAgC,CAAC,CAAA;YACzD,MAAM,WAAW,CAAC,KAAK,CAAC,2CAA2C,CAAC,CAAA;YACpE,MAAM,WAAW,CAAC,KAAK,CAAC,iDAAiD,CAAC,CAAA;YAC1E,MAAM,WAAW,CAAC,KAAK,CAAC,gDAAgD,CAAC,CAAA;YACzE,MAAM,WAAW,CAAC,KAAK,CAAC,gDAAgD,CAAC,CAAA;YACzE,MAAM,WAAW,CAAC,KAAK,CAAC,mCAAmC,CAAC,CAAA;QAC9D,CAAC;KAAA;CACF;AA7CD,oFA6CC"}
|
|
@@ -26,8 +26,8 @@ class CreateDigitalCredential1708525189002 {
|
|
|
26
26
|
"uniform_document" text NOT NULL,
|
|
27
27
|
"credential_id" text,
|
|
28
28
|
"hash" text NOT NULL UNIQUE,
|
|
29
|
-
"issuer_correlation_type" varchar CHECK( "issuer_correlation_type" IN ('DID'
|
|
30
|
-
"subject_correlation_type" varchar CHECK( "subject_correlation_type" IN ('DID'
|
|
29
|
+
"issuer_correlation_type" varchar CHECK( "issuer_correlation_type" IN ('DID') ) NOT NULL,
|
|
30
|
+
"subject_correlation_type" varchar CHECK( "subject_correlation_type" IN ('DID') ),
|
|
31
31
|
"issuer_correlation_id" text NOT NULL,
|
|
32
32
|
"subject_correlation_id" text,
|
|
33
33
|
"verified_state" varchar CHECK( "verified_state" IN ('REVOKED', 'VERIFIED', 'EXPIRED') ),
|
|
@@ -33,14 +33,8 @@ export declare enum CredentialDocumentFormat {
|
|
|
33
33
|
SD_JWT = "SD_JWT",
|
|
34
34
|
MDOC = "MDOC"
|
|
35
35
|
}
|
|
36
|
-
export declare namespace CredentialDocumentFormat {
|
|
37
|
-
function fromSpecValue(credentialFormat: string): CredentialDocumentFormat;
|
|
38
|
-
function toSpecValue(documentFormat: CredentialDocumentFormat, documentType: DocumentType): "vc+sd-jwt" | "mso_mdoc" | "ldp_vc" | "ldp_vp" | "jwt_vc_json" | "jwt_vp_json";
|
|
39
|
-
}
|
|
40
36
|
export declare enum CredentialCorrelationType {
|
|
41
|
-
DID = "DID"
|
|
42
|
-
X509_CN = "X509_CN",
|
|
43
|
-
URL = "URL"
|
|
37
|
+
DID = "DID"
|
|
44
38
|
}
|
|
45
39
|
export declare enum CredentialRole {
|
|
46
40
|
ISSUER = "ISSUER",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"digitalCredential.d.ts","sourceRoot":"","sources":["../../../src/types/digitalCredential/digitalCredential.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,6BAA6B,GAAG,IAAI,CAAC,iBAAiB,EAAE,IAAI,CAAC,CAAA;AAEzE,MAAM,MAAM,iBAAiB,GAAG;IAC9B,EAAE,EAAE,MAAM,CAAA;IACV,YAAY,EAAE,YAAY,CAAA;IAC1B,cAAc,EAAE,wBAAwB,CAAA;IACxC,cAAc,EAAE,cAAc,CAAA;IAC9B,WAAW,EAAE,MAAM,CAAA;IACnB,eAAe,EAAE,MAAM,CAAA;IACvB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,IAAI,EAAE,MAAM,CAAA;IACZ,qBAAqB,EAAE,yBAAyB,CAAA;IAChD,sBAAsB,CAAC,EAAE,yBAAyB,CAAA;IAClD,mBAAmB,EAAE,MAAM,CAAA;IAC3B,oBAAoB,CAAC,EAAE,MAAM,CAAA;IAC7B,aAAa,CAAC,EAAE,mBAAmB,CAAA;IACnC,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,SAAS,EAAE,IAAI,CAAA;IACf,aAAa,EAAE,IAAI,CAAA;IACnB,UAAU,CAAC,EAAE,IAAI,CAAA;IACjB,SAAS,CAAC,EAAE,IAAI,CAAA;IAChB,UAAU,CAAC,EAAE,IAAI,CAAA;IACjB,SAAS,CAAC,EAAE,IAAI,CAAA;CACjB,CAAA;AAED,oBAAY,YAAY;IACtB,EAAE,OAAO;IACT,EAAE,OAAO;IACT,CAAC,MAAM;IACP,CAAC,MAAM;CACR;AAED,oBAAY,wBAAwB;IAClC,OAAO,YAAY;IACnB,GAAG,QAAQ;IACX,MAAM,WAAW;IACjB,IAAI,SAAS;CACd;AAED,
|
|
1
|
+
{"version":3,"file":"digitalCredential.d.ts","sourceRoot":"","sources":["../../../src/types/digitalCredential/digitalCredential.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,6BAA6B,GAAG,IAAI,CAAC,iBAAiB,EAAE,IAAI,CAAC,CAAA;AAEzE,MAAM,MAAM,iBAAiB,GAAG;IAC9B,EAAE,EAAE,MAAM,CAAA;IACV,YAAY,EAAE,YAAY,CAAA;IAC1B,cAAc,EAAE,wBAAwB,CAAA;IACxC,cAAc,EAAE,cAAc,CAAA;IAC9B,WAAW,EAAE,MAAM,CAAA;IACnB,eAAe,EAAE,MAAM,CAAA;IACvB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,IAAI,EAAE,MAAM,CAAA;IACZ,qBAAqB,EAAE,yBAAyB,CAAA;IAChD,sBAAsB,CAAC,EAAE,yBAAyB,CAAA;IAClD,mBAAmB,EAAE,MAAM,CAAA;IAC3B,oBAAoB,CAAC,EAAE,MAAM,CAAA;IAC7B,aAAa,CAAC,EAAE,mBAAmB,CAAA;IACnC,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,SAAS,EAAE,IAAI,CAAA;IACf,aAAa,EAAE,IAAI,CAAA;IACnB,UAAU,CAAC,EAAE,IAAI,CAAA;IACjB,SAAS,CAAC,EAAE,IAAI,CAAA;IAChB,UAAU,CAAC,EAAE,IAAI,CAAA;IACjB,SAAS,CAAC,EAAE,IAAI,CAAA;CACjB,CAAA;AAED,oBAAY,YAAY;IACtB,EAAE,OAAO;IACT,EAAE,OAAO;IACT,CAAC,MAAM;IACP,CAAC,MAAM;CACR;AAED,oBAAY,wBAAwB;IAClC,OAAO,YAAY;IACnB,GAAG,QAAQ;IACX,MAAM,WAAW;IACjB,IAAI,SAAS;CACd;AAED,oBAAY,yBAAyB;IACnC,GAAG,QAAQ;CACZ;AAED,oBAAY,cAAc;IACxB,MAAM,WAAW;IACjB,QAAQ,aAAa;IACrB,MAAM,WAAW;CAClB;AAED,oBAAY,mBAAmB;IAC7B,OAAO,YAAY;IACnB,QAAQ,aAAa;IACrB,OAAO,YAAY;CACpB"}
|
|
@@ -15,41 +15,9 @@ var CredentialDocumentFormat;
|
|
|
15
15
|
CredentialDocumentFormat["SD_JWT"] = "SD_JWT";
|
|
16
16
|
CredentialDocumentFormat["MDOC"] = "MDOC";
|
|
17
17
|
})(CredentialDocumentFormat || (exports.CredentialDocumentFormat = CredentialDocumentFormat = {}));
|
|
18
|
-
(function (CredentialDocumentFormat) {
|
|
19
|
-
function fromSpecValue(credentialFormat) {
|
|
20
|
-
const format = credentialFormat.toLowerCase();
|
|
21
|
-
if (format.includes('sd')) {
|
|
22
|
-
return CredentialDocumentFormat.SD_JWT;
|
|
23
|
-
}
|
|
24
|
-
else if (format.includes('ldp')) {
|
|
25
|
-
return CredentialDocumentFormat.JSON_LD;
|
|
26
|
-
}
|
|
27
|
-
else if (format.includes('mso') || credentialFormat.includes('mdoc')) {
|
|
28
|
-
return CredentialDocumentFormat.MDOC;
|
|
29
|
-
}
|
|
30
|
-
else if (format.includes('jwt_')) {
|
|
31
|
-
return CredentialDocumentFormat.JWT;
|
|
32
|
-
}
|
|
33
|
-
else {
|
|
34
|
-
throw Error(`Could not map format ${format} to known format`);
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
CredentialDocumentFormat.fromSpecValue = fromSpecValue;
|
|
38
|
-
function toSpecValue(documentFormat, documentType) {
|
|
39
|
-
switch (documentFormat) {
|
|
40
|
-
case CredentialDocumentFormat.SD_JWT: return 'vc+sd-jwt';
|
|
41
|
-
case CredentialDocumentFormat.MDOC: return 'mso_mdoc';
|
|
42
|
-
case CredentialDocumentFormat.JSON_LD: return documentType === DocumentType.C || documentType === DocumentType.VC ? 'ldp_vc' : 'ldp_vp';
|
|
43
|
-
case CredentialDocumentFormat.JWT: return documentType === DocumentType.C || documentType === DocumentType.VC ? 'jwt_vc_json' : 'jwt_vp_json';
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
CredentialDocumentFormat.toSpecValue = toSpecValue;
|
|
47
|
-
})(CredentialDocumentFormat || (exports.CredentialDocumentFormat = CredentialDocumentFormat = {}));
|
|
48
18
|
var CredentialCorrelationType;
|
|
49
19
|
(function (CredentialCorrelationType) {
|
|
50
20
|
CredentialCorrelationType["DID"] = "DID";
|
|
51
|
-
CredentialCorrelationType["X509_CN"] = "X509_CN";
|
|
52
|
-
CredentialCorrelationType["URL"] = "URL";
|
|
53
21
|
})(CredentialCorrelationType || (exports.CredentialCorrelationType = CredentialCorrelationType = {}));
|
|
54
22
|
var CredentialRole;
|
|
55
23
|
(function (CredentialRole) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"digitalCredential.js","sourceRoot":"","sources":["../../../src/types/digitalCredential/digitalCredential.ts"],"names":[],"mappings":";;;AAyBA,IAAY,YAKX;AALD,WAAY,YAAY;IACtB,yBAAS,CAAA;IACT,yBAAS,CAAA;IACT,uBAAO,CAAA;IACP,uBAAO,CAAA;AACT,CAAC,EALW,YAAY,4BAAZ,YAAY,QAKvB;AAED,IAAY,wBAKX;AALD,WAAY,wBAAwB;IAClC,+CAAmB,CAAA;IACnB,uCAAW,CAAA;IACX,6CAAiB,CAAA;IACjB,yCAAa,CAAA;AACf,CAAC,EALW,wBAAwB,wCAAxB,wBAAwB,QAKnC;AAED,
|
|
1
|
+
{"version":3,"file":"digitalCredential.js","sourceRoot":"","sources":["../../../src/types/digitalCredential/digitalCredential.ts"],"names":[],"mappings":";;;AAyBA,IAAY,YAKX;AALD,WAAY,YAAY;IACtB,yBAAS,CAAA;IACT,yBAAS,CAAA;IACT,uBAAO,CAAA;IACP,uBAAO,CAAA;AACT,CAAC,EALW,YAAY,4BAAZ,YAAY,QAKvB;AAED,IAAY,wBAKX;AALD,WAAY,wBAAwB;IAClC,+CAAmB,CAAA;IACnB,uCAAW,CAAA;IACX,6CAAiB,CAAA;IACjB,yCAAa,CAAA;AACf,CAAC,EALW,wBAAwB,wCAAxB,wBAAwB,QAKnC;AAED,IAAY,yBAEX;AAFD,WAAY,yBAAyB;IACnC,wCAAW,CAAA;AACb,CAAC,EAFW,yBAAyB,yCAAzB,yBAAyB,QAEpC;AAED,IAAY,cAIX;AAJD,WAAY,cAAc;IACxB,mCAAiB,CAAA;IACjB,uCAAqB,CAAA;IACrB,mCAAiB,CAAA;AACnB,CAAC,EAJW,cAAc,8BAAd,cAAc,QAIzB;AAED,IAAY,mBAIX;AAJD,WAAY,mBAAmB;IAC7B,0CAAmB,CAAA;IACnB,4CAAqB,CAAA;IACrB,0CAAmB,CAAA;AACrB,CAAC,EAJW,mBAAmB,mCAAnB,mBAAmB,QAI9B"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { AddCredentialArgs } from '../../types';
|
|
1
2
|
import { DigitalCredentialEntity } from '../../entities/digitalCredential/DigitalCredentialEntity';
|
|
2
|
-
import {
|
|
3
|
+
import { DigitalCredential, NonPersistedDigitalCredential } from '../../types';
|
|
3
4
|
export declare const nonPersistedDigitalCredentialEntityFromAddArgs: (addCredentialArgs: AddCredentialArgs) => NonPersistedDigitalCredential;
|
|
4
5
|
export declare const digitalCredentialFrom: (credentialEntity: DigitalCredentialEntity) => DigitalCredential;
|
|
5
6
|
export declare const digitalCredentialsFrom: (credentialEntities: Array<DigitalCredentialEntity>) => DigitalCredential[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MappingUtils.d.ts","sourceRoot":"","sources":["../../../src/utils/digitalCredential/MappingUtils.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"MappingUtils.d.ts","sourceRoot":"","sources":["../../../src/utils/digitalCredential/MappingUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAA;AAC/C,OAAO,EAAE,uBAAuB,EAAE,MAAM,0DAA0D,CAAA;AAWlG,OAAO,EAA0C,iBAAiB,EAAE,6BAA6B,EAAE,MAAM,aAAa,CAAA;AAqEtH,eAAO,MAAM,8CAA8C,sBAAuB,iBAAiB,KAAG,6BA0BrG,CAAA;AAED,eAAO,MAAM,qBAAqB,qBAAsB,uBAAuB,KAAG,iBAIjF,CAAA;AAED,eAAO,MAAM,sBAAsB,uBAAwB,MAAM,uBAAuB,CAAC,KAAG,iBAAiB,EAE5G,CAAA"}
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.digitalCredentialsFrom = exports.digitalCredentialFrom = exports.nonPersistedDigitalCredentialEntityFromAddArgs = void 0;
|
|
4
4
|
const ssi_types_1 = require("@sphereon/ssi-types");
|
|
5
|
-
const utils_1 = require("@veramo/utils");
|
|
6
5
|
const types_1 = require("../../types");
|
|
6
|
+
const utils_1 = require("@veramo/utils");
|
|
7
7
|
function determineDocumentType(raw) {
|
|
8
8
|
const rawDocument = parseRawDocument(raw);
|
|
9
9
|
if (!rawDocument) {
|
|
@@ -51,7 +51,7 @@ function getValidUntil(uniformDocument) {
|
|
|
51
51
|
return new Date(uniformDocument.validUntil);
|
|
52
52
|
}
|
|
53
53
|
else if ('exp' in uniformDocument) {
|
|
54
|
-
return new Date(uniformDocument.exp
|
|
54
|
+
return new Date(uniformDocument.exp);
|
|
55
55
|
}
|
|
56
56
|
return undefined;
|
|
57
57
|
}
|
|
@@ -71,18 +71,20 @@ function getValidFrom(uniformDocument) {
|
|
|
71
71
|
return undefined;
|
|
72
72
|
}
|
|
73
73
|
const nonPersistedDigitalCredentialEntityFromAddArgs = (addCredentialArgs) => {
|
|
74
|
-
var _a
|
|
74
|
+
var _a;
|
|
75
75
|
const documentType = determineDocumentType(addCredentialArgs.rawDocument);
|
|
76
76
|
const documentFormat = ssi_types_1.CredentialMapper.detectDocumentType(addCredentialArgs.rawDocument);
|
|
77
77
|
if (documentFormat === 2 /* DocumentFormat.SD_JWT_VC */ && !((_a = addCredentialArgs.opts) === null || _a === void 0 ? void 0 : _a.hasher)) {
|
|
78
78
|
throw new Error('No hasher function is provided for SD_JWT credential.');
|
|
79
79
|
}
|
|
80
|
-
const
|
|
81
|
-
|
|
80
|
+
const uniformDocument = documentFormat === 2 /* DocumentFormat.SD_JWT_VC */
|
|
81
|
+
? (0, ssi_types_1.decodeSdJwtVc)(addCredentialArgs.rawDocument, addCredentialArgs.opts.hasher).decodedPayload
|
|
82
|
+
: documentType === types_1.DocumentType.VC || documentType === types_1.DocumentType.C
|
|
83
|
+
? ssi_types_1.CredentialMapper.toUniformCredential(addCredentialArgs.rawDocument)
|
|
84
|
+
: ssi_types_1.CredentialMapper.toUniformPresentation(addCredentialArgs.rawDocument);
|
|
82
85
|
const validFrom = getValidFrom(uniformDocument);
|
|
83
86
|
const validUntil = getValidUntil(uniformDocument);
|
|
84
|
-
|
|
85
|
-
return Object.assign(Object.assign({}, addCredentialArgs), { documentType, documentFormat: determineCredentialDocumentFormat(documentFormat), createdAt: new Date(), credentialId: (_c = uniformDocument.id) !== null && _c !== void 0 ? _c : hash, hash, uniformDocument: JSON.stringify(uniformDocument), validFrom,
|
|
87
|
+
return Object.assign(Object.assign({}, addCredentialArgs), { documentType, documentFormat: determineCredentialDocumentFormat(documentFormat), createdAt: new Date(), credentialId: uniformDocument.id, hash: (0, utils_1.computeEntryHash)(addCredentialArgs.rawDocument), uniformDocument: JSON.stringify(uniformDocument), validFrom,
|
|
86
88
|
validUntil, lastUpdatedAt: new Date() });
|
|
87
89
|
};
|
|
88
90
|
exports.nonPersistedDigitalCredentialEntityFromAddArgs = nonPersistedDigitalCredentialEntityFromAddArgs;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MappingUtils.js","sourceRoot":"","sources":["../../../src/utils/digitalCredential/MappingUtils.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"MappingUtils.js","sourceRoot":"","sources":["../../../src/utils/digitalCredential/MappingUtils.ts"],"names":[],"mappings":";;;AAEA,mDAS4B;AAC5B,uCAAsH;AACtH,yCAAgD;AAEhD,SAAS,qBAAqB,CAAC,GAAW;IACxC,MAAM,WAAW,GAAG,gBAAgB,CAAC,GAAG,CAAC,CAAA;IACzC,IAAI,CAAC,WAAW,EAAE,CAAC;QACjB,MAAM,IAAI,KAAK,CAAC,kCAAkC,GAAG,EAAE,CAAC,CAAA;IAC1D,CAAC;IAED,MAAM,QAAQ,GAAG,4BAAgB,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAA;IACvD,MAAM,YAAY,GAAG,4BAAgB,CAAC,YAAY,CAAC,WAAW,CAAC,CAAA;IAC/D,MAAM,cAAc,GAAG,4BAAgB,CAAC,cAAc,CAAC,WAAW,CAAC,CAAA;IAEnE,IAAI,YAAY,EAAE,CAAC;QACjB,OAAO,QAAQ,CAAC,CAAC,CAAC,oBAAY,CAAC,EAAE,CAAC,CAAC,CAAC,oBAAY,CAAC,CAAC,CAAA;IACpD,CAAC;SAAM,IAAI,cAAc,EAAE,CAAC;QAC1B,OAAO,QAAQ,CAAC,CAAC,CAAC,oBAAY,CAAC,EAAE,CAAC,CAAC,CAAC,oBAAY,CAAC,CAAC,CAAA;IACpD,CAAC;IACD,MAAM,IAAI,KAAK,CAAC,kDAAkD,GAAG,EAAE,CAAC,CAAA;AAC1E,CAAC;AAED,SAAS,gBAAgB,CAAC,GAAW;IACnC,IAAI,4BAAgB,CAAC,YAA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ACnE,uCACK,iBAAiB,KACpB,YAAY,EACZ,cAAc,EAAE,iCAAiC,CAAC,cAAc,CAAC,EACjE,SAAS,EAAE,IAAI,IAAI,EAAE,EACrB,YAAY,EAAE,eAAe,CAAC,EAAwB,EACtD,IAAI,EAAE,IAAA,wBAAgB,EAAC,iBAAiB,CAAC,WAAW,CAAC,EACrD,eAAe,EAAE,IAAI,CAAC,SAAS,CAAC,eAAe,CAAC,EAChD,SAAS;QACT,UAAU,EACV,aAAa,EAAE,IAAI,IAAI,EAAE,IAC1B;AACH,CAAC,CAAA;AA1BY,QAAA,8CAA8C,kDA0B1D;AAEM,MAAM,qBAAqB,GAAG,CAAC,gBAAyC,EAAqB,EAAE;IACpG,yBACK,gBAAgB,EACpB;AACH,CAAC,CAAA;AAJY,QAAA,qBAAqB,yBAIjC;AAEM,MAAM,sBAAsB,GAAG,CAAC,kBAAkD,EAAuB,EAAE;IAChH,OAAO,kBAAkB,CAAC,GAAG,CAAC,CAAC,gBAAgB,EAAE,EAAE,CAAC,IAAA,6BAAqB,EAAC,gBAAgB,CAAC,CAAC,CAAA;AAC9F,CAAC,CAAA;AAFY,QAAA,sBAAsB,0BAElC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sphereon/ssi-sdk.data-store",
|
|
3
|
-
"version": "0.29.1-unstable.
|
|
3
|
+
"version": "0.29.1-unstable.96+438312cf",
|
|
4
4
|
"source": "src/index.ts",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -15,11 +15,11 @@
|
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"@sphereon/pex": "^4.0.1",
|
|
18
|
-
"@sphereon/ssi-sdk-ext.did-utils": "0.24.1-
|
|
19
|
-
"@sphereon/ssi-sdk-ext.identifier-resolution": "0.24.1-
|
|
20
|
-
"@sphereon/ssi-sdk.agent-config": "0.29.1-unstable.
|
|
21
|
-
"@sphereon/ssi-sdk.core": "0.29.1-unstable.
|
|
22
|
-
"@sphereon/ssi-types": "0.29.1-unstable.
|
|
18
|
+
"@sphereon/ssi-sdk-ext.did-utils": "0.24.1-unstable.82",
|
|
19
|
+
"@sphereon/ssi-sdk-ext.identifier-resolution": "0.24.1-unstable.82",
|
|
20
|
+
"@sphereon/ssi-sdk.agent-config": "0.29.1-unstable.96+438312cf",
|
|
21
|
+
"@sphereon/ssi-sdk.core": "0.29.1-unstable.96+438312cf",
|
|
22
|
+
"@sphereon/ssi-types": "0.29.1-unstable.96+438312cf",
|
|
23
23
|
"@veramo/core": "4.2.0",
|
|
24
24
|
"@veramo/utils": "4.2.0",
|
|
25
25
|
"blakejs": "^1.2.1",
|
|
@@ -50,5 +50,5 @@
|
|
|
50
50
|
"PostgreSQL",
|
|
51
51
|
"Contact Store"
|
|
52
52
|
],
|
|
53
|
-
"gitHead": "
|
|
53
|
+
"gitHead": "438312cf027c2ce42a10a35b51b03c41e292965d"
|
|
54
54
|
}
|
|
@@ -52,7 +52,7 @@ export class DigitalCredentialStore extends AbstractDigitalCredentialStore {
|
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
getCredentials = async (args?: GetCredentialsArgs): Promise<GetCredentialsResponse> => {
|
|
55
|
-
const { filter = {}, offset, limit, order = '
|
|
55
|
+
const { filter = {}, offset, limit, order = 'id.asc' } = args ?? {}
|
|
56
56
|
const sortOptions: FindOptionsOrder<DigitalCredentialEntity> =
|
|
57
57
|
order && typeof order === 'string'
|
|
58
58
|
? parseAndValidateOrderOptions<DigitalCredentialEntity>(order)
|
|
@@ -1,16 +1,9 @@
|
|
|
1
1
|
import { BaseEntity, Column, CreateDateColumn, Entity, PrimaryGeneratedColumn, UpdateDateColumn } from 'typeorm'
|
|
2
|
-
import {
|
|
3
|
-
CredentialCorrelationType,
|
|
4
|
-
CredentialDocumentFormat,
|
|
5
|
-
CredentialRole,
|
|
6
|
-
CredentialStateType,
|
|
7
|
-
DigitalCredential,
|
|
8
|
-
DocumentType
|
|
9
|
-
} from '../../types'
|
|
2
|
+
import { CredentialCorrelationType, CredentialDocumentFormat, CredentialRole, CredentialStateType, DocumentType } from '../../types'
|
|
10
3
|
import { typeormDate, typeOrmDateTime } from '@sphereon/ssi-sdk.agent-config'
|
|
11
4
|
|
|
12
5
|
@Entity('DigitalCredential')
|
|
13
|
-
export class DigitalCredentialEntity extends BaseEntity
|
|
6
|
+
export class DigitalCredentialEntity extends BaseEntity {
|
|
14
7
|
@PrimaryGeneratedColumn('uuid')
|
|
15
8
|
id!: string
|
|
16
9
|
|
|
@@ -7,7 +7,7 @@ export class CreateDigitalCredential1708525189001 implements MigrationInterface
|
|
|
7
7
|
await queryRunner.query(`CREATE TYPE "digital_document_type" AS ENUM('VC', 'VP', 'C', 'P')`)
|
|
8
8
|
await queryRunner.query(`CREATE TYPE "digital_credential_document_format" AS ENUM('JSON_LD', 'JWT', 'SD_JWT', 'MDOC')`)
|
|
9
9
|
await queryRunner.query(`CREATE TYPE "digital_credential_credential_role" AS ENUM('ISSUER', 'VERIFIER', 'HOLDER')`)
|
|
10
|
-
await queryRunner.query(`CREATE TYPE "digital_credential_correlation_type" AS ENUM('DID'
|
|
10
|
+
await queryRunner.query(`CREATE TYPE "digital_credential_correlation_type" AS ENUM('DID')`)
|
|
11
11
|
await queryRunner.query(`CREATE TYPE "digital_credential_state_type" AS ENUM('REVOKED', 'VERIFIED', 'EXPIRED')`)
|
|
12
12
|
|
|
13
13
|
await queryRunner.query(`
|
|
@@ -14,8 +14,8 @@ export class CreateDigitalCredential1708525189002 implements MigrationInterface
|
|
|
14
14
|
"uniform_document" text NOT NULL,
|
|
15
15
|
"credential_id" text,
|
|
16
16
|
"hash" text NOT NULL UNIQUE,
|
|
17
|
-
"issuer_correlation_type" varchar CHECK( "issuer_correlation_type" IN ('DID'
|
|
18
|
-
"subject_correlation_type" varchar CHECK( "subject_correlation_type" IN ('DID'
|
|
17
|
+
"issuer_correlation_type" varchar CHECK( "issuer_correlation_type" IN ('DID') ) NOT NULL,
|
|
18
|
+
"subject_correlation_type" varchar CHECK( "subject_correlation_type" IN ('DID') ),
|
|
19
19
|
"issuer_correlation_id" text NOT NULL,
|
|
20
20
|
"subject_correlation_id" text,
|
|
21
21
|
"verified_state" varchar CHECK( "verified_state" IN ('REVOKED', 'VERIFIED', 'EXPIRED') ),
|
|
@@ -34,39 +34,11 @@ export enum CredentialDocumentFormat {
|
|
|
34
34
|
JSON_LD = 'JSON_LD',
|
|
35
35
|
JWT = 'JWT',
|
|
36
36
|
SD_JWT = 'SD_JWT',
|
|
37
|
-
MDOC = 'MDOC'
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
export namespace CredentialDocumentFormat {
|
|
41
|
-
export function fromSpecValue(credentialFormat: string) {
|
|
42
|
-
const format = credentialFormat.toLowerCase()
|
|
43
|
-
if (format.includes('sd')) {
|
|
44
|
-
return CredentialDocumentFormat.SD_JWT
|
|
45
|
-
} else if (format.includes('ldp')) {
|
|
46
|
-
return CredentialDocumentFormat.JSON_LD
|
|
47
|
-
} else if (format.includes('mso') || credentialFormat.includes('mdoc')) {
|
|
48
|
-
return CredentialDocumentFormat.MDOC
|
|
49
|
-
} else if (format.includes('jwt_')) {
|
|
50
|
-
return CredentialDocumentFormat.JWT
|
|
51
|
-
} else {
|
|
52
|
-
throw Error(`Could not map format ${format} to known format`)
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
export function toSpecValue(documentFormat: CredentialDocumentFormat, documentType: DocumentType) {
|
|
57
|
-
switch (documentFormat) {
|
|
58
|
-
case CredentialDocumentFormat.SD_JWT: return 'vc+sd-jwt'
|
|
59
|
-
case CredentialDocumentFormat.MDOC: return 'mso_mdoc'
|
|
60
|
-
case CredentialDocumentFormat.JSON_LD: return documentType === DocumentType.C || documentType === DocumentType.VC ? 'ldp_vc' : 'ldp_vp'
|
|
61
|
-
case CredentialDocumentFormat.JWT: return documentType === DocumentType.C || documentType === DocumentType.VC ? 'jwt_vc_json': 'jwt_vp_json'
|
|
62
|
-
}
|
|
63
|
-
}
|
|
37
|
+
MDOC = 'MDOC',
|
|
64
38
|
}
|
|
65
39
|
|
|
66
40
|
export enum CredentialCorrelationType {
|
|
67
41
|
DID = 'DID',
|
|
68
|
-
X509_CN = 'X509_CN',
|
|
69
|
-
URL = 'URL'
|
|
70
42
|
}
|
|
71
43
|
|
|
72
44
|
export enum CredentialRole {
|
|
@@ -1,21 +1,17 @@
|
|
|
1
|
+
import { AddCredentialArgs } from '../../types'
|
|
2
|
+
import { DigitalCredentialEntity } from '../../entities/digitalCredential/DigitalCredentialEntity'
|
|
1
3
|
import {
|
|
2
4
|
CredentialMapper,
|
|
5
|
+
decodeSdJwtVc,
|
|
3
6
|
DocumentFormat,
|
|
4
7
|
IVerifiableCredential,
|
|
5
8
|
IVerifiablePresentation,
|
|
6
9
|
OriginalVerifiableCredential,
|
|
7
10
|
OriginalVerifiablePresentation,
|
|
8
|
-
SdJwtDecodedVerifiableCredentialPayload
|
|
11
|
+
SdJwtDecodedVerifiableCredentialPayload,
|
|
9
12
|
} from '@sphereon/ssi-types'
|
|
13
|
+
import { CredentialDocumentFormat, DocumentType, DigitalCredential, NonPersistedDigitalCredential } from '../../types'
|
|
10
14
|
import { computeEntryHash } from '@veramo/utils'
|
|
11
|
-
import { DigitalCredentialEntity } from '../../entities/digitalCredential/DigitalCredentialEntity'
|
|
12
|
-
import {
|
|
13
|
-
AddCredentialArgs,
|
|
14
|
-
CredentialDocumentFormat,
|
|
15
|
-
DigitalCredential,
|
|
16
|
-
DocumentType,
|
|
17
|
-
NonPersistedDigitalCredential
|
|
18
|
-
} from '../../types'
|
|
19
15
|
|
|
20
16
|
function determineDocumentType(raw: string): DocumentType {
|
|
21
17
|
const rawDocument = parseRawDocument(raw)
|
|
@@ -65,7 +61,7 @@ function getValidUntil(uniformDocument: IVerifiableCredential | IVerifiablePrese
|
|
|
65
61
|
} else if ('validUntil' in uniformDocument) {
|
|
66
62
|
return new Date(uniformDocument.validUntil)
|
|
67
63
|
} else if ('exp' in uniformDocument) {
|
|
68
|
-
return new Date(uniformDocument.exp
|
|
64
|
+
return new Date(uniformDocument.exp)
|
|
69
65
|
}
|
|
70
66
|
return undefined
|
|
71
67
|
}
|
|
@@ -89,29 +85,31 @@ export const nonPersistedDigitalCredentialEntityFromAddArgs = (addCredentialArgs
|
|
|
89
85
|
if (documentFormat === DocumentFormat.SD_JWT_VC && !addCredentialArgs.opts?.hasher) {
|
|
90
86
|
throw new Error('No hasher function is provided for SD_JWT credential.')
|
|
91
87
|
}
|
|
92
|
-
const hasher = addCredentialArgs.opts?.hasher
|
|
93
88
|
const uniformDocument =
|
|
94
|
-
|
|
89
|
+
documentFormat === DocumentFormat.SD_JWT_VC
|
|
90
|
+
? decodeSdJwtVc(addCredentialArgs.rawDocument, addCredentialArgs.opts!.hasher!).decodedPayload
|
|
91
|
+
: documentType === DocumentType.VC || documentType === DocumentType.C
|
|
92
|
+
? CredentialMapper.toUniformCredential(addCredentialArgs.rawDocument)
|
|
93
|
+
: CredentialMapper.toUniformPresentation(addCredentialArgs.rawDocument)
|
|
95
94
|
const validFrom: Date | undefined = getValidFrom(uniformDocument)
|
|
96
95
|
const validUntil: Date | undefined = getValidUntil(uniformDocument)
|
|
97
|
-
const hash = computeEntryHash(addCredentialArgs.rawDocument)
|
|
98
96
|
return {
|
|
99
97
|
...addCredentialArgs,
|
|
100
98
|
documentType,
|
|
101
99
|
documentFormat: determineCredentialDocumentFormat(documentFormat),
|
|
102
100
|
createdAt: new Date(),
|
|
103
|
-
credentialId: uniformDocument.id
|
|
104
|
-
hash,
|
|
101
|
+
credentialId: uniformDocument.id as string | undefined, // uniformDocument.id is being inferred as JsonValue somehow
|
|
102
|
+
hash: computeEntryHash(addCredentialArgs.rawDocument),
|
|
105
103
|
uniformDocument: JSON.stringify(uniformDocument),
|
|
106
104
|
validFrom,
|
|
107
105
|
validUntil,
|
|
108
|
-
lastUpdatedAt: new Date()
|
|
106
|
+
lastUpdatedAt: new Date(),
|
|
109
107
|
}
|
|
110
108
|
}
|
|
111
109
|
|
|
112
110
|
export const digitalCredentialFrom = (credentialEntity: DigitalCredentialEntity): DigitalCredential => {
|
|
113
111
|
return {
|
|
114
|
-
...credentialEntity
|
|
112
|
+
...credentialEntity,
|
|
115
113
|
}
|
|
116
114
|
}
|
|
117
115
|
|