@sphereon/ssi-sdk-ext.key-manager 0.28.1-feature.jose.vcdm.52 → 0.28.1-feature.oyd.cmsm.improv.20

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.
@@ -22,12 +22,22 @@
22
22
  "description": "Optional. Key meta data"
23
23
  }
24
24
  },
25
- "required": ["type"],
25
+ "required": [
26
+ "type"
27
+ ],
26
28
  "description": "Input arguments for {@link ISphereonKeyManager.keyManagerCreate | keyManagerCreate }"
27
29
  },
28
30
  "TKeyType": {
29
31
  "type": "string",
30
- "enum": ["Ed25519", "Secp256k1", "Secp256r1", "X25519", "Bls12381G1", "Bls12381G2", "RSA"],
32
+ "enum": [
33
+ "Ed25519",
34
+ "Secp256k1",
35
+ "Secp256r1",
36
+ "X25519",
37
+ "Bls12381G1",
38
+ "Bls12381G2",
39
+ "RSA"
40
+ ],
31
41
  "description": "Cryptographic key type."
32
42
  },
33
43
  "IkeyOptions": {
@@ -99,7 +109,13 @@
99
109
  "description": "Optional. Key metadata. This should be used to determine which algorithms are supported."
100
110
  }
101
111
  },
102
- "required": ["kid", "kms", "privateKeyHex", "publicKeyHex", "type"]
112
+ "required": [
113
+ "kid",
114
+ "kms",
115
+ "privateKeyHex",
116
+ "publicKeyHex",
117
+ "type"
118
+ ]
103
119
  },
104
120
  "ISphereonKeyManagerHandleExpirationsArgs": {
105
121
  "type": "object",
@@ -140,7 +156,12 @@
140
156
  "description": "Optional. Key metadata. This should be used to determine which algorithms are supported."
141
157
  }
142
158
  },
143
- "required": ["kid", "kms", "type", "publicKeyHex"],
159
+ "required": [
160
+ "kid",
161
+ "kms",
162
+ "type",
163
+ "publicKeyHex"
164
+ ],
144
165
  "description": "Represents information about a managed key. Private or secret key material is NOT present."
145
166
  },
146
167
  "MinimalImportableKey": {
@@ -215,7 +236,9 @@
215
236
  "type": "number"
216
237
  }
217
238
  },
218
- "required": ["byteLength"]
239
+ "required": [
240
+ "byteLength"
241
+ ]
219
242
  },
220
243
  {}
221
244
  ]
@@ -230,7 +253,13 @@
230
253
  "type": "number"
231
254
  }
232
255
  },
233
- "required": ["BYTES_PER_ELEMENT", "buffer", "byteLength", "byteOffset", "length"],
256
+ "required": [
257
+ "BYTES_PER_ELEMENT",
258
+ "buffer",
259
+ "byteLength",
260
+ "byteOffset",
261
+ "length"
262
+ ],
234
263
  "additionalProperties": {
235
264
  "type": "number"
236
265
  }
@@ -240,11 +269,19 @@
240
269
  },
241
270
  "encoding": {
242
271
  "type": "string",
243
- "enum": ["utf-8", "base16", "base64", "hex"],
272
+ "enum": [
273
+ "utf-8",
274
+ "base16",
275
+ "base64",
276
+ "hex"
277
+ ],
244
278
  "description": "If the data is a \"string\" then you can specify which encoding is used. Default is \"utf-8\""
245
279
  }
246
280
  },
247
- "required": ["data", "keyRef"],
281
+ "required": [
282
+ "data",
283
+ "keyRef"
284
+ ],
248
285
  "description": "Input arguments for {@link ISphereonKeyManagerSignArgs.keyManagerSign | keyManagerSign }"
249
286
  },
250
287
  "ISphereonKeyManagerVerifyArgs": {
@@ -277,7 +314,9 @@
277
314
  "type": "number"
278
315
  }
279
316
  },
280
- "required": ["byteLength"]
317
+ "required": [
318
+ "byteLength"
319
+ ]
281
320
  },
282
321
  {}
283
322
  ]
@@ -292,7 +331,13 @@
292
331
  "type": "number"
293
332
  }
294
333
  },
295
- "required": ["BYTES_PER_ELEMENT", "buffer", "byteLength", "byteOffset", "length"],
334
+ "required": [
335
+ "BYTES_PER_ELEMENT",
336
+ "buffer",
337
+ "byteLength",
338
+ "byteOffset",
339
+ "length"
340
+ ],
296
341
  "additionalProperties": {
297
342
  "type": "number"
298
343
  }
@@ -301,7 +346,12 @@
301
346
  "type": "string"
302
347
  }
303
348
  },
304
- "required": ["publicKeyHex", "type", "data", "signature"]
349
+ "required": [
350
+ "publicKeyHex",
351
+ "type",
352
+ "data",
353
+ "signature"
354
+ ]
305
355
  }
306
356
  },
307
357
  "methods": {
@@ -377,4 +427,4 @@
377
427
  }
378
428
  }
379
429
  }
