예제 #1
0
 async def device_id(self) -> str:
     """:return: the current device id"""
     c_future = tankerlib.tanker_device_id(self.c_tanker)
     c_voidp = await ffihelpers.handle_tanker_future(c_future)
     c_str = ffi.cast("char*", c_voidp)
     res = ffihelpers.c_string_to_str(c_str)
     tankerlib.tanker_free_buffer(c_str)
     return res
예제 #2
0
    async def generate_verification_key(self) -> str:
        """Generate a private unlock key

        This can be used to verify an indentity later on
        """
        c_future = tankerlib.tanker_generate_verification_key(self.c_tanker)
        c_voidp = await ffihelpers.handle_tanker_future(c_future)
        c_str = ffi.cast("char*", c_voidp)
        res = ffihelpers.c_string_to_str(c_str)
        tankerlib.tanker_free_buffer(c_str)
        return res
예제 #3
0
    async def set_verification_method(
            self,
            verification: Verification,
            options: Optional[VerificationOptions] = None) -> Optional[str]:
        """Set or update a verification method"""
        c_verification = CVerification(verification)
        if options:
            c_verif_opts = CVerificationOptions(
                with_session_token=options.with_session_token, ).get()
        else:
            c_verif_opts = ffi.NULL
        c_future = tankerlib.tanker_set_verification_method(
            self.c_tanker, c_verification.get(), c_verif_opts)

        c_voidp = await ffihelpers.handle_tanker_future(c_future)
        if c_voidp == ffi.NULL:
            return None
        c_str = ffi.cast("char*", c_voidp)
        res = ffihelpers.c_string_to_str(c_str)
        tankerlib.tanker_free_buffer(c_str)
        return res