@sphereon/ssi-sdk.ebsi-support 0.34.1-fix.79 → 0.34.1-next.278
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/index.cjs +83 -21
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +327 -5
- package/dist/index.d.ts +327 -5
- package/dist/index.js +75 -13
- package/dist/index.js.map +1 -1
- package/package.json +24 -23
- package/plugin.schema.json +1 -1
- package/src/did/functions.ts +2 -2
- package/src/did/index.ts +1 -0
- package/src/did/types.ts +1 -1
- package/src/functions/Attestation.ts +1 -1
- package/src/functions/AttestationHeadlessCallbacks.ts +2 -2
- package/src/index.ts +1 -1
- package/src/types/IEbsiSupport.ts +2 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,19 +1,21 @@
|
|
|
1
1
|
import * as _sphereon_ssi_types from '@sphereon/ssi-types';
|
|
2
|
-
import { W3CVerifiableCredential, PresentationSubmission } from '@sphereon/ssi-types';
|
|
3
|
-
import { IIdentifier, MinimalImportableKey, TKeyType, IService,
|
|
2
|
+
import { W3CVerifiableCredential, CredentialRole, PresentationSubmission } from '@sphereon/ssi-types';
|
|
3
|
+
import { IIdentifier, MinimalImportableKey, TKeyType, IService, IAgentContext, IKeyManager, IKey, IDIDManager, IPluginMethodMap, IResolver, IAgentPlugin } from '@veramo/core';
|
|
4
4
|
import { DiscoveryMetadataPayload, JWK } from '@sphereon/did-auth-siop';
|
|
5
5
|
import { RequestObjectOpts, OID4VCICredentialFormat } from '@sphereon/oid4vci-common';
|
|
6
6
|
import { PresentationDefinitionV2, Format } from '@sphereon/pex-models';
|
|
7
7
|
import { ManagedIdentifierDidResult, IIdentifierResolution, ManagedIdentifierDidOpts } from '@sphereon/ssi-sdk-ext.identifier-resolution';
|
|
8
8
|
import { IJwtService } from '@sphereon/ssi-sdk-ext.jwt-service';
|
|
9
|
-
import {
|
|
9
|
+
import { Party, IBasicCredentialLocaleBranding } from '@sphereon/ssi-sdk.data-store-types';
|
|
10
10
|
import { PrepareStartArgs, IssuanceOpts, IOID4VCIHolder, ErrorDetails, MappedCredentialToAccept } from '@sphereon/ssi-sdk.oid4vci-holder';
|
|
11
11
|
import { IPresentationExchange } from '@sphereon/ssi-sdk.presentation-exchange';
|
|
12
12
|
import { IDidAuthSiopOpAuthenticator } from '@sphereon/ssi-sdk.siopv2-oid4vp-op-auth';
|
|
13
13
|
import { _ExtendedIKey } from '@veramo/utils';
|
|
14
|
-
import { DIDDocument } from 'did-resolver';
|
|
14
|
+
import { DIDDocument, DIDResolver } from 'did-resolver';
|
|
15
|
+
import { BigNumberish, BytesLike, AccessListish } from 'ethers';
|
|
15
16
|
import { AbstractIdentifierProvider } from '@veramo/did-manager';
|
|
16
17
|
|
|
18
|
+
type IContext = IAgentContext<IKeyManager>;
|
|
17
19
|
/**
|
|
18
20
|
* The type of the DID to be created
|
|
19
21
|
* @readonly
|
|
@@ -42,6 +44,7 @@ interface EbsiDidSpecInfo {
|
|
|
42
44
|
didLength?: number;
|
|
43
45
|
privateKeyLength?: number;
|
|
44
46
|
}
|
|
47
|
+
declare const EBSI_DID_SPEC_INFOS: Record<string, EbsiDidSpecInfo>;
|
|
45
48
|
/**
|
|
46
49
|
* A minimal importable key with restricted types to choose from and purposes of the public key
|
|
47
50
|
* @typedef IKeyOpts
|
|
@@ -56,6 +59,14 @@ interface IKeyOpts extends WithRequiredProperty<Partial<MinimalImportableKey>, '
|
|
|
56
59
|
type WithRequiredProperty<Type, Key extends keyof Type> = Type & {
|
|
57
60
|
[Property in Key]-?: Type[Property];
|
|
58
61
|
};
|
|
62
|
+
type RpcMethodArgs = {
|
|
63
|
+
params: RPCParams[];
|
|
64
|
+
rpcId: number;
|
|
65
|
+
accessToken: string;
|
|
66
|
+
rpcMethod: EbsiRpcMethod;
|
|
67
|
+
apiOpts?: ApiOpts;
|
|
68
|
+
doNotThrowErrors?: boolean;
|
|
69
|
+
};
|
|
59
70
|
type EbsiCreateIdentifierOpts = {
|
|
60
71
|
methodSpecificId?: string;
|
|
61
72
|
rpcId?: number;
|
|
@@ -102,6 +113,36 @@ declare enum EbsiPublicKeyPurpose {
|
|
|
102
113
|
AssertionMethod = "assertionMethod",
|
|
103
114
|
CapabilityInvocation = "capabilityInvocation"
|
|
104
115
|
}
|
|
116
|
+
/**
|
|
117
|
+
* @typedef InsertDidDocumentParams
|
|
118
|
+
* @type {object}
|
|
119
|
+
* @property {string} from - Ethereum address of the signer
|
|
120
|
+
* @property {string} did - DID to insert. It must be for a legal entity (DID v1)
|
|
121
|
+
* @property {string} BASE_CONTEXT_DOC - JSON string containing the @context of the DID document
|
|
122
|
+
* @property {string} vMethodId - Thumbprint of the public key
|
|
123
|
+
* @property {string} publicKey - Public key for secp256k1 in uncompressed format prefixed with "0x04"
|
|
124
|
+
* @property {boolean} isSecp256k1 - It must be true
|
|
125
|
+
* @property {number} notBefore - Capability invocation is valid from this time
|
|
126
|
+
* @property {number} notAfter - Expiration of the capability invocation
|
|
127
|
+
*/
|
|
128
|
+
type InsertDidDocumentParams = {
|
|
129
|
+
from: string;
|
|
130
|
+
did: string;
|
|
131
|
+
baseDocument: string;
|
|
132
|
+
vMethodId: string;
|
|
133
|
+
publicKey: string;
|
|
134
|
+
isSecp256k1: boolean;
|
|
135
|
+
notBefore: number;
|
|
136
|
+
notAfter: number;
|
|
137
|
+
};
|
|
138
|
+
/**
|
|
139
|
+
* @typedef UpdateBaseDocumentParams
|
|
140
|
+
* @type {object}
|
|
141
|
+
* @property {string} from - Ethereum address of the signer
|
|
142
|
+
* @property {string} did - Existing DID
|
|
143
|
+
* @property {string} BASE_CONTEXT_DOC - JSON string containing the @context of the DID document
|
|
144
|
+
*/
|
|
145
|
+
type UpdateBaseDocumentParams = Pick<InsertDidDocumentParams, 'from' | 'did' | 'baseDocument'>;
|
|
105
146
|
/**
|
|
106
147
|
* @typedef UpdateIdentifierParams
|
|
107
148
|
* @type {object}
|
|
@@ -116,6 +157,79 @@ type UpdateIdentifierParams = {
|
|
|
116
157
|
[p: string]: any;
|
|
117
158
|
};
|
|
118
159
|
};
|
|
160
|
+
type AddServiceParams = {
|
|
161
|
+
from: string;
|
|
162
|
+
did: string;
|
|
163
|
+
service: IService;
|
|
164
|
+
};
|
|
165
|
+
/**
|
|
166
|
+
* @typedef AddVerificationMethodParams
|
|
167
|
+
* @type {object}
|
|
168
|
+
* @property {string} from - Ethereum address of the signer
|
|
169
|
+
* @property {string} did - Existing DID
|
|
170
|
+
* @property {string} vMethodId - New verification method id
|
|
171
|
+
* @property {boolean} isSecp256k1 - Boolean defining if the public key is for secp256k1 curve or not
|
|
172
|
+
* @property {string} publicKey - Public key as hex string. For an ES256K key, it must be in uncompressed format
|
|
173
|
+
* prefixed with "0x04". For other algorithms, it must be the JWK transformed to string and then to hex format.
|
|
174
|
+
*/
|
|
175
|
+
type AddVerificationMethodParams = Pick<InsertDidDocumentParams, 'from' | 'did' | 'vMethodId' | 'isSecp256k1' | 'publicKey'>;
|
|
176
|
+
/**
|
|
177
|
+
* @typedef AddVerificationMethodRelationshipParams
|
|
178
|
+
* @type {object}
|
|
179
|
+
* @property {string} from - Ethereum address of the signer
|
|
180
|
+
* @property {string} did - Existing DID
|
|
181
|
+
* @property {string} name - Name of the verification relationship
|
|
182
|
+
* @property {string} vMethodId - Reference to the verification method
|
|
183
|
+
* @property {number} notBefore - Verification relationship is valid from this time
|
|
184
|
+
* @property {number} notAfter - Expiration of the verification relationship
|
|
185
|
+
*/
|
|
186
|
+
type AddVerificationMethodRelationshipParams = Pick<InsertDidDocumentParams, 'from' | 'did' | 'vMethodId' | 'notBefore' | 'notAfter'> & {
|
|
187
|
+
name: string;
|
|
188
|
+
};
|
|
189
|
+
/**
|
|
190
|
+
* @typedef UnsignedTransaction
|
|
191
|
+
* @type {object}
|
|
192
|
+
* @property {string} from - The sending address.
|
|
193
|
+
* @property {string} to - The receiving address (if EOA, the transaction will transfer value. If a smart contract
|
|
194
|
+
* account, the transaction will use contract code).
|
|
195
|
+
* @property {string} data - Can contain code or a message to the recipient.
|
|
196
|
+
* @property {string} nonce - A number used to track ordering of transactions and prevent replay attacks
|
|
197
|
+
* @property {string} chainId - The Ethereum Network ID (ex: 1 - Ethereum Mainnet).
|
|
198
|
+
* @property {string} gasLimit - The maximum amount of gas units that can be used.
|
|
199
|
+
* @property {string} gasPrice - Gas price provided by the sender in Wei.
|
|
200
|
+
* @property {string} value - The amount of ETH to be sent from the sending address (denominated in Wei)
|
|
201
|
+
*/
|
|
202
|
+
type UnsignedTransaction = {
|
|
203
|
+
to?: string;
|
|
204
|
+
nonce?: number;
|
|
205
|
+
gasLimit?: BigNumberish;
|
|
206
|
+
gasPrice?: BigNumberish;
|
|
207
|
+
data?: BytesLike;
|
|
208
|
+
value?: BigNumberish;
|
|
209
|
+
chainId?: number;
|
|
210
|
+
type?: number | null;
|
|
211
|
+
accessList?: AccessListish;
|
|
212
|
+
maxPriorityFeePerGas?: BigNumberish;
|
|
213
|
+
maxFeePerGas?: BigNumberish;
|
|
214
|
+
};
|
|
215
|
+
/**
|
|
216
|
+
* @typedef SendSignedTransactionParams
|
|
217
|
+
* @type {object}
|
|
218
|
+
* @property {string} protocol - Example: eth
|
|
219
|
+
* @property {UnsignedTransaction} unsignedTransaction - The unsigned transaction
|
|
220
|
+
* @property {string} r - ECDSA signature r
|
|
221
|
+
* @property {string} s - ECDSA signature s
|
|
222
|
+
* @property {string} v - ECDSA recovery id
|
|
223
|
+
* @property {string} signedRawTransaction - The signed raw transaction
|
|
224
|
+
*/
|
|
225
|
+
type SendSignedTransactionParams = {
|
|
226
|
+
protocol: string;
|
|
227
|
+
unsignedTransaction: UnsignedTransaction;
|
|
228
|
+
r: string;
|
|
229
|
+
s: string;
|
|
230
|
+
v: string;
|
|
231
|
+
signedRawTransaction: string;
|
|
232
|
+
};
|
|
119
233
|
/**
|
|
120
234
|
* @typedef RpcOkResponse
|
|
121
235
|
* @type {object}
|
|
@@ -136,6 +250,93 @@ type RpcErrorResponse = {
|
|
|
136
250
|
message: string;
|
|
137
251
|
};
|
|
138
252
|
};
|
|
253
|
+
/**
|
|
254
|
+
* @typedef ResponseNot200
|
|
255
|
+
* @type {object}
|
|
256
|
+
* @property {URL | string} type - An absolute URI that identifies the problem type. When dereferenced,
|
|
257
|
+
* it SHOULD provide human-readable documentation for the problem type.
|
|
258
|
+
* @property {string} title - A short summary of the problem type.
|
|
259
|
+
* @property {number} status - The HTTP status code generated by the origin server for this occurrence of the problem.
|
|
260
|
+
* @property {string} detail - A human-readable explanation specific to this occurrence of the problem.
|
|
261
|
+
* @property {URL | string} instance An absolute URI that identifies the specific occurrence of the problem.
|
|
262
|
+
* It may or may not yield further information if dereferenced.
|
|
263
|
+
*/
|
|
264
|
+
type ResponseNot200 = {
|
|
265
|
+
type: URL | string;
|
|
266
|
+
id?: number;
|
|
267
|
+
title: string;
|
|
268
|
+
error?: {
|
|
269
|
+
code: number;
|
|
270
|
+
message: string;
|
|
271
|
+
};
|
|
272
|
+
status: number;
|
|
273
|
+
detail: string;
|
|
274
|
+
instance: URL | string;
|
|
275
|
+
};
|
|
276
|
+
/**
|
|
277
|
+
* @typedef GetDidDocumentParams
|
|
278
|
+
* @type {object}
|
|
279
|
+
* @property {string} did
|
|
280
|
+
* @property {string} validAt
|
|
281
|
+
*/
|
|
282
|
+
type GetDidDocumentParams = {
|
|
283
|
+
did: string;
|
|
284
|
+
validAt?: string;
|
|
285
|
+
};
|
|
286
|
+
/**
|
|
287
|
+
* @typedef GetDidDocumentsParams
|
|
288
|
+
* @type {object}
|
|
289
|
+
* @property {string} offset Originally page[after] Cursor that points to the end of the page of data that has been returned.
|
|
290
|
+
* @property {number} size Originally page[size] Defines the maximum number of objects that may be returned.
|
|
291
|
+
* @property {string} controller Filter by controller DID.
|
|
292
|
+
*/
|
|
293
|
+
type GetDidDocumentsParams = {
|
|
294
|
+
offset?: string;
|
|
295
|
+
size?: number;
|
|
296
|
+
controller?: string;
|
|
297
|
+
};
|
|
298
|
+
/**
|
|
299
|
+
* Result of listing dids
|
|
300
|
+
* @typedef {Item}
|
|
301
|
+
* @type {object}
|
|
302
|
+
* @property {string} did - The DID
|
|
303
|
+
* @property {string} href - The referrer of the DID
|
|
304
|
+
*/
|
|
305
|
+
type Item = {
|
|
306
|
+
did: string;
|
|
307
|
+
href: string;
|
|
308
|
+
};
|
|
309
|
+
/**
|
|
310
|
+
* The links related to pagination
|
|
311
|
+
* @typedef Links
|
|
312
|
+
* @type {object}
|
|
313
|
+
* @property {string} first - The link to the first page
|
|
314
|
+
* @property {string} prev - The link ot the previous page
|
|
315
|
+
* @property {string} next - The link to the next page
|
|
316
|
+
* @property {string} last - The link to the last page
|
|
317
|
+
*/
|
|
318
|
+
type Links = {
|
|
319
|
+
first: string;
|
|
320
|
+
prev: string;
|
|
321
|
+
next: string;
|
|
322
|
+
last: string;
|
|
323
|
+
};
|
|
324
|
+
/**
|
|
325
|
+
* @typedef GetDidDocumentResponse
|
|
326
|
+
* @type {object}
|
|
327
|
+
* @property {string} self - Absolute path to the collection (consult)
|
|
328
|
+
* @property {Item[]} items - List of DIDs and their referrers
|
|
329
|
+
* @property {number} total - Total number of items across all pages.
|
|
330
|
+
* @property {pageSize} number - Maximum number of items per page. For the last page, its value should be independent of the number of actually returned items.
|
|
331
|
+
* @property {Links} links - The links related to pagination
|
|
332
|
+
*/
|
|
333
|
+
type GetDidDocumentsResponse = {
|
|
334
|
+
self: string;
|
|
335
|
+
items: Item[];
|
|
336
|
+
total: number;
|
|
337
|
+
pageSize: number;
|
|
338
|
+
links: Links;
|
|
339
|
+
};
|
|
139
340
|
type EbsiAccessTokenOpts = {
|
|
140
341
|
attestationToOnboard?: W3CVerifiableCredential;
|
|
141
342
|
attestationToOnboardCredentialRole: CredentialRole;
|
|
@@ -173,6 +374,32 @@ interface CreateEbsiDidOnLedgerResult {
|
|
|
173
374
|
addAssertionMethodRelationship: EbsiRPCResponse;
|
|
174
375
|
addAuthenticationRelationship: EbsiRPCResponse;
|
|
175
376
|
}
|
|
377
|
+
/**
|
|
378
|
+
* @constant JSON_RPC_VERSION
|
|
379
|
+
*/
|
|
380
|
+
declare const JSON_RPC_VERSION = "2.0";
|
|
381
|
+
/**
|
|
382
|
+
* @constant BASE_CONTEXT_DOC
|
|
383
|
+
*/
|
|
384
|
+
declare const BASE_CONTEXT_DOC: string;
|
|
385
|
+
interface EbsiDidRegistryAPIEndpoints {
|
|
386
|
+
mutate: string;
|
|
387
|
+
query: string;
|
|
388
|
+
}
|
|
389
|
+
/**
|
|
390
|
+
* The EBSI RPC operations
|
|
391
|
+
* @readonly
|
|
392
|
+
* @enum {string}
|
|
393
|
+
*/
|
|
394
|
+
declare enum EbsiRpcMethod {
|
|
395
|
+
INSERT_DID_DOCUMENT = "insertDidDocument",
|
|
396
|
+
UPDATE_DID_DOCUMENT = "updateBaseDocument",
|
|
397
|
+
ADD_VERIFICATION_METHOD = "addVerificationMethod",
|
|
398
|
+
ADD_VERIFICATION_RELATIONSHIP = "addVerificationRelationship",
|
|
399
|
+
ADD_SERVICE = "addService",
|
|
400
|
+
SEND_SIGNED_TRANSACTION = "sendSignedTransaction"
|
|
401
|
+
}
|
|
402
|
+
type RPCParams = InsertDidDocumentParams | UpdateBaseDocumentParams | AddVerificationMethodParams | AddVerificationMethodRelationshipParams | SendSignedTransactionParams | AddServiceParams;
|
|
176
403
|
type EbsiRPCResponse = RpcOkResponse | (RpcErrorResponse & {
|
|
177
404
|
nonce: string;
|
|
178
405
|
});
|
|
@@ -219,6 +446,101 @@ declare class EbsiDidProvider extends AbstractIdentifierProvider {
|
|
|
219
446
|
updateIdentifier(args: UpdateIdentifierParams, context: IAgentContext<IKeyManager & IDIDManager>): Promise<IIdentifier>;
|
|
220
447
|
}
|
|
221
448
|
|
|
449
|
+
declare function getDidEbsiResolver(): {
|
|
450
|
+
key: DIDResolver;
|
|
451
|
+
};
|
|
452
|
+
|
|
453
|
+
declare function generateEbsiMethodSpecificId(specInfo?: EbsiDidSpecInfo): string;
|
|
454
|
+
declare function generateOrUseProvidedEbsiPrivateKeyHex(specInfo?: EbsiDidSpecInfo, privateKeyBytes?: Uint8Array): string;
|
|
455
|
+
/**
|
|
456
|
+
* Returns the public key in the correct format to be used with the did registry v5
|
|
457
|
+
* - in case of Secp256k1 - returns the uncompressed public key as hex string prefixed with 0x04
|
|
458
|
+
* - in case of Secp256r1 - returns the jwk public key as hex string
|
|
459
|
+
* @param {{ key: IKey, type: EbsiKeyType }} args
|
|
460
|
+
* - key is the cryptographic key containing the public key
|
|
461
|
+
* - type is the type of the key which can be Secp256k1 or Secp256r1
|
|
462
|
+
* @returns {string} The properly formatted public key
|
|
463
|
+
* @throws {Error} If the key type is invalid
|
|
464
|
+
*/
|
|
465
|
+
declare const formatEbsiPublicKey: (args: {
|
|
466
|
+
key: IKey;
|
|
467
|
+
type: TKeyType;
|
|
468
|
+
}) => string;
|
|
469
|
+
declare const ebsiGetIssuerMock: (args: {
|
|
470
|
+
environment?: EbsiEnvironment;
|
|
471
|
+
version?: EbsiApiVersion;
|
|
472
|
+
}) => string;
|
|
473
|
+
declare const ebsiGetAuthorisationServer: (args: {
|
|
474
|
+
environment?: EbsiEnvironment;
|
|
475
|
+
version?: EbsiApiVersion;
|
|
476
|
+
}) => string;
|
|
477
|
+
declare const ebsiGetRegistryAPIUrls: (args: {
|
|
478
|
+
environment?: EbsiEnvironment;
|
|
479
|
+
version?: EbsiApiVersion;
|
|
480
|
+
}) => EbsiDidRegistryAPIEndpoints;
|
|
481
|
+
declare const determineWellknownEndpoint: ({ environment, version, type, system, mock }: WellknownOpts) => string;
|
|
482
|
+
declare const ebsiSignAndSendTransaction: (args: {
|
|
483
|
+
rpcRequest: RpcMethodArgs;
|
|
484
|
+
previousTxResponse?: EbsiRPCResponse;
|
|
485
|
+
kid: string;
|
|
486
|
+
accessToken: string;
|
|
487
|
+
apiOpts?: ApiOpts;
|
|
488
|
+
}, context: IContext) => Promise<EbsiRPCResponse>;
|
|
489
|
+
declare const ebsiGenerateOrUseKeyPair: (args: {
|
|
490
|
+
keyOpts?: IKeyOpts;
|
|
491
|
+
keyType: EbsiKeyType;
|
|
492
|
+
kms: string;
|
|
493
|
+
controllerKey?: boolean;
|
|
494
|
+
}, context: IAgentContext<IKeyManager>) => Promise<MinimalImportableKey>;
|
|
495
|
+
declare const toMinimalImportableKey: (args: {
|
|
496
|
+
key?: IKeyOpts;
|
|
497
|
+
type: EbsiKeyType;
|
|
498
|
+
kms: string;
|
|
499
|
+
}) => Promise<MinimalImportableKey>;
|
|
500
|
+
declare const assertedPurposes: (args: {
|
|
501
|
+
key?: IKeyOpts;
|
|
502
|
+
}) => EbsiPublicKeyPurpose[] | undefined;
|
|
503
|
+
declare const setPurposes: (args: {
|
|
504
|
+
key?: IKeyOpts;
|
|
505
|
+
type: EbsiKeyType;
|
|
506
|
+
}) => EbsiPublicKeyPurpose[];
|
|
507
|
+
declare const randomRpcId: () => number;
|
|
508
|
+
declare const ebsiCreateDidOnLedger: (args: CreateEbsiDidParams, context: IRequiredContext) => Promise<CreateEbsiDidOnLedgerResult>;
|
|
509
|
+
|
|
510
|
+
/**
|
|
511
|
+
* Gets the DID document corresponding to the DID.
|
|
512
|
+
* @param {{ params: GetDidDocumentParams, apiOpts?: ApiOpts }} args
|
|
513
|
+
* @returns a did document
|
|
514
|
+
*/
|
|
515
|
+
declare const ebsiGetDidDocument: (args: {
|
|
516
|
+
params: GetDidDocumentParams;
|
|
517
|
+
apiOpts?: ApiOpts;
|
|
518
|
+
}) => Promise<DIDDocument>;
|
|
519
|
+
/**
|
|
520
|
+
* Wait up to the number of MS for a DID Document or Verification methods and relationships to be registered. This is needed, as the EBSI blockchain does not directly propagate across all nodes, since it needs to mine for consensus first
|
|
521
|
+
* @param args
|
|
522
|
+
*/
|
|
523
|
+
declare const ebsiWaitTillDocumentAnchored: (args: GetDidDocumentParams & ApiOpts & {
|
|
524
|
+
startIntervalMS?: number;
|
|
525
|
+
minIntervalMS?: number;
|
|
526
|
+
decreaseIntervalMSPerStep?: number;
|
|
527
|
+
maxWaitTime?: number;
|
|
528
|
+
searchForObject?: Record<string, any>;
|
|
529
|
+
}) => Promise<{
|
|
530
|
+
totalWaitTime: number;
|
|
531
|
+
count: number;
|
|
532
|
+
didDocument: DIDDocument | undefined;
|
|
533
|
+
}>;
|
|
534
|
+
/**
|
|
535
|
+
* listDidDocuments - Returns a list of identifiers.
|
|
536
|
+
* @param {{ params: GetDidDocumentsParams; apiOpts?: ApiOpts }} args
|
|
537
|
+
* @returns a list of identifiers
|
|
538
|
+
*/
|
|
539
|
+
declare const ebsiListDidDocuments: (args: {
|
|
540
|
+
params: GetDidDocumentsParams;
|
|
541
|
+
apiOpts?: ApiOpts;
|
|
542
|
+
}) => Promise<GetDidDocumentsResponse>;
|
|
543
|
+
|
|
222
544
|
interface AttestationAuthRequestUrlResult extends Omit<Required<PrepareStartArgs>, 'issuanceOpt'> {
|
|
223
545
|
issuanceOpt?: IssuanceOpts;
|
|
224
546
|
authorizationCodeURL: string;
|
|
@@ -443,4 +765,4 @@ declare class EbsiSupport implements IAgentPlugin {
|
|
|
443
765
|
declare const logger: _sphereon_ssi_types.ISimpleLogger<unknown>;
|
|
444
766
|
declare const schema: any;
|
|
445
767
|
|
|
446
|
-
export { type ApiOpts, type AttestationResult, type CreateAttestationAuthRequestURLArgs, type EBSIAuthAccessTokenGetArgs, type EBSIScope, type EbsiApiVersion, EbsiDidProvider, type EbsiEnvironment, type EbsiMock, type EbsiOpenIDMetadata, EbsiSupport, type EbsiSystem, type ExceptionResponse, type GetAccessTokenArgs, type GetAccessTokenResponse, type GetAccessTokenResult, type GetAccessTokenSuccessResponse, type GetAttestationArgs, type GetOIDProviderJwksResponse, type GetOIDProviderJwksSuccessResponse, type GetOIDProviderMetadataResponse, type GetPresentationDefinitionArgs, type GetPresentationDefinitionResponse, type GetPresentationDefinitionSuccessResponse, type IEbsiSupport, type IRequiredContext, TokenType, type WellknownOpts, type WellknownType, ebsiSupportMethods, logger, schema };
|
|
768
|
+
export { type AddServiceParams, type AddVerificationMethodParams, type AddVerificationMethodRelationshipParams, type ApiOpts, type AttestationResult, BASE_CONTEXT_DOC, type CreateAttestationAuthRequestURLArgs, type CreateEbsiDidOnLedgerResult, type CreateEbsiDidParams, type EBSIAuthAccessTokenGetArgs, type EBSIScope, EBSI_DID_SPEC_INFOS, type EbsiAccessTokenOpts, type EbsiApiVersion, type EbsiCreateIdentifierOpts, type EbsiDIDPrefix, type EbsiDIDType, EbsiDidProvider, type EbsiDidRegistryAPIEndpoints, type EbsiDidSpecInfo, type EbsiEnvironment, type EbsiKeyType, type EbsiMock, type EbsiOpenIDMetadata, EbsiPublicKeyPurpose, type EbsiRPCResponse, EbsiRpcMethod, EbsiSupport, type EbsiSystem, type ExceptionResponse, type GetAccessTokenArgs, type GetAccessTokenResponse, type GetAccessTokenResult, type GetAccessTokenSuccessResponse, type GetAttestationArgs, type GetDidDocumentParams, type GetDidDocumentsParams, type GetDidDocumentsResponse, type GetOIDProviderJwksResponse, type GetOIDProviderJwksSuccessResponse, type GetOIDProviderMetadataResponse, type GetPresentationDefinitionArgs, type GetPresentationDefinitionResponse, type GetPresentationDefinitionSuccessResponse, type IContext, type ICreateIdentifierArgs, type IEbsiSupport, type IKeyOpts, type IRequiredContext, type InsertDidDocumentParams, type Item, JSON_RPC_VERSION, type Links, type RPCParams, type ResponseNot200, type RpcErrorResponse, type RpcMethodArgs, type RpcOkResponse, type SendSignedTransactionParams, TokenType, type UnsignedTransaction, type UpdateBaseDocumentParams, type UpdateIdentifierParams, type WellknownOpts, type WellknownType, assertedPurposes, determineWellknownEndpoint, ebsiCreateDidOnLedger, ebsiGenerateOrUseKeyPair, ebsiGetAuthorisationServer, ebsiGetDidDocument, ebsiGetIssuerMock, ebsiGetRegistryAPIUrls, ebsiListDidDocuments, ebsiSignAndSendTransaction, ebsiSupportMethods, ebsiWaitTillDocumentAnchored, formatEbsiPublicKey, generateEbsiMethodSpecificId, generateOrUseProvidedEbsiPrivateKeyHex, getDidEbsiResolver, logger, randomRpcId, schema, setPurposes, toMinimalImportableKey };
|
package/dist/index.js
CHANGED
|
@@ -356,7 +356,7 @@ var require_plugin_schema = __commonJS({
|
|
|
356
356
|
di_vp: {
|
|
357
357
|
$ref: "#/components/schemas/DiObject"
|
|
358
358
|
},
|
|
359
|
-
"
|
|
359
|
+
"dc+sd-jwt": {
|
|
360
360
|
$ref: "#/components/schemas/SdJwtObject"
|
|
361
361
|
}
|
|
362
362
|
}
|
|
@@ -2066,13 +2066,14 @@ import { getAuthenticationKey, SupportedDidMethodEnum } from "@sphereon/ssi-sdk-
|
|
|
2066
2066
|
import { calculateJwkThumbprintForKey, signatureAlgorithmFromKey } from "@sphereon/ssi-sdk-ext.key-utils";
|
|
2067
2067
|
import { OID4VCICallbackStateListener, OID4VCIMachineStates, signCallback } from "@sphereon/ssi-sdk.oid4vci-holder";
|
|
2068
2068
|
import { OID4VPCallbackStateListener, Siopv2MachineStates, Siopv2OID4VPLinkHandler } from "@sphereon/ssi-sdk.siopv2-oid4vp-op-auth";
|
|
2069
|
-
import { waitFor } from "xstate/lib/waitFor";
|
|
2069
|
+
import { waitFor } from "xstate/lib/waitFor.js";
|
|
2070
2070
|
|
|
2071
2071
|
// src/functions/AttestationHeadlessCallbacks.ts
|
|
2072
2072
|
import { decodeUriAsJson } from "@sphereon/did-auth-siop";
|
|
2073
2073
|
import { getIssuerName } from "@sphereon/oid4vci-common";
|
|
2074
|
-
import { ConnectionType, CorrelationIdentifierType,
|
|
2074
|
+
import { ConnectionType, CorrelationIdentifierType, IdentityOrigin, PartyOrigin, PartyTypeType } from "@sphereon/ssi-sdk.data-store-types";
|
|
2075
2075
|
import { OID4VCIMachineEvents } from "@sphereon/ssi-sdk.oid4vci-holder";
|
|
2076
|
+
import { CredentialRole } from "@sphereon/ssi-types";
|
|
2076
2077
|
import fetch from "cross-fetch";
|
|
2077
2078
|
var addContactCallback = /* @__PURE__ */ __name((context) => {
|
|
2078
2079
|
return async (oid4vciMachine, state) => {
|
|
@@ -2536,6 +2537,24 @@ var ebsiWaitTillDocumentAnchored = /* @__PURE__ */ __name(async (args) => {
|
|
|
2536
2537
|
count
|
|
2537
2538
|
};
|
|
2538
2539
|
}, "ebsiWaitTillDocumentAnchored");
|
|
2540
|
+
var ebsiListDidDocuments = /* @__PURE__ */ __name(async (args) => {
|
|
2541
|
+
const { params, apiOpts } = args;
|
|
2542
|
+
const { offset, size, controller } = params;
|
|
2543
|
+
const queryParams = [];
|
|
2544
|
+
if (offset) {
|
|
2545
|
+
queryParams.push(`page[after]=${offset}`);
|
|
2546
|
+
}
|
|
2547
|
+
if (size) {
|
|
2548
|
+
queryParams.push(`page[size]=${size}`);
|
|
2549
|
+
}
|
|
2550
|
+
if (controller) {
|
|
2551
|
+
queryParams.push(`controller=${controller}`);
|
|
2552
|
+
}
|
|
2553
|
+
const query = `?${queryParams.filter(Boolean).join("&")}`;
|
|
2554
|
+
return await (await fetch2(`${ebsiGetRegistryAPIUrls({
|
|
2555
|
+
...apiOpts
|
|
2556
|
+
}).query}/${query}`)).json();
|
|
2557
|
+
}, "ebsiListDidDocuments");
|
|
2539
2558
|
|
|
2540
2559
|
// src/did/services/EbsiRPCService.ts
|
|
2541
2560
|
import fetch3 from "cross-fetch";
|
|
@@ -2554,12 +2573,12 @@ var EBSI_DID_SPEC_INFOS = {
|
|
|
2554
2573
|
method: "did:key:"
|
|
2555
2574
|
}
|
|
2556
2575
|
};
|
|
2557
|
-
var EbsiPublicKeyPurpose = /* @__PURE__ */ function(EbsiPublicKeyPurpose2) {
|
|
2576
|
+
var EbsiPublicKeyPurpose = /* @__PURE__ */ (function(EbsiPublicKeyPurpose2) {
|
|
2558
2577
|
EbsiPublicKeyPurpose2["Authentication"] = "authentication";
|
|
2559
2578
|
EbsiPublicKeyPurpose2["AssertionMethod"] = "assertionMethod";
|
|
2560
2579
|
EbsiPublicKeyPurpose2["CapabilityInvocation"] = "capabilityInvocation";
|
|
2561
2580
|
return EbsiPublicKeyPurpose2;
|
|
2562
|
-
}({});
|
|
2581
|
+
})({});
|
|
2563
2582
|
var JSON_RPC_VERSION = "2.0";
|
|
2564
2583
|
var BASE_CONTEXT_DOC = JSON.stringify({
|
|
2565
2584
|
"@context": [
|
|
@@ -2567,7 +2586,7 @@ var BASE_CONTEXT_DOC = JSON.stringify({
|
|
|
2567
2586
|
"https://w3id.org/security/suites/jws-2020/v1"
|
|
2568
2587
|
]
|
|
2569
2588
|
});
|
|
2570
|
-
var EbsiRpcMethod = /* @__PURE__ */ function(EbsiRpcMethod2) {
|
|
2589
|
+
var EbsiRpcMethod = /* @__PURE__ */ (function(EbsiRpcMethod2) {
|
|
2571
2590
|
EbsiRpcMethod2["INSERT_DID_DOCUMENT"] = "insertDidDocument";
|
|
2572
2591
|
EbsiRpcMethod2["UPDATE_DID_DOCUMENT"] = "updateBaseDocument";
|
|
2573
2592
|
EbsiRpcMethod2["ADD_VERIFICATION_METHOD"] = "addVerificationMethod";
|
|
@@ -2575,7 +2594,7 @@ var EbsiRpcMethod = /* @__PURE__ */ function(EbsiRpcMethod2) {
|
|
|
2575
2594
|
EbsiRpcMethod2["ADD_SERVICE"] = "addService";
|
|
2576
2595
|
EbsiRpcMethod2["SEND_SIGNED_TRANSACTION"] = "sendSignedTransaction";
|
|
2577
2596
|
return EbsiRpcMethod2;
|
|
2578
|
-
}({});
|
|
2597
|
+
})({});
|
|
2579
2598
|
|
|
2580
2599
|
// src/did/services/EbsiRPCService.ts
|
|
2581
2600
|
var callRpcMethod = /* @__PURE__ */ __name(async (args) => {
|
|
@@ -2693,6 +2712,14 @@ var ebsiGetIssuerMock = /* @__PURE__ */ __name((args) => {
|
|
|
2693
2712
|
system: environment
|
|
2694
2713
|
})}/issuer-mock`;
|
|
2695
2714
|
}, "ebsiGetIssuerMock");
|
|
2715
|
+
var ebsiGetAuthorisationServer = /* @__PURE__ */ __name((args) => {
|
|
2716
|
+
const { environment = "pilot", version = "v4" } = args;
|
|
2717
|
+
return `${getEbsiApiBaseUrl({
|
|
2718
|
+
environment,
|
|
2719
|
+
version,
|
|
2720
|
+
system: "authorisation"
|
|
2721
|
+
})}`;
|
|
2722
|
+
}, "ebsiGetAuthorisationServer");
|
|
2696
2723
|
var ebsiGetRegistryAPIUrls = /* @__PURE__ */ __name((args) => {
|
|
2697
2724
|
const { environment = "pilot", version = "v5" } = args;
|
|
2698
2725
|
const baseUrl = `${getEbsiApiBaseUrl({
|
|
@@ -2806,7 +2833,7 @@ var toMinimalImportableKey = /* @__PURE__ */ __name(async (args) => {
|
|
|
2806
2833
|
minimalImportableKey.meta = {
|
|
2807
2834
|
purposes: assertedPurposes({
|
|
2808
2835
|
key
|
|
2809
|
-
}) ??
|
|
2836
|
+
}) ?? setPurposes({
|
|
2810
2837
|
key,
|
|
2811
2838
|
type
|
|
2812
2839
|
}),
|
|
@@ -2842,7 +2869,7 @@ var assertedPurposes = /* @__PURE__ */ __name((args) => {
|
|
|
2842
2869
|
}
|
|
2843
2870
|
return key?.purposes;
|
|
2844
2871
|
}, "assertedPurposes");
|
|
2845
|
-
var
|
|
2872
|
+
var setPurposes = /* @__PURE__ */ __name((args) => {
|
|
2846
2873
|
const { key, type } = args;
|
|
2847
2874
|
if (!key?.purposes || key.purposes.length === 0) {
|
|
2848
2875
|
switch (type) {
|
|
@@ -2860,7 +2887,7 @@ var setDefaultPurposes = /* @__PURE__ */ __name((args) => {
|
|
|
2860
2887
|
}
|
|
2861
2888
|
}
|
|
2862
2889
|
return key.purposes;
|
|
2863
|
-
}, "
|
|
2890
|
+
}, "setPurposes");
|
|
2864
2891
|
var randomRpcId = /* @__PURE__ */ __name(() => {
|
|
2865
2892
|
return Math.floor(Math.random() * Number.MAX_SAFE_INTEGER);
|
|
2866
2893
|
}, "randomRpcId");
|
|
@@ -3296,10 +3323,10 @@ ${JSON.stringify(accessTokenResponse)}`);
|
|
|
3296
3323
|
};
|
|
3297
3324
|
|
|
3298
3325
|
// src/types/IEbsiSupport.ts
|
|
3299
|
-
var TokenType = /* @__PURE__ */ function(TokenType2) {
|
|
3326
|
+
var TokenType = /* @__PURE__ */ (function(TokenType2) {
|
|
3300
3327
|
TokenType2["BEARER"] = "Bearer";
|
|
3301
3328
|
return TokenType2;
|
|
3302
|
-
}({});
|
|
3329
|
+
})({});
|
|
3303
3330
|
|
|
3304
3331
|
// src/did/EbsiDidProvider.ts
|
|
3305
3332
|
import { getControllerKey as getControllerKey2, getEthereumAddressFromKey as getEthereumAddressFromKey2 } from "@sphereon/ssi-sdk-ext.did-utils";
|
|
@@ -3510,6 +3537,18 @@ var EbsiDidProvider = class _EbsiDidProvider extends AbstractIdentifierProvider
|
|
|
3510
3537
|
// src/did/EbsiDidResolver.ts
|
|
3511
3538
|
import { Resolver } from "did-resolver";
|
|
3512
3539
|
import { getResolver } from "@sphereon/ssi-sdk-ext.did-resolver-ebsi";
|
|
3540
|
+
var resolveDidEbsi = /* @__PURE__ */ __name(async (didUrl, _parsed, _resolver, options) => {
|
|
3541
|
+
const resolver = new Resolver({
|
|
3542
|
+
...getResolver()
|
|
3543
|
+
});
|
|
3544
|
+
return resolver.resolve(didUrl, options);
|
|
3545
|
+
}, "resolveDidEbsi");
|
|
3546
|
+
function getDidEbsiResolver() {
|
|
3547
|
+
return {
|
|
3548
|
+
key: resolveDidEbsi
|
|
3549
|
+
};
|
|
3550
|
+
}
|
|
3551
|
+
__name(getDidEbsiResolver, "getDidEbsiResolver");
|
|
3513
3552
|
|
|
3514
3553
|
// src/index.ts
|
|
3515
3554
|
var logger = Loggers.DEFAULT.options("sphereon:ebsi-support", {
|
|
@@ -3521,11 +3560,34 @@ var logger = Loggers.DEFAULT.options("sphereon:ebsi-support", {
|
|
|
3521
3560
|
}).get("sphereon:ebsi-support");
|
|
3522
3561
|
var schema = require_plugin_schema();
|
|
3523
3562
|
export {
|
|
3563
|
+
BASE_CONTEXT_DOC,
|
|
3564
|
+
EBSI_DID_SPEC_INFOS,
|
|
3524
3565
|
EbsiDidProvider,
|
|
3566
|
+
EbsiPublicKeyPurpose,
|
|
3567
|
+
EbsiRpcMethod,
|
|
3525
3568
|
EbsiSupport,
|
|
3569
|
+
JSON_RPC_VERSION,
|
|
3526
3570
|
TokenType,
|
|
3571
|
+
assertedPurposes,
|
|
3572
|
+
determineWellknownEndpoint,
|
|
3573
|
+
ebsiCreateDidOnLedger,
|
|
3574
|
+
ebsiGenerateOrUseKeyPair,
|
|
3575
|
+
ebsiGetAuthorisationServer,
|
|
3576
|
+
ebsiGetDidDocument,
|
|
3577
|
+
ebsiGetIssuerMock,
|
|
3578
|
+
ebsiGetRegistryAPIUrls,
|
|
3579
|
+
ebsiListDidDocuments,
|
|
3580
|
+
ebsiSignAndSendTransaction,
|
|
3527
3581
|
ebsiSupportMethods,
|
|
3582
|
+
ebsiWaitTillDocumentAnchored,
|
|
3583
|
+
formatEbsiPublicKey,
|
|
3584
|
+
generateEbsiMethodSpecificId,
|
|
3585
|
+
generateOrUseProvidedEbsiPrivateKeyHex,
|
|
3586
|
+
getDidEbsiResolver,
|
|
3528
3587
|
logger,
|
|
3529
|
-
|
|
3588
|
+
randomRpcId,
|
|
3589
|
+
schema,
|
|
3590
|
+
setPurposes,
|
|
3591
|
+
toMinimalImportableKey
|
|
3530
3592
|
};
|
|
3531
3593
|
//# sourceMappingURL=index.js.map
|