Skip to content

Instantly share code, notes, and snippets.

debug_print(srtp_mod_aes_icm, "key: %s",
srtp_octet_string_hex_string(key, base_key_len));
debug_print(srtp_mod_aes_icm, "offset: %s", v128_hex_string(&c->offset));
static srtp_err_status_t srtp_hmac_compute(void *statev,
const uint8_t *message,
int msg_octets,
int tag_len,
uint8_t *result)
@schirrmacher
schirrmacher / DeviceCheck.swift
Last active March 9, 2020 13:25
DeviceCheck Example Implementation for Validating Device Authenticity on iOS
import Foundation
import RxSwift
import DeviceCheck
public struct Client {
private static func retrieveDeviceToken() -> Observable<String?> {
if #available(iOS 11.0, *) {
return Observable.create({ observer -> Disposable in
guard DCDevice.current.isSupported else {
@schirrmacher
schirrmacher / AppleDeviceCheckService.ts
Last active July 9, 2024 20:32
DeviceCheck Backend Example Implementation for Validating iOS Device Authenticity
import jwt from "jsonwebtoken";
import uuid from "uuid";
import config from "../../../config";
import { DeviceCheckService, DeviceCheckParams } from "./DeviceCheckService";
import BaseService from "./BaseService";
export class AppleDeviceCheckService extends BaseService implements DeviceCheckService {
@schirrmacher
schirrmacher / SafetyNetAttestation.kt
Created March 6, 2020 15:21
SafetyNet Attestation Example Implementation for Validating Device Authenticity on Android
import android.content.Context
import android.util.Base64
import com.google.android.gms.safetynet.SafetyNet
import inject.AppContext
import inject.modules.GoogleServicesModule.GoogleContext
import io.reactivex.Single
import java.io.ByteArrayOutputStream
import javax.inject.Inject
interface SecurityHelper {
@schirrmacher
schirrmacher / DeviceCheckCoordinator.ts
Last active May 27, 2021 13:17
Backend Implementation of Apple's DeviceCheck and Google's SafetyNet Attestation API
import BaseService from "./BaseService";
import BaseCoordinator from "./BaseCoordinator";
import { DeviceCheckParams, DeviceCheckService } from "./DeviceCheckService";
import { GoogleSafetyNetAttestationService } from "./GoogleSafetyNetAttestationService";
import { AppleDeviceCheckService } from "./AppleDeviceCheckService";
import * as UserAgentParser from "../helper/UserAgentParser";
export default class DeviceCheckCoordinator extends BaseCoordinator {
@schirrmacher
schirrmacher / GoogleSafetyNetAttestationService.ts
Last active June 14, 2023 09:53
SafetyNet Attestation Backend Example Implementation for Validating Android Device Authenticity
import moment = require("moment");
import config from "../../../config";
import BaseService from "../BaseService";
import { DeviceCheckService, DeviceCheckParams } from "./DeviceCheckService";
import { buildQueryParams } from "../helper/QueryHelper";
import { isSuccessStatus } from "../helper/ResponseHelper";
import { isTokenReplayed } from "../helper/DatabaseHelper";