@sphereon/ssi-sdk-ext.key-utils 0.24.0 → 0.24.1-next.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 (41) hide show
  1. package/dist/functions.d.ts +14 -1
  2. package/dist/functions.d.ts.map +1 -1
  3. package/dist/functions.js +181 -18
  4. package/dist/functions.js.map +1 -1
  5. package/dist/index.d.ts +0 -2
  6. package/dist/index.d.ts.map +1 -1
  7. package/dist/index.js +0 -2
  8. package/dist/index.js.map +1 -1
  9. package/dist/jwk-jcs.d.ts +28 -1
  10. package/dist/jwk-jcs.d.ts.map +1 -1
  11. package/dist/jwk-jcs.js +2 -1
  12. package/dist/jwk-jcs.js.map +1 -1
  13. package/dist/types/key-util-types.d.ts +33 -9
  14. package/dist/types/key-util-types.d.ts.map +1 -1
  15. package/dist/types/key-util-types.js +16 -6
  16. package/dist/types/key-util-types.js.map +1 -1
  17. package/package.json +6 -3
  18. package/src/functions.ts +207 -13
  19. package/src/index.ts +0 -2
  20. package/src/jwk-jcs.ts +1 -2
  21. package/src/types/key-util-types.ts +40 -9
  22. package/dist/x509/index.d.ts +0 -4
  23. package/dist/x509/index.d.ts.map +0 -1
  24. package/dist/x509/index.js +0 -20
  25. package/dist/x509/index.js.map +0 -1
  26. package/dist/x509/rsa-key.d.ts +0 -11
  27. package/dist/x509/rsa-key.d.ts.map +0 -1
  28. package/dist/x509/rsa-key.js +0 -101
  29. package/dist/x509/rsa-key.js.map +0 -1
  30. package/dist/x509/rsa-signer.d.ts +0 -25
  31. package/dist/x509/rsa-signer.d.ts.map +0 -1
  32. package/dist/x509/rsa-signer.js +0 -105
  33. package/dist/x509/rsa-signer.js.map +0 -1
  34. package/dist/x509/x509-utils.d.ts +0 -25
  35. package/dist/x509/x509-utils.d.ts.map +0 -1
  36. package/dist/x509/x509-utils.js +0 -176
  37. package/dist/x509/x509-utils.js.map +0 -1
  38. package/src/x509/index.ts +0 -3
  39. package/src/x509/rsa-key.ts +0 -81
  40. package/src/x509/rsa-signer.ts +0 -81
  41. package/src/x509/x509-utils.ts +0 -145
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ENC_KEY_ALGS = exports.SIG_KEY_ALGS = exports.KeyType = exports.KeyCurve = exports.JwkKeyUse = exports.Key = exports.JWK_JCS_PUB_PREFIX = exports.JWK_JCS_PUB_NAME = void 0;
3
+ exports.SignatureAlgorithmJwa = exports.ENC_KEY_ALGS = exports.SIG_KEY_ALGS = exports.KeyType = exports.KeyCurve = exports.JwkKeyUse = exports.Key = exports.JWK_JCS_PUB_PREFIX = exports.JWK_JCS_PUB_NAME = void 0;
4
4
  exports.JWK_JCS_PUB_NAME = 'jwk_jcs-pub';
5
5
  exports.JWK_JCS_PUB_PREFIX = 0xeb51;
6
6
  var Key;
@@ -29,9 +29,19 @@ var KeyType;
29
29
  })(KeyType || (exports.KeyType = KeyType = {}));
30
30
  exports.SIG_KEY_ALGS = ['ES256', 'ES384', 'ES512', 'EdDSA', 'ES256K', 'Ed25519', 'Secp256k1', 'Secp256r1', 'Bls12381G1', 'Bls12381G2'];
31
31
  exports.ENC_KEY_ALGS = ['X25519', 'ECDH_ES_A256KW', 'RSA_OAEP_256'];
