@sphereon/ssi-sdk.ebsi-support 0.27.0 → 0.27.1-next.10
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/agent/EbsiSupport.d.ts +1 -0
- package/dist/agent/EbsiSupport.d.ts.map +1 -1
- package/dist/agent/EbsiSupport.js +207 -186
- package/dist/agent/EbsiSupport.js.map +1 -1
- package/dist/did/EbsiDidProvider.d.ts.map +1 -1
- package/dist/did/EbsiDidProvider.js +173 -136
- package/dist/did/EbsiDidProvider.js.map +1 -1
- package/dist/did/EbsiDidResolver.js +19 -6
- package/dist/did/EbsiDidResolver.js.map +1 -1
- package/dist/did/functions.d.ts.map +1 -1
- package/dist/did/functions.js +158 -120
- package/dist/did/functions.js.map +1 -1
- package/dist/did/index.js +28 -5
- package/dist/did/index.js.map +1 -1
- package/dist/did/services/EbsiRPCService.js +36 -20
- package/dist/did/services/EbsiRPCService.js.map +1 -1
- package/dist/did/services/EbsiRestService.js +37 -19
- package/dist/did/services/EbsiRestService.js.map +1 -1
- package/dist/did/types.d.ts +2 -1
- package/dist/did/types.d.ts.map +1 -1
- package/dist/did/types.js +10 -7
- package/dist/did/types.js.map +1 -1
- package/dist/functions/Attestation.js +79 -69
- package/dist/functions/Attestation.js.map +1 -1
- package/dist/functions/AttestationHeadlessCallbacks.js +91 -72
- package/dist/functions/AttestationHeadlessCallbacks.js.map +1 -1
- package/dist/functions/index.js +32 -4
- package/dist/functions/index.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +26 -6
- package/dist/index.js.map +1 -1
- package/dist/types/IEbsiSupport.js +5 -2
- package/dist/types/IEbsiSupport.js.map +1 -1
- package/package.json +13 -12
- package/plugin.schema.json +2030 -0
- package/src/agent/EbsiSupport.ts +10 -0
- package/src/did/EbsiDidProvider.ts +18 -1
- package/src/did/functions.ts +2 -1
- package/src/did/types.ts +2 -1
- package/src/index.ts +1 -1
package/src/agent/EbsiSupport.ts
CHANGED
|
@@ -30,6 +30,16 @@ import {
|
|
|
30
30
|
|
|
31
31
|
import { v4 } from 'uuid'
|
|
32
32
|
|
|
33
|
+
|
|
34
|
+
export const ebsiSupportMethods: Array<string> = [
|
|
35
|
+
'ebsiWellknownMetadata',
|
|
36
|
+
'ebsiAuthorizationServerJwks',
|
|
37
|
+
'ebsiPresentationDefinitionGet',
|
|
38
|
+
'ebsiAccessTokenGet',
|
|
39
|
+
'ebsiCreateAttestationAuthRequestURL',
|
|
40
|
+
'ebsiGetAttestation'
|
|
41
|
+
]
|
|
42
|
+
|
|
33
43
|
export class EbsiSupport implements IAgentPlugin {
|
|
34
44
|
readonly schema = schema.IEbsiSupport
|
|
35
45
|
readonly methods: IEbsiSupport = {
|
|
@@ -35,6 +35,7 @@ export class EbsiDidProvider extends AbstractIdentifierProvider {
|
|
|
35
35
|
notAfter,
|
|
36
36
|
secp256k1Key,
|
|
37
37
|
secp256r1Key,
|
|
38
|
+
keys,
|
|
38
39
|
accessTokenOpts,
|
|
39
40
|
executeLedgerOperation = !!args.options?.accessTokenOpts,
|
|
40
41
|
methodSpecificId = generateEbsiMethodSpecificId(EBSI_DID_SPEC_INFOS.V1),
|
|
@@ -48,9 +49,11 @@ export class EbsiDidProvider extends AbstractIdentifierProvider {
|
|
|
48
49
|
const rpcId = options?.rpcId ?? randomRpcId()
|
|
49
50
|
|
|
50
51
|
if (type === EBSI_DID_SPEC_INFOS.KEY) {
|
|
51
|
-
|
|
52
|
+
return Promise.reject(Error(`Type ${type} not supported. Please use @sphereon/ssi-sdk-ext.did-provider-key for Natural Person EBSI DIDs`))
|
|
52
53
|
} else if (!kms) {
|
|
53
54
|
return Promise.reject(Error(`No KMS value provided`))
|
|
55
|
+
} else if (keys && keys.length > 0 && !executeLedgerOperation) {
|
|
56
|
+
return Promise.reject(Error(`Cannot add additional keys if ledger operation is not enabled at creation. Please add the keys later yourself`))
|
|
54
57
|
}
|
|
55
58
|
|
|
56
59
|
// CapabilityInvocation purpose
|
|
@@ -106,6 +109,20 @@ export class EbsiDidProvider extends AbstractIdentifierProvider {
|
|
|
106
109
|
},
|
|
107
110
|
context,
|
|
108
111
|
)
|
|
112
|
+
if (keys && keys.length > 0) {
|
|
113
|
+
for (const keyOpts of keys) {
|
|
114
|
+
const key = await ebsiGenerateOrUseKeyPair(
|
|
115
|
+
{
|
|
116
|
+
keyOpts,
|
|
117
|
+
keyType: keyOpts.type ?? 'Secp256r1',
|
|
118
|
+
kms,
|
|
119
|
+
},
|
|
120
|
+
context,
|
|
121
|
+
)
|
|
122
|
+
const managedKeyInfo = await context.agent.keyManagerImport(key)
|
|
123
|
+
console.warn(`FIXME: Anchor additional key on EBSI`, managedKeyInfo)
|
|
124
|
+
}
|
|
125
|
+
}
|
|
109
126
|
}
|
|
110
127
|
|
|
111
128
|
debug('Created', identifier.did)
|
package/src/did/functions.ts
CHANGED
|
@@ -253,7 +253,8 @@ export const assertedPurposes = (args: { key?: IKeyOpts }): EbsiPublicKeyPurpose
|
|
|
253
253
|
if (
|
|
254
254
|
key?.purposes &&
|
|
255
255
|
key.purposes.length > 0 &&
|
|
256
|
-
key.purposes.
|
|
256
|
+
key.purposes.includes(EbsiPublicKeyPurpose.AssertionMethod) &&
|
|
257
|
+
key.purposes.includes(EbsiPublicKeyPurpose.Authentication)
|
|
257
258
|
) {
|
|
258
259
|
return key.purposes
|
|
259
260
|
}
|
package/src/did/types.ts
CHANGED
|
@@ -83,6 +83,7 @@ export type EbsiCreateIdentifierOpts = {
|
|
|
83
83
|
rpcId?: number
|
|
84
84
|
secp256k1Key?: IKeyOpts
|
|
85
85
|
secp256r1Key?: IKeyOpts
|
|
86
|
+
keys?: IKeyOpts[] // additional importable keys, but only in case execute ledger is true
|
|
86
87
|
executeLedgerOperation?: boolean // Whether to persist on the EBSI ledger. By default looks at whether access token opts are set or not
|
|
87
88
|
baseDocument?: string
|
|
88
89
|
notBefore?: number
|
|
@@ -379,7 +380,7 @@ export type GetDidDocumentsResponse = {
|
|
|
379
380
|
links: Links
|
|
380
381
|
}
|
|
381
382
|
|
|
382
|
-
type EbsiAccessTokenOpts = {
|
|
383
|
+
export type EbsiAccessTokenOpts = {
|
|
383
384
|
attestationToOnboard?: W3CVerifiableCredential
|
|
384
385
|
jwksUri?: string
|
|
385
386
|
redirectUri: string
|
package/src/index.ts
CHANGED
|
@@ -3,6 +3,6 @@ import { Loggers } from '@sphereon/ssi-types'
|
|
|
3
3
|
export const logger = Loggers.DEFAULT.get('sphereon:ebsi-support')
|
|
4
4
|
const schema = require('../plugin.schema.json')
|
|
5
5
|
export { schema }
|
|
6
|
-
export { EbsiSupport } from './agent/EbsiSupport'
|
|
6
|
+
export { EbsiSupport, ebsiSupportMethods } from './agent/EbsiSupport'
|
|
7
7
|
export * from './types/IEbsiSupport'
|
|
8
8
|
export { EbsiDidProvider } from './did'
|