Skip to content

Commit

Permalink
chore: update deps
Browse files Browse the repository at this point in the history
  • Loading branch information
nklomp committed Aug 9, 2023
1 parent 6b7c29f commit bae026d
Show file tree
Hide file tree
Showing 19 changed files with 137 additions and 133 deletions.
3 changes: 2 additions & 1 deletion jest.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@
],
"testMatch": [
"**/__tests__/**/*.test.*",
"!**/.yalc/**"
"!**/.yalc/**",
"!dist/*"
],
"globals": {
"ts-jest": {
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@
"@veramo/url-handler": "4.2.0",
"@sphereon/ssi-types": "workspace:^",
"@sphereon/ssi-sdk.core": "workspace:^",
"@sphereon/ssi-sdk-ext.did-provider-key": "0.14.0",
"@noble/hashes": "1.2.0",
"did-jwt": "6.11.6",
"did-jwt-vc": "3.1.3",
Expand Down
8 changes: 4 additions & 4 deletions packages/oid4vci-issuer-rest-api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@
"@sphereon/did-uni-client": "^0.6.0",
"@sphereon/pex": "2.1.0",
"@sphereon/pex-models": "^2.0.3",
"@sphereon/ssi-sdk-ext.did-provider-jwk": "0.13.1-next.10",
"@sphereon/ssi-sdk-ext.key-manager": "0.13.1-next.10",
"@sphereon/ssi-sdk-ext.key-utils": "0.13.1-next.10",
"@sphereon/ssi-sdk-ext.kms-local": "0.13.1-next.10",
"@sphereon/ssi-sdk-ext.did-provider-jwk": "0.14.0",
"@sphereon/ssi-sdk-ext.key-manager": "0.14.0",
"@sphereon/ssi-sdk-ext.key-utils": "0.14.0",
"@sphereon/ssi-sdk-ext.kms-local": "0.14.0",
"@sphereon/ssi-sdk.data-store": "workspace:^",
"@sphereon/ssi-sdk.vc-handler-ld-local": "workspace:^",
"@types/body-parser": "^1.19.2",
Expand Down
2 changes: 1 addition & 1 deletion packages/oid4vci-issuer-store/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
},
"dependencies": {
"@sphereon/oid4vci-common": "0.6.0",
"@sphereon/ssi-sdk-ext.did-utils": "0.13.1-next.10",
"@sphereon/ssi-sdk-ext.did-utils": "0.14.0",
"@sphereon/ssi-sdk.kv-store-temp": "workspace:^",
"@types/uuid": "^9.0.1",
"@veramo/core": "4.2.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/oid4vci-issuer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"dependencies": {
"@sphereon/oid4vci-common": "0.6.0",
"@sphereon/oid4vci-issuer": "0.6.0",
"@sphereon/ssi-sdk-ext.did-utils": "0.13.1-next.10",
"@sphereon/ssi-sdk-ext.did-utils": "0.14.0",
"@sphereon/ssi-sdk.core": "workspace:^",
"@sphereon/ssi-sdk.kv-store-temp": "workspace:^",
"@sphereon/ssi-sdk.oid4vci-issuer-store": "workspace:^",
Expand Down
2 changes: 1 addition & 1 deletion packages/presentation-exchange/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"dependencies": {
"@sphereon/pex": "2.1.0",
"@sphereon/pex-models": "^2.0.3",
"@sphereon/ssi-sdk-ext.did-utils": "0.13.1-next.10",
"@sphereon/ssi-sdk-ext.did-utils": "0.14.0",
"@sphereon/ssi-sdk.kv-store-temp": "workspace:^",
"@sphereon/ssi-types": "workspace:^",
"@veramo/core": "4.2.0"
Expand Down
2 changes: 1 addition & 1 deletion packages/siopv2-oid4vp-op-auth/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"@sphereon/did-auth-siop": "0.3.2-unstable.8",
"@sphereon/pex": "2.1.0",
"@sphereon/pex-models": "2.0.2",
"@sphereon/ssi-sdk-ext.did-utils": "0.13.1-next.10",
"@sphereon/ssi-sdk-ext.did-utils": "0.14.0",
"@sphereon/ssi-sdk.core": "workspace:^",
"@sphereon/ssi-sdk.presentation-exchange": "workspace:^",
"@sphereon/ssi-types": "workspace:^",
Expand Down
2 changes: 1 addition & 1 deletion packages/siopv2-oid4vp-rp-auth/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"dependencies": {
"@sphereon/did-auth-siop": "0.3.2-unstable.8",
"@sphereon/pex": "2.1.0",
"@sphereon/ssi-sdk-ext.did-utils": "0.13.1-next.10",
"@sphereon/ssi-sdk-ext.did-utils": "0.14.0",
"@sphereon/ssi-sdk.core": "workspace:^",
"@sphereon/ssi-sdk.kv-store-temp": "workspace:^",
"@sphereon/ssi-sdk.presentation-exchange": "workspace:^",
Expand Down
2 changes: 1 addition & 1 deletion packages/siopv2-oid4vp-rp-rest-api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"@sphereon/did-uni-client": "^0.6.0",
"@sphereon/pex": "2.1.0",
"@sphereon/pex-models": "^2.0.3",
"@sphereon/ssi-sdk-ext.did-provider-jwk": "0.13.1-next.10",
"@sphereon/ssi-sdk-ext.did-provider-jwk": "0.14.0",
"@sphereon/ssi-sdk.data-store": "workspace:^",
"@sphereon/ssi-sdk.vc-handler-ld-local": "workspace:^",
"@types/body-parser": "^1.19.2",
Expand Down
10 changes: 5 additions & 5 deletions packages/uni-resolver-registrar-api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
"start:dev": "ts-node __tests__/agent.ts"
},
"dependencies": {
"@sphereon/ssi-sdk-ext.did-utils": "0.13.1-next.10",
"@sphereon/ssi-sdk-ext.key-manager": "0.13.1-next.10",
"@sphereon/ssi-sdk-ext.key-utils": "0.13.1-next.10",
"@sphereon/ssi-sdk-ext.did-utils": "0.14.0",
"@sphereon/ssi-sdk-ext.key-manager": "0.14.0",
"@sphereon/ssi-sdk-ext.key-utils": "0.14.0",
"@sphereon/ssi-sdk.core": "workspace:^",
"@sphereon/ssi-express-support": "workspace:^",
"@sphereon/ssi-types": "workspace:^",
Expand All @@ -30,8 +30,8 @@
},
"devDependencies": {
"@sphereon/did-uni-client": "^0.6.0",
"@sphereon/ssi-sdk-ext.did-provider-jwk": "0.13.1-next.10",
"@sphereon/ssi-sdk-ext.did-resolver-jwk": "0.13.1-next.10",
"@sphereon/ssi-sdk-ext.did-provider-jwk": "0.14.0",
"@sphereon/ssi-sdk-ext.did-resolver-jwk": "0.14.0",
"@sphereon/ssi-sdk.data-store": "workspace:^",
"@sphereon/ssi-sdk.vc-handler-ld-local": "workspace:^",
"@types/body-parser": "^1.19.2",
Expand Down
12 changes: 6 additions & 6 deletions packages/vc-handler-ld-local/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
"@sphereon/ed25519-signature-2018": "0.7.0-unstable.6",
"@sphereon/isomorphic-webcrypto": "^2.4.0-unstable.4",
"@noble/hashes": "^1.2.0",
"@sphereon/ssi-sdk-ext.did-utils": "0.13.1-next.10",
"@sphereon/ssi-sdk-ext.key-utils": "0.13.1-next.10",
"@sphereon/ssi-sdk-ext.did-utils": "0.14.0",
"@sphereon/ssi-sdk-ext.key-utils": "0.14.0",
"@sphereon/ssi-sdk.core": "workspace:^",
"@sphereon/ssi-types": "workspace:^",
"@transmute/ed25519-key-pair": "0.7.0-unstable.81",
Expand All @@ -52,10 +52,10 @@
},
"devDependencies": {
"@sphereon/did-uni-client": "^0.6.0",
"@sphereon/ssi-sdk-ext.did-provider-key": "0.13.1-next.10",
"@sphereon/ssi-sdk-ext.did-provider-lto": "0.13.1-next.10",
"@sphereon/ssi-sdk-ext.key-manager": "0.13.1-next.10",
"@sphereon/ssi-sdk-ext.kms-local": "0.13.1-next.10",
"@sphereon/ssi-sdk-ext.did-provider-key": "0.14.0",
"@sphereon/ssi-sdk-ext.did-provider-lto": "0.14.0",
"@sphereon/ssi-sdk-ext.key-manager": "0.14.0",
"@sphereon/ssi-sdk-ext.kms-local": "0.14.0",
"@sphereon/ssi-sdk.agent-config": "workspace:^",
"@transmute/lds-ecdsa-secp256k1-recovery2020": "^0.0.7",
"@types/nock": "^11.1.0",
Expand Down
16 changes: 8 additions & 8 deletions packages/vc-handler-ld-local/src/ld-document-loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export class LdDocumentLoader {
const origUrl = url
if (url.startsWith('#') && verifiableData.issuer !== undefined) {
url = (typeof verifiableData.issuer === 'string' ? verifiableData.issuer : verifiableData.issuer.id) + url
console.log(url)
debug(url)
}
// did resolution
if (url.toLowerCase().startsWith('did:')) {
Expand Down Expand Up @@ -73,17 +73,17 @@ export class LdDocumentLoader {
if (origUrl !== url) {
// Make sure we replace the result URLs with the original URLs, so framing keeps working
didDoc = JSON.parse(JSON.stringify(didDoc).replace(url, origUrl)) as DIDDocument
console.log('CHANGED:')
console.log(didDoc)
debug('CHANGED:')
debug(didDoc)
}

// Apparently we got a whole DID document, but we are looking for a verification method
// We use origUrl here, as that is how it was used in the VM
const component = await context.agent.getDIDComponentById({ didDocument: didDoc, didUrl: origUrl })
console.log('Component:')
console.log(component)
console.log('Component stringified:')
console.log(JSON.stringify(component))
debug('Component:')
debug(component)
debug('Component stringified:')
debug(JSON.stringify(component))
if (component && typeof component !== 'string' && component.id) {
// We have to provide a context
const contexts = this.ldSuiteLoader
Expand Down Expand Up @@ -138,7 +138,7 @@ export class LdDocumentLoader {
}
}

console.log(`WARNING: Possible unknown context/identifier for ${url} \n falling back to default documentLoader`)
debug(`WARNING: Possible unknown context/identifier for ${url} \n falling back to default documentLoader`)

return vc.defaultDocumentLoader(url)
})
Expand Down
2 changes: 1 addition & 1 deletion packages/vc-handler-ld-local/src/ld-suites.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {ISphereonKeyManager} from "@sphereon/ssi-sdk-ext.key-manager";
import { ISphereonKeyManager } from '@sphereon/ssi-sdk-ext.key-manager'
import { CredentialPayload, IAgentContext, IKey, IResolver, PresentationPayload, TKeyType, VerifiableCredential } from '@veramo/core'
import { DIDDocument } from 'did-resolver/lib/resolver'

Expand Down
17 changes: 6 additions & 11 deletions packages/vc-handler-ld-local/src/suites/JsonWebSignature2020.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,17 @@
import { JwkKeyUse, toJwk } from '@sphereon/ssi-sdk-ext.key-utils'
import { IProof, IVerifiableCredential } from '@sphereon/ssi-types'
import {
CredentialPayload,
DIDDocument,
IAgentContext,
IKey,
PresentationPayload,
TKeyType,
VerifiableCredential
} from '@veramo/core'
import { CredentialPayload, DIDDocument, IAgentContext, IKey, PresentationPayload, TKeyType, VerifiableCredential } from '@veramo/core'
import { asArray, encodeJoseBlob } from '@veramo/utils'
import Debug from 'debug'
import * as u8a from 'uint8arrays'

import { RequiredAgentMethods, SphereonLdSignature } from '../ld-suites'

import { JsonWebKey } from './impl/JsonWebKeyWithRSASupport'
import { JsonWebSignature } from './impl/JsonWebSignatureWithRSASupport'

const debug = Debug('sphereon:ssi-sdk:ld-credential-module-local')

/**
* Veramo wrapper for the JsonWebSignature2020 suite by Transmute Industries
*
Expand Down Expand Up @@ -60,14 +55,14 @@ export class SphereonJsonWebSignature2020 extends SphereonLdSignature {
const headerString = encodeJoseBlob(header)
const messageBuffer = u8a.concat([u8a.fromString(`${headerString}.`, 'utf-8'), args.data])
const messageString = u8a.toString(messageBuffer, 'base64')
console.log(`#Create MessageBuffer: ${messageString}`)
debug(`#Create MessageBuffer: ${messageString}`)
const signature = await context.agent.keyManagerSign({
keyRef: key.kid,
algorithm: alg,
data: messageString,
encoding: 'base64',
})
console.log(`#Create signature: ${signature}`)
debug(`#Create signature: ${signature}`)
return `${headerString}..${signature}`
},
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
// import crypto from '@sphereon/isomorphic-webcrypto'
import crypto from '@sphereon/isomorphic-webcrypto'
import { Ed25519KeyPair, Ed25519VerificationKey2018 } from '@transmute/ed25519-key-pair'
import { JWS } from '@transmute/jose-ld'
import { EcdsaSecp256k1VerificationKey2019, Secp256k1KeyPair } from '@transmute/secp256k1-key-pair'

import { JsonWebKey as JWK } from 'did-resolver'
// eslint-disable-next-line @typescript-eslint/no-var-requires
const crypto = require('@sphereon/isomorphic-webcrypto')

const subtle = crypto.subtle
// export const subtle: SubtleCrypto = typeof window !== 'undefined' && typeof jest === 'undefined' ? window.crypto.subtle : crypto.subtle

import { JsonWebKey2020, P256Key2021, P384Key2021, P521Key2021, WebCryptoKey } from '@transmute/web-crypto-key-pair'
// import { JsonWebKey, JsonWebSignature } from "@transmute/json-web-signature";
import Debug from 'debug'

export { JsonWebKey2020 }

const debug = Debug('sphereon:ssi-sdk:ld-credential-module-local')

const getKeyPairForKtyAndCrv = (kty: string, crv: string) => {
if (kty === 'OKP') {
if (crv === 'Ed25519') {
Expand Down Expand Up @@ -179,6 +178,7 @@ export class JsonWebKey {
) => {
let kp: any | undefined
if (k.type === 'JsonWebKey2020') {
debug('Importing RSA key using crypto.subtle')
const jwk = k.publicKeyJwk as JWK
if (jwk.kty === 'RSA') {
const publicKey: CryptoKey = await subtle.importKey(
Expand All @@ -204,6 +204,7 @@ export class JsonWebKey {
}
}
if (!kp) {
debug(`Using getKeyPairForType for ${k.type} ${k.id}`)
const KeyPair = getKeyPairForType(k)
kp = await KeyPair.from(k as any)
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
import crypto from '@sphereon/isomorphic-webcrypto'
import { sha256 } from '@noble/hashes/sha256'
import { Verifier } from '@transmute/jose-ld'
import sec from '@transmute/security-context'
import {decodeJoseBlob} from '@veramo/utils'
import { decodeJoseBlob } from '@veramo/utils'
import { JWTHeader } from 'did-jwt'
import Debug from 'debug'

// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
import jsonld from 'jsonld'
import * as u8a from 'uint8arrays'

import { JsonWebKey } from './JsonWebKeyWithRSASupport'

// eslint-disable-next-line @typescript-eslint/no-var-requires
const crypto = require('@sphereon/isomorphic-webcrypto')

const subtle = crypto.subtle

const debug = Debug('sphereon:ssi-sdk:ld-credential-module-local')

export function hash(payload: string | Uint8Array): Uint8Array {
const data = typeof payload === 'string' ? u8a.fromString(payload) : payload
return sha256(data)
Expand Down Expand Up @@ -87,7 +89,7 @@ export class JsonWebSignature {
expansionMap,
})
const verifyData = u8a.concat([hash(c14nProof), hash(c14nDocument)])
console.log(`===Verify DATA: ${u8a.toString(verifyData, 'base64')}`)
debug(`===Verify DATA: ${u8a.toString(verifyData, 'base64')}`)
return verifyData
}

Expand All @@ -106,7 +108,7 @@ export class JsonWebSignature {
saltLength = 32
}
} catch (error) {
console.log(error)
debug(error)
if (proof.verificationMethod.startsWith('did:web')) {
saltLength = 32
}
Expand Down Expand Up @@ -257,8 +259,8 @@ export class JsonWebSignature {
const header = decodeJoseBlob(headerString) as JWTHeader
const messageBuffer = u8a.concat([u8a.fromString(`${headerString}.`, 'utf-8'), verifyData])
const messageString = u8a.toString(messageBuffer, 'base64')
console.log(`#VERIFY MessageBuffer: ${messageString}`)
console.log(`#VERIFY Signature: ${signature}`)
debug(`#VERIFY MessageBuffer: ${messageString}`)
debug(`#VERIFY Signature: ${signature}`)
const algName = verificationMethod.publicKey.algorithm.name ?? key?.algorithm?.name ?? header?.alg ?? 'RSA-PSS'
return await subtle.verify(
algName === 'RSA-PSS'
Expand Down
6 changes: 4 additions & 2 deletions packages/vc-handler-ld-local/src/types/types.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { purposes } from '@digitalcredentials/jsonld-signatures'
import {ISphereonKeyManager} from "@sphereon/ssi-sdk-ext.key-manager";
import { ISphereonKeyManager } from '@sphereon/ssi-sdk-ext.key-manager'
import {
CredentialPayload,
IAgentContext,
Expand Down Expand Up @@ -163,7 +163,9 @@ export interface IVerifyPresentationLDArgs {
*
* @beta This API is likely to change without a BREAKING CHANGE notice
*/
export type IRequiredContext = IAgentContext<IResolver & IDIDManager & Pick<ISphereonKeyManager, 'keyManagerGet' | 'keyManagerSign' | 'keyManagerVerify'>>
export type IRequiredContext = IAgentContext<
IResolver & IDIDManager & Pick<ISphereonKeyManager, 'keyManagerGet' | 'keyManagerSign' | 'keyManagerVerify'>
>

export type ContextDoc = {
'@context': string | Record<string, any>
Expand Down
4 changes: 2 additions & 2 deletions packages/w3c-vc-api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
},
"devDependencies": {
"@sphereon/did-uni-client": "^0.6.0",
"@sphereon/ssi-sdk-ext.did-provider-jwk": "0.13.1-next.10",
"@sphereon/ssi-sdk-ext.did-resolver-jwk": "0.13.1-next.10",
"@sphereon/ssi-sdk-ext.did-provider-jwk": "0.14.0",
"@sphereon/ssi-sdk-ext.did-resolver-jwk": "0.14.0",
"@sphereon/ssi-sdk.data-store": "workspace:^",
"@sphereon/ssi-sdk.vc-handler-ld-local": "workspace:^",
"@types/body-parser": "^1.19.2",
Expand Down
Loading

0 comments on commit bae026d

Please sign in to comment.