@metamask/snaps-rpc-methods
Version:
MetaMask Snaps JSON-RPC method implementations
40 lines • 2.2 kB
text/typescript
import type { PermissionSpecificationBuilder, EndowmentGetterParams, PermissionValidatorConstraint, PermissionConstraint, CaveatSpecificationConstraint } from "@metamask/permission-controller";
import { PermissionType } from "@metamask/permission-controller";
import { SnapCaveatType } from "@metamask/snaps-utils";
import type { Json, NonEmptyArray } from "@metamask/utils";
import { SnapEndowments } from "./enum.cjs";
declare const permissionName = SnapEndowments.SignatureInsight;
export declare const signatureInsightEndowmentBuilder: Readonly<{
readonly targetName: SnapEndowments.SignatureInsight;
readonly specificationBuilder: PermissionSpecificationBuilder<PermissionType.Endowment, any, {
permissionType: PermissionType.Endowment;
targetName: typeof permissionName;
endowmentGetter: (_options?: EndowmentGetterParams) => null;
allowedCaveats: Readonly<NonEmptyArray<string>> | null;
validator: PermissionValidatorConstraint;
}>;
}>;
/**
* Map a raw value from the `initialPermissions` to a caveat specification.
* Note that this function does not do any validation, that's handled by the
* PermissionController when the permission is requested.
*
* @param value - The raw value from the `initialPermissions`.
* @returns The caveat specification.
*/
export declare function getSignatureInsightCaveatMapper(value: Json): Pick<PermissionConstraint, 'caveats'>;
/**
* Getter function to get the signature origin caveat from a permission.
*
* This does basic validation of the caveat, but does not validate the type or
* value of the namespaces object itself, as this is handled by the
* `PermissionsController` when the permission is requested.
*
* @param permission - The permission to get the signature origin caveat from.
* @returns The signature origin, or `null` if the permission does not have a
* signature origin caveat.
*/
export declare function getSignatureOriginCaveat(permission?: PermissionConstraint): boolean | null;
export declare const signatureInsightCaveatSpecifications: Record<SnapCaveatType.SignatureOrigin, CaveatSpecificationConstraint>;
export {};
//# sourceMappingURL=signature-insight.d.cts.map