@sphereon/ssi-sdk-ext.key-manager 0.23.0 → 0.23.1-next.5

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.
@@ -5,7 +5,7 @@
5
5
  "toolPackages": [
6
6
  {
7
7
  "packageName": "@microsoft/api-extractor",
8
- "packageVersion": "7.47.0"
8
+ "packageVersion": "7.47.3"
9
9
  }
10
10
  ]
11
11
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sphereon/ssi-sdk-ext.key-manager",
3
3
  "description": "Sphereon Key Manager plugin with BLS support",
4
- "version": "0.23.0",
4
+ "version": "0.23.1-next.5+37fc76f",
5
5
  "source": "src/index.ts",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
@@ -15,13 +15,13 @@
15
15
  "generate-plugin-schema": "sphereon dev generate-plugin-schema"
16
16
  },
17
17
  "dependencies": {
18
- "@sphereon/ssi-sdk-ext.kms-local": "0.23.0",
18
+ "@sphereon/ssi-sdk-ext.kms-local": "0.23.1-next.5+37fc76f",
19
19
  "@veramo/core": "4.2.0",
20
20
  "@veramo/key-manager": "4.2.0"
21
21
  },
22
22
  "devDependencies": {
23
23
  "@mattrglobal/bbs-signatures": "^1.3.1",
24
- "@sphereon/ssi-sdk-ext.key-utils": "0.23.0",
24
+ "@sphereon/ssi-sdk-ext.key-utils": "0.23.1-next.5+37fc76f",
25
25
  "@sphereon/ssi-sdk.dev": "0.27.0"
26
26
  },
27
27
  "resolutions": {
@@ -46,5 +46,5 @@
46
46
  "kms",
47
47
  "Veramo"
48
48
  ],
49
- "gitHead": "22da2aadb48b9a13b25af47f0f092764bca491f7"
49
+ "gitHead": "37fc76fa35d4c4498b12ec9d43bf3fc9db94ec47"
50
50
  }
@@ -1,107 +0,0 @@
1
- import { SphereonKeyManager } from '../agent/SphereonKeyManager'
2
- import { MemoryKeyStore, MemoryPrivateKeyStore } from '@veramo/key-manager'
3
- import { IKey, ManagedKeyInfo } from '@veramo/core'
4
- import { generateBls12381G2KeyPair } from '@mattrglobal/bbs-signatures'
5
- import { SphereonKeyManagementSystem } from '@sphereon/ssi-sdk-ext.kms-local'
6
-
7
- describe('@sphereon/ssi-sdk-ext.kms-local', () => {
8
- let bls: { publicKey: Uint8Array; secretKey: Uint8Array }
9
- let kms: SphereonKeyManager
10
-
11
- beforeAll(async () => {
12
- bls = await generateBls12381G2KeyPair()
13
- kms = new SphereonKeyManager({
14
- store: new MemoryKeyStore(),
15
- kms: {
16
- local: new SphereonKeyManagementSystem(new MemoryPrivateKeyStore()),
17
- },
18
- })
19
- })
20
-
21
- it('should import a BLS key', async () => {
22
- const myKey = {
23
- type: 'Bls12381G2',
24
- privateKeyHex: Buffer.from(bls.secretKey).toString('hex'),
25
- publicKeyHex: Buffer.from(bls.publicKey).toString('hex'),
26
- }
27
- const key = await kms.keyManagerImport({
28
- kid: myKey.publicKeyHex,
29
- privateKeyHex: myKey.privateKeyHex,
30
- publicKeyHex: myKey.publicKeyHex,
31
- kms: 'local',
32
- type: 'Bls12381G2',
33
- })
34
- expect(key).toEqual({
35
- kid: myKey.publicKeyHex,
36
- kms: 'local',
37
- meta: {
38
- algorithms: ['BLS'],
39
- },
40
- publicKeyHex: myKey.publicKeyHex,
41
- type: 'Bls12381G2',
42
- })
43
- })
44
-
45
- it('should get key management systems', async () => {
46
- await expect(kms.keyManagerGetKeyManagementSystems()).resolves.toEqual(['local'])
47
- })
48
-
49
- it('should get BLS key', async () => {
50
- await expect(kms.keyManagerGet({ kid: Buffer.from(bls.publicKey).toString('hex') }))
51
- })
52
-
53
- it('should create a BLS key', async () => {
54
- await expect(
55
- kms.keyManagerCreate({
56
- kms: 'local',
57
- type: 'Bls12381G2',
58
- })
59
- ).resolves.toEqual(
60
- expect.objectContaining({
61
- kms: 'local',
62
- type: 'Bls12381G2',
63
- meta: {
64
- algorithms: ['BLS'],
65
- },
66
- })
67
- )
68
- })
69
-
70
- //TODO need to update Veramo core to add the data array allowed by bls signer
71
- it('should sign with a BLS key', async () => {
72
- const key: IKey = (await kms.keyManagerGet({ kid: Buffer.from(bls.publicKey).toString('hex') })) as IKey
73
- await expect(
74
- kms.keyManagerSign({
75
- keyRef: key.kid,
76
- data: ['test data'] as any,
77
- })
78
- ).resolves.toBeDefined()
79
- })
80
-
81
- it('should delete a bls key', async () => {
82
- await expect(kms.keyManagerDelete({ kid: Buffer.from(bls.publicKey).toString('hex') })).resolves.toBeTruthy()
83
- })
84
-
85
- it('should get all the keys in the sphereon key manager', async () => {
86
- const myKey = {
87
- type: 'Bls12381G2',
88
- privateKeyHex: Buffer.from(bls.secretKey).toString('hex'),
89
- publicKeyHex: Buffer.from(bls.publicKey).toString('hex'),
90
- }
91
- await kms.keyManagerImport({
92
- kid: myKey.publicKeyHex,
93
- privateKeyHex: myKey.privateKeyHex,
94
- publicKeyHex: myKey.publicKeyHex,
95
- kms: 'local',
96
- type: 'Bls12381G2',
97
- })
98
- const keys: ManagedKeyInfo[] = await kms.keyManagerListKeys()
99
- keys.forEach((key) => {
100
- expect(key['privateKeyHex' as keyof ManagedKeyInfo]).toBeUndefined()
101
- })
102
- })
103
-
104
- afterAll(async () => {
105
- await new Promise((resolve) => setTimeout((v: void) => resolve(v), 500))
106
- })
107
- })