send idm with card in requests

This commit is contained in:
ppc
2025-01-14 18:52:08 +00:00
parent a6ad82ffda
commit 0a42a0a912
6 changed files with 15 additions and 23 deletions
+4 -7
View File
@@ -10,6 +10,7 @@ export const MIN_AMNET_API_VERSION = 1;
export interface AMCardInRequest {
cardId: string;
physicalCardIDm?: string;
}
/**
@@ -36,14 +37,10 @@ export interface AMServerInstanceMetrics {
sessionUptime?: number;
}
export interface AMServerPhysicalCardPreferences {
preferredCardIdFormat?: "idm" | "access" | null;
}
/**
* The response from an AMNet server's info endpoint
*/
export type AMServerInfo = AMServerMetadata & AMServerConnectionInfo & AMServerInstanceMetrics & AMServerPhysicalCardPreferences;
export type AMServerInfo = AMServerMetadata & AMServerConnectionInfo & AMServerInstanceMetrics;
/**
* Performs the card-in request to the specified server
@@ -55,7 +52,7 @@ export async function performCardIn(server: AMServerConnectionInfo, request: AMC
if (server.apiVersion < MIN_AMNET_API_VERSION || server.apiVersion > AMNET_API_VERSION) {
throw new Error("Unsupported server API version");
}
try {
const response = await fetch(`${new URL(server.serverAddress).origin}/amnet/signin`, {
method: "POST",
@@ -82,7 +79,7 @@ export async function fetchServerInfo(serverAddress: string, abort: AbortSignal)
const response = await fetch(`${new URL(serverAddress).origin}/amnet/info`, {
signal: abort
});
if (!response.ok) {
return null;
}