Skip to content

Commit

Permalink
chore: remove unnecessary code from credentials API
Browse files Browse the repository at this point in the history
Signed-off-by: Krishna Waske <[email protected]>
  • Loading branch information
GHkrishna committed Dec 3, 2024
1 parent 251a56c commit 6830a7c
Showing 1 changed file with 0 additions and 20 deletions.
20 changes: 0 additions & 20 deletions packages/core/src/modules/credentials/CredentialsApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ import type { CredentialExchangeRecord } from './repository/CredentialExchangeRe
import type { AgentMessage } from '../../agent/AgentMessage'
import type { Query, QueryOptions } from '../../storage/StorageService'

import * as pako from 'pako'

import { AgentContext } from '../../agent'
import { MessageSender } from '../../agent/MessageSender'
import { getOutboundMessageContext } from '../../agent/getOutboundMessageContext'
Expand All @@ -34,7 +32,6 @@ import { CredoError } from '../../error'
import { Logger } from '../../logger'
import { inject, injectable } from '../../plugins'
import { DidCommMessageRepository } from '../../storage/didcomm/DidCommMessageRepository'
import { Buffer } from '../../utils'
import { ConnectionService } from '../connections/services'
import { RoutingService } from '../routing/services/RoutingService'

Expand Down Expand Up @@ -707,21 +704,4 @@ export class CredentialsApi<CPs extends CredentialProtocol[]> implements Credent

return this.getProtocol(credentialExchangeRecord.protocolVersion)
}

private async encodeBitString(bitString: string): Promise<string> {
// Convert the bitString to a Uint8Array
const buffer = new TextEncoder().encode(bitString)
const compressedBuffer = pako.gzip(buffer)
// Convert the compressed buffer to a base64 string
return Buffer.from(compressedBuffer).toString('base64')
}

private async decodeBitSting(bitString: string): Promise<string> {
// Decode base64 string to Uint8Array
const compressedBuffer = Uint8Array.from(atob(bitString), (c) => c.charCodeAt(0))

// Decompress using pako
const decompressedBuffer = pako.ungzip(compressedBuffer, { to: 'string' })
return decompressedBuffer
}
}

0 comments on commit 6830a7c

Please sign in to comment.