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

refactor(oob)!: make label optional #1680

Merged
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
1 change: 0 additions & 1 deletion packages/core/src/modules/oob/OutOfBandService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ export class OutOfBandService {
// initiating the flow
const outOfBandInvitation = new OutOfBandInvitation({
id: did,
label: '',
services: [did],
handshakeProtocols,
})
Expand Down
6 changes: 4 additions & 2 deletions packages/core/src/modules/oob/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,17 @@ export function convertToOldInvitation(newInvitation: OutOfBandInvitation) {
if (typeof service === 'string') {
options = {
id: newInvitation.id,
label: newInvitation.label,
// label is optional
label: newInvitation.label ?? '',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it is optional, why do we still fallback to an empty string?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because it's not optional in an conection protocol invitation, only the oob invitation.

did: service,
imageUrl: newInvitation.imageUrl,
appendedAttachments: newInvitation.appendedAttachments,
}
} else {
options = {
id: newInvitation.id,
label: newInvitation.label,
// label is optional
label: newInvitation.label ?? '',
recipientKeys: service.recipientKeys.map(didKeyToVerkey),
routingKeys: service.routingKeys?.map(didKeyToVerkey),
serviceEndpoint: service.serviceEndpoint,
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/modules/oob/messages/OutOfBandInvitation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { OutOfBandDidCommService } from '../domain/OutOfBandDidCommService'

export interface OutOfBandInvitationOptions {
id?: string
label: string
label?: string
goalCode?: string
goal?: string
accept?: string[]
Expand Down Expand Up @@ -124,7 +124,7 @@ export class OutOfBandInvitation extends AgentMessage {
public readonly type = OutOfBandInvitation.type.messageTypeUri
public static readonly type = parseMessageType('https://didcomm.org/out-of-band/1.1/invitation')

public readonly label!: string
public readonly label?: string

@Expose({ name: 'goal_code' })
public readonly goalCode?: string
Expand Down
3 changes: 0 additions & 3 deletions packages/core/src/utils/parseInvitation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,6 @@ export const parseInvitationShortUrl = async (

// transform into out of band invitation
const invitation = new OutOfBandInvitation({
// The label is currently required by the OutOfBandInvitation class, but not according to the specification.
// FIXME: In 0.5.0 we will make this optional: https://github.com/hyperledger/aries-framework-javascript/issues/1524
label: '',
services: [OutOfBandDidCommService.fromResolvedDidCommService(agentMessage.service.resolvedDidCommService)],
})

Expand Down
Loading