-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #100 from velocitycareerlabs/VL-8115-nodejs-sample…
…-app-3 cont
- Loading branch information
Showing
31 changed files
with
610 additions
and
44 deletions.
There are no files selected for viewing
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,25 @@ | ||
/** | ||
* Created by Michael Avoyan on 04/07/2024. | ||
* | ||
* Copyright 2022 Velocity Career Labs inc. | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
import { generateOffersDescriptorFromJson, tokenFromString } from "../utils/Converter"; | ||
|
||
export async function checkForOffers(req, reply) { | ||
try { | ||
const offers = await req.vclSdk.checkForOffers( | ||
generateOffersDescriptorFromJson(req.body), | ||
tokenFromString(req.body.sessionToken.value) | ||
); | ||
reply.send(offers); | ||
} catch (e: any) { | ||
reply.code(500).send({ | ||
statusCode: "500", | ||
error: "Failed to check offers", | ||
message: e.message ?? e.stack ?? JSON.stringify(e), | ||
errorCode: e.errorCode, | ||
}); | ||
} | ||
} |
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 @@ | ||
/** | ||
* Created by Michael Avoyan on 04/07/2024. | ||
* | ||
* Copyright 2022 Velocity Career Labs inc. | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
import { generateOffersDescriptorFromJson } from "../utils/Converter"; | ||
|
||
export async function generateOffers(req, reply) { | ||
try { | ||
const offers = await req.vclSdk.generateOffers( | ||
generateOffersDescriptorFromJson(req.body), | ||
); | ||
reply.send(offers); | ||
} catch (e: any) { | ||
reply.code(500).send({ | ||
statusCode: "500", | ||
error: "Failed to generate offers", | ||
message: e.message ?? e.stack ?? JSON.stringify(e), | ||
errorCode: e.errorCode, | ||
}); | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
packages/sample-server/src/controllers/getCredentialManifest.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,26 @@ | ||
/** | ||
* Created by Michael Avoyan on 04/07/2024. | ||
* | ||
* Copyright 2022 Velocity Career Labs inc. | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
import { | ||
credentialManifestDescriptorFromJson | ||
} from "../utils/Converter"; | ||
|
||
export async function getCredentialManifest(req, reply) { | ||
try { | ||
const credentialManifest = await req.vclSdk.getCredentialManifest( | ||
credentialManifestDescriptorFromJson(req.body, req.didJwk) | ||
); | ||
reply.send(credentialManifest); | ||
} catch (e: any) { | ||
reply.code(500).send({ | ||
statusCode: "500", | ||
error: "Failed to search for organizations", | ||
message: e.message ?? e.stack ?? JSON.stringify(e), | ||
errorCode: e.errorCode, | ||
}); | ||
} | ||
} |
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
24 changes: 24 additions & 0 deletions
24
packages/sample-server/src/controllers/searchForOrganizations.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,24 @@ | ||
/** | ||
* Created by Michael Avoyan on 04/07/2024. | ||
* | ||
* Copyright 2022 Velocity Career Labs inc. | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
import { organizationsSearchDescriptorFromJson } from "../utils/Converter"; | ||
|
||
export async function searchForOrganizations(req, reply) { | ||
try { | ||
const organizations = await req.vclSdk.searchForOrganizations( | ||
organizationsSearchDescriptorFromJson(req.body) | ||
); | ||
reply.send(organizations); | ||
} catch (e: any) { | ||
reply.code(500).send({ | ||
statusCode: "500", | ||
error: "Failed to search for organizations", | ||
message: e.message ?? e.stack ?? JSON.stringify(e), | ||
errorCode: e.errorCode, | ||
}); | ||
} | ||
} |
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
Oops, something went wrong.