@microsoft/teams-js
Version:
Microsoft Client SDK for building app for Microsoft hosts
38 lines (37 loc) • 2.08 kB
TypeScript
import { AppId } from '../public/appId';
import { ValidatedSafeString } from '../public/validatedSafeString';
/**
* This function can be used to validate if a string is a "valid" app id.
* Valid is a relative term, in this case. Truly valid app ids are UUIDs as documented in the schema:
* https://learn.microsoft.com/en-us/microsoftteams/platform/resources/schema/manifest-schema#id
* However, there are some older internal/hard-coded apps which violate this schema and use names like com.microsoft.teamspace.tab.youtube.
* For compatibility with these legacy apps, we unfortunately cannot securely and completely validate app ids as UUIDs. Based
* on this, the validation is limited to checking for script tags, length, and non-printable characters.
*
* @param potentialAppId A string to check if it's a "valid" app id
* @throws Error with a message describing the exact validation violation
*/
export declare function validateStringLength(potentialAppId: string): void;
export declare function validateSafeContent(potentialAppId: string): void;
export declare const minimumValidAppIdLength = 4;
export declare const maximumValidAppIdLength = 256;
export declare function isStringWithinAppIdLengthLimits(potentialAppId: string): boolean;
export declare function doesStringContainNonPrintableCharacters(str: string): boolean;
/**
* @hidden
* Checks if the incoming app id is an instance of AppId
* @param potentialAppId An object to check if it's an instance of AppId
* @throws Error with a message describing the violation
* @internal
* Limited to Microsoft-internal use
*/
export declare function validateAppIdInstance(potentialAppId: AppId): void;
/**
* @hidden
* Checks if the incoming string is an instance of ValidatedSafeString
* @param incomingString An object to check if it's an instance of ValidatedSafeString
* @throws Error with a message describing the violation
* @internal
* Limited to Microsoft-internal use
*/
export declare function validateSafeStringInstance(incomingString: ValidatedSafeString): void;