@triveria/wallet 0.0.314 → 0.0.316
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/api.d.ts +11 -0
- package/api.js +10 -1
- package/notifications.d.ts +15 -2
- package/notifications.js +19 -4
- package/package.json +1 -1
package/api.d.ts
CHANGED
|
@@ -1016,6 +1016,16 @@ export interface VPDrivenIssuerConfig {
|
|
|
1016
1016
|
*/
|
|
1017
1017
|
'mapping': object;
|
|
1018
1018
|
}
|
|
1019
|
+
/**
|
|
1020
|
+
* Which key store backend holds this wallet\'s signing keys. This property COULD NOT change later: it is only read on wallet creation and is ignored on wallet patch. Leave unset to use the deployment\'s default backend. vaultPlaintext - locally generated and stored WITHOUT encryption, for development only and rejected when the deployment runs with production=true; vaultAwsKms / vaultOvhKms - locally generated, wrapped by AWS KMS / OVH KMS; vaultKmip - generated and held inside a KMIP-speaking appliance (e.g. OVHcloud KMS), never exported.
|
|
1021
|
+
*/
|
|
1022
|
+
export declare const VaultType: {
|
|
1023
|
+
readonly VaultPlaintext: "vaultPlaintext";
|
|
1024
|
+
readonly VaultAwsKms: "vaultAwsKms";
|
|
1025
|
+
readonly VaultOvhKms: "vaultOvhKms";
|
|
1026
|
+
readonly VaultKmip: "vaultKmip";
|
|
1027
|
+
};
|
|
1028
|
+
export type VaultType = typeof VaultType[keyof typeof VaultType];
|
|
1019
1029
|
/**
|
|
1020
1030
|
* The offer to be accepted. The offer URL is mandatory.
|
|
1021
1031
|
*/
|
|
@@ -1148,6 +1158,7 @@ export interface WalletConfig {
|
|
|
1148
1158
|
'EUDI'?: EudiConfiguration;
|
|
1149
1159
|
'IDTL'?: IdtlConfiguration;
|
|
1150
1160
|
'walletKeyIdentifier': SigningKeyIdentifier;
|
|
1161
|
+
'vaultType'?: VaultType;
|
|
1151
1162
|
/**
|
|
1152
1163
|
* Expiration time in seconds for credential status lists. Used only if the wallet is a credential issuer
|
|
1153
1164
|
*/
|
package/api.js
CHANGED
|
@@ -25,7 +25,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
25
25
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
26
26
|
};
|
|
27
27
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
28
|
-
exports.WmpEntityListEntityTypeEnum = exports.CredentialListInteractionEnum = exports.DefaultApi = exports.DefaultApiFactory = exports.DefaultApiFp = exports.DefaultApiAxiosParamCreator = exports.XadesSignatureType = exports.WmpRequestType = exports.WmpProvideIdentityAssertionTypeEnum = exports.WmpProcessVerificationRequestTypeEnum = exports.WmpProcessOfferRequestTypeEnum = exports.WmpAuthenticateSessionTypeEnum = exports.WalletNotificationEventType = exports.WalletCapability = exports.TrustListKind = exports.TrustFrameworkType = exports.SystemImpactStatusEnum = exports.SigningKeyIdentifier = exports.RevokeAccreditationRequestTypeEnum = exports.PresentationDefinitionSubmissionRequirementsRuleEnum = exports.OidcRevisionOidc4vpEnum = exports.OidcRevisionOidc4vciEnum = exports.ObjectVerticalAlignment = exports.ObjectHorizontalAlignment = exports.ListSort = exports.InteractionAuthorizationRequirementsRequirementTypeEnum = exports.HealthStatusStatusEnum = exports.EntityAccreditationRequestTypeEnum = exports.DocumentSignatureValidityVerificationResultEnum = exports.DeferredStatusEnum = exports.CredentialPropertyToVerify = exports.CredentialNotificationEventTypeEnum = exports.CredentialMetadataStatusEnum = exports.CredentialMetadataInteractionEnum = exports.CredentialIssuerDefinitionAuthorizationEnum = exports.CredentialIssuerDefinitionCredentialIssuerEnum = exports.CredentialFormat = exports.CertificateStatus = exports.AccreditationRequestTypeEnum = void 0;
|
|
28
|
+
exports.WmpEntityListEntityTypeEnum = exports.CredentialListInteractionEnum = exports.DefaultApi = exports.DefaultApiFactory = exports.DefaultApiFp = exports.DefaultApiAxiosParamCreator = exports.XadesSignatureType = exports.WmpRequestType = exports.WmpProvideIdentityAssertionTypeEnum = exports.WmpProcessVerificationRequestTypeEnum = exports.WmpProcessOfferRequestTypeEnum = exports.WmpAuthenticateSessionTypeEnum = exports.WalletNotificationEventType = exports.WalletCapability = exports.VaultType = exports.TrustListKind = exports.TrustFrameworkType = exports.SystemImpactStatusEnum = exports.SigningKeyIdentifier = exports.RevokeAccreditationRequestTypeEnum = exports.PresentationDefinitionSubmissionRequirementsRuleEnum = exports.OidcRevisionOidc4vpEnum = exports.OidcRevisionOidc4vciEnum = exports.ObjectVerticalAlignment = exports.ObjectHorizontalAlignment = exports.ListSort = exports.InteractionAuthorizationRequirementsRequirementTypeEnum = exports.HealthStatusStatusEnum = exports.EntityAccreditationRequestTypeEnum = exports.DocumentSignatureValidityVerificationResultEnum = exports.DeferredStatusEnum = exports.CredentialPropertyToVerify = exports.CredentialNotificationEventTypeEnum = exports.CredentialMetadataStatusEnum = exports.CredentialMetadataInteractionEnum = exports.CredentialIssuerDefinitionAuthorizationEnum = exports.CredentialIssuerDefinitionCredentialIssuerEnum = exports.CredentialFormat = exports.CertificateStatus = exports.AccreditationRequestTypeEnum = void 0;
|
|
29
29
|
const axios_1 = __importDefault(require("axios"));
|
|
30
30
|
// Some imports not used depending on template conditions
|
|
31
31
|
// @ts-ignore
|
|
@@ -181,6 +181,15 @@ exports.TrustListKind = {
|
|
|
181
181
|
TrustList: 'trustList',
|
|
182
182
|
Lotl: 'lotl',
|
|
183
183
|
};
|
|
184
|
+
/**
|
|
185
|
+
* Which key store backend holds this wallet\'s signing keys. This property COULD NOT change later: it is only read on wallet creation and is ignored on wallet patch. Leave unset to use the deployment\'s default backend. vaultPlaintext - locally generated and stored WITHOUT encryption, for development only and rejected when the deployment runs with production=true; vaultAwsKms / vaultOvhKms - locally generated, wrapped by AWS KMS / OVH KMS; vaultKmip - generated and held inside a KMIP-speaking appliance (e.g. OVHcloud KMS), never exported.
|
|
186
|
+
*/
|
|
187
|
+
exports.VaultType = {
|
|
188
|
+
VaultPlaintext: 'vaultPlaintext',
|
|
189
|
+
VaultAwsKms: 'vaultAwsKms',
|
|
190
|
+
VaultOvhKms: 'vaultOvhKms',
|
|
191
|
+
VaultKmip: 'vaultKmip',
|
|
192
|
+
};
|
|
184
193
|
/**
|
|
185
194
|
* Defines the capabilities which the wallet has. It may be any of \"holder\", \"issuer\" and \"verifier\".
|
|
186
195
|
*/
|
package/notifications.d.ts
CHANGED
|
@@ -52,7 +52,10 @@ export declare interface WalletNotificationStream {
|
|
|
52
52
|
* ```
|
|
53
53
|
*
|
|
54
54
|
* Drops are reconnected automatically (replaying queued notifications via
|
|
55
|
-
* `Last-Event-ID`) unless `options.reconnect` is set to `false`.
|
|
55
|
+
* `Last-Event-ID`) unless `options.reconnect` is set to `false`. The current
|
|
56
|
+
* `Last-Event-ID` is exposed via {@link WalletNotificationStream.lastEventId}
|
|
57
|
+
* so it can be persisted and used to resume the stream later, e.g. across
|
|
58
|
+
* process restarts.
|
|
56
59
|
*/
|
|
57
60
|
export declare class WalletNotificationStream extends EventEmitter implements AsyncIterable<WalletNotification> {
|
|
58
61
|
private readonly configuration;
|
|
@@ -64,7 +67,7 @@ export declare class WalletNotificationStream extends EventEmitter implements As
|
|
|
64
67
|
private readonly reconnect;
|
|
65
68
|
private readonly retryDelayMs;
|
|
66
69
|
private readonly maxRetryDelayMs;
|
|
67
|
-
private
|
|
70
|
+
private _lastEventId?;
|
|
68
71
|
private nextRetryDelayMs?;
|
|
69
72
|
private abortController?;
|
|
70
73
|
private retryTimer?;
|
|
@@ -75,6 +78,16 @@ export declare class WalletNotificationStream extends EventEmitter implements As
|
|
|
75
78
|
/** Stops the stream and prevents further reconnection attempts. */
|
|
76
79
|
close(): void;
|
|
77
80
|
get isClosed(): boolean;
|
|
81
|
+
/**
|
|
82
|
+
* The ID of the last SSE event received on this stream (per the `id:` field),
|
|
83
|
+
* or the `lastEventId` the stream was constructed/reconnected with if no event
|
|
84
|
+
* has been received yet.
|
|
85
|
+
*
|
|
86
|
+
* Persist this value and pass it back as `options.lastEventId` when creating a
|
|
87
|
+
* new {@link WalletNotificationStream} (e.g. after a process restart) to resume
|
|
88
|
+
* the stream and replay any notifications queued since that event.
|
|
89
|
+
*/
|
|
90
|
+
get lastEventId(): string | undefined;
|
|
78
91
|
private connect;
|
|
79
92
|
private scheduleReconnect;
|
|
80
93
|
private dispatchToQueue;
|
package/notifications.js
CHANGED
|
@@ -140,7 +140,10 @@ function parseSseStream(source) {
|
|
|
140
140
|
* ```
|
|
141
141
|
*
|
|
142
142
|
* Drops are reconnected automatically (replaying queued notifications via
|
|
143
|
-
* `Last-Event-ID`) unless `options.reconnect` is set to `false`.
|
|
143
|
+
* `Last-Event-ID`) unless `options.reconnect` is set to `false`. The current
|
|
144
|
+
* `Last-Event-ID` is exposed via {@link WalletNotificationStream.lastEventId}
|
|
145
|
+
* so it can be persisted and used to resume the stream later, e.g. across
|
|
146
|
+
* process restarts.
|
|
144
147
|
*/
|
|
145
148
|
class WalletNotificationStream extends events_1.EventEmitter {
|
|
146
149
|
constructor(configuration, walletId, options = {}) {
|
|
@@ -155,7 +158,7 @@ class WalletNotificationStream extends events_1.EventEmitter {
|
|
|
155
158
|
this.basePath = (_c = (_b = options.basePath) !== null && _b !== void 0 ? _b : configuration.basePath) !== null && _c !== void 0 ? _c : base_1.BASE_PATH;
|
|
156
159
|
this.eventType = options.eventType;
|
|
157
160
|
this.state = options.state;
|
|
158
|
-
this.
|
|
161
|
+
this._lastEventId = options.lastEventId;
|
|
159
162
|
this.reconnect = (_d = options.reconnect) !== null && _d !== void 0 ? _d : true;
|
|
160
163
|
this.retryDelayMs = (_e = options.retryDelayMs) !== null && _e !== void 0 ? _e : 3000;
|
|
161
164
|
this.maxRetryDelayMs = (_f = options.maxRetryDelayMs) !== null && _f !== void 0 ? _f : 30000;
|
|
@@ -176,6 +179,18 @@ class WalletNotificationStream extends events_1.EventEmitter {
|
|
|
176
179
|
get isClosed() {
|
|
177
180
|
return this.closed;
|
|
178
181
|
}
|
|
182
|
+
/**
|
|
183
|
+
* The ID of the last SSE event received on this stream (per the `id:` field),
|
|
184
|
+
* or the `lastEventId` the stream was constructed/reconnected with if no event
|
|
185
|
+
* has been received yet.
|
|
186
|
+
*
|
|
187
|
+
* Persist this value and pass it back as `options.lastEventId` when creating a
|
|
188
|
+
* new {@link WalletNotificationStream} (e.g. after a process restart) to resume
|
|
189
|
+
* the stream and replay any notifications queued since that event.
|
|
190
|
+
*/
|
|
191
|
+
get lastEventId() {
|
|
192
|
+
return this._lastEventId;
|
|
193
|
+
}
|
|
179
194
|
connect() {
|
|
180
195
|
return __awaiter(this, void 0, void 0, function* () {
|
|
181
196
|
var _a, e_2, _b, _c;
|
|
@@ -184,7 +199,7 @@ class WalletNotificationStream extends events_1.EventEmitter {
|
|
|
184
199
|
return;
|
|
185
200
|
this.abortController = new AbortController();
|
|
186
201
|
try {
|
|
187
|
-
const requestArgs = yield (0, api_1.DefaultApiAxiosParamCreator)(this.configuration).walletNotifications(this.walletId, this.eventType, this.state, this.
|
|
202
|
+
const requestArgs = yield (0, api_1.DefaultApiAxiosParamCreator)(this.configuration).walletNotifications(this.walletId, this.eventType, this.state, this._lastEventId, { signal: this.abortController.signal, responseType: 'stream' });
|
|
188
203
|
const request = (0, common_1.createRequestFunction)(requestArgs, this.axiosInstance, this.basePath, this.configuration);
|
|
189
204
|
const response = yield request(this.axiosInstance, this.basePath);
|
|
190
205
|
this.emit('open');
|
|
@@ -200,7 +215,7 @@ class WalletNotificationStream extends events_1.EventEmitter {
|
|
|
200
215
|
continue;
|
|
201
216
|
}
|
|
202
217
|
if (message.id !== undefined)
|
|
203
|
-
this.
|
|
218
|
+
this._lastEventId = message.id;
|
|
204
219
|
if (!message.data)
|
|
205
220
|
continue;
|
|
206
221
|
let notification;
|