@animo-id/oauth2-utils
Advanced tools
Comparing version 0.0.2-alpha-20241107082629 to 0.0.2-alpha-20241107122357
@@ -103,3 +103,3 @@ import * as v from 'valibot'; | ||
declare const vHttpsUrl: v.SchemaWithPipe<[v.StringSchema<undefined>, v.UrlAction<string, undefined>, v.StartsWithAction<string, "https://", undefined>]>; | ||
declare const vHttpsUrl: v.SchemaWithPipe<[v.StringSchema<undefined>, v.UrlAction<string, undefined>, v.CheckAction<string, "url must be an https:// url">]>; | ||
declare const vInteger: v.SchemaWithPipe<[v.NumberSchema<undefined>, v.IntegerAction<number, undefined>]>; | ||
@@ -138,2 +138,13 @@ declare const vHttpMethod: v.PicklistSchema<["GET", "POST", "PUT", "DELETE", "HEAD", "OPTIONS", "TRACE", "CONNECT", "PATCH"], undefined>; | ||
export { type BaseSchema, ContentType, type Fetch, type FetchHeaders, type FetchRequestInit, type FetchResponse, _Headers as Headers, type HttpMethod, type InferOutputUnion, JsonParseError, type Optional, type Simplify, _URL as URL, _URLSearchParams as URLSearchParams, type ValibotFetcher, ValidationError, type WwwAuthenticateHeaderChallenge, addSecondsToDate, arrayEqualsIgnoreOrder, createValibotFetcher, dateToSeconds, decodeBase64, decodeUtf8String, defaultFetcher, encodeToBase64, encodeToBase64Url, encodeToUtf8String, encodeWwwAuthenticateHeader, getQueryParams, joinUriParts, mergeDeep, objectToQueryParams, parseWithErrorHandling, parseWwwAuthenticateHeader, stringToJsonWithErrorHandling, vHttpMethod, vHttpsUrl, vInteger, valibotRecursiveFlattenIssues }; | ||
interface Oid4vcTsConfig { | ||
/** | ||
* Whether to allow insecure http urls. | ||
* | ||
* @default false | ||
*/ | ||
allowInsecureUrls: boolean; | ||
} | ||
declare function setGlobalConfig(config: Oid4vcTsConfig): void; | ||
declare function getGlobalConfig(): Oid4vcTsConfig; | ||
export { type BaseSchema, ContentType, type Fetch, type FetchHeaders, type FetchRequestInit, type FetchResponse, _Headers as Headers, type HttpMethod, type InferOutputUnion, JsonParseError, type Oid4vcTsConfig, type Optional, type Simplify, _URL as URL, _URLSearchParams as URLSearchParams, type ValibotFetcher, ValidationError, type WwwAuthenticateHeaderChallenge, addSecondsToDate, arrayEqualsIgnoreOrder, createValibotFetcher, dateToSeconds, decodeBase64, decodeUtf8String, defaultFetcher, encodeToBase64, encodeToBase64Url, encodeToUtf8String, encodeWwwAuthenticateHeader, getGlobalConfig, getQueryParams, joinUriParts, mergeDeep, objectToQueryParams, parseWithErrorHandling, parseWwwAuthenticateHeader, setGlobalConfig, stringToJsonWithErrorHandling, vHttpMethod, vHttpsUrl, vInteger, valibotRecursiveFlattenIssues }; |
@@ -50,2 +50,3 @@ "use strict"; | ||
encodeWwwAuthenticateHeader: () => encodeWwwAuthenticateHeader, | ||
getGlobalConfig: () => getGlobalConfig, | ||
getQueryParams: () => getQueryParams, | ||
@@ -57,2 +58,3 @@ joinUriParts: () => joinUriParts, | ||
parseWwwAuthenticateHeader: () => parseWwwAuthenticateHeader, | ||
setGlobalConfig: () => setGlobalConfig, | ||
stringToJsonWithErrorHandling: () => stringToJsonWithErrorHandling, | ||
@@ -232,3 +234,23 @@ vHttpMethod: () => vHttpMethod, | ||
var v3 = __toESM(require("valibot")); | ||
var vHttpsUrl = v3.pipe(v3.string(), v3.url(), v3.startsWith("https://")); | ||
// src/config.ts | ||
var GLOBAL_CONFIG = { | ||
allowInsecureUrls: false | ||
}; | ||
function setGlobalConfig(config) { | ||
GLOBAL_CONFIG = config; | ||
} | ||
function getGlobalConfig() { | ||
return GLOBAL_CONFIG; | ||
} | ||
// src/validation.ts | ||
var vHttpsUrl = v3.pipe( | ||
v3.string(), | ||
v3.url(), | ||
v3.check((url2) => { | ||
const { allowInsecureUrls } = getGlobalConfig(); | ||
return allowInsecureUrls ? url2.startsWith("http://") || url2.startsWith("https://") : url2.startsWith("https://"); | ||
}, "url must be an https:// url") | ||
); | ||
var vInteger = v3.pipe(v3.number(), v3.integer()); | ||
@@ -326,2 +348,3 @@ var vHttpMethod = v3.picklist(["GET", "POST", "PUT", "DELETE", "HEAD", "OPTIONS", "TRACE", "CONNECT", "PATCH"]); | ||
encodeWwwAuthenticateHeader, | ||
getGlobalConfig, | ||
getQueryParams, | ||
@@ -333,2 +356,3 @@ joinUriParts, | ||
parseWwwAuthenticateHeader, | ||
setGlobalConfig, | ||
stringToJsonWithErrorHandling, | ||
@@ -335,0 +359,0 @@ vHttpMethod, |
{ | ||
"name": "@animo-id/oauth2-utils", | ||
"version": "0.0.2-alpha-20241107082629", | ||
"version": "0.0.2-alpha-20241107122357", | ||
"exports": { | ||
@@ -5,0 +5,0 @@ ".": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
74621
747