@dfinity/vetkeys - v0.1.0
    Preparing search index...

    An interface that maps EncryptedMaps calls to IC canister calls that will call the respective method of the backend EncryptedMaps. For example, get_user_rights will call the get_user_rights method of the backend EncryptedMaps.

    interface EncryptedMapsClient {
        get_accessible_shared_map_names(): Promise<[Principal, ByteBuf][]>;
        get_all_accessible_encrypted_maps(): Promise<EncryptedMapData[]>;
        get_all_accessible_encrypted_values(): Promise<
            [[Principal, ByteBuf], [ByteBuf, ByteBuf][]][],
        >;
        get_encrypted_value(
            mapOwner: Principal,
            mapName: ByteBuf,
            mapKey: ByteBuf,
        ): Promise<{ Ok: [] | [ByteBuf] } | { Err: string }>;
        get_encrypted_values_for_map(
            mapOwner: Principal,
            mapName: ByteBuf,
        ): Promise<{ Ok: [ByteBuf, ByteBuf][] } | { Err: string }>;
        get_encrypted_vetkey(
            mapOwner: Principal,
            mapName: ByteBuf,
            transportKey: ByteBuf,
        ): Promise<{ Ok: ByteBuf } | { Err: string }>;
        get_owned_non_empty_map_names(): Promise<ByteBuf[]>;
        get_shared_user_access_for_map(
            owner: Principal,
            mapName: ByteBuf,
        ): Promise<{ Ok: [Principal, AccessRights][] } | { Err: string }>;
        get_user_rights(
            owner: Principal,
            mapName: ByteBuf,
            user: Principal,
        ): Promise<{ Ok: [] | [AccessRights] } | { Err: string }>;
        get_vetkey_verification_key(): Promise<ByteBuf>;
        insert_encrypted_value(
            mapOwner: Principal,
            mapName: ByteBuf,
            mapKey: ByteBuf,
            data: ByteBuf,
        ): Promise<{ Ok: [] | [ByteBuf] } | { Err: string }>;
        remove_encrypted_value(
            mapOwner: Principal,
            mapName: ByteBuf,
            mapKey: ByteBuf,
        ): Promise<{ Ok: [] | [ByteBuf] } | { Err: string }>;
        remove_map_values(
            mapOwner: Principal,
            mapName: ByteBuf,
        ): Promise<{ Ok: ByteBuf[] } | { Err: string }>;
        remove_user(
            owner: Principal,
            mapName: ByteBuf,
            user: Principal,
        ): Promise<{ Ok: [] | [AccessRights] } | { Err: string }>;
        set_user_rights(
            owner: Principal,
            mapName: ByteBuf,
            user: Principal,
            userRights: AccessRights,
        ): Promise<{ Ok: [] | [AccessRights] } | { Err: string }>;
    }

    Implemented by

    Index

    Methods

    • Retrieves a list of maps that were shared with the user and the user still has access to.

      Returns Promise<[Principal, ByteBuf][]>

      Promise resolving to an array of [Principal, ByteBuf] pairs representing accessible map identifiers.

    • Retrieves an encrypted value from a map.

      Parameters

      • mapOwner: Principal

        The principal of the map owner

      • mapName: ByteBuf

        The name/identifier of the map

      • mapKey: ByteBuf

        The key to retrieve

      Returns Promise<{ Ok: [] | [ByteBuf] } | { Err: string }>

      Promise resolving to the encrypted value if it exists, or an error if the operation fails

    • Retrieves all encrypted values from a specific map.

      Parameters

      • mapOwner: Principal

        The principal of the map owner

      • mapName: ByteBuf

        The name/identifier of the map

      Returns Promise<{ Ok: [ByteBuf, ByteBuf][] } | { Err: string }>

      Promise resolving to an array of key-value pairs, or an error if the operation fails

    • Fetches an encrypted VetKey.

      Parameters

      • mapOwner: Principal

        The principal of the map owner

      • mapName: ByteBuf

        The name/identifier of the map

      • transportKey: ByteBuf

        The public transport key to use for encryption

      Returns Promise<{ Ok: ByteBuf } | { Err: string }>

      Promise resolving to the encrypted VetKey bytes, or an error if the operation fails

    • Retrieves a list of non-empty maps owned by the caller.

      Returns Promise<ByteBuf[]>

      Promise resolving to an array of map names

    • Gets all users that have access to a map and their access rights.

      Parameters

      • owner: Principal

        The principal of the map owner

      • mapName: ByteBuf

        The name/identifier of the map

      Returns Promise<{ Ok: [Principal, AccessRights][] } | { Err: string }>

      Promise resolving to an array of user-access rights pairs, or an error if the operation fails

    • Checks a user's access rights.

      Parameters

      • owner: Principal

        The principal of the map owner

      • mapName: ByteBuf

        The name/identifier of the map

      • user: Principal

        The principal of the user to check rights for

      Returns Promise<{ Ok: [] | [AccessRights] } | { Err: string }>

      Promise resolving to the user's access rights if they exist, or an error if the operation fails

    • Retrieves the public verification key for validating encrypted VetKeys.

      Returns Promise<ByteBuf>

      Promise resolving to the verification key bytes

    • Stores an encrypted value in a map.

      Parameters

      • mapOwner: Principal

        The principal of the map owner

      • mapName: ByteBuf

        The name/identifier of the map

      • mapKey: ByteBuf

        The key to store

      • data: ByteBuf

        The encrypted value to store

      Returns Promise<{ Ok: [] | [ByteBuf] } | { Err: string }>

      Promise resolving to the previous value if it existed, or an error if the operation fails

    • Removes a value from a map.

      Parameters

      • mapOwner: Principal

        The principal of the map owner

      • mapName: ByteBuf

        The name/identifier of the map

      • mapKey: ByteBuf

        The key to remove

      Returns Promise<{ Ok: [] | [ByteBuf] } | { Err: string }>

      Promise resolving to the removed value if it existed, or an error if the operation fails

    • Removes all values from a map.

      Parameters

      • mapOwner: Principal

        The principal of the map owner

      • mapName: ByteBuf

        The name/identifier of the map

      Returns Promise<{ Ok: ByteBuf[] } | { Err: string }>

      Promise resolving to an array of removed keys, or an error if the operation fails

    • Revokes a user's access.

      Parameters

      • owner: Principal

        The principal of the map owner

      • mapName: ByteBuf

        The name/identifier of the map

      • user: Principal

        The principal of the user to remove

      Returns Promise<{ Ok: [] | [AccessRights] } | { Err: string }>

      Promise resolving to the previous access rights if they existed, or an error if the operation fails

    • Grants or modifies access rights for a user.

      Parameters

      • owner: Principal

        The principal of the map owner

      • mapName: ByteBuf

        The name/identifier of the map

      • user: Principal

        The principal of the user to grant/modify rights for

      • userRights: AccessRights

        The access rights to grant

      Returns Promise<{ Ok: [] | [AccessRights] } | { Err: string }>

      Promise resolving to the previous access rights if they existed, or an error if the operation fails