FrameClient

new FrameClient({
target,
timeout
})

FrameClient is a client that looks to the user like an ElvClient, but works by passing messages to another frame with an actual ElvClient instead of making the calls itself.

The purpose of this is to isolate users' private keys and the usage thereof in one trusted application, while still allowing other (possibly less trustworthy) applications to communicate with the content fabric on behalf of the user from a sandboxed IFrame.

FrameClient has available almost all of the same methods as ElvClient, and should be transparently interchangable with it from a usage perspective.

The methods available in FrameClient are generated automatically from ElvClient. These methods will use a messaging protocol to communicate intent to a specified frame, which can listen for such messages, perform the actions using the real ElvClient, and return the results via a response message.

Because the privileged frame is doing the actual work, it may decide to allow or disallow any actions it sees fit - for example, limiting a dependent app to a few safe calls while preventing it from making any significant changes.

The most important aspect of this architecture is to prevent leaking of users' private keys. Be careful when setting up a project using this architecture - make sure the untrusted app is properly contained in a sandboxed IFrame and served from a different origin than the privileged app.

See:
  • test/frames/Parent.html and test/frames/Client.html for an example setup using this scheme
Parameters:
Name Type Description
target Object

The window or frame that will listen for messages produced by this client

timeout number

How long to wait for a response after calling a method before giving up and generating a timeout error

Source:

Methods

AllowedMethods() → Array.<string>

Returns: List of ElvClient methods available to a FrameClient
Example
 AllowedMethods();


