-
Notifications
You must be signed in to change notification settings - Fork 200
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into feat(openid4vc-client)/pre-auth
- Loading branch information
Showing
45 changed files
with
1,372 additions
and
81 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export interface AnonCredsCreateLinkSecretOptions { | ||
linkSecretId?: string | ||
setAsDefault?: boolean | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { AnonCredsError } from './AnonCredsError' | ||
|
||
export class AnonCredsStoreRecordError extends AnonCredsError { | ||
public constructor(message: string, { cause }: { cause?: Error } = {}) { | ||
super(message, { cause }) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
export * from './AnonCredsError' | ||
export * from './AnonCredsStoreRecordError' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,9 @@ | ||
export * from './models' | ||
export * from './services' | ||
export * from './error' | ||
export * from './repository' | ||
export { AnonCredsModule } from './AnonCredsModule' | ||
export { AnonCredsModuleConfig, AnonCredsModuleConfigOptions } from './AnonCredsModuleConfig' | ||
export { AnonCredsApi } from './AnonCredsApi' | ||
export { LegacyIndyCredentialFormatService } from './formats/LegacyIndyCredentialFormatService' | ||
export { AnonCredsRegistryService } from './services/registry/AnonCredsRegistryService' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
packages/anoncreds/src/repository/AnonCredsCredentialDefinitionPrivateRecord.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import type { TagsBase } from '@aries-framework/core' | ||
|
||
import { BaseRecord, utils } from '@aries-framework/core' | ||
|
||
export interface AnonCredsCredentialDefinitionPrivateRecordProps { | ||
id?: string | ||
credentialDefinitionId: string | ||
value: Record<string, unknown> | ||
} | ||
|
||
export type DefaultAnonCredsCredentialDefinitionPrivateTags = { | ||
credentialDefinitionId: string | ||
} | ||
|
||
export class AnonCredsCredentialDefinitionPrivateRecord extends BaseRecord< | ||
DefaultAnonCredsCredentialDefinitionPrivateTags, | ||
TagsBase | ||
> { | ||
public static readonly type = 'AnonCredsCredentialDefinitionPrivateRecord' | ||
public readonly type = AnonCredsCredentialDefinitionPrivateRecord.type | ||
|
||
public readonly credentialDefinitionId!: string | ||
public readonly value!: Record<string, unknown> // TODO: Define structure | ||
|
||
public constructor(props: AnonCredsCredentialDefinitionPrivateRecordProps) { | ||
super() | ||
|
||
if (props) { | ||
this.id = props.id ?? utils.uuid() | ||
this.credentialDefinitionId = props.credentialDefinitionId | ||
this.value = props.value | ||
} | ||
} | ||
|
||
public getTags() { | ||
return { | ||
...this._tags, | ||
credentialDefinitionId: this.credentialDefinitionId, | ||
} | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
packages/anoncreds/src/repository/AnonCredsCredentialDefinitionPrivateRepository.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import type { AgentContext } from '@aries-framework/core' | ||
|
||
import { Repository, InjectionSymbols, StorageService, EventEmitter, injectable, inject } from '@aries-framework/core' | ||
|
||
import { AnonCredsCredentialDefinitionPrivateRecord } from './AnonCredsCredentialDefinitionPrivateRecord' | ||
|
||
@injectable() | ||
export class AnonCredsCredentialDefinitionPrivateRepository extends Repository<AnonCredsCredentialDefinitionPrivateRecord> { | ||
public constructor( | ||
@inject(InjectionSymbols.StorageService) storageService: StorageService<AnonCredsCredentialDefinitionPrivateRecord>, | ||
eventEmitter: EventEmitter | ||
) { | ||
super(AnonCredsCredentialDefinitionPrivateRecord, storageService, eventEmitter) | ||
} | ||
|
||
public async getByCredentialDefinitionId(agentContext: AgentContext, credentialDefinitionId: string) { | ||
return this.getSingleByQuery(agentContext, { credentialDefinitionId }) | ||
} | ||
|
||
public async findByCredentialDefinitionId(agentContext: AgentContext, credentialDefinitionId: string) { | ||
return this.findSingleByQuery(agentContext, { credentialDefinitionId }) | ||
} | ||
} |
50 changes: 50 additions & 0 deletions
50
packages/anoncreds/src/repository/AnonCredsCredentialDefinitionRecord.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import type { AnonCredsCredentialDefinitionRecordMetadata } from './anonCredsCredentialDefinitionRecordMetadataTypes' | ||
import type { AnonCredsCredentialDefinition } from '../models' | ||
import type { TagsBase } from '@aries-framework/core' | ||
|
||
import { BaseRecord, utils } from '@aries-framework/core' | ||
|
||
export interface AnonCredsCredentialDefinitionRecordProps { | ||
id?: string | ||
credentialDefinitionId: string | ||
credentialDefinition: AnonCredsCredentialDefinition | ||
} | ||
|
||
export type DefaultAnonCredsCredentialDefinitionTags = { | ||
schemaId: string | ||
credentialDefinitionId: string | ||
issuerId: string | ||
tag: string | ||
} | ||
|
||
export class AnonCredsCredentialDefinitionRecord extends BaseRecord< | ||
DefaultAnonCredsCredentialDefinitionTags, | ||
TagsBase, | ||
AnonCredsCredentialDefinitionRecordMetadata | ||
> { | ||
public static readonly type = 'AnonCredsCredentialDefinitionRecord' | ||
public readonly type = AnonCredsCredentialDefinitionRecord.type | ||
|
||
public readonly credentialDefinitionId!: string | ||
public readonly credentialDefinition!: AnonCredsCredentialDefinition | ||
|
||
public constructor(props: AnonCredsCredentialDefinitionRecordProps) { | ||
super() | ||
|
||
if (props) { | ||
this.id = props.id ?? utils.uuid() | ||
this.credentialDefinitionId = props.credentialDefinitionId | ||
this.credentialDefinition = props.credentialDefinition | ||
} | ||
} | ||
|
||
public getTags() { | ||
return { | ||
...this._tags, | ||
credentialDefinitionId: this.credentialDefinitionId, | ||
schemaId: this.credentialDefinition.schemaId, | ||
issuerId: this.credentialDefinition.issuerId, | ||
tag: this.credentialDefinition.tag, | ||
} | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
packages/anoncreds/src/repository/AnonCredsCredentialDefinitionRepository.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import type { AgentContext } from '@aries-framework/core' | ||
|
||
import { Repository, InjectionSymbols, StorageService, EventEmitter, injectable, inject } from '@aries-framework/core' | ||
|
||
import { AnonCredsCredentialDefinitionRecord } from './AnonCredsCredentialDefinitionRecord' | ||
|
||
@injectable() | ||
export class AnonCredsCredentialDefinitionRepository extends Repository<AnonCredsCredentialDefinitionRecord> { | ||
public constructor( | ||
@inject(InjectionSymbols.StorageService) storageService: StorageService<AnonCredsCredentialDefinitionRecord>, | ||
eventEmitter: EventEmitter | ||
) { | ||
super(AnonCredsCredentialDefinitionRecord, storageService, eventEmitter) | ||
} | ||
|
||
public async getByCredentialDefinitionId(agentContext: AgentContext, credentialDefinitionId: string) { | ||
return this.getSingleByQuery(agentContext, { credentialDefinitionId }) | ||
} | ||
|
||
public async findByCredentialDefinitionId(agentContext: AgentContext, credentialDefinitionId: string) { | ||
return this.findSingleByQuery(agentContext, { credentialDefinitionId }) | ||
} | ||
} |
41 changes: 41 additions & 0 deletions
41
packages/anoncreds/src/repository/AnonCredsKeyCorrectnessProofRecord.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import type { TagsBase } from '@aries-framework/core' | ||
|
||
import { BaseRecord, utils } from '@aries-framework/core' | ||
|
||
export interface AnonCredsKeyCorrectnessProofRecordProps { | ||
id?: string | ||
credentialDefinitionId: string | ||
value: Record<string, unknown> | ||
} | ||
|
||
export type DefaultAnonCredsKeyCorrectnessProofPrivateTags = { | ||
credentialDefinitionId: string | ||
} | ||
|
||
export class AnonCredsKeyCorrectnessProofRecord extends BaseRecord< | ||
DefaultAnonCredsKeyCorrectnessProofPrivateTags, | ||
TagsBase | ||
> { | ||
public static readonly type = 'AnonCredsKeyCorrectnessProofRecord' | ||
public readonly type = AnonCredsKeyCorrectnessProofRecord.type | ||
|
||
public readonly credentialDefinitionId!: string | ||
public readonly value!: Record<string, unknown> // TODO: Define structure | ||
|
||
public constructor(props: AnonCredsKeyCorrectnessProofRecordProps) { | ||
super() | ||
|
||
if (props) { | ||
this.id = props.id ?? utils.uuid() | ||
this.credentialDefinitionId = props.credentialDefinitionId | ||
this.value = props.value | ||
} | ||
} | ||
|
||
public getTags() { | ||
return { | ||
...this._tags, | ||
credentialDefinitionId: this.credentialDefinitionId, | ||
} | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
packages/anoncreds/src/repository/AnonCredsKeyCorrectnessProofRepository.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import type { AgentContext } from '@aries-framework/core' | ||
|
||
import { Repository, InjectionSymbols, StorageService, EventEmitter, injectable, inject } from '@aries-framework/core' | ||
|
||
import { AnonCredsKeyCorrectnessProofRecord } from './AnonCredsKeyCorrectnessProofRecord' | ||
|
||
@injectable() | ||
export class AnonCredsKeyCorrectnessProofRepository extends Repository<AnonCredsKeyCorrectnessProofRecord> { | ||
public constructor( | ||
@inject(InjectionSymbols.StorageService) storageService: StorageService<AnonCredsKeyCorrectnessProofRecord>, | ||
eventEmitter: EventEmitter | ||
) { | ||
super(AnonCredsKeyCorrectnessProofRecord, storageService, eventEmitter) | ||
} | ||
|
||
public async getByCredentialDefinitionId(agentContext: AgentContext, credentialDefinitionId: string) { | ||
return this.getSingleByQuery(agentContext, { credentialDefinitionId }) | ||
} | ||
|
||
public async findByCredentialDefinitionId(agentContext: AgentContext, credentialDefinitionId: string) { | ||
return this.findSingleByQuery(agentContext, { credentialDefinitionId }) | ||
} | ||
} |
42 changes: 42 additions & 0 deletions
42
packages/anoncreds/src/repository/AnonCredsLinkSecretRecord.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import type { TagsBase } from '@aries-framework/core' | ||
|
||
import { BaseRecord, utils } from '@aries-framework/core' | ||
|
||
export interface AnonCredsLinkSecretRecordProps { | ||
id?: string | ||
linkSecretId: string | ||
value?: string // If value is not provided, only reference to link secret is stored in regular storage | ||
} | ||
|
||
export type DefaultAnonCredsLinkSecretTags = { | ||
linkSecretId: string | ||
} | ||
|
||
export type CustomAnonCredsLinkSecretTags = TagsBase & { | ||
isDefault?: boolean | ||
} | ||
|
||
export class AnonCredsLinkSecretRecord extends BaseRecord<DefaultAnonCredsLinkSecretTags, TagsBase> { | ||
public static readonly type = 'AnonCredsLinkSecretRecord' | ||
public readonly type = AnonCredsLinkSecretRecord.type | ||
|
||
public readonly linkSecretId!: string | ||
public readonly value?: string | ||
|
||
public constructor(props: AnonCredsLinkSecretRecordProps) { | ||
super() | ||
|
||
if (props) { | ||
this.id = props.id ?? utils.uuid() | ||
this.linkSecretId = props.linkSecretId | ||
this.value = props.value | ||
} | ||
} | ||
|
||
public getTags() { | ||
return { | ||
...this._tags, | ||
linkSecretId: this.linkSecretId, | ||
} | ||
} | ||
} |
31 changes: 31 additions & 0 deletions
31
packages/anoncreds/src/repository/AnonCredsLinkSecretRepository.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import type { AgentContext } from '@aries-framework/core' | ||
|
||
import { Repository, InjectionSymbols, StorageService, EventEmitter, injectable, inject } from '@aries-framework/core' | ||
|
||
import { AnonCredsLinkSecretRecord } from './AnonCredsLinkSecretRecord' | ||
|
||
@injectable() | ||
export class AnonCredsLinkSecretRepository extends Repository<AnonCredsLinkSecretRecord> { | ||
public constructor( | ||
@inject(InjectionSymbols.StorageService) storageService: StorageService<AnonCredsLinkSecretRecord>, | ||
eventEmitter: EventEmitter | ||
) { | ||
super(AnonCredsLinkSecretRecord, storageService, eventEmitter) | ||
} | ||
|
||
public async getDefault(agentContext: AgentContext) { | ||
return this.getSingleByQuery(agentContext, { isDefault: true }) | ||
} | ||
|
||
public async findDefault(agentContext: AgentContext) { | ||
return this.findSingleByQuery(agentContext, { isDefault: true }) | ||
} | ||
|
||
public async getByLinkSecretId(agentContext: AgentContext, linkSecretId: string) { | ||
return this.getSingleByQuery(agentContext, { linkSecretId }) | ||
} | ||
|
||
public async findByLinkSecretId(agentContext: AgentContext, linkSecretId: string) { | ||
return this.findSingleByQuery(agentContext, { linkSecretId }) | ||
} | ||
} |
Oops, something went wrong.