32
- /*
33
- // Needed to make a single property required
34
- type WithRequiredProperty<Type, Key extends keyof Type> = Type & {
35
- [Property in Key]-?: Type[Property]
36
- }*/
32
+ var SignatureAlgorithmJwa;
33
+ (function (SignatureAlgorithmJwa) {
34
+ // todo: Compare to spec and to kmp lib
35
+ SignatureAlgorithmJwa["EdDSA"] = "EdDSA";
36
+ SignatureAlgorithmJwa["ES256"] = "ES256";
37
+ SignatureAlgorithmJwa["ES384"] = "ES384";
38
+ SignatureAlgorithmJwa["ES512"] = "ES512";
39
+ SignatureAlgorithmJwa["ES256K"] = "ES256K";
40
+ SignatureAlgorithmJwa["RS256"] = "RS256";
41
+ SignatureAlgorithmJwa["RS384"] = "RS384";
42
+ SignatureAlgorithmJwa["RS512"] = "RS512";
43
+ SignatureAlgorithmJwa["PS256"] = "PS256";
44
+ SignatureAlgorithmJwa["PS384"] = "PS384";
45
+ SignatureAlgorithmJwa["PS512"] = "PS512";
46
+ })(SignatureAlgorithmJwa || (exports.SignatureAlgorithmJwa = SignatureAlgorithmJwa = {}));
37
47
  //# sourceMappingURL=key-util-types.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"key-util-types.js","sourceRoot":"","sources":["../../src/types/key-util-types.ts"],"names":[],"mappings":";;;AAEa,QAAA,gBAAgB,GAAG,aAAsB,CAAA;AACzC,QAAA,kBAAkB,GAAG,MAAM,CAAA;AAIxC,IAAY,GAIX;AAJD,WAAY,GAAG;IACb,0BAAmB,CAAA;IACnB,8BAAuB,CAAA;IACvB,8BAAuB,CAAA;AACzB,CAAC,EAJW,GAAG,mBAAH,GAAG,QAId;AAED,IAAY,SAGX;AAHD,WAAY,SAAS;IACnB,+BAAkB,CAAA;IAClB,8BAAiB,CAAA;AACnB,CAAC,EAHW,SAAS,yBAAT,SAAS,QAGpB;AAED,IAAY,QAKX;AALD,WAAY,QAAQ;IAClB,mCAAuB,CAAA;IACvB,2BAAe,CAAA;IACf,+BAAmB,CAAA;IACnB,6BAAiB,CAAA;AACnB,CAAC,EALW,QAAQ,wBAAR,QAAQ,QAKnB;AAED,IAAY,OAIX;AAJD,WAAY,OAAO;IACjB,oBAAS,CAAA;IACT,sBAAW,CAAA;IACX,sBAAW,CAAA;AACb,CAAC,EAJW,OAAO,uBAAP,OAAO,QAIlB;AAEY,QAAA,YAAY,GAAG,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,WAAW,EAAE,WAAW,EAAE,YAAY,EAAE,YAAY,CAAC,CAAA;AAC9H,QAAA,YAAY,GAAG,CAAC,QAAQ,EAAE,gBAAgB,EAAE,cAAc,CAAC,CAAA;AAyDxE;;;;GAIG"}
1
+ {"version":3,"file":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C"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sphereon/ssi-sdk-ext.key-utils",
3
3
  "description": "Sphereon SSI-SDK plugin for key creation.",
4
- "version": "0.24.0",
4
+ "version": "0.24.1-next.101+35c772f",
5
5
  "source": "src/index.ts",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
@@ -11,9 +11,12 @@
11
11
  },
12
12
  "dependencies": {
13
13
  "@ethersproject/random": "^5.7.0",
14
+ "@sphereon/ssi-sdk-ext.x509-utils": "0.24.1-next.101+35c772f",
15
+ "@sphereon/ssi-types": "0.29.1-unstable.75",
14
16
  "@stablelib/ed25519": "^1.0.3",
15
17
  "@stablelib/sha256": "^1.0.1",
16
18
  "@stablelib/sha512": "^1.0.1",
19
+ "@trust/keyto": "^1.0.1",
17
20
  "@veramo/core": "4.2.0",
18
21
  "base64url": "^3.0.1",
19
22
  "debug": "^4.3.4",
@@ -38,7 +41,7 @@
38
41
  "publishConfig": {
39
42
  "access": "public"
40
43
  },
41
- "repository": "git@github.com:Sphereon-OpenSource/ssi-sdk.git",
44
+ "repository": "git@github.com:Sphereon-OpenSource/SSI-SDK-crypto-extensions.git",
42
45
  "author": "Sphereon <dev@sphereon.com>",
43
46
  "license": "Apache-2.0",
44
47
  "keywords": [
@@ -46,5 +49,5 @@
46
49
  "DID",
47
50
  "Veramo"
48
51
  ],
49
- "gitHead": "a69d4668ab18a6deec35ff686b737b4877857808"
52
+ "gitHead": "35c772f747819ee386e8da3c6547c565859cbed5"
50
53
  }
package/src/functions.ts CHANGED
@@ -1,16 +1,30 @@
1
1
  import { randomBytes } from '@ethersproject/random'
2
+ import { generateRSAKeyAsPEM, hexToBase64, hexToPEM, PEMToJwk, privateKeyHexFromPEM } from '@sphereon/ssi-sdk-ext.x509-utils'
3
+ import { Loggers } from '@sphereon/ssi-types'
2
4
  import { generateKeyPair as generateSigningKeyPair } from '@stablelib/ed25519'
3
5
  import { IAgentContext, IKey, IKeyManager, ManagedKeyInfo, MinimalImportableKey } from '@veramo/core'
4
- import Debug from 'debug'
5
6
 
6
7
  import { JsonWebKey } from 'did-resolver'
7
8
  import elliptic from 'elliptic'
8
9
  import * as u8a from 'uint8arrays'