[
  "AccessGroupManagers",
  "AccessGroupMembers",
  "AccessGroupOwner",
  "AccessInfo",
  "AccessRequest",
  "AccessType",
  "AddAccessGroupManager",
  "AddAccessGroupMember",
  "AddContentLibraryGroup",
  "AddContentObjectGroupPermission",
  "AddLibraryContentType",
  "AssetMetadata",
  "AvailableDRMs",
  "AvailableOfferings",
  "AwaitPending",
  "BitmovinPlayoutOptions",
  "BlockNumber",
  "CallBitcodeMethod",
  "CallContractMethod",
  "CallContractMethodAndWait",
  "ClearCache",
  "Collection",
  "ConfigUrl",
  "ContentLibraries",
  "ContentLibrary",
  "ContentLibraryGroupPermissions",
  "ContentLibraryOwner",
  "ContentObject",
  "ContentObjectAccessComplete",
  "ContentObjectGraph",
  "ContentObjectGroupPermissions",
  "ContentObjectImageUrl",
  "ContentObjectLibraryId",
  "ContentObjectMetadata",
  "ContentObjectOwner",
  "ContentObjectVersions",
  "ContentObjects",
  "ContentPart",
  "ContentParts",
  "ContentSpaceId",
  "ContentType",
  "ContentTypeOwner",
  "ContentTypes",
  "ContractAbi",
  "ContractEvents",
  "ContractMetadata",
  "ContractName",
  "CopyContentObject",
  "CreateABRMezzanine",
  "CreateAccessGroup",
  "CreateAndFinalizeContentObject",
  "CreateContentLibrary",
  "CreateContentObject",
  "CreateContentType",
  "CreateEncryptionConk",
  "CreateFileDirectories",
  "CreateFileUploadJob",
  "CreateLinks",
  "CreateNTPInstance",
  "CreatePart",
  "CreateProductionMaster",
  "CreateSignedToken",
  "CurrentAccountAddress",
  "CustomContractAddress",
  "Decrypt",
  "DecryptECIES",
  "DefaultKMSAddress",
  "DeleteAccessGroup",
  "DeleteContentLibrary",
  "DeleteContentObject",
  "DeleteContentVersion",
  "DeleteFiles",
  "DeleteMetadata",
  "DeleteNTPInstance",
  "DeletePart",
  "DeployContract",
  "Download",
  "DownloadEncrypted",
  "DownloadFile",
  "DownloadPart",
  "EditAndFinalizeContentObject",
  "EditContentObject",
  "Encrypt",
  "EncryptECIES",
  "EncryptionConk",
  "Events",
  "ExtractEventFromLogs",
  "ExtractValueFromEvent",
  "FabricUrl",
  "FileUrl",
  "FinalizeABRMezzanine",
  "FinalizeContentObject",
  "FinalizePart",
  "FinalizeStateChannelAccess",
  "FinalizeUploadJob",
  "FormatContractArguments",
  "GenerateStateChannelToken",
  "GetBalance",
  "InitializeAuthPolicy",
  "IssueNTPCode",
  "LatestVersionHash",
  "LibraryContentTypes",
  "LinkAccessGroupToOauth",
  "LinkData",
  "LinkTarget",
  "LinkUrl",
  "ListFiles",
  "ListNTPInstances",
  "LROStatus",
  "MergeContractMetadata",
  "MergeMetadata",
  "MetadataAuth",
  "NodeId",
  "Nodes",
  "NTPInstance",
  "Permission",
  "PlayoutOptions",
  "PlayoutPathResolution",
  "ProduceMetadataLinks",
  "Proofs",
  "PublicRep",
  "PublishContentVersion",
  "QParts",
  "RedeemCode",
  "RemoveAccessGroupManager",
  "RemoveAccessGroupMember",
  "RemoveContentObjectGroupPermission",
  "RemoveContentLibraryGroup",
  "RemoveLibraryContentType",
  "Rep",
  "ReplaceContractMetadata",
  "ReplaceMetadata",
  "Request",
  "ResetRegion",
  "SendFunds",
  "SetAccessCharge",
  "SetAuth",
  "SetAuthContext",
  "SetAuthPolicy",
  "SetContentLibraryImage",
  "SetContentObjectImage",
  "SetCustomContentContract",
  "SetGroupPermission",
  "SetNodes",
  "SetOauthToken",
  "SetPolicyAuthorization",
  "SetSignerFromOauthToken",
  "SetStaticToken",
  "SetVisibility",
  "SetPermission",
  "StartABRMezzanineJobs",
  "SuspendNTPInstance",
  "UnlinkAccessGroupFromOauth",
  "UpdateContentObjectGraph",
  "UpdateNTPInstance",
  "UploadFileData",
  "UploadFiles",
  "UploadFilesFromS3",
  "UploadJobStatus",
  "UploadPart",
  "UploadPartChunk",
  "UploadStatus",
  "UseRegion",
  "VerifyContentObject",
  "Visibility"
]
Source:

async PassRequest({request}) → object

Pass an ElvFrameRequest to the target and receive a ElvFrameResponse. Useful when acting as an intermediate between a contained app and a parent app.

Returns: The resultant ElvFrameResponse
Parameters:
Name Type Description
request object

An ElvFrameRequest

Examples
async PassRequest({
  "request": {
    "calledMethod": "ContentLibraries",
    "args": {},
    "type": "ElvFrameRequest",
    "requestId": 123
  },
  "Respond": "<function>"
});


{
  "type": "ElvFrameResponse",
  "requestId": 123,
  "response": [
    "ilibasP2Nff27BWoXJMuUevk2k7MoR6"
  ]
}
async PassRequest({
  "request": {
    "type": "ElvFrameRequest",
    "requestId": 1234,
    "calledMethod": "DownloadPart",
    "args": {
      "libraryId": "ilib3j1iarYtn2gs3T8t6wqgufwxgtNH",
      "objectId": "iq__2uKpqT1C2xtonWusjTUuJ7GrYVwg",
      "partHash": "hqp_8fUQ3kJWzWY62sTLwcirKQremLxuquS3ymLA8TEns7PVtmkZ",
      "chunked": true,
      "chunkSize": 10000,
      "callback": "<function>"
    },
    "callbackId": 321
  },
  "Respond": "<function>"
});


{
  "type": "ElvFrameResponse",
  "requestId": 1234
}
Source: