Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(credentials): default for credentials in exchange record #816

Merged
merged 7 commits into from
May 31, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export class CredentialExchangeRecord extends BaseRecord<
public revocationNotification?: RevocationNotification
public errorMessage?: string
public protocolVersion!: CredentialProtocolVersion
public credentials!: CredentialRecordBinding[]
public credentials: CredentialRecordBinding[] = []

@Type(() => CredentialPreviewAttribute)
public credentialAttributes?: CredentialPreviewAttribute[]
Expand All @@ -75,7 +75,6 @@ export class CredentialExchangeRecord extends BaseRecord<

public constructor(props: CredentialExchangeRecordProps) {
super()

if (props) {
this.id = props.id ?? uuid()
this.createdAt = props.createdAt ?? new Date()
Expand All @@ -96,10 +95,8 @@ export class CredentialExchangeRecord extends BaseRecord<

public getTags() {
const metadata = this.metadata.get(CredentialMetadataKeys.IndyCredential)
let ids: string[] = []
if (this.credentials) {
ids = this.credentials.map((c) => c.credentialRecordId)
}
const ids = this.credentials.map((c) => c.credentialRecordId)

return {
...this._tags,
threadId: this.threadId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1596,6 +1596,7 @@ Object {
"thid": "578e73da-c3be-43d4-949b-7aadfd5a6eae",
},
},
"credentials": Array [],
"id": "574b2a37-1db1-4af1-a3bf-35c6cb9e1d7a",
"metadata": Object {
"_internal/indyCredential": Object {
Expand Down Expand Up @@ -1707,6 +1708,7 @@ Object {
"thid": "578e73da-c3be-43d4-949b-7aadfd5a6eae",
},
},
"credentials": Array [],
"id": "5f2b7bc7-edfd-47e7-a1d4-aae050df2c4a",
"metadata": Object {
"_internal/indyCredential": Object {
Expand Down Expand Up @@ -1835,6 +1837,7 @@ Object {
"thid": "e2c2194c-6ac6-4b27-9030-18887c79b5eb",
},
},
"credentials": Array [],
"id": "ad644d8a-48a2-4c55-b46d-7a7f1a9278c7",
"metadata": Object {
"_internal/indyCredential": Object {
Expand Down Expand Up @@ -1946,6 +1949,7 @@ Object {
"thid": "e2c2194c-6ac6-4b27-9030-18887c79b5eb",
},
},
"credentials": Array [],
"id": "c7e0a752-7f1c-41c0-b0ae-a68c2d97ca8c",
"metadata": Object {
"_internal/indyCredential": Object {
Expand Down Expand Up @@ -2068,6 +2072,7 @@ Object {
"thid": "578e73da-c3be-43d4-949b-7aadfd5a6eae",
},
},
"credentials": Array [],
"id": "574b2a37-1db1-4af1-a3bf-35c6cb9e1d7a",
"metadata": Object {
"_internal/indyCredential": Object {
Expand Down Expand Up @@ -2179,6 +2184,7 @@ Object {
"thid": "578e73da-c3be-43d4-949b-7aadfd5a6eae",
},
},
"credentials": Array [],
"id": "5f2b7bc7-edfd-47e7-a1d4-aae050df2c4a",
"metadata": Object {
"_internal/indyCredential": Object {
Expand Down Expand Up @@ -2307,6 +2313,7 @@ Object {
"thid": "e2c2194c-6ac6-4b27-9030-18887c79b5eb",
},
},
"credentials": Array [],
"id": "ad644d8a-48a2-4c55-b46d-7a7f1a9278c7",
"metadata": Object {
"_internal/indyCredential": Object {
Expand Down Expand Up @@ -2418,6 +2425,7 @@ Object {
"thid": "e2c2194c-6ac6-4b27-9030-18887c79b5eb",
},
},
"credentials": Array [],
"id": "c7e0a752-7f1c-41c0-b0ae-a68c2d97ca8c",
"metadata": Object {
"_internal/indyCredential": Object {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ Array [
"thid": "578e73da-c3be-43d4-949b-7aadfd5a6eae",
},
},
"credentials": Array [],
"id": "574b2a37-1db1-4af1-a3bf-35c6cb9e1d7a",
"metadata": Object {
"_internal/indyCredential": Object {
Expand Down Expand Up @@ -149,6 +150,7 @@ Array [
"thid": "578e73da-c3be-43d4-949b-7aadfd5a6eae",
},
},
"credentials": Array [],
"id": "5f2b7bc7-edfd-47e7-a1d4-aae050df2c4a",
"metadata": Object {
"_internal/indyCredential": Object {
Expand Down Expand Up @@ -259,6 +261,7 @@ Array [
"thid": "e2c2194c-6ac6-4b27-9030-18887c79b5eb",
},
},
"credentials": Array [],
"id": "ad644d8a-48a2-4c55-b46d-7a7f1a9278c7",
"metadata": Object {
"_internal/indyCredential": Object {
Expand Down Expand Up @@ -363,6 +366,7 @@ Array [
"thid": "e2c2194c-6ac6-4b27-9030-18887c79b5eb",
},
},
"credentials": Array [],
"id": "c7e0a752-7f1c-41c0-b0ae-a68c2d97ca8c",
"metadata": Object {
"_internal/indyCredential": Object {
Expand Down