SPB Git

spb/os-vault Public

Self-custody, multi-chain crypto wallet for macOS. One recovery phrase, six chain families, zero API keys — nothing leaves your Mac.

Swift 96% Shell 3.4% Makefile 0.6%
689 B · 24 lines objective-c
Raw Blame History
1// Copyright © 2017-2018 Trust.2//3// This file is part of Trust. The full Trust copyright notice, including4// terms governing use, modification, and redistribution, is contained in the5// file LICENSE at the root of the source code distribution tree.67@import Security;89uint32_t random32(void) {10    uint32_t value;11    if (SecRandomCopyBytes(kSecRandomDefault, sizeof(value), &value) != errSecSuccess) {12        // failed to generate random number13        abort();14    }15    return value;16}1718void random_buffer(uint8_t *buf, size_t len) {19    if (SecRandomCopyBytes(kSecRandomDefault, len, buf) != errSecSuccess) {20        // failed to generate random number21        abort();22    }23}24