@sovrahq/waci 3.4.0
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/.eslintignore +2 -0
- package/.eslintrc.js +21 -0
- package/.prettierrc +4 -0
- package/LICENSE +201 -0
- package/dist/callbacks/index.d.ts +108 -0
- package/dist/callbacks/index.js +9 -0
- package/dist/callbacks/index.js.map +1 -0
- package/dist/constants/index.d.ts +1 -0
- package/dist/constants/index.js +5 -0
- package/dist/constants/index.js.map +1 -0
- package/dist/handlers/common/problem-report.handler.d.ts +4 -0
- package/dist/handlers/common/problem-report.handler.js +72 -0
- package/dist/handlers/common/problem-report.handler.js.map +1 -0
- package/dist/handlers/common/step-2-oob-invitation.handler.d.ts +4 -0
- package/dist/handlers/common/step-2-oob-invitation.handler.js +93 -0
- package/dist/handlers/common/step-2-oob-invitation.handler.js.map +1 -0
- package/dist/handlers/decorators/register-handler.decorator.d.ts +2 -0
- package/dist/handlers/decorators/register-handler.decorator.js +13 -0
- package/dist/handlers/decorators/register-handler.decorator.js.map +1 -0
- package/dist/handlers/index.d.ts +6 -0
- package/dist/handlers/index.js +11 -0
- package/dist/handlers/index.js.map +1 -0
- package/dist/handlers/issuance/step-3-propose-credential.handler.d.ts +32 -0
- package/dist/handlers/issuance/step-3-propose-credential.handler.js +180 -0
- package/dist/handlers/issuance/step-3-propose-credential.handler.js.map +1 -0
- package/dist/handlers/issuance/step-4-1-offer-credential-proceed.handler.d.ts +5 -0
- package/dist/handlers/issuance/step-4-1-offer-credential-proceed.handler.js +152 -0
- package/dist/handlers/issuance/step-4-1-offer-credential-proceed.handler.js.map +1 -0
- package/dist/handlers/issuance/step-4-offer-credential.handler.d.ts +5 -0
- package/dist/handlers/issuance/step-4-offer-credential.handler.js +169 -0
- package/dist/handlers/issuance/step-4-offer-credential.handler.js.map +1 -0
- package/dist/handlers/issuance/step-5-request-credential.handler.d.ts +4 -0
- package/dist/handlers/issuance/step-5-request-credential.handler.js +275 -0
- package/dist/handlers/issuance/step-5-request-credential.handler.js.map +1 -0
- package/dist/handlers/issuance/step-6-issue-credential.handler.d.ts +4 -0
- package/dist/handlers/issuance/step-6-issue-credential.handler.js +106 -0
- package/dist/handlers/issuance/step-6-issue-credential.handler.js.map +1 -0
- package/dist/handlers/issuance/step-7-ack-message.handler.d.ts +4 -0
- package/dist/handlers/issuance/step-7-ack-message.handler.js +78 -0
- package/dist/handlers/issuance/step-7-ack-message.handler.js.map +1 -0
- package/dist/handlers/presentation/step-3-propose-presentation.handler.d.ts +5 -0
- package/dist/handlers/presentation/step-3-propose-presentation.handler.js +107 -0
- package/dist/handlers/presentation/step-3-propose-presentation.handler.js.map +1 -0
- package/dist/handlers/presentation/step-4-1-presentation-proceed.handler.d.ts +5 -0
- package/dist/handlers/presentation/step-4-1-presentation-proceed.handler.js +130 -0
- package/dist/handlers/presentation/step-4-1-presentation-proceed.handler.js.map +1 -0
- package/dist/handlers/presentation/step-4-request-presentation.handler.d.ts +5 -0
- package/dist/handlers/presentation/step-4-request-presentation.handler.js +151 -0
- package/dist/handlers/presentation/step-4-request-presentation.handler.js.map +1 -0
- package/dist/handlers/presentation/step-5-present-proof.handler.d.ts +4 -0
- package/dist/handlers/presentation/step-5-present-proof.handler.js +211 -0
- package/dist/handlers/presentation/step-5-present-proof.handler.js.map +1 -0
- package/dist/handlers/presentation/step-6-ack-message.handler.d.ts +4 -0
- package/dist/handlers/presentation/step-6-ack-message.handler.js +72 -0
- package/dist/handlers/presentation/step-6-ack-message.handler.js.map +1 -0
- package/dist/index.d.ts +17 -0
- package/dist/index.js +37 -0
- package/dist/index.js.map +1 -0
- package/dist/services/waci-interpreter.d.ts +17 -0
- package/dist/services/waci-interpreter.js +222 -0
- package/dist/services/waci-interpreter.js.map +1 -0
- package/dist/types/actor.d.ts +5 -0
- package/dist/types/actor.js +10 -0
- package/dist/types/actor.js.map +1 -0
- package/dist/types/credential-application.d.ts +36 -0
- package/dist/types/credential-application.js +3 -0
- package/dist/types/credential-application.js.map +1 -0
- package/dist/types/credential-manifest.d.ts +173 -0
- package/dist/types/credential-manifest.js +3 -0
- package/dist/types/credential-manifest.js.map +1 -0
- package/dist/types/index.d.ts +4 -0
- package/dist/types/index.js +21 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/problem-report.d.ts +13 -0
- package/dist/types/problem-report.js +18 -0
- package/dist/types/problem-report.js.map +1 -0
- package/dist/types/waci-message.d.ts +106 -0
- package/dist/types/waci-message.js +106 -0
- package/dist/types/waci-message.js.map +1 -0
- package/dist/utils/erros.d.ts +15 -0
- package/dist/utils/erros.js +42 -0
- package/dist/utils/erros.js.map +1 -0
- package/dist/utils/index.d.ts +22 -0
- package/dist/utils/index.js +356 -0
- package/dist/utils/index.js.map +1 -0
- package/jest.config.json +17 -0
- package/package.json +39 -0
- package/readme.md +1 -0
- package/src/callbacks/index.ts +75 -0
- package/src/constants/index.ts +1 -0
- package/src/handlers/common/problem-report.handler.ts +15 -0
- package/src/handlers/common/step-2-oob-invitation.handler.ts +45 -0
- package/src/handlers/decorators/register-handler.decorator.ts +10 -0
- package/src/handlers/index.ts +7 -0
- package/src/handlers/issuance/step-3-propose-credential.handler.ts +186 -0
- package/src/handlers/issuance/step-4-1-offer-credential-proceed.handler.ts +129 -0
- package/src/handlers/issuance/step-4-offer-credential.handler.ts +137 -0
- package/src/handlers/issuance/step-5-request-credential.handler.ts +205 -0
- package/src/handlers/issuance/step-6-issue-credential.handler.ts +63 -0
- package/src/handlers/issuance/step-7-ack-message.handler.ts +21 -0
- package/src/handlers/presentation/step-3-propose-presentation.handler.ts +67 -0
- package/src/handlers/presentation/step-4-1-presentation-proceed.handler.ts +100 -0
- package/src/handlers/presentation/step-4-request-presentation.handler.ts +115 -0
- package/src/handlers/presentation/step-5-present-proof.handler.ts +159 -0
- package/src/handlers/presentation/step-6-ack-message.handler.ts +15 -0
- package/src/index.ts +18 -0
- package/src/services/waci-interpreter.ts +161 -0
- package/src/types/actor.ts +5 -0
- package/src/types/credential-application.ts +38 -0
- package/src/types/credential-manifest.ts +184 -0
- package/src/types/index.ts +4 -0
- package/src/types/problem-report.ts +29 -0
- package/src/types/waci-message.ts +148 -0
- package/src/utils/erros.ts +21 -0
- package/src/utils/index.ts +272 -0
- package/test/handlers/issuance/step-3-propose-credential.handler.spec.ts +43 -0
- package/test/handlers/issuance/step-4-offer-credential.handler.spec.ts +53 -0
- package/test/handlers/issuance/step-5-request-credential.handler.spec.ts +102 -0
- package/test/handlers/presentation/step-5-present-proof.handler.spec.ts +142 -0
- package/test/handlers/shared/step-2-oob-invitation.handler.spec.ts +55 -0
- package/test/stubs/index.ts +842 -0
- package/test/waci-interpreter.spec.ts +113 -0
- package/tsconfig.build.json +9 -0
- package/tsconfig.json +20 -0
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
declare enum SharedMessageType {
|
|
2
|
+
OutOfBandInvitation = "https://didcomm.org/out-of-band/2.0/invitation"
|
|
3
|
+
}
|
|
4
|
+
declare enum IssuanceMessageType {
|
|
5
|
+
ProposeCredential = "https://didcomm.org/issue-credential/3.0/propose-credential",
|
|
6
|
+
OfferCredential = "https://didcomm.org/issue-credential/3.0/offer-credential",
|
|
7
|
+
RequestCredential = "https://didcomm.org/issue-credential/3.0/request-credential",
|
|
8
|
+
IssueCredential = "https://didcomm.org/issue-credential/3.0/issue-credential",
|
|
9
|
+
IssuanceAck = "https://didcomm.org/issue-credential/3.0/ack",
|
|
10
|
+
ProblemReport = "https://didcomm.org/report-problem/2.0/problem-report"
|
|
11
|
+
}
|
|
12
|
+
declare enum PresentationMessageType {
|
|
13
|
+
ProposePresentation = "https://didcomm.org/present-proof/3.0/propose-presentation",
|
|
14
|
+
RequestPresentation = "https://didcomm.org/present-proof/3.0/request-presentation",
|
|
15
|
+
PresentProof = "https://didcomm.org/present-proof/3.0/presentation",
|
|
16
|
+
PresentationAck = "https://didcomm.org/present-proof/3.0/ack",
|
|
17
|
+
ProblemReport = "https://didcomm.org/report-problem/2.0/problem-report"
|
|
18
|
+
}
|
|
19
|
+
declare enum SharedMessageTypeV1 {
|
|
20
|
+
OutOfBandInvitation = "https://didcomm.org/out-of-band/1.0/invitation"
|
|
21
|
+
}
|
|
22
|
+
declare enum IssuanceMessageTypeV1 {
|
|
23
|
+
ProposeCredential = "https://didcomm.org/issue-credential/1.0/propose-credential",
|
|
24
|
+
OfferCredential = "https://didcomm.org/issue-credential/1.0/offer-credential",
|
|
25
|
+
RequestCredential = "https://didcomm.org/issue-credential/1.0/request-credential",
|
|
26
|
+
IssueCredential = "https://didcomm.org/issue-credential/1.0/issue-credential",
|
|
27
|
+
IssuanceAck = "https://didcomm.org/issue-credential/1.0/ack",
|
|
28
|
+
ProblemReport = "https://didcomm.org/report-problem/1.0/problem-report"
|
|
29
|
+
}
|
|
30
|
+
declare enum PresentationMessageTypeV1 {
|
|
31
|
+
ProposePresentation = "https://didcomm.org/present-proof/1.0/propose-presentation",
|
|
32
|
+
RequestPresentation = "https://didcomm.org/present-proof/1.0/request-presentation",
|
|
33
|
+
PresentProof = "https://didcomm.org/present-proof/1.0/presentation",
|
|
34
|
+
PresentationAck = "https://didcomm.org/present-proof/1.0/ack",
|
|
35
|
+
ProblemReport = "https://didcomm.org/report-problem/1.0/problem-report"
|
|
36
|
+
}
|
|
37
|
+
export declare const WACIMessageTypeV1: {
|
|
38
|
+
ProposePresentation: PresentationMessageTypeV1.ProposePresentation;
|
|
39
|
+
RequestPresentation: PresentationMessageTypeV1.RequestPresentation;
|
|
40
|
+
PresentProof: PresentationMessageTypeV1.PresentProof;
|
|
41
|
+
PresentationAck: PresentationMessageTypeV1.PresentationAck;
|
|
42
|
+
ProblemReport: PresentationMessageTypeV1.ProblemReport;
|
|
43
|
+
ProposeCredential: IssuanceMessageTypeV1.ProposeCredential;
|
|
44
|
+
OfferCredential: IssuanceMessageTypeV1.OfferCredential;
|
|
45
|
+
RequestCredential: IssuanceMessageTypeV1.RequestCredential;
|
|
46
|
+
IssueCredential: IssuanceMessageTypeV1.IssueCredential;
|
|
47
|
+
IssuanceAck: IssuanceMessageTypeV1.IssuanceAck;
|
|
48
|
+
OutOfBandInvitation: SharedMessageTypeV1.OutOfBandInvitation;
|
|
49
|
+
};
|
|
50
|
+
export declare enum DIDCommVersion {
|
|
51
|
+
V1 = "v1",
|
|
52
|
+
V2 = "v2"
|
|
53
|
+
}
|
|
54
|
+
export declare function detectDIDCommVersion(type: string): DIDCommVersion;
|
|
55
|
+
export declare function normalizeToV2(type: string): string;
|
|
56
|
+
export declare function convertToVersion(type: string, target: DIDCommVersion): string;
|
|
57
|
+
export declare const WACIMessageType: {
|
|
58
|
+
ProposePresentation: PresentationMessageType.ProposePresentation;
|
|
59
|
+
RequestPresentation: PresentationMessageType.RequestPresentation;
|
|
60
|
+
PresentProof: PresentationMessageType.PresentProof;
|
|
61
|
+
PresentationAck: PresentationMessageType.PresentationAck;
|
|
62
|
+
ProblemReport: PresentationMessageType.ProblemReport;
|
|
63
|
+
ProposeCredential: IssuanceMessageType.ProposeCredential;
|
|
64
|
+
OfferCredential: IssuanceMessageType.OfferCredential;
|
|
65
|
+
RequestCredential: IssuanceMessageType.RequestCredential;
|
|
66
|
+
IssueCredential: IssuanceMessageType.IssueCredential;
|
|
67
|
+
IssuanceAck: IssuanceMessageType.IssuanceAck;
|
|
68
|
+
OutOfBandInvitation: SharedMessageType.OutOfBandInvitation;
|
|
69
|
+
};
|
|
70
|
+
export type WACIMessageType = SharedMessageType | IssuanceMessageType | PresentationMessageType;
|
|
71
|
+
export declare enum GoalCode {
|
|
72
|
+
Issuance = "streamlined-vc",
|
|
73
|
+
Presentation = "streamlined-vp"
|
|
74
|
+
}
|
|
75
|
+
export declare const enum AckStatus {
|
|
76
|
+
Ok = "OK",
|
|
77
|
+
Fail = "FAIL",
|
|
78
|
+
Pending = "PENDING"
|
|
79
|
+
}
|
|
80
|
+
export type WACIMessage = {
|
|
81
|
+
type: WACIMessageType;
|
|
82
|
+
id: string;
|
|
83
|
+
from: string;
|
|
84
|
+
to?: string[];
|
|
85
|
+
body?: any;
|
|
86
|
+
pthid?: string;
|
|
87
|
+
thid?: string;
|
|
88
|
+
attachments?: any[];
|
|
89
|
+
};
|
|
90
|
+
export declare const enum WACIMessageResponseType {
|
|
91
|
+
CreateThread = 0,
|
|
92
|
+
ReplyThread = 1
|
|
93
|
+
}
|
|
94
|
+
export type WACIMessageHandlerResponse = {
|
|
95
|
+
message: WACIMessage;
|
|
96
|
+
responseType: WACIMessageResponseType;
|
|
97
|
+
};
|
|
98
|
+
export type WACIResponse = {
|
|
99
|
+
message: WACIMessage;
|
|
100
|
+
target: string;
|
|
101
|
+
responseType: WACIMessageResponseType;
|
|
102
|
+
};
|
|
103
|
+
export interface WACIMessageHandler {
|
|
104
|
+
handle(messageThread: WACIMessage[], callbacks: any): Promise<WACIMessageHandlerResponse | void>;
|
|
105
|
+
}
|
|
106
|
+
export {};
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var _a;
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.GoalCode = exports.WACIMessageType = exports.convertToVersion = exports.normalizeToV2 = exports.detectDIDCommVersion = exports.DIDCommVersion = exports.WACIMessageTypeV1 = void 0;
|
|
16
|
+
var SharedMessageType;
|
|
17
|
+
(function (SharedMessageType) {
|
|
18
|
+
SharedMessageType["OutOfBandInvitation"] = "https://didcomm.org/out-of-band/2.0/invitation";
|
|
19
|
+
})(SharedMessageType || (SharedMessageType = {}));
|
|
20
|
+
var IssuanceMessageType;
|
|
21
|
+
(function (IssuanceMessageType) {
|
|
22
|
+
IssuanceMessageType["ProposeCredential"] = "https://didcomm.org/issue-credential/3.0/propose-credential";
|
|
23
|
+
IssuanceMessageType["OfferCredential"] = "https://didcomm.org/issue-credential/3.0/offer-credential";
|
|
24
|
+
IssuanceMessageType["RequestCredential"] = "https://didcomm.org/issue-credential/3.0/request-credential";
|
|
25
|
+
IssuanceMessageType["IssueCredential"] = "https://didcomm.org/issue-credential/3.0/issue-credential";
|
|
26
|
+
IssuanceMessageType["IssuanceAck"] = "https://didcomm.org/issue-credential/3.0/ack";
|
|
27
|
+
IssuanceMessageType["ProblemReport"] = "https://didcomm.org/report-problem/2.0/problem-report";
|
|
28
|
+
})(IssuanceMessageType || (IssuanceMessageType = {}));
|
|
29
|
+
var PresentationMessageType;
|
|
30
|
+
(function (PresentationMessageType) {
|
|
31
|
+
PresentationMessageType["ProposePresentation"] = "https://didcomm.org/present-proof/3.0/propose-presentation";
|
|
32
|
+
PresentationMessageType["RequestPresentation"] = "https://didcomm.org/present-proof/3.0/request-presentation";
|
|
33
|
+
PresentationMessageType["PresentProof"] = "https://didcomm.org/present-proof/3.0/presentation";
|
|
34
|
+
PresentationMessageType["PresentationAck"] = "https://didcomm.org/present-proof/3.0/ack";
|
|
35
|
+
PresentationMessageType["ProblemReport"] = "https://didcomm.org/report-problem/2.0/problem-report";
|
|
36
|
+
})(PresentationMessageType || (PresentationMessageType = {}));
|
|
37
|
+
// --- DIDComm v1 message types ---
|
|
38
|
+
var SharedMessageTypeV1;
|
|
39
|
+
(function (SharedMessageTypeV1) {
|
|
40
|
+
SharedMessageTypeV1["OutOfBandInvitation"] = "https://didcomm.org/out-of-band/1.0/invitation";
|
|
41
|
+
})(SharedMessageTypeV1 || (SharedMessageTypeV1 = {}));
|
|
42
|
+
var IssuanceMessageTypeV1;
|
|
43
|
+
(function (IssuanceMessageTypeV1) {
|
|
44
|
+
IssuanceMessageTypeV1["ProposeCredential"] = "https://didcomm.org/issue-credential/1.0/propose-credential";
|
|
45
|
+
IssuanceMessageTypeV1["OfferCredential"] = "https://didcomm.org/issue-credential/1.0/offer-credential";
|
|
46
|
+
IssuanceMessageTypeV1["RequestCredential"] = "https://didcomm.org/issue-credential/1.0/request-credential";
|
|
47
|
+
IssuanceMessageTypeV1["IssueCredential"] = "https://didcomm.org/issue-credential/1.0/issue-credential";
|
|
48
|
+
IssuanceMessageTypeV1["IssuanceAck"] = "https://didcomm.org/issue-credential/1.0/ack";
|
|
49
|
+
IssuanceMessageTypeV1["ProblemReport"] = "https://didcomm.org/report-problem/1.0/problem-report";
|
|
50
|
+
})(IssuanceMessageTypeV1 || (IssuanceMessageTypeV1 = {}));
|
|
51
|
+
var PresentationMessageTypeV1;
|
|
52
|
+
(function (PresentationMessageTypeV1) {
|
|
53
|
+
PresentationMessageTypeV1["ProposePresentation"] = "https://didcomm.org/present-proof/1.0/propose-presentation";
|
|
54
|
+
PresentationMessageTypeV1["RequestPresentation"] = "https://didcomm.org/present-proof/1.0/request-presentation";
|
|
55
|
+
PresentationMessageTypeV1["PresentProof"] = "https://didcomm.org/present-proof/1.0/presentation";
|
|
56
|
+
PresentationMessageTypeV1["PresentationAck"] = "https://didcomm.org/present-proof/1.0/ack";
|
|
57
|
+
PresentationMessageTypeV1["ProblemReport"] = "https://didcomm.org/report-problem/1.0/problem-report";
|
|
58
|
+
})(PresentationMessageTypeV1 || (PresentationMessageTypeV1 = {}));
|
|
59
|
+
exports.WACIMessageTypeV1 = __assign(__assign(__assign({}, SharedMessageTypeV1), IssuanceMessageTypeV1), PresentationMessageTypeV1);
|
|
60
|
+
// --- Version detection & normalization ---
|
|
61
|
+
var DIDCommVersion;
|
|
62
|
+
(function (DIDCommVersion) {
|
|
63
|
+
DIDCommVersion["V1"] = "v1";
|
|
64
|
+
DIDCommVersion["V2"] = "v2";
|
|
65
|
+
})(DIDCommVersion = exports.DIDCommVersion || (exports.DIDCommVersion = {}));
|
|
66
|
+
var V1_TO_V2_MAP = (_a = {},
|
|
67
|
+
_a[SharedMessageTypeV1.OutOfBandInvitation] = SharedMessageType.OutOfBandInvitation,
|
|
68
|
+
_a[IssuanceMessageTypeV1.ProposeCredential] = IssuanceMessageType.ProposeCredential,
|
|
69
|
+
_a[IssuanceMessageTypeV1.OfferCredential] = IssuanceMessageType.OfferCredential,
|
|
70
|
+
_a[IssuanceMessageTypeV1.RequestCredential] = IssuanceMessageType.RequestCredential,
|
|
71
|
+
_a[IssuanceMessageTypeV1.IssueCredential] = IssuanceMessageType.IssueCredential,
|
|
72
|
+
_a[IssuanceMessageTypeV1.IssuanceAck] = IssuanceMessageType.IssuanceAck,
|
|
73
|
+
_a[IssuanceMessageTypeV1.ProblemReport] = IssuanceMessageType.ProblemReport,
|
|
74
|
+
_a[PresentationMessageTypeV1.ProposePresentation] = PresentationMessageType.ProposePresentation,
|
|
75
|
+
_a[PresentationMessageTypeV1.RequestPresentation] = PresentationMessageType.RequestPresentation,
|
|
76
|
+
_a[PresentationMessageTypeV1.PresentProof] = PresentationMessageType.PresentProof,
|
|
77
|
+
_a[PresentationMessageTypeV1.PresentationAck] = PresentationMessageType.PresentationAck,
|
|
78
|
+
_a);
|
|
79
|
+
var V2_TO_V1_MAP = Object.fromEntries(Object.entries(V1_TO_V2_MAP).map(function (_a) {
|
|
80
|
+
var k = _a[0], v = _a[1];
|
|
81
|
+
return [v, k];
|
|
82
|
+
}));
|
|
83
|
+
function detectDIDCommVersion(type) {
|
|
84
|
+
if (/\/1\.0\//.test(type))
|
|
85
|
+
return DIDCommVersion.V1;
|
|
86
|
+
return DIDCommVersion.V2;
|
|
87
|
+
}
|
|
88
|
+
exports.detectDIDCommVersion = detectDIDCommVersion;
|
|
89
|
+
function normalizeToV2(type) {
|
|
90
|
+
return V1_TO_V2_MAP[type] || type;
|
|
91
|
+
}
|
|
92
|
+
exports.normalizeToV2 = normalizeToV2;
|
|
93
|
+
function convertToVersion(type, target) {
|
|
94
|
+
if (target === DIDCommVersion.V1) {
|
|
95
|
+
return V2_TO_V1_MAP[type] || type;
|
|
96
|
+
}
|
|
97
|
+
return V1_TO_V2_MAP[type] || type;
|
|
98
|
+
}
|
|
99
|
+
exports.convertToVersion = convertToVersion;
|
|
100
|
+
exports.WACIMessageType = __assign(__assign(__assign({}, SharedMessageType), IssuanceMessageType), PresentationMessageType);
|
|
101
|
+
var GoalCode;
|
|
102
|
+
(function (GoalCode) {
|
|
103
|
+
GoalCode["Issuance"] = "streamlined-vc";
|
|
104
|
+
GoalCode["Presentation"] = "streamlined-vp";
|
|
105
|
+
})(GoalCode = exports.GoalCode || (exports.GoalCode = {}));
|
|
106
|
+
//# sourceMappingURL=waci-message.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"waci-message.js","sourceRoot":"","sources":["../../src/types/waci-message.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export declare enum WaciErrorCode {
|
|
2
|
+
InputDescriptorError = 30
|
|
3
|
+
}
|
|
4
|
+
export declare class WaciMessageError {
|
|
5
|
+
code: number;
|
|
6
|
+
name: string;
|
|
7
|
+
description: string;
|
|
8
|
+
constructor(description?: string);
|
|
9
|
+
}
|
|
10
|
+
export declare class InputDescriptorError extends WaciMessageError {
|
|
11
|
+
private messageError?;
|
|
12
|
+
code: WaciErrorCode;
|
|
13
|
+
name: string;
|
|
14
|
+
constructor(messageError?: string);
|
|
15
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = function (d, b) {
|
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
8
|
+
};
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
if (typeof b !== "function" && b !== null)
|
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
+
extendStatics(d, b);
|
|
13
|
+
function __() { this.constructor = d; }
|
|
14
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
+
};
|
|
16
|
+
})();
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.InputDescriptorError = exports.WaciMessageError = exports.WaciErrorCode = void 0;
|
|
19
|
+
var WaciErrorCode;
|
|
20
|
+
(function (WaciErrorCode) {
|
|
21
|
+
WaciErrorCode[WaciErrorCode["InputDescriptorError"] = 30] = "InputDescriptorError";
|
|
22
|
+
})(WaciErrorCode = exports.WaciErrorCode || (exports.WaciErrorCode = {}));
|
|
23
|
+
var WaciMessageError = /** @class */ (function () {
|
|
24
|
+
function WaciMessageError(description) {
|
|
25
|
+
this.description = description;
|
|
26
|
+
}
|
|
27
|
+
return WaciMessageError;
|
|
28
|
+
}());
|
|
29
|
+
exports.WaciMessageError = WaciMessageError;
|
|
30
|
+
var InputDescriptorError = /** @class */ (function (_super) {
|
|
31
|
+
__extends(InputDescriptorError, _super);
|
|
32
|
+
function InputDescriptorError(messageError) {
|
|
33
|
+
var _this = _super.call(this, messageError) || this;
|
|
34
|
+
_this.messageError = messageError;
|
|
35
|
+
_this.code = WaciErrorCode.InputDescriptorError;
|
|
36
|
+
_this.name = "input-descriptor-not-found";
|
|
37
|
+
return _this;
|
|
38
|
+
}
|
|
39
|
+
return InputDescriptorError;
|
|
40
|
+
}(WaciMessageError));
|
|
41
|
+
exports.InputDescriptorError = InputDescriptorError;
|
|
42
|
+
//# sourceMappingURL=erros.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"erros.js","sourceRoot":"","sources":["../../src/utils/erros.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,IAAY,aAET;AAFH,WAAY,aAAa;IACrB,kFAAyB,CAAA;AAC3B,CAAC,EAFS,aAAa,GAAb,qBAAa,KAAb,qBAAa,QAEtB;AAED;IAKE,0BAAY,WAAoB;QAAI,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;IAAC,CAAC;IACvE,uBAAC;AAAD,CAAC,AAND,IAMC;AANY,4CAAgB;AAQ7B;IAA0C,wCAAgB;IAIxD,8BAAoB,YAAqB;QAAzC,YACE,kBAAM,YAAY,CAAC,SACpB;QAFmB,kBAAY,GAAZ,YAAY,CAAS;QAHzC,UAAI,GAAG,aAAa,CAAC,oBAAoB,CAAC;QAC1C,UAAI,GAAG,4BAA4B,CAAC;;IAIpC,CAAC;IACH,2BAAC;AAAD,CAAC,AAPD,CAA0C,gBAAgB,GAOzD;AAPY,oDAAoB"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import * as UUID from 'uuid';
|
|
2
|
+
import { CredentialApplication, CredentialPresentation, PresentationDefinition, WACIMessage } from '../types';
|
|
3
|
+
import { Callback } from '../callbacks';
|
|
4
|
+
/**
|
|
5
|
+
* Extract the claim key from a JSONPath expression.
|
|
6
|
+
* E.g. "$.credentialSubject.name" → "name", "$.type" → "type"
|
|
7
|
+
*/
|
|
8
|
+
export declare const extractClaimKeyFromPath: (path: string) => string;
|
|
9
|
+
/**
|
|
10
|
+
* Parse an SD-JWT string and extract the disclosed claim names as a Set.
|
|
11
|
+
* SD-JWT format: <JWT>~<disclosure1>~<disclosure2>~...~[<KB-JWT>]
|
|
12
|
+
* Each disclosure is base64url-encoded JSON array: [salt, claimName, claimValue]
|
|
13
|
+
*/
|
|
14
|
+
export declare const extractSDJWTClaims: (sdJwtString: string) => Set<string>;
|
|
15
|
+
export declare const getObjectValues: (object: any) => string[];
|
|
16
|
+
export declare const createUUID: (<T extends ArrayLike<number>>(options: UUID.V4Options, buffer: T, offset?: number) => T) & ((options?: UUID.V4Options) => string);
|
|
17
|
+
export declare const verifyPresentation: (presentationDefinition: PresentationDefinition, credentialApplication: CredentialApplication | CredentialPresentation, verificationCallback: Callback<any, {
|
|
18
|
+
result: boolean;
|
|
19
|
+
error?: string[];
|
|
20
|
+
}>) => Promise<any>;
|
|
21
|
+
export declare const extractExpectedChallenge: (presentationDefinitionMessage: WACIMessage) => string;
|
|
22
|
+
export declare const validateVcByInputDescriptor: (vc: any, inputDescriptor: any) => boolean;
|