@sphereon/ssi-sdk-ext.jwt-service 0.28.1-feature.esm.cjs.9 → 0.28.1-feature.jose.vcdm.19

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.
@@ -1,34 +1,34 @@
1
- import { IAgentPlugin } from '@veramo/core'
2
- import debug from 'debug'
1
+ import { Loggers } from '@sphereon/ssi-types'
2
+ import type { IAgentPlugin } from '@veramo/core'
3
+ const logger = Loggers.DEFAULT.get("sphereon:jwt-service")
3
4
  import { importJWK } from 'jose'
4
5
 
5
6
  // @ts-ignore
6
- import { fromString } from 'uint8arrays/from-string'
7
- // @ts-ignore
8
- import { toString } from 'uint8arrays/to-string'
7
+ import * as u8a from 'uint8arrays'
8
+ const { fromString } = u8a
9
9
  import {
10
10
  createJwsCompact,
11
- CreateJwsCompactArgs,
12
- CreateJwsFlattenedArgs,
13
- CreateJwsJsonArgs,
11
+ type CreateJwsCompactArgs,
12
+ type CreateJwsFlattenedArgs,
13
+ type CreateJwsJsonArgs,
14
14
  createJwsJsonFlattened,
15
15
  createJwsJsonGeneral,
16
- DecryptJweCompactJwtArgs,
17
- EncryptJweCompactJwtArgs,
18
- IJwsValidationResult,
19
- IJwtService,
20
- IRequiredContext,
16
+ type DecryptJweCompactJwtArgs,
17
+ type EncryptJweCompactJwtArgs,
18
+ type IJwsValidationResult,
19
+ type IJwtService,
20
+ type IRequiredContext,
21
21
  jweAlg,
22
22
  jweEnc,
23
- JwsJsonFlattened,
24
- JwsJsonGeneral,
25
- JwtCompactResult,
23
+ type JwsJsonFlattened,
24
+ type JwsJsonGeneral,
25
+ type JwtCompactResult,
26
26
  JwtLogger,
27
- PreparedJwsObject,
27
+ type PreparedJwsObject,
28
28
  prepareJwsObject,
29
29
  schema,
30
30
  verifyJws,
31
- VerifyJwsArgs,
31
+ type VerifyJwsArgs,
32
32
  } from '..'
33
33
  import { CompactJwtEncrypter } from '../functions/JWE'
34
34
 
@@ -72,7 +72,7 @@ export class JwtService implements IAgentPlugin {
72
72
  const { payload, protectedHeader = { alg: args.alg, enc: args.enc }, recipientKey, issuer, expirationTime, audience } = args
73
73
 
74
74
  try {
75
- debug(`JWE Encrypt: ${JSON.stringify(args, null, 2)}`)
75
+ logger.debug(`JWE Encrypt: ${JSON.stringify(args, null, 2)}`)
76
76
 
77
77
  const alg = jweAlg(args.alg) ?? jweAlg(protectedHeader.alg) ?? 'ECDH-ES'
78
78
  const enc = jweEnc(args.enc) ?? jweEnc(protectedHeader.enc) ?? 'A256GCM'
@@ -1,26 +1,23 @@
1
- import { defaultRandomSource, randomBytes, RandomSource } from '@stablelib/random'
1
+ import { defaultRandomSource, randomBytes, type RandomSource } from '@stablelib/random'
2
2
  import { base64ToBytes, bytesToBase64url, decodeBase64url } from '@veramo/utils'
3
3
  import * as jose from 'jose'
4
- import { JWEKeyManagementHeaderParameters, JWTDecryptOptions } from 'jose'
4
+ import type { JWEKeyManagementHeaderParameters, JWTDecryptOptions } from 'jose'
5
5
  // @ts-ignore
6
6
  import type { KeyLike } from 'jose/dist/types/types'
7
7
  // @ts-ignore
8
- import { fromString } from 'uint8arrays/from-string'
9
- // @ts-ignore
10
- import { toString } from 'uint8arrays/to-string'
11
- // @ts-ignore
12
- import { concat } from 'uint8arrays/concat'
8
+ import * as u8a from 'uint8arrays'
9
+ const { fromString, toString, concat } = u8a
13
10
  import {
14
- JweAlg,
11
+ type JweAlg,
15
12
  JweAlgs,
16
- JweEnc,
13
+ type JweEnc,
17
14
  JweEncs,
18
- JweHeader,
19
- JweJsonGeneral,
20
- JweProtectedHeader,
21
- JweRecipient,
22
- JweRecipientUnprotectedHeader,
23
- JwsPayload,
15
+ type JweHeader,
16
+ type JweJsonGeneral,
17
+ type JweProtectedHeader,
18
+ type JweRecipient,
19
+ type JweRecipientUnprotectedHeader,
20
+ type JwsPayload,
24
21
  } from '../types/IJwtService'
25
22
 
26
23
  export interface EncryptionResult {
@@ -14,7 +14,8 @@ import { JWK } from '@sphereon/ssi-types'
14
14
  import { IAgentContext } from '@veramo/core'
15
15
  import { base64ToBytes, bytesToBase64url, decodeJoseBlob, encodeJoseBlob } from '@veramo/utils'
16
16
  // @ts-ignore
17
- import { fromString } from 'uint8arrays/from-string'
17
+ import * as u8a from 'uint8arrays'
18
+ const { fromString } = u8a
18
19
 
19
20
  import {
20
21
  CreateJwsCompactArgs,
@@ -1,4 +1,4 @@
1
- import {
1
+ import type {
2
2
  ExternalIdentifierDidOpts,
3
3
  ExternalIdentifierResult,
4
4
  ExternalIdentifierX5cOpts,
@@ -6,9 +6,9 @@ import {
6
6
  ManagedIdentifierOptsOrResult,
7
7
  ManagedIdentifierResult,
8
8
  } from '@sphereon/ssi-sdk-ext.identifier-resolution'
9
- import { ClientIdScheme } from '@sphereon/ssi-sdk-ext.x509-utils'
10
- import { BaseJWK, IValidationResult, JoseSignatureAlgorithm, JoseSignatureAlgorithmString, JWK } from '@sphereon/ssi-types'
11
- import { IAgentContext, IKeyManager, IPluginMethodMap } from '@veramo/core'
9
+ import type { ClientIdScheme } from '@sphereon/ssi-sdk-ext.x509-utils'
10
+ import type { BaseJWK, IValidationResult, JoseSignatureAlgorithm, JoseSignatureAlgorithmString, JWK } from '@sphereon/ssi-types'
11
+ import type { IAgentContext, IKeyManager, IPluginMethodMap } from '@veramo/core'
12
12
 
13
13
  export type IRequiredContext = IAgentContext<IIdentifierResolution & IKeyManager> // could we still interop with Veramo?
14
14