Skip to content

Commit

Permalink
fix: add hologram zone by default and redirect url (#74)
Browse files Browse the repository at this point in the history
  • Loading branch information
lotharking authored Jan 31, 2025
1 parent 0d3b2ee commit c570ca4
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 8 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ but likely needed for production and test deployments.
| AGENT_ENDPOINT | Public endpoint where agent DIDComm endpoints will be accessible (including protocol and port) | ws://localhost:3001 |
| AGENT_ENDPOINTS | List of endpoints where agent DIDComm endpoints will be accessible (including protocol and port), comma separated | ws://localhost:3001 |
| AGENT_INVITATION_IMAGE_URL | Public URL for image to be shown in invitations | none |
| AGENT_INVITATION_BASE_URL | Public URL for fallback when no DIDComm agent is found | https://2060.io/i |
| AGENT_INVITATION_BASE_URL | Public URL for fallback when no DIDComm agent is found | https://hologram.zone/ |
| REDIRECT_DEFAULT_URL_TO_INVITATION_URL | Default redirect to AGENT_INVITATION_BASE_URL | https://hologram.zone/ |
| AGENT_PUBLIC_DID | Agent's public DID (in did:web format) | none |
| AGENT_PORT | Port where DIDComm agent will be running | 3001 |
| AGENT_LOG_LEVEL | Aries Agent Log level | 4 (warn) |
Expand Down
6 changes: 3 additions & 3 deletions doc/service-agent-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -756,7 +756,7 @@ Response from Service Agent is a JSON object containing an URL-encoded invitatio

Note that the following Service Agent configuration environment variables are used when creating invitations:

- AGENT_INVITATION_BASE_URL: Base URL for invitations (e.g. https://2060.io/i)
- AGENT_INVITATION_BASE_URL: Base URL for invitations (e.g. https://hologram.zone/)
- AGENT_INVITATION_IMAGE_URL: An optional image URL to display along the connection invitation
- AGENT_LABEL: An optional label to show along the connection invitation

Expand Down Expand Up @@ -799,7 +799,7 @@ Response will include the invitation code in both short and long form URL format

Note that the following Service Agent configuration environment variables are used when creating presentation request invitations:

- AGENT_INVITATION_BASE_URL: Base URL for long-form invitations (e.g. https://2060.io/i)
- AGENT_INVITATION_BASE_URL: Base URL for long-form invitations (e.g. https://hologram.zone/)
- AGENT_INVITATION_IMAGE_URL: An optional image URL to display along the connection invitation
- AGENT_LABEL: An optional label to show along the connection invitation
- PUBLIC_API_BASE_URL: Base URL for short URL creation (resulting something like https://myHost.com/s?id=<uuid>)
Expand Down Expand Up @@ -851,7 +851,7 @@ Response will include the invitation code in both short and long form URL format

Note that the following Service Agent configuration environment variables are used when creating credential offer invitations:

- AGENT_INVITATION_BASE_URL: Base URL for long-form invitations (e.g. https://2060.io/i)
- AGENT_INVITATION_BASE_URL: Base URL for long-form invitations (e.g. https://hologram.zone/)
- AGENT_INVITATION_IMAGE_URL: An optional image URL to display along the connection invitation
- AGENT_LABEL: An optional label to show along the connection invitation
- PUBLIC_API_BASE_URL: Base URL for short URL creation (resulting something like https://myHost.com/s?id=<uuid>)
Expand Down
2 changes: 1 addition & 1 deletion examples/demo-dts/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ services:
- POSTGRES_USER=gaia
- POSTGRES_PASSWORD=2060demo
- AGENT_WALLET_KEY_DERIVATION_METHOD=ARGON2I_INT
- AGENT_INVITATION_BASE_URL=https://hologram.zone/
- REDIRECT_DEFAULT_URL_TO_INVITATION_URL=true
- REDIS_HOST=redis
volumes:
- ./afj:/root/.afj
Expand Down
2 changes: 1 addition & 1 deletion packages/main/src/controllers/vcauthn/VCAuthNController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ export class VCAuthNController {
invitation: invitation.outOfBandInvitation.toJSON(),
invi_msg_id: invitation.outOfBandInvitation.id,
invitation_url: invitation.outOfBandInvitation.toUrl({
domain: process.env.AGENT_INVITATION_BASE_URL ?? 'https://2060.io/i',
domain: process.env.AGENT_INVITATION_BASE_URL ?? 'https://hologram.zone/',
}),
oob_id: invitation.id,
state: invitation.state,
Expand Down
3 changes: 2 additions & 1 deletion packages/main/src/invitationRoutes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ export const addInvitationRoutes = async (app: express.Express, agent: ServiceAg
// Generate a regular invitation
app.get('/invitation', async (req, res) => {
const { url: invitationUrl } = await createInvitation(agent)
res.send(invitationUrl)
if (process.env.REDIRECT_DEFAULT_URL_TO_INVITATION_URL === 'true') res.redirect(invitationUrl)
else res.send(invitationUrl)
})

// Generate a regular invitation and render it to a QR code
Expand Down
4 changes: 3 additions & 1 deletion packages/main/src/utils/agent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ export async function createInvitation(agent: ServiceAgent, messages?: AgentMess
})
).outOfBandInvitation
return {
url: outOfBandInvitation.toUrl({ domain: process.env.AGENT_INVITATION_BASE_URL ?? 'https://2060.io/i' }),
url: outOfBandInvitation.toUrl({
domain: process.env.AGENT_INVITATION_BASE_URL ?? 'https://hologram.zone/',
}),
}
}

0 comments on commit c570ca4

Please sign in to comment.