9
10
  import { digestMethodParams } from './digest-methods'
10
- import { ENC_KEY_ALGS, IImportProvidedOrGeneratedKeyArgs, JWK, JwkKeyUse, KeyCurve, KeyType, SIG_KEY_ALGS, TKeyType } from './types'
11
- import { generateRSAKeyAsPEM, hexToBase64, hexToPEM, PEMToJwk, privateKeyHexFromPEM } from './x509'
11
+ import {
12
+ ENC_KEY_ALGS,
13
+ IImportProvidedOrGeneratedKeyArgs,
14
+ JWK,
15
+ JwkKeyUse,
16
+ KeyCurve,
17
+ KeyType,
18
+ KeyTypeFromCryptographicSuiteArgs,
19
+ SIG_KEY_ALGS,
20
+ SignatureAlgorithmFromKeyArgs,
21
+ SignatureAlgorithmFromKeyTypeArgs,
22
+ SignatureAlgorithmJwa,
23
+ TKeyType,
24
+ } from './types'
25
+
26
+ export const logger = Loggers.DEFAULT.get('sphereon:key-utils')
12
27
 
13
- const debug = Debug('sphereon:kms:local')
14
28
  /**
15
29
  * Generates a random Private Hex Key for the specified key type
16
30
  * @param type The key type
@@ -37,6 +51,23 @@ export const generatePrivateKeyHex = async (type: TKeyType): Promise<string> =>
37
51
  }
38
52
  }
39
53
 
54
+ const keyMetaAlgorithmsFromKeyType = (type: string | TKeyType) => {
55
+ switch (type) {
56
+ case 'Ed25519':
57
+ return ['Ed25519', 'EdDSA']
58
+ case 'ES256K':
59
+ case 'Secp256k1':
60
+ return ['ES256K', 'ES256K-R', 'eth_signTransaction', 'eth_signTypedData', 'eth_signMessage', 'eth_rawSign']
61
+ case 'Secp256r1':
62
+ return ['ES256']
63
+ case 'X25519':
64
+ return ['ECDH', 'ECDH-ES', 'ECDH-1PU']
65
+ case 'RSA':
66
+ return ['RS256', 'RS512', 'PS256', 'PS512']
67
+ }
68
+ return [type]
69
+ }
70
+
40
71
  /**
41
72
  * We optionally generate and then import our own keys.
42
73
  *
@@ -76,15 +107,23 @@ export async function importProvidedOrGeneratedKey(
76
107
  privateKeyHex = privateKeyHexFromPEM(key.meta.x509.privateKeyPEM)
77
108
  }
78
109
  }
79
- if (!privateKeyHex) {
80
- privateKeyHex = await generatePrivateKeyHex(type)
110
+ if (privateKeyHex) {
111
+ return context.agent.keyManagerImport({
112
+ ...key,
113
+ kms: args.kms,
114
+ type,
115
+ privateKeyHex: privateKeyHex!,
116
+ })
81
117
  }
82
118
 
83
- return context.agent.keyManagerImport({
84
- ...key,
85
- kms: args.kms,
119
+ return context.agent.keyManagerCreate({
86
120
  type,
87
- privateKeyHex: privateKeyHex!,
121
+ kms: args.kms,
122
+ meta: {
123
+ ...key?.meta,
124
+ algorithms: keyMetaAlgorithmsFromKeyType(type),
125
+ keyAlias: args.alias,
126
+ },
88
127
  })
89
128
  }
90
129
 
@@ -150,6 +189,11 @@ export const calculateJwkThumbprint = (args: { jwk: JWK; digestAlgorithm?: 'sha2
150
189
  : digestMethodParams('SHA-256').digestMethod(data, 'base64url')
151
190
  }
152
191
 
192
+ export const toJwkFromKey = (key: IKey | MinimalImportableKey | ManagedKeyInfo, opts?: { use?: JwkKeyUse; noKidThumbprint?: boolean }): JWK => {
193
+ const isPrivateKey = 'privateKeyHex' in key
194
+ return toJwk(key.publicKeyHex!, key.type, { ...opts, key, isPrivateKey })
195
+ }
196
+
153
197
  /**
154
198
  * Converts a public key in hex format to a JWK
155
199
  * @param publicKeyHex public key in hex
@@ -236,7 +280,7 @@ const assertProperKeyLength = (keyHex: string, expectedKeyLength: number | numbe
236
280
  */
