Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
vinkabuki committed Nov 15, 2023
1 parent 111adc8 commit c6bcdf9
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 151 deletions.
145 changes: 0 additions & 145 deletions packages/backend/src/nest/storage/acc.ts

This file was deleted.

Empty file.
15 changes: 9 additions & 6 deletions packages/backend/src/nest/storage/certificatesRequestsStore.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { CertificationRequest, getCrypto } from 'pkijs'
import { getCrypto } from 'pkijs'
import { EventEmitter } from 'events'
import EventStore from 'orbit-db-eventstore'
import OrbitDB from 'orbit-db'
Expand Down Expand Up @@ -38,6 +38,8 @@ export class CertificatesRequestsStore {
this.orbitDb = orbitDb
}

// Lock replicated event until previous event is processed by registration service

public resetCsrReplicatedMapAndId() {
this.csrReplicatedPromiseMap = new Map()
this.csrReplicatedPromiseId = 0
Expand Down Expand Up @@ -117,14 +119,15 @@ export class CertificatesRequestsStore {
await this.store.load({ fetchEntryTimeout: 15000 })
}

public getAddress() {
return this.store?.address
}

public async close() {
await this.store?.close()
}

public getAddress() {
return this.store?.address
}

public async addUserCsr(csr: string) {
logger('Adding user csr')
await this.store.add(csr)
Expand All @@ -140,7 +143,7 @@ export class CertificatesRequestsStore {
}
const parsedCsr = await loadCSR(csr)
await parsedCsr.verify()
await this.validateCsr(csr)
await this.validateCsrFormat(csr)

// Validate fields

Expand All @@ -151,7 +154,7 @@ export class CertificatesRequestsStore {
return true
}

private async validateCsr(csr: string) {
private async validateCsrFormat(csr: string) {
const userData = new UserCsrData()
userData.csr = csr
const validationErrors = await validate(userData)
Expand Down

0 comments on commit c6bcdf9

Please sign in to comment.