-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add Microsoft Request Service API support
- Loading branch information
Showing
13 changed files
with
177 additions
and
102 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
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
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
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,30 +1,31 @@ | ||
import { IIssueRequest, IIssueRequestResponse } from "./types/IMsRequestApi"; | ||
import { IIssueRequest, IIssueRequestResponse } from './types/IMsRequestApi' | ||
|
||
export async function fetchIssuanceRequestMs(issuanceInfo: IIssueRequest, accessToken: string, msIdentityHostName: string): Promise<IIssueRequestResponse> { | ||
var client_api_request_endpoint = `${msIdentityHostName}${issuanceInfo.authenticationInfo.azTenantId}/verifiablecredentials/request`; | ||
export async function fetchIssuanceRequestMs( | ||
issuanceInfo: IIssueRequest, | ||
accessToken: string, | ||
msIdentityHostName: string | ||
): Promise<IIssueRequestResponse> { | ||
var client_api_request_endpoint = `${msIdentityHostName}${issuanceInfo.authenticationInfo.azTenantId}/verifiablecredentials/request` | ||
|
||
var payload = JSON.stringify(issuanceInfo.issuanceConfig); | ||
const fetchOptions = { | ||
method: 'POST', | ||
body: payload, | ||
headers: { | ||
'Content-Type': 'application/json', | ||
'Content-Length': payload.length.toString(), | ||
'Authorization': `Bearer ${accessToken}` | ||
} | ||
}; | ||
const response = await fetch(client_api_request_endpoint, fetchOptions); | ||
return await response.json(); | ||
var payload = JSON.stringify(issuanceInfo.issuanceConfig) | ||
const fetchOptions = { | ||
method: 'POST', | ||
body: payload, | ||
headers: { | ||
'Content-Type': 'application/json', | ||
'Content-Length': payload.length.toString(), | ||
Authorization: `Bearer ${accessToken}`, | ||
}, | ||
} | ||
const response = await fetch(client_api_request_endpoint, fetchOptions) | ||
return await response.json() | ||
} | ||
|
||
export function generatePin(digits: number) { | ||
var add = 1, max = 12 - add; | ||
max = Math.pow(10, digits + add); | ||
var min = max / 10; // Math.pow(10, n) basically | ||
var number = Math.floor(Math.random() * (max - min + 1)) + min; | ||
return ("" + number).substring(add); | ||
var add = 1, | ||
max = 12 - add | ||
max = Math.pow(10, digits + add) | ||
var min = max / 10 // Math.pow(10, n) basically | ||
var number = Math.floor(Math.random() * (max - min + 1)) + min | ||
return ('' + number).substring(add) | ||
} | ||
|
||
|
||
|
||
|
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
Oops, something went wrong.