237
281
  const toSecp256k1Jwk = (keyHex: string, opts?: { use?: JwkKeyUse; isPrivateKey?: boolean }): JWK => {
238
282
  const { use } = opts ?? {}
239
- debug(`toSecp256k1Jwk keyHex: ${keyHex}, length: ${keyHex.length}`)
283
+ logger.debug(`toSecp256k1Jwk keyHex: ${keyHex}, length: ${keyHex.length}`)
240
284
  if (opts?.isPrivateKey) {
241
285
  assertProperKeyLength(keyHex, [64])
242
286
  } else {
@@ -267,7 +311,7 @@ const toSecp256k1Jwk = (keyHex: string, opts?: { use?: JwkKeyUse; isPrivateKey?:
267
311
  */
268
312
  const toSecp256r1Jwk = (keyHex: string, opts?: { use?: JwkKeyUse; isPrivateKey?: boolean }): JWK => {
269
313
  const { use } = opts ?? {}
270
- debug(`toSecp256r1Jwk keyHex: ${keyHex}, length: ${keyHex.length}`)
314
+ logger.debug(`toSecp256r1Jwk keyHex: ${keyHex}, length: ${keyHex.length}`)
271
315
  if (opts?.isPrivateKey) {
272
316
  assertProperKeyLength(keyHex, [64])
273
317
  } else {
@@ -276,7 +320,7 @@ const toSecp256r1Jwk = (keyHex: string, opts?: { use?: JwkKeyUse; isPrivateKey?:
276
320
 
277
321
  const secp256r1 = new elliptic.ec('p256')
278
322
  const keyBytes = u8a.fromString(keyHex, 'base16')
279
- debug(`keyBytes length: ${keyBytes}`)
323
+ logger.debug(`keyBytes length: ${keyBytes}`)
280
324
  const keyPair = opts?.isPrivateKey ? secp256r1.keyFromPrivate(keyBytes) : secp256r1.keyFromPublic(keyBytes)
281
325
  const pubPoint = keyPair.getPublic()
282
326
  return {
@@ -341,3 +385,153 @@ export const padLeft = (args: { data: string; size?: number; padString?: string
341
385
  const length = padString.length
342
386
  return padString.repeat((size - data.length) / length) + data
343
387
  }
388
+
389
+ enum OIDType {
390
+ Secp256k1,
391
+ Secp256r1,
392
+ Ed25519,
393
+ }
394
+
395
+ const OID: Record<OIDType, Uint8Array> = {
396
+ [OIDType.Secp256k1]: new Uint8Array([0x06, 0x07, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x02, 0x01]),
397
+ [OIDType.Secp256r1]: new Uint8Array([0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x03, 0x01, 0x07]),
398
+ [OIDType.Ed25519]: new Uint8Array([0x06, 0x03, 0x2b, 0x65, 0x70]),
399
+ }
400
+
401
+ const compareUint8Arrays = (a: Uint8Array, b: Uint8Array): boolean => {
402
+ if (a.length !== b.length) {
403
+ return false
404
+ }
405
+ for (let i = 0; i < a.length; i++) {
406
+ if (a[i] !== b[i]) {
407
+ return false
408
+ }
409
+ }
410
+ return true
411
+ }
412
+
413
+ const findSubarray = (haystack: Uint8Array, needle: Uint8Array): number => {
414
+ for (let i = 0; i <= haystack.length - needle.length; i++) {
415
+ if (compareUint8Arrays(haystack.subarray(i, i + needle.length), needle)) {
416
+ return i
417
+ }
418
+ }
419
+ return -1
420
+ }
421
+
422
+ const getTargetOID = (keyType: TKeyType) => {
423
+ switch (keyType) {
424
+ case 'Secp256k1':
425
+ return OID[OIDType.Secp256k1]
426
+ case 'Secp256r1':
427
+ return OID[OIDType.Secp256r1]
428
+ case 'Ed25519':
429
+ return OID[OIDType.Ed25519]
430
+ default:
431
+ throw new Error(`Unsupported key type: ${keyType}`)
432
+ }
433
+ }
434
+
435
+ export const isAsn1Der = (key: Uint8Array): boolean => key[0] === 0x30
436
+
437
+ export const asn1DerToRawPublicKey = (derKey: Uint8Array, keyType: TKeyType): Uint8Array => {
438
+ if (!isAsn1Der(derKey)) {
439
+ throw new Error('Invalid DER encoding: Expected to start with sequence tag')
440
+ }
441
+
442
+ let index = 2
443
+ if (derKey[1] & 0x80) {
444
+ const lengthBytesCount = derKey[1] & 0x7f
445
+ index += lengthBytesCount
446
+ }
447
+ const targetOid = getTargetOID(keyType)
448
+ const oidIndex = findSubarray(derKey, targetOid)
449
+ if (oidIndex === -1) {
450
+ throw new Error(`OID for ${keyType} not found in DER encoding`)
451
+ }
452
+
453
+ index = oidIndex + targetOid.length
454
+
455
+ while (index < derKey.length && derKey[index] !== 0x03) {
456
+ index++
457
+ }
458
+
459
+ if (index >= derKey.length) {
460
+ throw new Error('Invalid DER encoding: Bit string not found')
461
+ }
462
+
463
+ // Skip the bit string tag (0x03) and length byte
464
+ index += 2
465
+
466
+ // Skip the unused bits count byte
467
+ index++
468
+
469
+ return derKey.slice(index)
470
+ }
471
+
472
+ export const isRawCompressedPublicKey = (key: Uint8Array): boolean => key.length === 33 && (key[0] === 0x02 || key[0] === 0x03)
473
+
474
+ export const toRawCompressedHexPublicKey = (rawPublicKey: Uint8Array, keyType: TKeyType): string => {
475
+ if (isRawCompressedPublicKey(rawPublicKey)) {
476
+ throw new Error('Invalid public key format, an uncompressed raw public key is required as input, not a raw')
477
+ }
478
+
479
+ if (keyType === 'Secp256k1' || keyType === 'Secp256r1') {
480
+ if (rawPublicKey[0] === 0x04 && rawPublicKey.length === 65) {
481
+ const xCoordinate = rawPublicKey.slice(1, 33)
482
+ const yCoordinate = rawPublicKey.slice(33)
483
+ const prefix = new Uint8Array([yCoordinate[31] % 2 === 0 ? 0x02 : 0x03])
484
+ const resultKey = hexStringFromUint8Array(new Uint8Array([...prefix, ...xCoordinate]))
485
+ logger.debug(`converted public key ${hexStringFromUint8Array(rawPublicKey)} to ${resultKey}`)
486
+ return resultKey
487
+ }
488
+ return u8a.toString(rawPublicKey, 'base16')
489
+ } else if (keyType === 'Ed25519') {
490
+ // Ed25519 keys are always in compressed form
491
+ return u8a.toString(rawPublicKey, 'base16')
492
+ }
493
+
494
+ throw new Error(`Unsupported key type: ${keyType}`)
495
+ }
496
+
497
+ export const hexStringFromUint8Array = (value: Uint8Array): string => u8a.toString(value, 'base16')
498
+
499
+ export const signatureAlgorithmFromKey = async (args: SignatureAlgorithmFromKeyArgs): Promise<SignatureAlgorithmJwa> => {
500
+ const { key } = args
501
+ return signatureAlgorithmFromKeyType({ type: key.type })
502
+ }
503
+
504
+ export const signatureAlgorithmFromKeyType = (args: SignatureAlgorithmFromKeyTypeArgs): SignatureAlgorithmJwa => {
505
+ const { type } = args
506
+ switch (type) {
507
+ case 'Ed25519':
508
+ case 'X25519':
509
+ return SignatureAlgorithmJwa.EdDSA
510
+ case 'Secp256r1':
511
+ return SignatureAlgorithmJwa.ES256
512
+ case 'Secp256k1':
513
+ return SignatureAlgorithmJwa.ES256K
514
+ default:
515
+ throw new Error(`Key type '${type}' not supported`)
516
+ }
517
+ }
518
+
519
+ // TODO improve this conversion for jwt and jsonld, not a fan of current structure
520
+ export const keyTypeFromCryptographicSuite = (args: KeyTypeFromCryptographicSuiteArgs): TKeyType => {
521
+ const { suite } = args
522
+ switch (suite) {
523
+ case 'EdDSA':
524
+ case 'Ed25519Signature2018':
525
+ case 'Ed25519Signature2020':
526
+ case 'JcsEd25519Signature2020':
527
+ return 'Ed25519'
528
+ case 'JsonWebSignature2020':
529
+ case 'ES256':
530
+ return 'Secp256r1'
531
+ case 'EcdsaSecp256k1Signature2019':
532
+ case 'ES256K':
533
+ return 'Secp256k1'
534
+ default:
535
+ throw new Error(`Cryptographic suite '${suite}' not supported`)
536
+ }
537
+ }
package/src/index.ts CHANGED
@@ -4,9 +4,7 @@
4
4
  *
5
5
  * @packageDocumentation
6
6
  */
7
- export * from './x509'
8
7
  export * from './functions'
9
8
  export * from './jwk-jcs'
10
9
  export * from './types'
11
- export * from './x509/x509-utils'
12
10
  export * from './digest-methods'
package/src/jwk-jcs.ts CHANGED
@@ -1,7 +1,6 @@
1
1
  import { TextDecoder, TextEncoder } from 'web-encoding'
2
2
  import isPlainObject from 'lodash.isplainobject'
3
3
  import type { ByteView } from 'multiformats/codecs/interface'
4
- import type { JsonWebKey } from 'did-resolver'
5
4
 
6
5
  const textEncoder = new TextEncoder()
7
6
  const textDecoder = new TextDecoder()
@@ -74,7 +73,7 @@ function validateJwk(jwk: any) {
74
73
  * @param jwk - The JWK to canonicalize.
75
74
  * @returns The JWK with only the required members, ordered lexicographically.
76
75
  */
77
- function minimalJwk(jwk: any) {
76
+ export function minimalJwk(jwk: any) {
78
77
  // "default" case is not needed
79
78
  // eslint-disable-next-line default-case
80
79
  switch (jwk.kty) {
@@ -1,4 +1,4 @@
1
- import { MinimalImportableKey } from '@veramo/core'
1
+ import { IKey, MinimalImportableKey } from '@veramo/core'
2
2
 
3
3
  export const JWK_JCS_PUB_NAME = 'jwk_jcs-pub' as const
4
4
  export const JWK_JCS_PUB_PREFIX = 0xeb51
@@ -32,19 +32,30 @@ export enum KeyType {
32
32
  export const SIG_KEY_ALGS = ['ES256', 'ES384', 'ES512', 'EdDSA', 'ES256K', 'Ed25519', 'Secp256k1', 'Secp256r1', 'Bls12381G1', 'Bls12381G2']
33
33
  export const ENC_KEY_ALGS = ['X25519', 'ECDH_ES_A256KW', 'RSA_OAEP_256']
34
34
 
35
- export interface JWK {
36
- alg?: string
37
- crv?: string
35
+ export enum SignatureAlgorithmJwa {
36
+ // todo: Compare to spec and to kmp lib
37
+
38
+ EdDSA = 'EdDSA',
39
+ ES256 = 'ES256',
40
+ ES384 = 'ES384',
41
+ ES512 = 'ES512',
42
+ ES256K = 'ES256K',
43
+ RS256 = 'RS256',
44
+ RS384 = 'RS384',
45
+ RS512 = 'RS512',
46
+ PS256 = 'PS256',
47
+ PS384 = 'PS384',
48
+ PS512 = 'PS512',
49
+ }
50
+
51
+ export interface JWK extends BaseJWK {
38
52
  d?: string
39
53
  dp?: string
40
54
  dq?: string
41
- e?: string
42
55
  ext?: boolean
43
56
  k?: string
44
57
  key_ops?: string[]
45
58
  kid?: string
46
- kty?: string
47
- n?: string
48
59
  oth?: Array<{
49
60
  d?: string
50
61
  r?: string
@@ -54,8 +65,6 @@ export interface JWK {
54
65
  q?: string
55
66
  qi?: string
56
67
  use?: string
57
- x?: string
58
- y?: string
59
68
  /** JWK "x5c" (X.509 Certificate Chain) Parameter. */
60
69
  x5c?: string[]
61
70
  /** JWK "x5t" (X.509 Certificate SHA-1 Thumbprint) Parameter. */
@@ -67,6 +76,15 @@ export interface JWK {
67
76
  [propName: string]: unknown
68
77
  }
69
78
 
79
+ export interface BaseJWK {
80
+ kty: string
81
+ crv?: string
82
+ x?: string
83
+ y?: string
84
+ e?: string
85
+ n?: string
86
+ }
87
+
70
88
  export type KeyVisibility = 'public' | 'private'
71
89
 
72
90
  export interface X509Opts {
@@ -79,6 +97,7 @@ export interface X509Opts {
79
97
 
80
98
  export interface IImportProvidedOrGeneratedKeyArgs {
81
99
  kms?: string
100
+ alias?: string
82
101
  options?: IKeyOpts
83
102
  }
84
103
  export interface IKeyOpts {
@@ -92,3 +111,15 @@ export interface IKeyOpts {
92
111
  type WithRequiredProperty<Type, Key extends keyof Type> = Type & {
93
112
  [Property in Key]-?: Type[Property]
94
113
  }*/
114
+
115
+ export type SignatureAlgorithmFromKeyArgs = {
116
+ key: IKey
117
+ }
118
+
119
+ export type SignatureAlgorithmFromKeyTypeArgs = {
120
+ type: TKeyType
121
+ }
122
+
123
+ export type KeyTypeFromCryptographicSuiteArgs = {
124
+ suite: string
125
+ }
@@ -1,4 +0,0 @@
1
- export * from './rsa-key';
2
- export * from './rsa-signer';
3
- export * from './x509-utils';
4
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/x509/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAA;AACzB,cAAc,cAAc,CAAA;AAC5B,cAAc,cAAc,CAAA"}
@@ -1,20 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./rsa-key"), exports);
18
- __exportStar(require("./rsa-signer"), exports);
19
- __exportStar(require("./x509-utils"), exports);
20
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/x509/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4CAAyB;AACzB,+CAA4B;AAC5B,+CAA4B"}
@@ -1,11 +0,0 @@
1
- import { HashAlgorithm } from '../digest-methods';
2
- import { JWK } from '../types';
3
- export type RSASignatureSchemes = 'RSASSA-PKCS1-V1_5' | 'RSA-PSS';
4
- export type RSAEncryptionSchemes = 'RSAES-PKCS-v1_5 ' | 'RSAES-OAEP';
5
- export declare const signAlgorithmToSchemeAndHashAlg: (signingAlg: string) => {
6
- scheme: "RSASSA-PKCS1-V1_5" | "RSA-PSS";
7
- hashAlgorithm: HashAlgorithm;
8
- };
9
- export declare const cryptoSubtleImportRSAKey: (jwk: JWK, scheme: RSAEncryptionSchemes | RSASignatureSchemes, hashAlgorithm?: HashAlgorithm) => Promise<CryptoKey>;
10
- export declare const generateRSAKeyAsPEM: (scheme: RSAEncryptionSchemes | RSASignatureSchemes, hashAlgorithm?: HashAlgorithm, modulusLength?: number) => Promise<string>;
11
- //# sourceMappingURL=rsa-key.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"rsa-key.d.ts","sourceRoot":"","sources":["../../src/x509/rsa-key.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AACjD,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAA;AAG9B,MAAM,MAAM,mBAAmB,GAAG,mBAAmB,GAAG,SAAS,CAAA;AAEjE,MAAM,MAAM,oBAAoB,GAAG,kBAAkB,GAAG,YAAY,CAAA;AA2BpE,eAAO,MAAM,+BAA+B,eAAgB,MAAM;;;CAajE,CAAA;AAED,eAAO,MAAM,wBAAwB,QAC9B,GAAG,UACA,oBAAoB,GAAG,mBAAmB,kBAClC,aAAa,KAC5B,QAAQ,SAAS,CAKnB,CAAA;AAED,eAAO,MAAM,mBAAmB,WACtB,oBAAoB,GAAG,mBAAmB,kBAClC,aAAa,kBACb,MAAM,KACrB,QAAQ,MAAM,CAgBhB,CAAA"}
@@ -1,101 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
26
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
27
- return new (P || (P = Promise))(function (resolve, reject) {
28
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
29
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
30
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
31
- step((generator = generator.apply(thisArg, _arguments || [])).next());
32
- });
33
- };
34
- Object.defineProperty(exports, "__esModule", { value: true });
35
- exports.generateRSAKeyAsPEM = exports.cryptoSubtleImportRSAKey = exports.signAlgorithmToSchemeAndHashAlg = void 0;
36
- const u8a = __importStar(require("uint8arrays"));
37
- const x509_utils_1 = require("./x509-utils");
38
- const usage = (jwk) => {
39
- var _a, _b, _c, _d;
40
- if (jwk.key_ops && jwk.key_ops.length > 0) {
41
- return jwk.key_ops;
42
- }
43
- if (jwk.use) {
44
- const usages = [];
45
- if (jwk.use.includes('sig')) {
46
- usages.push('sign', 'verify');
47
- }
48
- else if (jwk.use.includes('enc')) {
49
- usages.push('encrypt', 'decrypt');
50
- }
51
- if (usages.length > 0) {
52
- return usages;
53
- }
54
- }
55
- if (jwk.kty === 'RSA') {
56
- if (jwk.d) {
57
- return ((_b = (_a = jwk.alg) === null || _a === void 0 ? void 0 : _a.toUpperCase()) === null || _b === void 0 ? void 0 : _b.includes('QAEP')) ? ['encrypt'] : ['sign'];
58
- }
59
- return ((_d = (_c = jwk.alg) === null || _c === void 0 ? void 0 : _c.toUpperCase()) === null || _d === void 0 ? void 0 : _d.includes('QAEP')) ? ['decrypt'] : ['verify'];
60
- }
61
- // "decrypt" | "deriveBits" | "deriveKey" | "encrypt" | "sign" | "unwrapKey" | "verify" | "wrapKey";
62
- return jwk.d && jwk.kty !== 'RSA' ? ['sign', 'decrypt', 'verify', 'encrypt'] : ['verify'];
63
- };
64
- const signAlgorithmToSchemeAndHashAlg = (signingAlg) => {
65
- const alg = signingAlg.toUpperCase();
66
- let scheme;
67
- if (alg.startsWith('RS')) {
68
- scheme = 'RSASSA-PKCS1-V1_5';
69
- }
70
- else if (alg.startsWith('PS')) {
71
- scheme = 'RSA-PSS';
72
- }
73
- else {
74
- throw Error(`Invalid signing algorithm supplied ${signingAlg}`);
75
- }
76
- const hashAlgorithm = `SHA-${alg.substring(2)}`;
77
- return { scheme, hashAlgorithm };
78
- };
79
- exports.signAlgorithmToSchemeAndHashAlg = signAlgorithmToSchemeAndHashAlg;
80
- const cryptoSubtleImportRSAKey = (jwk, scheme, hashAlgorithm) => __awaiter(void 0, void 0, void 0, function* () {
81
- const hashName = hashAlgorithm ? hashAlgorithm : jwk.alg ? `SHA-${jwk.alg.substring(2)}` : 'SHA-256';
82
- const importParams = { name: scheme, hash: hashName };
83
- return yield crypto.subtle.importKey('jwk', jwk, importParams, false, usage(jwk));
84
- });
85
- exports.cryptoSubtleImportRSAKey = cryptoSubtleImportRSAKey;
86
- const generateRSAKeyAsPEM = (scheme, hashAlgorithm, modulusLength) => __awaiter(void 0, void 0, void 0, function* () {
87
- const hashName = hashAlgorithm ? hashAlgorithm : 'SHA-256';
88
- const params = {
89
- name: scheme,
90
- hash: hashName,
91
- modulusLength: modulusLength ? modulusLength : 2048,
92
- publicExponent: new Uint8Array([1, 0, 1]),
93
- };
94
- const keyUsage = scheme === 'RSA-PSS' || scheme === 'RSASSA-PKCS1-V1_5' ? ['sign', 'verify'] : ['encrypt', 'decrypt'];
95
- const keypair = yield crypto.subtle.generateKey(params, true, keyUsage);
96
- const pkcs8 = yield crypto.subtle.exportKey('pkcs8', keypair.privateKey);
97
- const uint8Array = new Uint8Array(pkcs8);
98
- return (0, x509_utils_1.base64ToPEM)(u8a.toString(uint8Array, 'base64pad'), 'RSA PRIVATE KEY');
99
- });
100
- exports.generateRSAKeyAsPEM = generateRSAKeyAsPEM;
101
- //# sourceMappingURL=rsa-key.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"rsa-key.js","sourceRoot":"","sources":["../../src/x509/rsa-key.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iDAAkC;AAGlC,6CAA0C;AAM1C,MAAM,KAAK,GAAG,CAAC,GAAQ,EAAc,EAAE;;IACrC,IAAI,GAAG,CAAC,OAAO,IAAI,GAAG,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC1C,OAAO,GAAG,CAAC,OAAqB,CAAA;IAClC,CAAC;IACD,IAAI,GAAG,CAAC,GAAG,EAAE,CAAC;QACZ,MAAM,MAAM,GAAe,EAAE,CAAA;QAC7B,IAAI,GAAG,CAAC,GAAG,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;YAC5B,MAAM,CAAC,IAAI,CAAC,MAAM,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AC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;KAC1C,CAAA;IACD,MAAM,QAAQ,GAAe,MAAM,KAAK,SAAS,IAAI,MAAM,KAAK,mBAAmB,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,EAAE,SAAS,CAAC,CAAA;IAEjI,MAAM,OAAO,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,MAAM,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAA;IACvE,MAAM,KAAK,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,OAAO,EAAE,OAAO,CAAC,UAAU,CAAC,CAAA;IAExE,MAAM,UAAU,GAAG,IAAI,UAAU,CAAC,KAAK,CAAC,CAAA;IACxC,OAAO,IAAA,wBAAW,EAAC,GAAG,CAAC,QAAQ,CAAC,UAAU,EAAE,WAAW,CAAC,EAAE,iBAAiB,CAAC,CAAA;AAC9E,CAAC,CAAA,CAAA;AApBY,QAAA,mBAAmB,uBAoB/B"}
@@ -1,25 +0,0 @@
1
- import { HashAlgorithm } from '../digest-methods';
2
- import { JWK, KeyVisibility } from '../types';
3
- import { RSAEncryptionSchemes, RSASignatureSchemes } from './rsa-key';
4
- export declare class RSASigner {
5
- private readonly hashAlgorithm;
6
- private readonly jwk;
7
- private key;
8
- private readonly scheme;
9
- /**
10
- *
11
- * @param key Either in PEM or JWK format (no raw hex keys here!)
12
- * @param opts The algorithm and signature/encryption schemes
13
- */
14
- constructor(key: string | JWK, opts?: {
15
- hashAlgorithm?: HashAlgorithm;
16
- scheme?: RSAEncryptionSchemes | RSASignatureSchemes;
17
- visibility?: KeyVisibility;
18
- });
19
- private getImportParams;
20
- private getKey;
21
- private bufferToString;
22
- sign(data: Uint8Array): Promise<string>;
23
- verify(data: string | Uint8Array, signature: string): Promise<boolean>;
24
- }
25
- //# sourceMappingURL=rsa-signer.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"rsa-signer.d.ts","sourceRoot":"","sources":["../../src/x509/rsa-signer.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AACjD,OAAO,EAAE,GAAG,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAC7C,OAAO,EAA4B,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAA;AAG/F,qBAAa,SAAS;IACpB,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAe;IAC7C,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAK;IAEzB,OAAO,CAAC,GAAG,CAAuB;IAClC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA4C;IAEnE;;;;OAIG;gBAED,GAAG,EAAE,MAAM,GAAG,GAAG,EACjB,IAAI,CAAC,EAAE;QAAE,aAAa,CAAC,EAAE,aAAa,CAAC;QAAC,MAAM,CAAC,EAAE,oBAAoB,GAAG,mBAAmB,CAAC;QAAC,UAAU,CAAC,EAAE,aAAa,CAAA;KAAE;IAY3H,OAAO,CAAC,eAAe;YAQT,MAAM;IAOpB,OAAO,CAAC,cAAc;IAKT,IAAI,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC;IAYvC,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;CAgBpF"}