Implement `as_slice` for keys and nonce.