Skip to content

Commit

Permalink
fix: imports from core (openwallet-foundation#1303)
Browse files Browse the repository at this point in the history
Signed-off-by: Ariel Gentile <gentilester@gmail.com>
  • Loading branch information
genaris committed Feb 15, 2023
1 parent 4ac5332 commit 3e02227
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 53 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import {
AnonCredsLinkSecretRepository,
AnonCredsCredentialRepository,
} from '@aries-framework/anoncreds'
import { injectable } from '@aries-framework/core'
import { utils, injectable } from '@aries-framework/core'
import {
CredentialRequestMetadata,
Credential,
Expand All @@ -40,7 +40,6 @@ import {
Schema,
} from '@hyperledger/anoncreds-shared'

import { uuid } from '../../../core/src/utils/uuid'
import { AnonCredsRsError } from '../errors/AnonCredsRsError'

@injectable()
Expand All @@ -51,7 +50,7 @@ export class AnonCredsRsHolderService implements AnonCredsHolderService {
): Promise<CreateLinkSecretReturn> {
try {
return {
linkSecretId: options?.linkSecretId ?? uuid(),
linkSecretId: options?.linkSecretId ?? utils.uuid(),
linkSecretValue: JSON.parse(MasterSecret.create().toJson()).value.ms,
}
} catch (error) {
Expand Down Expand Up @@ -230,7 +229,7 @@ export class AnonCredsRsHolderService implements AnonCredsHolderService {
? RevocationRegistryDefinition.load(JSON.stringify(revocationRegistry.definition))
: undefined

const credentialId = options.credentialId ?? uuid()
const credentialId = options.credentialId ?? utils.uuid()
const processedCredential = Credential.load(JSON.stringify(credential)).process({
credentialDefinition: CredentialDefinition.load(JSON.stringify(credentialDefinition)),
credentialRequestMetadata: CredentialRequestMetadata.load(JSON.stringify(credentialRequestMetadata)),
Expand Down
44 changes: 0 additions & 44 deletions packages/askar/src/AskarModuleConfig.ts

This file was deleted.

1 change: 0 additions & 1 deletion packages/askar/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,3 @@ export { AskarStorageService } from './storage'

// Module
export { AskarModule } from './AskarModule'
export { AskarModuleConfig } from './AskarModuleConfig'
5 changes: 2 additions & 3 deletions packages/askar/src/wallet/AskarWallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ const isError = (error: unknown): error is Error => error instanceof Error

import { inject, injectable } from 'tsyringe'

import { encodeToBase58, decodeFromBase58 } from '../../../core/src/utils/base58'
import {
askarErrors,
isAskarError,
Expand Down Expand Up @@ -364,7 +363,7 @@ export class AskarWallet implements Wallet {
const key = seed ? AskarKey.fromSeed({ seed: Buffer.from(seed), algorithm }) : AskarKey.generate(algorithm)

// Store key
await this.session.insertKey({ key, name: encodeToBase58(key.publicBytes) })
await this.session.insertKey({ key, name: TypedArrayEncoder.toBase58(key.publicBytes) })
return Key.fromPublicKey(key.publicBytes, keyType)
} else {
// Check if there is a signing key provider for the specified key type.
Expand Down Expand Up @@ -633,7 +632,7 @@ export class AskarWallet implements Wallet {
)
const sender_x = AskarKey.fromPublicBytes({
algorithm: KeyAlgs.Ed25519,
publicKey: decodeFromBase58(senderKey),
publicKey: TypedArrayEncoder.fromBase58(senderKey),
}).convertkey({ algorithm: KeyAlgs.X25519 })

payloadKey = CryptoBox.open({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { WalletStorageConfig } from '../../../core/src/types'
import type { WalletStorageConfig } from '@aries-framework/core'

export interface AskarWalletPostgresConfig {
host: string
Expand Down
1 change: 1 addition & 0 deletions packages/core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export type {
JsonValue,
WalletConfigRekey,
WalletExportImportConfig,
WalletStorageConfig,
} from './types'
export { DidCommMimeType, KeyDerivationMethod } from './types'
export type { FileSystem, DownloadToFileOptions } from './storage/FileSystem'
Expand Down

0 comments on commit 3e02227

Please sign in to comment.