security.odin 737 B

1234567891011121314151617181920212223242526
  1. //+build darwin
  2. package darwin
  3. foreign import security "system:Security.framework"
  4. // A reference to a random number generator.
  5. SecRandomRef :: distinct rawptr
  6. OSStatus :: distinct i32
  7. errSec :: enum OSStatus {
  8. Success = 0, // No error.
  9. Unimplemented = -4, // Function or operation not implemented.
  10. // Many more...
  11. }
  12. foreign security {
  13. // Synonym for nil, uses a cryptographically secure random number generator.
  14. kSecRandomDefault: SecRandomRef
  15. // Generates an array of cryptographically secure random bytes.
  16. SecRandomCopyBytes :: proc(rnd: SecRandomRef = kSecRandomDefault, count: uint, bytes: [^]byte) -> errSec ---
  17. SecCopyErrorMessageString :: proc(status: errSec, reserved: rawptr = nil) -> CFStringRef ---
  18. }