@sphereon/ssi-sdk.ebsi-support 0.34.1-next.91 → 0.36.1-feat.SSISDK.83.3
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 -17
- 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 -9
- package/dist/index.js.map +1 -1
- package/package.json +24 -23
- package/src/agent/EbsiSupport.ts +4 -4
- 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 +11 -6
- 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
|
@@ -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) => {
|
|
@@ -2316,7 +2317,7 @@ var ebsiCreateAttestationAuthRequestURL = /* @__PURE__ */ __name(async ({ client
|
|
|
2316
2317
|
createAuthorizationRequestURL: false,
|
|
2317
2318
|
retrieveServerMetadata: true
|
|
2318
2319
|
});
|
|
2319
|
-
const allMatches =
|
|
2320
|
+
const allMatches = {};
|
|
2320
2321
|
let arrayMatches;
|
|
2321
2322
|
if (Array.isArray(allMatches)) {
|
|
2322
2323
|
arrayMatches = allMatches;
|
|
@@ -2333,10 +2334,14 @@ var ebsiCreateAttestationAuthRequestURL = /* @__PURE__ */ __name(async ({ client
|
|
|
2333
2334
|
throw Error(`Could not find '${credentialType}' with format(s) '${formats.join(",")}' in list of supported types for issuer: ${credentialIssuer}`);
|
|
2334
2335
|
}
|
|
2335
2336
|
const authorizationDetails = supportedConfigurations.map((supported) => {
|
|
2337
|
+
const credential_configuration_id = supported.id;
|
|
2338
|
+
if (!credential_configuration_id) {
|
|
2339
|
+
throw Error(`Credential configuration id missing for credential type: ${credentialType}`);
|
|
2340
|
+
}
|
|
2336
2341
|
return {
|
|
2337
2342
|
type: "openid_credential",
|
|
2338
|
-
|
|
2339
|
-
|
|
2343
|
+
credential_configuration_id,
|
|
2344
|
+
credential_identifiers: getTypesFromCredentialSupported(supported)
|
|
2340
2345
|
};
|
|
2341
2346
|
});
|
|
2342
2347
|
const signCallbacks = requestObjectOpts.signCallbacks ?? {
|
|
@@ -2536,6 +2541,24 @@ var ebsiWaitTillDocumentAnchored = /* @__PURE__ */ __name(async (args) => {
|
|
|
2536
2541
|
count
|
|
2537
2542
|
};
|
|
2538
2543
|
}, "ebsiWaitTillDocumentAnchored");
|
|
2544
|
+
var ebsiListDidDocuments = /* @__PURE__ */ __name(async (args) => {
|
|
2545
|
+
const { params, apiOpts } = args;
|
|
2546
|
+
const { offset, size, controller } = params;
|
|
2547
|
+
const queryParams = [];
|
|
2548
|
+
if (offset) {
|
|
2549
|
+
queryParams.push(`page[after]=${offset}`);
|
|
2550
|
+
}
|
|
2551
|
+
if (size) {
|
|
2552
|
+
queryParams.push(`page[size]=${size}`);
|
|
2553
|
+
}
|
|
2554
|
+
if (controller) {
|
|
2555
|
+
queryParams.push(`controller=${controller}`);
|
|
2556
|
+
}
|
|
2557
|
+
const query = `?${queryParams.filter(Boolean).join("&")}`;
|
|
2558
|
+
return await (await fetch2(`${ebsiGetRegistryAPIUrls({
|
|
2559
|
+
...apiOpts
|
|
2560
|
+
}).query}/${query}`)).json();
|
|
2561
|
+
}, "ebsiListDidDocuments");
|
|
2539
2562
|
|
|
2540
2563
|
// src/did/services/EbsiRPCService.ts
|
|
2541
2564
|
import fetch3 from "cross-fetch";
|
|
@@ -2693,6 +2716,14 @@ var ebsiGetIssuerMock = /* @__PURE__ */ __name((args) => {
|
|
|
2693
2716
|
system: environment
|
|
2694
2717
|
})}/issuer-mock`;
|
|
2695
2718
|
}, "ebsiGetIssuerMock");
|
|
2719
|
+
var ebsiGetAuthorisationServer = /* @__PURE__ */ __name((args) => {
|
|
2720
|
+
const { environment = "pilot", version = "v4" } = args;
|
|
2721
|
+
return `${getEbsiApiBaseUrl({
|
|
2722
|
+
environment,
|
|
2723
|
+
version,
|
|
2724
|
+
system: "authorisation"
|
|
2725
|
+
})}`;
|
|
2726
|
+
}, "ebsiGetAuthorisationServer");
|
|
2696
2727
|
var ebsiGetRegistryAPIUrls = /* @__PURE__ */ __name((args) => {
|
|
2697
2728
|
const { environment = "pilot", version = "v5" } = args;
|
|
2698
2729
|
const baseUrl = `${getEbsiApiBaseUrl({
|
|
@@ -2806,7 +2837,7 @@ var toMinimalImportableKey = /* @__PURE__ */ __name(async (args) => {
|
|
|
2806
2837
|
minimalImportableKey.meta = {
|
|
2807
2838
|
purposes: assertedPurposes({
|
|
2808
2839
|
key
|
|
2809
|
-
}) ??
|
|
2840
|
+
}) ?? setPurposes({
|
|
2810
2841
|
key,
|
|
2811
2842
|
type
|
|
2812
2843
|
}),
|
|
@@ -2842,7 +2873,7 @@ var assertedPurposes = /* @__PURE__ */ __name((args) => {
|
|
|
2842
2873
|
}
|
|
2843
2874
|
return key?.purposes;
|
|
2844
2875
|
}, "assertedPurposes");
|
|
2845
|
-
var
|
|
2876
|
+
var setPurposes = /* @__PURE__ */ __name((args) => {
|
|
2846
2877
|
const { key, type } = args;
|
|
2847
2878
|
if (!key?.purposes || key.purposes.length === 0) {
|
|
2848
2879
|
switch (type) {
|
|
@@ -2860,7 +2891,7 @@ var setDefaultPurposes = /* @__PURE__ */ __name((args) => {
|
|
|
2860
2891
|
}
|
|
2861
2892
|
}
|
|
2862
2893
|
return key.purposes;
|
|
2863
|
-
}, "
|
|
2894
|
+
}, "setPurposes");
|
|
2864
2895
|
var randomRpcId = /* @__PURE__ */ __name(() => {
|
|
2865
2896
|
return Math.floor(Math.random() * Number.MAX_SAFE_INTEGER);
|
|
2866
2897
|
}, "randomRpcId");
|
|
@@ -3510,6 +3541,18 @@ var EbsiDidProvider = class _EbsiDidProvider extends AbstractIdentifierProvider
|
|
|
3510
3541
|
// src/did/EbsiDidResolver.ts
|
|
3511
3542
|
import { Resolver } from "did-resolver";
|
|
3512
3543
|
import { getResolver } from "@sphereon/ssi-sdk-ext.did-resolver-ebsi";
|
|
3544
|
+
var resolveDidEbsi = /* @__PURE__ */ __name(async (didUrl, _parsed, _resolver, options) => {
|
|
3545
|
+
const resolver = new Resolver({
|
|
3546
|
+
...getResolver()
|
|
3547
|
+
});
|
|
3548
|
+
return resolver.resolve(didUrl, options);
|
|
3549
|
+
}, "resolveDidEbsi");
|
|
3550
|
+
function getDidEbsiResolver() {
|
|
3551
|
+
return {
|
|
3552
|
+
key: resolveDidEbsi
|
|
3553
|
+
};
|
|
3554
|
+
}
|
|
3555
|
+
__name(getDidEbsiResolver, "getDidEbsiResolver");
|
|
3513
3556
|
|
|
3514
3557
|
// src/index.ts
|
|
3515
3558
|
var logger = Loggers.DEFAULT.options("sphereon:ebsi-support", {
|
|
@@ -3521,11 +3564,34 @@ var logger = Loggers.DEFAULT.options("sphereon:ebsi-support", {
|
|
|
3521
3564
|
}).get("sphereon:ebsi-support");
|
|
3522
3565
|
var schema = require_plugin_schema();
|
|
3523
3566
|
export {
|
|
3567
|
+
BASE_CONTEXT_DOC,
|
|
3568
|
+
EBSI_DID_SPEC_INFOS,
|
|
3524
3569
|
EbsiDidProvider,
|
|
3570
|
+
EbsiPublicKeyPurpose,
|
|
3571
|
+
EbsiRpcMethod,
|
|
3525
3572
|
EbsiSupport,
|
|
3573
|
+
JSON_RPC_VERSION,
|
|
3526
3574
|
TokenType,
|
|
3575
|
+
assertedPurposes,
|
|
3576
|
+
determineWellknownEndpoint,
|
|
3577
|
+
ebsiCreateDidOnLedger,
|
|
3578
|
+
ebsiGenerateOrUseKeyPair,
|
|
3579
|
+
ebsiGetAuthorisationServer,
|
|
3580
|
+
ebsiGetDidDocument,
|
|
3581
|
+
ebsiGetIssuerMock,
|
|
3582
|
+
ebsiGetRegistryAPIUrls,
|
|
3583
|
+
ebsiListDidDocuments,
|
|
3584
|
+
ebsiSignAndSendTransaction,
|
|
3527
3585
|
ebsiSupportMethods,
|
|
3586
|
+
ebsiWaitTillDocumentAnchored,
|
|
3587
|
+
formatEbsiPublicKey,
|
|
3588
|
+
generateEbsiMethodSpecificId,
|
|
3589
|
+
generateOrUseProvidedEbsiPrivateKeyHex,
|
|
3590
|
+
getDidEbsiResolver,
|
|
3528
3591
|
logger,
|
|
3529
|
-
|
|
3592
|
+
randomRpcId,
|
|
3593
|
+
schema,
|
|
3594
|
+
setPurposes,
|
|
3595
|
+
toMinimalImportableKey
|
|
3530
3596
|
};
|
|
3531
3597
|
//# sourceMappingURL=index.js.map
|