@sphereon/ssi-sdk.data-store 0.29.1-unstable.62 → 0.29.1-unstable.73
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/utils/digitalCredential/MappingUtils.d.ts +2 -2
- package/dist/utils/digitalCredential/MappingUtils.d.ts.map +1 -1
- package/dist/utils/digitalCredential/MappingUtils.js +7 -7
- package/dist/utils/digitalCredential/MappingUtils.js.map +1 -1
- package/package.json +6 -6
- package/src/utils/digitalCredential/MappingUtils.ts +2 -7
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { AddCredentialArgs } from '../../types
|
|
1
|
+
import { AddCredentialArgs } from '../../types';
|
|
2
2
|
import { DigitalCredentialEntity } from '../../entities/digitalCredential/DigitalCredentialEntity';
|
|
3
|
-
import { DigitalCredential, NonPersistedDigitalCredential } from '../../types
|
|
3
|
+
import { DigitalCredential, NonPersistedDigitalCredential } from '../../types';
|
|
4
4
|
export declare const nonPersistedDigitalCredentialEntityFromAddArgs: (addCredentialArgs: AddCredentialArgs) => NonPersistedDigitalCredential;
|
|
5
5
|
export declare const digitalCredentialFrom: (credentialEntity: DigitalCredentialEntity) => DigitalCredential;
|
|
6
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":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM
|
|
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,7 +2,7 @@
|
|
|
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
|
|
5
|
+
const types_1 = require("../../types");
|
|
6
6
|
const utils_1 = require("@veramo/utils");
|
|
7
7
|
function determineDocumentType(raw) {
|
|
8
8
|
const rawDocument = parseRawDocument(raw);
|
|
@@ -13,10 +13,10 @@ function determineDocumentType(raw) {
|
|
|
13
13
|
const isCredential = ssi_types_1.CredentialMapper.isCredential(rawDocument);
|
|
14
14
|
const isPresentation = ssi_types_1.CredentialMapper.isPresentation(rawDocument);
|
|
15
15
|
if (isCredential) {
|
|
16
|
-
return hasProof ?
|
|
16
|
+
return hasProof ? types_1.DocumentType.VC : types_1.DocumentType.C;
|
|
17
17
|
}
|
|
18
18
|
else if (isPresentation) {
|
|
19
|
-
return hasProof ?
|
|
19
|
+
return hasProof ? types_1.DocumentType.VP : types_1.DocumentType.P;
|
|
20
20
|
}
|
|
21
21
|
throw new Error(`Couldn't determine the type of the credential: ${raw}`);
|
|
22
22
|
}
|
|
@@ -34,11 +34,11 @@ function parseRawDocument(raw) {
|
|
|
34
34
|
function determineCredentialDocumentFormat(documentFormat) {
|
|
35
35
|
switch (documentFormat) {
|
|
36
36
|
case 1 /* DocumentFormat.JSONLD */:
|
|
37
|
-
return
|
|
37
|
+
return types_1.CredentialDocumentFormat.JSON_LD;
|
|
38
38
|
case 0 /* DocumentFormat.JWT */:
|
|
39
|
-
return
|
|
39
|
+
return types_1.CredentialDocumentFormat.JWT;
|
|
40
40
|
case 2 /* DocumentFormat.SD_JWT_VC */:
|
|
41
|
-
return
|
|
41
|
+
return types_1.CredentialDocumentFormat.SD_JWT;
|
|
42
42
|
default:
|
|
43
43
|
throw new Error(`Not supported document format: ${documentFormat}`);
|
|
44
44
|
}
|
|
@@ -79,7 +79,7 @@ const nonPersistedDigitalCredentialEntityFromAddArgs = (addCredentialArgs) => {
|
|
|
79
79
|
}
|
|
80
80
|
const uniformDocument = documentFormat === 2 /* DocumentFormat.SD_JWT_VC */
|
|
81
81
|
? (0, ssi_types_1.decodeSdJwtVc)(addCredentialArgs.rawDocument, addCredentialArgs.opts.hasher).decodedPayload
|
|
82
|
-
: documentType ===
|
|
82
|
+
: documentType === types_1.DocumentType.VC || documentType === types_1.DocumentType.C
|
|
83
83
|
? ssi_types_1.CredentialMapper.toUniformCredential(addCredentialArgs.rawDocument)
|
|
84
84
|
: ssi_types_1.CredentialMapper.toUniformPresentation(addCredentialArgs.rawDocument);
|
|
85
85
|
const validFrom = getValidFrom(uniformDocument);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MappingUtils.js","sourceRoot":"","sources":["../../../src/utils/digitalCredential/MappingUtils.ts"],"names":[],"mappings":";;;AAEA,mDAS4B;AAC5B,
|
|
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,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BAAqB,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.73+77f8ba5d",
|
|
4
4
|
"source": "src/index.ts",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -15,10 +15,10 @@
|
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"@sphereon/pex": "^4.0.1",
|
|
18
|
-
"@sphereon/ssi-sdk-ext.did-utils": "0.24.1-next.
|
|
19
|
-
"@sphereon/ssi-sdk.agent-config": "0.29.1-unstable.
|
|
20
|
-
"@sphereon/ssi-sdk.core": "0.29.1-unstable.
|
|
21
|
-
"@sphereon/ssi-types": "0.29.1-unstable.
|
|
18
|
+
"@sphereon/ssi-sdk-ext.did-utils": "0.24.1-next.72",
|
|
19
|
+
"@sphereon/ssi-sdk.agent-config": "0.29.1-unstable.73+77f8ba5d",
|
|
20
|
+
"@sphereon/ssi-sdk.core": "0.29.1-unstable.73+77f8ba5d",
|
|
21
|
+
"@sphereon/ssi-types": "0.29.1-unstable.73+77f8ba5d",
|
|
22
22
|
"@veramo/core": "4.2.0",
|
|
23
23
|
"@veramo/utils": "4.2.0",
|
|
24
24
|
"blakejs": "^1.2.1",
|
|
@@ -49,5 +49,5 @@
|
|
|
49
49
|
"PostgreSQL",
|
|
50
50
|
"Contact Store"
|
|
51
51
|
],
|
|
52
|
-
"gitHead": "
|
|
52
|
+
"gitHead": "77f8ba5d02dcfadd815444d29401e428efe95894"
|
|
53
53
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AddCredentialArgs } from '../../types
|
|
1
|
+
import { AddCredentialArgs } from '../../types'
|
|
2
2
|
import { DigitalCredentialEntity } from '../../entities/digitalCredential/DigitalCredentialEntity'
|
|
3
3
|
import {
|
|
4
4
|
CredentialMapper,
|
|
@@ -10,12 +10,7 @@ import {
|
|
|
10
10
|
OriginalVerifiablePresentation,
|
|
11
11
|
SdJwtDecodedVerifiableCredentialPayload,
|
|
12
12
|
} from '@sphereon/ssi-types'
|
|
13
|
-
import {
|
|
14
|
-
CredentialDocumentFormat,
|
|
15
|
-
DocumentType,
|
|
16
|
-
DigitalCredential,
|
|
17
|
-
NonPersistedDigitalCredential,
|
|
18
|
-
} from '../../types/digitalCredential/digitalCredential'
|
|
13
|
+
import { CredentialDocumentFormat, DocumentType, DigitalCredential, NonPersistedDigitalCredential } from '../../types'
|
|
19
14
|
import { computeEntryHash } from '@veramo/utils'
|
|
20
15
|
|
|
21
16
|
function determineDocumentType(raw: string): DocumentType {
|