380
- }
430
+ }
@@ -1,7 +1,6 @@
1
- import { SphereonKeyManagementSystem } from '@sphereon/ssi-sdk-ext.kms-local'
2
- import { MemoryKeyStore, MemoryPrivateKeyStore } from '@veramo/key-manager'
3
- import { describe, expect, it } from 'vitest'
4
1
  import { SphereonKeyManager } from '../agent/SphereonKeyManager'
2
+ import { MemoryKeyStore, MemoryPrivateKeyStore } from '@veramo/key-manager'
3
+ import { SphereonKeyManagementSystem } from '@sphereon/ssi-sdk-ext.kms-local'
5
4
 
6
5
  describe('@sphereon/ssi-sdk-ext.key-manager key functionalities', () => {
7
6
  const kms = new SphereonKeyManager({
@@ -1,8 +1,7 @@
1
1
  import { generatePrivateKeyHex } from '@sphereon/ssi-sdk-ext.key-utils'
2
- import { SphereonKeyManagementSystem } from '@sphereon/ssi-sdk-ext.kms-local'
3
- import { MemoryKeyStore, MemoryPrivateKeyStore } from '@veramo/key-manager'
4
- import { beforeAll, describe, expect, it } from 'vitest'
5
2
  import { SphereonKeyManager } from '../agent/SphereonKeyManager'
3
+ import { MemoryKeyStore, MemoryPrivateKeyStore } from '@veramo/key-manager'
4
+ import { SphereonKeyManagementSystem } from '@sphereon/ssi-sdk-ext.kms-local'
6
5
 
7
6
  describe('@sphereon/ssi-sdk-ext.kms-local encrypt/decrypt', () => {
8
7
  const EXAMPLE_PAYLOAD = 'EXAMPLE payload! Could be anything'
@@ -1,20 +1,18 @@
1
1
  import { calculateJwkThumbprintForKey, toJwk, verifyRawSignature } from '@sphereon/ssi-sdk-ext.key-utils'
2
- import type { IKey, KeyMetadata, ManagedKeyInfo } from '@veramo/core'
2
+ import { IKey, KeyMetadata, ManagedKeyInfo } from '@veramo/core'
3
3
  import { AbstractKeyManagementSystem, AbstractKeyStore, KeyManager as VeramoKeyManager } from '@veramo/key-manager'
4
- // @ts-ignore
4
+
5
5
  import * as u8a from 'uint8arrays'
6
6
  import {
7
7
  hasKeyOptions,
8
- type IKeyManagerGetArgs,
9
- type ISphereonKeyManager,
10
- type ISphereonKeyManagerCreateArgs,
11
- type ISphereonKeyManagerHandleExpirationsArgs,
12
- type ISphereonKeyManagerSignArgs,
13
- type ISphereonKeyManagerVerifyArgs,
8
+ IKeyManagerGetArgs,
9
+ ISphereonKeyManager,
10
+ ISphereonKeyManagerCreateArgs,
11
+ ISphereonKeyManagerHandleExpirationsArgs,
12
+ ISphereonKeyManagerSignArgs,
13
+ ISphereonKeyManagerVerifyArgs,
14
14
  } from '../types/ISphereonKeyManager'
15
15
 
16
- const { fromString } = u8a
17
-
18
16
  export const sphereonKeyManagerMethods: Array<string> = [
19
17
  'keyManagerCreate',
20
18
  'keyManagerGet',
@@ -81,7 +79,7 @@ export class SphereonKeyManager extends VeramoKeyManager {
81
79
  const keyInfo = await this.keyManagerGet({ kid: args.keyRef })
82
80
  const kms = this.getKmsByName(keyInfo.kms)
83
81
  if (keyInfo.type === 'Bls12381G2') {
84
- return await kms.sign({ keyRef: keyInfo, data: typeof args.data === 'string' ? fromString(args.data) : args.data })
82
+ return await kms.sign({ keyRef: keyInfo, data: typeof args.data === 'string' ? u8a.fromString(args.data) : args.data })
85
83
  }
86
84
  // @ts-ignore // we can pass in uint8arrays as well, which the super also can handle but does not expose in its types
87
85
  return await super.keyManagerSign({ ...args, keyRef: keyInfo.kid })
@@ -98,7 +96,7 @@ export class SphereonKeyManager extends VeramoKeyManager {
98
96
  return await verifyRawSignature({
99
97
  key: toJwk(args.publicKeyHex, args.type),
100
98
  data: args.data,
101
- signature: fromString(args.signature, 'utf-8'),
99
+ signature: u8a.fromString(args.signature, 'utf-8'),
102
100
  })
103
101
  }
104
102
 
@@ -152,6 +150,7 @@ export class SphereonKeyManager extends VeramoKeyManager {
152
150
  }
153
151
  }
154
152
 
153
+
155
154
  get defaultKms(): string {
156
155
  return this._defaultKms
157
156
  }
@@ -1,4 +1,4 @@
1
- import type { IKeyManager, IKeyManagerSignArgs, IPluginMethodMap, KeyMetadata, ManagedKeyInfo, MinimalImportableKey, TKeyType } from '@veramo/core'
1
+ import { IKeyManager, IKeyManagerSignArgs, IPluginMethodMap, KeyMetadata, ManagedKeyInfo, MinimalImportableKey, TKeyType } from '@veramo/core'
2
2
 
3
3
  export type PartialKey = ManagedKeyInfo & { privateKeyHex: string }
4
4