@sphereon/ssi-types 0.33.0 → 0.33.1-feature.vcdm2.4
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/events/index.js +28 -35
- package/dist/events/index.js.map +1 -1
- package/dist/index.js +7 -23
- package/dist/index.js.map +1 -1
- package/dist/logging/index.js +30 -39
- package/dist/logging/index.js.map +1 -1
- package/dist/mapper/credential-constraints.js +1 -2
- package/dist/mapper/credential-mapper.js +99 -106
- package/dist/mapper/credential-mapper.js.map +1 -1
- package/dist/mapper/index.js +2 -18
- package/dist/mapper/index.js.map +1 -1
- package/dist/mapper/jsonld-language-values.js +20 -29
- package/dist/mapper/jsonld-language-values.js.map +1 -1
- package/dist/types/cose.js +8 -11
- package/dist/types/cose.js.map +1 -1
- package/dist/types/dcql.js +1 -2
- package/dist/types/dcql.js.map +1 -1
- package/dist/types/did.js +5 -9
- package/dist/types/did.js.map +1 -1
- package/dist/types/generic.js +1 -2
- package/dist/types/index.js +13 -29
- package/dist/types/index.js.map +1 -1
- package/dist/types/jose.js +8 -11
- package/dist/types/jose.js.map +1 -1
- package/dist/types/metadata-types.js +1 -2
- package/dist/types/mso_mdoc.js +25 -30
- package/dist/types/mso_mdoc.js.map +1 -1
- package/dist/types/pex.js +1 -2
- package/dist/types/sd-jwt-type-metadata.js +1 -2
- package/dist/types/sd-jwt-vc.js +64 -60
- package/dist/types/sd-jwt-vc.js.map +1 -1
- package/dist/types/status-list.js +2 -5
- package/dist/types/status-list.js.map +1 -1
- package/dist/types/vc.js +4 -7
- package/dist/types/vc.js.map +1 -1
- package/dist/types/w3c-vc.js +7 -12
- package/dist/types/w3c-vc.js.map +1 -1
- package/dist/utils/hasher.js +5 -32
- package/dist/utils/hasher.js.map +1 -1
- package/dist/utils/index.js +2 -18
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/object.js +1 -5
- package/dist/utils/object.js.map +1 -1
- package/package.json +2 -2
package/dist/types/sd-jwt-vc.js
CHANGED
|
@@ -1,25 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
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
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.sdJwtDecodedCredentialToUniformCredential = void 0;
|
|
13
|
-
exports.isWrappedSdJwtVerifiableCredential = isWrappedSdJwtVerifiableCredential;
|
|
14
|
-
exports.isWrappedSdJwtVerifiablePresentation = isWrappedSdJwtVerifiablePresentation;
|
|
15
|
-
exports.decodeSdJwtVc = decodeSdJwtVc;
|
|
16
|
-
exports.decodeSdJwtVcAsync = decodeSdJwtVcAsync;
|
|
17
|
-
const decode_1 = require("@sd-jwt/decode");
|
|
18
|
-
const did_1 = require("./did");
|
|
19
|
-
function isWrappedSdJwtVerifiableCredential(vc) {
|
|
1
|
+
import { decodeSdJwt, decodeSdJwtSync, getClaims, getClaimsSync } from '@sd-jwt/decode';
|
|
2
|
+
import { IProofPurpose, IProofType } from './did';
|
|
3
|
+
export function isWrappedSdJwtVerifiableCredential(vc) {
|
|
20
4
|
return vc.format === 'vc+sd-jwt';
|
|
21
5
|
}
|
|
22
|
-
function isWrappedSdJwtVerifiablePresentation(vp) {
|
|
6
|
+
export function isWrappedSdJwtVerifiablePresentation(vp) {
|
|
23
7
|
return vp.format === 'vc+sd-jwt';
|
|
24
8
|
}
|
|
25
9
|
/**
|
|
@@ -29,12 +13,15 @@ function isWrappedSdJwtVerifiablePresentation(vp) {
|
|
|
29
13
|
* Both the input and output interfaces of this method are defined in `@sphereon/ssi-types`, so
|
|
30
14
|
* this method hides the actual implementation of SD-JWT (which is currently based on @sd-jwt/core)
|
|
31
15
|
*/
|
|
32
|
-
function decodeSdJwtVc(compactSdJwtVc, hasher) {
|
|
33
|
-
const { jwt, disclosures, kbJwt } =
|
|
16
|
+
export function decodeSdJwtVc(compactSdJwtVc, hasher) {
|
|
17
|
+
const { jwt, disclosures, kbJwt } = decodeSdJwtSync(compactSdJwtVc, hasher);
|
|
34
18
|
const signedPayload = jwt.payload;
|
|
35
|
-
const decodedPayload =
|
|
19
|
+
const decodedPayload = getClaimsSync(signedPayload, disclosures, hasher);
|
|
36
20
|
const compactKeyBindingJwt = kbJwt ? compactSdJwtVc.split('~').pop() : undefined;
|
|
37
|
-
return
|
|
21
|
+
return {
|
|
22
|
+
compactSdJwtVc,
|
|
23
|
+
decodedPayload: decodedPayload,
|
|
24
|
+
disclosures: disclosures.map((d) => {
|
|
38
25
|
const decoded = d.key ? [d.salt, d.key, d.value] : [d.salt, d.value];
|
|
39
26
|
if (!d._digest)
|
|
40
27
|
throw new Error('Implementation error: digest not present in disclosure');
|
|
@@ -43,14 +30,17 @@ function decodeSdJwtVc(compactSdJwtVc, hasher) {
|
|
|
43
30
|
digest: d._digest,
|
|
44
31
|
encoded: d.encode(),
|
|
45
32
|
};
|
|
46
|
-
}),
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
33
|
+
}),
|
|
34
|
+
signedPayload: signedPayload,
|
|
35
|
+
...(compactKeyBindingJwt &&
|
|
36
|
+
kbJwt && {
|
|
37
|
+
kbJwt: {
|
|
38
|
+
header: kbJwt.header,
|
|
39
|
+
compact: compactKeyBindingJwt,
|
|
40
|
+
payload: kbJwt.payload,
|
|
41
|
+
},
|
|
42
|
+
}),
|
|
43
|
+
};
|
|
54
44
|
}
|
|
55
45
|
/**
|
|
56
46
|
* Decode an SD-JWT vc from its compact format (string) to an object containing the disclosures,
|
|
@@ -59,36 +49,39 @@ function decodeSdJwtVc(compactSdJwtVc, hasher) {
|
|
|
59
49
|
* Both the input and output interfaces of this method are defined in `@sphereon/ssi-types`, so
|
|
60
50
|
* this method hides the actual implementation of SD-JWT (which is currently based on @sd-jwt/core)
|
|
61
51
|
*/
|
|
62
|
-
function decodeSdJwtVcAsync(compactSdJwtVc, hasher) {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
52
|
+
export async function decodeSdJwtVcAsync(compactSdJwtVc, hasher) {
|
|
53
|
+
const { jwt, disclosures, kbJwt } = await decodeSdJwt(compactSdJwtVc, hasher);
|
|
54
|
+
const signedPayload = jwt.payload;
|
|
55
|
+
const decodedPayload = await getClaims(signedPayload, disclosures, hasher);
|
|
56
|
+
const compactKeyBindingJwt = kbJwt ? compactSdJwtVc.split('~').pop() : undefined;
|
|
57
|
+
return {
|
|
58
|
+
compactSdJwtVc,
|
|
59
|
+
decodedPayload: decodedPayload,
|
|
60
|
+
disclosures: disclosures.map((d) => {
|
|
61
|
+
const decoded = d.key ? [d.salt, d.key, d.value] : [d.salt, d.value];
|
|
62
|
+
if (!d._digest)
|
|
63
|
+
throw new Error('Implementation error: digest not present in disclosure');
|
|
64
|
+
return {
|
|
65
|
+
decoded: decoded,
|
|
66
|
+
digest: d._digest,
|
|
67
|
+
encoded: d.encode(),
|
|
68
|
+
};
|
|
69
|
+
}),
|
|
70
|
+
signedPayload: signedPayload,
|
|
71
|
+
...(compactKeyBindingJwt &&
|
|
78
72
|
kbJwt && {
|
|
79
73
|
kbJwt: {
|
|
80
74
|
header: kbJwt.header,
|
|
81
75
|
payload: kbJwt.payload,
|
|
82
76
|
compact: compactKeyBindingJwt,
|
|
83
77
|
},
|
|
84
|
-
})
|
|
85
|
-
}
|
|
78
|
+
}),
|
|
79
|
+
};
|
|
86
80
|
}
|
|
87
|
-
const sdJwtDecodedCredentialToUniformCredential = (decoded, opts) => {
|
|
88
|
-
var _a, _b, _c;
|
|
81
|
+
export const sdJwtDecodedCredentialToUniformCredential = (decoded, opts) => {
|
|
89
82
|
const { decodedPayload } = decoded;
|
|
90
83
|
const { exp, nbf, iss, iat, vct, cnf, status, sub, jti } = decodedPayload;
|
|
91
|
-
const maxSkewInMS =
|
|
84
|
+
const maxSkewInMS = opts?.maxTimeSkewInMS ?? 1500;
|
|
92
85
|
const expirationDate = jwtDateToISOString({ jwtClaim: exp, claimName: 'exp' });
|
|
93
86
|
let issuanceDateStr = jwtDateToISOString({ jwtClaim: iat, claimName: 'iat' });
|
|
94
87
|
let nbfDateAsStr;
|
|
@@ -117,17 +110,28 @@ const sdJwtDecodedCredentialToUniformCredential = (decoded, opts) => {
|
|
|
117
110
|
}
|
|
118
111
|
return acc;
|
|
119
112
|
}, {});
|
|
120
|
-
const credential =
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
113
|
+
const credential = {
|
|
114
|
+
type: [vct], // SDJwt is not a W3C VC, so no VerifiableCredential
|
|
115
|
+
'@context': [], // SDJwt has no JSON-LD by default. Certainly not the VC DM1 default context for JSON-LD
|
|
116
|
+
credentialSubject: {
|
|
117
|
+
...credentialSubject,
|
|
118
|
+
id: credentialSubject.id ?? sub ?? jti,
|
|
119
|
+
},
|
|
120
|
+
issuanceDate,
|
|
121
|
+
expirationDate,
|
|
122
|
+
issuer: iss,
|
|
123
|
+
...(cnf && { cnf }),
|
|
124
|
+
...(status && { status }),
|
|
125
|
+
proof: {
|
|
126
|
+
type: IProofType.SdJwtProof2024,
|
|
127
|
+
created: nbfDateAsStr ?? issuanceDate,
|
|
128
|
+
proofPurpose: IProofPurpose.authentication,
|
|
125
129
|
verificationMethod: iss,
|
|
126
130
|
jwt: decoded.compactSdJwtVc,
|
|
127
|
-
}
|
|
131
|
+
},
|
|
132
|
+
};
|
|
128
133
|
return credential;
|
|
129
134
|
};
|
|
130
|
-
exports.sdJwtDecodedCredentialToUniformCredential = sdJwtDecodedCredentialToUniformCredential;
|
|
131
135
|
const jwtDateToISOString = ({ jwtClaim, claimName, isRequired = false, }) => {
|
|
132
136
|
if (jwtClaim) {
|
|
133
137
|
const claim = parseInt(jwtClaim.toString());
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sd-jwt-vc.js","sourceRoot":"","sources":["../../src/types/sd-jwt-vc.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"sd-jwt-vc.js","sourceRoot":"","sources":["../../src/types/sd-jwt-vc.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAA;AAEvF,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAsMjD,MAAM,UAAU,kCAAkC,CAAC,EAA+B;IAChF,OAAO,EAAE,CAAC,MAAM,KAAK,WAAW,CAAA;AAClC,CAAC;AAED,MAAM,UAAU,oCAAoC,CAAC,EAAiC;IACpF,OAAO,EAAE,CAAC,MAAM,KAAK,WAAW,CAAA;AAClC,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,aAAa,CAAC,cAA8B,EAAE,MAAkB;IAC9E,MAAM,EAAE,GAAG,EAAE,WAAW,EAAE,KAAK,EAAE,GAAG,eAAe,CAAC,cAAc,EAAE,MAAM,CAAC,CAAA;IAE3E,MAAM,aAAa,GAAG,GAAG,CAAC,OAAiD,CAAA;IAC3E,MAAM,cAAc,GAAG,aAAa,CAAC,aAAa,EAAE,WAAW,EAAE,MAAM,CAAC,CAAA;IACxE,MAAM,oBAAoB,GAAG,KAAK,CAAC,CAAC,CAAC,cAAc,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,SAAS,CAAA;IAEhF,OA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CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAA;IAC/F,CAAC;SAAM,IAAI,UAAU,EAAE,CAAC;QACtB,MAAM,KAAK,CAAC,aAAa,SAAS,kCAAkC,CAAC,CAAA;IACvE,CAAC;IACD,OAAO,SAAS,CAAA;AAClB,CAAC,CAAA"}
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.StatusListType = void 0;
|
|
4
|
-
var StatusListType;
|
|
1
|
+
export var StatusListType;
|
|
5
2
|
(function (StatusListType) {
|
|
6
3
|
StatusListType["StatusList2021"] = "StatusList2021";
|
|
7
4
|
StatusListType["OAuthStatusList"] = "OAuthStatusList";
|
|
8
|
-
})(StatusListType || (
|
|
5
|
+
})(StatusListType || (StatusListType = {}));
|
|
9
6
|
//# sourceMappingURL=status-list.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"status-list.js","sourceRoot":"","sources":["../../src/types/status-list.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"status-list.js","sourceRoot":"","sources":["../../src/types/status-list.ts"],"names":[],"mappings":"AAGA,MAAM,CAAN,IAAY,cAGX;AAHD,WAAY,cAAc;IACxB,mDAAiC,CAAA;IACjC,qDAAmC,CAAA;AACrC,CAAC,EAHW,cAAc,KAAd,cAAc,QAGzB"}
|
package/dist/types/vc.js
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DocumentFormat = exports.OriginalType = void 0;
|
|
4
|
-
var OriginalType;
|
|
1
|
+
export var OriginalType;
|
|
5
2
|
(function (OriginalType) {
|
|
6
3
|
// W3C
|
|
7
4
|
OriginalType["JSONLD"] = "json-ld";
|
|
@@ -13,8 +10,8 @@ var OriginalType;
|
|
|
13
10
|
// MSO MDOCS
|
|
14
11
|
OriginalType["MSO_MDOC_ENCODED"] = "mso_mdoc-encoded";
|
|
15
12
|
OriginalType["MSO_MDOC_DECODED"] = "mso_mdoc-decoded";
|
|
16
|
-
})(OriginalType || (
|
|
17
|
-
var DocumentFormat;
|
|
13
|
+
})(OriginalType || (OriginalType = {}));
|
|
14
|
+
export var DocumentFormat;
|
|
18
15
|
(function (DocumentFormat) {
|
|
19
16
|
// W3C
|
|
20
17
|
DocumentFormat[DocumentFormat["JWT"] = 0] = "JWT";
|
|
@@ -24,5 +21,5 @@ var DocumentFormat;
|
|
|
24
21
|
// Remaining
|
|
25
22
|
DocumentFormat[DocumentFormat["EIP712"] = 3] = "EIP712";
|
|
26
23
|
DocumentFormat[DocumentFormat["MSO_MDOC"] = 4] = "MSO_MDOC";
|
|
27
|
-
})(DocumentFormat || (
|
|
24
|
+
})(DocumentFormat || (DocumentFormat = {}));
|
|
28
25
|
//# sourceMappingURL=vc.js.map
|
package/dist/types/vc.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vc.js","sourceRoot":"","sources":["../../src/types/vc.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"vc.js","sourceRoot":"","sources":["../../src/types/vc.ts"],"names":[],"mappings":"AAsBA,MAAM,CAAN,IAAY,YAaX;AAbD,WAAY,YAAY;IACtB,MAAM;IACN,kCAAkB,CAAA;IAClB,2CAA2B,CAAA;IAC3B,2CAA2B,CAAA;IAE3B,SAAS;IACT,uDAAuC,CAAA;IACvC,uDAAuC,CAAA;IAEvC,YAAY;IACZ,qDAAqC,CAAA;IACrC,qDAAqC,CAAA;AACvC,CAAC,EAbW,YAAY,KAAZ,YAAY,QAavB;AA0CD,MAAM,CAAN,IAAkB,cASjB;AATD,WAAkB,cAAc;IAC9B,MAAM;IACN,iDAAG,CAAA;IACH,uDAAM,CAAA;IACN,SAAS;IACT,6DAAS,CAAA;IACT,YAAY;IACZ,uDAAM,CAAA;IACN,2DAAQ,CAAA;AACV,CAAC,EATiB,cAAc,KAAd,cAAc,QAS/B"}
|
package/dist/types/w3c-vc.js
CHANGED
|
@@ -1,26 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.StatusListDriverType = exports.StatusListCredentialIdMode = exports.JWT_PROOF_TYPE_2020 = void 0;
|
|
4
|
-
exports.isWrappedW3CVerifiableCredential = isWrappedW3CVerifiableCredential;
|
|
5
|
-
exports.isWrappedW3CVerifiablePresentation = isWrappedW3CVerifiablePresentation;
|
|
6
|
-
exports.JWT_PROOF_TYPE_2020 = 'JwtProof2020';
|
|
7
|
-
var StatusListCredentialIdMode;
|
|
1
|
+
export const JWT_PROOF_TYPE_2020 = 'JwtProof2020';
|
|
2
|
+
export var StatusListCredentialIdMode;
|
|
8
3
|
(function (StatusListCredentialIdMode) {
|
|
9
4
|
StatusListCredentialIdMode["ISSUANCE"] = "ISSUANCE";
|
|
10
5
|
// PERSISTENCE = 'PERSISTENCE',
|
|
11
6
|
StatusListCredentialIdMode["NEVER"] = "NEVER";
|
|
12
|
-
})(StatusListCredentialIdMode || (
|
|
13
|
-
var StatusListDriverType;
|
|
7
|
+
})(StatusListCredentialIdMode || (StatusListCredentialIdMode = {}));
|
|
8
|
+
export var StatusListDriverType;
|
|
14
9
|
(function (StatusListDriverType) {
|
|
15
10
|
StatusListDriverType["AGENT_TYPEORM"] = "agent_typeorm";
|
|
16
11
|
/* AGENT_KV_STORE = 'agent_kv_store',
|
|
17
12
|
GITHUB = 'github',
|
|
18
13
|
AGENT_FILESYSTEM = 'agent_filesystem',*/
|
|
19
|
-
})(StatusListDriverType || (
|
|
20
|
-
function isWrappedW3CVerifiableCredential(vc) {
|
|
14
|
+
})(StatusListDriverType || (StatusListDriverType = {}));
|
|
15
|
+
export function isWrappedW3CVerifiableCredential(vc) {
|
|
21
16
|
return vc.format === 'jwt_vc' || vc.format === 'ldp_vc';
|
|
22
17
|
}
|
|
23
|
-
function isWrappedW3CVerifiablePresentation(vp) {
|
|
18
|
+
export function isWrappedW3CVerifiablePresentation(vp) {
|
|
24
19
|
return vp.format === 'jwt_vp' || vp.format === 'ldp_vp';
|
|
25
20
|
}
|
|
26
21
|
//# sourceMappingURL=w3c-vc.js.map
|
package/dist/types/w3c-vc.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"w3c-vc.js","sourceRoot":"","sources":["../../src/types/w3c-vc.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"w3c-vc.js","sourceRoot":"","sources":["../../src/types/w3c-vc.ts"],"names":[],"mappings":"AAqMA,MAAM,CAAC,MAAM,mBAAmB,GAAG,cAAc,CAAA;AAyFjD,MAAM,CAAN,IAAY,0BAIX;AAJD,WAAY,0BAA0B;IACpC,mDAAqB,CAAA;IACrB,+BAA+B;IAC/B,6CAAe,CAAA;AACjB,CAAC,EAJW,0BAA0B,KAA1B,0BAA0B,QAIrC;AAID,MAAM,CAAN,IAAY,oBAKX;AALD,WAAY,oBAAoB;IAC9B,uDAA+B,CAAA;IAC/B;;4CAEwC;AAC1C,CAAC,EALW,oBAAoB,KAApB,oBAAoB,QAK/B;AAED,MAAM,UAAU,gCAAgC,CAAC,EAA+B;IAC9E,OAAO,EAAE,CAAC,MAAM,KAAK,QAAQ,IAAI,EAAE,CAAC,MAAM,KAAK,QAAQ,CAAA;AACzD,CAAC;AAED,MAAM,UAAU,kCAAkC,CAAC,EAAiC;IAClF,OAAO,EAAE,CAAC,MAAM,KAAK,QAAQ,IAAI,EAAE,CAAC,MAAM,KAAK,QAAQ,CAAA;AACzD,CAAC"}
|
package/dist/utils/hasher.js
CHANGED
|
@@ -1,40 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.defaultHasher = exports.shaHasher = void 0;
|
|
27
|
-
const sha2_1 = require("@noble/hashes/sha2");
|
|
28
|
-
const u8a = __importStar(require("uint8arrays"));
|
|
1
|
+
import { sha256, sha384, sha512 } from '@noble/hashes/sha2';
|
|
2
|
+
import * as u8a from 'uint8arrays';
|
|
29
3
|
const supportedAlgorithms = ['sha256', 'sha384', 'sha512'];
|
|
30
|
-
const shaHasher = (data, algorithm) => {
|
|
4
|
+
export const shaHasher = (data, algorithm) => {
|
|
31
5
|
const sanitizedAlgorithm = algorithm.toLowerCase().replace(/[-_]/g, '');
|
|
32
6
|
if (!supportedAlgorithms.includes(sanitizedAlgorithm)) {
|
|
33
7
|
throw new Error(`Unsupported hashing algorithm ${algorithm}`);
|
|
34
8
|
}
|
|
35
|
-
const hasher = sanitizedAlgorithm === 'sha384' ?
|
|
9
|
+
const hasher = sanitizedAlgorithm === 'sha384' ? sha384 : sanitizedAlgorithm === 'sha512' ? sha512 : sha256;
|
|
36
10
|
return hasher(typeof data === 'string' ? u8a.fromString(data) : new Uint8Array(data));
|
|
37
11
|
};
|
|
38
|
-
|
|
39
|
-
exports.defaultHasher = exports.shaHasher;
|
|
12
|
+
export const defaultHasher = shaHasher;
|
|
40
13
|
//# sourceMappingURL=hasher.js.map
|
package/dist/utils/hasher.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hasher.js","sourceRoot":"","sources":["../../src/utils/hasher.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"hasher.js","sourceRoot":"","sources":["../../src/utils/hasher.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAA;AAC3D,OAAO,KAAK,GAAG,MAAM,aAAa,CAAA;AAGlC,MAAM,mBAAmB,GAAG,CAAC,QAAQ,EAAE,QAAQ,EAAE,QAAQ,CAAU,CAAA;AAGnE,MAAM,CAAC,MAAM,SAAS,GAAe,CAAC,IAAI,EAAE,SAAS,EAAE,EAAE;IACvD,MAAM,kBAAkB,GAAG,SAAS,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,CAAA;IACvE,IAAI,CAAC,mBAAmB,CAAC,QAAQ,CAAC,kBAAyC,CAAC,EAAE,CAAC;QAC7E,MAAM,IAAI,KAAK,CAAC,iCAAiC,SAAS,EAAE,CAAC,CAAA;IAC/D,CAAC;IACD,MAAM,MAAM,GAAG,kBAAkB,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,kBAAkB,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAA;IAC3G,OAAO,MAAM,CAAC,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,UAAU,CAAC,IAAI,CAAC,CAAC,CAAA;AACvF,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,aAAa,GAAe,SAAS,CAAA"}
|
package/dist/utils/index.js
CHANGED
|
@@ -1,19 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./object"), exports);
|
|
18
|
-
__exportStar(require("./hasher"), exports);
|
|
1
|
+
export * from './object';
|
|
2
|
+
export * from './hasher';
|
|
19
3
|
//# sourceMappingURL=index.js.map
|
package/dist/utils/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAA;AACxB,cAAc,UAAU,CAAA"}
|
package/dist/utils/object.js
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ObjectUtils = void 0;
|
|
4
1
|
const BASE64_REGEX = /^[-A-Za-z0-9+_/]*={0,3}$/g;
|
|
5
|
-
class ObjectUtils {
|
|
2
|
+
export class ObjectUtils {
|
|
6
3
|
static asArray(value) {
|
|
7
4
|
return Array.isArray(value) ? value : [value];
|
|
8
5
|
}
|
|
@@ -24,5 +21,4 @@ class ObjectUtils {
|
|
|
24
21
|
return value.match(BASE64_REGEX) !== null;
|
|
25
22
|
}
|
|
26
23
|
}
|
|
27
|
-
exports.ObjectUtils = ObjectUtils;
|
|
28
24
|
//# sourceMappingURL=object.js.map
|
package/dist/utils/object.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"object.js","sourceRoot":"","sources":["../../src/utils/object.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"object.js","sourceRoot":"","sources":["../../src/utils/object.ts"],"names":[],"mappings":"AAAA,MAAM,YAAY,GAAG,2BAA2B,CAAA;AAEhD,MAAM,OAAO,WAAW;IACf,MAAM,CAAC,OAAO,CAAI,KAAQ;QAC/B,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAA;IAC/C,CAAC;IAEM,MAAM,CAAC,QAAQ,CAAC,KAAc;QACnC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,iBAAiB,CAAA;IACjG,CAAC;IAEM,MAAM,CAAC,aAAa,CAAC,GAAW;QACrC,8EAA8E;QAC9E,MAAM,eAAe,GAAG,sCAAsC,CAAA;QAC9D,WAAW,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,eAAe,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;IACxD,CAAC;IAEM,MAAM,CAAC,QAAQ,CAAC,KAAc;QACnC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,iBAAiB,CAAA;IACjG,CAAC;IAEM,MAAM,CAAC,QAAQ,CAAC,KAAc;QACnC,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;YACjC,OAAO,KAAK,CAAA;QACd,CAAC;QACD,OAAO,KAAK,CAAC,KAAK,CAAC,YAAY,CAAC,KAAK,IAAI,CAAA;IAC3C,CAAC;CACF"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sphereon/ssi-types",
|
|
3
3
|
"description": "SSI Common Types",
|
|
4
|
-
"version": "0.33.
|
|
4
|
+
"version": "0.33.1-feature.vcdm2.4+9f634bdb",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"scripts": {
|
|
@@ -48,5 +48,5 @@
|
|
|
48
48
|
"DIDs"
|
|
49
49
|
],
|
|
50
50
|
"nx": {},
|
|
51
|
-
"gitHead": "
|
|
51
|
+
"gitHead": "9f634bdb714061141e277508c124b08d626f6036"
|
|
52
52
|
}
|