@sphereon/ssi-sdk.ebsi-support 0.26.1-unstable.101

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.
Files changed (68) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +13 -0
  3. package/dist/agent/EbsiSupport.d.ts +12 -0
  4. package/dist/agent/EbsiSupport.d.ts.map +1 -0
  5. package/dist/agent/EbsiSupport.js +202 -0
  6. package/dist/agent/EbsiSupport.js.map +1 -0
  7. package/dist/did/EbsiDidProvider.d.ts +47 -0
  8. package/dist/did/EbsiDidProvider.d.ts.map +1 -0
  9. package/dist/did/EbsiDidProvider.js +172 -0
  10. package/dist/did/EbsiDidProvider.js.map +1 -0
  11. package/dist/did/EbsiDidResolver.d.ts +5 -0
  12. package/dist/did/EbsiDidResolver.d.ts.map +1 -0
  13. package/dist/did/EbsiDidResolver.js +10 -0
  14. package/dist/did/EbsiDidResolver.js.map +1 -0
  15. package/dist/did/functions.d.ts +66 -0
  16. package/dist/did/functions.d.ts.map +1 -0
  17. package/dist/did/functions.js +416 -0
  18. package/dist/did/functions.js.map +1 -0
  19. package/dist/did/index.d.ts +6 -0
  20. package/dist/did/index.d.ts.map +1 -0
  21. package/dist/did/index.js +6 -0
  22. package/dist/did/index.js.map +1 -0
  23. package/dist/did/services/EbsiRPCService.d.ts +13 -0
  24. package/dist/did/services/EbsiRPCService.d.ts.map +1 -0
  25. package/dist/did/services/EbsiRPCService.js +64 -0
  26. package/dist/did/services/EbsiRPCService.js.map +1 -0
  27. package/dist/did/services/EbsiRestService.d.ts +37 -0
  28. package/dist/did/services/EbsiRestService.d.ts.map +1 -0
  29. package/dist/did/services/EbsiRestService.js +90 -0
  30. package/dist/did/services/EbsiRestService.js.map +1 -0
  31. package/dist/did/types.d.ts +386 -0
  32. package/dist/did/types.d.ts.map +1 -0
  33. package/dist/did/types.js +47 -0
  34. package/dist/did/types.js.map +1 -0
  35. package/dist/functions/Attestation.d.ts +32 -0
  36. package/dist/functions/Attestation.d.ts.map +1 -0
  37. package/dist/functions/Attestation.js +182 -0
  38. package/dist/functions/Attestation.js.map +1 -0
  39. package/dist/functions/AttestationHeadlessCallbacks.d.ts +17 -0
  40. package/dist/functions/AttestationHeadlessCallbacks.d.ts.map +1 -0
  41. package/dist/functions/AttestationHeadlessCallbacks.js +194 -0
  42. package/dist/functions/AttestationHeadlessCallbacks.js.map +1 -0
  43. package/dist/functions/index.d.ts +7 -0
  44. package/dist/functions/index.d.ts.map +1 -0
  45. package/dist/functions/index.js +8 -0
  46. package/dist/functions/index.js.map +1 -0
  47. package/dist/index.d.ts +7 -0
  48. package/dist/index.d.ts.map +1 -0
  49. package/dist/index.js +8 -0
  50. package/dist/index.js.map +1 -0
  51. package/dist/types/IEbsiSupport.d.ts +211 -0
  52. package/dist/types/IEbsiSupport.d.ts.map +1 -0
  53. package/dist/types/IEbsiSupport.js +5 -0
  54. package/dist/types/IEbsiSupport.js.map +1 -0
  55. package/package.json +86 -0
  56. package/src/agent/EbsiSupport.ts +250 -0
  57. package/src/did/EbsiDidProvider.ts +269 -0
  58. package/src/did/EbsiDidResolver.ts +16 -0
  59. package/src/did/functions.ts +528 -0
  60. package/src/did/index.ts +5 -0
  61. package/src/did/services/EbsiRPCService.ts +68 -0
  62. package/src/did/services/EbsiRestService.ts +117 -0
  63. package/src/did/types.ts +449 -0
  64. package/src/functions/Attestation.ts +262 -0
  65. package/src/functions/AttestationHeadlessCallbacks.ts +242 -0
  66. package/src/functions/index.ts +15 -0
  67. package/src/index.ts +8 -0
  68. package/src/types/IEbsiSupport.ts +241 -0
