updates
This commit is contained in:
@@ -1251,17 +1251,17 @@ export async function fetchFileWithCache(
|
||||
}
|
||||
|
||||
interface AlibabaCloudInstanceIdentityAudienceMeta {
|
||||
version: 1 | number;
|
||||
issuedAtMs: number;
|
||||
expiresAtMs: number;
|
||||
purpose: string;
|
||||
ver: 1 | number;
|
||||
iat: number;
|
||||
exp: number;
|
||||
aud: string;
|
||||
}
|
||||
|
||||
export type AlibabaCloudInstanceIdentityMode = "normal" | "secured";
|
||||
|
||||
// https://help.aliyun.com/zh/ecs/user-guide/use-instance-identities
|
||||
export async function fetchAlibabaCloudInstanceIdentityV1(
|
||||
purpose: string,
|
||||
audience: string,
|
||||
mode?: AlibabaCloudInstanceIdentityMode,
|
||||
): Promise<string> {
|
||||
let metaDataToken = null;
|
||||
@@ -1286,10 +1286,10 @@ export async function fetchAlibabaCloudInstanceIdentityV1(
|
||||
metaDataToken = await tokenResponse.text();
|
||||
}
|
||||
const audienceMeta = {
|
||||
version: 1,
|
||||
issuedAtMs: Date.now(),
|
||||
expiresAtMs: Date.now() + 60 * 1000,
|
||||
purpose: purpose,
|
||||
ver: 1,
|
||||
iat: Math.floor(Date.now() / 1000),
|
||||
exp: Math.floor(Date.now() / 1000) + 60,
|
||||
aud: audience,
|
||||
} as AlibabaCloudInstanceIdentityAudienceMeta;
|
||||
const pkcs7Options = {};
|
||||
if (metaDataToken) {
|
||||
@@ -1328,7 +1328,7 @@ export async function getSecretValueViaAlibabaCloudInstanceIdentity(
|
||||
mode?: AlibabaCloudInstanceIdentityMode,
|
||||
): Promise<string> {
|
||||
const pkcs7 = await fetchAlibabaCloudInstanceIdentityV1(
|
||||
"access_hatter_ink",
|
||||
"hatter.ink",
|
||||
mode,
|
||||
);
|
||||
const httpSecretResponse = await fetchDataWithTimeout(
|
||||
|
||||
@@ -7,7 +7,7 @@ import {
|
||||
getSecretValue,
|
||||
log,
|
||||
stdinToArrayBuffer,
|
||||
} from "https://script.hatter.ink/@54/deno-commons-mod.ts";
|
||||
} from "https://script.hatter.ink/@55/deno-commons-mod.ts";
|
||||
import {parseArgs} from "jsr:@std/cli/parse-args";
|
||||
|
||||
// specification: https://docs.openclaw.ai/gateway/secrets
|
||||
|
||||
Reference in New Issue
Block a user