@@ -0,0 +1,90 @@
1
+ import fetch from 'cross-fetch';
2
+ import { wait } from '../../functions';
3
+ import { logger } from '../../index';
4
+ import { ebsiGetRegistryAPIUrls } from '../functions';
5
+ /**
6
+ * Gets the DID document corresponding to the DID.
7
+ * @param {{ params: GetDidDocumentParams, apiOpts?: ApiOpts }} args
8
+ * @returns a did document
9
+ */
10
+ export const ebsiGetDidDocument = async (args) => {
11
+ const { params, apiOpts } = args;
12
+ const { did, validAt } = params;
13
+ if (!did) {
14
+ throw new Error('did parameter is required');
15
+ }
16
+ const query = validAt ? `?valid_at=${validAt}` : '';
17
+ const response = await fetch(`${ebsiGetRegistryAPIUrls({ ...apiOpts }).query}/${did}${query}`);
18
+ const textBody = await response.text();
19
+ const json = textBody.startsWith('{') ? JSON.parse(textBody) : undefined;
20
+ if (response.status >= 300 || !json) {
21
+ return Promise.reject(new Error(json ?? textBody));
22
+ }
23
+ return json;
24
+ };
25
+ /**
26
+ * 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
27
+ * @param args
28
+ */
29
+ export const ebsiWaitTillDocumentAnchored = async (args) => {
30
+ const { did, startIntervalMS = 2000, minIntervalMS = 500, decreaseIntervalMSPerStep = 250, maxWaitTime = 60_000, version = 'v5', environment = 'pilot', searchForObject, } = args;
31
+ if (startIntervalMS < minIntervalMS) {
32
+ return Promise.reject(Error(`min interval ${minIntervalMS} needs to be smaller or equal to the start interval ${startIntervalMS}`));
33
+ }
34
+ else if (decreaseIntervalMSPerStep < 0) {
35
+ return Promise.reject(Error(`decrease interval per step ${decreaseIntervalMSPerStep} needs to be bigger than zero`));
36
+ }
37
+ let interval = startIntervalMS;
38
+ let totalWaitTime = 0;
39
+ let didDocument;
40
+ let count = 0;
41
+ function logCalback() {
42
+ logger.debug(`Get DID Document; count ${count}: wait time: ${totalWaitTime}, ${did}`);
43
+ }
44
+ while (!didDocument && totalWaitTime <= maxWaitTime) {
45
+ ++count;
46
+ try {
47
+ logCalback();
48
+ didDocument = await ebsiGetDidDocument({ params: { did }, apiOpts: { environment, version } });
49
+ if (searchForObject && didDocument) {
50
+ const didDocAsStr = JSON.stringify(didDocument);
51
+ const search = JSON.stringify(searchForObject);
52
+ const found = didDocAsStr.includes(search.substring(1, search.length - 1));
53
+ if (!found) {
54
+ logger.debug(`We did not find VM relationship or key ${JSON.stringify(searchForObject)} in DID document ${did}`);
55
+ didDocument = undefined;
56
+ }
57
+ }
58
+ }
59
+ catch (e) { }
60
+ if (!didDocument) {
61
+ await wait(interval);
62
+ totalWaitTime += interval;
63
+ interval = Math.max(interval - decreaseIntervalMSPerStep, minIntervalMS);
64
+ }
65
+ }
66
+ logCalback();
67
+ return { didDocument, totalWaitTime, count };
68
+ };
69
+ /**
70
+ * listDidDocuments - Returns a list of identifiers.
71
+ * @param {{ params: GetDidDocumentsParams; apiOpts?: ApiOpts }} args
72
+ * @returns a list of identifiers
73
+ */
74
+ export const ebsiListDidDocuments = async (args) => {
75
+ const { params, apiOpts } = args;
76
+ const { offset, size, controller } = params;
77
+ const queryParams = [];
78
+ if (offset) {
79
+ queryParams.push(`page[after]=${offset}`);
80
+ }
81
+ if (size) {
82
+ queryParams.push(`page[size]=${size}`);
83
+ }
84
+ if (controller) {
85
+ queryParams.push(`controller=${controller}`);
86
+ }
87
+ const query = `?${queryParams.filter(Boolean).join('&')}`;
88
+ return await (await fetch(`${ebsiGetRegistryAPIUrls({ ...apiOpts }).query}/${query}`)).json();
89
+ };
90
+ //# sourceMappingURL=EbsiRestService.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EbsiRestService.js","sourceRoot":"","sources":["../../../src/did/services/EbsiRestService.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,aAAa,CAAA;AAE/B,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAA;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAEpC,OAAO,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAA;AAGrD;;;;GAIG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,KAAK,EAAE,IAAyD,EAAwB,EAAE;IAC1H,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,IAAI,CAAA;IAChC,MAAM,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,MAAM,CAAA;IAC/B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Manager, MinimalImportableKey, TKeyType } from '@veramo/core';
3
+ import { IService } from '@veramo/core/build/types/IIdentifier';
4
+ import { DIDDocument } from 'did-resolver';
5
+ import { AccessListish, BigNumberish, BytesLike } from 'ethers';
6
+ import { ApiOpts, EbsiEnvironment } from '../types/IEbsiSupport';
7
+ export type IContext = IAgentContext<IKeyManager>;
8
+ /**
9
+ * The type of the DID to be created
10
+ * @readonly
11
+ * @enum {string}
12
+ */
13
+ export type EbsiDIDType = 'NATURAL_PERSON' | 'LEGAL_ENTITY';
14
+ /**
15
+ * The DID method to use
16
+ * @readonly
17
+ * @enum {string}
18
+ */
19
+ export type EbsiDIDPrefix = 'did:ebsi:' | 'did:key:';
20
+ /**
21
+ * @typedef EbsiDidSpecInfo
22
+ * @type {object}
23
+ * @property {EbsiDIDType} type - The type of the DID
24
+ * @property {EbsiDIDPrefix} method - The method of the DID
25
+ * @property {number} version - The version of the specs
26
+ * @property {number} didLength - The length of the DID
27
+ * @property {number} privateKeyLength The private key length
28
+ */
29
+ export interface EbsiDidSpecInfo {
30
+ type: EbsiDIDType;
31
+ method: EbsiDIDPrefix;
32
+ version?: number;
33
+ didLength?: number;
34
+ privateKeyLength?: number;
35
+ }
36
+ export declare const EBSI_DID_SPEC_INFOS: Record<string, EbsiDidSpecInfo>;
37
+ /**
38
+ * A minimal importable key with restricted types to choose from and purposes of the public key
39
+ * @typedef IKeyOpts
40
+ * @extends MinimalImportableKey
41
+ * @property {EbsiKeyType} type
42
+ * @property {EbsiPublicKeyPurpose[]} purposes
43
+ */
44
+ export interface IKeyOpts extends WithRequiredProperty<Partial<MinimalImportableKey>, 'privateKeyHex'> {
45
+ type?: EbsiKeyType;
46
+ purposes?: EbsiPublicKeyPurpose[];
47
+ }
48
+ type WithRequiredProperty<Type, Key extends keyof Type> = Type & {
49
+ [Property in Key]-?: Type[Property];
50
+ };
51
+ export type RpcMethodArgs = {
52
+ params: RPCParams[];
53
+ rpcId: number;
54
+ accessToken: string;
55
+ rpcMethod: EbsiRpcMethod;
56
+ apiOpts?: ApiOpts;
57
+ doNotThrowErrors?: boolean;
58
+ };
59
+ export type EbsiCreateIdentifierOpts = {
60
+ methodSpecificId?: string;
61
+ rpcId?: number;
62
+ secp256k1Key?: IKeyOpts;
63
+ secp256r1Key?: IKeyOpts;
64
+ executeLedgerOperation?: boolean;
65
+ baseDocument?: string;
66
+ notBefore?: number;
67
+ notAfter?: number;
68
+ accessTokenOpts: EbsiAccessTokenOpts;
69
+ services?: IService[];
70
+ };
71
+ /**
72
+ * @typedef ICreateIdentifierArgs
73
+ * @type {object}
74
+ * @property {string} kms - The kms to use
75
+ * @property {string} alias - The alias of the DID
76
+ * @property {EbsiDidSpecInfo} type
77
+ * @property {string} options.methodSpecificId - method specific id for import
78
+ * @property {IKeyOpts} secp256k1Key - The options to create the key
79
+ * @property {IKeyOpts} secp256r1Key - The options to create the key
80
+ */
81
+ export interface ICreateIdentifierArgs {
82
+ kms?: string;
83
+ alias?: string;
84
+ type?: EbsiDidSpecInfo;
85
+ options: EbsiCreateIdentifierOpts;
86
+ }
87
+ /**
88
+ * The Ebsi allowed key types - Secp256k1 and Secp256r1
89
+ * @readonly
90
+ * @enum {string}
91
+ */
92
+ export type EbsiKeyType = Extract<TKeyType, 'Secp256k1' | 'Secp256r1'>;
93
+ /**
94
+ * The purpose of the public keys
95
+ * @readonly
96
+ * @enum {string}
97
+ */
98
+ export declare enum EbsiPublicKeyPurpose {
99
+ Authentication = "authentication",
100
+ AssertionMethod = "assertionMethod",
101
+ CapabilityInvocation = "capabilityInvocation"
102
+ }
103
+ /**
104
+ * @typedef InsertDidDocumentParams
105
+ * @type {object}
106
+ * @property {string} from - Ethereum address of the signer
107
+ * @property {string} did - DID to insert. It must be for a legal entity (DID v1)
108
+ * @property {string} BASE_CONTEXT_DOC - JSON string containing the @context of the DID document
109
+ * @property {string} vMethodId - Thumbprint of the public key
110
+ * @property {string} publicKey - Public key for secp256k1 in uncompressed format prefixed with "0x04"
111
+ * @property {boolean} isSecp256k1 - It must be true
112
+ * @property {number} notBefore - Capability invocation is valid from this time
113
+ * @property {number} notAfter - Expiration of the capability invocation
114
+ */
115
+ export type InsertDidDocumentParams = {
116
+ from: string;
117
+ did: string;
118
+ baseDocument: string;
119
+ vMethodId: string;
120
+ publicKey: string;
121
+ isSecp256k1: boolean;
122
+ notBefore: number;
123
+ notAfter: number;
124
+ };
125
+ /**
126
+ * @typedef UpdateBaseDocumentParams
127
+ * @type {object}
128
+ * @property {string} from - Ethereum address of the signer
129
+ * @property {string} did - Existing DID
130
+ * @property {string} BASE_CONTEXT_DOC - JSON string containing the @context of the DID document
131
+ */
132
+ export type UpdateBaseDocumentParams = Pick<InsertDidDocumentParams, 'from' | 'did' | 'baseDocument'>;
133
+ /**
134
+ * @typedef UpdateIdentifierParams
135
+ * @type {object}
136
+ * @property {string} did - A DID
137
+ * @property {Partial<DIDDocument>} document - The partial DID document
138
+ * @property {{ [p: string]: any }} [options] - Any additional options
139
+ */
140
+ export type UpdateIdentifierParams = {
141
+ did: string;
142
+ document: Partial<DIDDocument>;
143
+ options?: {
144
+ [p: string]: any;
145
+ };
146
+ };
147
+ export type AddServiceParams = {
148
+ from: string;
149
+ did: string;
150
+ service: IService;
151
+ };
152
+ /**
153
+ * @typedef AddVerificationMethodParams
154
+ * @type {object}
155
+ * @property {string} from - Ethereum address of the signer
156
+ * @property {string} did - Existing DID
157
+ * @property {string} vMethodId - New verification method id
158
+ * @property {boolean} isSecp256k1 - Boolean defining if the public key is for secp256k1 curve or not
159
+ * @property {string} publicKey - Public key as hex string. For an ES256K key, it must be in uncompressed format
160
+ * prefixed with "0x04". For other algorithms, it must be the JWK transformed to string and then to hex format.
161
+ */
162
+ export type AddVerificationMethodParams = Pick<InsertDidDocumentParams, 'from' | 'did' | 'vMethodId' | 'isSecp256k1' | 'publicKey'>;
163
+ /**
164
+ * @typedef AddVerificationMethodRelationshipParams
165
+ * @type {object}
166
+ * @property {string} from - Ethereum address of the signer
167
+ * @property {string} did - Existing DID
168
+ * @property {string} name - Name of the verification relationship
169
+ * @property {string} vMethodId - Reference to the verification method
170
+ * @property {number} notBefore - Verification relationship is valid from this time
171
+ * @property {number} notAfter - Expiration of the verification relationship
172
+ */
173
+ export type AddVerificationMethodRelationshipParams = Pick<InsertDidDocumentParams, 'from' | 'did' | 'vMethodId' | 'notBefore' | 'notAfter'> & {
174
+ name: string;
175
+ };
176
+ /**
177
+ * @typedef UnsignedTransaction
178
+ * @type {object}
179
+ * @property {string} from - The sending address.
180
+ * @property {string} to - The receiving address (if EOA, the transaction will transfer value. If a smart contract
181
+ * account, the transaction will use contract code).
182
+ * @property {string} data - Can contain code or a message to the recipient.
183
+ * @property {string} nonce - A number used to track ordering of transactions and prevent replay attacks
184
+ * @property {string} chainId - The Ethereum Network ID (ex: 1 - Ethereum Mainnet).
185
+ * @property {string} gasLimit - The maximum amount of gas units that can be used.
186
+ * @property {string} gasPrice - Gas price provided by the sender in Wei.
187
+ * @property {string} value - The amount of ETH to be sent from the sending address (denominated in Wei)
188
+ */
189
+ export type UnsignedTransaction = {
190
+ to?: string;
191
+ nonce?: number;
192
+ gasLimit?: BigNumberish;
193
+ gasPrice?: BigNumberish;
194
+ data?: BytesLike;
195
+ value?: BigNumberish;
196
+ chainId?: number;
197
+ type?: number | null;
198
+ accessList?: AccessListish;
199
+ maxPriorityFeePerGas?: BigNumberish;
200
+ maxFeePerGas?: BigNumberish;
201
+ };
202
+ /**
203
+ * @typedef SendSignedTransactionParams
204
+ * @type {object}
205
+ * @property {string} protocol - Example: eth
206
+ * @property {UnsignedTransaction} unsignedTransaction - The unsigned transaction
207
+ * @property {string} r - ECDSA signature r
208
+ * @property {string} s - ECDSA signature s
209
+ * @property {string} v - ECDSA recovery id
210
+ * @property {string} signedRawTransaction - The signed raw transaction
211
+ */
212
+ export type SendSignedTransactionParams = {
213
+ protocol: string;
214
+ unsignedTransaction: UnsignedTransaction;
215
+ r: string;
216
+ s: string;
217
+ v: string;
218
+ signedRawTransaction: string;
219
+ };
220
+ /**
221
+ * @typedef RpcOkResponse
222
+ * @type {object}
223
+ * @property {string} JSON_RPC_VERSION - Must be exactly "2.0"
224
+ * @property {number} id - Same identifier established by the client in the call
225
+ * @property {object} result - Result of the transaction
226
+ */
227
+ export type RpcOkResponse = {
228
+ jsonrpc: string;
229
+ id: number;
230
+ result: any;
231
+ };
232
+ export type RpcErrorResponse = {
233
+ jsonrpc: string;
234
+ id: number;
235
+ error: {
236
+ code: number;
237
+ message: string;
238
+ };
239
+ };
240
+ /**
241
+ * @typedef ResponseNot200
242
+ * @type {object}
243
+ * @property {URL | string} type - An absolute URI that identifies the problem type. When dereferenced,
244
+ * it SHOULD provide human-readable documentation for the problem type.
245
+ * @property {string} title - A short summary of the problem type.
246
+ * @property {number} status - The HTTP status code generated by the origin server for this occurrence of the problem.
247
+ * @property {string} detail - A human-readable explanation specific to this occurrence of the problem.
248
+ * @property {URL | string} instance An absolute URI that identifies the specific occurrence of the problem.
249
+ * It may or may not yield further information if dereferenced.
250
+ */
251
+ export type ResponseNot200 = {
252
+ type: URL | string;
253
+ id?: number;
254
+ title: string;
255
+ error?: {
256
+ code: number;
257
+ message: string;
258
+ };
259
+ status: number;
260
+ detail: string;
261
+ instance: URL | string;
262
+ };
263
+ /**
264
+ * @typedef GetDidDocumentParams
265
+ * @type {object}
266
+ * @property {string} did
267
+ * @property {string} validAt
268
+ */
269
+ export type GetDidDocumentParams = {
270
+ did: string;
271
+ validAt?: string;
272
+ };
273
+ /**
274
+ * @typedef GetDidDocumentsParams
275
+ * @type {object}
276
+ * @property {string} offset Originally page[after] Cursor that points to the end of the page of data that has been returned.
277
+ * @property {number} size Originally page[size] Defines the maximum number of objects that may be returned.
278
+ * @property {string} controller Filter by controller DID.
279
+ */
280
+ export type GetDidDocumentsParams = {
281
+ offset?: string;
282
+ size?: number;
283
+ controller?: string;
284
+ };
285
+ /**
286
+ * Result of listing dids
287
+ * @typedef {Item}
288
+ * @type {object}
289
+ * @property {string} did - The DID
290
+ * @property {string} href - The referrer of the DID
291
+ */
292
+ export type Item = {
293
+ did: string;
294
+ href: string;
295
+ };
296
+ /**
297
+ * The links related to pagination
298
+ * @typedef Links
299
+ * @type {object}
300
+ * @property {string} first - The link to the first page
301
+ * @property {string} prev - The link ot the previous page
302
+ * @property {string} next - The link to the next page
303
+ * @property {string} last - The link to the last page
304
+ */
305
+ export type Links = {
306
+ first: string;
307
+ prev: string;
308
+ next: string;
309
+ last: string;
310
+ };
311
+ /**
312
+ * @typedef GetDidDocumentResponse
313
+ * @type {object}
314
+ * @property {string} self - Absolute path to the collection (consult)
315
+ * @property {Item[]} items - List of DIDs and their referrers
316
+ * @property {number} total - Total number of items across all pages.
317
+ * @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.
318
+ * @property {Links} links - The links related to pagination
319
+ */
320
+ export type GetDidDocumentsResponse = {
321
+ self: string;
322
+ items: Item[];
323
+ total: number;
324
+ pageSize: number;
325
+ links: Links;
326
+ };
327
+ type EbsiAccessTokenOpts = {
328
+ attestationToOnboard?: W3CVerifiableCredential;
329
+ jwksUri?: string;
330
+ redirectUri: string;
331
+ credentialIssuer: string;
332
+ clientId: string;
333
+ environment: EbsiEnvironment;
334
+ };
335
+ /**
336
+ * @typedef CreateEbsiDidParams
337
+ * @type {object}
338
+ * @property {Omit<IIdentifier, 'provider'>} identifier An identifier without the provider
339
+ * @property {ManagedKeyInfo} secp256k1ManagedKeyInfo A Secp256k1 managed key
340
+ * @property {ManagedKeyInfo} secp256r1ManagedKeyInfo A Secp256r1 managed key
341
+ * @property {number} id A client created id
342
+ * @property {string} from The wallet eth like address
343
+ * @property {string} [baseDocument] The base DID document
344
+ * @property {number} notBefore Date of issuance of the identifier
345
+ * @property {number} notAfter Date of expiration of the identifier
346
+ * @property {ApiOpts} [apiOpts] The EBSI API options
347
+ */
348
+ export type CreateEbsiDidParams = {
349
+ identifier: IIdentifier;
350
+ rpcId?: number;
351
+ notBefore?: number;
352
+ notAfter?: number;
353
+ baseDocument?: string;
354
+ accessTokenOpts: EbsiAccessTokenOpts;
355
+ };
356
+ /**
357
+ * @constant JSON_RPC_VERSION
358
+ */
359
+ export declare const JSON_RPC_VERSION = "2.0";
360
+ /**
361
+ * @constant BASE_CONTEXT_DOC
362
+ */
363
+ export declare const BASE_CONTEXT_DOC: string;
364
+ export interface EbsiDidRegistryAPIEndpoints {
365
+ mutate: string;
366
+ query: string;
367
+ }
368
+ /**
369
+ * The EBSI RPC operations
370
+ * @readonly
371
+ * @enum {string}
372
+ */
373
+ export declare enum EbsiRpcMethod {
374
+ INSERT_DID_DOCUMENT = "insertDidDocument",
375
+ UPDATE_DID_DOCUMENT = "updateBaseDocument",
376
+ ADD_VERIFICATION_METHOD = "addVerificationMethod",
377
+ ADD_VERIFICATION_RELATIONSHIP = "addVerificationRelationship",
378
+ ADD_SERVICE = "addService",
379
+ SEND_SIGNED_TRANSACTION = "sendSignedTransaction"
380
+ }
381
+ export type RPCParams = InsertDidDocumentParams | UpdateBaseDocumentParams | AddVerificationMethodParams | AddVerificationMethodRelationshipParams | SendSignedTransactionParams | AddServiceParams;
382
+ export type EbsiRPCResponse = RpcOkResponse | (RpcErrorResponse & {
383
+ nonce: string;
384
+ });
385
+ export {};
386
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/did/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAA;AAC7D,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,WAAW,EAAE,oBAAoB,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAA;AACtG,OAAO,EAAE,QAAQ,EAAE,MAAM,sCAAsC,CAAA;AAC/D,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAC1C,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAA;AAC/D,OAAO,EAAE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AW,eAAe;IAC1B,uBAAuB,0BAA0B;CAClD;AAED,MAAM,MAAM,SAAS,GACjB,uBAAuB,GACvB,wBAAwB,GACxB,2BAA2B,GAC3B,uCAAuC,GACvC,2BAA2B,GAC3B,gBAAgB,CAAA;AAEpB,MAAM,MAAM,eAAe,GAAG,aAAa,GAAG,CAAC,gBAAgB,GAAG;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC,CAAA"}
@@ -0,0 +1,47 @@
1
+ export const EBSI_DID_SPEC_INFOS = {
2
+ V1: {
3
+ type: 'LEGAL_ENTITY',
4
+ method: 'did:ebsi:',
5
+ version: 0x01,
6
+ didLength: 16,
7
+ privateKeyLength: 32,
8
+ },
9
+ KEY: {
10
+ type: 'NATURAL_PERSON',
11
+ method: 'did:key:',
12
+ },
13
+ };
14
+ /**
15
+ * The purpose of the public keys
16
+ * @readonly
17
+ * @enum {string}
18
+ */
19
+ export var EbsiPublicKeyPurpose;
20
+ (function (EbsiPublicKeyPurpose) {
21
+ EbsiPublicKeyPurpose["Authentication"] = "authentication";
22
+ EbsiPublicKeyPurpose["AssertionMethod"] = "assertionMethod";
23
+ EbsiPublicKeyPurpose["CapabilityInvocation"] = "capabilityInvocation";
24
+ })(EbsiPublicKeyPurpose || (EbsiPublicKeyPurpose = {}));
25
+ /**
26
+ * @constant JSON_RPC_VERSION
27
+ */
28
+ export const JSON_RPC_VERSION = '2.0';
29
+ /**
30
+ * @constant BASE_CONTEXT_DOC
31
+ */
32
+ export const BASE_CONTEXT_DOC = JSON.stringify({ '@context': ['https://www.w3.org/ns/did/v1', 'https://w3id.org/security/suites/jws-2020/v1'] });
33
+ /**
34
+ * The EBSI RPC operations
35
+ * @readonly
36
+ * @enum {string}
37
+ */
38
+ export var EbsiRpcMethod;
39
+ (function (EbsiRpcMethod) {
40
+ EbsiRpcMethod["INSERT_DID_DOCUMENT"] = "insertDidDocument";
41
+ EbsiRpcMethod["UPDATE_DID_DOCUMENT"] = "updateBaseDocument";
42
+ EbsiRpcMethod["ADD_VERIFICATION_METHOD"] = "addVerificationMethod";
43
+ EbsiRpcMethod["ADD_VERIFICATION_RELATIONSHIP"] = "addVerificationRelationship";
44
+ EbsiRpcMethod["ADD_SERVICE"] = "addService";
45
+ EbsiRpcMethod["SEND_SIGNED_TRANSACTION"] = "sendSignedTransaction";
46
+ })(EbsiRpcMethod || (EbsiRpcMethod = {}));
47
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/did/types.ts"],"names":[],"mappings":"AAwCA,MAAM,CAAC,MAAM,mBAAmB,GAAoC;IAClE,EAAE,EAAE;QACF,IAAI,EAAE,cAAc;QACpB,MAAM,EAAE,WAAW;QACnB,OAAO,EAAE,IAAI;QACb,SAAS,EAAE,EAAE;QACb,gBAAgB,EAAE,EAAE;KACrB;IACD,GAAG,EAAE;QACH,IAAI,EAAE,gBAAgB;QACtB,MAAM,EAAE,UAAU;KACnB;CACF,CAAA;AAiED;;;;GAIG;AACH,MAAM,CAAN,IAAY,oBAIX;AAJD,WAAY,oBAAoB;IAC9B,yDAAiC,CAAA;IACjC,2DAAmC,CAAA;IACnC,qEAA6C,CAAA;AAC/C,CAAC,EAJW,oBAAoB,KAApB,oBAAoB,QAI/B;AA6RD;;GAEG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,KAAK,CAAA;AAErC;;GAEG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,IAAI,CAAC,SAAS,CAAC,EAAE,UAAU,EAAE,CAAC,8BAA8B,EAAE,8CAA8C,CAAC,EAAE,CAAC,CAAA;AAOhJ;;;;GAIG;AACH,MAAM,CAAN,IAAY,aAOX;AAPD,WAAY,aAAa;IACvB,0DAAyC,CAAA;IACzC,2DAA0C,CAAA;IAC1C,kEAAiD,CAAA;IACjD,8EAA6D,CAAA;IAC7D,2CAA0B,CAAA;IAC1B,kEAAiD,CAAA;AACnD,CAAC,EAPW,aAAa,KAAb,aAAa,QAOxB"}
@@ -0,0 +1,32 @@
1
+ import { IssuanceOpts, OID4VCIMachineInterpreter, PrepareStartArgs } from '@sphereon/ssi-sdk.oid4vci-holder';
2
+ import { IIdentifier } from '@veramo/core';
3
+ import { _ExtendedIKey } from '@veramo/utils';
4
+ import { AttestationResult, CreateAttestationAuthRequestURLArgs, EbsiEnvironment, GetAttestationArgs, IRequiredContext } from '../types/IEbsiSupport';
5
+ export interface AttestationAuthRequestUrlResult extends Omit<Required<PrepareStartArgs>, 'issuanceOpt'> {
6
+ issuanceOpt?: IssuanceOpts;
7
+ authorizationCodeURL: string;
8
+ identifier: IIdentifier;
9
+ authKey: _ExtendedIKey;
10
+ }
11
+ /**
12
+ * Method to generate an authz url for getting attestation credentials from a (R)TAO on EBSI using a cloud/service wallet
13
+ *
14
+ * This method can be used standalone. But it can also be used as input for the `oid4vciHolderStart` agent method,
15
+ * to start a OID4VCI holder flow.
16
+ *
17
+ * @param opts
18
+ * @param context
19
+ */
20
+ export declare const ebsiCreateAttestationAuthRequestURL: ({ clientId: clientIdArg, credentialIssuer, credentialType, idOpts, redirectUri, requestObjectOpts, formats, }: CreateAttestationAuthRequestURLArgs, context: IRequiredContext) => Promise<AttestationAuthRequestUrlResult>;
21
+ export declare const ebsiGetAttestationInterpreter: ({ clientId, authReqResult }: Omit<GetAttestationArgs, 'opts'>, context: IRequiredContext) => Promise<OID4VCIMachineInterpreter>;
22
+ export declare const ebsiGetAttestation: ({ clientId, authReqResult, opts }: GetAttestationArgs, context: IRequiredContext) => Promise<AttestationResult>;
23
+ /**
24
+ * Normally you would use the browser to let the user make this call in the front channel,
25
+ * however EBSI mainly uses mocks at present, and we want to be able to test as well
26
+ */
27
+ export declare const ebsiAuthRequestExecution: (authRequestResult: AttestationAuthRequestUrlResult, opts?: {}) => Promise<void>;
28
+ export declare const ebsiGetIssuer: ({ credentialIssuer, environment }: {
29
+ credentialIssuer?: string | undefined;
30
+ environment?: EbsiEnvironment | undefined;
31
+ }) => string;
32
+ //# sourceMappingURL=Attestation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Attestation.d.ts","sourceRoot":"","sources":["../../src/functions/Attestation.ts"],"names":[],"mappings":"AAaA,OAAO,EACL,YAAY,EAEZ,yBAAyB,EAGzB,gBAAgB,EAGjB,MAAM,kCAAkC,CAAA;AAQzC,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AAG7C,OAAO,EAAE,iBAAiB,EAAE,mCAAmC,EAAE,eAAe,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AAWrJ,MAAM,WAAW,+BAAgC,SAAQ,IAAI,CAAC,QAAQ,CAAC,gBAAgB,CAAC,EAAE,aAAa,CAAC;IACtG,WAAW,CAAC,EAAE,YAAY,CAAA;IAC1B,oBAAoB,EAAE,MAAM,CAAA;IAC5B,UAAU,EAAE,WAAW,CAAA;IACvB,OAAO,EAAE,aAAa,CAAA;CACvB;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,mCAAmC,kHAS3C,mCAAmC,gCAErC,QAAQ,+BAA+B,CAsFzC,CAAA;AAED,eAAO,MAAM,6BAA6B,gCACX,KAAK,kBAAkB,EAAE,MAAM,CAAC,gCAE5D,QAAQ,yBAAyB,CAiDnC,CAAA;AAED,eAAO,MAAM,kBAAkB,sCAC4B,kBAAkB,gCAE1E,QAAQ,iBAAiB,CAkB3B,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,wBAAwB,sBAA6B,+BAA+B,SAAS,EAAE,kBAS3G,CAAA;AAED,eAAO,MAAM,aAAa;;;MAAgH,MASzI,CAAA"}